summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UnoControls/source/controls/progressmonitor.cxx2
-rw-r--r--UnoControls/source/controls/statusindicator.cxx2
-rw-r--r--UnoControls/source/inc/progressbar.hxx2
-rw-r--r--accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx6
-rw-r--r--accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx3
-rw-r--r--accessibility/inc/accessibility/extended/accessiblelistbox.hxx2
-rw-r--r--accessibility/inc/accessibility/extended/accessibletabbarbase.hxx3
-rw-r--r--accessibility/inc/accessibility/extended/accessibletablistbox.hxx2
-rw-r--r--accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx2
-rw-r--r--accessibility/inc/accessibility/extended/listboxaccessible.hxx5
-rw-r--r--accessibility/inc/accessibility/extended/textwindowaccessibility.hxx2
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx3
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx3
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx8
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx3
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx3
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx5
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx13
-rw-r--r--accessibility/source/extended/AccessibleToolPanelDeck.cxx6
-rw-r--r--accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx4
-rw-r--r--accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx4
-rw-r--r--accessibility/source/extended/accessibleiconchoicectrl.cxx5
-rw-r--r--accessibility/source/extended/accessibleiconchoicectrlentry.cxx2
-rw-r--r--accessibility/source/extended/accessiblelistbox.cxx10
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx6
-rw-r--r--accessibility/source/helper/acc_factory.cxx4
-rw-r--r--accessibility/source/standard/vclxaccessiblebox.cxx24
-rw-r--r--accessibility/source/standard/vclxaccessiblebutton.cxx10
-rw-r--r--accessibility/source/standard/vclxaccessiblecheckbox.cxx4
-rw-r--r--accessibility/source/standard/vclxaccessiblecombobox.cxx9
-rw-r--r--accessibility/source/standard/vclxaccessibledropdowncombobox.cxx8
-rw-r--r--accessibility/source/standard/vclxaccessibledropdownlistbox.cxx9
-rw-r--r--accessibility/source/standard/vclxaccessibleedit.cxx8
-rw-r--r--accessibility/source/standard/vclxaccessiblelist.cxx22
-rw-r--r--accessibility/source/standard/vclxaccessiblelistbox.cxx12
-rw-r--r--accessibility/source/standard/vclxaccessibleradiobutton.cxx8
-rw-r--r--accessibility/source/standard/vclxaccessiblescrollbar.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessiblestatusbar.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessibletabcontrol.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessibletabpagewindow.cxx4
-rw-r--r--accessibility/source/standard/vclxaccessibletextcomponent.cxx4
-rw-r--r--accessibility/source/standard/vclxaccessibletextfield.cxx10
-rw-r--r--accessibility/source/standard/vclxaccessibletoolbox.cxx44
-rw-r--r--avmedia/inc/mediacontrol.hxx15
-rw-r--r--avmedia/source/framework/mediacontrol.cxx278
-rw-r--r--avmedia/source/framework/mediaplayer.cxx10
-rw-r--r--avmedia/source/framework/mediatoolbox.cxx11
-rw-r--r--avmedia/source/viewer/mediaevent_impl.cxx14
-rw-r--r--avmedia/source/viewer/mediaevent_impl.hxx3
-rw-r--r--avmedia/source/viewer/mediawindow.cxx7
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx32
-rw-r--r--avmedia/source/viewer/mediawindow_impl.hxx7
-rw-r--r--basctl/source/basicide/basdoc.cxx7
-rw-r--r--basctl/source/basicide/basdoc.hxx7
-rw-r--r--basctl/source/basicide/basicbox.cxx36
-rw-r--r--basctl/source/basicide/basicbox.hxx11
-rw-r--r--basctl/source/basicide/basicrenderable.cxx8
-rw-r--r--basctl/source/basicide/basicrenderable.hxx4
-rw-r--r--basctl/source/basicide/baside2.cxx79
-rw-r--r--basctl/source/basicide/baside2.hxx72
-rw-r--r--basctl/source/basicide/baside2b.cxx323
-rw-r--r--basctl/source/basicide/baside3.cxx26
-rw-r--r--basctl/source/basicide/basides1.cxx54
-rw-r--r--basctl/source/basicide/basides2.cxx14
-rw-r--r--basctl/source/basicide/basides3.cxx10
-rw-r--r--basctl/source/basicide/basidesh.cxx69
-rw-r--r--basctl/source/basicide/basobj2.cxx10
-rw-r--r--basctl/source/basicide/basobj3.cxx8
-rw-r--r--basctl/source/basicide/bastype2.cxx9
-rw-r--r--basctl/source/basicide/bastype2.hxx1
-rw-r--r--basctl/source/basicide/bastypes.cxx39
-rw-r--r--basctl/source/basicide/brkdlg.cxx16
-rw-r--r--basctl/source/basicide/brkdlg.hxx14
-rw-r--r--basctl/source/basicide/layout.cxx31
-rw-r--r--basctl/source/basicide/layout.hxx13
-rw-r--r--basctl/source/basicide/linenumberwindow.cxx10
-rw-r--r--basctl/source/basicide/linenumberwindow.hxx3
-rw-r--r--basctl/source/basicide/macrodlg.cxx25
-rw-r--r--basctl/source/basicide/macrodlg.hxx29
-rw-r--r--basctl/source/basicide/moduldl2.cxx94
-rw-r--r--basctl/source/basicide/moduldlg.cxx81
-rw-r--r--basctl/source/basicide/moduldlg.hxx66
-rw-r--r--basctl/source/basicide/objdlg.cxx49
-rw-r--r--basctl/source/basicide/objdlg.hxx7
-rw-r--r--basctl/source/basicide/tbxctl.cxx2
-rw-r--r--basctl/source/basicide/tbxctl.hxx2
-rw-r--r--basctl/source/dlged/managelang.cxx36
-rw-r--r--basctl/source/dlged/propbrw.cxx6
-rw-r--r--basctl/source/inc/accessibledialogcontrolshape.hxx3
-rw-r--r--basctl/source/inc/accessibledialogwindow.hxx3
-rw-r--r--basctl/source/inc/baside3.hxx8
-rw-r--r--basctl/source/inc/basidesh.hxx30
-rw-r--r--basctl/source/inc/bastypes.hxx10
-rw-r--r--basctl/source/inc/dlged.hxx5
-rw-r--r--basctl/source/inc/managelang.hxx23
-rw-r--r--basctl/source/inc/propbrw.hxx1
-rw-r--r--basic/source/runtime/inputbox.cxx65
-rw-r--r--basic/source/runtime/iosys.cxx44
-rw-r--r--basic/source/runtime/methods.cxx12
-rw-r--r--canvas/source/cairo/cairo_canvasfont.cxx2
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx4
-rw-r--r--canvas/source/cairo/cairo_canvashelper.hxx4
-rw-r--r--canvas/source/cairo/cairo_canvashelper_text.cxx4
-rw-r--r--canvas/source/cairo/cairo_devicehelper.cxx2
-rw-r--r--canvas/source/cairo/cairo_devicehelper.hxx2
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx10
-rw-r--r--canvas/source/directx/dx_9rm.cxx3
-rw-r--r--canvas/source/directx/dx_devicehelper.cxx6
-rw-r--r--canvas/source/directx/dx_devicehelper.hxx5
-rw-r--r--canvas/source/opengl/ogl_canvashelper.cxx12
-rw-r--r--canvas/source/vcl/backbuffer.cxx12
-rw-r--r--canvas/source/vcl/backbuffer.hxx3
-rw-r--r--canvas/source/vcl/bitmapbackbuffer.cxx7
-rw-r--r--canvas/source/vcl/bitmapbackbuffer.hxx2
-rw-r--r--canvas/source/vcl/canvasfont.cxx6
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx14
-rw-r--r--canvas/source/vcl/impltools.hxx2
-rw-r--r--canvas/source/vcl/spritecanvashelper.cxx10
-rw-r--r--canvas/source/vcl/spritecanvashelper.hxx4
-rw-r--r--canvas/source/vcl/textlayout.cxx26
-rw-r--r--chart2/inc/ChartModel.hxx2
-rw-r--r--chart2/source/controller/accessibility/AccessibleViewForwarder.hxx3
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.hxx4
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx74
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.hxx5
-rw-r--r--chart2/source/controller/dialogs/TextDirectionListBox.cxx4
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.cxx11
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx4
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.cxx16
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx14
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.cxx10
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.cxx21
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx17
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx4
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx4
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.cxx4
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.hxx3
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx8
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.cxx21
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.hxx4
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx8
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.hxx38
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.hxx46
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx13
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx9
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx14
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx15
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx26
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx28
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.cxx32
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.hxx37
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.cxx28
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.hxx40
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx82
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hxx7
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.hxx3
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx27
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hxx41
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.cxx4
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.cxx16
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.hxx6
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.cxx13
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.hxx3
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx16
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hxx15
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.cxx20
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hxx29
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx39
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.hxx68
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx25
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hxx37
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.cxx26
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.hxx19
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.hxx3
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx13
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx8
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx6
-rw-r--r--chart2/source/controller/inc/TextDirectionListBox.hxx1
-rw-r--r--chart2/source/controller/inc/dlg_ChartType.hxx3
-rw-r--r--chart2/source/controller/inc/dlg_ChartType_UNO.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard.hxx5
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_DataEditor.hxx5
-rw-r--r--chart2/source/controller/inc/dlg_DataSource.hxx9
-rw-r--r--chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx14
-rw-r--r--chart2/source/controller/inc/dlg_InsertDataLabel.hxx3
-rw-r--r--chart2/source/controller/inc/dlg_InsertErrorBars.hxx1
-rw-r--r--chart2/source/controller/inc/dlg_ObjectProperties.hxx1
-rw-r--r--chart2/source/controller/inc/dlg_View3D.hxx9
-rw-r--r--chart2/source/controller/inc/res_ErrorBar.hxx54
-rw-r--r--chart2/source/controller/inc/res_LegendPosition.hxx10
-rw-r--r--chart2/source/controller/inc/res_Titles.hxx28
-rw-r--r--chart2/source/controller/main/ChartController.cxx10
-rw-r--r--chart2/source/controller/main/ChartController.hxx2
-rw-r--r--chart2/source/controller/main/ChartController_EditData.cxx7
-rw-r--r--chart2/source/controller/main/ChartController_Insert.cxx64
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx19
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx12
-rw-r--r--chart2/source/controller/main/ChartWindow.hxx3
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx6
-rw-r--r--chart2/source/controller/main/ElementSelector.hxx3
-rw-r--r--chart2/source/controller/main/ShapeController.cxx24
-rw-r--r--chart2/source/controller/main/ShapeToolbarController.cxx2
-rw-r--r--chart2/source/inc/chartview/DrawModelWrapper.hxx2
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx2
-rw-r--r--chart2/source/view/inc/GL3DBarChart.hxx2
-rw-r--r--chart2/source/view/main/3DChartObjects.cxx16
-rw-r--r--chart2/source/view/main/ChartView.cxx2
-rw-r--r--chart2/source/view/main/DrawModelWrapper.cxx4
-rw-r--r--chart2/source/view/main/DummyXShape.cxx16
-rw-r--r--chart2/source/view/main/OpenGLRender.cxx16
-rw-r--r--compilerplugins/clang/vclwidgets.cxx458
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx2
-rw-r--r--cppcanvas/qa/unit/test.cxx2
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx12
-rw-r--r--cppcanvas/source/mtfrenderer/transparencygroupaction.cxx12
-rw-r--r--cui/source/customize/acccfg.cxx31
-rw-r--r--cui/source/customize/cfg.cxx250
-rw-r--r--cui/source/customize/cfgutil.cxx13
-rw-r--r--cui/source/customize/eventdlg.cxx7
-rw-r--r--cui/source/customize/eventdlg.hxx3
-rw-r--r--cui/source/customize/macropg.cxx82
-rw-r--r--cui/source/customize/macropg_impl.hxx13
-rw-r--r--cui/source/customize/selector.cxx25
-rw-r--r--cui/source/dialogs/SpellDialog.cxx59
-rw-r--r--cui/source/dialogs/about.cxx23
-rw-r--r--cui/source/dialogs/colorpicker.cxx104
-rw-r--r--cui/source/dialogs/cuicharmap.cxx25
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx45
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx120
-rw-r--r--cui/source/dialogs/cuigrfflt.cxx72
-rw-r--r--cui/source/dialogs/cuihyperdlg.cxx10
-rw-r--r--cui/source/dialogs/cuiimapwnd.cxx15
-rw-r--r--cui/source/dialogs/cuitbxform.cxx11
-rw-r--r--cui/source/dialogs/dlgname.cxx48
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx191
-rw-r--r--cui/source/dialogs/hldocntp.cxx31
-rw-r--r--cui/source/dialogs/hldoctp.cxx17
-rw-r--r--cui/source/dialogs/hlinettp.cxx23
-rw-r--r--cui/source/dialogs/hlmailtp.cxx16
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx21
-rw-r--r--cui/source/dialogs/hltpbase.cxx30
-rw-r--r--cui/source/dialogs/hyphen.cxx15
-rw-r--r--cui/source/dialogs/iconcdlg.cxx46
-rw-r--r--cui/source/dialogs/insdlg.cxx54
-rw-r--r--cui/source/dialogs/insrc.cxx22
-rw-r--r--cui/source/dialogs/linkdlg.cxx24
-rw-r--r--cui/source/dialogs/multipat.cxx41
-rw-r--r--cui/source/dialogs/newtabledlg.cxx15
-rw-r--r--cui/source/dialogs/passwdomdlg.cxx30
-rw-r--r--cui/source/dialogs/pastedlg.cxx17
-rw-r--r--cui/source/dialogs/postdlg.cxx13
-rw-r--r--cui/source/dialogs/scriptdlg.cxx69
-rw-r--r--cui/source/dialogs/showcols.cxx11
-rw-r--r--cui/source/dialogs/splitcelldlg.cxx32
-rw-r--r--cui/source/dialogs/srchxtra.cxx32
-rw-r--r--cui/source/dialogs/thesdlg.cxx55
-rw-r--r--cui/source/dialogs/zoom.cxx23
-rw-r--r--cui/source/factory/cuiexp.cxx29
-rw-r--r--cui/source/factory/dlgfact.cxx163
-rw-r--r--cui/source/factory/dlgfact.hxx8
-rw-r--r--cui/source/factory/init.cxx2
-rw-r--r--cui/source/inc/ControlFocusHelper.hxx4
-rw-r--r--cui/source/inc/SpellDialog.hxx42
-rw-r--r--cui/source/inc/about.hxx16
-rw-r--r--cui/source/inc/acccfg.hxx27
-rw-r--r--cui/source/inc/align.hxx55
-rw-r--r--cui/source/inc/autocdlg.hxx141
-rw-r--r--cui/source/inc/backgrnd.hxx61
-rw-r--r--cui/source/inc/border.hxx69
-rw-r--r--cui/source/inc/cfg.hxx82
-rw-r--r--cui/source/inc/cfgutil.hxx4
-rw-r--r--cui/source/inc/chardlg.hxx194
-rw-r--r--cui/source/inc/connect.hxx28
-rw-r--r--cui/source/inc/cuicharmap.hxx24
-rw-r--r--cui/source/inc/cuifmsearch.hxx55
-rw-r--r--cui/source/inc/cuigaldlg.hxx78
-rw-r--r--cui/source/inc/cuigrfflt.hxx34
-rw-r--r--cui/source/inc/cuihyperdlg.hxx3
-rw-r--r--cui/source/inc/cuiimapwnd.hxx12
-rw-r--r--cui/source/inc/cuioptgenrl.hxx7
-rw-r--r--cui/source/inc/cuisrchdlg.hxx6
-rw-r--r--cui/source/inc/cuitabarea.hxx297
-rw-r--r--cui/source/inc/cuitabline.hxx117
-rw-r--r--cui/source/inc/cuitbxform.hxx4
-rw-r--r--cui/source/inc/dbregister.hxx14
-rw-r--r--cui/source/inc/dlgname.hxx30
-rw-r--r--cui/source/inc/dstribut.hxx28
-rw-r--r--cui/source/inc/grfpage.hxx45
-rw-r--r--cui/source/inc/hangulhanjadlg.hxx100
-rw-r--r--cui/source/inc/headertablistbox.hxx10
-rw-r--r--cui/source/inc/hldocntp.hxx13
-rw-r--r--cui/source/inc/hldoctp.hxx15
-rw-r--r--cui/source/inc/hlinettp.hxx23
-rw-r--r--cui/source/inc/hlmailtp.hxx13
-rw-r--r--cui/source/inc/hlmarkwn.hxx13
-rw-r--r--cui/source/inc/hltpbase.hxx15
-rw-r--r--cui/source/inc/hyphen.hxx17
-rw-r--r--cui/source/inc/iconcdlg.hxx32
-rw-r--r--cui/source/inc/insdlg.hxx55
-rw-r--r--cui/source/inc/insrc.hxx12
-rw-r--r--cui/source/inc/labdlg.hxx24
-rw-r--r--cui/source/inc/linkdlg.hxx21
-rw-r--r--cui/source/inc/macroass.hxx3
-rw-r--r--cui/source/inc/macropg.hxx1
-rw-r--r--cui/source/inc/measure.hxx37
-rw-r--r--cui/source/inc/multipat.hxx14
-rw-r--r--cui/source/inc/newtabledlg.hxx8
-rw-r--r--cui/source/inc/numfmt.hxx63
-rw-r--r--cui/source/inc/numpages.hxx168
-rw-r--r--cui/source/inc/optasian.hxx32
-rw-r--r--cui/source/inc/optdict.hxx29
-rw-r--r--cui/source/inc/optlingu.hxx40
-rw-r--r--cui/source/inc/optpath.hxx11
-rw-r--r--cui/source/inc/page.hxx63
-rw-r--r--cui/source/inc/paragrph.hxx140
-rw-r--r--cui/source/inc/passwdomdlg.hxx1
-rw-r--r--cui/source/inc/pastedlg.hxx9
-rw-r--r--cui/source/inc/postdlg.hxx15
-rw-r--r--cui/source/inc/radiobtnbox.hxx1
-rw-r--r--cui/source/inc/scriptdlg.hxx20
-rw-r--r--cui/source/inc/selector.hxx20
-rw-r--r--cui/source/inc/showcols.hxx6
-rw-r--r--cui/source/inc/splitcelldlg.hxx13
-rw-r--r--cui/source/inc/srchxtra.hxx17
-rw-r--r--cui/source/inc/swpossizetabpage.hxx55
-rw-r--r--cui/source/inc/tabstpge.hxx58
-rw-r--r--cui/source/inc/textanim.hxx39
-rw-r--r--cui/source/inc/textattr.hxx36
-rw-r--r--cui/source/inc/thesdlg.hxx24
-rw-r--r--cui/source/inc/transfrm.hxx69
-rw-r--r--cui/source/inc/treeopt.hxx12
-rw-r--r--cui/source/inc/zoom.hxx27
-rw-r--r--cui/source/options/certpath.cxx13
-rw-r--r--cui/source/options/certpath.hxx9
-rw-r--r--cui/source/options/connpooloptions.cxx20
-rw-r--r--cui/source/options/connpooloptions.hxx24
-rw-r--r--cui/source/options/cuisrchdlg.cxx16
-rw-r--r--cui/source/options/dbregister.cxx36
-rw-r--r--cui/source/options/doclinkdialog.cxx26
-rw-r--r--cui/source/options/doclinkdialog.hxx10
-rw-r--r--cui/source/options/fontsubs.cxx27
-rw-r--r--cui/source/options/fontsubs.hxx25
-rw-r--r--cui/source/options/optaboutconfig.cxx30
-rw-r--r--cui/source/options/optaboutconfig.hxx18
-rw-r--r--cui/source/options/optaccessibility.cxx20
-rw-r--r--cui/source/options/optaccessibility.hxx24
-rw-r--r--cui/source/options/optasian.cxx24
-rw-r--r--cui/source/options/optbasic.cxx16
-rw-r--r--cui/source/options/optbasic.hxx15
-rw-r--r--cui/source/options/optchart.cxx34
-rw-r--r--cui/source/options/optchart.hxx13
-rw-r--r--cui/source/options/optcolor.cxx157
-rw-r--r--cui/source/options/optcolor.hxx11
-rw-r--r--cui/source/options/optctl.cxx16
-rw-r--r--cui/source/options/optctl.hxx20
-rw-r--r--cui/source/options/optdict.cxx41
-rw-r--r--cui/source/options/optfltr.cxx42
-rw-r--r--cui/source/options/optfltr.hxx37
-rw-r--r--cui/source/options/optgdlg.cxx82
-rw-r--r--cui/source/options/optgdlg.hxx99
-rw-r--r--cui/source/options/optgenrl.cxx21
-rw-r--r--cui/source/options/opthtml.cxx28
-rw-r--r--cui/source/options/opthtml.hxx41
-rw-r--r--cui/source/options/optinet2.cxx91
-rw-r--r--cui/source/options/optinet2.hxx86
-rw-r--r--cui/source/options/optjava.cxx83
-rw-r--r--cui/source/options/optjava.hxx47
-rw-r--r--cui/source/options/optjsearch.cxx29
-rw-r--r--cui/source/options/optjsearch.hxx50
-rw-r--r--cui/source/options/optlingu.cxx78
-rw-r--r--cui/source/options/optmemory.cxx19
-rw-r--r--cui/source/options/optmemory.hxx17
-rw-r--r--cui/source/options/optopencl.cxx65
-rw-r--r--cui/source/options/optopencl.hxx43
-rw-r--r--cui/source/options/optpath.cxx31
-rw-r--r--cui/source/options/optsave.cxx33
-rw-r--r--cui/source/options/optsave.hxx41
-rw-r--r--cui/source/options/optupdt.cxx27
-rw-r--r--cui/source/options/optupdt.hxx23
-rw-r--r--cui/source/options/personalization.cxx45
-rw-r--r--cui/source/options/personalization.hxx37
-rw-r--r--cui/source/options/radiobtnbox.cxx4
-rw-r--r--cui/source/options/securityoptions.cxx13
-rw-r--r--cui/source/options/securityoptions.hxx17
-rw-r--r--cui/source/options/treeopt.cxx53
-rw-r--r--cui/source/options/tsaurls.cxx11
-rw-r--r--cui/source/options/tsaurls.hxx10
-rw-r--r--cui/source/options/webconninfo.cxx12
-rw-r--r--cui/source/options/webconninfo.hxx9
-rw-r--r--cui/source/tabpages/align.cxx36
-rw-r--r--cui/source/tabpages/autocdlg.cxx198
-rw-r--r--cui/source/tabpages/backgrnd.cxx66
-rw-r--r--cui/source/tabpages/border.cxx42
-rw-r--r--cui/source/tabpages/chardlg.cxx153
-rw-r--r--cui/source/tabpages/connect.cxx42
-rw-r--r--cui/source/tabpages/dstribut.cxx38
-rw-r--r--cui/source/tabpages/grfpage.cxx45
-rw-r--r--cui/source/tabpages/labdlg.cxx26
-rw-r--r--cui/source/tabpages/macroass.cxx32
-rw-r--r--cui/source/tabpages/measure.cxx41
-rw-r--r--cui/source/tabpages/numfmt.cxx52
-rw-r--r--cui/source/tabpages/numpages.cxx154
-rw-r--r--cui/source/tabpages/page.cxx42
-rw-r--r--cui/source/tabpages/paragrph.cxx99
-rw-r--r--cui/source/tabpages/swpossizetabpage.cxx45
-rw-r--r--cui/source/tabpages/tabarea.cxx4
-rw-r--r--cui/source/tabpages/tabline.cxx6
-rw-r--r--cui/source/tabpages/tabstpge.cxx41
-rw-r--r--cui/source/tabpages/textanim.cxx34
-rw-r--r--cui/source/tabpages/textattr.cxx37
-rw-r--r--cui/source/tabpages/tparea.cxx82
-rw-r--r--cui/source/tabpages/tpbitmap.cxx55
-rw-r--r--cui/source/tabpages/tpcolor.cxx79
-rw-r--r--cui/source/tabpages/tpgradnt.cxx58
-rw-r--r--cui/source/tabpages/tphatch.cxx51
-rw-r--r--cui/source/tabpages/tpline.cxx67
-rw-r--r--cui/source/tabpages/tplnedef.cxx62
-rw-r--r--cui/source/tabpages/tplneend.cxx63
-rw-r--r--cui/source/tabpages/tpshadow.cxx23
-rw-r--r--cui/source/tabpages/transfrm.cxx76
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx1
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationdialog.cxx4
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationpages.cxx64
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationpages.hxx43
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationwizard.cxx6
-rw-r--r--dbaccess/source/ext/macromigration/rangeprogressbar.hxx2
-rw-r--r--dbaccess/source/ui/app/AppController.cxx13
-rw-r--r--dbaccess/source/ui/app/AppControllerDnD.cxx23
-rw-r--r--dbaccess/source/ui/app/AppControllerGen.cxx14
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx150
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.hxx19
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx146
-rw-r--r--dbaccess/source/ui/app/AppDetailView.hxx24
-rw-r--r--dbaccess/source/ui/app/AppIconControl.cxx7
-rw-r--r--dbaccess/source/ui/app/AppIconControl.hxx1
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.cxx44
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.hxx10
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.cxx33
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.hxx9
-rw-r--r--dbaccess/source/ui/app/AppView.cxx41
-rw-r--r--dbaccess/source/ui/app/AppView.hxx10
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.cxx1
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx26
-rw-r--r--dbaccess/source/ui/browser/brwview.cxx34
-rw-r--r--dbaccess/source/ui/browser/dataview.cxx28
-rw-r--r--dbaccess/source/ui/browser/dbtreeview.cxx11
-rw-r--r--dbaccess/source/ui/browser/dbtreeview.hxx3
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx13
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx32
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx4
-rw-r--r--dbaccess/source/ui/control/ColumnControlWindow.cxx5
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx155
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx11
-rw-r--r--dbaccess/source/ui/control/TableGrantCtrl.cxx14
-rw-r--r--dbaccess/source/ui/control/VertSplitView.cxx10
-rw-r--r--dbaccess/source/ui/control/charsetlistbox.cxx4
-rw-r--r--dbaccess/source/ui/control/curledit.cxx17
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx6
-rw-r--r--dbaccess/source/ui/control/marktree.cxx7
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx7
-rw-r--r--dbaccess/source/ui/control/toolboxcontroller.cxx6
-rw-r--r--dbaccess/source/ui/dlg/CollectionView.cxx17
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx37
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.hxx10
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx24
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.hxx27
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPageSetup.cxx28
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPageSetup.hxx17
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx186
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx138
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.hxx3
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.hxx27
-rw-r--r--dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx9
-rw-r--r--dbaccess/source/ui/dlg/RelationDlg.cxx24
-rw-r--r--dbaccess/source/ui/dlg/TablesSingleDlg.cxx8
-rw-r--r--dbaccess/source/ui/dlg/TextConnectionHelper.cxx26
-rw-r--r--dbaccess/source/ui/dlg/TextConnectionHelper.hxx39
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.cxx85
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.hxx13
-rw-r--r--dbaccess/source/ui/dlg/UserAdminDlg.cxx8
-rw-r--r--dbaccess/source/ui/dlg/admincontrols.cxx18
-rw-r--r--dbaccess/source/ui/dlg/admincontrols.hxx26
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx16
-rw-r--r--dbaccess/source/ui/dlg/adminpages.hxx2
-rw-r--r--dbaccess/source/ui/dlg/adtabdlg.cxx12
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx65
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx58
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx7
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.cxx19
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.hxx20
-rw-r--r--dbaccess/source/ui/dlg/dbwiz.cxx18
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx31
-rw-r--r--dbaccess/source/ui/dlg/detailpages.cxx192
-rw-r--r--dbaccess/source/ui/dlg/detailpages.hxx98
-rw-r--r--dbaccess/source/ui/dlg/directsql.cxx18
-rw-r--r--dbaccess/source/ui/dlg/dlgattr.cxx7
-rw-r--r--dbaccess/source/ui/dlg/dlgsave.cxx22
-rw-r--r--dbaccess/source/ui/dlg/dlgsize.cxx13
-rw-r--r--dbaccess/source/ui/dlg/dsselect.cxx10
-rw-r--r--dbaccess/source/ui/dlg/dsselect.hxx10
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx30
-rw-r--r--dbaccess/source/ui/dlg/generalpage.hxx27
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx38
-rw-r--r--dbaccess/source/ui/dlg/indexfieldscontrol.cxx13
-rw-r--r--dbaccess/source/ui/dlg/paramdialog.cxx12
-rw-r--r--dbaccess/source/ui/dlg/queryfilter.cxx17
-rw-r--r--dbaccess/source/ui/dlg/queryorder.cxx14
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx82
-rw-r--r--dbaccess/source/ui/dlg/tablespage.cxx14
-rw-r--r--dbaccess/source/ui/dlg/tablespage.hxx7
-rw-r--r--dbaccess/source/ui/dlg/textconnectionsettings.cxx10
-rw-r--r--dbaccess/source/ui/inc/CollectionView.hxx14
-rw-r--r--dbaccess/source/ui/inc/ColumnControlWindow.hxx1
-rw-r--r--dbaccess/source/ui/inc/ConnectionLine.hxx5
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineAccess.hxx3
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx75
-rw-r--r--dbaccess/source/ui/inc/JAccess.hxx3
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx2
-rw-r--r--dbaccess/source/ui/inc/JoinDesignView.hxx5
-rw-r--r--dbaccess/source/ui/inc/JoinTableView.hxx35
-rw-r--r--dbaccess/source/ui/inc/LimitBox.hxx1
-rw-r--r--dbaccess/source/ui/inc/QueryDesignView.hxx9
-rw-r--r--dbaccess/source/ui/inc/QueryPropertiesDialog.hxx8
-rw-r--r--dbaccess/source/ui/inc/QueryTableView.hxx3
-rw-r--r--dbaccess/source/ui/inc/QueryTextView.hxx3
-rw-r--r--dbaccess/source/ui/inc/QueryViewSwitch.hxx4
-rw-r--r--dbaccess/source/ui/inc/RelationControl.hxx6
-rw-r--r--dbaccess/source/ui/inc/RelationDesignView.hxx1
-rw-r--r--dbaccess/source/ui/inc/RelationDlg.hxx21
-rw-r--r--dbaccess/source/ui/inc/RelationTableView.hxx5
-rw-r--r--dbaccess/source/ui/inc/TableConnection.hxx3
-rw-r--r--dbaccess/source/ui/inc/TableDesignControl.hxx1
-rw-r--r--dbaccess/source/ui/inc/TableDesignHelpBar.hxx3
-rw-r--r--dbaccess/source/ui/inc/TableDesignView.hxx10
-rw-r--r--dbaccess/source/ui/inc/TableFieldDescription.hxx3
-rw-r--r--dbaccess/source/ui/inc/TableGrantCtrl.hxx5
-rw-r--r--dbaccess/source/ui/inc/TableWindow.hxx11
-rw-r--r--dbaccess/source/ui/inc/TableWindowAccess.hxx3
-rw-r--r--dbaccess/source/ui/inc/TableWindowListBox.hxx5
-rw-r--r--dbaccess/source/ui/inc/TableWindowTitle.hxx3
-rw-r--r--dbaccess/source/ui/inc/TablesSingleDlg.hxx1
-rw-r--r--dbaccess/source/ui/inc/TokenWriter.hxx2
-rw-r--r--dbaccess/source/ui/inc/UserAdminDlg.hxx1
-rw-r--r--dbaccess/source/ui/inc/VertSplitView.hxx7
-rw-r--r--dbaccess/source/ui/inc/WCPage.hxx23
-rw-r--r--dbaccess/source/ui/inc/WColumnSelect.hxx13
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx11
-rw-r--r--dbaccess/source/ui/inc/WExtendPages.hxx8
-rw-r--r--dbaccess/source/ui/inc/WNameMatch.hxx22
-rw-r--r--dbaccess/source/ui/inc/WTabPage.hxx4
-rw-r--r--dbaccess/source/ui/inc/WTypeSelect.hxx24
-rw-r--r--dbaccess/source/ui/inc/adtabdlg.hxx13
-rw-r--r--dbaccess/source/ui/inc/advancedsettingsdlg.hxx1
-rw-r--r--dbaccess/source/ui/inc/brwview.hxx11
-rw-r--r--dbaccess/source/ui/inc/charsetlistbox.hxx1
-rw-r--r--dbaccess/source/ui/inc/curledit.hxx3
-rw-r--r--dbaccess/source/ui/inc/datasourceconnector.hxx7
-rw-r--r--dbaccess/source/ui/inc/dbadmin.hxx1
-rw-r--r--dbaccess/source/ui/inc/dbtreelistbox.hxx1
-rw-r--r--dbaccess/source/ui/inc/dbwiz.hxx3
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx9
-rw-r--r--dbaccess/source/ui/inc/directsql.hxx15
-rw-r--r--dbaccess/source/ui/inc/dlgattr.hxx1
-rw-r--r--dbaccess/source/ui/inc/dlgsave.hxx1
-rw-r--r--dbaccess/source/ui/inc/dlgsize.hxx6
-rw-r--r--dbaccess/source/ui/inc/indexdialog.hxx19
-rw-r--r--dbaccess/source/ui/inc/indexfieldscontrol.hxx5
-rw-r--r--dbaccess/source/ui/inc/linkeddocuments.hxx3
-rw-r--r--dbaccess/source/ui/inc/marktree.hxx1
-rw-r--r--dbaccess/source/ui/inc/paramdialog.hxx11
-rw-r--r--dbaccess/source/ui/inc/querycontainerwindow.hxx5
-rw-r--r--dbaccess/source/ui/inc/queryfilter.hxx23
-rw-r--r--dbaccess/source/ui/inc/queryorder.hxx19
-rw-r--r--dbaccess/source/ui/inc/queryview.hxx1
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hxx5
-rw-r--r--dbaccess/source/ui/inc/sqledit.hxx3
-rw-r--r--dbaccess/source/ui/inc/sqlmessage.hxx7
-rw-r--r--dbaccess/source/ui/inc/textconnectionsettings.hxx5
-rw-r--r--dbaccess/source/ui/inc/undosqledit.hxx3
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx10
-rw-r--r--dbaccess/source/ui/inc/unosqlmessage.hxx2
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx24
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx4
-rw-r--r--dbaccess/source/ui/misc/ToolBoxHelper.cxx2
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx31
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx19
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx23
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx46
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx16
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx58
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx4
-rw-r--r--dbaccess/source/ui/misc/singledoccontroller.cxx1
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx14
-rw-r--r--dbaccess/source/ui/querydesign/JoinController.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/JoinDesignView.cxx14
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx85
-rw-r--r--dbaccess/source/ui/querydesign/LimitBox.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/QTableConnection.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/QTableConnection.hxx1
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.cxx10
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.hxx1
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx3
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx105
-rw-r--r--dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx2
-rw-r--r--dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx19
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx10
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx6
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx92
-rw-r--r--dbaccess/source/ui/querydesign/QueryTextView.cxx11
-rw-r--r--dbaccess/source/ui/querydesign/QueryViewSwitch.cxx12
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx43
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx15
-rw-r--r--dbaccess/source/ui/querydesign/TableConnection.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldDescription.cxx1
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx48
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowAccess.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowListBox.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowTitle.cxx14
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.cxx10
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.hxx3
-rw-r--r--dbaccess/source/ui/querydesign/querycontainerwindow.cxx15
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx38
-rw-r--r--dbaccess/source/ui/querydesign/querydlg.cxx11
-rw-r--r--dbaccess/source/ui/querydesign/querydlg.hxx11
-rw-r--r--dbaccess/source/ui/querydesign/queryview.cxx5
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnection.cxx4
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnection.hxx1
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx12
-rw-r--r--dbaccess/source/ui/relationdesign/RelationDesignView.cxx6
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx61
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx12
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx3
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx23
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.hxx13
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx58
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignControl.cxx5
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx11
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignView.cxx55
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx27
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx7
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.hxx7
-rw-r--r--dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx7
-rw-r--r--dbaccess/source/ui/uno/ColumnPeer.cxx13
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlg.cxx5
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlg.hxx2
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx6
-rw-r--r--dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx2
-rw-r--r--dbaccess/source/ui/uno/TableFilterDlg.cxx5
-rw-r--r--dbaccess/source/ui/uno/TableFilterDlg.hxx2
-rw-r--r--dbaccess/source/ui/uno/UserSettingsDlg.cxx5
-rw-r--r--dbaccess/source/ui/uno/UserSettingsDlg.hxx2
-rw-r--r--dbaccess/source/ui/uno/admindlg.cxx5
-rw-r--r--dbaccess/source/ui/uno/admindlg.hxx2
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.cxx16
-rw-r--r--dbaccess/source/ui/uno/composerdialogs.hxx8
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx8
-rw-r--r--dbaccess/source/ui/uno/dbinteraction.cxx16
-rw-r--r--dbaccess/source/ui/uno/textconnectionsettings_uno.cxx6
-rw-r--r--dbaccess/source/ui/uno/unoDirectSql.cxx4
-rw-r--r--dbaccess/source/ui/uno/unoDirectSql.hxx2
-rw-r--r--dbaccess/source/ui/uno/unosqlmessage.cxx6
-rw-r--r--desktop/source/app/app.cxx10
-rw-r--r--desktop/source/app/cmdlinehelp.hxx8
-rw-r--r--desktop/source/app/lockfile2.cxx12
-rw-r--r--desktop/source/deployment/gui/dp_gui_dependencydialog.cxx10
-rw-r--r--desktop/source/deployment/gui/dp_gui_dependencydialog.hxx4
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.cxx111
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.hxx44
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx28
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx24
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.hxx7
-rw-r--r--desktop/source/deployment/gui/dp_gui_service.cxx5
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.cxx23
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.hxx6
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx27
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.hxx33
-rw-r--r--desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx17
-rw-r--r--desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx15
-rw-r--r--desktop/source/deployment/gui/license_dialog.cxx41
-rw-r--r--desktop/source/lib/init.cxx22
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_misc.cxx8
-rw-r--r--desktop/source/splash/splash.cxx141
-rw-r--r--drawinglayer/source/primitive2d/controlprimitive2d.cxx8
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx48
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx6
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.cxx10
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.hxx6
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx40
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.hxx3
-rw-r--r--drawinglayer/source/tools/converters.cxx24
-rw-r--r--editeng/source/editeng/editeng.cxx4
-rw-r--r--editeng/source/editeng/impedit.cxx2
-rw-r--r--editeng/source/editeng/impedit.hxx19
-rw-r--r--editeng/source/editeng/impedit2.cxx6
-rw-r--r--editeng/source/editeng/impedit3.cxx2
-rw-r--r--editeng/source/editeng/textconv.hxx3
-rw-r--r--editeng/source/items/svxfont.cxx2
-rw-r--r--editeng/source/misc/hangulhanja.cxx2
-rw-r--r--editeng/source/misc/splwrap.cxx8
-rw-r--r--extensions/source/abpilot/abpfinalpage.cxx12
-rw-r--r--extensions/source/abpilot/abpfinalpage.hxx14
-rw-r--r--extensions/source/abpilot/abspilot.cxx17
-rw-r--r--extensions/source/abpilot/abspilot.hxx4
-rw-r--r--extensions/source/abpilot/admininvokationimpl.hxx3
-rw-r--r--extensions/source/abpilot/admininvokationpage.cxx11
-rw-r--r--extensions/source/abpilot/admininvokationpage.hxx7
-rw-r--r--extensions/source/abpilot/fieldmappingpage.cxx12
-rw-r--r--extensions/source/abpilot/fieldmappingpage.hxx8
-rw-r--r--extensions/source/abpilot/tableselectionpage.cxx10
-rw-r--r--extensions/source/abpilot/tableselectionpage.hxx6
-rw-r--r--extensions/source/abpilot/typeselectionpage.cxx21
-rw-r--r--extensions/source/abpilot/typeselectionpage.hxx26
-rw-r--r--extensions/source/abpilot/unodialogabp.cxx6
-rw-r--r--extensions/source/abpilot/unodialogabp.hxx2
-rw-r--r--extensions/source/bibliography/bibbeam.cxx32
-rw-r--r--extensions/source/bibliography/bibbeam.hxx5
-rw-r--r--extensions/source/bibliography/bibcont.cxx44
-rw-r--r--extensions/source/bibliography/bibcont.hxx10
-rw-r--r--extensions/source/bibliography/bibload.cxx2
-rw-r--r--extensions/source/bibliography/bibmod.cxx1
-rw-r--r--extensions/source/bibliography/bibshortcuthandler.hxx4
-rw-r--r--extensions/source/bibliography/bibview.cxx45
-rw-r--r--extensions/source/bibliography/bibview.hxx37
-rw-r--r--extensions/source/bibliography/datman.cxx124
-rw-r--r--extensions/source/bibliography/datman.hxx5
-rw-r--r--extensions/source/bibliography/framectr.cxx1
-rw-r--r--extensions/source/bibliography/general.cxx68
-rw-r--r--extensions/source/bibliography/general.hxx99
-rw-r--r--extensions/source/bibliography/toolbar.cxx79
-rw-r--r--extensions/source/bibliography/toolbar.hxx17
-rw-r--r--extensions/source/dbpilots/commonpagesdbp.cxx39
-rw-r--r--extensions/source/dbpilots/commonpagesdbp.hxx28
-rw-r--r--extensions/source/dbpilots/controlwizard.cxx12
-rw-r--r--extensions/source/dbpilots/controlwizard.hxx13
-rw-r--r--extensions/source/dbpilots/gridwizard.cxx24
-rw-r--r--extensions/source/dbpilots/gridwizard.hxx16
-rw-r--r--extensions/source/dbpilots/groupboxwiz.cxx62
-rw-r--r--extensions/source/dbpilots/groupboxwiz.hxx30
-rw-r--r--extensions/source/dbpilots/listcombowizard.cxx47
-rw-r--r--extensions/source/dbpilots/listcombowizard.hxx20
-rw-r--r--extensions/source/dbpilots/unoautopilot.hxx2
-rw-r--r--extensions/source/dbpilots/unoautopilot.inl4
-rw-r--r--extensions/source/plugin/base/plctrl.cxx2
-rw-r--r--extensions/source/plugin/inc/plugin/plctrl.hxx13
-rw-r--r--extensions/source/propctrlr/MasterDetailLinkDialog.cxx4
-rw-r--r--extensions/source/propctrlr/MasterDetailLinkDialog.hxx2
-rw-r--r--extensions/source/propctrlr/browserline.cxx37
-rw-r--r--extensions/source/propctrlr/browserline.hxx12
-rw-r--r--extensions/source/propctrlr/browserlistbox.cxx123
-rw-r--r--extensions/source/propctrlr/browserlistbox.hxx8
-rw-r--r--extensions/source/propctrlr/browserpage.cxx22
-rw-r--r--extensions/source/propctrlr/browserpage.hxx7
-rw-r--r--extensions/source/propctrlr/browserview.cxx13
-rw-r--r--extensions/source/propctrlr/browserview.hxx3
-rw-r--r--extensions/source/propctrlr/commoncontrol.cxx15
-rw-r--r--extensions/source/propctrlr/commoncontrol.hxx2
-rw-r--r--extensions/source/propctrlr/controlfontdialog.cxx7
-rw-r--r--extensions/source/propctrlr/controlfontdialog.hxx2
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx29
-rw-r--r--extensions/source/propctrlr/formlinkdialog.cxx41
-rw-r--r--extensions/source/propctrlr/formlinkdialog.hxx19
-rw-r--r--extensions/source/propctrlr/inspectorhelpwindow.cxx47
-rw-r--r--extensions/source/propctrlr/inspectorhelpwindow.hxx6
-rw-r--r--extensions/source/propctrlr/listselectiondlg.cxx11
-rw-r--r--extensions/source/propctrlr/listselectiondlg.hxx4
-rw-r--r--extensions/source/propctrlr/newdatatype.cxx11
-rw-r--r--extensions/source/propctrlr/newdatatype.hxx6
-rw-r--r--extensions/source/propctrlr/pcrunodialogs.cxx4
-rw-r--r--extensions/source/propctrlr/pcrunodialogs.hxx2
-rw-r--r--extensions/source/propctrlr/propcontroller.cxx5
-rw-r--r--extensions/source/propctrlr/propcontroller.hxx4
-rw-r--r--extensions/source/propctrlr/propertyeditor.cxx131
-rw-r--r--extensions/source/propctrlr/propertyeditor.hxx9
-rw-r--r--extensions/source/propctrlr/selectlabeldialog.cxx10
-rw-r--r--extensions/source/propctrlr/selectlabeldialog.hxx7
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx56
-rw-r--r--extensions/source/propctrlr/standardcontrol.hxx7
-rw-r--r--extensions/source/propctrlr/taborder.cxx12
-rw-r--r--extensions/source/propctrlr/taborder.hxx11
-rw-r--r--extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx10
-rw-r--r--extensions/source/scanner/grid.cxx21
-rw-r--r--extensions/source/scanner/grid.hxx11
-rw-r--r--extensions/source/scanner/sanedlg.cxx67
-rw-r--r--extensions/source/scanner/sanedlg.hxx49
-rw-r--r--extensions/source/scanner/scanunx.cxx6
-rw-r--r--extensions/workben/testframecontrol.cxx2
-rw-r--r--filter/source/flash/impswfdialog.cxx13
-rw-r--r--filter/source/flash/impswfdialog.hxx17
-rw-r--r--filter/source/flash/swfdialog.cxx9
-rw-r--r--filter/source/flash/swfdialog.hxx2
-rw-r--r--filter/source/flash/swfwriter.cxx3
-rw-r--r--filter/source/flash/swfwriter.hxx3
-rw-r--r--filter/source/graphic/GraphicExportDialog.cxx6
-rw-r--r--filter/source/graphicfilter/eos2met/eos2met.cxx39
-rw-r--r--filter/source/graphicfilter/epict/epict.cxx41
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx42
-rw-r--r--filter/source/graphicfilter/icgm/cgm.cxx2
-rw-r--r--filter/source/graphicfilter/icgm/cgm.hxx3
-rw-r--r--filter/source/graphicfilter/idxf/dxf2mtf.cxx2
-rw-r--r--filter/source/graphicfilter/idxf/dxf2mtf.hxx2
-rw-r--r--filter/source/graphicfilter/ieps/ieps.cxx36
-rw-r--r--filter/source/graphicfilter/ios2met/ios2met.cxx6
-rw-r--r--filter/source/graphicfilter/ipict/ipict.cxx6
-rw-r--r--filter/source/msfilter/escherex.cxx18
-rw-r--r--filter/source/msfilter/msdffimp.cxx6
-rw-r--r--filter/source/pdf/impdialog.cxx194
-rw-r--r--filter/source/pdf/impdialog.hxx206
-rw-r--r--filter/source/pdf/pdfdialog.cxx14
-rw-r--r--filter/source/pdf/pdfdialog.hxx2
-rw-r--r--filter/source/pdf/pdffilter.cxx4
-rw-r--r--filter/source/pdf/pdfinteract.cxx4
-rw-r--r--filter/source/svg/impsvgdialog.cxx91
-rw-r--r--filter/source/svg/impsvgdialog.hxx19
-rw-r--r--filter/source/svg/svgdialog.cxx11
-rw-r--r--filter/source/svg/svgdialog.hxx2
-rw-r--r--filter/source/svg/svgfontexport.cxx24
-rw-r--r--filter/source/svg/svgwriter.cxx2
-rw-r--r--filter/source/svg/svgwriter.hxx4
-rw-r--r--filter/source/xsltdialog/xmlfilterdialogcomponent.cxx12
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx71
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.hxx31
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.cxx20
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.hxx9
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagebasic.cxx12
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagebasic.hxx11
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.cxx14
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.hxx17
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx22
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.hxx31
-rw-r--r--forms/source/richtext/richtextcontrol.cxx14
-rw-r--r--forms/source/richtext/richtextimplcontrol.cxx27
-rw-r--r--forms/source/richtext/richtextimplcontrol.hxx14
-rw-r--r--forms/source/richtext/richtextvclcontrol.cxx6
-rw-r--r--forms/source/richtext/richtextvclcontrol.hxx1
-rw-r--r--forms/source/runtime/formoperations.cxx4
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx10
-rw-r--r--forms/source/solar/control/navtoolbar.cxx31
-rw-r--r--forms/source/solar/inc/navtoolbar.hxx6
-rw-r--r--formula/source/ui/dlg/ControlHelper.hxx19
-rw-r--r--formula/source/ui/dlg/formula.cxx72
-rw-r--r--formula/source/ui/dlg/funcpage.cxx12
-rw-r--r--formula/source/ui/dlg/funcpage.hxx6
-rw-r--r--formula/source/ui/dlg/funcutl.cxx69
-rw-r--r--formula/source/ui/dlg/parawin.cxx26
-rw-r--r--formula/source/ui/dlg/parawin.hxx51
-rw-r--r--formula/source/ui/dlg/structpg.cxx11
-rw-r--r--formula/source/ui/dlg/structpg.hxx4
-rw-r--r--fpicker/source/office/OfficeControlAccess.hxx2
-rw-r--r--fpicker/source/office/OfficeFilePicker.cxx4
-rw-r--r--fpicker/source/office/OfficeFilePicker.hxx2
-rw-r--r--fpicker/source/office/OfficeFolderPicker.cxx4
-rw-r--r--fpicker/source/office/OfficeFolderPicker.hxx2
-rw-r--r--fpicker/source/office/PlacesListBox.cxx39
-rw-r--r--fpicker/source/office/PlacesListBox.hxx14
-rw-r--r--fpicker/source/office/QueryFolderName.hxx8
-rw-r--r--fpicker/source/office/asyncfilepicker.hxx5
-rw-r--r--fpicker/source/office/commonpicker.cxx12
-rw-r--r--fpicker/source/office/commonpicker.hxx5
-rw-r--r--fpicker/source/office/iodlg.cxx87
-rw-r--r--fpicker/source/office/iodlg.hxx23
-rw-r--r--fpicker/source/office/iodlgimp.cxx11
-rw-r--r--fpicker/source/office/iodlgimp.hxx51
-rw-r--r--fpicker/test/svdem.cxx3
-rw-r--r--framework/inc/classes/fwktabwindow.hxx13
-rw-r--r--framework/inc/dispatch/closedispatcher.hxx3
-rw-r--r--framework/inc/helper/vclstatusindicator.hxx2
-rw-r--r--framework/inc/uielement/buttontoolbarcontroller.hxx7
-rw-r--r--framework/inc/uielement/comboboxtoolbarcontroller.hxx2
-rw-r--r--framework/inc/uielement/complextoolbarcontroller.hxx5
-rw-r--r--framework/inc/uielement/dropdownboxtoolbarcontroller.hxx3
-rw-r--r--framework/inc/uielement/edittoolbarcontroller.hxx2
-rw-r--r--framework/inc/uielement/generictoolbarcontroller.hxx11
-rw-r--r--framework/inc/uielement/spinfieldtoolbarcontroller.hxx3
-rw-r--r--framework/inc/uielement/statusbar.hxx1
-rw-r--r--framework/inc/uielement/statusbaritem.hxx3
-rw-r--r--framework/inc/uielement/statusbarmanager.hxx11
-rw-r--r--framework/inc/uielement/toolbarmanager.hxx2
-rw-r--r--framework/inc/uielement/toolbarmerger.hxx2
-rw-r--r--framework/source/classes/fwktabwindow.cxx51
-rw-r--r--framework/source/helper/vclstatusindicator.cxx5
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx2
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx14
-rw-r--r--framework/source/services/autorecovery.cxx8
-rw-r--r--framework/source/services/tabwindowservice.cxx8
-rw-r--r--framework/source/uielement/addonstoolbarwrapper.cxx2
-rw-r--r--framework/source/uielement/buttontoolbarcontroller.cxx2
-rw-r--r--framework/source/uielement/comboboxtoolbarcontroller.cxx13
-rw-r--r--framework/source/uielement/complextoolbarcontroller.cxx2
-rw-r--r--framework/source/uielement/dropdownboxtoolbarcontroller.cxx13
-rw-r--r--framework/source/uielement/edittoolbarcontroller.cxx13
-rw-r--r--framework/source/uielement/fontsizemenucontroller.cxx4
-rw-r--r--framework/source/uielement/generictoolbarcontroller.cxx2
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx6
-rw-r--r--framework/source/uielement/spinfieldtoolbarcontroller.cxx13
-rw-r--r--framework/source/uielement/statusbar.cxx4
-rw-r--r--framework/source/uielement/statusbarmanager.cxx51
-rw-r--r--framework/source/uielement/statusbarwrapper.cxx2
-rw-r--r--framework/source/uielement/toolbarmanager.cxx8
-rw-r--r--framework/source/uielement/toolbarwrapper.cxx2
-rw-r--r--include/avmedia/mediaplayer.hxx1
-rw-r--r--include/avmedia/mediatoolbox.hxx2
-rw-r--r--include/avmedia/mediawindow.hxx3
-rw-r--r--include/dbaccess/ToolBoxHelper.hxx3
-rw-r--r--include/dbaccess/dataview.hxx7
-rw-r--r--include/dbaccess/genericcontroller.hxx7
-rw-r--r--include/drawinglayer/processor2d/canvasprocessor.hxx2
-rw-r--r--include/editeng/outliner.hxx3
-rw-r--r--include/editeng/splwrap.hxx3
-rw-r--r--include/formula/funcutl.hxx7
-rw-r--r--include/rtl/ref.hxx8
-rw-r--r--include/sfx2/basedlgs.hxx20
-rw-r--r--include/sfx2/checkin.hxx8
-rw-r--r--include/sfx2/childwin.hxx8
-rw-r--r--include/sfx2/ctrlitem.hxx1
-rw-r--r--include/sfx2/dinfdlg.hxx159
-rw-r--r--include/sfx2/dockwin.hxx1
-rw-r--r--include/sfx2/fcontnr.hxx5
-rw-r--r--include/sfx2/frame.hxx3
-rw-r--r--include/sfx2/infobar.hxx19
-rw-r--r--include/sfx2/ipclient.hxx4
-rw-r--r--include/sfx2/mgetempl.hxx31
-rw-r--r--include/sfx2/module.hxx2
-rw-r--r--include/sfx2/new.hxx1
-rw-r--r--include/sfx2/newstyle.hxx7
-rw-r--r--include/sfx2/objsh.hxx3
-rw-r--r--include/sfx2/passwd.hxx30
-rw-r--r--include/sfx2/printer.hxx5
-rw-r--r--include/sfx2/printopt.hxx46
-rw-r--r--include/sfx2/prnmon.hxx3
-rw-r--r--include/sfx2/recentdocsview.hxx1
-rw-r--r--include/sfx2/securitypage.hxx6
-rw-r--r--include/sfx2/sidebar/ControlFactory.hxx5
-rw-r--r--include/sfx2/sidebar/ControllerItem.hxx3
-rw-r--r--include/sfx2/sidebar/SidebarPanelBase.hxx3
-rw-r--r--include/sfx2/sidebar/SidebarToolBox.hxx1
-rw-r--r--include/sfx2/stbitem.hxx6
-rw-r--r--include/sfx2/styledlg.hxx1
-rw-r--r--include/sfx2/tabdlg.hxx24
-rw-r--r--include/sfx2/taskpane.hxx6
-rw-r--r--include/sfx2/tbxctrl.hxx11
-rw-r--r--include/sfx2/templateabstractview.hxx7
-rw-r--r--include/sfx2/templatedefaultview.hxx1
-rw-r--r--include/sfx2/templatedlg.hxx21
-rw-r--r--include/sfx2/templateinfodlg.hxx11
-rw-r--r--include/sfx2/templatelocalview.hxx1
-rw-r--r--include/sfx2/templateremoteview.hxx2
-rw-r--r--include/sfx2/templdlg.hxx3
-rw-r--r--include/sfx2/thumbnailview.hxx3
-rw-r--r--include/sfx2/thumbnailviewitem.hxx2
-rw-r--r--include/sfx2/titledockwin.hxx14
-rw-r--r--include/sfx2/viewsh.hxx9
-rw-r--r--include/svtools/DocumentInfoPreview.hxx5
-rw-r--r--include/svtools/GraphicExportOptionsDialog.hxx8
-rw-r--r--include/svtools/PlaceEditDialog.hxx16
-rw-r--r--include/svtools/ServerDetailsControls.hxx26
-rw-r--r--include/svtools/accessibleruler.hxx3
-rw-r--r--include/svtools/addresstemplate.hxx9
-rw-r--r--include/svtools/brwbox.hxx24
-rw-r--r--include/svtools/brwhead.hxx5
-rw-r--r--include/svtools/calendar.hxx16
-rw-r--r--include/svtools/colrdlg.hxx8
-rw-r--r--include/svtools/ctrlbox.hxx7
-rw-r--r--include/svtools/ctrltool.hxx4
-rw-r--r--include/svtools/editbrowsebox.hxx16
-rw-r--r--include/svtools/editsyntaxhighlighter.hxx1
-rw-r--r--include/svtools/filectrl.hxx21
-rw-r--r--include/svtools/fileview.hxx5
-rw-r--r--include/svtools/fmtfield.hxx2
-rw-r--r--include/svtools/generictoolboxcontroller.hxx4
-rw-r--r--include/svtools/genericunodialog.hxx5
-rw-r--r--include/svtools/headbar.hxx1
-rw-r--r--include/svtools/hyperlabel.hxx3
-rw-r--r--include/svtools/inettbc.hxx1
-rw-r--r--include/svtools/ivctrl.hxx1
-rw-r--r--include/svtools/popupwindowcontroller.hxx3
-rw-r--r--include/svtools/prnsetup.hxx23
-rw-r--r--include/svtools/roadmapwizard.hxx7
-rw-r--r--include/svtools/ruler.hxx3
-rw-r--r--include/svtools/scrwin.hxx9
-rw-r--r--include/svtools/simptabl.hxx11
-rw-r--r--include/svtools/svmedit.hxx1
-rw-r--r--include/svtools/svmedit2.hxx3
-rw-r--r--include/svtools/svtabbx.hxx4
-rw-r--r--include/svtools/tabbar.hxx3
-rw-r--r--include/svtools/toolbarmenu.hxx3
-rw-r--r--include/svtools/toolpanel/drawerlayouter.hxx6
-rw-r--r--include/svtools/toolpanel/paneltabbar.hxx1
-rw-r--r--include/svtools/toolpanel/toolpaneldeck.hxx1
-rw-r--r--include/svtools/treelistbox.hxx11
-rw-r--r--include/svtools/valueset.hxx7
-rw-r--r--include/svtools/wizardmachine.hxx17
-rw-r--r--include/svtools/wizdlg.hxx11
-rw-r--r--include/svx/AccessibleShapeTreeInfo.hxx3
-rw-r--r--include/svx/ParaLineSpacingPopup.hxx2
-rw-r--r--include/svx/bmpmask.hxx51
-rw-r--r--include/svx/charmap.hxx7
-rw-r--r--include/svx/checklbx.hxx1
-rw-r--r--include/svx/clipboardctl.hxx2
-rw-r--r--include/svx/colrctrl.hxx4
-rw-r--r--include/svx/compressgraphicdialog.hxx34
-rw-r--r--include/svx/connctrl.hxx1
-rw-r--r--include/svx/contdlg.hxx7
-rw-r--r--include/svx/ctredlin.hxx59
-rw-r--r--include/svx/dialcontrol.hxx10
-rw-r--r--include/svx/dlgctl3d.hxx17
-rw-r--r--include/svx/dlgctrl.hxx13
-rw-r--r--include/svx/fillctrl.hxx13
-rw-r--r--include/svx/float3d.hxx175
-rw-r--r--include/svx/fmgridcl.hxx3
-rw-r--r--include/svx/fmgridif.hxx2
-rw-r--r--include/svx/fmshell.hxx2
-rw-r--r--include/svx/fntctrl.hxx1
-rw-r--r--include/svx/fontwork.hxx23
-rw-r--r--include/svx/fontworkgallery.hxx11
-rw-r--r--include/svx/frmdirlbox.hxx1
-rw-r--r--include/svx/frmsel.hxx2
-rw-r--r--include/svx/galctrl.hxx2
-rw-r--r--include/svx/grafctrl.hxx6
-rw-r--r--include/svx/graphctl.hxx5
-rw-r--r--include/svx/gridctrl.hxx31
-rw-r--r--include/svx/hdft.hxx47
-rw-r--r--include/svx/imapdlg.hxx19
-rw-r--r--include/svx/itemwin.hxx4
-rw-r--r--include/svx/langbox.hxx2
-rw-r--r--include/svx/layctrl.hxx4
-rw-r--r--include/svx/lboxctrl.hxx6
-rw-r--r--include/svx/linectrl.hxx11
-rw-r--r--include/svx/linkwarn.hxx3
-rw-r--r--include/svx/measctrl.hxx1
-rw-r--r--include/svx/numvset.hxx28
-rw-r--r--include/svx/optgrid.hxx42
-rw-r--r--include/svx/pagectrl.hxx1
-rw-r--r--include/svx/passwd.hxx15
-rw-r--r--include/svx/prtqry.hxx1
-rw-r--r--include/svx/rubydialog.hxx49
-rw-r--r--include/svx/ruler.hxx3
-rw-r--r--include/svx/sdrpaintwindow.hxx6
-rw-r--r--include/svx/sidebar/PanelLayout.hxx2
-rw-r--r--include/svx/sidebar/Popup.hxx14
-rw-r--r--include/svx/sidebar/PopupControl.hxx1
-rw-r--r--include/svx/sidebar/SidebarDialControl.hxx1
-rw-r--r--include/svx/sidebar/ValueSetWithTextControl.hxx2
-rw-r--r--include/svx/srchdlg.hxx101
-rw-r--r--include/svx/stddlg.hxx1
-rw-r--r--include/svx/subtoolboxcontrol.hxx2
-rw-r--r--include/svx/svdedxv.hxx4
-rw-r--r--include/svx/svdmodel.hxx4
-rw-r--r--include/svx/svdobj.hxx3
-rw-r--r--include/svx/svdpntv.hxx8
-rw-r--r--include/svx/svxdlg.hxx4
-rw-r--r--include/svx/swframeexample.hxx1
-rw-r--r--include/svx/tbcontrl.hxx10
-rw-r--r--include/svx/tbxalign.hxx2
-rw-r--r--include/svx/tbxcolorupdate.hxx7
-rw-r--r--include/svx/tbxcustomshapes.hxx2
-rw-r--r--include/svx/txencbox.hxx1
-rw-r--r--include/toolkit/awt/scrollabledialog.hxx5
-rw-r--r--include/toolkit/awt/vclxaccessiblecomponent.hxx7
-rw-r--r--include/toolkit/awt/vclxdevice.hxx19
-rw-r--r--include/toolkit/awt/vclxgraphics.hxx3
-rw-r--r--include/toolkit/awt/vclxprinter.hxx4
-rw-r--r--include/toolkit/awt/vclxwindow.hxx8
-rw-r--r--include/toolkit/controls/accessiblecontrolcontext.hxx3
-rw-r--r--include/toolkit/helper/vclunohelper.hxx9
-rw-r--r--include/tools/errinf.hxx10
-rw-r--r--include/vcl/animate.hxx9
-rw-r--r--include/vcl/btndlg.hxx1
-rw-r--r--include/vcl/builder.hxx40
-rw-r--r--include/vcl/button.hxx21
-rw-r--r--include/vcl/cairo.hxx3
-rw-r--r--include/vcl/combobox.hxx24
-rw-r--r--include/vcl/controllayout.hxx7
-rw-r--r--include/vcl/ctrl.hxx1
-rw-r--r--include/vcl/cursor.hxx3
-rw-r--r--include/vcl/decoview.hxx3
-rw-r--r--include/vcl/dialog.hxx16
-rw-r--r--include/vcl/dockingarea.hxx1
-rw-r--r--include/vcl/dockwin.hxx15
-rw-r--r--include/vcl/edit.hxx6
-rw-r--r--include/vcl/event.hxx26
-rw-r--r--include/vcl/field.hxx14
-rw-r--r--include/vcl/fixed.hxx5
-rw-r--r--include/vcl/fixedhyper.hxx5
-rw-r--r--include/vcl/floatwin.hxx5
-rw-r--r--include/vcl/fltcall.hxx2
-rw-r--r--include/vcl/gdimtf.hxx3
-rw-r--r--include/vcl/introwin.hxx6
-rw-r--r--include/vcl/layout.hxx63
-rw-r--r--include/vcl/lazydelete.hxx11
-rw-r--r--include/vcl/longcurr.hxx2
-rw-r--r--include/vcl/lstbox.hxx9
-rw-r--r--include/vcl/menu.hxx2
-rw-r--r--include/vcl/menubtn.hxx1
-rw-r--r--include/vcl/morebtn.hxx3
-rw-r--r--include/vcl/msgbox.hxx19
-rw-r--r--include/vcl/oldprintadaptor.hxx2
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx7
-rw-r--r--include/vcl/openglwin.hxx6
-rw-r--r--include/vcl/outdev.hxx38
-rw-r--r--include/vcl/popupmenuwindow.hxx1
-rw-r--r--include/vcl/prgsbar.hxx5
-rw-r--r--include/vcl/print.hxx15
-rw-r--r--include/vcl/scrbar.hxx3
-rw-r--r--include/vcl/seleng.hxx2
-rw-r--r--include/vcl/spin.hxx1
-rw-r--r--include/vcl/spinfld.hxx6
-rw-r--r--include/vcl/split.hxx3
-rw-r--r--include/vcl/splitwin.hxx3
-rw-r--r--include/vcl/status.hxx9
-rw-r--r--include/vcl/syschild.hxx1
-rw-r--r--include/vcl/syswin.hxx6
-rw-r--r--include/vcl/tabctrl.hxx7
-rw-r--r--include/vcl/tabdlg.hxx7
-rw-r--r--include/vcl/tabpage.hxx2
-rw-r--r--include/vcl/taskpanelist.hxx2
-rw-r--r--include/vcl/texteng.hxx3
-rw-r--r--include/vcl/throbber.hxx1
-rw-r--r--include/vcl/toolbox.hxx7
-rw-r--r--include/vcl/vclevent.hxx9
-rw-r--r--include/vcl/vclmedit.hxx7
-rw-r--r--include/vcl/vclptr.hxx357
-rw-r--r--include/vcl/virdev.hxx5
-rw-r--r--include/vcl/waitobj.hxx2
-rw-r--r--include/vcl/window.hxx46
-rw-r--r--include/vcl/wrkwin.hxx1
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx8
-rw-r--r--mysqlc/source/mysqlc_connection.cxx2
-rw-r--r--mysqlc/source/mysqlc_resultset.cxx2
-rw-r--r--mysqlc/source/mysqlc_statement.cxx2
-rw-r--r--odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx2
-rw-r--r--odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx2
-rw-r--r--odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx2
-rw-r--r--reportdesign/source/ui/dlg/AddField.cxx89
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.cxx15
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx75
-rw-r--r--reportdesign/source/ui/dlg/Condition.hxx33
-rw-r--r--reportdesign/source/ui/dlg/DateTime.cxx13
-rw-r--r--reportdesign/source/ui/dlg/Formula.cxx13
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.cxx91
-rw-r--r--reportdesign/source/ui/dlg/Navigator.cxx13
-rw-r--r--reportdesign/source/ui/dlg/PageNumber.cxx12
-rw-r--r--reportdesign/source/ui/inc/AddField.hxx17
-rw-r--r--reportdesign/source/ui/inc/ColorChanger.hxx2
-rw-r--r--reportdesign/source/ui/inc/ColorListener.hxx1
-rw-r--r--reportdesign/source/ui/inc/CondFormat.hxx15
-rw-r--r--reportdesign/source/ui/inc/DateTime.hxx15
-rw-r--r--reportdesign/source/ui/inc/DesignView.hxx21
-rw-r--r--reportdesign/source/ui/inc/Formula.hxx7
-rw-r--r--reportdesign/source/ui/inc/GroupsSorting.hxx21
-rw-r--r--reportdesign/source/ui/inc/MarkedSection.hxx2
-rw-r--r--reportdesign/source/ui/inc/PageNumber.hxx13
-rw-r--r--reportdesign/source/ui/inc/ReportController.hxx4
-rw-r--r--reportdesign/source/ui/inc/ReportSection.hxx3
-rw-r--r--reportdesign/source/ui/inc/ReportWindow.hxx15
-rw-r--r--reportdesign/source/ui/inc/ScrollHelper.hxx27
-rw-r--r--reportdesign/source/ui/inc/SectionView.hxx4
-rw-r--r--reportdesign/source/ui/inc/SectionWindow.hxx17
-rw-r--r--reportdesign/source/ui/inc/StartMarker.hxx9
-rw-r--r--reportdesign/source/ui/inc/ViewsWindow.hxx22
-rw-r--r--reportdesign/source/ui/inc/dlgedfunc.hxx2
-rw-r--r--reportdesign/source/ui/inc/propbrw.hxx3
-rw-r--r--reportdesign/source/ui/misc/ColorListener.cxx6
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx17
-rw-r--r--reportdesign/source/ui/misc/statusbarcontroller.cxx2
-rw-r--r--reportdesign/source/ui/misc/toolboxcontroller.cxx2
-rw-r--r--reportdesign/source/ui/report/DesignView.cxx155
-rw-r--r--reportdesign/source/ui/report/FixedTextColor.cxx2
-rw-r--r--reportdesign/source/ui/report/FormattedFieldBeautifier.cxx2
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx61
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx7
-rw-r--r--reportdesign/source/ui/report/ReportWindow.cxx147
-rw-r--r--reportdesign/source/ui/report/ScrollHelper.cxx134
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx133
-rw-r--r--reportdesign/source/ui/report/StartMarker.cxx94
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx37
-rw-r--r--reportdesign/source/ui/report/propbrw.cxx9
-rw-r--r--sc/inc/AccessibleFilterMenu.hxx3
-rw-r--r--sc/inc/AccessibleFilterMenuItem.hxx3
-rw-r--r--sc/inc/dociter.hxx3
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/inc/editutil.hxx9
-rw-r--r--sc/inc/rowheightcontext.hxx6
-rw-r--r--sc/inc/scmod.hxx6
-rw-r--r--sc/inc/scopetools.hxx3
-rw-r--r--sc/inc/waitoff.hxx2
-rw-r--r--sc/source/core/data/documen2.cxx4
-rw-r--r--sc/source/core/data/documen8.cxx15
-rw-r--r--sc/source/core/data/dpobject.cxx6
-rw-r--r--sc/source/core/data/global.cxx10
-rw-r--r--sc/source/core/data/validat.cxx12
-rw-r--r--sc/source/core/tool/editutil.cxx8
-rw-r--r--sc/source/filter/inc/htmlexp.hxx2
-rw-r--r--sc/source/filter/oox/workbookhelper.cxx8
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx4
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx24
-rw-r--r--sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx13
-rw-r--r--sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx10
-rw-r--r--sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx10
-rw-r--r--sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx28
-rw-r--r--sc/source/ui/StatisticsDialogs/SamplingDialog.cxx25
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx19
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx24
-rw-r--r--sc/source/ui/app/inputhdl.cxx5
-rw-r--r--sc/source/ui/app/inputwin.cxx175
-rw-r--r--sc/source/ui/app/scmod.cxx20
-rw-r--r--sc/source/ui/app/transobj.cxx20
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx114
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx10
-rw-r--r--sc/source/ui/attrdlg/scuiexp.cxx30
-rw-r--r--sc/source/ui/attrdlg/tabpages.cxx18
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx250
-rw-r--r--sc/source/ui/cctrl/tbinsert.cxx2
-rw-r--r--sc/source/ui/cctrl/tbzoomsliderctrl.cxx17
-rw-r--r--sc/source/ui/condformat/colorformat.cxx28
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx123
-rw-r--r--sc/source/ui/condformat/condformatdlgentry.cxx835
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx21
-rw-r--r--sc/source/ui/dbgui/PivotLayoutDialog.cxx40
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx12
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx2
-rw-r--r--sc/source/ui/dbgui/consdlg.cxx23
-rw-r--r--sc/source/ui/dbgui/csvcontrol.cxx6
-rw-r--r--sc/source/ui/dbgui/csvgrid.cxx142
-rw-r--r--sc/source/ui/dbgui/csvruler.cxx60
-rw-r--r--sc/source/ui/dbgui/csvtablebox.cxx155
-rw-r--r--sc/source/ui/dbgui/dapidata.cxx13
-rw-r--r--sc/source/ui/dbgui/dapitype.cxx23
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx25
-rw-r--r--sc/source/ui/dbgui/dpgroupdlg.cxx39
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx38
-rw-r--r--sc/source/ui/dbgui/pfiltdlg.cxx24
-rw-r--r--sc/source/ui/dbgui/pvfundlg.cxx80
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx18
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx28
-rw-r--r--sc/source/ui/dbgui/scuiimoptdlg.cxx18
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx25
-rw-r--r--sc/source/ui/dbgui/sortdlg.cxx13
-rw-r--r--sc/source/ui/dbgui/subtdlg.cxx11
-rw-r--r--sc/source/ui/dbgui/textimportoptions.cxx12
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx49
-rw-r--r--sc/source/ui/dbgui/tpsubt.cxx42
-rw-r--r--sc/source/ui/dbgui/validate.cxx75
-rw-r--r--sc/source/ui/dialogs/searchresults.cxx12
-rw-r--r--sc/source/ui/docshell/arealink.cxx6
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx20
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx4
-rw-r--r--sc/source/ui/docshell/docfunc.cxx9
-rw-r--r--sc/source/ui/docshell/docsh.cxx36
-rw-r--r--sc/source/ui/docshell/docsh3.cxx22
-rw-r--r--sc/source/ui/docshell/docsh4.cxx60
-rw-r--r--sc/source/ui/docshell/docsh5.cxx16
-rw-r--r--sc/source/ui/docshell/docsh6.cxx4
-rw-r--r--sc/source/ui/docshell/documentlinkmgr.cxx4
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx4
-rw-r--r--sc/source/ui/docshell/impex.cxx8
-rw-r--r--sc/source/ui/docshell/sizedev.cxx2
-rw-r--r--sc/source/ui/docshell/tablink.cxx6
-rw-r--r--sc/source/ui/docshell/tpstat.cxx14
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx4
-rw-r--r--sc/source/ui/drawfunc/fupoor.cxx3
-rw-r--r--sc/source/ui/drawfunc/graphsh.cxx6
-rw-r--r--sc/source/ui/formdlg/dwfunctr.cxx259
-rw-r--r--sc/source/ui/formdlg/formula.cxx6
-rw-r--r--sc/source/ui/inc/AccessibleCsvControl.hxx3
-rw-r--r--sc/source/ui/inc/AccessibleEditObject.hxx3
-rw-r--r--sc/source/ui/inc/AccessibleText.hxx4
-rw-r--r--sc/source/ui/inc/AnalysisOfVarianceDialog.hxx9
-rw-r--r--sc/source/ui/inc/ExponentialSmoothingDialog.hxx3
-rw-r--r--sc/source/ui/inc/MovingAverageDialog.hxx3
-rw-r--r--sc/source/ui/inc/PivotLayoutDialog.hxx55
-rw-r--r--sc/source/ui/inc/PivotLayoutTreeListBase.hxx3
-rw-r--r--sc/source/ui/inc/RandomNumberGeneratorDialog.hxx31
-rw-r--r--sc/source/ui/inc/SamplingDialog.hxx29
-rw-r--r--sc/source/ui/inc/StatisticsInputOutputDialog.hxx21
-rw-r--r--sc/source/ui/inc/StatisticsTwoVariableDialog.hxx27
-rw-r--r--sc/source/ui/inc/acredlin.hxx9
-rw-r--r--sc/source/ui/inc/anyrefdg.hxx18
-rw-r--r--sc/source/ui/inc/areasdlg.hxx26
-rw-r--r--sc/source/ui/inc/autofmt.hxx3
-rw-r--r--sc/source/ui/inc/cbutton.hxx3
-rw-r--r--sc/source/ui/inc/checklistmenu.hxx34
-rw-r--r--sc/source/ui/inc/colorformat.hxx30
-rw-r--r--sc/source/ui/inc/condformatdlg.hxx25
-rw-r--r--sc/source/ui/inc/condformatdlgentry.hxx103
-rw-r--r--sc/source/ui/inc/condformatmgr.hxx9
-rw-r--r--sc/source/ui/inc/conflictsdlg.hxx13
-rw-r--r--sc/source/ui/inc/consdlg.hxx35
-rw-r--r--sc/source/ui/inc/content.hxx3
-rw-r--r--sc/source/ui/inc/corodlg.hxx11
-rw-r--r--sc/source/ui/inc/crdlg.hxx10
-rw-r--r--sc/source/ui/inc/crnrdlg.hxx25
-rw-r--r--sc/source/ui/inc/csvcontrol.hxx1
-rw-r--r--sc/source/ui/inc/csvgrid.hxx5
-rw-r--r--sc/source/ui/inc/csvruler.hxx5
-rw-r--r--sc/source/ui/inc/csvtablebox.hxx15
-rw-r--r--sc/source/ui/inc/dapidata.hxx8
-rw-r--r--sc/source/ui/inc/dapitype.hxx23
-rw-r--r--sc/source/ui/inc/datafdlg.hxx25
-rw-r--r--sc/source/ui/inc/datastreamdlg.hxx36
-rw-r--r--sc/source/ui/inc/dbnamdlg.hxx37
-rw-r--r--sc/source/ui/inc/delcldlg.hxx10
-rw-r--r--sc/source/ui/inc/delcodlg.hxx19
-rw-r--r--sc/source/ui/inc/docsh.hxx2
-rw-r--r--sc/source/ui/inc/dpcontrol.hxx3
-rw-r--r--sc/source/ui/inc/dpgroupdlg.hxx55
-rw-r--r--sc/source/ui/inc/drawview.hxx2
-rw-r--r--sc/source/ui/inc/dwfunctr.hxx15
-rw-r--r--sc/source/ui/inc/filldlg.hxx41
-rw-r--r--sc/source/ui/inc/filtdlg.hxx122
-rw-r--r--sc/source/ui/inc/foptmgr.hxx24
-rw-r--r--sc/source/ui/inc/formula.hxx1
-rw-r--r--sc/source/ui/inc/fupoor.hxx4
-rw-r--r--sc/source/ui/inc/gridmerg.hxx2
-rw-r--r--sc/source/ui/inc/gridwin.hxx9
-rw-r--r--sc/source/ui/inc/groupdlg.hxx6
-rw-r--r--sc/source/ui/inc/highred.hxx15
-rw-r--r--sc/source/ui/inc/inputhdl.hxx9
-rw-r--r--sc/source/ui/inc/inputwin.hxx22
-rw-r--r--sc/source/ui/inc/inscldlg.hxx9
-rw-r--r--sc/source/ui/inc/inscodlg.hxx53
-rw-r--r--sc/source/ui/inc/instbdlg.hxx27
-rw-r--r--sc/source/ui/inc/lbseldlg.hxx4
-rw-r--r--sc/source/ui/inc/linkarea.hxx15
-rw-r--r--sc/source/ui/inc/mtrindlg.hxx6
-rw-r--r--sc/source/ui/inc/mvtabdlg.hxx15
-rw-r--r--sc/source/ui/inc/namecrea.hxx11
-rw-r--r--sc/source/ui/inc/namedefdlg.hxx25
-rw-r--r--sc/source/ui/inc/namedlg.hxx29
-rw-r--r--sc/source/ui/inc/namemgrtable.hxx1
-rw-r--r--sc/source/ui/inc/namepast.hxx9
-rw-r--r--sc/source/ui/inc/navipi.hxx26
-rw-r--r--sc/source/ui/inc/notemark.hxx8
-rw-r--r--sc/source/ui/inc/olinewin.hxx1
-rw-r--r--sc/source/ui/inc/opredlin.hxx12
-rw-r--r--sc/source/ui/inc/optsolver.hxx131
-rw-r--r--sc/source/ui/inc/output.hxx6
-rw-r--r--sc/source/ui/inc/pfiltdlg.hxx43
-rw-r--r--sc/source/ui/inc/preview.hxx1
-rw-r--r--sc/source/ui/inc/prevloc.hxx2
-rw-r--r--sc/source/ui/inc/prevwsh.hxx12
-rw-r--r--sc/source/ui/inc/printfun.hxx4
-rw-r--r--sc/source/ui/inc/protectiondlg.hxx15
-rw-r--r--sc/source/ui/inc/pvfundlg.hxx88
-rw-r--r--sc/source/ui/inc/reffact.hxx2
-rw-r--r--sc/source/ui/inc/retypepassdlg.hxx26
-rw-r--r--sc/source/ui/inc/scendlg.hxx19
-rw-r--r--sc/source/ui/inc/scuiasciiopt.hxx45
-rw-r--r--sc/source/ui/inc/scuiautofmt.hxx28
-rw-r--r--sc/source/ui/inc/scuiimoptdlg.hxx25
-rw-r--r--sc/source/ui/inc/scuitphfedit.hxx51
-rw-r--r--sc/source/ui/inc/searchresults.hxx3
-rw-r--r--sc/source/ui/inc/sharedocdlg.hxx7
-rw-r--r--sc/source/ui/inc/shtabdlg.hxx6
-rw-r--r--sc/source/ui/inc/simpref.hxx11
-rw-r--r--sc/source/ui/inc/sizedev.hxx12
-rw-r--r--sc/source/ui/inc/solveroptions.hxx19
-rw-r--r--sc/source/ui/inc/solvrdlg.hxx21
-rw-r--r--sc/source/ui/inc/sortdlg.hxx8
-rw-r--r--sc/source/ui/inc/sortkeydlg.hxx12
-rw-r--r--sc/source/ui/inc/strindlg.hxx7
-rw-r--r--sc/source/ui/inc/subtdlg.hxx4
-rw-r--r--sc/source/ui/inc/tabbgcolordlg.hxx11
-rw-r--r--sc/source/ui/inc/tabopdlg.hxx25
-rw-r--r--sc/source/ui/inc/tabpages.hxx13
-rw-r--r--sc/source/ui/inc/tabview.hxx38
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/inc/tbinsert.hxx2
-rw-r--r--sc/source/ui/inc/tbzoomsliderctrl.hxx3
-rw-r--r--sc/source/ui/inc/textimportoptions.hxx12
-rw-r--r--sc/source/ui/inc/tpcalc.hxx35
-rw-r--r--sc/source/ui/inc/tpcompatibility.hxx8
-rw-r--r--sc/source/ui/inc/tpdefaults.hxx7
-rw-r--r--sc/source/ui/inc/tpformula.hxx26
-rw-r--r--sc/source/ui/inc/tphf.hxx17
-rw-r--r--sc/source/ui/inc/tphfedit.hxx1
-rw-r--r--sc/source/ui/inc/tpprint.hxx12
-rw-r--r--sc/source/ui/inc/tpsort.hxx39
-rw-r--r--sc/source/ui/inc/tpstat.hxx12
-rw-r--r--sc/source/ui/inc/tpsubt.hxx35
-rw-r--r--sc/source/ui/inc/tptable.hxx50
-rw-r--r--sc/source/ui/inc/tpusrlst.hxx27
-rw-r--r--sc/source/ui/inc/tpview.hxx93
-rw-r--r--sc/source/ui/inc/validate.hxx72
-rw-r--r--sc/source/ui/inc/viewfunc.hxx2
-rw-r--r--sc/source/ui/inc/xmlsourcedlg.hxx20
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx13
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx18
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx38
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx14
-rw-r--r--sc/source/ui/miscdlgs/crdlg.cxx15
-rw-r--r--sc/source/ui/miscdlgs/crnrdlg.cxx20
-rw-r--r--sc/source/ui/miscdlgs/datafdlg.cxx56
-rw-r--r--sc/source/ui/miscdlgs/datastreamdlg.cxx27
-rw-r--r--sc/source/ui/miscdlgs/delcldlg.cxx15
-rw-r--r--sc/source/ui/miscdlgs/delcodlg.cxx23
-rw-r--r--sc/source/ui/miscdlgs/filldlg.cxx26
-rw-r--r--sc/source/ui/miscdlgs/groupdlg.cxx14
-rw-r--r--sc/source/ui/miscdlgs/highred.cxx16
-rw-r--r--sc/source/ui/miscdlgs/inscldlg.cxx18
-rw-r--r--sc/source/ui/miscdlgs/inscodlg.cxx28
-rw-r--r--sc/source/ui/miscdlgs/instbdlg.cxx19
-rw-r--r--sc/source/ui/miscdlgs/lbseldlg.cxx12
-rw-r--r--sc/source/ui/miscdlgs/linkarea.cxx13
-rw-r--r--sc/source/ui/miscdlgs/mtrindlg.cxx12
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx13
-rw-r--r--sc/source/ui/miscdlgs/namecrea.cxx14
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx131
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.cxx13
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.cxx49
-rw-r--r--sc/source/ui/miscdlgs/scuiautofmt.cxx43
-rw-r--r--sc/source/ui/miscdlgs/sharedocdlg.cxx12
-rw-r--r--sc/source/ui/miscdlgs/shtabdlg.cxx12
-rw-r--r--sc/source/ui/miscdlgs/simpref.cxx11
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx53
-rw-r--r--sc/source/ui/miscdlgs/solvrdlg.cxx18
-rw-r--r--sc/source/ui/miscdlgs/strindlg.cxx12
-rw-r--r--sc/source/ui/miscdlgs/tabbgcolordlg.cxx23
-rw-r--r--sc/source/ui/miscdlgs/tabopdlg.cxx19
-rw-r--r--sc/source/ui/namedlg/namedefdlg.cxx21
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx23
-rw-r--r--sc/source/ui/namedlg/namemgrtable.cxx6
-rw-r--r--sc/source/ui/namedlg/namepast.cxx13
-rw-r--r--sc/source/ui/navipi/content.cxx7
-rw-r--r--sc/source/ui/navipi/navcitem.cxx2
-rw-r--r--sc/source/ui/navipi/navipi.cxx211
-rw-r--r--sc/source/ui/navipi/scenwnd.cxx50
-rw-r--r--sc/source/ui/optdlg/calcoptionsdlg.cxx20
-rw-r--r--sc/source/ui/optdlg/calcoptionsdlg.hxx33
-rw-r--r--sc/source/ui/optdlg/opredlin.cxx14
-rw-r--r--sc/source/ui/optdlg/tpcalc.cxx26
-rw-r--r--sc/source/ui/optdlg/tpcompatibility.cxx11
-rw-r--r--sc/source/ui/optdlg/tpdefaults.cxx12
-rw-r--r--sc/source/ui/optdlg/tpformula.cxx27
-rw-r--r--sc/source/ui/optdlg/tpprint.cxx13
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx22
-rw-r--r--sc/source/ui/optdlg/tpview.cxx61
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx18
-rw-r--r--sc/source/ui/pagedlg/scuitphfedit.cxx42
-rw-r--r--sc/source/ui/pagedlg/tphf.cxx18
-rw-r--r--sc/source/ui/pagedlg/tphfedit.cxx6
-rw-r--r--sc/source/ui/pagedlg/tptable.cxx31
-rw-r--r--sc/source/ui/sidebar/AlignmentPropertyPanel.cxx30
-rw-r--r--sc/source/ui/sidebar/AlignmentPropertyPanel.hxx33
-rw-r--r--sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx26
-rw-r--r--sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx25
-rw-r--r--sc/source/ui/sidebar/CellBorderStyleControl.cxx119
-rw-r--r--sc/source/ui/sidebar/CellBorderStyleControl.hxx11
-rw-r--r--sc/source/ui/sidebar/CellLineStyleControl.cxx78
-rw-r--r--sc/source/ui/sidebar/CellLineStyleControl.hxx10
-rw-r--r--sc/source/ui/sidebar/CellLineStyleValueSet.cxx8
-rw-r--r--sc/source/ui/sidebar/CellLineStyleValueSet.hxx3
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx24
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx28
-rw-r--r--sc/source/ui/sidebar/ScPanelFactory.cxx46
-rw-r--r--sc/source/ui/undo/undobase.cxx8
-rw-r--r--sc/source/ui/undo/undoblk.cxx4
-rw-r--r--sc/source/ui/undo/undoblk3.cxx6
-rw-r--r--sc/source/ui/undo/undostyl.cxx6
-rw-r--r--sc/source/ui/unoobj/confuno.cxx4
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx24
-rw-r--r--sc/source/ui/vba/vbaeventshelper.cxx8
-rw-r--r--sc/source/ui/view/cellsh1.cxx20
-rw-r--r--sc/source/ui/view/cellsh2.cxx8
-rw-r--r--sc/source/ui/view/cellsh3.cxx4
-rw-r--r--sc/source/ui/view/dbfunc.cxx4
-rw-r--r--sc/source/ui/view/gridwin.cxx62
-rw-r--r--sc/source/ui/view/gridwin2.cxx4
-rw-r--r--sc/source/ui/view/gridwin4.cxx2
-rw-r--r--sc/source/ui/view/olinewin.cxx6
-rw-r--r--sc/source/ui/view/preview.cxx6
-rw-r--r--sc/source/ui/view/prevwsh.cxx25
-rw-r--r--sc/source/ui/view/printfun.cxx2
-rw-r--r--sc/source/ui/view/reffact.cxx37
-rw-r--r--sc/source/ui/view/spelleng.cxx4
-rw-r--r--sc/source/ui/view/tabview.cxx162
-rw-r--r--sc/source/ui/view/tabview2.cxx4
-rw-r--r--sc/source/ui/view/tabview3.cxx2
-rw-r--r--sc/source/ui/view/tabview4.cxx16
-rw-r--r--sc/source/ui/view/tabview5.cxx47
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx8
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx7
-rw-r--r--sc/source/ui/view/tabvwshc.cxx60
-rw-r--r--sc/source/ui/view/tabvwshh.cxx2
-rw-r--r--sc/source/ui/view/viewfun2.cxx8
-rw-r--r--sc/source/ui/view/viewfun3.cxx14
-rw-r--r--sc/source/ui/view/viewfun4.cxx8
-rw-r--r--sc/source/ui/view/viewfunc.cxx12
-rw-r--r--sc/source/ui/xmlsource/xmlsourcedlg.cxx21
-rw-r--r--sd/inc/Outliner.hxx2
-rw-r--r--sd/inc/sdmod.hxx4
-rw-r--r--sd/source/core/drawdoc3.cxx4
-rw-r--r--sd/source/filter/eppt/epptbase.hxx5
-rw-r--r--sd/source/filter/eppt/pptx-text.cxx2
-rw-r--r--sd/source/filter/grf/sdgrffilter.cxx4
-rw-r--r--sd/source/filter/html/buttonset.cxx12
-rw-r--r--sd/source/filter/html/htmlex.cxx6
-rw-r--r--sd/source/filter/html/pubdlg.cxx118
-rw-r--r--sd/source/ui/accessibility/AccessibleSlideSorterView.cxx16
-rw-r--r--sd/source/ui/animations/CustomAnimationCreateDialog.cxx50
-rw-r--r--sd/source/ui/animations/CustomAnimationCreateDialog.hxx7
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx270
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.hxx10
-rw-r--r--sd/source/ui/animations/CustomAnimationList.cxx8
-rw-r--r--sd/source/ui/animations/CustomAnimationList.hxx1
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx35
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.hxx35
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.cxx29
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.hxx27
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx7
-rw-r--r--sd/source/ui/annotations/annotationtag.cxx22
-rw-r--r--sd/source/ui/annotations/annotationtag.hxx4
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx25
-rw-r--r--sd/source/ui/annotations/annotationwindow.hxx10
-rw-r--r--sd/source/ui/app/sdmod.cxx2
-rw-r--r--sd/source/ui/app/sdmod2.cxx4
-rw-r--r--sd/source/ui/app/sdxfer.cxx4
-rw-r--r--sd/source/ui/app/tbxww.cxx2
-rw-r--r--sd/source/ui/controller/slidelayoutcontroller.cxx19
-rw-r--r--sd/source/ui/controller/slidelayoutcontroller.hxx2
-rw-r--r--sd/source/ui/dlg/AnimationChildWindow.cxx2
-rw-r--r--sd/source/ui/dlg/LayerTabBar.cxx4
-rw-r--r--sd/source/ui/dlg/NavigatorChildWindow.cxx3
-rw-r--r--sd/source/ui/dlg/PaneChildWindows.cxx7
-rw-r--r--sd/source/ui/dlg/PhotoAlbumDialog.cxx25
-rw-r--r--sd/source/ui/dlg/PhotoAlbumDialog.hxx24
-rw-r--r--sd/source/ui/dlg/RemoteDialog.cxx13
-rw-r--r--sd/source/ui/dlg/RemoteDialog.hxx8
-rw-r--r--sd/source/ui/dlg/RemoteDialogClientBox.cxx88
-rw-r--r--sd/source/ui/dlg/RemoteDialogClientBox.hxx13
-rw-r--r--sd/source/ui/dlg/animobjs.cxx51
-rw-r--r--sd/source/ui/dlg/assclass.cxx4
-rw-r--r--sd/source/ui/dlg/brkdlg.cxx16
-rw-r--r--sd/source/ui/dlg/copydlg.cxx39
-rw-r--r--sd/source/ui/dlg/custsdlg.cxx41
-rw-r--r--sd/source/ui/dlg/diactrl.cxx4
-rw-r--r--sd/source/ui/dlg/dlgass.cxx128
-rw-r--r--sd/source/ui/dlg/dlgassim.cxx6
-rw-r--r--sd/source/ui/dlg/dlgassim.hxx1
-rw-r--r--sd/source/ui/dlg/dlgctrls.cxx6
-rw-r--r--sd/source/ui/dlg/dlgfield.cxx15
-rw-r--r--sd/source/ui/dlg/dlgolbul.cxx6
-rw-r--r--sd/source/ui/dlg/dlgsnap.cxx19
-rw-r--r--sd/source/ui/dlg/docprev.cxx24
-rw-r--r--sd/source/ui/dlg/gluectrl.cxx8
-rw-r--r--sd/source/ui/dlg/headerfooterdlg.cxx76
-rw-r--r--sd/source/ui/dlg/ins_paste.cxx12
-rw-r--r--sd/source/ui/dlg/inspagob.cxx9
-rw-r--r--sd/source/ui/dlg/layeroptionsdlg.cxx16
-rw-r--r--sd/source/ui/dlg/masterlayoutdlg.cxx15
-rw-r--r--sd/source/ui/dlg/morphdlg.cxx9
-rw-r--r--sd/source/ui/dlg/navigatr.cxx253
-rw-r--r--sd/source/ui/dlg/paragr.cxx22
-rw-r--r--sd/source/ui/dlg/present.cxx33
-rw-r--r--sd/source/ui/dlg/prltempl.cxx6
-rw-r--r--sd/source/ui/dlg/prntopts.cxx33
-rw-r--r--sd/source/ui/dlg/sddlgfact.cxx48
-rw-r--r--sd/source/ui/dlg/sddlgfact.hxx3
-rw-r--r--sd/source/ui/dlg/sdpreslt.cxx12
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx14
-rw-r--r--sd/source/ui/dlg/sduiexp.cxx15
-rw-r--r--sd/source/ui/dlg/tpaction.cxx31
-rw-r--r--sd/source/ui/dlg/tpoption.cxx65
-rw-r--r--sd/source/ui/dlg/vectdlg.cxx16
-rw-r--r--sd/source/ui/docshell/docshel2.cxx20
-rw-r--r--sd/source/ui/docshell/docshel4.cxx20
-rw-r--r--sd/source/ui/docshell/docshell.cxx2
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx2
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.hxx3
-rw-r--r--sd/source/ui/framework/factories/ChildWindowPane.cxx2
-rw-r--r--sd/source/ui/framework/factories/FullScreenPane.cxx21
-rw-r--r--sd/source/ui/framework/factories/FullScreenPane.hxx2
-rw-r--r--sd/source/ui/framework/factories/Pane.cxx2
-rw-r--r--sd/source/ui/func/fuinsert.cxx4
-rw-r--r--sd/source/ui/func/fuinsfil.cxx12
-rw-r--r--sd/source/ui/func/fulinend.cxx4
-rw-r--r--sd/source/ui/func/fupage.cxx6
-rw-r--r--sd/source/ui/func/fupoor.cxx11
-rw-r--r--sd/source/ui/inc/AccessibleDocumentViewBase.hxx2
-rw-r--r--sd/source/ui/inc/AccessibleSlideSorterView.hxx3
-rw-r--r--sd/source/ui/inc/BreakDlg.hxx9
-rw-r--r--sd/source/ui/inc/DrawDocShell.hxx4
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx6
-rw-r--r--sd/source/ui/inc/FormShellManager.hxx3
-rw-r--r--sd/source/ui/inc/OutlineBulletDlg.hxx1
-rw-r--r--sd/source/ui/inc/PreviewRenderer.hxx2
-rw-r--r--sd/source/ui/inc/Ruler.hxx3
-rw-r--r--sd/source/ui/inc/SlideSorter.hxx35
-rw-r--r--sd/source/ui/inc/View.hxx4
-rw-r--r--sd/source/ui/inc/ViewShell.hxx18
-rw-r--r--sd/source/ui/inc/ViewTabBar.hxx6
-rw-r--r--sd/source/ui/inc/Window.hxx5
-rw-r--r--sd/source/ui/inc/WindowUpdater.hxx3
-rw-r--r--sd/source/ui/inc/animobjs.hxx47
-rw-r--r--sd/source/ui/inc/assclass.hxx2
-rw-r--r--sd/source/ui/inc/copydlg.hxx23
-rw-r--r--sd/source/ui/inc/createtabledesignpanel.hxx3
-rw-r--r--sd/source/ui/inc/custsdlg.hxx41
-rw-r--r--sd/source/ui/inc/diactrl.hxx2
-rw-r--r--sd/source/ui/inc/dlgass.hxx1
-rw-r--r--sd/source/ui/inc/dlgctrls.hxx3
-rw-r--r--sd/source/ui/inc/dlgfield.hxx11
-rw-r--r--sd/source/ui/inc/dlgsnap.hxx20
-rw-r--r--sd/source/ui/inc/docprev.hxx1
-rw-r--r--sd/source/ui/inc/drawview.hxx2
-rw-r--r--sd/source/ui/inc/framework/Pane.hxx3
-rw-r--r--sd/source/ui/inc/fupoor.hxx6
-rw-r--r--sd/source/ui/inc/gluectrl.hxx2
-rw-r--r--sd/source/ui/inc/headerfooterdlg.hxx13
-rw-r--r--sd/source/ui/inc/ins_paste.hxx6
-rw-r--r--sd/source/ui/inc/inspagob.hxx7
-rw-r--r--sd/source/ui/inc/layeroptionsdlg.hxx15
-rw-r--r--sd/source/ui/inc/masterlayoutdlg.hxx12
-rw-r--r--sd/source/ui/inc/morphdlg.hxx7
-rw-r--r--sd/source/ui/inc/navigatr.hxx11
-rw-r--r--sd/source/ui/inc/present.hxx48
-rw-r--r--sd/source/ui/inc/prltempl.hxx1
-rw-r--r--sd/source/ui/inc/prntopts.hxx41
-rw-r--r--sd/source/ui/inc/pubdlg.hxx169
-rw-r--r--sd/source/ui/inc/sdpreslt.hxx10
-rw-r--r--sd/source/ui/inc/sdtreelb.hxx5
-rw-r--r--sd/source/ui/inc/sdxfer.hxx2
-rw-r--r--sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx2
-rw-r--r--sd/source/ui/inc/tbx_ww.hxx2
-rw-r--r--sd/source/ui/inc/tpaction.hxx33
-rw-r--r--sd/source/ui/inc/tpoption.hxx68
-rw-r--r--sd/source/ui/inc/vectdlg.hxx21
-rw-r--r--sd/source/ui/presenter/PresenterHelper.cxx4
-rw-r--r--sd/source/ui/presenter/PresenterTextView.cxx11
-rw-r--r--sd/source/ui/sidebar/AllMasterPagesSelector.cxx7
-rw-r--r--sd/source/ui/sidebar/AllMasterPagesSelector.hxx2
-rw-r--r--sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx14
-rw-r--r--sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx3
-rw-r--r--sd/source/ui/sidebar/LayoutMenu.cxx6
-rw-r--r--sd/source/ui/sidebar/LayoutMenu.hxx1
-rw-r--r--sd/source/ui/sidebar/MasterPagesSelector.cxx6
-rw-r--r--sd/source/ui/sidebar/MasterPagesSelector.hxx1
-rw-r--r--sd/source/ui/sidebar/NavigatorWrapper.cxx25
-rw-r--r--sd/source/ui/sidebar/NavigatorWrapper.hxx4
-rw-r--r--sd/source/ui/sidebar/PanelBase.cxx14
-rw-r--r--sd/source/ui/sidebar/PanelBase.hxx3
-rw-r--r--sd/source/ui/sidebar/PanelFactory.cxx14
-rw-r--r--sd/source/ui/sidebar/RecentMasterPagesSelector.cxx13
-rw-r--r--sd/source/ui/sidebar/RecentMasterPagesSelector.hxx3
-rw-r--r--sd/source/ui/slideshow/showwin.cxx22
-rw-r--r--sd/source/ui/slideshow/showwindow.hxx1
-rw-r--r--sd/source/ui/slideshow/slideshow.cxx4
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx22
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.hxx12
-rw-r--r--sd/source/ui/slidesorter/controller/SlideSorterController.cxx16
-rw-r--r--sd/source/ui/slidesorter/controller/SlsClipboard.cxx6
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx2
-rw-r--r--sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx34
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx4
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx14
-rw-r--r--sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx4
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx9
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx2
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx4
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx4
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorter.cxx60
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx2
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx28
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx10
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx18
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx26
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx8
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayouter.cxx20
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx6
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx6
-rw-r--r--sd/source/ui/slidesorter/view/SlsToolTip.cxx8
-rw-r--r--sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx2
-rw-r--r--sd/source/ui/table/TableDesignPane.cxx6
-rw-r--r--sd/source/ui/table/TableDesignPane.hxx4
-rw-r--r--sd/source/ui/tools/PreviewRenderer.cxx2
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx4
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx19
-rw-r--r--sd/source/ui/view/FormShellManager.cxx4
-rw-r--r--sd/source/ui/view/Outliner.cxx24
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx17
-rw-r--r--sd/source/ui/view/ViewTabBar.cxx6
-rw-r--r--sd/source/ui/view/drawview.cxx5
-rw-r--r--sd/source/ui/view/drviews1.cxx64
-rw-r--r--sd/source/ui/view/drviews2.cxx20
-rw-r--r--sd/source/ui/view/drviews3.cxx2
-rw-r--r--sd/source/ui/view/drviews4.cxx2
-rw-r--r--sd/source/ui/view/drviews5.cxx4
-rw-r--r--sd/source/ui/view/drviews6.cxx4
-rw-r--r--sd/source/ui/view/drviews7.cxx2
-rw-r--r--sd/source/ui/view/drviews9.cxx10
-rw-r--r--sd/source/ui/view/drviewsa.cxx8
-rw-r--r--sd/source/ui/view/drviewsb.cxx4
-rw-r--r--sd/source/ui/view/drviewse.cxx2
-rw-r--r--sd/source/ui/view/drviewsi.cxx4
-rw-r--r--sd/source/ui/view/grviewsh.cxx2
-rw-r--r--sd/source/ui/view/sdruler.cxx7
-rw-r--r--sd/source/ui/view/sdview2.cxx2
-rw-r--r--sd/source/ui/view/sdwindow.cxx7
-rw-r--r--sd/source/ui/view/viewshe2.cxx2
-rw-r--r--sd/source/ui/view/viewshel.cxx18
-rw-r--r--sfx2/inc/inettbc.hxx2
-rw-r--r--sfx2/inc/srchdlg.hxx19
-rw-r--r--sfx2/source/appl/appopen.cxx10
-rw-r--r--sfx2/source/appl/appserv.cxx12
-rw-r--r--sfx2/source/appl/childwin.cxx24
-rw-r--r--sfx2/source/appl/fileobj.hxx2
-rw-r--r--sfx2/source/appl/helpinterceptor.hxx3
-rw-r--r--sfx2/source/appl/impldde.cxx30
-rw-r--r--sfx2/source/appl/lnkbase2.cxx4
-rw-r--r--sfx2/source/appl/module.cxx5
-rw-r--r--sfx2/source/appl/newhelp.cxx285
-rw-r--r--sfx2/source/appl/newhelp.hxx93
-rw-r--r--sfx2/source/appl/opengrf.cxx4
-rw-r--r--sfx2/source/appl/openuriexternally.cxx6
-rw-r--r--sfx2/source/appl/sfxhelp.cxx12
-rw-r--r--sfx2/source/appl/workwin.cxx29
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx4
-rw-r--r--sfx2/source/control/ctrlitem.cxx9
-rw-r--r--sfx2/source/control/recentdocsview.cxx4
-rw-r--r--sfx2/source/control/templateabstractview.cxx36
-rw-r--r--sfx2/source/control/templatedefaultview.cxx4
-rw-r--r--sfx2/source/control/templatelocalview.cxx18
-rw-r--r--sfx2/source/control/templateremoteview.cxx6
-rw-r--r--sfx2/source/control/templatesearchview.cxx4
-rw-r--r--sfx2/source/control/thumbnailview.cxx14
-rw-r--r--sfx2/source/control/thumbnailviewacc.cxx2
-rw-r--r--sfx2/source/control/thumbnailviewacc.hxx3
-rw-r--r--sfx2/source/control/thumbnailviewitem.cxx13
-rw-r--r--sfx2/source/dialog/alienwarn.cxx9
-rw-r--r--sfx2/source/dialog/backingcomp.cxx12
-rw-r--r--sfx2/source/dialog/backingwindow.cxx44
-rw-r--r--sfx2/source/dialog/backingwindow.hxx47
-rw-r--r--sfx2/source/dialog/basedlgs.cxx56
-rw-r--r--sfx2/source/dialog/checkin.cxx13
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx478
-rw-r--r--sfx2/source/dialog/dockwin.cxx27
-rw-r--r--sfx2/source/dialog/documentfontsdialog.cxx15
-rw-r--r--sfx2/source/dialog/filedlgimpl.hxx2
-rw-r--r--sfx2/source/dialog/infobar.cxx71
-rw-r--r--sfx2/source/dialog/inputdlg.cxx14
-rw-r--r--sfx2/source/dialog/mailmodel.cxx4
-rw-r--r--sfx2/source/dialog/mgetempl.cxx52
-rw-r--r--sfx2/source/dialog/navigat.cxx4
-rw-r--r--sfx2/source/dialog/newstyle.cxx15
-rw-r--r--sfx2/source/dialog/partwnd.cxx16
-rw-r--r--sfx2/source/dialog/passwd.cxx26
-rw-r--r--sfx2/source/dialog/printopt.cxx30
-rw-r--r--sfx2/source/dialog/recfloat.cxx17
-rw-r--r--sfx2/source/dialog/securitypage.cxx30
-rw-r--r--sfx2/source/dialog/splitwin.cxx30
-rw-r--r--sfx2/source/dialog/srchdlg.cxx12
-rw-r--r--sfx2/source/dialog/styledlg.cxx5
-rw-r--r--sfx2/source/dialog/tabdlg.cxx64
-rw-r--r--sfx2/source/dialog/taskpane.cxx63
-rw-r--r--sfx2/source/dialog/templateinfodlg.cxx12
-rw-r--r--sfx2/source/dialog/templdlg.cxx265
-rw-r--r--sfx2/source/dialog/titledockwin.cxx45
-rw-r--r--sfx2/source/dialog/versdlg.cxx53
-rw-r--r--sfx2/source/doc/QuerySaveDocument.cxx6
-rw-r--r--sfx2/source/doc/docinsert.cxx8
-rw-r--r--sfx2/source/doc/doctemplates.cxx14
-rw-r--r--sfx2/source/doc/guisaveas.cxx8
-rw-r--r--sfx2/source/doc/iframe.cxx2
-rw-r--r--sfx2/source/doc/new.cxx28
-rw-r--r--sfx2/source/doc/objcont.cxx20
-rw-r--r--sfx2/source/doc/objserv.cxx28
-rw-r--r--sfx2/source/doc/objstor.cxx4
-rw-r--r--sfx2/source/doc/plugin.cxx2
-rw-r--r--sfx2/source/doc/printhelper.cxx6
-rw-r--r--sfx2/source/doc/templatedlg.cxx84
-rw-r--r--sfx2/source/inc/alienwarn.hxx7
-rw-r--r--sfx2/source/inc/documentfontsdialog.hxx6
-rw-r--r--sfx2/source/inc/inputdlg.hxx10
-rw-r--r--sfx2/source/inc/partwnd.hxx1
-rw-r--r--sfx2/source/inc/recfloat.hxx3
-rw-r--r--sfx2/source/inc/splitwin.hxx11
-rw-r--r--sfx2/source/inc/templatesearchview.hxx2
-rw-r--r--sfx2/source/inc/templdgi.hxx17
-rw-r--r--sfx2/source/inc/versdlg.hxx42
-rw-r--r--sfx2/source/inc/workwin.hxx14
-rw-r--r--sfx2/source/inet/inettbc.cxx7
-rw-r--r--sfx2/source/sidebar/ControlFactory.cxx8
-rw-r--r--sfx2/source/sidebar/ControllerItem.cxx8
-rw-r--r--sfx2/source/sidebar/Deck.cxx67
-rw-r--r--sfx2/source/sidebar/Deck.hxx16
-rw-r--r--sfx2/source/sidebar/DeckLayouter.cxx4
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.cxx14
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.hxx1
-rw-r--r--sfx2/source/sidebar/FocusManager.cxx24
-rw-r--r--sfx2/source/sidebar/FocusManager.hxx10
-rw-r--r--sfx2/source/sidebar/MenuButton.cxx4
-rw-r--r--sfx2/source/sidebar/MenuButton.hxx1
-rw-r--r--sfx2/source/sidebar/Panel.cxx10
-rw-r--r--sfx2/source/sidebar/Panel.hxx8
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.cxx31
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.hxx3
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx6
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx83
-rw-r--r--sfx2/source/sidebar/SidebarController.hxx12
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx6
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.hxx1
-rw-r--r--sfx2/source/sidebar/SidebarPanelBase.cxx16
-rw-r--r--sfx2/source/sidebar/SidebarToolBox.cxx8
-rw-r--r--sfx2/source/sidebar/TabBar.cxx25
-rw-r--r--sfx2/source/sidebar/TabBar.hxx7
-rw-r--r--sfx2/source/sidebar/TabItem.cxx4
-rw-r--r--sfx2/source/sidebar/TabItem.hxx1
-rw-r--r--sfx2/source/sidebar/TitleBar.cxx21
-rw-r--r--sfx2/source/sidebar/TitleBar.hxx7
-rw-r--r--sfx2/source/statbar/stbitem.cxx2
-rw-r--r--sfx2/source/toolbox/imgmgr.cxx2
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx48
-rw-r--r--sfx2/source/view/frame.cxx2
-rw-r--r--sfx2/source/view/frame2.cxx9
-rw-r--r--sfx2/source/view/impframe.hxx14
-rw-r--r--sfx2/source/view/impviewframe.hxx4
-rw-r--r--sfx2/source/view/printer.cxx27
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx20
-rw-r--r--sfx2/source/view/viewprn.cxx57
-rw-r--r--sfx2/source/view/viewsh.cxx12
-rw-r--r--slideshow/source/engine/rehearsetimingsactivity.cxx40
-rw-r--r--slideshow/source/engine/shapes/gdimtftools.cxx42
-rw-r--r--slideshow/source/engine/shapes/viewmediashape.cxx6
-rw-r--r--slideshow/source/engine/shapes/viewmediashape.hxx5
-rw-r--r--starmath/inc/ElementsDockingWindow.hxx8
-rw-r--r--starmath/inc/dialog.hxx182
-rw-r--r--starmath/inc/document.hxx12
-rw-r--r--starmath/inc/edit.hxx7
-rw-r--r--starmath/inc/smmod.hxx4
-rw-r--r--starmath/inc/toolbox.hxx7
-rw-r--r--starmath/inc/view.hxx18
-rw-r--r--starmath/inc/visitors.hxx2
-rw-r--r--starmath/qa/cppunit/test_nodetotextvisitors.cxx32
-rw-r--r--starmath/qa/cppunit/test_starmath.cxx12
-rw-r--r--starmath/source/ElementsDockingWindow.cxx24
-rw-r--r--starmath/source/accessibility.hxx4
-rw-r--r--starmath/source/dialog.cxx187
-rw-r--r--starmath/source/document.cxx16
-rw-r--r--starmath/source/edit.cxx26
-rw-r--r--starmath/source/smmod.cxx7
-rw-r--r--starmath/source/toolbox.cxx24
-rw-r--r--starmath/source/unomodel.cxx10
-rw-r--r--starmath/source/view.cxx62
-rw-r--r--svtools/inc/roadmap.hxx1
-rw-r--r--svtools/inc/table/tablecontrol.hxx1
-rw-r--r--svtools/inc/vclxaccessibleheaderbar.hxx2
-rw-r--r--svtools/inc/vclxaccessibleheaderbaritem.hxx3
-rw-r--r--svtools/source/brwbox/brwbox1.cxx79
-rw-r--r--svtools/source/brwbox/brwbox2.cxx74
-rw-r--r--svtools/source/brwbox/brwhead.cxx12
-rw-r--r--svtools/source/brwbox/datwin.cxx20
-rw-r--r--svtools/source/brwbox/datwin.hxx13
-rw-r--r--svtools/source/brwbox/ebbcontrols.cxx10
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx21
-rw-r--r--svtools/source/contnr/DocumentInfoPreview.cxx42
-rw-r--r--svtools/source/contnr/fileview.cxx54
-rw-r--r--svtools/source/contnr/imivctl.hxx19
-rw-r--r--svtools/source/contnr/imivctl1.cxx173
-rw-r--r--svtools/source/contnr/ivctrl.cxx23
-rw-r--r--svtools/source/contnr/simptabl.cxx110
-rw-r--r--svtools/source/contnr/svimpbox.cxx191
-rw-r--r--svtools/source/contnr/svtabbx.cxx14
-rw-r--r--svtools/source/contnr/treelistbox.cxx85
-rw-r--r--svtools/source/control/calendar.cxx75
-rw-r--r--svtools/source/control/ctrlbox.cxx71
-rw-r--r--svtools/source/control/ctrltool.cxx2
-rw-r--r--svtools/source/control/filectrl.cxx54
-rw-r--r--svtools/source/control/fmtfield.cxx10
-rw-r--r--svtools/source/control/headbar.cxx19
-rw-r--r--svtools/source/control/hyperlabel.cxx6
-rw-r--r--svtools/source/control/inettbc.cxx14
-rw-r--r--svtools/source/control/roadmap.cxx34
-rw-r--r--svtools/source/control/ruler.cxx109
-rw-r--r--svtools/source/control/scrwin.cxx89
-rw-r--r--svtools/source/control/tabbar.cxx64
-rw-r--r--svtools/source/control/toolbarmenu.cxx22
-rw-r--r--svtools/source/control/toolbarmenuimp.hxx2
-rw-r--r--svtools/source/control/valueacc.cxx2
-rw-r--r--svtools/source/control/valueimp.hxx2
-rw-r--r--svtools/source/control/valueset.cxx94
-rw-r--r--svtools/source/control/vclxaccessibleheaderbar.cxx3
-rw-r--r--svtools/source/dialogs/PlaceEditDialog.cxx12
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx42
-rw-r--r--svtools/source/dialogs/colrdlg.cxx1
-rw-r--r--svtools/source/dialogs/prnsetup.cxx37
-rw-r--r--svtools/source/dialogs/restartdialog.cxx15
-rw-r--r--svtools/source/dialogs/roadmapwizard.cxx19
-rw-r--r--svtools/source/dialogs/wizardmachine.cxx34
-rw-r--r--svtools/source/dialogs/wizdlg.cxx15
-rw-r--r--svtools/source/edit/editsyntaxhighlighter.cxx4
-rw-r--r--svtools/source/edit/svmedit2.cxx6
-rw-r--r--svtools/source/filter/GraphicExportOptionsDialog.cxx12
-rw-r--r--svtools/source/filter/exportdialog.cxx39
-rw-r--r--svtools/source/filter/exportdialog.hxx73
-rw-r--r--svtools/source/graphic/grfmgr2.cxx16
-rw-r--r--svtools/source/graphic/provider.cxx16
-rw-r--r--svtools/source/hatchwindow/hatchwindow.cxx4
-rw-r--r--svtools/source/inc/hatchwindow.hxx2
-rw-r--r--svtools/source/inc/renderer.hxx2
-rw-r--r--svtools/source/inc/svimpbox.hxx12
-rw-r--r--svtools/source/inc/unoiface.hxx9
-rw-r--r--svtools/source/java/javainteractionhandler.cxx28
-rw-r--r--svtools/source/misc/dialogcontrolling.cxx4
-rw-r--r--svtools/source/misc/ehdl.cxx10
-rw-r--r--svtools/source/misc/sampletext.cxx14
-rw-r--r--svtools/source/table/gridtablerenderer.cxx8
-rw-r--r--svtools/source/table/tablecontrol.cxx6
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx31
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx9
-rw-r--r--svtools/source/table/tabledatawindow.cxx6
-rw-r--r--svtools/source/table/tabledatawindow.hxx1
-rw-r--r--svtools/source/toolpanel/drawerlayouter.cxx14
-rw-r--r--svtools/source/toolpanel/paneltabbar.cxx84
-rw-r--r--svtools/source/toolpanel/paneltabbarpeer.cxx4
-rw-r--r--svtools/source/toolpanel/paneltabbarpeer.hxx2
-rw-r--r--svtools/source/toolpanel/tablayouter.cxx4
-rw-r--r--svtools/source/toolpanel/toolpaneldeck.cxx27
-rw-r--r--svtools/source/toolpanel/toolpaneldeckpeer.cxx4
-rw-r--r--svtools/source/toolpanel/toolpaneldeckpeer.hxx2
-rw-r--r--svtools/source/toolpanel/toolpaneldrawer.cxx26
-rw-r--r--svtools/source/toolpanel/toolpaneldrawer.hxx7
-rw-r--r--svtools/source/toolpanel/toolpaneldrawerpeer.cxx2
-rw-r--r--svtools/source/uno/addrtempuno.cxx10
-rw-r--r--svtools/source/uno/generictoolboxcontroller.cxx6
-rw-r--r--svtools/source/uno/genericunodialog.cxx5
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx10
-rw-r--r--svtools/source/uno/statusbarcontroller.cxx2
-rw-r--r--svtools/source/uno/svtxgridcontrol.cxx58
-rw-r--r--svtools/source/uno/svtxgridcontrol.hxx2
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx2
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx11
-rw-r--r--svtools/source/uno/treecontrolpeer.hxx4
-rw-r--r--svtools/source/uno/unoiface.cxx221
-rw-r--r--svtools/source/uno/wizard/unowizard.cxx28
-rw-r--r--svtools/source/uno/wizard/wizardshell.cxx16
-rw-r--r--svtools/source/uno/wizard/wizardshell.hxx5
-rw-r--r--svx/inc/GalleryControl.hxx9
-rw-r--r--svx/inc/extrusiondepthdialog.hxx4
-rw-r--r--svx/inc/galbrws2.hxx16
-rw-r--r--svx/inc/sdr/overlay/overlaymanagerbuffered.hxx4
-rw-r--r--svx/inc/svdibrow.hxx13
-rw-r--r--svx/inc/tbunosearchcontrollers.hxx5
-rw-r--r--svx/source/accessibility/AccessibleShapeTreeInfo.cxx1
-rw-r--r--svx/source/accessibility/GraphCtlAccessibleContext.cxx6
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFontWork.cxx30
-rw-r--r--svx/source/customshapes/tbxcustomshapes.cxx2
-rw-r--r--svx/source/dialog/_bmpmask.cxx66
-rw-r--r--svx/source/dialog/_contdlg.cxx72
-rw-r--r--svx/source/dialog/charmap.cxx55
-rw-r--r--svx/source/dialog/checklbx.cxx6
-rw-r--r--svx/source/dialog/compressgraphicdialog.cxx31
-rw-r--r--svx/source/dialog/connctrl.cxx6
-rw-r--r--svx/source/dialog/contimp.hxx9
-rw-r--r--svx/source/dialog/contwnd.cxx4
-rw-r--r--svx/source/dialog/contwnd.hxx1
-rw-r--r--svx/source/dialog/ctredlin.cxx76
-rw-r--r--svx/source/dialog/dialcontrol.cxx10
-rw-r--r--svx/source/dialog/dlgctl3d.cxx134
-rw-r--r--svx/source/dialog/dlgctrl.cxx88
-rw-r--r--svx/source/dialog/docrecovery.cxx73
-rw-r--r--svx/source/dialog/fntctrl.cxx12
-rw-r--r--svx/source/dialog/fontwork.cxx22
-rw-r--r--svx/source/dialog/frmdirlbox.cxx4
-rw-r--r--svx/source/dialog/frmsel.cxx39
-rw-r--r--svx/source/dialog/graphctl.cxx6
-rw-r--r--svx/source/dialog/hdft.cxx30
-rw-r--r--svx/source/dialog/imapdlg.cxx30
-rw-r--r--svx/source/dialog/imapwnd.cxx6
-rw-r--r--svx/source/dialog/imapwnd.hxx1
-rw-r--r--svx/source/dialog/langbox.cxx10
-rw-r--r--svx/source/dialog/linkwarn.cxx7
-rw-r--r--svx/source/dialog/measctrl.cxx6
-rw-r--r--svx/source/dialog/optgrid.cxx31
-rw-r--r--svx/source/dialog/orienthelper.cxx2
-rw-r--r--svx/source/dialog/pagectrl.cxx6
-rw-r--r--svx/source/dialog/passwd.cxx14
-rw-r--r--svx/source/dialog/prtqry.cxx5
-rw-r--r--svx/source/dialog/rubydialog.cxx41
-rw-r--r--svx/source/dialog/srchdlg.cxx52
-rw-r--r--svx/source/dialog/stddlg.cxx4
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.cxx16
-rw-r--r--svx/source/dialog/svxruler.cxx32
-rw-r--r--svx/source/dialog/swframeexample.cxx4
-rw-r--r--svx/source/dialog/txencbox.cxx6
-rw-r--r--svx/source/engine3d/float3d.cxx21
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx11
-rw-r--r--svx/source/fmcomp/fmgridif.cxx61
-rw-r--r--svx/source/fmcomp/gridcell.cxx381
-rw-r--r--svx/source/fmcomp/gridctrl.cxx339
-rw-r--r--svx/source/form/databaselocationinput.cxx4
-rw-r--r--svx/source/form/datanavi.cxx370
-rw-r--r--svx/source/form/filtnav.cxx20
-rw-r--r--svx/source/form/fmPropBrw.cxx13
-rw-r--r--svx/source/form/fmexpl.cxx14
-rw-r--r--svx/source/form/fmobj.cxx4
-rw-r--r--svx/source/form/fmshell.cxx7
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx8
-rw-r--r--svx/source/form/navigatortree.cxx6
-rw-r--r--svx/source/form/tabwin.cxx22
-rw-r--r--svx/source/form/tbxform.cxx27
-rw-r--r--svx/source/form/xfm_addcondition.cxx6
-rw-r--r--svx/source/gallery2/GalleryControl.cxx31
-rw-r--r--svx/source/gallery2/galbrws1.cxx34
-rw-r--r--svx/source/gallery2/galbrws1.hxx7
-rw-r--r--svx/source/gallery2/galbrws2.cxx140
-rw-r--r--svx/source/gallery2/galctrl.cxx8
-rw-r--r--svx/source/gallery2/galobj.cxx4
-rw-r--r--svx/source/gallery2/galtheme.cxx6
-rw-r--r--svx/source/inc/AccessibleFrameSelector.hxx3
-rw-r--r--svx/source/inc/GraphCtlAccessibleContext.hxx2
-rw-r--r--svx/source/inc/charmapacc.hxx2
-rw-r--r--svx/source/inc/datalistener.hxx3
-rw-r--r--svx/source/inc/datanavi.hxx143
-rw-r--r--svx/source/inc/docrecovery.hxx46
-rw-r--r--svx/source/inc/filtnav.hxx4
-rw-r--r--svx/source/inc/fmPropBrw.hxx1
-rw-r--r--svx/source/inc/fmexch.hxx7
-rw-r--r--svx/source/inc/fmexpl.hxx4
-rw-r--r--svx/source/inc/fmobj.hxx2
-rw-r--r--svx/source/inc/fmvwimp.hxx3
-rw-r--r--svx/source/inc/frmselimpl.hxx2
-rw-r--r--svx/source/inc/gridcell.hxx22
-rw-r--r--svx/source/inc/svxrectctaccessiblecontext.hxx3
-rw-r--r--svx/source/inc/tabwin.hxx6
-rw-r--r--svx/source/inc/tbxform.hxx13
-rw-r--r--svx/source/inc/xfm_addcondition.hxx2
-rw-r--r--svx/source/mnuctrls/clipboardctl.cxx2
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx6
-rw-r--r--svx/source/sdr/overlay/overlaymanagerbuffered.cxx94
-rw-r--r--svx/source/sidebar/EmptyPanel.cxx17
-rw-r--r--svx/source/sidebar/EmptyPanel.hxx3
-rw-r--r--svx/source/sidebar/PanelFactory.cxx12
-rw-r--r--svx/source/sidebar/PanelLayout.cxx7
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanel.cxx41
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanel.hxx37
-rw-r--r--svx/source/sidebar/area/AreaTransparencyGradientControl.cxx274
-rw-r--r--svx/source/sidebar/area/AreaTransparencyGradientControl.hxx29
-rw-r--r--svx/source/sidebar/graphic/GraphicPropertyPanel.cxx35
-rw-r--r--svx/source/sidebar/graphic/GraphicPropertyPanel.hxx34
-rw-r--r--svx/source/sidebar/insert/InsertPropertyPanel.cxx15
-rw-r--r--svx/source/sidebar/insert/InsertPropertyPanel.hxx5
-rw-r--r--svx/source/sidebar/line/LinePropertyPanel.cxx39
-rw-r--r--svx/source/sidebar/line/LinePropertyPanel.hxx46
-rw-r--r--svx/source/sidebar/line/LineWidthControl.cxx153
-rw-r--r--svx/source/sidebar/line/LineWidthControl.hxx11
-rw-r--r--svx/source/sidebar/line/LineWidthValueSet.cxx11
-rw-r--r--svx/source/sidebar/line/LineWidthValueSet.hxx3
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx25
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx19
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx4
-rw-r--r--svx/source/sidebar/paragraph/ParaPropertyPanel.cxx45
-rw-r--r--svx/source/sidebar/paragraph/ParaPropertyPanel.hxx38
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx50
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.hxx48
-rw-r--r--svx/source/sidebar/possize/SidebarDialControl.cxx4
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingControl.cxx235
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingControl.hxx13
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingPopup.cxx2
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingPopup.hxx2
-rw-r--r--svx/source/sidebar/text/TextPropertyPanel.cxx36
-rw-r--r--svx/source/sidebar/text/TextPropertyPanel.hxx33
-rw-r--r--svx/source/sidebar/text/TextUnderlineControl.cxx178
-rw-r--r--svx/source/sidebar/text/TextUnderlineControl.hxx6
-rw-r--r--svx/source/sidebar/tools/Popup.cxx8
-rw-r--r--svx/source/sidebar/tools/PopupContainer.cxx7
-rw-r--r--svx/source/sidebar/tools/PopupControl.cxx10
-rw-r--r--svx/source/sidebar/tools/ValueSetWithTextControl.cxx6
-rw-r--r--svx/source/svdraw/sdrpaintwindow.cxx38
-rw-r--r--svx/source/svdraw/svdedxv.cxx30
-rw-r--r--svx/source/svdraw/svdfmtf.cxx54
-rw-r--r--svx/source/svdraw/svdfmtf.hxx36
-rw-r--r--svx/source/svdraw/svdibrow.cxx51
-rw-r--r--svx/source/svdraw/svdmrkv.cxx2
-rw-r--r--svx/source/svdraw/svdmrkv1.cxx2
-rw-r--r--svx/source/svdraw/svdograf.cxx10
-rw-r--r--svx/source/svdraw/svdotext.cxx8
-rw-r--r--svx/source/svdraw/svdpntv.cxx26
-rw-r--r--svx/source/svdraw/svdtrans.cxx16
-rw-r--r--svx/source/svdraw/svdview.cxx18
-rw-r--r--svx/source/svdraw/svdxcgv.cxx22
-rw-r--r--svx/source/tbxctrls/SvxColorChildWindow.cxx3
-rw-r--r--svx/source/tbxctrls/bulletsnumbering.cxx23
-rw-r--r--svx/source/tbxctrls/colorwindow.hxx15
-rw-r--r--svx/source/tbxctrls/colrctrl.cxx71
-rw-r--r--svx/source/tbxctrls/extrusioncontrols.cxx49
-rw-r--r--svx/source/tbxctrls/extrusioncontrols.hxx16
-rw-r--r--svx/source/tbxctrls/fillctrl.cxx22
-rw-r--r--svx/source/tbxctrls/fontworkgallery.cxx48
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx73
-rw-r--r--svx/source/tbxctrls/itemwin.cxx24
-rw-r--r--svx/source/tbxctrls/layctrl.cxx44
-rw-r--r--svx/source/tbxctrls/lboxctrl.cxx35
-rw-r--r--svx/source/tbxctrls/linectrl.cxx85
-rw-r--r--svx/source/tbxctrls/subtoolboxcontrol.cxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx223
-rw-r--r--svx/source/tbxctrls/tbunocontroller.cxx8
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx16
-rw-r--r--svx/source/tbxctrls/tbxalign.cxx2
-rw-r--r--svx/source/toolbars/extrusionbar.cxx6
-rw-r--r--svx/source/toolbars/fontworkbar.cxx10
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx41
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx41
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx5
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx3
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx15
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx13
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx52
-rw-r--r--svx/source/unodraw/recoveryui.cxx6
-rw-r--r--svx/source/unodraw/unoshape.cxx6
-rw-r--r--svx/source/unodraw/unoshtxt.cxx2
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx38
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx24
-rw-r--r--svx/source/xoutdev/xtabdash.cxx16
-rw-r--r--svx/source/xoutdev/xtabgrdt.cxx10
-rw-r--r--svx/source/xoutdev/xtabhtch.cxx16
-rw-r--r--svx/source/xoutdev/xtablend.cxx16
-rw-r--r--svx/workben/msview/msview.cxx2
-rw-r--r--svx/workben/pixelctl.cxx23
-rw-r--r--sw/inc/AnnotationWin.hxx3
-rw-r--r--sw/inc/PostItMgr.hxx5
-rw-r--r--sw/inc/SidebarWin.hxx13
-rw-r--r--sw/inc/colwd.hxx6
-rw-r--r--sw/inc/docsh.hxx2
-rw-r--r--sw/inc/hhcwrp.hxx2
-rw-r--r--sw/inc/hints.hxx5
-rw-r--r--sw/inc/postithelper.hxx6
-rw-r--r--sw/inc/printdata.hxx2
-rw-r--r--sw/inc/swmodule.hxx2
-rw-r--r--sw/inc/viewsh.hxx14
-rw-r--r--sw/qa/tiledrendering/tiledrendering.cxx215
-rw-r--r--sw/source/core/access/accdoc.hxx2
-rw-r--r--sw/source/core/access/accfrmobj.cxx2
-rw-r--r--sw/source/core/access/accfrmobj.hxx3
-rw-r--r--sw/source/core/attr/hints.cxx2
-rw-r--r--sw/source/core/doc/DocumentDeviceManager.cxx37
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx4
-rw-r--r--sw/source/core/draw/dflyobj.cxx2
-rw-r--r--sw/source/core/fields/postithelper.cxx4
-rw-r--r--sw/source/core/frmedt/fecopy.cxx20
-rw-r--r--sw/source/core/inc/DocumentDeviceManager.hxx6
-rw-r--r--sw/source/core/inc/drawfont.hxx5
-rw-r--r--sw/source/core/inc/fntcache.hxx5
-rw-r--r--sw/source/core/layout/paintfrm.cxx26
-rw-r--r--sw/source/core/layout/virtoutp.cxx5
-rw-r--r--sw/source/core/layout/virtoutp.hxx6
-rw-r--r--sw/source/core/text/inftxt.hxx4
-rw-r--r--sw/source/core/text/itratr.cxx6
-rw-r--r--sw/source/core/text/itratr.hxx2
-rw-r--r--sw/source/core/text/itrtxt.hxx2
-rw-r--r--sw/source/core/text/txtpaint.hxx4
-rw-r--r--sw/source/core/txtnode/fntcache.cxx10
-rw-r--r--sw/source/core/view/printdata.cxx8
-rw-r--r--sw/source/core/view/viewsh.cxx24
-rw-r--r--sw/source/core/view/vnew.cxx2
-rw-r--r--sw/source/core/view/vprint.cxx2
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx12
-rw-r--r--sw/source/ui/chrdlg/break.cxx21
-rw-r--r--sw/source/ui/chrdlg/chardlg.cxx22
-rw-r--r--sw/source/ui/chrdlg/drpcps.cxx41
-rw-r--r--sw/source/ui/chrdlg/numpara.cxx29
-rw-r--r--sw/source/ui/chrdlg/swuiccoll.cxx21
-rw-r--r--sw/source/ui/config/mailconfigpage.cxx141
-rw-r--r--sw/source/ui/config/optcomp.cxx20
-rw-r--r--sw/source/ui/config/optload.cxx62
-rw-r--r--sw/source/ui/config/optpage.cxx230
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx30
-rw-r--r--sw/source/ui/dbui/addresslistdialog.hxx19
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.cxx95
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.hxx39
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.cxx33
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.hxx20
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx39
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.cxx8
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.hxx5
-rw-r--r--sw/source/ui/dbui/mailmergewizard.cxx20
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx266
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.hxx99
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.cxx17
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.hxx19
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.cxx29
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.hxx52
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.cxx18
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.hxx23
-rw-r--r--sw/source/ui/dbui/mmmergepage.cxx19
-rw-r--r--sw/source/ui/dbui/mmmergepage.hxx18
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx116
-rw-r--r--sw/source/ui/dbui/mmoutputpage.hxx88
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.cxx48
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.hxx12
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.cxx18
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.hxx18
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.cxx13
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.hxx5
-rw-r--r--sw/source/ui/dialog/abstract.cxx12
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx21
-rw-r--r--sw/source/ui/dialog/docstdlg.cxx23
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx145
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx5
-rw-r--r--sw/source/ui/dialog/swmessdialog.cxx15
-rw-r--r--sw/source/ui/dialog/swuiexp.cxx25
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx134
-rw-r--r--sw/source/ui/dialog/wordcountdialog.cxx19
-rw-r--r--sw/source/ui/dochdl/selglos.cxx11
-rw-r--r--sw/source/ui/envelp/envfmt.cxx27
-rw-r--r--sw/source/ui/envelp/envfmt.hxx27
-rw-r--r--sw/source/ui/envelp/envlop1.cxx24
-rw-r--r--sw/source/ui/envelp/envprt.cxx23
-rw-r--r--sw/source/ui/envelp/envprt.hxx23
-rw-r--r--sw/source/ui/envelp/label1.cxx130
-rw-r--r--sw/source/ui/envelp/labfmt.cxx51
-rw-r--r--sw/source/ui/envelp/labfmt.hxx46
-rw-r--r--sw/source/ui/envelp/labprt.cxx23
-rw-r--r--sw/source/ui/envelp/labprt.hxx28
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx60
-rw-r--r--sw/source/ui/envelp/swuilabimp.hxx131
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.cxx14
-rw-r--r--sw/source/ui/fldui/changedb.cxx12
-rw-r--r--sw/source/ui/fldui/flddb.cxx24
-rw-r--r--sw/source/ui/fldui/flddb.hxx27
-rw-r--r--sw/source/ui/fldui/flddinf.cxx18
-rw-r--r--sw/source/ui/fldui/flddinf.hxx15
-rw-r--r--sw/source/ui/fldui/flddok.cxx27
-rw-r--r--sw/source/ui/fldui/flddok.hxx31
-rw-r--r--sw/source/ui/fldui/fldedt.cxx28
-rw-r--r--sw/source/ui/fldui/fldfunc.cxx37
-rw-r--r--sw/source/ui/fldui/fldfunc.hxx53
-rw-r--r--sw/source/ui/fldui/fldref.cxx21
-rw-r--r--sw/source/ui/fldui/fldref.hxx21
-rw-r--r--sw/source/ui/fldui/fldvar.cxx28
-rw-r--r--sw/source/ui/fldui/fldvar.hxx35
-rw-r--r--sw/source/ui/fldui/inpdlg.cxx14
-rw-r--r--sw/source/ui/fldui/javaedit.cxx16
-rw-r--r--sw/source/ui/fmtui/tmpdlg.cxx12
-rw-r--r--sw/source/ui/frmdlg/column.cxx45
-rw-r--r--sw/source/ui/frmdlg/cption.cxx67
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx117
-rw-r--r--sw/source/ui/frmdlg/wrap.cxx26
-rw-r--r--sw/source/ui/index/cnttab.cxx304
-rw-r--r--sw/source/ui/index/multmrk.cxx13
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx59
-rw-r--r--sw/source/ui/misc/bookmark.cxx9
-rw-r--r--sw/source/ui/misc/docfnote.cxx39
-rw-r--r--sw/source/ui/misc/glosbib.cxx16
-rw-r--r--sw/source/ui/misc/glossary.cxx61
-rw-r--r--sw/source/ui/misc/impfnote.hxx39
-rw-r--r--sw/source/ui/misc/insfnote.cxx17
-rw-r--r--sw/source/ui/misc/linenum.cxx22
-rw-r--r--sw/source/ui/misc/num.cxx52
-rw-r--r--sw/source/ui/misc/outline.cxx55
-rw-r--r--sw/source/ui/misc/pgfnote.cxx20
-rw-r--r--sw/source/ui/misc/pggrid.cxx35
-rw-r--r--sw/source/ui/misc/srtdlg.cxx35
-rw-r--r--sw/source/ui/misc/swmodalredlineacceptdlg.cxx6
-rw-r--r--sw/source/ui/misc/titlepage.cxx18
-rw-r--r--sw/source/ui/table/colwd.cxx12
-rw-r--r--sw/source/ui/table/convert.cxx20
-rw-r--r--sw/source/ui/table/instable.cxx17
-rw-r--r--sw/source/ui/table/mergetbl.cxx12
-rw-r--r--sw/source/ui/table/rowht.cxx12
-rw-r--r--sw/source/ui/table/splittbl.cxx14
-rw-r--r--sw/source/ui/table/tabledlg.cxx90
-rw-r--r--sw/source/ui/table/tautofmt.cxx103
-rw-r--r--sw/source/ui/utlui/swrenamexnameddlg.cxx12
-rw-r--r--sw/source/uibase/app/appopt.cxx4
-rw-r--r--sw/source/uibase/app/docsh2.cxx16
-rw-r--r--sw/source/uibase/app/docst.cxx3
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx16
-rw-r--r--sw/source/uibase/dbui/dbtree.cxx8
-rw-r--r--sw/source/uibase/dbui/dbui.cxx36
-rw-r--r--sw/source/uibase/dbui/mailmergechildwindow.cxx15
-rw-r--r--sw/source/uibase/dbui/mailmergehelper.cxx49
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx6
-rw-r--r--sw/source/uibase/docvw/AnnotationMenuButton.cxx6
-rw-r--r--sw/source/uibase/docvw/AnnotationMenuButton.hxx1
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx10
-rw-r--r--sw/source/uibase/docvw/FrameControlsManager.cxx5
-rw-r--r--sw/source/uibase/docvw/HeaderFooterWin.cxx10
-rw-r--r--sw/source/uibase/docvw/PageBreakWin.cxx17
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx14
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx6
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.hxx1
-rw-r--r--sw/source/uibase/docvw/SidebarWin.cxx35
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx24
-rw-r--r--sw/source/uibase/docvw/frmsidebarwincontainer.cxx2
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx21
-rw-r--r--sw/source/uibase/envelp/syncbtn.cxx15
-rw-r--r--sw/source/uibase/frmdlg/colex.cxx6
-rw-r--r--sw/source/uibase/inc/DropDownFieldDialog.hxx10
-rw-r--r--sw/source/uibase/inc/FrameControl.hxx2
-rw-r--r--sw/source/uibase/inc/FrameControlsManager.hxx5
-rw-r--r--sw/source/uibase/inc/HeaderFooterWin.hxx5
-rw-r--r--sw/source/uibase/inc/PageBreakWin.hxx3
-rw-r--r--sw/source/uibase/inc/abstract.hxx8
-rw-r--r--sw/source/uibase/inc/ascfldlg.hxx17
-rw-r--r--sw/source/uibase/inc/bookmark.hxx7
-rw-r--r--sw/source/uibase/inc/break.hxx15
-rw-r--r--sw/source/uibase/inc/changedb.hxx11
-rw-r--r--sw/source/uibase/inc/chrdlg.hxx27
-rw-r--r--sw/source/uibase/inc/colex.hxx1
-rw-r--r--sw/source/uibase/inc/column.hxx63
-rw-r--r--sw/source/uibase/inc/conttree.hxx8
-rw-r--r--sw/source/uibase/inc/convert.hxx29
-rw-r--r--sw/source/uibase/inc/cption.hxx31
-rw-r--r--sw/source/uibase/inc/dbinsdlg.hxx51
-rw-r--r--sw/source/uibase/inc/dbtree.hxx1
-rw-r--r--sw/source/uibase/inc/dbui.hxx18
-rw-r--r--sw/source/uibase/inc/docstdlg.hxx25
-rw-r--r--sw/source/uibase/inc/drawbase.hxx2
-rw-r--r--sw/source/uibase/inc/drpcps.hxx36
-rw-r--r--sw/source/uibase/inc/edtwin.hxx2
-rw-r--r--sw/source/uibase/inc/envlop.hxx27
-rw-r--r--sw/source/uibase/inc/fldedt.hxx9
-rw-r--r--sw/source/uibase/inc/fldmgr.hxx3
-rw-r--r--sw/source/uibase/inc/formedt.hxx35
-rw-r--r--sw/source/uibase/inc/frmpage.hxx183
-rw-r--r--sw/source/uibase/inc/glosbib.hxx13
-rw-r--r--sw/source/uibase/inc/glossary.hxx25
-rw-r--r--sw/source/uibase/inc/inpdlg.hxx10
-rw-r--r--sw/source/uibase/inc/inputwin.hxx9
-rw-r--r--sw/source/uibase/inc/insfnote.hxx21
-rw-r--r--sw/source/uibase/inc/instable.hxx23
-rw-r--r--sw/source/uibase/inc/javaedit.hxx21
-rw-r--r--sw/source/uibase/inc/label.hxx3
-rw-r--r--sw/source/uibase/inc/linenum.hxx31
-rw-r--r--sw/source/uibase/inc/mailconfigpage.hxx25
-rw-r--r--sw/source/uibase/inc/mailmergechildwindow.hxx4
-rw-r--r--sw/source/uibase/inc/mailmergehelper.hxx6
-rw-r--r--sw/source/uibase/inc/mailmergewizard.hxx2
-rw-r--r--sw/source/uibase/inc/mailmrge.hxx90
-rw-r--r--sw/source/uibase/inc/mergetbl.hxx4
-rw-r--r--sw/source/uibase/inc/multmrk.hxx5
-rw-r--r--sw/source/uibase/inc/navipi.hxx17
-rw-r--r--sw/source/uibase/inc/num.hxx53
-rw-r--r--sw/source/uibase/inc/numberingtypelistbox.hxx1
-rw-r--r--sw/source/uibase/inc/numfmtlb.hxx1
-rw-r--r--sw/source/uibase/inc/numpara.hxx37
-rw-r--r--sw/source/uibase/inc/optcomp.hxx11
-rw-r--r--sw/source/uibase/inc/optload.hxx79
-rw-r--r--sw/source/uibase/inc/optpage.hxx310
-rw-r--r--sw/source/uibase/inc/outline.hxx36
-rw-r--r--sw/source/uibase/inc/pgfnote.hxx29
-rw-r--r--sw/source/uibase/inc/pggrid.hxx51
-rw-r--r--sw/source/uibase/inc/prcntfld.hxx2
-rw-r--r--sw/source/uibase/inc/pview.hxx14
-rw-r--r--sw/source/uibase/inc/redlndlg.hxx12
-rw-r--r--sw/source/uibase/inc/regionsw.hxx136
-rw-r--r--sw/source/uibase/inc/rowht.hxx6
-rw-r--r--sw/source/uibase/inc/selglos.hxx5
-rw-r--r--sw/source/uibase/inc/shdwcrsr.hxx2
-rw-r--r--sw/source/uibase/inc/splittbl.hxx10
-rw-r--r--sw/source/uibase/inc/srcedtw.hxx7
-rw-r--r--sw/source/uibase/inc/srcview.hxx6
-rw-r--r--sw/source/uibase/inc/srtdlg.hxx51
-rw-r--r--sw/source/uibase/inc/swmessdialog.hxx12
-rw-r--r--sw/source/uibase/inc/swmodalredlineacceptdlg.hxx1
-rw-r--r--sw/source/uibase/inc/swrenamexnameddlg.hxx6
-rw-r--r--sw/source/uibase/inc/swruler.hxx5
-rw-r--r--sw/source/uibase/inc/swuiccoll.hxx23
-rw-r--r--sw/source/uibase/inc/swuicnttab.hxx228
-rw-r--r--sw/source/uibase/inc/swuiidxmrk.hxx90
-rw-r--r--sw/source/uibase/inc/syncbtn.hxx4
-rw-r--r--sw/source/uibase/inc/tautofmt.hxx27
-rw-r--r--sw/source/uibase/inc/tblctrl.hxx2
-rw-r--r--sw/source/uibase/inc/tbxanchr.hxx2
-rw-r--r--sw/source/uibase/inc/titlepage.hxx25
-rw-r--r--sw/source/uibase/inc/unotools.hxx2
-rw-r--r--sw/source/uibase/inc/view.hxx28
-rw-r--r--sw/source/uibase/inc/wordcountdialog.hxx27
-rw-r--r--sw/source/uibase/inc/workctrl.hxx19
-rw-r--r--sw/source/uibase/inc/wrap.hxx33
-rw-r--r--sw/source/uibase/lingu/olmenu.cxx6
-rw-r--r--sw/source/uibase/misc/glshell.cxx2
-rw-r--r--sw/source/uibase/misc/numberingtypelistbox.cxx6
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx31
-rw-r--r--sw/source/uibase/misc/swruler.cxx45
-rw-r--r--sw/source/uibase/ribbar/inputwin.cxx81
-rw-r--r--sw/source/uibase/ribbar/tblctrl.cxx2
-rw-r--r--sw/source/uibase/ribbar/tbxanchr.cxx2
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx39
-rw-r--r--sw/source/uibase/shells/grfsh.cxx8
-rw-r--r--sw/source/uibase/shells/tabsh.cxx4
-rw-r--r--sw/source/uibase/shells/textsh1.cxx20
-rw-r--r--sw/source/uibase/shells/txtattr.cxx1
-rw-r--r--sw/source/uibase/shells/txtcrsr.cxx1
-rw-r--r--sw/source/uibase/sidebar/PageColumnControl.cxx15
-rw-r--r--sw/source/uibase/sidebar/PageColumnControl.hxx5
-rw-r--r--sw/source/uibase/sidebar/PageMarginControl.cxx149
-rw-r--r--sw/source/uibase/sidebar/PageMarginControl.hxx29
-rw-r--r--sw/source/uibase/sidebar/PageOrientationControl.cxx8
-rw-r--r--sw/source/uibase/sidebar/PageOrientationControl.hxx3
-rw-r--r--sw/source/uibase/sidebar/PagePropertyPanel.cxx61
-rw-r--r--sw/source/uibase/sidebar/PagePropertyPanel.hxx21
-rw-r--r--sw/source/uibase/sidebar/PageSizeControl.cxx46
-rw-r--r--sw/source/uibase/sidebar/PageSizeControl.hxx7
-rw-r--r--sw/source/uibase/sidebar/StylePresetsPanel.cxx12
-rw-r--r--sw/source/uibase/sidebar/StylePresetsPanel.hxx5
-rw-r--r--sw/source/uibase/sidebar/SwPanelFactory.cxx12
-rw-r--r--sw/source/uibase/sidebar/ThemePanel.cxx14
-rw-r--r--sw/source/uibase/sidebar/ThemePanel.hxx9
-rw-r--r--sw/source/uibase/sidebar/WrapPropertyPanel.cxx30
-rw-r--r--sw/source/uibase/sidebar/WrapPropertyPanel.hxx22
-rw-r--r--sw/source/uibase/table/tablepg.hxx93
-rw-r--r--sw/source/uibase/uiview/pview.cxx49
-rw-r--r--sw/source/uibase/uiview/srcview.cxx66
-rw-r--r--sw/source/uibase/uiview/view.cxx22
-rw-r--r--sw/source/uibase/uiview/view2.cxx46
-rw-r--r--sw/source/uibase/uiview/viewdraw.cxx6
-rw-r--r--sw/source/uibase/uiview/viewfunc.hxx2
-rw-r--r--sw/source/uibase/uiview/viewling.cxx41
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx16
-rw-r--r--sw/source/uibase/uiview/viewprt.cxx23
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx13
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.hxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx16
-rw-r--r--sw/source/uibase/utlui/content.cxx31
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx22
-rw-r--r--sw/source/uibase/utlui/gloslst.cxx33
-rw-r--r--sw/source/uibase/utlui/navipi.cxx348
-rw-r--r--sw/source/uibase/utlui/numfmtlb.cxx6
-rw-r--r--sw/source/uibase/utlui/unotools.cxx16
-rw-r--r--toolkit/source/awt/animatedimagespeer.cxx39
-rw-r--r--toolkit/source/awt/scrollabledialog.cxx47
-rw-r--r--toolkit/source/awt/vclxaccessiblecomponent.cxx21
-rw-r--r--toolkit/source/awt/vclxdevice.cxx25
-rw-r--r--toolkit/source/awt/vclxprinter.cxx2
-rw-r--r--toolkit/source/awt/vclxspinbutton.cxx2
-rw-r--r--toolkit/source/awt/vclxtabpagecontainer.cxx31
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx130
-rw-r--r--toolkit/source/awt/vclxwindow.cxx9
-rw-r--r--toolkit/source/awt/vclxwindows.cxx515
-rw-r--r--toolkit/source/controls/accessiblecontrolcontext.cxx11
-rw-r--r--toolkit/source/helper/unowrapper.cxx28
-rw-r--r--toolkit/source/helper/vclunohelper.cxx12
-rw-r--r--tools/source/ref/errinf.cxx29
-rw-r--r--uui/source/authfallbackdlg.cxx15
-rw-r--r--uui/source/authfallbackdlg.hxx12
-rw-r--r--uui/source/fltdlg.cxx16
-rw-r--r--uui/source/fltdlg.hxx6
-rw-r--r--uui/source/iahndl-authentication.cxx22
-rw-r--r--uui/source/iahndl-errorhandler.cxx12
-rw-r--r--uui/source/iahndl-filter.cxx3
-rw-r--r--uui/source/iahndl-locking.cxx18
-rw-r--r--uui/source/iahndl-ssl.cxx6
-rw-r--r--uui/source/iahndl.cxx22
-rw-r--r--uui/source/logindlg.cxx25
-rw-r--r--uui/source/logindlg.hxx32
-rw-r--r--uui/source/masterpasscrtdlg.cxx17
-rw-r--r--uui/source/masterpasscrtdlg.hxx8
-rw-r--r--uui/source/masterpassworddlg.cxx16
-rw-r--r--uui/source/masterpassworddlg.hxx6
-rw-r--r--uui/source/nameclashdlg.cxx19
-rw-r--r--uui/source/nameclashdlg.hxx12
-rw-r--r--uui/source/passworddlg.cxx23
-rw-r--r--uui/source/passworddlg.hxx12
-rw-r--r--uui/source/secmacrowarnings.cxx15
-rw-r--r--uui/source/secmacrowarnings.hxx19
-rw-r--r--uui/source/unknownauthdlg.cxx14
-rw-r--r--uui/source/unknownauthdlg.hxx10
-rw-r--r--vcl/CppunitTest_vcl_lifecycle.mk52
-rw-r--r--vcl/Module_vcl.mk1
-rw-r--r--vcl/README.lifecycle261
-rw-r--r--vcl/generic/print/genprnpsp.cxx22
-rw-r--r--vcl/generic/print/prtsetup.cxx50
-rw-r--r--vcl/generic/print/prtsetup.hxx43
-rw-r--r--vcl/inc/brdwin.hxx19
-rw-r--r--vcl/inc/controldata.hxx2
-rw-r--r--vcl/inc/dndevdis.hxx4
-rw-r--r--vcl/inc/helpwin.hxx7
-rw-r--r--vcl/inc/ilstbox.hxx115
-rw-r--r--vcl/inc/outdev.h3
-rw-r--r--vcl/inc/printdlg.hxx118
-rw-r--r--vcl/inc/salframe.hxx9
-rw-r--r--vcl/inc/svdata.hxx67
-rw-r--r--vcl/inc/toolbox.h2
-rw-r--r--vcl/inc/unx/i18n_status.hxx3
-rw-r--r--vcl/inc/window.h65
-rw-r--r--vcl/osx/a11ylistener.cxx2
-rw-r--r--vcl/osx/salprn.cxx2
-rw-r--r--vcl/qa/cppunit/complextext.cxx6
-rw-r--r--vcl/qa/cppunit/lifecycle.cxx150
-rw-r--r--vcl/qa/cppunit/outdev.cxx30
-rw-r--r--vcl/quartz/cairo_quartz_cairo.cxx6
-rw-r--r--vcl/quartz/cairo_quartz_cairo.hxx2
-rw-r--r--vcl/source/app/dbggui.cxx163
-rw-r--r--vcl/source/app/help.cxx20
-rw-r--r--vcl/source/app/salvtables.cxx9
-rw-r--r--vcl/source/app/stdtext.cxx4
-rw-r--r--vcl/source/app/svapp.cxx39
-rw-r--r--vcl/source/app/svdata.cxx18
-rw-r--r--vcl/source/app/svmain.cxx6
-rw-r--r--vcl/source/app/vclevent.cxx9
-rw-r--r--vcl/source/control/button.cxx64
-rw-r--r--vcl/source/control/combobox.cxx84
-rw-r--r--vcl/source/control/ctrl.cxx18
-rw-r--r--vcl/source/control/edit.cxx26
-rw-r--r--vcl/source/control/field.cxx24
-rw-r--r--vcl/source/control/field2.cxx24
-rw-r--r--vcl/source/control/fixed.cxx15
-rw-r--r--vcl/source/control/fixedhyper.cxx4
-rw-r--r--vcl/source/control/ilstbox.cxx113
-rw-r--r--vcl/source/control/longcurr.cxx8
-rw-r--r--vcl/source/control/lstbox.cxx96
-rw-r--r--vcl/source/control/menubtn.cxx6
-rw-r--r--vcl/source/control/morebtn.cxx8
-rw-r--r--vcl/source/control/prgsbar.cxx4
-rw-r--r--vcl/source/control/scrbar.cxx8
-rw-r--r--vcl/source/control/spinbtn.cxx4
-rw-r--r--vcl/source/control/spinfld.cxx15
-rw-r--r--vcl/source/control/tabctrl.cxx38
-rw-r--r--vcl/source/control/throbber.cxx6
-rw-r--r--vcl/source/edit/texteng.cxx2
-rw-r--r--vcl/source/edit/textview.cxx9
-rw-r--r--vcl/source/edit/vclmedit.cxx64
-rw-r--r--vcl/source/filter/graphicfilter.cxx16
-rw-r--r--vcl/source/filter/sgfbram.cxx14
-rw-r--r--vcl/source/filter/sgvmain.cxx4
-rw-r--r--vcl/source/filter/sgvtext.cxx16
-rw-r--r--vcl/source/filter/wmf/emfwr.cxx114
-rw-r--r--vcl/source/filter/wmf/emfwr.hxx5
-rw-r--r--vcl/source/filter/wmf/winmtf.cxx43
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx2
-rw-r--r--vcl/source/filter/wmf/wmfwr.hxx2
-rw-r--r--vcl/source/gdi/animate.cxx6
-rw-r--r--vcl/source/gdi/bitmapex.cxx14
-rw-r--r--vcl/source/gdi/cvtsvm.cxx26
-rw-r--r--vcl/source/gdi/gdimetafiletools.cxx20
-rw-r--r--vcl/source/gdi/gdimtf.cxx180
-rw-r--r--vcl/source/gdi/impanmvw.cxx22
-rw-r--r--vcl/source/gdi/impanmvw.hxx6
-rw-r--r--vcl/source/gdi/impgraph.cxx16
-rw-r--r--vcl/source/gdi/impvect.cxx4
-rw-r--r--vcl/source/gdi/oldprintadaptor.cxx6
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx16
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx6
-rw-r--r--vcl/source/gdi/print.cxx19
-rw-r--r--vcl/source/gdi/print2.cxx94
-rw-r--r--vcl/source/gdi/print3.cxx37
-rw-r--r--vcl/source/gdi/virdev.cxx13
-rw-r--r--vcl/source/helper/lazydelete.cxx13
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx13
-rw-r--r--vcl/source/outdev/bitmap.cxx10
-rw-r--r--vcl/source/outdev/font.cxx5
-rw-r--r--vcl/source/outdev/map.cxx6
-rw-r--r--vcl/source/outdev/outdev.cxx31
-rw-r--r--vcl/source/outdev/outdevstate.cxx1
-rw-r--r--vcl/source/outdev/text.cxx58
-rw-r--r--vcl/source/outdev/transparent.cxx16
-rw-r--r--vcl/source/outdev/wallpaper.cxx10
-rw-r--r--vcl/source/uipreviewer/previewer.cxx5
-rw-r--r--vcl/source/window/accel.cxx1
-rw-r--r--vcl/source/window/accessibility.cxx7
-rw-r--r--vcl/source/window/brdwin.cxx18
-rw-r--r--vcl/source/window/btndlg.cxx40
-rw-r--r--vcl/source/window/builder.cxx78
-rw-r--r--vcl/source/window/clipping.cxx10
-rw-r--r--vcl/source/window/cursor.cxx4
-rw-r--r--vcl/source/window/decoview.cxx2
-rw-r--r--vcl/source/window/dialog.cxx51
-rw-r--r--vcl/source/window/dlgctrl.cxx20
-rw-r--r--vcl/source/window/dndevdis.cxx6
-rw-r--r--vcl/source/window/dockingarea.cxx6
-rw-r--r--vcl/source/window/dockmgr.cxx43
-rw-r--r--vcl/source/window/dockwin.cxx43
-rw-r--r--vcl/source/window/event.cxx28
-rw-r--r--vcl/source/window/floatwin.cxx40
-rw-r--r--vcl/source/window/introwin.cxx11
-rw-r--r--vcl/source/window/layout.cxx136
-rw-r--r--vcl/source/window/menu.cxx29
-rw-r--r--vcl/source/window/menubarwindow.cxx135
-rw-r--r--vcl/source/window/menubarwindow.hxx28
-rw-r--r--vcl/source/window/menufloatingwindow.cxx11
-rw-r--r--vcl/source/window/menufloatingwindow.hxx3
-rw-r--r--vcl/source/window/mouse.cxx28
-rw-r--r--vcl/source/window/msgbox.cxx29
-rw-r--r--vcl/source/window/openglwin.cxx14
-rw-r--r--vcl/source/window/paint.cxx6
-rw-r--r--vcl/source/window/popupmenuwindow.cxx6
-rw-r--r--vcl/source/window/printdlg.cxx137
-rw-r--r--vcl/source/window/scrwnd.cxx8
-rw-r--r--vcl/source/window/scrwnd.hxx3
-rw-r--r--vcl/source/window/settings.cxx8
-rw-r--r--vcl/source/window/split.cxx15
-rw-r--r--vcl/source/window/splitwin.cxx15
-rw-r--r--vcl/source/window/stacking.cxx45
-rw-r--r--vcl/source/window/status.cxx12
-rw-r--r--vcl/source/window/syschild.cxx8
-rw-r--r--vcl/source/window/syswin.cxx35
-rw-r--r--vcl/source/window/tabdlg.cxx11
-rw-r--r--vcl/source/window/tabpage.cxx11
-rw-r--r--vcl/source/window/taskpanelist.cxx19
-rw-r--r--vcl/source/window/toolbox.cxx34
-rw-r--r--vcl/source/window/toolbox2.cxx18
-rw-r--r--vcl/source/window/window.cxx178
-rw-r--r--vcl/source/window/window2.cxx116
-rw-r--r--vcl/source/window/winproc.cxx17
-rw-r--r--vcl/source/window/wrkwin.cxx8
-rw-r--r--vcl/unx/generic/app/i18n_status.cxx81
-rw-r--r--vcl/unx/generic/gdi/cairo_xlib_cairo.cxx6
-rw-r--r--vcl/unx/generic/gdi/cairo_xlib_cairo.hxx2
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx30
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx2
-rw-r--r--vcl/unx/gtk3/gdi/cairo_gtk3_cairo.cxx4
-rw-r--r--vcl/unx/gtk3/gdi/cairo_gtk3_cairo.hxx2
-rw-r--r--vcl/unx/x11/x11sys.cxx12
-rw-r--r--vcl/win/source/gdi/cairo_win32_cairo.cxx8
-rw-r--r--vcl/win/source/gdi/cairo_win32_cairo.hxx2
-rw-r--r--vcl/workben/icontest.cxx9
-rw-r--r--vcl/workben/mtfdemo.cxx4
-rw-r--r--vcl/workben/outdevgrind.cxx5
-rw-r--r--vcl/workben/svdem.cxx6
-rw-r--r--vcl/workben/svpclient.cxx77
-rw-r--r--vcl/workben/svptest.cxx7
-rw-r--r--vcl/workben/vcldemo.cxx97
-rw-r--r--writerperfect/source/writer/WordPerfectImportFilter.cxx16
-rw-r--r--xmlsecurity/inc/xmlsecurity/certificatechooser.hxx7
-rw-r--r--xmlsecurity/inc/xmlsecurity/certificateviewer.hxx41
-rw-r--r--xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx37
-rw-r--r--xmlsecurity/inc/xmlsecurity/macrosecurity.hxx42
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx33
-rw-r--r--xmlsecurity/source/dialogs/certificatechooser.cxx16
-rw-r--r--xmlsecurity/source/dialogs/certificateviewer.cxx78
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx39
-rw-r--r--xmlsecurity/source/dialogs/macrosecurity.cxx65
2632 files changed, 41659 insertions, 24794 deletions
diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
index e752b006031e..709ea0fe207b 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -57,7 +57,7 @@ ProgressMonitor::ProgressMonitor( const css::uno::Reference< XComponentContext >
m_xTopic_Bottom = css::uno::Reference< XFixedText > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
m_xText_Bottom = css::uno::Reference< XFixedText > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
m_xButton = css::uno::Reference< XButton > ( rxContext->getServiceManager()->createInstanceWithContext( BUTTON_SERVICENAME, rxContext ), UNO_QUERY );
- m_xProgressBar = new ProgressBar(rxContext);
+ m_xProgressBar = VclPtr<ProgressBar>::Create(rxContext);
// ... cast controls to Reference< XControl > (for "setModel"!) ...
css::uno::Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY );
diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx
index 240d148743a9..f4e54570f23c 100644
--- a/UnoControls/source/controls/statusindicator.cxx
+++ b/UnoControls/source/controls/statusindicator.cxx
@@ -47,7 +47,7 @@ StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext >
// Create instances for fixedtext and progress ...
m_xText = css::uno::Reference< XFixedText > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
- m_xProgressBar = new ProgressBar(rxContext);
+ m_xProgressBar = VclPtr<ProgressBar>::Create(rxContext);
// ... cast controls to css::uno::Reference< XControl > and set model ...
// ( ProgressBar has no model !!! )
css::uno::Reference< XControl > xTextControl ( m_xText , UNO_QUERY );
diff --git a/UnoControls/source/inc/progressbar.hxx b/UnoControls/source/inc/progressbar.hxx
index 11994533af19..2b1dee2de696 100644
--- a/UnoControls/source/inc/progressbar.hxx
+++ b/UnoControls/source/inc/progressbar.hxx
@@ -23,6 +23,8 @@
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <vcl/vclptr.hxx>
+
#include "basecontrol.hxx"
// namespaces
diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx
index 92c8cc3087b7..9fc58e200b6b 100644
--- a/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx
+++ b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx
@@ -30,11 +30,8 @@
class SvtIconChoiceCtrl;
-
namespace accessibility
{
-
-
typedef ::cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessible
, ::com::sun::star::accessibility::XAccessibleSelection> AccessibleIconChoiceCtrl_BASE;
@@ -55,7 +52,8 @@ namespace accessibility
virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE;
- SvtIconChoiceCtrl* getCtrl();
+ VclPtr< SvtIconChoiceCtrl > getCtrl();
+
public:
/** OAccessibleBase needs a valid view
@param _rIconCtrl
diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx
index da1a386b1643..b56ca82df4a8 100644
--- a/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx
+++ b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx
@@ -35,6 +35,7 @@
#include <comphelper/broadcasthelper.hxx>
#include <comphelper/accessibletexthelper.hxx>
#include <tools/gen.hxx>
+#include <vcl/vclptr.hxx>
// forward
@@ -63,7 +64,7 @@ namespace accessibility
{
private:
/** The treelistbox control */
- SvtIconChoiceCtrl* m_pIconCtrl;
+ VclPtr<SvtIconChoiceCtrl> m_pIconCtrl;
sal_Int32 m_nIndex;
protected:
diff --git a/accessibility/inc/accessibility/extended/accessiblelistbox.hxx b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
index 3032a8b9b578..ac5bbe69c157 100644
--- a/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
+++ b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
@@ -62,7 +62,7 @@ namespace accessibility
virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE;
- SvTreeListBox* getListBox() const;
+ VclPtr< SvTreeListBox > getListBox() const;
void RemoveChildEntries(SvTreeListEntry*);
diff --git a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx
index 81401f177564..ed920c89399d 100644
--- a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx
+++ b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx
@@ -22,6 +22,7 @@
#include <comphelper/accessiblecomponenthelper.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
class TabBar;
class VCLExternalSolarLock;
@@ -57,7 +58,7 @@ private:
protected:
VCLExternalSolarLock* m_pExternalLock;
- TabBar* m_pTabBar;
+ VclPtr<TabBar> m_pTabBar;
};
diff --git a/accessibility/inc/accessibility/extended/accessibletablistbox.hxx b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx
index e5e16809b038..f6e1d416bf30 100644
--- a/accessibility/inc/accessibility/extended/accessibletablistbox.hxx
+++ b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx
@@ -43,7 +43,7 @@ class AccessibleTabListBox
,public ::svt::IAccessibleTabListBox
{
private:
- SvHeaderTabListBox* m_pTabListBox;
+ VclPtr<SvHeaderTabListBox> m_pTabListBox;
public:
/** ctor()
diff --git a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
index 272f3fcc7e22..8c47222f2ff2 100644
--- a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
+++ b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
@@ -37,7 +37,7 @@ typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelecti
class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper
{
private:
- SvHeaderTabListBox* m_pTabListBox;
+ VclPtr<SvHeaderTabListBox> m_pTabListBox;
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xCurChild;
diff --git a/accessibility/inc/accessibility/extended/listboxaccessible.hxx b/accessibility/inc/accessibility/extended/listboxaccessible.hxx
index fc3bb245b2c4..4ce38c5090b6 100644
--- a/accessibility/inc/accessibility/extended/listboxaccessible.hxx
+++ b/accessibility/inc/accessibility/extended/listboxaccessible.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
class SvTreeListBox;
class VclSimpleEvent;
@@ -41,7 +42,7 @@ namespace accessibility
class ListBoxAccessibleBase
{
private:
- SvTreeListBox* m_pWindow;
+ VclPtr<SvTreeListBox> m_pWindow;
protected:
inline SvTreeListBox* getListBox() const
@@ -49,7 +50,7 @@ namespace accessibility
return const_cast< ListBoxAccessibleBase* >( this )->m_pWindow;
}
- inline bool isAlive() const { return NULL != m_pWindow; }
+ inline bool isAlive() const { return nullptr != m_pWindow; }
public:
ListBoxAccessibleBase( SvTreeListBox& _rWindow );
diff --git a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
index 1f2b65c99a8d..d64254608271 100644
--- a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
+++ b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
@@ -99,7 +99,7 @@ public:
private:
::Link m_aListener;
- vcl::Window * m_pNotifier;
+ VclPtr<vcl::Window> m_pNotifier;
};
class ParagraphInfo
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx
index 2ca6def7ba42..b6dc89864fec 100644
--- a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX
#include <accessibility/standard/accessiblemenucomponent.hxx>
+#include <vcl/vclptr.hxx>
class VclSimpleEvent;
class VclWindowEvent;
@@ -34,7 +35,7 @@ namespace vcl { class Window; }
class VCLXAccessibleMenuBar : public OAccessibleMenuComponent
{
protected:
- vcl::Window* m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
virtual bool IsFocused() SAL_OVERRIDE;
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx
index a07e4502c111..249f5cafa6ec 100644
--- a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
@@ -36,7 +37,7 @@ private:
typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren;
AccessibleChildren m_aAccessibleChildren;
- StatusBar* m_pStatusBar;
+ VclPtr<StatusBar> m_pStatusBar;
protected:
void UpdateShowing( sal_Int32 i, bool bShowing );
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx
index f720374f3af5..0432abc9db7a 100644
--- a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx
@@ -24,7 +24,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <comphelper/accessibletexthelper.hxx>
#include <cppuhelper/implbase2.hxx>
-
+#include <vcl/vclptr.hxx>
class StatusBar;
class VCLExternalSolarLock;
@@ -51,14 +51,14 @@ class VCLXAccessibleStatusBarItem : public AccessibleTextHelper_BASE,
private:
VCLExternalSolarLock* m_pExternalLock;
- StatusBar* m_pStatusBar;
+ VclPtr<StatusBar> m_pStatusBar;
sal_uInt16 m_nItemId;
OUString m_sItemName;
OUString m_sItemText;
- bool m_bShowing;
+ bool m_bShowing;
protected:
- bool IsShowing();
+ bool IsShowing();
void SetShowing( bool bShowing );
void SetItemName( const OUString& sItemName );
OUString GetItemName();
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx
index b4e7b54fd197..358213855df2 100644
--- a/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx
@@ -22,6 +22,7 @@
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <vcl/vclptr.hxx>
#include <vector>
@@ -42,7 +43,7 @@ private:
typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren;
AccessibleChildren m_aAccessibleChildren;
- TabControl* m_pTabControl;
+ VclPtr<TabControl> m_pTabControl;
protected:
void UpdateFocused();
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx
index 182235a0ad12..8c0aa5dcac5b 100644
--- a/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <comphelper/accessibletexthelper.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <vcl/vclptr.hxx>
class TabControl;
@@ -51,7 +52,7 @@ class VCLXAccessibleTabPage : public AccessibleTextHelper_BASE,
private:
VCLExternalSolarLock* m_pExternalLock;
- TabControl* m_pTabControl;
+ VclPtr<TabControl> m_pTabControl;
sal_uInt16 m_nPageId;
bool m_bFocused;
bool m_bSelected;
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx
index 0fb8f614bd0c..9393579b6883 100644
--- a/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <vcl/vclptr.hxx>
class TabControl;
@@ -34,8 +35,8 @@ class TabPage;
class VCLXAccessibleTabPageWindow : public VCLXAccessibleComponent
{
private:
- TabControl* m_pTabControl;
- TabPage* m_pTabPage;
+ VclPtr<TabControl> m_pTabControl;
+ VclPtr<TabPage> m_pTabPage;
sal_uInt16 m_nPageId;
protected:
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx
index b7d3c15fd3f8..a05f31b89d1f 100644
--- a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase4.hxx>
#include <comphelper/accessibletexthelper.hxx>
+#include <vcl/vclptr.hxx>
class ToolBox;
@@ -46,13 +47,13 @@ class VCLXAccessibleToolBoxItem : public AccessibleTextHelper_BASE,
{
private:
OUString m_sOldName;
- ToolBox* m_pToolBox;
+ VclPtr<ToolBox> m_pToolBox;
VCLExternalSolarLock* m_pExternalLock;
sal_Int32 m_nIndexInParent;
sal_Int16 m_nRole;
- sal_uInt16 m_nItemId;
- bool m_bHasFocus;
- bool m_bIsChecked;
+ sal_uInt16 m_nItemId;
+ bool m_bHasFocus;
+ bool m_bIsChecked;
bool m_bIndeterminate;
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xChild;
@@ -80,9 +81,9 @@ public:
VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_Int32 _nPos );
void SetFocus( bool _bFocus );
- inline bool HasFocus() const { return m_bHasFocus; }
+ inline bool HasFocus() const { return m_bHasFocus; }
void SetChecked( bool _bCheck );
- inline bool IsChecked() const { return m_bIsChecked; }
+ inline bool IsChecked() const { return m_bIsChecked; }
void SetIndeterminate( bool _bIndeterminate );
inline bool IsIndeterminate() const { return m_bIndeterminate; }
inline void ReleaseToolBox() { m_pToolBox = NULL; }
diff --git a/accessibility/source/extended/AccessibleToolPanelDeck.cxx b/accessibility/source/extended/AccessibleToolPanelDeck.cxx
index dfb8ede26120..4f69764bcf29 100644
--- a/accessibility/source/extended/AccessibleToolPanelDeck.cxx
+++ b/accessibility/source/extended/AccessibleToolPanelDeck.cxx
@@ -76,7 +76,7 @@ namespace accessibility
);
void checkDisposed();
- bool isDisposed() const { return m_pPanelDeck == NULL; }
+ bool isDisposed() const { return m_pPanelDeck == nullptr; }
void dispose();
virtual ~AccessibleToolPanelDeck_Impl();
@@ -95,7 +95,7 @@ namespace accessibility
public:
AccessibleToolPanelDeck& m_rAntiImpl;
Reference< XAccessible > m_xAccessibleParent;
- ::svt::ToolPanelDeck* m_pPanelDeck;
+ VclPtr<::svt::ToolPanelDeck> m_pPanelDeck;
Reference< XAccessible > m_xActivePanelAccessible;
};
@@ -141,7 +141,7 @@ namespace accessibility
{
ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" );
m_pPanelDeck->RemoveListener( *this );
- m_pPanelDeck = NULL;
+ m_pPanelDeck.clear();
m_xAccessibleParent.clear();
}
diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx
index 757c45257c6e..1700aed946b1 100644
--- a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx
+++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx
@@ -120,7 +120,7 @@ namespace accessibility
AccessibleToolPanelTabBar& m_rAntiImpl;
Reference< XAccessible > m_xAccessibleParent;
::svt::IToolPanelDeck* m_pPanelDeck;
- ::svt::PanelTabBar* m_pTabBar;
+ VclPtr<::svt::PanelTabBar> m_pTabBar;
::std::vector< Reference< XAccessible > > m_aChildren;
};
@@ -163,7 +163,7 @@ namespace accessibility
m_pTabBar->GetScrollButton( true ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
m_pTabBar->GetScrollButton( false ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
- m_pTabBar = NULL;
+ m_pTabBar.clear();
m_xAccessibleParent.clear();
}
diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx
index 33bca93ae759..f89cb3d7f807 100644
--- a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx
+++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx
@@ -105,7 +105,7 @@ namespace accessibility
AccessibleToolPanelDeckTabBarItem& m_rAntiImpl;
Reference< XAccessible > m_xAccessibleParent;
::svt::IToolPanelDeck* m_pPanelDeck;
- ::svt::PanelTabBar* m_pTabBar;
+ VclPtr<::svt::PanelTabBar> m_pTabBar;
size_t m_nItemPos;
};
@@ -139,7 +139,7 @@ namespace accessibility
m_xAccessibleParent.clear();
m_pPanelDeck->RemoveListener( *this );
m_pPanelDeck = NULL;
- m_pTabBar = NULL;
+ m_pTabBar.clear();
}
Reference< XAccessibleComponent > AccessibleToolPanelDeckTabBarItem_Impl::getParentAccessibleComponent() const
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
index 5ed05d9c27e1..1d512aa0631c 100644
--- a/accessibility/source/extended/accessibleiconchoicectrl.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -367,12 +367,11 @@ namespace accessibility
}
}
- SvtIconChoiceCtrl* AccessibleIconChoiceCtrl::getCtrl()
+ VclPtr< SvtIconChoiceCtrl > AccessibleIconChoiceCtrl::getCtrl()
{
- return static_cast<SvtIconChoiceCtrl*>(GetWindow());
+ return GetAs<SvtIconChoiceCtrl >();
}
-
}// namespace accessibility
diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index 8a5e6efef8ba..811fca30f4b5 100644
--- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -91,7 +91,7 @@ throw(RuntimeException, std::exception)
if ( _rSource.Source == m_xParent )
{
dispose();
- OSL_ENSURE( !m_xParent.is() && ( NULL == m_pIconCtrl ), "" );
+ OSL_ENSURE( !m_xParent.is() && ( nullptr == m_pIconCtrl ), "" );
}
}
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index 2c33734abd30..22cc0202e7bb 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -67,11 +67,6 @@ namespace accessibility
IMPLEMENT_FORWARD_XINTERFACE2(AccessibleListBox, VCLXAccessibleComponent, AccessibleListBox_BASE)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleListBox, VCLXAccessibleComponent, AccessibleListBox_BASE)
- SvTreeListBox* AccessibleListBox::getListBox() const
- {
- return static_cast< SvTreeListBox* >( GetWindow() );
- }
-
void AccessibleListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
if ( isAlive() )
@@ -592,7 +587,10 @@ namespace accessibility
}
}
-
+ VclPtr< SvTreeListBox > AccessibleListBox::getListBox() const
+ {
+ return GetAs< SvTreeListBox >();
+ }
}// namespace accessibility
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 2dd16ace0380..fbe72a0e9d07 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -47,17 +47,17 @@ void SfxListenerGuard::endListening()
void WindowListenerGuard::startListening(vcl::Window & rNotifier)
{
- OSL_ENSURE(m_pNotifier == 0, "called more than once");
+ OSL_ENSURE(m_pNotifier == nullptr, "called more than once");
m_pNotifier = &rNotifier;
m_pNotifier->AddEventListener(m_aListener);
}
void WindowListenerGuard::endListening()
{
- if (m_pNotifier != 0)
+ if (m_pNotifier)
{
m_pNotifier->RemoveEventListener(m_aListener);
- m_pNotifier = 0;
+ m_pNotifier = nullptr;
}
}
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index 34e29e5f27a7..ef67482170a3 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -257,7 +257,7 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX
Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXListBox* _pXWindow )
{
bool bIsDropDownBox = false;
- ListBox* pBox = static_cast< ListBox* >( _pXWindow->GetWindow() );
+ VclPtr< ListBox > pBox = _pXWindow->GetAs< ListBox >();
if ( pBox )
bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN );
@@ -290,7 +290,7 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX
Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXComboBox* _pXWindow )
{
bool bIsDropDownBox = false;
- ComboBox* pBox = static_cast< ComboBox* >( _pXWindow->GetWindow() );
+ VclPtr< ComboBox > pBox = _pXWindow->GetAs< ComboBox >();
if ( pBox )
bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN );
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index 95d8258ce501..1e801a86e8fb 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -75,8 +75,8 @@ void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindo
// be removed in a short time.
if (m_aBoxType==COMBOBOX)
{
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
- if ( ( pComboBox != NULL ) && ( pChildWindow != NULL ) )
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
+ if ( ( pComboBox != nullptr ) && ( pChildWindow != NULL ) )
if (pChildWindow == pComboBox->GetSubEdit())
{
if (rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW)
@@ -327,8 +327,8 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32
{
if (m_aBoxType==COMBOBOX)
{
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
- if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL)
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
+ if (pComboBox!=nullptr && pComboBox->GetSubEdit()!=NULL)
//Set the edit's acc name the same as parent
{
pComboBox->GetSubEdit()->SetAccessibleName(getAccessibleName());
@@ -398,8 +398,8 @@ sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
if (m_aBoxType == COMBOBOX)
{
- ComboBox* pComboBox = static_cast< ComboBox* >( GetWindow() );
- if (pComboBox != NULL)
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
+ if (pComboBox != nullptr)
{
pComboBox->ToggleDropDown();
bNotify = true;
@@ -407,8 +407,8 @@ sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
}
else if (m_aBoxType == LISTBOX)
{
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if (pListBox != NULL)
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
+ if (pListBox != nullptr)
{
pListBox->ToggleDropDown();
bNotify = true;
@@ -532,8 +532,8 @@ void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& r
{
OUString sText;
sal_Int32 nEntryCount = 0;
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
- if (pComboBox != NULL)
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
+ if (pComboBox != nullptr)
{
Edit* pSubEdit = pComboBox->GetSubEdit();
if ( pSubEdit)
@@ -546,8 +546,8 @@ void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& r
else if (m_aBoxType == LISTBOX && m_bIsDropDownBox)
{
sal_Int32 nSelectedEntryCount = 0;
- ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
- if (pListBox != NULL && pListBox->GetEntryCount() > 0)
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
+ if (pListBox != nullptr && pListBox->GetEntryCount() > 0)
{
nSelectedEntryCount = pListBox->GetSelectEntryCount();
if ( nSelectedEntryCount == 0)
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index 622565a8d6f3..ae3698d6b298 100644
--- a/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -65,7 +65,7 @@ void VCLXAccessibleButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowE
Any aOldValue;
Any aNewValue;
- PushButton* pButton = static_cast<PushButton*>( GetWindow() );
+ VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton && pButton->GetState() == TRISTATE_TRUE )
aNewValue <<= AccessibleStateType::CHECKED;
else
@@ -85,7 +85,7 @@ void VCLXAccessibleButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper
{
VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
- PushButton* pButton = static_cast<PushButton*>( GetWindow() );
+ VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton )
{
rStateSet.AddState( AccessibleStateType::FOCUSABLE );
@@ -196,7 +196,7 @@ sal_Bool VCLXAccessibleButton::doAccessibleAction ( sal_Int32 nIndex ) throw (In
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
throw IndexOutOfBoundsException();
- PushButton* pButton = static_cast<PushButton*>( GetWindow() );
+ VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton )
pButton->Click();
@@ -264,7 +264,7 @@ Any VCLXAccessibleButton::getCurrentValue( ) throw (RuntimeException, std::exce
Any aValue;
- PushButton* pButton = static_cast<PushButton*>( GetWindow() );
+ VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton )
aValue <<= (sal_Int32) pButton->IsPressed();
@@ -279,7 +279,7 @@ sal_Bool VCLXAccessibleButton::setCurrentValue( const Any& aNumber ) throw (Runt
bool bReturn = false;
- PushButton* pButton = static_cast<PushButton*>( GetWindow() );
+ VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton )
{
sal_Int32 nValue = 0;
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index 327510ee1d1c..377fe9a96d1d 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -198,7 +198,7 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw (
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
throw IndexOutOfBoundsException();
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
if ( pCheckBox && pVCLXCheckBox )
{
@@ -328,7 +328,7 @@ Any VCLXAccessibleCheckBox::getMaximumValue( ) throw (RuntimeException, std::ex
Any aValue;
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox && pCheckBox->IsTriStateEnabled() )
aValue <<= (sal_Int32) 2;
else
diff --git a/accessibility/source/standard/vclxaccessiblecombobox.cxx b/accessibility/source/standard/vclxaccessiblecombobox.cxx
index 25ed8f65c279..de97daac0cc1 100644
--- a/accessibility/source/standard/vclxaccessiblecombobox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecombobox.cxx
@@ -43,18 +43,11 @@ VCLXAccessibleComboBox::~VCLXAccessibleComboBox()
{
}
-
-
-
bool VCLXAccessibleComboBox::IsValid() const
{
- return static_cast<ComboBox*>(GetWindow()) != NULL;
-
+ return GetWindow().get() != NULL;
}
-
-
-
void VCLXAccessibleComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
{
VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
diff --git a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
index 9659e5e4afcd..0e50ac8c8ea3 100644
--- a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
+++ b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
@@ -57,17 +57,11 @@ VCLXAccessibleDropDownComboBox::~VCLXAccessibleDropDownComboBox()
{
}
-
-
bool VCLXAccessibleDropDownComboBox::IsValid() const
{
- return static_cast<ComboBox*>(GetWindow()) != NULL;
-
+ return GetWindow().get() != NULL;
}
-
-
-
void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
{
switch ( rVclWindowEvent.GetId() )
diff --git a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
index 23e44f0b2bbd..2875852fd82d 100644
--- a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
+++ b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
@@ -56,18 +56,11 @@ VCLXAccessibleDropDownListBox::~VCLXAccessibleDropDownListBox()
{
}
-
-
-
bool VCLXAccessibleDropDownListBox::IsValid() const
{
- return static_cast<ListBox*>(GetWindow()) != NULL;
-
+ return GetWindow().get() != NULL;
}
-
-
-
void VCLXAccessibleDropDownListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
VCLXAccessibleBox::ProcessWindowEvent (rVclWindowEvent);
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx
index 1b9027dd05c3..7cc89bb58229 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -133,7 +133,7 @@ OUString VCLXAccessibleEdit::implGetText()
{
OUString aText;
- Edit* pEdit = static_cast< Edit* >( GetWindow() );
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
aText = OutputDevice::GetNonMnemonicString( pEdit->GetText() );
@@ -225,7 +225,7 @@ sal_Int16 VCLXAccessibleEdit::getAccessibleRole( ) throw (RuntimeException, std
OExternalLockGuard aGuard( this );
sal_Int16 nRole;
- Edit* pEdit = static_cast< Edit* >( GetWindow() );
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit && ( ( pEdit->GetStyle() & WB_PASSWORD ) || pEdit->GetEchoChar() ) )
nRole = AccessibleRole::PASSWORD_TEXT;
else
@@ -336,7 +336,7 @@ awt::Rectangle VCLXAccessibleEdit::getCharacterBounds( sal_Int32 nIndex ) throw
if ( !implIsValidRange( nIndex, nIndex, nLength ) )
throw IndexOutOfBoundsException();
- Control* pControl = static_cast< Control* >( GetWindow() );
+ VclPtr< Control > pControl = GetAs< Control >();
if ( pControl )
{
if ( nIndex == nLength )
@@ -425,7 +425,7 @@ sal_Bool VCLXAccessibleEdit::setSelection( sal_Int32 nStartIndex, sal_Int32 nEnd
throw IndexOutOfBoundsException();
VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
- Edit* pEdit = static_cast< Edit* >( GetWindow() );
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pVCLXEdit && pEdit && pEdit->IsEnabled() )
{
pVCLXEdit->setSelection( awt::Selection( nStartIndex, nEndIndex ) );
diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
index cb70d1a3711d..f494d4b8629f 100644
--- a/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -72,16 +72,16 @@ VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType
{
case COMBOBOX:
{
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
- if ( pBox != NULL )
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
+ if ( pBox )
m_pListBoxHelper = new VCLListBoxHelper<ComboBox> (*pBox);
break;
}
case LISTBOX:
{
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
- if ( pBox != NULL )
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
+ if ( pBox )
m_pListBoxHelper = new VCLListBoxHelper<ListBox> (*pBox);
break;
}
@@ -189,8 +189,8 @@ void VCLXAccessibleList::UpdateSelection_Acc (const ::rtl::OUString& sTextOfSele
{
if ( m_aBoxType == COMBOBOX )
{
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
- if ( pBox != NULL )
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
+ if ( pBox )
{
// Find the index of the selected item inside the VCL control...
sal_Int32 nIndex = pBox->GetEntryPos(sTextOfSelectedItem);
@@ -458,7 +458,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve
void VCLXAccessibleList::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
{
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if( m_aBoxType == LISTBOX )
{
if (m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) != WB_DROPDOWN)
@@ -483,8 +483,8 @@ void VCLXAccessibleList::UpdateSelection (const OUString& sTextOfSelectedItem)
{
if ( m_aBoxType == COMBOBOX )
{
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
- if ( pBox != NULL )
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
+ if ( pBox )
{
// Find the index of the selected item inside the VCL control...
sal_Int32 nIndex = pBox->GetEntryPos(sTextOfSelectedItem);
@@ -930,7 +930,7 @@ awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException)
aBounds.Y = 0;
if ( m_aBoxType == COMBOBOX )
{
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
{
Size aSize = pBox->GetSubEdit()->GetSizePixel();
@@ -960,7 +960,7 @@ awt::Point VCLXAccessibleList::getLocationOnScreen( ) throw (uno::RuntimeExcept
aPos = VCLXAccessibleComponent::getLocationOnScreen();
if ( m_aBoxType == COMBOBOX )
{
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
{
aPos.Y += pBox->GetSubEdit()->GetSizePixel().Height();
diff --git a/accessibility/source/standard/vclxaccessiblelistbox.cxx b/accessibility/source/standard/vclxaccessiblelistbox.cxx
index 3fb9b1be3081..bc48680703ae 100644
--- a/accessibility/source/standard/vclxaccessiblelistbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblelistbox.cxx
@@ -54,26 +54,16 @@ VCLXAccessibleListBox::~VCLXAccessibleListBox()
{
}
-
-
-
bool VCLXAccessibleListBox::IsValid() const
{
- return static_cast<ListBox*>(GetWindow()) != NULL;
-
+ return GetWindow().get() != NULL;
}
-
-
-
void VCLXAccessibleListBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
{
VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
}
-
-
-
//===== XServiceInfo ========================================================
OUString VCLXAccessibleListBox::getImplementationName()
diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
index baabdd5555f1..23d8a92b268b 100644
--- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx
+++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
@@ -90,16 +90,16 @@ void VCLXAccessibleRadioButton::FillAccessibleRelationSet( utl::AccessibleRelati
{
VCLXAccessibleTextComponent::FillAccessibleRelationSet( rRelationSet );
- RadioButton* pRadioButton = dynamic_cast< RadioButton* >( GetWindow() );
+ VclPtr< RadioButton > pRadioButton = GetAsDynamic< RadioButton >();
if ( pRadioButton )
{
- ::std::vector< RadioButton* > aGroup(pRadioButton->GetRadioButtonGroup(true));
+ ::std::vector< VclPtr<RadioButton> > aGroup(pRadioButton->GetRadioButtonGroup(true));
if (!aGroup.empty())
{
sal_Int32 i = 0;
Sequence< Reference< XInterface > > aSequence( static_cast< sal_Int32 >( aGroup.size() ) );
- ::std::vector< RadioButton* >::const_iterator aEndItr = aGroup.end();
- for ( ::std::vector< RadioButton* >::const_iterator aItr = aGroup.begin(); aItr < aEndItr; ++aItr )
+ auto aEndItr = aGroup.end();
+ for ( auto aItr = aGroup.begin(); aItr < aEndItr; ++aItr )
{
aSequence[i++] = (*aItr)->GetAccessible();
}
diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
index 44faa7ed8ba9..76e58a67537d 100644
--- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
@@ -139,7 +139,7 @@ sal_Bool VCLXAccessibleScrollBar::doAccessibleAction ( sal_Int32 nIndex ) throw
throw IndexOutOfBoundsException();
bool bReturn = false;
- ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
{
ScrollType eScrollType;
diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx
index 921c7075f7f1..42d1db5eb38e 100644
--- a/accessibility/source/standard/vclxaccessiblestatusbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblestatusbar.cxx
@@ -38,7 +38,7 @@ using namespace ::comphelper;
VCLXAccessibleStatusBar::VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow )
:VCLXAccessibleComponent( pVCLXWindow )
{
- m_pStatusBar = static_cast< StatusBar* >( GetWindow() );
+ m_pStatusBar = static_cast< StatusBar *>( GetWindow().get() );
if ( m_pStatusBar )
m_aAccessibleChildren.assign( m_pStatusBar->GetItemCount(), Reference< XAccessible >() );
diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
index 268a6f335d80..26ffc8ebd81e 100644
--- a/accessibility/source/standard/vclxaccessibletabcontrol.cxx
+++ b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
@@ -43,7 +43,7 @@ using namespace ::comphelper;
VCLXAccessibleTabControl::VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow )
:VCLXAccessibleComponent( pVCLXWindow )
{
- m_pTabControl = static_cast< TabControl* >( GetWindow() );
+ m_pTabControl = static_cast< TabControl* >( GetWindow().get() );
if ( m_pTabControl )
m_aAccessibleChildren.assign( m_pTabControl->GetPageCount(), Reference< XAccessible >() );
diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
index 6b43aa3d4b2c..3edb2b815864 100644
--- a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
+++ b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
@@ -36,7 +36,7 @@ using namespace ::comphelper;
VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow )
:VCLXAccessibleComponent( pVCLXWindow )
{
- m_pTabPage = static_cast< TabPage* >( GetWindow() );
+ m_pTabPage = static_cast< TabPage* >( GetWindow().get() );
m_pTabControl = 0;
m_nPageId = 0;
if ( m_pTabPage )
@@ -50,7 +50,7 @@ VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindo
for ( sal_uInt16 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i )
{
sal_uInt16 nPageId = m_pTabControl->GetPageId( i );
- if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage )
+ if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage.get() )
m_nPageId = nPageId;
}
}
diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
index 1bfa1891cddc..7fbe48ab018f 100644
--- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx
+++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
@@ -254,7 +254,7 @@ awt::Rectangle VCLXAccessibleTextComponent::getCharacterBounds( sal_Int32 nIndex
throw IndexOutOfBoundsException();
awt::Rectangle aRect;
- Control* pControl = static_cast< Control* >( GetWindow() );
+ VclPtr< Control > pControl = GetAs< Control >();
if ( pControl )
aRect = AWTRectangle( pControl->GetCharacterBounds( nIndex ) );
@@ -277,7 +277,7 @@ sal_Int32 VCLXAccessibleTextComponent::getIndexAtPoint( const awt::Point& aPoint
OExternalLockGuard aGuard( this );
sal_Int32 nIndex = -1;
- Control* pControl = static_cast< Control* >( GetWindow() );
+ VclPtr< Control > pControl = GetAs< Control >();
if ( pControl )
nIndex = pControl->GetIndexForPoint( VCLPoint( aPoint ) );
diff --git a/accessibility/source/standard/vclxaccessibletextfield.cxx b/accessibility/source/standard/vclxaccessibletextfield.cxx
index 82e27f87eb60..44461225ffdd 100644
--- a/accessibility/source/standard/vclxaccessibletextfield.cxx
+++ b/accessibility/source/standard/vclxaccessibletextfield.cxx
@@ -53,22 +53,16 @@ VCLXAccessibleTextField::~VCLXAccessibleTextField()
{
}
-
-
-
OUString VCLXAccessibleTextField::implGetText()
{
OUString aText;
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
- if (pListBox!=NULL && !pListBox->IsInDropDown())
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
+ if (pListBox && !pListBox->IsInDropDown())
aText = pListBox->GetSelectEntry();
return aText;
}
-
-
-
IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index 3dc32a1e1795..bbb4e26f2efa 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -184,7 +184,7 @@ VCLXAccessibleToolBox::~VCLXAccessibleToolBox()
VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus )
{
VCLXAccessibleToolBoxItem* pItem = NULL;
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox && ( !_bMustHaveFocus || pToolBox->HasFocus() ) )
{
ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
@@ -198,7 +198,7 @@ VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos,
void VCLXAccessibleToolBox::UpdateFocus_Impl()
{
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if( !pToolBox )
return;
@@ -250,7 +250,7 @@ void VCLXAccessibleToolBox::UpdateFocus_Impl()
void VCLXAccessibleToolBox::ReleaseFocus_Impl( sal_Int32 _nPos )
{
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox ) // #107124#, do not check for focus because this message is also handled in losefocus
{
ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
@@ -266,7 +266,7 @@ void VCLXAccessibleToolBox::ReleaseFocus_Impl( sal_Int32 _nPos )
void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 _nPos )
{
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
{
sal_uInt16 nFocusId = pToolBox->GetItemId( (sal_uInt16)_nPos );
@@ -291,7 +291,7 @@ void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 _nPos )
void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( sal_Int32 _nPos )
{
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
{
sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)_nPos );
@@ -347,7 +347,7 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, bool _bItemAdded )
return;
}
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
{
if ( !_bItemAdded )
@@ -403,7 +403,7 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, bool _bItemAdded )
void VCLXAccessibleToolBox::UpdateAllItems_Impl()
{
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
{
// deregister the old items
@@ -427,7 +427,7 @@ void VCLXAccessibleToolBox::UpdateAllItems_Impl()
void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, bool bOpen )
{
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if( pWindow && pToolBox )
{
const sal_uInt16 nDownItem = pToolBox->GetDownItemId();
@@ -465,7 +465,7 @@ void VCLXAccessibleToolBox::UpdateItemEnabled_Impl( sal_Int32 _nPos )
void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow )
{
vcl::Window* pChildWindow = static_cast<vcl::Window *>(rVclWindowEvent.GetData());
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pChildWindow
&& pToolBox
&& pToolBox == pChildWindow->GetParent()
@@ -486,7 +486,7 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWin
void VCLXAccessibleToolBox::ReleaseSubToolBox( ToolBox* _pSubToolBox )
{
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( !pToolBox )
return;
@@ -512,7 +512,7 @@ void VCLXAccessibleToolBox::FillAccessibleStateSet( utl::AccessibleStateSetHelpe
{
VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
{
rStateSet.AddState( AccessibleStateType::FOCUSABLE );
@@ -533,7 +533,7 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
case VCLEVENT_TOOLBOX_CLICK:
case VCLEVENT_TOOLBOX_SELECT:
{
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( rVclWindowEvent.GetData() )
{
UpdateChecked_Impl( (sal_Int32)reinterpret_cast<sal_IntPtr>(rVclWindowEvent.GetData()) );
@@ -617,14 +617,14 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
case VCLEVENT_OBJECT_DYING :
{
// if this toolbox is a subtoolbox, we have to relese it from its parent
- vcl::Window * pWin = GetWindow();
+ VclPtr< vcl::Window > pWin = GetAs< vcl::Window >();
if ( pWin && pWin->GetParent() &&
pWin->GetParent()->GetType() == WINDOW_TOOLBOX )
{
VCLXAccessibleToolBox* pParent = static_cast< VCLXAccessibleToolBox* >(
pWin->GetParent()->GetAccessible()->getAccessibleContext().get() );
if ( pParent )
- pParent->ReleaseSubToolBox(static_cast<ToolBox *>(pWin));
+ pParent->ReleaseSubToolBox(static_cast<ToolBox *>(pWin.get()));
}
// dispose all items
@@ -704,7 +704,7 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBox::getAccessibleChildCount( ) throw (Run
comphelper::OExternalLockGuard aGuard( this );
sal_Int32 nCount = 0;
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
nCount = pToolBox->GetItemCount();
@@ -718,7 +718,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal
comphelper::OExternalLockGuard aGuard( this );
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
{
Reference< XAccessible > xChild;
@@ -763,7 +763,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleAtPoint( c
comphelper::OExternalLockGuard aGuard( this );
Reference< XAccessible > xAccessible;
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
{
sal_uInt16 nItemPos = pToolBox->GetItemPos( VCLPoint( _rPoint ) );
@@ -778,7 +778,7 @@ Reference< XAccessible > VCLXAccessibleToolBox::GetItemWindowAccessible( const V
{
Reference< XAccessible > xReturn;
vcl::Window* pChildWindow = static_cast<vcl::Window *>(rVclWindowEvent.GetData());
- ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pChildWindow && pToolBox )
{
sal_uInt16 nCount = pToolBox->GetItemCount();
@@ -808,7 +808,7 @@ void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int32 nChildIndex ) throw
OExternalLockGuard aGuard( this );
if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
throw IndexOutOfBoundsException();
- ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex);
pToolBox->ChangeHighlight( nPos );
}
@@ -818,9 +818,9 @@ sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex
OExternalLockGuard aGuard( this );
if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
throw IndexOutOfBoundsException();
- ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex);
- if ( pToolBox != NULL && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) )
+ if ( pToolBox && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) )
return true;
else
return false;
@@ -829,7 +829,7 @@ sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex
void VCLXAccessibleToolBox::clearAccessibleSelection( ) throw (RuntimeException, std::exception)
{
OExternalLockGuard aGuard( this );
- ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
+ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
pToolBox -> LoseFocus();
}
diff --git a/avmedia/inc/mediacontrol.hxx b/avmedia/inc/mediacontrol.hxx
index c6e0622c5421..b24e1a590ee7 100644
--- a/avmedia/inc/mediacontrol.hxx
+++ b/avmedia/inc/mediacontrol.hxx
@@ -58,6 +58,7 @@ public:
MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyle );
virtual ~MediaControl();
+ virtual void dispose() SAL_OVERRIDE;
const Size& getMinSizePixel() const;
@@ -89,13 +90,13 @@ private:
ImageList maImageList;
Idle maIdle;
MediaItem maItem;
- ToolBox maPlayToolBox;
- Slider maTimeSlider;
- ToolBox maMuteToolBox;
- Slider maVolumeSlider;
- ToolBox maZoomToolBox;
- ListBox* mpZoomListBox;
- Edit maTimeEdit;
+ VclPtr<ToolBox> maPlayToolBox;
+ VclPtr<Slider> maTimeSlider;
+ VclPtr<ToolBox> maMuteToolBox;
+ VclPtr<Slider> maVolumeSlider;
+ VclPtr<ToolBox> maZoomToolBox;
+ VclPtr<ListBox> mpZoomListBox;
+ VclPtr<Edit> maTimeEdit;
Size maMinSize;
MediaControlStyle meControlStyle;
bool mbLocked;
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index 13592611093f..5168c12e34e3 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -65,13 +65,13 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
Control( pParent ),
maImageList( SvtMiscOptions().AreCurrentSymbolsLarge() ? AVMEDIA_RESID( AVMEDIA_IMGLST_L ) : AVMEDIA_RESID( AVMEDIA_IMGLST ) ),
maItem( 0, AVMediaSetMask::ALL ),
- maPlayToolBox( this, WB_3DLOOK ),
- maTimeSlider( this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET ),
- maMuteToolBox( this, WB_3DLOOK ),
- maVolumeSlider( this, WB_HORZ | WB_DRAG | WB_SLIDERSET ),
- maZoomToolBox( this, WB_3DLOOK ),
- mpZoomListBox( new ListBox( &maZoomToolBox, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ),
- maTimeEdit( this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY ),
+ maPlayToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
+ maTimeSlider( VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET) ),
+ maMuteToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
+ maVolumeSlider( VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_SLIDERSET) ),
+ maZoomToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
+ mpZoomListBox( VclPtr<ListBox>::Create( maZoomToolBox.get(), WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ),
+ maTimeEdit( VclPtr<Edit>::Create(this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY) ),
meControlStyle( eControlStyle ),
mbLocked( false )
{
@@ -83,88 +83,88 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
if( MEDIACONTROLSTYLE_SINGLELINE != meControlStyle )
{
- maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), OUString( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) );
- maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN );
+ maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), OUString( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) );
+ maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN );
- maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_INSERT, implGetImage( AVMEDIA_IMG_INSERT ), OUString( AVMEDIA_RESID( AVMEDIA_STR_INSERT ) ) );
- maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, HID_AVMEDIA_TOOLBOXITEM_INSERT );
+ maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_INSERT, implGetImage( AVMEDIA_IMG_INSERT ), OUString( AVMEDIA_RESID( AVMEDIA_STR_INSERT ) ) );
+ maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, HID_AVMEDIA_TOOLBOXITEM_INSERT );
- maPlayToolBox.InsertSeparator();
+ maPlayToolBox->InsertSeparator();
}
else
{
mpZoomListBox->SetBackground();
- maZoomToolBox.SetBackground();
- maZoomToolBox.SetPaintTransparent( true );
- maPlayToolBox.SetBackground();
- maPlayToolBox.SetPaintTransparent( true );
- maMuteToolBox.SetBackground();
- maMuteToolBox.SetPaintTransparent( true );
+ maZoomToolBox->SetBackground();
+ maZoomToolBox->SetPaintTransparent( true );
+ maPlayToolBox->SetBackground();
+ maPlayToolBox->SetPaintTransparent( true );
+ maMuteToolBox->SetBackground();
+ maMuteToolBox->SetPaintTransparent( true );
}
- maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PLAY, implGetImage( AVMEDIA_IMG_PLAY ), OUString( AVMEDIA_RESID( AVMEDIA_STR_PLAY ) ), ToolBoxItemBits::CHECKABLE );
- maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, HID_AVMEDIA_TOOLBOXITEM_PLAY );
+ maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_PLAY, implGetImage( AVMEDIA_IMG_PLAY ), OUString( AVMEDIA_RESID( AVMEDIA_STR_PLAY ) ), ToolBoxItemBits::CHECKABLE );
+ maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, HID_AVMEDIA_TOOLBOXITEM_PLAY );
- maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PAUSE, implGetImage( AVMEDIA_IMG_PAUSE ), OUString( AVMEDIA_RESID( AVMEDIA_STR_PAUSE ) ), ToolBoxItemBits::CHECKABLE );
- maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, HID_AVMEDIA_TOOLBOXITEM_PAUSE );
+ maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_PAUSE, implGetImage( AVMEDIA_IMG_PAUSE ), OUString( AVMEDIA_RESID( AVMEDIA_STR_PAUSE ) ), ToolBoxItemBits::CHECKABLE );
+ maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, HID_AVMEDIA_TOOLBOXITEM_PAUSE );
- maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_STOP, implGetImage( AVMEDIA_IMG_STOP ), OUString( AVMEDIA_RESID( AVMEDIA_STR_STOP ) ), ToolBoxItemBits::CHECKABLE );
- maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, HID_AVMEDIA_TOOLBOXITEM_STOP );
+ maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_STOP, implGetImage( AVMEDIA_IMG_STOP ), OUString( AVMEDIA_RESID( AVMEDIA_STR_STOP ) ), ToolBoxItemBits::CHECKABLE );
+ maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, HID_AVMEDIA_TOOLBOXITEM_STOP );
- maPlayToolBox.InsertSeparator();
+ maPlayToolBox->InsertSeparator();
- maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_LOOP, implGetImage( AVMEDIA_IMG_ENDLESS ), OUString( AVMEDIA_RESID( AVMEDIA_STR_ENDLESS ) ) );
- maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, HID_AVMEDIA_TOOLBOXITEM_LOOP );
+ maPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_LOOP, implGetImage( AVMEDIA_IMG_ENDLESS ), OUString( AVMEDIA_RESID( AVMEDIA_STR_ENDLESS ) ) );
+ maPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, HID_AVMEDIA_TOOLBOXITEM_LOOP );
if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle )
- maPlayToolBox.InsertSeparator();
-
- maPlayToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
- maPlayToolBox.SetSizePixel( maPlayToolBox.CalcWindowSizePixel() );
- maPlayToolBox.Show();
- maMinSize = maPlayToolBox.GetSizePixel();
-
- maTimeSlider.SetSlideHdl( LINK( this, MediaControl, implTimeHdl ) );
- maTimeSlider.SetEndSlideHdl( LINK( this, MediaControl, implTimeEndHdl ) );
- maTimeSlider.SetRange( Range( 0, AVMEDIA_TIME_RANGE ) );
- maTimeSlider.SetHelpId( HID_AVMEDIA_TIMESLIDER );
- maTimeSlider.SetUpdateMode( true );
- maTimeSlider.SetSizePixel( Size( 128, maPlayToolBox.GetSizePixel().Height() ) );
- maTimeSlider.Show();
- maMinSize.Width() += maTimeSlider.GetSizePixel().Width();
-
- maTimeEdit.SetText( aTimeText );
- maTimeEdit.SetUpdateMode( true );
- maTimeEdit.SetSizePixel( Size( maTimeEdit.GetTextWidth( aTimeText ) + 8, maPlayToolBox.GetSizePixel().Height() ) );
- maTimeEdit.SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() );
- maTimeEdit.SetHelpId( HID_AVMEDIA_TIMEEDIT );
- maTimeEdit.Disable();
- maTimeEdit.Show();
- maMinSize.Width() += maTimeEdit.GetSizePixel().Width();
+ maPlayToolBox->InsertSeparator();
+
+ maPlayToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
+ maPlayToolBox->SetSizePixel( maPlayToolBox->CalcWindowSizePixel() );
+ maPlayToolBox->Show();
+ maMinSize = maPlayToolBox->GetSizePixel();
+
+ maTimeSlider->SetSlideHdl( LINK( this, MediaControl, implTimeHdl ) );
+ maTimeSlider->SetEndSlideHdl( LINK( this, MediaControl, implTimeEndHdl ) );
+ maTimeSlider->SetRange( Range( 0, AVMEDIA_TIME_RANGE ) );
+ maTimeSlider->SetHelpId( HID_AVMEDIA_TIMESLIDER );
+ maTimeSlider->SetUpdateMode( true );
+ maTimeSlider->SetSizePixel( Size( 128, maPlayToolBox->GetSizePixel().Height() ) );
+ maTimeSlider->Show();
+ maMinSize.Width() += maTimeSlider->GetSizePixel().Width();
+
+ maTimeEdit->SetText( aTimeText );
+ maTimeEdit->SetUpdateMode( true );
+ maTimeEdit->SetSizePixel( Size( maTimeEdit->GetTextWidth( aTimeText ) + 8, maPlayToolBox->GetSizePixel().Height() ) );
+ maTimeEdit->SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() );
+ maTimeEdit->SetHelpId( HID_AVMEDIA_TIMEEDIT );
+ maTimeEdit->Disable();
+ maTimeEdit->Show();
+ maMinSize.Width() += maTimeEdit->GetSizePixel().Width();
if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle )
- maMuteToolBox.InsertSeparator();
-
- maMuteToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_MUTE, implGetImage( AVMEDIA_IMG_MUTE ), OUString( AVMEDIA_RESID( AVMEDIA_STR_MUTE ) ) );
- maMuteToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, HID_AVMEDIA_TOOLBOXITEM_MUTE );
-
- maMuteToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
- maMuteToolBox.SetSizePixel( maMuteToolBox.CalcWindowSizePixel() );
- maMuteToolBox.Show();
- maMinSize.Width() += maMuteToolBox.GetSizePixel().Width();
-
- maVolumeSlider.SetSlideHdl( LINK( this, MediaControl, implVolumeHdl ) );
- maVolumeSlider.SetEndSlideHdl( LINK( this, MediaControl, implVolumeEndHdl ) );
- maVolumeSlider.SetRange( Range( AVMEDIA_DB_RANGE, 0 ) );
- maVolumeSlider.SetUpdateMode( true );
- maVolumeSlider.SetHelpId( HID_AVMEDIA_VOLUMESLIDER );
- maVolumeSlider.SetSizePixel( Size( 48, maPlayToolBox.GetSizePixel().Height() ) );
- maVolumeSlider.Show();
- maMinSize.Width() += maVolumeSlider.GetSizePixel().Width();
-
- mpZoomListBox->SetSizePixel( Size( maTimeEdit.GetSizePixel().Width(), 260 ) );
+ maMuteToolBox->InsertSeparator();
+
+ maMuteToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_MUTE, implGetImage( AVMEDIA_IMG_MUTE ), OUString( AVMEDIA_RESID( AVMEDIA_STR_MUTE ) ) );
+ maMuteToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, HID_AVMEDIA_TOOLBOXITEM_MUTE );
+
+ maMuteToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
+ maMuteToolBox->SetSizePixel( maMuteToolBox->CalcWindowSizePixel() );
+ maMuteToolBox->Show();
+ maMinSize.Width() += maMuteToolBox->GetSizePixel().Width();
+
+ maVolumeSlider->SetSlideHdl( LINK( this, MediaControl, implVolumeHdl ) );
+ maVolumeSlider->SetEndSlideHdl( LINK( this, MediaControl, implVolumeEndHdl ) );
+ maVolumeSlider->SetRange( Range( AVMEDIA_DB_RANGE, 0 ) );
+ maVolumeSlider->SetUpdateMode( true );
+ maVolumeSlider->SetHelpId( HID_AVMEDIA_VOLUMESLIDER );
+ maVolumeSlider->SetSizePixel( Size( 48, maPlayToolBox->GetSizePixel().Height() ) );
+ maVolumeSlider->Show();
+ maMinSize.Width() += maVolumeSlider->GetSizePixel().Width();
+
+ mpZoomListBox->SetSizePixel( Size( maTimeEdit->GetSizePixel().Width(), 260 ) );
mpZoomListBox->InsertEntry( OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_50 ) ), AVMEDIA_ZOOMLEVEL_50 );
mpZoomListBox->InsertEntry( OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_100 ) ), AVMEDIA_ZOOMLEVEL_100 );
mpZoomListBox->InsertEntry( OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_200 ) ), AVMEDIA_ZOOMLEVEL_200 );
@@ -172,14 +172,14 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
mpZoomListBox->SetSelectHdl( LINK( this, MediaControl, implZoomSelectHdl ) );
mpZoomListBox->SetHelpId( HID_AVMEDIA_ZOOMLISTBOX );
- maZoomToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_ZOOM, OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM ) ) );
- maZoomToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, HID_AVMEDIA_ZOOMLISTBOX );
+ maZoomToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_ZOOM, OUString( AVMEDIA_RESID( AVMEDIA_STR_ZOOM ) ) );
+ maZoomToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, HID_AVMEDIA_ZOOMLISTBOX );
- maZoomToolBox.SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, mpZoomListBox );
- maZoomToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
- maZoomToolBox.SetSizePixel( maZoomToolBox.CalcWindowSizePixel() );
- maZoomToolBox.Show();
- maMinSize.Width() += maZoomToolBox.GetSizePixel().Width();
+ maZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, mpZoomListBox );
+ maZoomToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
+ maZoomToolBox->SetSizePixel( maZoomToolBox->CalcWindowSizePixel() );
+ maZoomToolBox->Show();
+ maMinSize.Width() += maZoomToolBox->GetSizePixel().Width();
if( MEDIACONTROLSTYLE_MULTILINE == meControlStyle )
{
@@ -196,8 +196,20 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
MediaControl::~MediaControl()
{
- maZoomToolBox.SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL );
- delete mpZoomListBox;
+ disposeOnce();
+}
+
+void MediaControl::dispose()
+{
+ maZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL );
+ mpZoomListBox.disposeAndClear();
+ maTimeEdit.disposeAndClear();
+ maZoomToolBox.disposeAndClear();
+ maVolumeSlider.disposeAndClear();
+ maMuteToolBox.disposeAndClear();
+ maTimeSlider.disposeAndClear();
+ maPlayToolBox.disposeAndClear();
+ Control::dispose();
}
@@ -212,56 +224,56 @@ const Size& MediaControl::getMinSizePixel() const
void MediaControl::Resize()
{
Point aPos( 0, 0 );
- const sal_Int32 nPlayToolBoxWidth = maPlayToolBox.GetSizePixel().Width();
- const sal_Int32 nMuteToolBoxWidth = maMuteToolBox.GetSizePixel().Width();
- const sal_Int32 nVolumeSliderWidth = maVolumeSlider.GetSizePixel().Width();
- const sal_Int32 nZoomToolBoxWidth = maZoomToolBox.GetSizePixel().Width();
- const sal_Int32 nTimeEditWidth = maTimeEdit.GetSizePixel().Width();
- const sal_Int32 nTimeSliderHeight = maTimeSlider.GetSizePixel().Height();
+ const sal_Int32 nPlayToolBoxWidth = maPlayToolBox->GetSizePixel().Width();
+ const sal_Int32 nMuteToolBoxWidth = maMuteToolBox->GetSizePixel().Width();
+ const sal_Int32 nVolumeSliderWidth = maVolumeSlider->GetSizePixel().Width();
+ const sal_Int32 nZoomToolBoxWidth = maZoomToolBox->GetSizePixel().Width();
+ const sal_Int32 nTimeEditWidth = maTimeEdit->GetSizePixel().Width();
+ const sal_Int32 nTimeSliderHeight = maTimeSlider->GetSizePixel().Height();
if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle )
{
const sal_Int32 nTimeSliderWidth = GetSizePixel().Width() - ( AVMEDIA_CONTROLOFFSET * 3 ) -
nPlayToolBoxWidth - nMuteToolBoxWidth - nVolumeSliderWidth - nTimeEditWidth - nZoomToolBoxWidth;
- maPlayToolBox.SetPosSizePixel( aPos, maPlayToolBox.GetSizePixel() );
+ maPlayToolBox->SetPosSizePixel( aPos, maPlayToolBox->GetSizePixel() );
aPos.X() += nPlayToolBoxWidth;
- maTimeSlider.SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) );
+ maTimeSlider->SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) );
aPos.X() += nTimeSliderWidth + AVMEDIA_CONTROLOFFSET;
- maTimeEdit.SetPosSizePixel( aPos, maTimeEdit.GetSizePixel() );
+ maTimeEdit->SetPosSizePixel( aPos, maTimeEdit->GetSizePixel() );
aPos.X() += nTimeEditWidth + AVMEDIA_CONTROLOFFSET;
- maMuteToolBox.SetPosSizePixel( aPos, maMuteToolBox.GetSizePixel() );
+ maMuteToolBox->SetPosSizePixel( aPos, maMuteToolBox->GetSizePixel() );
aPos.X() += nMuteToolBoxWidth;
- maVolumeSlider.SetPosSizePixel( aPos, maVolumeSlider.GetSizePixel() );
+ maVolumeSlider->SetPosSizePixel( aPos, maVolumeSlider->GetSizePixel() );
aPos.X() += nVolumeSliderWidth + AVMEDIA_CONTROLOFFSET;
- maZoomToolBox.SetPosSizePixel( aPos, maZoomToolBox.GetSizePixel() );
+ maZoomToolBox->SetPosSizePixel( aPos, maZoomToolBox->GetSizePixel() );
}
else
{
const sal_Int32 nTimeSliderWidth = GetSizePixel().Width() - AVMEDIA_CONTROLOFFSET - nTimeEditWidth;
- maTimeSlider.SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) );
+ maTimeSlider->SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) );
aPos.X() += nTimeSliderWidth + AVMEDIA_CONTROLOFFSET;
- maTimeEdit.SetPosSizePixel( aPos, maTimeEdit.GetSizePixel() );
+ maTimeEdit->SetPosSizePixel( aPos, maTimeEdit->GetSizePixel() );
aPos.X() = 0;
aPos.Y() += nTimeSliderHeight + AVMEDIA_CONTROLOFFSET;
- maPlayToolBox.SetPosSizePixel( aPos, maPlayToolBox.GetSizePixel() );
+ maPlayToolBox->SetPosSizePixel( aPos, maPlayToolBox->GetSizePixel() );
aPos.X() = GetSizePixel().Width() - nVolumeSliderWidth - nMuteToolBoxWidth - nZoomToolBoxWidth - AVMEDIA_CONTROLOFFSET;
- maMuteToolBox.SetPosSizePixel( aPos, maMuteToolBox.GetSizePixel() );
+ maMuteToolBox->SetPosSizePixel( aPos, maMuteToolBox->GetSizePixel() );
aPos.X() += nMuteToolBoxWidth;
- maVolumeSlider.SetPosSizePixel( aPos, maVolumeSlider.GetSizePixel() );
+ maVolumeSlider->SetPosSizePixel( aPos, maVolumeSlider->GetSizePixel() );
aPos.X() = GetSizePixel().Width() - nZoomToolBoxWidth;
- maZoomToolBox.SetPosSizePixel( aPos, maZoomToolBox.GetSizePixel() );
+ maZoomToolBox->SetPosSizePixel( aPos, maZoomToolBox->GetSizePixel() );
}
}
@@ -286,48 +298,48 @@ void MediaControl::implUpdateToolboxes()
{
const bool bValidURL = !maItem.getURL().isEmpty();
- maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_INSERT, bValidURL );
- maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_PLAY, bValidURL );
- maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_PAUSE, bValidURL );
- maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_STOP, bValidURL );
- maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_LOOP, bValidURL );
- maMuteToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_MUTE, bValidURL );
+ maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_INSERT, bValidURL );
+ maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_PLAY, bValidURL );
+ maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_PAUSE, bValidURL );
+ maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_STOP, bValidURL );
+ maPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_LOOP, bValidURL );
+ maMuteToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_MUTE, bValidURL );
if( !bValidURL || !IsEnabled() )
{
mpZoomListBox->Disable();
if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle )
- maPlayToolBox.Disable();
+ maPlayToolBox->Disable();
- maMuteToolBox.Disable();
+ maMuteToolBox->Disable();
}
else
{
- maPlayToolBox.Enable();
- maMuteToolBox.Enable();
+ maPlayToolBox->Enable();
+ maMuteToolBox->Enable();
if( MEDIASTATE_PLAY == maItem.getState() )
{
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, true );
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false );
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, true );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false );
}
else if( maItem.getTime() > 0.0 && ( maItem.getTime() < maItem.getDuration() ) )
{
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false );
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, true );
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, true );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false );
}
else
{
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false );
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false );
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, true );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP, true );
}
- maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_LOOP, maItem.isLoop() );
- maMuteToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_MUTE, maItem.isMute() );
+ maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_LOOP, maItem.isLoop() );
+ maMuteToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_MUTE, maItem.isMute() );
if( !mpZoomListBox->IsTravelSelect() && !mpZoomListBox->IsInDropDown() )
{
@@ -360,10 +372,10 @@ void MediaControl::implUpdateToolboxes()
void MediaControl::implUpdateTimeSlider()
{
if( maItem.getURL().isEmpty() || !IsEnabled() )
- maTimeSlider.Disable();
+ maTimeSlider->Disable();
else
{
- maTimeSlider.Enable();
+ maTimeSlider->Enable();
const double fDuration = maItem.getDuration();
@@ -371,13 +383,13 @@ void MediaControl::implUpdateTimeSlider()
{
const double fTime = ::std::min( maItem.getTime(), fDuration );
- if( !maTimeSlider.GetLineSize() )
- maTimeSlider.SetLineSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_LINEINCREMENT / fDuration ) );
+ if( !maTimeSlider->GetLineSize() )
+ maTimeSlider->SetLineSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_LINEINCREMENT / fDuration ) );
- if( !maTimeSlider.GetPageSize() )
- maTimeSlider.SetPageSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_PAGEINCREMENT / fDuration ) );
+ if( !maTimeSlider->GetPageSize() )
+ maTimeSlider->SetPageSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_PAGEINCREMENT / fDuration ) );
- maTimeSlider.SetThumbPos( static_cast< sal_Int32 >( fTime / fDuration * AVMEDIA_TIME_RANGE ) );
+ maTimeSlider->SetThumbPos( static_cast< sal_Int32 >( fTime / fDuration * AVMEDIA_TIME_RANGE ) );
}
}
}
@@ -387,14 +399,14 @@ void MediaControl::implUpdateTimeSlider()
void MediaControl::implUpdateVolumeSlider()
{
if( maItem.getURL().isEmpty() || !IsEnabled() )
- maVolumeSlider.Disable();
+ maVolumeSlider->Disable();
else
{
- maVolumeSlider.Enable();
+ maVolumeSlider->Enable();
const sal_Int32 nVolumeDB = maItem.getVolumeDB();
- maVolumeSlider.SetThumbPos( ::std::min( ::std::max( nVolumeDB, static_cast< sal_Int32 >( AVMEDIA_DB_RANGE ) ),
+ maVolumeSlider->SetThumbPos( ::std::min( ::std::max( nVolumeDB, static_cast< sal_Int32 >( AVMEDIA_DB_RANGE ) ),
static_cast< sal_Int32 >( 0 ) ) );
}
}
@@ -414,8 +426,8 @@ void MediaControl::implUpdateTimeField( double fCurTime )
" / " +
rLocaleData.getDuration( tools::Time( 0, 0, static_cast< sal_uInt32 >( floor( maItem.getDuration() ) )) );
- if( maTimeEdit.GetText() != aTimeString )
- maTimeEdit.SetText( aTimeString );
+ if( maTimeEdit->GetText() != aTimeString )
+ maTimeEdit->SetText( aTimeString );
}
}
@@ -535,13 +547,13 @@ IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p )
case( AVMEDIA_TOOLBOXITEM_MUTE ):
{
- aExecItem.setMute( !maMuteToolBox.IsItemChecked( AVMEDIA_TOOLBOXITEM_MUTE ) );
+ aExecItem.setMute( !maMuteToolBox->IsItemChecked( AVMEDIA_TOOLBOXITEM_MUTE ) );
}
break;
case( AVMEDIA_TOOLBOXITEM_LOOP ):
{
- aExecItem.setLoop( !maPlayToolBox.IsItemChecked( AVMEDIA_TOOLBOXITEM_LOOP ) );
+ aExecItem.setLoop( !maPlayToolBox->IsItemChecked( AVMEDIA_TOOLBOXITEM_LOOP ) );
}
break;
diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx
index 6090b6289394..28adf1959c8e 100644
--- a/avmedia/source/framework/mediaplayer.cxx
+++ b/avmedia/source/framework/mediaplayer.cxx
@@ -40,9 +40,9 @@ namespace avmedia
MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId )
{
- pWindow = new MediaFloater( _pBindings, this, _pParent );
+ pWindow.reset( VclPtr<MediaFloater>::Create( _pBindings, this, _pParent ) );
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- static_cast< MediaFloater* >( pWindow )->Initialize( pInfo );
+ static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo );
};
@@ -75,8 +75,14 @@ MediaFloater::MediaFloater( SfxBindings* _pBindings, SfxChildWindow* pCW, vcl::W
MediaFloater::~MediaFloater()
{
+ disposeOnce();
+}
+
+void MediaFloater::dispose()
+{
delete mpMediaWindow;
mpMediaWindow = NULL;
+ SfxDockingWindow::dispose();
}
diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx
index ea4131fe4713..4f20a781c676 100644
--- a/avmedia/source/framework/mediatoolbox.cxx
+++ b/avmedia/source/framework/mediatoolbox.cxx
@@ -42,7 +42,6 @@ class MediaToolBoxControl_Impl : public MediaControl
public:
MediaToolBoxControl_Impl( vcl::Window& rParent, MediaToolBoxControl& rControl );
- virtual ~MediaToolBoxControl_Impl();
void update() SAL_OVERRIDE;
void execute( const MediaItem& rItem ) SAL_OVERRIDE;
@@ -63,12 +62,6 @@ MediaToolBoxControl_Impl::MediaToolBoxControl_Impl( vcl::Window& rParent, MediaT
-MediaToolBoxControl_Impl::~MediaToolBoxControl_Impl()
-{
-}
-
-
-
void MediaToolBoxControl_Impl::update()
{
mpToolBoxControl->implUpdateMediaControl();
@@ -131,9 +124,9 @@ void MediaToolBoxControl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eSta
-vcl::Window* MediaToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> MediaToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- return( pParent ? new MediaToolBoxControl_Impl( *pParent, *this ) : NULL );
+ return ( pParent ? VclPtr<MediaToolBoxControl_Impl>::Create( *pParent, *this ) : nullptr );
}
diff --git a/avmedia/source/viewer/mediaevent_impl.cxx b/avmedia/source/viewer/mediaevent_impl.cxx
index 86e18175101c..3e42ebb223b4 100644
--- a/avmedia/source/viewer/mediaevent_impl.cxx
+++ b/avmedia/source/viewer/mediaevent_impl.cxx
@@ -45,7 +45,7 @@ MediaEventListenersImpl::~MediaEventListenersImpl()
void MediaEventListenersImpl::cleanUp()
{
- Application::RemoveMouseAndKeyEvents( reinterpret_cast< vcl::Window* >( mpNotifyWindow ) );
+ Application::RemoveMouseAndKeyEvents( reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ) );
mpNotifyWindow = NULL;
}
@@ -72,7 +72,7 @@ void SAL_CALL MediaEventListenersImpl::keyPressed( const ::com::sun::star::awt::
( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) );
KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode );
- Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLKeyEvt );
+ Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLKeyEvt );
}
}
@@ -91,7 +91,7 @@ void SAL_CALL MediaEventListenersImpl::keyReleased( const ::com::sun::star::awt:
( ( e.Modifiers & 2 ) ? KEY_MOD1 : 0 ) |
( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) );
KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode );
- Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLKeyEvt );
+ Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLKeyEvt );
}
}
@@ -112,7 +112,7 @@ void SAL_CALL MediaEventListenersImpl::mousePressed( const ::com::sun::star::awt
( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) |
( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ),
e.Modifiers );
- Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
+ Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt );
}
}
@@ -133,7 +133,7 @@ void SAL_CALL MediaEventListenersImpl::mouseReleased( const ::com::sun::star::aw
( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) |
( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ),
e.Modifiers );
- Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
+ Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt );
}
}
@@ -174,7 +174,7 @@ void SAL_CALL MediaEventListenersImpl::mouseDragged( const ::com::sun::star::awt
if( mpNotifyWindow )
{
MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, MouseEventModifiers::NONE, e.Buttons, e.Modifiers );
- Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
+ Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt );
}
}
@@ -189,7 +189,7 @@ void SAL_CALL MediaEventListenersImpl::mouseMoved( const ::com::sun::star::awt::
if( mpNotifyWindow )
{
MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, MouseEventModifiers::NONE, e.Buttons, e.Modifiers );
- Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
+ Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt );
}
}
diff --git a/avmedia/source/viewer/mediaevent_impl.hxx b/avmedia/source/viewer/mediaevent_impl.hxx
index 63e1a0d77ba2..27676c749d84 100644
--- a/avmedia/source/viewer/mediaevent_impl.hxx
+++ b/avmedia/source/viewer/mediaevent_impl.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/awt/XMouseListener.hpp>
#include <com/sun/star/awt/XMouseMotionListener.hpp>
#include <com/sun/star/awt/XFocusListener.hpp>
+#include <vcl/vclptr.hxx>
namespace avmedia
{
@@ -69,7 +70,7 @@ namespace avmedia
private:
- vcl::Window* mpNotifyWindow;
+ VclPtr<vcl::Window> mpNotifyWindow;
mutable ::osl::Mutex maMutex;
};
}
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index a40d8a384be2..267e39fb7d6a 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -46,7 +46,7 @@ namespace avmedia {
MediaWindow::MediaWindow( vcl::Window* parent, bool bInternalMediaControl ) :
- mpImpl( new priv::MediaWindowImpl( parent, this, bInternalMediaControl ) )
+ mpImpl( VclPtr<priv::MediaWindowImpl>::Create( parent, this, bInternalMediaControl ) )
{
mpImpl->Show();
}
@@ -327,9 +327,10 @@ bool MediaWindow::executeMediaURLDialog(vcl::Window* /* pParent */,
void MediaWindow::executeFormatErrorBox( vcl::Window* pParent )
{
- MessageDialog aErrBox( pParent, AVMEDIA_RESID( AVMEDIA_STR_ERR_URL ) );
+ ScopedVclPtrInstance< MessageDialog > aErrBox( pParent, AVMEDIA_RESID( AVMEDIA_STR_ERR_URL ) );
- aErrBox.Execute();
+ aErrBox->Execute();
+ aErrBox.disposeAndClear();
}
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 7a6863b1b2bc..c84849b2dec3 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -56,12 +56,6 @@ MediaWindowControl::MediaWindowControl( vcl::Window* pParent ) :
-MediaWindowControl::~MediaWindowControl()
-{
-}
-
-
-
void MediaWindowControl::update()
{
MediaItem aItem;
@@ -93,12 +87,6 @@ MediaChildWindow::MediaChildWindow( vcl::Window* pParent, SystemWindowData* pDat
}
#endif
-MediaChildWindow::~MediaChildWindow()
-{
-}
-
-
-
void MediaChildWindow::MouseMove( const MouseEvent& rMEvt )
{
const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
@@ -168,7 +156,7 @@ MediaWindowImpl::MediaWindowImpl( vcl::Window* pParent, MediaWindow* pMediaWindo
mpMediaWindow( pMediaWindow ),
mpEvents( NULL ),
mbEventTransparent(true),
- mpMediaWindowControl( bInternalMediaControl ? new MediaWindowControl( this ) : NULL ),
+ mpMediaWindowControl( bInternalMediaControl ? VclPtr<MediaWindowControl>::Create( this ) : nullptr ),
mpEmptyBmpEx( NULL ),
mpAudioBmpEx( NULL )
{
@@ -183,6 +171,11 @@ MediaWindowImpl::MediaWindowImpl( vcl::Window* pParent, MediaWindow* pMediaWindo
MediaWindowImpl::~MediaWindowImpl()
{
+ disposeOnce();
+}
+
+void MediaWindowImpl::dispose()
+{
if( mpEvents )
mpEvents->cleanUp();
@@ -208,8 +201,13 @@ MediaWindowImpl::~MediaWindowImpl()
mpMediaWindow = NULL;
delete mpEmptyBmpEx;
+ mpEmptyBmpEx = NULL;
delete mpAudioBmpEx;
- delete mpMediaWindowControl;
+ mpAudioBmpEx = NULL;
+ mpMediaWindowControl.disposeAndClear();
+ mpChildWindow.disposeAndClear();
+
+ Control::dispose();
}
uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& rURL, const OUString& rReferer, const OUString* pMimeType )
@@ -510,13 +508,15 @@ void MediaWindowImpl::onURLChanged()
{
if( m_sMimeType == AVMEDIA_MIMETYPE_COMMON )
{
- mpChildWindow.reset(new MediaChildWindow(this) );
+ mpChildWindow.disposeAndClear();
+ mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this) );
}
#if HAVE_FEATURE_GLTF
else if ( m_sMimeType == AVMEDIA_MIMETYPE_JSON )
{
SystemWindowData aWinData = OpenGLContext::generateWinData(this, false);
- mpChildWindow.reset(new MediaChildWindow(this,&aWinData));
+ mpChildWindow.disposeAndClear();
+ mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this,&aWinData));
mbEventTransparent = false;
}
#endif
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index c5c65fa41aa0..c56558c375db 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -49,7 +49,6 @@ namespace avmedia
public:
MediaWindowControl( vcl::Window* pParent );
- virtual ~MediaWindowControl();
protected:
@@ -67,7 +66,6 @@ namespace avmedia
MediaChildWindow( vcl::Window* pParent );
MediaChildWindow( vcl::Window* pParent, SystemWindowData* pData );
- virtual ~MediaChildWindow();
protected:
@@ -94,6 +92,7 @@ namespace avmedia
MediaWindowImpl( vcl::Window* parent, MediaWindow* pMediaWindow, bool bInternalMediaControl );
virtual ~MediaWindowImpl();
+ virtual void dispose() SAL_OVERRIDE;
static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer, const OUString* pMimeType = 0 );
@@ -173,8 +172,8 @@ namespace avmedia
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxEventsIf;
MediaEventListenersImpl* mpEvents;
bool mbEventTransparent;
- std::unique_ptr<MediaChildWindow> mpChildWindow;
- MediaWindowControl* mpMediaWindowControl;
+ VclPtr<MediaChildWindow> mpChildWindow;
+ VclPtr<MediaWindowControl> mpMediaWindowControl;
BitmapEx* mpEmptyBmpEx;
BitmapEx* mpAudioBmpEx;
};
diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx
index 7f0388960c11..93302febee1d 100644
--- a/basctl/source/basicide/basdoc.cxx
+++ b/basctl/source/basicide/basdoc.cxx
@@ -51,7 +51,9 @@ DocShell::DocShell()
}
DocShell::~DocShell()
-{ }
+{
+ pPrinter.disposeAndClear();
+}
SfxPrinter* DocShell::GetPrinter( bool bCreate )
{
@@ -66,7 +68,10 @@ SfxPrinter* DocShell::GetPrinter( bool bCreate )
void DocShell::SetPrinter( SfxPrinter* pPr )
{
if (pPr != pPrinter.get())
+ {
+ pPrinter.disposeAndClear();
pPrinter.reset(pPr);
+ }
}
void DocShell::FillClass( SvGlobalName*, SotClipboardFormatId*, OUString*, OUString*, OUString*, sal_Int32, bool bTemplate) const
diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx
index 5b6210d5dcab..083049ce073d 100644
--- a/basctl/source/basicide/basdoc.hxx
+++ b/basctl/source/basicide/basdoc.hxx
@@ -23,17 +23,16 @@
#include <iderid.hxx>
#include <sfx2/docfac.hxx>
#include <svx/ifaceids.hxx>
-
+#include <vcl/vclptr.hxx>
+#include <sfx2/printer.hxx>
#include <boost/scoped_ptr.hpp>
-class SfxPrinter;
-
namespace basctl
{
class DocShell: public SfxObjectShell
{
- boost::scoped_ptr<SfxPrinter> pPrinter;
+ ScopedVclPtr<SfxPrinter> pPrinter;
protected:
virtual void Draw( OutputDevice *, const JobSetup & rSetup,
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx
index d4cbae63aa88..a774c1bd796d 100644
--- a/basctl/source/basicide/basicbox.cxx
+++ b/basctl/source/basicide/basicbox.cxx
@@ -46,12 +46,6 @@ LibBoxControl::LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx
-LibBoxControl::~LibBoxControl()
-{
-}
-
-
-
void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
{
LibBox* pBox = static_cast<LibBox*>(GetToolBox().GetItemWindow(GetId()));
@@ -71,9 +65,9 @@ void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPool
-vcl::Window* LibBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> LibBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- return new LibBox( pParent, m_xFrame );
+ return VclPtr<LibBox>::Create( pParent, m_xFrame );
}
@@ -88,7 +82,13 @@ DocListenerBox::DocListenerBox( vcl::Window* pParent )
DocListenerBox::~DocListenerBox()
{
+ disposeOnce();
+}
+
+void DocListenerBox::dispose()
+{
m_aNotifier.dispose();
+ ListBox::dispose();
}
void DocListenerBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
@@ -156,7 +156,13 @@ LibBox::LibBox( vcl::Window* pParent, const uno::Reference< frame::XFrame >& rFr
LibBox::~LibBox()
{
+ disposeOnce();
+}
+
+void LibBox::dispose()
+{
ClearBox();
+ DocListenerBox::dispose();
}
void LibBox::Update( const SfxStringItem* pItem )
@@ -341,10 +347,6 @@ LanguageBoxControl::LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, Tool
{
}
-LanguageBoxControl::~LanguageBoxControl()
-{
-}
-
void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, const SfxPoolItem* pItem )
{
(void)nID;
@@ -360,9 +362,9 @@ void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, cons
}
}
-vcl::Window* LanguageBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> LanguageBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- return new LanguageBox( pParent );
+ return VclPtr<LanguageBox>::Create( pParent );
}
// class basctl::LanguageBox -----------------------------------------------
@@ -384,7 +386,13 @@ LanguageBox::LanguageBox( vcl::Window* pParent ) :
LanguageBox::~LanguageBox()
{
+ disposeOnce();
+}
+
+void LanguageBox::dispose()
+{
ClearBox();
+ DocListenerBox::dispose();
}
void LanguageBox::FillBox()
diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx
index f6d31703f7d1..3e4cc8045f04 100644
--- a/basctl/source/basicide/basicbox.hxx
+++ b/basctl/source/basicide/basicbox.hxx
@@ -33,11 +33,10 @@ public:
SFX_DECL_TOOLBOX_CONTROL();
LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
- virtual ~LibBoxControl();
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;
};
/** base class for list boxes which need to update their content according to the list
@@ -49,6 +48,7 @@ class DocListenerBox :public ListBox
protected:
DocListenerBox( vcl::Window* pParent );
virtual ~DocListenerBox();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual void FillBox() = 0;
@@ -95,7 +95,8 @@ protected:
public:
LibBox( vcl::Window* pParent,
const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
- virtual ~LibBox();
+ virtual ~LibBox();
+ virtual void dispose() SAL_OVERRIDE;
using Window::Update;
void Update( const SfxStringItem* pItem );
@@ -107,10 +108,9 @@ public:
SFX_DECL_TOOLBOX_CONTROL();
LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
- virtual ~LanguageBoxControl();
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 LanguageBox : public DocListenerBox
@@ -135,6 +135,7 @@ protected:
public:
LanguageBox( vcl::Window* pParent );
virtual ~LanguageBox();
+ virtual void dispose() SAL_OVERRIDE;
using Window::Update;
void Update( const SfxStringItem* pItem );
diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx
index ee5ed4bef958..72814178984b 100644
--- a/basctl/source/basicide/basicrenderable.cxx
+++ b/basctl/source/basicide/basicrenderable.cxx
@@ -77,17 +77,17 @@ Renderable::~Renderable()
{
}
-Printer* Renderable::getPrinter()
+VclPtr< Printer > Renderable::getPrinter()
{
- Printer* pPrinter = NULL;
+ VclPtr< Printer > pPrinter;
Any aValue( getValue( "RenderDevice" ) );
Reference<awt::XDevice> xRenderDevice;
if( aValue >>= xRenderDevice )
{
VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice);
- OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
- pPrinter = dynamic_cast<Printer*>(pOut);
+ VclPtr< OutputDevice > pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >();
+ pPrinter = dynamic_cast<Printer*>(pOut.get());
}
return pPrinter;
}
diff --git a/basctl/source/basicide/basicrenderable.hxx b/basctl/source/basicide/basicrenderable.hxx
index f91a5ef8a9d3..dd60f1653b03 100644
--- a/basctl/source/basicide/basicrenderable.hxx
+++ b/basctl/source/basicide/basicrenderable.hxx
@@ -33,10 +33,10 @@ class Renderable :
public cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >,
public vcl::PrinterOptionsHelper
{
- BaseWindow* mpWindow;
+ VclPtr<BaseWindow> mpWindow;
osl::Mutex maMutex;
- Printer* getPrinter();
+ VclPtr<Printer> getPrinter();
public:
Renderable (BaseWindow*);
virtual ~Renderable();
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 1c11bb11a24d..f6e491a03abe 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -192,10 +192,10 @@ ModulWindow::ModulWindow (
BaseWindow(pParent, rDocument, aLibName, aName),
rLayout(*pParent),
nValid(ValidWindow),
- aXEditorWindow(this),
+ aXEditorWindow(VclPtr<ComplexEditorWindow>::Create(this)),
m_aModule(aModule)
{
- aXEditorWindow.Show();
+ aXEditorWindow->Show();
SetBackground();
}
@@ -227,9 +227,15 @@ SbModuleRef ModulWindow::XModule()
ModulWindow::~ModulWindow()
{
- nValid = 0;
+ disposeOnce();
+}
+void ModulWindow::dispose()
+{
+ nValid = 0;
StarBASIC::Stop();
+ aXEditorWindow.disposeAndClear();
+ BaseWindow::dispose();
}
@@ -237,7 +243,7 @@ void ModulWindow::GetFocus()
{
if (nValid != ValidWindow)
return;
- aXEditorWindow.GetEdtWindow().GrabFocus();
+ aXEditorWindow->GetEdtWindow().GrabFocus();
// don't call basic calls because focus is somewhere else...
}
@@ -256,7 +262,7 @@ void ModulWindow::Paint( const Rectangle& )
void ModulWindow::Resize()
{
- aXEditorWindow.SetPosSizePixel( Point( 0, 0 ),
+ aXEditorWindow->SetPosSizePixel( Point( 0, 0 ),
Size( GetOutputSizePixel() ) );
}
@@ -580,7 +586,7 @@ bool ModulWindow::BasicToggleBreakPoint()
bNewBreakPoint = true;
}
- aXEditorWindow.GetBrkWindow().Invalidate();
+ aXEditorWindow->GetBrkWindow().Invalidate();
return bNewBreakPoint;
}
@@ -613,8 +619,8 @@ void ModulWindow::BasicToggleBreakPointEnabled()
void ModulWindow::ManageBreakPoints()
{
BreakPointWindow& rBrkWin = GetBreakPointWindow();
- BreakPointDialog aBrkDlg( &rBrkWin, GetBreakPoints() );
- aBrkDlg.Execute();
+ ScopedVclPtrInstance< BreakPointDialog > aBrkDlg( &rBrkWin, GetBreakPoints() );
+ aBrkDlg->Execute();
rBrkWin.Invalidate();
}
@@ -638,7 +644,7 @@ bool ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
// if other basic, the IDE should try to display the correct module
bool const bMarkError = pBasic == GetBasic();
if ( bMarkError )
- aXEditorWindow.GetBrkWindow().SetMarkerPos(nErrorLine, true);
+ aXEditorWindow->GetBrkWindow().SetMarkerPos(nErrorLine, true);
// #i47002#
Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( this );
@@ -651,7 +657,7 @@ bool ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
return false;
if ( bMarkError )
- aXEditorWindow.GetBrkWindow().SetNoMarker();
+ aXEditorWindow->GetBrkWindow().SetNoMarker();
return false;
}
@@ -676,7 +682,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
AssertValidEditEngine();
GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, 0 ), TextPaM( nErrorLine, 0 ) ) );
- aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine );
+ aXEditorWindow->GetBrkWindow().SetMarkerPos( nErrorLine );
rLayout.UpdateDebug(false);
@@ -691,7 +697,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
Application::Yield();
aStatus.bIsInReschedule = false;
- aXEditorWindow.GetBrkWindow().SetNoMarker();
+ aXEditorWindow->GetBrkWindow().SetNoMarker();
ClearStatus( BASWIN_INRESCHEDULE );
@@ -1022,7 +1028,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
{
SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false);
bSourceLinesEnabled = pItem && pItem->GetValue();
- aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+ aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled);
}
break;
case SID_BASICIDE_DELETECURRENT:
@@ -1037,9 +1043,9 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
break;
case SID_GOTOLINE:
{
- GotoLineDialog aGotoDlg(this);
- if (aGotoDlg.Execute())
- if (sal_Int32 const nLine = aGotoDlg.GetLineNumber())
+ ScopedVclPtrInstance< GotoLineDialog > aGotoDlg(this);
+ if (aGotoDlg->Execute())
+ if (sal_Int32 const nLine = aGotoDlg->GetLineNumber())
{
TextSelection const aSel(TextPaM(nLine - 1, 0), TextPaM(nLine - 1, 0));
GetEditView()->SetSelection(aSel);
@@ -1236,7 +1242,7 @@ void ModulWindow::AssertValidEditEngine()
void ModulWindow::Activating ()
{
- aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+ aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled);
Show();
}
@@ -1420,7 +1426,7 @@ bool ModulWindow::IsPasteAllowed()
void ModulWindow::OnNewDocument ()
{
- aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+ aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled);
}
char const* ModulWindow::GetHid () const
@@ -1464,15 +1470,28 @@ void ModulWindow::UpdateModule ()
ModulWindowLayout::ModulWindowLayout (vcl::Window* pParent, ObjectCatalog& rObjectCatalog_) :
Layout(pParent),
pChild(0),
- aWatchWindow(this),
- aStackWindow(this),
+ aWatchWindow(VclPtr<WatchWindow>::Create(this)),
+ aStackWindow(VclPtr<StackWindow>::Create(this)),
rObjectCatalog(rObjectCatalog_)
{ }
+ModulWindowLayout::~ModulWindowLayout()
+{
+ disposeOnce();
+}
+
+void ModulWindowLayout::dispose()
+{
+ aWatchWindow.disposeAndClear();
+ aStackWindow.disposeAndClear();
+ pChild.clear();
+ Layout::dispose();
+}
+
void ModulWindowLayout::UpdateDebug (bool bBasicStopped)
{
- aWatchWindow.UpdateWatches(bBasicStopped);
- aStackWindow.UpdateCalls();
+ aWatchWindow->UpdateWatches(bBasicStopped);
+ aStackWindow->UpdateCalls();
}
void ModulWindowLayout::Paint (Rectangle const&)
@@ -1493,8 +1512,8 @@ void ModulWindowLayout::Activating (BaseWindow& rChild)
{
assert(dynamic_cast<ModulWindow*>(&rChild));
pChild = &static_cast<ModulWindow&>(rChild);
- aWatchWindow.Show();
- aStackWindow.Show();
+ aWatchWindow->Show();
+ aStackWindow->Show();
rObjectCatalog.Show();
rObjectCatalog.SetLayoutWindow(this);
rObjectCatalog.UpdateEntries();
@@ -1506,8 +1525,8 @@ void ModulWindowLayout::Deactivating ()
{
aSyntaxColors.SetActiveEditor(0);
Layout::Deactivating();
- aWatchWindow.Hide();
- aStackWindow.Hide();
+ aWatchWindow->Hide();
+ aStackWindow->Hide();
rObjectCatalog.Hide();
pChild = 0;
}
@@ -1528,19 +1547,19 @@ void ModulWindowLayout::GetState (SfxItemSet &rSet, unsigned nWhich)
void ModulWindowLayout::BasicAddWatch (OUString const& rWatchStr)
{
- aWatchWindow.AddWatch(rWatchStr);
+ aWatchWindow->AddWatch(rWatchStr);
}
void ModulWindowLayout::BasicRemoveWatch ()
{
- aWatchWindow.RemoveSelectedWatch();
+ aWatchWindow->RemoveSelectedWatch();
}
void ModulWindowLayout::OnFirstSize (long const nWidth, long const nHeight)
{
AddToLeft(&rObjectCatalog, Size(nWidth * 0.20, nHeight * 0.75));
- AddToBottom(&aWatchWindow, Size(nWidth * 0.67, nHeight * 0.25));
- AddToBottom(&aStackWindow, Size(nWidth * 0.33, nHeight * 0.25));
+ AddToBottom(aWatchWindow.get(), Size(nWidth * 0.67, nHeight * 0.25));
+ AddToBottom(aStackWindow.get(), Size(nWidth * 0.33, nHeight * 0.25));
}
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index a5c3b91fc29e..2d5afed4fb17 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -109,7 +109,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
GetComponentInterface(bool bCreate = true) SAL_OVERRIDE;
CodeCompleteDataCache aCodeCompleteCache;
- boost::scoped_ptr< CodeCompleteWindow > pCodeCompleteWnd;
+ VclPtr<CodeCompleteWindow> pCodeCompleteWnd;
OUString GetActualSubName( sal_uLong nLine ); // gets the actual subroutine name according to line number
void SetupAndShowCodeCompleteWnd(const std::vector< OUString >& aEntryVect, TextSelection aSel );
void HandleAutoCorrect();
@@ -137,6 +137,7 @@ protected:
public:
EditorWindow (vcl::Window* pParent, ModulWindow*);
virtual ~EditorWindow();
+ virtual void dispose() SAL_OVERRIDE;
ExtTextEngine* GetEditEngine() const { return pEditEngine.get(); }
ExtTextView* GetEditView() const { return pEditView.get(); }
@@ -186,7 +187,6 @@ protected:
public:
BreakPointWindow (vcl::Window* pParent, ModulWindow*);
- virtual ~BreakPointWindow();
void SetMarkerPos( sal_uInt16 nLine, bool bErrorMarker = false );
void SetNoMarker ();
@@ -211,6 +211,7 @@ protected:
public:
WatchTreeListBox( vcl::Window* pParent, WinBits nWinBits );
virtual ~WatchTreeListBox();
+ virtual void dispose() SAL_OVERRIDE;
void RequestingChildren( SvTreeListEntry * pParent ) SAL_OVERRIDE;
void UpdateWatches( bool bBasicStopped = false );
@@ -225,10 +226,10 @@ class WatchWindow : public DockingWindow
{
private:
OUString aWatchStr;
- ExtendedEdit aXEdit;
- ImageButton aRemoveWatchButton;
- WatchTreeListBox aTreeListBox;
- HeaderBar aHeaderBar;
+ VclPtr<ExtendedEdit> aXEdit;
+ VclPtr<ImageButton> aRemoveWatchButton;
+ VclPtr<WatchTreeListBox> aTreeListBox;
+ VclPtr<HeaderBar> aHeaderBar;
protected:
virtual void Resize() SAL_OVERRIDE;
@@ -243,20 +244,21 @@ protected:
public:
WatchWindow (Layout* pParent);
virtual ~WatchWindow();
+ virtual void dispose() SAL_OVERRIDE;
void AddWatch( const OUString& rVName );
bool RemoveSelectedWatch();
void UpdateWatches( bool bBasicStopped = false );
- WatchTreeListBox& GetWatchTreeListBox() { return aTreeListBox; }
+ WatchTreeListBox& GetWatchTreeListBox() { return *aTreeListBox.get(); }
};
class StackWindow : public DockingWindow
{
private:
- SvTreeListBox aTreeListBox;
- OUString aStackStr;
+ VclPtr<SvTreeListBox> aTreeListBox;
+ OUString aStackStr;
protected:
virtual void Resize() SAL_OVERRIDE;
@@ -265,6 +267,7 @@ protected:
public:
StackWindow (Layout* pParent);
virtual ~StackWindow();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateCalls();
};
@@ -273,10 +276,10 @@ public:
class ComplexEditorWindow : public vcl::Window
{
private:
- BreakPointWindow aBrkWindow;
- LineNumberWindow aLineNumberWindow;
- EditorWindow aEdtWindow;
- ScrollBar aEWVScrollBar;
+ VclPtr<BreakPointWindow> aBrkWindow;
+ VclPtr<LineNumberWindow> aLineNumberWindow;
+ VclPtr<EditorWindow> aEdtWindow;
+ VclPtr<ScrollBar> aEWVScrollBar;
virtual void DataChanged(DataChangedEvent const & rDCEvt) SAL_OVERRIDE;
@@ -286,11 +289,12 @@ protected:
public:
ComplexEditorWindow( ModulWindow* pParent );
-
- BreakPointWindow& GetBrkWindow() { return aBrkWindow; }
- LineNumberWindow& GetLineNumberWindow() { return aLineNumberWindow; }
- EditorWindow& GetEdtWindow() { return aEdtWindow; }
- ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; }
+ virtual ~ComplexEditorWindow();
+ virtual void dispose() SAL_OVERRIDE;
+ BreakPointWindow& GetBrkWindow() { return *aBrkWindow.get(); }
+ LineNumberWindow& GetLineNumberWindow() { return *aLineNumberWindow.get(); }
+ EditorWindow& GetEdtWindow() { return *aEdtWindow.get(); }
+ ScrollBar& GetEWVScrollBar() { return *aEWVScrollBar.get(); }
void SetLineNumberDisplay(bool b);
};
@@ -302,7 +306,7 @@ private:
ModulWindowLayout& rLayout;
StarBASICRef xBasic;
short nValid;
- ComplexEditorWindow aXEditorWindow;
+ VclPtr<ComplexEditorWindow> aXEditorWindow;
BasicStatus aStatus;
SbModuleRef xModule;
OUString aCurPath;
@@ -328,6 +332,7 @@ public:
ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aName, OUString& aModule );
virtual ~ModulWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ExecuteCommand (SfxRequest& rReq) SAL_OVERRIDE;
virtual void ExecuteGlobal (SfxRequest& rReq) SAL_OVERRIDE;
@@ -386,10 +391,10 @@ public:
virtual SearchOptionFlags GetSearchOptions() SAL_OVERRIDE;
virtual sal_uInt16 StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false) SAL_OVERRIDE;
- EditorWindow& GetEditorWindow() { return aXEditorWindow.GetEdtWindow(); }
- BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow.GetBrkWindow(); }
- LineNumberWindow& GetLineNumberWindow() { return aXEditorWindow.GetLineNumberWindow(); }
- ScrollBar& GetEditVScrollBar() { return aXEditorWindow.GetEWVScrollBar(); }
+ EditorWindow& GetEditorWindow() { return aXEditorWindow->GetEdtWindow(); }
+ BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow->GetBrkWindow(); }
+ LineNumberWindow& GetLineNumberWindow() { return aXEditorWindow->GetLineNumberWindow(); }
+ ScrollBar& GetEditVScrollBar() { return aXEditorWindow->GetEWVScrollBar(); }
ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); }
ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); }
BreakPointList& GetBreakPoints() { return GetBreakPointWindow().GetBreakPoints(); }
@@ -419,6 +424,8 @@ class ModulWindowLayout: public Layout
{
public:
ModulWindowLayout (vcl::Window* pParent, ObjectCatalog&);
+ virtual ~ModulWindowLayout();
+ virtual void dispose() SAL_OVERRIDE;
public:
// Layout:
virtual void Activating (BaseWindow&) SAL_OVERRIDE;
@@ -438,10 +445,10 @@ protected:
private:
// main child window
- ModulWindow* pChild;
+ VclPtr<ModulWindow> pChild;
// dockable windows
- WatchWindow aWatchWindow;
- StackWindow aStackWindow;
+ VclPtr<WatchWindow> aWatchWindow;
+ VclPtr<StackWindow> aStackWindow;
ObjectCatalog& rObjectCatalog;
private:
virtual void DataChanged (DataChangedEvent const& rDCEvt) SAL_OVERRIDE;
@@ -468,7 +475,7 @@ private:
// the configuration
svtools::ColorConfig aConfig;
// the active editor
- EditorWindow* pEditor;
+ VclPtr<EditorWindow> pEditor;
} aSyntaxColors;
};
@@ -482,7 +489,7 @@ private:
/* a buffer to build up function name when typing
* a function name, used for showing/hiding listbox values
* */
- CodeCompleteWindow* pCodeCompleteWindow; // parent window
+ VclPtr<CodeCompleteWindow> pCodeCompleteWindow; // parent window
void SetMatchingEntries(); // sets the visible entries based on aFuncBuffer variable
void HideAndRestoreFocus();
@@ -490,6 +497,8 @@ private:
public:
CodeCompleteListBox( CodeCompleteWindow* pPar );
+ virtual ~CodeCompleteListBox();
+ virtual void dispose() SAL_OVERRIDE;
void InsertSelectedEntry(); //insert the selected entry
DECL_LINK(ImplDoubleClickHdl, void*);
@@ -503,15 +512,16 @@ class CodeCompleteWindow: public vcl::Window
{
friend class CodeCompleteListBox;
private:
- EditorWindow* pParent; // parent window
+ VclPtr<EditorWindow> pParent; // parent window
TextSelection aTextSelection;
- CodeCompleteListBox* pListBox;
+ VclPtr<CodeCompleteListBox> pListBox;
void InitListBox(); // initialize the ListBox
public:
CodeCompleteWindow( EditorWindow* pPar );
- virtual ~CodeCompleteWindow(){ delete pListBox; }
+ virtual ~CodeCompleteWindow();
+ virtual void dispose() SAL_OVERRIDE;
void InsertEntry( const OUString& aStr );
void ClearListBox();
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 46796215108f..fbf4da6470bf 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -227,7 +227,7 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) :
bHighlightning(false),
bDoSyntaxHighlight(true),
bDelayHighlight(true),
- pCodeCompleteWnd(new CodeCompleteWindow(this))
+ pCodeCompleteWnd(VclPtr<CodeCompleteWindow>::Create(this))
{
SetBackground(Wallpaper(GetSettings().GetStyleSettings().GetFieldColor()));
SetPointer( Pointer( POINTER_TEXT ) );
@@ -250,6 +250,11 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) :
EditorWindow::~EditorWindow()
{
+ disposeOnce();
+}
+
+void EditorWindow::dispose()
+{
Reference< beans::XMultiPropertySet > n;
{
osl::MutexGuard g(mutex_);
@@ -266,6 +271,8 @@ EditorWindow::~EditorWindow()
EndListening( *pEditEngine );
pEditEngine->RemoveView(pEditView.get());
}
+ pCodeCompleteWnd.disposeAndClear();
+ vcl::Window::dispose();
}
OUString EditorWindow::GetWordAtCursor()
@@ -1376,12 +1383,6 @@ BreakPointWindow::BreakPointWindow (vcl::Window* pParent, ModulWindow* pModulWin
SetHelpId(HID_BASICIDE_BREAKPOINTWINDOW);
}
-BreakPointWindow::~BreakPointWindow()
-{
-}
-
-
-
void BreakPointWindow::Paint( const Rectangle& )
{
if ( SyncYOffset() )
@@ -1519,9 +1520,9 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt )
break;
case RID_BRKPROPS:
{
- BreakPointDialog aBrkDlg( this, GetBreakPoints() );
- aBrkDlg.SetCurrentBreakPoint( pBrk );
- aBrkDlg.Execute();
+ ScopedVclPtrInstance< BreakPointDialog > aBrkDlg( this, GetBreakPoints() );
+ aBrkDlg->SetCurrentBreakPoint( pBrk );
+ aBrkDlg->Execute();
Invalidate();
}
break;
@@ -1534,8 +1535,8 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt )
{
case RID_BRKDLG:
{
- BreakPointDialog aBrkDlg( this, GetBreakPoints() );
- aBrkDlg.Execute();
+ ScopedVclPtrInstance< BreakPointDialog > aBrkDlg( this, GetBreakPoints() );
+ aBrkDlg->Execute();
Invalidate();
}
break;
@@ -1598,69 +1599,69 @@ namespace
WatchWindow::WatchWindow (Layout* pParent) :
DockingWindow(pParent),
aWatchStr( IDEResId( RID_STR_REMOVEWATCH ) ),
- aXEdit( this, IDEResId( RID_EDT_WATCHEDIT ) ),
- aRemoveWatchButton( this, IDEResId( RID_IMGBTN_REMOVEWATCH ) ),
- aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP
- | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ),
- aHeaderBar( this, WB_BUTTONSTYLE | WB_BORDER )
+ aXEdit( VclPtr<ExtendedEdit>::Create(this, IDEResId( RID_EDT_WATCHEDIT )) ),
+ aRemoveWatchButton( VclPtr<ImageButton>::Create(this, IDEResId( RID_IMGBTN_REMOVEWATCH )) ),
+ aTreeListBox( VclPtr<WatchTreeListBox>::Create(this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP
+ | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ),
+ aHeaderBar( VclPtr<HeaderBar>::Create( this, WB_BUTTONSTYLE | WB_BORDER ) )
{
- aXEdit.SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
- aTreeListBox.SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
+ aXEdit->SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
+ aTreeListBox->SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
long nTextLen = GetTextWidth( aWatchStr ) + DWBORDER + 3;
- aXEdit.SetPosPixel( Point( nTextLen, 3 ) );
- aXEdit.SetAccHdl( LINK( this, WatchWindow, EditAccHdl ) );
- aXEdit.GetAccelerator().InsertItem( 1, vcl::KeyCode( KEY_RETURN ) );
- aXEdit.GetAccelerator().InsertItem( 2, vcl::KeyCode( KEY_ESCAPE ) );
- aXEdit.Show();
-
- aRemoveWatchButton.Disable();
- aRemoveWatchButton.SetClickHdl( LINK( this, WatchWindow, ButtonHdl ) );
- aRemoveWatchButton.SetPosPixel( Point( nTextLen + aXEdit.GetSizePixel().Width() + 4, 2 ) );
- Size aSz( aRemoveWatchButton.GetModeImage().GetSizePixel() );
+ aXEdit->SetPosPixel( Point( nTextLen, 3 ) );
+ aXEdit->SetAccHdl( LINK( this, WatchWindow, EditAccHdl ) );
+ aXEdit->GetAccelerator().InsertItem( 1, vcl::KeyCode( KEY_RETURN ) );
+ aXEdit->GetAccelerator().InsertItem( 2, vcl::KeyCode( KEY_ESCAPE ) );
+ aXEdit->Show();
+
+ aRemoveWatchButton->Disable();
+ aRemoveWatchButton->SetClickHdl( LINK( this, WatchWindow, ButtonHdl ) );
+ aRemoveWatchButton->SetPosPixel( Point( nTextLen + aXEdit->GetSizePixel().Width() + 4, 2 ) );
+ Size aSz( aRemoveWatchButton->GetModeImage().GetSizePixel() );
aSz.Width() += 6;
aSz.Height() += 6;
- aRemoveWatchButton.SetSizePixel( aSz );
- aRemoveWatchButton.Show();
+ aRemoveWatchButton->SetSizePixel( aSz );
+ aRemoveWatchButton->Show();
- long nRWBtnSize = aRemoveWatchButton.GetModeImage().GetSizePixel().Height() + 10;
- nVirtToolBoxHeight = aXEdit.GetSizePixel().Height() + 7;
+ long nRWBtnSize = aRemoveWatchButton->GetModeImage().GetSizePixel().Height() + 10;
+ nVirtToolBoxHeight = aXEdit->GetSizePixel().Height() + 7;
if ( nRWBtnSize > nVirtToolBoxHeight )
nVirtToolBoxHeight = nRWBtnSize;
nHeaderBarHeight = 16;
- aTreeListBox.SetHelpId(HID_BASICIDE_WATCHWINDOW_LIST);
- aTreeListBox.EnableInplaceEditing(true);
- aTreeListBox.SetSelectHdl( LINK( this, WatchWindow, TreeListHdl ) );
- aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight + nHeaderBarHeight ) );
- aTreeListBox.SetHighlightRange( 1, 5 );
+ aTreeListBox->SetHelpId(HID_BASICIDE_WATCHWINDOW_LIST);
+ aTreeListBox->EnableInplaceEditing(true);
+ aTreeListBox->SetSelectHdl( LINK( this, WatchWindow, TreeListHdl ) );
+ aTreeListBox->SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight + nHeaderBarHeight ) );
+ aTreeListBox->SetHighlightRange( 1, 5 );
Point aPnt( DWBORDER, nVirtToolBoxHeight + 1 );
- aHeaderBar.SetPosPixel( aPnt );
- aHeaderBar.SetEndDragHdl( LINK( this, WatchWindow, implEndDragHdl ) );
+ aHeaderBar->SetPosPixel( aPnt );
+ aHeaderBar->SetEndDragHdl( LINK( this, WatchWindow, implEndDragHdl ) );
long nVarTabWidth = 220;
long nValueTabWidth = 100;
long nTypeTabWidth = 1250;
- aHeaderBar.InsertItem( ITEM_ID_VARIABLE, IDEResId(RID_STR_WATCHVARIABLE).toString(), nVarTabWidth );
- aHeaderBar.InsertItem( ITEM_ID_VALUE, IDEResId(RID_STR_WATCHVALUE).toString(), nValueTabWidth );
- aHeaderBar.InsertItem( ITEM_ID_TYPE, IDEResId(RID_STR_WATCHTYPE).toString(), nTypeTabWidth );
+ aHeaderBar->InsertItem( ITEM_ID_VARIABLE, IDEResId(RID_STR_WATCHVARIABLE).toString(), nVarTabWidth );
+ aHeaderBar->InsertItem( ITEM_ID_VALUE, IDEResId(RID_STR_WATCHVALUE).toString(), nValueTabWidth );
+ aHeaderBar->InsertItem( ITEM_ID_TYPE, IDEResId(RID_STR_WATCHTYPE).toString(), nTypeTabWidth );
long tabs[ 4 ];
tabs[ 0 ] = 3; // two tabs
tabs[ 1 ] = 0;
tabs[ 2 ] = nVarTabWidth;
tabs[ 3 ] = nVarTabWidth + nValueTabWidth;
- aTreeListBox.SvHeaderTabListBox::SetTabs( tabs, MAP_PIXEL );
- aTreeListBox.InitHeaderBar( &aHeaderBar );
+ aTreeListBox->SvHeaderTabListBox::SetTabs( tabs, MAP_PIXEL );
+ aTreeListBox->InitHeaderBar( aHeaderBar.get() );
- aTreeListBox.SetNodeDefaultImages( );
+ aTreeListBox->SetNodeDefaultImages( );
- aHeaderBar.Show();
+ aHeaderBar->Show();
- aTreeListBox.Show();
+ aTreeListBox->Show();
SetText(IDEResId(RID_STR_WATCHNAME).toString());
@@ -1674,7 +1675,18 @@ WatchWindow::WatchWindow (Layout* pParent) :
WatchWindow::~WatchWindow()
{
- GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
+ disposeOnce();
+}
+
+void WatchWindow::dispose()
+{
+ aXEdit.disposeAndClear();
+ aRemoveWatchButton.disposeAndClear();
+ aHeaderBar.disposeAndClear();
+ aTreeListBox.disposeAndClear();
+ if (!IsDisposed())
+ GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
+ DockingWindow::dispose();
}
@@ -1698,11 +1710,11 @@ void WatchWindow::Resize()
aBoxSz.Height() = 0;
aBoxSz.Height() -= nHeaderBarHeight;
- aTreeListBox.SetSizePixel( aBoxSz );
- aTreeListBox.GetHScroll()->SetPageSize( aTreeListBox.GetHScroll()->GetVisibleSize() );
+ aTreeListBox->SetSizePixel( aBoxSz );
+ aTreeListBox->GetHScroll()->SetPageSize( aTreeListBox->GetHScroll()->GetVisibleSize() );
aBoxSz.Height() = nHeaderBarHeight;
- aHeaderBar.SetSizePixel( aBoxSz );
+ aHeaderBar->SetSizePixel( aBoxSz );
Invalidate();
}
@@ -1766,29 +1778,29 @@ void WatchWindow::AddWatch( const OUString& rVName )
OUString aWatchStr_( aVar );
aWatchStr_ += "\t\t";
- SvTreeListEntry* pNewEntry = aTreeListBox.InsertEntry( aWatchStr_, 0, true, TREELIST_APPEND );
+ SvTreeListEntry* pNewEntry = aTreeListBox->InsertEntry( aWatchStr_, 0, true, TREELIST_APPEND );
pNewEntry->SetUserData( pWatchItem );
- aTreeListBox.Select(pNewEntry, true);
- aTreeListBox.MakeVisible(pNewEntry);
- aRemoveWatchButton.Enable();
+ aTreeListBox->Select(pNewEntry, true);
+ aTreeListBox->MakeVisible(pNewEntry);
+ aRemoveWatchButton->Enable();
UpdateWatches();
}
bool WatchWindow::RemoveSelectedWatch()
{
- SvTreeListEntry* pEntry = aTreeListBox.GetCurEntry();
+ SvTreeListEntry* pEntry = aTreeListBox->GetCurEntry();
if ( pEntry )
{
- aTreeListBox.GetModel()->Remove( pEntry );
- pEntry = aTreeListBox.GetCurEntry();
+ aTreeListBox->GetModel()->Remove( pEntry );
+ pEntry = aTreeListBox->GetCurEntry();
if ( pEntry )
- aXEdit.SetText( static_cast<WatchItem*>(pEntry->GetUserData())->maName );
+ aXEdit->SetText( static_cast<WatchItem*>(pEntry->GetUserData())->maName );
else
- aXEdit.SetText( OUString() );
- if ( !aTreeListBox.GetEntryCount() )
- aRemoveWatchButton.Disable();
+ aXEdit->SetText( OUString() );
+ if ( !aTreeListBox->GetEntryCount() )
+ aRemoveWatchButton->Disable();
return true;
}
else
@@ -1798,7 +1810,7 @@ bool WatchWindow::RemoveSelectedWatch()
IMPL_LINK_INLINE_START( WatchWindow, ButtonHdl, ImageButton *, pButton )
{
- if (pButton == &aRemoveWatchButton)
+ if (pButton == aRemoveWatchButton.get())
if (SfxDispatcher* pDispatcher = GetDispatcher())
pDispatcher->Execute(SID_BASICIDE_REMOVEWATCH);
return 0;
@@ -1809,9 +1821,9 @@ IMPL_LINK_INLINE_END( WatchWindow, ButtonHdl, ImageButton *, pButton )
IMPL_LINK_NOARG_INLINE_START(WatchWindow, TreeListHdl)
{
- SvTreeListEntry* pCurEntry = aTreeListBox.GetCurEntry();
+ SvTreeListEntry* pCurEntry = aTreeListBox->GetCurEntry();
if ( pCurEntry && pCurEntry->GetUserData() )
- aXEdit.SetText( static_cast<WatchItem*>(pCurEntry->GetUserData())->maName );
+ aXEdit->SetText( static_cast<WatchItem*>(pCurEntry->GetUserData())->maName );
return 0;
}
@@ -1824,29 +1836,29 @@ IMPL_LINK_INLINE_START( WatchWindow, implEndDragHdl, HeaderBar *, pBar )
const sal_Int32 TAB_WIDTH_MIN = 10;
sal_Int32 nMaxWidth =
- aHeaderBar.GetSizePixel().getWidth() - 2 * TAB_WIDTH_MIN;
+ aHeaderBar->GetSizePixel().getWidth() - 2 * TAB_WIDTH_MIN;
- sal_Int32 nVariableWith = aHeaderBar.GetItemSize( ITEM_ID_VARIABLE );
+ sal_Int32 nVariableWith = aHeaderBar->GetItemSize( ITEM_ID_VARIABLE );
if( nVariableWith < TAB_WIDTH_MIN )
- aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, TAB_WIDTH_MIN );
+ aHeaderBar->SetItemSize( ITEM_ID_VARIABLE, TAB_WIDTH_MIN );
else if( nVariableWith > nMaxWidth )
- aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, nMaxWidth );
+ aHeaderBar->SetItemSize( ITEM_ID_VARIABLE, nMaxWidth );
- sal_Int32 nValueWith = aHeaderBar.GetItemSize( ITEM_ID_VALUE );
+ sal_Int32 nValueWith = aHeaderBar->GetItemSize( ITEM_ID_VALUE );
if( nValueWith < TAB_WIDTH_MIN )
- aHeaderBar.SetItemSize( ITEM_ID_VALUE, TAB_WIDTH_MIN );
+ aHeaderBar->SetItemSize( ITEM_ID_VALUE, TAB_WIDTH_MIN );
else if( nValueWith > nMaxWidth )
- aHeaderBar.SetItemSize( ITEM_ID_VALUE, nMaxWidth );
+ aHeaderBar->SetItemSize( ITEM_ID_VALUE, nMaxWidth );
- if (aHeaderBar.GetItemSize( ITEM_ID_TYPE ) < TAB_WIDTH_MIN)
- aHeaderBar.SetItemSize( ITEM_ID_TYPE, TAB_WIDTH_MIN );
+ if (aHeaderBar->GetItemSize( ITEM_ID_TYPE ) < TAB_WIDTH_MIN)
+ aHeaderBar->SetItemSize( ITEM_ID_TYPE, TAB_WIDTH_MIN );
sal_Int32 nPos = 0;
- sal_uInt16 nTabs = aHeaderBar.GetItemCount();
+ sal_uInt16 nTabs = aHeaderBar->GetItemCount();
for( sal_uInt16 i = 1 ; i < nTabs ; ++i )
{
- nPos += aHeaderBar.GetItemSize( i );
- aTreeListBox.SetTab( i, nPos, MAP_PIXEL );
+ nPos += aHeaderBar->GetItemSize( i );
+ aTreeListBox->SetTab( i, nPos, MAP_PIXEL );
}
return 0;
}
@@ -1859,17 +1871,17 @@ IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc )
{
case KEY_RETURN:
{
- OUString aCurText( aXEdit.GetText() );
+ OUString aCurText( aXEdit->GetText() );
if ( !aCurText.isEmpty() )
{
AddWatch( aCurText );
- aXEdit.SetSelection( Selection( 0, 0xFFFF ) );
+ aXEdit->SetSelection( Selection( 0, 0xFFFF ) );
}
}
break;
case KEY_ESCAPE:
{
- aXEdit.SetText( OUString() );
+ aXEdit->SetText( OUString() );
}
break;
}
@@ -1879,7 +1891,7 @@ IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc )
void WatchWindow::UpdateWatches( bool bBasicStopped )
{
- aTreeListBox.UpdateWatches( bBasicStopped );
+ aTreeListBox->UpdateWatches( bBasicStopped );
}
@@ -1890,16 +1902,16 @@ void WatchWindow::UpdateWatches( bool bBasicStopped )
StackWindow::StackWindow (Layout* pParent) :
DockingWindow(pParent),
- aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ),
+ aTreeListBox( VclPtr<SvTreeListBox>::Create(this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP) ),
aStackStr( IDEResId( RID_STR_STACK ) )
{
- aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
- aTreeListBox.SetAccessibleName(IDEResId(RID_STR_STACKNAME).toString());
- aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) );
- aTreeListBox.SetHighlightRange();
- aTreeListBox.SetSelectionMode( NO_SELECTION );
- aTreeListBox.InsertEntry( OUString(), 0, false, TREELIST_APPEND );
- aTreeListBox.Show();
+ aTreeListBox->SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
+ aTreeListBox->SetAccessibleName(IDEResId(RID_STR_STACKNAME).toString());
+ aTreeListBox->SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) );
+ aTreeListBox->SetHighlightRange();
+ aTreeListBox->SetSelectionMode( NO_SELECTION );
+ aTreeListBox->InsertEntry( OUString(), 0, false, TREELIST_APPEND );
+ aTreeListBox->Show();
SetText(IDEResId(RID_STR_STACKNAME).toString());
@@ -1913,7 +1925,15 @@ StackWindow::StackWindow (Layout* pParent) :
StackWindow::~StackWindow()
{
- GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
+ disposeOnce();
+}
+
+void StackWindow::dispose()
+{
+ if (!IsDisposed())
+ GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
+ aTreeListBox.disposeAndClear();
+ DockingWindow::dispose();
}
@@ -1936,20 +1956,20 @@ void StackWindow::Resize()
if ( aBoxSz.Height() < 4 )
aBoxSz.Height() = 0;
- aTreeListBox.SetSizePixel( aBoxSz );
+ aTreeListBox->SetSizePixel( aBoxSz );
Invalidate();
}
void StackWindow::UpdateCalls()
{
- aTreeListBox.SetUpdateMode(false);
- aTreeListBox.Clear();
+ aTreeListBox->SetUpdateMode(false);
+ aTreeListBox->Clear();
if ( StarBASIC::IsRunning() )
{
SbxError eOld = SbxBase::GetError();
- aTreeListBox.SetSelectionMode( SINGLE_SELECTION );
+ aTreeListBox->SetSelectionMode( SINGLE_SELECTION );
sal_Int32 nScope = 0;
SbMethod* pMethod = StarBASIC::GetActiveMethod( nScope );
@@ -1998,7 +2018,7 @@ void StackWindow::UpdateCalls()
}
aEntry += ")";
}
- aTreeListBox.InsertEntry( aEntry, 0, false, TREELIST_APPEND );
+ aTreeListBox->InsertEntry( aEntry, 0, false, TREELIST_APPEND );
nScope++;
pMethod = StarBASIC::GetActiveMethod( nScope );
}
@@ -2009,11 +2029,11 @@ void StackWindow::UpdateCalls()
}
else
{
- aTreeListBox.SetSelectionMode( NO_SELECTION );
- aTreeListBox.InsertEntry( OUString(), 0, false, TREELIST_APPEND );
+ aTreeListBox->SetSelectionMode( NO_SELECTION );
+ aTreeListBox->InsertEntry( OUString(), 0, false, TREELIST_APPEND );
}
- aTreeListBox.SetUpdateMode(true);
+ aTreeListBox->SetUpdateMode(true);
}
@@ -2024,18 +2044,33 @@ void StackWindow::UpdateCalls()
ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ),
- aBrkWindow(this, pParent),
- aLineNumberWindow(this, pParent),
- aEdtWindow(this, pParent),
- aEWVScrollBar( this, WB_VSCROLL | WB_DRAG )
+ aBrkWindow(VclPtr<BreakPointWindow>::Create(this, pParent)),
+ aLineNumberWindow(VclPtr<LineNumberWindow>::Create(this, pParent)),
+ aEdtWindow(VclPtr<EditorWindow>::Create(this, pParent)),
+ aEWVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_DRAG) )
+{
+ aEdtWindow->Show();
+ aBrkWindow->Show();
+
+ aEWVScrollBar->SetLineSize(nScrollLine);
+ aEWVScrollBar->SetPageSize(nScrollPage);
+ aEWVScrollBar->SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) );
+ aEWVScrollBar->Show();
+}
+
+
+ComplexEditorWindow::~ComplexEditorWindow()
{
- aEdtWindow.Show();
- aBrkWindow.Show();
+ disposeOnce();
+}
- aEWVScrollBar.SetLineSize(nScrollLine);
- aEWVScrollBar.SetPageSize(nScrollPage);
- aEWVScrollBar.SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) );
- aEWVScrollBar.Show();
+void ComplexEditorWindow::dispose()
+{
+ aBrkWindow.disposeAndClear();
+ aLineNumberWindow.disposeAndClear();
+ aEdtWindow.disposeAndClear();
+ aEWVScrollBar.disposeAndClear();
+ vcl::Window::dispose();
}
void ComplexEditorWindow::Resize()
@@ -2045,40 +2080,40 @@ void ComplexEditorWindow::Resize()
aSz.Width() -= 2*DWBORDER;
aSz.Height() -= 2*DWBORDER;
long nBrkWidth = 20;
- long nSBWidth = aEWVScrollBar.GetSizePixel().Width();
+ long nSBWidth = aEWVScrollBar->GetSizePixel().Width();
Size aBrkSz(nBrkWidth, aSz.Height());
- Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height());
+ Size aLnSz(aLineNumberWindow->GetWidth(), aSz.Height());
- if (aLineNumberWindow.IsVisible())
+ if (aLineNumberWindow->IsVisible())
{
- aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
- aLineNumberWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aLnSz);
- Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height());
- aEdtWindow.SetPosSizePixel( Point( DWBORDER + aBrkSz.Width() + aLnSz.Width() - 1, DWBORDER ), aEWSz );
+ aBrkWindow->SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
+ aLineNumberWindow->SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aLnSz);
+ Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow->GetWidth() - nSBWidth + 2, aSz.Height());
+ aEdtWindow->SetPosSizePixel( Point( DWBORDER + aBrkSz.Width() + aLnSz.Width() - 1, DWBORDER ), aEWSz );
}
else
{
- aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
+ aBrkWindow->SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
Size aEWSz(aSz.Width() - nBrkWidth - nSBWidth + 2, aSz.Height());
- aEdtWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz);
+ aEdtWindow->SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz);
}
- aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
+ aEWVScrollBar->SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
}
IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
{
- if ( aEdtWindow.GetEditView() )
+ if ( aEdtWindow->GetEditView() )
{
- DBG_ASSERT( pCurScrollBar == &aEWVScrollBar, "Wer scrollt hier ?" );
- long nDiff = aEdtWindow.GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
- aEdtWindow.GetEditView()->Scroll( 0, nDiff );
- aBrkWindow.DoScroll( 0, nDiff );
- aLineNumberWindow.DoScroll(0, nDiff);
- aEdtWindow.GetEditView()->ShowCursor(false, true);
- pCurScrollBar->SetThumbPos( aEdtWindow.GetEditView()->GetStartDocPos().Y() );
+ DBG_ASSERT( pCurScrollBar == aEWVScrollBar.get(), "Wer scrollt hier ?" );
+ long nDiff = aEdtWindow->GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
+ aEdtWindow->GetEditView()->Scroll( 0, nDiff );
+ aBrkWindow->DoScroll( 0, nDiff );
+ aLineNumberWindow->DoScroll(0, nDiff);
+ aEdtWindow->GetEditView()->ShowCursor(false, true);
+ pCurScrollBar->SetThumbPos( aEdtWindow->GetEditView()->GetStartDocPos().Y() );
}
return 0;
@@ -2102,7 +2137,7 @@ void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt)
void ComplexEditorWindow::SetLineNumberDisplay(bool b)
{
- aLineNumberWindow.Show(b);
+ aLineNumberWindow->Show(b);
Resize();
}
@@ -2135,13 +2170,20 @@ WatchTreeListBox::WatchTreeListBox( vcl::Window* pParent, WinBits nWinBits )
WatchTreeListBox::~WatchTreeListBox()
{
+ disposeOnce();
+}
+
+void WatchTreeListBox::dispose()
+{
// Destroy user data
SvTreeListEntry* pEntry = First();
while ( pEntry )
{
delete static_cast<WatchItem*>(pEntry->GetUserData());
+ pEntry->SetUserData(NULL);
pEntry = Next( pEntry );
}
+ SvHeaderTabListBox::dispose();
}
void WatchTreeListBox::SetTabs()
@@ -2642,6 +2684,17 @@ pCodeCompleteWindow( pPar )
SetSelectHdl(LINK(this, CodeCompleteListBox, ImplSelectHdl));
}
+CodeCompleteListBox::~CodeCompleteListBox()
+{
+ disposeOnce();
+}
+
+void CodeCompleteListBox::dispose()
+{
+ pCodeCompleteWindow.clear();
+ ListBox::dispose();
+}
+
IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl)
{
InsertSelectedEntry();
@@ -2807,12 +2860,24 @@ void CodeCompleteListBox::HideAndRestoreFocus()
CodeCompleteWindow::CodeCompleteWindow( EditorWindow* pPar )
: Window( pPar ),
pParent( pPar ),
-pListBox( new CodeCompleteListBox(this) )
+pListBox( VclPtr<CodeCompleteListBox>::Create(this) )
{
SetSizePixel( Size(151,151) ); //default, later it changes
InitListBox();
}
+CodeCompleteWindow::~CodeCompleteWindow()
+{
+ disposeOnce();
+}
+
+void CodeCompleteWindow::dispose()
+{
+ pListBox.disposeAndClear();
+ pParent.clear();
+ vcl::Window::dispose();
+}
+
void CodeCompleteWindow::InitListBox()
{
pListBox->SetSizePixel( Size(150,150) ); //default, this will adopt the line length
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index af89dfb3292d..fa99f7cd2855 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -100,9 +100,6 @@ DialogWindow::DialogWindow (
SetReadOnly(true);
}
-DialogWindow::~DialogWindow()
-{ }
-
void DialogWindow::LoseFocus()
{
if ( IsModified() )
@@ -1027,8 +1024,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
OUString aQueryBoxText(IDE_RESSTR(RID_STR_DLGIMP_CLASH_TEXT));
aQueryBoxText = aQueryBoxText.replaceAll("$(ARG1)", aXmlDlgName);
- NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
- sal_uInt16 nRet = aQueryBox.Execute();
+ ScopedVclPtrInstance< NameClashQueryBox > aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
+ sal_uInt16 nRet = aQueryBox->Execute();
if( RET_YES == nRet )
{
// RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox
@@ -1089,8 +1086,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
{
OUString aQueryBoxTitle(IDE_RESSTR(RID_STR_DLGIMP_MISMATCH_TITLE));
OUString aQueryBoxText(IDE_RESSTR(RID_STR_DLGIMP_MISMATCH_TEXT));
- LanguageMismatchQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
- sal_uInt16 nRet = aQueryBox.Execute();
+ ScopedVclPtrInstance< LanguageMismatchQueryBox > aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
+ sal_uInt16 nRet = aQueryBox->Execute();
if( RET_YES == nRet )
{
// RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
@@ -1411,11 +1408,16 @@ DialogWindowLayout::DialogWindowLayout (vcl::Window* pParent, ObjectCatalog& rOb
DialogWindowLayout::~DialogWindowLayout()
{
- if (pPropertyBrowser != 0)
- {
+ disposeOnce();
+}
+
+void DialogWindowLayout::dispose()
+{
+ if (pPropertyBrowser)
Remove(pPropertyBrowser);
- delete pPropertyBrowser;
- }
+ pPropertyBrowser.disposeAndClear();
+ pChild.clear();
+ Layout::dispose();
}
// shows the property browser (and creates if necessary)
@@ -1425,7 +1427,7 @@ void DialogWindowLayout::ShowPropertyBrowser ()
if (!pPropertyBrowser)
{
// creating
- pPropertyBrowser = new PropBrw(*this);
+ pPropertyBrowser = VclPtr<PropBrw>::Create(*this);
pPropertyBrowser->Show();
// after OnFirstSize():
if (HasSize())
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 1a620ce03a41..b713ffe1e878 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -126,7 +126,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
break;
if (it != aWindowTable.end())
++it;
- BaseWindow* pWin = it != aWindowTable.end() ? it->second : 0;
+ BaseWindow* pWin = it != aWindowTable.end() ? it->second.get() : 0;
bool bSearchedFromStart = false;
while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) )
@@ -136,8 +136,8 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
SfxViewFrame* pViewFrame = GetViewFrame();
SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL;
vcl::Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL;
- QueryBox aQuery(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART));
- if ( aQuery.Execute() == RET_YES )
+ ScopedVclPtrInstance< QueryBox > aQuery(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART));
+ if ( aQuery->Execute() == RET_YES )
{
it = aWindowTable.begin();
if ( it != aWindowTable.end() )
@@ -166,7 +166,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
{
if ( it != aWindowTable.end() )
++it;
- pWin = it != aWindowTable.end() ? it->second : 0;
+ pWin = it != aWindowTable.end() ? it->second.get() : 0;
}
else
pWin = 0;
@@ -202,7 +202,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
case SID_BASICSTOP:
{
// maybe do not simply stop if on breakpoint!
- if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
+ if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get()))
pMCurWin->BasicStop();
StopBasic();
}
@@ -330,7 +330,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
case SID_BASICIDE_OBJCAT:
// toggling object catalog
- aObjectCatalog.Show(!aObjectCatalog.IsVisible());
+ aObjectCatalog->Show(!aObjectCatalog->IsVisible());
if (pLayout)
pLayout->ArrangeWindows();
// refresh the button state
@@ -676,8 +676,8 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
case SID_BASICIDE_MANAGE_LANG:
{
- ManageLanguageDialog aDlg(pCurWin, m_pCurLocalizationMgr);
- aDlg.Execute();
+ ScopedVclPtrInstance< ManageLanguageDialog > aDlg(pCurWin, m_pCurLocalizationMgr);
+ aDlg->Execute();
rReq.Done();
}
break;
@@ -750,7 +750,7 @@ void Shell::GetState(SfxItemSet &rSet)
break;
case SID_BASICIDE_OBJCAT:
if (pLayout)
- rSet.Put(SfxBoolItem(nWh, aObjectCatalog.IsVisible()));
+ rSet.Put(SfxBoolItem(nWh, aObjectCatalog->IsVisible()));
else
rSet.Put(SfxVisibilityItem(nWh, false));
break;
@@ -769,7 +769,7 @@ void Shell::GetState(SfxItemSet &rSet)
case SID_BASICSAVEAS:
case SID_BASICIDE_MATCHGROUP:
{
- if (!dynamic_cast<ModulWindow*>(pCurWin))
+ if (!dynamic_cast<ModulWindow*>(pCurWin.get()))
rSet.DisableItem( nWh );
else if ( ( nWh == SID_BASICLOAD ) && ( StarBASIC::IsRunning() || ( pCurWin && pCurWin->IsReadOnly() ) ) )
rSet.DisableItem( nWh );
@@ -782,7 +782,7 @@ void Shell::GetState(SfxItemSet &rSet)
case SID_BASICIDE_TOGGLEBRKPNT:
case SID_BASICIDE_MANAGEBRKPNTS:
{
- if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
+ if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get()))
{
if (StarBASIC::IsRunning() && !pMCurWin->GetBasicStatus().bIsInReschedule)
rSet.DisableItem(nWh);
@@ -793,7 +793,7 @@ void Shell::GetState(SfxItemSet &rSet)
break;
case SID_BASICCOMPILE:
{
- if (StarBASIC::IsRunning() || !dynamic_cast<ModulWindow*>(pCurWin))
+ if (StarBASIC::IsRunning() || !dynamic_cast<ModulWindow*>(pCurWin.get()))
rSet.DisableItem( nWh );
}
break;
@@ -814,7 +814,7 @@ void Shell::GetState(SfxItemSet &rSet)
case SID_INSERT_FORM_HSCROLL:
case SID_INSERT_FORM_SPIN:
{
- if (!dynamic_cast<DialogWindow*>(pCurWin))
+ if (!dynamic_cast<DialogWindow*>(pCurWin.get()))
rSet.DisableItem( nWh );
}
break;
@@ -945,7 +945,7 @@ void Shell::GetState(SfxItemSet &rSet)
// if this is not a module window hide the
// setting, doesn't make sense for example if the
// dialog editor is open
- if (pCurWin && !dynamic_cast<ModulWindow*>(pCurWin))
+ if (pCurWin && !dynamic_cast<ModulWindow*>(pCurWin.get()))
{
rSet.DisableItem( nWh );
rSet.Put(SfxVisibilityItem(nWh, false));
@@ -968,7 +968,7 @@ bool Shell::HasUIFeature( sal_uInt32 nFeature )
if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER )
{
// fade out (in) property browser in module (dialog) windows
- if (dynamic_cast<DialogWindow*>(pCurWin) && !pCurWin->IsReadOnly())
+ if (dynamic_cast<DialogWindow*>(pCurWin.get()) && !pCurWin->IsReadOnly())
bResult = true;
}
@@ -1032,10 +1032,10 @@ void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRemembe
GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
SfxObjectShell::SetCurrentComponent(0);
}
- aObjectCatalog.SetCurrentEntry(pCurWin);
+ aObjectCatalog->SetCurrentEntry(pCurWin);
SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 );
InvalidateBasicIDESlots();
- EnableScrollbars(pCurWin != 0);
+ EnableScrollbars(pCurWin != nullptr);
if ( m_pCurLocalizationMgr )
m_pCurLocalizationMgr->handleTranslationbar();
@@ -1067,7 +1067,7 @@ void Shell::ManageToolbars()
if ( xLayoutManager.is() )
{
xLayoutManager->lock();
- if (dynamic_cast<DialogWindow*>(pCurWin))
+ if (dynamic_cast<DialogWindow*>(pCurWin.get()))
{
xLayoutManager->destroyElement( aMacroBarResName );
@@ -1188,13 +1188,13 @@ void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
return;
Size aSz( rSize );
- Size aScrollBarBoxSz( aScrollBarBox.GetSizePixel() );
+ Size aScrollBarBoxSz( aScrollBarBox->GetSizePixel() );
aSz.Height() -= aScrollBarBoxSz.Height();
Size aOutSz( aSz );
aSz.Width() -= aScrollBarBoxSz.Width();
- aScrollBarBox.SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) );
- aVScrollBar.SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) );
+ aScrollBarBox->SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) );
+ aVScrollBar->SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) );
if ( bTabBarSplitted )
{
// SplitSize is 0 at a resize!
@@ -1203,17 +1203,17 @@ void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
nSplitPos = aSz.Width();
pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( nSplitPos, aScrollBarBoxSz.Height() ) );
long nScrlStart = rPos.X() + nSplitPos;
- aHScrollBar.SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) );
- aHScrollBar.Update();
+ aHScrollBar->SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) );
+ aHScrollBar->Update();
}
else
{
- aHScrollBar.SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) );
+ aHScrollBar->SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) );
pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) );
}
if (pLayout)
- pLayout->SetPosSizePixel(rPos, dynamic_cast<DialogWindow*>(pCurWin) ? aSz : aOutSz);
+ pLayout->SetPosSizePixel(rPos, dynamic_cast<DialogWindow*>(pCurWin.get()) ? aSz : aOutSz);
}
Reference< XModel > Shell::GetCurrentDocument() const
@@ -1230,7 +1230,7 @@ void Shell::Activate( bool bMDI )
if ( bMDI )
{
- if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin))
+ if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin.get()))
pDCurWin->UpdateBrowser();
}
}
@@ -1241,7 +1241,7 @@ void Shell::Deactivate( bool bMDI )
// deactivate due to a MessageBox bMDI is false
if ( bMDI )
{
- if (DialogWindow* pXDlgWin = dynamic_cast<DialogWindow*>(pCurWin))
+ if (DialogWindow* pXDlgWin = dynamic_cast<DialogWindow*>(pCurWin.get()))
{
pXDlgWin->DisableBrowser();
if( pXDlgWin->IsModified() )
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index 1801060e581e..e05869a64831 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -44,7 +44,7 @@ Reference< view::XRenderable > Shell::GetRenderable()
bool Shell::HasSelection( bool /* bText */ ) const
{
- if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
+ if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get()))
{
TextView* pEditView = pMCurWin->GetEditView();
if ( pEditView && pEditView->HasSelection() )
@@ -56,7 +56,7 @@ bool Shell::HasSelection( bool /* bText */ ) const
OUString Shell::GetSelectionText( bool bWholeWord )
{
OUString aText;
- if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
+ if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get()))
{
if (TextView* pEditView = pMCurWin->GetEditView())
{
@@ -166,8 +166,8 @@ ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUStrin
{
// new module window
if (!pModulLayout)
- pModulLayout.reset(new ModulWindowLayout(&GetViewFrame()->GetWindow(), aObjectCatalog));
- pWin = new ModulWindow(pModulLayout.get(), rDocument, aLibName, aModName, aModule);
+ pModulLayout.reset(VclPtr<ModulWindowLayout>::Create(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
+ pWin = VclPtr<ModulWindow>::Create(pModulLayout.get(), rDocument, aLibName, aModName, aModule);
nKey = InsertWindowInTable( pWin );
}
else // we've gotten called recursively ( via listener from createModule above ), get outta here
@@ -195,7 +195,7 @@ ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUStrin
pTabBar->Sort();
if(pWin)
{
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
+ pWin->GrabScrollBars( aHScrollBar.get(), aVScrollBar.get() );
if ( !pCurWin )
SetCurWindow( pWin, false, false );
}
@@ -220,14 +220,14 @@ void Shell::Move()
void Shell::ShowCursor( bool bOn )
{
- if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
+ if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get()))
pMCurWin->ShowCursor(bOn);
}
// only if basic window above:
void Shell::ExecuteBasic( SfxRequest& rReq )
{
- if (dynamic_cast<ModulWindow*>(pCurWin))
+ if (dynamic_cast<ModulWindow*>(pCurWin.get()))
{
pCurWin->ExecuteCommand( rReq );
if (nShellCount)
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index ff53a779c932..8479fd8a39a2 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -77,8 +77,8 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri
// new dialog window
if (!pDialogLayout)
- pDialogLayout.reset(new DialogWindowLayout(&GetViewFrame()->GetWindow(), aObjectCatalog));
- pWin = new DialogWindow(pDialogLayout.get(), rDocument, aLibName, aDlgName, xDialogModel);
+ pDialogLayout.reset(VclPtr<DialogWindowLayout>::Create(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
+ pWin = VclPtr<DialogWindow>::Create(pDialogLayout.get(), rDocument, aLibName, aDlgName, xDialogModel);
nKey = InsertWindowInTable( pWin );
}
}
@@ -96,7 +96,7 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri
if( pWin )
{
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
+ pWin->GrabScrollBars( aHScrollBar.get(), aVScrollBar.get() );
pTabBar->InsertPage( (sal_uInt16)nKey, aDlgName );
pTabBar->Sort();
if ( !pCurWin )
@@ -128,7 +128,7 @@ sal_uInt16 Shell::GetWindowId(const BaseWindow* pWin) const
SdrView* Shell::GetCurDlgView() const
{
- if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin))
+ if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin.get()))
return &pDCurWin->GetView();
else
return 0;
@@ -137,7 +137,7 @@ SdrView* Shell::GetCurDlgView() const
// only if dialogue window above:
void Shell::ExecuteDialog( SfxRequest& rReq )
{
- if (pCurWin && (dynamic_cast<DialogWindow*>(pCurWin) || rReq.GetSlot() == SID_IMPORT_DIALOG))
+ if (pCurWin && (dynamic_cast<DialogWindow*>(pCurWin.get()) || rReq.GetSlot() == SID_IMPORT_DIALOG))
pCurWin->ExecuteCommand(rReq);
}
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index dce1ea4b680a..214c5b6967db 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -148,11 +148,11 @@ unsigned Shell::nShellCount = 0;
Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) :
SfxViewShell( pFrame_, SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::NO_NEWWINDOW ),
m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
- aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ),
- aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ),
- aScrollBarBox( &GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE ) ),
+ aHScrollBar( VclPtr<ScrollBar>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG )) ),
+ aVScrollBar( VclPtr<ScrollBar>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG )) ),
+ aScrollBarBox( VclPtr<ScrollBarBox>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE )) ),
pLayout(0),
- aObjectCatalog(&GetViewFrame()->GetWindow()),
+ aObjectCatalog(VclPtr<ObjectCatalog>::Create(&GetViewFrame()->GetWindow())),
m_bAppBasicModified( false ),
m_aNotifier( *this )
{
@@ -188,7 +188,7 @@ void Shell::Init()
m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
bCreatingWindow = false;
- pTabBar.reset(new TabBar(&GetViewFrame()->GetWindow()));
+ pTabBar.reset(VclPtr<TabBar>::Create(&GetViewFrame()->GetWindow()));
pTabBar->SetSplitHdl( LINK( this, Shell, TabBarSplitHdl ) );
bTabBarSplitted = false;
@@ -225,12 +225,15 @@ Shell::~Shell()
SetWindow( 0 );
SetCurWindow( 0 );
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (WindowTable::iterator it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
{
// no store; does already happen when the BasicManagers are destroyed
- delete it->second;
+ it->second.disposeAndClear();
}
+ // no store; does already happen when the BasicManagers are destroyed
+ aWindowTable.clear();
+
// Destroy all ContainerListeners for Basic Container.
if (ContainerListenerImpl* pListener = static_cast<ContainerListenerImpl*>(m_xLibListener.get()))
pListener->removeContainerListener(m_aCurDocument, m_aCurLibName);
@@ -290,7 +293,7 @@ void Shell::onDocumentClosed( const ScriptDocument& _rDocument )
bool bSetCurWindow = false;
bool bSetCurLib = ( _rDocument == m_aCurDocument );
- std::vector<BaseWindow*> aDeleteVec;
+ std::vector<VclPtr<BaseWindow> > aDeleteVec;
// remove all windows which belong to this document
for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
@@ -311,7 +314,7 @@ void Shell::onDocumentClosed( const ScriptDocument& _rDocument )
}
}
// delete windows outside main loop so we don't invalidate the original iterator
- for (std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it)
+ for (auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it)
{
BaseWindow* pWin = *it;
pWin->StoreData();
@@ -409,15 +412,15 @@ bool Shell::PrepareClose( bool bUI )
void Shell::InitScrollBars()
{
- aVScrollBar.SetLineSize( 300 );
- aVScrollBar.SetPageSize( 2000 );
- aHScrollBar.SetLineSize( 300 );
- aHScrollBar.SetPageSize( 2000 );
- aHScrollBar.Enable();
- aVScrollBar.Enable();
- aVScrollBar.Show();
- aHScrollBar.Show();
- aScrollBarBox.Show();
+ aVScrollBar->SetLineSize( 300 );
+ aVScrollBar->SetPageSize( 2000 );
+ aHScrollBar->SetLineSize( 300 );
+ aHScrollBar->SetPageSize( 2000 );
+ aHScrollBar->Enable();
+ aVScrollBar->Enable();
+ aVScrollBar->Show();
+ aHScrollBar->Show();
+ aScrollBarBox->Show();
}
@@ -485,16 +488,16 @@ bool Shell::NextPage( bool bPrev )
void Shell::ArrangeTabBar()
{
- long nBoxPos = aScrollBarBox.GetPosPixel().X() - 1;
+ long nBoxPos = aScrollBarBox->GetPosPixel().X() - 1;
long nPos = pTabBar->GetSplitSize();
if ( nPos <= nBoxPos )
{
Point aPnt( pTabBar->GetPosPixel() );
- long nH = aHScrollBar.GetSizePixel().Height();
+ long nH = aHScrollBar->GetSizePixel().Height();
pTabBar->SetPosSizePixel( aPnt, Size( nPos, nH ) );
long nScrlStart = aPnt.X() + nPos;
- aHScrollBar.SetPosSizePixel( Point( nScrlStart, aPnt.Y() ), Size( nBoxPos - nScrlStart + 2, nH ) );
- aHScrollBar.Update();
+ aHScrollBar->SetPosSizePixel( Point( nScrlStart, aPnt.Y() ), Size( nBoxPos - nScrlStart + 2, nH ) );
+ aHScrollBar->Update();
}
}
@@ -523,7 +526,7 @@ void Shell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
case SFX_HINT_DYING:
{
EndListening( rBC, true /* log off all */ );
- aObjectCatalog.UpdateEntries();
+ aObjectCatalog->UpdateEntries();
}
break;
}
@@ -592,14 +595,14 @@ void Shell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
void Shell::CheckWindows()
{
bool bSetCurWindow = false;
- std::vector<BaseWindow*> aDeleteVec;
+ std::vector<VclPtr<BaseWindow> > aDeleteVec;
for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
{
BaseWindow* pWin = it->second;
if ( pWin->GetStatus() & BASWIN_TOBEKILLED )
aDeleteVec.push_back( pWin );
}
- for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+ for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
{
BaseWindow* pWin = *it;
pWin->StoreData();
@@ -615,15 +618,15 @@ void Shell::CheckWindows()
void Shell::RemoveWindows( const ScriptDocument& rDocument, const OUString& rLibName, bool bDestroy )
{
- bool bChangeCurWindow = pCurWin == nullptr;
- std::vector<BaseWindow*> aDeleteVec;
+ bool bChangeCurWindow = pCurWin;
+ std::vector<VclPtr<BaseWindow> > aDeleteVec;
for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
{
BaseWindow* pWin = it->second;
if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName )
aDeleteVec.push_back( pWin );
}
- for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+ for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
{
BaseWindow* pWin = *it;
if ( pWin == pCurWin )
@@ -643,7 +646,7 @@ void Shell::UpdateWindows()
bool bChangeCurWindow = pCurWin == nullptr;
if ( !m_aCurLibName.isEmpty() )
{
- std::vector<BaseWindow*> aDeleteVec;
+ std::vector<VclPtr<BaseWindow> > aDeleteVec;
for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
{
BaseWindow* pWin = it->second;
@@ -659,7 +662,7 @@ void Shell::UpdateWindows()
aDeleteVec.push_back( pWin );
}
}
- for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+ for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
{
RemoveWindow( *it, false, false );
}
@@ -806,7 +809,7 @@ void Shell::RemoveWindow( BaseWindow* pWindow_, bool bDestroy, bool bAllowChange
{
if ( !( pWindow_->GetStatus() & BASWIN_INRESCHEDULE ) )
{
- delete pWindow_;
+ pWindow_->disposeOnce();
}
else
{
@@ -901,8 +904,8 @@ void Shell::InvalidateBasicIDESlots()
void Shell::EnableScrollbars( bool bEnable )
{
- aHScrollBar.Enable(bEnable);
- aVScrollBar.Enable(bEnable);
+ aHScrollBar->Enable(bEnable);
+ aVScrollBar->Enable(bEnable);
}
void Shell::SetCurLib( const ScriptDocument& rDocument, const OUString& aLibName, bool bUpdateWindows, bool bCheck )
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 2e41965b81c9..43d1be3d6b1f 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -149,16 +149,16 @@ bool RenameModule (
if ( rDocument.hasModule( rLibName, rNewName ) )
{
- MessageDialog aError(pErrorParent, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2));
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(pErrorParent, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2));
+ aError->Execute();
return false;
}
// #i74440
if ( rNewName.isEmpty() )
{
- MessageDialog aError(pErrorParent, IDE_RESSTR(RID_STR_BADSBXNAME));
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(pErrorParent, IDE_RESSTR(RID_STR_BADSBXNAME));
+ aError->Execute();
return false;
}
@@ -242,7 +242,7 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
OUString aScriptURL;
SbMethod* pMethod = NULL;
- boost::scoped_ptr< MacroChooser > pChooser( new MacroChooser( NULL, true ) );
+ ScopedVclPtrInstance< MacroChooser > pChooser( nullptr, true );
if ( bChooseOnly || !SvtModuleOptions::IsBasicIDE() )
pChooser->SetMode(MacroChooser::ChooseOnly);
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index df25cbbfcb6e..dd700b1bb4ce 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -155,16 +155,16 @@ bool RenameDialog (
if ( rDocument.hasDialog( rLibName, rNewName ) )
{
- MessageDialog aError(pErrorParent, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2));
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(pErrorParent, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2));
+ aError->Execute();
return false;
}
// #i74440
if ( rNewName.isEmpty() )
{
- MessageDialog aError(pErrorParent, IDE_RESSTR(RID_STR_BADSBXNAME));
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(pErrorParent, IDE_RESSTR(RID_STR_BADSBXNAME));
+ aError->Execute();
return false;
}
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 5d105dbe1082..79ebd6d8dacd 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -206,15 +206,22 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTreeListBox(vcl::Windo
TreeListBox::~TreeListBox ()
{
+ disposeOnce();
+}
+
+void TreeListBox::dispose()
+{
m_aNotifier.dispose();
// destroy user data
SvTreeListEntry* pEntry = First();
while ( pEntry )
{
- delete static_cast<Entry*>(pEntry->GetUserData());
+ delete static_cast<Entry*>( pEntry->GetUserData() );
+ pEntry->SetUserData( NULL );
pEntry = Next( pEntry );
}
+ SvTreeListBox::dispose();
}
void TreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation )
diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx
index f08f298b6dc8..bf270e28413a 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -208,6 +208,7 @@ public:
TreeListBox(vcl::Window* pParent, const ResId& rRes);
TreeListBox(vcl::Window* pParent, WinBits nStyle);
virtual ~TreeListBox();
+ virtual void dispose() SAL_OVERRIDE;
void ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
void ScanAllEntries();
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 854621f0adda..6efa5cb29a19 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -56,10 +56,18 @@ BaseWindow::BaseWindow( vcl::Window* pParent, const ScriptDocument& rDocument, c
BaseWindow::~BaseWindow()
{
+ disposeOnce();
+}
+
+void BaseWindow::dispose()
+{
if ( pShellVScrollBar )
pShellVScrollBar->SetScrollHdl( Link() );
if ( pShellHScrollBar )
pShellHScrollBar->SetScrollHdl( Link() );
+ pShellVScrollBar.clear();
+ pShellHScrollBar.clear();
+ vcl::Window::dispose();
}
@@ -274,6 +282,17 @@ DockingWindow::DockingWindow (Layout* pParent) :
nShowCount(0)
{ }
+DockingWindow::~DockingWindow()
+{
+ disposeOnce();
+}
+
+void DockingWindow::dispose()
+{
+ pLayout.clear();
+ ::DockingWindow::dispose();
+}
+
// Sets the position and the size of the docking window. This property is saved
// when the window is floating. Called by Layout.
void DockingWindow::ResizeIfDocking (Point const& rPos, Size const& rSize)
@@ -521,7 +540,7 @@ void TabBar::Command( const CommandEvent& rCEvt )
{
Shell::WindowTable& aWindowTable = pShell->GetWindowTable();
Shell::WindowTableIt it = aWindowTable.find( GetCurPageId() );
- if (it != aWindowTable.end() && dynamic_cast<ModulWindow*>(it->second))
+ if (it != aWindowTable.end() && dynamic_cast<ModulWindow*>(it->second.get()))
{
SbModule* pActiveModule = pBasic->FindModule( it->second->GetName() );
if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) )
@@ -785,8 +804,8 @@ bool QueryDel( const OUString& rName, const ResId& rId, vcl::Window* pParent )
aNameBuf.append('\'');
aNameBuf.insert(0, '\'');
aQuery = aQuery.replaceAll("XX", aNameBuf.makeStringAndClear());
- MessageDialog aQueryBox(pParent, aQuery, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- return ( aQueryBox.Execute() == RET_YES );
+ ScopedVclPtrInstance< MessageDialog > aQueryBox(pParent, aQuery, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ return ( aQueryBox->Execute() == RET_YES );
}
bool QueryDelMacro( const OUString& rName, vcl::Window* pParent )
@@ -822,19 +841,19 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
do
{
// password dialog
- SfxPasswordDialog aDlg(Application::GetDefDialogParent());
- aDlg.SetMinLen( 1 );
+ ScopedVclPtrInstance< SfxPasswordDialog > aDlg(Application::GetDefDialogParent());
+ aDlg->SetMinLen( 1 );
// set new title
if ( bNewTitle )
{
OUString aTitle(IDE_RESSTR(RID_STR_ENTERPASSWORD));
aTitle = aTitle.replaceAll("XX", rLibName);
- aDlg.SetText( aTitle );
+ aDlg->SetText( aTitle );
}
// execute dialog
- nRet = aDlg.Execute();
+ nRet = aDlg->Execute();
// verify password
if ( nRet == RET_OK )
@@ -844,14 +863,14 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
Reference< script::XLibraryContainerPassword > xPasswd( xLibContainer, UNO_QUERY );
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( rLibName ) && !xPasswd->isLibraryPasswordVerified( rLibName ) )
{
- rPassword = aDlg.GetPassword();
+ rPassword = aDlg->GetPassword();
// OUString aOUPassword( rPassword );
bOK = xPasswd->verifyLibraryPassword( rLibName, rPassword );
if ( !bOK )
{
- MessageDialog aErrorBox(Application::GetDefDialogParent(), IDE_RESSTR(RID_STR_WRONGPASSWORD));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(Application::GetDefDialogParent(), IDE_RESSTR(RID_STR_WRONGPASSWORD));
+ aErrorBox->Execute();
}
}
}
diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index b5b2ef17d9dc..fa8399a00512 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -106,6 +106,22 @@ BreakPointDialog::BreakPointDialog( vcl::Window* pParent, BreakPointList& rBrkPn
CheckButtons();
}
+BreakPointDialog::~BreakPointDialog()
+{
+ disposeOnce();
+}
+
+void BreakPointDialog::dispose()
+{
+ m_pComboBox.clear();
+ m_pOKButton.clear();
+ m_pNewButton.clear();
+ m_pDelButton.clear();
+ m_pNumericField.clear();
+ m_pCheckBox.clear();
+ ModalDialog::dispose();
+}
+
void BreakPointDialog::SetCurrentBreakPoint( BreakPoint* pBrk )
{
OUString aStr( "# " + OUString::number(pBrk->nLine) );
diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx
index 703744efd345..50d18543d846 100644
--- a/basctl/source/basicide/brkdlg.hxx
+++ b/basctl/source/basicide/brkdlg.hxx
@@ -31,12 +31,12 @@ namespace basctl
class BreakPointDialog : public ModalDialog
{
private:
- ComboBox* m_pComboBox;
- OKButton* m_pOKButton;
- PushButton* m_pNewButton;
- PushButton* m_pDelButton;
- ::CheckBox* m_pCheckBox;
- NumericField* m_pNumericField;
+ VclPtr<ComboBox> m_pComboBox;
+ VclPtr<OKButton> m_pOKButton;
+ VclPtr<PushButton> m_pNewButton;
+ VclPtr<PushButton> m_pDelButton;
+ VclPtr<CheckBox> m_pCheckBox;
+ VclPtr<NumericField> m_pNumericField;
BreakPointList & m_rOriginalBreakPointList;
BreakPointList m_aModifiedBreakPointList;
@@ -53,6 +53,8 @@ protected:
public:
BreakPointDialog( vcl::Window* pParent, BreakPointList& rBrkList );
+ virtual ~BreakPointDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetCurrentBreakPoint( BreakPoint* pBrk );
};
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index 961a7bde65e4..2bca3ce4349b 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -53,9 +53,16 @@ Layout::Layout (vcl::Window* pParent) :
SetFont(aFont);
}
-// virtual dtor
Layout::~Layout()
-{ }
+{
+ disposeOnce();
+}
+
+void Layout::dispose()
+{
+ pChild.clear();
+ Window::dispose();
+}
// removes a docking window
void Layout::Remove (DockingWindow* pWin)
@@ -166,9 +173,9 @@ Layout::SplittedSide::SplittedSide (Layout* pParent, Side eSide) :
bVertical(eSide == Left || eSide == Right),
bLower(eSide == Left || eSide == Top),
nSize(0),
- aSplitter(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL)
+ aSplitter(VclPtr<Splitter>::Create(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL))
{
- InitSplitter(aSplitter);
+ InitSplitter(*aSplitter.get());
}
@@ -188,7 +195,7 @@ void Layout::SplittedSide::Add (DockingWindow* pWin, Size const& rSize)
// splitter
if (!vItems.empty())
{
- aItem.pSplit = boost::make_shared<Splitter>(&rLayout, bVertical ? WB_VSCROLL : WB_HSCROLL);
+ aItem.pSplit = VclPtr<Splitter>::Create(&rLayout, bVertical ? WB_VSCROLL : WB_HSCROLL);
aItem.pSplit->SetSplitPosPixel(aItem.nStartPos - nSplitThickness);
InitSplitter(*aItem.pSplit);
}
@@ -267,19 +274,19 @@ void Layout::SplittedSide::ArrangeIn (Rectangle const& rRect)
// shown if any of the windows is docked
if (!bEmpty)
{
- aSplitter.Show();
+ aSplitter->Show();
// split position
- aSplitter.SetSplitPosPixel((bLower ? nSize : nPos1) - nSplitThickness);
+ aSplitter->SetSplitPosPixel((bLower ? nSize : nPos1) - nSplitThickness);
// the actual position and size
- aSplitter.SetPosSizePixel(
- MakePoint(nPos2, aSplitter.GetSplitPosPixel()),
+ aSplitter->SetPosSizePixel(
+ MakePoint(nPos2, aSplitter->GetSplitPosPixel()),
MakeSize(nLength, nSplitThickness)
);
// dragging rectangle
- aSplitter.SetDragRectPixel(aRect);
+ aSplitter->SetDragRectPixel(aRect);
}
else
- aSplitter.Hide();
+ aSplitter->Hide();
// positioning separator lines and windows
bool bPrevDocking = false; // is the previous window docked?
@@ -350,7 +357,7 @@ IMPL_LINK(Layout::SplittedSide, SplitHdl, Splitter*, pSplitter)
// checking margins
CheckMarginsFor(pSplitter);
// changing stored sizes
- if (pSplitter == &aSplitter)
+ if (pSplitter == aSplitter.get())
{
// nSize
if (bLower)
diff --git a/basctl/source/basicide/layout.hxx b/basctl/source/basicide/layout.hxx
index fac9bdc86b69..e25cb11461ea 100644
--- a/basctl/source/basicide/layout.hxx
+++ b/basctl/source/basicide/layout.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_BASCTL_SOURCE_BASICIDE_LAYOUT_HXX
#include <vcl/split.hxx>
+#include <vcl/vclptr.hxx>
class DockingWindow;
@@ -49,9 +50,11 @@ public:
virtual void GetState (SfxItemSet&, unsigned nWhich) = 0;
virtual void UpdateDebug (bool bBasicStopped ) = 0;
+ virtual ~Layout();
+ virtual void dispose() SAL_OVERRIDE;
+
protected:
Layout (vcl::Window* pParent);
- virtual ~Layout ();
void AddToLeft (DockingWindow* pWin, Size const& rSize) { aLeftSide.Add(pWin, rSize); }
void AddToBottom (DockingWindow* pWin, Size const& rSize) { aBottomSide.Add(pWin, rSize); }
@@ -67,7 +70,7 @@ protected:
private:
// the main child window (either ModulWindow or DialogWindow)
- BaseWindow* pChild;
+ VclPtr<BaseWindow> pChild;
// when this window has at first (nonempty) size
bool bFirstSize;
@@ -96,12 +99,12 @@ private:
// size (width or height)
long nSize;
// the main splitting line
- Splitter aSplitter;
+ VclPtr<Splitter> aSplitter;
// the dockable windows (and some data)
struct Item
{
// pointer to the dockable window
- DockingWindow* pWin;
+ VclPtr<DockingWindow> pWin;
// starting and ending position in the strip
// They may be different from the actual window position, because
// the window may fill the space of the adjacent currently
@@ -110,7 +113,7 @@ private:
long nStartPos, nEndPos;
// splitter line window before the window
// (the first one is always nullptr)
- boost::shared_ptr<Splitter> pSplit;
+ VclPtr<Splitter> pSplit;
};
std::vector<Item> vItems;
private:
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index 2ba7043207da..a2f01eea8795 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -26,7 +26,15 @@ LineNumberWindow::LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin
}
LineNumberWindow::~LineNumberWindow()
-{ }
+{
+ disposeOnce();
+}
+
+void LineNumberWindow::dispose()
+{
+ m_pModulWindow.clear();
+ Window::dispose();
+}
void LineNumberWindow::Paint( const Rectangle& )
{
diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx
index caa7f15350c0..65498937eda8 100644
--- a/basctl/source/basicide/linenumberwindow.hxx
+++ b/basctl/source/basicide/linenumberwindow.hxx
@@ -19,7 +19,7 @@ class ModulWindow;
class LineNumberWindow : public vcl::Window
{
private:
- ModulWindow* m_pModulWindow;
+ VclPtr<ModulWindow> m_pModulWindow;
int m_nWidth;
long m_nCurYOffset;
int m_nBaseWidth;
@@ -31,6 +31,7 @@ protected:
public:
LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin);
virtual ~LineNumberWindow();
+ virtual void dispose() SAL_OVERRIDE;
void DoScroll( long nHorzScroll, long nVertScroll );
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index be4c92593604..2960bfa34929 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -112,8 +112,31 @@ MacroChooser::MacroChooser( vcl::Window* pParnt, bool bCreateEntries )
MacroChooser::~MacroChooser()
{
+ disposeOnce();
+}
+
+void MacroChooser::dispose()
+{
if ( bForceStoreBasic )
+ {
SfxGetpApp()->SaveBasicAndDialogContainer();
+ bForceStoreBasic = false;
+ }
+ m_pMacroNameEdit.clear();
+ m_pMacroFromTxT.clear();
+ m_pMacrosSaveInTxt.clear();
+ m_pBasicBox.clear();
+ m_pMacrosInTxt.clear();
+ m_pMacroBox.clear();
+ m_pRunButton.clear();
+ m_pCloseButton.clear();
+ m_pAssignButton.clear();
+ m_pEditButton.clear();
+ m_pDelButton.clear();
+ m_pOrganizeButton.clear();
+ m_pNewLibButton.clear();
+ m_pNewModButton.clear();
+ SfxModalDialog::dispose();
}
void MacroChooser::StoreMacroDescription()
@@ -754,7 +777,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
StoreMacroDescription();
EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(m_pBasicBox->FirstSelected());
- boost::scoped_ptr<OrganizeDialog> pDlg(new OrganizeDialog( this, 0, aDesc ));
+ VclPtrInstance< OrganizeDialog > pDlg( this, 0, aDesc );
sal_uInt16 nRet = pDlg->Execute();
pDlg.reset();
diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx
index 5cd80eb12540..c9c36cee13a6 100644
--- a/basctl/source/basicide/macrodlg.hxx
+++ b/basctl/source/basicide/macrodlg.hxx
@@ -45,22 +45,22 @@ public:
};
private:
- Edit* m_pMacroNameEdit;
- FixedText* m_pMacroFromTxT;
- FixedText* m_pMacrosSaveInTxt;
- TreeListBox* m_pBasicBox;
- FixedText* m_pMacrosInTxt;
+ VclPtr<Edit> m_pMacroNameEdit;
+ VclPtr<FixedText> m_pMacroFromTxT;
+ VclPtr<FixedText> m_pMacrosSaveInTxt;
+ VclPtr<TreeListBox> m_pBasicBox;
+ VclPtr<FixedText> m_pMacrosInTxt;
OUString m_aMacrosInTxtBaseStr;
- SvTreeListBox* m_pMacroBox;
+ VclPtr<SvTreeListBox> m_pMacroBox;
- PushButton* m_pRunButton;
- CloseButton* m_pCloseButton;
- PushButton* m_pAssignButton;
- PushButton* m_pEditButton;
- PushButton* m_pDelButton;
- PushButton* m_pOrganizeButton;
- PushButton* m_pNewLibButton;
- PushButton* m_pNewModButton;
+ VclPtr<PushButton> m_pRunButton;
+ VclPtr<CloseButton> m_pCloseButton;
+ VclPtr<PushButton> m_pAssignButton;
+ VclPtr<PushButton> m_pEditButton;
+ VclPtr<PushButton> m_pDelButton;
+ VclPtr<PushButton> m_pOrganizeButton;
+ VclPtr<PushButton> m_pNewLibButton;
+ VclPtr<PushButton> m_pNewModButton;
bool bNewDelIsDel;
bool bForceStoreBasic;
@@ -87,6 +87,7 @@ private:
public:
MacroChooser( vcl::Window* pParent, bool bCreateEntries = true );
virtual ~MacroChooser();
+ virtual void dispose() SAL_OVERRIDE;
SbMethod* GetMacro();
void DeleteMacro();
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 8793ca43aa89..7ac4766d3e14 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -161,15 +161,23 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeCheckBox(vcl::Window *
CheckBox::~CheckBox()
{
+ disposeOnce();
+}
+
+void CheckBox::dispose()
+{
delete pCheckButton;
+ pCheckButton = NULL;
// delete user data
SvTreeListEntry* pEntry = First();
while ( pEntry )
{
- delete static_cast<LibUserData*>(pEntry->GetUserData());
+ delete static_cast<LibUserData*>( pEntry->GetUserData() );
+ pEntry->SetUserData( NULL );
pEntry = Next( pEntry );
}
+ SvTabListBox::dispose();
}
void CheckBox::Init()
@@ -384,6 +392,18 @@ NewObjectDialog::NewObjectDialog(vcl::Window * pParent, ObjectMode::Mode eMode,
m_pOKButton->SetClickHdl(LINK(this, NewObjectDialog, OkButtonHandler));
}
+NewObjectDialog::~NewObjectDialog()
+{
+ disposeOnce();
+}
+
+void NewObjectDialog::dispose()
+{
+ m_pEdit.clear();
+ m_pOKButton.clear();
+ ModalDialog::dispose();
+}
+
// GotoLineDialog
GotoLineDialog::GotoLineDialog(vcl::Window * pParent )
: ModalDialog(pParent, "GotoLineDialog",
@@ -395,6 +415,18 @@ GotoLineDialog::GotoLineDialog(vcl::Window * pParent )
m_pOKButton->SetClickHdl(LINK(this, GotoLineDialog, OkButtonHandler));
}
+GotoLineDialog::~GotoLineDialog()
+{
+ disposeOnce();
+}
+
+void GotoLineDialog::dispose()
+{
+ m_pEdit.clear();
+ m_pOKButton.clear();
+ ModalDialog::dispose();
+}
+
sal_Int32 GotoLineDialog::GetLineNumber() const
{
return m_pEdit->GetText().toInt32();
@@ -429,6 +461,18 @@ ExportDialog::ExportDialog(vcl::Window * pParent)
m_pOKButton->SetClickHdl(LINK(this, ExportDialog, OkButtonHandler));
}
+ExportDialog::~ExportDialog()
+{
+ disposeOnce();
+}
+
+void ExportDialog::dispose()
+{
+ m_pExportAsPackageButton.clear();
+ m_pOKButton.clear();
+ ModalDialog::dispose();
+}
+
// LibPage
LibPage::LibPage(vcl::Window * pParent)
: TabPage(pParent, "LibPage",
@@ -476,12 +520,30 @@ LibPage::LibPage(vcl::Window * pParent)
LibPage::~LibPage()
{
- sal_uInt16 nCount = m_pBasicsBox->GetEntryCount();
- for ( sal_uInt16 i = 0; i < nCount; ++i )
+ disposeOnce();
+}
+
+void LibPage::dispose()
+{
+ if (m_pBasicsBox)
{
- DocumentEntry* pEntry = static_cast<DocumentEntry*>(m_pBasicsBox->GetEntryData( i ));
- delete pEntry;
+ sal_uInt16 nCount = m_pBasicsBox->GetEntryCount();
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ {
+ DocumentEntry* pEntry = static_cast<DocumentEntry*>(m_pBasicsBox->GetEntryData( i ));
+ delete pEntry;
+ }
}
+ m_pBasicsBox.clear();
+ m_pLibBox.clear();
+ m_pEditButton.clear();
+ m_pPasswordButton.clear();
+ m_pNewLibButton.clear();
+ m_pInsertLibButton.clear();
+ m_pExportButton.clear();
+ m_pDelButton.clear();
+ pTabDlg.clear();
+ TabPage::dispose();
}
void LibPage::CheckButtons()
@@ -626,7 +688,7 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton )
bool const bProtected = xPasswd->isLibraryPasswordProtected( aLibName );
// change password dialog
- boost::scoped_ptr<SvxPasswordDialog> pDlg(new SvxPasswordDialog( this, true, !bProtected ));
+ VclPtrInstance< SvxPasswordDialog > pDlg( this, true, !bProtected );
pDlg->SetCheckPasswordHdl( LINK( this, LibPage, CheckPasswordHdl ) );
if ( pDlg->Execute() == RET_OK )
@@ -764,7 +826,7 @@ void LibPage::InsertLib()
if ( xModLibContImport.is() || xDlgLibContImport.is() )
{
- boost::scoped_ptr<LibDialog> pLibDlg;
+ VclPtr<LibDialog> pLibDlg;
Reference< script::XLibraryContainer > xModLibContImp( xModLibContImport, UNO_QUERY );
Reference< script::XLibraryContainer > xDlgLibContImp( xDlgLibContImport, UNO_QUERY );
@@ -776,7 +838,7 @@ void LibPage::InsertLib()
// library import dialog
if ( !pLibDlg )
{
- pLibDlg.reset(new LibDialog( this ));
+ pLibDlg.reset(VclPtr<LibDialog>::Create( this ));
pLibDlg->SetStorageName( aURLObj.getName() );
pLibDlg->GetLibBox().SetMode(ObjectMode::Library);
}
@@ -1066,12 +1128,12 @@ void LibPage::Export()
return;
}
- ExportDialog aNewDlg(this);
- if (aNewDlg.Execute() == RET_OK)
+ ScopedVclPtrInstance< ExportDialog > aNewDlg(this);
+ if (aNewDlg->Execute() == RET_OK)
{
try
{
- if (aNewDlg.isExportAsPackage())
+ if (aNewDlg->isExportAsPackage())
ExportAsPackage( aLibName );
else
ExportAsBasic( aLibName );
@@ -1442,13 +1504,13 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
i++;
}
- NewObjectDialog aNewDlg(pWin, ObjectMode::Library);
- aNewDlg.SetObjectName(aLibName);
+ ScopedVclPtrInstance< NewObjectDialog > aNewDlg(pWin, ObjectMode::Library);
+ aNewDlg->SetObjectName(aLibName);
- if (aNewDlg.Execute())
+ if (aNewDlg->Execute())
{
- if (!aNewDlg.GetObjectName().isEmpty())
- aLibName = aNewDlg.GetObjectName();
+ if (!aNewDlg->GetObjectName().isEmpty())
+ aLibName = aNewDlg->GetObjectName();
if ( aLibName.getLength() > 30 )
{
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index ff181b230ec1..8abed4ee8893 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -62,9 +62,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeExtTreeListBox(vcl::Wi
return new ExtTreeListBox(pParent, nWinBits);
}
-ExtTreeListBox::~ExtTreeListBox ()
-{ }
-
bool ExtTreeListBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
{
bool bRet = false;
@@ -489,8 +486,19 @@ OrganizeDialog::OrganizeDialog(vcl::Window* pParent, sal_Int16 tabId,
OrganizeDialog::~OrganizeDialog()
{
- for ( sal_uInt16 i = 0; i < m_pTabCtrl->GetPageCount(); i++ )
- delete m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) );
+ disposeOnce();
+}
+
+void OrganizeDialog::dispose()
+{
+ if (m_pTabCtrl)
+ {
+ for ( sal_uInt16 i = 0; i < m_pTabCtrl->GetPageCount(); i++ )
+ VclPtr<vcl::Window>(m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) )).disposeAndClear();
+ }
+ m_pTabCtrl.clear();
+
+ TabDialog::dispose();
};
short OrganizeDialog::Execute()
@@ -510,25 +518,25 @@ IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl )
if ( !pTabCtrl->GetTabPage( nId ) )
{
OString sPageName(pTabCtrl->GetPageName(nId));
- TabPage* pNewTabPage = 0;
+ VclPtr<TabPage> pNewTabPage;
if (sPageName == "modules")
{
- ObjectPage* pObjectPage = new ObjectPage(pTabCtrl, "ModulePage", BROWSEMODE_MODULES);
- pNewTabPage = pObjectPage;
+ VclPtrInstance<ObjectPage> pObjectPage(pTabCtrl, "ModulePage", BROWSEMODE_MODULES);
+ pNewTabPage.reset(pObjectPage);
pObjectPage->SetTabDlg(this);
pObjectPage->SetCurrentEntry(m_aCurEntry);
}
else if (sPageName == "dialogs")
{
- ObjectPage* pObjectPage = new ObjectPage( pTabCtrl, "DialogPage", BROWSEMODE_DIALOGS );
- pNewTabPage = pObjectPage;
+ VclPtrInstance<ObjectPage> pObjectPage( pTabCtrl, "DialogPage", BROWSEMODE_DIALOGS );
+ pNewTabPage.reset(pObjectPage);
pObjectPage->SetTabDlg(this);
pObjectPage->SetCurrentEntry(m_aCurEntry);
}
else if (sPageName == "libraries")
{
- LibPage* pLibPage = new LibPage( pTabCtrl );
- pNewTabPage = pLibPage;
+ VclPtrInstance<LibPage> pLibPage( pTabCtrl );
+ pNewTabPage.reset(pLibPage);
pLibPage->SetTabDlg( this );
}
else
@@ -590,6 +598,22 @@ ObjectPage::ObjectPage(vcl::Window *pParent, const OString &rName, sal_uInt16 nM
CheckButtons();
}
+ObjectPage::~ObjectPage()
+{
+ disposeOnce();
+}
+
+void ObjectPage::dispose()
+{
+ m_pBasicBox.clear();
+ m_pEditButton.clear();
+ m_pNewModButton.clear();
+ m_pNewDlgButton.clear();
+ m_pDelButton.clear();
+ pTabDlg.clear();
+ TabPage::dispose();
+}
+
void ObjectPage::SetCurrentEntry (EntryDescriptor& rDesc)
{
m_pBasicBox->SetCurrentEntry( rDesc );
@@ -801,12 +825,12 @@ void ObjectPage::NewDialog()
{
aDocument.getOrCreateLibrary( E_DIALOGS, aLibName );
- NewObjectDialog aNewDlg(this, ObjectMode::Dialog, true);
- aNewDlg.SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) );
+ ScopedVclPtrInstance< NewObjectDialog > aNewDlg(this, ObjectMode::Dialog, true);
+ aNewDlg->SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) );
- if (aNewDlg.Execute() != 0)
+ if (aNewDlg->Execute() != 0)
{
- OUString aDlgName = aNewDlg.GetObjectName();
+ OUString aDlgName = aNewDlg->GetObjectName();
if (aDlgName.isEmpty())
aDlgName = aDocument.createObjectName( E_DIALOGS, aLibName);
@@ -919,6 +943,21 @@ LibDialog::LibDialog( vcl::Window* pParent )
m_pLibBox->set_width_request(m_pLibBox->approximate_char_width() * 32);
}
+LibDialog::~LibDialog()
+{
+ disposeOnce();
+}
+
+void LibDialog::dispose()
+{
+ m_pStorageFrame.clear();
+ m_pLibBox.clear();
+ m_pReferenceBox.clear();
+ m_pReplaceBox.clear();
+ ModalDialog::dispose();
+}
+
+
void LibDialog::SetStorageName( const OUString& rName )
{
OUString aName( IDE_RESSTR(RID_STR_FILENAME) );
@@ -944,13 +983,13 @@ SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
if ( aModName.isEmpty() )
aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
- NewObjectDialog aNewDlg(pWin, ObjectMode::Module, true);
- aNewDlg.SetObjectName( aModName );
+ ScopedVclPtrInstance< NewObjectDialog > aNewDlg(pWin, ObjectMode::Module, true);
+ aNewDlg->SetObjectName( aModName );
- if (aNewDlg.Execute() != 0)
+ if (aNewDlg->Execute() != 0)
{
- if (!aNewDlg.GetObjectName().isEmpty() )
- aModName = aNewDlg.GetObjectName();
+ if (!aNewDlg->GetObjectName().isEmpty() )
+ aModName = aNewDlg->GetObjectName();
try
{
diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx
index a1c3f79e8e45..12907c0c2342 100644
--- a/basctl/source/basicide/moduldlg.hxx
+++ b/basctl/source/basicide/moduldlg.hxx
@@ -48,12 +48,14 @@ namespace ObjectMode
class NewObjectDialog : public ModalDialog
{
private:
- Edit* m_pEdit;
- OKButton* m_pOKButton;
+ VclPtr<Edit> m_pEdit;
+ VclPtr<OKButton> m_pOKButton;
DECL_LINK(OkButtonHandler, void *);
public:
NewObjectDialog (vcl::Window* pParent, ObjectMode::Mode, bool bCheckName = false);
+ virtual ~NewObjectDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetObjectName() const { return m_pEdit->GetText(); }
void SetObjectName( const OUString& rName )
{
@@ -64,19 +66,21 @@ public:
class GotoLineDialog : public ModalDialog
{
- Edit* m_pEdit;
- OKButton* m_pOKButton;
+ VclPtr<Edit> m_pEdit;
+ VclPtr<OKButton> m_pOKButton;
DECL_LINK(OkButtonHandler, void *);
public:
GotoLineDialog(vcl::Window * pParent);
+ virtual ~GotoLineDialog();
+ virtual void dispose() SAL_OVERRIDE;
sal_Int32 GetLineNumber() const;
};
class ExportDialog : public ModalDialog
{
private:
- RadioButton* m_pExportAsPackageButton;
- OKButton* m_pOKButton;
+ VclPtr<RadioButton> m_pExportAsPackageButton;
+ VclPtr<OKButton> m_pOKButton;
bool mbExportAsPackage;
@@ -84,6 +88,8 @@ private:
public:
ExportDialog( vcl::Window * pParent );
+ virtual ~ExportDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool isExportAsPackage () const { return mbExportAsPackage; }
};
@@ -107,7 +113,6 @@ protected:
public:
ExtTreeListBox(vcl::Window* pParent, WinBits nStyle);
- virtual ~ExtTreeListBox();
};
class CheckBox : public SvTabListBox
@@ -121,6 +126,7 @@ private:
public:
CheckBox(vcl::Window* pParent, WinBits nStyle);
virtual ~CheckBox();
+ virtual void dispose() SAL_OVERRIDE;
SvTreeListEntry* DoInsertEntry( const OUString& rStr, sal_uLong nPos = LISTBOX_APPEND );
SvTreeListEntry* FindEntry( const OUString& rName );
@@ -141,13 +147,15 @@ public:
class LibDialog: public ModalDialog
{
private:
- VclFrame* m_pStorageFrame;
- CheckBox* m_pLibBox;
- ::CheckBox* m_pReferenceBox;
- ::CheckBox* m_pReplaceBox;
+ VclPtr<VclFrame> m_pStorageFrame;
+ VclPtr<CheckBox> m_pLibBox;
+ VclPtr<::CheckBox> m_pReferenceBox;
+ VclPtr<::CheckBox> m_pReplaceBox;
public:
LibDialog( vcl::Window* pParent );
+ virtual ~LibDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetStorageName( const OUString& rName );
@@ -162,12 +170,13 @@ public:
class OrganizeDialog : public TabDialog
{
private:
- TabControl* m_pTabCtrl;
+ VclPtr<TabControl> m_pTabCtrl;
EntryDescriptor m_aCurEntry;
public:
OrganizeDialog( vcl::Window* pParent, sal_Int16 tabId, EntryDescriptor& rDesc );
virtual ~OrganizeDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
@@ -177,11 +186,11 @@ public:
class ObjectPage: public TabPage
{
protected:
- ExtTreeListBox* m_pBasicBox;
- PushButton* m_pEditButton;
- PushButton* m_pNewModButton;
- PushButton* m_pNewDlgButton;
- PushButton* m_pDelButton;
+ VclPtr<ExtTreeListBox> m_pBasicBox;
+ VclPtr<PushButton> m_pEditButton;
+ VclPtr<PushButton> m_pNewModButton;
+ VclPtr<PushButton> m_pNewDlgButton;
+ VclPtr<PushButton> m_pDelButton;
DECL_LINK( BasicBoxHighlightHdl, TreeListBox * );
DECL_LINK( ButtonHdl, Button * );
@@ -192,13 +201,15 @@ protected:
void NewDialog();
void EndTabDialog( sal_uInt16 nRet );
- TabDialog* pTabDlg;
+ VclPtr<TabDialog> pTabDlg;
virtual void ActivatePage() SAL_OVERRIDE;
virtual void DeactivatePage() SAL_OVERRIDE;
public:
ObjectPage(vcl::Window* pParent, const OString& rName, sal_uInt16 nMode);
+ virtual ~ObjectPage();
+ virtual void dispose() SAL_OVERRIDE;
void SetCurrentEntry( EntryDescriptor& rDesc );
void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
@@ -208,14 +219,14 @@ public:
class LibPage: public TabPage
{
protected:
- ListBox* m_pBasicsBox;
- CheckBox* m_pLibBox;
- PushButton* m_pEditButton;
- PushButton* m_pPasswordButton;
- PushButton* m_pNewLibButton;
- PushButton* m_pInsertLibButton;
- PushButton* m_pExportButton;
- PushButton* m_pDelButton;
+ VclPtr<ListBox> m_pBasicsBox;
+ VclPtr<CheckBox> m_pLibBox;
+ VclPtr<PushButton> m_pEditButton;
+ VclPtr<PushButton> m_pPasswordButton;
+ VclPtr<PushButton> m_pNewLibButton;
+ VclPtr<PushButton> m_pInsertLibButton;
+ VclPtr<PushButton> m_pExportButton;
+ VclPtr<PushButton> m_pDelButton;
ScriptDocument m_aCurDocument;
LibraryLocation m_eCurLocation;
@@ -241,11 +252,12 @@ protected:
virtual void ActivatePage() SAL_OVERRIDE;
virtual void DeactivatePage() SAL_OVERRIDE;
- TabDialog* pTabDlg;
+ VclPtr<TabDialog> pTabDlg;
public:
LibPage( vcl::Window* pParent );
virtual ~LibPage();
+ virtual void dispose() SAL_OVERRIDE;
void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
};
diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx
index 7bc31392b8c9..d8b9538aff3d 100644
--- a/basctl/source/basicide/objdlg.cxx
+++ b/basctl/source/basicide/objdlg.cxx
@@ -30,27 +30,27 @@ namespace basctl
ObjectCatalog::ObjectCatalog (vcl::Window* pParent) :
DockingWindow(pParent),
- aTitle(this),
- aTree(this, IDEResId(RID_TLB_MACROS))
+ aTitle(VclPtr<FixedText>::Create(this)),
+ aTree(VclPtr<TreeListBox>::Create(this, IDEResId(RID_TLB_MACROS)))
{
SetHelpId("basctl:FloatingWindow:RID_BASICIDE_OBJCAT");
SetText(IDEResId(RID_BASICIDE_OBJCAT).toString());
// title
- aTitle.SetText(IDEResId(RID_BASICIDE_OBJCAT).toString());
- aTitle.SetStyle(WB_CENTER);
+ aTitle->SetText(IDEResId(RID_BASICIDE_OBJCAT).toString());
+ aTitle->SetStyle(WB_CENTER);
// tree list
- aTree.Hide();
- aTree.SetStyle(
+ aTree->Hide();
+ aTree->SetStyle(
WB_BORDER | WB_TABSTOP | WB_HSCROLL |
WB_HASLINES | WB_HASLINESATROOT |
WB_HASBUTTONS | WB_HASBUTTONSATROOT
);
- aTree.SetAccessibleName(IDEResId(RID_STR_TLB_MACROS).toString());
- aTree.SetHelpId(HID_BASICIDE_OBJECTCAT);
- aTree.ScanAllEntries();
- aTree.GrabFocus();
+ aTree->SetAccessibleName(IDEResId(RID_STR_TLB_MACROS).toString());
+ aTree->SetHelpId(HID_BASICIDE_OBJECTCAT);
+ aTree->ScanAllEntries();
+ aTree->GrabFocus();
{
// centered after AppWin:
@@ -67,9 +67,18 @@ ObjectCatalog::ObjectCatalog (vcl::Window* pParent) :
GetParent()->GetSystemWindow()->GetTaskPaneList()->AddWindow(this);
}
-ObjectCatalog::~ObjectCatalog ()
+ObjectCatalog::~ObjectCatalog()
{
- GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this);
+ disposeOnce();
+}
+
+void ObjectCatalog::dispose()
+{
+ if (!IsDisposed())
+ GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this);
+ aTitle.disposeAndClear();
+ aTree.disposeAndClear();
+ DockingWindow::dispose();
}
// Resize() -- called by Window
@@ -97,14 +106,14 @@ void ObjectCatalog::ArrangeWindows ()
// title
// (showing only if no title bar)
if (bFloating)
- aTitle.Hide();
+ aTitle->Hide();
else
{
Size aTitleSize = LogicToPixel(Size(3, 10), MAP_APPFONT);
aTitleSize.Width() = aSize.Width() - 2*aTitleSize.Width();
- aTitle.SetPosPixel(LogicToPixel(Point(3, 3), MAP_APPFONT));
- aTitle.SetSizePixel(aTitleSize);
- aTitle.Show();
+ aTitle->SetPosPixel(LogicToPixel(Point(3, 3), MAP_APPFONT));
+ aTitle->SetSizePixel(aTitleSize);
+ aTitle->Show();
}
// tree
@@ -116,11 +125,11 @@ void ObjectCatalog::ArrangeWindows ()
);
if (aTreeSize.Height() > 0)
{
- aTree.SetPosSizePixel(aTreePos, aTreeSize);
- aTree.Show();
+ aTree->SetPosSizePixel(aTreePos, aTreeSize);
+ aTree->Show();
}
else
- aTree.Hide();
+ aTree->Hide();
}
void ObjectCatalog::SetCurrentEntry (BaseWindow* pCurWin)
@@ -128,7 +137,7 @@ void ObjectCatalog::SetCurrentEntry (BaseWindow* pCurWin)
EntryDescriptor aDescriptor;
if (pCurWin)
aDescriptor = pCurWin->CreateEntryDescriptor();
- aTree.SetCurrentEntry(aDescriptor);
+ aTree->SetCurrentEntry(aDescriptor);
}
diff --git a/basctl/source/basicide/objdlg.hxx b/basctl/source/basicide/objdlg.hxx
index aca869793836..1ce7389044c4 100644
--- a/basctl/source/basicide/objdlg.hxx
+++ b/basctl/source/basicide/objdlg.hxx
@@ -37,15 +37,16 @@ class ObjectCatalog : public DockingWindow
public:
ObjectCatalog (vcl::Window* pParent);
virtual ~ObjectCatalog ();
+ virtual void dispose() SAL_OVERRIDE;
public:
- void UpdateEntries () { aTree.UpdateEntries(); }
+ void UpdateEntries () { aTree->UpdateEntries(); }
void SetCurrentEntry (BaseWindow* pCurWin);
private:
// title: "Object Catalog"
- FixedText aTitle;
+ VclPtr<FixedText> aTitle;
// the tree-list of the objects
- TreeListBox aTree;
+ VclPtr<TreeListBox> aTree;
private:
virtual void Resize () SAL_OVERRIDE; // Window
diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx
index fac2961b8455..328ea08e3f27 100644
--- a/basctl/source/basicide/tbxctl.cxx
+++ b/basctl/source/basicide/tbxctl.cxx
@@ -141,7 +141,7 @@ void TbxControls::Select( sal_uInt16 nModifier )
|* rItemRect are the screen coordinates
|*
\************************************************************************/
-SfxPopupWindow* TbxControls::CreatePopupWindow()
+VclPtr<SfxPopupWindow> TbxControls::CreatePopupWindow()
{
if ( GetSlotId() == SID_CHOOSE_CONTROLS )
createAndPositionSubToolBar( aSubToolBarResName );
diff --git a/basctl/source/basicide/tbxctl.hxx b/basctl/source/basicide/tbxctl.hxx
index 7e8a5dcc409d..d9152a07211b 100644
--- a/basctl/source/basicide/tbxctl.hxx
+++ b/basctl/source/basicide/tbxctl.hxx
@@ -46,7 +46,7 @@ public:
virtual ~TbxControls() {}
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
using SfxToolBoxControl::Select;
void Select( sal_uInt16 nModifier ) SAL_OVERRIDE;
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index fb513dc637db..eb4632366a23 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -75,7 +75,17 @@ ManageLanguageDialog::ManageLanguageDialog(vcl::Window* pParent, boost::shared_p
ManageLanguageDialog::~ManageLanguageDialog()
{
+ disposeOnce();
+}
+
+void ManageLanguageDialog::dispose()
+{
ClearLanguageBox();
+ m_pLanguageLB.clear();
+ m_pAddPB.clear();
+ m_pDeletePB.clear();
+ m_pMakeDefPB.clear();
+ ModalDialog::dispose();
}
void ManageLanguageDialog::Init()
@@ -136,11 +146,11 @@ void ManageLanguageDialog::ClearLanguageBox()
IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl)
{
- SetDefaultLanguageDialog aDlg( this, m_xLocalizationMgr );
- if ( RET_OK == aDlg.Execute() )
+ ScopedVclPtrInstance< SetDefaultLanguageDialog > aDlg( this, m_xLocalizationMgr );
+ if ( RET_OK == aDlg->Execute() )
{
// add new locales
- Sequence< Locale > aLocaleSeq = aDlg.GetLocales();
+ Sequence< Locale > aLocaleSeq = aDlg->GetLocales();
m_xLocalizationMgr->handleAddLocales( aLocaleSeq );
// update listbox
ClearLanguageBox();
@@ -154,8 +164,8 @@ IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl)
IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl)
{
- MessageDialog aQBox(this, "DeleteLangDialog", "modules/BasicIDE/ui/deletelang.ui");
- if ( aQBox.Execute() == RET_OK )
+ ScopedVclPtrInstance< MessageDialog > aQBox(this, "DeleteLangDialog", "modules/BasicIDE/ui/deletelang.ui");
+ if ( aQBox->Execute() == RET_OK )
{
sal_uInt16 i, nCount = m_pLanguageLB->GetSelectEntryCount();
sal_uInt16 nPos = m_pLanguageLB->GetSelectEntryPos();
@@ -247,6 +257,22 @@ SetDefaultLanguageDialog::SetDefaultLanguageDialog(vcl::Window* pParent, boost::
FillLanguageBox();
}
+SetDefaultLanguageDialog::~SetDefaultLanguageDialog()
+{
+ disposeOnce();
+}
+
+void SetDefaultLanguageDialog::dispose()
+{
+ m_pLanguageFT.clear();
+ m_pLanguageLB.clear();
+ m_pCheckLangFT.clear();
+ m_pCheckLangLB.clear();
+ m_pDefinedFT.clear();
+ m_pAddedFT.clear();
+ ModalDialog::dispose();
+}
+
void SetDefaultLanguageDialog::FillLanguageBox()
{
// fill list with all languages
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
index e38c26632a82..5f89f2627a40 100644
--- a/basctl/source/dlged/propbrw.cxx
+++ b/basctl/source/dlged/propbrw.cxx
@@ -190,8 +190,14 @@ void PropBrw::ImplReCreateController()
PropBrw::~PropBrw()
{
+ disposeOnce();
+}
+
+void PropBrw::dispose()
+{
if ( m_xBrowserController.is() )
ImplDestroyController();
+ DockingWindow::dispose();
}
diff --git a/basctl/source/inc/accessibledialogcontrolshape.hxx b/basctl/source/inc/accessibledialogcontrolshape.hxx
index 7192763c27dc..bc0d52b33eec 100644
--- a/basctl/source/inc/accessibledialogcontrolshape.hxx
+++ b/basctl/source/inc/accessibledialogcontrolshape.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <comphelper/accessiblecomponenthelper.hxx>
#include <cppuhelper/implbase3.hxx>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
class VCLExternalSolarLock;
@@ -56,7 +57,7 @@ class AccessibleDialogControlShape : public AccessibleExtendedComponentHelper
private:
VCLExternalSolarLock* m_pExternalLock;
- DialogWindow* m_pDialogWindow;
+ VclPtr<DialogWindow> m_pDialogWindow;
DlgEdObj* m_pDlgEdObj;
bool m_bFocused;
bool m_bSelected;
diff --git a/basctl/source/inc/accessibledialogwindow.hxx b/basctl/source/inc/accessibledialogwindow.hxx
index c57b2590ae71..bd2739440160 100644
--- a/basctl/source/inc/accessibledialogwindow.hxx
+++ b/basctl/source/inc/accessibledialogwindow.hxx
@@ -26,6 +26,7 @@
#include <cppuhelper/implbase3.hxx>
#include <svl/lstner.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
class VCLExternalSolarLock;
class VclSimpleEvent;
@@ -80,7 +81,7 @@ private:
AccessibleChildren m_aAccessibleChildren;
VCLExternalSolarLock* m_pExternalLock;
- basctl::DialogWindow* m_pDialogWindow;
+ VclPtr<basctl::DialogWindow> m_pDialogWindow;
DlgEditor* m_pDlgEditor;
DlgEdModel* m_pDlgEdModel;
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
index b73b9e571b6e..de17eb08403c 100644
--- a/basctl/source/inc/baside3.hxx
+++ b/basctl/source/inc/baside3.hxx
@@ -81,8 +81,7 @@ protected:
public:
TYPEINFO_OVERRIDE();
DialogWindow (DialogWindowLayout* pParent, ScriptDocument const& rDocument, const OUString& aLibName, const OUString& aName, com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> const& xDialogModel);
- DialogWindow( DialogWindow* pCurView ); // never implemented
- virtual ~DialogWindow();
+ DialogWindow( DialogWindow* pCurView ); // never implemented
virtual void ExecuteCommand( SfxRequest& rReq ) SAL_OVERRIDE;
virtual void GetState( SfxItemSet& ) SAL_OVERRIDE;
@@ -129,6 +128,7 @@ class DialogWindowLayout : public Layout
public:
DialogWindowLayout (vcl::Window* pParent, ObjectCatalog&);
virtual ~DialogWindowLayout();
+ virtual void dispose() SAL_OVERRIDE;
public:
void ShowPropertyBrowser ();
void UpdatePropertyBrowser ();
@@ -146,12 +146,12 @@ protected:
private:
// child window
- DialogWindow* pChild;
+ VclPtr<DialogWindow> pChild;
// dockable windows:
// object catalog (owned by Shell)
ObjectCatalog& rObjectCatalog;
// property browser (created by this, deleted by toolkit)
- PropBrw* pPropertyBrowser;
+ VclPtr<PropBrw> pPropertyBrowser;
private:
void AddPropertyBrowser ();
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index a6e8ecc43e39..3ae9b5bac73b 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -56,7 +56,7 @@ class Shell :
public DocumentEventListener
{
public:
- typedef std::map<sal_uInt16, BaseWindow*> WindowTable;
+ typedef std::map<sal_uInt16, VclPtr<BaseWindow> > WindowTable;
typedef WindowTable::const_iterator WindowTableIt;
private:
@@ -64,26 +64,26 @@ private:
friend class LocalizationMgr;
friend bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ); // defined in baside3.cxx
- WindowTable aWindowTable;
+ WindowTable aWindowTable;
sal_uInt16 nCurKey;
- BaseWindow* pCurWin;
+ VclPtr<BaseWindow> pCurWin;
ScriptDocument m_aCurDocument;
OUString m_aCurLibName;
boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr;
- ScrollBar aHScrollBar;
- ScrollBar aVScrollBar;
- ScrollBarBox aScrollBarBox;
- boost::scoped_ptr<TabBar> pTabBar; // basctl::TabBar
+ VclPtr<ScrollBar> aHScrollBar;
+ VclPtr<ScrollBar> aVScrollBar;
+ VclPtr<ScrollBarBox> aScrollBarBox;
+ VclPtr<TabBar> pTabBar; // basctl::TabBar
bool bTabBarSplitted;
bool bCreatingWindow;
// layout windows
- boost::scoped_ptr<ModulWindowLayout> pModulLayout;
- boost::scoped_ptr<DialogWindowLayout> pDialogLayout;
+ VclPtr<ModulWindowLayout> pModulLayout;
+ VclPtr<DialogWindowLayout> pDialogLayout;
// the active layout window
- Layout* pLayout;
+ VclPtr<Layout> pLayout;
// common object catalog window
- ObjectCatalog aObjectCatalog;
+ VclPtr<ObjectCatalog> aObjectCatalog;
bool m_bAppBasicModified;
DocumentEventNotifier m_aNotifier;
@@ -163,9 +163,9 @@ public:
OUString const& GetCurLibName() const { return m_aCurLibName; }
boost::shared_ptr<LocalizationMgr> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
- ScrollBar& GetHScrollBar() { return aHScrollBar; }
- ScrollBar& GetVScrollBar() { return aVScrollBar; }
- ScrollBarBox& GetScrollBarBox() { return aScrollBarBox; }
+ ScrollBar& GetHScrollBar() { return *aHScrollBar.get(); }
+ ScrollBar& GetVScrollBar() { return *aVScrollBar.get(); }
+ ScrollBarBox& GetScrollBarBox() { return *aScrollBarBox.get(); }
TabBar& GetTabBar() { return *pTabBar; }
WindowTable& GetWindowTable() { return aWindowTable; }
sal_uInt16 GetWindowId (BaseWindow const* pWin) const;
@@ -212,7 +212,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
GetCurrentDocument() const SAL_OVERRIDE;
- void UpdateObjectCatalog () { aObjectCatalog.UpdateEntries(); }
+ void UpdateObjectCatalog () { aObjectCatalog->UpdateEntries(); }
void RemoveWindow (BaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true);
};
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index c7e1e1d913a7..8b67fcc1270a 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -81,7 +81,8 @@ class DockingWindow : public ::DockingWindow
public:
DockingWindow (vcl::Window* pParent);
DockingWindow (Layout* pParent);
-public:
+ virtual ~DockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
void ResizeIfDocking (Point const&, Size const&);
void ResizeIfDocking (Size const&);
Size GetDockingSize () const { return aDockingRect.GetSize(); }
@@ -103,7 +104,7 @@ private:
// the position and the size of the docking window
Rectangle aDockingRect;
// the parent layout window (only when docking)
- Layout* pLayout;
+ VclPtr<Layout> pLayout;
// > 0: shown, <= 0: hidden, ++ by Show() and -- by Hide()
int nShowCount;
@@ -149,8 +150,8 @@ class EntryDescriptor;
class BaseWindow : public vcl::Window
{
private:
- ScrollBar* pShellHScrollBar;
- ScrollBar* pShellVScrollBar;
+ VclPtr<ScrollBar> pShellHScrollBar;
+ VclPtr<ScrollBar> pShellVScrollBar;
DECL_LINK( ScrollHdl, ScrollBar * );
int nStatus;
@@ -169,6 +170,7 @@ public:
TYPEINFO();
BaseWindow( vcl::Window* pParent, const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aName );
virtual ~BaseWindow();
+ virtual void dispose() SAL_OVERRIDE;
void Init();
virtual void DoInit();
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
index 81e9f61ef57d..af9ad3c8e41d 100644
--- a/basctl/source/inc/dlged.hxx
+++ b/basctl/source/inc/dlged.hxx
@@ -30,6 +30,7 @@
#include <tools/gen.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
+#include <vcl/vclptr.hxx>
#include <boost/scoped_ptr.hpp>
@@ -106,8 +107,8 @@ private:
static void Print( Printer* pPrinter, const OUString& rTitle );
private:
- ScrollBar* pHScroll;
- ScrollBar* pVScroll;
+ VclPtr<ScrollBar> pHScroll;
+ VclPtr<ScrollBar> pVScroll;
boost::scoped_ptr<DlgEdModel> pDlgEdModel; // never nullptr
DlgEdPage* pDlgEdPage; // never nullptr
boost::scoped_ptr<DlgEdView> pDlgEdView; // never nullptr
diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx
index 8b07b27c0f80..f7b9335e5e24 100644
--- a/basctl/source/inc/managelang.hxx
+++ b/basctl/source/inc/managelang.hxx
@@ -52,10 +52,10 @@ extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft,
class ManageLanguageDialog : public ModalDialog
{
private:
- ListBox* m_pLanguageLB;
- PushButton* m_pAddPB;
- PushButton* m_pDeletePB;
- PushButton* m_pMakeDefPB;
+ VclPtr<ListBox> m_pLanguageLB;
+ VclPtr<PushButton> m_pAddPB;
+ VclPtr<PushButton> m_pDeletePB;
+ VclPtr<PushButton> m_pMakeDefPB;
boost::shared_ptr<LocalizationMgr> m_xLocalizationMgr;
@@ -74,17 +74,18 @@ private:
public:
ManageLanguageDialog( vcl::Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr );
virtual ~ManageLanguageDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
class SetDefaultLanguageDialog : public ModalDialog
{
private:
- FixedText* m_pLanguageFT;
- SvxLanguageBox* m_pLanguageLB;
- FixedText* m_pCheckLangFT;
- SvxCheckListBox* m_pCheckLangLB;
- FixedText* m_pDefinedFT;
- FixedText* m_pAddedFT;
+ VclPtr<FixedText> m_pLanguageFT;
+ VclPtr<SvxLanguageBox> m_pLanguageLB;
+ VclPtr<FixedText> m_pCheckLangFT;
+ VclPtr<SvxCheckListBox> m_pCheckLangLB;
+ VclPtr<FixedText> m_pDefinedFT;
+ VclPtr<FixedText> m_pAddedFT;
boost::shared_ptr<LocalizationMgr> m_xLocalizationMgr;
@@ -92,6 +93,8 @@ private:
public:
SetDefaultLanguageDialog(vcl::Window* pParent, boost::shared_ptr<LocalizationMgr> xLMgr);
+ virtual ~SetDefaultLanguageDialog();
+ virtual void dispose() SAL_OVERRIDE;
::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > GetLocales() const;
};
diff --git a/basctl/source/inc/propbrw.hxx b/basctl/source/inc/propbrw.hxx
index 04ab22d5dccf..3262d36301d0 100644
--- a/basctl/source/inc/propbrw.hxx
+++ b/basctl/source/inc/propbrw.hxx
@@ -75,6 +75,7 @@ protected:
public:
explicit PropBrw (DialogWindowLayout&);
virtual ~PropBrw();
+ virtual void dispose() SAL_OVERRIDE;
using Window::Update;
// note: changing the Context document to an instance other than the one given in the ctor is not supported
// currently
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index c15127d45146..97208770c0a1 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -30,10 +30,10 @@
class SvRTLInputBox : public ModalDialog
{
- Edit aEdit;
- OKButton aOk;
- CancelButton aCancel;
- FixedText aPromptText;
+ VclPtr<Edit> aEdit;
+ VclPtr<OKButton> aOk;
+ VclPtr<CancelButton> aCancel;
+ VclPtr<FixedText> aPromptText;
OUString aText;
void PositionDialog( long nXTwips, long nYTwips, const Size& rDlgSize );
@@ -46,6 +46,8 @@ class SvRTLInputBox : public ModalDialog
public:
SvRTLInputBox( vcl::Window* pParent, const OUString& rPrompt, const OUString& rTitle,
const OUString& rDefault, long nXTwips = -1, long nYTwips = -1 );
+ virtual ~SvRTLInputBox() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
OUString GetText() const SAL_OVERRIDE { return aText; }
};
@@ -53,8 +55,8 @@ SvRTLInputBox::SvRTLInputBox( vcl::Window* pParent, const OUString& rPrompt,
const OUString& rTitle, const OUString& rDefault,
long nXTwips, long nYTwips ) :
ModalDialog( pParent,WB_3DLOOK | WB_MOVEABLE | WB_CLOSEABLE ),
- aEdit( this, WB_LEFT | WB_BORDER ),
- aOk( this ), aCancel( this ), aPromptText( this, WB_WORDBREAK )
+ aEdit( VclPtr<Edit>::Create(this, WB_LEFT | WB_BORDER) ),
+ aOk( new OKButton(this) ), aCancel( new CancelButton(this) ), aPromptText( VclPtr<FixedText>::Create(this, WB_WORDBREAK) )
{
SetMapMode( MapMode( MAP_APPFONT ) );
Size aDlgSizeApp( 280, 80 );
@@ -62,29 +64,38 @@ SvRTLInputBox::SvRTLInputBox( vcl::Window* pParent, const OUString& rPrompt,
InitButtons( aDlgSizeApp );
PositionEdit( aDlgSizeApp );
PositionPrompt( rPrompt, aDlgSizeApp );
- aOk.Show();
- aCancel.Show();
- aEdit.Show();
- aPromptText.Show();
+ aOk->Show();
+ aCancel->Show();
+ aEdit->Show();
+ aPromptText->Show();
SetText( rTitle );
vcl::Font aFont( GetFont());
Color aColor( GetBackground().GetColor() );
aFont.SetFillColor( aColor );
- aEdit.SetFont( aFont );
- aEdit.SetText( rDefault );
- aEdit.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+ aEdit->SetFont( aFont );
+ aEdit->SetText( rDefault );
+ aEdit->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+}
+
+void SvRTLInputBox::dispose()
+{
+ aEdit.disposeAndClear();
+ aOk.disposeAndClear();
+ aCancel.disposeAndClear();
+ aPromptText.disposeAndClear();
+ ModalDialog::dispose();
}
void SvRTLInputBox::InitButtons( const Size& rDlgSize )
{
- aOk.SetSizePixel( LogicToPixel( Size( 45, 15) ));
- aCancel.SetSizePixel( LogicToPixel( Size( 45, 15) ));
+ aOk->SetSizePixel( LogicToPixel( Size( 45, 15) ));
+ aCancel->SetSizePixel( LogicToPixel( Size( 45, 15) ));
Point aPos( rDlgSize.Width()-45-10, 5 );
- aOk.SetPosPixel( LogicToPixel( Point(aPos) ));
+ aOk->SetPosPixel( LogicToPixel( Point(aPos) ));
aPos.Y() += 16;
- aCancel.SetPosPixel( LogicToPixel( Point(aPos) ));
- aOk.SetClickHdl(LINK(this,SvRTLInputBox, OkHdl));
- aCancel.SetClickHdl(LINK(this,SvRTLInputBox,CancelHdl));
+ aCancel->SetPosPixel( LogicToPixel( Point(aPos) ));
+ aOk->SetClickHdl(LINK(this,SvRTLInputBox, OkHdl));
+ aCancel->SetClickHdl(LINK(this,SvRTLInputBox,CancelHdl));
}
void SvRTLInputBox::PositionDialog(long nXTwips, long nYTwips, const Size& rDlgSize)
@@ -99,8 +110,8 @@ void SvRTLInputBox::PositionDialog(long nXTwips, long nYTwips, const Size& rDlgS
void SvRTLInputBox::PositionEdit( const Size& rDlgSize )
{
- aEdit.SetPosPixel( LogicToPixel( Point( 5,rDlgSize.Height()-35)));
- aEdit.SetSizePixel( LogicToPixel( Size(rDlgSize.Width()-15,12)));
+ aEdit->SetPosPixel( LogicToPixel( Point( 5,rDlgSize.Height()-35)));
+ aEdit->SetSizePixel( LogicToPixel( Size(rDlgSize.Width()-15,12)));
}
@@ -109,12 +120,12 @@ void SvRTLInputBox::PositionPrompt(const OUString& rPrompt,const Size& rDlgSize)
if ( rPrompt.isEmpty() )
return;
OUString aText_(convertLineEnd(rPrompt, LINEEND_CR));
- aPromptText.SetPosPixel( LogicToPixel(Point(5,5)));
- aPromptText.SetText( aText_ );
+ aPromptText->SetPosPixel( LogicToPixel(Point(5,5)));
+ aPromptText->SetText( aText_ );
Size aSize( rDlgSize );
aSize.Width() -= 70;
aSize.Height() -= 50;
- aPromptText.SetSizePixel( LogicToPixel(aSize));
+ aPromptText->SetSizePixel( LogicToPixel(aSize));
}
@@ -122,7 +133,7 @@ IMPL_LINK_INLINE_START( SvRTLInputBox, OkHdl, Button *, pButton )
{
(void)pButton;
- aText = aEdit.GetText();
+ aText = aEdit->GetText();
EndDialog( 1 );
return 0;
}
@@ -172,8 +183,8 @@ RTLFUNC(InputBox)
nX = rPar.Get(4)->GetLong();
nY = rPar.Get(5)->GetLong();
}
- boost::scoped_ptr<SvRTLInputBox> pDlg(new SvRTLInputBox(Application::GetDefDialogParent(),
- rPrompt,aTitle,aDefault,nX,nY));
+ VclPtrInstance<SvRTLInputBox> pDlg(Application::GetDefDialogParent(),
+ rPrompt,aTitle,aDefault,nX,nY);
pDlg->Execute();
rPar.Get(0)->PutString( pDlg->GetText() );
}
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index ae6d03e256fc..f4092002d4aa 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -66,25 +66,27 @@ using namespace com::sun::star::bridge;
class SbiInputDialog : public ModalDialog {
- Edit aInput;
- OKButton aOk;
- CancelButton aCancel;
+ VclPtr<Edit> aInput;
+ VclPtr<OKButton> aOk;
+ VclPtr<CancelButton> aCancel;
OUString aText;
DECL_LINK( Ok, vcl::Window * );
DECL_LINK( Cancel, vcl::Window * );
public:
SbiInputDialog( vcl::Window*, const OUString& );
+ virtual ~SbiInputDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
const OUString& GetInput() { return aText; }
};
SbiInputDialog::SbiInputDialog( vcl::Window* pParent, const OUString& rPrompt )
:ModalDialog( pParent, WB_3DLOOK | WB_MOVEABLE | WB_CLOSEABLE ),
- aInput( this, WB_3DLOOK | WB_LEFT | WB_BORDER ),
- aOk( this ), aCancel( this )
+ aInput( VclPtr<Edit>::Create(this, WB_3DLOOK | WB_LEFT | WB_BORDER) ),
+ aOk( new OKButton(this) ), aCancel( VclPtr<CancelButton>::Create(this) )
{
SetText( rPrompt );
- aOk.SetClickHdl( LINK( this, SbiInputDialog, Ok ) );
- aCancel.SetClickHdl( LINK( this, SbiInputDialog, Cancel ) );
+ aOk->SetClickHdl( LINK( this, SbiInputDialog, Ok ) );
+ aCancel->SetClickHdl( LINK( this, SbiInputDialog, Cancel ) );
SetMapMode( MapMode( MAP_APPFONT ) );
Point aPt = LogicToPixel( Point( 50, 50 ) );
@@ -92,24 +94,32 @@ SbiInputDialog::SbiInputDialog( vcl::Window* pParent, const OUString& rPrompt )
SetPosSizePixel( aPt, aSz );
aPt = LogicToPixel( Point( 10, 10 ) );
aSz = LogicToPixel( Size( 120, 12 ) );
- aInput.SetPosSizePixel( aPt, aSz );
+ aInput->SetPosSizePixel( aPt, aSz );
aPt = LogicToPixel( Point( 15, 30 ) );
aSz = LogicToPixel( Size( 45, 15) );
- aOk.SetPosSizePixel( aPt, aSz );
+ aOk->SetPosSizePixel( aPt, aSz );
aPt = LogicToPixel( Point( 80, 30 ) );
aSz = LogicToPixel( Size( 45, 15) );
- aCancel.SetPosSizePixel( aPt, aSz );
+ aCancel->SetPosSizePixel( aPt, aSz );
- aInput.Show();
- aOk.Show();
- aCancel.Show();
+ aInput->Show();
+ aOk->Show();
+ aCancel->Show();
+}
+
+void SbiInputDialog::dispose()
+{
+ aInput.disposeAndClear();
+ aOk.disposeAndClear();
+ aCancel.disposeAndClear();
+ ModalDialog::dispose();
}
IMPL_LINK_INLINE_START( SbiInputDialog, Ok, vcl::Window *, pWindow )
{
(void)pWindow;
- aText = aInput.GetText();
+ aText = aInput->GetText();
EndDialog( 1 );
return 0;
}
@@ -956,10 +966,10 @@ void SbiIoSystem::CloseAll()
void SbiIoSystem::ReadCon(OString& rIn)
{
OUString aPromptStr(OStringToOUString(aPrompt, osl_getThreadTextEncoding()));
- SbiInputDialog aDlg( NULL, aPromptStr );
- if( aDlg.Execute() )
+ ScopedVclPtrInstance< SbiInputDialog > aDlg(nullptr, aPromptStr);
+ if( aDlg->Execute() )
{
- rIn = OUStringToOString(aDlg.GetInput(), osl_getThreadTextEncoding());
+ rIn = OUStringToOString(aDlg->GetInput(), osl_getThreadTextEncoding());
}
else
{
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 2cc26f78ea98..8b40e3643ef9 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4611,7 +4611,7 @@ RTLFUNC(MsgBox)
}
nType &= (16+32+64);
- boost::scoped_ptr<MessBox> pBox;
+ VclPtr<MessBox> pBox;
SolarMutexGuard aSolarGuard;
@@ -4619,19 +4619,19 @@ RTLFUNC(MsgBox)
switch( nType )
{
case 16:
- pBox.reset(new ErrorBox( pParent, nWinBits, aMsg ));
+ pBox.reset(VclPtr<ErrorBox>::Create( pParent, nWinBits, aMsg ));
break;
case 32:
- pBox.reset(new QueryBox( pParent, nWinBits, aMsg ));
+ pBox.reset(VclPtr<QueryBox>::Create( pParent, nWinBits, aMsg ));
break;
case 48:
- pBox.reset(new WarningBox( pParent, nWinBits, aMsg ));
+ pBox.reset(VclPtr<WarningBox>::Create( pParent, nWinBits, aMsg ));
break;
case 64:
- pBox.reset(new InfoBox( pParent, nWinBits, aMsg ));
+ pBox.reset(VclPtr<InfoBox>::Create( pParent, nWinBits, aMsg ));
break;
default:
- pBox.reset(new MessBox( pParent, nWinBits, aTitle, aMsg ));
+ pBox.reset(VclPtr<MessBox>::Create( pParent, nWinBits, aTitle, aMsg ));
}
pBox->SetText( aTitle );
short nRet = pBox->Execute();
diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx
index 9a2b8650ba54..bdfe3a193e73 100644
--- a/canvas/source/cairo/cairo_canvasfont.cxx
+++ b/canvas/source/cairo/cairo_canvasfont.cxx
@@ -63,7 +63,7 @@ namespace cairocanvas
// adjust to stretched/shrunk font
if( !::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) )
{
- OutputDevice* pOutDev( mpRefDevice->getOutputDevice() );
+ VclPtr<OutputDevice> pOutDev( mpRefDevice->getOutputDevice() );
if( pOutDev )
{
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 6157ea671020..7a918f4b38be 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -83,7 +83,7 @@ namespace cairocanvas
{
mpSurface.reset();
mpCairo.reset();
- mpVirtualDevice.reset();
+ mpVirtualDevice.disposeAndClear();
mpDevice = NULL;
mpSurfaceProvider = NULL;
}
@@ -105,7 +105,7 @@ namespace cairocanvas
void CanvasHelper::setSurface( const SurfaceSharedPtr& pSurface, bool bHasAlpha )
{
mbHaveAlpha = bHasAlpha;
- mpVirtualDevice.reset();
+ mpVirtualDevice.disposeAndClear();
mpSurface = pSurface;
mpCairo = pSurface->getCairo();
}
diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx
index b67904d6ebf5..ed6f702a53aa 100644
--- a/canvas/source/cairo/cairo_canvashelper.hxx
+++ b/canvas/source/cairo/cairo_canvashelper.hxx
@@ -28,6 +28,8 @@
#include <basegfx/vector/b2dsize.hxx>
#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
+#include <vcl/vclptr.hxx>
+#include <vcl/virdev.hxx>
#include <boost/utility.hpp>
#include <vcl/cairo.hxx>
@@ -269,7 +271,7 @@ namespace cairocanvas
private:
- boost::shared_ptr<VirtualDevice> mpVirtualDevice;
+ VclPtr<VirtualDevice> mpVirtualDevice;
void useStates( const ::com::sun::star::rendering::ViewState& viewState,
const ::com::sun::star::rendering::RenderState& renderState,
diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx
index f3c4c05083c3..2a98ea7b6e09 100644
--- a/canvas/source/cairo/cairo_canvashelper_text.cxx
+++ b/canvas/source/cairo/cairo_canvashelper_text.cxx
@@ -175,7 +175,7 @@ namespace cairocanvas
class DeviceSettingsGuard
{
private:
- OutputDevice *mpVirtualDevice;
+ VclPtr<OutputDevice> mpVirtualDevice;
cairo_t *mpCairo;
bool mbMappingWasEnabled;
public:
@@ -272,7 +272,7 @@ namespace cairocanvas
cairo_fill(mpCairo.get());
#endif
::Point aOutpos;
- if( !setupTextOutput( *mpVirtualDevice, pOwner, aOutpos, viewState, renderState, xFont ) )
+ if( !setupTextOutput( *mpVirtualDevice.get(), pOwner, aOutpos, viewState, renderState, xFont ) )
return uno::Reference< rendering::XCachedPrimitive >(NULL); // no output necessary
// change text direction and layout mode
diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx
index 9e7ba2e13ca5..684b61afcf2c 100644
--- a/canvas/source/cairo/cairo_devicehelper.cxx
+++ b/canvas/source/cairo/cairo_devicehelper.cxx
@@ -209,7 +209,7 @@ namespace cairocanvas
uno::Any DeviceHelper::getDeviceHandle() const
{
- return uno::makeAny( reinterpret_cast< sal_Int64 >(mpRefDevice) );
+ return uno::makeAny( reinterpret_cast< sal_Int64 >(mpRefDevice.get()) );
}
uno::Any DeviceHelper::getSurfaceHandle() const
diff --git a/canvas/source/cairo/cairo_devicehelper.hxx b/canvas/source/cairo/cairo_devicehelper.hxx
index 81f71810d61d..eafc5065e10b 100644
--- a/canvas/source/cairo/cairo_devicehelper.hxx
+++ b/canvas/source/cairo/cairo_devicehelper.hxx
@@ -116,7 +116,7 @@ namespace cairocanvas
*/
SurfaceProvider* mpSurfaceProvider;
- OutputDevice* mpRefDevice;
+ VclPtr<OutputDevice> mpRefDevice;
::cairo::SurfaceSharedPtr mpSurface;
};
}
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index f5a197846e72..03d319473e7c 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -179,14 +179,14 @@ namespace cairocanvas
if( !pOutDev )
return geometry::RealRectangle2D();
- VirtualDevice aVDev( *pOutDev );
- aVDev.SetFont( mpFont->getVCLFont() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( *pOutDev );
+ pVDev->SetFont( mpFont->getVCLFont() );
// need metrics for Y offset, the XCanvas always renders
// relative to baseline
- const ::FontMetric& aMetric( aVDev.GetFontMetric() );
+ const ::FontMetric& aMetric( pVDev->GetFontMetric() );
- setupLayoutMode( aVDev, mnTextDirection );
+ setupLayoutMode( *pVDev.get(), mnTextDirection );
const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() );
const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
@@ -200,7 +200,7 @@ namespace cairocanvas
else
{
return geometry::RealRectangle2D( 0, nAboveBaseline,
- aVDev.GetTextWidth(
+ pVDev->GetTextWidth(
maText.Text,
::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) ),
diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index b9ee8833a769..34e393897839 100644
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -666,7 +666,8 @@ namespace dxcanvas
maVertexCache.reserve(1024);
mpWindow.reset(
- new SystemChildWindow(
+ VclPtr<SystemChildWindow>::Create(
+
const_cast<vcl::Window *>(&rWindow), 0) );
// system child window must not receive mouse events
diff --git a/canvas/source/directx/dx_devicehelper.cxx b/canvas/source/directx/dx_devicehelper.cxx
index cc824719c3d7..759bb0b70f17 100644
--- a/canvas/source/directx/dx_devicehelper.cxx
+++ b/canvas/source/directx/dx_devicehelper.cxx
@@ -52,6 +52,10 @@ namespace dxcanvas
{
}
+ DeviceHelper::~DeviceHelper()
+ {
+ }
+
void DeviceHelper::init( HDC hdc, OutputDevice* pOutDev,
rendering::XGraphicDevice& rDevice )
{
@@ -191,7 +195,7 @@ namespace dxcanvas
uno::Any DeviceHelper::getDeviceHandle() const
{
- return uno::makeAny( reinterpret_cast< sal_Int64 >(mpOutDev) );
+ return uno::makeAny( reinterpret_cast< sal_Int64 >(mpOutDev.get()) );
}
uno::Any DeviceHelper::getSurfaceHandle() const
diff --git a/canvas/source/directx/dx_devicehelper.hxx b/canvas/source/directx/dx_devicehelper.hxx
index bb455c3cc916..cdf1e943243e 100644
--- a/canvas/source/directx/dx_devicehelper.hxx
+++ b/canvas/source/directx/dx_devicehelper.hxx
@@ -28,7 +28,7 @@
#include "dx_bitmap.hxx"
#include <canvas/rendering/isurfaceproxymanager.hxx>
-
+#include <vcl/vclptr.hxx>
#include <boost/utility.hpp>
class OutputDevice;
@@ -40,6 +40,7 @@ namespace dxcanvas
{
public:
DeviceHelper();
+ ~DeviceHelper();
/** Init the device helper
@@ -105,7 +106,7 @@ namespace dxcanvas
*/
com::sun::star::rendering::XGraphicDevice* mpDevice;
HDC mnHDC;
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
};
typedef ::rtl::Reference< com::sun::star::rendering::XGraphicDevice > DeviceRef;
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index f6d641f8bb2b..501e7f83fe6b 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -725,8 +725,8 @@ namespace oglcanvas
if( mpDevice )
{
- VirtualDevice aVDev;
- aVDev.EnableOutput(false);
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->EnableOutput(false);
CanvasFont* pFont=dynamic_cast<CanvasFont*>(xLayoutetText->getFont().get());
const rendering::StringContext& rTxt=xLayoutetText->getText();
@@ -749,7 +749,7 @@ namespace oglcanvas
// adjust to stretched font
if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11))
{
- const Size aSize = aVDev.GetFontMetric( aFont ).GetSize();
+ const Size aSize = pVDev->GetFontMetric( aFont ).GetSize();
const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 );
double fStretch = (rFontMatrix.m00 + rFontMatrix.m01);
@@ -762,7 +762,7 @@ namespace oglcanvas
}
// set font
- aVDev.SetFont(aFont);
+ pVDev->SetFont(aFont);
mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
@@ -780,7 +780,7 @@ namespace oglcanvas
pDXArray[i] = basegfx::fround( aLogicalAdvancements[i] );
// get the glyphs
- aVDev.GetTextOutlines(rAct.maPolyPolys,
+ pVDev->GetTextOutlines(rAct.maPolyPolys,
rTxt.Text,
0,
rTxt.StartPosition,
@@ -792,7 +792,7 @@ namespace oglcanvas
else
{
// get the glyphs
- aVDev.GetTextOutlines(rAct.maPolyPolys,
+ pVDev->GetTextOutlines(rAct.maPolyPolys,
rTxt.Text,
0,
rTxt.StartPosition,
diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx
index 73d6320fcba5..356caa9254e7 100644
--- a/canvas/source/vcl/backbuffer.cxx
+++ b/canvas/source/vcl/backbuffer.cxx
@@ -25,7 +25,7 @@ namespace vclcanvas
{
BackBuffer::BackBuffer( const OutputDevice& rRefDevice,
bool bMonochromeBuffer ) :
- maVDev( new VirtualDevice( rRefDevice,
+ maVDev( VclPtr<VirtualDevice>::Create( rRefDevice,
sal_uInt16(bMonochromeBuffer) ) )
{
if( !bMonochromeBuffer )
@@ -43,14 +43,20 @@ namespace vclcanvas
}
}
+ BackBuffer::~BackBuffer()
+ {
+ SolarMutexGuard aGuard;
+ maVDev.disposeAndClear();
+ }
+
OutputDevice& BackBuffer::getOutDev()
{
- return maVDev.get();
+ return *maVDev.get();
}
const OutputDevice& BackBuffer::getOutDev() const
{
- return maVDev.get();
+ return *maVDev.get();
}
void BackBuffer::setSize( const ::Size& rNewSize )
diff --git a/canvas/source/vcl/backbuffer.hxx b/canvas/source/vcl/backbuffer.hxx
index 0fea559876dd..0beeda2e0467 100644
--- a/canvas/source/vcl/backbuffer.hxx
+++ b/canvas/source/vcl/backbuffer.hxx
@@ -43,6 +43,7 @@ namespace vclcanvas
*/
BackBuffer( const OutputDevice& rRefDevice,
bool bMonochromeBuffer=false );
+ virtual ~BackBuffer();
virtual OutputDevice& getOutDev() SAL_OVERRIDE;
virtual const OutputDevice& getOutDev() const SAL_OVERRIDE;
@@ -50,7 +51,7 @@ namespace vclcanvas
void setSize( const ::Size& rNewSize );
private:
- ::canvas::vcltools::VCLObject<VirtualDevice> maVDev;
+ VclPtr< VirtualDevice > maVDev;
};
typedef ::boost::shared_ptr< BackBuffer > BackBufferSharedPtr;
diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx
index d140ea002a10..bd01d71b5c54 100644
--- a/canvas/source/vcl/bitmapbackbuffer.cxx
+++ b/canvas/source/vcl/bitmapbackbuffer.cxx
@@ -45,8 +45,7 @@ namespace vclcanvas
// are supposed to be called with already locked solar mutex)
SolarMutexGuard aGuard;
- if( mpVDev )
- delete mpVDev;
+ mpVDev.disposeAndClear();
}
OutputDevice& BitmapBackBuffer::getOutDev()
@@ -113,8 +112,8 @@ namespace vclcanvas
// VDev not yet created, do it now. Create an alpha-VDev,
// if bitmap has transparency.
mpVDev = maBitmap->IsTransparent() ?
- new VirtualDevice( mrRefDevice, 0, 0 ) :
- new VirtualDevice( mrRefDevice );
+ VclPtr<VirtualDevice>::Create( mrRefDevice, 0, 0 ) :
+ VclPtr<VirtualDevice>::Create( mrRefDevice );
OSL_ENSURE( mpVDev,
"BitmapBackBuffer::createVDev(): Unable to create VirtualDevice" );
diff --git a/canvas/source/vcl/bitmapbackbuffer.hxx b/canvas/source/vcl/bitmapbackbuffer.hxx
index c3f2a27a7ba7..b51867994a68 100644
--- a/canvas/source/vcl/bitmapbackbuffer.hxx
+++ b/canvas/source/vcl/bitmapbackbuffer.hxx
@@ -66,7 +66,7 @@ namespace vclcanvas
void updateVDev() const;
::canvas::vcltools::VCLObject<BitmapEx> maBitmap;
- mutable VirtualDevice* mpVDev; // created only on demand
+ mutable VclPtr<VirtualDevice> mpVDev; // created only on demand
const OutputDevice& mrRefDevice;
diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx
index 5477ea6bb257..6c4437da1205 100644
--- a/canvas/source/vcl/canvasfont.cxx
+++ b/canvas/source/vcl/canvasfont.cxx
@@ -121,9 +121,9 @@ namespace vclcanvas
SolarMutexGuard aGuard;
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
- VirtualDevice aVDev( rOutDev );
- aVDev.SetFont(getVCLFont());
- const ::FontMetric& aMetric( aVDev.GetFontMetric() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetFont(getVCLFont());
+ const ::FontMetric& aMetric( pVDev->GetFontMetric() );
return rendering::FontMetrics(
aMetric.GetAscent(),
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index f57e49812acc..b46746e2cf8b 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -1026,8 +1026,8 @@ namespace vclcanvas
// cannot do direct XOR, but have to
// prepare the filled polygon within a
// VDev
- VirtualDevice aVDev( rOutDev );
- aVDev.SetOutputSizePixel( aPolygonDeviceRect.GetSize() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetOutputSizePixel( aPolygonDeviceRect.GetSize() );
// shift output to origin of VDev
const ::Point aOutPos( aPt - aPolygonDeviceRect.TopLeft() );
@@ -1036,8 +1036,8 @@ namespace vclcanvas
const vcl::Region aPolyClipRegion( aPolyPoly );
- aVDev.SetClipRegion( aPolyClipRegion );
- textureFill( aVDev,
+ pVDev->SetClipRegion( aPolyClipRegion );
+ textureFill( *pVDev.get(),
*pGrfObj,
aOutPos,
aIntegerNextTileX,
@@ -1051,12 +1051,12 @@ namespace vclcanvas
// target position.
const ::Point aEmptyPoint;
Bitmap aContentBmp(
- aVDev.GetBitmap( aEmptyPoint,
- aVDev.GetOutputSizePixel() ) );
+ pVDev->GetBitmap( aEmptyPoint,
+ pVDev->GetOutputSizePixel() ) );
sal_uInt8 nCol( static_cast< sal_uInt8 >(
::basegfx::fround( 255.0*( 1.0 - textures[0].Alpha ) ) ) );
- AlphaMask aAlpha( aVDev.GetOutputSizePixel(),
+ AlphaMask aAlpha( pVDev->GetOutputSizePixel(),
&nCol );
BitmapEx aOutputBmpEx( aContentBmp, aAlpha );
diff --git a/canvas/source/vcl/impltools.hxx b/canvas/source/vcl/impltools.hxx
index 059495523db0..c294efd89ae7 100644
--- a/canvas/source/vcl/impltools.hxx
+++ b/canvas/source/vcl/impltools.hxx
@@ -158,7 +158,7 @@ namespace vclcanvas
}
}
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
const bool mbMappingWasEnabled;
const sal_uInt16 mnAntiAliasing;
};
diff --git a/canvas/source/vcl/spritecanvashelper.cxx b/canvas/source/vcl/spritecanvashelper.cxx
index 682950534135..51a234feca1c 100644
--- a/canvas/source/vcl/spritecanvashelper.cxx
+++ b/canvas/source/vcl/spritecanvashelper.cxx
@@ -189,6 +189,12 @@ namespace vclcanvas
#endif
}
+ SpriteCanvasHelper::~SpriteCanvasHelper()
+ {
+ SolarMutexGuard aGuard;
+ maVDev.disposeAndClear();
+ }
+
void SpriteCanvasHelper::init( const OutDevProviderSharedPtr& rOutDev,
SpriteCanvas& rOwningSpriteCanvas,
::canvas::SpriteRedrawManager& rManager,
@@ -318,7 +324,7 @@ namespace vclcanvas
mpRedrawManager->forEachSprite(
::boost::bind(
&spriteRedraw,
- ::boost::ref( maVDev.get() ),
+ ::boost::ref( *maVDev.get() ),
_1 ) );
// flush to screen
@@ -576,7 +582,7 @@ namespace vclcanvas
::std::for_each( rSortedUpdateSprites.begin(),
rSortedUpdateSprites.end(),
::boost::bind( &spriteRedrawStub2,
- ::boost::ref( maVDev.get() ),
+ ::boost::ref( *maVDev.get() ),
::vcl::unotools::b2DPointFromPoint(
aOutputPosition),
_1 ) );
diff --git a/canvas/source/vcl/spritecanvashelper.hxx b/canvas/source/vcl/spritecanvashelper.hxx
index dc165d460296..a6b3c0393c8a 100644
--- a/canvas/source/vcl/spritecanvashelper.hxx
+++ b/canvas/source/vcl/spritecanvashelper.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/rendering/XSpriteCanvas.hpp>
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
+#include <vcl/vclptr.hxx>
#include <vcl/virdev.hxx>
#include <canvas/spriteredrawmanager.hxx>
@@ -40,6 +41,7 @@ namespace vclcanvas
{
public:
SpriteCanvasHelper();
+ ~SpriteCanvasHelper();
void init( const OutDevProviderSharedPtr& rOutDev,
SpriteCanvas& rOwningSpriteCanvas,
@@ -150,7 +152,7 @@ namespace vclcanvas
Typically, sprites will be composited in the background,
before pushing them to screen. This happens here.
*/
- ::canvas::vcltools::VCLObject< VirtualDevice > maVDev;
+ VclPtr< VirtualDevice > maVDev;
/// For the frame counter timings
::canvas::tools::ElapsedTime maLastUpdate;
diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx
index d64f7dfa7fb7..6cf534220e26 100644
--- a/canvas/source/vcl/textlayout.cxx
+++ b/canvas/source/vcl/textlayout.cxx
@@ -104,10 +104,10 @@ namespace vclcanvas
SolarMutexGuard aGuard;
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
- VirtualDevice aVDev( rOutDev );
- aVDev.SetFont( mpFont->getVCLFont() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetFont( mpFont->getVCLFont() );
- setupLayoutMode( aVDev, mnTextDirection );
+ setupLayoutMode( *pVDev.get(), mnTextDirection );
const rendering::ViewState aViewState(
geometry::AffineMatrix2D(1,0,0, 0,1,0),
@@ -124,7 +124,7 @@ namespace vclcanvas
uno::Sequence< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence;
::basegfx::B2DPolyPolygonVector aOutlines;
- if (aVDev.GetTextOutlines(
+ if (pVDev->GetTextOutlines(
aOutlines,
maText.Text,
maText.StartPosition,
@@ -157,10 +157,10 @@ namespace vclcanvas
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
- VirtualDevice aVDev( rOutDev );
- aVDev.SetFont( mpFont->getVCLFont() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetFont( mpFont->getVCLFont() );
- setupLayoutMode( aVDev, mnTextDirection );
+ setupLayoutMode( *pVDev.get(), mnTextDirection );
const rendering::ViewState aViewState(
geometry::AffineMatrix2D(1,0,0, 0,1,0),
@@ -177,7 +177,7 @@ namespace vclcanvas
MetricVector aMetricVector;
uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes;
- if (aVDev.GetGlyphBoundRects(
+ if (pVDev->GetGlyphBoundRects(
Point(0,0),
maText.Text,
::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
@@ -237,14 +237,14 @@ namespace vclcanvas
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
- VirtualDevice aVDev( rOutDev );
- aVDev.SetFont( mpFont->getVCLFont() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetFont( mpFont->getVCLFont() );
// need metrics for Y offset, the XCanvas always renders
// relative to baseline
- const ::FontMetric& aMetric( aVDev.GetFontMetric() );
+ const ::FontMetric& aMetric( pVDev->GetFontMetric() );
- setupLayoutMode( aVDev, mnTextDirection );
+ setupLayoutMode( *pVDev.get(), mnTextDirection );
const sal_Int32 nAboveBaseline( /*-aMetric.GetIntLeading()*/ - aMetric.GetAscent() );
const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
@@ -258,7 +258,7 @@ namespace vclcanvas
else
{
return geometry::RealRectangle2D( 0, nAboveBaseline,
- aVDev.GetTextWidth(
+ pVDev->GetTextWidth(
maText.Text,
::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) ),
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index 9e71caa1cb23..d1f5e4f39fdc 100644
--- a/chart2/inc/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -618,7 +618,7 @@ private:
sal_Int32 mnStart;
sal_Int32 mnEnd;
bool bSet;
- OpenGLWindow* mpOpenGLWindow;
+ VclPtr<OpenGLWindow> mpOpenGLWindow;
};
} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
index e0b65406b31e..b2d55cb8784f 100644
--- a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLEVIEWFORWARDER_HXX
#include <vcl/mapmod.hxx>
+#include <vcl/vclptr.hxx>
#include <svx/IAccessibleViewForwarder.hxx>
namespace vcl { class Window; }
@@ -48,7 +49,7 @@ private:
AccessibleViewForwarder& operator=( AccessibleViewForwarder& ) SAL_DELETED_FUNCTION;
AccessibleChartView* m_pAccChartView;
- vcl::Window* m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
MapMode m_aMapMode;
};
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
index 14ce8e13b5da..7ea6c1c4b0c7 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
@@ -281,8 +281,8 @@ private:
DECL_LINK( ChangeLineCountHdl, void* );
private:
- FixedText* m_pFT_NumberOfLines;
- NumericField* m_pMF_NumberOfLines;
+ VclPtr<FixedText> m_pFT_NumberOfLines;
+ VclPtr<NumericField> m_pMF_NumberOfLines;
};
class BubbleChartDialogController : public ChartTypeDialogController
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 62ab1a2b9a3d..7c7b8f30deec 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -102,7 +102,6 @@ class SeriesHeaderEdit : public Edit
{
public:
SeriesHeaderEdit( vcl::Window * pParent );
- virtual ~SeriesHeaderEdit();
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
void setStartColumn( sal_Int32 nStartColumn );
@@ -122,9 +121,6 @@ SeriesHeaderEdit::SeriesHeaderEdit( vcl::Window * pParent ) :
SetHelpId(HID_SCH_DATA_SERIES_LABEL);
}
-SeriesHeaderEdit::~SeriesHeaderEdit()
-{}
-
void SeriesHeaderEdit::setStartColumn( sal_Int32 nStartColumn )
{
m_nStartColumn = nStartColumn;
@@ -182,11 +178,11 @@ public:
bool HasFocus() const;
private:
- ::boost::shared_ptr< FixedImage > m_spSymbol;
- ::boost::shared_ptr< SeriesHeaderEdit > m_spSeriesName;
- ::boost::shared_ptr< FixedText > m_spColorBar;
- OutputDevice * m_pDevice;
- Link m_aChangeLink;
+ VclPtr< FixedImage > m_spSymbol;
+ VclPtr< SeriesHeaderEdit > m_spSeriesName;
+ VclPtr< FixedText > m_spColorBar;
+ VclPtr< OutputDevice> m_pDevice;
+ Link m_aChangeLink;
void notifyChanges();
DECL_LINK( SeriesNameChanged, void * );
@@ -204,9 +200,9 @@ private:
};
SeriesHeader::SeriesHeader( vcl::Window * pParent, vcl::Window *pColorParent ) :
- m_spSymbol( new FixedImage( pParent, WB_NOBORDER )),
- m_spSeriesName( new SeriesHeaderEdit( pParent )),
- m_spColorBar( new FixedText( pColorParent, WB_NOBORDER )),
+ m_spSymbol( VclPtr<FixedImage>::Create( pParent, WB_NOBORDER )),
+ m_spSeriesName( VclPtr<SeriesHeaderEdit>::Create( pParent )),
+ m_spColorBar( VclPtr<FixedText>::Create( pColorParent, WB_NOBORDER )),
m_pDevice( pParent ),
m_nStartCol( 0 ),
m_nEndCol( 0 ),
@@ -457,21 +453,29 @@ DataBrowser::DataBrowser( vcl::Window* pParent, WinBits nStyle, bool bLiveUpdate
m_bIsDirty( false ),
m_bLiveUpdate( bLiveUpdate ),
m_bDataValid( true ),
- m_aNumberEditField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ),
- m_aTextEditField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ),
- m_rNumberEditController( new ::svt::FormattedFieldCellController( & m_aNumberEditField )),
- m_rTextEditController( new ::svt::EditCellController( & m_aTextEditField ))
+ m_aNumberEditField( VclPtr<FormattedField>::Create( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ) ),
+ m_aTextEditField( VclPtr<Edit>::Create( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ) ),
+ m_rNumberEditController( new ::svt::FormattedFieldCellController( m_aNumberEditField.get() )),
+ m_rTextEditController( new ::svt::EditCellController( m_aTextEditField.get() ))
{
double fNan;
::rtl::math::setNan( & fNan );
- m_aNumberEditField.SetDefaultValue( fNan );
- m_aNumberEditField.TreatAsNumber( true );
+ m_aNumberEditField->SetDefaultValue( fNan );
+ m_aNumberEditField->TreatAsNumber( true );
RenewTable();
SetClean();
}
DataBrowser::~DataBrowser()
{
+ disposeOnce();
+}
+
+void DataBrowser::dispose()
+{
+ m_aNumberEditField.disposeAndClear();
+ m_aTextEditField.disposeAndClear();
+ ::svt::EditBrowseBox::dispose();
}
bool DataBrowser::MayInsertRow() const
@@ -762,9 +766,9 @@ void DataBrowser::ShowWarningBox()
bool DataBrowser::ShowQueryBox()
{
- QueryBox* pQueryBox = new QueryBox(this, WB_YES_NO, SCH_RESSTR(STR_DATA_EDITOR_INCORRECT_INPUT));
+ ScopedVclPtrInstance<QueryBox> pQueryBox(this, WB_YES_NO, SCH_RESSTR(STR_DATA_EDITOR_INCORRECT_INPUT));
- return ( pQueryBox->Execute() == RET_YES );
+ return pQueryBox->Execute() == RET_YES;
}
bool DataBrowser::IsDataValid()
@@ -777,7 +781,7 @@ bool DataBrowser::IsDataValid()
{
sal_uInt32 nDummy = 0;
double fDummy = 0.0;
- OUString aText( m_aNumberEditField.GetText());
+ OUString aText( m_aNumberEditField->GetText());
if( !aText.isEmpty() &&
m_spNumberFormatterWrapper.get() &&
@@ -821,7 +825,7 @@ void DataBrowser::SetDataFromModel(
Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY )));
if( m_spNumberFormatterWrapper.get() )
- m_aNumberEditField.SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() );
+ m_aNumberEditField->SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() );
RenewTable();
@@ -1041,8 +1045,8 @@ bool DataBrowser::IsTabAllowed( bool bForward ) const
if( CellContainsNumbers( nRow, nCol ))
{
- m_aNumberEditField.UseInputStringForFormatting();
- m_aNumberEditField.SetFormatKey( GetNumberFormatKey( nRow, nCol ));
+ m_aNumberEditField->UseInputStringForFormatting();
+ m_aNumberEditField->SetFormatKey( GetNumberFormatKey( nRow, nCol ));
return m_rNumberEditController;
}
@@ -1055,19 +1059,19 @@ void DataBrowser::InitController(
if( rController == m_rTextEditController )
{
OUString aText( GetCellText( nRow, nCol ) );
- m_aTextEditField.SetText( aText );
- m_aTextEditField.SetSelection( Selection( 0, aText.getLength() ));
+ m_aTextEditField->SetText( aText );
+ m_aTextEditField->SetSelection( Selection( 0, aText.getLength() ));
}
else if( rController == m_rNumberEditController )
{
// treat invalid and empty text as Nan
- m_aNumberEditField.EnableNotANumber( true );
+ m_aNumberEditField->EnableNotANumber( true );
if( ::rtl::math::isNan( GetCellNumber( nRow, nCol )))
- m_aNumberEditField.SetTextValue( OUString());
+ m_aNumberEditField->SetTextValue( OUString());
else
- m_aNumberEditField.SetValue( GetCellNumber( nRow, nCol ) );
- OUString aText( m_aNumberEditField.GetText());
- m_aNumberEditField.SetSelection( Selection( 0, aText.getLength()));
+ m_aNumberEditField->SetValue( GetCellNumber( nRow, nCol ) );
+ OUString aText( m_aNumberEditField->GetText());
+ m_aNumberEditField->SetSelection( Selection( 0, aText.getLength()));
}
else
{
@@ -1125,7 +1129,7 @@ bool DataBrowser::SaveModified()
{
sal_uInt32 nDummy = 0;
double fDummy = 0.0;
- OUString aText( m_aNumberEditField.GetText());
+ OUString aText( m_aNumberEditField->GetText());
// an empty string is valid, if no numberformatter exists, all
// values are treated as valid
if( !aText.isEmpty() && pSvNumberFormatter &&
@@ -1135,14 +1139,14 @@ bool DataBrowser::SaveModified()
}
else
{
- double fData = m_aNumberEditField.GetValue();
+ double fData = m_aNumberEditField->GetValue();
bChangeValid = m_apDataBrowserModel->setCellNumber( nCol, nRow, fData );
}
}
break;
case DataBrowserModel::TEXTORDATE:
{
- OUString aText( m_aTextEditField.GetText() );
+ OUString aText( m_aTextEditField->GetText() );
double fDateValue = 0.0;
bChangeValid = false;
if( isDateString( aText, fDateValue ) )
@@ -1153,7 +1157,7 @@ bool DataBrowser::SaveModified()
break;
case DataBrowserModel::TEXT:
{
- OUString aText( m_aTextEditField.GetText());
+ OUString aText( m_aTextEditField->GetText());
bChangeValid = m_apDataBrowserModel->setCellText( nCol, nRow, aText );
}
break;
diff --git a/chart2/source/controller/dialogs/DataBrowser.hxx b/chart2/source/controller/dialogs/DataBrowser.hxx
index ee6030081f59..8a721c428067 100644
--- a/chart2/source/controller/dialogs/DataBrowser.hxx
+++ b/chart2/source/controller/dialogs/DataBrowser.hxx
@@ -69,6 +69,7 @@ protected:
public:
DataBrowser( vcl::Window* pParent, WinBits nStyle, bool bLiveUpdate );
virtual ~DataBrowser();
+ virtual void dispose() SAL_OVERRIDE;
/** GetCellText returns the text at the given position
@param nRow
@@ -164,8 +165,8 @@ private:
bool m_bLiveUpdate;
bool m_bDataValid;
- FormattedField m_aNumberEditField;
- Edit m_aTextEditField;
+ VclPtr<FormattedField> m_aNumberEditField;
+ VclPtr<Edit> m_aTextEditField;
/// note: m_aNumberEditField must precede this member!
::svt::CellControllerRef m_rNumberEditController;
diff --git a/chart2/source/controller/dialogs/TextDirectionListBox.cxx b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
index 85c1def2c08d..c3f5e309a36b 100644
--- a/chart2/source/controller/dialogs/TextDirectionListBox.cxx
+++ b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
@@ -47,10 +47,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTextDirectionListBox(v
return new TextDirectionListBox(pParent);
}
-TextDirectionListBox::~TextDirectionListBox()
-{
-}
-
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx
index 30d03d140def..073d194a3afd 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx
@@ -42,7 +42,8 @@ ChartTypeDialog::ChartTypeDialog( vcl::Window* pParent
, m_xChartModel(xChartModel)
, m_xCC( xContext )
{
- m_pChartTypeTabPage = new ChartTypeTabPage(
+ m_pChartTypeTabPage = VclPtr<ChartTypeTabPage>::Create(
+
get_content_area(),
uno::Reference<XChartDocument>::query(m_xChartModel),
m_xCC,
@@ -55,7 +56,13 @@ ChartTypeDialog::ChartTypeDialog( vcl::Window* pParent
ChartTypeDialog::~ChartTypeDialog()
{
- delete m_pChartTypeTabPage;
+ disposeOnce();
+}
+
+void ChartTypeDialog::dispose()
+{
+ m_pChartTypeTabPage.disposeAndClear();
+ ModalDialog::dispose();
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
index 86f2b59faa6e..c2415b78b04e 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
@@ -79,9 +79,9 @@ void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue)
else
ChartTypeUnoDlg_BASE::implInitialize(_rValue);
}
-Dialog* ChartTypeUnoDlg::createDialog(vcl::Window* _pParent)
+VclPtr<Dialog> ChartTypeUnoDlg::createDialog(vcl::Window* _pParent)
{
- return new ChartTypeDialog( _pParent, m_xChartModel, m_aContext );
+ return VclPtr<ChartTypeDialog>::Create( _pParent, m_xChartModel, m_aContext );
}
uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo() throw(uno::RuntimeException, std::exception)
{
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index 9094da82cbf1..17da73233a6a 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -106,13 +106,9 @@ CreationWizard::CreationWizard( vcl::Window* pParent, const uno::Reference< fram
ActivatePage();
}
-CreationWizard::~CreationWizard()
+VclPtr<TabPage> CreationWizard::createPage(WizardState nState)
{
-}
-
-svt::OWizardPage* CreationWizard::createPage(WizardState nState)
-{
- svt::OWizardPage* pRet = 0;
+ VclPtr<svt::OWizardPage> pRet;
if(m_nOnePageOnlyIndex!=-1 && m_nOnePageOnlyIndex!=nState)
return pRet;
bool bDoLiveUpdate = m_nOnePageOnlyIndex == -1;
@@ -121,7 +117,7 @@ svt::OWizardPage* CreationWizard::createPage(WizardState nState)
case STATE_CHARTTYPE:
{
m_aTimerTriggeredControllerLock.startTimer();
- ChartTypeTabPage* pChartTypeTabPage = new ChartTypeTabPage(this,m_xChartModel,m_xCC,bDoLiveUpdate);
+ VclPtrInstance<ChartTypeTabPage> pChartTypeTabPage(this,m_xChartModel,m_xCC,bDoLiveUpdate);
pRet = pChartTypeTabPage;
m_pTemplateProvider = pChartTypeTabPage;
if (m_pDialogModel)
@@ -131,18 +127,18 @@ svt::OWizardPage* CreationWizard::createPage(WizardState nState)
case STATE_SIMPLE_RANGE:
{
m_aTimerTriggeredControllerLock.startTimer();
- pRet = new RangeChooserTabPage(this, *m_pDialogModel, m_pTemplateProvider, this);
+ pRet = VclPtr<RangeChooserTabPage>::Create(this, *m_pDialogModel, m_pTemplateProvider, this);
}
break;
case STATE_DATA_SERIES:
{
m_aTimerTriggeredControllerLock.startTimer();
- pRet = new DataSourceTabPage(this, *m_pDialogModel, m_pTemplateProvider, this);
+ pRet = VclPtr<DataSourceTabPage>::Create(this, *m_pDialogModel, m_pTemplateProvider, this);
}
break;
case STATE_OBJECTS:
{
- pRet = new TitlesAndObjectsTabPage(this,m_xChartModel,m_xCC);
+ pRet = VclPtr<TitlesAndObjectsTabPage>::Create(this,m_xChartModel,m_xCC);
m_aTimerTriggeredControllerLock.startTimer();
}
break;
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
index 1672e8d0b6b4..34df8acaca78 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -54,11 +54,7 @@ CreationWizardUnoDlg::CreationWizardUnoDlg( const uno::Reference< uno::XComponen
CreationWizardUnoDlg::~CreationWizardUnoDlg()
{
SolarMutexGuard aSolarGuard;
- if( m_pDialog )
- {
- delete m_pDialog;
- m_pDialog = 0;
- }
+ m_pDialog.disposeAndClear();
}
// lang::XServiceInfo
OUString SAL_CALL CreationWizardUnoDlg::getImplementationName()
@@ -216,7 +212,7 @@ void CreationWizardUnoDlg::createDialogOnDemand()
uno::Reference< XComponent > xComp( this );
if( m_xChartModel.is() )
{
- m_pDialog = new CreationWizard( pParent, m_xChartModel, m_xCC );
+ m_pDialog = VclPtr<CreationWizard>::Create( pParent, m_xChartModel, m_xCC );
m_pDialog->AddEventListener( LINK( this, CreationWizardUnoDlg, DialogEventHdl ) );
}
}
@@ -272,11 +268,7 @@ void SAL_CALL CreationWizardUnoDlg::disposing()
m_xParentWindow.clear();
SolarMutexGuard aSolarGuard;
- if( m_pDialog )
- {
- delete m_pDialog;
- m_pDialog = 0;
- }
+ m_pDialog.disposeAndClear();
try
{
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
index 502579f539af..4f4ce2f09230 100644
--- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
@@ -48,7 +48,7 @@ DataEditor::DataEditor(vcl::Window* pParent,
, m_xChartDoc(xChartDoc)
, m_xContext(xContext)
{
- m_xBrwData.reset(new DataBrowser(get<vcl::Window>("datawindow"), WB_BORDER | WB_TABSTOP, true /* bLiveUpdate */));
+ m_xBrwData.reset(VclPtr<DataBrowser>::Create(get<vcl::Window>("datawindow"), WB_BORDER | WB_TABSTOP, true /* bLiveUpdate */));
m_xBrwData->set_hexpand(true);
m_xBrwData->set_vexpand(true);
m_xBrwData->set_expand(true);
@@ -95,12 +95,20 @@ DataEditor::DataEditor(vcl::Window* pParent,
DataEditor::~DataEditor()
{
+ disposeOnce();
+}
+
+void DataEditor::dispose()
+{
notifySystemWindow( this, m_pTbxData, ::comphelper::mem_fun( & TaskPaneList::RemoveWindow ));
SvtMiscOptions aMiscOptions;
aMiscOptions.RemoveListenerLink( LINK( this, DataEditor, MiscHdl ) );
OSL_TRACE( "DataEditor: DTOR" );
+ m_pTbxData.clear();
+ m_xBrwData.disposeAndClear();
+ ModalDialog::dispose();
}
// react on click (or keypress) on toolbar icon
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index bfa90c7647be..d0cb0739fdc7 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -133,7 +133,7 @@ DataSourceDialog::DataSourceDialog(vcl::Window * pParent,
, m_xContext(xContext)
, m_apDocTemplateProvider(new DocumentChartTypeTemplateProvider(xChartDocument))
, m_apDialogModel(new DialogModel(xChartDocument, xContext))
- , m_pTabControl(new DataSourceTabControl(get_content_area()))
+ , m_pTabControl(VclPtr<DataSourceTabControl>::Create(get_content_area()))
, m_pRangeChooserTabePage(0)
, m_pDataSourceTabPage(0)
, m_bRangeChooserTabIsValid(true)
@@ -143,9 +143,9 @@ DataSourceDialog::DataSourceDialog(vcl::Window * pParent,
m_pTabControl->Show();
- m_pRangeChooserTabePage = new RangeChooserTabPage( m_pTabControl, *(m_apDialogModel.get()),
+ m_pRangeChooserTabePage = VclPtr<RangeChooserTabPage>::Create( m_pTabControl, *(m_apDialogModel.get()),
m_apDocTemplateProvider.get(), this, true /* bHideDescription */ );
- m_pDataSourceTabPage = new DataSourceTabPage( m_pTabControl, *(m_apDialogModel.get()),
+ m_pDataSourceTabPage = VclPtr<DataSourceTabPage>::Create( m_pTabControl, *(m_apDialogModel.get()),
m_apDocTemplateProvider.get(), this, true /* bHideDescription */ );
m_pTabControl->InsertPage( TP_RANGECHOOSER, SCH_RESSTR(STR_PAGE_DATA_RANGE) );
@@ -159,11 +159,18 @@ DataSourceDialog::DataSourceDialog(vcl::Window * pParent,
DataSourceDialog::~DataSourceDialog()
{
- delete m_pRangeChooserTabePage;
- delete m_pDataSourceTabPage;
+ disposeOnce();
+}
- m_nLastPageId = m_pTabControl->GetCurPageId();
- delete m_pTabControl;
+void DataSourceDialog::dispose()
+{
+ m_pRangeChooserTabePage.disposeAndClear();
+ m_pDataSourceTabPage.disposeAndClear();
+ if (m_pTabControl)
+ m_nLastPageId = m_pTabControl->GetCurPageId();
+ m_pTabControl.disposeAndClear();
+ m_pBtnOK.clear();
+ TabDialog::dispose();
}
short DataSourceDialog::Execute()
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
index 2af1b5fa2073..4ef50442f07c 100644
--- a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
@@ -83,8 +83,21 @@ SchAxisDlg::SchAxisDlg(vcl::Window* pWindow,
SchAxisDlg::~SchAxisDlg()
{
+ disposeOnce();
}
+void SchAxisDlg::dispose()
+{
+ m_pCbPrimaryX.clear();
+ m_pCbPrimaryY.clear();
+ m_pCbPrimaryZ.clear();
+ m_pCbSecondaryX.clear();
+ m_pCbSecondaryY.clear();
+ m_pCbSecondaryZ.clear();
+ ModalDialog::dispose();
+}
+
+
void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput )
{
rOutput.aExistenceList[0]=m_pCbPrimaryX->IsChecked();
@@ -100,10 +113,6 @@ SchGridDlg::SchGridDlg( vcl::Window* pParent, const InsertAxisOrGridDialogData&
{
}
-SchGridDlg::~SchGridDlg()
-{
-}
-
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
index 83c13095025f..17c15bcb7f2e 100644
--- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
@@ -34,10 +34,6 @@ DataLabelsDialog::DataLabelsDialog(vcl::Window* pWindow, const SfxItemSet& rInAt
Reset();
}
-DataLabelsDialog::~DataLabelsDialog()
-{
-}
-
void DataLabelsDialog::Reset()
{
m_apDataLabelResources->Reset(m_rInAttrs);
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
index 11f48f9dc9e2..5cf894f2313c 100644
--- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
@@ -57,10 +57,6 @@ InsertErrorBarsDialog::InsertErrorBarsDialog(
m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument );
}
-InsertErrorBarsDialog::~InsertErrorBarsDialog()
-{
-}
-
void InsertErrorBarsDialog::FillItemSet(SfxItemSet& rOutAttrs)
{
m_apErrorBarResources->FillItemSet(rOutAttrs);
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
index a2ba7f3c0ca0..9d0e54ca4c42 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -44,10 +44,6 @@ NumberFormatDialog::NumberFormatDialog(vcl::Window* pParent, SfxItemSet& rSet)
}
}
-NumberFormatDialog::~NumberFormatDialog()
-{
-}
-
SfxItemSet NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool )
{
static const sal_uInt16 nWhichPairs[] =
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
index a27ff0caf7f0..1aff53582645 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
@@ -30,8 +30,7 @@ namespace chart
class NumberFormatDialog : public SfxSingleTabDialog
{
public:
- NumberFormatDialog(vcl::Window* pParent, SfxItemSet& rSet);
- virtual ~NumberFormatDialog();
+ NumberFormatDialog(vcl::Window* pParent, SfxItemSet& rSet);
static SfxItemSet CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool );
};
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index 165b179521f5..92c6cb668f56 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -481,8 +481,16 @@ SchAttribTabDlg::SchAttribTabDlg(vcl::Window* pParent,
SchAttribTabDlg::~SchAttribTabDlg()
{
+ disposeOnce();
+}
+
+void SchAttribTabDlg::dispose()
+{
delete m_pSymbolShapeProperties;
+ m_pSymbolShapeProperties = NULL;
delete m_pAutoSymbolGraphic;
+ m_pAutoSymbolGraphic = NULL;
+ SfxTabDialog::dispose();
}
void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
index 0ff8d1b10a35..ec67eb829f59 100644
--- a/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -49,9 +49,9 @@ View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XM
get(m_pTabControl, "tabcontrol");
uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
- m_pGeometry = new ThreeD_SceneGeometry_TabPage(m_pTabControl,xSceneProperties,m_aControllerLocker);
- m_pAppearance = new ThreeD_SceneAppearance_TabPage(m_pTabControl,xChartModel,m_aControllerLocker);
- m_pIllumination = new ThreeD_SceneIllumination_TabPage(m_pTabControl,xSceneProperties,xChartModel,pColorTable);
+ m_pGeometry = VclPtr<ThreeD_SceneGeometry_TabPage>::Create(m_pTabControl,xSceneProperties,m_aControllerLocker);
+ m_pAppearance = VclPtr<ThreeD_SceneAppearance_TabPage>::Create(m_pTabControl,xChartModel,m_aControllerLocker);
+ m_pIllumination = VclPtr<ThreeD_SceneIllumination_TabPage>::Create(m_pTabControl,xSceneProperties,xChartModel,pColorTable);
m_pTabControl->InsertPage( TP_3D_SCENEGEOMETRY, SCH_RESSTR(STR_PAGE_PERSPECTIVE) );
m_pTabControl->InsertPage( TP_3D_SCENEAPPEARANCE, SCH_RESSTR(STR_PAGE_APPEARANCE) );
@@ -66,11 +66,18 @@ View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XM
View3DDialog::~View3DDialog()
{
- delete m_pGeometry;
- delete m_pAppearance;
- delete m_pIllumination;
+ disposeOnce();
+}
- m_nLastPageId = m_pTabControl->GetCurPageId();
+void View3DDialog::dispose()
+{
+ m_pGeometry.disposeAndClear();
+ m_pAppearance.disposeAndClear();
+ m_pIllumination.disposeAndClear();
+ if (m_pTabControl)
+ m_nLastPageId = m_pTabControl->GetCurPageId();
+ m_pTabControl.clear();
+ TabDialog::dispose();
}
short View3DDialog::Execute()
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.hxx b/chart2/source/controller/dialogs/res_BarGeometry.hxx
index 60af3af3ccd8..7a9eeb8c17f8 100644
--- a/chart2/source/controller/dialogs/res_BarGeometry.hxx
+++ b/chart2/source/controller/dialogs/res_BarGeometry.hxx
@@ -41,8 +41,8 @@ public:
void SetSelectHdl( const Link& rLink );
private:
- FixedText* m_pFT_Geometry;
- ListBox* m_pLB_Geometry;
+ VclPtr<FixedText> m_pFT_Geometry;
+ VclPtr<ListBox> m_pLB_Geometry;
};
} //namespace chart
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index c0f2da11fccd..6f0d2b8ec022 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -205,12 +205,12 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey ));
aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat ));
- NumberFormatDialog aDlg(m_pWindow, aNumberSet);
+ ScopedVclPtrInstance< NumberFormatDialog > aDlg(m_pWindow, aNumberSet);
if( bPercent )
- aDlg.SetText( m_pFT_NumberFormatForPercent->GetText());
- if( RET_OK == aDlg.Execute() )
+ aDlg->SetText( m_pFT_NumberFormatForPercent->GetText());
+ if( RET_OK == aDlg->Execute() )
{
- const SfxItemSet* pResult = aDlg.GetOutputItemSet();
+ const SfxItemSet* pResult = aDlg->GetOutputItemSet();
if( pResult )
{
bool bOldSource = rUseSourceFormat;
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
index 9d6d0e01cd90..cfb4758cc29b 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.hxx
@@ -45,28 +45,28 @@ public:
void SetNumberFormatter( SvNumberFormatter* pFormatter );
private:
- CheckBox* m_pCBNumber;
- PushButton* m_pPB_NumberFormatForValue;
- CheckBox* m_pCBPercent;
- PushButton* m_pPB_NumberFormatForPercent;
- FixedText* m_pFT_NumberFormatForPercent;
- CheckBox* m_pCBCategory;
- CheckBox* m_pCBSymbol;
-
- VclHBox* m_pSeparatorResources;
- ListBox* m_pLB_Separator;
+ VclPtr<CheckBox> m_pCBNumber;
+ VclPtr<PushButton> m_pPB_NumberFormatForValue;
+ VclPtr<CheckBox> m_pCBPercent;
+ VclPtr<PushButton> m_pPB_NumberFormatForPercent;
+ VclPtr<FixedText> m_pFT_NumberFormatForPercent;
+ VclPtr<CheckBox> m_pCBCategory;
+ VclPtr<CheckBox> m_pCBSymbol;
+
+ VclPtr<VclHBox> m_pSeparatorResources;
+ VclPtr<ListBox> m_pLB_Separator;
OUString m_aEntryMap[NUMBER_SEPARATORS];
- VclHBox* m_pBxLabelPlacement;
- ListBox* m_pLB_LabelPlacement;
+ VclPtr<VclHBox> m_pBxLabelPlacement;
+ VclPtr<ListBox> m_pLB_LabelPlacement;
- VclHBox* m_pBxOrientation;
- svx::DialControl* m_pDC_Dial;
- FixedText* m_pFT_Dial;
- NumericField* m_pNF_Degrees;
+ VclPtr<VclHBox> m_pBxOrientation;
+ VclPtr<svx::DialControl> m_pDC_Dial;
+ VclPtr<FixedText> m_pFT_Dial;
+ VclPtr<NumericField> m_pNF_Degrees;
- VclHBox* m_pBxTextDirection;
- TextDirectionListBox* m_pLB_TextDirection;
+ VclPtr<VclHBox> m_pBxTextDirection;
+ VclPtr<TextDirectionListBox> m_pLB_TextDirection;
::std::map< sal_Int32, sal_uInt16 > m_aPlacementToListBoxMap;
::std::map< sal_uInt16, sal_Int32 > m_aListBoxToPlacementMap;
@@ -82,7 +82,7 @@ private:
bool m_bSourceFormatForValue;
bool m_bSourceFormatForPercent;
- vcl::Window* m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
SfxItemPool* m_pPool;
DECL_LINK(NumberFormatDialogHdl, PushButton * );
diff --git a/chart2/source/controller/dialogs/res_Trendline.hxx b/chart2/source/controller/dialogs/res_Trendline.hxx
index 0d4be04cdf4d..03c3ebe3bd87 100644
--- a/chart2/source/controller/dialogs/res_Trendline.hxx
+++ b/chart2/source/controller/dialogs/res_Trendline.hxx
@@ -46,29 +46,29 @@ public:
void SetNbPoints( sal_Int32 nNbPoints );
private:
- RadioButton* m_pRB_Linear;
- RadioButton* m_pRB_Logarithmic;
- RadioButton* m_pRB_Exponential;
- RadioButton* m_pRB_Power;
- RadioButton* m_pRB_Polynomial;
- RadioButton* m_pRB_MovingAverage;
-
- FixedImage* m_pFI_Linear;
- FixedImage* m_pFI_Logarithmic;
- FixedImage* m_pFI_Exponential;
- FixedImage* m_pFI_Power;
- FixedImage* m_pFI_Polynomial;
- FixedImage* m_pFI_MovingAverage;
-
- NumericField* m_pNF_Degree;
- NumericField* m_pNF_Period;
- Edit* m_pEE_Name;
- FormattedField* m_pFmtFld_ExtrapolateForward;
- FormattedField* m_pFmtFld_ExtrapolateBackward;
- CheckBox* m_pCB_SetIntercept;
- FormattedField* m_pFmtFld_InterceptValue;
- CheckBox* m_pCB_ShowEquation;
- CheckBox* m_pCB_ShowCorrelationCoeff;
+ VclPtr<RadioButton> m_pRB_Linear;
+ VclPtr<RadioButton> m_pRB_Logarithmic;
+ VclPtr<RadioButton> m_pRB_Exponential;
+ VclPtr<RadioButton> m_pRB_Power;
+ VclPtr<RadioButton> m_pRB_Polynomial;
+ VclPtr<RadioButton> m_pRB_MovingAverage;
+
+ VclPtr<FixedImage> m_pFI_Linear;
+ VclPtr<FixedImage> m_pFI_Logarithmic;
+ VclPtr<FixedImage> m_pFI_Exponential;
+ VclPtr<FixedImage> m_pFI_Power;
+ VclPtr<FixedImage> m_pFI_Polynomial;
+ VclPtr<FixedImage> m_pFI_MovingAverage;
+
+ VclPtr<NumericField> m_pNF_Degree;
+ VclPtr<NumericField> m_pNF_Period;
+ VclPtr<Edit> m_pEE_Name;
+ VclPtr<FormattedField> m_pFmtFld_ExtrapolateForward;
+ VclPtr<FormattedField> m_pFmtFld_ExtrapolateBackward;
+ VclPtr<CheckBox> m_pCB_SetIntercept;
+ VclPtr<FormattedField> m_pFmtFld_InterceptValue;
+ VclPtr<CheckBox> m_pCB_ShowEquation;
+ VclPtr<CheckBox> m_pCB_ShowCorrelationCoeff;
SvxChartRegress m_eTrendLineType;
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
index 1515c6b9899d..7c866eed86b5 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
@@ -121,7 +121,18 @@ ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(
}
ThreeD_SceneAppearance_TabPage::~ThreeD_SceneAppearance_TabPage()
-{}
+{
+ disposeOnce();
+}
+
+void ThreeD_SceneAppearance_TabPage::dispose()
+{
+ m_pLB_Scheme.clear();
+ m_pCB_Shading.clear();
+ m_pCB_ObjectLines.clear();
+ m_pCB_RoundedEdge.clear();
+ TabPage::dispose();
+}
void ThreeD_SceneAppearance_TabPage::ActivatePage()
{
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
index b674dff025dd..80720d031e87 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
@@ -39,6 +39,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel,
ControllerLockHelper & rControllerLockHelper );
virtual ~ThreeD_SceneAppearance_TabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
@@ -56,11 +57,11 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
m_xChartModel;
- ListBox* m_pLB_Scheme;
+ VclPtr<ListBox> m_pLB_Scheme;
- CheckBox* m_pCB_Shading;
- CheckBox* m_pCB_ObjectLines;
- CheckBox* m_pCB_RoundedEdge;
+ VclPtr<CheckBox> m_pCB_Shading;
+ VclPtr<CheckBox> m_pCB_ObjectLines;
+ VclPtr<CheckBox> m_pCB_RoundedEdge;
bool m_bUpdateOtherControls;
bool m_bCommitToModel;
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
index d9f3ccac74e8..e3988f975ebf 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
@@ -149,8 +149,22 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( vcl::Window* pWindow
ThreeD_SceneGeometry_TabPage::~ThreeD_SceneGeometry_TabPage()
{
+ disposeOnce();
}
+void ThreeD_SceneGeometry_TabPage::dispose()
+{
+ m_pCbxRightAngledAxes.clear();
+ m_pMFXRotation.clear();
+ m_pMFYRotation.clear();
+ m_pFtZRotation.clear();
+ m_pMFZRotation.clear();
+ m_pCbxPerspective.clear();
+ m_pMFPerspective.clear();
+ TabPage::dispose();
+}
+
+
void ThreeD_SceneGeometry_TabPage::commitPendingChanges()
{
ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
index 21bc08a7ccc1..cfd16ff23bd6 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
@@ -40,6 +40,7 @@ public:
::com::sun::star::beans::XPropertySet > & xSceneProperties,
ControllerLockHelper & rControllerLockHelper );
virtual ~ThreeD_SceneGeometry_TabPage();
+ virtual void dispose() SAL_OVERRIDE;
// has to be called in case the dialog was closed with OK
void commitPendingChanges();
@@ -64,17 +65,17 @@ private:
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > m_xSceneProperties;
- CheckBox* m_pCbxRightAngledAxes;
+ VclPtr<CheckBox> m_pCbxRightAngledAxes;
- MetricField* m_pMFXRotation;
+ VclPtr<MetricField> m_pMFXRotation;
- MetricField* m_pMFYRotation;
+ VclPtr<MetricField> m_pMFYRotation;
- FixedText* m_pFtZRotation;
- MetricField* m_pMFZRotation;
+ VclPtr<FixedText> m_pFtZRotation;
+ VclPtr<MetricField> m_pMFZRotation;
- CheckBox* m_pCbxPerspective;
- MetricField* m_pMFPerspective;
+ VclPtr<CheckBox> m_pCbxPerspective;
+ VclPtr<MetricField> m_pMFPerspective;
//to keep old values when switching to right angled axes
sal_Int64 m_nXRotation;
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 71d0d65f40f2..6f3805f7d8da 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -48,10 +48,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLightButton(vcl::Windo
return new LightButton(pParent);
}
-LightButton::~LightButton()
-{
-}
-
void LightButton::switchLightOn(bool bOn)
{
if( m_bLightOn==bOn )
@@ -82,7 +78,7 @@ struct LightSource
struct LightSourceInfo
{
- LightButton* pButton;
+ VclPtr<LightButton> pButton;
LightSource aLightSource;
LightSourceInfo();
@@ -298,7 +294,27 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( vcl::Window*
ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
{
+ disposeOnce();
+}
+
+void ThreeD_SceneIllumination_TabPage::dispose()
+{
delete[] m_pLightSourceInfoList;
+ m_pLightSourceInfoList = NULL;
+ m_pBtn_Light1.clear();
+ m_pBtn_Light2.clear();
+ m_pBtn_Light3.clear();
+ m_pBtn_Light4.clear();
+ m_pBtn_Light5.clear();
+ m_pBtn_Light6.clear();
+ m_pBtn_Light7.clear();
+ m_pBtn_Light8.clear();
+ m_pLB_LightSource.clear();
+ m_pBtn_LightSource_Color.clear();
+ m_pLB_AmbientLight.clear();
+ m_pBtn_AmbientLight_Color.clear();
+ m_pCtl_Preview.clear();
+ TabPage::dispose();
}
IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel)
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
index 5e68d8bf08e0..b7f46f26e964 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
@@ -37,7 +37,6 @@ class LightButton : public ImageButton
{
public:
LightButton( vcl::Window* pParent);
- virtual ~LightButton();
void switchLightOn(bool bOn);
bool isLightOn() const { return m_bLightOn;}
@@ -58,6 +57,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel,
const XColorListRef &pColorTable );
virtual ~ThreeD_SceneIllumination_TabPage();
+ virtual void dispose() SAL_OVERRIDE;
private:
DECL_LINK( ClickLightSourceButtonHdl, LightButton* );
@@ -74,22 +74,22 @@ private:
void applyLightSourceToModel( sal_uInt32 nLightNumber );
void applyLightSourcesToModel();
- LightButton* m_pBtn_Light1;
- LightButton* m_pBtn_Light2;
- LightButton* m_pBtn_Light3;
- LightButton* m_pBtn_Light4;
- LightButton* m_pBtn_Light5;
- LightButton* m_pBtn_Light6;
- LightButton* m_pBtn_Light7;
- LightButton* m_pBtn_Light8;
+ VclPtr<LightButton> m_pBtn_Light1;
+ VclPtr<LightButton> m_pBtn_Light2;
+ VclPtr<LightButton> m_pBtn_Light3;
+ VclPtr<LightButton> m_pBtn_Light4;
+ VclPtr<LightButton> m_pBtn_Light5;
+ VclPtr<LightButton> m_pBtn_Light6;
+ VclPtr<LightButton> m_pBtn_Light7;
+ VclPtr<LightButton> m_pBtn_Light8;
- ColorLB* m_pLB_LightSource;
- PushButton* m_pBtn_LightSource_Color;
+ VclPtr<ColorLB> m_pLB_LightSource;
+ VclPtr<PushButton> m_pBtn_LightSource_Color;
- ColorLB* m_pLB_AmbientLight;
- PushButton* m_pBtn_AmbientLight_Color;
+ VclPtr<ColorLB> m_pLB_AmbientLight;
+ VclPtr<PushButton> m_pBtn_AmbientLight_Color;
- SvxLightCtl3D* m_pCtl_Preview;
+ VclPtr<SvxLightCtl3D> m_pCtl_Preview;
LightSourceInfo* m_pLightSourceInfoList;
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
index 77a426f4bba3..c9f53c5f5008 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -71,11 +71,37 @@ SchAxisLabelTabPage::SchAxisLabelTabPage( vcl::Window* pParent, const SfxItemSet
}
SchAxisLabelTabPage::~SchAxisLabelTabPage()
-{delete m_pOrientHlp;}
+{
+ disposeOnce();
+}
+
+void SchAxisLabelTabPage::dispose()
+{
+ delete m_pOrientHlp;
+ m_pOrientHlp = NULL;
+ m_pCbShowDescription.clear();
+ m_pFlOrder.clear();
+ m_pRbSideBySide.clear();
+ m_pRbUpDown.clear();
+ m_pRbDownUp.clear();
+ m_pRbAuto.clear();
+ m_pFlTextFlow.clear();
+ m_pCbTextOverlap.clear();
+ m_pCbTextBreak.clear();
+ m_pFtABCD.clear();
+ m_pFlOrient.clear();
+ m_pCtrlDial.clear();
+ m_pFtRotate.clear();
+ m_pNfRotate.clear();
+ m_pCbStacked.clear();
+ m_pFtTextDirection.clear();
+ m_pLbTextDirection.clear();
+ SfxTabPage::dispose();
+}
-SfxTabPage* SchAxisLabelTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SchAxisLabelTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrs )
{
- return new SchAxisLabelTabPage( pParent, *rAttrs );
+ return VclPtr<SchAxisLabelTabPage>::Create( pParent, *rAttrs );
}
bool SchAxisLabelTabPage::FillItemSet( SfxItemSet* rOutAttrs )
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
index 0aa09b53b823..ef591d0ea028 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -35,27 +35,27 @@ namespace chart
class SchAxisLabelTabPage : public SfxTabPage
{
private:
- CheckBox* m_pCbShowDescription;
+ VclPtr<CheckBox> m_pCbShowDescription;
- FixedText* m_pFlOrder;
- RadioButton* m_pRbSideBySide;
- RadioButton* m_pRbUpDown;
- RadioButton* m_pRbDownUp;
- RadioButton* m_pRbAuto;
+ VclPtr<FixedText> m_pFlOrder;
+ VclPtr<RadioButton> m_pRbSideBySide;
+ VclPtr<RadioButton> m_pRbUpDown;
+ VclPtr<RadioButton> m_pRbDownUp;
+ VclPtr<RadioButton> m_pRbAuto;
- FixedText* m_pFlTextFlow;
- CheckBox* m_pCbTextOverlap;
- CheckBox* m_pCbTextBreak;
- FixedText* m_pFtABCD;
- FixedText* m_pFlOrient;
- svx::DialControl* m_pCtrlDial;
- FixedText* m_pFtRotate;
- NumericField* m_pNfRotate;
- TriStateBox* m_pCbStacked;
+ VclPtr<FixedText> m_pFlTextFlow;
+ VclPtr<CheckBox> m_pCbTextOverlap;
+ VclPtr<CheckBox> m_pCbTextBreak;
+ VclPtr<FixedText> m_pFtABCD;
+ VclPtr<FixedText> m_pFlOrient;
+ VclPtr<svx::DialControl> m_pCtrlDial;
+ VclPtr<FixedText> m_pFtRotate;
+ VclPtr<NumericField> m_pNfRotate;
+ VclPtr<TriStateBox> m_pCbStacked;
svx::OrientationHelper* m_pOrientHlp;
- FixedText* m_pFtTextDirection;
- TextDirectionListBox* m_pLbTextDirection;
+ VclPtr<FixedText> m_pFtTextDirection;
+ VclPtr<TextDirectionListBox> m_pLbTextDirection;
bool m_bShowStaggeringControls;
@@ -70,8 +70,9 @@ private:
public:
SchAxisLabelTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SchAxisLabelTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rInAttrs ) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
index c74605624733..83fa72fa21f1 100644
--- a/chart2/source/controller/dialogs/tp_AxisPositions.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
@@ -84,9 +84,33 @@ AxisPositionsTabPage::AxisPositionsTabPage(vcl::Window* pWindow,const SfxItemSet
m_pLB_PlaceTicks->SetDropDownLineCount( m_pLB_PlaceTicks->GetEntryCount() );
}
-SfxTabPage* AxisPositionsTabPage::Create(vcl::Window* pWindow,const SfxItemSet* rOutAttrs)
+AxisPositionsTabPage::~AxisPositionsTabPage()
{
- return new AxisPositionsTabPage(pWindow, *rOutAttrs);
+ disposeOnce();
+}
+
+void AxisPositionsTabPage::dispose()
+{
+ m_pFL_AxisLine.clear();
+ m_pLB_CrossesAt.clear();
+ m_pED_CrossesAt.clear();
+ m_pED_CrossesAtCategory.clear();
+ m_pCB_AxisBetweenCategories.clear();
+ m_pFL_Labels.clear();
+ m_pLB_PlaceLabels.clear();
+ m_pED_LabelDistance.clear();
+ m_pCB_TicksInner.clear();
+ m_pCB_TicksOuter.clear();
+ m_pCB_MinorInner.clear();
+ m_pCB_MinorOuter.clear();
+ m_pBxPlaceTicks.clear();
+ m_pLB_PlaceTicks.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> AxisPositionsTabPage::Create(vcl::Window* pWindow,const SfxItemSet* rOutAttrs)
+{
+ return VclPtr<AxisPositionsTabPage>::Create(pWindow, *rOutAttrs);
}
bool AxisPositionsTabPage::FillItemSet(SfxItemSet* rOutAttrs)
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.hxx b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
index 61eb83c2dacd..a05ae58aeb49 100644
--- a/chart2/source/controller/dialogs/tp_AxisPositions.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
@@ -33,8 +33,10 @@ class AxisPositionsTabPage : public SfxTabPage
{
public:
AxisPositionsTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~AxisPositionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rInAttrs ) SAL_OVERRIDE;
using TabPage::DeactivatePage;
@@ -52,30 +54,30 @@ private: //methods:
DECL_LINK( PlaceLabelsSelectHdl, void* );
private: //member:
- VclFrame* m_pFL_AxisLine;
- ListBox* m_pLB_CrossesAt;
- FormattedField* m_pED_CrossesAt;
- ComboBox* m_pED_CrossesAtCategory;
- CheckBox* m_pCB_AxisBetweenCategories;
+ VclPtr<VclFrame> m_pFL_AxisLine;
+ VclPtr<ListBox> m_pLB_CrossesAt;
+ VclPtr<FormattedField> m_pED_CrossesAt;
+ VclPtr<ComboBox> m_pED_CrossesAtCategory;
+ VclPtr<CheckBox> m_pCB_AxisBetweenCategories;
- VclFrame* m_pFL_Labels;
- ListBox* m_pLB_PlaceLabels;
- FormattedField* m_pED_LabelDistance;
+ VclPtr<VclFrame> m_pFL_Labels;
+ VclPtr<ListBox> m_pLB_PlaceLabels;
+ VclPtr<FormattedField> m_pED_LabelDistance;
- CheckBox* m_pCB_TicksInner;
- CheckBox* m_pCB_TicksOuter;
+ VclPtr<CheckBox> m_pCB_TicksInner;
+ VclPtr<CheckBox> m_pCB_TicksOuter;
- CheckBox* m_pCB_MinorInner;
- CheckBox* m_pCB_MinorOuter;
+ VclPtr<CheckBox> m_pCB_MinorInner;
+ VclPtr<CheckBox> m_pCB_MinorOuter;
- VclBox* m_pBxPlaceTicks;
- ListBox* m_pLB_PlaceTicks;
+ VclPtr<VclBox> m_pBxPlaceTicks;
+ VclPtr<ListBox> m_pLB_PlaceTicks;
// Not implemented
-// CheckBox* m_pCB_MajorGrid;
-// PushButton* m_pPB_MajorGrid;
-// CheckBox* m_pCB_MinorGrid;
-// PushButton* m_pPB_MinorGrid;
+// VclPtr<CheckBox> m_pCB_MajorGrid;
+// VclPtr<PushButton> m_pPB_MajorGrid;
+// VclPtr<CheckBox> m_pCB_MinorGrid;
+// VclPtr<PushButton> m_pPB_MinorGrid;
SvNumberFormatter* m_pNumFormatter;
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 1ae7a691756a..5a13c68988fa 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -56,8 +56,8 @@ private:
DECL_LINK( SelectSchemeHdl, void* );
private:
- CheckBox* m_pCB_3DLook;
- ListBox* m_pLB_Scheme;
+ VclPtr<CheckBox> m_pCB_3DLook;
+ VclPtr<ListBox> m_pLB_Scheme;
};
Dim3DLookResourceGroup::Dim3DLookResourceGroup(VclBuilderContainer* pWindow)
@@ -129,7 +129,7 @@ private:
DECL_LINK( SortByXValuesCheckHdl, void* );
private:
- CheckBox* m_pCB_XValueSorting;
+ VclPtr<CheckBox> m_pCB_XValueSorting;
};
SortByXValuesResourceGroup::SortByXValuesResourceGroup(VclBuilderContainer* pWindow )
@@ -176,10 +176,10 @@ private:
DECL_LINK( StackingEnableHdl, void* );
private:
- CheckBox* m_pCB_Stacked;
- RadioButton* m_pRB_Stack_Y;
- RadioButton* m_pRB_Stack_Y_Percent;
- RadioButton* m_pRB_Stack_Z;
+ VclPtr<CheckBox> m_pCB_Stacked;
+ VclPtr<RadioButton> m_pRB_Stack_Y;
+ VclPtr<RadioButton> m_pRB_Stack_Y_Percent;
+ VclPtr<RadioButton> m_pRB_Stack_Z;
bool m_bShowDeepStacking;
};
@@ -278,7 +278,7 @@ public:
private:
DECL_LINK( SettingChangedHdl, void* );
private:
- CheckBox* m_pCB_RoundedEdge;
+ VclPtr<CheckBox> m_pCB_RoundedEdge;
};
GL3DResourceGroup::GL3DResourceGroup( VclBuilderContainer* pWindow )
@@ -313,7 +313,8 @@ class SplinePropertiesDialog : public ModalDialog
{
public:
SplinePropertiesDialog( vcl::Window* pParent );
- virtual ~SplinePropertiesDialog();
+ virtual ~SplinePropertiesDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
void fillControls( const ChartTypeParameter& rParameter );
void fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines );
@@ -324,11 +325,11 @@ private:
DECL_LINK( SplineTypeListBoxHdl, void* );
private:
- ListBox* m_pLB_Spline_Type;
+ VclPtr<ListBox> m_pLB_Spline_Type;
- NumericField* m_pMF_SplineResolution;
- FixedText* m_pFT_SplineOrder;
- NumericField* m_pMF_SplineOrder;
+ VclPtr<NumericField> m_pMF_SplineResolution;
+ VclPtr<FixedText> m_pFT_SplineOrder;
+ VclPtr<NumericField> m_pMF_SplineOrder;
};
const sal_uInt16 CUBIC_SPLINE_POS = 0;
@@ -347,8 +348,13 @@ SplinePropertiesDialog::SplinePropertiesDialog( vcl::Window* pParent )
m_pLB_Spline_Type->SetSelectHdl( LINK (this, SplinePropertiesDialog, SplineTypeListBoxHdl ) );
}
-SplinePropertiesDialog::~SplinePropertiesDialog()
+void SplinePropertiesDialog::dispose()
{
+ m_pLB_Spline_Type.clear();
+ m_pMF_SplineResolution.clear();
+ m_pFT_SplineOrder.clear();
+ m_pMF_SplineOrder.clear();
+ ModalDialog::dispose();
}
void SplinePropertiesDialog::StateChanged( StateChangedType nType )
@@ -400,7 +406,8 @@ class SteppedPropertiesDialog : public ModalDialog
{
public:
SteppedPropertiesDialog( vcl::Window* pParent );
- virtual ~SteppedPropertiesDialog();
+ virtual ~SteppedPropertiesDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
void fillControls( const ChartTypeParameter& rParameter );
void fillParameter( ChartTypeParameter& rParameter, bool bSteppedLines );
@@ -410,10 +417,10 @@ public:
private:
private:
- RadioButton* m_pRB_Start;
- RadioButton* m_pRB_End;
- RadioButton* m_pRB_CenterX;
- RadioButton* m_pRB_CenterY;
+ VclPtr<RadioButton> m_pRB_Start;
+ VclPtr<RadioButton> m_pRB_End;
+ VclPtr<RadioButton> m_pRB_CenterX;
+ VclPtr<RadioButton> m_pRB_CenterY;
};
SteppedPropertiesDialog::SteppedPropertiesDialog( vcl::Window* pParent )
@@ -427,8 +434,13 @@ SteppedPropertiesDialog::SteppedPropertiesDialog( vcl::Window* pParent )
SetText(SCH_RESSTR(STR_DLG_STEPPED_LINE_PROPERTIES));
}
-SteppedPropertiesDialog::~SteppedPropertiesDialog()
+void SteppedPropertiesDialog::dispose()
{
+ m_pRB_Start.clear();
+ m_pRB_End.clear();
+ m_pRB_CenterX.clear();
+ m_pRB_CenterY.clear();
+ ModalDialog::dispose();
}
void SteppedPropertiesDialog::StateChanged( StateChangedType nType )
@@ -490,11 +502,11 @@ private:
SteppedPropertiesDialog& getSteppedPropertiesDialog();
private:
- FixedText* m_pFT_LineType;
- ListBox* m_pLB_LineType;
- PushButton* m_pPB_DetailsDialog;
- boost::scoped_ptr< SplinePropertiesDialog > m_pSplinePropertiesDialog;
- boost::scoped_ptr< SteppedPropertiesDialog > m_pSteppedPropertiesDialog;
+ VclPtr<FixedText> m_pFT_LineType;
+ VclPtr<ListBox> m_pLB_LineType;
+ VclPtr<PushButton> m_pPB_DetailsDialog;
+ VclPtr< SplinePropertiesDialog > m_pSplinePropertiesDialog;
+ VclPtr< SteppedPropertiesDialog > m_pSteppedPropertiesDialog;
};
SplineResourceGroup::SplineResourceGroup(VclBuilderContainer* pWindow)
@@ -510,7 +522,7 @@ SplineResourceGroup::SplineResourceGroup(VclBuilderContainer* pWindow)
SplinePropertiesDialog& SplineResourceGroup::getSplinePropertiesDialog()
{
if( !m_pSplinePropertiesDialog.get() )
- m_pSplinePropertiesDialog.reset( new SplinePropertiesDialog( m_pPB_DetailsDialog->GetParentDialog() ) );
+ m_pSplinePropertiesDialog.reset( VclPtr<SplinePropertiesDialog>::Create( m_pPB_DetailsDialog->GetParentDialog() ) );
return *m_pSplinePropertiesDialog;
}
@@ -518,7 +530,7 @@ SteppedPropertiesDialog& SplineResourceGroup::getSteppedPropertiesDialog()
{
if( !m_pSteppedPropertiesDialog.get() )
{
- m_pSteppedPropertiesDialog.reset( new SteppedPropertiesDialog( m_pPB_DetailsDialog->GetParentDialog() ) );
+ m_pSteppedPropertiesDialog.reset( VclPtr<SteppedPropertiesDialog>::Create( m_pPB_DetailsDialog->GetParentDialog() ) );
}
return *m_pSteppedPropertiesDialog;
}
@@ -774,6 +786,11 @@ ChartTypeTabPage::ChartTypeTabPage(vcl::Window* pParent
ChartTypeTabPage::~ChartTypeTabPage()
{
+ disposeOnce();
+}
+
+void ChartTypeTabPage::dispose()
+{
//delete all dialog controller
::std::vector< ChartTypeDialogController* >::const_iterator aIter = m_aChartTypeDialogControllerList.begin();
const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
@@ -785,12 +802,23 @@ ChartTypeTabPage::~ChartTypeTabPage()
//delete all resource helper
delete m_pDim3DLookResourceGroup;
+ m_pDim3DLookResourceGroup = NULL;
delete m_pStackingResourceGroup;
+ m_pStackingResourceGroup = NULL;
delete m_pSplineResourceGroup;
+ m_pSplineResourceGroup = NULL;
delete m_pGeometryResourceGroup;
+ m_pGeometryResourceGroup = NULL;
delete m_pSortByXValuesResourceGroup;
+ m_pSortByXValuesResourceGroup = NULL;
delete m_pGL3DResourceGroup;
+ m_pGL3DResourceGroup = NULL;
+ m_pFT_ChooseType.clear();
+ m_pMainTypeList.clear();
+ m_pSubTypeList.clear();
+ svt::OWizardPage::dispose();
}
+
ChartTypeParameter ChartTypeTabPage::getCurrentParamter() const
{
ChartTypeParameter aParameter;
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx
index 486ae1540805..4ed830b10535 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.hxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.hxx
@@ -55,6 +55,7 @@ public:
::com::sun::star::uno::XComponentContext >& xContext
, bool bDoLiveUpdate, bool bShowDescription = true );
virtual ~ChartTypeTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void initializePage() SAL_OVERRIDE;
virtual bool commitPage( ::svt::WizardTypes::CommitPageReason eReason ) SAL_OVERRIDE;
@@ -77,9 +78,9 @@ protected:
DECL_LINK( SelectSubTypeHdl, void* );
protected:
- FixedText* m_pFT_ChooseType;
- ListBox* m_pMainTypeList;
- ValueSet* m_pSubTypeList;
+ VclPtr<FixedText> m_pFT_ChooseType;
+ VclPtr<ListBox> m_pMainTypeList;
+ VclPtr<ValueSet> m_pSubTypeList;
Dim3DLookResourceGroup* m_pDim3DLookResourceGroup;
StackingResourceGroup* m_pStackingResourceGroup;
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx
index ef795fa2e2ca..432290d78201 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx
@@ -34,13 +34,9 @@ DataLabelsTabPage::DataLabelsTabPage(vcl::Window* pWindow, const SfxItemSet& rIn
{
}
-DataLabelsTabPage::~DataLabelsTabPage()
+VclPtr<SfxTabPage> DataLabelsTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rOutAttrs)
{
-}
-
-SfxTabPage* DataLabelsTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rOutAttrs)
-{
- return new DataLabelsTabPage(pWindow, *rOutAttrs);
+ return VclPtr<DataLabelsTabPage>::Create(pWindow, *rOutAttrs);
}
bool DataLabelsTabPage::FillItemSet(SfxItemSet* rOutAttrs)
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.hxx b/chart2/source/controller/dialogs/tp_DataLabel.hxx
index 1bad928af04d..0699b8a02d9d 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_DataLabel.hxx
@@ -34,9 +34,8 @@ class DataLabelsTabPage : public SfxTabPage
{
public:
DataLabelsTabPage(vcl::Window* pWindow, const SfxItemSet& rInAttrs);
- virtual ~DataLabelsTabPage();
- static SfxTabPage* Create(vcl::Window* pWindow, const SfxItemSet* rInAttrs);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pWindow, const SfxItemSet* rInAttrs);
void SetNumberFormatter( SvNumberFormatter* pFormatter );
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index d265e8ab7859..c3149fea8fbe 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -274,7 +274,32 @@ DataSourceTabPage::DataSourceTabPage(
}
DataSourceTabPage::~DataSourceTabPage()
-{}
+{
+ disposeOnce();
+}
+
+void DataSourceTabPage::dispose()
+{
+ m_pFT_CAPTION.clear();
+ m_pFT_SERIES.clear();
+ m_pLB_SERIES.clear();
+ m_pBTN_ADD.clear();
+ m_pBTN_REMOVE.clear();
+ m_pBTN_UP.clear();
+ m_pBTN_DOWN.clear();
+ m_pFT_ROLE.clear();
+ m_pLB_ROLE.clear();
+ m_pFT_RANGE.clear();
+ m_pEDT_RANGE.clear();
+ m_pIMB_RANGE_MAIN.clear();
+ m_pFT_CATEGORIES.clear();
+ m_pFT_DATALABELS.clear();
+ m_pEDT_CATEGORIES.clear();
+ m_pIMB_RANGE_CAT.clear();
+ m_pCurrentRangeChoosingField.clear();
+ m_pParentDialog.clear();
+ ::svt::OWizardPage::dispose();
+}
void DataSourceTabPage::ActivatePage()
{
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
index 1cc0439a1065..59b92bf840c3 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -59,6 +59,7 @@ public:
Dialog * pParentDialog,
bool bHideDescription = false );
virtual ~DataSourceTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void commitPage();
@@ -118,34 +119,34 @@ protected:
void fillRoleListBox();
private:
- FixedText* m_pFT_CAPTION;
- FixedText* m_pFT_SERIES;
- SvTreeListBox* m_pLB_SERIES;
- PushButton* m_pBTN_ADD;
- PushButton* m_pBTN_REMOVE;
- PushButton* m_pBTN_UP;
- PushButton* m_pBTN_DOWN;
-
- FixedText* m_pFT_ROLE;
- SvTabListBox* m_pLB_ROLE;
- FixedText* m_pFT_RANGE;
- Edit* m_pEDT_RANGE;
- PushButton* m_pIMB_RANGE_MAIN;
-
- FixedText* m_pFT_CATEGORIES;
- FixedText* m_pFT_DATALABELS;//used for xy charts
- Edit* m_pEDT_CATEGORIES;
- PushButton* m_pIMB_RANGE_CAT;
+ VclPtr<FixedText> m_pFT_CAPTION;
+ VclPtr<FixedText> m_pFT_SERIES;
+ VclPtr<SvTreeListBox> m_pLB_SERIES;
+ VclPtr<PushButton> m_pBTN_ADD;
+ VclPtr<PushButton> m_pBTN_REMOVE;
+ VclPtr<PushButton> m_pBTN_UP;
+ VclPtr<PushButton> m_pBTN_DOWN;
+
+ VclPtr<FixedText> m_pFT_ROLE;
+ VclPtr<SvTabListBox> m_pLB_ROLE;
+ VclPtr<FixedText> m_pFT_RANGE;
+ VclPtr<Edit> m_pEDT_RANGE;
+ VclPtr<PushButton> m_pIMB_RANGE_MAIN;
+
+ VclPtr<FixedText> m_pFT_CATEGORIES;
+ VclPtr<FixedText> m_pFT_DATALABELS;//used for xy charts
+ VclPtr<Edit> m_pEDT_CATEGORIES;
+ VclPtr<PushButton> m_pIMB_RANGE_CAT;
OUString m_aFixedTextRange;
ChartTypeTemplateProvider * m_pTemplateProvider;
DialogModel & m_rDialogModel;
- Edit * m_pCurrentRangeChoosingField;
+ VclPtr<Edit> m_pCurrentRangeChoosingField;
bool m_bIsDirty;
sal_Int32 m_nLastChartTypeGroupIndex;
- Dialog * m_pParentDialog;
+ VclPtr<Dialog> m_pParentDialog;
TabPageNotifiable * m_pTabPageNotifiable;
};
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.cxx b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
index 4d58bb7f91a8..adac35ea9c87 100644
--- a/chart2/source/controller/dialogs/tp_ErrorBars.cxx
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
@@ -41,10 +41,10 @@ ErrorBarsTabPage::ErrorBarsTabPage( vcl::Window* pParent, const SfxItemSet& rInA
{
}
-SfxTabPage* ErrorBarsTabPage::Create(
+VclPtr<SfxTabPage> ErrorBarsTabPage::Create(
vcl::Window* pParent, const SfxItemSet* rOutAttrs )
{
- return new ErrorBarsTabPage( pParent, *rOutAttrs );
+ return VclPtr<ErrorBarsTabPage>::Create( pParent, *rOutAttrs );
}
bool ErrorBarsTabPage::FillItemSet( SfxItemSet* rOutAttrs )
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.hxx b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
index 6da7692d8c9f..4ac8bdbcd0bd 100644
--- a/chart2/source/controller/dialogs/tp_ErrorBars.hxx
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
@@ -37,7 +37,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDocument );
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rInAttrs ) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
index 707324fb8610..1a264f5b6b4f 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
@@ -41,9 +41,21 @@ SchLegendPosTabPage::SchLegendPosTabPage(vcl::Window* pWindow, const SfxItemSet&
m_pLbTextDirection->SetDropDownLineCount(3);
}
-SfxTabPage* SchLegendPosTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rOutAttrs)
+SchLegendPosTabPage::~SchLegendPosTabPage()
{
- return new SchLegendPosTabPage(pWindow, *rOutAttrs);
+ disposeOnce();
+}
+
+void SchLegendPosTabPage::dispose()
+{
+ m_pLbTextDirection.clear();
+ SfxTabPage::dispose();
+}
+
+
+VclPtr<SfxTabPage> SchLegendPosTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rOutAttrs)
+{
+ return VclPtr<SchLegendPosTabPage>::Create(pWindow, *rOutAttrs);
}
bool SchLegendPosTabPage::FillItemSet(SfxItemSet* rOutAttrs)
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
index 0d4f4acf0d07..13f46f21f9b7 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
@@ -33,12 +33,14 @@ class SchLegendPosTabPage : public SfxTabPage
private:
LegendPositionResources m_aLegendPositionResources;
- TextDirectionListBox* m_pLbTextDirection;
+ VclPtr<TextDirectionListBox> m_pLbTextDirection;
public:
SchLegendPosTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~SchLegendPosTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet* rInAttrs) SAL_OVERRIDE;
};
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
index 3abb60bbc5fb..5975806aa9f1 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -39,13 +39,20 @@ SchLayoutTabPage::SchLayoutTabPage(vcl::Window* pWindow,const SfxItemSet& rInAtt
SchLayoutTabPage::~SchLayoutTabPage()
{
+ disposeOnce();
+}
+
+void SchLayoutTabPage::dispose()
+{
delete m_pGeometryResources;
+ m_pGeometryResources = NULL;
+ SfxTabPage::dispose();
}
-SfxTabPage* SchLayoutTabPage::Create(vcl::Window* pWindow,
- const SfxItemSet* rOutAttrs)
+VclPtr<SfxTabPage> SchLayoutTabPage::Create(vcl::Window* pWindow,
+ const SfxItemSet* rOutAttrs)
{
- return new SchLayoutTabPage(pWindow, *rOutAttrs);
+ return VclPtr<SchLayoutTabPage>::Create(pWindow, *rOutAttrs);
}
bool SchLayoutTabPage::FillItemSet(SfxItemSet* rOutAttrs)
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.hxx b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
index 635768fe1178..7283f5f6cb50 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
@@ -30,8 +30,9 @@ class SchLayoutTabPage : public SfxTabPage
public:
SchLayoutTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs);
virtual ~SchLayoutTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet* rInAttrs) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index dbd0c460df28..d01f02b97cb8 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -46,11 +46,23 @@ PolarOptionsTabPage::PolarOptionsTabPage( vcl::Window* pWindow,const SfxItemSet&
PolarOptionsTabPage::~PolarOptionsTabPage()
{
+ disposeOnce();
}
-SfxTabPage* PolarOptionsTabPage::Create( vcl::Window* pWindow,const SfxItemSet* rOutAttrs )
+void PolarOptionsTabPage::dispose()
{
- return new PolarOptionsTabPage( pWindow, *rOutAttrs );
+ m_pCB_Clockwise.clear();
+ m_pFL_StartingAngle.clear();
+ m_pAngleDial.clear();
+ m_pNF_StartingAngle.clear();
+ m_pFL_PlotOptions.clear();
+ m_pCB_IncludeHiddenCells.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> PolarOptionsTabPage::Create( vcl::Window* pWindow,const SfxItemSet* rOutAttrs )
+{
+ return VclPtr<PolarOptionsTabPage>::Create( pWindow, *rOutAttrs );
}
bool PolarOptionsTabPage::FillItemSet( SfxItemSet* rOutAttrs )
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
index 7d0ea5034122..0b65cb745671 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.hxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
@@ -34,18 +34,19 @@ class PolarOptionsTabPage : public SfxTabPage
public:
PolarOptionsTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~PolarOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet* rInAttrs) SAL_OVERRIDE;
private:
- CheckBox* m_pCB_Clockwise;
- VclFrame* m_pFL_StartingAngle;
- svx::DialControl* m_pAngleDial;
- NumericField* m_pNF_StartingAngle;
- VclFrame* m_pFL_PlotOptions;
- CheckBox* m_pCB_IncludeHiddenCells;
+ VclPtr<CheckBox> m_pCB_Clockwise;
+ VclPtr<VclFrame> m_pFL_StartingAngle;
+ VclPtr<svx::DialControl> m_pAngleDial;
+ VclPtr<NumericField> m_pNF_StartingAngle;
+ VclPtr<VclFrame> m_pFL_PlotOptions;
+ VclPtr<CheckBox> m_pCB_IncludeHiddenCells;
};
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
index a5b498661fed..81189258c9ee 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -124,8 +124,28 @@ RangeChooserTabPage::RangeChooserTabPage( vcl::Window* pParent
RangeChooserTabPage::~RangeChooserTabPage()
{
+ disposeOnce();
}
+void RangeChooserTabPage::dispose()
+{
+ m_pFT_Caption.clear();
+ m_pFT_Range.clear();
+ m_pED_Range.clear();
+ m_pIB_Range.clear();
+ m_pRB_Rows.clear();
+ m_pRB_Columns.clear();
+ m_pCB_FirstRowAsLabel.clear();
+ m_pCB_FirstColumnAsLabel.clear();
+ m_pFTTitle.clear();
+ m_pCB_TimeBased.clear();
+ m_pEd_TimeStart.clear();
+ m_pEd_TimeEnd.clear();
+ m_pParentDialog.clear();
+ OWizardPage::dispose();
+}
+
+
void RangeChooserTabPage::ActivatePage()
{
OWizardPage::ActivatePage();
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
index 3b88a46dd845..5bcda3593f8b 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
@@ -48,7 +48,8 @@ public:
, ChartTypeTemplateProvider* pTemplateProvider
, Dialog * pParentDialog
, bool bHideDescription = false );
-virtual ~RangeChooserTabPage();
+ virtual ~RangeChooserTabPage();
+ virtual void dispose() SAL_OVERRIDE;
//RangeSelectionListenerParent
virtual void listeningFinished( const OUString & rNewRange ) SAL_OVERRIDE;
@@ -76,21 +77,21 @@ protected: //methods
protected: //member
- FixedText* m_pFT_Caption;
- FixedText* m_pFT_Range;
- Edit* m_pED_Range;
- PushButton* m_pIB_Range;
+ VclPtr<FixedText> m_pFT_Caption;
+ VclPtr<FixedText> m_pFT_Range;
+ VclPtr<Edit> m_pED_Range;
+ VclPtr<PushButton> m_pIB_Range;
- RadioButton* m_pRB_Rows;
- RadioButton* m_pRB_Columns;
+ VclPtr<RadioButton> m_pRB_Rows;
+ VclPtr<RadioButton> m_pRB_Columns;
- CheckBox* m_pCB_FirstRowAsLabel;
- CheckBox* m_pCB_FirstColumnAsLabel;
- FixedText* m_pFTTitle;
+ VclPtr<CheckBox> m_pCB_FirstRowAsLabel;
+ VclPtr<CheckBox> m_pCB_FirstColumnAsLabel;
+ VclPtr<FixedText> m_pFTTitle;
- CheckBox* m_pCB_TimeBased;
- Edit* m_pEd_TimeStart;
- Edit* m_pEd_TimeEnd;
+ VclPtr<CheckBox> m_pCB_TimeBased;
+ VclPtr<Edit> m_pEd_TimeStart;
+ VclPtr<Edit> m_pEd_TimeEnd;
sal_Int32 m_nChangingControlCalls;
bool m_bIsDirty;
@@ -106,7 +107,7 @@ protected: //member
ChartTypeTemplateProvider* m_pTemplateProvider;
DialogModel & m_rDialogModel;
- Dialog * m_pParentDialog;
+ VclPtr<Dialog> m_pParentDialog;
TabPageNotifiable * m_pTabPageNotifiable;
};
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index 875c71f9c991..cca20e82289e 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -122,6 +122,41 @@ ScaleTabPage::ScaleTabPage(vcl::Window* pWindow,const SfxItemSet& rInAttrs) :
HideAllControls();
}
+ScaleTabPage::~ScaleTabPage()
+{
+ disposeOnce();
+}
+
+void ScaleTabPage::dispose()
+{
+ m_pCbxReverse.clear();
+ m_pCbxLogarithm.clear();
+ m_pBxType.clear();
+ m_pLB_AxisType.clear();
+ m_pBxMinMax.clear();
+ m_pFmtFldMin.clear();
+ m_pCbxAutoMin.clear();
+ m_pFmtFldMax.clear();
+ m_pCbxAutoMax.clear();
+ m_pBxResolution.clear();
+ m_pLB_TimeResolution.clear();
+ m_pCbx_AutoTimeResolution.clear();
+ m_pTxtMain.clear();
+ m_pFmtFldStepMain.clear();
+ m_pMt_MainDateStep.clear();
+ m_pLB_MainTimeUnit.clear();
+ m_pCbxAutoStepMain.clear();
+ m_pTxtHelpCount.clear();
+ m_pTxtHelp.clear();
+ m_pMtStepHelp.clear();
+ m_pLB_HelpTimeUnit.clear();
+ m_pCbxAutoStepHelp.clear();
+ m_pFmtFldOrigin.clear();
+ m_pCbxAutoOrigin.clear();
+ m_pBxOrigin.clear();
+ SfxTabPage::dispose();
+}
+
IMPL_LINK( ScaleTabPage, FmtFieldModifiedHdl, FormattedField*, pFmtFied )
{
if( pFmtFied )
@@ -236,9 +271,9 @@ IMPL_LINK_NOARG(ScaleTabPage, SelectAxisTypeHdl)
return 0;
}
-SfxTabPage* ScaleTabPage::Create(vcl::Window* pWindow,const SfxItemSet* rOutAttrs)
+VclPtr<SfxTabPage> ScaleTabPage::Create(vcl::Window* pWindow,const SfxItemSet* rOutAttrs)
{
- return new ScaleTabPage(pWindow, *rOutAttrs);
+ return VclPtr<ScaleTabPage>::Create(pWindow, *rOutAttrs);
}
bool ScaleTabPage::FillItemSet(SfxItemSet* rOutAttrs)
diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx
index 3f0a99caa460..2f5a66c6c1dd 100644
--- a/chart2/source/controller/dialogs/tp_Scale.hxx
+++ b/chart2/source/controller/dialogs/tp_Scale.hxx
@@ -33,8 +33,10 @@ class ScaleTabPage : public SfxTabPage
{
public:
ScaleTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~ScaleTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rInAttrs ) SAL_OVERRIDE;
using TabPage::DeactivatePage;
@@ -48,38 +50,38 @@ public:
virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
private:
- CheckBox* m_pCbxReverse;
- CheckBox* m_pCbxLogarithm;
-
- VclBox* m_pBxType;
- ListBox* m_pLB_AxisType;
-
- VclGrid* m_pBxMinMax;
- FormattedField* m_pFmtFldMin;
- CheckBox* m_pCbxAutoMin;
-
- FormattedField* m_pFmtFldMax;
- CheckBox* m_pCbxAutoMax;
-
- VclBox* m_pBxResolution;
- ListBox* m_pLB_TimeResolution;
- CheckBox* m_pCbx_AutoTimeResolution;
-
- FixedText* m_pTxtMain;
- FormattedField* m_pFmtFldStepMain;
- MetricField* m_pMt_MainDateStep;
- ListBox* m_pLB_MainTimeUnit;
- CheckBox* m_pCbxAutoStepMain;
-
- FixedText* m_pTxtHelpCount;
- FixedText* m_pTxtHelp;
- MetricField* m_pMtStepHelp;
- ListBox* m_pLB_HelpTimeUnit;
- CheckBox* m_pCbxAutoStepHelp;
-
- FormattedField* m_pFmtFldOrigin;
- CheckBox* m_pCbxAutoOrigin;
- VclBox* m_pBxOrigin;
+ VclPtr<CheckBox> m_pCbxReverse;
+ VclPtr<CheckBox> m_pCbxLogarithm;
+
+ VclPtr<VclBox> m_pBxType;
+ VclPtr<ListBox> m_pLB_AxisType;
+
+ VclPtr<VclGrid> m_pBxMinMax;
+ VclPtr<FormattedField> m_pFmtFldMin;
+ VclPtr<CheckBox> m_pCbxAutoMin;
+
+ VclPtr<FormattedField> m_pFmtFldMax;
+ VclPtr<CheckBox> m_pCbxAutoMax;
+
+ VclPtr<VclBox> m_pBxResolution;
+ VclPtr<ListBox> m_pLB_TimeResolution;
+ VclPtr<CheckBox> m_pCbx_AutoTimeResolution;
+
+ VclPtr<FixedText> m_pTxtMain;
+ VclPtr<FormattedField> m_pFmtFldStepMain;
+ VclPtr<MetricField> m_pMt_MainDateStep;
+ VclPtr<ListBox> m_pLB_MainTimeUnit;
+ VclPtr<CheckBox> m_pCbxAutoStepMain;
+
+ VclPtr<FixedText> m_pTxtHelpCount;
+ VclPtr<FixedText> m_pTxtHelp;
+ VclPtr<MetricField> m_pMtStepHelp;
+ VclPtr<ListBox> m_pLB_HelpTimeUnit;
+ VclPtr<CheckBox> m_pCbxAutoStepHelp;
+
+ VclPtr<FormattedField> m_pFmtFldOrigin;
+ VclPtr<CheckBox> m_pCbxAutoOrigin;
+ VclPtr<VclBox> m_pBxOrigin;
double fMin;
double fMax;
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index 826eec3b08c8..e6d372178752 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -65,6 +65,26 @@ SchOptionTabPage::SchOptionTabPage(vcl::Window* pWindow,const SfxItemSet& rInAtt
SchOptionTabPage::~SchOptionTabPage()
{
+ disposeOnce();
+}
+
+void SchOptionTabPage::dispose()
+{
+ m_pGrpAxis.clear();
+ m_pRbtAxis1.clear();
+ m_pRbtAxis2.clear();
+ m_pGrpBar.clear();
+ m_pMTGap.clear();
+ m_pMTOverlap.clear();
+ m_pCBConnect.clear();
+ m_pCBAxisSideBySide.clear();
+ m_pGrpPlotOptions.clear();
+ m_pGridPlotOptions.clear();
+ m_pRB_DontPaint.clear();
+ m_pRB_AssumeZero.clear();
+ m_pRB_ContinueLine.clear();
+ m_pCBIncludeHiddenCells.clear();
+ SfxTabPage::dispose();
}
IMPL_LINK_NOARG(SchOptionTabPage, EnableHdl)
@@ -77,9 +97,10 @@ IMPL_LINK_NOARG(SchOptionTabPage, EnableHdl)
return 0;
}
-SfxTabPage* SchOptionTabPage::Create(vcl::Window* pWindow,const SfxItemSet* rOutAttrs)
+VclPtr<SfxTabPage> SchOptionTabPage::Create(vcl::Window* pWindow,
+ const SfxItemSet* rOutAttrs)
{
- return new SchOptionTabPage(pWindow, *rOutAttrs);
+ return VclPtr<SchOptionTabPage>::Create(pWindow, *rOutAttrs);
}
bool SchOptionTabPage::FillItemSet(SfxItemSet* rOutAttrs)
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
index ff81b28b59c5..1d0b2e3f1bdb 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -32,8 +32,9 @@ class SchOptionTabPage : public SfxTabPage
public:
SchOptionTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs);
virtual ~SchOptionTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet* rInAttrs) SAL_OVERRIDE;
@@ -43,23 +44,23 @@ private: //methods
void AdaptControlPositionsAndVisibility();
private: //member
- VclFrame* m_pGrpAxis;
- RadioButton* m_pRbtAxis1;
- RadioButton* m_pRbtAxis2;
-
- VclFrame* m_pGrpBar;
- MetricField* m_pMTGap;
- MetricField* m_pMTOverlap;
- CheckBox* m_pCBConnect;
- CheckBox* m_pCBAxisSideBySide;
-
- VclFrame* m_pGrpPlotOptions;
- VclGrid* m_pGridPlotOptions;
- RadioButton* m_pRB_DontPaint;
- RadioButton* m_pRB_AssumeZero;
- RadioButton* m_pRB_ContinueLine;
-
- CheckBox* m_pCBIncludeHiddenCells;
+ VclPtr<VclFrame> m_pGrpAxis;
+ VclPtr<RadioButton> m_pRbtAxis1;
+ VclPtr<RadioButton> m_pRbtAxis2;
+
+ VclPtr<VclFrame> m_pGrpBar;
+ VclPtr<MetricField> m_pMTGap;
+ VclPtr<MetricField> m_pMTOverlap;
+ VclPtr<CheckBox> m_pCBConnect;
+ VclPtr<CheckBox> m_pCBAxisSideBySide;
+
+ VclPtr<VclGrid> m_pGrpPlotOptions;
+ VclPtr<VclGrid> m_pGridPlotOptions;
+ VclPtr<RadioButton> m_pRB_DontPaint;
+ VclPtr<RadioButton> m_pRB_AssumeZero;
+ VclPtr<RadioButton> m_pRB_ContinueLine;
+
+ VclPtr<CheckBox> m_pCBIncludeHiddenCells;
DECL_LINK(EnableHdl, void * );
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index 32004557fdf8..25fa53dde0b8 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -57,19 +57,33 @@ SchAlignmentTabPage::SchAlignmentTabPage(vcl::Window* pWindow,
SchAlignmentTabPage::~SchAlignmentTabPage()
{
+ disposeOnce();
+}
+
+void SchAlignmentTabPage::dispose()
+{
delete m_pOrientHlp;
+ m_pOrientHlp = NULL;
+ m_pCtrlDial.clear();
+ m_pFtRotate.clear();
+ m_pNfRotate.clear();
+ m_pCbStacked.clear();
+ m_pFtTextDirection.clear();
+ m_pLbTextDirection.clear();
+ m_pFtABCD.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SchAlignmentTabPage::Create(vcl::Window* pParent,
- const SfxItemSet* rInAttrs)
+VclPtr<SfxTabPage> SchAlignmentTabPage::Create(vcl::Window* pParent,
+ const SfxItemSet* rInAttrs)
{
- return new SchAlignmentTabPage(pParent, *rInAttrs);
+ return VclPtr<SchAlignmentTabPage>::Create(pParent, *rInAttrs);
}
-SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(vcl::Window* pParent,
- const SfxItemSet* rInAttrs)
+VclPtr<SfxTabPage> SchAlignmentTabPage::CreateWithoutRotation(vcl::Window* pParent,
+ const SfxItemSet* rInAttrs)
{
- return new SchAlignmentTabPage(pParent, *rInAttrs, false);
+ return VclPtr<SchAlignmentTabPage>::Create(pParent, *rInAttrs, false);
}
bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs)
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
index 0bd5c976b4e3..c7a20a2f90f7 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -31,21 +31,22 @@ namespace chart
class SchAlignmentTabPage : public SfxTabPage
{
private:
- svx::DialControl* m_pCtrlDial;
- FixedText* m_pFtRotate;
- NumericField* m_pNfRotate;
- TriStateBox* m_pCbStacked;
+ VclPtr<svx::DialControl> m_pCtrlDial;
+ VclPtr<FixedText> m_pFtRotate;
+ VclPtr<NumericField> m_pNfRotate;
+ VclPtr<TriStateBox> m_pCbStacked;
svx::OrientationHelper* m_pOrientHlp;
- FixedText* m_pFtTextDirection;
- TextDirectionListBox* m_pLbTextDirection;
- FixedText* m_pFtABCD;
+ VclPtr<FixedText> m_pFtTextDirection;
+ VclPtr<TextDirectionListBox> m_pLbTextDirection;
+ VclPtr<FixedText> m_pFtABCD;
public:
SchAlignmentTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bWithRotation = true);
virtual ~SchAlignmentTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
- static SfxTabPage* CreateWithoutRotation(vcl::Window* pParent, const SfxItemSet* rInAttrs);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
+ static VclPtr<SfxTabPage> CreateWithoutRotation(vcl::Window* pParent, const SfxItemSet* rInAttrs);
virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet* rInAttrs) SAL_OVERRIDE;
};
diff --git a/chart2/source/controller/dialogs/tp_Trendline.cxx b/chart2/source/controller/dialogs/tp_Trendline.cxx
index a998056f8edf..34939d4a0d15 100644
--- a/chart2/source/controller/dialogs/tp_Trendline.cxx
+++ b/chart2/source/controller/dialogs/tp_Trendline.cxx
@@ -31,14 +31,10 @@ TrendlineTabPage::TrendlineTabPage( vcl::Window* pParent, const SfxItemSet& rInA
{
}
-TrendlineTabPage::~TrendlineTabPage()
-{
-}
-
-SfxTabPage* TrendlineTabPage::Create(
+VclPtr<SfxTabPage> TrendlineTabPage::Create(
vcl::Window* pParent, const SfxItemSet* rOutAttrs )
{
- return new TrendlineTabPage( pParent, *rOutAttrs );
+ return VclPtr<TrendlineTabPage>::Create( pParent, *rOutAttrs );
}
bool TrendlineTabPage::FillItemSet( SfxItemSet* rOutAttrs )
diff --git a/chart2/source/controller/dialogs/tp_Trendline.hxx b/chart2/source/controller/dialogs/tp_Trendline.hxx
index a88c858c7b9a..bdd9848e6028 100644
--- a/chart2/source/controller/dialogs/tp_Trendline.hxx
+++ b/chart2/source/controller/dialogs/tp_Trendline.hxx
@@ -30,9 +30,8 @@ class TrendlineTabPage : public SfxTabPage
{
public:
TrendlineTabPage ( vcl::Window* pParent, const SfxItemSet& rInAttrs );
- virtual ~TrendlineTabPage ();
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rInAttrs ) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
index 90088b0b66ae..8c40e6d43512 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
@@ -57,6 +57,19 @@ TitlesAndObjectsTabPage::TitlesAndObjectsTabPage( svt::OWizardMachine* pParent
m_pCB_Grid_Z->SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
}
+TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage()
+{
+ disposeOnce();
+}
+
+void TitlesAndObjectsTabPage::dispose()
+{
+ m_pCB_Grid_X.clear();
+ m_pCB_Grid_Y.clear();
+ m_pCB_Grid_Z.clear();
+ OWizardPage::dispose();
+}
+
void TitlesAndObjectsTabPage::initializePage()
{
m_bCommitToModel = false;
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
index 26e2cb2aebae..520453ce0452 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
@@ -44,6 +44,8 @@ public:
::com::sun::star::chart2::XChartDocument >& xChartModel
, const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~TitlesAndObjectsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void initializePage() SAL_OVERRIDE;
virtual bool commitPage( ::svt::WizardTypes::CommitPageReason eReason ) SAL_OVERRIDE;
@@ -57,9 +59,9 @@ protected:
boost::scoped_ptr< TitleResources > m_xTitleResources;
boost::scoped_ptr< LegendPositionResources > m_xLegendPositionResources;
- CheckBox* m_pCB_Grid_X;
- CheckBox* m_pCB_Grid_Y;
- CheckBox* m_pCB_Grid_Z;
+ VclPtr<CheckBox> m_pCB_Grid_X;
+ VclPtr<CheckBox> m_pCB_Grid_Y;
+ VclPtr<CheckBox> m_pCB_Grid_Z;
::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > m_xChartModel;
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index f304034e85c6..9f60c63bb405 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -143,14 +143,14 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co
nStandardSymbol %= pSymbolList->GetObjCount();
SdrObject* pObj = pSymbolList->GetObj(nStandardSymbol);
- VirtualDevice aVDev;
- aVDev.SetMapMode(MapMode(MAP_100TH_MM));
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->SetMapMode(MapMode(MAP_100TH_MM));
SdrModel* pModel = new SdrModel();
pModel->GetItemPool().FreezeIdRanges();
SdrPage* pPage = new SdrPage( *pModel, false );
pPage->SetSize(Size(1000,1000));
pModel->InsertPage( pPage, 0 );
- SdrView* pView = new SdrView( pModel, &aVDev );
+ SdrView* pView = new SdrView( pModel, pVDev );
pView->hideMarkHandles();
SdrPageView* pPageView = pView->ShowSdrPage(pPage);
diff --git a/chart2/source/controller/inc/TextDirectionListBox.hxx b/chart2/source/controller/inc/TextDirectionListBox.hxx
index bee03f2fb247..706043034916 100644
--- a/chart2/source/controller/inc/TextDirectionListBox.hxx
+++ b/chart2/source/controller/inc/TextDirectionListBox.hxx
@@ -32,7 +32,6 @@ class TextDirectionListBox : public svx::FrameDirectionListBox
public:
explicit TextDirectionListBox( vcl::Window* pParent,
vcl::Window* pWindow1 = 0, vcl::Window* pWindow2 = 0 );
- virtual ~TextDirectionListBox();
};
} //namespace chart
diff --git a/chart2/source/controller/inc/dlg_ChartType.hxx b/chart2/source/controller/inc/dlg_ChartType.hxx
index b67a06fd729b..d8fecf56782e 100644
--- a/chart2/source/controller/inc/dlg_ChartType.hxx
+++ b/chart2/source/controller/inc/dlg_ChartType.hxx
@@ -38,9 +38,10 @@ public:
, const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& xContext );
virtual ~ChartTypeDialog();
+ virtual void dispose() SAL_OVERRIDE;
private:
- ChartTypeTabPage* m_pChartTypeTabPage;
+ VclPtr<ChartTypeTabPage> m_pChartTypeTabPage;
::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel > m_xChartModel;
diff --git a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
index 6bf4e0f2851a..524a87c4e32e 100644
--- a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
+++ b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
@@ -44,7 +44,7 @@ private:
// OGenericUnoDialog overridables
virtual void implInitialize(const com::sun::star::uno::Any& _rValue) SAL_OVERRIDE;
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
// XTypeProvider
virtual com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index 95d47fd4c5ae..152fc8485751 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -22,6 +22,7 @@
#include "TimerTriggeredControllerLock.hxx"
#include "TabPageNotifiable.hxx"
+#include "../dialogs/DialogModel.hxx"
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <svtools/roadmapwizard.hxx>
@@ -36,7 +37,6 @@ namespace chart
class RangeChooserTabPage;
class DataSourceTabPage;
class ChartTypeTemplateProvider;
-class DialogModel;
class CreationWizard : public svt::RoadmapWizard, public TabPageNotifiable
{
@@ -47,7 +47,6 @@ public:
, const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& xContext
, sal_Int32 nOnePageOnlyIndex=-1 );//if nOnePageOnlyIndex is an index of an exsisting page starting with 0, then only this page is displayed without next/previous and roadmap
- virtual ~CreationWizard();
bool isClosable() { /*@todo*/ return m_bIsClosable;}
@@ -66,7 +65,7 @@ private:
//no default constructor
CreationWizard();
- virtual svt::OWizardPage* createPage(WizardState nState) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage(WizardState nState) SAL_OVERRIDE;
::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > m_xChartModel;
diff --git a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
index ce4f638dd442..a71d86aaf3ac 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
@@ -119,7 +119,7 @@ private:
com::sun::star::uno::Reference<
com::sun::star::awt::XWindow > m_xParentWindow;
- CreationWizard* m_pDialog;
+ VclPtr<CreationWizard> m_pDialog;
bool m_bUnlockControllersOnExecute;
};
diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx
index 76d67301894e..f37b16cfc956 100644
--- a/chart2/source/controller/inc/dlg_DataEditor.hxx
+++ b/chart2/source/controller/inc/dlg_DataEditor.hxx
@@ -48,6 +48,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > & xContext );
virtual ~DataEditor();
+ virtual void dispose() SAL_OVERRIDE;
// Dialog
virtual bool Close() SAL_OVERRIDE;
@@ -65,8 +66,8 @@ private:
sal_uInt16 TBI_DATA_SWAP_ROW;
bool m_bReadOnly;
- boost::scoped_ptr<DataBrowser> m_xBrwData;
- ToolBox* m_pTbxData;
+ VclPtr<DataBrowser> m_xBrwData;
+ VclPtr<ToolBox> m_pTbxData;
::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > m_xChartDoc;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx
index 8b3529b9d9e1..bc3d22da9c8b 100644
--- a/chart2/source/controller/inc/dlg_DataSource.hxx
+++ b/chart2/source/controller/inc/dlg_DataSource.hxx
@@ -50,6 +50,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > & xContext );
virtual ~DataSourceDialog();
+ virtual void dispose() SAL_OVERRIDE;
// from Dialog (base of TabDialog)
virtual short Execute() SAL_OVERRIDE;
@@ -67,11 +68,11 @@ protected:
::std::unique_ptr< DialogModel > m_apDialogModel;
private:
- DataSourceTabControl* m_pTabControl;
- OKButton* m_pBtnOK;
+ VclPtr<DataSourceTabControl> m_pTabControl;
+ VclPtr<OKButton> m_pBtnOK;
- RangeChooserTabPage * m_pRangeChooserTabePage;
- DataSourceTabPage * m_pDataSourceTabPage;
+ VclPtr<RangeChooserTabPage> m_pRangeChooserTabePage;
+ VclPtr<DataSourceTabPage> m_pDataSourceTabPage;
bool m_bRangeChooserTabIsValid;
bool m_bDataSourceTabIsValid;
diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
index bf3bf85750e7..1ec0829f4eac 100644
--- a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
+++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
@@ -43,16 +43,17 @@ struct InsertAxisOrGridDialogData
class SchAxisDlg : public ModalDialog
{
protected:
- CheckBox* m_pCbPrimaryX;
- CheckBox* m_pCbPrimaryY;
- CheckBox* m_pCbPrimaryZ;
- CheckBox* m_pCbSecondaryX;
- CheckBox* m_pCbSecondaryY;
- CheckBox* m_pCbSecondaryZ;
+ VclPtr<CheckBox> m_pCbPrimaryX;
+ VclPtr<CheckBox> m_pCbPrimaryY;
+ VclPtr<CheckBox> m_pCbPrimaryZ;
+ VclPtr<CheckBox> m_pCbSecondaryX;
+ VclPtr<CheckBox> m_pCbSecondaryY;
+ VclPtr<CheckBox> m_pCbSecondaryZ;
public:
SchAxisDlg(vcl::Window* pParent, const InsertAxisOrGridDialogData& rInput, bool bAxisDlg=true);
virtual ~SchAxisDlg();
+ virtual void dispose() SAL_OVERRIDE;
void getResult( InsertAxisOrGridDialogData& rOutput );
};
@@ -66,7 +67,6 @@ class SchGridDlg : public SchAxisDlg
{
public:
SchGridDlg( vcl::Window* pParent, const InsertAxisOrGridDialogData& rInput );
- virtual ~SchGridDlg();
};
} //namespace chart
diff --git a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
index 1cbed9f9a9c0..fd269c525d13 100644
--- a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
+++ b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
@@ -23,13 +23,13 @@
#include <vcl/button.hxx>
#include <svl/itemset.hxx>
#include <boost/scoped_ptr.hpp>
+#include "../dialogs/res_DataLabel.hxx"
class SvNumberFormatter;
namespace chart
{
-class DataLabelResources;
class DataLabelsDialog : public ModalDialog
{
private:
@@ -44,7 +44,6 @@ private:
public:
DataLabelsDialog(vcl::Window* pParent, const SfxItemSet& rInAttrs, SvNumberFormatter* pFormatter);
- virtual ~DataLabelsDialog();
void FillItemSet(SfxItemSet& rOutAttrs);
};
diff --git a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
index e981b718ec63..ae45a16941f5 100644
--- a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
+++ b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
@@ -36,7 +36,6 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDocument,
ErrorBarResources::tErrorBarType eType );
- virtual ~InsertErrorBarsDialog();
void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
index 19b1bf2539c2..8ad9fc95525d 100644
--- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx
+++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
@@ -132,6 +132,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
virtual ~SchAttribTabDlg();
+ virtual void dispose() SAL_OVERRIDE;
//pSymbolShapeProperties: Properties to be set on the symbollist shapes
//pAutoSymbolGraphic: Graphic to be shown if AutoSymbol gets selected
diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx
index fdfb35463625..0ef93e8d1fea 100644
--- a/chart2/source/controller/inc/dlg_View3D.hxx
+++ b/chart2/source/controller/inc/dlg_View3D.hxx
@@ -41,16 +41,17 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel,
const XColorListRef &pColorTable );
virtual ~View3DDialog();
+ virtual void dispose() SAL_OVERRIDE;
// from Dialog (base of TabDialog)
virtual short Execute() SAL_OVERRIDE;
private:
- TabControl* m_pTabControl;
+ VclPtr<TabControl> m_pTabControl;
- ThreeD_SceneGeometry_TabPage* m_pGeometry;
- ThreeD_SceneAppearance_TabPage* m_pAppearance;
- ThreeD_SceneIllumination_TabPage* m_pIllumination;
+ VclPtr<ThreeD_SceneGeometry_TabPage> m_pGeometry;
+ VclPtr<ThreeD_SceneAppearance_TabPage> m_pAppearance;
+ VclPtr<ThreeD_SceneIllumination_TabPage> m_pIllumination;
ControllerLockHelper m_aControllerLocker;
diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx
index 0ad485c39990..85917809db48 100644
--- a/chart2/source/controller/inc/res_ErrorBar.hxx
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -67,36 +67,36 @@ public:
private:
// category
- RadioButton* m_pRbNone;
- RadioButton* m_pRbConst;
- RadioButton* m_pRbPercent;
- RadioButton* m_pRbFunction;
- RadioButton* m_pRbRange;
- ListBox* m_pLbFunction;
+ VclPtr<RadioButton> m_pRbNone;
+ VclPtr<RadioButton> m_pRbConst;
+ VclPtr<RadioButton> m_pRbPercent;
+ VclPtr<RadioButton> m_pRbFunction;
+ VclPtr<RadioButton> m_pRbRange;
+ VclPtr<ListBox> m_pLbFunction;
// parameters
- VclFrame* m_pFlParameters;
- VclBox* m_pBxPositive;
- MetricField* m_pMfPositive;
- Edit* m_pEdRangePositive;
- PushButton* m_pIbRangePositive;
- VclBox* m_pBxNegative;
- MetricField* m_pMfNegative;
- Edit* m_pEdRangeNegative;
- PushButton* m_pIbRangeNegative;
- CheckBox* m_pCbSyncPosNeg;
+ VclPtr<VclFrame> m_pFlParameters;
+ VclPtr<VclBox> m_pBxPositive;
+ VclPtr<MetricField> m_pMfPositive;
+ VclPtr<Edit> m_pEdRangePositive;
+ VclPtr<PushButton> m_pIbRangePositive;
+ VclPtr<VclBox> m_pBxNegative;
+ VclPtr<MetricField> m_pMfNegative;
+ VclPtr<Edit> m_pEdRangeNegative;
+ VclPtr<PushButton> m_pIbRangeNegative;
+ VclPtr<CheckBox> m_pCbSyncPosNeg;
// indicator
- RadioButton* m_pRbBoth;
- RadioButton* m_pRbPositive;
- RadioButton* m_pRbNegative;
- FixedImage* m_pFiBoth;
- FixedImage* m_pFiPositive;
- FixedImage* m_pFiNegative;
+ VclPtr<RadioButton> m_pRbBoth;
+ VclPtr<RadioButton> m_pRbPositive;
+ VclPtr<RadioButton> m_pRbNegative;
+ VclPtr<FixedImage> m_pFiBoth;
+ VclPtr<FixedImage> m_pFiPositive;
+ VclPtr<FixedImage> m_pFiNegative;
- FixedText* m_pUIStringPos;
- FixedText* m_pUIStringNeg;
- FixedText* m_pUIStringRbRange;
+ VclPtr<FixedText> m_pUIStringPos;
+ VclPtr<FixedText> m_pUIStringNeg;
+ VclPtr<FixedText> m_pUIStringRbRange;
SvxChartKindError m_eErrorKind;
SvxChartIndicate m_eIndicate;
@@ -116,9 +116,9 @@ private:
double m_fPlusValue;
double m_fMinusValue;
- Dialog * m_pParentDialog;
+ VclPtr<Dialog> m_pParentDialog;
boost::scoped_ptr< RangeSelectionHelper > m_apRangeSelectionHelper;
- Edit * m_pCurrentRangeChoosingField;
+ VclPtr<Edit> m_pCurrentRangeChoosingField;
bool m_bHasInternalDataProvider;
bool m_bEnableDataTableDialog;
diff --git a/chart2/source/controller/inc/res_LegendPosition.hxx b/chart2/source/controller/inc/res_LegendPosition.hxx
index c8292db200af..7801895a6308 100644
--- a/chart2/source/controller/inc/res_LegendPosition.hxx
+++ b/chart2/source/controller/inc/res_LegendPosition.hxx
@@ -60,12 +60,12 @@ private:
::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext> m_xCC;
- CheckBox* m_pCbxShow;
+ VclPtr<CheckBox> m_pCbxShow;
- RadioButton* m_pRbtLeft;
- RadioButton* m_pRbtRight;
- RadioButton* m_pRbtTop;
- RadioButton* m_pRbtBottom;
+ VclPtr<RadioButton> m_pRbtLeft;
+ VclPtr<RadioButton> m_pRbtRight;
+ VclPtr<RadioButton> m_pRbtTop;
+ VclPtr<RadioButton> m_pRbtBottom;
Link m_aChangeLink;
};
diff --git a/chart2/source/controller/inc/res_Titles.hxx b/chart2/source/controller/inc/res_Titles.hxx
index 1e4e8c67cd91..396c87af598f 100644
--- a/chart2/source/controller/inc/res_Titles.hxx
+++ b/chart2/source/controller/inc/res_Titles.hxx
@@ -40,22 +40,22 @@ public:
void ClearModifyFlag();
private:
- FixedText* m_pFT_Main;
- FixedText* m_pFT_Sub;
- Edit* m_pEd_Main;
- Edit* m_pEd_Sub;
+ VclPtr<FixedText> m_pFT_Main;
+ VclPtr<FixedText> m_pFT_Sub;
+ VclPtr<Edit> m_pEd_Main;
+ VclPtr<Edit> m_pEd_Sub;
- FixedText* m_pFT_XAxis;
- FixedText* m_pFT_YAxis;
- FixedText* m_pFT_ZAxis;
- Edit* m_pEd_XAxis;
- Edit* m_pEd_YAxis;
- Edit* m_pEd_ZAxis;
+ VclPtr<FixedText> m_pFT_XAxis;
+ VclPtr<FixedText> m_pFT_YAxis;
+ VclPtr<FixedText> m_pFT_ZAxis;
+ VclPtr<Edit> m_pEd_XAxis;
+ VclPtr<Edit> m_pEd_YAxis;
+ VclPtr<Edit> m_pEd_ZAxis;
- FixedText* m_pFT_SecondaryXAxis;
- FixedText* m_pFT_SecondaryYAxis;
- Edit* m_pEd_SecondaryXAxis;
- Edit* m_pEd_SecondaryYAxis;
+ VclPtr<FixedText> m_pFT_SecondaryXAxis;
+ VclPtr<FixedText> m_pFT_SecondaryYAxis;
+ VclPtr<Edit> m_pEd_SecondaryXAxis;
+ VclPtr<Edit> m_pEd_SecondaryYAxis;
};
} //namespace chart
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index fca17f15983c..40e6cacdfe8d 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -388,7 +388,7 @@ void SAL_CALL ChartController::attachFrame(
{
// calls to VCL
SolarMutexGuard aSolarGuard;
- m_pChartWindow = new ChartWindow(this,pParent,pParent?pParent->GetStyle():0);
+ m_pChartWindow = VclPtr<ChartWindow>::Create(this,pParent,pParent?pParent->GetStyle():0);
m_pChartWindow->SetBackground();//no Background
m_xViewWindow = uno::Reference< awt::XWindow >( m_pChartWindow->GetComponentInterface(), uno::UNO_QUERY );
m_pChartWindow->Show();
@@ -1271,8 +1271,8 @@ void ChartController::executeDispatch_ChartType()
SolarMutexGuard aSolarGuard;
//prepare and open dialog
- ChartTypeDialog aDlg( m_pChartWindow, getModel(), m_xCC );
- if( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< ChartTypeDialog > aDlg( m_pChartWindow, getModel(), m_xCC );
+ if( aDlg->Execute() == RET_OK )
{
impl_adaptDataSeriesAutoResize();
aUndoGuard.commit();
@@ -1292,8 +1292,8 @@ void ChartController::executeDispatch_SourceData()
if( xChartDoc.is())
{
SolarMutexGuard aSolarGuard;
- ::chart::DataSourceDialog aDlg( m_pChartWindow, xChartDoc, m_xCC );
- if( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< ::chart::DataSourceDialog > aDlg( m_pChartWindow, xChartDoc, m_xCC );
+ if( aDlg->Execute() == RET_OK )
{
impl_adaptDataSeriesAutoResize();
aUndoGuard.commit();
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index c447af4e1874..f5c73bff7459 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -508,7 +508,7 @@ private:
TheModelRef m_aModel;
//view
- ChartWindow* m_pChartWindow;
+ VclPtr<ChartWindow> m_pChartWindow;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xViewWindow;
::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface > m_xChartView;
diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
index 9cba950495b9..6f6b9c1c5597 100644
--- a/chart2/source/controller/main/ChartController_EditData.cxx
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -54,10 +54,9 @@ void ChartController::executeDispatch_EditData()
UndoLiveUpdateGuardWithData aUndoGuard = UndoLiveUpdateGuardWithData(
SCH_RESSTR( STR_ACTION_EDIT_CHART_DATA ),
m_xUndoManager );
- vcl::Window* pParent( NULL );
- DataEditor aDataEditorDialog( pParent, xChartDoc, m_xCC );
- if (aDataEditorDialog.Execute() == RET_OK)
- aDataEditorDialog.ApplyChangesToModel();
+ ScopedVclPtrInstance<DataEditor> aDataEditorDialog( nullptr, xChartDoc, m_xCC );
+ if (aDataEditorDialog->Execute() == RET_OK)
+ aDataEditorDialog->ApplyChangesToModel();
aUndoGuard.commit();
}
}
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 7c83ecc569fc..e194016abd17 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -109,14 +109,14 @@ void ChartController::executeDispatch_InsertAxes()
AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, true );
SolarMutexGuard aGuard;
- SchAxisDlg aDlg( m_pChartWindow, aDialogInput );
- if( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance<SchAxisDlg> aDlg( m_pChartWindow, aDialogInput );
+ if( aDlg->Execute() == RET_OK )
{
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
InsertAxisOrGridDialogData aDialogOutput;
- aDlg.getResult( aDialogOutput );
+ aDlg->getResult( aDialogOutput );
boost::scoped_ptr< ReferenceSizeProvider > mpRefSizeProvider(
impl_createReferenceSizeProvider());
bool bChanged = AxisHelper::changeVisibilityOfAxes( xDiagram
@@ -147,13 +147,13 @@ void ChartController::executeDispatch_InsertGrid()
AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, false );
SolarMutexGuard aGuard;
- SchGridDlg aDlg( m_pChartWindow, aDialogInput );//aItemSet, b3D, bNet, bSecondaryX, bSecondaryY );
- if( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance<SchGridDlg> aDlg(m_pChartWindow, aDialogInput);//aItemSet, b3D, bNet, bSecondaryX, bSecondaryY );
+ if( aDlg->Execute() == RET_OK )
{
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
InsertAxisOrGridDialogData aDialogOutput;
- aDlg.getResult( aDialogOutput );
+ aDlg->getResult( aDialogOutput );
bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
, aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC );
if( bChanged )
@@ -179,13 +179,13 @@ void ChartController::executeDispatch_InsertTitles()
aDialogInput.readFromModel( getModel() );
SolarMutexGuard aGuard;
- SchTitleDlg aDlg( m_pChartWindow, aDialogInput );
- if( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< SchTitleDlg > aDlg( m_pChartWindow, aDialogInput );
+ if( aDlg->Execute() == RET_OK )
{
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
TitleDialogData aDialogOutput(impl_createReferenceSizeProvider());
- aDlg.getResult( aDialogOutput );
+ aDlg->getResult( aDialogOutput );
bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput );
if( bChanged )
aUndoGuard.commit();
@@ -232,13 +232,13 @@ void ChartController::executeDispatch_OpenLegendDialog()
{
//prepare and open dialog
SolarMutexGuard aGuard;
- SchLegendDlg aDlg( m_pChartWindow, m_xCC );
- aDlg.init( getModel() );
- if( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< SchLegendDlg > aDlg( m_pChartWindow, m_xCC );
+ aDlg->init( getModel() );
+ if( aDlg->Execute() == RET_OK )
{
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
- bool bChanged = aDlg.writeToModel( getModel() );
+ bool bChanged = aDlg->writeToModel( getModel() );
if( bChanged )
aUndoGuard.commit();
}
@@ -292,12 +292,12 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
SvNumberFormatter* pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
- DataLabelsDialog aDlg( m_pChartWindow, aItemSet, pNumberFormatter);
+ ScopedVclPtrInstance< DataLabelsDialog > aDlg( m_pChartWindow, aItemSet, pNumberFormatter);
- if( aDlg.Execute() == RET_OK )
+ if( aDlg->Execute() == RET_OK )
{
SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
- aDlg.FillItemSet( aOutItemSet );
+ aDlg->FillItemSet( aOutItemSet );
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
@@ -397,14 +397,17 @@ void ChartController::executeDispatch_InsertTrendline()
aDialogParameter.init( getModel() );
ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
SolarMutexGuard aGuard;
- SchAttribTabDlg aDialog( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
- uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
+ ScopedVclPtrInstance<SchAttribTabDlg> aDialog(
+ m_pChartWindow, &aItemSet, &aDialogParameter,
+ &aViewElementListProvider,
+ uno::Reference< util::XNumberFormatsSupplier >(
+ getModel(), uno::UNO_QUERY ) );
// note: when a user pressed "OK" but didn't change any settings in the
// dialog, the SfxTabDialog returns "Cancel"
- if( aDialog.Execute() == RET_OK || aDialog.DialogWasClosedWithOK())
+ if( aDialog->Execute() == RET_OK || aDialog->DialogWasClosedWithOK())
{
- const SfxItemSet* pOutItemSet = aDialog.GetOutputItemSet();
+ const SfxItemSet* pOutItemSet = aDialog->GetOutputItemSet();
if( pOutItemSet )
{
ControllerLockGuardUNO aCLGuard( getModel() );
@@ -452,17 +455,20 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
aDialogParameter.init( getModel() );
ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
SolarMutexGuard aGuard;
- SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
- uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
- aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+ ScopedVclPtrInstance<SchAttribTabDlg> aDlg(
+ m_pChartWindow, &aItemSet, &aDialogParameter,
+ &aViewElementListProvider,
+ uno::Reference< util::XNumberFormatsSupplier >(
+ getModel(), uno::UNO_QUERY ) );
+ aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(),
m_xChartView, m_aSelection.getSelectedCID()));
// note: when a user pressed "OK" but didn't change any settings in the
// dialog, the SfxTabDialog returns "Cancel"
- if( aDlg.Execute() == RET_OK || aDlg.DialogWasClosedWithOK())
+ if( aDlg->Execute() == RET_OK || aDlg->DialogWasClosedWithOK())
{
- const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
+ const SfxItemSet* pOutItemSet = aDlg->GetOutputItemSet();
if( pOutItemSet )
{
ControllerLockGuardUNO aCLGuard( getModel() );
@@ -489,18 +495,18 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
//prepare and open dialog
SolarMutexGuard aGuard;
- InsertErrorBarsDialog aDlg(
+ ScopedVclPtrInstance<InsertErrorBarsDialog> aDlg(
m_pChartWindow, aItemSet,
uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ),
bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X);
- aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+ aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, OUString() ) );
- if( aDlg.Execute() == RET_OK )
+ if( aDlg->Execute() == RET_OK )
{
SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
- aDlg.FillItemSet( aOutItemSet );
+ aDlg->FillItemSet( aOutItemSet );
// lock controllers till end of block
ControllerLockGuardUNO aCLGuard( getModel() );
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index ca3dfa1c1d3b..4cc7a171d031 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -761,8 +761,11 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard(
ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get() );
SolarMutexGuard aGuard;
- SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider
- , uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ) );
+ ScopedVclPtrInstance<SchAttribTabDlg> aDlg(
+ m_pChartWindow, &aItemSet, &aDialogParameter,
+ &aViewElementListProvider,
+ uno::Reference< util::XNumberFormatsSupplier >(
+ getModel(), uno::UNO_QUERY ) );
if(aDialogParameter.HasSymbolProperties())
{
@@ -782,18 +785,18 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard(
sal_Int32 nStandardSymbol=0;//@todo get from somewhere
Graphic* pAutoSymbolGraphic = new Graphic( aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, pSymbolShapeProperties ) );
// note: the dialog takes the ownership of pSymbolShapeProperties and pAutoSymbolGraphic
- aDlg.setSymbolInformation( pSymbolShapeProperties, pAutoSymbolGraphic );
+ aDlg->setSymbolInformation( pSymbolShapeProperties, pAutoSymbolGraphic );
}
if( aDialogParameter.HasStatisticProperties() )
{
- aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+ aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, rObjectCID ) );
}
//open the dialog
- if (aDlg.Execute() == RET_OK || (bSuccessOnUnchanged && aDlg.DialogWasClosedWithOK()))
+ if (aDlg->Execute() == RET_OK || (bSuccessOnUnchanged && aDlg->DialogWasClosedWithOK()))
{
- const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
+ const SfxItemSet* pOutItemSet = aDlg->GetOutputItemSet();
if(pOutItemSet)
{
ControllerLockGuardUNO aCLGuard( getModel());
@@ -822,8 +825,8 @@ void ChartController::executeDispatch_View3D()
//open dialog
SolarMutexGuard aSolarGuard;
- View3DDialog aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorList() );
- if( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< View3DDialog > aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorList() );
+ if( aDlg->Execute() == RET_OK )
aUndoGuard.commit();
}
catch(const uno::RuntimeException& e)
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index c46bab4e0b48..cd50dd3fb598 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -49,7 +49,7 @@ ChartWindow::ChartWindow( ChartController* pController, vcl::Window* pParent, Wi
: Window(pParent, nStyle)
, m_pWindowController( pController )
, m_bInPaint(false)
- , m_pOpenGLWindow(new OpenGLWindow(this))
+ , m_pOpenGLWindow(VclPtr<OpenGLWindow>::Create(this))
{
this->SetHelpId( HID_SCH_WIN_DOCUMENT );
this->SetMapMode( MapMode(MAP_100TH_MM) );
@@ -64,7 +64,7 @@ ChartWindow::ChartWindow( ChartController* pController, vcl::Window* pParent, Wi
{
m_pOpenGLWindow->Show();
uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW);
- sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow);
+ sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow.get());
x3DWindowProvider->setWindow(nWindowPtr);
x3DWindowProvider->update();
}
@@ -72,13 +72,19 @@ ChartWindow::ChartWindow( ChartController* pController, vcl::Window* pParent, Wi
ChartWindow::~ChartWindow()
{
+ disposeOnce();
+}
+
+void ChartWindow::dispose()
+{
if (m_pWindowController && m_pWindowController->getModel().is())
{
uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(m_pWindowController->getModel(), uno::UNO_QUERY_THROW);
x3DWindowProvider->setWindow(0);
x3DWindowProvider->update();
}
- delete m_pOpenGLWindow;
+ m_pOpenGLWindow.disposeAndClear();
+ vcl::Window::dispose();
}
void ChartWindow::clear()
diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx
index 2afa38a986d6..cd0afaa07d0a 100644
--- a/chart2/source/controller/main/ChartWindow.hxx
+++ b/chart2/source/controller/main/ChartWindow.hxx
@@ -37,6 +37,7 @@ class ChartWindow : public vcl::Window
public:
ChartWindow( ChartController* pController, vcl::Window* pParent, WinBits nStyle );
virtual ~ChartWindow();
+ virtual void dispose() SAL_OVERRIDE;
void clear();
@@ -67,7 +68,7 @@ public:
private:
ChartController* m_pWindowController;
bool m_bInPaint;
- OpenGLWindow* m_pOpenGLWindow;
+ VclPtr<OpenGLWindow> m_pOpenGLWindow;
void adjustHighContrastMode();
};
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index ba5d165fb831..732bf479bcae 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -57,10 +57,6 @@ SelectorListBox::SelectorListBox( vcl::Window* pParent, WinBits nStyle )
{
}
-SelectorListBox::~SelectorListBox()
-{
-}
-
void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tOID & rParent, std::vector< ListBoxEntryData >& rEntries
, const sal_Int32 nHierarchyDepth, const Reference< chart2::XChartDocument >& xChartDoc )
{
@@ -326,7 +322,7 @@ uno::Reference< awt::XWindow > SAL_CALL ElementSelectorToolbarController::create
vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
if( pParent )
{
- m_apSelectorListBox.reset( new SelectorListBox( pParent, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER ) );
+ m_apSelectorListBox.reset( VclPtr<SelectorListBox>::Create( pParent, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER ) );
::Size aLogicalSize( 95, 160 );
::Size aPixelSize = m_apSelectorListBox->LogicToPixel( aLogicalSize, MAP_APPFONT );
m_apSelectorListBox->SetSizePixel( aPixelSize );
diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx
index 5c3a19d0464d..aa9c182cf6b2 100644
--- a/chart2/source/controller/main/ElementSelector.hxx
+++ b/chart2/source/controller/main/ElementSelector.hxx
@@ -47,7 +47,6 @@ class SelectorListBox : public ListBox
{
public:
SelectorListBox( vcl::Window* pParent, WinBits nStyle );
- virtual ~SelectorListBox();
virtual void Select() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -111,7 +110,7 @@ private:
private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
- boost::scoped_ptr< SelectorListBox > m_apSelectorListBox;
+ VclPtr< SelectorListBox > m_apSelectorListBox;
};
} //namespace chart
diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index 52b5f1f6d4e4..e0176be4eff4 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -252,7 +252,7 @@ void ShapeController::executeDispatch_FormatLine()
SolarMutexGuard aGuard;
if ( m_pChartController )
{
- vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow );
+ vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() );
DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
if ( pParent && pDrawModelWrapper && pDrawViewWrapper )
@@ -267,10 +267,10 @@ void ShapeController::executeDispatch_FormatLine()
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if ( pFact )
{
- ::boost::scoped_ptr< SfxAbstractTabDialog > pDlg(
+ boost::scoped_ptr< SfxAbstractTabDialog > pDlg(
pFact->CreateSvxLineTabDialog( pParent, &aAttr, &pDrawModelWrapper->getSdrModel(),
pSelectedObj, bHasMarked ) );
- if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ if ( pDlg->Execute() == RET_OK )
{
const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
if ( bHasMarked )
@@ -292,7 +292,7 @@ void ShapeController::executeDispatch_FormatArea()
SolarMutexGuard aGuard;
if ( m_pChartController )
{
- vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow );
+ vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() );
DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
if ( pParent && pDrawModelWrapper && pDrawViewWrapper )
@@ -335,7 +335,7 @@ void ShapeController::executeDispatch_TextAttributes()
SolarMutexGuard aGuard;
if ( m_pChartController )
{
- vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow );
+ vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() );
DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
if ( pParent && pDrawViewWrapper )
{
@@ -372,7 +372,7 @@ void ShapeController::executeDispatch_TransformDialog()
SolarMutexGuard aGuard;
if ( m_pChartController )
{
- vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow );
+ vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() );
DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
if ( pParent && pDrawViewWrapper )
{
@@ -541,7 +541,7 @@ void ShapeController::executeDispatch_FontDialog()
SolarMutexGuard aGuard;
if ( m_pChartController )
{
- vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow );
+ vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() );
DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
if ( pParent && pDrawModelWrapper && pDrawViewWrapper )
@@ -549,8 +549,8 @@ void ShapeController::executeDispatch_FontDialog()
SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() );
pDrawViewWrapper->GetAttributes( aAttr );
ViewElementListProvider aViewElementListProvider( pDrawModelWrapper );
- ::boost::scoped_ptr< ShapeFontDialog > pDlg( new ShapeFontDialog( pParent, &aAttr, &aViewElementListProvider ) );
- if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ ScopedVclPtrInstance< ShapeFontDialog > pDlg( pParent, &aAttr, &aViewElementListProvider );
+ if ( pDlg->Execute() == RET_OK )
{
const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
pDrawViewWrapper->SetAttributes( *pOutAttr );
@@ -564,7 +564,7 @@ void ShapeController::executeDispatch_ParagraphDialog()
SolarMutexGuard aGuard;
if ( m_pChartController )
{
- vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow );
+ vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() );
DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
if ( pParent && pDrawViewWrapper )
{
@@ -587,8 +587,8 @@ void ShapeController::executeDispatch_ParagraphDialog()
aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
- ::boost::scoped_ptr< ShapeParagraphDialog > pDlg( new ShapeParagraphDialog( pParent, &aNewAttr ) );
- if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ ScopedVclPtrInstance< ShapeParagraphDialog > pDlg( pParent, &aNewAttr );
+ if ( pDlg->Execute() == RET_OK )
{
const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
pDrawViewWrapper->SetAttributes( *pOutAttr );
diff --git a/chart2/source/controller/main/ShapeToolbarController.cxx b/chart2/source/controller/main/ShapeToolbarController.cxx
index 46c7cda65740..999c9bacdd5c 100644
--- a/chart2/source/controller/main/ShapeToolbarController.cxx
+++ b/chart2/source/controller/main/ShapeToolbarController.cxx
@@ -105,7 +105,7 @@ void ShapeToolbarController::initialize( const Sequence< uno::Any >& rArguments
SolarMutexGuard aSolarMutexGuard;
::osl::MutexGuard aGuard( m_aMutex );
- ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if ( pToolBox )
{
const sal_uInt16 nCount = pToolBox->GetItemCount();
diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx
index 986a6b993eb8..0e590a67891e 100644
--- a/chart2/source/inc/chartview/DrawModelWrapper.hxx
+++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx
@@ -41,7 +41,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xMainDrawPage;
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xHiddenDrawPage;
- boost::scoped_ptr<OutputDevice> m_pRefDevice;
+ VclPtr<OutputDevice> m_pRefDevice;
//no default constructor
DrawModelWrapper();
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 09fef837f55f..ad79ed5a158f 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -1487,7 +1487,7 @@ IMPL_LINK_NOARG(GL3DBarChart, UpdateTimerHdl)
void GL3DBarChart::setOpenGLWindow(OpenGLWindow* pWindow)
{
- if (mpWindow != pWindow)
+ if (mpWindow.get() != pWindow)
{
mpWindow = pWindow;
Size aSize = mpWindow->GetSizePixel();
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 9f8664d73fce..c714a5b50489 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -124,7 +124,7 @@ private:
boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
boost::scoped_ptr<opengl3D::OpenGL3DRenderer> mpRenderer;
- OpenGLWindow* mpWindow;
+ VclPtr<OpenGLWindow> mpWindow;
opengl3D::Camera* mpCamera;
bool mbValidContext;
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
index 7bf6966ee258..b1354c588eed 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -76,26 +76,26 @@ const TextCacheItem& TextCache::getText(OUString const & rText, bool bIs3dText)
if(itr != maTextCache.end())
return *itr->second;
- VirtualDevice aDevice(*Application::GetDefaultDevice(), 0, 0);
+ ScopedVclPtrInstance< VirtualDevice > pDevice(*Application::GetDefaultDevice(), 0, 0);
vcl::Font aFont;
if(bIs3dText)
aFont = vcl::Font("Brillante St",Size(0,0));
else
- aFont = aDevice.GetFont();
+ aFont = pDevice->GetFont();
aFont.SetSize(Size(0, 96));
static bool bOldRender = getenv("OLDRENDER");
if (bOldRender)
aFont.SetColor(COL_BLACK);
else
aFont.SetColor(COL_GREEN); // RGB_COLORDATA(0xf0, 0xf0, 0xf0));
- aDevice.SetFont(aFont);
- aDevice.Erase();
+ pDevice->SetFont(aFont);
+ pDevice->Erase();
- aDevice.SetOutputSize(Size(aDevice.GetTextWidth(rText), aDevice.GetTextHeight()));
- aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
- aDevice.DrawText(Point(0,0), rText);
+ pDevice->SetOutputSize(Size(pDevice->GetTextWidth(rText), pDevice->GetTextHeight()));
+ pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+ pDevice->DrawText(Point(0,0), rText);
- BitmapEx aText(aDevice.GetBitmapEx(Point(0,0), aDevice.GetOutputSize()));
+ BitmapEx aText(pDevice->GetBitmapEx(Point(0,0), pDevice->GetOutputSize()));
// TextCacheItem *pItem = new TextCacheItem(OpenGLHelper::ConvertBitmapExToRGBABuffer(aText), aText.GetSizePixel());
Bitmap aBitmap (aText.GetBitmap());
BitmapReadAccess *pAcc = aBitmap.AcquireReadAccess();
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index d9258e99bf7e..1ef10303457e 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1090,7 +1090,7 @@ public:
private:
ChartView* mpView;
bool mbContextDestroyed;
- OpenGLWindow* mpWindow;
+ VclPtr<OpenGLWindow> mpWindow;
};
GL2DRenderer::GL2DRenderer(ChartView* pView):
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
index d917ee16aadd..c9c1ba2930da 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -150,7 +150,8 @@ DrawModelWrapper::DrawModelWrapper( const uno::Reference<uno::XComponentContext>
OutputDevice* pDefaultDevice = rOutliner.GetRefDevice();
if( !pDefaultDevice )
pDefaultDevice = Application::GetDefaultDevice();
- m_pRefDevice.reset(new VirtualDevice(*pDefaultDevice));
+ m_pRefDevice.disposeAndClear();
+ m_pRefDevice = VclPtr<VirtualDevice>::Create(*pDefaultDevice);
MapMode aMapMode = m_pRefDevice->GetMapMode();
aMapMode.SetMapUnit(MAP_100TH_MM);
m_pRefDevice->SetMapMode(aMapMode);
@@ -176,6 +177,7 @@ DrawModelWrapper::~DrawModelWrapper()
}
SfxItemPool::Free(m_pChartItemPool);
}
+ m_pRefDevice.disposeAndClear();
}
uno::Reference< uno::XInterface > DrawModelWrapper
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index b6f6237aa3c8..7d81b5581228 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -836,19 +836,19 @@ DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
{
vcl::Font aFont;
std::for_each(maProperties.begin(), maProperties.end(), FontAttribSetter(aFont));
- VirtualDevice aDevice(*Application::GetDefaultDevice(), 0, 0);
- aDevice.Erase();
+ ScopedVclPtrInstance< VirtualDevice > pDevice(*Application::GetDefaultDevice(), 0, 0);
+ pDevice->Erase();
Rectangle aRect;
- aDevice.SetFont(aFont);
- aDevice.GetTextBoundRect(aRect, rText);
+ pDevice->SetFont(aFont);
+ pDevice->GetTextBoundRect(aRect, rText);
int screenWidth = (aRect.BottomRight().X());
int screenHeight = (aRect.BottomRight().Y());
- aDevice.SetOutputSizePixel(Size(screenWidth * 3, screenHeight));
- aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
- aDevice.DrawText(Point(0, 0), rText);
+ pDevice->SetOutputSizePixel(Size(screenWidth * 3, screenHeight));
+ pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+ pDevice->DrawText(Point(0, 0), rText);
bmpWidth = aRect.Right() - aRect.Left();
bmpHeight = aRect.Bottom() - aRect.Top();
- maBitmap = BitmapEx(aDevice.GetBitmapEx(aRect.TopLeft(), Size(bmpWidth, bmpHeight)));
+ maBitmap = BitmapEx(pDevice->GetBitmapEx(aRect.TopLeft(), Size(bmpWidth, bmpHeight)));
rCache.insertBitmap(aKey, maBitmap);
}
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 19f6f933a677..1b64ef1d193e 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -625,19 +625,19 @@ int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill)
int OpenGLRender::CreateTextTexture(::rtl::OUString const &textValue, vcl::Font aFont, long , awt::Point aPos, awt::Size aSize, long rotation)
{
- VirtualDevice aDevice(*Application::GetDefaultDevice(), 0, 0);
- aDevice.Erase();
+ ScopedVclPtrInstance< VirtualDevice > pDevice(*Application::GetDefaultDevice(), 0, 0);
+ pDevice->Erase();
Rectangle aRect;
- aDevice.SetFont(aFont);
- aDevice.GetTextBoundRect(aRect, textValue);
+ pDevice->SetFont(aFont);
+ pDevice->GetTextBoundRect(aRect, textValue);
int screenWidth = (aRect.BottomRight().X() + 3) & ~3;
int screenHeight = (aRect.BottomRight().Y() + 3) & ~3;
- aDevice.SetOutputSizePixel(Size(screenWidth * 3, screenHeight));
- aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
- aDevice.DrawText(Point(0, 0), textValue);
+ pDevice->SetOutputSizePixel(Size(screenWidth * 3, screenHeight));
+ pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+ pDevice->DrawText(Point(0, 0), textValue);
int bmpWidth = (aRect.Right() - aRect.Left() + 3) & ~3;
int bmpHeight = (aRect.Bottom() - aRect.Top() + 3) & ~3;
- BitmapEx aBitmap = BitmapEx(aDevice.GetBitmapEx(aRect.TopLeft(), Size(bmpWidth, bmpHeight)));
+ BitmapEx aBitmap = BitmapEx(pDevice->GetBitmapEx(aRect.TopLeft(), Size(bmpWidth, bmpHeight)));
sal_Int32 nXPos = aPos.X;
sal_Int32 nYPos = aPos.Y;
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
new file mode 100644
index 000000000000..e12e9572b385
--- /dev/null
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -0,0 +1,458 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <string>
+#include <iostream>
+
+#include "plugin.hxx"
+#include "compat.hxx"
+#include "clang/AST/CXXInheritance.h"
+
+// Final goal: Checker for VCL widget references. Makes sure that VCL Window subclasses are properly referenced counted and dispose()'ed.
+//
+// But at the moment it just finds subclasses of Window which are not heap-allocated
+//
+// TODO do I need to check for local and static variables, too ?
+// TODO when we have a dispose() method, verify that the dispose() methods releases all of the Window references
+// TODO when we have a dispose() method, verify that it calls the super-class dispose() method at some point.
+
+namespace {
+
+class VCLWidgets:
+ public RecursiveASTVisitor<VCLWidgets>, public loplugin::Plugin
+{
+public:
+ explicit VCLWidgets(InstantiationData const & data): Plugin(data) {}
+
+ virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+
+ bool VisitVarDecl(const VarDecl *);
+
+ bool VisitFieldDecl(const FieldDecl *);
+
+ bool VisitParmVarDecl(const ParmVarDecl *);
+
+ bool VisitFunctionDecl(const FunctionDecl *);
+
+ bool VisitCXXDestructorDecl(const CXXDestructorDecl *);
+
+ bool VisitCXXDeleteExpr(const CXXDeleteExpr *);
+
+private:
+ bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl);
+};
+
+static bool startsWith(const std::string& s, const char* other)
+{
+ return s.compare(0, strlen(other), other) == 0;
+}
+
+bool BaseCheckNotWindowSubclass(const CXXRecordDecl *BaseDefinition, void *) {
+ if (BaseDefinition && BaseDefinition->getQualifiedNameAsString() == "OutputDevice") {
+ return false;
+ }
+ return true;
+}
+
+bool isDerivedFromWindow(const CXXRecordDecl *decl) {
+ if (!decl)
+ return false;
+ if (decl->getQualifiedNameAsString() == "OutputDevice")
+ return true;
+ if (!decl->hasDefinition()) {
+ return false;
+ }
+ if (// not sure what hasAnyDependentBases() does,
+ // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
+ !decl->hasAnyDependentBases() &&
+ !decl->forallBases(BaseCheckNotWindowSubclass, nullptr, true)) {
+ return true;
+ }
+ return false;
+}
+
+bool containsWindowSubclass(const Type* pType0);
+
+bool containsWindowSubclass(const QualType& qType) {
+ if (startsWith(qType.getAsString(), "VclPtr"))
+ return false;
+ if (startsWith(qType.getAsString(), "const VclPtr"))
+ return false;
+ if (startsWith(qType.getAsString(), "class VclPtr"))
+ return false;
+ if (startsWith(qType.getAsString(), "const class VclPtr"))
+ return false;
+ if (startsWith(qType.getAsString(), "ScopedVclPtr"))
+ return false;
+ if (startsWith(qType.getAsString(), "class ScopedVclPtr"))
+ return false;
+ if (startsWith(qType.getAsString(), "const class ScopedVclPtr"))
+ return false;
+ return containsWindowSubclass(qType.getTypePtr());
+}
+
+bool containsWindowSubclass(const Type* pType0) {
+ if (!pType0)
+ return false;
+ const Type* pType = pType0->getUnqualifiedDesugaredType();
+ if (!pType)
+ return false;
+ const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl();
+ if (pRecordDecl) {
+ const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl);
+ if (pTemplate) {
+ for(unsigned i=0; i<pTemplate->getTemplateArgs().size(); ++i) {
+ const TemplateArgument& rArg = pTemplate->getTemplateArgs()[i];
+ if (rArg.getKind() == TemplateArgument::ArgKind::Type &&
+ containsWindowSubclass(rArg.getAsType()))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ if (pType->isPointerType()) {
+ QualType pointeeType = pType->getPointeeType();
+ return containsWindowSubclass(pointeeType);
+ } else if (pType->isArrayType()) {
+ const ArrayType* pArrayType = dyn_cast<ArrayType>(pType);
+ QualType elementType = pArrayType->getElementType();
+ return containsWindowSubclass(elementType);
+ } else {
+ return isDerivedFromWindow(pRecordDecl);
+ }
+}
+
+bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorDecl)
+{
+ if (ignoreLocation(pCXXDestructorDecl)) {
+ return true;
+ }
+ if (!pCXXDestructorDecl->isThisDeclarationADefinition()) {
+ return true;
+ }
+ const CXXRecordDecl * pRecordDecl = pCXXDestructorDecl->getParent();
+ // ignore OutputDevice class
+ if (pRecordDecl->getQualifiedNameAsString() == "OutputDevice") {
+ return true;
+ }
+ // check if this class is derived from Window
+ if (!isDerivedFromWindow(pRecordDecl)) {
+ return true;
+ }
+ bool foundVclPtrField = false;
+ for(auto fieldDecl : pRecordDecl->fields()) {
+ const RecordType *pFieldRecordType = fieldDecl->getType()->getAs<RecordType>();
+ if (pFieldRecordType) {
+ const CXXRecordDecl *pFieldRecordTypeDecl = dyn_cast<CXXRecordDecl>(pFieldRecordType->getDecl());
+ if (startsWith(pFieldRecordTypeDecl->getQualifiedNameAsString(), "VclPtr")) {
+ foundVclPtrField = true;
+ break;
+ }
+ }
+ }
+ bool foundDispose = false;
+ for(auto methodDecl : pRecordDecl->methods()) {
+ if (methodDecl->isInstance() && methodDecl->param_size()==0 && methodDecl->getNameAsString() == "dispose") {
+ foundDispose = true;
+ break;
+ }
+ }
+ const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pCXXDestructorDecl->getBody());
+ // having an empty body and no dispose() method is fine
+ if (!foundVclPtrField && !foundDispose && pCompoundStatement && pCompoundStatement->size() == 0) {
+ return true;
+ }
+ if (foundVclPtrField && pCompoundStatement && pCompoundStatement->size() == 0) {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass with VclPtr field must call dispose() from it's destructor.",
+ pCXXDestructorDecl->getLocStart())
+ << pCXXDestructorDecl->getSourceRange();
+ return true;
+ }
+ // check that the destructor for a OutputDevice subclass does nothing except call into the dispose() method
+ bool ok = false;
+ if (pCompoundStatement && pCompoundStatement->size() == 1) {
+ const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_begin());
+ if (pCallExpr) {
+ if( const FunctionDecl* func = pCallExpr->getDirectCallee()) {
+ if( func->getNumParams() == 0 && func->getIdentifier() != NULL
+ && ( func->getName() == "disposeOnce" )) {
+ ok = true;
+ }
+ }
+ }
+ }
+ if (!ok) {
+ SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
+ pCXXDestructorDecl->getLocStart());
+ StringRef filename = compiler.getSourceManager().getFilename(spellingLocation);
+ if ( !(filename.startswith(SRCDIR "/vcl/source/window/window.cxx"))
+ && !(filename.startswith(SRCDIR "/vcl/source/gdi/virdev.cxx")) )
+ {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass should have nothing in it's destructor but a call to disposeOnce().",
+ pCXXDestructorDecl->getLocStart())
+ << pCXXDestructorDecl->getSourceRange();
+ }
+ }
+ return true;
+}
+
+
+bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
+ if (ignoreLocation(pVarDecl)) {
+ return true;
+ }
+ const RecordType *recordType = pVarDecl->getType()->getAs<RecordType>();
+ if (recordType == nullptr) {
+ return true;
+ }
+ const CXXRecordDecl *recordDecl = dyn_cast<CXXRecordDecl>(recordType->getDecl());
+ if (recordDecl == nullptr) {
+ return true;
+ }
+
+ // check if this field is derived from Window
+ if (isDerivedFromWindow(recordDecl)) {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass allocated on stack, should be allocated via VclPtr or via *.",
+ pVarDecl->getLocation())
+ << pVarDecl->getSourceRange();
+ }
+ if ( !startsWith(pVarDecl->getType().getAsString(), "std::vector<vcl::Window *>")
+ && !startsWith(pVarDecl->getType().getAsString(), "std::map<vcl::Window *, Size>")
+ && !startsWith(pVarDecl->getType().getAsString(), "std::map<vcl::Window *, class Size>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::vector<class Button *>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::vector<Button *>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::mem_fun1_t<")
+ && !startsWith(pVarDecl->getType().getAsString(), "::comphelper::mem_fun1_t<")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::pair<formula::RefButton *, formula::RefEdit *>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::pair<RefButton *, RefEdit *>")
+ && !startsWith(pVarDecl->getType().getAsString(), "std::list<SwSidebarWin *>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::map<OTableWindow *, sal_Int32>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::map<class OTableWindow *, sal_Int32>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, OTableWindow *>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::std::multimap<sal_Int32, class OTableWindow *>")
+ && !startsWith(pVarDecl->getType().getAsString(), "::dbp::OMultiInstanceAutoRegistration< ::dbp::OUnoAutoPilot<")
+ && !startsWith(pVarDecl->getType().getAsString(), "SwSidebarWin_iterator")
+ && !startsWith(pVarDecl->getType().getAsString(), "functor_vector_type")
+ && !startsWith(pVarDecl->getType().getAsString(), "const functor_vector_type")
+ && containsWindowSubclass(pVarDecl->getType()))
+ {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass should be wrapped in VclPtr. " + pVarDecl->getType().getAsString(),
+ pVarDecl->getLocation())
+ << pVarDecl->getSourceRange();
+ }
+ return true;
+}
+
+bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
+ if (ignoreLocation(fieldDecl)) {
+ return true;
+ }
+ if (fieldDecl->isBitField()) {
+ return true;
+ }
+ const CXXRecordDecl *pParentRecordDecl = dyn_cast<CXXRecordDecl>(fieldDecl->getParent());
+ if (containsWindowSubclass(fieldDecl->getType())) {
+ // have to ignore this for now, nasty reverse dependency from tools->vcl
+ if (!(pParentRecordDecl != nullptr && pParentRecordDecl->getQualifiedNameAsString() == "ErrorContextImpl")) {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass declared as a pointer field, should be wrapped in VclPtr." + fieldDecl->getType().getAsString(),
+ fieldDecl->getLocation())
+ << fieldDecl->getSourceRange();
+ return true;
+ }
+ }
+ const RecordType *recordType = fieldDecl->getType()->getAs<RecordType>();
+ if (recordType == nullptr) {
+ return true;
+ }
+ const CXXRecordDecl *recordDecl = dyn_cast<CXXRecordDecl>(recordType->getDecl());
+ if (recordDecl == nullptr) {
+ return true;
+ }
+
+ // check if this field is derived from Window
+ if (isDerivedFromWindow(recordDecl)) {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass allocated as a class member, should be allocated via VclPtr.",
+ fieldDecl->getLocation())
+ << fieldDecl->getSourceRange();
+ }
+
+ // If this field is a VclPtr field, then the class MUST have a dispose method
+ if (pParentRecordDecl && isDerivedFromWindow(pParentRecordDecl)
+ && startsWith(recordDecl->getQualifiedNameAsString(), "VclPtr"))
+ {
+ bool foundDispose = false;
+ for(auto methodDecl : pParentRecordDecl->methods()) {
+ if (methodDecl->isInstance() && methodDecl->param_size()==0 && methodDecl->getNameAsString() == "dispose") {
+ foundDispose = true;
+ break;
+ }
+ }
+ if (!foundDispose) {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass with a VclPtr field MUST have a dispose() method.",
+ fieldDecl->getLocation())
+ << fieldDecl->getSourceRange();
+ }
+ if (!pParentRecordDecl->hasUserDeclaredDestructor()) {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass with a VclPtr field MUST have an explicit destructor.",
+ fieldDecl->getLocation())
+ << fieldDecl->getSourceRange();
+ }
+ }
+
+ return true;
+}
+
+bool VCLWidgets::VisitParmVarDecl(ParmVarDecl const * pvDecl)
+{
+ if (ignoreLocation(pvDecl)) {
+ return true;
+ }
+ // ignore the stuff in the VclPtr template class
+ const CXXMethodDecl *pMethodDecl = dyn_cast<CXXMethodDecl>(pvDecl->getDeclContext());
+ if (pMethodDecl
+ && pMethodDecl->getParent()->getQualifiedNameAsString().find("VclPtr") != std::string::npos) {
+ return true;
+ }
+ // we exclude this method in VclBuilder because it's so useful to have it like this
+ if (pMethodDecl
+ && pMethodDecl->getNameAsString() == "get"
+ && (pMethodDecl->getParent()->getQualifiedNameAsString() == "VclBuilder"
+ || pMethodDecl->getParent()->getQualifiedNameAsString() == "VclBuilderContainer"))
+ {
+ return true;
+ }
+ return true;
+}
+
+bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
+{
+ if (ignoreLocation(functionDecl)) {
+ return true;
+ }
+ // ignore the stuff in the VclPtr template class
+ const CXXMethodDecl *pMethodDecl = dyn_cast<CXXMethodDecl>(functionDecl);
+ if (pMethodDecl
+ && pMethodDecl->getParent()->getQualifiedNameAsString() == "VclPtr") {
+ return true;
+ }
+ // ignore the OutputDevice::dispose() method
+ if (pMethodDecl
+ && pMethodDecl->getParent()->getQualifiedNameAsString() == "OutputDevice") {
+ return true;
+ }
+ if (functionDecl->hasBody() && pMethodDecl && isDerivedFromWindow(pMethodDecl->getParent())) {
+ // check the last thing that the dispose() method does, is to call into the superclass dispose method
+ if (pMethodDecl->getNameAsString() == "dispose") {
+ if (!isDisposeCallingSuperclassDispose(pMethodDecl)) {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass dispose() method MUST call it's superclass dispose() as the last thing it does",
+ functionDecl->getLocStart())
+ << functionDecl->getSourceRange();
+ }
+ }
+ }
+
+ return true;
+}
+
+bool VCLWidgets::VisitCXXDeleteExpr(const CXXDeleteExpr *pCXXDeleteExpr)
+{
+ if (ignoreLocation(pCXXDeleteExpr)) {
+ return true;
+ }
+ const CXXRecordDecl *pPointee = pCXXDeleteExpr->getArgument()->getType()->getPointeeCXXRecordDecl();
+ if (pPointee && isDerivedFromWindow(pPointee)) {
+ SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
+ pCXXDeleteExpr->getLocStart());
+ StringRef filename = compiler.getSourceManager().getFilename(spellingLocation);
+ if ( !(filename.startswith(SRCDIR "/include/vcl/outdev.hxx")))
+ {
+ report(
+ DiagnosticsEngine::Warning,
+ "calling delete on instance of OutputDevice subclass, must rather call disposeAndClear()",
+ pCXXDeleteExpr->getLocStart())
+ << pCXXDeleteExpr->getSourceRange();
+ }
+ }
+ const ImplicitCastExpr* pImplicitCastExpr = dyn_cast<ImplicitCastExpr>(pCXXDeleteExpr->getArgument());
+ if (!pImplicitCastExpr) {
+ return true;
+ }
+ if (pImplicitCastExpr->getCastKind() != CK_UserDefinedConversion) {
+ return true;
+ }
+ report(
+ DiagnosticsEngine::Warning,
+ "calling delete on instance of VclPtr, must rather call disposeAndClear()",
+ pCXXDeleteExpr->getLocStart())
+ << pCXXDeleteExpr->getSourceRange();
+ return true;
+}
+
+
+/**
+The AST looks like:
+`-CXXMemberCallExpr 0xb06d8b0 'void'
+ `-MemberExpr 0xb06d868 '<bound member function type>' ->dispose 0x9d34880
+ `-ImplicitCastExpr 0xb06d8d8 'class SfxTabPage *' <UncheckedDerivedToBase (SfxTabPage)>
+ `-CXXThisExpr 0xb06d850 'class SfxAcceleratorConfigPage *' this
+
+*/
+bool VCLWidgets::isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl)
+{
+ const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pMethodDecl->getBody());
+ if (!pCompoundStatement) return false;
+ if (pCompoundStatement->size() == 0) return false;
+ // find the last statement
+ const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_rbegin());
+ if (!pCallExpr) return false;
+ const MemberExpr *pMemberExpr = dyn_cast<MemberExpr>(pCallExpr->getCallee());
+ if (!pMemberExpr) return false;
+ if (pMemberExpr->getMemberDecl()->getNameAsString() != "dispose") return false;
+ const CXXMethodDecl *pDirectCallee = dyn_cast<CXXMethodDecl>(pCallExpr->getDirectCallee());
+ if (!pDirectCallee) return false;
+/* Not working yet. Partially because sometimes the superclass does not a dispose() method, so it gets passed up the chain.
+ Need complex checking for that case.
+ if (pDirectCallee->getParent()->getTypeForDecl() != (*pMethodDecl->getParent()->bases_begin()).getType().getTypePtr()) {
+ report(
+ DiagnosticsEngine::Warning,
+ "dispose() method calling wrong baseclass, calling " + pDirectCallee->getParent()->getQualifiedNameAsString() +
+ " should be calling " + (*pMethodDecl->getParent()->bases_begin()).getType().getAsString(),
+ pCallExpr->getLocStart())
+ << pCallExpr->getSourceRange();
+ return false;
+ }*/
+ return true;
+}
+
+
+
+loplugin::Plugin::Registration< VCLWidgets > X("vclwidgets");
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index a2f8c65a6d88..682e5d992971 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -61,7 +61,7 @@ void OPredicateCompiler::dispose()
{
Clean();
m_orgColumns = NULL;
-m_xIndexes.clear();
+ m_xIndexes.clear();
}
void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
diff --git a/cppcanvas/qa/unit/test.cxx b/cppcanvas/qa/unit/test.cxx
index 02a361692f76..6b909e058a44 100644
--- a/cppcanvas/qa/unit/test.cxx
+++ b/cppcanvas/qa/unit/test.cxx
@@ -43,7 +43,7 @@ public:
void CanvasTest::testComposite()
{
#ifdef LINUX
- boost::scoped_ptr<vcl::Window> pWin(new WorkWindow( (vcl::Window *)NULL ));
+ VclPtrInstance<WorkWindow> pWin( nullptr, WB_STDWORK );
uno::Reference<rendering::XCanvas> xCanvas = pWin->GetCanvas ();
if( !xCanvas.is() )
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 9e93995ed2af..9aeabbaefde3 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -2908,16 +2908,16 @@ namespace cppcanvas
VectorOfOutDevStates aStateStack;
- VirtualDevice aVDev;
- aVDev.EnableOutput( false );
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
+ aVDev->EnableOutput( false );
// Setup VDev for state tracking and mapping
// =========================================
- aVDev.SetMapMode( rMtf.GetPrefMapMode() );
+ aVDev->SetMapMode( rMtf.GetPrefMapMode() );
const Size aMtfSize( rMtf.GetPrefSize() );
- const Size aMtfSizePixPre( aVDev.LogicToPixel( aMtfSize,
+ const Size aMtfSizePixPre( aVDev->LogicToPixel( aMtfSize,
rMtf.GetPrefMapMode() ) );
// #i44110# correct null-sized output - there are shapes
@@ -2928,7 +2928,7 @@ namespace cppcanvas
sal_Int32 nCurrActions(0);
ActionFactoryParameters aParms(aStateStack,
rCanvas,
- aVDev,
+ *aVDev.get(),
rParams,
nCurrActions );
@@ -2942,7 +2942,7 @@ namespace cppcanvas
1.0 / aMtfSizePix.Height() );
tools::calcLogic2PixelAffineTransform( aStateStack.getState().mapModeTransform,
- aVDev );
+ *aVDev.get() );
ColorSharedPtr pColor( getCanvas()->createColor() );
diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
index 8237a12216b4..a943e36a198c 100644
--- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
+++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
@@ -242,10 +242,10 @@ namespace cppcanvas
// render our content into an appropriately sized
// VirtualDevice with alpha channel
- VirtualDevice aVDev(
+ ScopedVclPtrInstance<VirtualDevice> aVDev(
*::Application::GetDefaultDevice(), 0, 0 );
- aVDev.SetOutputSizePixel( aBitmapSizePixel );
- aVDev.SetMapMode();
+ aVDev->SetOutputSizePixel( aBitmapSizePixel );
+ aVDev->SetMapMode();
if( rSubset.mnSubsetBegin != 0 ||
rSubset.mnSubsetEnd != -1 )
@@ -334,7 +334,7 @@ namespace cppcanvas
}
}
- aVDev.DrawTransparent( aMtf,
+ aVDev->DrawTransparent( aMtf,
aEmptyPoint,
aOutputSizePixel,
*mpAlphaGradient );
@@ -342,7 +342,7 @@ namespace cppcanvas
else
{
// no subsetting - render whole mtf
- aVDev.DrawTransparent( *mpGroupMtf,
+ aVDev->DrawTransparent( *mpGroupMtf,
aEmptyPoint,
aOutputSizePixel,
*mpAlphaGradient );
@@ -352,7 +352,7 @@ namespace cppcanvas
// update buffered bitmap and transformation
BitmapSharedPtr aBmp( VCLFactory::createBitmap(
mpCanvas,
- aVDev.GetBitmapEx(
+ aVDev->GetBitmapEx(
aEmptyPoint,
aBitmapSizePixel ) ) );
mxBufferBitmap = aBmp->getUNOBitmap();
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 05aa1343d5c8..40360a67a398 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -672,6 +672,17 @@ void SfxAccCfgTabListBox_Impl::InitEntry(SvTreeListEntry* pEntry,
SvTabListBox::InitEntry(pEntry, rText, rImage1, rImage2, eButtonKind);
}
+SfxAccCfgTabListBox_Impl::~SfxAccCfgTabListBox_Impl()
+{
+ disposeOnce();
+}
+
+void SfxAccCfgTabListBox_Impl::dispose()
+{
+ m_pAccelConfigPage.clear();
+ SvTabListBox::dispose();
+}
+
/** select the entry, which match the current key input ... excepting
keys, which are used for the dialog itself.
*/
@@ -800,6 +811,11 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( vcl::Window* pParent, const
SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
{
+ disposeOnce();
+}
+
+void SfxAcceleratorConfigPage::dispose()
+{
// free memory - remove all dynamic user data
SvTreeListEntry* pEntry = m_pEntriesBox->First();
while (pEntry)
@@ -823,6 +839,21 @@ SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
m_pKeyBox->Clear();
delete m_pFileDlg;
+ m_pFileDlg = NULL;
+
+ m_pEntriesBox.clear();
+ m_pOfficeButton.clear();
+ m_pModuleButton.clear();
+ m_pChangeButton.clear();
+ m_pRemoveButton.clear();
+ m_pGroupLBox.clear();
+ m_pFunctionBox.clear();
+ m_pKeyBox.clear();
+ m_pLoadButton.clear();
+ m_pSaveButton.clear();
+ m_pResetButton.clear();
+
+ SfxTabPage::dispose();
}
void SfxAcceleratorConfigPage::InitAccCfg()
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index aa1cd010af66..96ed1acc96b5 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -735,24 +735,24 @@ ConvertToolbarEntry(
return aPropSeq;
}
-SfxTabPage *CreateSvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> CreateSvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new SvxMenuConfigPage( pParent, *rSet );
+ return VclPtr<SvxMenuConfigPage>::Create( pParent, *rSet );
}
-SfxTabPage *CreateKeyboardConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> CreateKeyboardConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new SfxAcceleratorConfigPage( pParent, *rSet );
+ return VclPtr<SfxAcceleratorConfigPage>::Create( pParent, *rSet );
}
-SfxTabPage *CreateSvxToolbarConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> CreateSvxToolbarConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new SvxToolbarConfigPage( pParent, *rSet );
+ return VclPtr<SvxToolbarConfigPage>::Create( pParent, *rSet );
}
-SfxTabPage *CreateSvxEventConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> CreateSvxEventConfigPage( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new SvxEventConfigPage( pParent, *rSet, SvxEventConfigPage::EarlyInit() );
+ return VclPtr<SvxEventConfigPage>::Create( pParent, *rSet, SvxEventConfigPage::EarlyInit() );
}
namespace {
@@ -1397,7 +1397,13 @@ SvxMenuEntriesListBox::SvxMenuEntriesListBox(vcl::Window* pParent, SvxConfigPage
SvxMenuEntriesListBox::~SvxMenuEntriesListBox()
{
- // do nothing
+ disposeOnce();
+}
+
+void SvxMenuEntriesListBox::dispose()
+{
+ pPage.clear();
+ SvTreeListBox::dispose();
}
// drag and drop support
@@ -1547,6 +1553,32 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
m_pDescriptionField->EnableCursor( false );
}
+SvxConfigPage::~SvxConfigPage()
+{
+ disposeOnce();
+}
+
+void SvxConfigPage::dispose()
+{
+ m_pTopLevel.clear();
+ m_pTopLevelLabel.clear();
+ m_pTopLevelListBox.clear();
+ m_pNewTopLevelButton.clear();
+ m_pModifyTopLevelButton.clear();
+ m_pContents.clear();
+ m_pContentsLabel.clear();
+ m_pEntries.clear();
+ m_pContentsListBox.disposeAndClear();
+ m_pAddCommandsButton.clear();
+ m_pModifyCommandButton.clear();
+ m_pMoveUpButton.clear();
+ m_pMoveDownButton.clear();
+ m_pSaveInListBox.clear();
+ m_pDescriptionField.clear();
+ m_pSelectorDlg.disposeAndClear();
+ SfxTabPage::dispose();
+}
+
void SvxConfigPage::Reset( const SfxItemSet* )
{
// If we haven't initialised our XMultiServiceFactory reference
@@ -2174,7 +2206,7 @@ bool SvxConfigPage::MoveEntryData(
SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
: SvxConfigPage(pParent, rSet)
{
- m_pContentsListBox = new SvxMenuEntriesListBox(m_pEntries, this);
+ m_pContentsListBox = VclPtr<SvxMenuEntriesListBox>::Create(m_pEntries, this);
m_pContentsListBox->set_grid_left_attach(0);
m_pContentsListBox->set_grid_top_attach(0);
m_pContentsListBox->set_hexpand(true);
@@ -2211,6 +2243,11 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe
LINK( this, SvxMenuConfigPage, EntrySelectHdl ) );
}
+SvxMenuConfigPage::~SvxMenuConfigPage()
+{
+ disposeOnce();
+}
+
// Populates the Menu combo box
void SvxMenuConfigPage::Init()
{
@@ -2224,7 +2261,7 @@ void SvxMenuConfigPage::Init()
m_pTopLevelListBox->GetSelectHdl().Call(this);
}
-SvxMenuConfigPage::~SvxMenuConfigPage()
+void SvxMenuConfigPage::dispose()
{
for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
{
@@ -2233,9 +2270,11 @@ SvxMenuConfigPage::~SvxMenuConfigPage()
delete pData;
}
+ m_pSaveInListBox->Clear();
- delete m_pSelectorDlg;
- delete m_pContentsListBox;
+ m_pSelectorDlg.clear();
+ m_pContentsListBox.clear();
+ SvxConfigPage::dispose();
}
IMPL_LINK( SvxMenuConfigPage, SelectMenuEntry, Control *, pBox )
@@ -2354,9 +2393,9 @@ short SvxMenuConfigPage::QueryReset()
OUString label = replaceSaveInName( msg, saveInName );
- QueryBox qbox( this, WB_YES_NO, label );
+ ScopedVclPtrInstance<QueryBox> qbox( this, WB_YES_NO, label );
- return qbox.Execute();
+ return qbox->Execute();
}
IMPL_LINK( SvxMenuConfigPage, SelectMenu, ListBox *, pBox )
@@ -2404,7 +2443,7 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
OUString aNewName( stripHotKey( pMenuData->GetName() ) );
OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_MENU ) );
@@ -2421,8 +2460,8 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
- boost::scoped_ptr<SvxMainMenuOrganizerDialog> pDialog(
- new SvxMainMenuOrganizerDialog( this,
+ VclPtr<SvxMainMenuOrganizerDialog> pDialog(
+ VclPtr<SvxMainMenuOrganizerDialog>::Create( this,
GetSaveInData()->GetEntries(), pMenuData ));
if ( pDialog->Execute() == RET_OK )
@@ -2447,7 +2486,7 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
OUString aNewName;
OUString aDesc = CUI_RESSTR( RID_SVXSTR_SUBMENU_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_NAME_SUBMENU );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_ADD_SUBMENU ) );
@@ -2484,7 +2523,7 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
OUString aNewName( stripHotKey( pEntry->GetName() ) );
OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU_ITEM );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_MENU ) );
@@ -2524,9 +2563,8 @@ IMPL_LINK( SvxMenuConfigPage, NewMenuHdl, Button *, pButton )
{
(void)pButton;
- boost::scoped_ptr<SvxMainMenuOrganizerDialog> pDialog(
- new SvxMainMenuOrganizerDialog( 0,
- GetSaveInData()->GetEntries(), NULL, true ));
+ VclPtrInstance<SvxMainMenuOrganizerDialog> pDialog(
+ nullptr, GetSaveInData()->GetEntries(), nullptr, true );
if ( pDialog->Execute() == RET_OK )
{
@@ -2542,10 +2580,10 @@ IMPL_LINK( SvxMenuConfigPage, AddCommandsHdl, Button *, pButton )
{
(void)pButton;
- if ( m_pSelectorDlg == NULL )
+ if ( m_pSelectorDlg == nullptr )
{
// Create Script Selector which also shows builtin commands
- m_pSelectorDlg = new SvxScriptSelectorDialog( this, true, m_xFrame );
+ m_pSelectorDlg = VclPtr<SvxScriptSelectorDialog>::Create( this, true, m_xFrame );
m_pSelectorDlg->SetAddHdl(
LINK( this, SvxMenuConfigPage, AddFunctionHdl ) );
@@ -2655,6 +2693,21 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) );
}
+SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog()
+{
+ disposeOnce();
+}
+
+void SvxMainMenuOrganizerDialog::dispose()
+{
+ m_pMenuBox.clear();
+ m_pMenuNameEdit.clear();
+ m_pMenuListBox.clear();
+ m_pMoveUpButton.clear();
+ m_pMoveDownButton.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
{
(void)pEdit;
@@ -2675,10 +2728,6 @@ IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
return 0;
}
-SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog()
-{
-}
-
IMPL_LINK( SvxMainMenuOrganizerDialog, SelectHdl, Control*, pCtrl )
{
(void)pCtrl;
@@ -2838,7 +2887,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
{
SetHelpId( HID_SVX_CONFIG_TOOLBAR );
- m_pContentsListBox = new SvxToolbarEntriesListBox(m_pEntries, this);
+ m_pContentsListBox = VclPtr<SvxToolbarEntriesListBox>::Create(m_pEntries, this);
m_pContentsListBox->set_grid_left_attach(0);
m_pContentsListBox->set_grid_top_attach(0);
m_pContentsListBox->set_hexpand(true);
@@ -2916,6 +2965,11 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
SvxToolbarConfigPage::~SvxToolbarConfigPage()
{
+ disposeOnce();
+}
+
+void SvxToolbarConfigPage::dispose()
+{
for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
{
ToolbarSaveInData* pData =
@@ -2923,14 +2977,11 @@ SvxToolbarConfigPage::~SvxToolbarConfigPage()
delete pData;
}
+ m_pSaveInListBox->Clear();
- if ( m_pSelectorDlg != NULL )
- {
- delete m_pSelectorDlg;
- }
-
-
- delete m_pContentsListBox;
+ m_pSelectorDlg.disposeAndClear();
+ m_pContentsListBox.disposeAndClear();
+ SvxConfigPage::dispose();
}
void SvxToolbarConfigPage::DeleteSelectedTopLevel()
@@ -2993,10 +3044,10 @@ bool SvxToolbarConfigPage::DeleteSelectedContent()
if ( m_pContentsListBox->GetEntryCount() == 0 &&
GetTopLevelSelection()->IsDeletable() )
{
- MessageDialog qbox(this,
+ ScopedVclPtrInstance<MessageDialog> qbox(this,
CUI_RES(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( qbox.Execute() == RET_YES )
+ if ( qbox->Execute() == RET_YES )
{
DeleteSelectedTopLevel();
}
@@ -3051,7 +3102,7 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
OUString aNewName( stripHotKey( pToolbar->GetName() ) );
OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) );
@@ -3073,10 +3124,10 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
}
case ID_DEFAULT_STYLE:
{
- MessageDialog qbox(this,
+ ScopedVclPtrInstance<MessageDialog> qbox(this,
CUI_RES(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( qbox.Execute() == RET_YES )
+ if ( qbox->Execute() == RET_YES )
{
ToolbarSaveInData* pSaveInData_ =
static_cast<ToolbarSaveInData*>(GetSaveInData());
@@ -3137,7 +3188,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
OUString aNewName( stripHotKey( pEntry->GetName() ) );
OUString aDesc = CUI_RESSTR( RID_SVXSTR_LABEL_NEW_NAME );
- boost::scoped_ptr<SvxNameDialog> pNameDialog(new SvxNameDialog( this, aNewName, aDesc ));
+ VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM );
pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) );
@@ -3267,8 +3318,8 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
}
}
- boost::scoped_ptr<SvxIconSelectorDialog> pIconDialog(
- new SvxIconSelectorDialog( 0,
+ VclPtr<SvxIconSelectorDialog> pIconDialog(
+ VclPtr<SvxIconSelectorDialog>::Create( nullptr,
GetSaveInData()->GetImageManager(),
GetSaveInData()->GetParentImageManager() ));
@@ -4304,9 +4355,9 @@ short SvxToolbarConfigPage::QueryReset()
OUString label = replaceSaveInName( msg, saveInName );
- QueryBox qbox( this, WB_YES_NO, label );
+ ScopedVclPtrInstance< QueryBox > qbox( this, WB_YES_NO, label );
- return qbox.Execute();
+ return qbox->Execute();
}
IMPL_LINK( SvxToolbarConfigPage, SelectToolbar, ListBox *, pBox )
@@ -4395,7 +4446,7 @@ IMPL_LINK( SvxToolbarConfigPage, NewToolbarHdl, Button *, pButton )
OUString aNewURL =
generateCustomURL( GetSaveInData()->GetEntries() );
- boost::scoped_ptr<SvxNewToolbarDialog> pNameDialog(new SvxNewToolbarDialog( 0, aNewName ));
+ VclPtrInstance< SvxNewToolbarDialog > pNameDialog( nullptr, aNewName );
sal_uInt16 nInsertPos;
for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
@@ -4450,10 +4501,10 @@ IMPL_LINK( SvxToolbarConfigPage, AddCommandsHdl, Button *, pButton )
{
(void)pButton;
- if ( m_pSelectorDlg == NULL )
+ if ( m_pSelectorDlg == nullptr )
{
// Create Script Selector which shows slot commands
- m_pSelectorDlg = new SvxScriptSelectorDialog( this, true, m_xFrame );
+ m_pSelectorDlg = VclPtr<SvxScriptSelectorDialog>::Create( this, true, m_xFrame );
// Position the Script Selector over the Add button so it is
// beside the menu contents list and does not obscure it
@@ -4522,7 +4573,16 @@ SvxToolbarEntriesListBox::SvxToolbarEntriesListBox(vcl::Window* pParent, SvxTool
SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox()
{
+ disposeOnce();
+}
+
+void SvxToolbarEntriesListBox::dispose()
+{
delete m_pButtonData;
+ m_pButtonData = NULL;
+
+ pPage.clear();
+ SvxMenuEntriesListBox::dispose();
}
void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pData )
@@ -4532,28 +4592,28 @@ void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pDat
// in all color modes, like high contrast.
const AllSettings& rSettings = Application::GetSettings();
- VirtualDevice aDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
Size aSize( 26, 20 );
- aDev.SetOutputSizePixel( aSize );
+ pVDev->SetOutputSizePixel( aSize );
- Image aImage = GetSizedImage( aDev, aSize,
+ Image aImage = GetSizedImage( *pVDev.get(), aSize,
CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT ));
// Fill button data struct with new images
pData->SetImage(SvBmp::UNCHECKED, aImage);
- pData->SetImage(SvBmp::CHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED )) );
- pData->SetImage(SvBmp::HICHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED )) );
- pData->SetImage(SvBmp::HIUNCHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED)) );
- pData->SetImage(SvBmp::TRISTATE, GetSizedImage( aDev, aSize, Image() ) ); // Use tristate bitmaps to have no checkbox for separator entries
- pData->SetImage(SvBmp::HITRISTATE, GetSizedImage( aDev, aSize, Image() ) );
+ pData->SetImage(SvBmp::CHECKED, GetSizedImage( *pVDev.get(), aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED )) );
+ pData->SetImage(SvBmp::HICHECKED, GetSizedImage( *pVDev.get(), aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED )) );
+ pData->SetImage(SvBmp::HIUNCHECKED, GetSizedImage( *pVDev.get(), aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED)) );
+ pData->SetImage(SvBmp::TRISTATE, GetSizedImage( *pVDev.get(), aSize, Image() ) ); // Use tristate bitmaps to have no checkbox for separator entries
+ pData->SetImage(SvBmp::HITRISTATE, GetSizedImage( *pVDev.get(), aSize, Image() ) );
// Get image size
m_aCheckBoxImageSizePixel = aImage.GetSizePixel();
}
Image SvxToolbarEntriesListBox::GetSizedImage(
- VirtualDevice& aDev, const Size& aNewSize, const Image& aImage )
+ VirtualDevice& rVDev, const Size& aNewSize, const Image& aImage )
{
// Create new checkbox images for treelistbox. They must have a
// decent width to have a clear column for the visibility checkbox.
@@ -4567,18 +4627,18 @@ Image SvxToolbarEntriesListBox::GetSizedImage(
sal_uInt16 nPosX = std::max( (sal_uInt16) (((( aNewSize.Width() - 2 ) - aImage.GetSizePixel().Width() ) / 2 ) - 1), (sal_uInt16) 0 );
sal_uInt16 nPosY = std::max( (sal_uInt16) (((( aNewSize.Height() - 2 ) - aImage.GetSizePixel().Height() ) / 2 ) + 1), (sal_uInt16) 0 );
Point aPos( nPosX > 0 ? nPosX : 0, nPosY > 0 ? nPosY : 0 );
- aDev.SetFillColor( aFillColor );
- aDev.SetLineColor( aFillColor );
- aDev.DrawRect( Rectangle( Point(), aNewSize ));
- aDev.DrawImage( aPos, aImage );
+ rVDev.SetFillColor( aFillColor );
+ rVDev.SetLineColor( aFillColor );
+ rVDev.DrawRect( Rectangle( Point(), aNewSize ));
+ rVDev.DrawImage( aPos, aImage );
// Draw separator line 2 pixels left from the right border
Color aLineColor = GetDisplayBackground().GetColor().IsDark() ? Color( COL_WHITE ) : Color( COL_BLACK );
- aDev.SetLineColor( aLineColor );
- aDev.DrawLine( Point( aNewSize.Width()-3, 0 ), Point( aNewSize.Width()-3, aNewSize.Height()-1 ));
+ rVDev.SetLineColor( aLineColor );
+ rVDev.DrawLine( Point( aNewSize.Width()-3, 0 ), Point( aNewSize.Width()-3, aNewSize.Height()-1 ));
// Create new image that uses the fillcolor as transparent
- return Image( aDev.GetBitmap( Point(), aNewSize ), aFillColor );
+ return Image( rVDev.GetBitmap( Point(), aNewSize ), aFillColor );
}
void SvxToolbarEntriesListBox::DataChanged( const DataChangedEvent& rDCEvt )
@@ -4673,7 +4733,7 @@ TriState SvxToolbarEntriesListBox::NotifyCopying(
if ( !m_bIsInternalDrag )
{
// if the target is NULL then add function to the start of the list
- static_cast<SvxToolbarConfigPage*>(pPage)->AddFunction( pTarget, pTarget == NULL );
+ static_cast<SvxToolbarConfigPage*>(pPage.get())->AddFunction( pTarget, pTarget == NULL );
// Instant Apply changes to UI
SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection();
@@ -4705,6 +4765,20 @@ SvxNewToolbarDialog::SvxNewToolbarDialog(vcl::Window* pWindow, const OUString& r
m_pEdtName->SetModifyHdl(LINK(this, SvxNewToolbarDialog, ModifyHdl));
}
+SvxNewToolbarDialog::~SvxNewToolbarDialog()
+{
+ disposeOnce();
+}
+
+void SvxNewToolbarDialog::dispose()
+{
+ m_pEdtName.clear();
+ m_pBtnOK.clear();
+ m_pSaveInListBox.clear();
+ ModalDialog::dispose();
+}
+
+
IMPL_LINK(SvxNewToolbarDialog, ModifyHdl, Edit*, pEdit)
{
(void)pEdit;
@@ -4906,20 +4980,32 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
SvxIconSelectorDialog::~SvxIconSelectorDialog()
{
- sal_uInt16 nCount = pTbSymbol->GetItemCount();
+ disposeOnce();
+}
- for (sal_uInt16 n = 0; n < nCount; ++n )
+void SvxIconSelectorDialog::dispose()
+{
+ if (pTbSymbol)
{
- sal_uInt16 nId = pTbSymbol->GetItemId(n);
-
- uno::XInterface* xi = static_cast< uno::XInterface* >(
- pTbSymbol->GetItemData( nId ) );
+ sal_uInt16 nCount = pTbSymbol->GetItemCount();
- if ( xi != NULL )
+ for (sal_uInt16 n = 0; n < nCount; ++n )
{
+ sal_uInt16 nId = pTbSymbol->GetItemId(n);
+
+ uno::XInterface* xi = static_cast< uno::XInterface* >(
+ pTbSymbol->GetItemData( nId ) );
+
+ if ( xi != NULL )
xi->release();
}
}
+
+ pTbSymbol.clear();
+ pFtNote.clear();
+ pBtnImport.clear();
+ pBtnDelete.clear();
+ ModalDialog::dispose();
}
uno::Reference< graphic::XGraphic> SvxIconSelectorDialog::GetSelectedIcon()
@@ -5211,8 +5297,8 @@ void SvxIconSelectorDialog::ImportGraphics(
message += newLine;
}
- SvxIconChangeDialog aDialog(this, message);
- aDialog.Execute();
+ ScopedVclPtrInstance< SvxIconChangeDialog > aDialog(this, message);
+ aDialog->Execute();
}
}
@@ -5364,4 +5450,16 @@ SvxIconChangeDialog::SvxIconChangeDialog(
pLineEditDescription->SetText(aMessage);
}
+SvxIconChangeDialog::~SvxIconChangeDialog()
+{
+ disposeOnce();
+}
+
+void SvxIconChangeDialog::dispose()
+{
+ pFImageInfo.clear();
+ pLineEditDescription.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 53c954415098..875b71b57fe3 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -276,7 +276,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSfxConfigFunctionListB
SfxConfigFunctionListBox::~SfxConfigFunctionListBox()
{
+ disposeOnce();
+}
+
+void SfxConfigFunctionListBox::dispose()
+{
ClearAll();
+ SvTreeListBox::dispose();
}
void SfxConfigFunctionListBox::MouseMove( const MouseEvent& )
@@ -423,7 +429,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSfxConfigGroupListBox(
SfxConfigGroupListBox::~SfxConfigGroupListBox()
{
+ disposeOnce();
+}
+
+void SfxConfigGroupListBox::dispose()
+{
ClearAll();
+ pFunctionListBox.clear();
+ SvTreeListBox::dispose();
}
void SfxConfigGroupListBox::ClearAll()
diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
index e466d526a747..20e00dedd7a1 100644
--- a/cui/source/customize/eventdlg.cxx
+++ b/cui/source/customize/eventdlg.cxx
@@ -103,6 +103,11 @@ void SvxEventConfigPage::LateInit( const uno::Reference< frame::XFrame >& _rxFra
SvxEventConfigPage::~SvxEventConfigPage()
{
+ disposeOnce();
+}
+
+void SvxEventConfigPage::dispose()
+{
// need to delete the user data
SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
SvTreeListEntry* pE = rListBox.GetEntry( 0 );
@@ -113,6 +118,8 @@ SvxEventConfigPage::~SvxEventConfigPage()
pE->SetUserData((void*)0);
pE = SvTreeListBox::NextSibling( pE );
}
+ m_pSaveInListBox.clear();
+ _SvxMacroTabPage::dispose();
}
void SvxEventConfigPage::ImplInitDocument()
diff --git a/cui/source/customize/eventdlg.hxx b/cui/source/customize/eventdlg.hxx
index 06d5433fa67b..385df86d1bbb 100644
--- a/cui/source/customize/eventdlg.hxx
+++ b/cui/source/customize/eventdlg.hxx
@@ -29,7 +29,7 @@
class SvxEventConfigPage : public _SvxMacroTabPage
{
- ListBox* m_pSaveInListBox;
+ VclPtr<ListBox> m_pSaveInListBox;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocumentEvents;
@@ -48,6 +48,7 @@ public:
struct EarlyInit { };
SvxEventConfigPage( vcl::Window *pParent, const SfxItemSet& rSet, EarlyInit );
virtual ~SvxEventConfigPage();
+ virtual void dispose() SAL_OVERRIDE;
void LateInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index dec5a9fb3e6b..fc5194af6567 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -83,32 +83,32 @@ static long nTabs[] =
IMPL_LINK( MacroEventListBox, HeaderEndDrag_Impl, HeaderBar*, pBar )
{
- DBG_ASSERT( pBar == &maHeaderBar, "*MacroEventListBox::HeaderEndDrag_Impl: something is wrong here..." );
+ DBG_ASSERT( pBar == maHeaderBar.get(), "*MacroEventListBox::HeaderEndDrag_Impl: something is wrong here..." );
(void)pBar;
- if( !maHeaderBar.GetCurItemId() )
+ if( !maHeaderBar->GetCurItemId() )
return 0;
- if( !maHeaderBar.IsItemMode() )
+ if( !maHeaderBar->IsItemMode() )
{
Size aSz;
- sal_uInt16 _nTabs = maHeaderBar.GetItemCount();
- long nWidth = maHeaderBar.GetItemSize( ITEMID_EVENT );
- long nBarWidth = maHeaderBar.GetSizePixel().Width();
+ sal_uInt16 _nTabs = maHeaderBar->GetItemCount();
+ long nWidth = maHeaderBar->GetItemSize( ITEMID_EVENT );
+ long nBarWidth = maHeaderBar->GetSizePixel().Width();
if( nWidth < TAB_WIDTH_MIN )
- maHeaderBar.SetItemSize( ITEMID_EVENT, TAB_WIDTH_MIN );
+ maHeaderBar->SetItemSize( ITEMID_EVENT, TAB_WIDTH_MIN );
else if( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
- maHeaderBar.SetItemSize( ITEMID_EVENT, nBarWidth - TAB_WIDTH_MIN );
+ maHeaderBar->SetItemSize( ITEMID_EVENT, nBarWidth - TAB_WIDTH_MIN );
{
long nTmpSz = 0;
for( sal_uInt16 i = 1 ; i < _nTabs ; ++i )
{
- long _nWidth = maHeaderBar.GetItemSize( i );
+ long _nWidth = maHeaderBar->GetItemSize( i );
aSz.Width() = _nWidth + nTmpSz;
nTmpSz += _nWidth;
- maListBox.SetTab( i, PixelToLogic( aSz, MapMode( MAP_APPFONT ) ).Width(), MAP_APPFONT );
+ maListBox->SetTab( i, PixelToLogic( aSz, MapMode( MAP_APPFONT ) ).Width(), MAP_APPFONT );
}
}
}
@@ -121,8 +121,8 @@ bool MacroEventListBox::Notify( NotifyEvent& rNEvt )
if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS )
{
- if ( rNEvt.GetWindow() != &maListBox )
- maListBox.GrabFocus();
+ if ( rNEvt.GetWindow() != maListBox.get() )
+ maListBox->GrabFocus();
}
return nRet;
@@ -130,13 +130,25 @@ bool MacroEventListBox::Notify( NotifyEvent& rNEvt )
MacroEventListBox::MacroEventListBox( vcl::Window* pParent, WinBits nStyle )
: Control( pParent, nStyle )
- , maHeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER )
- , maListBox( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP )
+ , maHeaderBar( VclPtr<HeaderBar>::Create( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER ) )
+ , maListBox( VclPtr<SvHeaderTabListBox>::Create( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ) )
{
- maListBox.SetHelpId( HID_MACRO_HEADERTABLISTBOX );
+ maListBox->SetHelpId( HID_MACRO_HEADERTABLISTBOX );
// enable the cell focus to show visible focus
- maListBox.EnableCellFocus();
+ maListBox->EnableCellFocus();
+}
+
+MacroEventListBox::~MacroEventListBox()
+{
+ disposeOnce();
+}
+
+void MacroEventListBox::dispose()
+{
+ maHeaderBar.disposeAndClear();
+ maListBox.disposeAndClear();
+ Control::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeMacroEventListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap)
@@ -161,15 +173,15 @@ void MacroEventListBox::Resize()
// calc pos and size of header bar
Point aPnt( 0, 0 );
- Size aSize( maHeaderBar.CalcWindowSizePixel() );
+ Size aSize( maHeaderBar->CalcWindowSizePixel() );
Size aCtrlSize( GetOutputSizePixel() );
aSize.Width() = aCtrlSize.Width();
- maHeaderBar.SetPosSizePixel( aPnt, aSize );
+ maHeaderBar->SetPosSizePixel( aPnt, aSize );
// calc pos and size of ListBox
aPnt.Y() += aSize.Height();
aSize.Height() = aCtrlSize.Height() - aSize.Height();
- maListBox.SetPosSizePixel( aPnt, aSize );
+ maListBox->SetPosSizePixel( aPnt, aSize );
}
void MacroEventListBox::ConnectElements()
@@ -177,21 +189,21 @@ void MacroEventListBox::ConnectElements()
Resize();
// set handler
- maHeaderBar.SetEndDragHdl( LINK( this, MacroEventListBox, HeaderEndDrag_Impl ) );
+ maHeaderBar->SetEndDragHdl( LINK( this, MacroEventListBox, HeaderEndDrag_Impl ) );
- maListBox.InitHeaderBar( &maHeaderBar );
+ maListBox->InitHeaderBar( maHeaderBar.get() );
}
void MacroEventListBox::Show( bool bVisible, sal_uInt16 nFlags )
{
- maListBox.Show( bVisible, nFlags );
- maHeaderBar.Show( bVisible, nFlags );
+ maListBox->Show( bVisible, nFlags );
+ maHeaderBar->Show( bVisible, nFlags );
}
void MacroEventListBox::Enable( bool bEnable, bool bChild )
{
- maListBox.Enable( bEnable, bChild );
- maHeaderBar.Enable( bEnable, bChild );
+ maListBox->Enable( bEnable, bChild );
+ maHeaderBar->Enable( bEnable, bChild );
}
// assign button ("Add Command") is enabled only if it is not read only
@@ -226,7 +238,13 @@ _SvxMacroTabPage::_SvxMacroTabPage(vcl::Window* pParent, const OString& rID,
_SvxMacroTabPage::~_SvxMacroTabPage()
{
+ disposeOnce();
+}
+
+void _SvxMacroTabPage::dispose()
+{
DELETEZ( mpImpl );
+ SfxTabPage::dispose();
}
void _SvxMacroTabPage::InitResources()
@@ -640,7 +658,7 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton*
)
)
{
- boost::scoped_ptr<AssignComponentDialog> pAssignDlg(new AssignComponentDialog( pThis, sEventURL ));
+ VclPtrInstance< AssignComponentDialog > pAssignDlg( pThis, sEventURL );
short ret = pAssignDlg->Execute();
if( ret )
@@ -654,7 +672,7 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton*
else if( bAssEnabled )
{
// assign pressed
- boost::scoped_ptr<SvxScriptSelectorDialog> pDlg(new SvxScriptSelectorDialog( pThis, false, pThis->GetFrame() ));
+ VclPtrInstance< SvxScriptSelectorDialog > pDlg( pThis, false, pThis->GetFrame() );
if( pDlg )
{
short ret = pDlg->Execute();
@@ -836,7 +854,7 @@ SvxMacroAssignDlg::SvxMacroAssignDlg( vcl::Window* pParent, const Reference< fra
const Reference< container::XNameReplace >& xNameReplace, sal_uInt16 nSelectedIndex )
: SvxMacroAssignSingleTabDialog(pParent, rSet)
{
- SetTabPage(new SvxMacroTabPage(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex));
+ SetTabPage(VclPtr<SvxMacroTabPage>::Create(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex));
}
@@ -872,9 +890,15 @@ AssignComponentDialog::AssignComponentDialog( vcl::Window * pParent, const OUStr
AssignComponentDialog::~AssignComponentDialog()
{
+ disposeOnce();
}
-
+void AssignComponentDialog::dispose()
+{
+ mpMethodEdit.clear();
+ mpOKButton.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, pButton )
{
diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx
index dd7909275085..f80697fb5783 100644
--- a/cui/source/customize/macropg_impl.hxx
+++ b/cui/source/customize/macropg_impl.hxx
@@ -25,14 +25,14 @@ class _SvxMacroTabPage_Impl
public:
_SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet );
- PushButton* pAssignPB;
- PushButton* pAssignComponentPB;
- PushButton* pDeletePB;
+ VclPtr<PushButton> pAssignPB;
+ VclPtr<PushButton> pAssignComponentPB;
+ VclPtr<PushButton> pDeletePB;
Image aMacroImg;
Image aComponentImg;
OUString sStrEvent;
OUString sAssignedMacro;
- MacroEventListBox* pEventLB;
+ VclPtr<MacroEventListBox> pEventLB;
bool bReadOnly;
bool bIDEDialogMode;
};
@@ -40,8 +40,8 @@ public:
class AssignComponentDialog : public ModalDialog
{
private:
- Edit* mpMethodEdit;
- OKButton* mpOKButton;
+ VclPtr<Edit> mpMethodEdit;
+ VclPtr<OKButton> mpOKButton;
OUString maURL;
@@ -50,6 +50,7 @@ private:
public:
AssignComponentDialog( vcl::Window * pParent, const OUString& rURL );
virtual ~AssignComponentDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString getURL() const
{ return maURL; }
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
index ee962883068e..7477032f1567 100644
--- a/cui/source/customize/selector.cxx
+++ b/cui/source/customize/selector.cxx
@@ -99,7 +99,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxConfigFunctionListB
SvxConfigFunctionListBox::~SvxConfigFunctionListBox()
{
+ disposeOnce();
+}
+
+void SvxConfigFunctionListBox::dispose()
+{
ClearAll();
+ SvTreeListBox::dispose();
}
SvTreeListEntry* SvxConfigFunctionListBox::GetLastSelectedEntry()
@@ -227,7 +233,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxConfigGroupListBox(
SvxConfigGroupListBox::~SvxConfigGroupListBox()
{
+ disposeOnce();
+}
+
+void SvxConfigGroupListBox::dispose()
+{
ClearAll();
+ pFunctionListBox.clear();
+ SvTreeListBox::dispose();
}
void SvxConfigGroupListBox::ClearAll()
@@ -908,6 +921,18 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
{
+ disposeOnce();
+}
+
+void SvxScriptSelectorDialog::dispose()
+{
+ m_pDialogDescription.clear();
+ m_pCategories.clear();
+ m_pCommands.clear();
+ m_pOKButton.clear();
+ m_pCancelButton.clear();
+ m_pDescriptionText.clear();
+ ModelessDialog::dispose();
}
IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl )
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index c9462aaa3e8a..dc58061832d7 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -246,17 +246,43 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
SpellDialog::~SpellDialog()
{
- // save possibly modified user-dictionaries
- Reference< XSearchableDictionaryList > xDicList( SvxGetDictionaryList() );
- if (xDicList.is())
- {
- SaveDictionaries( xDicList );
- }
-
- delete pImpl;
+ disposeOnce();
}
+void SpellDialog::dispose()
+{
+ if (pImpl)
+ {
+ // save possibly modified user-dictionaries
+ Reference< XSearchableDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ SaveDictionaries( xDicList );
+ delete pImpl;
+ pImpl = NULL;
+ }
+ m_pLanguageFT.clear();
+ m_pLanguageLB.clear();
+ m_pExplainFT.clear();
+ m_pExplainLink.clear();
+ m_pNotInDictFT.clear();
+ m_pSentenceED.clear();
+ m_pSuggestionFT.clear();
+ m_pSuggestionLB.clear();
+ m_pIgnorePB.clear();
+ m_pIgnoreAllPB.clear();
+ m_pIgnoreRulePB.clear();
+ m_pAddToDictPB.clear();
+ m_pAddToDictMB.clear();
+ m_pChangePB.clear();
+ m_pChangeAllPB.clear();
+ m_pAutoCorrPB.clear();
+ m_pCheckGrammarCB.clear();
+ m_pOptionsPB.clear();
+ m_pUndoPB.clear();
+ m_pClosePB.clear();
+ SfxModelessDialog::dispose();
+}
void SpellDialog::Init_Impl()
{
@@ -497,10 +523,10 @@ void SpellDialog::StartSpellOptDlg_Impl()
};
SfxItemSet aSet( SfxGetpApp()->GetPool(), aSpellInfos);
aSet.Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
- boost::scoped_ptr<SfxSingleTabDialog> pDlg(
- new SfxSingleTabDialog(this, aSet, "SpellOptionsDialog", "cui/ui/spelloptionsdialog.ui"));
- SfxTabPage* pPage = SvxLinguTabPage::Create( pDlg->get_content_area(), &aSet );
- static_cast<SvxLinguTabPage*>(pPage)->HideGroups( GROUP_MODULES );
+ VclPtr<SfxSingleTabDialog> pDlg(
+ VclPtr<SfxSingleTabDialog>::Create(this, aSet, "SpellOptionsDialog", "cui/ui/spelloptionsdialog.ui"));
+ VclPtr<SfxTabPage> pPage = SvxLinguTabPage::Create( pDlg->get_content_area(), &aSet );
+ static_cast<SvxLinguTabPage*>(pPage.get())->HideGroups( GROUP_MODULES );
pDlg->SetTabPage( pPage );
if(RET_OK == pDlg->Execute())
{
@@ -1199,9 +1225,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSentenceEditWindow(vcl
}
-SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
-{
-}
/*-------------------------------------------------------------------------
The selection before inputting a key may have a range or not
and it may be inside or outside of field or error attributes.
@@ -2032,9 +2055,9 @@ IMPL_LINK( SpellDialog, HandleHyperlink, FixedHyperlink*, pHyperlink )
uno::Any exc( ::cppu::getCaughtException() );
OUString msg( ::comphelper::anyToString( exc ) );
const SolarMutexGuard guard;
- MessageDialog aErrorBox(NULL, msg);
- aErrorBox.SetText(sTitle);
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg);
+ aErrorBox->SetText(sTitle);
+ aErrorBox->Execute();
}
return 1;
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index f5761d3093ff..1250e098e6ad 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -98,6 +98,23 @@ AboutDialog::AboutDialog(vcl::Window* pParent)
get<PushButton>("close")->GrabFocus();
}
+AboutDialog::~AboutDialog()
+{
+ disposeOnce();
+}
+
+void AboutDialog::dispose()
+{
+ m_pVersion.clear();
+ m_pDescriptionText.clear();
+ m_pCopyrightText.clear();
+ m_pLogoImage.clear();
+ m_pLogoReplacement.clear();
+ m_pCreditsButton.clear();
+ m_pWebsiteButton.clear();
+ SfxModalDialog::dispose();
+}
+
IMPL_LINK( AboutDialog, HandleClick, PushButton*, pButton )
{
OUString sURL = "";
@@ -126,9 +143,9 @@ IMPL_LINK( AboutDialog, HandleClick, PushButton*, pButton )
Any exc( ::cppu::getCaughtException() );
OUString msg( ::comphelper::anyToString( exc ) );
const SolarMutexGuard guard;
- MessageDialog aErrorBox(NULL, msg);
- aErrorBox.SetText( GetText() );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg);
+ aErrorBox->SetText( GetText() );
+ aErrorBox->Execute();
}
return 1;
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index d1015e844e97..539c1e5f777b 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -309,6 +309,7 @@ class ColorFieldControl : public Control
public:
ColorFieldControl( vcl::Window* pParent, const WinBits& nStyle );
virtual ~ColorFieldControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -359,7 +360,14 @@ ColorFieldControl::ColorFieldControl( vcl::Window* pParent, const WinBits& nStyl
ColorFieldControl::~ColorFieldControl()
{
+ disposeOnce();
+}
+
+void ColorFieldControl::dispose()
+{
delete mpBitmap;
+ mpBitmap = NULL;
+ Control::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorFieldControl(vcl::Window *pParent, VclBuilder::stringmap &rMap)
@@ -702,6 +710,7 @@ class ColorSliderControl : public Control
public:
ColorSliderControl( vcl::Window* pParent, const WinBits& nStyle );
virtual ~ColorSliderControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -744,7 +753,14 @@ ColorSliderControl::ColorSliderControl( vcl::Window* pParent, const WinBits& nSt
ColorSliderControl::~ColorSliderControl()
{
+ disposeOnce();
+}
+
+void ColorSliderControl::dispose()
+{
delete mpBitmap;
+ mpBitmap = NULL;
+ Control::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorSliderControl(vcl::Window *pParent, VclBuilder::stringmap &rMap)
@@ -957,6 +973,8 @@ class ColorPickerDialog : public ModalDialog
{
public:
ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sal_Int16 nMode );
+ virtual ~ColorPickerDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
void update_color( sal_uInt16 n = UPDATE_ALL );
@@ -976,35 +994,35 @@ private:
double mdCyan, mdMagenta, mdYellow, mdKey;
private:
- ColorFieldControl* mpColorField;
- ColorSliderControl* mpColorSlider;
- ColorPreviewControl* mpColorPreview;
- ColorPreviewControl* mpColorPrevious;
+ VclPtr<ColorFieldControl> mpColorField;
+ VclPtr<ColorSliderControl> mpColorSlider;
+ VclPtr<ColorPreviewControl> mpColorPreview;
+ VclPtr<ColorPreviewControl> mpColorPrevious;
- FixedImage* mpFISliderLeft;
- FixedImage* mpFISliderRight;
+ VclPtr<FixedImage> mpFISliderLeft;
+ VclPtr<FixedImage> mpFISliderRight;
Image maSliderImage;
- RadioButton* mpRBRed;
- RadioButton* mpRBGreen;
- RadioButton* mpRBBlue;
- RadioButton* mpRBHue;
- RadioButton* mpRBSaturation;
- RadioButton* mpRBBrightness;
-
- MetricField* mpMFRed;
- MetricField* mpMFGreen;
- MetricField* mpMFBlue;
- HexColorControl* mpEDHex;
-
- MetricField* mpMFHue;
- MetricField* mpMFSaturation;
- MetricField* mpMFBrightness;
-
- MetricField* mpMFCyan;
- MetricField* mpMFMagenta;
- MetricField* mpMFYellow;
- MetricField* mpMFKey;
+ VclPtr<RadioButton> mpRBRed;
+ VclPtr<RadioButton> mpRBGreen;
+ VclPtr<RadioButton> mpRBBlue;
+ VclPtr<RadioButton> mpRBHue;
+ VclPtr<RadioButton> mpRBSaturation;
+ VclPtr<RadioButton> mpRBBrightness;
+
+ VclPtr<MetricField> mpMFRed;
+ VclPtr<MetricField> mpMFGreen;
+ VclPtr<MetricField> mpMFBlue;
+ VclPtr<HexColorControl> mpEDHex;
+
+ VclPtr<MetricField> mpMFHue;
+ VclPtr<MetricField> mpMFSaturation;
+ VclPtr<MetricField> mpMFBrightness;
+
+ VclPtr<MetricField> mpMFCyan;
+ VclPtr<MetricField> mpMFMagenta;
+ VclPtr<MetricField> mpMFYellow;
+ VclPtr<MetricField> mpMFKey;
};
ColorPickerDialog::ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sal_Int16 nMode )
@@ -1110,6 +1128,34 @@ ColorPickerDialog::ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sa
update_color();
}
+void ColorPickerDialog::dispose()
+{
+ mpColorField.clear();
+ mpColorSlider.clear();
+ mpColorPreview.clear();
+ mpColorPrevious.clear();
+ mpFISliderLeft.clear();
+ mpFISliderRight.clear();
+ mpRBRed.clear();
+ mpRBGreen.clear();
+ mpRBBlue.clear();
+ mpRBHue.clear();
+ mpRBSaturation.clear();
+ mpRBBrightness.clear();
+ mpMFRed.clear();
+ mpMFGreen.clear();
+ mpMFBlue.clear();
+ mpEDHex.clear();
+ mpMFHue.clear();
+ mpMFSaturation.clear();
+ mpMFBrightness.clear();
+ mpMFCyan.clear();
+ mpMFMagenta.clear();
+ mpMFYellow.clear();
+ mpMFKey.clear();
+ ModalDialog::dispose();
+}
+
static int toInt( double dValue, double dRange )
{
return static_cast< int >( std::floor((dValue * dRange) + 0.5 ) );
@@ -1495,10 +1541,10 @@ void SAL_CALL ColorPicker::setTitle( const OUString& sTitle ) throw (RuntimeExce
sal_Int16 SAL_CALL ColorPicker::execute( ) throw (RuntimeException, std::exception)
{
- ColorPickerDialog aDlg( VCLUnoHelper::GetWindow( mxParent ), mnColor, mnMode );
- sal_Int16 ret = aDlg.Execute();
+ ScopedVclPtrInstance< ColorPickerDialog > aDlg( VCLUnoHelper::GetWindow( mxParent ), mnColor, mnMode );
+ sal_Int16 ret = aDlg->Execute();
if( ret )
- mnColor = aDlg.GetColor();
+ mnColor = aDlg->GetColor();
return ret;
}
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 6764c45f15fa..a351d820c872 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -100,15 +100,25 @@ SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, bool bOne_, const SfxIte
CreateOutputItemSet( pSet ? *pSet->GetPool() : SfxGetpApp()->GetPool() );
}
-
-
SvxCharacterMap::~SvxCharacterMap()
{
+ disposeOnce();
}
-
-
-
+void SvxCharacterMap::dispose()
+{
+ m_pShowSet.clear();
+ m_pShowText.clear();
+ m_pOKBtn.clear();
+ m_pFontText.clear();
+ m_pFontLB.clear();
+ m_pSubsetText.clear();
+ m_pSubsetLB.clear();
+ m_pSymbolText.clear();
+ m_pShowChar.clear();
+ m_pCharCodeText.clear();
+ SfxModalDialog::dispose();
+}
void SvxCharacterMap::SetChar( sal_UCS4 c )
@@ -174,8 +184,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxShowText(vcl::Windo
return new SvxShowText(pParent);
}
-
-
void SvxShowText::Paint( const Rectangle& )
{
Color aTextCol = GetTextColor();
@@ -298,9 +306,6 @@ void SvxShowText::SetText( const OUString& rText )
-SvxShowText::~SvxShowText()
-{}
-
// class SvxCharacterMap =================================================
void SvxCharacterMap::init()
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index 6f3643d3a772..0e11f72b8ccd 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -160,18 +160,51 @@ FmSearchDialog::FmSearchDialog(vcl::Window* pParent, const OUString& sInitialTex
FmSearchDialog::~FmSearchDialog()
{
+ disposeOnce();
+}
+
+void FmSearchDialog::dispose()
+{
if (m_aDelayedPaint.IsActive())
m_aDelayedPaint.Stop();
SaveParams();
- if (m_pConfig)
- {
- delete m_pConfig;
- m_pConfig = NULL;
- }
+ delete m_pConfig;
+ m_pConfig = NULL;
delete m_pSearchEngine;
+ m_pSearchEngine = NULL;
+
+ m_prbSearchForText.clear();
+ m_prbSearchForNull.clear();
+ m_prbSearchForNotNull.clear();
+ m_pcmbSearchText.clear();
+ m_pftForm.clear();
+ m_plbForm.clear();
+ m_prbAllFields.clear();
+ m_prbSingleField.clear();
+ m_plbField.clear();
+ m_pftPosition.clear();
+ m_plbPosition.clear();
+ m_pcbUseFormat.clear();
+ m_pcbCase.clear();
+ m_pcbBackwards.clear();
+ m_pcbStartOver.clear();
+ m_pcbWildCard.clear();
+ m_pcbRegular.clear();
+ m_pcbApprox.clear();
+ m_ppbApproxSettings.clear();
+ m_pHalfFullFormsCJK.clear();
+ m_pSoundsLikeCJK.clear();
+ m_pSoundsLikeCJKSettings.clear();
+ m_pftRecord.clear();
+ m_pftHint.clear();
+ m_pbSearchAgain.clear();
+ m_pbClose.clear();
+ m_pPreSearchFocus.clear();
+
+ ModalDialog::dispose();
}
void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sInitialText)
@@ -604,7 +637,7 @@ void FmSearchDialog::EnableSearchUI(bool bEnable)
m_pPreSearchFocus->GrabFocus();
if ( WINDOW_EDIT == m_pPreSearchFocus->GetType() )
{
- Edit* pEdit = static_cast< Edit* >( m_pPreSearchFocus );
+ Edit* pEdit = static_cast< Edit* >( m_pPreSearchFocus.get() );
pEdit->SetSelection( Selection( 0, pEdit->GetText().getLength() ) );
}
}
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index a6a9ef3a507e..549d21054447 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -215,6 +215,19 @@ SearchProgress::SearchProgress( vcl::Window* pParent, const INetURLObject& rStar
m_pBtnCancel->SetClickHdl( LINK( this, SearchProgress, ClickCancelBtn ) );
}
+SearchProgress::~SearchProgress()
+{
+ disposeOnce();
+}
+
+void SearchProgress::dispose()
+{
+ m_pFtSearchDir.clear();
+ m_pFtSearchType.clear();
+ m_pBtnCancel.clear();
+ parent_.clear();
+ ModalDialog::dispose();
+}
void SearchProgress::Terminate()
@@ -240,7 +253,7 @@ IMPL_LINK_NOARG(SearchProgress, CleanUpHdl)
EndDialog( RET_OK );
- delete this;
+ disposeOnce();
return 0L;
}
@@ -260,7 +273,7 @@ void SearchProgress::StartExecuteModal( const Link& rEndDialogHdl )
{
assert(!maSearchThread.is());
maSearchThread = new SearchThread(
- this, static_cast< TPGalleryThemeProperties * >(parent_), startUrl_);
+ this, static_cast< TPGalleryThemeProperties * >(parent_.get()), startUrl_);
maSearchThread->launch();
ModalDialog::StartExecuteModal( rEndDialogHdl );
}
@@ -345,6 +358,19 @@ TakeProgress::TakeProgress(vcl::Window* pWindow)
m_pBtnCancel->SetClickHdl( LINK( this, TakeProgress, ClickCancelBtn ) );
}
+TakeProgress::~TakeProgress()
+{
+ disposeOnce();
+}
+
+void TakeProgress::dispose()
+{
+ m_pFtTakeFile.clear();
+ m_pBtnCancel.clear();
+ window_.clear();
+ ModalDialog::dispose();
+}
+
void TakeProgress::Terminate()
{
if (maTakeThread.is())
@@ -405,7 +431,7 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl)
GetParent()->LeaveWait();
EndDialog( RET_OK );
- delete this;
+ disposeOnce();
return 0L;
}
@@ -425,7 +451,7 @@ void TakeProgress::StartExecuteModal( const Link& rEndDialogHdl )
{
assert(!maTakeThread.is());
maTakeThread = new TakeThread(
- this, static_cast< TPGalleryThemeProperties * >(window_), maTakenList);
+ this, static_cast< TPGalleryThemeProperties * >(window_.get()), maTakenList);
maTakeThread->launch();
ModalDialog::StartExecuteModal( rEndDialogHdl );
}
@@ -443,6 +469,18 @@ ActualizeProgress::ActualizeProgress(vcl::Window* pWindow, GalleryTheme* pThm)
m_pBtnCancel->SetClickHdl( LINK( this, ActualizeProgress, ClickCancelBtn ) );
}
+ActualizeProgress::~ActualizeProgress()
+{
+ disposeOnce();
+}
+
+void ActualizeProgress::dispose()
+{
+ m_pFtActualizeFile.clear();
+ m_pBtnCancel.clear();
+ ModalDialog::dispose();
+}
+
short ActualizeProgress::Execute()
{
short nRet;
@@ -511,6 +549,17 @@ TitleDialog::TitleDialog(vcl::Window* pParent, const OUString& rOldTitle)
m_pEdit->GrabFocus();
}
+TitleDialog::~TitleDialog()
+{
+ disposeOnce();
+}
+
+void TitleDialog::dispose()
+{
+ m_pEdit.clear();
+ ModalDialog::dispose();
+}
+
// - GalleryIdDialog -
@@ -532,7 +581,17 @@ GalleryIdDialog::GalleryIdDialog( vcl::Window* pParent, GalleryTheme* _pThm )
m_pBtnOk->SetClickHdl( LINK( this, GalleryIdDialog, ClickOkHdl ) );
}
+GalleryIdDialog::~GalleryIdDialog()
+{
+ disposeOnce();
+}
+void GalleryIdDialog::dispose()
+{
+ m_pBtnOk.clear();
+ m_pLbResName.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl)
{
@@ -552,8 +611,8 @@ IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl)
aStr += pInfo->GetThemeName();
aStr += ")";
- InfoBox aBox( this, aStr );
- aBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aBox( this, aStr );
+ aBox->Execute();
m_pLbResName->GrabFocus();
bDifferentThemeExists = true;
}
@@ -616,6 +675,22 @@ TPGalleryThemeGeneral::TPGalleryThemeGeneral(vcl::Window* pParent, const SfxItem
get(m_pFtMSShowChangeDate, "modified");
}
+TPGalleryThemeGeneral::~TPGalleryThemeGeneral()
+{
+ disposeOnce();
+}
+
+void TPGalleryThemeGeneral::dispose()
+{
+ m_pFiMSImage.clear();
+ m_pEdtMSName.clear();
+ m_pFtMSShowType.clear();
+ m_pFtMSShowPath.clear();
+ m_pFtMSShowContent.clear();
+ m_pFtMSShowChangeDate.clear();
+ SfxTabPage::dispose();
+}
+
void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData )
{
pData = _pData;
@@ -682,9 +757,9 @@ bool TPGalleryThemeGeneral::FillItemSet( SfxItemSet* /*rSet*/ )
-SfxTabPage* TPGalleryThemeGeneral::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> TPGalleryThemeGeneral::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new TPGalleryThemeGeneral( pParent, *rSet );
+ return VclPtr<TPGalleryThemeGeneral>::Create( pParent, *rSet );
}
// - TPGalleryThemeProperties -
@@ -756,23 +831,34 @@ void TPGalleryThemeProperties::StartSearchFiles( const OUString& _rFolderURL, sh
TPGalleryThemeProperties::~TPGalleryThemeProperties()
{
+ disposeOnce();
+}
+
+void TPGalleryThemeProperties::dispose()
+{
xMediaPlayer.clear();
xDialogListener.clear();
for ( size_t i = 0, n = aFilterEntryList.size(); i < n; ++i ) {
delete aFilterEntryList[ i ];
}
+ aFilterEntryList.clear();
+
+ m_pCbbFileType.clear();
+ m_pLbxFound.clear();
+ m_pBtnSearch.clear();
+ m_pBtnTake.clear();
+ m_pBtnTakeAll.clear();
+ m_pCbxPreview.clear();
+ m_pWndPreview.clear();
+ SfxTabPage::dispose();
}
-
-
-SfxTabPage* TPGalleryThemeProperties::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> TPGalleryThemeProperties::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new TPGalleryThemeProperties( pParent, *rSet );
+ return VclPtr<TPGalleryThemeProperties>::Create( pParent, *rSet );
}
-
-
OUString TPGalleryThemeProperties::addExtension( const OUString& _rDisplayText, const OUString& _rExtension )
{
OUString sAllFilter( "(*.*)" );
@@ -951,7 +1037,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFileTypeHdl)
void TPGalleryThemeProperties::SearchFiles()
{
- SearchProgress* pProgress = new SearchProgress( this, aURL );
+ SearchProgress* pProgress = VclPtr<SearchProgress>::Create( this, aURL );
aFoundList.clear();
m_pLbxFound->Clear();
@@ -1010,12 +1096,12 @@ void TPGalleryThemeProperties::TakeFiles()
{
if( m_pLbxFound->GetSelectEntryCount() || ( bTakeAll && bEntriesFound ) )
{
- TakeProgress* pTakeProgress = new TakeProgress( this );
+ VclPtrInstance<TakeProgress> pTakeProgress( this );
pTakeProgress->Update();
pTakeProgress->StartExecuteModal(
Link() /* no postprocessing needed, pTakeProgress
- will be deleted in TakeProgress::CleanupHdl */ );
+ will be disposed in TakeProgress::CleanupHdl */ );
}
}
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index 9eb47497865e..9e84ce37c102 100644
--- a/cui/source/dialogs/cuigrfflt.cxx
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -153,6 +153,16 @@ GraphicFilterDialog::GraphicFilterDialog(vcl::Window* pParent,
mpPreview->init(&rGraphic, maModifyHdl);
}
+GraphicFilterDialog::~GraphicFilterDialog()
+{
+ disposeOnce();
+}
+
+void GraphicFilterDialog::dispose()
+{
+ mpPreview.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(GraphicFilterDialog, ImplPreviewTimeoutHdl)
@@ -204,7 +214,18 @@ GraphicFilterMosaic::GraphicFilterMosaic( vcl::Window* pParent, const Graphic& r
mpMtrWidth->GrabFocus();
}
+GraphicFilterMosaic::~GraphicFilterMosaic()
+{
+ disposeOnce();
+}
+void GraphicFilterMosaic::dispose()
+{
+ mpMtrWidth.clear();
+ mpMtrHeight.clear();
+ mpCbxEdges.clear();
+ GraphicFilterDialog::dispose();
+}
Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
double fScaleX, double fScaleY )
@@ -257,6 +278,16 @@ GraphicFilterSmooth::GraphicFilterSmooth( vcl::Window* pParent, const Graphic& r
mpMtrRadius->GrabFocus();
}
+GraphicFilterSmooth::~GraphicFilterSmooth()
+{
+ disposeOnce();
+}
+
+void GraphicFilterSmooth::dispose()
+{
+ mpMtrRadius.clear();
+ GraphicFilterDialog::dispose();
+}
Graphic GraphicFilterSmooth::GetFilteredGraphic( const Graphic& rGraphic, double /*fScaleX*/, double /*fScaleY*/ )
@@ -305,6 +336,17 @@ GraphicFilterSolarize::GraphicFilterSolarize( vcl::Window* pParent, const Graphi
mpCbxInvert->SetToggleHdl( GetModifyHdl() );
}
+GraphicFilterSolarize::~GraphicFilterSolarize()
+{
+ disposeOnce();
+}
+
+void GraphicFilterSolarize::dispose()
+{
+ mpMtrThreshold.clear();
+ mpCbxInvert.clear();
+ GraphicFilterDialog::dispose();
+}
Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic,
@@ -356,6 +398,16 @@ GraphicFilterSepia::GraphicFilterSepia( vcl::Window* pParent, const Graphic& rGr
mpMtrSepia->SetModifyHdl( GetModifyHdl() );
}
+GraphicFilterSepia::~GraphicFilterSepia()
+{
+ disposeOnce();
+}
+
+void GraphicFilterSepia::dispose()
+{
+ mpMtrSepia.clear();
+ GraphicFilterDialog::dispose();
+}
Graphic GraphicFilterSepia::GetFilteredGraphic( const Graphic& rGraphic,
@@ -399,6 +451,16 @@ GraphicFilterPoster::GraphicFilterPoster(vcl::Window* pParent, const Graphic& rG
mpNumPoster->SetModifyHdl( GetModifyHdl() );
}
+GraphicFilterPoster::~GraphicFilterPoster()
+{
+ disposeOnce();
+}
+
+void GraphicFilterPoster::dispose()
+{
+ mpNumPoster.clear();
+ GraphicFilterDialog::dispose();
+}
Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic,
@@ -462,6 +524,16 @@ GraphicFilterEmboss::GraphicFilterEmboss(vcl::Window* pParent,
mpCtlLight->GrabFocus();
}
+GraphicFilterEmboss::~GraphicFilterEmboss()
+{
+ disposeOnce();
+}
+
+void GraphicFilterEmboss::dispose()
+{
+ mpCtlLight.clear();
+ GraphicFilterDialog::dispose();
+}
Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic,
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 41dc5a1be98b..1270e09f92d4 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -93,7 +93,7 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
// insert pages
Image aImage;
OUString aStrTitle;
- SvxIconChoiceCtrlEntry* pEntry = NULL;
+ SvxIconChoiceCtrlEntry *pEntry;
aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP );
aImage = Image( CUI_RES ( RID_SVXBMP_HLINETTP ) );
@@ -157,11 +157,19 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
SvxHpLinkDlg::~SvxHpLinkDlg ()
{
+ disposeOnce();
+}
+
+void SvxHpLinkDlg::dispose()
+{
// delete config item, so the base class (IconChoiceDialog) can not load it on the next start
SvtViewOptions aViewOpt( E_TABDIALOG, OUString::number(SID_HYPERLINK_DIALOG) );
aViewOpt.Delete();
delete mpItemSet;
+ mpItemSet = NULL;
+
+ IconChoiceDialog::dispose();
}
/*************************************************************************
diff --git a/cui/source/dialogs/cuiimapwnd.cxx b/cui/source/dialogs/cuiimapwnd.cxx
index 118da3fc5c50..98e059a2109a 100644
--- a/cui/source/dialogs/cuiimapwnd.cxx
+++ b/cui/source/dialogs/cuiimapwnd.cxx
@@ -73,4 +73,19 @@ URLDlg::URLDlg( vcl::Window* pWindow, const OUString& rURL, const OUString& rAlt
m_pCbbTargets->SetText( rTarget );
}
+URLDlg::~URLDlg()
+{
+ disposeOnce();
+}
+
+void URLDlg::dispose()
+{
+ m_pEdtURL.clear();
+ m_pCbbTargets.clear();
+ m_pEdtName.clear();
+ m_pEdtAlternativeText.clear();
+ m_pEdtDescription.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/cuitbxform.cxx b/cui/source/dialogs/cuitbxform.cxx
index 46ae5b5e78d6..b54de7fe8e31 100644
--- a/cui/source/dialogs/cuitbxform.cxx
+++ b/cui/source/dialogs/cuitbxform.cxx
@@ -41,4 +41,15 @@ FmInputRecordNoDialog::FmInputRecordNoDialog(vcl::Window * pParent)
m_pRecordNo->SetDecimalDigits(0);
}
+FmInputRecordNoDialog::~FmInputRecordNoDialog()
+{
+ disposeOnce();
+}
+
+void FmInputRecordNoDialog::dispose()
+{
+ m_pRecordNo.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index 83ee94c07fce..7745404b4ae5 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -45,6 +45,19 @@ SvxNameDialog::SvxNameDialog( vcl::Window* pWindow, const OUString& rName, const
pEdtName->SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl));
}
+SvxNameDialog::~SvxNameDialog()
+{
+ disposeOnce();
+}
+
+void SvxNameDialog::dispose()
+{
+ pFtDescription.clear();
+ pEdtName.clear();
+ pBtnOK.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl)
{
if(aCheckNameHdl.IsSet())
@@ -73,6 +86,19 @@ SvxObjectNameDialog::SvxObjectNameDialog(
pEdtName->SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl));
}
+SvxObjectNameDialog::~SvxObjectNameDialog()
+{
+ disposeOnce();
+}
+
+void SvxObjectNameDialog::dispose()
+{
+ pEdtName.clear();
+ pBtnOK.clear();
+ ModalDialog::dispose();
+}
+
+
IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl)
{
if(aCheckNameHdl.IsSet())
@@ -105,6 +131,17 @@ SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(
pEdtTitle->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
}
+SvxObjectTitleDescDialog::~SvxObjectTitleDescDialog()
+{
+ disposeOnce();
+}
+
+void SvxObjectTitleDescDialog::dispose()
+{
+ pEdtTitle.clear();
+ pEdtDescription.clear();
+ ModalDialog::dispose();
+}
/*************************************************************************
@@ -138,7 +175,18 @@ SvxMessDialog::SvxMessDialog( vcl::Window* pWindow, const OUString& rText, const
SvxMessDialog::~SvxMessDialog()
{
+ disposeOnce();
+}
+
+void SvxMessDialog::dispose()
+{
delete pImage;
+ pImage = NULL;
+ pFtDescription.clear();
+ pBtn1.clear();
+ pBtn2.clear();
+ pFtImage.clear();
+ ModalDialog::dispose();
}
/*************************************************************************/
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index ade585801826..5fea052f03df 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -338,7 +338,13 @@ namespace svx
SuggestionSet::~SuggestionSet()
{
+ disposeOnce();
+ }
+
+ void SuggestionSet::dispose()
+ {
ClearSet();
+ ValueSet::dispose();
}
void SuggestionSet::UserDraw( const UserDrawEvent& rUDEvt )
@@ -366,29 +372,37 @@ namespace svx
SuggestionDisplay::SuggestionDisplay( vcl::Window* pParent, WinBits nBits )
: Control( pParent, nBits )
, m_bDisplayListBox( true )
- , m_aValueSet( this )
- , m_aListBox( this,GetStyle() | WB_BORDER )
+ , m_aValueSet( VclPtr<SuggestionSet>::Create(this) )
+ , m_aListBox( VclPtr<ListBox>::Create(this,GetStyle() | WB_BORDER) )
, m_bInSelectionUpdate( false )
{
- m_aValueSet.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
- m_aListBox.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
+ m_aValueSet->SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
+ m_aListBox->SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
- m_aValueSet.SetLineCount( LINE_CNT );
- m_aValueSet.SetStyle( m_aValueSet.GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL );
- m_aValueSet.SetBorderStyle( WindowBorderStyle::MONO );
+ m_aValueSet->SetLineCount( LINE_CNT );
+ m_aValueSet->SetStyle( m_aValueSet->GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL );
+ m_aValueSet->SetBorderStyle( WindowBorderStyle::MONO );
OUString aOneCharacter("AU");
long nItemWidth = 2*GetTextWidth( aOneCharacter );
- m_aValueSet.SetItemWidth( nItemWidth );
+ m_aValueSet->SetItemWidth( nItemWidth );
Size aSize( approximate_char_width() * 48, GetTextHeight() * 5 );
- m_aValueSet.SetSizePixel( aSize );
- m_aListBox.SetSizePixel( aSize );
+ m_aValueSet->SetSizePixel( aSize );
+ m_aListBox->SetSizePixel( aSize );
implUpdateDisplay();
}
SuggestionDisplay::~SuggestionDisplay()
{
+ disposeOnce();
+ }
+
+ void SuggestionDisplay::dispose()
+ {
+ m_aValueSet.disposeAndClear();
+ m_aListBox.disposeAndClear();
+ Control::dispose();
}
void SuggestionDisplay::implUpdateDisplay()
@@ -396,8 +410,8 @@ namespace svx
bool bShowBox = IsVisible() && m_bDisplayListBox;
bool bShowSet = IsVisible() && !m_bDisplayListBox;
- m_aListBox.Show( bShowBox );
- m_aValueSet.Show( bShowSet );
+ m_aListBox->Show( bShowBox );
+ m_aValueSet->Show( bShowSet );
}
void SuggestionDisplay::StateChanged( StateChangedType nStateChange )
@@ -409,8 +423,8 @@ namespace svx
Control& SuggestionDisplay::implGetCurrentControl()
{
if( m_bDisplayListBox )
- return m_aListBox;
- return m_aValueSet;
+ return *m_aListBox.get();
+ return *m_aValueSet.get();
}
void SuggestionDisplay::KeyInput( const KeyEvent& rKEvt )
@@ -467,15 +481,15 @@ namespace svx
return 0L;
m_bInSelectionUpdate = true;
- if( pControl == &m_aListBox )
+ if( pControl == m_aListBox.get() )
{
- sal_uInt16 nPos = m_aListBox.GetSelectEntryPos();
- m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
+ sal_uInt16 nPos = m_aListBox->GetSelectEntryPos();
+ m_aValueSet->SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
}
else
{
- sal_uInt16 nPos = m_aValueSet.GetSelectItemId()-1; //itemid == pos+1 (id 0 has special meaning)
- m_aListBox.SelectEntryPos( nPos );
+ sal_uInt16 nPos = m_aValueSet->GetSelectItemId()-1; //itemid == pos+1 (id 0 has special meaning)
+ m_aListBox->SelectEntryPos( nPos );
}
m_bInSelectionUpdate = false;
m_aSelectLink.Call( this );
@@ -488,38 +502,38 @@ namespace svx
}
void SuggestionDisplay::Clear()
{
- m_aListBox.Clear();
- m_aValueSet.Clear();
+ m_aListBox->Clear();
+ m_aValueSet->Clear();
}
void SuggestionDisplay::InsertEntry( const OUString& rStr )
{
- sal_uInt16 nItemId = m_aListBox.InsertEntry( rStr ) + 1; //itemid == pos+1 (id 0 has special meaning)
- m_aValueSet.InsertItem( nItemId );
+ sal_uInt16 nItemId = m_aListBox->InsertEntry( rStr ) + 1; //itemid == pos+1 (id 0 has special meaning)
+ m_aValueSet->InsertItem( nItemId );
OUString* pItemData = new OUString( rStr );
- m_aValueSet.SetItemData( nItemId, pItemData );
+ m_aValueSet->SetItemData( nItemId, pItemData );
}
void SuggestionDisplay::SelectEntryPos( sal_uInt16 nPos )
{
- m_aListBox.SelectEntryPos( nPos );
- m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
+ m_aListBox->SelectEntryPos( nPos );
+ m_aValueSet->SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
}
sal_uInt16 SuggestionDisplay::GetEntryCount() const
{
- return m_aListBox.GetEntryCount();
+ return m_aListBox->GetEntryCount();
}
OUString SuggestionDisplay::GetEntry( sal_uInt16 nPos ) const
{
- return m_aListBox.GetEntry( nPos );
+ return m_aListBox->GetEntry( nPos );
}
OUString SuggestionDisplay::GetSelectEntry() const
{
- return m_aListBox.GetSelectEntry();
+ return m_aListBox->GetSelectEntry();
}
void SuggestionDisplay::SetHelpIds()
{
this->SetHelpId( HID_HANGULDLG_SUGGESTIONS );
- m_aValueSet.SetHelpId( HID_HANGULDLG_SUGGESTIONS_GRID );
- m_aListBox.SetHelpId( HID_HANGULDLG_SUGGESTIONS_LIST );
+ m_aValueSet->SetHelpId( HID_HANGULDLG_SUGGESTIONS_GRID );
+ m_aListBox->SetHelpId( HID_HANGULDLG_SUGGESTIONS_LIST );
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSuggestionDisplay( vcl::Window *pParent, VclBuilder::stringmap & )
@@ -591,11 +605,35 @@ namespace svx
m_pSuggestions->SetHelpIds();
}
-
- HangulHanjaConversionDialog::~HangulHanjaConversionDialog( )
+ HangulHanjaConversionDialog::~HangulHanjaConversionDialog()
{
+ disposeOnce();
}
+ void HangulHanjaConversionDialog::dispose()
+ {
+ m_pFind.clear();
+ m_pIgnore.clear();
+ m_pIgnoreAll.clear();
+ m_pReplace.clear();
+ m_pReplaceAll.clear();
+ m_pOptions.clear();
+ m_pSuggestions.clear();
+ m_pSimpleConversion.clear();
+ m_pHangulBracketed.clear();
+ m_pHanjaBracketed.clear();
+ m_pWordInput.clear();
+ m_pOriginalWord.clear();
+ m_pHanjaAbove.clear();
+ m_pHanjaBelow.clear();
+ m_pHangulAbove.clear();
+ m_pHangulBelow.clear();
+ m_pHangulOnly.clear();
+ m_pHanjaOnly.clear();
+ m_pReplaceByChar.clear();
+ m_pIgnoreNonPrimary.clear();
+ ModalDialog::dispose();
+ }
void HangulHanjaConversionDialog::FillSuggestions( const ::com::sun::star::uno::Sequence< OUString >& _rSuggestions )
{
@@ -723,8 +761,8 @@ namespace svx
IMPL_LINK_NOARG( HangulHanjaConversionDialog, OnOption )
{
- HangulHanjaOptionsDialog aOptDlg( this );
- aOptDlg.Execute();
+ ScopedVclPtrInstance< HangulHanjaOptionsDialog > aOptDlg(this);
+ aOptDlg->Execute();
m_aOptionsChangedLink.Call( this );
return 0L;
}
@@ -1003,9 +1041,9 @@ namespace svx
IMPL_LINK_NOARG(HangulHanjaOptionsDialog, NewDictHdl)
{
OUString aName;
- HangulHanjaNewDictDialog aNewDlg( this );
- aNewDlg.Execute();
- if( aNewDlg.GetName( aName ) )
+ ScopedVclPtrInstance< HangulHanjaNewDictDialog > aNewDlg(this);
+ aNewDlg->Execute();
+ if( aNewDlg->GetName( aName ) )
{
if( m_xConversionDictionaryList.is() )
{
@@ -1039,8 +1077,8 @@ namespace svx
DBG_ASSERT( pEntry, "+HangulHanjaEditDictDialog::EditDictHdl(): call of edit should not be possible with no selection!" );
if( pEntry )
{
- HangulHanjaEditDictDialog aEdDlg( this, m_aDictList, m_pDictsLB->GetSelectEntryPos() );
- aEdDlg.Execute();
+ ScopedVclPtrInstance< HangulHanjaEditDictDialog > aEdDlg(this, m_aDictList, m_pDictsLB->GetSelectEntryPos());
+ aEdDlg->Execute();
}
return 0L;
}
@@ -1125,17 +1163,34 @@ namespace svx
HangulHanjaOptionsDialog::~HangulHanjaOptionsDialog()
{
- SvTreeListEntry* pEntry = m_pDictsLB->First();
- while( pEntry )
+ disposeOnce();
+ }
+
+ void HangulHanjaOptionsDialog::dispose()
+ {
+ if (m_pDictsLB)
{
- OUString const * pDel = static_cast<OUString const *>(pEntry->GetUserData());
- if( pDel )
- delete pDel;
- pEntry = m_pDictsLB->Next( pEntry );
+ SvTreeListEntry* pEntry = m_pDictsLB->First();
+ while( pEntry )
+ {
+ delete static_cast<OUString const *>(pEntry->GetUserData());
+ pEntry->SetUserData( NULL );
+ pEntry = m_pDictsLB->Next( pEntry );
+ }
}
- if( m_pCheckButtonData )
- delete m_pCheckButtonData;
+ delete m_pCheckButtonData;
+ m_pCheckButtonData = NULL;
+
+ m_pDictsLB.clear();
+ m_pIgnorepostCB.clear();
+ m_pShowrecentlyfirstCB.clear();
+ m_pAutoreplaceuniqueCB.clear();
+ m_pNewPB.clear();
+ m_pEditPB.clear();
+ m_pDeletePB.clear();
+ m_pOkPB.clear();
+ ModalDialog::dispose();
}
void HangulHanjaOptionsDialog::AddDict( const OUString& _rName, bool _bChecked )
@@ -1182,6 +1237,18 @@ namespace svx
m_pDictNameED->SetModifyHdl( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) );
}
+ HangulHanjaNewDictDialog::~HangulHanjaNewDictDialog()
+ {
+ disposeOnce();
+ }
+
+ void HangulHanjaNewDictDialog::dispose()
+ {
+ m_pDictNameED.clear();
+ m_pOkBtn.clear();
+ ModalDialog::dispose();
+ }
+
bool HangulHanjaNewDictDialog::GetName( OUString& _rRetName ) const
{
if( m_bEntered )
@@ -1359,6 +1426,15 @@ namespace svx
SuggestionEdit::~SuggestionEdit()
{
+ disposeOnce();
+ }
+
+ void SuggestionEdit::dispose()
+ {
+ m_pPrev.clear();
+ m_pNext.clear();
+ m_pScrollBar.clear();
+ Edit::dispose();
}
bool SuggestionEdit::PreNotify( NotifyEvent& rNEvt )
@@ -1769,8 +1845,23 @@ namespace svx
HangulHanjaEditDictDialog::~HangulHanjaEditDictDialog()
{
- if( m_pSuggestions )
- delete m_pSuggestions;
+ disposeOnce();
+ }
+
+ void HangulHanjaEditDictDialog::dispose()
+ {
+ delete m_pSuggestions;
+ m_pSuggestions = NULL;
+ m_aBookLB.clear();
+ m_aOriginalLB.clear();
+ m_aEdit1.clear();
+ m_aEdit2.clear();
+ m_aEdit3.clear();
+ m_aEdit4.clear();
+ m_aScrollSB.clear();
+ m_aNewPB.clear();
+ m_aDeletePB.clear();
+ ModalDialog::dispose();
}
void HangulHanjaEditDictDialog::UpdateScrollbar()
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 4711a1f574ce..b0657eef30cf 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -129,12 +129,23 @@ SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( vcl::Window *pParent, IconChoiceDia
SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp ()
{
- for ( sal_uInt16 n=0; n<m_pLbDocTypes->GetEntryCount(); n++ )
+ disposeOnce();
+}
+
+void SvxHyperlinkNewDocTp::dispose()
+{
+ if (m_pLbDocTypes)
{
- DocumentTypeData* pTypeData = static_cast<DocumentTypeData*>(
- m_pLbDocTypes->GetEntryData ( n ));
- delete pTypeData;
+ for ( sal_uInt16 n=0; n<m_pLbDocTypes->GetEntryCount(); n++ )
+ delete static_cast<DocumentTypeData*>(m_pLbDocTypes->GetEntryData ( n ));
+ m_pLbDocTypes = NULL;
}
+ m_pRbtEditNow.clear();
+ m_pRbtEditLater.clear();
+ m_pCbbPath.clear();
+ m_pBtCreate.clear();
+ m_pLbDocTypes.clear();
+ SvxHyperlinkTabPageBase::dispose();
}
/*************************************************************************
@@ -232,9 +243,9 @@ void SvxHyperlinkNewDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStr
|*
|************************************************************************/
-IconChoicePage* SvxHyperlinkNewDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
+VclPtr<IconChoicePage> SvxHyperlinkNewDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
{
- return new SvxHyperlinkNewDocTp( pWindow, pDlg, rItemSet );
+ return VclPtr<SvxHyperlinkNewDocTp>::Create( pWindow, pDlg, rItemSet );
}
/*************************************************************************
@@ -260,8 +271,8 @@ bool SvxHyperlinkNewDocTp::AskApply()
bool bRet = ImplGetURLObject( m_pCbbPath->GetText(), m_pCbbPath->GetBaseURL(), aINetURLObject );
if ( !bRet )
{
- WarningBox aWarning( this, WB_OK, CUI_RESSTR(RID_SVXSTR_HYPDLG_NOVALIDFILENAME) );
- aWarning.Execute();
+ ScopedVclPtrInstance< WarningBox > aWarning( this, WB_OK, CUI_RESSTR(RID_SVXSTR_HYPDLG_NOVALIDFILENAME) );
+ aWarning->Execute();
}
return bRet;
}
@@ -310,8 +321,8 @@ void SvxHyperlinkNewDocTp::DoApply ()
if( bOk )
{
- WarningBox aWarning( this, WB_YES_NO, CUI_RESSTR(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) );
- bCreate = aWarning.Execute() == RET_YES;
+ ScopedVclPtrInstance<WarningBox> aWarning( this, WB_YES_NO, CUI_RESSTR(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) );
+ bCreate = aWarning->Execute() == RET_YES;
}
}
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 11fe8e63db34..fd9340d599b2 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -71,8 +71,19 @@ SvxHyperlinkDocTp::SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* p
maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkDocTp, TimeoutHdl_Impl ) );
}
-SvxHyperlinkDocTp::~SvxHyperlinkDocTp ()
+SvxHyperlinkDocTp::~SvxHyperlinkDocTp()
{
+ disposeOnce();
+}
+
+void SvxHyperlinkDocTp::dispose()
+{
+ m_pCbbPath.clear();
+ m_pBtFileopen.clear();
+ m_pEdTarget.clear();
+ m_pFtFullURL.clear();
+ m_pBtBrowse.clear();
+ SvxHyperlinkTabPageBase::dispose();
}
/*************************************************************************
@@ -157,9 +168,9 @@ void SvxHyperlinkDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrNam
|*
|************************************************************************/
-IconChoicePage* SvxHyperlinkDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
+VclPtr<IconChoicePage> SvxHyperlinkDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
{
- return new SvxHyperlinkDocTp( pWindow, pDlg, rItemSet );
+ return VclPtr<SvxHyperlinkDocTp>::Create( pWindow, pDlg, rItemSet );
}
/*************************************************************************
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index 3c7bfcc1c4a4..e6cb7c0a4b31 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -81,8 +81,23 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( vcl::Window *pParent,
maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) );
}
-SvxHyperlinkInternetTp::~SvxHyperlinkInternetTp ()
+SvxHyperlinkInternetTp::~SvxHyperlinkInternetTp()
{
+ disposeOnce();
+}
+
+void SvxHyperlinkInternetTp::dispose()
+{
+ m_pRbtLinktypInternet.clear();
+ m_pRbtLinktypFTP.clear();
+ m_pCbbTarget.clear();
+ m_pBtBrowse.clear();
+ m_pFtLogin.clear();
+ m_pEdLogin.clear();
+ m_pFtPassword.clear();
+ m_pEdPassword.clear();
+ m_pCbAnonymous.clear();
+ SvxHyperlinkTabPageBase::dispose();
}
/*************************************************************************
@@ -187,9 +202,9 @@ OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const
|*
|************************************************************************/
-IconChoicePage* SvxHyperlinkInternetTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
+VclPtr<IconChoicePage> SvxHyperlinkInternetTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
{
- return new SvxHyperlinkInternetTp( pWindow, pDlg, rItemSet );
+ return VclPtr<SvxHyperlinkInternetTp>::Create( pWindow, pDlg, rItemSet );
}
/*************************************************************************
@@ -401,7 +416,7 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ClickBrowseHdl_Impl)
SfxBoolItem aBrowse( SID_BROWSE, true );
const SfxPoolItem *ppItems[] = { &aName, &aNewView, &aSilent, &aReadOnly, &aRefererItem, &aBrowse, NULL };
- static_cast<SvxHpLinkDlg*>(mpDialog)->GetBindings()->Execute( SID_OPENDOC, ppItems, 0, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+ static_cast<SvxHpLinkDlg*>(mpDialog.get())->GetBindings()->Execute( SID_OPENDOC, ppItems, 0, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
return 0L;
}
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index 5c114ff317f0..10336197a848 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -66,8 +66,18 @@ SvxHyperlinkMailTp::SvxHyperlinkMailTp ( vcl::Window *pParent, IconChoiceDialog*
m_pBtAdrBook->Hide();
}
-SvxHyperlinkMailTp::~SvxHyperlinkMailTp ()
+SvxHyperlinkMailTp::~SvxHyperlinkMailTp()
{
+ disposeOnce();
+}
+
+void SvxHyperlinkMailTp::dispose()
+{
+ m_pCbbReceiver.clear();
+ m_pBtAdrBook.clear();
+ m_pFtSubject.clear();
+ m_pEdSubject.clear();
+ SvxHyperlinkTabPageBase::dispose();
}
/*************************************************************************
@@ -161,9 +171,9 @@ OUString SvxHyperlinkMailTp::CreateAbsoluteURL() const
|*
|************************************************************************/
-IconChoicePage* SvxHyperlinkMailTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
+VclPtr<IconChoicePage> SvxHyperlinkMailTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
{
- return new SvxHyperlinkMailTp( pWindow, pDlg, rItemSet );
+ return VclPtr<SvxHyperlinkMailTp>::Create( pWindow, pDlg, rItemSet );
}
/*************************************************************************
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index a2b83836abf2..80b8690d5713 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -72,6 +72,17 @@ SvxHlmarkTreeLBox::SvxHlmarkTreeLBox(vcl::Window* pParent, WinBits nStyle)
SetNodeDefaultImages();
}
+SvxHlmarkTreeLBox::~SvxHlmarkTreeLBox()
+{
+ disposeOnce();
+}
+
+void SvxHlmarkTreeLBox::dispose()
+{
+ mpParentWnd.clear();
+ SvTreeListBox::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxHlmarkTreeLBox(vcl::Window *pParent, VclBuilder::stringmap &rMap)
{
WinBits nWinStyle = WB_TABSTOP;
@@ -150,7 +161,17 @@ SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd( SvxHyperlinkTabPageBase *pParent )
SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd()
{
+ disposeOnce();
+}
+
+void SvxHlinkDlgMarkWnd::dispose()
+{
ClearTree();
+ mpBtApply.clear();
+ mpBtClose.clear();
+ mpLbTree.clear();
+ mpParent.clear();
+ ModalDialog::dispose();
}
/*************************************************************************
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 293b04069896..9260c684cfac 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -105,11 +105,25 @@ SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( vcl::Window *pParent,
mpMarkWnd = new SvxHlinkDlgMarkWnd ( this );
}
-SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase ()
+SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase()
+{
+ disposeOnce();
+}
+
+void SvxHyperlinkTabPageBase::dispose()
{
maTimer.Stop();
- delete mpMarkWnd;
+ mpMarkWnd.disposeAndClear();
+
+ mpCbbFrame.clear();
+ mpLbForm.clear();
+ mpEdIndication.clear();
+ mpEdText.clear();
+ mpBtScript.clear();
+ mpDialog.clear();
+
+ IconChoicePage::dispose();
}
void SvxHyperlinkTabPageBase::ActivatePage()
@@ -283,13 +297,13 @@ void SvxHyperlinkTabPageBase::SetInitFocus()
// Ask dialog whether the curretn doc is a HTML-doc
bool SvxHyperlinkTabPageBase::IsHTMLDoc() const
{
- return static_cast<SvxHpLinkDlg*>(mpDialog)->IsHTMLDoc();
+ return static_cast<SvxHpLinkDlg*>(mpDialog.get())->IsHTMLDoc();
}
// retrieve dispatcher
SfxDispatcher* SvxHyperlinkTabPageBase::GetDispatcher() const
{
- return static_cast<SvxHpLinkDlg*>(mpDialog)->GetDispatcher();
+ return static_cast<SvxHpLinkDlg*>(mpDialog.get())->GetDispatcher();
}
// Click on imagebutton : Script
@@ -319,10 +333,10 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl)
bool bIsInputEnabled = GetParent()->IsInputEnabled();
if ( bIsInputEnabled )
GetParent()->EnableInput( false );
- SfxMacroAssignDlg aDlg( this, mxDocumentFrame, *pItemSet );
+ ScopedVclPtrInstance< SfxMacroAssignDlg > aDlg( this, mxDocumentFrame, *pItemSet );
// add events
- SfxMacroTabPage *pMacroPage = static_cast<SfxMacroTabPage*>( aDlg.GetTabPage() );
+ SfxMacroTabPage *pMacroPage = static_cast<SfxMacroTabPage*>( aDlg->GetTabPage() );
if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSEOVER_OBJECT )
pMacroPage->AddEvent( OUString( CUI_RESSTR(RID_SVXSTR_HYPDLG_MACROACT1) ),
@@ -338,11 +352,11 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl)
GetParent()->EnableInput( true );
// execute dlg
DisableClose( true );
- short nRet = aDlg.Execute();
+ short nRet = aDlg->Execute();
DisableClose( false );
if ( RET_OK == nRet )
{
- const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
+ const SfxItemSet* pOutSet = aDlg->GetOutputItemSet();
const SfxPoolItem* pItem;
if( SfxItemState::SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, false, &pItem ))
{
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx
index c6c7bb19b71c..e124a435fefc 100644
--- a/cui/source/dialogs/hyphen.cxx
+++ b/cui/source/dialogs/hyphen.cxx
@@ -512,9 +512,22 @@ SvxHyphenWordDialog::SvxHyphenWordDialog(
Enable( false );
}
-
SvxHyphenWordDialog::~SvxHyphenWordDialog()
{
+ disposeOnce();
+}
+
+void SvxHyphenWordDialog::dispose()
+{
+ m_pWordEdit.clear();
+ m_pLeftBtn.clear();
+ m_pRightBtn.clear();
+ m_pOkBtn.clear();
+ m_pContBtn.clear();
+ m_pDelBtn.clear();
+ m_pHyphAll.clear();
+ m_pCloseBtn.clear();
+ SfxModalDialog::dispose();
}
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 1c999e3cde65..d1c8c3523e9d 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -52,9 +52,15 @@ IconChoicePage::IconChoicePage( vcl::Window *pParent, const OString& rID,
}
-
IconChoicePage::~IconChoicePage()
{
+ disposeOnce();
+}
+
+void IconChoicePage::dispose()
+{
+ pDialog.clear();
+ TabPage::dispose();
}
/**********************************************************************
@@ -150,8 +156,8 @@ void IconChoicePage::DataChanged( const DataChangedEvent& rDCEvt )
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvtIconChoiceCtrl(vcl::Window *pParent, VclBuilder::stringmap &)
{
return new SvtIconChoiceCtrl(pParent, WB_3DLOOK | WB_ICON | WB_BORDER |
- WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
- WB_NODRAGSELECTION | WB_TABSTOP);
+ WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
+ WB_NODRAGSELECTION | WB_TABSTOP);
}
IconChoiceDialog::IconChoiceDialog ( vcl::Window* pParent, const OUString& rID,
@@ -209,6 +215,11 @@ IconChoiceDialog::IconChoiceDialog ( vcl::Window* pParent, const OUString& rID,
IconChoiceDialog ::~IconChoiceDialog ()
{
+ disposeOnce();
+}
+
+void IconChoiceDialog::dispose()
+{
// save configuration at INI-Manager
// and remove pages
//SvtViewOptions aTabDlgOpt( E_TABDIALOG, rId );
@@ -231,22 +242,35 @@ IconChoiceDialog ::~IconChoiceDialog ()
if ( pData->bOnDemand )
delete &pData->pPage->GetItemSet();
- delete pData->pPage;
+ pData->pPage.disposeAndClear();
}
delete pData;
}
+ maPageList.clear();
- // remove Userdata from Icons
- for ( sal_uLong i=0; i < m_pIconCtrl->GetEntryCount(); i++)
+ if (m_pIconCtrl)
{
- SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry ( i );
- sal_uInt16* pUserData = static_cast<sal_uInt16*>(pEntry->GetUserData());
- delete pUserData;
+ // remove Userdata from Icons
+ for ( sal_uLong i=0; i < m_pIconCtrl->GetEntryCount(); i++)
+ {
+ SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry ( i );
+ delete static_cast<sal_uInt16*>(pEntry->GetUserData());
+ }
}
-
delete pRanges;
+ pRanges = NULL;
delete pOutSet;
+ pOutSet = NULL;
+
+ m_pIconCtrl.clear();
+ m_pOKBtn.clear();
+ m_pApplyBtn.clear();
+ m_pCancelBtn.clear();
+ m_pHelpBtn.clear();
+ m_pResetBtn.clear();
+ m_pTabContainer.clear();
+ ModalDialog::dispose();
}
/**********************************************************************
@@ -532,7 +556,7 @@ bool IconChoiceDialog::DeActivatePageImpl ()
for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
{
IconChoicePageData* pObj = maPageList[ i ];
- if ( pObj->pPage != pPage )
+ if ( pObj->pPage.get() != pPage )
pObj->bRefresh = true;
else
pObj->bRefresh = false;
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index fc9d8218c97d..0b24ea2a535c 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -191,6 +191,24 @@ SvInsertOleDlg::SvInsertOleDlg
RadioHdl( NULL );
}
+SvInsertOleDlg::~SvInsertOleDlg()
+{
+ disposeOnce();
+}
+
+void SvInsertOleDlg::dispose()
+{
+ m_pRbNewObject.clear();
+ m_pRbObjectFromfile.clear();
+ m_pObjectTypeFrame.clear();
+ m_pLbObjecttype.clear();
+ m_pFileFrame.clear();
+ m_pEdFilepath.clear();
+ m_pBtnFilepath.clear();
+ m_pCbFilelink.clear();
+ InsertObjectDialog_Impl::dispose();
+}
+
short SvInsertOleDlg::Execute()
{
short nRet = RET_OK;
@@ -395,10 +413,18 @@ SvInsertPlugInDialog::SvInsertPlugInDialog(vcl::Window* pParent,
SvInsertPlugInDialog::~SvInsertPlugInDialog()
{
- delete m_pURL;
+ disposeOnce();
}
-
+void SvInsertPlugInDialog::dispose()
+{
+ delete m_pURL;
+ m_pURL = NULL;
+ m_pEdFileurl.clear();
+ m_pBtnFileurl.clear();
+ m_pEdPluginsOptions.clear();
+ InsertObjectDialog_Impl::dispose();
+}
static void Plugin_ImplFillCommandSequence( const OUString& aCommands, uno::Sequence< beans::PropertyValue >& aCommandSequence )
{
@@ -489,6 +515,30 @@ SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( vcl::Window *pParent
Init();
}
+SfxInsertFloatingFrameDialog::~SfxInsertFloatingFrameDialog()
+{
+ disposeOnce();
+}
+
+void SfxInsertFloatingFrameDialog::dispose()
+{
+ m_pEDName.clear();
+ m_pEDURL.clear();
+ m_pBTOpen.clear();
+ m_pRBScrollingOn.clear();
+ m_pRBScrollingOff.clear();
+ m_pRBScrollingAuto.clear();
+ m_pRBFrameBorderOn.clear();
+ m_pRBFrameBorderOff.clear();
+ m_pFTMarginWidth.clear();
+ m_pNMMarginWidth.clear();
+ m_pCBMarginWidthDefault.clear();
+ m_pFTMarginHeight.clear();
+ m_pNMMarginHeight.clear();
+ m_pCBMarginHeightDefault.clear();
+ InsertObjectDialog_Impl::dispose();
+}
+
void SfxInsertFloatingFrameDialog::Init()
{
get(m_pEDName, "edname");
diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx
index ef1eecff6a99..13f18c3b5493 100644
--- a/cui/source/dialogs/insrc.cxx
+++ b/cui/source/dialogs/insrc.cxx
@@ -33,21 +33,29 @@ sal_uInt16 SvxInsRowColDlg::getInsertCount() const
}
SvxInsRowColDlg::SvxInsRowColDlg(vcl::Window* pParent, bool bCol, const OString& sHelpId )
- : ModalDialog(pParent, "InsertRowColumnDialog", "cui/ui/insertrowcolumn.ui")
+ : m_pDialog(VclPtr<ModalDialog>::Create(pParent, "InsertRowColumnDialog", "cui/ui/insertrowcolumn.ui"))
, aRow(CUI_RESSTR(RID_SVXSTR_ROW))
, aCol(CUI_RESSTR(RID_SVXSTR_COL))
, bColumn(bCol)
{
- get(m_pCountEdit, "insert_number");
- get(m_pBeforeBtn, "insert_before");
- get(m_pAfterBtn, "insert_after");
- SetText( bColumn ? aCol : aRow );
- SetHelpId( sHelpId );
+ m_pDialog->get(m_pCountEdit, "insert_number");
+ m_pDialog->get(m_pBeforeBtn, "insert_before");
+ m_pDialog->get(m_pAfterBtn, "insert_after");
+ m_pDialog->SetText( bColumn ? aCol : aRow );
+ m_pDialog->SetHelpId( sHelpId );
+}
+
+SvxInsRowColDlg::~SvxInsRowColDlg()
+{
+ m_pCountEdit.clear();
+ m_pBeforeBtn.clear();
+ m_pAfterBtn.clear();
+ m_pDialog.disposeAndClear();
}
short SvxInsRowColDlg::Execute()
{
- return ModalDialog::Execute();
+ return m_pDialog->Execute();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 505df5a9b4a4..0995ae4c6ad5 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -145,6 +145,22 @@ SvBaseLinksDlg::SvBaseLinksDlg( vcl::Window * pParent, LinkManager* pMgr, bool b
SvBaseLinksDlg::~SvBaseLinksDlg()
{
+ disposeOnce();
+}
+
+void SvBaseLinksDlg::dispose()
+{
+ m_pTbLinks.clear();
+ m_pFtFullFileName.clear();
+ m_pFtFullSourceName.clear();
+ m_pFtFullTypeName.clear();
+ m_pRbAutomatic.clear();
+ m_pRbManual.clear();
+ m_pPbUpdateNow.clear();
+ m_pPbOpenSource.clear();
+ m_pPbChangeSource.clear();
+ m_pPbBreakLink.clear();
+ ModalDialog::dispose();
}
/*************************************************************************
@@ -428,9 +444,9 @@ IMPL_LINK( SvBaseLinksDlg, BreakLinkClickHdl, PushButton *, pPushButton )
if( !xLink.Is() )
return 0;
- QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, Closelinkmsg() );
+ ScopedVclPtrInstance< QueryBox > aBox( this, WB_YES_NO | WB_DEF_YES, Closelinkmsg() );
- if( RET_YES == aBox.Execute() )
+ if( RET_YES == aBox->Execute() )
{
m_pTbLinks->GetModel()->Remove( m_pTbLinks->GetEntry( nPos ) );
@@ -459,9 +475,9 @@ IMPL_LINK( SvBaseLinksDlg, BreakLinkClickHdl, PushButton *, pPushButton )
}
else
{
- QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, CloselinkmsgMulti() );
+ ScopedVclPtrInstance< QueryBox > aBox( this, WB_YES_NO | WB_DEF_YES, CloselinkmsgMulti() );
- if( RET_YES == aBox.Execute() )
+ if( RET_YES == aBox->Execute() )
{
SvBaseLinkMemberList aLinkList;
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index e4adae253e24..8cdc64439efa 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -186,7 +186,7 @@ SvxMultiPathDialog::SvxMultiPathDialog(vcl::Window* pParent)
Size aSize(LogicToPixel(Size(195, 77), MAP_APPFONT));
pRadioLBContainer->set_width_request(aSize.Width());
pRadioLBContainer->set_height_request(aSize.Height());
- m_pRadioLB = new svx::SvxRadioButtonListBox(*pRadioLBContainer, 0);
+ m_pRadioLB = VclPtr<svx::SvxRadioButtonListBox>::Create(*pRadioLBContainer, 0);
static long aStaticTabs[]= { 2, 0, 12 };
m_pRadioLB->SvSimpleTable::SetTabs( aStaticTabs );
@@ -224,21 +224,44 @@ SvxPathSelectDialog::SvxPathSelectDialog(vcl::Window* pParent)
SvxMultiPathDialog::~SvxMultiPathDialog()
{
- sal_uInt16 nPos = (sal_uInt16)m_pRadioLB->GetEntryCount();
- while ( nPos-- )
+ disposeOnce();
+}
+
+void SvxMultiPathDialog::dispose()
+{
+ if (m_pRadioLB)
{
- SvTreeListEntry* pEntry = m_pRadioLB->GetEntry( nPos );
- delete static_cast<OUString*>(pEntry->GetUserData());
+ sal_uInt16 nPos = (sal_uInt16)m_pRadioLB->GetEntryCount();
+ while ( nPos-- )
+ {
+ SvTreeListEntry* pEntry = m_pRadioLB->GetEntry( nPos );
+ delete static_cast<OUString*>(pEntry->GetUserData());
+ }
}
- delete m_pRadioLB;
+ m_pRadioLB.disposeAndClear();
+ m_pAddBtn.clear();
+ m_pDelBtn.clear();
+ ModalDialog::dispose();
}
SvxPathSelectDialog::~SvxPathSelectDialog()
{
- sal_uInt16 nPos = m_pPathLB->GetEntryCount();
- while ( nPos-- )
- delete static_cast<OUString*>(m_pPathLB->GetEntryData(nPos));
+ disposeOnce();
+}
+
+void SvxPathSelectDialog::dispose()
+{
+ if (m_pPathLB)
+ {
+ sal_uInt16 nPos = m_pPathLB->GetEntryCount();
+ while ( nPos-- )
+ delete static_cast<OUString*>(m_pPathLB->GetEntryData(nPos));
+ }
+ m_pPathLB.clear();
+ m_pAddBtn.clear();
+ m_pDelBtn.clear();
+ ModalDialog::dispose();
}
OUString SvxMultiPathDialog::GetPath() const
diff --git a/cui/source/dialogs/newtabledlg.cxx b/cui/source/dialogs/newtabledlg.cxx
index ae6a0e757fa2..a83e11ac991f 100644
--- a/cui/source/dialogs/newtabledlg.cxx
+++ b/cui/source/dialogs/newtabledlg.cxx
@@ -22,15 +22,22 @@
#include "newtabledlg.hxx"
SvxNewTableDialog::SvxNewTableDialog( vcl::Window* pParent )
-: ModalDialog( pParent, "NewTableDialog", "cui/ui/newtabledialog.ui" )
+ : m_pDialog( VclPtr<ModalDialog>::Create( pParent, "NewTableDialog", "cui/ui/newtabledialog.ui" ) )
{
- get(mpNumRows, "rows");
- get(mpNumColumns, "columns");
+ m_pDialog->get(mpNumRows, "rows");
+ m_pDialog->get(mpNumColumns, "columns");
+}
+
+SvxNewTableDialog::~SvxNewTableDialog()
+{
+ mpNumColumns.clear();
+ mpNumRows.clear();
+ m_pDialog.disposeAndClear();
}
short SvxNewTableDialog::Execute()
{
- return ModalDialog::Execute();
+ return m_pDialog->Execute();
}
sal_Int32 SvxNewTableDialog::getRows() const
diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx
index bca8cd9c211e..1b47dda9aa79 100644
--- a/cui/source/dialogs/passwdomdlg.cxx
+++ b/cui/source/dialogs/passwdomdlg.cxx
@@ -31,15 +31,15 @@
struct PasswordToOpenModifyDialog_Impl
{
- PasswordToOpenModifyDialog * m_pParent;
+ VclPtr<PasswordToOpenModifyDialog> m_pParent;
- Edit* m_pPasswdToOpenED;
- Edit* m_pReenterPasswdToOpenED;
- VclExpander* m_pOptionsExpander;
- OKButton* m_pOk;
- CheckBox* m_pOpenReadonlyCB;
- Edit* m_pPasswdToModifyED;
- Edit* m_pReenterPasswdToModifyED;
+ VclPtr<Edit> m_pPasswdToOpenED;
+ VclPtr<Edit> m_pReenterPasswdToOpenED;
+ VclPtr<VclExpander> m_pOptionsExpander;
+ VclPtr<OKButton> m_pOk;
+ VclPtr<CheckBox> m_pOpenReadonlyCB;
+ VclPtr<Edit> m_pPasswdToModifyED;
+ VclPtr<Edit> m_pReenterPasswdToModifyED;
OUString m_aOneMismatch;
OUString m_aTwoMismatch;
@@ -101,9 +101,9 @@ IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG
m_pPasswdToModifyED->GetText().isEmpty();
if (bInvalidState)
{
- MessageDialog aErrorBox(m_pParent,
+ ScopedVclPtrInstance<MessageDialog> aErrorBox(m_pParent,
m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2);
- aErrorBox.Execute();
+ aErrorBox->Execute();
}
else // check for mismatched passwords...
{
@@ -112,8 +112,8 @@ IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG
const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1);
if (nMismatch > 0)
{
- MessageDialog aErrorBox(m_pParent, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch);
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(m_pParent, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch);
+ aErrorBox->Execute();
Edit* pEdit = !bToOpenMatch ? m_pPasswdToOpenED : m_pPasswdToModifyED;
Edit* pRepeatEdit = !bToOpenMatch? m_pReenterPasswdToOpenED : m_pReenterPasswdToModifyED;
@@ -153,6 +153,12 @@ PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(
PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog()
{
+ disposeOnce();
+}
+
+void PasswordToOpenModifyDialog::dispose()
+{
+ SfxModalDialog::dispose();
}
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index a7478f5c23df..ff6263a2587e 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -52,6 +52,19 @@ SvPasteObjectDialog::SvPasteObjectDialog( vcl::Window* pParent )
ObjectLB().SetDoubleClickHdl( LINK( this, SvPasteObjectDialog, DoubleClickHdl ) );
}
+SvPasteObjectDialog::~SvPasteObjectDialog()
+{
+ disposeOnce();
+}
+
+void SvPasteObjectDialog::dispose()
+{
+ m_pFtObjectSource.clear();
+ m_pLbInsertList.clear();
+ m_pOKButton.clear();
+ ModalDialog::dispose();
+}
+
void SvPasteObjectDialog::SelectObject()
{
if (m_pLbInsertList->GetEntryCount())
@@ -79,10 +92,6 @@ IMPL_LINK_INLINE_START( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox
}
IMPL_LINK_INLINE_END( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox )
-SvPasteObjectDialog::~SvPasteObjectDialog()
-{
-}
-
/*************************************************************************
|* SvPasteObjectDialog::Insert()
*************************************************************************/
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
index b740fd9e91bb..c1e43e1939c4 100644
--- a/cui/source/dialogs/postdlg.cxx
+++ b/cui/source/dialogs/postdlg.cxx
@@ -124,8 +124,21 @@ SvxPostItDialog::SvxPostItDialog(vcl::Window* pParent, const SfxItemSet& rCoreSe
SvxPostItDialog::~SvxPostItDialog()
{
+ disposeOnce();
+}
+
+void SvxPostItDialog::dispose()
+{
delete pOutSet;
pOutSet = 0;
+ m_pLastEditFT.clear();
+ m_pEditED.clear();
+ m_pInsertAuthor.clear();
+ m_pAuthorBtn.clear();
+ m_pOKBtn.clear();
+ m_pPrevBtn.clear();
+ m_pNextBtn.clear();
+ SfxModalDialog::dispose();
}
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 2e4a87157ec5..98a97d0e8656 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -96,12 +96,18 @@ SFTreeListBox::SFTreeListBox(vcl::Window* pParent)
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSFTreeListBox(vcl::Window *pParent, VclBuilder::stringmap &)
{
- return new SFTreeListBox(pParent);
+ return VclPtr<SFTreeListBox>::Create(pParent);
}
SFTreeListBox::~SFTreeListBox()
{
+ disposeOnce();
+}
+
+void SFTreeListBox::dispose()
+{
deleteAllTree();
+ SvTreeListBox::dispose();
}
void SFTreeListBox::delUserData( SvTreeListEntry* pEntry )
@@ -437,6 +443,17 @@ CuiInputDialog::CuiInputDialog(vcl::Window * pParent, sal_uInt16 nMode )
}
}
+CuiInputDialog::~CuiInputDialog()
+{
+ disposeOnce();
+}
+
+void CuiInputDialog::dispose()
+{
+ m_pEdit.clear();
+ ModalDialog::dispose();
+}
+
// ScriptOrgDialog ------------------------------------------------------------
@@ -487,8 +504,21 @@ SvxScriptOrgDialog::SvxScriptOrgDialog( vcl::Window* pParent, const OUString& la
SvxScriptOrgDialog::~SvxScriptOrgDialog()
{
+ disposeOnce();
+}
+
+void SvxScriptOrgDialog::dispose()
+{
// clear the SelectHdl so that it isn't called during the dtor
m_pScriptsBox->SetSelectHdl( Link() );
+ m_pScriptsBox.clear();
+ m_pRunButton.clear();
+ m_pCloseButton.clear();
+ m_pCreateButton.clear();
+ m_pEditButton.clear();
+ m_pRenameButton.clear();
+ m_pDelButton.clear();
+ SfxModalDialog::dispose();
};
short SvxScriptOrgDialog::Execute()
@@ -876,7 +906,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
}
}
- boost::scoped_ptr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<vcl::Window*>(this), nMode ) );
+ ScopedVclPtrInstance< CuiInputDialog > xNewDlg( static_cast<vcl::Window*>(this), nMode );
xNewDlg->SetObjectName( aNewName );
do
@@ -892,9 +922,9 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
bValid = false;
OUString aError( m_createErrStr );
aError += m_createDupStr;
- MessageDialog aErrorBox(static_cast<vcl::Window*>(this), aError);
- aErrorBox.SetText( m_createErrTitleStr );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(static_cast<vcl::Window*>(this), aError);
+ aErrorBox->SetText( m_createErrTitleStr );
+ aErrorBox->Execute();
xNewDlg->SetObjectName( aNewName );
break;
}
@@ -974,9 +1004,9 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
{
//ISSUE L10N & message from exception?
OUString aError( m_createErrStr );
- MessageDialog aErrorBox(static_cast<vcl::Window*>(this), aError);
- aErrorBox.SetText( m_createErrTitleStr );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(static_cast<vcl::Window*>(this), aError);
+ aErrorBox->SetText( m_createErrTitleStr );
+ aErrorBox->Execute();
}
}
@@ -999,7 +1029,7 @@ void SvxScriptOrgDialog::renameEntry( SvTreeListEntry* pEntry )
}
sal_uInt16 nMode = INPUTMODE_RENAME;
- boost::scoped_ptr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<vcl::Window*>(this), nMode ) );
+ ScopedVclPtrInstance< CuiInputDialog > xNewDlg( static_cast<vcl::Window*>(this), nMode );
xNewDlg->SetObjectName( aNewName );
bool bValid;
@@ -1050,9 +1080,9 @@ void SvxScriptOrgDialog::renameEntry( SvTreeListEntry* pEntry )
{
//ISSUE L10N & message from exception?
OUString aError( m_renameErrStr );
- MessageDialog aErrorBox(static_cast<vcl::Window*>(this), aError);
- aErrorBox.SetText( m_renameErrTitleStr );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(static_cast<vcl::Window*>(this), aError);
+ aErrorBox->SetText( m_renameErrTitleStr );
+ aErrorBox->Execute();
}
}
void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry )
@@ -1061,9 +1091,9 @@ void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry )
Reference< browse::XBrowseNode > node = getBrowseNode( pEntry );
// ISSUE L10N string & can we centre list?
OUString aQuery = m_delQueryStr + getListOfChildren( node, 0 );
- MessageDialog aQueryBox(static_cast<vcl::Window*>(this), aQuery, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- aQueryBox.SetText( m_delQueryTitleStr );
- if ( aQueryBox.Execute() == RET_NO )
+ VclPtrInstance< MessageDialog > aQueryBox(static_cast<vcl::Window*>(this), aQuery, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ aQueryBox->SetText( m_delQueryTitleStr );
+ if ( aQueryBox->Execute() == RET_NO )
{
return;
}
@@ -1096,9 +1126,9 @@ void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry )
else
{
//ISSUE L10N & message from exception?
- MessageDialog aErrorBox(static_cast<vcl::Window*>(this), m_delErrStr);
- aErrorBox.SetText( m_delErrTitleStr );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(static_cast<vcl::Window*>(this), m_delErrStr);
+ aErrorBox->SetText( m_delErrTitleStr );
+ aErrorBox->Execute();
}
}
@@ -1468,11 +1498,10 @@ IMPL_LINK( SvxScriptErrorDialog, ShowDialog, OUString*, pMessage )
message = OUString( CUI_RES( RID_SVXSTR_ERROR_TITLE ) );
}
- MessageDialog* pBox = new MessageDialog(NULL, message, VCL_MESSAGE_WARNING);
+ ScopedVclPtrInstance<MessageDialog> pBox( nullptr, message, VCL_MESSAGE_WARNING );
pBox->SetText( CUI_RES( RID_SVXSTR_ERROR_TITLE ) );
pBox->Execute();
- delete pBox;
delete pMessage;
return 0;
diff --git a/cui/source/dialogs/showcols.cxx b/cui/source/dialogs/showcols.cxx
index 94e286ecd92d..4c86ac4da191 100644
--- a/cui/source/dialogs/showcols.cxx
+++ b/cui/source/dialogs/showcols.cxx
@@ -39,6 +39,17 @@ FmShowColsDialog::FmShowColsDialog(vcl::Window* pParent)
m_pOK->SetClickHdl( LINK( this, FmShowColsDialog, OnClickedOk ) );
}
+FmShowColsDialog::~FmShowColsDialog()
+{
+ disposeOnce();
+}
+
+void FmShowColsDialog::dispose()
+{
+ m_pList.clear();
+ m_pOK.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(FmShowColsDialog, OnClickedOk)
{
diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
index e3b6d18c58a3..69bfd0ec0051 100644
--- a/cui/source/dialogs/splitcelldlg.cxx
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -24,16 +24,27 @@
#include "splitcelldlg.hxx"
#include "cuires.hrc"
+namespace {
+ class NoApplyDialog : public SvxStandardDialog
+ {
+ public:
+ NoApplyDialog(vcl::Window *pParent, const OUString &rId, const OUString &rXML) :
+ SvxStandardDialog(pParent, rId, rXML) { }
+ protected:
+ virtual void Apply() SAL_OVERRIDE {}
+ };
+}
+
SvxSplitTableDlg::SvxSplitTableDlg( vcl::Window *pParent, bool bIsTableVertical,
long nMaxVertical, long nMaxHorizontal )
- : SvxStandardDialog(pParent, "SplitCellsDialog", "cui/ui/splitcellsdialog.ui")
+ : m_pDialog(VclPtr<NoApplyDialog>::Create(pParent, "SplitCellsDialog", "cui/ui/splitcellsdialog.ui"))
, mnMaxVertical(nMaxVertical)
, mnMaxHorizontal(nMaxHorizontal)
{
- get(m_pCountEdit, "countnf");
- get(m_pHorzBox, "hori");
- get(m_pVertBox, "vert");
- get(m_pPropCB, "prop");
+ m_pDialog->get(m_pCountEdit, "countnf");
+ m_pDialog->get(m_pHorzBox, "hori");
+ m_pDialog->get(m_pVertBox, "vert");
+ m_pDialog->get(m_pPropCB, "prop");
m_pHorzBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
m_pPropCB->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
m_pVertBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
@@ -55,6 +66,11 @@ SvxSplitTableDlg::SvxSplitTableDlg( vcl::Window *pParent, bool bIsTableVertical,
SvxSplitTableDlg::~SvxSplitTableDlg()
{
+ m_pCountEdit.clear();
+ m_pHorzBox.clear();
+ m_pVertBox.clear();
+ m_pPropCB.clear();
+ m_pDialog.disposeAndClear();
}
IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton )
@@ -83,11 +99,7 @@ long SvxSplitTableDlg::GetCount() const
short SvxSplitTableDlg::Execute()
{
- return SvxStandardDialog::Execute();
-}
-
-void SvxSplitTableDlg::Apply()
-{
+ return m_pDialog->Execute();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 39fbcd2cc99a..44976012dad2 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -64,7 +64,14 @@ SvxSearchFormatDialog::SvxSearchFormatDialog(vcl::Window* pParent, const SfxItem
SvxSearchFormatDialog::~SvxSearchFormatDialog()
{
+ disposeOnce();
+}
+
+void SvxSearchFormatDialog::dispose()
+{
delete m_pFontList;
+ m_pFontList = NULL;
+ SfxTabDialog::dispose();
}
void SvxSearchFormatDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage )
@@ -171,6 +178,17 @@ SvxSearchAttributeDialog::SvxSearchAttributeDialog(vcl::Window* pParent,
m_pAttrLB->SelectEntryPos( 0 );
}
+SvxSearchAttributeDialog::~SvxSearchAttributeDialog()
+{
+ disposeOnce();
+}
+
+void SvxSearchAttributeDialog::dispose()
+{
+ m_pAttrLB.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(SvxSearchAttributeDialog, OKHdl)
@@ -241,4 +259,18 @@ SvxSearchSimilarityDialog::SvxSearchSimilarityDialog
m_pRelaxBox->Check( bRelax );
}
+SvxSearchSimilarityDialog::~SvxSearchSimilarityDialog()
+{
+ disposeOnce();
+}
+
+void SvxSearchSimilarityDialog::dispose()
+{
+ m_pOtherFld.clear();
+ m_pLongerFld.clear();
+ m_pShorterFld.clear();
+ m_pRelaxBox.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index 5ad4a5dae338..953bbc7b0e69 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -66,6 +66,17 @@ LookUpComboBox::LookUpComboBox(vcl::Window *pParent)
EnableAutocomplete( false );
}
+LookUpComboBox::~LookUpComboBox()
+{
+ disposeOnce();
+}
+
+void LookUpComboBox::dispose()
+{
+ m_pDialog.clear();
+ ComboBox::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLookUpComboBox(vcl::Window *pParent, VclBuilder::stringmap &)
{
return new LookUpComboBox(pParent);
@@ -76,10 +87,6 @@ void LookUpComboBox::init(SvxThesaurusDialog *pDialog)
m_pDialog = pDialog;
}
-LookUpComboBox::~LookUpComboBox()
-{
-}
-
void LookUpComboBox::Modify()
{
m_aModifyIdle.Start();
@@ -100,13 +107,21 @@ ReplaceEdit::ReplaceEdit(vcl::Window *pParent)
{
}
-extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeReplaceEdit(vcl::Window *pParent, VclBuilder::stringmap &)
+ReplaceEdit::~ReplaceEdit()
{
- return new ReplaceEdit(pParent);
+ disposeOnce();
}
-ReplaceEdit::~ReplaceEdit()
+void ReplaceEdit::dispose()
{
+ m_pBtn.clear();
+ Edit::dispose();
+}
+
+
+extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeReplaceEdit(vcl::Window *pParent, VclBuilder::stringmap &)
+{
+ return new ReplaceEdit(pParent);
}
void ReplaceEdit::Modify()
@@ -178,7 +193,14 @@ void ThesaurusAlternativesCtrl::init(SvxThesaurusDialog *pDialog)
ThesaurusAlternativesCtrl::~ThesaurusAlternativesCtrl()
{
+ disposeOnce();
+}
+
+void ThesaurusAlternativesCtrl::dispose()
+{
ClearExtraData();
+ m_pDialog.clear();
+ SvxCheckListBox::dispose();
}
void ThesaurusAlternativesCtrl::ClearExtraData()
@@ -516,14 +538,25 @@ SvxThesaurusDialog::SvxThesaurusDialog(
Enable( false );
}
-IMPL_LINK( SvxThesaurusDialog, ReplaceBtnHdl_Impl, Button *, EMPTYARG /*pBtn*/ )
+SvxThesaurusDialog::~SvxThesaurusDialog()
{
- EndDialog(RET_OK);
- return 0;
+ disposeOnce();
}
-SvxThesaurusDialog::~SvxThesaurusDialog()
+void SvxThesaurusDialog::dispose()
+{
+ m_pLeftBtn.clear();
+ m_pWordCB.clear();
+ m_pAlternativesCT.clear();
+ m_pReplaceEdit.clear();
+ m_pLangLB.clear();
+ SvxStandardDialog::dispose();
+}
+
+IMPL_LINK( SvxThesaurusDialog, ReplaceBtnHdl_Impl, Button *, EMPTYARG /*pBtn*/ )
{
+ EndDialog(RET_OK);
+ return 0;
}
void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage )
diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx
index 32dea8c5ab77..5b2dff90d8d0 100644
--- a/cui/source/dialogs/zoom.cxx
+++ b/cui/source/dialogs/zoom.cxx
@@ -289,7 +289,28 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet )
}
SvxZoomDialog::~SvxZoomDialog()
-{}
+{
+ disposeOnce();
+}
+
+void SvxZoomDialog::dispose()
+{
+ mpOutSet.reset();
+ m_pOptimalBtn.clear();
+ m_pWholePageBtn.clear();
+ m_pPageWidthBtn.clear();
+ m_p100Btn.clear();
+ m_pUserBtn.clear();
+ m_pUserEdit.clear();
+ m_pViewFrame.clear();
+ m_pAutomaticBtn.clear();
+ m_pSingleBtn.clear();
+ m_pColumnsBtn.clear();
+ m_pColumnsEdit.clear();
+ m_pBookModeChk.clear();
+ m_pOKBtn.clear();
+ SfxModalDialog::dispose();
+}
IMPL_LINK(SvxZoomDialog, UserHdl, RadioButton *, pButton)
{
diff --git a/cui/source/factory/cuiexp.cxx b/cui/source/factory/cuiexp.cxx
index 8bb9d51ef1f6..754d8b47a092 100644
--- a/cui/source/factory/cuiexp.cxx
+++ b/cui/source/factory/cuiexp.cxx
@@ -17,6 +17,35 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sfx2/basedlgs.hxx"
+#include "cuigaldlg.hxx"
+#include "hlmarkwn.hxx"
+#include "srchxtra.hxx"
+#include "cuisrchdlg.hxx"
+#include "transfrm.hxx"
+#include "labdlg.hxx"
+#include "cuitbxform.hxx"
+#include "optdict.hxx"
+#include "dlgname.hxx"
+#include "cuiimapwnd.hxx"
+#include "multipat.hxx"
+#include "cuifmsearch.hxx"
+#include "cuigrfflt.hxx"
+#include "cuitabarea.hxx"
+#include "insdlg.hxx"
+#include "pastedlg.hxx"
+#include "linkdlg.hxx"
+#include "postdlg.hxx"
+#include "passwdomdlg.hxx"
+#include "cuihyperdlg.hxx"
+#include "selector.hxx"
+#include "SpellDialog.hxx"
+#include "zoom.hxx"
+#include "showcols.hxx"
+#include "hyphen.hxx"
+#include "thesdlg.hxx"
+#include "hangulhanjadlg.hxx"
+#include "dstribut.hxx"
#include "dlgfact.hxx"
#include "sal/types.h"
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index f2f368ad4dc1..6158d9abceba 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -105,10 +105,11 @@ IMPL_ABSTDLG_BASE(AbstractFmShowColsDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractHyphenWordDialog_Impl)
IMPL_ABSTDLG_BASE(AbstractThesaurusDialog_Impl)
-AbstractSvxZoomDialog_Impl::~AbstractSvxZoomDialog_Impl() \
+AbstractSvxZoomDialog_Impl::~AbstractSvxZoomDialog_Impl()
{
- delete pDlg;
+ pDlg.disposeAndClear();
}
+
short AbstractSvxZoomDialog_Impl::Execute()
{
return pDlg->Execute();
@@ -154,7 +155,7 @@ IMPL_ABSTDLG_BASE(AbstractPasswordToOpenModifyDialog_Impl);
// virtual
VclAbstractDialog2_Impl::~VclAbstractDialog2_Impl()
{
- delete m_pDlg;
+ m_pDlg.disposeAndClear();
}
// virtual
@@ -970,12 +971,12 @@ bool AbstractPasswordToOpenModifyDialog_Impl::IsRecommendToOpenReadonly() const
// Create dialogs with simplest interface
VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( vcl::Window* pParent, sal_uInt32 nResId )
{
- Dialog* pDlg=NULL;
+ VclPtr<Dialog> pDlg;
switch ( nResId )
{
case RID_DEFAULTABOUT:
{
- pDlg = new AboutDialog(pParent);
+ pDlg = VclPtr<AboutDialog>::Create(pParent);
break;
}
case SID_OPTIONS_TREEDIALOG :
@@ -986,7 +987,7 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( vcl::Window* pPa
if (nResId == SID_OPTIONS_TREEDIALOG)
bActivateLastSelection = true;
Reference< frame::XFrame > xFrame;
- OfaTreeOptionsDialog* pOptDlg = new OfaTreeOptionsDialog( pParent, xFrame, bActivateLastSelection );
+ VclPtrInstance<OfaTreeOptionsDialog> pOptDlg( pParent, xFrame, bActivateLastSelection );
if (nResId == SID_OPTIONS_DATABASES)
{
pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
@@ -996,7 +997,7 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( vcl::Window* pPa
//open the tab page "tools/options/languages"
pOptDlg->ActivatePage(OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE);
}
- pDlg = pOptDlg;
+ pDlg.reset(pOptDlg);
}
break;
default:
@@ -1018,17 +1019,17 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateFrameDialog(
vcl::Window* pParent, const Reference< frame::XFrame >& rxFrame,
sal_uInt32 nResId, const OUString& rParameter )
{
- Dialog* pDlg = NULL;
+ VclPtr<Dialog> pDlg;
if ( SID_OPTIONS_TREEDIALOG == nResId || SID_OPTIONS_DATABASES == nResId )
{
// only activate last page if we dont want to activate a special page
bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.isEmpty() );
- OfaTreeOptionsDialog* pOptDlg = new OfaTreeOptionsDialog( pParent, rxFrame, bActivateLastSelection );
+ VclPtrInstance<OfaTreeOptionsDialog> pOptDlg( pParent, rxFrame, bActivateLastSelection );
if ( nResId == SID_OPTIONS_DATABASES )
pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
else if ( !rParameter.isEmpty() )
pOptDlg->ActivatePage( rParameter );
- pDlg = pOptDlg;
+ pDlg.reset(pOptDlg);
}
if ( pDlg )
@@ -1049,10 +1050,10 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabDialog( sal_uInt32 nR
switch ( nResId )
{
case RID_OFA_AUTOCORR_DLG :
- pDlg = new OfaAutoCorrDlg( pParent, pAttrSet );
+ pDlg = VclPtr<OfaAutoCorrDlg>::Create( pParent, pAttrSet );
break;
case RID_SVXDLG_CUSTOMIZE :
- pDlg = new SvxConfigDialog( pParent, pAttrSet );
+ pDlg = VclPtr<SvxConfigDialog>::Create( pParent, pAttrSet );
break;
default:
break;
@@ -1070,17 +1071,17 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabDialog( sal_uInt32 nR
bool /*bEditFmt*/,
const OUString * )
{
- SfxTabDialog* pDlg=NULL;
+ VclPtr<SfxTabDialog> pDlg;
switch ( nResId )
{
case RID_OFA_AUTOCORR_DLG :
- pDlg = new OfaAutoCorrDlg( pParent, pAttrSet );
+ pDlg = VclPtr<OfaAutoCorrDlg>::Create( pParent, pAttrSet );
break;
case RID_SVXDLG_CUSTOMIZE :
{
- SvxConfigDialog* pDlg1 = new SvxConfigDialog( pParent, pAttrSet );
+ VclPtrInstance<SvxConfigDialog> pDlg1( pParent, pAttrSet );
pDlg1->SetFrame(xViewFrame);
- pDlg = (SfxTabDialog*)pDlg1;
+ pDlg.reset(pDlg1);
}
break;
default:
@@ -1098,7 +1099,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTextTabDialog( vcl::Wind
SdrView* pView,
SdrModel* )
{
- SfxTabDialog* pDlg = new SvxTextTabDialog( pParent, pAttrSet, pView );
+ VclPtrInstance<SvxTextTabDialog> pDlg( pParent, pAttrSet, pView );
return new CuiAbstractTabDialog_Impl( pDlg );
}
@@ -1107,7 +1108,7 @@ AbstractSvxCaptionDialog* AbstractDialogFactory_Impl::CreateCaptionDialog(
const SdrView* pView,
sal_uInt16 nAnchorTypes )
{
- SvxCaptionTabDialog* pDlg = new SvxCaptionTabDialog( pParent, pView, nAnchorTypes );
+ VclPtrInstance<SvxCaptionTabDialog> pDlg( pParent, pView, nAnchorTypes );
return new AbstractSvxCaptionDialog_Impl( pDlg );
}
@@ -1116,14 +1117,14 @@ AbstractSvxDistributeDialog* AbstractDialogFactory_Impl::CreateSvxDistributeD
SvxDistributeHorizontal eHor ,
SvxDistributeVertical eVer)
{
- SvxDistributeDialog* pDlg = new SvxDistributeDialog( pParent, rAttr, eHor, eVer);
+ VclPtrInstance<SvxDistributeDialog> pDlg( pParent, rAttr, eHor, eVer);
return new AbstractSvxDistributeDialog_Impl( pDlg );
}
AbstractHangulHanjaConversionDialog* AbstractDialogFactory_Impl::CreateHangulHanjaConversionDialog(vcl::Window* pParent,
editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection )
{
- HangulHanjaConversionDialog* pDlg = new HangulHanjaConversionDialog( pParent, _ePrimaryDirection);
+ VclPtrInstance<HangulHanjaConversionDialog> pDlg( pParent, _ePrimaryDirection);
return new AbstractHangulHanjaConversionDialog_Impl( pDlg );
}
@@ -1131,7 +1132,7 @@ AbstractThesaurusDialog* AbstractDialogFactory_Impl::CreateThesaurusDialog( vcl:
css::uno::Reference< css::linguistic2::XThesaurus > xThesaurus,
const OUString &rWord, sal_Int16 nLanguage )
{
- SvxThesaurusDialog* pDlg = new SvxThesaurusDialog( pParent, xThesaurus, rWord, nLanguage );
+ VclPtrInstance<SvxThesaurusDialog> pDlg( pParent, xThesaurus, rWord, nLanguage );
return new AbstractThesaurusDialog_Impl( pDlg );
}
@@ -1140,19 +1141,19 @@ AbstractHyphenWordDialog* AbstractDialogFactory_Impl::CreateHyphenWordDialog( vc
::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen,
SvxSpellWrapper* pWrapper )
{
- SvxHyphenWordDialog* pDlg = new SvxHyphenWordDialog( rWord, nLang, pParent, xHyphen, pWrapper );
+ VclPtrInstance<SvxHyphenWordDialog> pDlg( rWord, nLang, pParent, xHyphen, pWrapper );
return new AbstractHyphenWordDialog_Impl( pDlg );
}
AbstractFmShowColsDialog * AbstractDialogFactory_Impl::CreateFmShowColsDialog( vcl::Window* pParent )
{
- FmShowColsDialog* pDlg = new FmShowColsDialog( pParent);
+ VclPtrInstance<FmShowColsDialog> pDlg( pParent);
return new AbstractFmShowColsDialog_Impl( pDlg );
}
AbstractSvxZoomDialog * AbstractDialogFactory_Impl::CreateSvxZoomDialog( vcl::Window* pParent,
const SfxItemSet& rCoreSet)
{
- SvxZoomDialog* pDlg = new SvxZoomDialog( pParent, rCoreSet);
+ VclPtrInstance<SvxZoomDialog> pDlg( pParent, rCoreSet);
return new AbstractSvxZoomDialog_Impl( pDlg );
}
@@ -1161,26 +1162,26 @@ AbstractSpellDialog * AbstractDialogFactory_Impl::CreateSvxSpellDialog(
SfxBindings* pBindings,
svx::SpellDialogChildWindow* pSpellChildWindow )
{
- svx::SpellDialog* pDlg = new svx::SpellDialog(pSpellChildWindow, pParent, pBindings);
+ VclPtrInstance<svx::SpellDialog> pDlg(pSpellChildWindow, pParent, pBindings);
return new AbstractSpellDialog_Impl(pDlg);
}
VclAbstractRefreshableDialog * AbstractDialogFactory_Impl::CreateActualizeProgressDialog( vcl::Window* pParent, GalleryTheme* pThm )
{
- Dialog* pDlg = new ActualizeProgress( pParent, pThm);
+ VclPtrInstance<ActualizeProgress> pDlg(pParent, pThm);
return new VclAbstractRefreshableDialog_Impl( pDlg );
}
AbstractSearchProgress * AbstractDialogFactory_Impl::CreateSearchProgressDialog( vcl::Window* pParent,
const INetURLObject& rStartURL )
{
- SearchProgress* pDlg = new SearchProgress( pParent, rStartURL);
+ SearchProgress* pDlg = VclPtr<SearchProgress>::Create( pParent, rStartURL);
return new AbstractSearchProgress_Impl( pDlg );
}
AbstractTakeProgress * AbstractDialogFactory_Impl::CreateTakeProgressDialog( vcl::Window* pParent )
{
- TakeProgress* pDlg = new TakeProgress( pParent );
+ VclPtrInstance<TakeProgress> pDlg( pParent );
return new AbstractTakeProgress_Impl( pDlg );
}
@@ -1195,7 +1196,7 @@ AbstractScriptSelectorDialog*
AbstractDialogFactory_Impl::CreateScriptSelectorDialog(
vcl::Window* pParent, bool bShowSlots, const Reference< frame::XFrame >& _rxFrame )
{
- SvxScriptSelectorDialog* pDlg = new SvxScriptSelectorDialog(pParent, bShowSlots, _rxFrame);
+ VclPtrInstance<SvxScriptSelectorDialog> pDlg(pParent, bShowSlots, _rxFrame);
return new AbstractScriptSelectorDialog_Impl(pDlg);
}
@@ -1216,21 +1217,21 @@ void AbstractScriptSelectorDialog_Impl::SetRunLabel()
VclAbstractDialog * AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( vcl::Window* pParent,
const OUString& rLanguage)
{
- Dialog* pDlg = new SvxScriptOrgDialog( pParent, rLanguage);
+ VclPtrInstance<SvxScriptOrgDialog> pDlg( pParent, rLanguage);
return new CuiVclAbstractDialog_Impl( pDlg );
}
AbstractTitleDialog * AbstractDialogFactory_Impl::CreateTitleDialog( vcl::Window* pParent,
const OUString& rOldText)
{
- TitleDialog* pDlg = new TitleDialog( pParent, rOldText);
+ VclPtrInstance<TitleDialog> pDlg( pParent, rOldText);
return new AbstractTitleDialog_Impl( pDlg );
}
AbstractGalleryIdDialog * AbstractDialogFactory_Impl::CreateGalleryIdDialog( vcl::Window* pParent,
GalleryTheme* pThm )
{
- GalleryIdDialog* pDlg = new GalleryIdDialog( pParent, pThm);
+ VclPtrInstance<GalleryIdDialog> pDlg( pParent, pThm);
return new AbstractGalleryIdDialog_Impl( pDlg );
}
@@ -1238,7 +1239,7 @@ VclAbstractDialog2 * AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDia
ExchangeData* pData,
SfxItemSet* pItemSet)
{
- Dialog* pDlg = new GalleryThemeProperties( pParent, pData, pItemSet);
+ VclPtrInstance<GalleryThemeProperties> pDlg( pParent, pData, pItemSet);
return new VclAbstractDialog2_Impl( pDlg );
}
@@ -1247,7 +1248,8 @@ AbstractURLDlg * AbstractDialogFactory_Impl::CreateURLDialog( vcl::Window* pPare
const OUString& rTarget, const OUString& rName,
TargetList& rTargetList )
{
- URLDlg* pDlg = new URLDlg( pParent, rURL, rAltText, rDescription, rTarget, rName, rTargetList);
+ VclPtrInstance<URLDlg> pDlg( pParent, rURL, rAltText, rDescription,
+ rTarget, rName, rTargetList);
return new AbstractURLDlg_Impl( pDlg );
}
@@ -1257,7 +1259,7 @@ AbstractSvxHlinkDlgMarkWnd* AbstractDialogFactory_Impl::CreateSvxHlinkDlgMarkWnd
switch ( nResId )
{
case RID_SVXFLOAT_HYPERLINK_MARKWND :
- pDlg = new SvxHlinkDlgMarkWnd( pParent );
+ pDlg = VclPtr<SvxHlinkDlgMarkWnd>::Create ( pParent );
break;
default:
break;
@@ -1271,7 +1273,7 @@ AbstractSvxHlinkDlgMarkWnd* AbstractDialogFactory_Impl::CreateSvxHlinkDlgMarkWnd
SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabItemDialog(vcl::Window* pParent,
const SfxItemSet& rSet)
{
- SfxTabDialog* pDlg = new SvxSearchFormatDialog(pParent, rSet);
+ VclPtrInstance<SvxSearchFormatDialog> pDlg(pParent, rSet);
return new CuiAbstractTabDialog_Impl(pDlg);
}
@@ -1279,7 +1281,7 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateSvxSearchAttributeDial
SearchAttrItemList& rLst,
const sal_uInt16* pWhRanges )
{
- Dialog* pDlg = new SvxSearchAttributeDialog( pParent, rLst, pWhRanges);
+ VclPtrInstance<SvxSearchAttributeDialog> pDlg( pParent, rLst, pWhRanges);
return new CuiVclAbstractDialog_Impl( pDlg );
}
@@ -1289,7 +1291,7 @@ AbstractSvxSearchSimilarityDialog * AbstractDialogFactory_Impl::CreateSvxSearchS
sal_uInt16 nShorter,
sal_uInt16 nLonger)
{
- SvxSearchSimilarityDialog* pDlg = new SvxSearchSimilarityDialog( pParent, bRelax, nOther, nShorter, nLonger );
+ VclPtrInstance<SvxSearchSimilarityDialog> pDlg( pParent, bRelax, nOther, nShorter, nLonger );
return new AbstractSvxSearchSimilarityDialog_Impl( pDlg );
}
@@ -1300,7 +1302,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg(
bool bEnableSelector,
bool bEnableDrawingLayerFillStyles)
{
- SfxTabDialog* pDlg = new SvxBorderBackgroundDlg(
+ VclPtrInstance<SvxBorderBackgroundDlg> pDlg(
pParent,
rCoreSet,
bEnableSelector,
@@ -1314,7 +1316,7 @@ AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTab
const SdrView* pView,
sal_uInt16 nAnchorTypes )
{
- SvxTransformTabDialog* pDlg = new SvxTransformTabDialog( pParent, pAttr,pView, nAnchorTypes);
+ VclPtrInstance<SvxTransformTabDialog> pDlg( pParent, pAttr,pView, nAnchorTypes);
return new AbstractSvxTransformTabDialog_Impl( pDlg );
}
@@ -1325,19 +1327,19 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSchTransformTabDialog( v
bool bSizeTabPage
)
{
- SfxTabDialog* pDlg=NULL;
+ VclPtr<SfxTabDialog> pDlg;
switch ( nResId )
{
case RID_SCH_TransformTabDLG_SVXPAGE_ANGLE :
{
- pDlg = new SvxTransformTabDialog( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE);
+ pDlg.reset( VclPtr<SvxTransformTabDialog>::Create( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE) );
pDlg->RemoveTabPage( "RID_SVXPAGE_ANGLE" );
pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" );
}
break;
case RID_SCH_TransformTabDLG_SVXPAGE_SLANT:
{
- pDlg = new SvxTransformTabDialog( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE);
+ pDlg.reset(VclPtr<SvxTransformTabDialog>::Create ( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE ) );
pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" );
}
break;
@@ -1354,20 +1356,20 @@ AbstractSvxJSearchOptionsDialog * AbstractDialogFactory_Impl::CreateSvxJSearchOp
const SfxItemSet& rOptionsSet,
sal_Int32 nInitialFlags)
{
- SvxJSearchOptionsDialog* pDlg = new SvxJSearchOptionsDialog( pParent, rOptionsSet, nInitialFlags );
+ VclPtrInstance<SvxJSearchOptionsDialog> pDlg( pParent, rOptionsSet, nInitialFlags );
return new AbstractSvxJSearchOptionsDialog_Impl( pDlg );
}
AbstractFmInputRecordNoDialog * AbstractDialogFactory_Impl::CreateFmInputRecordNoDialog( vcl::Window* pParent )
{
- FmInputRecordNoDialog* pDlg = new FmInputRecordNoDialog( pParent );
+ VclPtrInstance<FmInputRecordNoDialog> pDlg( pParent );
return new AbstractFmInputRecordNoDialog_Impl( pDlg );
}
AbstractSvxNewDictionaryDialog * AbstractDialogFactory_Impl::CreateSvxNewDictionaryDialog( vcl::Window* pParent,
::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl )
{
- SvxNewDictionaryDialog* pDlg = new SvxNewDictionaryDialog( pParent, xSpl );
+ VclPtrInstance<SvxNewDictionaryDialog> pDlg( pParent, xSpl );
return new AbstractSvxNewDictionaryDialog_Impl( pDlg );
}
@@ -1380,7 +1382,7 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialo
switch ( nResId )
{
case RID_SFXDLG_EDITDICT :
- pDlg = new SvxEditDictionaryDialog( pParent, rName, xSpl );
+ pDlg = VclPtr<SvxEditDictionaryDialog>::Create( pParent, rName, xSpl );
break;
default:
break;
@@ -1394,36 +1396,36 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialo
AbstractSvxNameDialog * AbstractDialogFactory_Impl::CreateSvxNameDialog( vcl::Window* pParent,
const OUString& rName, const OUString& rDesc )
{
- SvxNameDialog* pDlg = new SvxNameDialog( pParent, rName, rDesc );
+ VclPtrInstance<SvxNameDialog> pDlg( pParent, rName, rDesc );
return new AbstractSvxNameDialog_Impl( pDlg );
}
AbstractSvxObjectNameDialog* AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(vcl::Window* pParent, const OUString& rName )
{
- return new AbstractSvxObjectNameDialog_Impl(new SvxObjectNameDialog(pParent, rName));
+ return new AbstractSvxObjectNameDialog_Impl(VclPtr<SvxObjectNameDialog>::Create(pParent, rName));
}
AbstractSvxObjectTitleDescDialog* AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(vcl::Window* pParent, const OUString& rTitle, const OUString& rDescription)
{
- return new AbstractSvxObjectTitleDescDialog_Impl(new SvxObjectTitleDescDialog(pParent, rTitle, rDescription));
+ return new AbstractSvxObjectTitleDescDialog_Impl(VclPtr<SvxObjectTitleDescDialog>::Create(pParent, rTitle, rDescription));
}
AbstractSvxMessDialog * AbstractDialogFactory_Impl::CreateSvxMessDialog( vcl::Window* pParent, sal_uInt32,
const OUString& rText, const OUString& rDesc, Image* pImg )
{
- SvxMessDialog* pDlg = new SvxMessDialog( pParent, rText, rDesc, pImg );
+ VclPtrInstance<SvxMessDialog> pDlg( pParent, rText, rDesc, pImg );
return new AbstractSvxMessDialog_Impl( pDlg );
}
AbstractSvxMultiPathDialog * AbstractDialogFactory_Impl::CreateSvxMultiPathDialog(vcl::Window* pParent)
{
- SvxMultiPathDialog* pDlg = new SvxMultiPathDialog(pParent);
+ VclPtrInstance<SvxMultiPathDialog> pDlg(pParent);
return new AbstractSvxMultiPathDialog_Impl( pDlg );
}
AbstractSvxMultiPathDialog * AbstractDialogFactory_Impl::CreateSvxPathSelectDialog(vcl::Window* pParent)
{
- SvxPathSelectDialog* pDlg = new SvxPathSelectDialog(pParent);
+ VclPtrInstance<SvxPathSelectDialog> pDlg(pParent);
return new AbstractSvxPathSelectDialog_Impl( pDlg );
}
@@ -1435,7 +1437,7 @@ AbstractSvxHpLinkDlg * AbstractDialogFactory_Impl::CreateSvxHpLinkDlg (vcl::Wind
switch ( nResId )
{
case SID_HYPERLINK_DIALOG :
- pDlg = new SvxHpLinkDlg( pParent, pBindings );
+ pDlg = VclPtr<SvxHpLinkDlg>::Create( pParent, pBindings );
break;
default:
break;
@@ -1452,7 +1454,8 @@ AbstractFmSearchDialog* AbstractDialogFactory_Impl::CreateFmSearchDialog(vcl::W
sal_Int16 nInitialContext,
const Link& lnkContextSupplier)
{
- FmSearchDialog* pDlg = new FmSearchDialog( pParent, strInitialText, _rContexts, nInitialContext, lnkContextSupplier );
+ VclPtrInstance<FmSearchDialog> pDlg( pParent, strInitialText, _rContexts,
+ nInitialContext, lnkContextSupplier );
return new AbstractFmSearchDialog_Impl( pDlg );
}
@@ -1460,7 +1463,7 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterEmb
const Graphic& rGraphic,
RECT_POINT eLightSource)
{
- GraphicFilterDialog* pDlg = new GraphicFilterEmboss( pParent, rGraphic, eLightSource );
+ VclPtrInstance<GraphicFilterEmboss> pDlg( pParent, rGraphic, eLightSource );
return new AbstractGraphicFilterDialog_Impl( pDlg );
}
@@ -1468,7 +1471,7 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterPos
const Graphic& rGraphic,
sal_uInt16 nCount)
{
- GraphicFilterDialog* pDlg = new GraphicFilterPoster( pParent, rGraphic, nCount );
+ VclPtrInstance<GraphicFilterPoster> pDlg( pParent, rGraphic, nCount );
return new AbstractGraphicFilterDialog_Impl( pDlg );
}
@@ -1476,21 +1479,21 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSep
const Graphic& rGraphic,
sal_uInt16 nCount)
{
- GraphicFilterDialog* pDlg = new GraphicFilterSepia( pParent, rGraphic, nCount );
+ VclPtrInstance<GraphicFilterSepia> pDlg( pParent, rGraphic, nCount );
return new AbstractGraphicFilterDialog_Impl( pDlg );
}
AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSmooth(vcl::Window* pParent,
const Graphic& rGraphic, double nRadius)
{
- GraphicFilterDialog* pDlg = new GraphicFilterSmooth( pParent, rGraphic, nRadius );
+ VclPtrInstance<GraphicFilterSmooth> pDlg( pParent, rGraphic, nRadius );
return new AbstractGraphicFilterDialog_Impl( pDlg );
}
AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSolarize (vcl::Window* pParent,
const Graphic& rGraphic, sal_uInt8 nGreyThreshold, bool bInvert)
{
- GraphicFilterDialog* pDlg = new GraphicFilterSolarize( pParent, rGraphic, nGreyThreshold, bInvert );
+ VclPtrInstance<GraphicFilterSolarize> pDlg( pParent, rGraphic, nGreyThreshold, bInvert );
return new AbstractGraphicFilterDialog_Impl( pDlg );
}
@@ -1498,7 +1501,7 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterMos
const Graphic& rGraphic, sal_uInt16 nTileWidth, sal_uInt16 nTileHeight,
bool bEnhanceEdges)
{
- GraphicFilterDialog* pDlg = new GraphicFilterMosaic(pParent, rGraphic, nTileWidth, nTileHeight, bEnhanceEdges);
+ VclPtrInstance<GraphicFilterMosaic> pDlg(pParent, rGraphic, nTileWidth, nTileHeight, bEnhanceEdges);
return new AbstractGraphicFilterDialog_Impl( pDlg );
}
@@ -1507,7 +1510,7 @@ AbstractSvxAreaTabDialog* AbstractDialogFactory_Impl::CreateSvxAreaTabDialog( vc
SdrModel* pModel,
bool bShadow)
{
- SvxAreaTabDialog* pDlg = new SvxAreaTabDialog( pParent, pAttr, pModel, bShadow );
+ VclPtrInstance<SvxAreaTabDialog> pDlg( pParent, pAttr, pModel, bShadow );
return new AbstractSvxAreaTabDialog_Impl( pDlg );
}
@@ -1516,7 +1519,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxLineTabDialog( vcl::W
const SdrObject* pObj ,
bool bHasObj)
{
- SfxTabDialog* pDlg = new SvxLineTabDialog( pParent, pAttr, pModel,pObj,bHasObj );
+ VclPtrInstance<SvxLineTabDialog> pDlg( pParent, pAttr, pModel,pObj,bHasObj );
return new CuiAbstractTabDialog_Impl( pDlg );
}
@@ -1530,10 +1533,10 @@ SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( vcl::Window* pPa
switch ( nResId )
{
case SID_EVENTCONFIG :
- pDlg = new SfxMacroAssignDlg( pParent, _rxDocumentFrame, rAttr );
+ pDlg = VclPtr<SfxMacroAssignDlg>::Create( pParent, _rxDocumentFrame, rAttr );
break;
case RID_SVXDLG_CHARMAP :
- pDlg = new SvxCharacterMap( pParent, true, &rAttr );
+ pDlg = VclPtr<SvxCharacterMap>::Create( pParent, true, &rAttr );
break;
default:
break;
@@ -1555,13 +1558,13 @@ SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( vcl::Window* pPa
switch ( nResId )
{
case RID_SVXPAGE_MEASURE :
- pDlg = new SvxMeasureDialog( pParent, rAttr, pView );
+ pDlg = VclPtr<SvxMeasureDialog>::Create( pParent, rAttr, pView );
break;
case RID_SVXPAGE_CONNECTION :
- pDlg = new SvxConnectionDialog( pParent, rAttr, pView );
+ pDlg = VclPtr<SvxConnectionDialog>::Create( pParent, rAttr, pView );
break;
case RID_SFXPAGE_DBREGISTER :
- pDlg = new DatabaseRegistrationDialog( pParent, rAttr );
+ pDlg = VclPtr<DatabaseRegistrationDialog>::Create( pParent, rAttr );
break;
default:
break;
@@ -1577,7 +1580,7 @@ AbstractSvxPostItDialog* AbstractDialogFactory_Impl::CreateSvxPostItDialog( vcl:
const SfxItemSet& rCoreSet,
bool bPrevNext )
{
- SvxPostItDialog* pDlg = new SvxPostItDialog( pParent, rCoreSet, bPrevNext );
+ VclPtrInstance<SvxPostItDialog> pDlg( pParent, rCoreSet, bPrevNext );
return new AbstractSvxPostItDialog_Impl( pDlg );
}
@@ -1589,7 +1592,7 @@ public:
:m_aItems( SfxGetpApp()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM )
{
m_aItems.Put( SfxBoolItem( SID_ATTR_MACROITEM, _bUnoDialogMode ) );
- m_pDialog.reset( new SvxMacroAssignDlg( _pParent, _rxDocumentFrame, m_aItems, _rxEvents, _nInitiallySelectedEvent ) );
+ m_pDialog.reset( VclPtr<SvxMacroAssignDlg>::Create( _pParent, _rxDocumentFrame, m_aItems, _rxEvents, _nInitiallySelectedEvent ) );
}
virtual short Execute() SAL_OVERRIDE;
@@ -1597,7 +1600,7 @@ public:
private:
SfxItemSet m_aItems;
- ::std::unique_ptr< SvxMacroAssignDlg > m_pDialog;
+ VclPtr< SvxMacroAssignDlg > m_pDialog;
};
short SvxMacroAssignDialog::Execute()
@@ -1765,11 +1768,11 @@ SfxAbstractInsertObjectDialog* AbstractDialogFactory_Impl::CreateInsertObjectDia
{
InsertObjectDialog_Impl* pDlg=0;
if ( rCommand == ".uno:InsertObject" )
- pDlg = new SvInsertOleDlg( pParent, xStor, pList );
+ pDlg = VclPtr<SvInsertOleDlg>::Create( pParent, xStor, pList );
else if ( rCommand == ".uno:InsertPlugin" )
- pDlg = new SvInsertPlugInDialog( pParent, xStor );
+ pDlg = VclPtr<SvInsertPlugInDialog>::Create( pParent, xStor );
else if ( rCommand == ".uno:InsertObjectFloatingFrame" )
- pDlg = new SfxInsertFloatingFrameDialog( pParent, xStor );
+ pDlg = VclPtr<SfxInsertFloatingFrameDialog>::Create( pParent, xStor );
if ( pDlg )
{
@@ -1784,7 +1787,7 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateEditObjectDialog( vcl::Wind
{
if ( rCommand == ".uno:InsertObjectFloatingFrame" )
{
- InsertObjectDialog_Impl* pDlg = new SfxInsertFloatingFrameDialog( pParent, xObj );
+ VclPtrInstance<SfxInsertFloatingFrameDialog> pDlg( pParent, xObj );
pDlg->SetHelpId( OUStringToOString( rCommand, RTL_TEXTENCODING_UTF8 ) );
return new CuiVclAbstractDialog_Impl( pDlg );
}
@@ -1795,12 +1798,12 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateEditObjectDialog( vcl::Wind
SfxAbstractPasteDialog* AbstractDialogFactory_Impl::CreatePasteDialog( vcl::Window* pParent )
{
- return new AbstractPasteDialog_Impl( new SvPasteObjectDialog( pParent ) );
+ return new AbstractPasteDialog_Impl( VclPtr<SvPasteObjectDialog>::Create( pParent ) );
}
SfxAbstractLinksDialog* AbstractDialogFactory_Impl::CreateLinksDialog( vcl::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML, sfx2::SvBaseLink* p)
{
- SvBaseLinksDlg* pLinkDlg = new SvBaseLinksDlg( pParent, pMgr, bHTML );
+ VclPtrInstance<SvBaseLinksDlg> pLinkDlg( pParent, pMgr, bHTML );
if ( p )
pLinkDlg->SetActLink(p);
return new AbstractLinksDialog_Impl( pLinkDlg );
@@ -1808,7 +1811,7 @@ SfxAbstractLinksDialog* AbstractDialogFactory_Impl::CreateLinksDialog( vcl::Wind
SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* /*pObj*/ )
{
- return new CuiAbstractTabDialog_Impl( new SvxFormatCellsDialog( pParent, pAttr, pModel ) );
+ return new CuiAbstractTabDialog_Impl( VclPtr<SvxFormatCellsDialog>::Create( pParent, pAttr, pModel ) );
}
SvxAbstractSplittTableDialog* AbstractDialogFactory_Impl::CreateSvxSplittTableDialog( vcl::Window* pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal )
@@ -1824,7 +1827,7 @@ SvxAbstractNewTableDialog* AbstractDialogFactory_Impl::CreateSvxNewTableDialog(
VclAbstractDialog* AbstractDialogFactory_Impl::CreateOptionsDialog(
vcl::Window* pParent, const OUString& rExtensionId, const OUString& /*rApplicationContext*/ )
{
- return new CuiVclAbstractDialog_Impl( new OfaTreeOptionsDialog( pParent, rExtensionId ) );
+ return new CuiVclAbstractDialog_Impl( VclPtr<OfaTreeOptionsDialog>::Create( pParent, rExtensionId ) );
}
SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( vcl::Window* pParent, bool bCol, const OString& sHelpId )
@@ -1836,7 +1839,7 @@ AbstractPasswordToOpenModifyDialog * AbstractDialogFactory_Impl::CreatePasswordT
vcl::Window * pParent,
sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify )
{
- PasswordToOpenModifyDialog * pDlg = new PasswordToOpenModifyDialog( pParent, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify );
+ VclPtrInstance<PasswordToOpenModifyDialog> pDlg( pParent, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify );
return new AbstractPasswordToOpenModifyDialog_Impl( pDlg );
}
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index ffb15778c5e1..808a80c96fa5 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -61,7 +61,7 @@ class HangulHanjaConversionDialog;
using namespace svx;
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
- DialogClass* pDlg; \
+ VclPtr<DialogClass> pDlg; \
public: \
Class( DialogClass* p) \
: pDlg(p) \
@@ -72,16 +72,16 @@ public: \
#define IMPL_ABSTDLG_BASE(Class) \
Class::~Class() \
{ \
- delete pDlg; \
+ pDlg.disposeAndClear(); \
} \
-short Class::Execute() \
+short Class::Execute() \
{ \
return pDlg->Execute(); \
}
class VclAbstractDialog2_Impl : public VclAbstractDialog2
{
- Dialog* m_pDlg;
+ ScopedVclPtr<Dialog> m_pDlg;
Link m_aEndDlgHdl;
public:
VclAbstractDialog2_Impl( Dialog* p ) : m_pDlg( p ) {}
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index eb24820e3351..cdf2ed91d22b 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -28,7 +28,7 @@ extern "C"
SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(vcl::Window* i_pParent, const vcl::Font& i_rFont, OUString& o_rResult)
{
bool bRet = false;
- boost::scoped_ptr<SvxCharacterMap> aDlg(new SvxCharacterMap( i_pParent ));
+ VclPtrInstance< SvxCharacterMap > aDlg( i_pParent );
aDlg->DisableFontSelection();
aDlg->SetCharFont(i_rFont);
if ( aDlg->Execute() == RET_OK )
diff --git a/cui/source/inc/ControlFocusHelper.hxx b/cui/source/inc/ControlFocusHelper.hxx
index b984838fa09c..6530f3cf6740 100644
--- a/cui/source/inc/ControlFocusHelper.hxx
+++ b/cui/source/inc/ControlFocusHelper.hxx
@@ -26,11 +26,13 @@
class SvxControlFocusHelper : public Control
{
private:
- Control* m_pFocusCtrl;
+ VclPtr<Control> m_pFocusCtrl;
public:
SvxControlFocusHelper( vcl::Window* pParent, const ResId& rId ) :
Control( pParent, rId ), m_pFocusCtrl( NULL ) {}
+ virtual ~SvxControlFocusHelper();
+ virtual void dispose() SAL_OVERRIDE;
void SetFocusControl( Control* pCtrl ) { m_pFocusCtrl = pCtrl; }
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 7b8646fee38b..411df36dd123 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -76,7 +76,6 @@ protected:
public:
SentenceEditWindow_Impl(vcl::Window* pParent, WinBits nBits);
- virtual ~SentenceEditWindow_Impl();
void SetModifyHdl(const Link& rLink) SAL_OVERRIDE { m_aModifyLink = rLink;}
@@ -125,33 +124,33 @@ class SpellDialog : public SfxModelessDialog
friend class SentenceEditWindow_Impl;
private:
- FixedText* m_pLanguageFT;
- SvxLanguageBox* m_pLanguageLB;
+ VclPtr<FixedText> m_pLanguageFT;
+ VclPtr<SvxLanguageBox> m_pLanguageLB;
- FixedText* m_pExplainFT;
- FixedHyperlink* m_pExplainLink;
+ VclPtr<FixedText> m_pExplainFT;
+ VclPtr<FixedHyperlink> m_pExplainLink;
- FixedText* m_pNotInDictFT;
- SentenceEditWindow_Impl* m_pSentenceED;
+ VclPtr<FixedText> m_pNotInDictFT;
+ VclPtr<SentenceEditWindow_Impl> m_pSentenceED;
- FixedText* m_pSuggestionFT;
- ListBox* m_pSuggestionLB;
+ VclPtr<FixedText> m_pSuggestionFT;
+ VclPtr<ListBox> m_pSuggestionLB;
- PushButton* m_pIgnorePB;
- PushButton* m_pIgnoreAllPB;
- PushButton* m_pIgnoreRulePB;
- PushButton* m_pAddToDictPB;
- MenuButton* m_pAddToDictMB;
+ VclPtr<PushButton> m_pIgnorePB;
+ VclPtr<PushButton> m_pIgnoreAllPB;
+ VclPtr<PushButton> m_pIgnoreRulePB;
+ VclPtr<PushButton> m_pAddToDictPB;
+ VclPtr<MenuButton> m_pAddToDictMB;
- PushButton* m_pChangePB;
- PushButton* m_pChangeAllPB;
- PushButton* m_pAutoCorrPB;
+ VclPtr<PushButton> m_pChangePB;
+ VclPtr<PushButton> m_pChangeAllPB;
+ VclPtr<PushButton> m_pAutoCorrPB;
- CheckBox* m_pCheckGrammarCB;
+ VclPtr<CheckBox> m_pCheckGrammarCB;
- PushButton* m_pOptionsPB;
- PushButton* m_pUndoPB;
- CloseButton* m_pClosePB;
+ VclPtr<PushButton> m_pOptionsPB;
+ VclPtr<PushButton> m_pUndoPB;
+ VclPtr<CloseButton> m_pClosePB;
OUString m_sResumeST;
OUString m_sIgnoreOnceST;
@@ -220,6 +219,7 @@ public:
vcl::Window * pParent,
SfxBindings* pBindings);
virtual ~SpellDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetLanguage( sal_uInt16 nLang );
virtual bool Close() SAL_OVERRIDE;
diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx
index 132ab541702e..82cfac00ee18 100644
--- a/cui/source/inc/about.hxx
+++ b/cui/source/inc/about.hxx
@@ -34,13 +34,13 @@ private:
BitmapEx aBackgroundBitmap;
BitmapEx aLogoBitmap;
- VclMultiLineEdit* m_pVersion;
- FixedText* m_pDescriptionText;
- FixedText* m_pCopyrightText;
- FixedImage* m_pLogoImage;
- FixedText* m_pLogoReplacement;
- PushButton* m_pCreditsButton;
- PushButton* m_pWebsiteButton;
+ VclPtr<VclMultiLineEdit> m_pVersion;
+ VclPtr<FixedText> m_pDescriptionText;
+ VclPtr<FixedText> m_pCopyrightText;
+ VclPtr<FixedImage> m_pLogoImage;
+ VclPtr<FixedText> m_pLogoReplacement;
+ VclPtr<PushButton> m_pCreditsButton;
+ VclPtr<PushButton> m_pWebsiteButton;
OUString m_aVersionTextStr;
OUString m_aVendorTextStr;
@@ -66,6 +66,8 @@ protected:
public:
AboutDialog(vcl::Window* pParent);
+ virtual ~AboutDialog();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK( HandleClick, PushButton* );
};
diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx
index 88d096f8425f..6c487cabc80f 100644
--- a/cui/source/inc/acccfg.hxx
+++ b/cui/source/inc/acccfg.hxx
@@ -53,7 +53,7 @@ class SfxStringItem;
class SfxAccCfgTabListBox_Impl : public SvTabListBox
{
- SfxAcceleratorConfigPage* m_pAccelConfigPage;
+ VclPtr<SfxAcceleratorConfigPage> m_pAccelConfigPage;
void KeyInput( const KeyEvent &rKEvt ) SAL_OVERRIDE;
@@ -67,6 +67,8 @@ public:
, m_pAccelConfigPage(NULL)
{
}
+ virtual ~SfxAccCfgTabListBox_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void SetAccelConfigPage(SfxAcceleratorConfigPage* pAccelConfigPage)
{
@@ -118,17 +120,17 @@ private:
const SfxStringItem* m_pFontItem;
sfx2::FileDialogHelper* m_pFileDlg;
- SfxAccCfgTabListBox_Impl* m_pEntriesBox;
- RadioButton* m_pOfficeButton;
- RadioButton* m_pModuleButton;
- PushButton* m_pChangeButton;
- PushButton* m_pRemoveButton;
- SfxConfigGroupListBox* m_pGroupLBox;
- SfxConfigFunctionListBox* m_pFunctionBox;
- SvTreeListBox* m_pKeyBox;
- PushButton* m_pLoadButton;
- PushButton* m_pSaveButton;
- PushButton* m_pResetButton;
+ VclPtr<SfxAccCfgTabListBox_Impl> m_pEntriesBox;
+ VclPtr<RadioButton> m_pOfficeButton;
+ VclPtr<RadioButton> m_pModuleButton;
+ VclPtr<PushButton> m_pChangeButton;
+ VclPtr<PushButton> m_pRemoveButton;
+ VclPtr<SfxConfigGroupListBox> m_pGroupLBox;
+ VclPtr<SfxConfigFunctionListBox> m_pFunctionBox;
+ VclPtr<SvTreeListBox> m_pKeyBox;
+ VclPtr<PushButton> m_pLoadButton;
+ VclPtr<PushButton> m_pSaveButton;
+ VclPtr<PushButton> m_pResetButton;
OUString aLoadAccelConfigStr;
OUString aSaveAccelConfigStr;
OUString aFilterAllStr;
@@ -172,6 +174,7 @@ private:
public:
SfxAcceleratorConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet );
virtual ~SfxAcceleratorConfigPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx
index b6d9e46baa9b..b0f5e0aa7b5f 100644
--- a/cui/source/inc/align.hxx
+++ b/cui/source/inc/align.hxx
@@ -58,8 +58,9 @@ class AlignmentTabPage : public SfxTabPage
public:
virtual ~AlignmentTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
static const sal_uInt16* GetRanges() { return s_pRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -78,36 +79,36 @@ private:
DECL_LINK( UpdateEnableHdl, void* );
private:
- ListBox* m_pLbHorAlign;
- FixedText* m_pFtIndent;
- MetricField* m_pEdIndent;
- FixedText* m_pFtVerAlign;
- ListBox* m_pLbVerAlign;
-
- DialControl* m_pCtrlDial;
- FixedText* m_pFtRotate;
- NumericField* m_pNfRotate;
- FixedText* m_pFtRefEdge;
- ValueSet* m_pVsRefEdge;
- TriStateBox* m_pCbStacked;
- TriStateBox* m_pCbAsianMode;
+ VclPtr<ListBox> m_pLbHorAlign;
+ VclPtr<FixedText> m_pFtIndent;
+ VclPtr<MetricField> m_pEdIndent;
+ VclPtr<FixedText> m_pFtVerAlign;
+ VclPtr<ListBox> m_pLbVerAlign;
+
+ VclPtr<DialControl> m_pCtrlDial;
+ VclPtr<FixedText> m_pFtRotate;
+ VclPtr<NumericField> m_pNfRotate;
+ VclPtr<FixedText> m_pFtRefEdge;
+ VclPtr<ValueSet> m_pVsRefEdge;
+ VclPtr<TriStateBox> m_pCbStacked;
+ VclPtr<TriStateBox> m_pCbAsianMode;
OrientationHelper* m_pOrientHlp;
- VclHBox* m_pBoxDirection;
- TriStateBox* m_pBtnWrap;
- TriStateBox* m_pBtnHyphen;
- TriStateBox* m_pBtnShrink;
- FrameDirListBox* m_pLbFrameDir;
+ VclPtr<VclHBox> m_pBoxDirection;
+ VclPtr<TriStateBox> m_pBtnWrap;
+ VclPtr<TriStateBox> m_pBtnHyphen;
+ VclPtr<TriStateBox> m_pBtnShrink;
+ VclPtr<FrameDirListBox> m_pLbFrameDir;
// hidden labels/string
- FixedText* m_pFtBotLock;
- FixedText* m_pFtTopLock;
- FixedText* m_pFtCelLock;
- FixedText* m_pFtABCD;
-
- VclContainer* m_pAlignmentFrame;
- VclContainer* m_pOrientFrame;
- VclContainer* m_pPropertiesFrame;
+ VclPtr<FixedText> m_pFtBotLock;
+ VclPtr<FixedText> m_pFtTopLock;
+ VclPtr<FixedText> m_pFtCelLock;
+ VclPtr<FixedText> m_pFtABCD;
+
+ VclPtr<VclContainer> m_pAlignmentFrame;
+ VclPtr<VclContainer> m_pOrientFrame;
+ VclPtr<VclContainer> m_pPropertiesFrame;
};
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 8d6d1bc16f58..d56700e45e7a 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -43,8 +43,8 @@ namespace editeng { class SortedAutoCompleteStrings; }
class OfaAutoCorrDlg : public SfxTabDialog
{
- VclContainer* m_pLanguageBox;
- SvxLanguageBox* m_pLanguageLB;
+ VclPtr<VclContainer> m_pLanguageBox;
+ VclPtr<SvxLanguageBox> m_pLanguageLB;
sal_uInt16 m_nReplacePageId;
sal_uInt16 m_nExceptionsPageId;
@@ -53,6 +53,8 @@ class OfaAutoCorrDlg : public SfxTabDialog
public:
OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet *pSet);
+ virtual ~OfaAutoCorrDlg();
+ virtual void dispose() SAL_OVERRIDE;
void EnableLanguage(bool bEnable);
};
@@ -94,7 +96,7 @@ class OfaAutocorrOptionsPage : public SfxTabPage
using TabPage::ActivatePage;
private:
- SvxCheckListBox *m_pCheckLB;
+ VclPtr<SvxCheckListBox> m_pCheckLB;
OUString m_sInput;
OUString m_sDoubleCaps;
@@ -107,8 +109,10 @@ private:
public:
OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~OfaAutocorrOptionsPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -123,8 +127,8 @@ class OfaSwAutoFmtOptionsPage : public SfxTabPage
{
using TabPage::ActivatePage;
- OfaACorrCheckListBox* m_pCheckLB;
- PushButton* m_pEditPB;
+ VclPtr<OfaACorrCheckListBox> m_pCheckLB;
+ VclPtr<PushButton> m_pEditPB;
OUString sDeleteEmptyPara;
OUString sUseReplaceTbl;
@@ -163,9 +167,10 @@ class OfaSwAutoFmtOptionsPage : public SfxTabPage
OfaSwAutoFmtOptionsPage( vcl::Window* pParent,
const SfxItemSet& rSet );
virtual ~OfaSwAutoFmtOptionsPage();
+ virtual void dispose() SAL_OVERRIDE;
- public:
- static SfxTabPage* Create( vcl::Window* pParent,
+public:
+ 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;
@@ -224,12 +229,12 @@ private:
StringChangeTable aChangesTable;
- CheckBox* m_pTextOnlyCB;
- AutoCorrEdit* m_pShortED;
- AutoCorrEdit* m_pReplaceED;
- SvTabListBox* m_pReplaceTLB;
- PushButton* m_pNewReplacePB;
- PushButton* m_pDeleteReplacePB;
+ VclPtr<CheckBox> m_pTextOnlyCB;
+ VclPtr<AutoCorrEdit> m_pShortED;
+ VclPtr<AutoCorrEdit> m_pReplaceED;
+ VclPtr<SvTabListBox> m_pReplaceTLB;
+ VclPtr<PushButton> m_pNewReplacePB;
+ VclPtr<PushButton> m_pDeleteReplacePB;
OUString sModify;
OUString sNew;
@@ -257,8 +262,9 @@ private:
public:
OfaAutocorrReplacePage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~OfaAutocorrReplacePage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -289,17 +295,17 @@ class OfaAutocorrExceptPage : public SfxTabPage
using TabPage::DeactivatePage;
private:
- AutoCorrEdit* m_pAbbrevED;
- ListBox* m_pAbbrevLB;
- PushButton* m_pNewAbbrevPB;
- PushButton* m_pDelAbbrevPB;
- CheckBox* m_pAutoAbbrevCB;
-
- AutoCorrEdit* m_pDoubleCapsED;
- ListBox* m_pDoubleCapsLB;
- PushButton* m_pNewDoublePB;
- PushButton* m_pDelDoublePB;
- CheckBox* m_pAutoCapsCB;
+ VclPtr<AutoCorrEdit> m_pAbbrevED;
+ VclPtr<ListBox> m_pAbbrevLB;
+ VclPtr<PushButton> m_pNewAbbrevPB;
+ VclPtr<PushButton> m_pDelAbbrevPB;
+ VclPtr<CheckBox> m_pAutoAbbrevCB;
+
+ VclPtr<AutoCorrEdit> m_pDoubleCapsED;
+ VclPtr<ListBox> m_pDoubleCapsLB;
+ VclPtr<PushButton> m_pNewDoublePB;
+ VclPtr<PushButton> m_pDelDoublePB;
+ VclPtr<CheckBox> m_pAutoCapsCB;
StringsTable aStringsTable;
CollatorWrapper* pCompareClass;
@@ -315,8 +321,9 @@ private:
public:
OfaAutocorrExceptPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~OfaAutocorrExceptPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -335,29 +342,29 @@ class OfaQuoteTabPage : public SfxTabPage
private:
/// For anything but writer
- SvxCheckListBox* m_pCheckLB;
+ VclPtr<SvxCheckListBox> m_pCheckLB;
/// Just for writer
- OfaACorrCheckListBox* m_pSwCheckLB;
+ VclPtr<OfaACorrCheckListBox> m_pSwCheckLB;
OUString sNonBrkSpace;
OUString sOrdinal;
SvLBoxButtonData* pCheckButtonData;
- CheckBox* m_pSingleTypoCB;
- PushButton* m_pSglStartQuotePB;
- FixedText* m_pSglStartExFT;
- PushButton* m_pSglEndQuotePB;
- FixedText* m_pSglEndExFT;
- PushButton* m_pSglStandardPB;
+ VclPtr<CheckBox> m_pSingleTypoCB;
+ VclPtr<PushButton> m_pSglStartQuotePB;
+ VclPtr<FixedText> m_pSglStartExFT;
+ VclPtr<PushButton> m_pSglEndQuotePB;
+ VclPtr<FixedText> m_pSglEndExFT;
+ VclPtr<PushButton> m_pSglStandardPB;
- CheckBox* m_pDoubleTypoCB;
- PushButton* m_pDblStartQuotePB;
- FixedText* m_pDblStartExFT;
- PushButton* m_pDblEndQuotePB;
- FixedText* m_pDblEndExFT;
- PushButton* m_pDblStandardPB;
+ VclPtr<CheckBox> m_pDoubleTypoCB;
+ VclPtr<PushButton> m_pDblStartQuotePB;
+ VclPtr<FixedText> m_pDblStartExFT;
+ VclPtr<PushButton> m_pDblEndQuotePB;
+ VclPtr<FixedText> m_pDblEndExFT;
+ VclPtr<PushButton> m_pDblStandardPB;
OUString m_sStartQuoteDlg;
OUString m_sEndQuoteDlg;
@@ -381,8 +388,9 @@ private:
OfaQuoteTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
public:
virtual ~OfaQuoteTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -397,31 +405,33 @@ class OfaAutoCompleteTabPage : public SfxTabPage
public:
class AutoCompleteMultiListBox : public MultiListBox
{
- OfaAutoCompleteTabPage* m_pPage;
+ VclPtr<OfaAutoCompleteTabPage> m_pPage;
public:
AutoCompleteMultiListBox(vcl::Window *pParent, WinBits nBits)
: MultiListBox(pParent, nBits)
, m_pPage(NULL)
{
}
+ virtual ~AutoCompleteMultiListBox();
+ virtual void dispose() SAL_OVERRIDE;
void SetPage(OfaAutoCompleteTabPage *pPage) { m_pPage = pPage; }
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
private:
using TabPage::ActivatePage;
- CheckBox* m_pCBActiv; ///<Enable word completion
- CheckBox* m_pCBAppendSpace;///<Append space
- CheckBox* m_pCBAsTip; ///<Show as tip
-
- CheckBox* m_pCBCollect;///<Collect words
- CheckBox* m_pCBRemoveList;///<...save the list for later use...
-
- ListBox* m_pDCBExpandKey;
- NumericField* m_pNFMinWordlen;
- NumericField* m_pNFMaxEntries;
- AutoCompleteMultiListBox* m_pLBEntries;
- PushButton* m_pPBEntries;
+ VclPtr<CheckBox> m_pCBActiv; ///<Enable word completion
+ VclPtr<CheckBox> m_pCBAppendSpace;///<Append space
+ VclPtr<CheckBox> m_pCBAsTip; ///<Show as tip
+
+ VclPtr<CheckBox> m_pCBCollect;///<Collect words
+ VclPtr<CheckBox> m_pCBRemoveList;///<...save the list for later use...
+
+ VclPtr<ListBox> m_pDCBExpandKey;
+ VclPtr<NumericField> m_pNFMinWordlen;
+ VclPtr<NumericField> m_pNFMaxEntries;
+ VclPtr<AutoCompleteMultiListBox> m_pLBEntries;
+ VclPtr<PushButton> m_pPBEntries;
editeng::SortedAutoCompleteStrings* m_pAutoCompleteList;
sal_uInt16 m_nAutoCmpltListCnt;
@@ -430,9 +440,9 @@ private:
OfaAutoCompleteTabPage( vcl::Window* pParent,
const SfxItemSet& rSet );
public:
- virtual ~OfaAutoCompleteTabPage();
-
- static SfxTabPage* Create( vcl::Window* pParent,
+ virtual ~OfaAutoCompleteTabPage();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -456,12 +466,9 @@ class OfaSmartTagOptionsTabPage : public SfxTabPage
private:
// controls
- CheckBox* m_pMainCB;
- SvxCheckListBox* m_pSmartTagTypesLB;
- PushButton* m_pPropertiesPB;
-
- /// construction via Create()
- OfaSmartTagOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ VclPtr<CheckBox> m_pMainCB;
+ VclPtr<SvxCheckListBox> m_pSmartTagTypesLB;
+ VclPtr<PushButton> m_pPropertiesPB;
/** Inserts items into m_aSmartTagTypesLB
@@ -496,10 +503,12 @@ private:
DECL_LINK(SelectHdl, void *);
public:
-
+ /// construction via Create()
+ OfaSmartTagOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~OfaSmartTagOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index 0686c81ceb3a..70d01e9b87ff 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -47,7 +47,7 @@ class SvxBackgroundTabPage : public SvxTabPage
using TabPage::DeactivatePage;
static const sal_uInt16 pPageRanges[];
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
// returns the area of the which-values
static const sal_uInt16* GetRanges() { return pPageRanges; }
@@ -71,40 +71,41 @@ protected:
private:
SvxBackgroundTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet );
virtual ~SvxBackgroundTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- VclContainer* m_pAsGrid;
- FixedText* m_pSelectTxt;
- ListBox* m_pLbSelect;
- FixedText* m_pTblDesc;
- ListBox* m_pTblLBox;
- ListBox* m_pParaLBox;
+ VclPtr<VclContainer> m_pAsGrid;
+ VclPtr<FixedText> m_pSelectTxt;
+ VclPtr<ListBox> m_pLbSelect;
+ VclPtr<FixedText> m_pTblDesc;
+ VclPtr<ListBox> m_pTblLBox;
+ VclPtr<ListBox> m_pParaLBox;
- VclFrame* m_pBackGroundColorFrame;
- SvxColorValueSet* m_pBackgroundColorSet;
- BackgroundPreviewImpl* m_pPreviewWin1;
+ VclPtr<VclFrame> m_pBackGroundColorFrame;
+ VclPtr<SvxColorValueSet> m_pBackgroundColorSet;
+ VclPtr<BackgroundPreviewImpl> m_pPreviewWin1;
- FixedText* m_pColTransFT;///<color transparency
- MetricField* m_pColTransMF;
- CheckBox* m_pBtnPreview;
+ VclPtr<FixedText> m_pColTransFT;///<color transparency
+ VclPtr<MetricField> m_pColTransMF;
+ VclPtr<CheckBox> m_pBtnPreview;
// Background Bitmap ----------------------------------
- VclContainer* m_pBitmapContainer;
- VclContainer* m_pFileFrame;
- PushButton* m_pBtnBrowse;
- CheckBox* m_pBtnLink;
- FixedText* m_pFtUnlinked;
- FixedText* m_pFtFile;
-
- VclContainer* m_pTypeFrame;
- RadioButton* m_pBtnPosition;
- RadioButton* m_pBtnArea;
- RadioButton* m_pBtnTile;
- SvxRectCtl* m_pWndPosition;
-
- VclContainer* m_pGraphTransFrame;///<transparency of graphics
- MetricField* m_pGraphTransMF;
-
- BackgroundPreviewImpl* m_pPreviewWin2;
+ VclPtr<VclContainer> m_pBitmapContainer;
+ VclPtr<VclContainer> m_pFileFrame;
+ VclPtr<PushButton> m_pBtnBrowse;
+ VclPtr<CheckBox> m_pBtnLink;
+ VclPtr<FixedText> m_pFtUnlinked;
+ VclPtr<FixedText> m_pFtFile;
+
+ VclPtr<VclContainer> m_pTypeFrame;
+ VclPtr<RadioButton> m_pBtnPosition;
+ VclPtr<RadioButton> m_pBtnArea;
+ VclPtr<RadioButton> m_pBtnTile;
+ VclPtr<SvxRectCtl> m_pWndPosition;
+
+ VclPtr<VclContainer> m_pGraphTransFrame;///<transparency of graphics
+ VclPtr<MetricField> m_pGraphTransMF;
+
+ VclPtr<BackgroundPreviewImpl> m_pPreviewWin2;
// DDListBox for Writer -------------------------------
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 9e2ed6622c9d..8f129977a546 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -45,7 +45,9 @@ class SvxBorderTabPage : public SfxTabPage
static const sal_uInt16 pRanges[];
public:
- static SfxTabPage* Create( vcl::Window* pParent,
+ virtual ~SvxBorderTabPage();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
static const sal_uInt16* GetRanges() { return pRanges; }
@@ -61,40 +63,39 @@ protected:
private:
SvxBorderTabPage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs );
- virtual ~SvxBorderTabPage();
// Controls
- ValueSet* m_pWndPresets;
- FixedText* m_pUserDefFT;
- svx::FrameSelector* m_pFrameSel;
-
- LineListBox* m_pLbLineStyle;
- ColorListBox* m_pLbLineColor;
- MetricField* m_pLineWidthMF;
-
- VclContainer* m_pSpacingFrame;
- FixedText* m_pLeftFT;
- MetricField* m_pLeftMF;
- FixedText* m_pRightFT;
- MetricField* m_pRightMF;
- FixedText* m_pTopFT;
- MetricField* m_pTopMF;
- FixedText* m_pBottomFT;
- MetricField* m_pBottomMF;
- CheckBox* m_pSynchronizeCB;
-
- VclContainer* m_pShadowFrame;
- ValueSet* m_pWndShadows;
- FixedText* m_pFtShadowSize;
- MetricField* m_pEdShadowSize;
- FixedText* m_pFtShadowColor;
- ColorListBox* m_pLbShadowColor;
-
-
- VclContainer* m_pPropertiesFrame;///< properties - "Merge with next paragraph" in Writer
- CheckBox* m_pMergeWithNextCB;
+ VclPtr<ValueSet> m_pWndPresets;
+ VclPtr<FixedText> m_pUserDefFT;
+ VclPtr<svx::FrameSelector> m_pFrameSel;
+
+ VclPtr<LineListBox> m_pLbLineStyle;
+ VclPtr<ColorListBox> m_pLbLineColor;
+ VclPtr<MetricField> m_pLineWidthMF;
+
+ VclPtr<VclContainer> m_pSpacingFrame;
+ VclPtr<FixedText> m_pLeftFT;
+ VclPtr<MetricField> m_pLeftMF;
+ VclPtr<FixedText> m_pRightFT;
+ VclPtr<MetricField> m_pRightMF;
+ VclPtr<FixedText> m_pTopFT;
+ VclPtr<MetricField> m_pTopMF;
+ VclPtr<FixedText> m_pBottomFT;
+ VclPtr<MetricField> m_pBottomMF;
+ VclPtr<CheckBox> m_pSynchronizeCB;
+
+ VclPtr<VclContainer> m_pShadowFrame;
+ VclPtr<ValueSet> m_pWndShadows;
+ VclPtr<FixedText> m_pFtShadowSize;
+ VclPtr<MetricField> m_pEdShadowSize;
+ VclPtr<FixedText> m_pFtShadowColor;
+ VclPtr<ColorListBox> m_pLbShadowColor;
+
+
+ VclPtr<VclContainer> m_pPropertiesFrame;///< properties - "Merge with next paragraph" in Writer
+ VclPtr<CheckBox> m_pMergeWithNextCB;
// #i29550#
- CheckBox* m_pMergeAdjacentBordersCB;
+ VclPtr<CheckBox> m_pMergeAdjacentBordersCB;
ImageList aShadowImgLstH;
ImageList aShadowImgLst;
@@ -114,8 +115,8 @@ private:
std::set<sal_Int16> maUsedBorderStyles;
// Handler
- DECL_LINK( SelStyleHdl_Impl, ListBox* pLb );
- DECL_LINK( SelColHdl_Impl, ListBox* pLb );
+ DECL_LINK( SelStyleHdl_Impl, ListBox* );
+ DECL_LINK( SelColHdl_Impl, ListBox* );
DECL_LINK( SelPreHdl_Impl, void* );
DECL_LINK( SelSdwHdl_Impl, void* );
DECL_LINK( LinesChanged_Impl, void* );
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 58505ff614e2..759b1406d3e6 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -315,7 +315,7 @@ public:
class SvxMenuEntriesListBox : public SvTreeListBox
{
private:
- SvxConfigPage* pPage;
+ VclPtr<SvxConfigPage> pPage;
protected:
bool m_bIsInternalDrag;
@@ -323,6 +323,7 @@ protected:
public:
SvxMenuEntriesListBox(vcl::Window*, SvxConfigPage*);
virtual ~SvxMenuEntriesListBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
@@ -359,30 +360,30 @@ protected:
// the top section of the tab page where top level menus and toolbars
// are displayed in a listbox
- VclFrame* m_pTopLevel;
- FixedText* m_pTopLevelLabel;
- ListBox* m_pTopLevelListBox;
- PushButton* m_pNewTopLevelButton;
- MenuButton* m_pModifyTopLevelButton;
+ VclPtr<VclFrame> m_pTopLevel;
+ VclPtr<FixedText> m_pTopLevelLabel;
+ VclPtr<ListBox> m_pTopLevelListBox;
+ VclPtr<PushButton> m_pNewTopLevelButton;
+ VclPtr<MenuButton> m_pModifyTopLevelButton;
// the contents section where the contents of the selected
// menu or toolbar are displayed
- VclFrame* m_pContents;
- FixedText* m_pContentsLabel;
- VclContainer* m_pEntries;
- SvTreeListBox* m_pContentsListBox;
+ VclPtr<VclFrame> m_pContents;
+ VclPtr<FixedText> m_pContentsLabel;
+ VclPtr<VclContainer> m_pEntries;
+ VclPtr<SvTreeListBox> m_pContentsListBox;
- PushButton* m_pAddCommandsButton;
- MenuButton* m_pModifyCommandButton;
+ VclPtr<PushButton> m_pAddCommandsButton;
+ VclPtr<MenuButton> m_pModifyCommandButton;
- PushButton* m_pMoveUpButton;
- PushButton* m_pMoveDownButton;
+ VclPtr<PushButton> m_pMoveUpButton;
+ VclPtr<PushButton> m_pMoveDownButton;
- ListBox* m_pSaveInListBox;
+ VclPtr<ListBox> m_pSaveInListBox;
- VclMultiLineEdit* m_pDescriptionField;
+ VclPtr<VclMultiLineEdit> m_pDescriptionField;
- SvxScriptSelectorDialog* m_pSelectorDlg;
+ VclPtr<SvxScriptSelectorDialog> m_pSelectorDlg;
/// the ResourceURL to select when opening the dialog
OUString m_aURLToSelect;
@@ -410,7 +411,7 @@ protected:
SvTreeListEntry* pTarget = NULL,
bool bFront = false );
- void AddSubMenusToUI( const OUString& rBaseTitle,
+ void AddSubMenusToUI( const OUString& rBaseTitle,
SvxConfigEntry* pParentData );
SvTreeListEntry* InsertEntryIntoUI ( SvxConfigEntry* pNewEntryData,
@@ -423,6 +424,9 @@ protected:
public:
+ virtual ~SvxConfigPage();
+ virtual void dispose() SAL_OVERRIDE;
+
static bool CanConfig( const OUString& rModuleId );
SaveInData* GetSaveInData() { return pCurrentSaveInData; }
@@ -483,6 +487,7 @@ private:
public:
SvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet );
virtual ~SvxMenuConfigPage();
+ virtual void dispose() SAL_OVERRIDE;
SaveInData* CreateSaveInData(
const ::com::sun::star::uno::Reference <
@@ -495,11 +500,11 @@ public:
class SvxMainMenuOrganizerDialog : public ModalDialog
{
- VclContainer* m_pMenuBox;
- Edit* m_pMenuNameEdit;
- SvTreeListBox* m_pMenuListBox;
- PushButton* m_pMoveUpButton;
- PushButton* m_pMoveDownButton;
+ VclPtr<VclContainer> m_pMenuBox;
+ VclPtr<Edit> m_pMenuNameEdit;
+ VclPtr<SvTreeListBox> m_pMenuListBox;
+ VclPtr<PushButton> m_pMoveUpButton;
+ VclPtr<PushButton> m_pMoveDownButton;
SvxEntries* mpEntries;
SvTreeListEntry* pNewMenuEntry;
@@ -515,8 +520,8 @@ public:
SvxMainMenuOrganizerDialog (
vcl::Window*, SvxEntries*,
SvxConfigEntry*, bool bCreateMenu = false );
-
- virtual ~SvxMainMenuOrganizerDialog ();
+ virtual ~SvxMainMenuOrganizerDialog();
+ virtual void dispose() SAL_OVERRIDE;
SvxEntries* GetEntries() { return mpEntries;}
void SetEntries( SvxEntries* );
@@ -528,7 +533,7 @@ class SvxToolbarEntriesListBox : public SvxMenuEntriesListBox
Size m_aCheckBoxImageSizePixel;
Link m_aChangedListener;
SvLBoxButtonData* m_pButtonData;
- SvxConfigPage* pPage;
+ VclPtr<SvxConfigPage> pPage;
void ChangeVisibility( SvTreeListEntry* pEntry );
@@ -544,6 +549,7 @@ public:
SvxToolbarEntriesListBox(vcl::Window* pParent, SvxToolbarConfigPage* pPg);
virtual ~SvxToolbarEntriesListBox();
+ virtual void dispose() SAL_OVERRIDE;
void SetChangedListener( const Link& aChangedListener )
{ m_aChangedListener = aChangedListener; }
@@ -584,6 +590,7 @@ private:
public:
SvxToolbarConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet );
virtual ~SvxToolbarConfigPage();
+ virtual void dispose() SAL_OVERRIDE;
SvTreeListEntry* AddFunction( SvTreeListEntry* pTarget = NULL,
bool bFront = false,
@@ -662,8 +669,8 @@ public:
class SvxNewToolbarDialog : public ModalDialog
{
private:
- Edit* m_pEdtName;
- OKButton* m_pBtnOK;
+ VclPtr<Edit> m_pEdtName;
+ VclPtr<OKButton> m_pBtnOK;
Link aCheckNameHdl;
@@ -671,8 +678,10 @@ private:
public:
SvxNewToolbarDialog(vcl::Window* pWindow, const OUString& rName);
+ virtual ~SvxNewToolbarDialog();
+ virtual void dispose() SAL_OVERRIDE;
- ListBox* m_pSaveInListBox;
+ VclPtr<ListBox> m_pSaveInListBox;
OUString GetName()
{
@@ -702,10 +711,10 @@ struct SvxIconSelectorToolBoxItem
class SvxIconSelectorDialog : public ModalDialog
{
private:
- ToolBox* pTbSymbol;
- FixedText* pFtNote;
- PushButton* pBtnImport;
- PushButton* pBtnDelete;
+ VclPtr<ToolBox> pTbSymbol;
+ VclPtr<FixedText> pFtNote;
+ VclPtr<PushButton> pBtnImport;
+ VclPtr<PushButton> pBtnDelete;
Size aTbSize;
sal_uInt16 m_nNextId;
@@ -741,6 +750,7 @@ public:
);
virtual ~SvxIconSelectorDialog();
+ virtual void dispose() SAL_OVERRIDE;
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
GetSelectedIcon();
@@ -769,10 +779,12 @@ public:
class SvxIconChangeDialog : public ModalDialog
{
private:
- FixedImage* pFImageInfo;
- VclMultiLineEdit* pLineEditDescription;
+ VclPtr<FixedImage> pFImageInfo;
+ VclPtr<VclMultiLineEdit> pLineEditDescription;
public:
SvxIconChangeDialog(vcl::Window *pWindow, const OUString& aMessage);
+ virtual ~SvxIconChangeDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif // INCLUDED_CUI_SOURCE_INC_CFG_HXX
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 3e445ce0e853..984e8e9e4c80 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -113,6 +113,7 @@ class SfxConfigFunctionListBox : public SvTreeListBox
public:
SfxConfigFunctionListBox(vcl::Window*, WinBits nStyle);
virtual ~SfxConfigFunctionListBox();
+ virtual void dispose() SAL_OVERRIDE;
void ClearAll();
using Window::GetHelpText;
@@ -127,7 +128,7 @@ struct SvxConfigGroupBoxResource_Impl;
class SfxConfigGroupListBox : public SvTreeListBox
{
SvxConfigGroupBoxResource_Impl* pImp;
- SfxConfigFunctionListBox* pFunctionListBox;
+ VclPtr<SfxConfigFunctionListBox> pFunctionListBox;
SfxGroupInfoArr_Impl aArr;
OUString m_sModuleLongName;
@@ -162,6 +163,7 @@ protected:
public:
SfxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle);
virtual ~SfxConfigGroupListBox();
+ virtual void dispose() SAL_OVERRIDE;
void ClearAll();
void Init(const css::uno::Reference< css::uno::XComponentContext >& xContext,
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 9a471ff3e048..fad03f168fe4 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -47,14 +47,12 @@ class FontList;
class SvxCharBasePage : public SfxTabPage
{
protected:
- SvxFontPrevWindow* m_pPreviewWin;
+ VclPtr<SvxFontPrevWindow> m_pPreviewWin;
bool m_bPreviewBackgroundToCharacter;
SvxCharBasePage(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet& rItemset);
- virtual ~SvxCharBasePage();
-
void SetPrevFontWidthScale( const SfxItemSet& rSet );
void SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
@@ -63,6 +61,9 @@ protected:
inline SvxFont& GetPreviewCTLFont();
public:
+ virtual ~SvxCharBasePage();
+ virtual void dispose() SAL_OVERRIDE;
+
using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
@@ -79,38 +80,38 @@ class SvxCharNamePage : public SvxCharBasePage
private:
static const sal_uInt16 pNameRanges[];
- VclContainer* m_pWestFrame;
- FixedText* m_pWestFontNameFT;
- FontNameBox* m_pWestFontNameLB;
- FixedText* m_pWestFontStyleFT;
- FontStyleBox* m_pWestFontStyleLB;
- FixedText* m_pWestFontSizeFT;
- FontSizeBox* m_pWestFontSizeLB;
- FixedText* m_pWestFontLanguageFT;
- SvxLanguageComboBox* m_pWestFontLanguageLB;
- FixedText* m_pWestFontTypeFT;
-
- VclContainer* m_pEastFrame;
- FixedText* m_pEastFontNameFT;
- FontNameBox* m_pEastFontNameLB;
- FixedText* m_pEastFontStyleFT;
- FontStyleBox* m_pEastFontStyleLB;
- FixedText* m_pEastFontSizeFT;
- FontSizeBox* m_pEastFontSizeLB;
- FixedText* m_pEastFontLanguageFT;
- SvxLanguageBox* m_pEastFontLanguageLB;
- FixedText* m_pEastFontTypeFT;
-
- VclContainer* m_pCTLFrame;
- FixedText* m_pCTLFontNameFT;
- FontNameBox* m_pCTLFontNameLB;
- FixedText* m_pCTLFontStyleFT;
- FontStyleBox* m_pCTLFontStyleLB;
- FixedText* m_pCTLFontSizeFT;
- FontSizeBox* m_pCTLFontSizeLB;
- FixedText* m_pCTLFontLanguageFT;
- SvxLanguageBox* m_pCTLFontLanguageLB;
- FixedText* m_pCTLFontTypeFT;
+ VclPtr<VclContainer> m_pWestFrame;
+ VclPtr<FixedText> m_pWestFontNameFT;
+ VclPtr<FontNameBox> m_pWestFontNameLB;
+ VclPtr<FixedText> m_pWestFontStyleFT;
+ VclPtr<FontStyleBox> m_pWestFontStyleLB;
+ VclPtr<FixedText> m_pWestFontSizeFT;
+ VclPtr<FontSizeBox> m_pWestFontSizeLB;
+ VclPtr<FixedText> m_pWestFontLanguageFT;
+ VclPtr<SvxLanguageComboBox> m_pWestFontLanguageLB;
+ VclPtr<FixedText> m_pWestFontTypeFT;
+
+ VclPtr<VclContainer> m_pEastFrame;
+ VclPtr<FixedText> m_pEastFontNameFT;
+ VclPtr<FontNameBox> m_pEastFontNameLB;
+ VclPtr<FixedText> m_pEastFontStyleFT;
+ VclPtr<FontStyleBox> m_pEastFontStyleLB;
+ VclPtr<FixedText> m_pEastFontSizeFT;
+ VclPtr<FontSizeBox> m_pEastFontSizeLB;
+ VclPtr<FixedText> m_pEastFontLanguageFT;
+ VclPtr<SvxLanguageBox> m_pEastFontLanguageLB;
+ VclPtr<FixedText> m_pEastFontTypeFT;
+
+ VclPtr<VclContainer> m_pCTLFrame;
+ VclPtr<FixedText> m_pCTLFontNameFT;
+ VclPtr<FontNameBox> m_pCTLFontNameLB;
+ VclPtr<FixedText> m_pCTLFontStyleFT;
+ VclPtr<FontStyleBox> m_pCTLFontStyleLB;
+ VclPtr<FixedText> m_pCTLFontSizeFT;
+ VclPtr<FontSizeBox> m_pCTLFontSizeLB;
+ VclPtr<FixedText> m_pCTLFontLanguageFT;
+ VclPtr<SvxLanguageBox> m_pCTLFontLanguageLB;
+ VclPtr<FixedText> m_pCTLFontTypeFT;
SvxCharNamePage_Impl* m_pImpl;
@@ -152,8 +153,9 @@ public:
public:
virtual ~SvxCharNamePage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return pNameRanges; }
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -176,44 +178,43 @@ class SvxCharEffectsPage : public SvxCharBasePage
private:
static const sal_uInt16 pEffectsRanges[];
- FixedText* m_pFontColorFT;
- ColorListBox* m_pFontColorLB;
+ VclPtr<FixedText> m_pFontColorFT;
+ VclPtr<ColorListBox> m_pFontColorLB;
- FixedText* m_pEffectsFT;
- ListBox* m_pEffectsLB;
+ VclPtr<FixedText> m_pEffectsFT;
+ VclPtr<ListBox> m_pEffectsLB;
- FixedText* m_pReliefFT;
- ListBox* m_pReliefLB;
+ VclPtr<FixedText> m_pReliefFT;
+ VclPtr<ListBox> m_pReliefLB;
- TriStateBox* m_pOutlineBtn;
- TriStateBox* m_pShadowBtn;
- TriStateBox* m_pBlinkingBtn;
- TriStateBox* m_pHiddenBtn;
+ VclPtr<TriStateBox> m_pOutlineBtn;
+ VclPtr<TriStateBox> m_pShadowBtn;
+ VclPtr<TriStateBox> m_pBlinkingBtn;
+ VclPtr<TriStateBox> m_pHiddenBtn;
- ListBox* m_pOverlineLB;
- FixedText* m_pOverlineColorFT;
- ColorListBox* m_pOverlineColorLB;
+ VclPtr<ListBox> m_pOverlineLB;
+ VclPtr<FixedText> m_pOverlineColorFT;
+ VclPtr<ColorListBox> m_pOverlineColorLB;
- ListBox* m_pStrikeoutLB;
+ VclPtr<ListBox> m_pStrikeoutLB;
- ListBox* m_pUnderlineLB;
- FixedText* m_pUnderlineColorFT;
- ColorListBox* m_pUnderlineColorLB;
+ VclPtr<ListBox> m_pUnderlineLB;
+ VclPtr<FixedText> m_pUnderlineColorFT;
+ VclPtr<ColorListBox> m_pUnderlineColorLB;
- CheckBox* m_pIndividualWordsBtn;
+ VclPtr<CheckBox> m_pIndividualWordsBtn;
- FixedText* m_pEmphasisFT;
- ListBox* m_pEmphasisLB;
+ VclPtr<FixedText> m_pEmphasisFT;
+ VclPtr<ListBox> m_pEmphasisLB;
- FixedText* m_pPositionFT;
- ListBox* m_pPositionLB;
+ VclPtr<FixedText> m_pPositionFT;
+ VclPtr<ListBox> m_pPositionLB;
sal_uInt16 m_nHtmlMode;
OUString m_aTransparentColorName;
SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~SvxCharEffectsPage();
void Initialize();
void UpdatePreview_Impl();
@@ -228,12 +229,14 @@ private:
DECL_LINK( ColorBoxSelectHdl_Impl, ColorListBox* );
public:
- using SfxTabPage::DeactivatePage;
+ virtual ~SvxCharEffectsPage();
+ virtual void dispose() SAL_OVERRIDE;
+ using SfxTabPage::DeactivatePage;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return pEffectsRanges; }
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -254,30 +257,30 @@ class SvxCharPositionPage : public SvxCharBasePage
static const sal_uInt16 pPositionRanges[];
private:
- RadioButton* m_pHighPosBtn;
- RadioButton* m_pNormalPosBtn;
- RadioButton* m_pLowPosBtn;
- FixedText* m_pHighLowFT;
- MetricField* m_pHighLowMF;
- CheckBox* m_pHighLowRB;
- FixedText* m_pFontSizeFT;
- MetricField* m_pFontSizeMF;
-
- VclContainer* m_pRotationContainer;
-
- FixedText* m_pScalingFT;
- FixedText* m_pScalingAndRotationFT;
- RadioButton* m_p0degRB;
- RadioButton* m_p90degRB;
- RadioButton* m_p270degRB;
- CheckBox* m_pFitToLineCB;
-
- MetricField* m_pScaleWidthMF;
-
- ListBox* m_pKerningLB;
- FixedText* m_pKerningFT;
- MetricField* m_pKerningMF;
- CheckBox* m_pPairKerningBtn;
+ VclPtr<RadioButton> m_pHighPosBtn;
+ VclPtr<RadioButton> m_pNormalPosBtn;
+ VclPtr<RadioButton> m_pLowPosBtn;
+ VclPtr<FixedText> m_pHighLowFT;
+ VclPtr<MetricField> m_pHighLowMF;
+ VclPtr<CheckBox> m_pHighLowRB;
+ VclPtr<FixedText> m_pFontSizeFT;
+ VclPtr<MetricField> m_pFontSizeMF;
+
+ VclPtr<VclContainer> m_pRotationContainer;
+
+ VclPtr<FixedText> m_pScalingFT;
+ VclPtr<FixedText> m_pScalingAndRotationFT;
+ VclPtr<RadioButton> m_p0degRB;
+ VclPtr<RadioButton> m_p90degRB;
+ VclPtr<RadioButton> m_p270degRB;
+ VclPtr<CheckBox> m_pFitToLineCB;
+
+ VclPtr<MetricField> m_pScaleWidthMF;
+
+ VclPtr<ListBox> m_pKerningLB;
+ VclPtr<FixedText> m_pKerningFT;
+ VclPtr<MetricField> m_pKerningMF;
+ VclPtr<CheckBox> m_pPairKerningBtn;
short m_nSuperEsc;
short m_nSubEsc;
@@ -289,7 +292,6 @@ private:
sal_uInt8 m_nSubProp;
SvxCharPositionPage( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~SvxCharPositionPage();
void Initialize();
void UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
@@ -307,6 +309,9 @@ private:
DECL_LINK(ScaleWidthModifyHdl_Impl, void *);
public:
+ virtual ~SvxCharPositionPage();
+ virtual void dispose() SAL_OVERRIDE;
+
using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
@@ -314,7 +319,7 @@ public:
virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return pPositionRanges; }
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -331,16 +336,15 @@ class SvxCharTwoLinesPage : public SvxCharBasePage
{
private:
static const sal_uInt16 pTwoLinesRanges[];
- CheckBox* m_pTwoLinesBtn;
- VclContainer* m_pEnclosingFrame;
- ListBox* m_pStartBracketLB;
- ListBox* m_pEndBracketLB;
+ VclPtr<CheckBox> m_pTwoLinesBtn;
+ VclPtr<VclContainer> m_pEnclosingFrame;
+ VclPtr<ListBox> m_pStartBracketLB;
+ VclPtr<ListBox> m_pEndBracketLB;
sal_uInt16 m_nStartBracketPosition;
sal_uInt16 m_nEndBracketPosition;
SvxCharTwoLinesPage(vcl::Window* pParent, const SfxItemSet& rSet);
- virtual ~SvxCharTwoLinesPage();
void UpdatePreview_Impl();
void Initialize();
@@ -351,14 +355,16 @@ private:
DECL_LINK( CharacterMapHdl_Impl, ListBox* );
public:
+ virtual ~SvxCharTwoLinesPage();
+ virtual void dispose() SAL_OVERRIDE;
+
using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
-public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return pTwoLinesRanges; }
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/inc/connect.hxx b/cui/source/inc/connect.hxx
index a85dabdb8a5f..875ff89baf9b 100644
--- a/cui/source/inc/connect.hxx
+++ b/cui/source/inc/connect.hxx
@@ -34,21 +34,21 @@ class SvxConnectionPage : public SfxTabPage
{
private:
static const sal_uInt16 pRanges[];
- ListBox* m_pLbType;
+ VclPtr<ListBox> m_pLbType;
- FixedText* m_pFtLine1;
- MetricField* m_pMtrFldLine1;
- FixedText* m_pFtLine2;
- MetricField* m_pMtrFldLine2;
- FixedText* m_pFtLine3;
- MetricField* m_pMtrFldLine3;
+ VclPtr<FixedText> m_pFtLine1;
+ VclPtr<MetricField> m_pMtrFldLine1;
+ VclPtr<FixedText> m_pFtLine2;
+ VclPtr<MetricField> m_pMtrFldLine2;
+ VclPtr<FixedText> m_pFtLine3;
+ VclPtr<MetricField> m_pMtrFldLine3;
- MetricField* m_pMtrFldHorz1;
- MetricField* m_pMtrFldVert1;
- MetricField* m_pMtrFldHorz2;
- MetricField* m_pMtrFldVert2;
+ VclPtr<MetricField> m_pMtrFldHorz1;
+ VclPtr<MetricField> m_pMtrFldVert1;
+ VclPtr<MetricField> m_pMtrFldHorz2;
+ VclPtr<MetricField> m_pMtrFldVert2;
- SvxXConnectionPreview* m_pCtlPreview;
+ VclPtr<SvxXConnectionPreview> m_pCtlPreview;
const SfxItemSet& rOutAttrs;
SfxItemSet aAttrSet;
@@ -63,8 +63,9 @@ public:
SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
virtual ~SvxConnectionPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
@@ -82,7 +83,6 @@ class SvxConnectionDialog : public SfxSingleTabDialog
public:
SvxConnectionDialog( vcl::Window* pParent, const SfxItemSet& rAttr,
const SdrView* pView );
- virtual ~SvxConnectionDialog();
};
#endif // INCLUDED_CUI_SOURCE_INC_CONNECT_HXX
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
index a2e30e516502..596d3231443e 100644
--- a/cui/source/inc/cuicharmap.hxx
+++ b/cui/source/inc/cuicharmap.hxx
@@ -41,7 +41,6 @@ class SvxShowText : public Control
public:
SvxShowText( vcl::Window* pParent,
bool bCenter = false );
- virtual ~SvxShowText();
void SetFont( const vcl::Font& rFont );
void SetText( const OUString& rText ) SAL_OVERRIDE;
@@ -68,16 +67,16 @@ private:
void init();
- SvxShowCharSet* m_pShowSet;
- Edit* m_pShowText;
- PushButton* m_pOKBtn;
- FixedText* m_pFontText;
- ListBox* m_pFontLB;
- FixedText* m_pSubsetText;
- ListBox* m_pSubsetLB;
- FixedText* m_pSymbolText;
- SvxShowText* m_pShowChar;
- FixedText* m_pCharCodeText;
+ VclPtr<SvxShowCharSet> m_pShowSet;
+ VclPtr<Edit> m_pShowText;
+ VclPtr<PushButton> m_pOKBtn;
+ VclPtr<FixedText> m_pFontText;
+ VclPtr<ListBox> m_pFontLB;
+ VclPtr<FixedText> m_pSubsetText;
+ VclPtr<ListBox> m_pSubsetLB;
+ VclPtr<FixedText> m_pSymbolText;
+ VclPtr<SvxShowText> m_pShowChar;
+ VclPtr<FixedText> m_pCharCodeText;
vcl::Font aFont;
bool bOne;
const SubsetMap* pSubsetMap;
@@ -94,7 +93,8 @@ private:
public:
SvxCharacterMap( vcl::Window* pParent, bool bOne=true, const SfxItemSet* pSet=0 );
- virtual ~SvxCharacterMap();
+ virtual ~SvxCharacterMap();
+ virtual void dispose() SAL_OVERRIDE;
void DisableFontSelection();
diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx
index d163b3d44b6f..d56c9d5ee2a4 100644
--- a/cui/source/inc/cuifmsearch.hxx
+++ b/cui/source/inc/cuifmsearch.hxx
@@ -47,36 +47,36 @@ class FmSearchDialog : public ModalDialog
friend class FmSearchEngine;
// my all Controls
- RadioButton *m_prbSearchForText;
- RadioButton *m_prbSearchForNull;
- RadioButton *m_prbSearchForNotNull;
- ComboBox *m_pcmbSearchText;
- FixedText *m_pftForm;
- ListBox *m_plbForm;
- RadioButton *m_prbAllFields;
- RadioButton *m_prbSingleField;
- ListBox *m_plbField;
- FixedText *m_pftPosition;
- ListBox *m_plbPosition;
- CheckBox *m_pcbUseFormat;
- CheckBox *m_pcbCase;
- CheckBox *m_pcbBackwards;
- CheckBox *m_pcbStartOver;
- CheckBox *m_pcbWildCard;
- CheckBox *m_pcbRegular;
- CheckBox *m_pcbApprox;
- PushButton *m_ppbApproxSettings;
- CheckBox *m_pHalfFullFormsCJK;
- CheckBox *m_pSoundsLikeCJK;
- PushButton *m_pSoundsLikeCJKSettings;
- FixedText *m_pftRecord;
- FixedText *m_pftHint;
- PushButton *m_pbSearchAgain;
- CancelButton *m_pbClose;
+ VclPtr<RadioButton> m_prbSearchForText;
+ VclPtr<RadioButton> m_prbSearchForNull;
+ VclPtr<RadioButton> m_prbSearchForNotNull;
+ VclPtr<ComboBox> m_pcmbSearchText;
+ VclPtr<FixedText> m_pftForm;
+ VclPtr<ListBox> m_plbForm;
+ VclPtr<RadioButton> m_prbAllFields;
+ VclPtr<RadioButton> m_prbSingleField;
+ VclPtr<ListBox> m_plbField;
+ VclPtr<FixedText> m_pftPosition;
+ VclPtr<ListBox> m_plbPosition;
+ VclPtr<CheckBox> m_pcbUseFormat;
+ VclPtr<CheckBox> m_pcbCase;
+ VclPtr<CheckBox> m_pcbBackwards;
+ VclPtr<CheckBox> m_pcbStartOver;
+ VclPtr<CheckBox> m_pcbWildCard;
+ VclPtr<CheckBox> m_pcbRegular;
+ VclPtr<CheckBox> m_pcbApprox;
+ VclPtr<PushButton> m_ppbApproxSettings;
+ VclPtr<CheckBox> m_pHalfFullFormsCJK;
+ VclPtr<CheckBox> m_pSoundsLikeCJK;
+ VclPtr<PushButton> m_pSoundsLikeCJKSettings;
+ VclPtr<FixedText> m_pftRecord;
+ VclPtr<FixedText> m_pftHint;
+ VclPtr<PushButton> m_pbSearchAgain;
+ VclPtr<CancelButton> m_pbClose;
OUString m_sSearch;
OUString m_sCancel;
- vcl::Window* m_pPreSearchFocus;
+ VclPtr<vcl::Window> m_pPreSearchFocus;
Link m_lnkFoundHandler; ///< Handler for "found"
Link m_lnkCanceledNotFoundHdl; ///< Handler for Positioning the Cursors
@@ -111,6 +111,7 @@ public:
const Link& lnkContextSupplier);
virtual ~FmSearchDialog();
+ virtual void dispose() SAL_OVERRIDE;
/** The found-handler gets in the 'found'-case a pointer on a FmFoundRecordInformation-structure
(which is only valid in the handler; so if one needs to memorize the data, don't copy the pointer but
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index a57904afd53a..a1855b1a1fdd 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -60,8 +60,8 @@ class SearchThread: public salhelper::Thread
{
private:
- SearchProgress* mpProgress;
- TPGalleryThemeProperties* mpBrowser;
+ VclPtr<SearchProgress> mpProgress;
+ VclPtr<TPGalleryThemeProperties> mpBrowser;
INetURLObject maStartURL;
void ImplSearch( const INetURLObject& rStartURL,
@@ -81,10 +81,10 @@ public:
class SearchProgress : public ModalDialog
{
private:
- FixedText* m_pFtSearchDir;
- FixedText* m_pFtSearchType;
- CancelButton* m_pBtnCancel;
- vcl::Window * parent_;
+ VclPtr<FixedText> m_pFtSearchDir;
+ VclPtr<FixedText> m_pFtSearchType;
+ VclPtr<CancelButton> m_pBtnCancel;
+ VclPtr<vcl::Window> parent_;
INetURLObject startUrl_;
rtl::Reference< SearchThread > maSearchThread;
@@ -93,7 +93,8 @@ private:
public:
SearchProgress( vcl::Window* pParent, const INetURLObject& rStartURL );
- virtual ~SearchProgress() {};
+ virtual ~SearchProgress();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK( CleanUpHdl, void* );
@@ -107,8 +108,8 @@ class TakeThread: public salhelper::Thread
{
private:
- TakeProgress* mpProgress;
- TPGalleryThemeProperties* mpBrowser;
+ VclPtr<TakeProgress> mpProgress;
+ VclPtr<TPGalleryThemeProperties> mpBrowser;
TokenList_impl& mrTakenList;
virtual ~TakeThread();
@@ -126,9 +127,9 @@ public:
class TakeProgress : public ModalDialog
{
private:
- FixedText* m_pFtTakeFile;
- CancelButton* m_pBtnCancel;
- vcl::Window * window_;
+ VclPtr<FixedText> m_pFtTakeFile;
+ VclPtr<CancelButton> m_pBtnCancel;
+ VclPtr<vcl::Window> window_;
rtl::Reference< TakeThread > maTakeThread;
TokenList_impl maTakenList;
@@ -138,6 +139,8 @@ private:
public:
TakeProgress( vcl::Window* pWindow );
+ virtual ~TakeProgress();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK( CleanUpHdl, void* );
@@ -149,8 +152,8 @@ public:
class ActualizeProgress : public ModalDialog
{
private:
- FixedText* m_pFtActualizeFile;
- CancelButton* m_pBtnCancel;
+ VclPtr<FixedText> m_pFtActualizeFile;
+ VclPtr<CancelButton> m_pBtnCancel;
Idle* pIdle;
GalleryTheme* pTheme;
GalleryProgress aStatusProgress;
@@ -161,7 +164,8 @@ private:
public:
ActualizeProgress( vcl::Window* pWindow, GalleryTheme* pThm );
- virtual ~ActualizeProgress() {};
+ virtual ~ActualizeProgress();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
};
@@ -169,23 +173,27 @@ public:
class TitleDialog : public ModalDialog
{
private:
- Edit* m_pEdit;
+ VclPtr<Edit> m_pEdit;
public:
TitleDialog(vcl::Window* pParent, const OUString& rOldText);
+ virtual ~TitleDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetTitle() const { return m_pEdit->GetText(); }
};
class GalleryIdDialog : public ModalDialog
{
private:
- OKButton* m_pBtnOk;
- ListBox* m_pLbResName;
+ VclPtr<OKButton> m_pBtnOk;
+ VclPtr<ListBox> m_pLbResName;
GalleryTheme* pThm;
DECL_LINK( ClickOkHdl, void* );
DECL_LINK( ClickResNameHdl, void* );
public:
GalleryIdDialog( vcl::Window* pParent, GalleryTheme* pThm );
+ virtual ~GalleryIdDialog();
+ virtual void dispose() SAL_OVERRIDE;
sal_uLong GetId() const { return m_pLbResName->GetSelectEntryPos(); }
};
@@ -206,12 +214,12 @@ class TPGalleryThemeGeneral : public SfxTabPage
{
private:
- FixedImage* m_pFiMSImage;
- Edit* m_pEdtMSName;
- FixedText* m_pFtMSShowType;
- FixedText* m_pFtMSShowPath;
- FixedText* m_pFtMSShowContent;
- FixedText* m_pFtMSShowChangeDate;
+ VclPtr<FixedImage> m_pFiMSImage;
+ VclPtr<Edit> m_pEdtMSName;
+ VclPtr<FixedText> m_pFtMSShowType;
+ VclPtr<FixedText> m_pFtMSShowPath;
+ VclPtr<FixedText> m_pFtMSShowContent;
+ VclPtr<FixedText> m_pFtMSShowChangeDate;
ExchangeData* pData;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE {}
@@ -221,12 +229,13 @@ private:
public:
TPGalleryThemeGeneral( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~TPGalleryThemeGeneral() {}
+ virtual ~TPGalleryThemeGeneral();
+ virtual void dispose() SAL_OVERRIDE;
void SetXChgData( ExchangeData* pData );
const ExchangeData* GetXChgData() const { return pData; }
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
};
typedef ::std::vector< FilterEntry* > FilterEntryList_impl;
@@ -237,13 +246,13 @@ class TPGalleryThemeProperties : public SfxTabPage
friend class TakeProgress;
friend class TakeThread;
- ComboBox* m_pCbbFileType;
- ListBox* m_pLbxFound;
- PushButton* m_pBtnSearch;
- PushButton* m_pBtnTake;
- PushButton* m_pBtnTakeAll;
- CheckBox* m_pCbxPreview;
- GalleryPreview* m_pWndPreview;
+ VclPtr<ComboBox> m_pCbbFileType;
+ VclPtr<ListBox> m_pLbxFound;
+ VclPtr<PushButton> m_pBtnSearch;
+ VclPtr<PushButton> m_pBtnTake;
+ VclPtr<PushButton> m_pBtnTakeAll;
+ VclPtr<CheckBox> m_pCbxPreview;
+ VclPtr<GalleryPreview> m_pWndPreview;
ExchangeData* pData;
StringList aFoundList;
@@ -287,13 +296,14 @@ class TPGalleryThemeProperties : public SfxTabPage
public:
TPGalleryThemeProperties( vcl::Window* pWindow, const SfxItemSet& rSet );
virtual ~TPGalleryThemeProperties();
+ virtual void dispose() SAL_OVERRIDE;
void SetXChgData( ExchangeData* pData );
const ExchangeData* GetXChgData() const { return pData; }
void StartSearchFiles( const OUString& _rFolderURL, short _nDlgResult );
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
};
#endif // INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx
index 1fb139375fd7..f43685d65fd2 100644
--- a/cui/source/inc/cuigrfflt.hxx
+++ b/cui/source/inc/cuigrfflt.hxx
@@ -77,7 +77,7 @@ private:
DECL_LINK( ImplModifyHdl, void* p );
protected:
- GraphicPreviewWindow* mpPreview;
+ VclPtr<GraphicPreviewWindow> mpPreview;
const Link& GetModifyHdl() const { return maModifyHdl; }
const Size& GetGraphicSizePixel() const { return maSizePixel; }
@@ -85,6 +85,8 @@ protected:
public:
GraphicFilterDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, const Graphic& rGraphic);
+ virtual ~GraphicFilterDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0;
};
@@ -97,11 +99,13 @@ public:
class GraphicFilterSmooth : public GraphicFilterDialog
{
private:
- NumericField* mpMtrRadius;
+ VclPtr<NumericField> mpMtrRadius;
public:
GraphicFilterSmooth( vcl::Window* pParent, const Graphic& rGraphic, double nRadius);
+ virtual ~GraphicFilterSmooth();
+ virtual void dispose() SAL_OVERRIDE;
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
double GetRadius() const { return mpMtrRadius->GetValue() / 10.0; }
@@ -114,14 +118,16 @@ public:
class GraphicFilterMosaic : public GraphicFilterDialog
{
private:
- MetricField* mpMtrWidth;
- MetricField* mpMtrHeight;
- CheckBox* mpCbxEdges;
+ VclPtr<MetricField> mpMtrWidth;
+ VclPtr<MetricField> mpMtrHeight;
+ VclPtr<CheckBox> mpCbxEdges;
public:
GraphicFilterMosaic(vcl::Window* pParent, const Graphic& rGraphic,
sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, bool bEnhanceEdges);
+ virtual ~GraphicFilterMosaic();
+ virtual void dispose() SAL_OVERRIDE;
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
long GetTileWidth() const { return static_cast<long>(mpMtrWidth->GetValue()); }
@@ -136,13 +142,15 @@ public:
class GraphicFilterSolarize : public GraphicFilterDialog
{
private:
- MetricField* mpMtrThreshold;
- CheckBox* mpCbxInvert;
+ VclPtr<MetricField> mpMtrThreshold;
+ VclPtr<CheckBox> mpCbxInvert;
public:
GraphicFilterSolarize( vcl::Window* pParent, const Graphic& rGraphic,
sal_uInt8 nGreyThreshold, bool bInvert );
+ virtual ~GraphicFilterSolarize();
+ virtual void dispose() SAL_OVERRIDE;
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
sal_uInt8 GetGreyThreshold() const { return( (sal_uInt8) FRound( mpMtrThreshold->GetValue() * 2.55 ) ); }
@@ -156,10 +164,12 @@ public:
class GraphicFilterSepia : public GraphicFilterDialog
{
private:
- MetricField* mpMtrSepia;
+ VclPtr<MetricField> mpMtrSepia;
public:
GraphicFilterSepia( vcl::Window* pParent, const Graphic& rGraphic,
sal_uInt16 nSepiaPercent );
+ virtual ~GraphicFilterSepia();
+ virtual void dispose() SAL_OVERRIDE;
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
sal_uInt16 GetSepiaPercent() const
{
@@ -174,10 +184,12 @@ public:
class GraphicFilterPoster : public GraphicFilterDialog
{
private:
- NumericField* mpNumPoster;
+ VclPtr<NumericField> mpNumPoster;
public:
GraphicFilterPoster( vcl::Window* pParent, const Graphic& rGraphic,
sal_uInt16 nPosterColorCount );
+ virtual ~GraphicFilterPoster();
+ virtual void dispose() SAL_OVERRIDE;
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
sal_uInt16 GetPosterColorCount() const { return( (sal_uInt16) mpNumPoster->GetValue() ); }
@@ -203,10 +215,12 @@ public:
class GraphicFilterEmboss : public GraphicFilterDialog
{
private:
- EmbossControl* mpCtlLight;
+ VclPtr<EmbossControl> mpCtlLight;
public:
GraphicFilterEmboss( vcl::Window* pParent, const Graphic& rGraphic,
RECT_POINT eLightSource );
+ virtual ~GraphicFilterEmboss();
+ virtual void dispose() SAL_OVERRIDE;
virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) SAL_OVERRIDE;
RECT_POINT GetLightSource() const { return mpCtlLight->GetActualRP(); }
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index 8ef2930ae952..b85633738ddf 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -38,7 +38,7 @@ class SvxHpLinkDlg;
class SvxHlinkCtrl : public SfxControllerItem
{
private :
- SvxHpLinkDlg *pParent;
+ VclPtr<SvxHpLinkDlg> pParent;
SfxStatusForwarder aRdOnlyForwarder;
@@ -80,6 +80,7 @@ protected:
public:
SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings );
virtual ~SvxHpLinkDlg ();
+ virtual void dispose() SAL_OVERRIDE;
virtual void PageCreated( sal_uInt16 nId, IconChoicePage& rPage ) SAL_OVERRIDE;
diff --git a/cui/source/inc/cuiimapwnd.hxx b/cui/source/inc/cuiimapwnd.hxx
index 3266a2a3449c..87c7e546cc6a 100644
--- a/cui/source/inc/cuiimapwnd.hxx
+++ b/cui/source/inc/cuiimapwnd.hxx
@@ -33,11 +33,11 @@
class URLDlg : public ModalDialog
{
- Edit* m_pEdtURL;
- ComboBox* m_pCbbTargets;
- Edit* m_pEdtName;
- Edit* m_pEdtAlternativeText;
- VclMultiLineEdit* m_pEdtDescription;
+ VclPtr<Edit> m_pEdtURL;
+ VclPtr<ComboBox> m_pCbbTargets;
+ VclPtr<Edit> m_pEdtName;
+ VclPtr<Edit> m_pEdtAlternativeText;
+ VclPtr<VclMultiLineEdit> m_pEdtDescription;
public:
@@ -45,6 +45,8 @@ public:
const OUString& rURL, const OUString& rAlternativeText, const OUString& rDescription,
const OUString& rTarget, const OUString& rName,
TargetList& rTargetList );
+ virtual ~URLDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetURL() const { return m_pEdtURL->GetText(); }
OUString GetAltText() const { return m_pEdtAlternativeText->GetText(); }
diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx
index e6906f1c3244..8e911729fe5f 100644
--- a/cui/source/inc/cuioptgenrl.hxx
+++ b/cui/source/inc/cuioptgenrl.hxx
@@ -40,7 +40,7 @@ class SvxGeneralTabPage : public SfxTabPage
using TabPage::DeactivatePage;
private:
// the "Use data for document properties" checkbox
- CheckBox* m_pUseDataCB;
+ VclPtr<CheckBox> m_pUseDataCB;
// rows
struct Row;
std::vector<boost::shared_ptr<Row> > vRows;
@@ -64,9 +64,10 @@ protected:
public:
SvxGeneralTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~SvxGeneralTabPage ();
+ virtual ~SvxGeneralTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/inc/cuisrchdlg.hxx b/cui/source/inc/cuisrchdlg.hxx
index 3dc19f0a1c97..be75242a8238 100644
--- a/cui/source/inc/cuisrchdlg.hxx
+++ b/cui/source/inc/cuisrchdlg.hxx
@@ -36,8 +36,8 @@ class SvxJSearchOptionsPage;
class SvxJSearchOptionsDialog : public SfxSingleTabDialog
{
- sal_Int32 nInitialTlFlags;
- SvxJSearchOptionsPage *pPage;
+ sal_Int32 nInitialTlFlags;
+ VclPtr<SvxJSearchOptionsPage> pPage;
SvxJSearchOptionsDialog( const SvxJSearchOptionsDialog & ) SAL_DELETED_FUNCTION;
SvxJSearchOptionsDialog & operator == ( const SvxJSearchOptionsDialog & ) SAL_DELETED_FUNCTION;
@@ -45,6 +45,8 @@ class SvxJSearchOptionsDialog : public SfxSingleTabDialog
public:
SvxJSearchOptionsDialog(vcl::Window *pParent,
const SfxItemSet& rOptionsSet, sal_Int32 nInitialFlags);
+ virtual ~SvxJSearchOptionsDialog();
+ virtual void dispose() SAL_OVERRIDE;
// Window
virtual void Activate() SAL_OVERRIDE;
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 3fe91da9f651..baa67bc85d4c 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -76,7 +76,6 @@ protected:
public:
SvxAreaTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow );
- virtual ~SvxAreaTabDialog();
void SetNewColorList( XColorListRef pColTab )
{ mpNewColorList = pColTab; }
@@ -116,29 +115,29 @@ class SvxTransparenceTabPage : public SvxTabPage
sal_uInt16 nDlgType;
// main selection
- RadioButton* m_pRbtTransOff;
- RadioButton* m_pRbtTransLinear;
- RadioButton* m_pRbtTransGradient;
+ VclPtr<RadioButton> m_pRbtTransOff;
+ VclPtr<RadioButton> m_pRbtTransLinear;
+ VclPtr<RadioButton> m_pRbtTransGradient;
/// linear transparency
- MetricField* m_pMtrTransparent;
+ VclPtr<MetricField> m_pMtrTransparent;
// gradient transparency
- VclGrid* m_pGridGradient;
- ListBox* m_pLbTrgrGradientType;
- FixedText* m_pFtTrgrCenterX;
- MetricField* m_pMtrTrgrCenterX;
- FixedText* m_pFtTrgrCenterY;
- MetricField* m_pMtrTrgrCenterY;
- FixedText* m_pFtTrgrAngle;
- MetricField* m_pMtrTrgrAngle;
- MetricField* m_pMtrTrgrBorder;
- MetricField* m_pMtrTrgrStartValue;
- MetricField* m_pMtrTrgrEndValue;
+ VclPtr<VclGrid> m_pGridGradient;
+ VclPtr<ListBox> m_pLbTrgrGradientType;
+ VclPtr<FixedText> m_pFtTrgrCenterX;
+ VclPtr<MetricField> m_pMtrTrgrCenterX;
+ VclPtr<FixedText> m_pFtTrgrCenterY;
+ VclPtr<MetricField> m_pMtrTrgrCenterY;
+ VclPtr<FixedText> m_pFtTrgrAngle;
+ VclPtr<MetricField> m_pMtrTrgrAngle;
+ VclPtr<MetricField> m_pMtrTrgrBorder;
+ VclPtr<MetricField> m_pMtrTrgrStartValue;
+ VclPtr<MetricField> m_pMtrTrgrEndValue;
// preview
- SvxXRectPreview* m_pCtlBitmapPreview;
- SvxXRectPreview* m_pCtlXRectPreview;
+ VclPtr<SvxXRectPreview> m_pCtlBitmapPreview;
+ VclPtr<SvxXRectPreview> m_pCtlXRectPreview;
bool bBitmap;
XOutdevItemPool* pXPool;
@@ -161,8 +160,10 @@ class SvxTransparenceTabPage : public SvxTabPage
public:
SvxTransparenceTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~SvxTransparenceTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window*, const SfxItemSet*);
+ static VclPtr<SfxTabPage> Create(vcl::Window*, const SfxItemSet*);
static const sal_uInt16* GetRanges() { return pTransparenceRanges; }
virtual bool FillItemSet(SfxItemSet*) SAL_OVERRIDE;
@@ -184,48 +185,48 @@ class SvxAreaTabPage : public SvxTabPage
using TabPage::DeactivatePage;
static const sal_uInt16 pAreaRanges[];
private:
- ListBox* m_pTypeLB;
-
- VclBox* m_pFillLB;
- ColorLB* m_pLbColor;
- GradientLB* m_pLbGradient;
- HatchingLB* m_pLbHatching;
- BitmapLB* m_pLbBitmap;
- SvxXRectPreview* m_pCtlBitmapPreview;
-
- TriStateBox* m_pTsbStepCount;
- VclFrame* m_pFlStepCount;
- NumericField* m_pNumFldStepCount;
-
- VclFrame* m_pFlHatchBckgrd;
- CheckBox* m_pCbxHatchBckgrd;
- ColorLB* m_pLbHatchBckgrdColor;
-
- VclBox* m_pBxBitmap;
-
- VclFrame* m_pFlSize;
- TriStateBox* m_pTsbOriginal;
- TriStateBox* m_pTsbScale;
- VclGrid* m_pGridX_Y;
- FixedText* m_pFtXSize;
- MetricField* m_pMtrFldXSize;
- FixedText* m_pFtYSize;
- MetricField* m_pMtrFldYSize;
-
- VclFrame* m_pFlPosition;
- SvxRectCtl* m_pCtlPosition;
- VclGrid* m_pGridOffset;
- MetricField* m_pMtrFldXOffset;
- MetricField* m_pMtrFldYOffset;
- VclBox* m_pBxTile;
- TriStateBox* m_pTsbTile;
- TriStateBox* m_pTsbStretch;
- VclFrame* m_pFlOffset;
- RadioButton* m_pRbtRow;
- RadioButton* m_pRbtColumn;
- MetricField* m_pMtrFldOffset;
-
- SvxXRectPreview* m_pCtlXRectPreview;
+ VclPtr<ListBox> m_pTypeLB;
+
+ VclPtr<VclBox> m_pFillLB;
+ VclPtr<ColorLB> m_pLbColor;
+ VclPtr<GradientLB> m_pLbGradient;
+ VclPtr<HatchingLB> m_pLbHatching;
+ VclPtr<BitmapLB> m_pLbBitmap;
+ VclPtr<SvxXRectPreview> m_pCtlBitmapPreview;
+
+ VclPtr<TriStateBox> m_pTsbStepCount;
+ VclPtr<VclFrame> m_pFlStepCount;
+ VclPtr<NumericField> m_pNumFldStepCount;
+
+ VclPtr<VclFrame> m_pFlHatchBckgrd;
+ VclPtr<CheckBox> m_pCbxHatchBckgrd;
+ VclPtr<ColorLB> m_pLbHatchBckgrdColor;
+
+ VclPtr<VclBox> m_pBxBitmap;
+
+ VclPtr<VclFrame> m_pFlSize;
+ VclPtr<TriStateBox> m_pTsbOriginal;
+ VclPtr<TriStateBox> m_pTsbScale;
+ VclPtr<VclGrid> m_pGridX_Y;
+ VclPtr<FixedText> m_pFtXSize;
+ VclPtr<MetricField> m_pMtrFldXSize;
+ VclPtr<FixedText> m_pFtYSize;
+ VclPtr<MetricField> m_pMtrFldYSize;
+
+ VclPtr<VclFrame> m_pFlPosition;
+ VclPtr<SvxRectCtl> m_pCtlPosition;
+ VclPtr<VclGrid> m_pGridOffset;
+ VclPtr<MetricField> m_pMtrFldXOffset;
+ VclPtr<MetricField> m_pMtrFldYOffset;
+ VclPtr<VclBox> m_pBxTile;
+ VclPtr<TriStateBox> m_pTsbTile;
+ VclPtr<TriStateBox> m_pTsbStretch;
+ VclPtr<VclFrame> m_pFlOffset;
+ VclPtr<RadioButton> m_pRbtRow;
+ VclPtr<RadioButton> m_pRbtColumn;
+ VclPtr<MetricField> m_pMtrFldOffset;
+
+ VclPtr<SvxXRectPreview> m_pCtlXRectPreview;
const SfxItemSet& rOutAttrs;
RECT_POINT eRP;
@@ -265,7 +266,7 @@ private:
bool mbDirectGraphicSet;
Graphic maDirectGraphic;
OUString maDirectName;
- PushButton* m_pBtnImport;
+ VclPtr<PushButton> m_pBtnImport;
DECL_LINK(SelectDialogTypeHdl_Impl, void *);
DECL_LINK( ModifyColorHdl_Impl, void * );
@@ -289,10 +290,12 @@ private:
public:
SvxAreaTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxAreaTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pAreaRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
@@ -327,13 +330,13 @@ class SvxShadowTabPage : public SvxTabPage
static const sal_uInt16 pShadowRanges[];
private:
- TriStateBox* m_pTsbShowShadow;
- VclGrid* m_pGridShadow;
- SvxRectCtl* m_pCtlPosition;
- MetricField* m_pMtrDistance;
- ColorLB* m_pLbShadowColor;
- MetricField* m_pMtrTransparent;
- SvxXShadowPreview* m_pCtlXRectPreview;
+ VclPtr<TriStateBox> m_pTsbShowShadow;
+ VclPtr<VclGrid> m_pGridShadow;
+ VclPtr<SvxRectCtl> m_pCtlPosition;
+ VclPtr<MetricField> m_pMtrDistance;
+ VclPtr<ColorLB> m_pLbShadowColor;
+ VclPtr<MetricField> m_pMtrTransparent;
+ VclPtr<SvxXShadowPreview> m_pCtlXRectPreview;
const SfxItemSet& rOutAttrs;
RECT_POINT eRP;
@@ -356,9 +359,11 @@ private:
public:
SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxShadowTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pShadowRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
@@ -384,25 +389,25 @@ class SvxGradientTabPage : public SfxTabPage
using TabPage::DeactivatePage;
private:
- ListBox* m_pLbGradientType;
- FixedText* m_pFtCenterX;
- MetricField* m_pMtrCenterX;
- FixedText* m_pFtCenterY;
- MetricField* m_pMtrCenterY;
- FixedText* m_pFtAngle;
- MetricField* m_pMtrAngle;
- MetricField* m_pMtrBorder;
- ColorLB* m_pLbColorFrom;
- MetricField* m_pMtrColorFrom;
- ColorLB* m_pLbColorTo;
- MetricField* m_pMtrColorTo;
- GradientLB* m_pLbGradients;
- SvxXRectPreview* m_pCtlPreview;
- PushButton* m_pBtnAdd;
- PushButton* m_pBtnModify;
- PushButton* m_pBtnDelete;
- PushButton* m_pBtnLoad;
- PushButton* m_pBtnSave;
+ VclPtr<ListBox> m_pLbGradientType;
+ VclPtr<FixedText> m_pFtCenterX;
+ VclPtr<MetricField> m_pMtrCenterX;
+ VclPtr<FixedText> m_pFtCenterY;
+ VclPtr<MetricField> m_pMtrCenterY;
+ VclPtr<FixedText> m_pFtAngle;
+ VclPtr<MetricField> m_pMtrAngle;
+ VclPtr<MetricField> m_pMtrBorder;
+ VclPtr<ColorLB> m_pLbColorFrom;
+ VclPtr<MetricField> m_pMtrColorFrom;
+ VclPtr<ColorLB> m_pLbColorTo;
+ VclPtr<MetricField> m_pMtrColorTo;
+ VclPtr<GradientLB> m_pLbGradients;
+ VclPtr<SvxXRectPreview> m_pCtlPreview;
+ VclPtr<PushButton> m_pBtnAdd;
+ VclPtr<PushButton> m_pBtnModify;
+ VclPtr<PushButton> m_pBtnDelete;
+ VclPtr<PushButton> m_pBtnLoad;
+ VclPtr<PushButton> m_pBtnSave;
const SfxItemSet& rOutAttrs;
@@ -435,10 +440,12 @@ private:
public:
SvxGradientTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxGradientTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
@@ -466,18 +473,18 @@ class SvxHatchTabPage : public SvxTabPage
using TabPage::DeactivatePage;
private:
- MetricField* m_pMtrDistance;
- MetricField* m_pMtrAngle;
- SvxRectCtl* m_pCtlAngle;
- ListBox* m_pLbLineType;
- ColorLB* m_pLbLineColor;
- HatchingLB* m_pLbHatchings;
- SvxXRectPreview* m_pCtlPreview;
- PushButton* m_pBtnAdd;
- PushButton* m_pBtnModify;
- PushButton* m_pBtnDelete;
- PushButton* m_pBtnLoad;
- PushButton* m_pBtnSave;
+ VclPtr<MetricField> m_pMtrDistance;
+ VclPtr<MetricField> m_pMtrAngle;
+ VclPtr<SvxRectCtl> m_pCtlAngle;
+ VclPtr<ListBox> m_pLbLineType;
+ VclPtr<ColorLB> m_pLbLineColor;
+ VclPtr<HatchingLB> m_pLbHatchings;
+ VclPtr<SvxXRectPreview> m_pCtlPreview;
+ VclPtr<PushButton> m_pBtnAdd;
+ VclPtr<PushButton> m_pBtnModify;
+ VclPtr<PushButton> m_pBtnDelete;
+ VclPtr<PushButton> m_pBtnLoad;
+ VclPtr<PushButton> m_pBtnSave;
const SfxItemSet& rOutAttrs;
@@ -511,10 +518,12 @@ private:
public:
SvxHatchTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxHatchTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
@@ -546,19 +555,19 @@ class SvxBitmapTabPage : public SvxTabPage
using TabPage::DeactivatePage;
private:
- VclBox* m_pBxPixelEditor;
- SvxPixelCtl* m_pCtlPixel;
- ColorLB* m_pLbColor;
- ColorLB* m_pLbBackgroundColor;
- FixedText* m_pLbBitmapsHidden;
- BitmapLB* m_pLbBitmaps;
- SvxXRectPreview* m_pCtlPreview;
- PushButton* m_pBtnAdd;
- PushButton* m_pBtnModify;
- PushButton* m_pBtnImport;
- PushButton* m_pBtnDelete;
- PushButton* m_pBtnLoad;
- PushButton* m_pBtnSave;
+ VclPtr<VclBox> m_pBxPixelEditor;
+ VclPtr<SvxPixelCtl> m_pCtlPixel;
+ VclPtr<ColorLB> m_pLbColor;
+ VclPtr<ColorLB> m_pLbBackgroundColor;
+ VclPtr<FixedText> m_pLbBitmapsHidden;
+ VclPtr<BitmapLB> m_pLbBitmaps;
+ VclPtr<SvxXRectPreview> m_pCtlPreview;
+ VclPtr<PushButton> m_pBtnAdd;
+ VclPtr<PushButton> m_pBtnModify;
+ VclPtr<PushButton> m_pBtnImport;
+ VclPtr<PushButton> m_pBtnDelete;
+ VclPtr<PushButton> m_pBtnLoad;
+ VclPtr<PushButton> m_pBtnSave;
SvxBitmapCtl* m_pBitmapCtl;
@@ -597,10 +606,11 @@ private:
public:
SvxBitmapTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SvxBitmapTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
@@ -642,11 +652,11 @@ class SvxColorTabPage : public SfxTabPage
private:
XPropertyListType meType;
- Window *mpTopDlg;
- CheckBox *m_pBoxEmbed;
- PushButton *m_pBtnLoad;
- PushButton *m_pBtnSave;
- FixedText *m_pTableName;
+ VclPtr<Window> mpTopDlg;
+ VclPtr<CheckBox> m_pBoxEmbed;
+ VclPtr<PushButton> m_pBtnLoad;
+ VclPtr<PushButton> m_pBtnSave;
+ VclPtr<FixedText> m_pTableName;
DECL_LINK( EmbedToggleHdl_Impl, void * );
DECL_LINK( ClickLoadHdl_Impl, void * );
@@ -660,31 +670,31 @@ private:
void EnableSave( bool bCanSave );
SvxColorTabPageShadow *pShadow;
- Edit* m_pEdtName;
- ColorLB* m_pLbColor;
+ VclPtr<Edit> m_pEdtName;
+ VclPtr<ColorLB> m_pLbColor;
- SvxColorValueSet* m_pValSetColorList;
+ VclPtr<SvxColorValueSet> m_pValSetColorList;
- SvxXRectPreview* m_pCtlPreviewOld;
- SvxXRectPreview* m_pCtlPreviewNew;
+ VclPtr<SvxXRectPreview> m_pCtlPreviewOld;
+ VclPtr<SvxXRectPreview> m_pCtlPreviewNew;
- ListBox* m_pLbColorModel;
+ VclPtr<ListBox> m_pLbColorModel;
- VclContainer* m_pRGB;
- NumericField* m_pR;
- NumericField* m_pG;
- NumericField* m_pB;
+ VclPtr<VclContainer> m_pRGB;
+ VclPtr<NumericField> m_pR;
+ VclPtr<NumericField> m_pG;
+ VclPtr<NumericField> m_pB;
- VclContainer* m_pCMYK;
- MetricField* m_pC;
- MetricField* m_pY;
- MetricField* m_pM;
- MetricField* m_pK;
+ VclPtr<VclContainer> m_pCMYK;
+ VclPtr<MetricField> m_pC;
+ VclPtr<MetricField> m_pY;
+ VclPtr<MetricField> m_pM;
+ VclPtr<MetricField> m_pK;
- PushButton* m_pBtnAdd;
- PushButton* m_pBtnModify;
- PushButton* m_pBtnWorkOn;
- PushButton* m_pBtnDelete;
+ VclPtr<PushButton> m_pBtnAdd;
+ VclPtr<PushButton> m_pBtnModify;
+ VclPtr<PushButton> m_pBtnWorkOn;
+ VclPtr<PushButton> m_pBtnDelete;
const SfxItemSet& rOutAttrs;
@@ -731,10 +741,11 @@ private:
public:
SvxColorTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SvxColorTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 31550706538a..3bb1f2b414ea 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -64,7 +64,6 @@ public:
SvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
SdrModel* pModel, const SdrObject* pObj = NULL,
bool bHasObj = true );
- virtual ~SvxLineTabDialog();
void SetNewDashList( XDashListRef pInLst)
{ pNewDashList = pInLst; }
@@ -92,34 +91,34 @@ class SvxLineTabPage : public SvxTabPage
using TabPage::DeactivatePage;
static const sal_uInt16 pLineRanges[];
private:
- VclBox* m_pBoxColor;
- LineLB* m_pLbLineStyle;
- ColorLB* m_pLbColor;
- VclBox* m_pBoxWidth;
- MetricField* m_pMtrLineWidth;
- VclBox* m_pBoxTransparency;
- MetricField* m_pMtrTransparent;
-
- VclFrame* m_pFlLineEnds;
- VclBox* m_pBoxArrowStyles;
- LineEndLB* m_pLbStartStyle;
- VclBox* m_pBoxStart;
- MetricField* m_pMtrStartWidth;
- TriStateBox* m_pTsbCenterStart;
- VclBox* m_pBoxEnd;
- LineEndLB* m_pLbEndStyle;
- MetricField* m_pMtrEndWidth;
- TriStateBox* m_pTsbCenterEnd;
- CheckBox* m_pCbxSynchronize;
- SvxXLinePreview* m_pCtlPreview;
+ VclPtr<VclBox> m_pBoxColor;
+ VclPtr<LineLB> m_pLbLineStyle;
+ VclPtr<ColorLB> m_pLbColor;
+ VclPtr<VclBox> m_pBoxWidth;
+ VclPtr<MetricField> m_pMtrLineWidth;
+ VclPtr<VclBox> m_pBoxTransparency;
+ VclPtr<MetricField> m_pMtrTransparent;
+
+ VclPtr<VclFrame> m_pFlLineEnds;
+ VclPtr<VclBox> m_pBoxArrowStyles;
+ VclPtr<LineEndLB> m_pLbStartStyle;
+ VclPtr<VclBox> m_pBoxStart;
+ VclPtr<MetricField> m_pMtrStartWidth;
+ VclPtr<TriStateBox> m_pTsbCenterStart;
+ VclPtr<VclBox> m_pBoxEnd;
+ VclPtr<LineEndLB> m_pLbEndStyle;
+ VclPtr<MetricField> m_pMtrEndWidth;
+ VclPtr<TriStateBox> m_pTsbCenterEnd;
+ VclPtr<CheckBox> m_pCbxSynchronize;
+ VclPtr<SvxXLinePreview> m_pCtlPreview;
// #116827#
- VclFrame* m_pFLEdgeStyle;
- VclGrid* m_pGridEdgeCaps;
- ListBox* m_pLBEdgeStyle;
+ VclPtr<VclFrame> m_pFLEdgeStyle;
+ VclPtr<VclGrid> m_pGridEdgeCaps;
+ VclPtr<ListBox> m_pLBEdgeStyle;
// LineCaps
- ListBox* m_pLBCapStyle;
+ VclPtr<ListBox> m_pLBCapStyle;
//#58425# symbols on a line (e. g. StarChart) ->
/** a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview.
@@ -132,12 +131,12 @@ private:
long nSymbolType;
/// attributes for the shown symbols; only necessary if not equal to line properties
SfxItemSet* pSymbolAttr;
- VclFrame* m_pFlSymbol;
- VclGrid* m_pGridIconSize;
- MenuButton* m_pSymbolMB;
- MetricField* m_pSymbolWidthMF;
- MetricField* m_pSymbolHeightMF;
- CheckBox* m_pSymbolRatioCB;
+ VclPtr<VclFrame> m_pFlSymbol;
+ VclPtr<VclGrid> m_pGridIconSize;
+ VclPtr<MenuButton> m_pSymbolMB;
+ VclPtr<MetricField> m_pSymbolWidthMF;
+ VclPtr<MetricField> m_pSymbolHeightMF;
+ VclPtr<CheckBox> m_pSymbolRatioCB;
std::vector<OUString> aGrfNames;
SvxBmpItemInfoList aGrfBrushItems;
bool bLastWidthModified;
@@ -205,10 +204,11 @@ public:
SvxLineTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SvxLineTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pLineRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
@@ -246,21 +246,21 @@ class SvxLineDefTabPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
private:
- LineLB* m_pLbLineStyles;
- ListBox* m_pLbType1;
- ListBox* m_pLbType2;
- NumericField* m_pNumFldNumber1;
- NumericField* m_pNumFldNumber2;
- MetricField* m_pMtrLength1;
- MetricField* m_pMtrLength2;
- MetricField* m_pMtrDistance;
- CheckBox* m_pCbxSynchronize;
- PushButton* m_pBtnAdd;
- PushButton* m_pBtnModify;
- PushButton* m_pBtnDelete;
- PushButton* m_pBtnLoad;
- PushButton* m_pBtnSave;
- SvxXLinePreview* m_pCtlPreview;
+ VclPtr<LineLB> m_pLbLineStyles;
+ VclPtr<ListBox> m_pLbType1;
+ VclPtr<ListBox> m_pLbType2;
+ VclPtr<NumericField> m_pNumFldNumber1;
+ VclPtr<NumericField> m_pNumFldNumber2;
+ VclPtr<MetricField> m_pMtrLength1;
+ VclPtr<MetricField> m_pMtrLength2;
+ VclPtr<MetricField> m_pMtrDistance;
+ VclPtr<CheckBox> m_pCbxSynchronize;
+ VclPtr<PushButton> m_pBtnAdd;
+ VclPtr<PushButton> m_pBtnModify;
+ VclPtr<PushButton> m_pBtnDelete;
+ VclPtr<PushButton> m_pBtnLoad;
+ VclPtr<PushButton> m_pBtnSave;
+ VclPtr<SvxXLinePreview> m_pCtlPreview;
const SfxItemSet& rOutAttrs;
XDash aDash;
@@ -303,10 +303,12 @@ private:
public:
SvxLineDefTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxLineDefTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
@@ -333,14 +335,14 @@ class SvxLineEndDefTabPage : public SfxTabPage
using TabPage::DeactivatePage;
private:
- Edit* m_pEdtName;
- LineEndLB* m_pLbLineEnds;
- PushButton* m_pBtnAdd;
- PushButton* m_pBtnModify;
- PushButton* m_pBtnDelete;
- PushButton* m_pBtnLoad;
- PushButton* m_pBtnSave;
- SvxXLinePreview* m_pCtlPreview;
+ VclPtr<Edit> m_pEdtName;
+ VclPtr<LineEndLB> m_pLbLineEnds;
+ VclPtr<PushButton> m_pBtnAdd;
+ VclPtr<PushButton> m_pBtnModify;
+ VclPtr<PushButton> m_pBtnDelete;
+ VclPtr<PushButton> m_pBtnLoad;
+ VclPtr<PushButton> m_pBtnSave;
+ VclPtr<SvxXLinePreview> m_pCtlPreview;
const SfxItemSet& rOutAttrs;
const SdrObject* pPolyObj;
@@ -373,10 +375,11 @@ private:
public:
SvxLineEndDefTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SvxLineEndDefTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
diff --git a/cui/source/inc/cuitbxform.hxx b/cui/source/inc/cuitbxform.hxx
index 1f2b34d616db..4ee17070a5f5 100644
--- a/cui/source/inc/cuitbxform.hxx
+++ b/cui/source/inc/cuitbxform.hxx
@@ -29,10 +29,12 @@
class FmInputRecordNoDialog : public ModalDialog
{
public:
- NumericField* m_pRecordNo;
+ VclPtr<NumericField> m_pRecordNo;
public:
FmInputRecordNoDialog(vcl::Window * pParent);
+ virtual ~FmInputRecordNoDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetValue(long dNew) { m_pRecordNo->SetValue(dNew); }
long GetValue() const { return static_cast<long>(m_pRecordNo->GetValue()); }
diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx
index f35f2adb57c8..cf0142120532 100644
--- a/cui/source/inc/dbregister.hxx
+++ b/cui/source/inc/dbregister.hxx
@@ -46,12 +46,12 @@ namespace svx
OUString aTypeText;
OUString aPathText;
- SvSimpleTableContainer* m_pPathCtrl;
- PushButton* m_pNew;
- PushButton* m_pEdit;
- PushButton* m_pDelete;
+ VclPtr<SvSimpleTableContainer> m_pPathCtrl;
+ VclPtr<PushButton> m_pNew;
+ VclPtr<PushButton> m_pEdit;
+ VclPtr<PushButton> m_pDelete;
- ::svx::OptHeaderTabListBox* pPathBox;
+ VclPtr<::svx::OptHeaderTabListBox> pPathBox;
SvTreeListEntry* m_pCurEntry;
sal_uLong m_nOldCount;
bool m_bModified;
@@ -91,8 +91,9 @@ namespace svx
public:
DbRegistrationOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~DbRegistrationOptionsPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges();
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -129,7 +130,6 @@ namespace svx
{
public:
DatabaseRegistrationDialog( vcl::Window* pParent, const SfxItemSet& rAttr );
- virtual ~DatabaseRegistrationDialog();
virtual short Execute() SAL_OVERRIDE;
};
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
index e6d9ea26c9fd..8615477f6618 100644
--- a/cui/source/inc/dlgname.hxx
+++ b/cui/source/inc/dlgname.hxx
@@ -30,9 +30,9 @@
class SvxNameDialog : public ModalDialog
{
private:
- FixedText* pFtDescription;
- Edit* pEdtName;
- OKButton* pBtnOK;
+ VclPtr<FixedText> pFtDescription;
+ VclPtr<Edit> pEdtName;
+ VclPtr<OKButton> pBtnOK;
Link aCheckNameHdl;
@@ -40,6 +40,8 @@ private:
public:
SvxNameDialog( vcl::Window* pWindow, const OUString& rName, const OUString& rDesc );
+ virtual ~SvxNameDialog();
+ virtual void dispose() SAL_OVERRIDE;
void GetName( OUString& rName ){rName = pEdtName->GetText();}
@@ -75,10 +77,10 @@ class SvxObjectNameDialog : public ModalDialog
{
private:
// name
- Edit* pEdtName;
+ VclPtr<Edit> pEdtName;
// buttons
- OKButton* pBtnOK;
+ VclPtr<OKButton> pBtnOK;
// callback link for name uniqueness
Link aCheckNameHdl;
@@ -88,6 +90,8 @@ private:
public:
// constructor
SvxObjectNameDialog(vcl::Window* pWindow, const OUString& rName);
+ virtual ~SvxObjectNameDialog();
+ virtual void dispose() SAL_OVERRIDE;
// data access
void GetName(OUString& rName) {rName = pEdtName->GetText(); }
@@ -110,15 +114,16 @@ class SvxObjectTitleDescDialog : public ModalDialog
{
private:
// title
- Edit* pEdtTitle;
+ VclPtr<Edit> pEdtTitle;
// description
- VclMultiLineEdit* pEdtDescription;
+ VclPtr<VclMultiLineEdit> pEdtDescription;
public:
// constructor
SvxObjectTitleDescDialog(vcl::Window* pWindow, const OUString& rTitle, const OUString& rDesc);
-
+ virtual ~SvxObjectTitleDescDialog();
+ virtual void dispose() SAL_OVERRIDE;
// data access
void GetTitle(OUString& rTitle) {rTitle = pEdtTitle->GetText(); }
void GetDescription(OUString& rDescription) {rDescription = pEdtDescription->GetText(); }
@@ -128,10 +133,10 @@ public:
class SvxMessDialog : public ModalDialog
{
private:
- FixedText* pFtDescription;
- PushButton* pBtn1;
- PushButton* pBtn2;
- FixedImage* pFtImage;
+ VclPtr<FixedText> pFtDescription;
+ VclPtr<PushButton> pBtn1;
+ VclPtr<PushButton> pBtn2;
+ VclPtr<FixedImage> pFtImage;
Image* pImage;
DECL_LINK(Button1Hdl, void *);
@@ -140,6 +145,7 @@ private:
public:
SvxMessDialog( vcl::Window* pWindow, const OUString& rText, const OUString& rDesc, Image* pImg = NULL );
virtual ~SvxMessDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetButtonText( sal_uInt16 nBtnId, const OUString& rNewTxt );
};
diff --git a/cui/source/inc/dstribut.hxx b/cui/source/inc/dstribut.hxx
index e0be5f3dd87e..46e18129968f 100644
--- a/cui/source/inc/dstribut.hxx
+++ b/cui/source/inc/dstribut.hxx
@@ -29,23 +29,25 @@ class SvxDistributePage : public SvxTabPage
SvxDistributeHorizontal m_eDistributeHor;
SvxDistributeVertical m_eDistributeVer;
- RadioButton* m_pBtnHorNone;
- RadioButton* m_pBtnHorLeft;
- RadioButton* m_pBtnHorCenter;
- RadioButton* m_pBtnHorDistance;
- RadioButton* m_pBtnHorRight;
- RadioButton* m_pBtnVerNone;
- RadioButton* m_pBtnVerTop;
- RadioButton* m_pBtnVerCenter;
- RadioButton* m_pBtnVerDistance;
- RadioButton* m_pBtnVerBottom;
+ VclPtr<RadioButton> m_pBtnHorNone;
+ VclPtr<RadioButton> m_pBtnHorLeft;
+ VclPtr<RadioButton> m_pBtnHorCenter;
+ VclPtr<RadioButton> m_pBtnHorDistance;
+ VclPtr<RadioButton> m_pBtnHorRight;
+ VclPtr<RadioButton> m_pBtnVerNone;
+ VclPtr<RadioButton> m_pBtnVerTop;
+ VclPtr<RadioButton> m_pBtnVerCenter;
+ VclPtr<RadioButton> m_pBtnVerDistance;
+ VclPtr<RadioButton> m_pBtnVerBottom;
public:
SvxDistributePage(vcl::Window* pWindow, const SfxItemSet& rInAttrs,
SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone,
SvxDistributeVertical eVer = SvxDistributeVerticalNone);
+ virtual ~SvxDistributePage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window*, const SfxItemSet&,
+ static VclPtr<SfxTabPage> Create(vcl::Window*, const SfxItemSet&,
SvxDistributeHorizontal eHor, SvxDistributeVertical eVer);
virtual bool FillItemSet(SfxItemSet*) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet*) SAL_OVERRIDE;
@@ -57,12 +59,14 @@ public:
class SvxDistributeDialog : public SfxSingleTabDialog
{
- SvxDistributePage* mpPage;
+ VclPtr<SvxDistributePage> mpPage;
public:
SvxDistributeDialog(vcl::Window* pParent, const SfxItemSet& rAttr,
SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone,
SvxDistributeVertical eVer = SvxDistributeVerticalNone);
+ virtual ~SvxDistributeDialog();
+ virtual void dispose() SAL_OVERRIDE;
SvxDistributeHorizontal GetDistributeHor() const { return mpPage->GetDistributeHor(); }
SvxDistributeVertical GetDistributeVer() const { return mpPage->GetDistributeVer(); }
diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx
index 18769aee67b2..4ce44f8ec257 100644
--- a/cui/source/inc/grfpage.hxx
+++ b/cui/source/inc/grfpage.hxx
@@ -56,28 +56,28 @@ class SvxGrfCropPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
- VclContainer* m_pCropFrame;
- RadioButton* m_pZoomConstRB;
- RadioButton* m_pSizeConstRB;
- MetricField* m_pLeftMF;
- MetricField* m_pRightMF;
- MetricField* m_pTopMF;
- MetricField* m_pBottomMF;
-
- VclContainer* m_pScaleFrame;
- MetricField* m_pWidthZoomMF;
- MetricField* m_pHeightZoomMF;
-
- VclContainer* m_pSizeFrame;
- MetricField* m_pWidthMF;
- MetricField* m_pHeightMF;
-
- VclContainer* m_pOrigSizeGrid;
- FixedText* m_pOrigSizeFT;
- PushButton* m_pOrigSizePB;
+ VclPtr<VclContainer> m_pCropFrame;
+ VclPtr<RadioButton> m_pZoomConstRB;
+ VclPtr<RadioButton> m_pSizeConstRB;
+ VclPtr<MetricField> m_pLeftMF;
+ VclPtr<MetricField> m_pRightMF;
+ VclPtr<MetricField> m_pTopMF;
+ VclPtr<MetricField> m_pBottomMF;
+
+ VclPtr<VclContainer> m_pScaleFrame;
+ VclPtr<MetricField> m_pWidthZoomMF;
+ VclPtr<MetricField> m_pHeightZoomMF;
+
+ VclPtr<VclContainer> m_pSizeFrame;
+ VclPtr<MetricField> m_pWidthMF;
+ VclPtr<MetricField> m_pHeightMF;
+
+ VclPtr<VclContainer> m_pOrigSizeGrid;
+ VclPtr<FixedText> m_pOrigSizeFT;
+ VclPtr<PushButton> m_pOrigSizePB;
// Example
- SvxCropExample* m_pExampleWN;
+ VclPtr<SvxCropExample> m_pExampleWN;
Timer aTimer;
@@ -85,7 +85,7 @@ class SvxGrfCropPage : public SfxTabPage
Size aOrigSize;
Size aOrigPixelSize;
Size aPageSize;
- const MetricField* pLastCropField;
+ VclPtr<MetricField> pLastCropField;
long nOldWidth;
long nOldHeight;
bool bReset;
@@ -95,6 +95,7 @@ class SvxGrfCropPage : public SfxTabPage
SvxGrfCropPage( vcl::Window *pParent, const SfxItemSet &rSet );
virtual ~SvxGrfCropPage();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK( ZoomHdl, MetricField * );
DECL_LINK( SizeHdl, MetricField * );
@@ -111,7 +112,7 @@ class SvxGrfCropPage : public SfxTabPage
Size GetGrfOrigSize( const Graphic& ) const;
public:
- static SfxTabPage *Create( vcl::Window *pParent, const SfxItemSet *rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window *pParent, const SfxItemSet *rSet );
virtual bool FillItemSet( SfxItemSet *rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet *rSet ) SAL_OVERRIDE;
diff --git a/cui/source/inc/hangulhanjadlg.hxx b/cui/source/inc/hangulhanjadlg.hxx
index cb228daebc1e..2aa203c85319 100644
--- a/cui/source/inc/hangulhanjadlg.hxx
+++ b/cui/source/inc/hangulhanjadlg.hxx
@@ -43,6 +43,7 @@ namespace svx
public:
SuggestionSet( vcl::Window* pParent );
virtual ~SuggestionSet();
+ virtual void dispose() SAL_OVERRIDE;
virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
void ClearSet();
@@ -53,6 +54,7 @@ namespace svx
public:
SuggestionDisplay( vcl::Window* pParent, WinBits nBits );
virtual ~SuggestionDisplay();
+ virtual void dispose() SAL_OVERRIDE;
void DisplayListBox( bool bDisplayListBox );
@@ -87,8 +89,8 @@ namespace svx
private:
bool m_bDisplayListBox;//otherwise ValueSet
- SuggestionSet m_aValueSet;
- ListBox m_aListBox;
+ VclPtr<SuggestionSet> m_aValueSet;
+ VclPtr<ListBox> m_aListBox;
Link m_aSelectLink;
bool m_bInSelectionUpdate;
@@ -102,27 +104,27 @@ namespace svx
{
private:
- PushButton* m_pFind;
- PushButton* m_pIgnore;
- PushButton* m_pIgnoreAll;
- PushButton* m_pReplace;
- PushButton* m_pReplaceAll;
- PushButton* m_pOptions;
- SuggestionDisplay* m_pSuggestions;
- RadioButton* m_pSimpleConversion;
- RadioButton* m_pHangulBracketed;
- RadioButton* m_pHanjaBracketed;
- Edit* m_pWordInput;
- FixedText* m_pOriginalWord;
- RubyRadioButton* m_pHanjaAbove;
- RubyRadioButton* m_pHanjaBelow;
- RubyRadioButton* m_pHangulAbove;
- RubyRadioButton* m_pHangulBelow;
- CheckBox* m_pHangulOnly;
- CheckBox* m_pHanjaOnly;
- CheckBox* m_pReplaceByChar;
-
- CheckBox* m_pIgnoreNonPrimary;
+ VclPtr<PushButton> m_pFind;
+ VclPtr<PushButton> m_pIgnore;
+ VclPtr<PushButton> m_pIgnoreAll;
+ VclPtr<PushButton> m_pReplace;
+ VclPtr<PushButton> m_pReplaceAll;
+ VclPtr<PushButton> m_pOptions;
+ VclPtr<SuggestionDisplay> m_pSuggestions;
+ VclPtr<RadioButton> m_pSimpleConversion;
+ VclPtr<RadioButton> m_pHangulBracketed;
+ VclPtr<RadioButton> m_pHanjaBracketed;
+ VclPtr<Edit> m_pWordInput;
+ VclPtr<FixedText> m_pOriginalWord;
+ VclPtr<RubyRadioButton> m_pHanjaAbove;
+ VclPtr<RubyRadioButton> m_pHanjaBelow;
+ VclPtr<RubyRadioButton> m_pHangulAbove;
+ VclPtr<RubyRadioButton> m_pHangulBelow;
+ VclPtr<CheckBox> m_pHangulOnly;
+ VclPtr<CheckBox> m_pHanjaOnly;
+ VclPtr<CheckBox> m_pReplaceByChar;
+
+ VclPtr<CheckBox> m_pIgnoreNonPrimary;
/** are we working for a document? This is normally true, but in case
the user uses the "find" functionality, we switch to working
with what the user entered, which then does not have any relation to
@@ -136,7 +138,8 @@ namespace svx
HangulHanjaConversionDialog(
vcl::Window* _pParent,
editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection );
- virtual ~HangulHanjaConversionDialog( );
+ virtual ~HangulHanjaConversionDialog();
+ virtual void dispose() SAL_OVERRIDE;
public:
void SetOptionsChangedHdl( const Link& _rHdl );
@@ -195,14 +198,14 @@ namespace svx
class HangulHanjaOptionsDialog : public ModalDialog
{
private:
- SvxCheckListBox* m_pDictsLB;
- CheckBox* m_pIgnorepostCB;
- CheckBox* m_pShowrecentlyfirstCB;
- CheckBox* m_pAutoreplaceuniqueCB;
- PushButton* m_pNewPB;
- PushButton* m_pEditPB;
- PushButton* m_pDeletePB;
- OKButton* m_pOkPB;
+ VclPtr<SvxCheckListBox> m_pDictsLB;
+ VclPtr<CheckBox> m_pIgnorepostCB;
+ VclPtr<CheckBox> m_pShowrecentlyfirstCB;
+ VclPtr<CheckBox> m_pAutoreplaceuniqueCB;
+ VclPtr<PushButton> m_pNewPB;
+ VclPtr<PushButton> m_pEditPB;
+ VclPtr<PushButton> m_pDeletePB;
+ VclPtr<OKButton> m_pOkPB;
SvLBoxButtonData* m_pCheckButtonData;
@@ -222,6 +225,7 @@ namespace svx
public:
HangulHanjaOptionsDialog( vcl::Window* _pParent );
virtual ~HangulHanjaOptionsDialog();
+ virtual void dispose() SAL_OVERRIDE;
void AddDict( const OUString& _rName, bool _bChecked );
};
@@ -230,8 +234,8 @@ namespace svx
class HangulHanjaNewDictDialog : public ModalDialog
{
private:
- Edit* m_pDictNameED;
- OKButton* m_pOkBtn;
+ VclPtr<Edit> m_pDictNameED;
+ VclPtr<OKButton> m_pOkBtn;
bool m_bEntered;
@@ -239,6 +243,8 @@ namespace svx
DECL_LINK( ModifyHdl, void* );
public:
HangulHanjaNewDictDialog( vcl::Window* _pParent );
+ virtual ~HangulHanjaNewDictDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool GetName( OUString& _rRetName ) const;
};
@@ -249,15 +255,16 @@ namespace svx
class SuggestionEdit : public Edit
{
private:
- SuggestionEdit* m_pPrev;
- SuggestionEdit* m_pNext;
- ScrollBar* m_pScrollBar;
+ VclPtr<SuggestionEdit> m_pPrev;
+ VclPtr<SuggestionEdit> m_pNext;
+ VclPtr<ScrollBar> m_pScrollBar;
bool ShouldScroll( bool _bUp ) const;
void DoJump( bool _bUp );
public:
SuggestionEdit( vcl::Window* pParent, WinBits nBits );
virtual ~SuggestionEdit();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
void init( ScrollBar* pScrollBar, SuggestionEdit* pPrev, SuggestionEdit* pNext);
};
@@ -273,15 +280,15 @@ namespace svx
OUString m_aOriginal;
SuggestionList* m_pSuggestions;
- ListBox* m_aBookLB;
- ComboBox* m_aOriginalLB;
- SuggestionEdit* m_aEdit1;
- SuggestionEdit* m_aEdit2;
- SuggestionEdit* m_aEdit3;
- SuggestionEdit* m_aEdit4;
- ScrollBar* m_aScrollSB;
- PushButton* m_aNewPB;
- PushButton* m_aDeletePB;
+ VclPtr<ListBox> m_aBookLB;
+ VclPtr<ComboBox> m_aOriginalLB;
+ VclPtr<SuggestionEdit> m_aEdit1;
+ VclPtr<SuggestionEdit> m_aEdit2;
+ VclPtr<SuggestionEdit> m_aEdit3;
+ VclPtr<SuggestionEdit> m_aEdit4;
+ VclPtr<ScrollBar> m_aScrollSB;
+ VclPtr<PushButton> m_aNewPB;
+ VclPtr<PushButton> m_aDeletePB;
sal_uInt16 m_nTopPos;
bool m_bModifiedSuggestions;
@@ -312,6 +319,7 @@ namespace svx
public:
HangulHanjaEditDictDialog( vcl::Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict );
virtual ~HangulHanjaEditDictDialog();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateScrollbar();
};
diff --git a/cui/source/inc/headertablistbox.hxx b/cui/source/inc/headertablistbox.hxx
index d368d4dc27c9..f63eba3c73c1 100644
--- a/cui/source/inc/headertablistbox.hxx
+++ b/cui/source/inc/headertablistbox.hxx
@@ -27,25 +27,27 @@
class MacroEventListBox : public Control
{
private:
- HeaderBar maHeaderBar;
- SvHeaderTabListBox maListBox;
+ VclPtr<HeaderBar> maHeaderBar;
+ VclPtr<SvHeaderTabListBox> maListBox;
protected:
DECL_LINK( HeaderEndDrag_Impl, HeaderBar* );
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
public:
MacroEventListBox( vcl::Window* pParent, WinBits nStyle );
+ virtual ~MacroEventListBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
SvHeaderTabListBox& GetListBox()
{
- return maListBox;
+ return *maListBox.get();
}
HeaderBar& GetHeaderBar()
{
- return maHeaderBar;
+ return *maHeaderBar.get();
}
void ConnectElements();/**< should be called after all manipulations on elements are done
diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx
index 98731d7e6172..e72b13387e0e 100644
--- a/cui/source/inc/hldocntp.hxx
+++ b/cui/source/inc/hldocntp.hxx
@@ -30,11 +30,11 @@
class SvxHyperlinkNewDocTp : public SvxHyperlinkTabPageBase
{
private:
- RadioButton *m_pRbtEditNow;
- RadioButton *m_pRbtEditLater;
- SvxHyperURLBox *m_pCbbPath;
- PushButton *m_pBtCreate;
- ListBox *m_pLbDocTypes;
+ VclPtr<RadioButton> m_pRbtEditNow;
+ VclPtr<RadioButton> m_pRbtEditLater;
+ VclPtr<SvxHyperURLBox> m_pCbbPath;
+ VclPtr<PushButton> m_pBtCreate;
+ VclPtr<ListBox> m_pLbDocTypes;
bool ImplGetURLObject( const OUString& rPath, const OUString& rBase, INetURLObject& aURLObject ) const;
void FillDocumentList ();
@@ -52,8 +52,9 @@ protected:
public:
SvxHyperlinkNewDocTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet);
virtual ~SvxHyperlinkNewDocTp ();
+ virtual void dispose() SAL_OVERRIDE;
- static IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
+ static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
virtual bool AskApply () SAL_OVERRIDE;
virtual void DoApply () SAL_OVERRIDE;
diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx
index 1b7e3525840d..457cf1e0ea28 100644
--- a/cui/source/inc/hldoctp.hxx
+++ b/cui/source/inc/hldoctp.hxx
@@ -30,12 +30,12 @@
class SvxHyperlinkDocTp : public SvxHyperlinkTabPageBase
{
private:
- SvxHyperURLBox *m_pCbbPath;
- PushButton *m_pBtFileopen;
+ VclPtr<SvxHyperURLBox> m_pCbbPath;
+ VclPtr<PushButton> m_pBtFileopen;
- Edit *m_pEdTarget;
- FixedText *m_pFtFullURL;
- PushButton *m_pBtBrowse;
+ VclPtr<Edit> m_pEdTarget;
+ VclPtr<FixedText> m_pFtFullURL;
+ VclPtr<PushButton> m_pBtBrowse;
OUString maStrURL;
@@ -67,9 +67,10 @@ protected:
public:
SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet);
- virtual ~SvxHyperlinkDocTp ();
+ virtual ~SvxHyperlinkDocTp();
+ virtual void dispose() SAL_OVERRIDE;
- static IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
+ static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
virtual void SetMarkStr ( const OUString& aStrMark ) SAL_OVERRIDE;
diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx
index e11b74456b32..99f60cdca909 100644
--- a/cui/source/inc/hlinettp.hxx
+++ b/cui/source/inc/hlinettp.hxx
@@ -32,15 +32,15 @@
class SvxHyperlinkInternetTp : public SvxHyperlinkTabPageBase
{
private:
- RadioButton *m_pRbtLinktypInternet;
- RadioButton *m_pRbtLinktypFTP;
- SvxHyperURLBox *m_pCbbTarget;
- PushButton *m_pBtBrowse;
- FixedText *m_pFtLogin;
- Edit *m_pEdLogin;
- FixedText *m_pFtPassword;
- Edit *m_pEdPassword;
- CheckBox *m_pCbAnonymous;
+ VclPtr<RadioButton > m_pRbtLinktypInternet;
+ VclPtr<RadioButton> m_pRbtLinktypFTP;
+ VclPtr<SvxHyperURLBox> m_pCbbTarget;
+ VclPtr<PushButton> m_pBtBrowse;
+ VclPtr<FixedText> m_pFtLogin;
+ VclPtr<Edit> m_pEdLogin;
+ VclPtr<FixedText> m_pFtPassword;
+ VclPtr<Edit> m_pEdPassword;
+ VclPtr<CheckBox> m_pCbAnonymous;
OUString maStrOldUser;
OUString maStrOldPassword;
@@ -78,9 +78,10 @@ protected:
public:
SvxHyperlinkInternetTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet);
- virtual ~SvxHyperlinkInternetTp ();
+ virtual ~SvxHyperlinkInternetTp();
+ virtual void dispose() SAL_OVERRIDE;
- static IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
+ static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
virtual void SetMarkStr ( const OUString& aStrMark ) SAL_OVERRIDE;
diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx
index 6f847976e16b..705a9a3a8fda 100644
--- a/cui/source/inc/hlmailtp.hxx
+++ b/cui/source/inc/hlmailtp.hxx
@@ -30,10 +30,10 @@
class SvxHyperlinkMailTp : public SvxHyperlinkTabPageBase
{
private:
- SvxHyperURLBox *m_pCbbReceiver;
- PushButton *m_pBtAdrBook;
- FixedText *m_pFtSubject;
- Edit *m_pEdSubject;
+ VclPtr<SvxHyperURLBox> m_pCbbReceiver;
+ VclPtr<PushButton> m_pBtAdrBook;
+ VclPtr<FixedText> m_pFtSubject;
+ VclPtr<Edit> m_pEdSubject;
DECL_LINK (ClickAdrBookHdl_Impl , void * ); ///< Button : Address book
DECL_LINK (ModifiedReceiverHdl_Impl, void * ); ///< Combobox "receiver" modified
@@ -51,9 +51,10 @@ protected:
public:
SvxHyperlinkMailTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet);
- virtual ~SvxHyperlinkMailTp ();
+ virtual ~SvxHyperlinkMailTp();
+ virtual void dispose() SAL_OVERRIDE;
- static IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
+ static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
virtual void SetInitFocus() SAL_OVERRIDE;
};
diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx
index 2108beb587b4..9591a2a0f640 100644
--- a/cui/source/inc/hlmarkwn.hxx
+++ b/cui/source/inc/hlmarkwn.hxx
@@ -39,10 +39,12 @@ class SvxHlinkDlgMarkWnd;
class SvxHlmarkTreeLBox : public SvTreeListBox
{
private:
- SvxHlinkDlgMarkWnd* mpParentWnd;
+ VclPtr<SvxHlinkDlgMarkWnd> mpParentWnd;
public:
SvxHlmarkTreeLBox(vcl::Window* pParent, WinBits nStyle);
+ virtual ~SvxHlmarkTreeLBox();
+ virtual void dispose() SAL_OVERRIDE;
void SetParentWnd(SvxHlinkDlgMarkWnd* pParent)
{
@@ -62,13 +64,13 @@ class SvxHlinkDlgMarkWnd : public ModalDialog //FloatingWindow
private:
friend class SvxHlmarkTreeLBox;
- PushButton* mpBtApply;
- PushButton* mpBtClose;
- SvxHlmarkTreeLBox* mpLbTree;
+ VclPtr<PushButton> mpBtApply;
+ VclPtr<PushButton> mpBtClose;
+ VclPtr<SvxHlmarkTreeLBox> mpLbTree;
bool mbUserMoved;
- SvxHyperlinkTabPageBase* mpParent;
+ VclPtr<SvxHyperlinkTabPageBase> mpParent;
OUString maStrLastURL;
@@ -90,6 +92,7 @@ protected:
public:
SvxHlinkDlgMarkWnd (SvxHyperlinkTabPageBase *pParent);
virtual ~SvxHlinkDlgMarkWnd();
+ virtual void dispose() SAL_OVERRIDE;
bool MoveTo ( Point aNewPos );
void RefreshTree(const OUString& aStrURL);
diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx
index f1df0e407056..d155d6e42de7 100644
--- a/cui/source/inc/hltpbase.hxx
+++ b/cui/source/inc/hltpbase.hxx
@@ -67,11 +67,11 @@ public:
class SvxHyperlinkTabPageBase : public IconChoicePage
{
private:
- ComboBox *mpCbbFrame;
- ListBox *mpLbForm;
- Edit *mpEdIndication;
- Edit *mpEdText;
- PushButton *mpBtScript;
+ VclPtr<ComboBox> mpCbbFrame;
+ VclPtr<ListBox> mpLbForm;
+ VclPtr<Edit> mpEdIndication;
+ VclPtr<Edit> mpEdText;
+ VclPtr<PushButton> mpBtScript;
bool mbIsCloseDisabled;
@@ -79,7 +79,7 @@ private:
mxDocumentFrame;
protected:
- vcl::Window* mpDialog;
+ VclPtr<vcl::Window> mpDialog;
bool mbStdControlsInit;
@@ -87,7 +87,7 @@ protected:
Timer maTimer;
- SvxHlinkDlgMarkWnd* mpMarkWnd;
+ VclPtr<SvxHlinkDlgMarkWnd> mpMarkWnd;
void InitStdControls ();
void FillStandardDlgFields ( const SvxHyperlinkItem* pHyperlinkItem );
@@ -118,6 +118,7 @@ public:
const SfxItemSet& rItemSet
);
virtual ~SvxHyperlinkTabPageBase ();
+ virtual void dispose() SAL_OVERRIDE;
void SetDocumentFrame(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame )
diff --git a/cui/source/inc/hyphen.hxx b/cui/source/inc/hyphen.hxx
index 4d0b7ba7c489..3bf97672b99b 100644
--- a/cui/source/inc/hyphen.hxx
+++ b/cui/source/inc/hyphen.hxx
@@ -42,14 +42,14 @@ protected:
class SvxHyphenWordDialog : public SfxModalDialog
{
- HyphenEdit* m_pWordEdit;
- PushButton* m_pLeftBtn;
- PushButton* m_pRightBtn;
- PushButton* m_pOkBtn;
- PushButton* m_pContBtn;
- PushButton* m_pDelBtn;
- PushButton* m_pHyphAll;
- CloseButton* m_pCloseBtn;
+ VclPtr<HyphenEdit> m_pWordEdit;
+ VclPtr<PushButton> m_pLeftBtn;
+ VclPtr<PushButton> m_pRightBtn;
+ VclPtr<PushButton> m_pOkBtn;
+ VclPtr<PushButton> m_pContBtn;
+ VclPtr<PushButton> m_pDelBtn;
+ VclPtr<PushButton> m_pHyphAll;
+ VclPtr<CloseButton> m_pCloseBtn;
OUString aLabel;
SvxSpellWrapper* pHyphWrapper;
css::uno::Reference< css::linguistic2::XHyphenator > xHyphenator;
@@ -86,6 +86,7 @@ public:
css::uno::Reference< css::linguistic2::XHyphenator > &xHyphen,
SvxSpellWrapper* pWrapper );
virtual ~SvxHyphenWordDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetWindowTitle( LanguageType nLang );
void SelLeft();
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index 8831eb65f3d0..74b686d17ca5 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -40,8 +40,8 @@ class IconChoiceDialog;
class IconChoicePage;
// Create-Function
-typedef IconChoicePage* (*CreatePage)(vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet &rAttrSet);
-typedef const sal_uInt16* (*GetPageRanges)(); // gives international Which-value
+typedef VclPtr<IconChoicePage> (*CreatePage)(vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet &rAttrSet);
+typedef const sal_uInt16* (*GetPageRanges)(); // gives international Which-value
/// Data-structure for pages in dialog
struct IconChoicePageData
@@ -49,7 +49,7 @@ struct IconChoicePageData
sal_uInt16 nId;
CreatePage fnCreatePage; ///< pointer to the factory
GetPageRanges fnGetRanges; ///< pointer to the ranges-function
- IconChoicePage* pPage; ///< the TabPage itself
+ VclPtr<IconChoicePage> pPage; ///< the TabPage itself
bool bOnDemand; ///< Flag: ItemSet onDemand
bool bRefresh; ///< Flag: page has to be newly initialized
@@ -73,7 +73,7 @@ private :
const SfxItemSet* pSet;
OUString aUserString;
bool bHasExchangeSupport;
- IconChoiceDialog* pDialog;
+ VclPtr<IconChoiceDialog> pDialog;
void SetDialog( IconChoiceDialog* pNew ) { pDialog = pNew; }
IconChoiceDialog* GetDialog() const { return pDialog; }
@@ -85,11 +85,12 @@ private :
protected :
IconChoicePage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet &rAttrSet );
- sal_uInt16 GetSlot( sal_uInt16 nWhich ) const { return pSet->GetPool()->GetSlotId( nWhich ); }
- sal_uInt16 GetWhich( sal_uInt16 nSlot ) const { return pSet->GetPool()->GetWhich( nSlot ); }
+ sal_uInt16 GetSlot( sal_uInt16 nWhich ) const { return pSet->GetPool()->GetSlotId( nWhich ); }
+ sal_uInt16 GetWhich( sal_uInt16 nSlot ) const { return pSet->GetPool()->GetWhich( nSlot ); }
public :
- virtual ~IconChoicePage();
+ virtual ~IconChoicePage();
+ virtual void dispose() SAL_OVERRIDE;
const SfxItemSet& GetItemSet() const { return *pSet; }
@@ -125,18 +126,18 @@ private :
::std::vector< IconChoicePageData* > maPageList;
- SvtIconChoiceCtrl *m_pIconCtrl;
+ VclPtr<SvtIconChoiceCtrl> m_pIconCtrl;
sal_uInt16 mnCurrentPageId;
// Buttons
- OKButton *m_pOKBtn;
- PushButton *m_pApplyBtn;
- CancelButton *m_pCancelBtn;
- HelpButton *m_pHelpBtn;
- PushButton *m_pResetBtn;
+ VclPtr<OKButton> m_pOKBtn;
+ VclPtr<PushButton> m_pApplyBtn;
+ VclPtr<CancelButton> m_pCancelBtn;
+ VclPtr<HelpButton> m_pHelpBtn;
+ VclPtr<PushButton> m_pResetBtn;
- VclVBox *m_pTabContainer;
+ VclPtr<VclVBox> m_pTabContainer;
const SfxItemSet* pSet;
SfxItemSet* pOutSet;
SfxItemSet* pExampleSet;
@@ -167,7 +168,7 @@ protected :
SfxItemSet* CreateInputItemSet( sal_uInt16 nId );
inline SfxItemSet* GetInputSetImpl() { return const_cast<SfxItemSet*>(pSet); }
inline IconChoicePage* GetTabPage( sal_uInt16 nPageId )
- { return ( GetPageData (nPageId)->pPage?GetPageData (nPageId)->pPage:NULL); }
+ { return ( GetPageData (nPageId)->pPage?GetPageData (nPageId)->pPage.get():NULL); }
void RefreshInputSet();
void ActivatePageImpl ();
@@ -182,6 +183,7 @@ public :
IconChoiceDialog ( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription,
const SfxItemSet * pItemSet = 0 );
virtual ~IconChoiceDialog ();
+ virtual void dispose() SAL_OVERRIDE;
// interface
SvxIconChoiceCtrlEntry* AddTabPage(
diff --git a/cui/source/inc/insdlg.hxx b/cui/source/inc/insdlg.hxx
index 5807c240b826..eda64bad3349 100644
--- a/cui/source/inc/insdlg.hxx
+++ b/cui/source/inc/insdlg.hxx
@@ -56,14 +56,14 @@ public:
class SvInsertOleDlg : public InsertObjectDialog_Impl
{
- RadioButton* m_pRbNewObject;
- RadioButton* m_pRbObjectFromfile;
- VclFrame* m_pObjectTypeFrame;
- ListBox* m_pLbObjecttype;
- VclFrame* m_pFileFrame;
- Edit* m_pEdFilepath;
- PushButton* m_pBtnFilepath;
- CheckBox* m_pCbFilelink;
+ VclPtr<RadioButton> m_pRbNewObject;
+ VclPtr<RadioButton> m_pRbObjectFromfile;
+ VclPtr<VclFrame> m_pObjectTypeFrame;
+ VclPtr<ListBox> m_pLbObjecttype;
+ VclPtr<VclFrame> m_pFileFrame;
+ VclPtr<Edit> m_pEdFilepath;
+ VclPtr<PushButton> m_pBtnFilepath;
+ VclPtr<CheckBox> m_pCbFilelink;
const SvObjectServerList* m_pServers;
::com::sun::star::uno::Sequence< sal_Int8 > m_aIconMetaFile;
@@ -86,6 +86,8 @@ public:
SvInsertOleDlg( vcl::Window* pParent,
const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage,
const SvObjectServerList* pServers = NULL );
+ virtual ~SvInsertOleDlg();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
/// get replacement for the iconified embedded object and the mediatype of the replacement
@@ -95,9 +97,9 @@ public:
class SvInsertPlugInDialog : public InsertObjectDialog_Impl
{
private:
- Edit* m_pEdFileurl;
- PushButton* m_pBtnFileurl;
- VclMultiLineEdit* m_pEdPluginsOptions;
+ VclPtr<Edit> m_pEdFileurl;
+ VclPtr<PushButton> m_pBtnFileurl;
+ VclPtr<VclMultiLineEdit> m_pEdPluginsOptions;
INetURLObject* m_pURL;
OUString m_aCommands;
@@ -109,29 +111,30 @@ public:
SvInsertPlugInDialog(vcl::Window* pParent,
const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage);
virtual ~SvInsertPlugInDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
};
class SfxInsertFloatingFrameDialog : public InsertObjectDialog_Impl
{
private:
- Edit* m_pEDName;
- Edit* m_pEDURL;
- PushButton* m_pBTOpen;
+ VclPtr<Edit> m_pEDName;
+ VclPtr<Edit> m_pEDURL;
+ VclPtr<PushButton> m_pBTOpen;
- RadioButton* m_pRBScrollingOn;
- RadioButton* m_pRBScrollingOff;
- RadioButton* m_pRBScrollingAuto;
+ VclPtr<RadioButton> m_pRBScrollingOn;
+ VclPtr<RadioButton> m_pRBScrollingOff;
+ VclPtr<RadioButton> m_pRBScrollingAuto;
- RadioButton* m_pRBFrameBorderOn;
- RadioButton* m_pRBFrameBorderOff;
+ VclPtr<RadioButton> m_pRBFrameBorderOn;
+ VclPtr<RadioButton> m_pRBFrameBorderOff;
- FixedText* m_pFTMarginWidth;
- NumericField* m_pNMMarginWidth;
- CheckBox* m_pCBMarginWidthDefault;
- FixedText* m_pFTMarginHeight;
- NumericField* m_pNMMarginHeight;
- CheckBox* m_pCBMarginHeightDefault;
+ VclPtr<FixedText> m_pFTMarginWidth;
+ VclPtr<NumericField> m_pNMMarginWidth;
+ VclPtr<CheckBox> m_pCBMarginWidthDefault;
+ VclPtr<FixedText> m_pFTMarginHeight;
+ VclPtr<NumericField> m_pNMMarginHeight;
+ VclPtr<CheckBox> m_pCBMarginHeightDefault;
DECL_STATIC_LINK(SfxInsertFloatingFrameDialog, OpenHdl, PushButton* );
DECL_STATIC_LINK(SfxInsertFloatingFrameDialog, CheckHdl, CheckBox* );
@@ -143,6 +146,8 @@ public:
const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
SfxInsertFloatingFrameDialog( vcl::Window* pParent,
const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj );
+ virtual ~SfxInsertFloatingFrameDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
};
diff --git a/cui/source/inc/insrc.hxx b/cui/source/inc/insrc.hxx
index a6e215e2ee49..0e66966be946 100644
--- a/cui/source/inc/insrc.hxx
+++ b/cui/source/inc/insrc.hxx
@@ -29,20 +29,22 @@
#include <vcl/group.hxx>
#include <vcl/button.hxx>
-class SvxInsRowColDlg : public SvxAbstractInsRowColDlg, public ModalDialog
+class SvxInsRowColDlg : public SvxAbstractInsRowColDlg
{
- NumericField* m_pCountEdit;
+ VclPtr<ModalDialog> m_pDialog;
+ VclPtr<NumericField> m_pCountEdit;
- RadioButton* m_pBeforeBtn;
- RadioButton* m_pAfterBtn;
+ VclPtr<RadioButton> m_pBeforeBtn;
+ VclPtr<RadioButton> m_pAfterBtn;
OUString aRow;
OUString aCol;
- bool bColumn;
+ bool bColumn;
public:
SvxInsRowColDlg( vcl::Window* pParent, bool bCol, const OString& sHelpId );
+ virtual ~SvxInsRowColDlg();
virtual short Execute() SAL_OVERRIDE;
diff --git a/cui/source/inc/labdlg.hxx b/cui/source/inc/labdlg.hxx
index 446499f28887..610c63b2f2f9 100644
--- a/cui/source/inc/labdlg.hxx
+++ b/cui/source/inc/labdlg.hxx
@@ -34,16 +34,16 @@ class SvxCaptionTabPage : public SfxTabPage
{
private:
static const sal_uInt16 pCaptionRanges[];
- ValueSet* m_pCT_CAPTTYPE;
- MetricField* m_pMF_ABSTAND;
- ListBox* m_pLB_ANSATZ;
- FixedText* m_pFT_UM;
- MetricField* m_pMF_ANSATZ;
- FixedText* m_pFT_ANSATZ_REL;
- ListBox* m_pLB_ANSATZ_REL;
- FixedText* m_pFT_LAENGE;
- MetricField* m_pMF_LAENGE;
- CheckBox* m_pCB_LAENGE;
+ VclPtr<ValueSet> m_pCT_CAPTTYPE;
+ VclPtr<MetricField> m_pMF_ABSTAND;
+ VclPtr<ListBox> m_pLB_ANSATZ;
+ VclPtr<FixedText> m_pFT_UM;
+ VclPtr<MetricField> m_pMF_ANSATZ;
+ VclPtr<FixedText> m_pFT_ANSATZ_REL;
+ VclPtr<ListBox> m_pLB_ANSATZ_REL;
+ VclPtr<FixedText> m_pFT_LAENGE;
+ VclPtr<MetricField> m_pMF_LAENGE;
+ VclPtr<CheckBox> m_pCB_LAENGE;
Image m_aBmpCapTypes[CAPTYPE_BITMAPS_COUNT];
@@ -75,8 +75,10 @@ private:
public:
SvxCaptionTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxCaptionTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pCaptionRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
diff --git a/cui/source/inc/linkdlg.hxx b/cui/source/inc/linkdlg.hxx
index 89491007d919..7e953fcd747e 100644
--- a/cui/source/inc/linkdlg.hxx
+++ b/cui/source/inc/linkdlg.hxx
@@ -44,16 +44,16 @@ class SvBaseLinksDlg : public ModalDialog
{
using Window::SetType;
- SvTabListBox *m_pTbLinks;
- FixedText *m_pFtFullFileName;
- FixedText *m_pFtFullSourceName;
- FixedText *m_pFtFullTypeName;
- RadioButton *m_pRbAutomatic;
- RadioButton *m_pRbManual;
- PushButton *m_pPbUpdateNow;
- PushButton *m_pPbOpenSource;
- PushButton *m_pPbChangeSource;
- PushButton *m_pPbBreakLink;
+ VclPtr<SvTabListBox> m_pTbLinks;
+ VclPtr<FixedText> m_pFtFullFileName;
+ VclPtr<FixedText> m_pFtFullSourceName;
+ VclPtr<FixedText> m_pFtFullTypeName;
+ VclPtr<RadioButton> m_pRbAutomatic;
+ VclPtr<RadioButton> m_pRbManual;
+ VclPtr<PushButton> m_pPbUpdateNow;
+ VclPtr<PushButton> m_pPbOpenSource;
+ VclPtr<PushButton> m_pPbChangeSource;
+ VclPtr<PushButton> m_pPbBreakLink;
OUString aStrAutolink;
OUString aStrManuallink;
OUString aStrBrokenlink;
@@ -96,6 +96,7 @@ class SvBaseLinksDlg : public ModalDialog
public:
SvBaseLinksDlg( vcl::Window * pParent, sfx2::LinkManager*, bool bHtml = false );
virtual ~SvBaseLinksDlg();
+ virtual void dispose() SAL_OVERRIDE;
void SetActLink( sfx2::SvBaseLink * pLink );
};
diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx
index c0e4fd66492b..696c8bf55711 100644
--- a/cui/source/inc/macroass.hxx
+++ b/cui/source/inc/macroass.hxx
@@ -57,6 +57,7 @@ protected:
public:
virtual ~_SfxMacroTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void AddEvent( const OUString & rEventName, sal_uInt16 nEventId );
@@ -96,7 +97,7 @@ public:
);
// --------- inherit from the base -------------
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
};
class SfxMacroAssignDlg : public SfxSingleTabDialog
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index c1cded175f5e..befe9e3607f9 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -82,6 +82,7 @@ protected:
public:
virtual ~_SvxMacroTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void InitResources();
void InitAndSetHandler( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xAppEvents, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xDocEvents, ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > xModifiable );
diff --git a/cui/source/inc/measure.hxx b/cui/source/inc/measure.hxx
index aadc276d3641..28dbdfdc7c28 100644
--- a/cui/source/inc/measure.hxx
+++ b/cui/source/inc/measure.hxx
@@ -33,23 +33,23 @@ class SvxMeasurePage : public SvxTabPage
private:
static const sal_uInt16 pRanges[];
- MetricField* m_pMtrFldLineDist;
- MetricField* m_pMtrFldHelplineOverhang;
- MetricField* m_pMtrFldHelplineDist;
- MetricField* m_pMtrFldHelpline1Len;
- MetricField* m_pMtrFldHelpline2Len;
- TriStateBox* m_pTsbBelowRefEdge;
- MetricField* m_pMtrFldDecimalPlaces;
-
- SvxRectCtl* m_pCtlPosition;
- TriStateBox* m_pTsbAutoPosV;
- TriStateBox* m_pTsbAutoPosH;
- TriStateBox* m_pTsbShowUnit;
- ListBox* m_pLbUnit;
- TriStateBox* m_pTsbParallel;
- FixedText* m_pFtAutomatic;
-
- SvxXMeasurePreview* m_pCtlPreview;
+ VclPtr<MetricField> m_pMtrFldLineDist;
+ VclPtr<MetricField> m_pMtrFldHelplineOverhang;
+ VclPtr<MetricField> m_pMtrFldHelplineDist;
+ VclPtr<MetricField> m_pMtrFldHelpline1Len;
+ VclPtr<MetricField> m_pMtrFldHelpline2Len;
+ VclPtr<TriStateBox> m_pTsbBelowRefEdge;
+ VclPtr<MetricField> m_pMtrFldDecimalPlaces;
+
+ VclPtr<SvxRectCtl> m_pCtlPosition;
+ VclPtr<TriStateBox> m_pTsbAutoPosV;
+ VclPtr<TriStateBox> m_pTsbAutoPosH;
+ VclPtr<TriStateBox> m_pTsbShowUnit;
+ VclPtr<ListBox> m_pLbUnit;
+ VclPtr<TriStateBox> m_pTsbParallel;
+ VclPtr<FixedText> m_pFtAutomatic;
+
+ VclPtr<SvxXMeasurePreview> m_pCtlPreview;
const SfxItemSet& rOutAttrs;
SfxItemSet aAttrSet;
@@ -67,8 +67,9 @@ public:
SvxMeasurePage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
virtual ~SvxMeasurePage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx
index 0508ff40aba1..ecc1395f6cad 100644
--- a/cui/source/inc/multipat.hxx
+++ b/cui/source/inc/multipat.hxx
@@ -39,9 +39,9 @@
class SvxMultiPathDialog : public ModalDialog
{
private:
- svx::SvxRadioButtonListBox* m_pRadioLB;
- PushButton* m_pAddBtn;
- PushButton* m_pDelBtn;
+ VclPtr<svx::SvxRadioButtonListBox> m_pRadioLB;
+ VclPtr<PushButton> m_pAddBtn;
+ VclPtr<PushButton> m_pDelBtn;
DECL_LINK(AddHdl_Impl, void *);
DECL_LINK(DelHdl_Impl, void *);
@@ -51,6 +51,7 @@ private:
public:
SvxMultiPathDialog(vcl::Window* pParent);
virtual ~SvxMultiPathDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetPath() const;
void SetPath( const OUString& rPath );
@@ -59,9 +60,9 @@ public:
class SvxPathSelectDialog : public ModalDialog
{
private:
- ListBox* m_pPathLB;
- PushButton* m_pAddBtn;
- PushButton* m_pDelBtn;
+ VclPtr<ListBox> m_pPathLB;
+ VclPtr<PushButton> m_pAddBtn;
+ VclPtr<PushButton> m_pDelBtn;
DECL_LINK(AddHdl_Impl, void *);
DECL_LINK(DelHdl_Impl, void *);
@@ -70,6 +71,7 @@ private:
public:
SvxPathSelectDialog(vcl::Window* pParent);
virtual ~SvxPathSelectDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetPath() const;
void SetPath( const OUString& rPath );
diff --git a/cui/source/inc/newtabledlg.hxx b/cui/source/inc/newtabledlg.hxx
index 109d62f1509e..394d04265344 100644
--- a/cui/source/inc/newtabledlg.hxx
+++ b/cui/source/inc/newtabledlg.hxx
@@ -26,14 +26,16 @@
#include <svx/stddlg.hxx>
#include <svx/svxdlg.hxx>
-class SvxNewTableDialog : public SvxAbstractNewTableDialog, public ModalDialog
+class SvxNewTableDialog : public SvxAbstractNewTableDialog
{
private:
- NumericField* mpNumColumns;
- NumericField* mpNumRows;
+ VclPtr<ModalDialog> m_pDialog;
+ VclPtr<NumericField> mpNumColumns;
+ VclPtr<NumericField> mpNumRows;
public:
SvxNewTableDialog( vcl::Window* pWindow );
+ virtual ~SvxNewTableDialog();
virtual short Execute() SAL_OVERRIDE;
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index 9a6172a5a753..e2fa378794a2 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -70,8 +70,9 @@ class SvxNumberFormatTabPage : public SfxTabPage
public:
virtual ~SvxNumberFormatTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
// Returns area information.
static const sal_uInt16* GetRanges() { return pRanges; }
@@ -91,31 +92,31 @@ public:
private:
SvxNumberFormatTabPage( vcl::Window* pParent,
const SfxItemSet& rCoreAttrs );
- FixedText* m_pFtCategory;
- ListBox* m_pLbCategory;
- FixedText* m_pFtFormat;
- ListBox* m_pLbCurrency;
- SvxFontListBox* m_pLbFormat;
- FixedText* m_pFtLanguage;
- SvxLanguageBox* m_pLbLanguage;
- CheckBox* m_pCbSourceFormat;
- SvxNumberPreview* m_pWndPreview;
- FixedText* m_pFtOptions;
- FixedText* m_pFtDecimals;
- NumericField* m_pEdDecimals;
- CheckBox* m_pBtnNegRed;
- FixedText* m_pFtLeadZeroes;
- NumericField* m_pEdLeadZeroes;
- CheckBox* m_pBtnThousand;
-
- VclContainer* m_pFormatCodeFrame;
- Edit* m_pEdFormat;
- PushButton* m_pIbAdd;
- PushButton* m_pIbInfo;
- PushButton* m_pIbRemove;
-
- FixedText* m_pFtComment;
- Edit* m_pEdComment;
+ VclPtr<FixedText> m_pFtCategory;
+ VclPtr<ListBox> m_pLbCategory;
+ VclPtr<FixedText> m_pFtFormat;
+ VclPtr<ListBox> m_pLbCurrency;
+ VclPtr<SvxFontListBox> m_pLbFormat;
+ VclPtr<FixedText> m_pFtLanguage;
+ VclPtr<SvxLanguageBox> m_pLbLanguage;
+ VclPtr<CheckBox> m_pCbSourceFormat;
+ VclPtr<SvxNumberPreview> m_pWndPreview;
+ VclPtr<FixedText> m_pFtOptions;
+ VclPtr<FixedText> m_pFtDecimals;
+ VclPtr<NumericField> m_pEdDecimals;
+ VclPtr<CheckBox> m_pBtnNegRed;
+ VclPtr<FixedText> m_pFtLeadZeroes;
+ VclPtr<NumericField> m_pEdLeadZeroes;
+ VclPtr<CheckBox> m_pBtnThousand;
+
+ VclPtr<VclContainer> m_pFormatCodeFrame;
+ VclPtr<Edit> m_pEdFormat;
+ VclPtr<PushButton> m_pIbAdd;
+ VclPtr<PushButton> m_pIbInfo;
+ VclPtr<PushButton> m_pIbRemove;
+
+ VclPtr<FixedText> m_pFtComment;
+ VclPtr<Edit> m_pEdComment;
Timer aResetWinTimer;
@@ -130,7 +131,7 @@ private:
OUString sAutomaticEntry;
- vcl::Window* pLastActivWindow;
+ VclPtr<vcl::Window> pLastActivWindow;
void Init_Impl();
void FillCurrencyBox();
@@ -145,11 +146,11 @@ private:
void ChangePreviewText( sal_uInt16 nPos );
void AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect);
// Handler
- DECL_LINK( LostFocusHdl_Impl, Edit* pEd );
- DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* pLb );
+ DECL_LINK( LostFocusHdl_Impl, Edit* );
+ DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* );
DECL_LINK( SelFormatHdl_Impl, void * );
- DECL_LINK( ClickHdl_Impl, PushButton* pIB );
- DECL_LINK( EditHdl_Impl, Edit* pEdFormat );
+ DECL_LINK( ClickHdl_Impl, PushButton* );
+ DECL_LINK( EditHdl_Impl, Edit* );
DECL_LINK( OptHdl_Impl, void * );
DECL_LINK(TimeHdl_Impl, void *);
};
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 739249fbde20..108f9e3bea39 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -90,7 +90,7 @@ class SvxSingleNumPickTabPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
- SvxNumValueSet* m_pExamplesVS;
+ VclPtr<SvxNumValueSet> m_pExamplesVS;
SvxNumSettingsArr_Impl aNumSettingsArr;
SvxNumRule* pActNum;
SvxNumRule* pSaveNum;
@@ -101,16 +101,17 @@ class SvxSingleNumPickTabPage : public SfxTabPage
OUString sNumCharFmtName;
sal_uInt16 nNumItemId;
- protected:
+protected:
DECL_LINK(NumSelectHdl_Impl, void *);
DECL_LINK(DoubleClickHdl_Impl, void *);
- public:
+public:
SvxSingleNumPickTabPage(vcl::Window* pParent,
const SfxItemSet& rSet);
- virtual ~SvxSingleNumPickTabPage();
+ virtual ~SvxSingleNumPickTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
@@ -129,7 +130,7 @@ class SvxBulletPickTabPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
- SvxNumValueSet* m_pExamplesVS;
+ VclPtr<SvxNumValueSet> m_pExamplesVS;
SvxNumRule* pActNum;
SvxNumRule* pSaveNum;
sal_uInt16 nActNumLvl;
@@ -138,15 +139,16 @@ class SvxBulletPickTabPage : public SfxTabPage
sal_uInt16 nNumItemId;
OUString sBulletCharFmtName;
- protected:
+protected:
DECL_LINK(NumSelectHdl_Impl, void *);
DECL_LINK(DoubleClickHdl_Impl, void *);
- public:
+public:
SvxBulletPickTabPage(vcl::Window* pParent,
const SfxItemSet& rSet);
- virtual ~SvxBulletPickTabPage();
+ virtual ~SvxBulletPickTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
@@ -166,7 +168,7 @@ class SvxNumPickTabPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
- SvxNumValueSet* m_pExamplesVS;
+ VclPtr<SvxNumValueSet> m_pExamplesVS;
OUString sNumCharFmtName;
OUString sBulletCharFmtName;
@@ -180,16 +182,17 @@ class SvxNumPickTabPage : public SfxTabPage
bool bPreset : 1;
- protected:
+protected:
DECL_LINK(NumSelectHdl_Impl, void *);
DECL_LINK(DoubleClickHdl_Impl, void *);
- public:
- SvxNumPickTabPage(vcl::Window* pParent,
+public:
+ SvxNumPickTabPage(vcl::Window* pParent,
const SfxItemSet& rSet);
- virtual ~SvxNumPickTabPage();
+ virtual ~SvxNumPickTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
@@ -210,8 +213,8 @@ class SvxBitmapPickTabPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
- FixedText* m_pErrorText;
- SvxBmpNumValueSet* m_pExamplesVS;
+ VclPtr<FixedText> m_pErrorText;
+ VclPtr<SvxBmpNumValueSet> m_pExamplesVS;
std::vector<OUString> aGrfNames;
OUString sNumCharFmtName;
@@ -224,17 +227,18 @@ class SvxBitmapPickTabPage : public SfxTabPage
bool bModified : 1;
bool bPreset : 1;
- protected:
+protected:
DECL_LINK(NumSelectHdl_Impl, void *);
DECL_LINK(DoubleClickHdl_Impl, void *);
DECL_LINK(LinkBmpHdl_Impl, void *);
- public:
+public:
SvxBitmapPickTabPage(vcl::Window* pParent,
const SfxItemSet& rSet);
virtual ~SvxBitmapPickTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
@@ -251,44 +255,44 @@ class SvxNumOptionsTabPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
- ListBox* m_pLevelLB;
-
- ListBox* m_pFmtLB;
-
- FixedText* m_pSeparatorFT;
- FixedText* m_pPrefixFT;
- Edit* m_pPrefixED;
- FixedText* m_pSuffixFT;
- Edit* m_pSuffixED;
- FixedText* m_pCharFmtFT;
- ListBox* m_pCharFmtLB;
- FixedText* m_pBulColorFT;
- ColorListBox* m_pBulColLB;
- FixedText* m_pBulRelSizeFT;
- MetricField* m_pBulRelSizeMF;
- FixedText* m_pAllLevelFT;
- NumericField* m_pAllLevelNF;
- FixedText* m_pStartFT;
- NumericField* m_pStartED;
- FixedText* m_pBulletFT;
- PushButton* m_pBulletPB;
- FixedText* m_pAlignFT;
- ListBox* m_pAlignLB;
- FixedText* m_pBitmapFT;
- MenuButton* m_pBitmapMB;
+ VclPtr<ListBox> m_pLevelLB;
+
+ VclPtr<ListBox> m_pFmtLB;
+
+ VclPtr<FixedText> m_pSeparatorFT;
+ VclPtr<FixedText> m_pPrefixFT;
+ VclPtr<Edit> m_pPrefixED;
+ VclPtr<FixedText> m_pSuffixFT;
+ VclPtr<Edit> m_pSuffixED;
+ VclPtr<FixedText> m_pCharFmtFT;
+ VclPtr<ListBox> m_pCharFmtLB;
+ VclPtr<FixedText> m_pBulColorFT;
+ VclPtr<ColorListBox> m_pBulColLB;
+ VclPtr<FixedText> m_pBulRelSizeFT;
+ VclPtr<MetricField> m_pBulRelSizeMF;
+ VclPtr<FixedText> m_pAllLevelFT;
+ VclPtr<NumericField> m_pAllLevelNF;
+ VclPtr<FixedText> m_pStartFT;
+ VclPtr<NumericField> m_pStartED;
+ VclPtr<FixedText> m_pBulletFT;
+ VclPtr<PushButton> m_pBulletPB;
+ VclPtr<FixedText> m_pAlignFT;
+ VclPtr<ListBox> m_pAlignLB;
+ VclPtr<FixedText> m_pBitmapFT;
+ VclPtr<MenuButton> m_pBitmapMB;
sal_uInt16 m_nGalleryId;
- FixedText* m_pWidthFT;
- MetricField* m_pWidthMF;
- FixedText* m_pHeightFT;
- MetricField* m_pHeightMF;
- CheckBox* m_pRatioCB;
- FixedText* m_pOrientFT;
- ListBox* m_pOrientLB;
+ VclPtr<FixedText> m_pWidthFT;
+ VclPtr<MetricField> m_pWidthMF;
+ VclPtr<FixedText> m_pHeightFT;
+ VclPtr<MetricField> m_pHeightMF;
+ VclPtr<CheckBox> m_pRatioCB;
+ VclPtr<FixedText> m_pOrientFT;
+ VclPtr<ListBox> m_pOrientLB;
- VclContainer* m_pAllLevelsFrame;
- CheckBox* m_pSameLevelCB;
+ VclPtr<VclContainer> m_pAllLevelsFrame;
+ VclPtr<CheckBox> m_pSameLevelCB;
- SvxNumberingPreview* m_pPreviewWIN;
+ VclPtr<SvxNumberingPreview> m_pPreviewWIN;
OUString m_sNumCharFmtName;
OUString m_sBulletCharFmtName;
@@ -341,12 +345,13 @@ class SvxNumOptionsTabPage : public SfxTabPage
DECL_STATIC_LINK( SvxNumOptionsTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* );
- public:
+public:
SvxNumOptionsTabPage(vcl::Window* pParent,
const SfxItemSet& rSet);
virtual ~SvxNumOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
@@ -385,36 +390,36 @@ class SvxNumPositionTabPage : public SfxTabPage
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
- ListBox* m_pLevelLB;
+ VclPtr<ListBox> m_pLevelLB;
// former set of controls shown for numbering rules containing list level
// attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
- FixedText* m_pDistBorderFT;
- MetricField* m_pDistBorderMF;
- CheckBox* m_pRelativeCB;
- FixedText* m_pIndentFT;
- MetricField* m_pIndentMF;
- FixedText* m_pDistNumFT;
- MetricField* m_pDistNumMF;
- FixedText* m_pAlignFT;
- ListBox* m_pAlignLB;
+ VclPtr<FixedText> m_pDistBorderFT;
+ VclPtr<MetricField> m_pDistBorderMF;
+ VclPtr<CheckBox> m_pRelativeCB;
+ VclPtr<FixedText> m_pIndentFT;
+ VclPtr<MetricField> m_pIndentMF;
+ VclPtr<FixedText> m_pDistNumFT;
+ VclPtr<MetricField> m_pDistNumMF;
+ VclPtr<FixedText> m_pAlignFT;
+ VclPtr<ListBox> m_pAlignLB;
// new set of controls shown for numbering rules containing list level
// attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
- FixedText* m_pLabelFollowedByFT;
- ListBox* m_pLabelFollowedByLB;
- FixedText* m_pListtabFT;
- MetricField* m_pListtabMF;
- FixedText* m_pAlign2FT;
- ListBox* m_pAlign2LB;
- FixedText* m_pAlignedAtFT;
- MetricField* m_pAlignedAtMF;
- FixedText* m_pIndentAtFT;
- MetricField* m_pIndentAtMF;
+ VclPtr<FixedText> m_pLabelFollowedByFT;
+ VclPtr<ListBox> m_pLabelFollowedByLB;
+ VclPtr<FixedText> m_pListtabFT;
+ VclPtr<MetricField> m_pListtabMF;
+ VclPtr<FixedText> m_pAlign2FT;
+ VclPtr<ListBox> m_pAlign2LB;
+ VclPtr<FixedText> m_pAlignedAtFT;
+ VclPtr<MetricField> m_pAlignedAtMF;
+ VclPtr<FixedText> m_pIndentAtFT;
+ VclPtr<MetricField> m_pIndentAtMF;
- PushButton* m_pStandardPB;
+ VclPtr<PushButton> m_pStandardPB;
- SvxNumberingPreview* m_pPreviewWIN;
+ VclPtr<SvxNumberingPreview> m_pPreviewWIN;
SvxNumRule* pActNum;
SvxNumRule* pSaveNum;
@@ -448,13 +453,14 @@ public:
SvxNumPositionTabPage(vcl::Window* pParent,
const SfxItemSet& rSet);
virtual ~SvxNumPositionTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
void SetMetric(FieldUnit eSet);
diff --git a/cui/source/inc/optasian.hxx b/cui/source/inc/optasian.hxx
index d2d182420783..39d18ef48976 100644
--- a/cui/source/inc/optasian.hxx
+++ b/cui/source/inc/optasian.hxx
@@ -29,22 +29,22 @@
struct SvxAsianLayoutPage_Impl;
class SvxAsianLayoutPage : public SfxTabPage
{
- RadioButton* m_pCharKerningRB;
- RadioButton* m_pCharPunctKerningRB;
+ VclPtr<RadioButton> m_pCharKerningRB;
+ VclPtr<RadioButton> m_pCharPunctKerningRB;
- RadioButton* m_pNoCompressionRB;
- RadioButton* m_pPunctCompressionRB;
- RadioButton* m_pPunctKanaCompressionRB;
+ VclPtr<RadioButton> m_pNoCompressionRB;
+ VclPtr<RadioButton> m_pPunctCompressionRB;
+ VclPtr<RadioButton> m_pPunctKanaCompressionRB;
- FixedText* m_pLanguageFT;
- SvxLanguageBox* m_pLanguageLB;
- CheckBox* m_pStandardCB;
+ VclPtr<FixedText> m_pLanguageFT;
+ VclPtr<SvxLanguageBox> m_pLanguageLB;
+ VclPtr<CheckBox> m_pStandardCB;
- FixedText* m_pStartFT;
- Edit* m_pStartED;
- FixedText* m_pEndFT;
- Edit* m_pEndED;
- FixedText* m_pHintFT;
+ VclPtr<FixedText> m_pStartFT;
+ VclPtr<Edit> m_pStartED;
+ VclPtr<FixedText> m_pEndFT;
+ VclPtr<Edit> m_pEndED;
+ VclPtr<FixedText> m_pHintFT;
SvxAsianLayoutPage_Impl* pImpl;
@@ -52,12 +52,12 @@ class SvxAsianLayoutPage : public SfxTabPage
DECL_LINK(ChangeStandardHdl, CheckBox*);
DECL_LINK(ModifyHdl, Edit*);
- SvxAsianLayoutPage( vcl::Window* pParent, const SfxItemSet& rSet );
public:
-
+ SvxAsianLayoutPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxAsianLayoutPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
static const sal_uInt16* GetRanges();
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/inc/optdict.hxx b/cui/source/inc/optdict.hxx
index e26a4b37f253..3bdffc3f0edd 100644
--- a/cui/source/inc/optdict.hxx
+++ b/cui/source/inc/optdict.hxx
@@ -50,10 +50,10 @@ namespace linguistic2{
class SvxNewDictionaryDialog : public ModalDialog
{
private:
- Edit* pNameEdit;
- SvxLanguageBox* pLanguageLB;
- CheckBox* pExceptBtn;
- OKButton* pOKBtn;
+ VclPtr<Edit> pNameEdit;
+ VclPtr<SvxLanguageBox> pLanguageLB;
+ VclPtr<CheckBox> pExceptBtn;
+ VclPtr<OKButton> pOKBtn;
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
::com::sun::star::uno::Reference<
@@ -66,6 +66,8 @@ public:
SvxNewDictionaryDialog( vcl::Window* pParent,
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellChecker1 > &xSpl );
+ virtual ~SvxNewDictionaryDialog();
+ virtual void dispose() SAL_OVERRIDE;
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XDictionary >
@@ -100,16 +102,16 @@ class SvxEditDictionaryDialog : public ModalDialog
{
private:
- ListBox* pAllDictsLB;
- FixedText* pLangFT;
- SvxLanguageBox* pLangLB;
+ VclPtr<ListBox> pAllDictsLB;
+ VclPtr<FixedText> pLangFT;
+ VclPtr<SvxLanguageBox> pLangLB;
- SvxDictEdit* pWordED;
- FixedText* pReplaceFT;
- SvxDictEdit* pReplaceED;
- SvTabListBox* pWordsLB;
- PushButton* pNewReplacePB;
- PushButton* pDeletePB;
+ VclPtr<SvxDictEdit> pWordED;
+ VclPtr<FixedText> pReplaceFT;
+ VclPtr<SvxDictEdit> pReplaceED;
+ VclPtr<SvTabListBox> pWordsLB;
+ VclPtr<PushButton> pNewReplacePB;
+ VclPtr<PushButton> pDeletePB;
OUString sModify;
OUString sNew;
@@ -153,6 +155,7 @@ public:
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
virtual ~SvxEditDictionaryDialog();
+ virtual void dispose() SAL_OVERRIDE;
sal_uInt16 GetSelectedDict() {return pAllDictsLB->GetSelectEntryPos();}
};
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 8529393a14a0..f99e3bb7ba46 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -52,15 +52,15 @@ class SvxLinguData_Impl;
class SvxEditModulesDlg : public ModalDialog
{
- SvxLanguageBox* m_pLanguageLB;
+ VclPtr<SvxLanguageBox> m_pLanguageLB;
- SvxCheckListBox* m_pModulesCLB;
- PushButton* m_pPrioUpPB;
- PushButton* m_pPrioDownPB;
- PushButton* m_pBackPB;
- FixedHyperlink* m_pMoreDictsLink;
+ VclPtr<SvxCheckListBox> m_pModulesCLB;
+ VclPtr<PushButton> m_pPrioUpPB;
+ VclPtr<PushButton> m_pPrioDownPB;
+ VclPtr<PushButton> m_pBackPB;
+ VclPtr<FixedHyperlink> m_pMoreDictsLink;
- CloseButton* m_pClosePB;
+ VclPtr<CloseButton> m_pClosePB;
OUString sSpell;
OUString sHyph;
@@ -86,6 +86,7 @@ class SvxEditModulesDlg : public ModalDialog
public:
SvxEditModulesDlg(vcl::Window* pParent, SvxLinguData_Impl& rData);
virtual ~SvxEditModulesDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
// class SvxLinguTabPage -------------------------------------------------
@@ -93,17 +94,17 @@ public:
class SvxLinguTabPage : public SfxTabPage
{
private:
- FixedText* m_pLinguModulesFT;
- SvxCheckListBox* m_pLinguModulesCLB;
- PushButton* m_pLinguModulesEditPB;
- FixedText* m_pLinguDicsFT;
- SvxCheckListBox* m_pLinguDicsCLB;
- PushButton* m_pLinguDicsNewPB;
- PushButton* m_pLinguDicsEditPB;
- PushButton* m_pLinguDicsDelPB;
- SvxCheckListBox* m_pLinguOptionsCLB;
- PushButton* m_pLinguOptionsEditPB;
- FixedHyperlink* m_pMoreDictsLink;
+ VclPtr<FixedText> m_pLinguModulesFT;
+ VclPtr<SvxCheckListBox> m_pLinguModulesCLB;
+ VclPtr<PushButton> m_pLinguModulesEditPB;
+ VclPtr<FixedText> m_pLinguDicsFT;
+ VclPtr<SvxCheckListBox> m_pLinguDicsCLB;
+ VclPtr<PushButton> m_pLinguDicsNewPB;
+ VclPtr<PushButton> m_pLinguDicsEditPB;
+ VclPtr<PushButton> m_pLinguDicsDelPB;
+ VclPtr<SvxCheckListBox> m_pLinguOptionsCLB;
+ VclPtr<PushButton> m_pLinguOptionsEditPB;
+ VclPtr<FixedHyperlink> m_pMoreDictsLink;
OUString sCapitalWords;
OUString sWordsWithDigits;
@@ -147,7 +148,8 @@ private:
public:
virtual ~SvxLinguTabPage();
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
index 8db65294ce6d..df078cec88b8 100644
--- a/cui/source/inc/optpath.hxx
+++ b/cui/source/inc/optpath.hxx
@@ -42,11 +42,11 @@ class SvxPathTabPage;
class SvxPathTabPage : public SfxTabPage
{
private:
- SvSimpleTableContainer* m_pPathCtrl;
- PushButton* m_pStandardBtn;
- PushButton* m_pPathBtn;
+ VclPtr<SvSimpleTableContainer> m_pPathCtrl;
+ VclPtr<PushButton> m_pStandardBtn;
+ VclPtr<PushButton> m_pPathBtn;
- ::svx::OptHeaderTabListBox* pPathBox;
+ VclPtr<::svx::OptHeaderTabListBox> pPathBox;
OptPath_Impl* pImpl;
::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
@@ -71,8 +71,9 @@ private:
public:
SvxPathTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxPathTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges();
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 90dadaea13e8..f68bf339bab7 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -75,53 +75,53 @@ class SvxPageDescPage : public SfxTabPage
static const sal_uInt16 pRanges[];
private:
// paper format
- ListBox* m_pPaperSizeBox;
+ VclPtr<ListBox> m_pPaperSizeBox;
- MetricField* m_pPaperWidthEdit;
- MetricField* m_pPaperHeightEdit;
+ VclPtr<MetricField> m_pPaperWidthEdit;
+ VclPtr<MetricField> m_pPaperHeightEdit;
- FixedText* m_pOrientationFT;
- RadioButton* m_pPortraitBtn;
- RadioButton* m_pLandscapeBtn;
+ VclPtr<FixedText> m_pOrientationFT;
+ VclPtr<RadioButton> m_pPortraitBtn;
+ VclPtr<RadioButton> m_pLandscapeBtn;
- SvxPageWindow* m_pBspWin;
+ VclPtr<SvxPageWindow> m_pBspWin;
- FixedText* m_pTextFlowLbl;
- svx::FrameDirectionListBox* m_pTextFlowBox;
+ VclPtr<FixedText> m_pTextFlowLbl;
+ VclPtr<svx::FrameDirectionListBox> m_pTextFlowBox;
- ListBox* m_pPaperTrayBox;
+ VclPtr<ListBox> m_pPaperTrayBox;
// Margins
- FixedText* m_pLeftMarginLbl;
- MetricField* m_pLeftMarginEdit;
- FixedText* m_pRightMarginLbl;
- MetricField* m_pRightMarginEdit;
- MetricField* m_pTopMarginEdit;
- MetricField* m_pBottomMarginEdit;
+ VclPtr<FixedText> m_pLeftMarginLbl;
+ VclPtr<MetricField> m_pLeftMarginEdit;
+ VclPtr<FixedText> m_pRightMarginLbl;
+ VclPtr<MetricField> m_pRightMarginEdit;
+ VclPtr<MetricField> m_pTopMarginEdit;
+ VclPtr<MetricField> m_pBottomMarginEdit;
// layout settings
- FixedText* m_pPageText;
- ListBox* m_pLayoutBox;
- ListBox* m_pNumberFormatBox;
+ VclPtr<FixedText> m_pPageText;
+ VclPtr<ListBox> m_pLayoutBox;
+ VclPtr<ListBox> m_pNumberFormatBox;
//Extras Calc
- FixedText* m_pTblAlignFT;
- CheckBox* m_pHorzBox;
- CheckBox* m_pVertBox;
+ VclPtr<FixedText> m_pTblAlignFT;
+ VclPtr<CheckBox> m_pHorzBox;
+ VclPtr<CheckBox> m_pVertBox;
// Impress and Draw
- CheckBox* m_pAdaptBox;
+ VclPtr<CheckBox> m_pAdaptBox;
//Register Writer
- CheckBox* m_pRegisterCB;
- FixedText* m_pRegisterFT;
- ListBox* m_pRegisterLB;
+ VclPtr<CheckBox> m_pRegisterCB;
+ VclPtr<FixedText> m_pRegisterFT;
+ VclPtr<ListBox> m_pRegisterLB;
OUString sStandardRegister;
- FixedText* m_pInsideLbl;
- FixedText* m_pOutsideLbl;
- FixedText* m_pPrintRangeQueryText;
+ VclPtr<FixedText> m_pInsideLbl;
+ VclPtr<FixedText> m_pOutsideLbl;
+ VclPtr<FixedText> m_pPrintRangeQueryText;
long nFirstLeftMargin;
long nFirstRightMargin;
@@ -140,7 +140,7 @@ private:
//UUUU SvxPage_Impl* pImpl;
MarginPosition m_nPos;
- Printer* mpDefPrinter;
+ VclPtr<Printer> mpDefPrinter;
bool mbDelPrinter : 1;
@@ -188,7 +188,7 @@ protected:
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
// returns the range of the Which values
static const sal_uInt16* GetRanges() { return pRanges; }
@@ -197,6 +197,7 @@ public:
virtual void FillUserData() SAL_OVERRIDE;
virtual ~SvxPageDescPage();
+ virtual void dispose() SAL_OVERRIDE;
void SetMode( SvxModeType eMType ) { eMode = eMType; }
void SetPaperFormatRanges( Paper eStart, Paper eEnd )
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index e0ca89f29da9..80b2536aed21 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -52,32 +52,32 @@ private:
SvxStdParagraphTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
// indention
- SvxRelativeField* m_pLeftIndent;
+ VclPtr<SvxRelativeField> m_pLeftIndent;
- FixedText* m_pRightLabel;
- SvxRelativeField* m_pRightIndent;
+ VclPtr<FixedText> m_pRightLabel;
+ VclPtr<SvxRelativeField> m_pRightIndent;
- FixedText* m_pFLineLabel;
- SvxRelativeField* m_pFLineIndent;
- CheckBox* m_pAutoCB;
+ VclPtr<FixedText> m_pFLineLabel;
+ VclPtr<SvxRelativeField> m_pFLineIndent;
+ VclPtr<CheckBox> m_pAutoCB;
// distance
- SvxRelativeField* m_pTopDist;
- SvxRelativeField* m_pBottomDist;
- CheckBox* m_pContextualCB;
+ VclPtr<SvxRelativeField> m_pTopDist;
+ VclPtr<SvxRelativeField> m_pBottomDist;
+ VclPtr<CheckBox> m_pContextualCB;
// line spacing
- ListBox* m_pLineDist;
- FixedText* m_pLineDistAtLabel;
- MetricField* m_pLineDistAtPercentBox;
- MetricField* m_pLineDistAtMetricBox;
- FixedText* m_pAbsDist;
+ VclPtr<ListBox> m_pLineDist;
+ VclPtr<FixedText> m_pLineDistAtLabel;
+ VclPtr<MetricField> m_pLineDistAtPercentBox;
+ VclPtr<MetricField> m_pLineDistAtMetricBox;
+ VclPtr<FixedText> m_pAbsDist;
OUString sAbsDist;
- SvxParaPrevWindow* m_pExampleWin;
+ VclPtr<SvxParaPrevWindow> m_pExampleWin;
// only writer
- VclFrame* m_pRegisterFL;
- CheckBox* m_pRegisterCB;
+ VclPtr<VclFrame> m_pRegisterFL;
+ VclPtr<CheckBox> m_pRegisterCB;
long nAbst;
long nWidth;
@@ -98,9 +98,12 @@ protected:
public:
+ virtual ~SvxStdParagraphTabPage();
+ virtual void dispose() SAL_OVERRIDE;
+
DECL_LINK(ELRLoseFocusHdl, void *);
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return pStdRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -115,8 +118,6 @@ public:
void EnableAbsLineDist(long nMinTwip);
void EnableNegativeMode();
virtual void PageCreated(const SfxAllItemSet& aSet) SAL_OVERRIDE;
-
- virtual ~SvxStdParagraphTabPage();
};
// class SvxParaAlignTabPage ------------------------------------------------
@@ -127,27 +128,27 @@ class SvxParaAlignTabPage : public SfxTabPage
static const sal_uInt16 pAlignRanges[];
// alignment
- RadioButton* m_pLeft;
- RadioButton* m_pRight;
- RadioButton* m_pCenter;
- RadioButton* m_pJustify;
- FixedText* m_pLeftBottom;
- FixedText* m_pRightTop;
+ VclPtr<RadioButton> m_pLeft;
+ VclPtr<RadioButton> m_pRight;
+ VclPtr<RadioButton> m_pCenter;
+ VclPtr<RadioButton> m_pJustify;
+ VclPtr<FixedText> m_pLeftBottom;
+ VclPtr<FixedText> m_pRightTop;
- FixedText* m_pLastLineFT;
- ListBox* m_pLastLineLB;
- CheckBox* m_pExpandCB;
+ VclPtr<FixedText> m_pLastLineFT;
+ VclPtr<ListBox> m_pLastLineLB;
+ VclPtr<CheckBox> m_pExpandCB;
- CheckBox* m_pSnapToGridCB;
+ VclPtr<CheckBox> m_pSnapToGridCB;
//preview
- SvxParaPrevWindow* m_pExampleWin;
+ VclPtr<SvxParaPrevWindow> m_pExampleWin;
//vertical alignment
- VclFrame* m_pVertAlignFL;
- ListBox* m_pVertAlignLB;
+ VclPtr<VclFrame> m_pVertAlignFL;
+ VclPtr<ListBox> m_pVertAlignLB;
- VclFrame* m_pPropertiesFL;
- svx::FrameDirectionListBox* m_pTextDirectionLB;
+ VclPtr<VclFrame> m_pPropertiesFL;
+ VclPtr<svx::FrameDirectionListBox> m_pTextDirectionLB;
DECL_LINK(AlignHdl_Impl, void *);
DECL_LINK(LastLineHdl_Impl, void *);
@@ -156,13 +157,15 @@ class SvxParaAlignTabPage : public SfxTabPage
void UpdateExample_Impl( bool bAll = false );
SvxParaAlignTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~SvxParaAlignTabPage();
protected:
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ virtual ~SvxParaAlignTabPage();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return pAlignRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -192,9 +195,10 @@ class SvxExtParagraphTabPage: public SfxTabPage
static const sal_uInt16 pExtRanges[];
public:
- virtual ~SvxExtParagraphTabPage();
+ virtual ~SvxExtParagraphTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return pExtRanges; }
@@ -210,37 +214,37 @@ private:
SvxExtParagraphTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
// hyphenation
- TriStateBox* m_pHyphenBox;
- FixedText* m_pBeforeText;
- NumericField* m_pExtHyphenBeforeBox;
- FixedText* m_pAfterText;
- NumericField* m_pExtHyphenAfterBox;
- FixedText* m_pMaxHyphenLabel;
- NumericField* m_pMaxHyphenEdit;
+ VclPtr<TriStateBox> m_pHyphenBox;
+ VclPtr<FixedText> m_pBeforeText;
+ VclPtr<NumericField> m_pExtHyphenBeforeBox;
+ VclPtr<FixedText> m_pAfterText;
+ VclPtr<NumericField> m_pExtHyphenAfterBox;
+ VclPtr<FixedText> m_pMaxHyphenLabel;
+ VclPtr<NumericField> m_pMaxHyphenEdit;
// pagebreak
- TriStateBox* m_pPageBreakBox;
- FixedText* m_pBreakTypeFT;
- ListBox* m_pBreakTypeLB;
- FixedText* m_pBreakPositionFT;
- ListBox* m_pBreakPositionLB;
- TriStateBox* m_pApplyCollBtn;
- ListBox* m_pApplyCollBox;
- FixedText* m_pPagenumText;
- NumericField* m_pPagenumEdit;
+ VclPtr<TriStateBox> m_pPageBreakBox;
+ VclPtr<FixedText> m_pBreakTypeFT;
+ VclPtr<ListBox> m_pBreakTypeLB;
+ VclPtr<FixedText> m_pBreakPositionFT;
+ VclPtr<ListBox> m_pBreakPositionLB;
+ VclPtr<TriStateBox> m_pApplyCollBtn;
+ VclPtr<ListBox> m_pApplyCollBox;
+ VclPtr<FixedText> m_pPagenumText;
+ VclPtr<NumericField> m_pPagenumEdit;
// paragraph division
- TriStateBox* m_pKeepTogetherBox;
- TriStateBox* m_pKeepParaBox;
+ VclPtr<TriStateBox> m_pKeepTogetherBox;
+ VclPtr<TriStateBox> m_pKeepParaBox;
// orphan/widow
- TriStateBox* m_pOrphanBox;
- NumericField* m_pOrphanRowNo;
- FixedText* m_pOrphanRowLabel;
+ VclPtr<TriStateBox> m_pOrphanBox;
+ VclPtr<NumericField> m_pOrphanRowNo;
+ VclPtr<FixedText> m_pOrphanRowLabel;
- TriStateBox* m_pWidowBox;
- NumericField* m_pWidowRowNo;
- FixedText* m_pWidowRowLabel;
+ VclPtr<TriStateBox> m_pWidowBox;
+ VclPtr<NumericField> m_pWidowRowNo;
+ VclPtr<FixedText> m_pWidowRowLabel;
bool bPageBreak;
bool bHtmlMode;
@@ -262,9 +266,9 @@ private:
class SvxAsianTabPage : public SfxTabPage
{
- CheckBox* m_pForbiddenRulesCB;
- CheckBox* m_pHangingPunctCB;
- CheckBox* m_pScriptSpaceCB;
+ VclPtr<CheckBox> m_pForbiddenRulesCB;
+ VclPtr<CheckBox> m_pHangingPunctCB;
+ VclPtr<CheckBox> m_pScriptSpaceCB;
SvxAsianTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
@@ -272,9 +276,9 @@ class SvxAsianTabPage : public SfxTabPage
public:
virtual ~SvxAsianTabPage();
+ virtual void dispose() SAL_OVERRIDE;
-
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rSet );
static const sal_uInt16* GetRanges();
diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx
index 9dd7aca1e11b..59fd9e479a78 100644
--- a/cui/source/inc/passwdomdlg.hxx
+++ b/cui/source/inc/passwdomdlg.hxx
@@ -40,6 +40,7 @@ public:
sal_uInt16 nMaxPasswdLen /* 0 -> no max len enforced */,
bool bIsPasswordToModify );
virtual ~PasswordToOpenModifyDialog();
+ virtual void dispose() SAL_OVERRIDE;
// AbstractPasswordToOpenModifyDialog
OUString GetPasswordToOpen() const;
diff --git a/cui/source/inc/pastedlg.hxx b/cui/source/inc/pastedlg.hxx
index 52332ac398ed..c634dc715a6b 100644
--- a/cui/source/inc/pastedlg.hxx
+++ b/cui/source/inc/pastedlg.hxx
@@ -39,9 +39,9 @@ class TransferableDataHelper;
class SvPasteObjectDialog : public ModalDialog
{
- FixedText* m_pFtObjectSource;
- ListBox* m_pLbInsertList;
- OKButton* m_pOKButton;
+ VclPtr<FixedText> m_pFtObjectSource;
+ VclPtr<ListBox> m_pLbInsertList;
+ VclPtr<OKButton> m_pOKButton;
::std::map< SotClipboardFormatId, OUString > aSupplementMap;
SvGlobalName aObjClassName;
OUString aObjName;
@@ -55,7 +55,8 @@ class SvPasteObjectDialog : public ModalDialog
public:
SvPasteObjectDialog( vcl::Window* pParent );
- virtual ~SvPasteObjectDialog();
+ virtual ~SvPasteObjectDialog();
+ virtual void dispose() SAL_OVERRIDE;
void Insert( SotClipboardFormatId nFormat, const OUString & rFormatName );
void SetObjName( const SvGlobalName & rClass, const OUString & rObjName );
diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx
index 624649689e6a..170e00692379 100644
--- a/cui/source/inc/postdlg.hxx
+++ b/cui/source/inc/postdlg.hxx
@@ -46,6 +46,7 @@ public:
SvxPostItDialog(vcl::Window* pParent, const SfxItemSet& rCoreSet,
bool bPrevNext = false);
virtual ~SvxPostItDialog();
+ virtual void dispose() SAL_OVERRIDE;
static const sal_uInt16* GetRanges();
const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
@@ -87,17 +88,17 @@ public:
}
private:
- FixedText* m_pLastEditFT;
+ VclPtr<FixedText> m_pLastEditFT;
- VclMultiLineEdit* m_pEditED;
+ VclPtr<VclMultiLineEdit> m_pEditED;
- VclContainer* m_pInsertAuthor;
- PushButton* m_pAuthorBtn;
+ VclPtr<VclContainer> m_pInsertAuthor;
+ VclPtr<PushButton> m_pAuthorBtn;
- OKButton* m_pOKBtn;
+ VclPtr<OKButton> m_pOKBtn;
- PushButton* m_pPrevBtn;
- PushButton* m_pNextBtn;
+ VclPtr<PushButton> m_pPrevBtn;
+ VclPtr<PushButton> m_pNextBtn;
const SfxItemSet& rSet;
SfxItemSet* pOutSet;
diff --git a/cui/source/inc/radiobtnbox.hxx b/cui/source/inc/radiobtnbox.hxx
index 1688bcd43905..7c31f340be54 100644
--- a/cui/source/inc/radiobtnbox.hxx
+++ b/cui/source/inc/radiobtnbox.hxx
@@ -39,7 +39,6 @@ protected:
public:
SvxRadioButtonListBox(SvSimpleTableContainer& rParent, WinBits nBits);
- virtual ~SvxRadioButtonListBox();
void HandleEntryChecked( SvTreeListEntry* _pEntry );
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index 8778123ed582..d3847dc6de62 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -77,6 +77,7 @@ public:
::com::sun::star::uno::Reference< com::sun::star::frame::XModel>& model );
SFTreeListBox(vcl::Window* pParent);
virtual ~SFTreeListBox();
+ virtual void dispose() SAL_OVERRIDE;
SvTreeListEntry * insertEntry(OUString const & rText, sal_uInt16 nBitmap,
SvTreeListEntry * pParent,
@@ -94,9 +95,11 @@ public:
class CuiInputDialog : public ModalDialog
{
private:
- Edit* m_pEdit;
+ VclPtr<Edit> m_pEdit;
public:
CuiInputDialog(vcl::Window * pParent, sal_uInt16 nMode);
+ virtual ~CuiInputDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetObjectName() const { return m_pEdit->GetText(); }
void SetObjectName(const OUString& rName)
@@ -131,14 +134,14 @@ public:
class SvxScriptOrgDialog : public SfxModalDialog
{
protected:
- SFTreeListBox* m_pScriptsBox;
+ VclPtr<SFTreeListBox> m_pScriptsBox;
- PushButton* m_pRunButton;
- CloseButton* m_pCloseButton;
- PushButton* m_pCreateButton;
- PushButton* m_pEditButton;
- PushButton* m_pRenameButton;
- PushButton* m_pDelButton;
+ VclPtr<PushButton> m_pRunButton;
+ VclPtr<CloseButton> m_pCloseButton;
+ VclPtr<PushButton> m_pCreateButton;
+ VclPtr<PushButton> m_pEditButton;
+ VclPtr<PushButton> m_pRenameButton;
+ VclPtr<PushButton> m_pDelButton;
OUString m_sLanguage;
static Selection_hash m_lastSelection;
@@ -175,6 +178,7 @@ public:
// to specify the language or provider
SvxScriptOrgDialog( vcl::Window* pParent, const OUString& language );
virtual ~SvxScriptOrgDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
diff --git a/cui/source/inc/selector.hxx b/cui/source/inc/selector.hxx
index b22b85e30f30..c1ac1e3f6b62 100644
--- a/cui/source/inc/selector.hxx
+++ b/cui/source/inc/selector.hxx
@@ -102,6 +102,7 @@ friend class SvxConfigGroupListBox;
public:
SvxConfigFunctionListBox(vcl::Window* pParent, WinBits nStyle);
virtual ~SvxConfigFunctionListBox();
+ virtual void dispose() SAL_OVERRIDE;
void ClearAll();
OUString GetHelpText( SvTreeListEntry *pEntry );
using Window::GetHelpText;
@@ -122,7 +123,7 @@ class SvxConfigGroupListBox : public SvTreeListBox
SvxGroupInfoArr_Impl aArr;
bool m_bShowSlots;
- SvxConfigFunctionListBox* pFunctionListBox;
+ VclPtr<SvxConfigFunctionListBox> pFunctionListBox;
ImageProvider* m_pImageProvider;
::com::sun::star::uno::Reference
@@ -162,6 +163,7 @@ protected:
public:
SvxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle);
virtual ~SvxConfigGroupListBox();
+ virtual void dispose() SAL_OVERRIDE;
void Init(bool bShowSlots, const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame >& xFrame);
@@ -179,12 +181,12 @@ public:
class SvxScriptSelectorDialog : public ModelessDialog
{
- FixedText* m_pDialogDescription;
- SvxConfigGroupListBox* m_pCategories;
- SvxConfigFunctionListBox* m_pCommands;
- PushButton* m_pOKButton;
- PushButton* m_pCancelButton;
- VclMultiLineEdit* m_pDescriptionText;
+ VclPtr<FixedText> m_pDialogDescription;
+ VclPtr<SvxConfigGroupListBox> m_pCategories;
+ VclPtr<SvxConfigFunctionListBox> m_pCommands;
+ VclPtr<PushButton> m_pOKButton;
+ VclPtr<PushButton> m_pCancelButton;
+ VclPtr<VclMultiLineEdit> m_pDescriptionText;
OUString m_sDefaultDesc;
bool m_bShowSlots;
Link m_aAddHdl;
@@ -203,8 +205,8 @@ public:
const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame >& xFrame = 0
);
-
- virtual ~SvxScriptSelectorDialog ( );
+ virtual ~SvxScriptSelectorDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetAddHdl( const Link& rLink ) { m_aAddHdl = rLink; }
const Link& GetAddHdl() const { return m_aAddHdl; }
diff --git a/cui/source/inc/showcols.hxx b/cui/source/inc/showcols.hxx
index dceddb7e3a00..d7494d72896b 100644
--- a/cui/source/inc/showcols.hxx
+++ b/cui/source/inc/showcols.hxx
@@ -35,13 +35,15 @@
class FmShowColsDialog : public ModalDialog
{
- ListBox* m_pList;
- OKButton* m_pOK;
+ VclPtr<ListBox> m_pList;
+ VclPtr<OKButton> m_pOK;
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xColumns;
public:
FmShowColsDialog(vcl::Window* pParent);
+ virtual ~FmShowColsDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols);
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
index 212559f32968..9d727d1583f1 100644
--- a/cui/source/inc/splitcelldlg.hxx
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -26,17 +26,16 @@
#include <svx/stddlg.hxx>
#include <svx/svxdlg.hxx>
-class SvxSplitTableDlg : public SvxAbstractSplittTableDialog, public SvxStandardDialog
+class SvxSplitTableDlg : public SvxAbstractSplittTableDialog
{
- NumericField* m_pCountEdit;
- RadioButton* m_pHorzBox;
- RadioButton* m_pVertBox;
- CheckBox* m_pPropCB;
+ VclPtr<SvxStandardDialog> m_pDialog;
+ VclPtr<NumericField> m_pCountEdit;
+ VclPtr<RadioButton> m_pHorzBox;
+ VclPtr<RadioButton> m_pVertBox;
+ VclPtr<CheckBox> m_pPropCB;
long mnMaxVertical;
long mnMaxHorizontal;
-protected:
- virtual void Apply() SAL_OVERRIDE;
public:
SvxSplitTableDlg(vcl::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal );
diff --git a/cui/source/inc/srchxtra.hxx b/cui/source/inc/srchxtra.hxx
index 0965484c9c45..f1c6aefde1a9 100644
--- a/cui/source/inc/srchxtra.hxx
+++ b/cui/source/inc/srchxtra.hxx
@@ -31,6 +31,7 @@ class SvxSearchFormatDialog : public SfxTabDialog
public:
SvxSearchFormatDialog( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxSearchFormatDialog();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE;
@@ -50,10 +51,12 @@ class SvxSearchAttributeDialog : public ModalDialog
public:
SvxSearchAttributeDialog( vcl::Window* pParent, SearchAttrItemList& rLst,
const sal_uInt16* pWhRanges );
+ virtual ~SvxSearchAttributeDialog();
+ virtual void dispose() SAL_OVERRIDE;
private:
- SvxCheckListBox* m_pAttrLB;
- OKButton* m_pOKBtn;
+ VclPtr<SvxCheckListBox> m_pAttrLB;
+ VclPtr<OKButton> m_pOKBtn;
SearchAttrItemList& rList;
@@ -65,10 +68,10 @@ private:
class SvxSearchSimilarityDialog : public ModalDialog
{
private:
- NumericField* m_pOtherFld;
- NumericField* m_pLongerFld;
- NumericField* m_pShorterFld;
- CheckBox* m_pRelaxBox;
+ VclPtr<NumericField> m_pOtherFld;
+ VclPtr<NumericField> m_pLongerFld;
+ VclPtr<NumericField> m_pShorterFld;
+ VclPtr<CheckBox> m_pRelaxBox;
public:
SvxSearchSimilarityDialog( vcl::Window* pParent,
@@ -76,6 +79,8 @@ public:
sal_uInt16 nOther,
sal_uInt16 nShorter,
sal_uInt16 nLonger );
+ virtual ~SvxSearchSimilarityDialog();
+ virtual void dispose() SAL_OVERRIDE;
sal_uInt16 GetOther() { return (sal_uInt16)m_pOtherFld->GetValue(); }
sal_uInt16 GetShorter() { return (sal_uInt16)m_pShorterFld->GetValue(); }
diff --git a/cui/source/inc/swpossizetabpage.hxx b/cui/source/inc/swpossizetabpage.hxx
index d293468214e7..e1db4048acc7 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -34,39 +34,39 @@ class SvxSwPosSizeTabPage : public SfxTabPage
{
using TabPage::DeactivatePage;
- MetricField* m_pWidthMF;
- MetricField* m_pHeightMF;
- CheckBox* m_pKeepRatioCB;
+ VclPtr<MetricField> m_pWidthMF;
+ VclPtr<MetricField> m_pHeightMF;
+ VclPtr<CheckBox> m_pKeepRatioCB;
- RadioButton* m_pToPageRB;
- RadioButton* m_pToParaRB;
- RadioButton* m_pToCharRB;
- RadioButton* m_pAsCharRB;
- RadioButton* m_pToFrameRB;
+ VclPtr<RadioButton> m_pToPageRB;
+ VclPtr<RadioButton> m_pToParaRB;
+ VclPtr<RadioButton> m_pToCharRB;
+ VclPtr<RadioButton> m_pAsCharRB;
+ VclPtr<RadioButton> m_pToFrameRB;
- TriStateBox* m_pPositionCB;
- TriStateBox* m_pSizeCB;
+ VclPtr<TriStateBox> m_pPositionCB;
+ VclPtr<TriStateBox> m_pSizeCB;
- VclContainer* m_pPosFrame;
- FixedText* m_pHoriFT;
- ListBox* m_pHoriLB;
- FixedText* m_pHoriByFT;
- MetricField* m_pHoriByMF;
- FixedText* m_pHoriToFT;
- ListBox* m_pHoriToLB;
+ VclPtr<VclContainer> m_pPosFrame;
+ VclPtr<FixedText> m_pHoriFT;
+ VclPtr<ListBox> m_pHoriLB;
+ VclPtr<FixedText> m_pHoriByFT;
+ VclPtr<MetricField> m_pHoriByMF;
+ VclPtr<FixedText> m_pHoriToFT;
+ VclPtr<ListBox> m_pHoriToLB;
- CheckBox* m_pHoriMirrorCB;
+ VclPtr<CheckBox> m_pHoriMirrorCB;
- FixedText* m_pVertFT;
- ListBox* m_pVertLB;
- FixedText* m_pVertByFT;
- MetricField* m_pVertByMF;
- FixedText* m_pVertToFT;
- ListBox* m_pVertToLB;
+ VclPtr<FixedText> m_pVertFT;
+ VclPtr<ListBox> m_pVertLB;
+ VclPtr<FixedText> m_pVertByFT;
+ VclPtr<MetricField> m_pVertByMF;
+ VclPtr<FixedText> m_pVertToFT;
+ VclPtr<ListBox> m_pVertToLB;
- CheckBox* m_pFollowCB;
+ VclPtr<CheckBox> m_pFollowCB;
- SvxSwFrameExample* m_pExampleWN;
+ VclPtr<SvxSwFrameExample> m_pExampleWN;
Link m_aValidateLink;
@@ -124,8 +124,9 @@ class SvxSwPosSizeTabPage : public SfxTabPage
public:
SvxSwPosSizeTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SvxSwPosSizeTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges();
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
index 39c761a5b15e..05903afd03a4 100644
--- a/cui/source/inc/tabstpge.hxx
+++ b/cui/source/inc/tabstpge.hxx
@@ -50,8 +50,8 @@ class SvxTabulatorTabPage : public SfxTabPage
public:
virtual ~SvxTabulatorTabPage();
-
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -66,34 +66,34 @@ private:
SvxTabulatorTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
// tabulators and positions
- MetricBox* m_pTabBox;
+ VclPtr<MetricBox> m_pTabBox;
// TabType
- RadioButton* m_pLeftTab;
- RadioButton* m_pRightTab;
- RadioButton* m_pCenterTab;
- RadioButton* m_pDezTab;
-
- TabWin_Impl* m_pLeftWin;
- TabWin_Impl* m_pRightWin;
- TabWin_Impl* m_pCenterWin;
- TabWin_Impl* m_pDezWin;
-
- FixedText* m_pDezCharLabel;
- Edit* m_pDezChar;
-
- RadioButton* m_pNoFillChar;
- RadioButton* m_pFillPoints;
- RadioButton* m_pFillDashLine ;
- RadioButton* m_pFillSolidLine;
- RadioButton* m_pFillSpecial;
- Edit* m_pFillChar;
-
- PushButton* m_pNewBtn;
- PushButton* m_pDelAllBtn;
- PushButton* m_pDelBtn;
-
- VclContainer* m_pTypeFrame;
- VclContainer* m_pFillFrame;
+ VclPtr<RadioButton> m_pLeftTab;
+ VclPtr<RadioButton> m_pRightTab;
+ VclPtr<RadioButton> m_pCenterTab;
+ VclPtr<RadioButton> m_pDezTab;
+
+ VclPtr<TabWin_Impl> m_pLeftWin;
+ VclPtr<TabWin_Impl> m_pRightWin;
+ VclPtr<TabWin_Impl> m_pCenterWin;
+ VclPtr<TabWin_Impl> m_pDezWin;
+
+ VclPtr<FixedText> m_pDezCharLabel;
+ VclPtr<Edit> m_pDezChar;
+
+ VclPtr<RadioButton> m_pNoFillChar;
+ VclPtr<RadioButton> m_pFillPoints;
+ VclPtr<RadioButton> m_pFillDashLine ;
+ VclPtr<RadioButton> m_pFillSolidLine;
+ VclPtr<RadioButton> m_pFillSpecial;
+ VclPtr<Edit> m_pFillChar;
+
+ VclPtr<PushButton> m_pNewBtn;
+ VclPtr<PushButton> m_pDelAllBtn;
+ VclPtr<PushButton> m_pDelBtn;
+
+ VclPtr<VclContainer> m_pTypeFrame;
+ VclPtr<VclContainer> m_pFillFrame;
// local variables, internal functions
SvxTabStop aAktTab;
diff --git a/cui/source/inc/textanim.hxx b/cui/source/inc/textanim.hxx
index 2f1031d3d572..875b4d2a087f 100644
--- a/cui/source/inc/textanim.hxx
+++ b/cui/source/inc/textanim.hxx
@@ -37,27 +37,28 @@ class SdrView;
class SvxTextAnimationPage : public SfxTabPage
{
private:
- static const sal_uInt16 pRanges[];
- ListBox* m_pLbEffect;
- VclBox* m_pBoxDirection;
- PushButton* m_pBtnUp;
- PushButton* m_pBtnLeft;
- PushButton* m_pBtnRight;
- PushButton* m_pBtnDown;
+ static const sal_uInt16 pRanges[];
- VclFrame* m_pFlProperties;
- TriStateBox* m_pTsbStartInside;
- TriStateBox* m_pTsbStopInside;
+ VclPtr<ListBox> m_pLbEffect;
+ VclPtr<VclBox> m_pBoxDirection;
+ VclPtr<PushButton> m_pBtnUp;
+ VclPtr<PushButton> m_pBtnLeft;
+ VclPtr<PushButton> m_pBtnRight;
+ VclPtr<PushButton> m_pBtnDown;
- VclBox* m_pBoxCount;
- TriStateBox* m_pTsbEndless;
- NumericField* m_pNumFldCount;
+ VclPtr<VclFrame> m_pFlProperties;
+ VclPtr<TriStateBox> m_pTsbStartInside;
+ VclPtr<TriStateBox> m_pTsbStopInside;
- TriStateBox* m_pTsbPixel;
- MetricField* m_pMtrFldAmount;
+ VclPtr<VclBox> m_pBoxCount;
+ VclPtr<TriStateBox> m_pTsbEndless;
+ VclPtr<NumericField> m_pNumFldCount;
- TriStateBox* m_pTsbAuto;
- MetricField* m_pMtrFldDelay;
+ VclPtr<TriStateBox> m_pTsbPixel;
+ VclPtr<MetricField> m_pMtrFldAmount;
+
+ VclPtr<TriStateBox> m_pTsbAuto;
+ VclPtr<MetricField> m_pMtrFldDelay;
const SfxItemSet& rOutAttrs;
SdrTextAniKind eAniKind;
@@ -76,8 +77,9 @@ private:
public:
SvxTextAnimationPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
virtual ~SvxTextAnimationPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
@@ -104,7 +106,6 @@ public:
SvxTextTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
const SdrView* pView );
- virtual ~SvxTextTabDialog() {};
};
diff --git a/cui/source/inc/textattr.hxx b/cui/source/inc/textattr.hxx
index 6c309a329b92..881f3fd4837c 100644
--- a/cui/source/inc/textattr.hxx
+++ b/cui/source/inc/textattr.hxx
@@ -38,22 +38,23 @@ class SvxTextAttrPage : public SvxTabPage
{
private:
static const sal_uInt16 pRanges[];
- TriStateBox* m_pTsbAutoGrowWidth;
- TriStateBox* m_pTsbAutoGrowHeight;
- TriStateBox* m_pTsbFitToSize;
- TriStateBox* m_pTsbContour;
- TriStateBox* m_pTsbWordWrapText;
- TriStateBox* m_pTsbAutoGrowSize;
-
- VclFrame* m_pFlDistance;
- MetricField* m_pMtrFldLeft;
- MetricField* m_pMtrFldRight;
- MetricField* m_pMtrFldTop;
- MetricField* m_pMtrFldBottom;
-
- VclFrame* m_pFlPosition;
- SvxRectCtl* m_pCtlPosition;
- TriStateBox* m_pTsbFullWidth;
+
+ VclPtr<TriStateBox> m_pTsbAutoGrowWidth;
+ VclPtr<TriStateBox> m_pTsbAutoGrowHeight;
+ VclPtr<TriStateBox> m_pTsbFitToSize;
+ VclPtr<TriStateBox> m_pTsbContour;
+ VclPtr<TriStateBox> m_pTsbWordWrapText;
+ VclPtr<TriStateBox> m_pTsbAutoGrowSize;
+
+ VclPtr<VclFrame> m_pFlDistance;
+ VclPtr<MetricField> m_pMtrFldLeft;
+ VclPtr<MetricField> m_pMtrFldRight;
+ VclPtr<MetricField> m_pMtrFldTop;
+ VclPtr<MetricField> m_pMtrFldBottom;
+
+ VclPtr<VclFrame> m_pFlPosition;
+ VclPtr<SvxRectCtl> m_pCtlPosition;
+ VclPtr<TriStateBox> m_pTsbFullWidth;
const SfxItemSet& rOutAttrs;
const SdrView* pView;
@@ -77,8 +78,9 @@ public:
SvxTextAttrPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
virtual ~SvxTextAttrPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx
index a2dcc8580118..661788124c3f 100644
--- a/cui/source/inc/thesdlg.hxx
+++ b/cui/source/inc/thesdlg.hxx
@@ -35,7 +35,7 @@ class SvxThesaurusDialog;
class LookUpComboBox : public ComboBox
{
Idle m_aModifyIdle;
- SvxThesaurusDialog* m_pDialog;
+ VclPtr<SvxThesaurusDialog> m_pDialog;
LookUpComboBox( const LookUpComboBox & ) SAL_DELETED_FUNCTION;
LookUpComboBox& operator = ( const LookUpComboBox & ) SAL_DELETED_FUNCTION;
@@ -43,6 +43,7 @@ class LookUpComboBox : public ComboBox
public:
LookUpComboBox(vcl::Window *pParent);
virtual ~LookUpComboBox();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK( ModifyTimer_Hdl, Timer * );
@@ -72,7 +73,7 @@ public:
class ThesaurusAlternativesCtrl
: public SvxCheckListBox
{
- SvxThesaurusDialog* m_pDialog;
+ VclPtr<SvxThesaurusDialog> m_pDialog;
typedef std::map< const SvTreeListEntry *, AlternativesExtraData > UserDataMap_t;
UserDataMap_t m_aUserData;
@@ -85,7 +86,7 @@ public:
void init(SvxThesaurusDialog *pDialog);
virtual ~ThesaurusAlternativesCtrl();
-
+ virtual void dispose() SAL_OVERRIDE;
SvTreeListEntry * AddEntry( sal_Int32 nVal, const OUString &rText, bool bIsHeader );
@@ -99,7 +100,7 @@ public:
class ReplaceEdit : public Edit
{
- Button * m_pBtn;
+ VclPtr<Button> m_pBtn;
ReplaceEdit( const ReplaceEdit & ) SAL_DELETED_FUNCTION;
ReplaceEdit & operator = ( const ReplaceEdit & ) SAL_DELETED_FUNCTION;
@@ -107,6 +108,7 @@ class ReplaceEdit : public Edit
public:
ReplaceEdit(vcl::Window *pParent);
virtual ~ReplaceEdit();
+ virtual void dispose() SAL_OVERRIDE;
void init(Button *pBtn) { m_pBtn = pBtn; }
@@ -118,11 +120,11 @@ public:
class SvxThesaurusDialog : public SvxStandardDialog
{
- PushButton* m_pLeftBtn;
- LookUpComboBox* m_pWordCB;
- ThesaurusAlternativesCtrl* m_pAlternativesCT;
- ReplaceEdit* m_pReplaceEdit;
- ListBox* m_pLangLB;
+ VclPtr<PushButton> m_pLeftBtn;
+ VclPtr<LookUpComboBox> m_pWordCB;
+ VclPtr<ThesaurusAlternativesCtrl> m_pAlternativesCT;
+ VclPtr<ReplaceEdit> m_pReplaceEdit;
+ VclPtr<ListBox> m_pLangLB;
OUString m_aErrStr;
@@ -133,6 +135,9 @@ class SvxThesaurusDialog : public SvxStandardDialog
bool m_bWordFound;
public:
+ virtual ~SvxThesaurusDialog();
+ virtual void dispose() SAL_OVERRIDE;
+
bool WordFound() const { return m_bWordFound; }
OUString getErrStr() const { return m_aErrStr; }
@@ -159,7 +164,6 @@ public:
SvxThesaurusDialog( vcl::Window* pParent,
css::uno::Reference< css::linguistic2::XThesaurus > xThesaurus,
const OUString &rWord, LanguageType nLanguage );
- virtual ~SvxThesaurusDialog();
void SetWindowTitle( LanguageType nLanguage );
OUString GetWord();
diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx
index ccc70d1b349b..52489521102e 100644
--- a/cui/source/inc/transfrm.hxx
+++ b/cui/source/inc/transfrm.hxx
@@ -62,7 +62,6 @@ public:
SvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
const SdrView* pView,
sal_uInt16 nAnchorTypes = 0);
- virtual ~SvxTransformTabDialog();
//link for the Writer to validate positions
void SetValidateFramePosLink( const Link& rLink );
@@ -82,29 +81,29 @@ class SvxPositionSizeTabPage : public SvxTabPage
private:
// position
- VclFrame* m_pFlPosition;
- MetricField* m_pMtrPosX;
- MetricField* m_pMtrPosY;
- SvxRectCtl* m_pCtlPos;
+ VclPtr<VclFrame> m_pFlPosition;
+ VclPtr<MetricField> m_pMtrPosX;
+ VclPtr<MetricField> m_pMtrPosY;
+ VclPtr<SvxRectCtl> m_pCtlPos;
// size
- VclFrame* m_pFlSize;
- FixedText* m_pFtWidth;
- MetricField* m_pMtrWidth;
- FixedText* m_pFtHeight;
- MetricField* m_pMtrHeight;
- CheckBox* m_pCbxScale;
- SvxRectCtl* m_pCtlSize;
+ VclPtr<VclFrame> m_pFlSize;
+ VclPtr<FixedText> m_pFtWidth;
+ VclPtr<MetricField> m_pMtrWidth;
+ VclPtr<FixedText> m_pFtHeight;
+ VclPtr<MetricField> m_pMtrHeight;
+ VclPtr<CheckBox> m_pCbxScale;
+ VclPtr<SvxRectCtl> m_pCtlSize;
// protect
- VclFrame* m_pFlProtect;
- TriStateBox* m_pTsbPosProtect;
- TriStateBox* m_pTsbSizeProtect;
+ VclPtr<VclFrame> m_pFlProtect;
+ VclPtr<TriStateBox> m_pTsbPosProtect;
+ VclPtr<TriStateBox> m_pTsbSizeProtect;
// adjust
- VclFrame* m_pFlAdjust;
- TriStateBox* m_pTsbAutoGrowWidth;
- TriStateBox* m_pTsbAutoGrowHeight;
+ VclPtr<VclFrame> m_pFlAdjust;
+ VclPtr<TriStateBox> m_pTsbAutoGrowWidth;
+ VclPtr<TriStateBox> m_pTsbAutoGrowHeight;
private:
const SfxItemSet& mrOutAttrs;
@@ -147,8 +146,10 @@ private:
public:
SvxPositionSizeTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxPositionSizeTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pPosSizeRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
@@ -182,14 +183,14 @@ class SvxAngleTabPage : public SvxTabPage
static const sal_uInt16 pAngleRanges[];
private:
- VclFrame* m_pFlPosition;
- MetricField* m_pMtrPosX;
- MetricField* m_pMtrPosY;
- SvxRectCtl* m_pCtlRect;
+ VclPtr<VclFrame> m_pFlPosition;
+ VclPtr<MetricField> m_pMtrPosX;
+ VclPtr<MetricField> m_pMtrPosY;
+ VclPtr<SvxRectCtl> m_pCtlRect;
- VclFrame* m_pFlAngle;
- NumericField* m_pNfAngle;
- svx::DialControl* m_pCtlAngle;
+ VclPtr<VclFrame> m_pFlAngle;
+ VclPtr<NumericField> m_pNfAngle;
+ VclPtr<svx::DialControl> m_pCtlAngle;
const SfxItemSet& rOutAttrs;
const SdrView* pView;
@@ -203,8 +204,10 @@ private:
public:
SvxAngleTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxAngleTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pAngleRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
@@ -231,10 +234,10 @@ class SvxSlantTabPage : public SvxTabPage
static const sal_uInt16 pSlantRanges[];
private:
- VclFrame* m_pFlRadius;
- MetricField* m_pMtrRadius;
- VclFrame* m_pFlAngle;
- MetricField* m_pMtrAngle;
+ VclPtr<VclFrame> m_pFlRadius;
+ VclPtr<MetricField> m_pMtrRadius;
+ VclPtr<VclFrame> m_pFlAngle;
+ VclPtr<MetricField> m_pMtrAngle;
const SfxItemSet& rOutAttrs;
@@ -248,8 +251,10 @@ private:
public:
SvxSlantTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxSlantTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pSlantRanges; }
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 2fa0d064ef9c..78b63bd68761 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -146,18 +146,18 @@ private:
SvTreeListEntry* pCurrentPageEntry;
bool hasTreePendingLayout() const;
- OKButton* pOkPB;
- PushButton* pBackPB;
+ VclPtr<OKButton> pOkPB;
+ VclPtr<PushButton> pBackPB;
- SvTreeListBox* pTreeLB;
- VclBox* pTabBox;
+ VclPtr<SvTreeListBox> pTreeLB;
+ VclPtr<VclBox> pTabBox;
OUString sTitle;
OUString sNotLoadedError;
// for the ColorTabPage
SfxItemSet* pColorPageItemSet;
- SvxColorTabPage *mpColorPage;
+ VclPtr<SvxColorTabPage> mpColorPage;
bool bForgetSelection;
bool bIsFromExtensionManager;
@@ -200,6 +200,7 @@ public:
bool bActivateLastSelection = true );
OfaTreeOptionsDialog( vcl::Window* pParent, const OUString& rExtensionId );
virtual ~OfaTreeOptionsDialog();
+ virtual void dispose() SAL_OVERRIDE;
OptionsPageInfo* AddTabPage( sal_uInt16 nId, const OUString& rPageName, sal_uInt16 nGroup );
sal_uInt16 AddGroup( const OUString& rGroupName, SfxShell* pCreateShell,
@@ -277,6 +278,7 @@ public:
com::sun::star::awt::XContainerWindowProvider >& rProvider );
virtual ~ExtensionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual void DeactivatePage() SAL_OVERRIDE;
diff --git a/cui/source/inc/zoom.hxx b/cui/source/inc/zoom.hxx
index 3cccaceb49e8..882be467f95d 100644
--- a/cui/source/inc/zoom.hxx
+++ b/cui/source/inc/zoom.hxx
@@ -27,21 +27,21 @@
class SvxZoomDialog : public SfxModalDialog
{
private:
- RadioButton* m_pOptimalBtn;
- RadioButton* m_pWholePageBtn;
- RadioButton* m_pPageWidthBtn;
- RadioButton* m_p100Btn;
- RadioButton* m_pUserBtn;
- MetricField* m_pUserEdit;
+ VclPtr<RadioButton> m_pOptimalBtn;
+ VclPtr<RadioButton> m_pWholePageBtn;
+ VclPtr<RadioButton> m_pPageWidthBtn;
+ VclPtr<RadioButton> m_p100Btn;
+ VclPtr<RadioButton> m_pUserBtn;
+ VclPtr<MetricField> m_pUserEdit;
- VclContainer* m_pViewFrame;
- RadioButton* m_pAutomaticBtn;
- RadioButton* m_pSingleBtn;
- RadioButton* m_pColumnsBtn;
- NumericField* m_pColumnsEdit;
- CheckBox* m_pBookModeChk;
+ VclPtr<VclContainer> m_pViewFrame;
+ VclPtr<RadioButton> m_pAutomaticBtn;
+ VclPtr<RadioButton> m_pSingleBtn;
+ VclPtr<RadioButton> m_pColumnsBtn;
+ VclPtr<NumericField> m_pColumnsEdit;
+ VclPtr<CheckBox> m_pBookModeChk;
- OKButton* m_pOKBtn;
+ VclPtr<OKButton> m_pOKBtn;
const SfxItemSet& mrSet;
std::unique_ptr<SfxItemSet> mpOutSet;
@@ -57,6 +57,7 @@ private:
public:
SvxZoomDialog(vcl::Window* pParent, const SfxItemSet& rCoreSet);
virtual ~SvxZoomDialog();
+ virtual void dispose() SAL_OVERRIDE;
const SfxItemSet* GetOutputItemSet() const;
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index bfe416952d7d..10c2ebc1bf90 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -35,7 +35,7 @@ CertPathDialog::CertPathDialog(vcl::Window* pParent)
m_pCertPathListContainer->set_width_request(aSize.Width());
m_pCertPathListContainer->set_height_request(aSize.Height());
m_pCertPathList =
- new svx::SvxRadioButtonListBox(*m_pCertPathListContainer, 0);
+ VclPtr<svx::SvxRadioButtonListBox>::Create(*m_pCertPathListContainer, 0);
m_sAddDialogText = get<FixedText>("certdir")->GetText();
m_sManual = get<FixedText>("manual")->GetText();
@@ -144,6 +144,11 @@ OUString CertPathDialog::getDirectory() const
CertPathDialog::~CertPathDialog()
{
+ disposeOnce();
+}
+
+void CertPathDialog::dispose()
+{
SvTreeListEntry* pEntry = m_pCertPathList->First();
while (pEntry)
{
@@ -151,7 +156,11 @@ CertPathDialog::~CertPathDialog()
delete pCertPath;
pEntry = m_pCertPathList->Next( pEntry );
}
- delete m_pCertPathList;
+ m_pCertPathList.disposeAndClear();
+ m_pCertPathListContainer.clear();
+ m_pAddBtn.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
}
IMPL_LINK( CertPathDialog, CheckHdl_Impl, SvSimpleTable *, pList )
diff --git a/cui/source/options/certpath.hxx b/cui/source/options/certpath.hxx
index bdc083c987d8..29a3e1aa45fb 100644
--- a/cui/source/options/certpath.hxx
+++ b/cui/source/options/certpath.hxx
@@ -19,10 +19,10 @@
class CertPathDialog : public ModalDialog
{
private:
- SvSimpleTableContainer* m_pCertPathListContainer;
- svx::SvxRadioButtonListBox* m_pCertPathList;
- PushButton* m_pAddBtn;
- OKButton* m_pOKBtn;
+ VclPtr<SvSimpleTableContainer> m_pCertPathListContainer;
+ VclPtr<svx::SvxRadioButtonListBox> m_pCertPathList;
+ VclPtr<PushButton> m_pAddBtn;
+ VclPtr<OKButton> m_pOKBtn;
OUString m_sAddDialogText;
OUString m_sManual;
@@ -35,6 +35,7 @@ private:
public:
CertPathDialog(vcl::Window* pParent);
virtual ~CertPathDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString getDirectory() const;
};
diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx
index 058f9a69c917..b162898bc97c 100644
--- a/cui/source/options/connpooloptions.cxx
+++ b/cui/source/options/connpooloptions.cxx
@@ -326,12 +326,28 @@ namespace offapp
m_pDriverList->SetRowChangeHandler( LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged) );
}
+ ConnectionPoolOptionsPage::~ConnectionPoolOptionsPage()
+ {
+ disposeOnce();
+ }
- SfxTabPage* ConnectionPoolOptionsPage::Create(vcl::Window* _pParent, const SfxItemSet* _rAttrSet)
+ void ConnectionPoolOptionsPage::dispose()
{
- return new ConnectionPoolOptionsPage(_pParent, *_rAttrSet);
+ m_pEnablePooling.clear();
+ m_pDriversLabel.clear();
+ m_pDriverList.clear();
+ m_pDriverLabel.clear();
+ m_pDriver.clear();
+ m_pDriverPoolingEnabled.clear();
+ m_pTimeoutLabel.clear();
+ m_pTimeout.clear();
+ SfxTabPage::dispose();
}
+ VclPtr<SfxTabPage> ConnectionPoolOptionsPage::Create(vcl::Window* _pParent, const SfxItemSet* _rAttrSet)
+ {
+ return VclPtr<ConnectionPoolOptionsPage>::Create(_pParent, *_rAttrSet);
+ }
void ConnectionPoolOptionsPage::implInitControls(const SfxItemSet& _rSet, bool /*_bFromReset*/)
{
diff --git a/cui/source/options/connpooloptions.hxx b/cui/source/options/connpooloptions.hxx
index 868c42702a16..d8e4c2556df8 100644
--- a/cui/source/options/connpooloptions.hxx
+++ b/cui/source/options/connpooloptions.hxx
@@ -38,20 +38,20 @@ namespace offapp
using TabPage::ActivatePage;
protected:
- CheckBox* m_pEnablePooling;
- FixedText* m_pDriversLabel;
- DriverListControl* m_pDriverList;
- FixedText* m_pDriverLabel;
- FixedText* m_pDriver;
- CheckBox* m_pDriverPoolingEnabled;
- FixedText* m_pTimeoutLabel;
- NumericField* m_pTimeout;
-
- protected:
- ConnectionPoolOptionsPage(vcl::Window* _pParent, const SfxItemSet& _rAttrSet);
+ VclPtr<CheckBox> m_pEnablePooling;
+ VclPtr<FixedText> m_pDriversLabel;
+ VclPtr<DriverListControl> m_pDriverList;
+ VclPtr<FixedText> m_pDriverLabel;
+ VclPtr<FixedText> m_pDriver;
+ VclPtr<CheckBox> m_pDriverPoolingEnabled;
+ VclPtr<FixedText> m_pTimeoutLabel;
+ VclPtr<NumericField> m_pTimeout;
public:
- static SfxTabPage* Create(vcl::Window* _pParent, const SfxItemSet* _rAttrSet);
+ ConnectionPoolOptionsPage(vcl::Window* _pParent, const SfxItemSet& _rAttrSet);
+ virtual ~ConnectionPoolOptionsPage();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create(vcl::Window* _pParent, const SfxItemSet* _rAttrSet);
protected:
virtual bool Notify( NotifyEvent& _rNEvt ) SAL_OVERRIDE;
diff --git a/cui/source/options/cuisrchdlg.cxx b/cui/source/options/cuisrchdlg.cxx
index a7041604683b..bff4d1a74c8e 100644
--- a/cui/source/options/cuisrchdlg.cxx
+++ b/cui/source/options/cuisrchdlg.cxx
@@ -54,12 +54,24 @@ SvxJSearchOptionsDialog::SvxJSearchOptionsDialog(vcl::Window *pParent,
{
// pPage will be implicitly destroyed by the
// SfxSingleTabDialog destructor
- pPage = static_cast<SvxJSearchOptionsPage *>(
- SvxJSearchOptionsPage::Create(get_content_area(), &rOptionsSet ));
+ pPage.reset( static_cast<SvxJSearchOptionsPage *>(
+ SvxJSearchOptionsPage::Create(
+ get_content_area(), &rOptionsSet ).get() ) );
SetTabPage( pPage ); //! implicitly calls pPage->Reset(...)!
pPage->EnableSaveOptions(false);
}
+SvxJSearchOptionsDialog::~SvxJSearchOptionsDialog()
+{
+ disposeOnce();
+}
+
+void SvxJSearchOptionsDialog::dispose()
+{
+ pPage.clear();
+ SfxSingleTabDialog::dispose();
+}
+
void SvxJSearchOptionsDialog::Activate()
{
pPage->SetTransliterationFlags( nInitialTlFlags );
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index c99defce27d0..5d834e297cdf 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -78,15 +78,11 @@ DatabaseRegistrationDialog::DatabaseRegistrationDialog( vcl::Window* pParent, co
: RegistrationItemSetHolder(rInAttrs)
, SfxSingleTabDialog(pParent, getRegistrationItems())
{
- SfxTabPage* page = DbRegistrationOptionsPage::Create(get_content_area(), &getRegistrationItems());
+ VclPtr<SfxTabPage> page = DbRegistrationOptionsPage::Create(get_content_area(), &getRegistrationItems());
SetTabPage(page);
SetText(page->get<VclFrame>("frame1")->get_label());
}
-DatabaseRegistrationDialog::~DatabaseRegistrationDialog()
-{
-}
-
short DatabaseRegistrationDialog::Execute()
{
short result = SfxSingleTabDialog::Execute();
@@ -167,17 +163,27 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage( vcl::Window* pParent, cons
DbRegistrationOptionsPage::~DbRegistrationOptionsPage()
{
+ disposeOnce();
+}
+
+void DbRegistrationOptionsPage::dispose()
+{
for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
delete static_cast< DatabaseRegistration* >( pPathBox->GetEntry(i)->GetUserData() );
- delete pPathBox;
+ pPathBox.disposeAndClear();
+ m_pPathCtrl.clear();
+ m_pNew.clear();
+ m_pEdit.clear();
+ m_pDelete.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* DbRegistrationOptionsPage::Create( vcl::Window* pParent,
+VclPtr<SfxTabPage> DbRegistrationOptionsPage::Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet )
{
- return ( new DbRegistrationOptionsPage( pParent, *rAttrSet ) );
+ return VclPtr<DbRegistrationOptionsPage>::Create( pParent, *rAttrSet );
}
@@ -272,8 +278,8 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, DeleteHdl)
SvTreeListEntry* pEntry = pPathBox->FirstSelected();
if ( pEntry )
{
- MessageDialog aQuery(this, CUI_RES(RID_SVXSTR_QUERY_DELETE_CONFIRM), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( aQuery.Execute() == RET_YES )
+ ScopedVclPtrInstance< MessageDialog > aQuery(this, CUI_RES(RID_SVXSTR_QUERY_DELETE_CONFIRM), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if ( aQuery->Execute() == RET_YES )
pPathBox->GetModel()->Remove(pEntry);
}
return 0;
@@ -408,15 +414,15 @@ void DbRegistrationOptionsPage::insertNewEntry( const OUString& _sName,const OUS
void DbRegistrationOptionsPage::openLinkDialog(const OUString& _sOldName,const OUString& _sOldLocation,SvTreeListEntry* _pEntry)
{
- ODocumentLinkDialog aDlg(this,_pEntry == NULL);
+ ScopedVclPtrInstance< ODocumentLinkDialog > aDlg(this,_pEntry == nullptr);
- aDlg.setLink(_sOldName,_sOldLocation);
- aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
+ aDlg->setLink(_sOldName,_sOldLocation);
+ aDlg->setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
- if ( aDlg.Execute() == RET_OK )
+ if ( aDlg->Execute() == RET_OK )
{
OUString sNewName,sNewLocation;
- aDlg.getLink(sNewName,sNewLocation);
+ aDlg->getLink(sNewName,sNewLocation);
if ( _pEntry == NULL || sNewName != _sOldName || sNewLocation != _sOldLocation )
{
if ( _pEntry )
diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx
index ffeeb84e33a3..52e03509b068 100644
--- a/cui/source/options/doclinkdialog.cxx
+++ b/cui/source/options/doclinkdialog.cxx
@@ -70,6 +70,20 @@ namespace svx
m_pURL->SetDropDownLineCount( 5 );
}
+ ODocumentLinkDialog::~ODocumentLinkDialog()
+ {
+ disposeOnce();
+ }
+
+ void ODocumentLinkDialog::dispose()
+ {
+ m_pURL.clear();
+ m_pBrowseFile.clear();
+ m_pName.clear();
+ m_pOK.clear();
+ ModalDialog::dispose();
+ }
+
void ODocumentLinkDialog::setLink( const OUString& _rName, const OUString& _rURL )
{
@@ -116,8 +130,8 @@ namespace svx
{
OUString sMsg = CUI_RES(STR_LINKEDDOC_DOESNOTEXIST);
sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText());
- MessageDialog aError(this, sMsg);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(this, sMsg);
+ aError->Execute();
return 0L;
} // if (!bFileExists)
INetURLObject aURL( sURL );
@@ -125,8 +139,8 @@ namespace svx
{
OUString sMsg = CUI_RES(STR_LINKEDDOC_NO_SYSTEM_FILE);
sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText());
- MessageDialog aError(this, sMsg);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(this, sMsg);
+ aError->Execute();
return 0L;
}
@@ -137,8 +151,8 @@ namespace svx
{
OUString sMsg = CUI_RES(STR_NAME_CONFLICT);
sMsg = sMsg.replaceFirst("$file$", sCurrentText);
- MessageDialog aError(this, sMsg, VCL_MESSAGE_INFO);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(this, sMsg, VCL_MESSAGE_INFO);
+ aError->Execute();
m_pName->SetSelection(Selection(0,sCurrentText.getLength()));
m_pName->GrabFocus();
diff --git a/cui/source/options/doclinkdialog.hxx b/cui/source/options/doclinkdialog.hxx
index 0584734b761d..55493e9e9974 100644
--- a/cui/source/options/doclinkdialog.hxx
+++ b/cui/source/options/doclinkdialog.hxx
@@ -40,10 +40,10 @@ namespace svx
class ODocumentLinkDialog : public ModalDialog
{
protected:
- ::svt::OFileURLControl* m_pURL;
- PushButton* m_pBrowseFile;
- Edit* m_pName;
- OKButton* m_pOK;
+ VclPtr<::svt::OFileURLControl> m_pURL;
+ VclPtr<PushButton> m_pBrowseFile;
+ VclPtr<Edit> m_pName;
+ VclPtr<OKButton> m_pOK;
bool m_bCreatingNew;
@@ -51,6 +51,8 @@ namespace svx
public:
ODocumentLinkDialog( vcl::Window* _pParent, bool _bCreateNew );
+ virtual ~ODocumentLinkDialog();
+ virtual void dispose() SAL_OVERRIDE;
// name validation has to be done by an external instance
// the validator link gets a pointer to a String, and should return 0 if the string is not
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index 955cac735640..4276de7311b7 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -62,7 +62,7 @@ SvxFontSubstTabPage::SvxFontSubstTabPage( vcl::Window* pParent,
pCheckLBContainer->set_width_request(aControlSize.Width());
pCheckLBContainer->set_height_request(aControlSize.Height());
- m_pCheckLB = new SvxFontSubstCheckListBox(*pCheckLBContainer, 0);
+ m_pCheckLB = VclPtr<SvxFontSubstCheckListBox>::Create(*pCheckLBContainer, 0);
m_pCheckLB->SetHelpId(HID_OFA_FONT_SUBST_CLB);
m_pCheckLB->SetStyle(m_pCheckLB->GetStyle()|WB_HSCROLL|WB_VSCROLL);
@@ -138,15 +138,32 @@ SvTreeListEntry* SvxFontSubstTabPage::CreateEntry(OUString& rFont1, OUString& rF
SvxFontSubstTabPage::~SvxFontSubstTabPage()
{
+ disposeOnce();
+}
+
+void SvxFontSubstTabPage::dispose()
+{
delete pCheckButtonData;
+ pCheckButtonData = NULL;
delete pConfig;
- delete m_pCheckLB;
+ pConfig = NULL;
+ m_pCheckLB.disposeAndClear();
+ m_pUseTableCB.clear();
+ m_pReplacements.clear();
+ m_pFont1CB.clear();
+ m_pFont2CB.clear();
+ m_pApply.clear();
+ m_pDelete.clear();
+ m_pFontNameLB.clear();
+ m_pNonPropFontsOnlyCB.clear();
+ m_pFontHeightLB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxFontSubstTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SvxFontSubstTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SvxFontSubstTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxFontSubstTabPage>::Create(pParent, *rAttrSet);
}
bool SvxFontSubstTabPage::FillItemSet( SfxItemSet* )
diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx
index d73e2b0f9926..27847da31464 100644
--- a/cui/source/options/fontsubs.hxx
+++ b/cui/source/options/fontsubs.hxx
@@ -63,18 +63,18 @@ class SvxFontSubstCheckListBox : public SvSimpleTable
class SvtFontSubstConfig;
class SvxFontSubstTabPage : public SfxTabPage
{
- CheckBox* m_pUseTableCB;
- VclContainer* m_pReplacements;
- FontNameBox* m_pFont1CB;
- FontNameBox* m_pFont2CB;
- PushButton* m_pApply;
- PushButton* m_pDelete;
+ VclPtr<CheckBox> m_pUseTableCB;
+ VclPtr<VclContainer> m_pReplacements;
+ VclPtr<FontNameBox> m_pFont1CB;
+ VclPtr<FontNameBox> m_pFont2CB;
+ VclPtr<PushButton> m_pApply;
+ VclPtr<PushButton> m_pDelete;
- SvxFontSubstCheckListBox* m_pCheckLB;
+ VclPtr<SvxFontSubstCheckListBox> m_pCheckLB;
- ListBox* m_pFontNameLB;
- CheckBox* m_pNonPropFontsOnlyCB;
- ListBox* m_pFontHeightLB;
+ VclPtr<ListBox> m_pFontNameLB;
+ VclPtr<CheckBox> m_pNonPropFontsOnlyCB;
+ VclPtr<ListBox> m_pFontHeightLB;
OUString m_sAutomatic;
@@ -91,11 +91,12 @@ class SvxFontSubstTabPage : public SfxTabPage
void CheckEnable();
- SvxFontSubstTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxFontSubstTabPage();
+ virtual void dispose() SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ SvxFontSubstTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ 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/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index c5ef749ec20f..851753d932c8 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -130,7 +130,7 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxI
m_pSearchBtn( get<PushButton>("searchButton") ),
m_pSearchEdit( get<Edit>("searchEntry") ),
m_vectorOfModified(),
- m_pPrefBox( new SvSimpleTable(*m_pPrefCtrl, WB_SCROLL | WB_HSCROLL | WB_VSCROLL ) )
+ m_pPrefBox( VclPtr<SvSimpleTable>::Create(*m_pPrefCtrl, WB_SCROLL | WB_HSCROLL | WB_VSCROLL ) )
{
Size aControlSize(LogicToPixel(Size(385, 230), MAP_APPFONT));
m_pPrefCtrl->set_width_request(aControlSize.Width());
@@ -164,6 +164,21 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxI
m_pPrefBox->SetAlternatingRowColors( true );
}
+CuiAboutConfigTabPage::~CuiAboutConfigTabPage()
+{
+ disposeOnce();
+}
+
+void CuiAboutConfigTabPage::dispose()
+{
+ m_pPrefCtrl.clear();
+ m_pResetBtn.clear();
+ m_pEditBtn.clear();
+ m_pSearchBtn.clear();
+ m_pSearchEdit.clear();
+ ModelessDialog::dispose();
+}
+
void CuiAboutConfigTabPage::InsertEntry(const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue)
{
SvTreeListEntry* pEntry = new SvTreeListEntry;
@@ -477,6 +492,17 @@ CuiAboutConfigValueDialog::CuiAboutConfigValueDialog( vcl::Window* pWindow,
}
+CuiAboutConfigValueDialog::~CuiAboutConfigValueDialog()
+{
+ disposeOnce();
+}
+
+void CuiAboutConfigValueDialog::dispose()
+{
+ m_pEDValue.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK_NOARG( CuiAboutConfigTabPage, ResetBtnHdl_Impl )
{
Reset();
@@ -538,7 +564,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
else if( sPropertyType == "hyper" )
limit = HYPER_LEN_LIMIT;
- CuiAboutConfigValueDialog* pValueDialog = new CuiAboutConfigValueDialog(0, sDialogValue, limit);
+ VclPtrInstance<CuiAboutConfigValueDialog> pValueDialog(nullptr, sDialogValue, limit);
if( pValueDialog->Execute() == RET_OK )
{
diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx
index dc19e4ae6539..b9ead63ef7e5 100644
--- a/cui/source/options/optaboutconfig.hxx
+++ b/cui/source/options/optaboutconfig.hxx
@@ -43,14 +43,14 @@ public:
class CuiAboutConfigTabPage : public ModelessDialog
{
private:
- SvSimpleTableContainer* m_pPrefCtrl;
- PushButton* m_pResetBtn;
- PushButton* m_pEditBtn;
- PushButton* m_pSearchBtn;
- Edit* m_pSearchEdit;
+ VclPtr<SvSimpleTableContainer> m_pPrefCtrl;
+ VclPtr<PushButton> m_pResetBtn;
+ VclPtr<PushButton> m_pEditBtn;
+ VclPtr<PushButton> m_pSearchBtn;
+ VclPtr<Edit> m_pSearchEdit;
std::vector< boost::shared_ptr< Prop_Impl > > m_vectorOfModified;
- boost::scoped_ptr< SvSimpleTable > m_pPrefBox;
+ VclPtr< SvSimpleTable > m_pPrefBox;
//for search
::com::sun::star::util::SearchOptions m_options;
@@ -65,6 +65,8 @@ private:
public:
CuiAboutConfigTabPage(vcl::Window* pParent);
+ virtual ~CuiAboutConfigTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void InsertEntry(const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue);
void Reset();
void FillItems(const com::sun::star::uno::Reference<com::sun::star::container::XNameAccess>& xNameAccess);
@@ -75,10 +77,12 @@ public:
class CuiAboutConfigValueDialog : public ModalDialog
{
private:
- CuiCustomMultilineEdit* m_pEDValue;
+ VclPtr<CuiCustomMultilineEdit> m_pEDValue;
public:
CuiAboutConfigValueDialog( vcl::Window* pWindow, const OUString& rValue , int limit = 0);
+ virtual ~CuiAboutConfigValueDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString getValue()
{
diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx
index cccc1b428087..d781ed26dd54 100644
--- a/cui/source/options/optaccessibility.cxx
+++ b/cui/source/options/optaccessibility.cxx
@@ -58,12 +58,28 @@ SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(vcl::Window* pPar
SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage()
{
+ disposeOnce();
+}
+
+void SvxAccessibilityOptionsTabPage::dispose()
+{
delete m_pImpl;
+ m_pImpl = NULL;
+ m_pAccessibilityTool.clear();
+ m_pTextSelectionInReadonly.clear();
+ m_pAnimatedGraphics.clear();
+ m_pAnimatedTexts.clear();
+ m_pTipHelpCB.clear();
+ m_pTipHelpNF.clear();
+ m_pAutoDetectHC.clear();
+ m_pAutomaticFontColor.clear();
+ m_pPagePreviews.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxAccessibilityOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxAccessibilityOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new SvxAccessibilityOptionsTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxAccessibilityOptionsTabPage>::Create(pParent, *rAttrSet);
}
bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* )
diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx
index c63c37dac682..16e4c3a97bd3 100644
--- a/cui/source/options/optaccessibility.hxx
+++ b/cui/source/options/optaccessibility.hxx
@@ -25,27 +25,27 @@
struct SvxAccessibilityOptionsTabPage_Impl;
class SvxAccessibilityOptionsTabPage : public SfxTabPage
{
- CheckBox* m_pAccessibilityTool;
- CheckBox* m_pTextSelectionInReadonly;
- CheckBox* m_pAnimatedGraphics;
- CheckBox* m_pAnimatedTexts;
- CheckBox* m_pTipHelpCB;
- NumericField* m_pTipHelpNF;
- CheckBox* m_pAutoDetectHC;
- CheckBox* m_pAutomaticFontColor;
- CheckBox* m_pPagePreviews;
+ VclPtr<CheckBox> m_pAccessibilityTool;
+ VclPtr<CheckBox> m_pTextSelectionInReadonly;
+ VclPtr<CheckBox> m_pAnimatedGraphics;
+ VclPtr<CheckBox> m_pAnimatedTexts;
+ VclPtr<CheckBox> m_pTipHelpCB;
+ VclPtr<NumericField> m_pTipHelpNF;
+ VclPtr<CheckBox> m_pAutoDetectHC;
+ VclPtr<CheckBox> m_pAutomaticFontColor;
+ VclPtr<CheckBox> m_pPagePreviews;
DECL_LINK(TipHelpHdl, CheckBox*);
void EnableTipHelp(bool bCheck);
SvxAccessibilityOptionsTabPage_Impl* m_pImpl;
- SvxAccessibilityOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
public:
-
+ SvxAccessibilityOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxAccessibilityOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
};
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index d944b5f891e3..c16711f621a4 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -151,12 +151,32 @@ SvxAsianLayoutPage::SvxAsianLayoutPage( vcl::Window* pParent, const SfxItemSet&
SvxAsianLayoutPage::~SvxAsianLayoutPage()
{
+ disposeOnce();
+}
+
+void SvxAsianLayoutPage::dispose()
+{
delete pImpl;
+ pImpl = NULL;
+ m_pCharKerningRB.clear();
+ m_pCharPunctKerningRB.clear();
+ m_pNoCompressionRB.clear();
+ m_pPunctCompressionRB.clear();
+ m_pPunctKanaCompressionRB.clear();
+ m_pLanguageFT.clear();
+ m_pLanguageLB.clear();
+ m_pStandardCB.clear();
+ m_pStartFT.clear();
+ m_pStartED.clear();
+ m_pEndFT.clear();
+ m_pEndED.clear();
+ m_pHintFT.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxAsianLayoutPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxAsianLayoutPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new SvxAsianLayoutPage(pParent, *rAttrSet);
+ return VclPtr<SvxAsianLayoutPage>::Create(pParent, *rAttrSet);
}
bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* )
diff --git a/cui/source/options/optbasic.cxx b/cui/source/options/optbasic.cxx
index 2c5498e97934..913b8a230f0f 100644
--- a/cui/source/options/optbasic.cxx
+++ b/cui/source/options/optbasic.cxx
@@ -47,6 +47,18 @@ SvxBasicIDEOptionsPage::SvxBasicIDEOptionsPage( vcl::Window* pParent, const SfxI
SvxBasicIDEOptionsPage::~SvxBasicIDEOptionsPage()
{
+ disposeOnce();
+}
+
+void SvxBasicIDEOptionsPage::dispose()
+{
+ pCodeCompleteChk.clear();
+ pAutocloseProcChk.clear();
+ pAutocloseParenChk.clear();
+ pAutocloseQuotesChk.clear();
+ pAutoCorrectChk.clear();
+ pUseExtendedTypesChk.clear();
+ SfxTabPage::dispose();
}
void SvxBasicIDEOptionsPage::LoadConfig()
@@ -136,9 +148,9 @@ void SvxBasicIDEOptionsPage::Reset( const SfxItemSet* /*rSet*/ )
pUseExtendedTypesChk->SaveValue();
}
-SfxTabPage* SvxBasicIDEOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxBasicIDEOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return ( new SvxBasicIDEOptionsPage( pParent, *rAttrSet ) );
+ return VclPtr<SvxBasicIDEOptionsPage>::Create( pParent, *rAttrSet );
}
void SvxBasicIDEOptionsPage::FillUserData()
diff --git a/cui/source/options/optbasic.hxx b/cui/source/options/optbasic.hxx
index 5b1959d9f5a6..dc617b1fea3a 100644
--- a/cui/source/options/optbasic.hxx
+++ b/cui/source/options/optbasic.hxx
@@ -27,20 +27,21 @@
class SvxBasicIDEOptionsPage: public SfxTabPage
{
private:
- CheckBox* pCodeCompleteChk;
- CheckBox* pAutocloseProcChk;
- CheckBox* pAutocloseParenChk;
- CheckBox* pAutocloseQuotesChk;
- CheckBox* pAutoCorrectChk;
- CheckBox* pUseExtendedTypesChk;
+ VclPtr<CheckBox> pCodeCompleteChk;
+ VclPtr<CheckBox> pAutocloseProcChk;
+ VclPtr<CheckBox> pAutocloseParenChk;
+ VclPtr<CheckBox> pAutocloseQuotesChk;
+ VclPtr<CheckBox> pAutoCorrectChk;
+ VclPtr<CheckBox> pUseExtendedTypesChk;
void LoadConfig();
public:
SvxBasicIDEOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxBasicIDEOptionsPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void FillUserData() SAL_OVERRIDE;
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index 55d002d70e51..f9e3c0e22d40 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -83,12 +83,28 @@ SvxDefaultColorOptPage::SvxDefaultColorOptPage(vcl::Window* pParent, const SfxIt
SvxDefaultColorOptPage::~SvxDefaultColorOptPage()
{
+ disposeOnce();
+}
+
+void SvxDefaultColorOptPage::dispose()
+{
// save changes
- pChartOptions->SetDefaultColors( pColorConfig->GetColorList() );
- pChartOptions->Commit();
+ if (pChartOptions)
+ {
+ pChartOptions->SetDefaultColors( pColorConfig->GetColorList() );
+ pChartOptions->Commit();
- delete pColorConfig;
- delete pChartOptions;
+ delete pColorConfig;
+ pColorConfig = NULL;
+ delete pChartOptions;
+ pChartOptions = NULL;
+ }
+ m_pLbChartColors.clear();
+ m_pValSetColorBox.clear();
+ m_pPBDefault.clear();
+ m_pPBAdd.clear();
+ m_pPBRemove.clear();
+ SfxTabPage::dispose();
}
void SvxDefaultColorOptPage::Construct()
@@ -103,9 +119,9 @@ void SvxDefaultColorOptPage::Construct()
}
-SfxTabPage* SvxDefaultColorOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxDefaultColorOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrs )
{
- return new SvxDefaultColorOptPage( pParent, *rAttrs );
+ return VclPtr<SvxDefaultColorOptPage>::Create( pParent, *rAttrs );
}
bool SvxDefaultColorOptPage::FillItemSet( SfxItemSet* rOutAttrs )
@@ -215,9 +231,9 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, PushButton*, pButton )
{
OSL_ENSURE(pColorConfig->GetColorList().size() > 1, "don't delete the last chart color");
- MessageDialog aQuery(pButton, "QueryDeleteChartColorDialog",
- "cui/ui/querydeletechartcolordialog.ui");
- if (RET_YES == aQuery.Execute())
+ ScopedVclPtrInstance<MessageDialog> aQuery(pButton, "QueryDeleteChartColorDialog",
+ "cui/ui/querydeletechartcolordialog.ui");
+ if (RET_YES == aQuery->Execute())
{
pColorConfig->GetColorList().remove( nIndex );
diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx
index 0f210e1ccd15..506b9c87f1a0 100644
--- a/cui/source/options/optchart.hxx
+++ b/cui/source/options/optchart.hxx
@@ -33,11 +33,11 @@ class SvxDefaultColorOptPage : public SfxTabPage
{
private:
- ColorLB* m_pLbChartColors;
- ValueSet* m_pValSetColorBox;
- PushButton* m_pPBDefault;
- PushButton* m_pPBAdd;
- PushButton* m_pPBRemove;
+ VclPtr<ColorLB> m_pLbChartColors;
+ VclPtr<ValueSet> m_pValSetColorBox;
+ VclPtr<PushButton> m_pPBDefault;
+ VclPtr<PushButton> m_pPBAdd;
+ VclPtr<PushButton> m_pPBRemove;
SvxChartOptions* pChartOptions;
SvxChartColorTableItem* pColorConfig;
@@ -55,10 +55,11 @@ private:
public:
SvxDefaultColorOptPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SvxDefaultColorOptPage();
+ virtual void dispose() SAL_OVERRIDE;
void Construct();
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rInAttrs ) SAL_OVERRIDE;
};
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index e71e31b02df2..a8e8c8e9bed8 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -174,7 +174,8 @@ class ColorConfigWindow_Impl
{
public:
ColorConfigWindow_Impl(vcl::Window* pParent);
- virtual ~ColorConfigWindow_Impl();
+ virtual ~ColorConfigWindow_Impl() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
public:
void SetLinks (Link const&, Link const&, Link const&);
@@ -192,8 +193,7 @@ private:
class Chapter
{
// text
- bool m_bOwnsWidget;
- FixedText *m_pText;
+ VclPtr<FixedText> m_pText;
public:
Chapter(FixedText *pText, bool bShow);
Chapter(vcl::Window *pGrid, unsigned nYPos, const OUString& sDisplayName);
@@ -234,11 +234,11 @@ private:
private:
bool m_bOwnsWidgets;
// checkbox (CheckBox) or simple text (FixedText)
- Control* m_pText;
+ VclPtr<Control> m_pText;
// color list box
- ColorListBox* m_pColorList;
+ VclPtr<ColorListBox> m_pColorList;
// color preview box
- vcl::Window* m_pPreview;
+ VclPtr<vcl::Window> m_pPreview;
// default color
Color m_aDefaultColor;
private:
@@ -255,9 +255,9 @@ private:
private:
- VclGrid *m_pGrid;
- ScrollBar *m_pVScroll;
- HeaderBar *m_pHeaderHB;
+ VclPtr<VclGrid> m_pGrid;
+ VclPtr<ScrollBar> m_pVScroll;
+ VclPtr<HeaderBar> m_pHeaderHB;
// initialization
void CreateEntries();
@@ -282,8 +282,7 @@ private:
// eGroup: which group is this?
// rResMgr: resource manager
ColorConfigWindow_Impl::Chapter::Chapter(FixedText* pText, bool bShow)
- : m_bOwnsWidget(false)
- , m_pText(pText)
+ : m_pText(pText)
{
if (!bShow)
Hide();
@@ -292,9 +291,8 @@ ColorConfigWindow_Impl::Chapter::Chapter(FixedText* pText, bool bShow)
// ctor for extended groups
ColorConfigWindow_Impl::Chapter::Chapter(vcl::Window *pGrid,
unsigned nYPos, const OUString& rDisplayName)
- : m_bOwnsWidget(true)
{
- m_pText = new FixedText(pGrid, WB_LEFT|WB_VCENTER|WB_3DLOOK);
+ m_pText = VclPtr<FixedText>::Create(pGrid, WB_LEFT|WB_VCENTER|WB_3DLOOK);
m_pText->set_font_attribute("weight", "bold");
m_pText->set_grid_width(3);
m_pText->set_grid_left_attach(0);
@@ -304,8 +302,8 @@ ColorConfigWindow_Impl::Chapter::Chapter(vcl::Window *pGrid,
ColorConfigWindow_Impl::Chapter::~Chapter()
{
- if (m_bOwnsWidget)
- delete m_pText;
+ // FIXME: we had an horrible m_bOwnsWidget const
+ m_pText.disposeAndClear();
}
void ColorConfigWindow_Impl::Chapter::Show(Wallpaper const& rBackWall)
@@ -348,19 +346,19 @@ ColorConfigWindow_Impl::Entry::Entry( vcl::Window *pGrid, unsigned nYPos,
: m_bOwnsWidgets(true)
, m_aDefaultColor(rColorEntry.getDefaultColor())
{
- m_pText = new FixedText(pGrid, WB_LEFT|WB_VCENTER|WB_3DLOOK);
+ m_pText = VclPtr<FixedText>::Create(pGrid, WB_LEFT|WB_VCENTER|WB_3DLOOK);
m_pText->set_grid_left_attach(0);
m_pText->set_grid_top_attach(nYPos);
m_pText->set_margin_left(6 + nCheckBoxLabelOffset);
m_pText->SetText(rColorEntry.getDisplayName());
WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP|WB_DROPDOWN;
- m_pColorList = new ColorListBox(pGrid, nWinBits);
+ m_pColorList = VclPtr<ColorListBox>::Create(pGrid, nWinBits);
m_pColorList->EnableAutoSize(true);
m_pColorList->set_grid_left_attach(1);
m_pColorList->set_grid_top_attach(nYPos);
- m_pPreview = new vcl::Window(pGrid, WB_BORDER);
+ m_pPreview = VclPtr<vcl::Window>::Create(pGrid, WB_BORDER);
m_pPreview->set_grid_left_attach(2);
m_pPreview->set_grid_top_attach(nYPos);
m_pPreview->set_margin_right(6);
@@ -372,9 +370,9 @@ ColorConfigWindow_Impl::Entry::~Entry()
{
if (m_bOwnsWidgets)
{
- delete m_pText;
- delete m_pColorList;
- delete m_pPreview;
+ m_pText.disposeAndClear();
+ m_pColorList.disposeAndClear();
+ m_pPreview.disposeAndClear();
}
}
@@ -416,7 +414,7 @@ void ColorConfigWindow_Impl::Entry::SetLinks(
{
m_pColorList->SetSelectHdl(aColorLink);
m_pColorList->SetGetFocusHdl(aGetFocusLink);
- if (CheckBox* pCheckBox = dynamic_cast<CheckBox*>(m_pText))
+ if (CheckBox* pCheckBox = dynamic_cast<CheckBox*>(m_pText.get()))
{
pCheckBox->SetClickHdl(aCheckLink);
pCheckBox->SetGetFocusHdl(aGetFocusLink);
@@ -439,7 +437,7 @@ void ColorConfigWindow_Impl::Entry::Update (
m_pColorList->SelectEntry(aColor);
}
m_pPreview->SetBackground(Wallpaper(aColor));
- if (CheckBox* pCheckBox = dynamic_cast<CheckBox*>(m_pText))
+ if (CheckBox* pCheckBox = dynamic_cast<CheckBox*>(m_pText.get()))
pCheckBox->Check(rValue.bIsVisible);
}
@@ -509,6 +507,15 @@ ColorConfigWindow_Impl::ColorConfigWindow_Impl(vcl::Window* pParent)
SetAppearance();
}
+void ColorConfigWindow_Impl::dispose()
+{
+ disposeBuilder();
+ m_pGrid.clear();
+ m_pVScroll.clear();
+ m_pHeaderHB.clear();
+ VclContainer::dispose();
+}
+
Size ColorConfigWindow_Impl::calculateRequisition() const
{
return getLayoutRequisition(*m_pGrid);
@@ -546,12 +553,12 @@ void ColorConfigWindow_Impl::CreateEntries()
long nCheckBoxLabelOffset = 0;
{
OUString sSampleText("X");
- CheckBox aCheckBox(this);
- FixedText aFixedText(this);
- aCheckBox.SetText(sSampleText);
- aFixedText.SetText(sSampleText);
- Size aCheckSize(aCheckBox.CalcMinimumSize(0x7fffffff));
- Size aFixedSize(aFixedText.CalcMinimumSize(0x7fffffff));
+ ScopedVclPtrInstance< CheckBox > aCheckBox(this);
+ ScopedVclPtrInstance< FixedText > aFixedText(this);
+ aCheckBox->SetText(sSampleText);
+ aFixedText->SetText(sSampleText);
+ Size aCheckSize(aCheckBox->CalcMinimumSize(0x7fffffff));
+ Size aFixedSize(aFixedText->CalcMinimumSize(0x7fffffff));
nCheckBoxLabelOffset = aCheckSize.Width() - aFixedSize.Width();
}
@@ -621,13 +628,13 @@ void ColorConfigWindow_Impl::SetAppearance ()
OSL_ENSURE( vEntries.size() >= sizeof vEntryInfo / sizeof vEntryInfo[0], "wrong number of helpIDs for color listboxes" );
// creating a sample color listbox with the color entries
- ColorListBox aSampleColorList(this);
+ ScopedVclPtrInstance< ColorListBox > aSampleColorList(this);
{
XColorListRef const xColorTable = XColorList::CreateStdColorList();
for (sal_Int32 i = 0; i != xColorTable->Count(); ++i)
{
XColorEntry& rEntry = *xColorTable->GetColor(i);
- aSampleColorList.InsertEntry(rEntry.GetColor(), rEntry.GetName());
+ aSampleColorList->InsertEntry(rEntry.GetColor(), rEntry.GetName());
}
}
@@ -635,13 +642,10 @@ void ColorConfigWindow_Impl::SetAppearance ()
for (size_t i = 0; i != vEntries.size(); ++i)
{
// appearance
- vEntries[i]->SetAppearance(aTransparentWall, aSampleColorList);
+ vEntries[i]->SetAppearance(aTransparentWall, *aSampleColorList.get());
}
}
-ColorConfigWindow_Impl::~ColorConfigWindow_Impl ()
-{ }
-
void ColorConfigWindow_Impl::AdjustHeaderBar()
{
// horizontal positions
@@ -823,10 +827,10 @@ void ColorConfigWindow_Impl::Command( const CommandEvent& rCEvt )
class ColorConfigCtrl_Impl : public VclVBox
{
- HeaderBar* m_pHeaderHB;
- VclHBox* m_pBody;
- ColorConfigWindow_Impl* m_pScrollWindow;
- ScrollBar* m_pVScroll;
+ VclPtr<HeaderBar> m_pHeaderHB;
+ VclPtr<VclHBox> m_pBody;
+ VclPtr<ColorConfigWindow_Impl> m_pScrollWindow;
+ VclPtr<ScrollBar> m_pVScroll;
EditableColorConfig* pColorConfig;
EditableExtendedColorConfig* pExtColorConfig;
@@ -842,6 +846,7 @@ class ColorConfigCtrl_Impl : public VclVBox
public:
ColorConfigCtrl_Impl(vcl::Window* pParent);
virtual ~ColorConfigCtrl_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void InitHeaderBar(const OUString &rOn, const OUString &rUIElems,
const OUString &rColorSetting, const OUString &rPreview);
@@ -864,11 +869,11 @@ ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(vcl::Window* pParent)
, pColorConfig(0)
, pExtColorConfig(0)
{
- m_pHeaderHB = new HeaderBar(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
+ m_pHeaderHB = VclPtr<HeaderBar>::Create(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
- m_pBody = new VclHBox(this);
- m_pScrollWindow = new ColorConfigWindow_Impl(m_pBody);
- m_pVScroll = new ScrollBar(m_pBody, WB_VERT);
+ m_pBody = VclPtr<VclHBox>::Create(this);
+ m_pScrollWindow = VclPtr<ColorConfigWindow_Impl>::Create(m_pBody);
+ m_pVScroll = VclPtr<ScrollBar>::Create(m_pBody, WB_VERT);
m_pScrollWindow->Init(m_pVScroll, m_pHeaderHB);
m_pBody->set_hexpand(true);
@@ -910,10 +915,16 @@ void ColorConfigCtrl_Impl::InitHeaderBar(const OUString &rOn, const OUString &rU
ColorConfigCtrl_Impl::~ColorConfigCtrl_Impl()
{
- delete m_pVScroll;
- delete m_pScrollWindow;
- delete m_pBody;
- delete m_pHeaderHB;
+ disposeOnce();
+}
+
+void ColorConfigCtrl_Impl::dispose()
+{
+ m_pVScroll.disposeAndClear();
+ m_pScrollWindow.disposeAndClear();
+ m_pBody.disposeAndClear();
+ m_pHeaderHB.disposeAndClear();
+ VclVBox::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorConfigCtrl(vcl::Window *pParent, VclBuilder::stringmap &)
@@ -1056,28 +1067,44 @@ SvxColorOptionsTabPage::SvxColorOptionsTabPage(
SvxColorOptionsTabPage::~SvxColorOptionsTabPage()
{
- //when the dialog is cancelled but the color scheme ListBox has been changed these
- //changes need to be undone
- if(!bFillItemSetCalled && m_pColorSchemeLB->IsValueChangedFromSaved())
+ disposeOnce();
+}
+
+void SvxColorOptionsTabPage::dispose()
+{
+ if (pColorConfig)
{
- OUString sOldScheme = m_pColorSchemeLB->GetEntry(m_pColorSchemeLB->GetSavedValue());
- if(!sOldScheme.isEmpty())
+ //when the dialog is cancelled but the color scheme ListBox has been changed these
+ //changes need to be undone
+ if(!bFillItemSetCalled && m_pColorSchemeLB->IsValueChangedFromSaved())
{
- pColorConfig->SetCurrentSchemeName(sOldScheme);
- pExtColorConfig->SetCurrentSchemeName(sOldScheme);
+ OUString sOldScheme = m_pColorSchemeLB->GetEntry(m_pColorSchemeLB->GetSavedValue());
+ if(!sOldScheme.isEmpty())
+ {
+ pColorConfig->SetCurrentSchemeName(sOldScheme);
+ pExtColorConfig->SetCurrentSchemeName(sOldScheme);
+ }
}
+ pColorConfig->ClearModified();
+ pColorConfig->EnableBroadcast();
+ delete pColorConfig;
+ pColorConfig = NULL;
+
+ pExtColorConfig->ClearModified();
+ pExtColorConfig->EnableBroadcast();
+ delete pExtColorConfig;
+ pExtColorConfig = NULL;
}
- pColorConfig->ClearModified();
- pColorConfig->EnableBroadcast();
- delete pColorConfig;
- pExtColorConfig->ClearModified();
- pExtColorConfig->EnableBroadcast();
- delete pExtColorConfig;
+ m_pColorSchemeLB.clear();
+ m_pSaveSchemePB.clear();
+ m_pDeleteSchemePB.clear();
+ m_pColorConfigCT.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxColorOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxColorOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return ( new SvxColorOptionsTabPage( pParent, *rAttrSet ) );
+ return VclPtr<SvxColorOptionsTabPage>::Create( pParent, *rAttrSet );
}
bool SvxColorOptionsTabPage::FillItemSet( SfxItemSet* )
@@ -1178,9 +1205,9 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton )
else
{
DBG_ASSERT(m_pColorSchemeLB->GetEntryCount() > 1, "don't delete the last scheme");
- MessageDialog aQuery(pButton, CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- aQuery.SetText(CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE));
- if(RET_YES == aQuery.Execute())
+ ScopedVclPtrInstance< MessageDialog > aQuery(pButton, CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ aQuery->SetText(CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE));
+ if(RET_YES == aQuery->Execute())
{
OUString sDeleteScheme(m_pColorSchemeLB->GetSelectEntry());
m_pColorSchemeLB->RemoveEntry(m_pColorSchemeLB->GetSelectEntryPos());
diff --git a/cui/source/options/optcolor.hxx b/cui/source/options/optcolor.hxx
index 494874831f6c..c16c2973ee0f 100644
--- a/cui/source/options/optcolor.hxx
+++ b/cui/source/options/optcolor.hxx
@@ -31,10 +31,10 @@ class SvxColorOptionsTabPage : public SfxTabPage
{
using SfxTabPage::DeactivatePage;
- ListBox* m_pColorSchemeLB;
- PushButton* m_pSaveSchemePB;
- PushButton* m_pDeleteSchemePB;
- ColorConfigCtrl_Impl* m_pColorConfigCT;
+ VclPtr<ListBox> m_pColorSchemeLB;
+ VclPtr<PushButton> m_pSaveSchemePB;
+ VclPtr<PushButton> m_pDeleteSchemePB;
+ VclPtr<ColorConfigCtrl_Impl> m_pColorConfigCT;
bool bFillItemSetCalled;
@@ -49,8 +49,9 @@ class SvxColorOptionsTabPage : public SfxTabPage
public:
SvxColorOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxColorOptionsTabPage( );
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/options/optctl.cxx b/cui/source/options/optctl.cxx
index 45430195bc94..652bba938bf9 100644
--- a/cui/source/options/optctl.cxx
+++ b/cui/source/options/optctl.cxx
@@ -59,11 +59,23 @@ SvxCTLOptionsPage::SvxCTLOptionsPage( vcl::Window* pParent, const SfxItemSet& rS
SvxCTLOptionsPage::~SvxCTLOptionsPage()
{
+ disposeOnce();
}
-SfxTabPage* SvxCTLOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+void SvxCTLOptionsPage::dispose()
{
- return new SvxCTLOptionsPage( pParent, *rAttrSet );
+ m_pSequenceCheckingCB.clear();
+ m_pRestrictedCB.clear();
+ m_pTypeReplaceCB.clear();
+ m_pMovementLogicalRB.clear();
+ m_pMovementVisualRB.clear();
+ m_pNumeralsLB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SvxCTLOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SvxCTLOptionsPage>::Create( pParent, *rAttrSet );
}
bool SvxCTLOptionsPage::FillItemSet( SfxItemSet* )
diff --git a/cui/source/options/optctl.hxx b/cui/source/options/optctl.hxx
index 3ab62ad2c09d..ac2544d47c27 100644
--- a/cui/source/options/optctl.hxx
+++ b/cui/source/options/optctl.hxx
@@ -30,24 +30,22 @@ class SvxCTLOptionsPage : public SfxTabPage
{
private:
- CheckBox* m_pSequenceCheckingCB;
- CheckBox* m_pRestrictedCB;
- CheckBox* m_pTypeReplaceCB;
+ VclPtr<CheckBox> m_pSequenceCheckingCB;
+ VclPtr<CheckBox> m_pRestrictedCB;
+ VclPtr<CheckBox> m_pTypeReplaceCB;
- RadioButton* m_pMovementLogicalRB;
- RadioButton* m_pMovementVisualRB;
+ VclPtr<RadioButton> m_pMovementLogicalRB;
+ VclPtr<RadioButton> m_pMovementVisualRB;
- ListBox* m_pNumeralsLB;
+ VclPtr<ListBox> m_pNumeralsLB;
DECL_LINK( SequenceCheckingCB_Hdl, void* );
- SvxCTLOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
-
public:
-
+ SvxCTLOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxCTLOptionsPage();
-
- 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/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index d7d0c7297b2c..4d154e26f0f0 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -117,6 +117,19 @@ SvxNewDictionaryDialog::SvxNewDictionaryDialog( vcl::Window* pParent,
pLanguageLB->SelectEntryPos(0);
}
+SvxNewDictionaryDialog::~SvxNewDictionaryDialog()
+{
+ disposeOnce();
+}
+
+void SvxNewDictionaryDialog::dispose()
+{
+ pNameEdit.clear();
+ pLanguageLB.clear();
+ pExceptBtn.clear();
+ pOKBtn.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl)
@@ -212,8 +225,7 @@ IMPL_LINK_NOARG_INLINE_END(SvxNewDictionaryDialog, ModifyHdl_Impl)
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxDictEdit(vcl::Window *pParent, VclBuilder::stringmap&)
{
WinBits nWinStyle = WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK;
- SvxDictEdit *pEdit = new SvxDictEdit(pParent, nWinStyle);
- return pEdit;
+ return new SvxDictEdit(pParent, nWinStyle);
};
SvxEditDictionaryDialog::SvxEditDictionaryDialog(
@@ -331,10 +343,23 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(
}
}
-
-
SvxEditDictionaryDialog::~SvxEditDictionaryDialog()
{
+ disposeOnce();
+}
+
+void SvxEditDictionaryDialog::dispose()
+{
+ pAllDictsLB.clear();
+ pLangFT.clear();
+ pLangLB.clear();
+ pWordED.clear();
+ pReplaceFT.clear();
+ pReplaceED.clear();
+ pWordsLB.clear();
+ pNewReplacePB.clear();
+ pDeletePB.clear();
+ ModalDialog::dispose();
}
@@ -451,12 +476,12 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl)
if ( nLang != nOldLang )
{
- MessageDialog aBox(this, CUI_RES( RID_SVXSTR_CONFIRM_SET_LANGUAGE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- OUString sTxt(aBox.get_primary_text());
+ ScopedVclPtrInstance< MessageDialog > aBox(this, CUI_RES( RID_SVXSTR_CONFIRM_SET_LANGUAGE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ OUString sTxt(aBox->get_primary_text());
sTxt = sTxt.replaceFirst( "%1", pAllDictsLB->GetSelectEntry() );
- aBox.set_primary_text(sTxt);
+ aBox->set_primary_text(sTxt);
- if ( aBox.Execute() == RET_YES )
+ if ( aBox->Execute() == RET_YES )
{
xDic->setLocale( LanguageTag::convertToLocale( nLang ) );
bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index f3f1df5d2013..cd6858228f3c 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -56,8 +56,23 @@ OfaMSFilterTabPage::OfaMSFilterTabPage(vcl::Window* pParent, const SfxItemSet& r
OfaMSFilterTabPage::~OfaMSFilterTabPage()
{
+ disposeOnce();
}
+void OfaMSFilterTabPage::dispose()
+{
+ aWBasicCodeCB.clear();
+ aWBasicWbctblCB.clear();
+ aWBasicStgCB.clear();
+ aEBasicCodeCB.clear();
+ aEBasicExectblCB.clear();
+ aEBasicStgCB.clear();
+ aPBasicCodeCB.clear();
+ aPBasicStgCB.clear();
+ SfxTabPage::dispose();
+}
+
+
IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl)
{
aWBasicWbctblCB->Enable( aWBasicCodeCB->IsChecked() );
@@ -70,10 +85,10 @@ IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl)
return 0;
}
-SfxTabPage* OfaMSFilterTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> OfaMSFilterTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return new OfaMSFilterTabPage( pParent, *rAttrSet );
+ return VclPtr<OfaMSFilterTabPage>::Create( pParent, *rAttrSet );
}
bool OfaMSFilterTabPage::FillItemSet( SfxItemSet* )
@@ -149,7 +164,7 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2( vcl::Window* pParent, const SfxItemSet
m_pCheckLBContainer->set_width_request(aControlSize.Width());
m_pCheckLBContainer->set_height_request(aControlSize.Height());
- m_pCheckLB = new MSFltrSimpleTable(*m_pCheckLBContainer);
+ m_pCheckLB = VclPtr<MSFltrSimpleTable>::Create(*m_pCheckLBContainer);
static long aStaticTabs[] = { 3, 0, 20, 40 };
m_pCheckLB->SvSimpleTable::SetTabs( aStaticTabs );
@@ -163,14 +178,25 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2( vcl::Window* pParent, const SfxItemSet
OfaMSFilterTabPage2::~OfaMSFilterTabPage2()
{
+ disposeOnce();
+}
+
+void OfaMSFilterTabPage2::dispose()
+{
delete pCheckButtonData;
- delete m_pCheckLB;
+ pCheckButtonData = NULL;
+ m_pCheckLB.clear();
+ m_pCheckLBContainer.clear();
+ aHighlightingRB.clear();
+ aShadingRB.clear();
+
+ SfxTabPage::dispose();
}
-SfxTabPage* OfaMSFilterTabPage2::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> OfaMSFilterTabPage2::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return new OfaMSFilterTabPage2( pParent, *rAttrSet );
+ return VclPtr<OfaMSFilterTabPage2>::Create( pParent, *rAttrSet );
}
bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet* )
diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx
index 38d280b52a46..221c705f3ae1 100644
--- a/cui/source/options/optfltr.hxx
+++ b/cui/source/options/optfltr.hxx
@@ -27,23 +27,24 @@
class OfaMSFilterTabPage : public SfxTabPage
{
- CheckBox* aWBasicCodeCB;
- CheckBox* aWBasicWbctblCB;
- CheckBox* aWBasicStgCB;
- CheckBox* aEBasicCodeCB;
- CheckBox* aEBasicExectblCB;
- CheckBox* aEBasicStgCB;
- CheckBox* aPBasicCodeCB;
- CheckBox* aPBasicStgCB;
+ VclPtr<CheckBox> aWBasicCodeCB;
+ VclPtr<CheckBox> aWBasicWbctblCB;
+ VclPtr<CheckBox> aWBasicStgCB;
+ VclPtr<CheckBox> aEBasicCodeCB;
+ VclPtr<CheckBox> aEBasicExectblCB;
+ VclPtr<CheckBox> aEBasicStgCB;
+ VclPtr<CheckBox> aPBasicCodeCB;
+ VclPtr<CheckBox> aPBasicStgCB;
- OfaMSFilterTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~OfaMSFilterTabPage();
DECL_LINK(LoadWordBasicCheckHdl_Impl, void *);
DECL_LINK(LoadExcelBasicCheckHdl_Impl, void *);
public:
+ OfaMSFilterTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ virtual ~OfaMSFilterTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -73,8 +74,8 @@ class OfaMSFilterTabPage2 : public SfxTabPage
}
};
- SvSimpleTableContainer* m_pCheckLBContainer;
- MSFltrSimpleTable* m_pCheckLB;
+ VclPtr<SvSimpleTableContainer> m_pCheckLBContainer;
+ VclPtr<MSFltrSimpleTable> m_pCheckLB;
OUString sHeader1, sHeader2;
OUString sChgToFromMath,
sChgToFromWriter,
@@ -83,11 +84,11 @@ class OfaMSFilterTabPage2 : public SfxTabPage
sChgToFromSmartArt;
SvLBoxButtonData* pCheckButtonData;
- RadioButton* aHighlightingRB;
- RadioButton* aShadingRB;
+ VclPtr<RadioButton> aHighlightingRB;
+ VclPtr<RadioButton> aShadingRB;
- OfaMSFilterTabPage2( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~OfaMSFilterTabPage2();
+ virtual void dispose() SAL_OVERRIDE;
void InsertEntry( const OUString& _rTxt, sal_IntPtr _nType );
void InsertEntry( const OUString& _rTxt, sal_IntPtr _nType,
@@ -95,8 +96,8 @@ class OfaMSFilterTabPage2 : public SfxTabPage
SvTreeListEntry* GetEntry4Type( sal_IntPtr _nType ) const;
public:
-
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ OfaMSFilterTabPage2( vcl::Window* pParent, const SfxItemSet& rSet );
+ 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/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 2ee207c85976..0a9b466a792c 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -309,11 +309,28 @@ OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
OfaMiscTabPage::~OfaMiscTabPage()
{
+ disposeOnce();
}
-SfxTabPage* OfaMiscTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+void OfaMiscTabPage::dispose()
{
- return new OfaMiscTabPage( pParent, *rAttrSet );
+ m_pToolTipsCB.clear();
+ m_pExtHelpCB.clear();
+ m_pFileDlgROImage.clear();
+ m_pFileDlgCB.clear();
+ m_pPrintDlgCB.clear();
+ m_pDocStatusCB.clear();
+ m_pSaveAlwaysCB.clear();
+ m_pYearFrame.clear();
+ m_pYearValueField.clear();
+ m_pToYearFT.clear();
+ m_pCollectUsageInfo.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> OfaMiscTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+{
+ return VclPtr<OfaMiscTabPage>::Create( pParent, *rAttrSet );
}
bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
@@ -686,9 +703,35 @@ OfaViewTabPage::OfaViewTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
OfaViewTabPage::~OfaViewTabPage()
{
+ disposeOnce();
+}
+
+void OfaViewTabPage::dispose()
+{
delete mpDrawinglayerOpt;
+ mpDrawinglayerOpt = NULL;
delete pCanvasSettings;
+ pCanvasSettings = NULL;
delete pAppearanceCfg;
+ pAppearanceCfg = NULL;
+ m_pWindowSizeMF.clear();
+ m_pIconSizeLB.clear();
+ m_pIconStyleLB.clear();
+ m_pFontAntiAliasing.clear();
+ m_pAAPointLimitLabel.clear();
+ m_pAAPointLimit.clear();
+ m_pMenuIconsLB.clear();
+ m_pFontShowCB.clear();
+ m_pFontHistoryCB.clear();
+ m_pUseHardwareAccell.clear();
+ m_pUseAntiAliase.clear();
+ m_pUseOpenGL.clear();
+ m_pForceOpenGL.clear();
+ m_pMousePosLB.clear();
+ m_pMouseMiddleLB.clear();
+ m_pSelectionCB.clear();
+ m_pSelectionMF.clear();
+ SfxTabPage::dispose();
}
#if defined( UNX )
@@ -714,9 +757,9 @@ IMPL_LINK( OfaViewTabPage, OnSelectionToggled, void*, NOTINTERESTEDIN )
return 0;
}
-SfxTabPage* OfaViewTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> OfaViewTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new OfaViewTabPage(pParent, *rAttrSet);
+ return VclPtr<OfaViewTabPage>::Create(pParent, *rAttrSet);
}
bool OfaViewTabPage::FillItemSet( SfxItemSet* )
@@ -1205,12 +1248,35 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(vcl::Window* pParent, const SfxItemSet&
OfaLanguagesTabPage::~OfaLanguagesTabPage()
{
+ disposeOnce();
+}
+
+void OfaLanguagesTabPage::dispose()
+{
delete pLangConfig;
+ pLangConfig = NULL;
+ m_pUserInterfaceLB.clear();
+ m_pLocaleSettingFT.clear();
+ m_pLocaleSettingLB.clear();
+ m_pDecimalSeparatorCB.clear();
+ m_pCurrencyFT.clear();
+ m_pCurrencyLB.clear();
+ m_pDatePatternsFT.clear();
+ m_pDatePatternsED.clear();
+ m_pWesternLanguageLB.clear();
+ m_pWesternLanguageFT.clear();
+ m_pAsianLanguageLB.clear();
+ m_pComplexLanguageLB.clear();
+ m_pCurrentDocCB.clear();
+ m_pAsianSupportCB.clear();
+ m_pCTLSupportCB.clear();
+ m_pIgnoreLanguageChangeCB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* OfaLanguagesTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> OfaLanguagesTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new OfaLanguagesTabPage(pParent, *rAttrSet);
+ return VclPtr<OfaLanguagesTabPage>::Create(pParent, *rAttrSet);
}
static void lcl_UpdateAndDelete(SfxVoidItem* pInvalidItems[], SfxBoolItem* pBoolItems[], sal_uInt16 nCount)
@@ -1290,8 +1356,8 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
xProp->setPropertyValue(sUserLocaleKey, makeAny(aLangString));
Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges();
// display info
- MessageDialog aBox(this, CUI_RES(RID_SVXSTR_LANGUAGE_RESTART), VCL_MESSAGE_INFO);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, CUI_RES(RID_SVXSTR_LANGUAGE_RESTART), VCL_MESSAGE_INFO);
+ aBox->Execute();
// tell quickstarter to stop being a veto listener
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index f4b4ee73cd86..8dc2397ffe4a 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -44,24 +44,24 @@ class OfaMiscTabPage : public SfxTabPage
{
using TabPage::DeactivatePage;
private:
- CheckBox* m_pToolTipsCB;
- CheckBox* m_pExtHelpCB;
+ VclPtr<CheckBox> m_pToolTipsCB;
+ VclPtr<CheckBox> m_pExtHelpCB;
- FixedImage* m_pFileDlgROImage;
- CheckBox* m_pFileDlgCB;
+ VclPtr<FixedImage> m_pFileDlgROImage;
+ VclPtr<CheckBox> m_pFileDlgCB;
- CheckBox* m_pPrintDlgCB;
+ VclPtr<CheckBox> m_pPrintDlgCB;
- CheckBox* m_pDocStatusCB;
- CheckBox* m_pSaveAlwaysCB;
+ VclPtr<CheckBox> m_pDocStatusCB;
+ VclPtr<CheckBox> m_pSaveAlwaysCB;
- VclContainer* m_pYearFrame;
- NumericField* m_pYearValueField;
- FixedText* m_pToYearFT;
+ VclPtr<VclContainer> m_pYearFrame;
+ VclPtr<NumericField> m_pYearValueField;
+ VclPtr<FixedText> m_pToYearFT;
OUString m_aStrDateInfo;
- CheckBox* m_pCollectUsageInfo;
+ VclPtr<CheckBox> m_pCollectUsageInfo;
DECL_LINK( TwoFigureHdl, NumericField* );
DECL_LINK( TwoFigureConfigHdl, NumericField* );
@@ -75,8 +75,9 @@ protected:
public:
OfaMiscTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~OfaMiscTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -88,30 +89,30 @@ class SvtTabAppearanceCfg;
class OfaViewTabPage : public SfxTabPage
{
private:
- MetricField* m_pWindowSizeMF;
- ListBox* m_pIconSizeLB;
- ListBox* m_pIconStyleLB;
+ VclPtr<MetricField> m_pWindowSizeMF;
+ VclPtr<ListBox> m_pIconSizeLB;
+ VclPtr<ListBox> m_pIconStyleLB;
- CheckBox* m_pFontAntiAliasing;
- FixedText* m_pAAPointLimitLabel;
- MetricField* m_pAAPointLimit;
+ VclPtr<CheckBox> m_pFontAntiAliasing;
+ VclPtr<FixedText> m_pAAPointLimitLabel;
+ VclPtr<MetricField> m_pAAPointLimit;
- ListBox* m_pMenuIconsLB;
+ VclPtr<ListBox> m_pMenuIconsLB;
- CheckBox* m_pFontShowCB;
- CheckBox* m_pFontHistoryCB;
+ VclPtr<CheckBox> m_pFontShowCB;
+ VclPtr<CheckBox> m_pFontHistoryCB;
- CheckBox* m_pUseHardwareAccell;
- CheckBox* m_pUseAntiAliase;
- CheckBox* m_pUseOpenGL;
- CheckBox* m_pForceOpenGL;
+ VclPtr<CheckBox> m_pUseHardwareAccell;
+ VclPtr<CheckBox> m_pUseAntiAliase;
+ VclPtr<CheckBox> m_pUseOpenGL;
+ VclPtr<CheckBox> m_pForceOpenGL;
- ListBox* m_pMousePosLB;
- ListBox* m_pMouseMiddleLB;
+ VclPtr<ListBox> m_pMousePosLB;
+ VclPtr<ListBox> m_pMouseMiddleLB;
// #i97672#
- CheckBox* m_pSelectionCB;
- MetricField* m_pSelectionMF;
+ VclPtr<CheckBox> m_pSelectionCB;
+ VclPtr<MetricField> m_pSelectionMF;
sal_uInt16 nSizeLB_InitialSelection;
sal_uInt16 nStyleLB_InitialSelection;
@@ -132,8 +133,9 @@ private:
public:
OfaViewTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~OfaViewTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -142,23 +144,23 @@ public:
struct LanguageConfig_Impl;
class OfaLanguagesTabPage : public SfxTabPage
{
- ListBox* m_pUserInterfaceLB;
- FixedText* m_pLocaleSettingFT;
- SvxLanguageBox* m_pLocaleSettingLB;
- CheckBox* m_pDecimalSeparatorCB;
- FixedText* m_pCurrencyFT;
- ListBox* m_pCurrencyLB;
- FixedText* m_pDatePatternsFT;
- Edit* m_pDatePatternsED;
-
- SvxLanguageBox* m_pWesternLanguageLB;
- FixedText* m_pWesternLanguageFT;
- SvxLanguageBox* m_pAsianLanguageLB;
- SvxLanguageBox* m_pComplexLanguageLB;
- CheckBox* m_pCurrentDocCB;
- CheckBox* m_pAsianSupportCB;
- CheckBox* m_pCTLSupportCB;
- CheckBox* m_pIgnoreLanguageChangeCB;
+ VclPtr<ListBox> m_pUserInterfaceLB;
+ VclPtr<FixedText> m_pLocaleSettingFT;
+ VclPtr<SvxLanguageBox> m_pLocaleSettingLB;
+ VclPtr<CheckBox> m_pDecimalSeparatorCB;
+ VclPtr<FixedText> m_pCurrencyFT;
+ VclPtr<ListBox> m_pCurrencyLB;
+ VclPtr<FixedText> m_pDatePatternsFT;
+ VclPtr<Edit> m_pDatePatternsED;
+
+ VclPtr<SvxLanguageBox> m_pWesternLanguageLB;
+ VclPtr<FixedText> m_pWesternLanguageFT;
+ VclPtr<SvxLanguageBox> m_pAsianLanguageLB;
+ VclPtr<SvxLanguageBox> m_pComplexLanguageLB;
+ VclPtr<CheckBox> m_pCurrentDocCB;
+ VclPtr<CheckBox> m_pAsianSupportCB;
+ VclPtr<CheckBox> m_pCTLSupportCB;
+ VclPtr<CheckBox> m_pIgnoreLanguageChangeCB;
bool m_bOldAsian;
bool m_bOldCtl;
@@ -176,8 +178,9 @@ class OfaLanguagesTabPage : public SfxTabPage
public:
OfaLanguagesTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~OfaLanguagesTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 9cb1c1b82ef1..f102d9e50eb8 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -166,7 +166,7 @@ struct SvxGeneralTabPage::Row
// which row is it?
RowType eRow;
// row label
- FixedText* pLabel;
+ VclPtr<FixedText> pLabel;
// first and last field in the row (last is exclusive)
unsigned nFirstField, nLastField;
@@ -191,7 +191,7 @@ struct SvxGeneralTabPage::Field
// which field is this? (in vFieldInfo[] above)
unsigned iField;
// edit box
- Edit *pEdit;
+ VclPtr<Edit> pEdit;
public:
Field (Edit *pEdit_, unsigned iField_)
@@ -219,11 +219,16 @@ SvxGeneralTabPage::SvxGeneralTabPage(vcl::Window* pParent, const SfxItemSet& rCo
SetLinks();
}
+SvxGeneralTabPage::~SvxGeneralTabPage()
+{
+ disposeOnce();
+}
-
-SvxGeneralTabPage::~SvxGeneralTabPage ()
-{ }
-
+void SvxGeneralTabPage::dispose()
+{
+ m_pUseDataCB.clear();
+ SfxTabPage::dispose();
+}
// Initializes the titles and the edit boxes,
@@ -296,9 +301,9 @@ void SvxGeneralTabPage::SetLinks ()
-SfxTabPage* SvxGeneralTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxGeneralTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return ( new SvxGeneralTabPage( pParent, *rAttrSet ) );
+ return VclPtr<SvxGeneralTabPage>::Create( pParent, *rAttrSet );
}
diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx
index b95873784cd0..8298bd6c6e6b 100644
--- a/cui/source/options/opthtml.cxx
+++ b/cui/source/options/opthtml.cxx
@@ -86,12 +86,34 @@ SfxTabPage( pParent, "OptHtmlPage" , "cui/ui/opthtmlpage.ui", &rSet )
OfaHtmlTabPage::~OfaHtmlTabPage()
{
+ disposeOnce();
}
-SfxTabPage* OfaHtmlTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+void OfaHtmlTabPage::dispose()
{
- return new OfaHtmlTabPage(pParent, *rAttrSet);
+ aSize1NF.clear();
+ aSize2NF.clear();
+ aSize3NF.clear();
+ aSize4NF.clear();
+ aSize5NF.clear();
+ aSize6NF.clear();
+ aSize7NF.clear();
+ aNumbersEnglishUSCB.clear();
+ aUnknownTagCB.clear();
+ aIgnoreFontNamesCB.clear();
+ aExportLB.clear();
+ aStarBasicCB.clear();
+ aStarBasicWarningCB.clear();
+ aPrintExtensionCB.clear();
+ aSaveGrfLocalCB.clear();
+ aCharSetLB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> OfaHtmlTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
+{
+ return VclPtr<OfaHtmlTabPage>::Create(pParent, *rAttrSet);
}
bool OfaHtmlTabPage::FillItemSet( SfxItemSet* )
diff --git a/cui/source/options/opthtml.hxx b/cui/source/options/opthtml.hxx
index c79e2393e831..6977795feb65 100644
--- a/cui/source/options/opthtml.hxx
+++ b/cui/source/options/opthtml.hxx
@@ -30,34 +30,35 @@
class OfaHtmlTabPage : public SfxTabPage
{
- NumericField* aSize1NF;
- NumericField* aSize2NF;
- NumericField* aSize3NF;
- NumericField* aSize4NF;
- NumericField* aSize5NF;
- NumericField* aSize6NF;
- NumericField* aSize7NF;
+ VclPtr<NumericField> aSize1NF;
+ VclPtr<NumericField> aSize2NF;
+ VclPtr<NumericField> aSize3NF;
+ VclPtr<NumericField> aSize4NF;
+ VclPtr<NumericField> aSize5NF;
+ VclPtr<NumericField> aSize6NF;
+ VclPtr<NumericField> aSize7NF;
- CheckBox* aNumbersEnglishUSCB;
- CheckBox* aUnknownTagCB;
- CheckBox* aIgnoreFontNamesCB;
+ VclPtr<CheckBox> aNumbersEnglishUSCB;
+ VclPtr<CheckBox> aUnknownTagCB;
+ VclPtr<CheckBox> aIgnoreFontNamesCB;
- ListBox* aExportLB;
- CheckBox* aStarBasicCB;
- CheckBox* aStarBasicWarningCB;
- CheckBox* aPrintExtensionCB;
- CheckBox* aSaveGrfLocalCB;
- SvxTextEncodingBox* aCharSetLB;
+ VclPtr<ListBox> aExportLB;
+ VclPtr<CheckBox> aStarBasicCB;
+ VclPtr<CheckBox> aStarBasicWarningCB;
+ VclPtr<CheckBox> aPrintExtensionCB;
+ VclPtr<CheckBox> aSaveGrfLocalCB;
+ VclPtr<SvxTextEncodingBox> aCharSetLB;
DECL_LINK(ExportHdl_Impl, ListBox*);
DECL_LINK(CheckBoxHdl_Impl, CheckBox*);
- OfaHtmlTabPage(vcl::Window* pParent, const SfxItemSet& rSet);
- virtual ~OfaHtmlTabPage();
public:
+ virtual ~OfaHtmlTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet );
+ OfaHtmlTabPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ 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/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 17e97d2853e3..48e2626a31ec 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -217,11 +217,33 @@ SvxProxyTabPage::SvxProxyTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
SvxProxyTabPage::~SvxProxyTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SvxProxyTabPage::Create(vcl::Window* pParent, const SfxItemSet* rAttrSet )
+void SvxProxyTabPage::dispose()
{
- return new SvxProxyTabPage(pParent, *rAttrSet);
+ m_pProxyModeLB.clear();
+ m_pHttpProxyFT.clear();
+ m_pHttpProxyED.clear();
+ m_pHttpPortFT.clear();
+ m_pHttpPortED.clear();
+ m_pHttpsProxyFT.clear();
+ m_pHttpsProxyED.clear();
+ m_pHttpsPortFT.clear();
+ m_pHttpsPortED.clear();
+ m_pFtpProxyFT.clear();
+ m_pFtpProxyED.clear();
+ m_pFtpPortFT.clear();
+ m_pFtpPortED.clear();
+ m_pNoProxyForFT.clear();
+ m_pNoProxyForED.clear();
+ m_pNoProxyDescFT.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SvxProxyTabPage::Create(vcl::Window* pParent, const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SvxProxyTabPage>::Create(pParent, *rAttrSet);
}
void SvxProxyTabPage::ReadConfigData_Impl()
@@ -626,16 +648,35 @@ SvxSecurityTabPage::SvxSecurityTabPage(vcl::Window* pParent, const SfxItemSet& r
SvxSecurityTabPage::~SvxSecurityTabPage()
{
- delete mpCertPathDlg;
+ disposeOnce();
+}
+void SvxSecurityTabPage::dispose()
+{
delete mpSecOptions;
- delete mpSecOptDlg;
+ mpSecOptions = NULL;
+ mpCertPathDlg.disposeAndClear();
+ mpSecOptDlg.clear();
+ m_pSecurityOptionsPB.clear();
+ m_pSavePasswordsCB.clear();
+ m_pShowConnectionsPB.clear();
+ m_pMasterPasswordCB.clear();
+ m_pMasterPasswordFT.clear();
+ m_pMasterPasswordPB.clear();
+ m_pMacroSecFrame.clear();
+ m_pMacroSecPB.clear();
+ m_pCertFrame.clear();
+ m_pCertPathPB.clear();
+ m_pTSAURLsFrame.clear();
+ m_pTSAURLsPB.clear();
+
+ SfxTabPage::dispose();
}
IMPL_LINK_NOARG(SvxSecurityTabPage, SecurityOptionsHdl)
{
if ( !mpSecOptDlg )
- mpSecOptDlg = new svx::SecurityOptionsDialog( this, mpSecOptions );
+ mpSecOptDlg = VclPtr<svx::SecurityOptionsDialog>::Create( this, mpSecOptions );
mpSecOptDlg->Execute();
return 0;
}
@@ -667,8 +708,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl)
}
else
{
- QueryBox aQuery( this, WB_YES_NO|WB_DEF_NO, m_sPasswordStoringDeactivateStr );
- sal_uInt16 nRet = aQuery.Execute();
+ ScopedVclPtrInstance< QueryBox > aQuery( this, WB_YES_NO|WB_DEF_NO, m_sPasswordStoringDeactivateStr );
+ sal_uInt16 nRet = aQuery->Execute();
if( RET_YES == nRet )
{
@@ -764,8 +805,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl)
if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) )
{
- svx::WebConnectionInfoDialog aDlg( this );
- aDlg.Execute();
+ ScopedVclPtrInstance< svx::WebConnectionInfoDialog > aDlg(this);
+ aDlg->Execute();
}
}
catch (const Exception&)
@@ -776,15 +817,15 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl)
IMPL_LINK_NOARG(SvxSecurityTabPage, CertPathPBHdl)
{
if (!mpCertPathDlg)
- mpCertPathDlg = new CertPathDialog(this);
+ mpCertPathDlg = VclPtr<CertPathDialog>::Create(this);
OUString sOrig = mpCertPathDlg->getDirectory();
short nRet = mpCertPathDlg->Execute();
if (nRet == RET_OK && sOrig != mpCertPathDlg->getDirectory())
{
- MessageDialog aWarnBox(this, CUI_RES(RID_SVXSTR_OPTIONS_RESTART), VCL_MESSAGE_INFO);
- aWarnBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aWarnBox(this, CUI_RES(RID_SVXSTR_OPTIONS_RESTART), VCL_MESSAGE_INFO);
+ aWarnBox->Execute();
}
return 0;
@@ -795,12 +836,10 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, TSAURLsPBHdl)
// Unlike the mpCertPathDlg, we *don't* keep the same dialog object around between
// invocations. Seems clearer to my little brain that way.
- TSAURLsDialog* pTSAURLsDlg = new TSAURLsDialog(this);
+ ScopedVclPtrInstance<TSAURLsDialog> pTSAURLsDlg(this);
pTSAURLsDlg->Execute();
- delete pTSAURLsDlg;
-
return 0;
}
@@ -875,9 +914,9 @@ void SvxSecurityTabPage::InitControls()
}
}
-SfxTabPage* SvxSecurityTabPage::Create(vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxSecurityTabPage::Create(vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new SvxSecurityTabPage(pParent, *rAttrSet);
+ return VclPtr<SfxTabPage>(new SvxSecurityTabPage(pParent, *rAttrSet), SAL_NO_ACQUIRE);
}
void SvxSecurityTabPage::ActivatePage( const SfxItemSet& )
@@ -972,14 +1011,28 @@ SvxEMailTabPage::SvxEMailTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
SvxEMailTabPage::~SvxEMailTabPage()
{
+ disposeOnce();
+}
+
+void SvxEMailTabPage::dispose()
+{
delete pImpl;
+ pImpl = NULL;
+ m_pMailContainer.clear();
+ m_pMailerURLFI.clear();
+ m_pMailerURLED.clear();
+ m_pMailerURLPB.clear();
+ m_pSuppressHiddenContainer.clear();
+ m_pSuppressHiddenFI.clear();
+ m_pSuppressHidden.clear();
+ SfxTabPage::dispose();
}
/* -------------------------------------------------------------------------*/
-SfxTabPage* SvxEMailTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxEMailTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new SvxEMailTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxEMailTabPage>::Create(pParent, *rAttrSet);
}
/* -------------------------------------------------------------------------*/
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index 2d137ba7bc33..d1b4362794ea 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -58,26 +58,26 @@ class SvxProxyTabPage : public SfxTabPage
{
private:
- ListBox* m_pProxyModeLB;
+ VclPtr<ListBox> m_pProxyModeLB;
- FixedText* m_pHttpProxyFT;
- SvxNoSpaceEdit* m_pHttpProxyED;
- FixedText* m_pHttpPortFT;
- SvxNoSpaceEdit* m_pHttpPortED;
+ VclPtr<FixedText> m_pHttpProxyFT;
+ VclPtr<SvxNoSpaceEdit> m_pHttpProxyED;
+ VclPtr<FixedText> m_pHttpPortFT;
+ VclPtr<SvxNoSpaceEdit> m_pHttpPortED;
- FixedText* m_pHttpsProxyFT;
- SvxNoSpaceEdit* m_pHttpsProxyED;
- FixedText* m_pHttpsPortFT;
- SvxNoSpaceEdit* m_pHttpsPortED;
+ VclPtr<FixedText> m_pHttpsProxyFT;
+ VclPtr<SvxNoSpaceEdit> m_pHttpsProxyED;
+ VclPtr<FixedText> m_pHttpsPortFT;
+ VclPtr<SvxNoSpaceEdit> m_pHttpsPortED;
- FixedText* m_pFtpProxyFT;
- SvxNoSpaceEdit* m_pFtpProxyED;
- FixedText* m_pFtpPortFT;
- SvxNoSpaceEdit* m_pFtpPortED;
+ VclPtr<FixedText> m_pFtpProxyFT;
+ VclPtr<SvxNoSpaceEdit> m_pFtpProxyED;
+ VclPtr<FixedText> m_pFtpPortFT;
+ VclPtr<SvxNoSpaceEdit> m_pFtpPortED;
- FixedText* m_pNoProxyForFT;
- Edit* m_pNoProxyForED;
- FixedText* m_pNoProxyDescFT;
+ VclPtr<FixedText> m_pNoProxyForFT;
+ VclPtr<Edit> m_pNoProxyForED;
+ VclPtr<FixedText> m_pNoProxyDescFT;
const OUString aProxyModePN;
const OUString aHttpProxyPN;
@@ -98,11 +98,11 @@ private:
DECL_LINK( ProxyHdl_Impl, ListBox * );
DECL_LINK( LoseFocusHdl_Impl, Edit * );
+public:
SvxProxyTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxProxyTabPage();
-
-public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
};
@@ -130,28 +130,28 @@ class SvxSecurityTabPage : public SfxTabPage
using TabPage::DeactivatePage;
private:
- PushButton* m_pSecurityOptionsPB;
+ VclPtr<PushButton> m_pSecurityOptionsPB;
- CheckBox* m_pSavePasswordsCB;
- PushButton* m_pShowConnectionsPB;
+ VclPtr<CheckBox> m_pSavePasswordsCB;
+ VclPtr<PushButton> m_pShowConnectionsPB;
- CheckBox* m_pMasterPasswordCB;
- FixedText* m_pMasterPasswordFT;
- PushButton* m_pMasterPasswordPB;
+ VclPtr<CheckBox> m_pMasterPasswordCB;
+ VclPtr<FixedText> m_pMasterPasswordFT;
+ VclPtr<PushButton> m_pMasterPasswordPB;
- VclContainer* m_pMacroSecFrame;
- PushButton* m_pMacroSecPB;
+ VclPtr<VclContainer> m_pMacroSecFrame;
+ VclPtr<PushButton> m_pMacroSecPB;
- VclContainer* m_pCertFrame;
- PushButton* m_pCertPathPB;
+ VclPtr<VclContainer> m_pCertFrame;
+ VclPtr<PushButton> m_pCertPathPB;
- VclContainer* m_pTSAURLsFrame;
- PushButton* m_pTSAURLsPB;
+ VclPtr<VclContainer> m_pTSAURLsFrame;
+ VclPtr<PushButton> m_pTSAURLsPB;
SvtSecurityOptions* mpSecOptions;
- svx::SecurityOptionsDialog* mpSecOptDlg;
+ VclPtr<svx::SecurityOptionsDialog> mpSecOptDlg;
- CertPathDialog* mpCertPathDlg;
+ VclPtr<CertPathDialog> mpCertPathDlg;
OUString m_sPasswordStoringDeactivateStr;
@@ -168,13 +168,14 @@ private:
SvxSecurityTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxSecurityTabPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
};
@@ -182,13 +183,13 @@ public:
struct SvxEMailTabPage_Impl;
class SvxEMailTabPage : public SfxTabPage
{
- VclContainer* m_pMailContainer;
- FixedImage* m_pMailerURLFI;
- Edit* m_pMailerURLED;
- PushButton* m_pMailerURLPB;
- VclContainer* m_pSuppressHiddenContainer;
- FixedImage* m_pSuppressHiddenFI;
- CheckBox* m_pSuppressHidden;
+ VclPtr<VclContainer> m_pMailContainer;
+ VclPtr<FixedImage> m_pMailerURLFI;
+ VclPtr<Edit> m_pMailerURLED;
+ VclPtr<PushButton> m_pMailerURLPB;
+ VclPtr<VclContainer> m_pSuppressHiddenContainer;
+ VclPtr<FixedImage> m_pSuppressHiddenFI;
+ VclPtr<CheckBox> m_pSuppressHidden;
OUString m_sDefaultFilterName;
@@ -199,8 +200,9 @@ class SvxEMailTabPage : public SfxTabPage
public:
SvxEMailTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxEMailTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 3ad13eb797ba..95471d1121c5 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -161,7 +161,7 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet&
aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
pJavaListContainer->set_width_request(aControlSize.Width());
pJavaListContainer->set_height_request(aControlSize.Height());
- m_pJavaList = new SvxJavaListBox(*pJavaListContainer, m_sAccessibilityText);
+ m_pJavaList = VclPtr<SvxJavaListBox>::Create(*pJavaListContainer, m_sAccessibilityText);
long aStaticTabs[]= { 4, 0, 0, 0, 0 };
@@ -202,9 +202,14 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet&
SvxJavaOptionsPage::~SvxJavaOptionsPage()
{
- delete m_pJavaList;
- delete m_pParamDlg;
- delete m_pPathDlg;
+ disposeOnce();
+}
+
+void SvxJavaOptionsPage::dispose()
+{
+ m_pJavaList.disposeAndClear();
+ m_pParamDlg.disposeAndClear();
+ m_pPathDlg.disposeAndClear();
ClearJavaInfo();
#if HAVE_FEATURE_JAVA
std::vector< JavaInfo* >::iterator pIter;
@@ -213,9 +218,20 @@ SvxJavaOptionsPage::~SvxJavaOptionsPage()
JavaInfo* pInfo = *pIter;
jfw_freeJavaInfo( pInfo );
}
+ m_aAddedInfos.clear();
jfw_unlock();
#endif
+ m_pJavaEnableCB.clear();
+ m_pJavaBox.clear();
+ m_pJavaPathText.clear();
+ m_pAddBtn.clear();
+ m_pParameterBtn.clear();
+ m_pClassPathBtn.clear();
+ m_pExpertConfigBtn.clear();
+ m_pExperimentalCB.clear();
+ m_pMacroCB.clear();
+ SfxTabPage::dispose();
}
@@ -290,7 +306,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl)
Sequence< OUString > aParameterList;
if ( !m_pParamDlg )
{
- m_pParamDlg = new SvxJavaParameterDlg( this );
+ m_pParamDlg = VclPtr<SvxJavaParameterDlg>::Create( this );
javaFrameworkError eErr = jfw_getVMParameters( &m_parParameters, &m_nParamSize );
if ( JFW_E_NONE == eErr && m_parParameters && m_nParamSize > 0 )
{
@@ -320,8 +336,8 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl)
(void)eErr;
if ( bRunning )
{
- MessageDialog aWarnBox( this, CUI_RES( RID_SVXSTR_OPTIONS_RESTART ), VCL_MESSAGE_INFO );
- aWarnBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aWarnBox( this, CUI_RES( RID_SVXSTR_OPTIONS_RESTART ), VCL_MESSAGE_INFO );
+ aWarnBox->Execute();
}
}
}
@@ -340,7 +356,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl)
if ( !m_pPathDlg )
{
- m_pPathDlg = new SvxJavaClassPathDlg( this );
+ m_pPathDlg = VclPtr<SvxJavaClassPathDlg>::Create( this );
javaFrameworkError eErr = jfw_getUserClassPath( &m_pClassPath );
if ( JFW_E_NONE == eErr && m_pClassPath )
{
@@ -365,8 +381,8 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl)
(void)eErr;
if ( bRunning )
{
- MessageDialog aWarnBox( this, CUI_RES( RID_SVXSTR_OPTIONS_RESTART ), VCL_MESSAGE_INFO );
- aWarnBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aWarnBox( this, CUI_RES( RID_SVXSTR_OPTIONS_RESTART ), VCL_MESSAGE_INFO );
+ aWarnBox->Execute();
}
}
}
@@ -421,7 +437,7 @@ IMPL_LINK( SvxJavaOptionsPage, DialogClosedHdl, DialogClosedEvent*, pEvt )
IMPL_LINK_NOARG( SvxJavaOptionsPage, ExpertConfigHdl_Impl )
{
- CuiAboutConfigTabPage* m_pExpertConfigDlg = new CuiAboutConfigTabPage(this);
+ ScopedVclPtrInstance< CuiAboutConfigTabPage > m_pExpertConfigDlg(this);
m_pExpertConfigDlg->Reset();//initialize and reset function
if( RET_OK == m_pExpertConfigDlg->Execute() )
@@ -429,7 +445,7 @@ IMPL_LINK_NOARG( SvxJavaOptionsPage, ExpertConfigHdl_Impl )
m_pExpertConfigDlg->FillItemSet();//save changes if there are any
}
- delete m_pExpertConfigDlg;
+ m_pExpertConfigDlg.disposeAndClear();
return 0;
}
@@ -614,13 +630,13 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
}
else if ( JFW_E_NOT_RECOGNIZED == eErr )
{
- MessageDialog aErrBox( this, CUI_RES( RID_SVXSTR_JRE_NOT_RECOGNIZED ) );
- aErrBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrBox( this, CUI_RES( RID_SVXSTR_JRE_NOT_RECOGNIZED ) );
+ aErrBox->Execute();
}
else if ( JFW_E_FAILED_VERSION == eErr )
{
- MessageDialog aErrBox( this, CUI_RES( RID_SVXSTR_JRE_FAILED_VERSION ) );
- aErrBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrBox( this, CUI_RES( RID_SVXSTR_JRE_FAILED_VERSION ) );
+ aErrBox->Execute();
}
if ( bStartAgain )
@@ -635,9 +651,9 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
-SfxTabPage* SvxJavaOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxJavaOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return ( new SvxJavaOptionsPage( pParent, *rAttrSet ) );
+ return VclPtr<SvxJavaOptionsPage>::Create( pParent, *rAttrSet );
}
@@ -805,12 +821,19 @@ SvxJavaParameterDlg::SvxJavaParameterDlg( vcl::Window* pParent ) :
EnableRemoveButton();
}
-
-
SvxJavaParameterDlg::~SvxJavaParameterDlg()
{
+ disposeOnce();
}
+void SvxJavaParameterDlg::dispose()
+{
+ m_pParameterEdit.clear();
+ m_pAssignBtn.clear();
+ m_pAssignedList.clear();
+ m_pRemoveBtn.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(SvxJavaParameterDlg, ModifyHdl_Impl)
@@ -939,12 +962,24 @@ SvxJavaClassPathDlg::SvxJavaClassPathDlg(vcl::Window* pParent)
SvxJavaClassPathDlg::~SvxJavaClassPathDlg()
{
- sal_Int32 i, nCount = m_pPathList->GetEntryCount();
- for ( i = 0; i < nCount; ++i )
- delete static_cast< OUString* >( m_pPathList->GetEntryData(i) );
+ disposeOnce();
}
-
+void SvxJavaClassPathDlg::dispose()
+{
+ if (m_pPathList)
+ {
+ sal_Int32 i, nCount = m_pPathList->GetEntryCount();
+ for ( i = 0; i < nCount; ++i )
+ delete static_cast< OUString* >( m_pPathList->GetEntryData(i) );
+ m_pPathList = NULL;
+ }
+ m_pPathList.clear();
+ m_pAddArchiveBtn.clear();
+ m_pAddPathBtn.clear();
+ m_pRemoveBtn.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl)
{
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index 4b45f37265ea..ffe299b7c628 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -51,17 +51,17 @@ class SvxJavaListBox;
class SvxJavaOptionsPage : public SfxTabPage
{
private:
- CheckBox* m_pJavaEnableCB;
- VclContainer* m_pJavaBox;
- SvxJavaListBox* m_pJavaList;
- FixedText* m_pJavaPathText;
- PushButton* m_pAddBtn;
- PushButton* m_pParameterBtn;
- PushButton* m_pClassPathBtn;
- PushButton* m_pExpertConfigBtn;
-
- SvxJavaParameterDlg* m_pParamDlg;
- SvxJavaClassPathDlg* m_pPathDlg;
+ VclPtr<CheckBox> m_pJavaEnableCB;
+ VclPtr<VclContainer> m_pJavaBox;
+ VclPtr<SvxJavaListBox> m_pJavaList;
+ VclPtr<FixedText> m_pJavaPathText;
+ VclPtr<PushButton> m_pAddBtn;
+ VclPtr<PushButton> m_pParameterBtn;
+ VclPtr<PushButton> m_pClassPathBtn;
+ VclPtr<PushButton> m_pExpertConfigBtn;
+
+ VclPtr<SvxJavaParameterDlg> m_pParamDlg;
+ VclPtr<SvxJavaClassPathDlg> m_pPathDlg;
#if HAVE_FEATURE_JAVA
JavaInfo** m_parJavaInfo;
@@ -75,8 +75,8 @@ private:
OUString m_sAddDialogText;
Idle m_aResetIdle;
- CheckBox* m_pExperimentalCB;
- CheckBox* m_pMacroCB;
+ VclPtr<CheckBox> m_pExperimentalCB;
+ VclPtr<CheckBox> m_pMacroCB;
::std::vector< JavaInfo* >
m_aAddedInfos;
@@ -107,8 +107,9 @@ private:
public:
SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxJavaOptionsPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -120,11 +121,11 @@ public:
class SvxJavaParameterDlg : public ModalDialog
{
private:
- Edit* m_pParameterEdit;
- PushButton* m_pAssignBtn;
+ VclPtr<Edit> m_pParameterEdit;
+ VclPtr<PushButton> m_pAssignBtn;
- ListBox* m_pAssignedList;
- PushButton* m_pRemoveBtn;
+ VclPtr<ListBox> m_pAssignedList;
+ VclPtr<PushButton> m_pRemoveBtn;
DECL_LINK(ModifyHdl_Impl, void *);
DECL_LINK(AssignHdl_Impl, void *);
@@ -141,6 +142,7 @@ private:
public:
SvxJavaParameterDlg( vcl::Window* pParent );
virtual ~SvxJavaParameterDlg();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
@@ -153,10 +155,10 @@ public:
class SvxJavaClassPathDlg : public ModalDialog
{
private:
- ListBox* m_pPathList;
- PushButton* m_pAddArchiveBtn;
- PushButton* m_pAddPathBtn;
- PushButton* m_pRemoveBtn;
+ VclPtr<ListBox> m_pPathList;
+ VclPtr<PushButton> m_pAddArchiveBtn;
+ VclPtr<PushButton> m_pAddPathBtn;
+ VclPtr<PushButton> m_pRemoveBtn;
OUString m_sOldPath;
@@ -173,6 +175,7 @@ private:
public:
SvxJavaClassPathDlg( vcl::Window* pParent );
virtual ~SvxJavaClassPathDlg();
+ virtual void dispose() SAL_OVERRIDE;
inline const OUString& GetOldPath() const { return m_sOldPath; }
inline void SetFocus() { m_pPathList->GrabFocus(); }
diff --git a/cui/source/options/optjsearch.cxx b/cui/source/options/optjsearch.cxx
index 96bc0146811f..2bd5401acac5 100644
--- a/cui/source/options/optjsearch.cxx
+++ b/cui/source/options/optjsearch.cxx
@@ -55,15 +55,38 @@ SvxJSearchOptionsPage::SvxJSearchOptionsPage( vcl::Window* pParent, const SfxIte
nTransliterationFlags = 0x00000000;
}
-
SvxJSearchOptionsPage::~SvxJSearchOptionsPage()
{
+ disposeOnce();
}
+void SvxJSearchOptionsPage::dispose()
+{
+ m_pMatchCase.clear();
+ m_pMatchFullHalfWidth.clear();
+ m_pMatchHiraganaKatakana.clear();
+ m_pMatchContractions.clear();
+ m_pMatchMinusDashChoon.clear();
+ m_pMatchRepeatCharMarks.clear();
+ m_pMatchVariantFormKanji.clear();
+ m_pMatchOldKanaForms.clear();
+ m_pMatchDiziDuzu.clear();
+ m_pMatchBavaHafa.clear();
+ m_pMatchTsithichiDhizi.clear();
+ m_pMatchHyuiyuByuvyu.clear();
+ m_pMatchSesheZeje.clear();
+ m_pMatchIaiya.clear();
+ m_pMatchKiku.clear();
+ m_pMatchProlongedSoundMark.clear();
+ m_pIgnorePunctuation.clear();
+ m_pIgnoreWhitespace.clear();
+ m_pIgnoreMiddleDot.clear();
+ SfxTabPage::dispose();
+}
-SfxTabPage* SvxJSearchOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxJSearchOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxJSearchOptionsPage( pParent, *rSet );
+ return VclPtr<SvxJSearchOptionsPage>::Create( pParent, *rSet );
}
diff --git a/cui/source/options/optjsearch.hxx b/cui/source/options/optjsearch.hxx
index bb5ac7a4606e..26fed46c9c3a 100644
--- a/cui/source/options/optjsearch.hxx
+++ b/cui/source/options/optjsearch.hxx
@@ -32,39 +32,37 @@ class SfxItemSet;
class SvxJSearchOptionsPage : public SfxTabPage
{
private:
- CheckBox* m_pMatchCase;
- CheckBox* m_pMatchFullHalfWidth;
- CheckBox* m_pMatchHiraganaKatakana;
- CheckBox* m_pMatchContractions;
- CheckBox* m_pMatchMinusDashChoon;
- CheckBox* m_pMatchRepeatCharMarks;
- CheckBox* m_pMatchVariantFormKanji;
- CheckBox* m_pMatchOldKanaForms;
- CheckBox* m_pMatchDiziDuzu;
- CheckBox* m_pMatchBavaHafa;
- CheckBox* m_pMatchTsithichiDhizi;
- CheckBox* m_pMatchHyuiyuByuvyu;
- CheckBox* m_pMatchSesheZeje;
- CheckBox* m_pMatchIaiya;
- CheckBox* m_pMatchKiku;
- CheckBox* m_pMatchProlongedSoundMark;
-
- CheckBox* m_pIgnorePunctuation;
- CheckBox* m_pIgnoreWhitespace;
- CheckBox* m_pIgnoreMiddleDot;
+ VclPtr<CheckBox> m_pMatchCase;
+ VclPtr<CheckBox> m_pMatchFullHalfWidth;
+ VclPtr<CheckBox> m_pMatchHiraganaKatakana;
+ VclPtr<CheckBox> m_pMatchContractions;
+ VclPtr<CheckBox> m_pMatchMinusDashChoon;
+ VclPtr<CheckBox> m_pMatchRepeatCharMarks;
+ VclPtr<CheckBox> m_pMatchVariantFormKanji;
+ VclPtr<CheckBox> m_pMatchOldKanaForms;
+ VclPtr<CheckBox> m_pMatchDiziDuzu;
+ VclPtr<CheckBox> m_pMatchBavaHafa;
+ VclPtr<CheckBox> m_pMatchTsithichiDhizi;
+ VclPtr<CheckBox> m_pMatchHyuiyuByuvyu;
+ VclPtr<CheckBox> m_pMatchSesheZeje;
+ VclPtr<CheckBox> m_pMatchIaiya;
+ VclPtr<CheckBox> m_pMatchKiku;
+ VclPtr<CheckBox> m_pMatchProlongedSoundMark;
+
+ VclPtr<CheckBox> m_pIgnorePunctuation;
+ VclPtr<CheckBox> m_pIgnoreWhitespace;
+ VclPtr<CheckBox> m_pIgnoreMiddleDot;
sal_Int32 nTransliterationFlags;
bool bSaveOptions;
sal_Int32 GetTransliterationFlags_Impl();
-protected:
- SvxJSearchOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
-
public:
- virtual ~SvxJSearchOptionsPage();
-
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ SvxJSearchOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxJSearchOptionsPage();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 1b72de3e8c23..54d4fe51598f 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -329,10 +329,10 @@ static inline OUString lcl_GetPropertyName( EID_OPTIONS eEntryId )
class OptionsBreakSet : public ModalDialog
{
- VclFrame* m_pBeforeFrame;
- VclFrame* m_pAfterFrame;
- VclFrame* m_pMinimalFrame;
- NumericField* m_pBreakNF;
+ VclPtr<VclFrame> m_pBeforeFrame;
+ VclPtr<VclFrame> m_pAfterFrame;
+ VclPtr<VclFrame> m_pMinimalFrame;
+ VclPtr<NumericField> m_pBreakNF;
public:
OptionsBreakSet(vcl::Window* pParent, sal_uInt16 nRID)
@@ -364,6 +364,15 @@ public:
get(m_pBreakNF, "wordlength");
}
}
+ virtual ~OptionsBreakSet() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ m_pBeforeFrame.clear();
+ m_pAfterFrame.clear();
+ m_pMinimalFrame.clear();
+ m_pBreakNF.clear();
+ ModalDialog::dispose();
+ }
NumericField& GetNumericFld()
{
@@ -1122,14 +1131,32 @@ SvxLinguTabPage::SvxLinguTabPage( vcl::Window* pParent, const SfxItemSet& rSet )
SvxLinguTabPage::~SvxLinguTabPage()
{
- if (pLinguData)
- delete pLinguData;
+ disposeOnce();
+}
+
+void SvxLinguTabPage::dispose()
+{
+ delete pLinguData;
+ pLinguData = NULL;
+ m_pLinguModulesFT.clear();
+ m_pLinguModulesCLB.clear();
+ m_pLinguModulesEditPB.clear();
+ m_pLinguDicsFT.clear();
+ m_pLinguDicsCLB.clear();
+ m_pLinguDicsNewPB.clear();
+ m_pLinguDicsEditPB.clear();
+ m_pLinguDicsDelPB.clear();
+ m_pLinguOptionsCLB.clear();
+ m_pLinguOptionsEditPB.clear();
+ m_pMoreDictsLink.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxLinguTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxLinguTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SvxLinguTabPage( pParent, *rAttrSet ) );
+ return VclPtr<SfxTabPage>( new SvxLinguTabPage( pParent, *rAttrSet ),
+ SAL_NO_ACQUIRE );
}
@@ -1570,8 +1597,8 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
pLinguData = new SvxLinguData_Impl;
SvxLinguData_Impl aOldLinguData( *pLinguData );
- SvxEditModulesDlg aDlg( this, *pLinguData );
- if (aDlg.Execute() != RET_OK)
+ ScopedVclPtrInstance< SvxEditModulesDlg > aDlg( this, *pLinguData );
+ if (aDlg->Execute() != RET_OK)
*pLinguData = aOldLinguData;
// evaluate new status of 'bConfigured' flag
@@ -1647,9 +1674,9 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
}
else if (m_pLinguDicsDelPB == pBtn)
{
- MessageDialog aQuery(this, "QueryDeleteDictionaryDialog",
- "cui/ui/querydeletedictionarydialog.ui");
- if (RET_NO == aQuery.Execute())
+ ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDeleteDictionaryDialog",
+ "cui/ui/querydeletedictionarydialog.ui");
+ if (RET_NO == aQuery->Execute())
return 0;
SvTreeListEntry *pEntry = m_pLinguDicsCLB->GetCurEntry();
@@ -1719,11 +1746,11 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
if(aData.HasNumericValue())
{
sal_uInt16 nRID = aData.GetEntryId();
- OptionsBreakSet aDlg( this, nRID );
- aDlg.GetNumericFld().SetValue( aData.GetNumericValue() );
- if (RET_OK == aDlg.Execute() )
+ ScopedVclPtrInstance< OptionsBreakSet > aDlg(this, nRID);
+ aDlg->GetNumericFld().SetValue( aData.GetNumericValue() );
+ if (RET_OK == aDlg->Execute() )
{
- long nVal = static_cast<long>(aDlg.GetNumericFld().GetValue());
+ long nVal = static_cast<long>(aDlg->GetNumericFld().GetValue());
if (-1 != nVal && aData.GetNumericValue() != nVal)
{
aData.SetNumericValue( (sal_uInt8)nVal ); //! sets IsModified !
@@ -1892,9 +1919,22 @@ SvxEditModulesDlg::SvxEditModulesDlg(vcl::Window* pParent, SvxLinguData_Impl& rD
SvxEditModulesDlg::~SvxEditModulesDlg()
{
- delete pDefaultLinguData;
+ disposeOnce();
}
+void SvxEditModulesDlg::dispose()
+{
+ delete pDefaultLinguData;
+ pDefaultLinguData = NULL;
+ m_pLanguageLB.clear();
+ m_pModulesCLB.clear();
+ m_pPrioUpPB.clear();
+ m_pPrioDownPB.clear();
+ m_pBackPB.clear();
+ m_pMoreDictsLink.clear();
+ m_pClosePB.clear();
+ ModalDialog::dispose();
+}
SvTreeListEntry* SvxEditModulesDlg::CreateEntry( OUString& rTxt, sal_uInt16 nCol )
{
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
index a8bac7001b03..730df834fee1 100644
--- a/cui/source/options/optmemory.cxx
+++ b/cui/source/options/optmemory.cxx
@@ -141,15 +141,26 @@ OfaMemoryOptionsPage::OfaMemoryOptionsPage(vcl::Window* pParent, const SfxItemSe
m_pNfGraphicCache->SetModifyHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) );
}
-
-
OfaMemoryOptionsPage::~OfaMemoryOptionsPage()
{
+ disposeOnce();
+}
+
+void OfaMemoryOptionsPage::dispose()
+{
+ m_pUndoEdit.clear();
+ m_pNfGraphicCache.clear();
+ m_pNfGraphicObjectCache.clear();
+ m_pTfGraphicObjectTime.clear();
+ m_pNfOLECache.clear();
+ m_pQuickStarterFrame.clear();
+ m_pQuickLaunchCB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* OfaMemoryOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> OfaMemoryOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new OfaMemoryOptionsPage( pParent, *rAttrSet );
+ return VclPtr<OfaMemoryOptionsPage>::Create( pParent, *rAttrSet );
}
bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet* rSet )
diff --git a/cui/source/options/optmemory.hxx b/cui/source/options/optmemory.hxx
index 1ba1a1ec4b95..a9c823b2d640 100644
--- a/cui/source/options/optmemory.hxx
+++ b/cui/source/options/optmemory.hxx
@@ -32,16 +32,16 @@ class OfaMemoryOptionsPage : public SfxTabPage
{
using SfxTabPage::DeactivatePage;
private:
- NumericField* m_pUndoEdit;
+ VclPtr<NumericField> m_pUndoEdit;
- NumericField* m_pNfGraphicCache;
- NumericField* m_pNfGraphicObjectCache;
- TimeField* m_pTfGraphicObjectTime;
+ VclPtr<NumericField> m_pNfGraphicCache;
+ VclPtr<NumericField> m_pNfGraphicObjectCache;
+ VclPtr<TimeField> m_pTfGraphicObjectTime;
- NumericField* m_pNfOLECache;
+ VclPtr<NumericField> m_pNfOLECache;
- VclContainer* m_pQuickStarterFrame;
- CheckBox* m_pQuickLaunchCB;
+ VclPtr<VclContainer> m_pQuickStarterFrame;
+ VclPtr<CheckBox> m_pQuickLaunchCB;
DECL_LINK(GraphicCacheConfigHdl, void *);
@@ -58,8 +58,9 @@ protected:
public:
OfaMemoryOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~OfaMemoryOptionsPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index e6703b08738d..465bb4acf437 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -72,8 +72,8 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
mpWhiteListDelete->SetClickHdl(LINK(this, SvxOpenCLTabPage, WhiteListDeleteHdl));
WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
- mpBlackList = new SvSimpleTable( *mpBlackListTable, nBits );
- mpWhiteList = new SvSimpleTable( *mpWhiteListTable, nBits );
+ mpBlackList = VclPtr<SvSimpleTable>::Create( *mpBlackListTable, nBits );
+ mpWhiteList = VclPtr<SvSimpleTable>::Create( *mpWhiteListTable, nBits );
HeaderBar &rBlBar = mpBlackList->GetTheHeaderBar();
HeaderBar &rWiBar = mpWhiteList->GetTheHeaderBar();
@@ -104,17 +104,41 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
SvxOpenCLTabPage::~SvxOpenCLTabPage()
{
- for ( sal_uInt16 i = 0; i < mpBlackList->GetEntryCount(); ++i )
+ disposeOnce();
+}
+
+void SvxOpenCLTabPage::dispose()
+{
+ for ( sal_uInt16 i = 0; i < mpBlackList->GetEntryCount(); ++i )
delete static_cast<OpenCLConfig::ImplMatcher*>(mpBlackList->GetEntry(i)->GetUserData());
for ( sal_uInt16 i = 0; i < mpWhiteList->GetEntryCount(); ++i )
delete static_cast<OpenCLConfig::ImplMatcher*>(mpWhiteList->GetEntry(i)->GetUserData());
- delete mpBlackList;
- delete mpWhiteList;
+ mpBlackList.disposeAndClear();
+ mpWhiteList.disposeAndClear();
+
+ mpUseOpenCL.clear();
+ mpBlackListFrame.clear();
+ mpBlackListTable.clear();
+ mpBlackListEdit.clear();
+ mpBlackListAdd.clear();
+ mpBlackListDelete.clear();
+ mpOS.clear();
+ mpOSVersion.clear();
+ mpDevice.clear();
+ mpVendor.clear();
+ mpDrvVersion.clear();
+ mpWhiteListFrame.clear();
+ mpWhiteListTable.clear();
+ mpWhiteListEdit.clear();
+ mpWhiteListAdd.clear();
+ mpWhiteListDelete.clear();
+
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxOpenCLTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxOpenCLTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new SvxOpenCLTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxOpenCLTabPage>::Create(pParent, *rAttrSet);
}
bool SvxOpenCLTabPage::FillItemSet( SfxItemSet* )
@@ -189,16 +213,27 @@ class ListEntryDialog : public ModalDialog
public:
OpenCLConfig::ImplMatcher maEntry;
- ListBox* mpOS;
- Edit* mpOSVersion;
- Edit* mpPlatformVendor;
- Edit* mpDevice;
- Edit* mpDriverVersion;
+ VclPtr<ListBox> mpOS;
+ VclPtr<Edit> mpOSVersion;
+ VclPtr<Edit> mpPlatformVendor;
+ VclPtr<Edit> mpDevice;
+ VclPtr<Edit> mpDriverVersion;
DECL_LINK(OSSelectHdl, ListBox*);
DECL_LINK(EditModifiedHdl, Edit*);
ListEntryDialog(vcl::Window* pParent, const OpenCLConfig::ImplMatcher& rEntry, const OString& rTag);
+ virtual ~ListEntryDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ mpOS.clear();
+ mpOSVersion.clear();
+ mpPlatformVendor.clear();
+ mpDevice.clear();
+ mpDriverVersion.clear();
+ ModalDialog::dispose();
+ }
+
};
ListEntryDialog::ListEntryDialog(vcl::Window* pParent, const OpenCLConfig::ImplMatcher& rEntry, const OString& rTag)
@@ -268,10 +303,10 @@ IMPL_LINK(ListEntryDialog, EditModifiedHdl, Edit*, pEdit)
void openListDialog(SvxOpenCLTabPage* pTabPage, OpenCLConfig::ImplMatcher& rEntry, const OString& rTag)
{
- ListEntryDialog aDlg(pTabPage, rEntry, rTag);
+ ScopedVclPtrInstance< ListEntryDialog > aDlg(pTabPage, rEntry, rTag);
- if (aDlg.Execute() == RET_OK)
- rEntry = aDlg.maEntry;
+ if (aDlg->Execute() == RET_OK)
+ rEntry = aDlg->maEntry;
}
const OpenCLConfig::ImplMatcher& findCurrentEntry(OpenCLConfig::ImplMatcherSet& rSet, SvSimpleTable* pListBox)
diff --git a/cui/source/options/optopencl.hxx b/cui/source/options/optopencl.hxx
index dc28ba32a2c1..09eb097609fd 100644
--- a/cui/source/options/optopencl.hxx
+++ b/cui/source/options/optopencl.hxx
@@ -31,26 +31,26 @@ class SvxOpenCLTabPage : public SfxTabPage
private:
OpenCLConfig maConfig;
- CheckBox* mpUseOpenCL;
-
- VclFrame* mpBlackListFrame;
- SvSimpleTable* mpBlackList;
- SvSimpleTableContainer* mpBlackListTable;
- PushButton* mpBlackListEdit;
- PushButton* mpBlackListAdd;
- PushButton* mpBlackListDelete;
- FixedText* mpOS;
- FixedText* mpOSVersion;
- FixedText* mpDevice;
- FixedText* mpVendor;
- FixedText* mpDrvVersion;
-
- VclFrame* mpWhiteListFrame;
- SvSimpleTable* mpWhiteList;
- SvSimpleTableContainer* mpWhiteListTable;
- PushButton* mpWhiteListEdit;
- PushButton* mpWhiteListAdd;
- PushButton* mpWhiteListDelete;
+ VclPtr<CheckBox> mpUseOpenCL;
+
+ VclPtr<VclFrame> mpBlackListFrame;
+ VclPtr<SvSimpleTable> mpBlackList;
+ VclPtr<SvSimpleTableContainer> mpBlackListTable;
+ VclPtr<PushButton> mpBlackListEdit;
+ VclPtr<PushButton> mpBlackListAdd;
+ VclPtr<PushButton> mpBlackListDelete;
+ VclPtr<FixedText> mpOS;
+ VclPtr<FixedText> mpOSVersion;
+ VclPtr<FixedText> mpDevice;
+ VclPtr<FixedText> mpVendor;
+ VclPtr<FixedText> mpDrvVersion;
+
+ VclPtr<VclFrame> mpWhiteListFrame;
+ VclPtr<SvSimpleTable> mpWhiteList;
+ VclPtr<SvSimpleTableContainer> mpWhiteListTable;
+ VclPtr<PushButton> mpWhiteListEdit;
+ VclPtr<PushButton> mpWhiteListAdd;
+ VclPtr<PushButton> mpWhiteListDelete;
DECL_LINK(BlackListEditHdl, void*);
DECL_LINK(BlackListAddHdl, void*);
@@ -71,8 +71,9 @@ private:
public:
SvxOpenCLTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxOpenCLTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 53363402f7d6..468f56eeed0e 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -214,7 +214,7 @@ SvxPathTabPage::SvxPathTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
m_pPathCtrl->set_width_request(aControlSize.Width());
m_pPathCtrl->set_height_request(aControlSize.Height());
WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
- pPathBox = new svx::OptHeaderTabListBox( *m_pPathCtrl, nBits );
+ pPathBox = VclPtr<svx::OptHeaderTabListBox>::Create( *m_pPathCtrl, nBits );
HeaderBar &rBar = pPathBox->GetTheHeaderBar();
rBar.SetSelectHdl( LINK( this, SvxPathTabPage, HeaderSelect_Impl ) );
@@ -247,21 +247,30 @@ SvxPathTabPage::SvxPathTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
SvxPathTabPage::~SvxPathTabPage()
{
- for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
- delete static_cast<PathUserData_Impl*>(pPathBox->GetEntry(i)->GetUserData());
- delete pPathBox;
- delete pImpl;
+ disposeOnce();
}
-
-
-SfxTabPage* SvxPathTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+void SvxPathTabPage::dispose()
{
- return ( new SvxPathTabPage( pParent, *rAttrSet ) );
+ if ( pPathBox )
+ {
+ for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
+ delete static_cast<PathUserData_Impl*>(pPathBox->GetEntry(i)->GetUserData());
+ pPathBox.disposeAndClear();
+ }
+ delete pImpl;
+ pImpl = NULL;
+ m_pPathCtrl.clear();
+ m_pStandardBtn.clear();
+ m_pPathBtn.clear();
+ SfxTabPage::dispose();
}
-
+VclPtr<SfxTabPage> SvxPathTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SvxPathTabPage>::Create( pParent, *rAttrSet );
+}
bool SvxPathTabPage::FillItemSet( SfxItemSet* )
{
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 1bc7861c0905..a57f3e0dca35 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -199,17 +199,38 @@ SfxSaveTabPage::SfxSaveTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet
SfxSaveTabPage::~SfxSaveTabPage()
{
- delete pImpl;
+ disposeOnce();
}
-
-
-SfxTabPage* SfxSaveTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+void SvxSaveTabPage::dispose()
{
- return ( new SfxSaveTabPage( pParent, *rAttrSet ) );
+ delete pImpl;
+ pImpl = NULL;
+ aLoadUserSettingsCB.clear();
+ aLoadDocPrinterCB.clear();
+ aDocInfoCB.clear();
+ aBackupCB.clear();
+ aAutoSaveCB.clear();
+ aAutoSaveEdit.clear();
+ aMinuteFT.clear();
+ aUserAutoSaveCB.clear();
+ aRelativeFsysCB.clear();
+ aRelativeInetCB.clear();
+ aODFVersionLB.clear();
+ aWarnAlienFormatCB.clear();
+ aDocTypeLB.clear();
+ aSaveAsFT.clear();
+ aSaveAsLB.clear();
+ aODFWarningFI.clear();
+ aODFWarningFT.clear();
+ SfxTabPage::dispose();
}
+VclPtr<SfxTabPage> SfxSaveTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SfxSaveTabPage>::Create( pParent, *rAttrSet );
+}
void SfxSaveTabPage::DetectHiddenControls()
{
diff --git a/cui/source/options/optsave.hxx b/cui/source/options/optsave.hxx
index b5fe40ad204e..f64dc0a82495 100644
--- a/cui/source/options/optsave.hxx
+++ b/cui/source/options/optsave.hxx
@@ -42,25 +42,25 @@ struct SvxSaveTabPage_Impl;
class SvxSaveTabPage : public SfxTabPage
{
private:
- CheckBox* aLoadUserSettingsCB;
- CheckBox* aLoadDocPrinterCB;
-
- CheckBox* aDocInfoCB;
- CheckBox* aBackupCB;
- CheckBox* aAutoSaveCB;
- NumericField* aAutoSaveEdit;
- FixedText* aMinuteFT;
- CheckBox* aUserAutoSaveCB;
- CheckBox* aRelativeFsysCB;
- CheckBox* aRelativeInetCB;
-
- ListBox* aODFVersionLB;
- CheckBox* aWarnAlienFormatCB;
- ListBox* aDocTypeLB;
- FixedText* aSaveAsFT;
- ListBox* aSaveAsLB;
- FixedImage* aODFWarningFI;
- FixedText* aODFWarningFT;
+ VclPtr<CheckBox> aLoadUserSettingsCB;
+ VclPtr<CheckBox> aLoadDocPrinterCB;
+
+ VclPtr<CheckBox> aDocInfoCB;
+ VclPtr<CheckBox> aBackupCB;
+ VclPtr<CheckBox> aAutoSaveCB;
+ VclPtr<NumericField> aAutoSaveEdit;
+ VclPtr<FixedText> aMinuteFT;
+ VclPtr<CheckBox> aUserAutoSaveCB;
+ VclPtr<CheckBox> aRelativeFsysCB;
+ VclPtr<CheckBox> aRelativeInetCB;
+
+ VclPtr<ListBox> aODFVersionLB;
+ VclPtr<CheckBox> aWarnAlienFormatCB;
+ VclPtr<ListBox> aDocTypeLB;
+ VclPtr<FixedText> aSaveAsFT;
+ VclPtr<ListBox> aSaveAsLB;
+ VclPtr<FixedImage> aODFWarningFI;
+ VclPtr<FixedText> aODFWarningFT;
SvxSaveTabPage_Impl* pImpl;
@@ -73,8 +73,9 @@ private:
public:
SvxSaveTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxSaveTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index e44e76006484..5f66f5bbbd43 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -82,10 +82,24 @@ SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage(vcl::Window* pParent, const SfxIt
UpdateLastCheckedText();
}
-
-
SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage()
{
+ disposeOnce();
+}
+
+void SvxOnlineUpdateTabPage::dispose()
+{
+ m_pAutoCheckCheckBox.clear();
+ m_pEveryDayButton.clear();
+ m_pEveryWeekButton.clear();
+ m_pEveryMonthButton.clear();
+ m_pCheckNowButton.clear();
+ m_pAutoDownloadCheckBox.clear();
+ m_pDestPathLabel.clear();
+ m_pDestPath.clear();
+ m_pChangePathButton.clear();
+ m_pLastChecked.clear();
+ SfxTabPage::dispose();
}
@@ -146,17 +160,12 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
m_pLastChecked->SetText( aText );
}
-
-
-SfxTabPage*
+VclPtr<SfxTabPage>
SvxOnlineUpdateTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new SvxOnlineUpdateTabPage( pParent, *rAttrSet );
+ return VclPtr<SvxOnlineUpdateTabPage>::Create( pParent, *rAttrSet );
}
-
-
-
bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* )
{
bool bModified = false;
diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx
index 54bb2a3791f8..ec749adc16c8 100644
--- a/cui/source/options/optupdt.hxx
+++ b/cui/source/options/optupdt.hxx
@@ -29,16 +29,16 @@
class SvxOnlineUpdateTabPage : public SfxTabPage
{
private:
- CheckBox* m_pAutoCheckCheckBox;
- RadioButton* m_pEveryDayButton;
- RadioButton* m_pEveryWeekButton;
- RadioButton* m_pEveryMonthButton;
- PushButton* m_pCheckNowButton;
- CheckBox* m_pAutoDownloadCheckBox;
- FixedText* m_pDestPathLabel;
- FixedText* m_pDestPath;
- PushButton* m_pChangePathButton;
- FixedText* m_pLastChecked;
+ VclPtr<CheckBox> m_pAutoCheckCheckBox;
+ VclPtr<RadioButton> m_pEveryDayButton;
+ VclPtr<RadioButton> m_pEveryWeekButton;
+ VclPtr<RadioButton> m_pEveryMonthButton;
+ VclPtr<PushButton> m_pCheckNowButton;
+ VclPtr<CheckBox> m_pAutoDownloadCheckBox;
+ VclPtr<FixedText> m_pDestPathLabel;
+ VclPtr<FixedText> m_pDestPath;
+ VclPtr<PushButton> m_pChangePathButton;
+ VclPtr<FixedText> m_pLastChecked;
OUString m_aNeverChecked;
OUString m_aLastCheckedTemplate;
@@ -53,8 +53,9 @@ private:
public:
SvxOnlineUpdateTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxOnlineUpdateTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index ddea9fed3c17..f19cfb4589d9 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -92,6 +92,25 @@ SelectPersonaDialog::SelectPersonaDialog( vcl::Window *pParent )
}
}
+SelectPersonaDialog::~SelectPersonaDialog()
+{
+ disposeOnce();
+}
+
+void SelectPersonaDialog::dispose()
+{
+ m_pEdit.clear();
+ m_pSearchButton.clear();
+ m_pProgressLabel.clear();
+ for (VclPtr<PushButton> vp : m_vResultList)
+ vp.clear();
+ for (VclPtr<PushButton> vp : m_vSearchSuggestions)
+ vp.clear();
+ m_pOkButton.clear();
+ m_pCancelButton.clear();
+ ModalDialog::dispose();
+}
+
OUString SelectPersonaDialog::GetSelectedPersona() const
{
if( !m_aSelectedPersona.isEmpty( ) )
@@ -293,11 +312,27 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( vcl::Window *pParent, cons
SvxPersonalizationTabPage::~SvxPersonalizationTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SvxPersonalizationTabPage::Create( vcl::Window *pParent, const SfxItemSet *rSet )
+void SvxPersonalizationTabPage::dispose()
+{
+ m_pNoPersona.clear();
+ m_pDefaultPersona.clear();
+ m_pOwnPersona.clear();
+ m_pSelectPersona.clear();
+ for (int i=0; i<3; ++i)
+ m_vDefaultPersonaImages[i].clear();
+ m_pExtensionPersonaPreview.clear();
+ m_pPersonaList.clear();
+ m_pExtensionLabel.clear();
+ SfxTabPage::dispose();
+}
+
+
+VclPtr<SfxTabPage> SvxPersonalizationTabPage::Create( vcl::Window *pParent, const SfxItemSet *rSet )
{
- return new SvxPersonalizationTabPage( pParent, *rSet );
+ return VclPtr<SvxPersonalizationTabPage>::Create( pParent, *rSet );
}
bool SvxPersonalizationTabPage::FillItemSet( SfxItemSet * )
@@ -441,11 +476,11 @@ void SvxPersonalizationTabPage::LoadExtensionThemes()
IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ )
{
- SelectPersonaDialog aDialog( NULL );
+ ScopedVclPtrInstance< SelectPersonaDialog > aDialog(nullptr);
- if ( aDialog.Execute() == RET_OK )
+ if ( aDialog->Execute() == RET_OK )
{
- OUString aPersonaSetting( aDialog.GetAppliedPersonaSetting() );
+ OUString aPersonaSetting( aDialog->GetAppliedPersonaSetting() );
if ( !aPersonaSetting.isEmpty() )
{
SetPersonaSettings( aPersonaSetting );
diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx
index 95da0717c932..0ec920db2704 100644
--- a/cui/source/options/personalization.hxx
+++ b/cui/source/options/personalization.hxx
@@ -25,15 +25,15 @@ class SvxPersonalizationTabPage : public SfxTabPage
using SfxTabPage::DeactivatePage;
private:
- RadioButton *m_pNoPersona; ///< Just the default look, without any bitmap
- RadioButton *m_pDefaultPersona; ///< Use the built-in bitmap
- RadioButton *m_pOwnPersona; ///< Use the user-defined bitmap
- PushButton *m_pSelectPersona; ///< Let the user select in the 'own' case
- PushButton *m_vDefaultPersonaImages[3]; ///< Buttons to show the default persona images
- PushButton *m_pExtensionPersonaPreview; ///< Buttons to show the last 3 personas installed via extensions
- ListBox* m_pPersonaList; ///< The ListBox to show the list of installed personas
+ VclPtr<RadioButton> m_pNoPersona; ///< Just the default look, without any bitmap
+ VclPtr<RadioButton> m_pDefaultPersona; ///< Use the built-in bitmap
+ VclPtr<RadioButton> m_pOwnPersona; ///< Use the user-defined bitmap
+ VclPtr<PushButton> m_pSelectPersona; ///< Let the user select in the 'own' case
+ VclPtr<PushButton> m_vDefaultPersonaImages[3]; ///< Buttons to show the default persona images
+ VclPtr<PushButton> m_pExtensionPersonaPreview; ///< Buttons to show the last 3 personas installed via extensions
+ VclPtr<ListBox> m_pPersonaList; ///< The ListBox to show the list of installed personas
OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings.
- FixedText *m_pExtensionLabel; ///< The "select persona installed via extensions" label
+ VclPtr<FixedText> m_pExtensionLabel; ///< The "select persona installed via extensions" label
std::vector<OUString> m_vDefaultPersonaSettings;
std::vector<OUString> m_vExtensionPersonaSettings;
@@ -42,8 +42,9 @@ public:
::rtl::Reference< SearchAndParseThread > m_rApplyThread;
SvxPersonalizationTabPage( vcl::Window *pParent, const SfxItemSet &rSet );
virtual ~SvxPersonalizationTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window *pParent, const SfxItemSet *rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window *pParent, const SfxItemSet *rSet );
/// Apply the settings ([OK] button).
virtual bool FillItemSet( SfxItemSet *rSet ) SAL_OVERRIDE;
@@ -78,13 +79,13 @@ https://addons.mozilla.org/firefox/themes ...
class SelectPersonaDialog : public ModalDialog
{
private:
- Edit *m_pEdit; ///< The input line for the search term
- PushButton *m_pSearchButton; ///< The search button
- FixedText *m_pProgressLabel; ///< The label for showing progress of search
- PushButton *m_vResultList[9]; ///< List of buttons to show search results
- PushButton *m_vSearchSuggestions[5]; ///< List of buttons for the search suggestions
- PushButton *m_pOkButton; ///< The OK button
- PushButton *m_pCancelButton; ///< The Cancel button
+ VclPtr<Edit> m_pEdit; ///< The input line for the search term
+ VclPtr<PushButton> m_pSearchButton; ///< The search button
+ VclPtr<FixedText> m_pProgressLabel; ///< The label for showing progress of search
+ VclPtr<PushButton> m_vResultList[9]; ///< List of buttons to show search results
+ VclPtr<PushButton> m_vSearchSuggestions[5]; ///< List of buttons for the search suggestions
+ VclPtr<PushButton> m_pOkButton; ///< The OK button
+ VclPtr<PushButton> m_pCancelButton; ///< The Cancel button
std::vector<OUString> m_vPersonaSettings;
OUString m_aSelectedPersona;
@@ -92,6 +93,8 @@ private:
public:
SelectPersonaDialog( vcl::Window *pParent );
+ virtual ~SelectPersonaDialog();
+ virtual void dispose() SAL_OVERRIDE;
::rtl::Reference< SearchAndParseThread > m_rSearchThread;
OUString GetSelectedPersona() const;
@@ -114,7 +117,7 @@ class SearchAndParseThread: public salhelper::Thread
{
private:
- SelectPersonaDialog *m_pPersonaDialog;
+ VclPtr<SelectPersonaDialog> m_pPersonaDialog;
OUString m_aURL;
bool m_bExecute;
diff --git a/cui/source/options/radiobtnbox.cxx b/cui/source/options/radiobtnbox.cxx
index 7830cbe024f2..500617bedf28 100644
--- a/cui/source/options/radiobtnbox.cxx
+++ b/cui/source/options/radiobtnbox.cxx
@@ -33,10 +33,6 @@ SvxRadioButtonListBox::SvxRadioButtonListBox(SvSimpleTableContainer& rParent, Wi
EnableCheckButton( new SvLBoxButtonData( this, true ) );
}
-SvxRadioButtonListBox::~SvxRadioButtonListBox()
-{
-}
-
void SvxRadioButtonListBox::SetTabs()
{
SvSimpleTable::SetTabs();
diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx
index b046f218bbb6..aea7fd280645 100644
--- a/cui/source/options/securityoptions.cxx
+++ b/cui/source/options/securityoptions.cxx
@@ -74,8 +74,21 @@ SecurityOptionsDialog::SecurityOptionsDialog(vcl::Window* pParent, SvtSecurityOp
SecurityOptionsDialog::~SecurityOptionsDialog()
{
+ disposeOnce();
}
+void SecurityOptionsDialog::dispose()
+{
+ m_pSaveOrSendDocsCB.clear();
+ m_pSignDocsCB.clear();
+ m_pPrintDocsCB.clear();
+ m_pCreatePdfCB.clear();
+ m_pRemovePersInfoCB.clear();
+ m_pRecommPasswdCB.clear();
+ m_pCtrlHyperlinkCB.clear();
+ m_pBlockUntrustedRefererLinksCB.clear();
+ ModalDialog::dispose();
+}
} // namespace svx
diff --git a/cui/source/options/securityoptions.hxx b/cui/source/options/securityoptions.hxx
index 614e3f72dfa3..216e372e945f 100644
--- a/cui/source/options/securityoptions.hxx
+++ b/cui/source/options/securityoptions.hxx
@@ -37,19 +37,20 @@ namespace svx
class SecurityOptionsDialog : public ModalDialog
{
private:
- CheckBox* m_pSaveOrSendDocsCB;
- CheckBox* m_pSignDocsCB;
- CheckBox* m_pPrintDocsCB;
- CheckBox* m_pCreatePdfCB;
+ VclPtr<CheckBox> m_pSaveOrSendDocsCB;
+ VclPtr<CheckBox> m_pSignDocsCB;
+ VclPtr<CheckBox> m_pPrintDocsCB;
+ VclPtr<CheckBox> m_pCreatePdfCB;
- CheckBox* m_pRemovePersInfoCB;
- CheckBox* m_pRecommPasswdCB;
- CheckBox* m_pCtrlHyperlinkCB;
- CheckBox* m_pBlockUntrustedRefererLinksCB;
+ VclPtr<CheckBox> m_pRemovePersInfoCB;
+ VclPtr<CheckBox> m_pRecommPasswdCB;
+ VclPtr<CheckBox> m_pCtrlHyperlinkCB;
+ VclPtr<CheckBox> m_pBlockUntrustedRefererLinksCB;
public:
SecurityOptionsDialog( vcl::Window* pParent, SvtSecurityOptions* pOptions );
virtual ~SecurityOptionsDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool IsSaveOrSendDocsChecked() const { return m_pSaveOrSendDocsCB->IsChecked(); }
bool IsSignDocsChecked() const { return m_pSignDocsCB->IsChecked(); }
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 42154b213a2f..2267d16775ad 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -291,7 +291,7 @@ void MailMergeCfg_Impl::Notify( const com::sun::star::uno::Sequence< OUString >&
}
//typedef SfxTabPage* (*FNCreateTabPage)( vcl::Window *pParent, const SfxItemSet &rAttrSet );
-SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
+VclPtr<SfxTabPage> CreateGeneralTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
{
CreateTabPage fnCreate = 0;
switch(nId)
@@ -332,7 +332,7 @@ SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, vcl::Window* pParent, const Sf
#endif
}
- SfxTabPage* pRet = fnCreate ? (*fnCreate)( pParent, &rSet ) : NULL;
+ VclPtr<SfxTabPage> pRet = fnCreate ? (*fnCreate)( pParent, &rSet ) : nullptr;
return pRet;
}
@@ -465,11 +465,11 @@ static bool lcl_isOptionHidden( sal_uInt16 _nPageId, const SvtOptionsDialogOptio
struct OptionsPageInfo
{
- SfxTabPage* m_pPage;
+ ScopedVclPtr<SfxTabPage> m_pPage;
sal_uInt16 m_nPageId;
OUString m_sPageURL;
OUString m_sEventHdl;
- ExtensionsTabPage* m_pExtPage;
+ VclPtr<ExtensionsTabPage> m_pExtPage;
OptionsPageInfo( sal_uInt16 nId ) : m_pPage( NULL ), m_nPageId( nId ), m_pExtPage( NULL ) {}
};
@@ -483,7 +483,7 @@ struct OptionsGroupInfo
sal_uInt16 m_nDialogId; // Id of the former dialog
bool m_bLoadError; // load fails?
OUString m_sPageURL;
- ExtensionsTabPage* m_pExtPage;
+ VclPtr<ExtensionsTabPage> m_pExtPage;
OptionsGroupInfo( SfxShell* pSh, SfxModule* pMod, sal_uInt16 nId ) :
m_pInItemSet( NULL ), m_pOutItemSet( NULL ), m_pShell( pSh ),
@@ -552,8 +552,13 @@ OfaTreeOptionsDialog::OfaTreeOptionsDialog( vcl::Window* pParent, const OUString
OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
{
+ disposeOnce();
+}
+
+void OfaTreeOptionsDialog::dispose()
+{
pCurrentPageEntry = NULL;
- SvTreeListEntry* pEntry = pTreeLB->First();
+ SvTreeListEntry* pEntry = pTreeLB ? pTreeLB->First() : NULL;
// first children
while(pEntry)
{
@@ -570,7 +575,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
SvtViewOptions aTabPageOpt( E_TABPAGE, OUString::number( pPageInfo->m_nPageId) );
SetViewOptUserItem( aTabPageOpt, aPageData );
}
- delete pPageInfo->m_pPage;
+ pPageInfo->m_pPage.disposeAndClear();
}
if (pPageInfo->m_nPageId == RID_SFXPAGE_LINGU)
@@ -583,7 +588,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
}
}
- delete pPageInfo->m_pExtPage;
+ pPageInfo->m_pExtPage.disposeAndClear();
delete pPageInfo;
}
@@ -591,20 +596,27 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
}
// and parents
- pEntry = pTreeLB->First();
+ pEntry = pTreeLB ? pTreeLB->First() : NULL;
while(pEntry)
{
if(!pTreeLB->GetParent(pEntry))
{
OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pEntry->GetUserData());
- if ( pGroupInfo && pGroupInfo->m_pExtPage )
- delete pGroupInfo->m_pExtPage;
+ if ( pGroupInfo )
+ pGroupInfo->m_pExtPage.disposeAndClear();
delete pGroupInfo;
}
pEntry = pTreeLB->Next(pEntry);
}
delete pColorPageItemSet;
+ pColorPageItemSet = NULL;
deleteGroupNames();
+ pOkPB.clear();
+ pBackPB.clear();
+ pTreeLB.clear();
+ pTabBox.clear();
+ mpColorPage.clear();
+ SfxModalDialog::dispose();
}
OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
@@ -1038,17 +1050,17 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
if(pPageInfo->m_nPageId == RID_SVXPAGE_COLOR)
{
- pPageInfo->m_pPage = ::CreateGeneralTabPage(
- pPageInfo->m_nPageId, pTabBox, *pColorPageItemSet );
- mpColorPage = static_cast<SvxColorTabPage*>(pPageInfo->m_pPage);
+ pPageInfo->m_pPage.reset( ::CreateGeneralTabPage(
+ pPageInfo->m_nPageId, pTabBox, *pColorPageItemSet ) );
+ mpColorPage = static_cast<SvxColorTabPage*>(pPageInfo->m_pPage.get());
mpColorPage->SetupForViewFrame( SfxViewFrame::Current() );
}
else
{
- pPageInfo->m_pPage = ::CreateGeneralTabPage(pPageInfo->m_nPageId, pTabBox, *pGroupInfo->m_pInItemSet );
+ pPageInfo->m_pPage.reset( ::CreateGeneralTabPage(pPageInfo->m_nPageId, pTabBox, *pGroupInfo->m_pInItemSet ) );
if(!pPageInfo->m_pPage && pGroupInfo->m_pModule)
- pPageInfo->m_pPage = pGroupInfo->m_pModule->CreateTabPage(pPageInfo->m_nPageId, pTabBox, *pGroupInfo->m_pInItemSet);
+ pPageInfo->m_pPage.reset( pGroupInfo->m_pModule->CreateTabPage(pPageInfo->m_nPageId, pTabBox, *pGroupInfo->m_pInItemSet) );
}
@@ -1076,7 +1088,8 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
m_xContainerWinProvider = awt::ContainerWindowProvider::create( ::comphelper::getProcessComponentContext() );
}
- pPageInfo->m_pExtPage = new ExtensionsTabPage(
+ pPageInfo->m_pExtPage = VclPtr<ExtensionsTabPage>::Create(
+
pTabBox, 0, pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider );
}
@@ -2156,6 +2169,11 @@ ExtensionsTabPage::ExtensionsTabPage(
ExtensionsTabPage::~ExtensionsTabPage()
{
+ disposeOnce();
+}
+
+void ExtensionsTabPage::dispose()
+{
Hide();
DeactivatePage();
@@ -2174,6 +2192,7 @@ ExtensionsTabPage::~ExtensionsTabPage()
}
m_xPage.clear();
}
+ TabPage::dispose();
}
diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
index 9db380135ed7..142ea656f045 100644
--- a/cui/source/options/tsaurls.cxx
+++ b/cui/source/options/tsaurls.cxx
@@ -67,6 +67,17 @@ IMPL_LINK_NOARG(TSAURLsDialog, OKHdl_Impl)
TSAURLsDialog::~TSAURLsDialog()
{
+ disposeOnce();
+}
+
+void TSAURLsDialog::dispose()
+{
+ m_pAddBtn.clear();
+ m_pDeleteBtn.clear();
+ m_pOKBtn.clear();
+ m_pURLListBox.clear();
+
+ ModalDialog::dispose();
}
void TSAURLsDialog::AddTSAURL(const OUString& rURL)
diff --git a/cui/source/options/tsaurls.hxx b/cui/source/options/tsaurls.hxx
index aba749181ac5..0b25238f1397 100644
--- a/cui/source/options/tsaurls.hxx
+++ b/cui/source/options/tsaurls.hxx
@@ -16,10 +16,10 @@
class TSAURLsDialog : public ModalDialog
{
private:
- ListBox* m_pURLListBox;
- PushButton* m_pAddBtn;
- PushButton* m_pDeleteBtn;
- OKButton* m_pOKBtn;
+ VclPtr<ListBox> m_pURLListBox;
+ VclPtr<PushButton> m_pAddBtn;
+ VclPtr<PushButton> m_pDeleteBtn;
+ VclPtr<OKButton> m_pOKBtn;
DECL_LINK(AddHdl_Impl, void *);
DECL_LINK(DeleteHdl_Impl, void *);
@@ -32,7 +32,7 @@ private:
public:
TSAURLsDialog(vcl::Window* pParent);
virtual ~TSAURLsDialog();
-
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index b5c61bf88397..e97f790b3a32 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -111,7 +111,7 @@ WebConnectionInfoDialog::WebConnectionInfoDialog(vcl::Window* pParent)
get(m_pChangeBtn, "change");
SvSimpleTableContainer *pPasswordsLBContainer = get<SvSimpleTableContainer>("logins");
- m_pPasswordsLB = new PasswordTable(*pPasswordsLBContainer, 0);
+ m_pPasswordsLB = VclPtr<PasswordTable>::Create(*pPasswordsLBContainer, 0);
long aStaticTabs[]= { 2, 0, 0 };
m_pPasswordsLB->SetTabs( aStaticTabs );
@@ -142,9 +142,17 @@ WebConnectionInfoDialog::WebConnectionInfoDialog(vcl::Window* pParent)
WebConnectionInfoDialog::~WebConnectionInfoDialog()
{
- delete m_pPasswordsLB;
+ disposeOnce();
}
+void WebConnectionInfoDialog::dispose()
+{
+ m_pPasswordsLB.disposeAndClear();
+ m_pRemoveBtn.clear();
+ m_pRemoveAllBtn.clear();
+ m_pChangeBtn.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK( WebConnectionInfoDialog, HeaderBarClickedHdl, SvSimpleTable*, pTable )
{
diff --git a/cui/source/options/webconninfo.hxx b/cui/source/options/webconninfo.hxx
index 366bcfc31283..a9d1b566d592 100644
--- a/cui/source/options/webconninfo.hxx
+++ b/cui/source/options/webconninfo.hxx
@@ -47,10 +47,10 @@ namespace svx
class WebConnectionInfoDialog : public ModalDialog
{
private:
- PasswordTable* m_pPasswordsLB;
- PushButton* m_pRemoveBtn;
- PushButton* m_pRemoveAllBtn;
- PushButton* m_pChangeBtn;
+ VclPtr<PasswordTable> m_pPasswordsLB;
+ VclPtr<PushButton> m_pRemoveBtn;
+ VclPtr<PushButton> m_pRemoveAllBtn;
+ VclPtr<PushButton> m_pChangeBtn;
sal_Int32 m_nPos;
DECL_LINK( HeaderBarClickedHdl, SvSimpleTable* );
@@ -64,6 +64,7 @@ namespace svx
public:
WebConnectionInfoDialog( vcl::Window* pParent );
virtual ~WebConnectionInfoDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 8a80c500e9f4..8d7329fe19b1 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -250,12 +250,44 @@ AlignmentTabPage::AlignmentTabPage( vcl::Window* pParent, const SfxItemSet& rCor
AlignmentTabPage::~AlignmentTabPage()
{
+ disposeOnce();
+}
+
+void AlignmentTabPage::dispose()
+{
delete m_pOrientHlp;
+ m_pOrientHlp = NULL;
+ m_pLbHorAlign.clear();
+ m_pFtIndent.clear();
+ m_pEdIndent.clear();
+ m_pFtVerAlign.clear();
+ m_pLbVerAlign.clear();
+ m_pCtrlDial.clear();
+ m_pFtRotate.clear();
+ m_pNfRotate.clear();
+ m_pFtRefEdge.clear();
+ m_pVsRefEdge.clear();
+ m_pCbStacked.clear();
+ m_pCbAsianMode.clear();
+ m_pBoxDirection.clear();
+ m_pBtnWrap.clear();
+ m_pBtnHyphen.clear();
+ m_pBtnShrink.clear();
+ m_pLbFrameDir.clear();
+ m_pFtBotLock.clear();
+ m_pFtTopLock.clear();
+ m_pFtCelLock.clear();
+ m_pFtABCD.clear();
+ m_pAlignmentFrame.clear();
+ m_pOrientFrame.clear();
+ m_pPropertiesFrame.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* AlignmentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> AlignmentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new AlignmentTabPage( pParent, *rAttrSet );
+ return VclPtr<SfxTabPage>( new AlignmentTabPage( pParent, *rAttrSet ),
+ SAL_NO_ACQUIRE );
}
bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 5c46ca9f8488..9d492b843612 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -137,6 +137,18 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet )
SetCurPageId("smarttags");
}
+OfaAutoCorrDlg::~OfaAutoCorrDlg()
+{
+ disposeOnce();
+}
+
+void OfaAutoCorrDlg::dispose()
+{
+ m_pLanguageBox.clear();
+ m_pLanguageLB.clear();
+ SfxTabDialog::dispose();
+}
+
void OfaAutoCorrDlg::EnableLanguage(bool bEnable)
{
m_pLanguageBox->Enable(bEnable);
@@ -192,10 +204,21 @@ OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxIt
get(m_pCheckLB, "checklist");
}
-SfxTabPage* OfaAutocorrOptionsPage::Create( vcl::Window* pParent,
- const SfxItemSet* rSet)
+OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage()
+{
+ disposeOnce();
+}
+
+void OfaAutocorrOptionsPage::dispose()
+{
+ m_pCheckLB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> OfaAutocorrOptionsPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rSet)
{
- return new OfaAutocorrOptionsPage(pParent, *rSet);
+ return VclPtr<OfaAutocorrOptionsPage>::Create(pParent, *rSet);
}
bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet* )
@@ -282,13 +305,16 @@ struct ImpUserData
class OfaAutoFmtPrcntSet : public ModalDialog
{
- MetricField* m_pPrcntMF;
+ VclPtr<MetricField> m_pPrcntMF;
public:
OfaAutoFmtPrcntSet(vcl::Window* pParent)
: ModalDialog(pParent, "PercentDialog","cui/ui/percentdialog.ui")
{
get(m_pPrcntMF, "margin");
}
+ virtual ~OfaAutoFmtPrcntSet() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_pPrcntMF.clear(); ModalDialog::dispose(); }
+
MetricField& GetPrcntFld()
{
return *m_pPrcntMF;
@@ -417,7 +443,7 @@ OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( vcl::Window* pParent,
aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
pCheckLBContainer->set_width_request(aControlSize.Width());
pCheckLBContainer->set_height_request(aControlSize.Height());
- m_pCheckLB = new OfaACorrCheckListBox(*pCheckLBContainer);
+ m_pCheckLB = VclPtr<OfaACorrCheckListBox>::Create(*pCheckLBContainer);
m_pCheckLB->SetStyle(m_pCheckLB->GetStyle()|WB_HSCROLL| WB_VSCROLL);
@@ -469,17 +495,28 @@ SvTreeListEntry* OfaSwAutoFmtOptionsPage::CreateEntry(OUString& rTxt, sal_uInt16
OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage()
{
- delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( REPLACE_BULLETS ));
- delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( APPLY_NUMBERING ));
- delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( MERGE_SINGLE_LINE_PARA ));
- delete pCheckButtonData;
- delete m_pCheckLB;
+ disposeOnce();
+}
+
+void OfaSwAutoFmtOptionsPage::dispose()
+{
+ if (m_pCheckLB)
+ {
+ delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( REPLACE_BULLETS ));
+ delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( APPLY_NUMBERING ));
+ delete static_cast<ImpUserData*>(m_pCheckLB->GetUserData( MERGE_SINGLE_LINE_PARA ));
+ delete pCheckButtonData;
+ pCheckButtonData = NULL;
+ }
+ m_pCheckLB.disposeAndClear();
+ m_pEditPB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* OfaSwAutoFmtOptionsPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> OfaSwAutoFmtOptionsPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new OfaSwAutoFmtOptionsPage(pParent, *rAttrSet);
+ return VclPtr<SfxTabPage>( new OfaSwAutoFmtOptionsPage(pParent, *rAttrSet), SAL_NO_ACQUIRE );
}
bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* )
@@ -694,7 +731,7 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl)
if( nSelEntryPos == REPLACE_BULLETS ||
nSelEntryPos == APPLY_NUMBERING)
{
- boost::scoped_ptr<SvxCharacterMap> pMapDlg(new SvxCharacterMap(this));
+ ScopedVclPtrInstance< SvxCharacterMap > pMapDlg(this);
ImpUserData* pUserData = static_cast<ImpUserData*>(m_pCheckLB->FirstSelected()->GetUserData());
pMapDlg->SetCharFont(*pUserData->pFont);
pMapDlg->SetChar( (*pUserData->pString)[0] );
@@ -711,11 +748,11 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl)
else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
{
// dialog for per cent settings
- OfaAutoFmtPrcntSet aDlg(this);
- aDlg.GetPrcntFld().SetValue(nPercent);
- if(RET_OK == aDlg.Execute())
+ ScopedVclPtrInstance< OfaAutoFmtPrcntSet > aDlg(this);
+ aDlg->GetPrcntFld().SetValue(nPercent);
+ if(RET_OK == aDlg->Execute())
{
- nPercent = (sal_uInt16)aDlg.GetPrcntFld().GetValue();
+ nPercent = (sal_uInt16)aDlg->GetPrcntFld().GetValue();
sMargin = " " +
unicode::formatPercent(nPercent, Application::GetSettings().GetUILanguageTag());
}
@@ -897,16 +934,31 @@ void OfaAutocorrReplacePage::Resize()
OfaAutocorrReplacePage::~OfaAutocorrReplacePage()
{
+ disposeOnce();
+}
+
+void OfaAutocorrReplacePage::dispose()
+{
aDoubleStringTable.clear();
aChangesTable.clear();
delete pCompareClass;
+ pCompareClass = NULL;
delete pCharClass;
+ pCharClass = NULL;
+
+ m_pTextOnlyCB.clear();
+ m_pShortED.clear();
+ m_pReplaceED.clear();
+ m_pReplaceTLB.clear();
+ m_pNewReplacePB.clear();
+ m_pDeleteReplacePB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* OfaAutocorrReplacePage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> OfaAutocorrReplacePage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new OfaAutocorrReplacePage(pParent, *rSet);
+ return VclPtr<OfaAutocorrReplacePage>::Create(pParent, *rSet);
}
void OfaAutocorrReplacePage::ActivatePage( const SfxItemSet& )
@@ -1400,14 +1452,30 @@ OfaAutocorrExceptPage::OfaAutocorrExceptPage(vcl::Window* pParent, const SfxItem
OfaAutocorrExceptPage::~OfaAutocorrExceptPage()
{
+ disposeOnce();
+}
+
+void OfaAutocorrExceptPage::dispose()
+{
aStringsTable.clear();
delete pCompareClass;
+ m_pAbbrevED.clear();
+ m_pAbbrevLB.clear();
+ m_pNewAbbrevPB.clear();
+ m_pDelAbbrevPB.clear();
+ m_pAutoAbbrevCB.clear();
+ m_pDoubleCapsED.clear();
+ m_pDoubleCapsLB.clear();
+ m_pNewDoublePB.clear();
+ m_pDelDoublePB.clear();
+ m_pAutoCapsCB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* OfaAutocorrExceptPage::Create( vcl::Window* pParent,
- const SfxItemSet* rSet)
+VclPtr<SfxTabPage> OfaAutocorrExceptPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rSet)
{
- return new OfaAutocorrExceptPage(pParent, *rSet);
+ return VclPtr<OfaAutocorrExceptPage>::Create(pParent, *rSet);
}
void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet& )
@@ -1618,7 +1686,7 @@ void OfaAutocorrExceptPage::Reset( const SfxItemSet* )
IMPL_LINK(OfaAutocorrExceptPage, NewDelHdl, void*, pBtn)
{
- if((pBtn == m_pNewAbbrevPB || pBtn == m_pAbbrevED )
+ if((pBtn == m_pNewAbbrevPB || pBtn == m_pAbbrevED.get() )
&& !m_pAbbrevED->GetText().isEmpty())
{
m_pAbbrevLB->InsertEntry(m_pAbbrevED->GetText());
@@ -1629,7 +1697,7 @@ IMPL_LINK(OfaAutocorrExceptPage, NewDelHdl, void*, pBtn)
m_pAbbrevLB->RemoveEntry(m_pAbbrevED->GetText());
ModifyHdl(m_pAbbrevED);
}
- else if((pBtn == m_pNewDoublePB || pBtn == m_pDoubleCapsED )
+ else if((pBtn == m_pNewDoublePB || pBtn == m_pDoubleCapsED.get() )
&& !m_pDoubleCapsED->GetText().isEmpty())
{
m_pDoubleCapsLB->InsertEntry(m_pDoubleCapsED->GetText());
@@ -1756,7 +1824,7 @@ OfaQuoteTabPage::OfaQuoteTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
pListContainer->set_width_request(aControlSize.Width());
pListContainer->set_height_request(aControlSize.Height());
- m_pSwCheckLB = new OfaACorrCheckListBox(*pListContainer),
+ m_pSwCheckLB = VclPtr<OfaACorrCheckListBox>::Create(*pListContainer),
get(m_pSingleTypoCB, "singlereplace");
get(m_pSglStartQuotePB, "startsingle");
@@ -1817,14 +1885,35 @@ OfaQuoteTabPage::OfaQuoteTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
OfaQuoteTabPage::~OfaQuoteTabPage()
{
- delete pCheckButtonData;
- delete m_pSwCheckLB;
+ disposeOnce();
}
-SfxTabPage* OfaQuoteTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+void OfaQuoteTabPage::dispose()
{
- return new OfaQuoteTabPage(pParent, *rAttrSet);
+ delete pCheckButtonData;
+ pCheckButtonData = NULL;
+ m_pSwCheckLB.disposeAndClear();
+ m_pCheckLB.disposeAndClear();
+ m_pSingleTypoCB.clear();
+ m_pSglStartQuotePB.clear();
+ m_pSglStartExFT.clear();
+ m_pSglEndQuotePB.clear();
+ m_pSglEndExFT.clear();
+ m_pSglStandardPB.clear();
+ m_pDoubleTypoCB.clear();
+ m_pDblStartQuotePB.clear();
+ m_pDblStartExFT.clear();
+ m_pDblEndQuotePB.clear();
+ m_pDblEndExFT.clear();
+ m_pDblStandardPB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> OfaQuoteTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
+{
+ return VclPtr<SfxTabPage>( new OfaQuoteTabPage(pParent, *rAttrSet),
+ SAL_NO_ACQUIRE );
}
bool OfaQuoteTabPage::FillItemSet( SfxItemSet* )
@@ -1973,7 +2062,7 @@ IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn )
else if (pBtn == m_pDblEndQuotePB)
nMode = DBL_END;
// start character selection dialog
- boost::scoped_ptr<SvxCharacterMap> pMap(new SvxCharacterMap( this, true ));
+ ScopedVclPtrInstance< SvxCharacterMap > pMap( this, true );
pMap->SetCharFont( OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT,
LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE, 0 ));
pMap->SetText(nMode < SGL_END ? m_sStartQuoteDlg : m_sEndQuoteDlg );
@@ -2143,12 +2232,28 @@ OfaAutoCompleteTabPage::OfaAutoCompleteTabPage(vcl::Window* pParent,
OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage()
{
+ disposeOnce();
}
-SfxTabPage* OfaAutoCompleteTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rSet)
+void OfaAutoCompleteTabPage::dispose()
{
- return new OfaAutoCompleteTabPage( pParent, *rSet );
+ m_pCBActiv.clear();
+ m_pCBAppendSpace.clear();
+ m_pCBAsTip.clear();
+ m_pCBCollect.clear();
+ m_pCBRemoveList.clear();
+ m_pDCBExpandKey.clear();
+ m_pNFMinWordlen.clear();
+ m_pNFMaxEntries.clear();
+ m_pLBEntries.clear();
+ m_pPBEntries.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> OfaAutoCompleteTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rSet)
+{
+ return VclPtr<SfxTabPage>( new OfaAutoCompleteTabPage( pParent, *rSet ), SAL_NO_ACQUIRE );
}
bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* )
@@ -2318,6 +2423,17 @@ void OfaAutoCompleteTabPage::CopyToClipboard() const
}
}
+OfaAutoCompleteTabPage::AutoCompleteMultiListBox::~AutoCompleteMultiListBox()
+{
+ disposeOnce();
+}
+
+void OfaAutoCompleteTabPage::AutoCompleteMultiListBox::dispose()
+{
+ m_pPage.clear();
+ MultiListBox::dispose();
+}
+
bool OfaAutoCompleteTabPage::AutoCompleteMultiListBox::PreNotify(
NotifyEvent& rNEvt )
{
@@ -2381,12 +2497,20 @@ OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( vcl::Window* pParent,
OfaSmartTagOptionsTabPage::~OfaSmartTagOptionsTabPage()
{
+ disposeOnce();
+}
+void OfaSmartTagOptionsTabPage::dispose()
+{
+ m_pMainCB.clear();
+ m_pSmartTagTypesLB.clear();
+ m_pPropertiesPB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* OfaSmartTagOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> OfaSmartTagOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new OfaSmartTagOptionsTabPage( pParent, *rSet );
+ return VclPtr<OfaSmartTagOptionsTabPage>::Create( pParent, *rSet );
}
/** This struct is used to associate list box entries with smart tag data
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 6be44956e12d..6ff30321d4d3 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -183,6 +183,7 @@ public:
BackgroundPreviewImpl(vcl::Window* pParent);
void setBmp(bool bBmp);
virtual ~BackgroundPreviewImpl();
+ virtual void dispose() SAL_OVERRIDE;
void NotifyChange( const Color& rColor );
void NotifyChange( const Bitmap* pBitmap );
@@ -230,9 +231,15 @@ void BackgroundPreviewImpl::setBmp(bool bBmp)
BackgroundPreviewImpl::~BackgroundPreviewImpl()
{
- delete pBitmap;
+ disposeOnce();
}
+void BackgroundPreviewImpl::dispose()
+{
+ delete pBitmap;
+ pBitmap = NULL;
+ vcl::Window::dispose();
+}
void BackgroundPreviewImpl::NotifyChange( const Color& rColor )
{
@@ -422,9 +429,20 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe
SvxBackgroundTabPage::~SvxBackgroundTabPage()
{
- delete pPageImpl->pLoadIdle;
- delete pPageImpl;
+ disposeOnce();
+}
+
+void SvxBackgroundTabPage::dispose()
+{
+ if (pPageImpl)
+ {
+ delete pPageImpl->pLoadIdle;
+ delete pPageImpl;
+ pPageImpl = NULL;
+ }
+
delete pImportDlg;
+ pImportDlg = NULL;
if( pTableBck_Impl)
{
@@ -432,6 +450,7 @@ SvxBackgroundTabPage::~SvxBackgroundTabPage()
delete pTableBck_Impl->pRowBrush;
delete pTableBck_Impl->pTableBrush;
delete pTableBck_Impl;
+ pTableBck_Impl = NULL;
}
if(pParaBck_Impl)
@@ -439,21 +458,44 @@ SvxBackgroundTabPage::~SvxBackgroundTabPage()
delete pParaBck_Impl->pParaBrush;
delete pParaBck_Impl->pCharBrush;
delete pParaBck_Impl;
+ pParaBck_Impl = NULL;
}
-}
-
+ m_pAsGrid.clear();
+ m_pSelectTxt.clear();
+ m_pLbSelect.clear();
+ m_pTblDesc.clear();
+ m_pTblLBox.clear();
+ m_pParaLBox.clear();
+ m_pBackGroundColorFrame.clear();
+ m_pBackgroundColorSet.clear();
+ m_pPreviewWin1.clear();
+ m_pColTransFT.clear();
+ m_pColTransMF.clear();
+ m_pBtnPreview.clear();
+ m_pBitmapContainer.clear();
+ m_pFileFrame.clear();
+ m_pBtnBrowse.clear();
+ m_pBtnLink.clear();
+ m_pFtUnlinked.clear();
+ m_pFtFile.clear();
+ m_pTypeFrame.clear();
+ m_pBtnPosition.clear();
+ m_pBtnArea.clear();
+ m_pBtnTile.clear();
+ m_pWndPosition.clear();
+ m_pGraphTransFrame.clear();
+ m_pGraphTransMF.clear();
+ m_pPreviewWin2.clear();
+ SvxTabPage::dispose();
+}
-SfxTabPage* SvxBackgroundTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
-
-/* [Description]
- create method for the TabDialog
-*/
+VclPtr<SfxTabPage> SvxBackgroundTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SvxBackgroundTabPage( pParent, *rAttrSet ) );
+ return VclPtr<SfxTabPage>( new SvxBackgroundTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE );
}
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 803779389026..387e003402c3 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -334,21 +334,47 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore
m_pMergeAdjacentBordersCB->Hide();
}
-
-
SvxBorderTabPage::~SvxBorderTabPage()
{
+ disposeOnce();
}
-
-
-SfxTabPage* SvxBorderTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+void SvxBorderTabPage::dispose()
{
- return ( new SvxBorderTabPage( pParent, *rAttrSet ) );
+ m_pWndPresets.clear();
+ m_pUserDefFT.clear();
+ m_pFrameSel.clear();
+ m_pLbLineStyle.clear();
+ m_pLbLineColor.clear();
+ m_pLineWidthMF.clear();
+ m_pSpacingFrame.clear();
+ m_pLeftFT.clear();
+ m_pLeftMF.clear();
+ m_pRightFT.clear();
+ m_pRightMF.clear();
+ m_pTopFT.clear();
+ m_pTopMF.clear();
+ m_pBottomFT.clear();
+ m_pBottomMF.clear();
+ m_pSynchronizeCB.clear();
+ m_pShadowFrame.clear();
+ m_pWndShadows.clear();
+ m_pFtShadowSize.clear();
+ m_pEdShadowSize.clear();
+ m_pFtShadowColor.clear();
+ m_pLbShadowColor.clear();
+ m_pPropertiesFrame.clear();
+ m_pMergeWithNextCB.clear();
+ m_pMergeAdjacentBordersCB.clear();
+ SfxTabPage::dispose();
}
-
+VclPtr<SfxTabPage> SvxBorderTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SfxTabPage>(new SvxBorderTabPage( pParent, *rAttrSet ),
+ SAL_NO_ACQUIRE);
+}
void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder, const SvxBorderLine* pCoreLine, bool bValid )
{
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 6df37aa3d3d8..96da16d8c445 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -183,12 +183,16 @@ SvxCharBasePage::SvxCharBasePage(vcl::Window* pParent, const OString& rID, const
{
}
-
-
SvxCharBasePage::~SvxCharBasePage()
{
+ disposeOnce();
}
+void SvxCharBasePage::dispose()
+{
+ m_pPreviewWin.clear();
+ SfxTabPage::dispose();
+}
void SvxCharBasePage::ActivatePage( const SfxItemSet& rSet )
@@ -375,10 +379,45 @@ SvxCharNamePage::SvxCharNamePage( vcl::Window* pParent, const SfxItemSet& rInSet
SvxCharNamePage::~SvxCharNamePage()
{
- delete m_pImpl;
+ disposeOnce();
}
-
+void SvxCharNamePage::dispose()
+{
+ delete m_pImpl;
+ m_pImpl = NULL;
+ m_pWestFrame.clear();
+ m_pWestFontNameFT.clear();
+ m_pWestFontNameLB.clear();
+ m_pWestFontStyleFT.clear();
+ m_pWestFontStyleLB.clear();
+ m_pWestFontSizeFT.clear();
+ m_pWestFontSizeLB.clear();
+ m_pWestFontLanguageFT.clear();
+ m_pWestFontLanguageLB.clear();
+ m_pWestFontTypeFT.clear();
+ m_pEastFrame.clear();
+ m_pEastFontNameFT.clear();
+ m_pEastFontNameLB.clear();
+ m_pEastFontStyleFT.clear();
+ m_pEastFontStyleLB.clear();
+ m_pEastFontSizeFT.clear();
+ m_pEastFontSizeLB.clear();
+ m_pEastFontLanguageFT.clear();
+ m_pEastFontLanguageLB.clear();
+ m_pEastFontTypeFT.clear();
+ m_pCTLFrame.clear();
+ m_pCTLFontNameFT.clear();
+ m_pCTLFontNameLB.clear();
+ m_pCTLFontStyleFT.clear();
+ m_pCTLFontStyleLB.clear();
+ m_pCTLFontSizeFT.clear();
+ m_pCTLFontSizeLB.clear();
+ m_pCTLFontLanguageFT.clear();
+ m_pCTLFontLanguageLB.clear();
+ m_pCTLFontTypeFT.clear();
+ SvxCharBasePage::dispose();
+}
void SvxCharNamePage::Initialize()
{
@@ -1180,9 +1219,10 @@ SfxTabPage::sfxpg SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet )
-SfxTabPage* SvxCharNamePage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxCharNamePage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxCharNamePage( pParent, *rSet );
+ return VclPtr<SfxTabPage>( new SvxCharNamePage( pParent, *rSet ),
+ SAL_NO_ACQUIRE );
}
@@ -1337,6 +1377,37 @@ SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet&
Initialize();
}
+SvxCharEffectsPage::~SvxCharEffectsPage()
+{
+ disposeOnce();
+}
+
+void SvxCharEffectsPage::dispose()
+{
+ m_pFontColorFT.clear();
+ m_pFontColorLB.clear();
+ m_pEffectsFT.clear();
+ m_pEffectsLB.clear();
+ m_pReliefFT.clear();
+ m_pReliefLB.clear();
+ m_pOutlineBtn.clear();
+ m_pShadowBtn.clear();
+ m_pBlinkingBtn.clear();
+ m_pHiddenBtn.clear();
+ m_pOverlineLB.clear();
+ m_pOverlineColorFT.clear();
+ m_pOverlineColorLB.clear();
+ m_pStrikeoutLB.clear();
+ m_pUnderlineLB.clear();
+ m_pUnderlineColorFT.clear();
+ m_pUnderlineColorLB.clear();
+ m_pIndividualWordsBtn.clear();
+ m_pEmphasisFT.clear();
+ m_pEmphasisLB.clear();
+ m_pPositionFT.clear();
+ m_pPositionLB.clear();
+ SvxCharBasePage::dispose();
+}
void SvxCharEffectsPage::Initialize()
@@ -1440,12 +1511,6 @@ void SvxCharEffectsPage::Initialize()
}
}
-SvxCharEffectsPage::~SvxCharEffectsPage()
-{
-}
-
-
-
void SvxCharEffectsPage::UpdatePreview_Impl()
{
SvxFont& rFont = GetPreviewFont();
@@ -1643,7 +1708,7 @@ IMPL_LINK( SvxCharEffectsPage, SelectHdl_Impl, ListBox*, pBox )
m_pOutlineBtn->Enable( bEnable );
m_pShadowBtn->Enable( bEnable );
}
- else if ( m_pPositionLB != pBox )
+ else if ( m_pPositionLB.get() != pBox )
{
sal_Int32 nUPos = m_pUnderlineLB->GetSelectEntryPos(),
nOPos = m_pOverlineLB->GetSelectEntryPos(),
@@ -1720,9 +1785,10 @@ SfxTabPage::sfxpg SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet )
-SfxTabPage* SvxCharEffectsPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxCharEffectsPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxCharEffectsPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>( new SvxCharEffectsPage( pParent, *rSet ),
+ SAL_NO_ACQUIRE );
}
@@ -2585,6 +2651,35 @@ SvxCharPositionPage::SvxCharPositionPage( vcl::Window* pParent, const SfxItemSet
Initialize();
}
+SvxCharPositionPage::~SvxCharPositionPage()
+{
+ disposeOnce();
+}
+
+void SvxCharPositionPage::dispose()
+{
+ m_pHighPosBtn.clear();
+ m_pNormalPosBtn.clear();
+ m_pLowPosBtn.clear();
+ m_pHighLowFT.clear();
+ m_pHighLowMF.clear();
+ m_pHighLowRB.clear();
+ m_pFontSizeFT.clear();
+ m_pFontSizeMF.clear();
+ m_pRotationContainer.clear();
+ m_pScalingFT.clear();
+ m_pScalingAndRotationFT.clear();
+ m_p0degRB.clear();
+ m_p90degRB.clear();
+ m_p270degRB.clear();
+ m_pFitToLineCB.clear();
+ m_pScaleWidthMF.clear();
+ m_pKerningLB.clear();
+ m_pKerningFT.clear();
+ m_pKerningMF.clear();
+ m_pPairKerningBtn.clear();
+ SvxCharBasePage::dispose();
+}
void SvxCharPositionPage::Initialize()
@@ -2627,12 +2722,6 @@ void SvxCharPositionPage::Initialize()
m_pScaleWidthMF->SetModifyHdl( LINK( this, SvxCharPositionPage, ScaleWidthModifyHdl_Impl ) );
}
-SvxCharPositionPage::~SvxCharPositionPage()
-{
-}
-
-
-
void SvxCharPositionPage::UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc )
{
SetPrevFontEscapement( nProp, nEscProp, nEsc );
@@ -2887,9 +2976,10 @@ SfxTabPage::sfxpg SvxCharPositionPage::DeactivatePage( SfxItemSet* _pSet )
-SfxTabPage* SvxCharPositionPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxCharPositionPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxCharPositionPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>( new SvxCharPositionPage( pParent, *rSet ),
+ SAL_NO_ACQUIRE );
}
@@ -3323,9 +3413,17 @@ SvxCharTwoLinesPage::SvxCharTwoLinesPage(vcl::Window* pParent, const SfxItemSet&
SvxCharTwoLinesPage::~SvxCharTwoLinesPage()
{
+ disposeOnce();
}
-
+void SvxCharTwoLinesPage::dispose()
+{
+ m_pTwoLinesBtn.clear();
+ m_pEnclosingFrame.clear();
+ m_pStartBracketLB.clear();
+ m_pEndBracketLB.clear();
+ SvxCharBasePage::dispose();
+}
void SvxCharTwoLinesPage::Initialize()
{
@@ -3351,7 +3449,7 @@ void SvxCharTwoLinesPage::Initialize()
void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
{
bool bStart = pBox == m_pStartBracketLB;
- boost::scoped_ptr<SvxCharacterMap> aDlg(new SvxCharacterMap( this ));
+ VclPtrInstance< SvxCharacterMap > aDlg( this );
aDlg->DisableFontSelection();
if ( aDlg->Execute() == RET_OK )
@@ -3451,9 +3549,10 @@ SfxTabPage::sfxpg SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet )
-SfxTabPage* SvxCharTwoLinesPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxCharTwoLinesPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxCharTwoLinesPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>( new SvxCharTwoLinesPage( pParent, *rSet ),
+ SAL_NO_ACQUIRE );
}
void SvxCharTwoLinesPage::Reset( const SfxItemSet* rSet )
diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx
index 6b49e2aa0e83..66b493516fc1 100644
--- a/cui/source/tabpages/connect.cxx
+++ b/cui/source/tabpages/connect.cxx
@@ -54,7 +54,7 @@ SvxConnectionDialog::SvxConnectionDialog( vcl::Window* pParent, const SfxItemSet
const SdrView* pSdrView )
: SfxSingleTabDialog(pParent, rInAttrs)
{
- SvxConnectionPage* _pPage = new SvxConnectionPage( get_content_area(), rInAttrs );
+ VclPtrInstance<SvxConnectionPage> _pPage( get_content_area(), rInAttrs );
_pPage->SetView( pSdrView );
_pPage->Construct();
@@ -65,16 +65,6 @@ SvxConnectionDialog::SvxConnectionDialog( vcl::Window* pParent, const SfxItemSet
/*************************************************************************
|*
-|* Dtor
-|*
-\************************************************************************/
-
-SvxConnectionDialog::~SvxConnectionDialog()
-{
-}
-
-/*************************************************************************
-|*
|* page for changing connectors
|*
\************************************************************************/
@@ -141,14 +131,26 @@ SvxConnectionPage::SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rI
m_pLbType->SetSelectHdl( aLink );
}
-/*************************************************************************
-|*
-|* Dtor
-|*
-\************************************************************************/
-
SvxConnectionPage::~SvxConnectionPage()
{
+ disposeOnce();
+}
+
+void SvxConnectionPage::dispose()
+{
+ m_pLbType.clear();
+ m_pFtLine1.clear();
+ m_pMtrFldLine1.clear();
+ m_pFtLine2.clear();
+ m_pMtrFldLine2.clear();
+ m_pFtLine3.clear();
+ m_pMtrFldLine3.clear();
+ m_pMtrFldHorz1.clear();
+ m_pMtrFldVert1.clear();
+ m_pMtrFldHorz2.clear();
+ m_pMtrFldVert2.clear();
+ m_pCtlPreview.clear();
+ SfxTabPage::dispose();
}
/*************************************************************************
@@ -388,10 +390,10 @@ void SvxConnectionPage::Construct()
|*
\************************************************************************/
-SfxTabPage* SvxConnectionPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxConnectionPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SvxConnectionPage( pWindow, *rAttrs );
+ return VclPtr<SvxConnectionPage>::Create( pWindow, *rAttrs );
}
IMPL_LINK( SvxConnectionPage, ChangeAttrHdl_Impl, void *, p )
diff --git a/cui/source/tabpages/dstribut.cxx b/cui/source/tabpages/dstribut.cxx
index 86d23299112b..ac14dbd34f17 100644
--- a/cui/source/tabpages/dstribut.cxx
+++ b/cui/source/tabpages/dstribut.cxx
@@ -37,10 +37,21 @@ SvxDistributeDialog::SvxDistributeDialog(vcl::Window* pParent,
"cui/ui/distributiondialog.ui")
, mpPage(NULL)
{
- mpPage = new SvxDistributePage(get_content_area(), rInAttrs, eHor, eVer);
+ mpPage = VclPtr<SvxDistributePage>::Create(get_content_area(), rInAttrs, eHor, eVer);
SetTabPage(mpPage);
}
+SvxDistributeDialog::~SvxDistributeDialog()
+{
+ disposeOnce();
+}
+
+void SvxDistributeDialog::dispose()
+{
+ mpPage.clear();
+ SfxSingleTabDialog::dispose();
+}
+
/*************************************************************************
|*
|* Tabpage
@@ -68,16 +79,37 @@ SvxDistributePage::SvxDistributePage(vcl::Window* pWindow,
get(m_pBtnVerBottom, "verbottom");
}
+SvxDistributePage::~SvxDistributePage()
+{
+ disposeOnce();
+}
+
+void SvxDistributePage::dispose()
+{
+ m_pBtnHorNone.clear();
+ m_pBtnHorLeft.clear();
+ m_pBtnHorCenter.clear();
+ m_pBtnHorDistance.clear();
+ m_pBtnHorRight.clear();
+ m_pBtnVerNone.clear();
+ m_pBtnVerTop.clear();
+ m_pBtnVerCenter.clear();
+ m_pBtnVerDistance.clear();
+ m_pBtnVerBottom.clear();
+ SvxTabPage::dispose();
+}
+
+
/*************************************************************************
|*
|* create the tabpage
|*
\************************************************************************/
-SfxTabPage* SvxDistributePage::Create(vcl::Window* pWindow, const SfxItemSet& rAttrs,
+VclPtr<SfxTabPage> SvxDistributePage::Create(vcl::Window* pWindow, const SfxItemSet& rAttrs,
SvxDistributeHorizontal eHor, SvxDistributeVertical eVer)
{
- return new SvxDistributePage(pWindow, rAttrs, eHor, eVer);
+ return VclPtr<SvxDistributePage>::Create(pWindow, rAttrs, eHor, eVer);
}
void SvxDistributePage::PointChanged(vcl::Window* /*pWindow*/, RECT_POINT /*eRP*/)
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index c416ad7c267f..af1c96b4be62 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -127,12 +127,37 @@ SvxGrfCropPage::SvxGrfCropPage ( vcl::Window *pParent, const SfxItemSet &rSet )
SvxGrfCropPage::~SvxGrfCropPage()
{
+ disposeOnce();
+}
+
+void SvxGrfCropPage::dispose()
+{
aTimer.Stop();
+ m_pCropFrame.clear();
+ m_pZoomConstRB.clear();
+ m_pSizeConstRB.clear();
+ m_pLeftMF.clear();
+ m_pRightMF.clear();
+ m_pTopMF.clear();
+ m_pBottomMF.clear();
+ m_pScaleFrame.clear();
+ m_pWidthZoomMF.clear();
+ m_pHeightZoomMF.clear();
+ m_pSizeFrame.clear();
+ m_pWidthMF.clear();
+ m_pHeightMF.clear();
+ m_pOrigSizeGrid.clear();
+ m_pOrigSizeFT.clear();
+ m_pOrigSizePB.clear();
+ m_pExampleWN.clear();
+ pLastCropField.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxGrfCropPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+VclPtr<SfxTabPage> SvxGrfCropPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
{
- return new SvxGrfCropPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>( new SvxGrfCropPage( pParent, *rSet ),
+ SAL_NO_ACQUIRE );
}
void SvxGrfCropPage::Reset( const SfxItemSet *rSet )
@@ -675,17 +700,17 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
// display original size
const FieldUnit eMetric = GetModuleFieldUnit( GetItemSet() );
- MetricField aFld(this, WB_HIDE);
- SetFieldUnit( aFld, eMetric );
- aFld.SetDecimalDigits( m_pWidthMF->GetDecimalDigits() );
- aFld.SetMax( LONG_MAX - 1 );
+ ScopedVclPtrInstance< MetricField > aFld(this, WB_HIDE);
+ SetFieldUnit( *aFld.get(), eMetric );
+ aFld->SetDecimalDigits( m_pWidthMF->GetDecimalDigits() );
+ aFld->SetMax( LONG_MAX - 1 );
- aFld.SetValue( aFld.Normalize( aOrigSize.Width() ), eUnit );
- OUString sTemp = aFld.GetText();
- aFld.SetValue( aFld.Normalize( aOrigSize.Height() ), eUnit );
+ aFld->SetValue( aFld->Normalize( aOrigSize.Width() ), eUnit );
+ OUString sTemp = aFld->GetText();
+ aFld->SetValue( aFld->Normalize( aOrigSize.Height() ), eUnit );
// multiplication sign (U+00D7)
sTemp += OUString( sal_Unicode (0x00D7) );
- sTemp += aFld.GetText();
+ sTemp += aFld->GetText();
if ( aOrigPixelSize.Width() && aOrigPixelSize.Height() ) {
sal_Int32 ax = sal_Int32(floor((float)aOrigPixelSize.Width() /
diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx
index 243d9dcf038d..d57e180245d1 100644
--- a/cui/source/tabpages/labdlg.cxx
+++ b/cui/source/tabpages/labdlg.cxx
@@ -138,6 +138,26 @@ SvxCaptionTabPage::SvxCaptionTabPage(vcl::Window* pParent, const SfxItemSet& rIn
m_pCB_LAENGE->SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl));
}
+SvxCaptionTabPage::~SvxCaptionTabPage()
+{
+ disposeOnce();
+}
+
+void SvxCaptionTabPage::dispose()
+{
+ m_pCT_CAPTTYPE.clear();
+ m_pMF_ABSTAND.clear();
+ m_pLB_ANSATZ.clear();
+ m_pFT_UM.clear();
+ m_pMF_ANSATZ.clear();
+ m_pFT_ANSATZ_REL.clear();
+ m_pLB_ANSATZ_REL.clear();
+ m_pFT_LAENGE.clear();
+ m_pMF_LAENGE.clear();
+ m_pCB_LAENGE.clear();
+ SfxTabPage::dispose();
+}
+
void SvxCaptionTabPage::Construct()
{
// set rectangle and working area
@@ -336,10 +356,10 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* )
-SfxTabPage* SvxCaptionTabPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rOutAttrs )
+VclPtr<SfxTabPage> SvxCaptionTabPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rOutAttrs )
{
- return new SvxCaptionTabPage( pWindow, *rOutAttrs );
+ return VclPtr<SvxCaptionTabPage>::Create( pWindow, *rOutAttrs );
}
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index 64d38b7e4ddf..ced57182cea9 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -44,16 +44,16 @@ class _SfxMacroTabPage_Impl
public:
_SfxMacroTabPage_Impl();
- OUString maStaticMacroLBLabel;
- PushButton* pAssignPB;
- PushButton* pDeletePB;
- OUString sStrEvent;
- OUString sAssignedMacro;
- MacroEventListBox* pEventLB;
- VclFrame* pGroupFrame;
- SfxConfigGroupListBox* pGroupLB;
- VclFrame* pMacroFrame;
- SfxConfigFunctionListBox* pMacroLB;
+ OUString maStaticMacroLBLabel;
+ VclPtr<PushButton> pAssignPB;
+ VclPtr<PushButton> pDeletePB;
+ OUString sStrEvent;
+ OUString sAssignedMacro;
+ VclPtr<MacroEventListBox> pEventLB;
+ VclPtr<VclFrame> pGroupFrame;
+ VclPtr<SfxConfigGroupListBox> pGroupLB;
+ VclPtr<VclFrame> pMacroFrame;
+ VclPtr<SfxConfigFunctionListBox> pMacroLB;
bool bReadOnly;
Idle maFillGroupIdle;
@@ -143,7 +143,13 @@ _SfxMacroTabPage::_SfxMacroTabPage(vcl::Window* pParent, const SfxItemSet& rAttr
_SfxMacroTabPage::~_SfxMacroTabPage()
{
+ disposeOnce();
+}
+
+void _SfxMacroTabPage::dispose()
+{
DELETEZ( mpImpl );
+ SfxTabPage::dispose();
}
void _SfxMacroTabPage::AddEvent( const OUString & rEventName, sal_uInt16 nEventId )
@@ -454,13 +460,13 @@ SfxMacroTabPage::SfxMacroTabPage(vcl::Window* pParent, const Reference< XFrame >
namespace
{
- SfxMacroTabPage* CreateSfxMacroTabPage( vcl::Window* pParent, const SfxItemSet& rAttrSet )
+ VclPtr<SfxMacroTabPage> CreateSfxMacroTabPage( vcl::Window* pParent, const SfxItemSet& rAttrSet )
{
- return new SfxMacroTabPage( pParent, NULL, rAttrSet );
+ return VclPtr<SfxMacroTabPage>( new SfxMacroTabPage( pParent, NULL, rAttrSet ), SAL_NO_ACQUIRE );
}
}
-SfxTabPage* SfxMacroTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SfxMacroTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
return CreateSfxMacroTabPage(pParent, *rAttrSet);
}
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx
index ea086be40fb3..2053ecf37977 100644
--- a/cui/source/tabpages/measure.cxx
+++ b/cui/source/tabpages/measure.cxx
@@ -64,7 +64,7 @@ SvxMeasureDialog::SvxMeasureDialog( vcl::Window* pParent, const SfxItemSet& rInA
const SdrView* pSdrView )
: SfxSingleTabDialog(pParent, rInAttrs)
{
- SvxMeasurePage* _pPage = new SvxMeasurePage( get_content_area(), rInAttrs );
+ VclPtrInstance<SvxMeasurePage> _pPage( get_content_area(), rInAttrs );
_pPage->SetView( pSdrView );
_pPage->Construct();
@@ -148,14 +148,29 @@ SvxMeasurePage::SvxMeasurePage( vcl::Window* pWindow, const SfxItemSet& rInAttrs
m_pLbUnit->SetSelectHdl( aLink );
}
-/*************************************************************************
-|*
-|* Dtor
-|*
-\************************************************************************/
-
SvxMeasurePage::~SvxMeasurePage()
{
+ disposeOnce();
+}
+
+void SvxMeasurePage::dispose()
+{
+ m_pMtrFldLineDist.clear();
+ m_pMtrFldHelplineOverhang.clear();
+ m_pMtrFldHelplineDist.clear();
+ m_pMtrFldHelpline1Len.clear();
+ m_pMtrFldHelpline2Len.clear();
+ m_pTsbBelowRefEdge.clear();
+ m_pMtrFldDecimalPlaces.clear();
+ m_pCtlPosition.clear();
+ m_pTsbAutoPosV.clear();
+ m_pTsbAutoPosH.clear();
+ m_pTsbShowUnit.clear();
+ m_pLbUnit.clear();
+ m_pTsbParallel.clear();
+ m_pFtAutomatic.clear();
+ m_pCtlPreview.clear();
+ SvxTabPage::dispose();
}
/*************************************************************************
@@ -587,16 +602,10 @@ void SvxMeasurePage::Construct()
m_pCtlPreview->Invalidate();
}
-/*************************************************************************
-|*
-|* create the tabpage
-|*
-\************************************************************************/
-
-SfxTabPage* SvxMeasurePage::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxMeasurePage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SvxMeasurePage( pWindow, *rAttrs );
+ return VclPtr<SvxMeasurePage>::Create( pWindow, *rAttrs );
}
void SvxMeasurePage::PointChanged( vcl::Window* pWindow, RECT_POINT /*eRP*/ )
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index bc6f14273893..852607ca84c5 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -282,8 +282,41 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(vcl::Window* pParent,
SvxNumberFormatTabPage::~SvxNumberFormatTabPage()
{
+ disposeOnce();
+}
+
+
+void SvxNumberFormatTabPage::dispose()
+{
delete pNumFmtShell;
+ pNumFmtShell = NULL;
delete pNumItem;
+ pNumItem = NULL;
+ m_pFtCategory.clear();
+ m_pLbCategory.clear();
+ m_pFtFormat.clear();
+ m_pLbCurrency.clear();
+ m_pLbFormat.clear();
+ m_pFtLanguage.clear();
+ m_pLbLanguage.clear();
+ m_pCbSourceFormat.clear();
+ m_pWndPreview.clear();
+ m_pFtOptions.clear();
+ m_pFtDecimals.clear();
+ m_pEdDecimals.clear();
+ m_pBtnNegRed.clear();
+ m_pFtLeadZeroes.clear();
+ m_pEdLeadZeroes.clear();
+ m_pBtnThousand.clear();
+ m_pFormatCodeFrame.clear();
+ m_pEdFormat.clear();
+ m_pIbAdd.clear();
+ m_pIbInfo.clear();
+ m_pIbRemove.clear();
+ m_pFtComment.clear();
+ m_pEdComment.clear();
+ pLastActivWindow.clear();
+ SfxTabPage::dispose();
}
void SvxNumberFormatTabPage::Init_Impl()
@@ -347,21 +380,10 @@ void SvxNumberFormatTabPage::Init_Impl()
}
}
-/*************************************************************************
-#* Method: Create
-#*------------------------------------------------------------------------
-#*
-#* Class: SvxNumberFormatTabPage
-#* Function: Creates a new number format page.
-#* Input: Window, SfxItemSet
-#* Output: new TabPage
-#*
-#************************************************************************/
-
-SfxTabPage* SvxNumberFormatTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxNumberFormatTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SvxNumberFormatTabPage( pParent, *rAttrSet ) );
+ return VclPtr<SfxTabPage>( new SvxNumberFormatTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE );
}
@@ -1644,7 +1666,7 @@ bool SvxNumberFormatTabPage::PreNotify( NotifyEvent& rNEvt )
{
if(rNEvt.GetType()==MouseNotifyEvent::LOSEFOCUS)
{
- if ( rNEvt.GetWindow() == dynamic_cast< vcl::Window* >( m_pEdComment ) && !m_pEdComment->IsVisible() )
+ if ( rNEvt.GetWindow() == dynamic_cast< vcl::Window* >( m_pEdComment.get() ) && !m_pEdComment->IsVisible() )
{
pLastActivWindow = NULL;
}
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index a725a70180e5..34a19e76227d 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -219,14 +219,23 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(vcl::Window* pParent,
SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage()
{
+ disposeOnce();
+}
+
+void SvxSingleNumPickTabPage::dispose()
+{
delete pActNum;
+ pActNum = NULL;
delete pSaveNum;
+ pSaveNum = NULL;
+ m_pExamplesVS.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxSingleNumPickTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SvxSingleNumPickTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SvxSingleNumPickTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxSingleNumPickTabPage>::Create(pParent, *rAttrSet);
}
bool SvxSingleNumPickTabPage::FillItemSet( SfxItemSet* rSet )
@@ -380,14 +389,23 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(vcl::Window* pParent,
SvxBulletPickTabPage::~SvxBulletPickTabPage()
{
+ disposeOnce();
+}
+
+void SvxBulletPickTabPage::dispose()
+{
delete pActNum;
+ pActNum = NULL;
delete pSaveNum;
+ pSaveNum = NULL;
+ m_pExamplesVS.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxBulletPickTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SvxBulletPickTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SvxBulletPickTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxBulletPickTabPage>::Create(pParent, *rAttrSet);
}
bool SvxBulletPickTabPage::FillItemSet( SfxItemSet* rSet )
@@ -577,14 +595,23 @@ SvxNumPickTabPage::SvxNumPickTabPage(vcl::Window* pParent,
SvxNumPickTabPage::~SvxNumPickTabPage()
{
+ disposeOnce();
+}
+
+void SvxNumPickTabPage::dispose()
+{
delete pActNum;
+ pActNum = NULL;
delete pSaveNum;
+ pSaveNum = NULL;
+ m_pExamplesVS.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxNumPickTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SvxNumPickTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SvxNumPickTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxNumPickTabPage>::Create(pParent, *rAttrSet);
}
bool SvxNumPickTabPage::FillItemSet( SfxItemSet* rSet )
@@ -818,14 +845,24 @@ SvxBitmapPickTabPage::SvxBitmapPickTabPage(vcl::Window* pParent,
SvxBitmapPickTabPage::~SvxBitmapPickTabPage()
{
+ disposeOnce();
+}
+
+void SvxBitmapPickTabPage::dispose()
+{
delete pActNum;
+ pActNum = NULL;
delete pSaveNum;
+ pSaveNum = NULL;
+ m_pErrorText.clear();
+ m_pExamplesVS.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxBitmapPickTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SvxBitmapPickTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SvxBitmapPickTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxBitmapPickTabPage>::Create(pParent, *rAttrSet);
}
void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet)
@@ -1125,9 +1162,53 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(vcl::Window* pParent,
SvxNumOptionsTabPage::~SvxNumOptionsTabPage()
{
- delete m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
+ disposeOnce();
+}
+
+void SvxNumOptionsTabPage::dispose()
+{
+ if (m_pBitmapMB)
+ {
+ delete m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
+ }
delete pActNum;
+ pActNum = NULL;
delete pSaveNum;
+ pSaveNum = NULL;
+ m_pLevelLB.clear();
+ m_pFmtLB.clear();
+ m_pSeparatorFT.clear();
+ m_pPrefixFT.clear();
+ m_pPrefixED.clear();
+ m_pSuffixFT.clear();
+ m_pSuffixED.clear();
+ m_pCharFmtFT.clear();
+ m_pCharFmtLB.clear();
+ m_pBulColorFT.clear();
+ m_pBulColLB.clear();
+ m_pBulRelSizeFT.clear();
+ m_pBulRelSizeMF.clear();
+ m_pAllLevelFT.clear();
+ m_pAllLevelNF.clear();
+ m_pStartFT.clear();
+ m_pStartED.clear();
+ m_pBulletFT.clear();
+ m_pBulletPB.clear();
+ m_pAlignFT.clear();
+ m_pAlignLB.clear();
+ m_pBitmapFT.clear();
+ m_pBitmapMB.clear();
+ m_pWidthFT.clear();
+ m_pWidthMF.clear();
+ m_pHeightFT.clear();
+ m_pHeightMF.clear();
+ m_pRatioCB.clear();
+ m_pOrientFT.clear();
+ m_pOrientLB.clear();
+ m_pAllLevelsFrame.clear();
+ m_pSameLevelCB.clear();
+ m_pPreviewWIN.clear();
+ SfxTabPage::dispose();
}
void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric)
@@ -1141,10 +1222,10 @@ void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric)
m_pHeightMF->SetUnit( eMetric );
}
-SfxTabPage* SvxNumOptionsTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SvxNumOptionsTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SvxNumOptionsTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxNumOptionsTabPage>::Create(pParent, *rAttrSet);
};
void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
@@ -2014,7 +2095,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl)
IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl)
{
- boost::scoped_ptr<SvxCharacterMap> pMap(new SvxCharacterMap( this, true ));
+ VclPtrInstance< SvxCharacterMap > pMap( this, true );
sal_uInt16 nMask = 1;
const vcl::Font* pFmtFont = 0;
@@ -2298,7 +2379,7 @@ void SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
const Color aBackColor = rStyleSettings.GetFieldColor();
const Color aTextColor = rStyleSettings.GetFieldTextColor();
- boost::scoped_ptr<VirtualDevice> pVDev(new VirtualDevice(*this));
+ ScopedVclPtrInstance< VirtualDevice > pVDev(*this);
pVDev->EnableRTL( IsRTLEnabled() );
pVDev->SetMapMode(GetMapMode());
pVDev->SetOutputSize( aSize );
@@ -2683,9 +2764,40 @@ SvxNumPositionTabPage::SvxNumPositionTabPage(vcl::Window* pParent,
SvxNumPositionTabPage::~SvxNumPositionTabPage()
{
+ disposeOnce();
+}
+
+void SvxNumPositionTabPage::dispose()
+{
delete pActNum;
+ pActNum = NULL;
delete pSaveNum;
+ pSaveNum = NULL;
+ m_pLevelLB.clear();
+ m_pDistBorderFT.clear();
+ m_pDistBorderMF.clear();
+ m_pRelativeCB.clear();
+ m_pIndentFT.clear();
+ m_pIndentMF.clear();
+ m_pDistNumFT.clear();
+ m_pDistNumMF.clear();
+ m_pAlignFT.clear();
+ m_pAlignLB.clear();
+ m_pLabelFollowedByFT.clear();
+ m_pLabelFollowedByLB.clear();
+ m_pListtabFT.clear();
+ m_pListtabMF.clear();
+ m_pAlign2FT.clear();
+ m_pAlign2LB.clear();
+ m_pAlignedAtFT.clear();
+ m_pAlignedAtMF.clear();
+ m_pIndentAtFT.clear();
+ m_pIndentAtMF.clear();
+ m_pStandardPB.clear();
+ m_pPreviewWIN.clear();
+ SfxTabPage::dispose();
}
+
/*-------------------------------------------------------*/
#if OSL_DEBUG_LEVEL > 1
@@ -3108,10 +3220,10 @@ void SvxNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
m_pIndentAtMF->Show( bLabelAlignmentPosAndSpaceModeActive );
}
-SfxTabPage* SvxNumPositionTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SvxNumPositionTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SvxNumPositionTabPage(pParent, *rAttrSet);
+ return VclPtr<SvxNumPositionTabPage>::Create(pParent, *rAttrSet);
}
void SvxNumPositionTabPage::SetMetric(FieldUnit eMetric)
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index ef8dc6a41b2c..6a37a3d1f1ed 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -164,9 +164,9 @@ bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize )
// class SvxPageDescPage --------------------------------------------------
-SfxTabPage* SvxPageDescPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxPageDescPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxPageDescPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>(new SvxPageDescPage( pParent, *rSet ), SAL_NO_ACQUIRE );
}
SvxPageDescPage::SvxPageDescPage( vcl::Window* pParent, const SfxItemSet& rAttr ) :
@@ -366,10 +366,46 @@ SvxPageDescPage::SvxPageDescPage( vcl::Window* pParent, const SfxItemSet& rAttr
SvxPageDescPage::~SvxPageDescPage()
{
+ disposeOnce();
+}
+
+void SvxPageDescPage::dispose()
+{
if(mbDelPrinter)
{
- delete mpDefPrinter;
+ mpDefPrinter.disposeAndClear();
+ mbDelPrinter = false;
}
+ m_pPaperSizeBox.clear();
+ m_pPaperWidthEdit.clear();
+ m_pPaperHeightEdit.clear();
+ m_pOrientationFT.clear();
+ m_pPortraitBtn.clear();
+ m_pLandscapeBtn.clear();
+ m_pBspWin.clear();
+ m_pTextFlowLbl.clear();
+ m_pTextFlowBox.clear();
+ m_pPaperTrayBox.clear();
+ m_pLeftMarginLbl.clear();
+ m_pLeftMarginEdit.clear();
+ m_pRightMarginLbl.clear();
+ m_pRightMarginEdit.clear();
+ m_pTopMarginEdit.clear();
+ m_pBottomMarginEdit.clear();
+ m_pPageText.clear();
+ m_pLayoutBox.clear();
+ m_pNumberFormatBox.clear();
+ m_pTblAlignFT.clear();
+ m_pHorzBox.clear();
+ m_pVertBox.clear();
+ m_pAdaptBox.clear();
+ m_pRegisterCB.clear();
+ m_pRegisterFT.clear();
+ m_pRegisterLB.clear();
+ m_pInsideLbl.clear();
+ m_pOutsideLbl.clear();
+ m_pPrintRangeQueryText.clear();
+ SfxTabPage::dispose();
}
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 527f4f760079..56b1345db3ad 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -194,9 +194,9 @@ IMPL_LINK_NOARG(SvxStdParagraphTabPage, ELRLoseFocusHdl)
return 0;
}
-SfxTabPage* SvxStdParagraphTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SvxStdParagraphTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SvxStdParagraphTabPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>( new SvxStdParagraphTabPage( pParent, *rSet ), SAL_NO_ACQUIRE );
}
bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
@@ -656,6 +656,29 @@ SvxStdParagraphTabPage::SvxStdParagraphTabPage( vcl::Window* pParent, const Sfx
SvxStdParagraphTabPage::~SvxStdParagraphTabPage()
{
+ disposeOnce();
+}
+
+void SvxStdParagraphTabPage::dispose()
+{
+ m_pLeftIndent.clear();
+ m_pRightLabel.clear();
+ m_pRightIndent.clear();
+ m_pFLineLabel.clear();
+ m_pFLineIndent.clear();
+ m_pAutoCB.clear();
+ m_pTopDist.clear();
+ m_pBottomDist.clear();
+ m_pContextualCB.clear();
+ m_pLineDist.clear();
+ m_pLineDistAtLabel.clear();
+ m_pLineDistAtPercentBox.clear();
+ m_pLineDistAtMetricBox.clear();
+ m_pAbsDist.clear();
+ m_pExampleWin.clear();
+ m_pRegisterFL.clear();
+ m_pRegisterCB.clear();
+ SfxTabPage::dispose();
}
void SvxStdParagraphTabPage::EnableNegativeMode()
@@ -1018,6 +1041,27 @@ SvxParaAlignTabPage::SvxParaAlignTabPage( vcl::Window* pParent, const SfxItemSet
SvxParaAlignTabPage::~SvxParaAlignTabPage()
{
+ disposeOnce();
+}
+
+void SvxParaAlignTabPage::dispose()
+{
+ m_pLeft.clear();
+ m_pRight.clear();
+ m_pCenter.clear();
+ m_pJustify.clear();
+ m_pLeftBottom.clear();
+ m_pRightTop.clear();
+ m_pLastLineFT.clear();
+ m_pLastLineLB.clear();
+ m_pExpandCB.clear();
+ m_pSnapToGridCB.clear();
+ m_pExampleWin.clear();
+ m_pVertAlignFL.clear();
+ m_pVertAlignLB.clear();
+ m_pPropertiesFL.clear();
+ m_pTextDirectionLB.clear();
+ SfxTabPage::dispose();
}
SfxTabPage::sfxpg SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet )
@@ -1027,9 +1071,9 @@ SfxTabPage::sfxpg SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet )
return LEAVE_PAGE;
}
-SfxTabPage* SvxParaAlignTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxParaAlignTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxParaAlignTabPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>( new SvxParaAlignTabPage(pParent, *rSet), SAL_NO_ACQUIRE );
}
bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
@@ -1300,10 +1344,10 @@ void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet& aSet)
EnableJustifyExt();
}
-SfxTabPage* SvxExtParagraphTabPage::Create( vcl::Window* pParent,
+VclPtr<SfxTabPage> SvxExtParagraphTabPage::Create( vcl::Window* pParent,
const SfxItemSet* rSet )
{
- return new SvxExtParagraphTabPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>( new SvxExtParagraphTabPage( pParent, *rSet ), SAL_NO_ACQUIRE );
}
bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
@@ -1901,6 +1945,36 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage( vcl::Window* pParent, const SfxI
SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
{
+ disposeOnce();
+}
+
+void SvxExtParagraphTabPage::dispose()
+{
+ m_pHyphenBox.clear();
+ m_pBeforeText.clear();
+ m_pExtHyphenBeforeBox.clear();
+ m_pAfterText.clear();
+ m_pExtHyphenAfterBox.clear();
+ m_pMaxHyphenLabel.clear();
+ m_pMaxHyphenEdit.clear();
+ m_pPageBreakBox.clear();
+ m_pBreakTypeFT.clear();
+ m_pBreakTypeLB.clear();
+ m_pBreakPositionFT.clear();
+ m_pBreakPositionLB.clear();
+ m_pApplyCollBtn.clear();
+ m_pApplyCollBox.clear();
+ m_pPagenumText.clear();
+ m_pPagenumEdit.clear();
+ m_pKeepTogetherBox.clear();
+ m_pKeepParaBox.clear();
+ m_pOrphanBox.clear();
+ m_pOrphanRowNo.clear();
+ m_pOrphanRowLabel.clear();
+ m_pWidowBox.clear();
+ m_pWidowRowNo.clear();
+ m_pWidowRowLabel.clear();
+ SfxTabPage::dispose();
}
IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageBreakHdl_Impl)
@@ -2107,11 +2181,20 @@ SvxAsianTabPage::SvxAsianTabPage( vcl::Window* pParent, const SfxItemSet& rSet )
SvxAsianTabPage::~SvxAsianTabPage()
{
+ disposeOnce();
+}
+
+void SvxAsianTabPage::dispose()
+{
+ m_pForbiddenRulesCB.clear();
+ m_pHangingPunctCB.clear();
+ m_pScriptSpaceCB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SvxAsianTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxAsianTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxAsianTabPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SvxAsianTabPage(pParent, *rSet), SAL_NO_ACQUIRE );
}
const sal_uInt16* SvxAsianTabPage::GetRanges()
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index dcf3b945de4a..64c9085f0a35 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -588,6 +588,43 @@ SvxSwPosSizeTabPage::SvxSwPosSizeTabPage(vcl::Window* pParent, const SfxItemSet&
m_pPositionCB->SetClickHdl(LINK(this, SvxSwPosSizeTabPage, ProtectHdl));
}
+SvxSwPosSizeTabPage::~SvxSwPosSizeTabPage()
+{
+ disposeOnce();
+}
+
+void SvxSwPosSizeTabPage::dispose()
+{
+ m_pWidthMF.clear();
+ m_pHeightMF.clear();
+ m_pKeepRatioCB.clear();
+ m_pToPageRB.clear();
+ m_pToParaRB.clear();
+ m_pToCharRB.clear();
+ m_pAsCharRB.clear();
+ m_pToFrameRB.clear();
+ m_pPositionCB.clear();
+ m_pSizeCB.clear();
+ m_pPosFrame.clear();
+ m_pHoriFT.clear();
+ m_pHoriLB.clear();
+ m_pHoriByFT.clear();
+ m_pHoriByMF.clear();
+ m_pHoriToFT.clear();
+ m_pHoriToLB.clear();
+ m_pHoriMirrorCB.clear();
+ m_pVertFT.clear();
+ m_pVertLB.clear();
+ m_pVertByFT.clear();
+ m_pVertByMF.clear();
+ m_pVertToFT.clear();
+ m_pVertToLB.clear();
+ m_pFollowCB.clear();
+ m_pExampleWN.clear();
+ SfxTabPage::dispose();
+}
+
+
namespace
{
struct FrmMaps
@@ -689,13 +726,9 @@ void SvxSwPosSizeTabPage::setOptimalRelWidth()
m_pHoriLB->Clear();
}
-SvxSwPosSizeTabPage::~SvxSwPosSizeTabPage()
-{
-}
-
-SfxTabPage* SvxSwPosSizeTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SvxSwPosSizeTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SvxSwPosSizeTabPage(pParent, *rSet);
+ return VclPtr<SvxSwPosSizeTabPage>::Create(pParent, *rSet);
}
const sal_uInt16* SvxSwPosSizeTabPage::GetRanges()
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
index d856f6b91fc0..56e54c8bc07c 100644
--- a/cui/source/tabpages/tabarea.cxx
+++ b/cui/source/tabpages/tabarea.cxx
@@ -96,10 +96,6 @@ SvxAreaTabDialog::SvxAreaTabDialog
rBtnCancel.SetClickHdl( LINK( this, SvxAreaTabDialog, CancelHdlImpl ) );
}
-SvxAreaTabDialog::~SvxAreaTabDialog()
-{
-}
-
void SvxAreaTabDialog::SavePalettes()
{
SfxObjectShell* pShell = SfxObjectShell::Current();
diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx
index be818ba57f02..f9ee914225b9 100644
--- a/cui/source/tabpages/tabline.cxx
+++ b/cui/source/tabpages/tabline.cxx
@@ -104,12 +104,6 @@ SvxLineTabDialog::SvxLineTabDialog
-SvxLineTabDialog::~SvxLineTabDialog()
-{
-}
-
-
-
void SvxLineTabDialog::SavePalettes()
{
SfxObjectShell* pShell = SfxObjectShell::Current();
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 4d589e7fe55f..2d8b7c0c7326 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -38,7 +38,7 @@
class TabWin_Impl : public vcl::Window
{
- SvxTabulatorTabPage* mpPage;
+ VclPtr<SvxTabulatorTabPage> mpPage;
private:
sal_uInt16 nTabStyle;
@@ -50,8 +50,10 @@ public:
, nTabStyle(0)
{
}
+ virtual ~TabWin_Impl() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { mpPage.clear(); vcl::Window::dispose(); }
- virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
void SetTabulatorTabPage(SvxTabulatorTabPage* pPage) { mpPage = pPage; }
void SetTabStyle(sal_uInt16 nStyle) {nTabStyle = nStyle; }
@@ -185,13 +187,37 @@ SvxTabulatorTabPage::SvxTabulatorTabPage( vcl::Window* pParent, const SfxItemSet
aAktTab.GetDecimal() = rLocaleWrapper.getNumDecimalSep()[0];
}
-
-
SvxTabulatorTabPage::~SvxTabulatorTabPage()
{
+ disposeOnce();
}
-
+void SvxTabulatorTabPage::dispose()
+{
+ m_pTabBox.clear();
+ m_pLeftTab.clear();
+ m_pRightTab.clear();
+ m_pCenterTab.clear();
+ m_pDezTab.clear();
+ m_pLeftWin.clear();
+ m_pRightWin.clear();
+ m_pCenterWin.clear();
+ m_pDezWin.clear();
+ m_pDezCharLabel.clear();
+ m_pDezChar.clear();
+ m_pNoFillChar.clear();
+ m_pFillPoints.clear();
+ m_pFillDashLine.clear();
+ m_pFillSolidLine.clear();
+ m_pFillSpecial.clear();
+ m_pFillChar.clear();
+ m_pNewBtn.clear();
+ m_pDelAllBtn.clear();
+ m_pDelBtn.clear();
+ m_pTypeFrame.clear();
+ m_pFillFrame.clear();
+ SfxTabPage::dispose();
+}
bool SvxTabulatorTabPage::FillItemSet( SfxItemSet* rSet )
{
@@ -252,10 +278,11 @@ bool SvxTabulatorTabPage::FillItemSet( SfxItemSet* rSet )
-SfxTabPage* SvxTabulatorTabPage::Create( vcl::Window* pParent,
+VclPtr<SfxTabPage> SvxTabulatorTabPage::Create( vcl::Window* pParent,
const SfxItemSet* rSet)
{
- return ( new SvxTabulatorTabPage( pParent, *rSet ) );
+ return VclPtr<SfxTabPage>( new SvxTabulatorTabPage( pParent, *rSet ),
+ SAL_NO_ACQUIRE );
}
diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx
index 72626e953100..b2f2980de258 100644
--- a/cui/source/tabpages/textanim.cxx
+++ b/cui/source/tabpages/textanim.cxx
@@ -122,14 +122,30 @@ SvxTextAnimationPage::SvxTextAnimationPage( vcl::Window* pWindow, const SfxItemS
m_pBtnDown->SetClickHdl( aLink );
}
-/*************************************************************************
-|*
-|* Dtor
-|*
-\************************************************************************/
-
SvxTextAnimationPage::~SvxTextAnimationPage()
{
+ disposeOnce();
+}
+
+void SvxTextAnimationPage::dispose()
+{
+ m_pLbEffect.clear();
+ m_pBoxDirection.clear();
+ m_pBtnUp.clear();
+ m_pBtnLeft.clear();
+ m_pBtnRight.clear();
+ m_pBtnDown.clear();
+ m_pFlProperties.clear();
+ m_pTsbStartInside.clear();
+ m_pTsbStopInside.clear();
+ m_pBoxCount.clear();
+ m_pTsbEndless.clear();
+ m_pNumFldCount.clear();
+ m_pTsbPixel.clear();
+ m_pMtrFldAmount.clear();
+ m_pTsbAuto.clear();
+ m_pMtrFldDelay.clear();
+ SfxTabPage::dispose();
}
/*************************************************************************
@@ -445,10 +461,10 @@ bool SvxTextAnimationPage::FillItemSet( SfxItemSet* rAttrs)
|*
\************************************************************************/
-SfxTabPage* SvxTextAnimationPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxTextAnimationPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SvxTextAnimationPage( pWindow, *rAttrs );
+ return VclPtr<SvxTextAnimationPage>::Create( pWindow, *rAttrs );
}
IMPL_LINK_NOARG(SvxTextAnimationPage, SelectEffectHdl_Impl)
diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
index 655638577e35..d04a830b9dbd 100644
--- a/cui/source/tabpages/textattr.cxx
+++ b/cui/source/tabpages/textattr.cxx
@@ -96,13 +96,28 @@ SvxTextAttrPage::SvxTextAttrPage(vcl::Window* pWindow, const SfxItemSet& rInAttr
m_pTsbFullWidth->SetClickHdl(LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) );
}
-/*************************************************************************
-|*
-|* Dtor
-|*
-\************************************************************************/
SvxTextAttrPage::~SvxTextAttrPage()
{
+ disposeOnce();
+}
+
+void SvxTextAttrPage::dispose()
+{
+ m_pTsbAutoGrowWidth.clear();
+ m_pTsbAutoGrowHeight.clear();
+ m_pTsbFitToSize.clear();
+ m_pTsbContour.clear();
+ m_pTsbWordWrapText.clear();
+ m_pTsbAutoGrowSize.clear();
+ m_pFlDistance.clear();
+ m_pMtrFldLeft.clear();
+ m_pMtrFldRight.clear();
+ m_pMtrFldTop.clear();
+ m_pMtrFldBottom.clear();
+ m_pFlPosition.clear();
+ m_pCtlPosition.clear();
+ m_pTsbFullWidth.clear();
+ SvxTabPage::dispose();
}
/*************************************************************************
@@ -514,16 +529,10 @@ void SvxTextAttrPage::Construct()
m_pTsbWordWrapText->Enable( bWordWrapTextEnabled );
}
-/*************************************************************************
-|*
-|* creates the page
-|*
-\************************************************************************/
-
-SfxTabPage* SvxTextAttrPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxTextAttrPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SvxTextAttrPage( pWindow, *rAttrs );
+ return VclPtr<SvxTextAttrPage>::Create( pWindow, *rAttrs );
}
/** Check whether we have to uncheck the "Full width" check box.
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 944aff6abe8e..7cd0685cb031 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -118,6 +118,33 @@ IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransGradientHdl_Impl)
return 0L;
}
+SvxTransparenceTabPage::~SvxTransparenceTabPage()
+{
+ disposeOnce();
+}
+
+void SvxTransparenceTabPage::dispose()
+{
+ m_pRbtTransOff.clear();
+ m_pRbtTransLinear.clear();
+ m_pRbtTransGradient.clear();
+ m_pMtrTransparent.clear();
+ m_pGridGradient.clear();
+ m_pLbTrgrGradientType.clear();
+ m_pFtTrgrCenterX.clear();
+ m_pMtrTrgrCenterX.clear();
+ m_pFtTrgrCenterY.clear();
+ m_pMtrTrgrCenterY.clear();
+ m_pFtTrgrAngle.clear();
+ m_pMtrTrgrAngle.clear();
+ m_pMtrTrgrBorder.clear();
+ m_pMtrTrgrStartValue.clear();
+ m_pMtrTrgrEndValue.clear();
+ m_pCtlBitmapPreview.clear();
+ m_pCtlXRectPreview.clear();
+ SvxTabPage::dispose();
+}
+
void SvxTransparenceTabPage::ActivateLinear(bool bActivate)
{
m_pMtrTransparent->Enable(bActivate);
@@ -287,9 +314,9 @@ SvxTransparenceTabPage::SvxTransparenceTabPage(vcl::Window* pParent, const SfxIt
SetExchangeSupport();
}
-SfxTabPage* SvxTransparenceTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rAttrs)
+VclPtr<SfxTabPage> SvxTransparenceTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rAttrs)
{
- return new SvxTransparenceTabPage(pWindow, *rAttrs);
+ return VclPtr<SvxTransparenceTabPage>::Create(pWindow, *rAttrs);
}
bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs)
@@ -768,6 +795,51 @@ SvxAreaTabPage::SvxAreaTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs
m_pCtlXRectPreview->set_height_request(aSize2.Height());
}
+SvxAreaTabPage::~SvxAreaTabPage()
+{
+ disposeOnce();
+}
+
+void SvxAreaTabPage::dispose()
+{
+ m_pTypeLB.clear();
+ m_pFillLB.clear();
+ m_pLbColor.clear();
+ m_pLbGradient.clear();
+ m_pLbHatching.clear();
+ m_pLbBitmap.clear();
+ m_pCtlBitmapPreview.clear();
+ m_pTsbStepCount.clear();
+ m_pFlStepCount.clear();
+ m_pNumFldStepCount.clear();
+ m_pFlHatchBckgrd.clear();
+ m_pCbxHatchBckgrd.clear();
+ m_pLbHatchBckgrdColor.clear();
+ m_pBxBitmap.clear();
+ m_pFlSize.clear();
+ m_pTsbOriginal.clear();
+ m_pTsbScale.clear();
+ m_pGridX_Y.clear();
+ m_pFtXSize.clear();
+ m_pMtrFldXSize.clear();
+ m_pFtYSize.clear();
+ m_pMtrFldYSize.clear();
+ m_pFlPosition.clear();
+ m_pCtlPosition.clear();
+ m_pGridOffset.clear();
+ m_pMtrFldXOffset.clear();
+ m_pMtrFldYOffset.clear();
+ m_pBxTile.clear();
+ m_pTsbTile.clear();
+ m_pTsbStretch.clear();
+ m_pFlOffset.clear();
+ m_pRbtRow.clear();
+ m_pRbtColumn.clear();
+ m_pMtrFldOffset.clear();
+ m_pCtlXRectPreview.clear();
+ m_pBtnImport.clear();
+ SvxTabPage::dispose();
+}
void SvxAreaTabPage::Construct()
@@ -1758,10 +1830,10 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs )
-SfxTabPage* SvxAreaTabPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxAreaTabPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SvxAreaTabPage( pWindow, *rAttrs );
+ return VclPtr<SvxAreaTabPage>::Create( pWindow, *rAttrs );
}
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 3ce5ff5b1696..e75afb7d1a29 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -122,10 +122,28 @@ SvxBitmapTabPage::SvxBitmapTabPage( vcl::Window* pParent, const SfxItemSet& rIn
SvxBitmapTabPage::~SvxBitmapTabPage()
{
- delete m_pBitmapCtl;
+ disposeOnce();
}
-
+void SvxBitmapTabPage::dispose()
+{
+ delete m_pBitmapCtl;
+ m_pBitmapCtl = NULL;
+ m_pBxPixelEditor.clear();
+ m_pCtlPixel.clear();
+ m_pLbColor.clear();
+ m_pLbBackgroundColor.clear();
+ m_pLbBitmapsHidden.clear();
+ m_pLbBitmaps.clear();
+ m_pCtlPreview.clear();
+ m_pBtnAdd.clear();
+ m_pBtnModify.clear();
+ m_pBtnImport.clear();
+ m_pBtnDelete.clear();
+ m_pBtnLoad.clear();
+ m_pBtnSave.clear();
+ SvxTabPage::dispose();
+}
void SvxBitmapTabPage::Construct()
{
@@ -292,10 +310,10 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* )
-SfxTabPage* SvxBitmapTabPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxBitmapTabPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rSet )
{
- return new SvxBitmapTabPage( pWindow, *rSet );
+ return VclPtr<SvxBitmapTabPage>::Create( pWindow, *rSet );
}
@@ -428,10 +446,10 @@ long SvxBitmapTabPage::CheckChanges_Impl()
{
ResMgr& rMgr = CUI_MGR();
Image aWarningBoxImage = WarningBox::GetStandardImage();
- boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
- SVX_RES( RID_SVXSTR_BITMAP ),
- CUI_RES( RID_SVXSTR_ASK_CHANGE_BITMAP ),
- &aWarningBoxImage ));
+ ScopedVclPtrInstance<SvxMessDialog> aMessDlg( GetParentDialog(),
+ SVX_RES( RID_SVXSTR_BITMAP ),
+ CUI_RES( RID_SVXSTR_ASK_CHANGE_BITMAP ),
+ &aWarningBoxImage );
DBG_ASSERT(aMessDlg, "Dialog creation failed!");
aMessDlg->SetButtonText( MESS_BTN_1, ResId( RID_SVXSTR_CHANGE, rMgr ) );
aMessDlg->SetButtonText( MESS_BTN_2, ResId( RID_SVXSTR_ADD, rMgr ) );
@@ -492,7 +510,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl)
DBG_ASSERT(pFact, "Dialog creation failed!");
boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
DBG_ASSERT(pDlg, "Dialog creation failed!");
- boost::scoped_ptr<MessageDialog> pWarnBox;
+ ScopedVclPtr<MessageDialog> pWarnBox;
sal_uInt16 nError(1);
while( pDlg->Execute() == RET_OK )
@@ -512,7 +530,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl)
if( !pWarnBox )
{
- pWarnBox.reset(new MessageDialog( GetParentDialog()
+ pWarnBox.reset(VclPtr<MessageDialog>::Create( GetParentDialog()
,"DuplicateNameDialog"
,"cui/ui/queryduplicatedialog.ui"));
}
@@ -592,7 +610,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
if( !nError )
{
OUString aDesc( ResId(RID_SVXSTR_DESC_EXT_BITMAP, rMgr) );
- boost::scoped_ptr<MessageDialog> pWarnBox;
+ ScopedVclPtr<MessageDialog> pWarnBox;
// convert file URL to UI name
OUString aName;
@@ -621,7 +639,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
if( !pWarnBox )
{
- pWarnBox.reset(new MessageDialog( GetParentDialog()
+ pWarnBox.reset(VclPtr<MessageDialog>::Create( GetParentDialog()
,"DuplicateNameDialog"
,"cui/ui/queryduplicatedialog.ui"));
}
@@ -710,10 +728,11 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl)
}
else
{
- MessageDialog aBox( GetParentDialog()
+ ScopedVclPtrInstance<MessageDialog> aBox(
+ GetParentDialog()
,"DuplicateNameDialog"
,"cui/ui/queryduplicatedialog.ui");
- aBox.Execute();
+ aBox->Execute();
}
}
}
@@ -728,9 +747,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickDeleteHdl_Impl)
if( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- MessageDialog aQueryBox( GetParentDialog(),"AskDelBitmapDialog","cui/ui/querydeletebitmapdialog.ui");
+ ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelBitmapDialog","cui/ui/querydeletebitmapdialog.ui" );
- if( aQueryBox.Execute() == RET_YES )
+ if( aQueryBox->Execute() == RET_YES )
{
delete pBitmapList->Remove( nPos );
m_pLbBitmaps->RemoveEntry( nPos );
@@ -969,7 +988,7 @@ void SvxBitmapTabPage::PointChanged( vcl::Window* pWindow, RECT_POINT )
vcl::Window* SvxBitmapTabPage::GetParentLabeledBy( const vcl::Window* pLabeled ) const
{
if (pLabeled == m_pLbBitmaps)
- return m_pLbBitmapsHidden;
+ return m_pLbBitmapsHidden.get();
else
return SvxTabPage::GetParentLabeledBy (pLabeled);
}
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 165736eb60ca..b96b0d64e51c 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -51,8 +51,8 @@ using namespace com::sun::star;
XPropertyListRef SvxColorTabPage::GetList()
{
- SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg );
- SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg );
+ SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg.get() );
+ SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg.get() );
XColorListRef pList;
if( pArea )
@@ -162,8 +162,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickLoadHdl_Impl)
if( pList->Load() )
{
// check whether the table may be deleted:
- SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg );
- SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg );
+ SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg.get() );
+ SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg.get() );
// FIXME: want to have a generic set and get method by type ...
if( pArea )
@@ -397,10 +397,39 @@ SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr
SvxColorTabPage::~SvxColorTabPage()
{
- delete pShadow;
+ disposeOnce();
}
-
+void SvxColorTabPage::dispose()
+{
+ delete pShadow;
+ pShadow = NULL;
+ mpTopDlg.clear();
+ m_pBoxEmbed.clear();
+ m_pBtnLoad.clear();
+ m_pBtnSave.clear();
+ m_pTableName.clear();
+ m_pEdtName.clear();
+ m_pLbColor.clear();
+ m_pValSetColorList.clear();
+ m_pCtlPreviewOld.clear();
+ m_pCtlPreviewNew.clear();
+ m_pLbColorModel.clear();
+ m_pRGB.clear();
+ m_pR.clear();
+ m_pG.clear();
+ m_pB.clear();
+ m_pCMYK.clear();
+ m_pC.clear();
+ m_pY.clear();
+ m_pM.clear();
+ m_pK.clear();
+ m_pBtnAdd.clear();
+ m_pBtnModify.clear();
+ m_pBtnWorkOn.clear();
+ m_pBtnDelete.clear();
+ SfxTabPage::dispose();
+}
void SvxColorTabPage::ImpColorCountChanged()
{
@@ -510,10 +539,10 @@ long SvxColorTabPage::CheckChanges_Impl()
{
ResMgr& rMgr = CUI_MGR();
Image aWarningBoxImage = WarningBox::GetStandardImage();
- boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
- SVX_RESSTR( RID_SVXSTR_COLOR ),
- ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ),
- &aWarningBoxImage ));
+ ScopedVclPtrInstance<SvxMessDialog> aMessDlg( GetParentDialog(),
+ SVX_RESSTR( RID_SVXSTR_COLOR ),
+ ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ),
+ &aWarningBoxImage );
aMessDlg->SetButtonText( MESS_BTN_1,
ResId( RID_SVXSTR_CHANGE, rMgr ) );
aMessDlg->SetButtonText( MESS_BTN_2,
@@ -618,10 +647,10 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet )
-SfxTabPage* SvxColorTabPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rOutAttrs )
+VclPtr<SfxTabPage> SvxColorTabPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rOutAttrs )
{
- return new SvxColorTabPage( pWindow, *rOutAttrs );
+ return VclPtr<SvxColorTabPage>::Create( pWindow, *rOutAttrs );
}
// is called when the content of the MtrFields is changed for color values
@@ -676,10 +705,10 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl)
// if yes, it is repeated and a new name is demanded
if ( !bDifferent )
{
- MessageDialog aWarningBox( GetParentDialog()
- ,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
- aWarningBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aWarningBox( GetParentDialog()
+ ,"DuplicateNameDialog"
+ ,"cui/ui/queryduplicatedialog.ui");
+ aWarningBox->Execute();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
@@ -699,7 +728,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl)
if( bDifferent )
bLoop = false;
else
- aWarningBox.Execute();
+ aWarningBox->Execute();
}
}
@@ -747,10 +776,10 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickModifyHdl_Impl)
// if yes, it is repeated and a new name is demanded
if ( !bDifferent )
{
- MessageDialog aWarningBox( GetParentDialog()
- ,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
- aWarningBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aWarningBox( GetParentDialog()
+ ,"DuplicateNameDialog"
+ ,"cui/ui/queryduplicatedialog.ui");
+ aWarningBox->Execute();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
@@ -768,7 +797,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickModifyHdl_Impl)
if( bDifferent )
bLoop = false;
else
- aWarningBox.Execute();
+ aWarningBox->Execute();
}
}
@@ -843,9 +872,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl)
if( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- MessageDialog aQueryBox( GetParentDialog(),"AskDelColorDialog","cui/ui/querydeletecolordialog.ui");
+ ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelColorDialog","cui/ui/querydeletecolordialog.ui");
- if( aQueryBox.Execute() == RET_YES )
+ if( aQueryBox->Execute() == RET_YES )
{
XColorEntry* pEntry = pColorList->Remove( nPos );
DBG_ASSERT( pEntry, "ColorEntry not found !" );
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index b2c334883f91..55c81296f638 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -139,6 +139,34 @@ SvxGradientTabPage::SvxGradientTabPage
setPreviewsToSamePlace(pParent, this);
}
+SvxGradientTabPage::~SvxGradientTabPage()
+{
+ disposeOnce();
+}
+
+void SvxGradientTabPage::dispose()
+{
+ m_pLbGradientType.clear();
+ m_pFtCenterX.clear();
+ m_pMtrCenterX.clear();
+ m_pFtCenterY.clear();
+ m_pMtrCenterY.clear();
+ m_pFtAngle.clear();
+ m_pMtrAngle.clear();
+ m_pMtrBorder.clear();
+ m_pLbColorFrom.clear();
+ m_pMtrColorFrom.clear();
+ m_pLbColorTo.clear();
+ m_pMtrColorTo.clear();
+ m_pLbGradients.clear();
+ m_pCtlPreview.clear();
+ m_pBtnAdd.clear();
+ m_pBtnModify.clear();
+ m_pBtnDelete.clear();
+ m_pBtnLoad.clear();
+ m_pBtnSave.clear();
+ SfxTabPage::dispose();
+}
void SvxGradientTabPage::Construct()
@@ -263,10 +291,10 @@ long SvxGradientTabPage::CheckChanges_Impl()
{
ResMgr& rMgr = CUI_MGR();
Image aWarningBoxImage = WarningBox::GetStandardImage();
- boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
- SVX_RESSTR( RID_SVXSTR_GRADIENT ),
- CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_GRADIENT ),
- &aWarningBoxImage ));
+ ScopedVclPtrInstance<SvxMessDialog> aMessDlg( GetParentDialog(),
+ SVX_RESSTR( RID_SVXSTR_GRADIENT ),
+ CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_GRADIENT ),
+ &aWarningBoxImage );
DBG_ASSERT(aMessDlg, "Dialog creation failed!");
aMessDlg->SetButtonText( MESS_BTN_1,
OUString( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
@@ -366,10 +394,10 @@ void SvxGradientTabPage::Reset( const SfxItemSet* )
-SfxTabPage* SvxGradientTabPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rOutAttrs )
+VclPtr<SfxTabPage> SvxGradientTabPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rOutAttrs )
{
- return new SvxGradientTabPage( pWindow, *rOutAttrs );
+ return VclPtr<SvxGradientTabPage>::Create( pWindow, *rOutAttrs );
}
@@ -429,7 +457,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl)
DBG_ASSERT(pFact, "Dialog creation failed!");
boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
DBG_ASSERT(pDlg, "Dialog creation failed!");
- boost::scoped_ptr<MessageDialog> pWarnBox;
+ ScopedVclPtr<MessageDialog> pWarnBox;
sal_uInt16 nError = 1;
while( pDlg->Execute() == RET_OK )
@@ -450,7 +478,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl)
if( !pWarnBox )
{
- pWarnBox.reset(new MessageDialog( GetParentDialog()
+ pWarnBox.reset(VclPtr<MessageDialog>::Create( GetParentDialog()
,"DuplicateNameDialog"
,"cui/ui/queryduplicatedialog.ui"));
}
@@ -561,10 +589,10 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl)
}
else
{
- MessageDialog aBox( GetParentDialog()
- ,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
- aBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog()
+ ,"DuplicateNameDialog"
+ ,"cui/ui/queryduplicatedialog.ui" );
+ aBox->Execute();
}
}
@@ -580,9 +608,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickDeleteHdl_Impl)
if( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- MessageDialog aQueryBox( GetParentDialog(),"AskDelGradientDialog","cui/ui/querydeletegradientdialog.ui");
+ ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelGradientDialog","cui/ui/querydeletegradientdialog.ui");
- if ( aQueryBox.Execute() == RET_YES )
+ if ( aQueryBox->Execute() == RET_YES )
{
delete pGradientList->Remove( nPos );
m_pLbGradients->RemoveEntry( nPos );
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 418a7ce500db..3e839505e0cc 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -137,6 +137,27 @@ SvxHatchTabPage::SvxHatchTabPage
setPreviewsToSamePlace(pParent, this);
}
+SvxHatchTabPage::~SvxHatchTabPage()
+{
+ disposeOnce();
+}
+
+void SvxHatchTabPage::dispose()
+{
+ m_pMtrDistance.clear();
+ m_pMtrAngle.clear();
+ m_pCtlAngle.clear();
+ m_pLbLineType.clear();
+ m_pLbLineColor.clear();
+ m_pLbHatchings.clear();
+ m_pCtlPreview.clear();
+ m_pBtnAdd.clear();
+ m_pBtnModify.clear();
+ m_pBtnDelete.clear();
+ m_pBtnLoad.clear();
+ m_pBtnSave.clear();
+ SvxTabPage::dispose();
+}
void SvxHatchTabPage::Construct()
@@ -240,10 +261,10 @@ long SvxHatchTabPage::CheckChanges_Impl()
{
ResMgr& rMgr = CUI_MGR();
Image aWarningBoxImage = WarningBox::GetStandardImage();
- boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
- SVX_RESSTR( RID_SVXSTR_HATCH ),
- CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_HATCH ),
- &aWarningBoxImage ));
+ ScopedVclPtrInstance<SvxMessDialog> aMessDlg( GetParentDialog(),
+ SVX_RESSTR( RID_SVXSTR_HATCH ),
+ CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_HATCH ),
+ &aWarningBoxImage );
DBG_ASSERT(aMessDlg, "Dialog creation failed!");
aMessDlg->SetButtonText( MESS_BTN_1,
OUString( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
@@ -339,10 +360,10 @@ void SvxHatchTabPage::Reset( const SfxItemSet* rSet )
-SfxTabPage* SvxHatchTabPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxHatchTabPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rSet )
{
- return new SvxHatchTabPage( pWindow, *rSet );
+ return VclPtr<SvxHatchTabPage>::Create( pWindow, *rSet );
}
@@ -479,7 +500,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl)
DBG_ASSERT(pFact, "Dialog creation failed!");
boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
DBG_ASSERT(pDlg, "Dialog creation failed!");
- boost::scoped_ptr<MessageDialog> pWarnBox;
+ ScopedVclPtr<MessageDialog> pWarnBox;
sal_uInt16 nError = 1;
while( pDlg->Execute() == RET_OK )
@@ -499,7 +520,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl)
if( !pWarnBox )
{
- pWarnBox.reset(new MessageDialog( GetParentDialog()
+ pWarnBox.reset(VclPtr<MessageDialog>::Create( GetParentDialog()
,"DuplicateNameDialog"
,"cui/ui/queryduplicatedialog.ui"));
}
@@ -606,10 +627,10 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl)
}
else
{
- MessageDialog aBox( GetParentDialog()
- ,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
- aBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog()
+ ,"DuplicateNameDialog"
+ ,"cui/ui/queryduplicatedialog.ui" );
+ aBox->Execute();
}
}
}
@@ -624,9 +645,9 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickDeleteHdl_Impl)
if( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- MessageDialog aQueryBox( GetParentDialog(),"AskDelHatchDialog","cui/ui/querydeletehatchdialog.ui");
+ ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelHatchDialog","cui/ui/querydeletehatchdialog.ui");
- if( aQueryBox.Execute() == RET_YES )
+ if( aQueryBox->Execute() == RET_YES )
{
delete pHatchingList->Remove( nPos );
m_pLbHatchings->RemoveEntry( nPos );
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 119d59948a5f..300db7422607 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -230,12 +230,20 @@ void SvxLineTabPage::ShowSymbolControls(bool bOn)
SvxLineTabPage::~SvxLineTabPage()
{
- // Symbols on a line (e.g. StarCharts), dtor new!
+ disposeOnce();
+}
- delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_GALLERY );
+void SvxLineTabPage::dispose()
+{
+ // Symbols on a line (e.g. StarCharts), dtor new!
+ if (m_pSymbolMB)
+ {
+ delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_GALLERY );
- if(pSymbolList)
- delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
+ if(pSymbolList)
+ delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
+ m_pSymbolMB = NULL;
+ }
for ( size_t i = 0, n = aGrfBrushItems.size(); i < n; ++i )
{
@@ -243,7 +251,40 @@ SvxLineTabPage::~SvxLineTabPage()
delete pInfo->pBrushItem;
delete pInfo;
}
+ aGrfBrushItems.clear();
+
+ m_pBoxColor.clear();
+ m_pLbLineStyle.clear();
+ m_pLbColor.clear();
+ m_pBoxWidth.clear();
+ m_pMtrLineWidth.clear();
+ m_pBoxTransparency.clear();
+ m_pMtrTransparent.clear();
+ m_pFlLineEnds.clear();
+ m_pBoxArrowStyles.clear();
+ m_pLbStartStyle.clear();
+ m_pBoxStart.clear();
+ m_pMtrStartWidth.clear();
+ m_pTsbCenterStart.clear();
+ m_pBoxEnd.clear();
+ m_pLbEndStyle.clear();
+ m_pMtrEndWidth.clear();
+ m_pTsbCenterEnd.clear();
+ m_pCbxSynchronize.clear();
+ m_pCtlPreview.clear();
+ m_pFLEdgeStyle.clear();
+ m_pGridEdgeCaps.clear();
+ m_pLBEdgeStyle.clear();
+ m_pLBCapStyle.clear();
+ m_pFlSymbol.clear();
+ m_pGridIconSize.clear();
+ m_pSymbolMB.clear();
+ m_pSymbolWidthMF.clear();
+ m_pSymbolHeightMF.clear();
+ m_pSymbolRatioCB.clear();
+ SvxTabPage::dispose();
}
+
void SvxLineTabPage::Construct()
{
// Color chart
@@ -319,8 +360,8 @@ void SvxLineTabPage::InitSymbols(MenuButton* pButton)
if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList)
{
- VirtualDevice aVDev;
- aVDev.SetMapMode(MapMode(MAP_100TH_MM));
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->SetMapMode(MapMode(MAP_100TH_MM));
boost::scoped_ptr<SdrModel> pModel(new SdrModel);
pModel->GetItemPool().FreezeIdRanges();
// Page
@@ -329,7 +370,7 @@ void SvxLineTabPage::InitSymbols(MenuButton* pButton)
pModel->InsertPage( pPage, 0 );
{
// 3D View
- boost::scoped_ptr<SdrView> pView(new SdrView( pModel.get(), &aVDev ));
+ boost::scoped_ptr<SdrView> pView(new SdrView( pModel.get(), pVDev ));
pView->hideMarkHandles();
pView->ShowSdrPage(pPage);
@@ -1114,8 +1155,8 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
}
else if(nSymType >= 0)
{
- VirtualDevice aVDev;
- aVDev.SetMapMode(MapMode(MAP_100TH_MM));
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->SetMapMode(MapMode(MAP_100TH_MM));
boost::scoped_ptr<SdrModel> pModel(new SdrModel);
pModel->GetItemPool().FreezeIdRanges();
@@ -1123,7 +1164,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
pPage->SetSize(Size(1000,1000));
pModel->InsertPage( pPage, 0 );
{
- boost::scoped_ptr<SdrView> pView(new SdrView( pModel.get(), &aVDev ));
+ boost::scoped_ptr<SdrView> pView(new SdrView( pModel.get(), pVDev ));
pView->hideMarkHandles();
pView->ShowSdrPage(pPage);
SdrObject *pObj=NULL;
@@ -1488,10 +1529,10 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
-SfxTabPage* SvxLineTabPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxLineTabPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SvxLineTabPage( pWindow, *rAttrs );
+ return VclPtr<SvxLineTabPage>::Create( pWindow, *rAttrs );
}
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index 9e947e89358d..0e68ad35c932 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -154,6 +154,31 @@ SvxLineDefTabPage::SvxLineDefTabPage
pDashList = NULL;
}
+SvxLineDefTabPage::~SvxLineDefTabPage()
+{
+ disposeOnce();
+}
+
+void SvxLineDefTabPage::dispose()
+{
+ m_pLbLineStyles.clear();
+ m_pLbType1.clear();
+ m_pLbType2.clear();
+ m_pNumFldNumber1.clear();
+ m_pNumFldNumber2.clear();
+ m_pMtrLength1.clear();
+ m_pMtrLength2.clear();
+ m_pMtrDistance.clear();
+ m_pCbxSynchronize.clear();
+ m_pBtnAdd.clear();
+ m_pBtnModify.clear();
+ m_pBtnDelete.clear();
+ m_pBtnLoad.clear();
+ m_pBtnSave.clear();
+ m_pCtlPreview.clear();
+ SfxTabPage::dispose();
+}
+
void SvxLineDefTabPage::Construct()
{
// Line style fill; do *not* add default fields here
@@ -221,10 +246,10 @@ void SvxLineDefTabPage::CheckChanges_Impl()
{
ResMgr& rMgr = CUI_MGR();
Image aWarningBoxImage = WarningBox::GetStandardImage();
- boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
- SVX_RESSTR( RID_SVXSTR_LINESTYLE ),
- OUString( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ),
- &aWarningBoxImage ));
+ ScopedVclPtrInstance<SvxMessDialog> aMessDlg( GetParentDialog(),
+ SVX_RESSTR( RID_SVXSTR_LINESTYLE ),
+ OUString( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ),
+ &aWarningBoxImage );
DBG_ASSERT(aMessDlg, "Dialog creation failed!");
aMessDlg->SetButtonText( MESS_BTN_1, OUString( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
aMessDlg->SetButtonText( MESS_BTN_2, OUString( ResId( RID_SVXSTR_ADD, rMgr ) ) );
@@ -325,9 +350,9 @@ void SvxLineDefTabPage::Reset( const SfxItemSet* rAttrs )
-SfxTabPage* SvxLineDefTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rOutAttrs )
+VclPtr<SfxTabPage> SvxLineDefTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rOutAttrs )
{
- return new SvxLineDefTabPage( pWindow, *rOutAttrs );
+ return VclPtr<SvxLineDefTabPage>::Create( pWindow, *rOutAttrs );
}
@@ -593,11 +618,10 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl)
}
else
{
-
- MessageDialog aBox( GetParentDialog()
- ,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
- aBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog()
+ ,"DuplicateNameDialog"
+ ,"cui/ui/queryduplicatedialog.ui" );
+ aBox->Execute();
}
}
pDlg.reset();
@@ -672,10 +696,10 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl)
}
else
{
- MessageDialog aBox( GetParentDialog()
- ,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
- aBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog()
+ ,"DuplicateNameDialog"
+ ,"cui/ui/queryduplicatedialog.ui" );
+ aBox->Execute();
}
}
}
@@ -690,11 +714,11 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickDeleteHdl_Impl)
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- MessageDialog aQueryBox( GetParentDialog()
- ,"AskDelLineStyleDialog"
- ,"cui/ui/querydeletelinestyledialog.ui");
+ ScopedVclPtrInstance<MessageDialog> aQueryBox( GetParentDialog()
+ ,"AskDelLineStyleDialog"
+ ,"cui/ui/querydeletelinestyledialog.ui" );
- if ( aQueryBox.Execute() == RET_YES )
+ if ( aQueryBox->Execute() == RET_YES )
{
delete pDashList->Remove( nPos );
m_pLbLineStyles->RemoveEntry( nPos );
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index 194b0cd8f2fa..e33cd057f4ed 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -105,17 +105,29 @@ SvxLineEndDefTabPage::SvxLineEndDefTabPage
}
-void SvxLineEndDefTabPage::Resize()
+SvxLineEndDefTabPage::~SvxLineEndDefTabPage()
{
- rXLSet.Put(XLineStartWidthItem(m_pCtlPreview->GetOutputSize().Height() / 2 ));
- rXLSet.Put(XLineEndWidthItem(m_pCtlPreview->GetOutputSize().Height() / 2 ));
- SfxTabPage::Resize();
+ disposeOnce();
}
+void SvxLineEndDefTabPage::dispose()
+{
+ m_pEdtName.clear();
+ m_pLbLineEnds.clear();
+ m_pBtnAdd.clear();
+ m_pBtnModify.clear();
+ m_pBtnDelete.clear();
+ m_pBtnLoad.clear();
+ m_pBtnSave.clear();
+ m_pCtlPreview.clear();
+ SfxTabPage::dispose();
+}
-
-SvxLineEndDefTabPage::~SvxLineEndDefTabPage()
+void SvxLineEndDefTabPage::Resize()
{
+ rXLSet.Put(XLineStartWidthItem(m_pCtlPreview->GetOutputSize().Height() / 2 ));
+ rXLSet.Put(XLineEndWidthItem(m_pCtlPreview->GetOutputSize().Height() / 2 ));
+ SfxTabPage::Resize();
}
@@ -194,11 +206,10 @@ void SvxLineEndDefTabPage::CheckChanges_Impl()
if( aString != m_pLbLineEnds->GetSelectEntry() )
{
- MessageDialog aQueryBox( GetParentDialog()
- ,"AskChangeLineEndDialog"
- ,"cui/ui/querychangelineenddialog.ui");
-
- if ( aQueryBox.Execute() == RET_YES )
+ ScopedVclPtrInstance<MessageDialog> aQueryBox( GetParentDialog()
+ ,"AskChangeLineEndDialog"
+ ,"cui/ui/querychangelineenddialog.ui" );
+ if ( aQueryBox->Execute() == RET_YES )
ClickModifyHdl_Impl( this );
}
}
@@ -269,9 +280,9 @@ void SvxLineEndDefTabPage::Reset( const SfxItemSet* )
-SfxTabPage* SvxLineEndDefTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxLineEndDefTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rSet )
{
- return new SvxLineEndDefTabPage( pWindow, *rSet );
+ return VclPtr<SvxLineEndDefTabPage>::Create( pWindow, *rSet );
}
@@ -331,10 +342,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl)
// if yes, repeat and demand a new name
if ( !bDifferent )
{
- MessageDialog aWarningBox( GetParentDialog()
- ,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
- aWarningBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aWarningBox( GetParentDialog()
+ ,"DuplicateNameDialog"
+ ,"cui/ui/queryduplicatedialog.ui" );
+ aWarningBox->Execute();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialog creation failed!");
@@ -356,7 +367,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl)
if( bDifferent )
bLoop = false;
else
- aWarningBox.Execute();
+ aWarningBox->Execute();
}
}
@@ -485,10 +496,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl)
}
else
{
- MessageDialog aBox( GetParentDialog()
- ,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
- aBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog()
+ ,"DuplicateNameDialog"
+ ,"cui/ui/queryduplicatedialog.ui" );
+ aBox->Execute();
}
}
}
@@ -513,11 +524,11 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickDeleteHdl_Impl)
if( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- MessageDialog aQueryBox( GetParentDialog()
- ,"AskDelLineEndDialog"
- ,"cui/ui/querydeletelineenddialog.ui");
+ ScopedVclPtrInstance<MessageDialog> aQueryBox( GetParentDialog()
+ ,"AskDelLineEndDialog"
+ ,"cui/ui/querydeletelineenddialog.ui" );
- if ( aQueryBox.Execute() == RET_YES )
+ if ( aQueryBox->Execute() == RET_YES )
{
delete pLineEndList->Remove( nPos );
m_pLbLineEnds->RemoveEntry( nPos );
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index e1121a6acd65..9c18dc3240f7 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -165,6 +165,23 @@ SvxShadowTabPage::SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInA
m_pMtrDistance->SetModifyHdl( aLink );
}
+SvxShadowTabPage::~SvxShadowTabPage()
+{
+ disposeOnce();
+}
+
+void SvxShadowTabPage::dispose()
+{
+ m_pTsbShowShadow.clear();
+ m_pGridShadow.clear();
+ m_pCtlPosition.clear();
+ m_pMtrDistance.clear();
+ m_pLbShadowColor.clear();
+ m_pMtrTransparent.clear();
+ m_pCtlXRectPreview.clear();
+ SvxTabPage::dispose();
+}
+
void SvxShadowTabPage::Construct()
{
m_pLbShadowColor->Fill( pColorList );
@@ -466,10 +483,10 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
-SfxTabPage* SvxShadowTabPage::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxShadowTabPage::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SvxShadowTabPage( pWindow, *rAttrs );
+ return VclPtr<SvxShadowTabPage>::Create( pWindow, *rAttrs );
}
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 5658f7aba4a8..2da50ac83e69 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -116,12 +116,6 @@ SvxTransformTabDialog::SvxTransformTabDialog( vcl::Window* pParent, const SfxIte
-SvxTransformTabDialog::~SvxTransformTabDialog()
-{
-}
-
-
-
void SvxTransformTabDialog::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
{
if (nId==nPosSize)
@@ -203,6 +197,23 @@ SvxAngleTabPage::SvxAngleTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr
m_pCtlAngle->SetLinkedField( m_pNfAngle, 2 );
}
+SvxAngleTabPage::~SvxAngleTabPage()
+{
+ disposeOnce();
+}
+
+void SvxAngleTabPage::dispose()
+{
+ m_pFlPosition.clear();
+ m_pMtrPosX.clear();
+ m_pMtrPosY.clear();
+ m_pCtlRect.clear();
+ m_pFlAngle.clear();
+ m_pNfAngle.clear();
+ m_pCtlAngle.clear();
+ SvxTabPage::dispose();
+}
+
void SvxAngleTabPage::Construct()
{
DBG_ASSERT(pView, "No valid view (!)");
@@ -313,9 +324,9 @@ void SvxAngleTabPage::Reset(const SfxItemSet* rAttrs)
-SfxTabPage* SvxAngleTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SvxAngleTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rSet)
{
- return new SvxAngleTabPage(pWindow, *rSet);
+ return VclPtr<SvxAngleTabPage>::Create(pWindow, *rSet);
}
@@ -428,6 +439,20 @@ SvxSlantTabPage::SvxSlantTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr
ePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X );
}
+SvxSlantTabPage::~SvxSlantTabPage()
+{
+ disposeOnce();
+}
+
+void SvxSlantTabPage::dispose()
+{
+ m_pFlRadius.clear();
+ m_pMtrRadius.clear();
+ m_pFlAngle.clear();
+ m_pMtrAngle.clear();
+ SvxTabPage::dispose();
+}
+
void SvxSlantTabPage::Construct()
{
// get the range
@@ -540,9 +565,9 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
-SfxTabPage* SvxSlantTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rOutAttrs )
+VclPtr<SfxTabPage> SvxSlantTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rOutAttrs )
{
- return new SvxSlantTabPage( pWindow, *rOutAttrs );
+ return VclPtr<SvxSlantTabPage>::Create( pWindow, *rOutAttrs );
}
@@ -643,6 +668,33 @@ SvxPositionSizeTabPage::SvxPositionSizeTabPage(vcl::Window* pParent, const SfxIt
}
+SvxPositionSizeTabPage::~SvxPositionSizeTabPage()
+{
+ disposeOnce();
+}
+
+void SvxPositionSizeTabPage::dispose()
+{
+ m_pFlPosition.clear();
+ m_pMtrPosX.clear();
+ m_pMtrPosY.clear();
+ m_pCtlPos.clear();
+ m_pFlSize.clear();
+ m_pFtWidth.clear();
+ m_pMtrWidth.clear();
+ m_pFtHeight.clear();
+ m_pMtrHeight.clear();
+ m_pCbxScale.clear();
+ m_pCtlSize.clear();
+ m_pFlProtect.clear();
+ m_pTsbPosProtect.clear();
+ m_pTsbSizeProtect.clear();
+ m_pFlAdjust.clear();
+ m_pTsbAutoGrowWidth.clear();
+ m_pTsbAutoGrowHeight.clear();
+ SvxTabPage::dispose();
+}
+
void SvxPositionSizeTabPage::Construct()
{
// get range and work area
@@ -972,9 +1024,9 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* )
-SfxTabPage* SvxPositionSizeTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rOutAttrs )
+VclPtr<SfxTabPage> SvxPositionSizeTabPage::Create( vcl::Window* pWindow, const SfxItemSet* rOutAttrs )
{
- return new SvxPositionSizeTabPage( pWindow, *rOutAttrs );
+ return VclPtr<SvxPositionSizeTabPage>::Create( pWindow, *rOutAttrs );
}
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index a0bb7289ca28..5062648b9e3f 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1505,6 +1505,7 @@ void SAL_CALL ODatabaseDocument::close( sal_Bool _bDeliverOwnership ) throw (Clo
// SYNCHRONIZED ->
{
DocumentGuard aGuard(*this, DocumentGuard::DefaultMethod);
+ assert (!m_bClosing);
m_bClosing = true;
}
// <- SYNCHRONIZED
diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
index c643e8042942..b778fd68587e 100644
--- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
@@ -406,8 +406,8 @@ namespace dbmm
// check that the backup location isn't the same as the document itself
if ( lcl_equalURLs_nothrow( m_pData->aContext, sBackupLocation, m_pData->xDocumentModel->getURL() ) )
{
- MessageDialog aErrorBox( const_cast< MacroMigrationDialog* >( this ), MacroMigrationResId( STR_INVALID_BACKUP_LOCATION ) );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox( const_cast< MacroMigrationDialog* >( this ), MacroMigrationResId( STR_INVALID_BACKUP_LOCATION ) );
+ aErrorBox->Execute();
rBackupPage.grabLocationFocus();
return false;
}
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
index c4ccd03e6353..c97494f41fda 100644
--- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
@@ -67,14 +67,25 @@ namespace dbmm
get(m_pCloseDocError, "closedocerror");
}
+ PreparationPage::~PreparationPage()
+ {
+ disposeOnce();
+ }
+
+ void PreparationPage::dispose()
+ {
+ m_pCloseDocError.clear();
+ MacroMigrationPage::dispose();
+ }
+
void PreparationPage::showCloseDocsError( bool _bShow )
{
m_pCloseDocError->Show( _bShow );
}
- TabPage* PreparationPage::Create( ::svt::RoadmapWizard& _rParentDialog )
+ VclPtr<TabPage> PreparationPage::Create( ::svt::RoadmapWizard& _rParentDialog )
{
- return new PreparationPage(&_rParentDialog);
+ return VclPtr<PreparationPage>::Create(&_rParentDialog);
}
// SaveDBDocPage
@@ -95,7 +106,16 @@ namespace dbmm
SaveDBDocPage::~SaveDBDocPage()
{
+ disposeOnce();
+ }
+
+ void SaveDBDocPage::dispose()
+ {
delete m_pLocationController;
+ m_pSaveAsLocation.clear();
+ m_pBrowseSaveAsLocation.clear();
+ m_pStartMigration.clear();
+ MacroMigrationPage::dispose();
}
void SaveDBDocPage::impl_updateLocationDependentItems()
@@ -156,9 +176,9 @@ namespace dbmm
return true;
}
- TabPage* SaveDBDocPage::Create( ::svt::RoadmapWizard& _rParentDialog )
+ VclPtr<TabPage> SaveDBDocPage::Create( ::svt::RoadmapWizard& _rParentDialog )
{
- return new SaveDBDocPage( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
+ return VclPtr<SaveDBDocPage>::Create( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
}
// ProgressPage
@@ -174,9 +194,24 @@ namespace dbmm
get(m_pMigrationDone, "done");
}
- TabPage* ProgressPage::Create(::svt::RoadmapWizard& _rParentDialog)
+ ProgressPage::~ProgressPage()
{
- return new ProgressPage(&_rParentDialog);
+ disposeOnce();
+ }
+
+ void ProgressPage::dispose()
+ {
+ m_pObjectCount.clear();
+ m_pCurrentObject.clear();
+ m_pCurrentAction.clear();
+ m_pAllProgressText.clear();
+ m_pMigrationDone.clear();
+ MacroMigrationPage::dispose();
+ }
+
+ VclPtr<TabPage> ProgressPage::Create(::svt::RoadmapWizard& _rParentDialog)
+ {
+ return VclPtr<ProgressPage>::Create(&_rParentDialog);
}
void ProgressPage::setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports )
@@ -256,9 +291,22 @@ namespace dbmm
get(m_pFailureLabel, "failure");
}
- TabPage* ResultPage::Create(::svt::RoadmapWizard& _rParentDialog)
+ ResultPage::~ResultPage()
+ {
+ disposeOnce();
+ }
+
+ void ResultPage::dispose()
+ {
+ m_pSuccessLabel.clear();
+ m_pFailureLabel.clear();
+ m_pChanges.clear();
+ MacroMigrationPage::dispose();
+ }
+
+ VclPtr<TabPage> ResultPage::Create(::svt::RoadmapWizard& _rParentDialog)
{
- return new ResultPage(&_rParentDialog);
+ return VclPtr<ResultPage>::Create(&_rParentDialog);
}
void ResultPage::displayMigrationLog(const bool _bSuccessful, const OUString& _rSummary)
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.hxx b/dbaccess/source/ext/macromigration/macromigrationpages.hxx
index fc6ffc934521..70a70826783f 100644
--- a/dbaccess/source/ext/macromigration/macromigrationpages.hxx
+++ b/dbaccess/source/ext/macromigration/macromigrationpages.hxx
@@ -57,14 +57,16 @@ namespace dbmm
{
public:
PreparationPage(vcl::Window *pParent);
+ virtual ~PreparationPage();
+ virtual void dispose() SAL_OVERRIDE;
- static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
+ static VclPtr<TabPage> Create( ::svt::RoadmapWizard& _rParentDialog );
public:
void showCloseDocsError(bool _bShow);
protected:
- FixedText* m_pCloseDocError;
+ VclPtr<FixedText> m_pCloseDocError;
};
// SaveDBDocPage
@@ -73,16 +75,17 @@ namespace dbmm
public:
SaveDBDocPage(MacroMigrationDialog& _rParentDialog);
virtual ~SaveDBDocPage();
- static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<TabPage> Create( ::svt::RoadmapWizard& _rParentDialog );
public:
OUString getBackupLocation() const { return m_pLocationController->getURL(); }
void grabLocationFocus() { m_pSaveAsLocation->GrabFocus(); }
protected:
- ::svt::OFileURLControl* m_pSaveAsLocation;
- PushButton* m_pBrowseSaveAsLocation;
- FixedText* m_pStartMigration;
+ VclPtr<::svt::OFileURLControl> m_pSaveAsLocation;
+ VclPtr<PushButton> m_pBrowseSaveAsLocation;
+ VclPtr<FixedText> m_pStartMigration;
::svx::DatabaseLocationInputController* m_pLocationController;
protected:
@@ -101,8 +104,10 @@ namespace dbmm
{
public:
ProgressPage(vcl::Window *pParent);
+ virtual ~ProgressPage();
+ virtual void dispose() SAL_OVERRIDE;
- static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
+ static VclPtr<TabPage> Create( ::svt::RoadmapWizard& _rParentDialog );
void setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports );
void onFinishedSuccessfully();
@@ -118,13 +123,13 @@ namespace dbmm
virtual void setOverallProgressValue( const sal_uInt32 _nValue ) SAL_OVERRIDE;
private:
- FixedText* m_pObjectCount;
- FixedText* m_pCurrentObject;
- FixedText* m_pCurrentAction;
- RangeProgressBar m_aCurrentProgress;
- FixedText* m_pAllProgressText;
- RangeProgressBar m_aAllProgress;
- FixedText* m_pMigrationDone;
+ VclPtr<FixedText> m_pObjectCount;
+ VclPtr<FixedText> m_pCurrentObject;
+ VclPtr<FixedText> m_pCurrentAction;
+ RangeProgressBar m_aCurrentProgress;
+ VclPtr<FixedText> m_pAllProgressText;
+ RangeProgressBar m_aAllProgress;
+ VclPtr<FixedText> m_pMigrationDone;
};
// ResultPage
@@ -132,15 +137,17 @@ namespace dbmm
{
public:
ResultPage(vcl::Window *pParent);
+ virtual ~ResultPage();
+ virtual void dispose() SAL_OVERRIDE;
- static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
+ static VclPtr<TabPage> Create( ::svt::RoadmapWizard& _rParentDialog );
void displayMigrationLog( const bool _bSuccessful, const OUString& _rLog );
private:
- FixedText* m_pSuccessLabel;
- FixedText* m_pFailureLabel;
- VclMultiLineEdit* m_pChanges;
+ VclPtr<FixedText> m_pSuccessLabel;
+ VclPtr<FixedText> m_pFailureLabel;
+ VclPtr<VclMultiLineEdit> m_pChanges;
};
} // namespace dbmm
diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx
index 5966a9b27e3c..740a337aeca8 100644
--- a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx
@@ -88,7 +88,7 @@ namespace dbmm
virtual ~MacroMigrationDialogService();
protected:
- virtual Dialog* createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
virtual void destroyDialog() SAL_OVERRIDE;
private:
@@ -121,9 +121,9 @@ namespace dbmm
return *(new MacroMigrationDialogService( _rxContext ) );
}
- Dialog* MacroMigrationDialogService::createDialog( vcl::Window* _pParent )
+ VclPtr<Dialog> MacroMigrationDialogService::createDialog( vcl::Window* _pParent )
{
- return new MacroMigrationDialog( _pParent, m_aContext, m_xDocument );
+ return VclPtr<MacroMigrationDialog>::Create( _pParent, m_aContext, m_xDocument );
}
void MacroMigrationDialogService::destroyDialog()
diff --git a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx
index 0dde133e7f10..7b5a1a0e1282 100644
--- a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx
+++ b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx
@@ -65,7 +65,7 @@ namespace dbmm
}
private:
- ProgressBar *m_pBar;
+ VclPtr<ProgressBar> m_pBar;
sal_uInt32 m_nRange;
};
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 1cbbf0e24897..8836a5dc0dce 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -309,9 +309,7 @@ OApplicationController::~OApplicationController()
osl_atomic_increment( &m_refCount );
dispose();
}
- ::std::unique_ptr< vcl::Window> aTemp( getView() );
clearView();
-
}
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OApplicationController,OApplicationController_CBASE,OApplicationController_Base)
@@ -427,7 +425,7 @@ void SAL_CALL OApplicationController::disposing()
bool OApplicationController::Construct(vcl::Window* _pParent)
{
- setView( * new OApplicationView( _pParent, getORB(), *this, m_ePreviewMode ) );
+ setView( VclPtr<OApplicationView>::Create( _pParent, getORB(), *this, m_ePreviewMode ) );
getView()->SetUniqueId(UID_APP_VIEW);
// late construction
@@ -447,7 +445,6 @@ bool OApplicationController::Construct(vcl::Window* _pParent)
if ( !bSuccess )
{
- ::std::unique_ptr< vcl::Window> aTemp( getView() );
clearView();
return false;
}
@@ -2048,7 +2045,7 @@ void OApplicationController::renameEntry()
if ( xContainer.is() )
{
::std::unique_ptr< IObjectNameCheck > pNameChecker;
- ::std::unique_ptr< OSaveAsDlg > aDialog;
+ VclPtr< OSaveAsDlg > aDialog;
Reference<XRename> xRename;
const ElementType eType = getContainer()->getElementType();
@@ -2081,7 +2078,8 @@ void OApplicationController::renameEntry()
}
}
pNameChecker.reset( new HierarchicalNameCheck( xHNames.get(), OUString() ) );
- aDialog.reset( new OSaveAsDlg(
+ aDialog.reset( VclPtr<OSaveAsDlg>::Create(
+
getView(), getORB(), sName, sLabel, *pNameChecker, SAD_TITLE_RENAME ) );
}
}
@@ -2100,7 +2098,8 @@ void OApplicationController::renameEntry()
ensureConnection();
pNameChecker.reset( new DynamicTableOrQueryNameCheck( getConnection(), nCommandType ) );
- aDialog.reset( new OSaveAsDlg(
+ aDialog.reset( VclPtr<OSaveAsDlg>::Create(
+
getView(), nCommandType, getORB(), getConnection(),
*aList.begin(), *pNameChecker, SAD_TITLE_RENAME ) );
}
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
index 4f4da2f070d0..f18b2d010b85 100644
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ b/dbaccess/source/ui/app/AppControllerDnD.cxx
@@ -175,8 +175,8 @@ void OApplicationController::deleteTables(const ::std::vector< OUString>& _rList
else
{
OUString sMessage(ModuleRes(STR_MISSING_TABLES_XDROP));
- MessageDialog aError(getView(), sMessage);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(getView(), sMessage);
+ aError->Execute();
}
}
}
@@ -210,19 +210,19 @@ void OApplicationController::deleteObjects( ElementType _eType, const ::std::vec
if ( eResult != svtools::QUERYDELETE_ALL )
{
- svtools::QueryDeleteDlg_Impl aDlg( getView(), *aThisRound );
+ ScopedVclPtrInstance< svtools::QueryDeleteDlg_Impl > aDlg(getView(), *aThisRound);
if ( !sDialogPosition.isEmpty() )
- aDlg.SetWindowState( sDialogPosition );
+ aDlg->SetWindowState( sDialogPosition );
if ( nObjectsLeft > 1 )
- aDlg.EnableAllButton();
+ aDlg->EnableAllButton();
- eResult = aDlg.Execute();
+ eResult = aDlg->Execute();
if (eResult == svtools::QUERYDELETE_CANCEL)
return;
- sDialogPosition = aDlg.GetWindowState( );
+ sDialogPosition = aDlg->GetWindowState( );
}
bool bSuccess = false;
@@ -686,17 +686,18 @@ bool OApplicationController::paste( ElementType _eType, const ::svx::ODataAccess
has a /table/ with that name) */
if ( bNeedAskForName )
{
- OSaveAsDlg aAskForName( getView(),
+ ScopedVclPtrInstance<OSaveAsDlg> aAskForName(
+ getView(),
CommandType::QUERY,
getORB(),
getConnection(),
sTargetName,
aNameChecker,
- SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
- if ( RET_OK != aAskForName.Execute() )
+ SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS );
+ if ( RET_OK != aAskForName->Execute() )
// cancelled by the user
return false;
- sTargetName = aAskForName.getName();
+ sTargetName = aAskForName->getName();
}
// create a new object
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index 3eda31592a78..e9424506727a 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -111,12 +111,12 @@ void OApplicationController::convertToView(const OUString& _sName)
OUString aDefaultName = ::dbaui::createDefaultName(xMeta,xTables,aName);
DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE );
- OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< OSaveAsDlg > aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker );
+ if ( aDlg->Execute() == RET_OK )
{
- OUString sName = aDlg.getName();
- OUString sCatalog = aDlg.getCatalog();
- OUString sSchema = aDlg.getSchema();
+ OUString sName = aDlg->getName();
+ OUString sCatalog = aDlg->getCatalog();
+ OUString sSchema = aDlg->getSchema();
OUString sNewName(
::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, false, ::dbtools::eInTableDefinitions ) );
Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject);
@@ -534,8 +534,8 @@ void OApplicationController::askToReconnect()
bool bClear = true;
if ( !m_pSubComponentManager->empty() )
{
- MessageDialog aQry(getView(), ModuleRes(STR_QUERY_CLOSEDOCUMENTS), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- switch (aQry.Execute())
+ ScopedVclPtrInstance< MessageDialog > aQry(getView(), ModuleRes(STR_QUERY_CLOSEDOCUMENTS), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ switch (aQry->Execute())
{
case RET_YES:
closeSubComponents();
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index f01c26bcf9ef..6907968e1fa2 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -188,34 +188,33 @@ namespace
// class OAppDetailPageHelper
OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
,m_rBorderWin(_rBorderWin)
- ,m_aFL(this,WB_VERT)
- ,m_aTBPreview(this,WB_TABSTOP )
- ,m_aBorder(this,WB_BORDER | WB_READONLY)
- ,m_aPreview(&m_aBorder)
- ,m_aDocumentInfo(&m_aBorder,WB_LEFT | WB_VSCROLL | WB_READONLY )
- ,m_pTablePreview(NULL)
+ ,m_aFL(VclPtr<FixedLine>::Create(this,WB_VERT))
+ ,m_aTBPreview(VclPtr<ToolBox>::Create(this,WB_TABSTOP) )
+ ,m_aBorder(VclPtr<Window>::Create(this,WB_BORDER | WB_READONLY))
+ ,m_aPreview(VclPtr<OPreviewWindow>::Create(m_aBorder.get()))
+ ,m_aDocumentInfo(new ::svtools::ODocumentInfoPreview(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) )
,m_ePreviewMode(_ePreviewMode)
{
- m_aBorder.SetBorderStyle(WindowBorderStyle::MONO);
+ m_aBorder->SetBorderStyle(WindowBorderStyle::MONO);
m_aMenu.reset(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
- m_aTBPreview.SetOutStyle(TOOLBOX_STYLE_FLAT);
- m_aTBPreview.InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
- m_aTBPreview.SetHelpId(HID_APP_VIEW_PREVIEW_CB);
- m_aTBPreview.SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
- m_aTBPreview.EnableMenuStrings();
- m_aTBPreview.Enable(true);
+ m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
+ m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
+ m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
+ m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
+ m_aTBPreview->EnableMenuStrings();
+ m_aTBPreview->Enable(true);
- m_aBorder.SetUniqueId(UID_APP_VIEW_PREVIEW_1);
+ m_aBorder->SetUniqueId(UID_APP_VIEW_PREVIEW_1);
- m_aPreview.SetHelpId(HID_APP_VIEW_PREVIEW_1);
+ m_aPreview->SetHelpId(HID_APP_VIEW_PREVIEW_1);
- m_pTablePreview = new OTablePreviewWindow(&m_aBorder,WB_READONLY | WB_DIALOGCONTROL );
+ m_pTablePreview.set( VclPtr<OTablePreviewWindow>::Create(m_aBorder.get(), WB_READONLY | WB_DIALOGCONTROL ) );
m_pTablePreview->SetHelpId(HID_APP_VIEW_PREVIEW_2);
- m_aDocumentInfo.SetHelpId(HID_APP_VIEW_PREVIEW_3);
+ m_aDocumentInfo->SetHelpId(HID_APP_VIEW_PREVIEW_3);
m_xWindow = VCLUnoHelper::GetInterface( m_pTablePreview );
@@ -227,6 +226,11 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
OAppDetailPageHelper::~OAppDetailPageHelper()
{
+ disposeOnce();
+}
+
+void OAppDetailPageHelper::dispose()
+{
try
{
Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY);
@@ -244,13 +248,19 @@ OAppDetailPageHelper::~OAppDetailPageHelper()
{
m_pLists[i]->clearCurrentSelection();
m_pLists[i]->Hide();
- boost::scoped_ptr<DBTreeListBox> aTemp(m_pLists[i]);
m_pLists[i]->clearCurrentSelection(); // why a second time?
- m_pLists[i] = NULL;
+ m_pLists[i].disposeAndClear();
}
-
}
-
+ m_aMenu.reset();
+ m_pTablePreview.disposeAndClear();
+ m_aDocumentInfo.disposeAndClear();
+ m_aPreview.disposeAndClear();
+ m_aBorder.disposeAndClear();
+ m_aTBPreview.disposeAndClear();
+ m_aFL.disposeAndClear();
+
+ vcl::Window::dispose();
}
int OAppDetailPageHelper::getVisibleControlIndex() const
@@ -358,7 +368,7 @@ void OAppDetailPageHelper::describeCurrentSelectionForControl( const Control& _r
void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
{
OSL_ENSURE( _eType < E_ELEMENT_TYPE_COUNT, "OAppDetailPageHelper::describeCurrentSelectionForType: invalid type!" );
- DBTreeListBox* pList = ( _eType < E_ELEMENT_TYPE_COUNT ) ? m_pLists[ _eType ] : NULL;
+ DBTreeListBox* pList = ( _eType < E_ELEMENT_TYPE_COUNT ) ? m_pLists[ _eType ].get() : NULL;
OSL_ENSURE( pList, "OAppDetailPageHelper::describeCurrentSelectionForType: "
"You really should ensure this type has already been viewed before!" );
if ( !pList )
@@ -560,7 +570,7 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon
if ( !m_pLists[E_TABLE] )
{
- OTableTreeListBox* pTreeView = new OTableTreeListBox(this,
+ VclPtrInstance<OTableTreeListBox> pTreeView(this,
WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
pTreeView->SetHelpId(HID_APP_TABLE_TREE);
m_pLists[E_TABLE] = pTreeView;
@@ -571,11 +581,11 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon
);
pTreeView->notifyHiContrastChanged();
- m_aBorder.SetZOrder(pTreeView, WINDOW_ZORDER_BEHIND);
+ m_aBorder->SetZOrder(pTreeView, WINDOW_ZORDER_BEHIND);
}
if ( !m_pLists[E_TABLE]->GetEntryCount() )
{
- static_cast<OTableTreeListBox*>(m_pLists[E_TABLE])->UpdateTableList(_xConnection);
+ static_cast<OTableTreeListBox*>(m_pLists[E_TABLE].get())->UpdateTableList(_xConnection);
SvTreeListEntry* pEntry = m_pLists[E_TABLE]->First();
if ( pEntry )
@@ -657,13 +667,13 @@ void OAppDetailPageHelper::setDetailPage(vcl::Window* _pWindow)
showPreview(NULL);
bool bHasFocus = false;
- m_aFL.Show();
+ m_aFL->Show();
{
bHasFocus = pCurrent != 0 && pCurrent->HasChildPathFocus();
_pWindow->Show();
}
- m_aTBPreview.Show();
- m_aBorder.Show();
+ m_aTBPreview->Show();
+ m_aBorder->Show();
switchPreview(m_ePreviewMode,true);
if ( bHasFocus )
@@ -727,7 +737,7 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine
DBTreeListBox* OAppDetailPageHelper::createSimpleTree( const OString& _sHelpId, const Image& _rImage)
{
- DBTreeListBox* pTreeView = new DBTreeListBox(this,
+ VclPtrInstance<DBTreeListBox> pTreeView(this,
WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
pTreeView->SetHelpId( _sHelpId );
return createTree( pTreeView, _rImage );
@@ -947,17 +957,17 @@ void OAppDetailPageHelper::Resize()
pWindow->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
- m_aFL.SetPosSizePixel( Point(nHalfOutputWidth , 0 ), Size(aFLSize.Width(), nOutputHeight ) );
+ m_aFL->SetPosSizePixel( Point(nHalfOutputWidth , 0 ), Size(aFLSize.Width(), nOutputHeight ) );
- Size aTBSize = m_aTBPreview.CalcWindowSizePixel();
- m_aTBPreview.SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ),
+ Size aTBSize = m_aTBPreview->CalcWindowSizePixel();
+ m_aTBPreview->SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ),
aTBSize );
- m_aBorder.SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ),
+ m_aBorder->SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ),
Size(nHalfOutputWidth - aFLSize.Width() - n6PPT, nOutputHeight - 2*n6PPT - aTBSize.getHeight()) );
- m_aPreview.SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
- m_aDocumentInfo.SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
- m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
+ m_aPreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
+ m_aDocumentInfo->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
+ m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
}
}
@@ -993,7 +1003,7 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
}
m_aMenu->CheckItem(nSelectedAction);
- m_aTBPreview.SetItemText(SID_DB_APP_DISABLE_PREVIEW, m_aMenu->GetItemText(nSelectedAction));
+ m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, m_aMenu->GetItemText(nSelectedAction));
Resize();
// simulate a selectionChanged event at the controller, to force the preview to be updated
@@ -1007,8 +1017,8 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
else
{
m_pTablePreview->Hide();
- m_aPreview.Hide();
- m_aDocumentInfo.Hide();
+ m_aPreview->Hide();
+ m_aDocumentInfo->Hide();
}
}
}
@@ -1034,8 +1044,8 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
Any aPreview = xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >());
if ( m_ePreviewMode == E_DOCUMENT )
{
- m_aDocumentInfo.Hide();
- m_aPreview.Show();
+ m_aDocumentInfo->Hide();
+ m_aPreview->Show();
Graphic aGraphic;
Sequence < sal_Int8 > aBmpSequence;
@@ -1047,24 +1057,24 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
GraphicConverter::Import(aData,aGraphic);
}
- m_aPreview.setGraphic( aGraphic );
- m_aPreview.Invalidate();
+ m_aPreview->setGraphic( aGraphic );
+ m_aPreview->Invalidate();
}
else
{
- m_aPreview.Hide();
- m_aDocumentInfo.clear();
- m_aDocumentInfo.Show();
+ m_aPreview->Hide();
+ m_aDocumentInfo->clear();
+ m_aDocumentInfo->Show();
Reference<document::XDocumentProperties> xProp(
aPreview, UNO_QUERY);
if ( xProp.is() )
- m_aDocumentInfo.fill(xProp,OUString());
+ m_aDocumentInfo->fill(xProp,OUString());
}
}
else
{
- m_aPreview.Hide();
- m_aDocumentInfo.Hide();
+ m_aPreview->Hide();
+ m_aDocumentInfo->Hide();
}
}
catch( const Exception& )
@@ -1081,8 +1091,8 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
if ( isPreviewEnabled() )
{
WaitObject aWaitCursor( this );
- m_aPreview.Hide();
- m_aDocumentInfo.Hide();
+ m_aPreview->Hide();
+ m_aDocumentInfo->Hide();
m_pTablePreview->Show();
if ( !m_xFrame.is() )
{
@@ -1142,17 +1152,17 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
IMPL_LINK(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, /*pToolBox*/)
{
- m_aTBPreview.EndSelection();
+ m_aTBPreview->EndSelection();
// tell the toolbox that the item is pressed down
- m_aTBPreview.SetItemDown( SID_DB_APP_DISABLE_PREVIEW, true );
+ m_aTBPreview->SetItemDown( SID_DB_APP_DISABLE_PREVIEW, true );
// simulate a mouse move (so the "down" state is really painted)
- Point aPoint = m_aTBPreview.GetItemRect( SID_DB_APP_DISABLE_PREVIEW ).TopLeft();
+ Point aPoint = m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW ).TopLeft();
MouseEvent aMove( aPoint, 0, MouseEventModifiers::SIMPLEMOVE | MouseEventModifiers::SYNTHETIC );
- m_aTBPreview.MouseMove( aMove );
+ m_aTBPreview->MouseMove( aMove );
- m_aTBPreview.Update();
+ m_aTBPreview->Update();
// execute the menu
boost::scoped_ptr<PopupMenu> aMenu(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
@@ -1171,14 +1181,14 @@ IMPL_LINK(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, /*pToolBox*/)
// no disabled entries
aMenu->RemoveDisabledEntries();
- sal_uInt16 nSelectedAction = aMenu->Execute(&m_aTBPreview, m_aTBPreview.GetItemRect( SID_DB_APP_DISABLE_PREVIEW ));
+ sal_uInt16 nSelectedAction = aMenu->Execute(m_aTBPreview.get(), m_aTBPreview->GetItemRect( SID_DB_APP_DISABLE_PREVIEW ));
// "cleanup" the toolbox state
MouseEvent aLeave( aPoint, 0, MouseEventModifiers::LEAVEWINDOW | MouseEventModifiers::SYNTHETIC );
- m_aTBPreview.MouseMove( aLeave );
- m_aTBPreview.SetItemDown( SID_DB_APP_DISABLE_PREVIEW, false);
+ m_aTBPreview->MouseMove( aLeave );
+ m_aTBPreview->SetItemDown( SID_DB_APP_DISABLE_PREVIEW, false);
if ( nSelectedAction )
{
- m_aTBPreview.SetItemText(SID_DB_APP_DISABLE_PREVIEW, aMenu->GetItemText(nSelectedAction));
+ m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, aMenu->GetItemText(nSelectedAction));
Resize();
getBorderWin().getView()->getAppController().executeChecked(nSelectedAction,Sequence<PropertyValue>());
}
@@ -1215,7 +1225,7 @@ void OAppDetailPageHelper::DataChanged( const DataChangedEvent& rDCEvt )
ImplInitSettings();
if ( m_pLists[ E_TABLE ] )
{
- OTableTreeListBox* pTableTree = dynamic_cast< OTableTreeListBox* >( m_pLists[ E_TABLE ] );
+ OTableTreeListBox* pTableTree = dynamic_cast< OTableTreeListBox* >( m_pLists[ E_TABLE ].get() );
OSL_ENSURE( pTableTree != NULL, "OAppDetailPageHelper::DataChanged: a tree list for tables which is no TableTreeList?" );
if ( pTableTree )
pTableTree->notifyHiContrastChanged();
@@ -1230,19 +1240,19 @@ void OAppDetailPageHelper::ImplInitSettings()
aFont = rStyleSettings.GetFieldFont();
aFont.SetColor( rStyleSettings.GetWindowTextColor() );
SetPointFont( aFont );
- m_aTBPreview.SetPointFont( aFont );
+ m_aTBPreview->SetPointFont( aFont );
SetTextColor( rStyleSettings.GetFieldTextColor() );
SetTextFillColor();
- m_aBorder.SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aBorder.SetTextFillColor();
- m_aTBPreview.SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aTBPreview.SetTextFillColor();
+ m_aBorder->SetTextColor( rStyleSettings.GetFieldTextColor() );
+ m_aBorder->SetTextFillColor();
+ m_aTBPreview->SetTextColor( rStyleSettings.GetFieldTextColor() );
+ m_aTBPreview->SetTextFillColor();
SetBackground( rStyleSettings.GetFieldColor() );
- m_aBorder.SetBackground( rStyleSettings.GetFieldColor() );
- m_aFL.SetBackground( rStyleSettings.GetFieldColor() );
- m_aDocumentInfo.SetBackground( rStyleSettings.GetFieldColor() );
- m_aTBPreview.SetBackground( rStyleSettings.GetFieldColor() );
+ m_aBorder->SetBackground( rStyleSettings.GetFieldColor() );
+ m_aFL->SetBackground( rStyleSettings.GetFieldColor() );
+ m_aDocumentInfo->SetBackground( rStyleSettings.GetFieldColor() );
+ m_aTBPreview->SetBackground( rStyleSettings.GetFieldColor() );
m_pTablePreview->SetBackground( rStyleSettings.GetFieldColor() );
}
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index fb86bdd3f050..9240fb94e0b5 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -77,15 +77,15 @@ namespace dbaui
// Combines general functionality.
class OAppDetailPageHelper : public vcl::Window
{
- DBTreeListBox* m_pLists[ELEMENT_COUNT];
+ VclPtr<DBTreeListBox> m_pLists[ELEMENT_COUNT];
OAppBorderWindow& m_rBorderWin;
- FixedLine m_aFL;
- ToolBox m_aTBPreview;
- Window m_aBorder;
- OPreviewWindow m_aPreview;
- ::svtools::ODocumentInfoPreview
- m_aDocumentInfo;
- vcl::Window* m_pTablePreview;
+ VclPtr<FixedLine> m_aFL;
+ VclPtr<ToolBox> m_aTBPreview;
+ VclPtr<Window> m_aBorder;
+ VclPtr<OPreviewWindow> m_aPreview;
+ VclPtr<::svtools::ODocumentInfoPreview>
+ m_aDocumentInfo;
+ VclPtr<vcl::Window> m_pTablePreview;
::std::unique_ptr<PopupMenu> m_aMenu;
PreviewMode m_ePreviewMode;
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
@@ -169,6 +169,7 @@ namespace dbaui
public:
OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode);
virtual ~OAppDetailPageHelper();
+ virtual void dispose() SAL_OVERRIDE;
// Window overrides
virtual void Resize() SAL_OVERRIDE;
@@ -193,7 +194,7 @@ namespace dbaui
inline DBTreeListBox* getCurrentView() const
{
ElementType eType = getElementType();
- return (eType != E_NONE ) ? m_pLists[static_cast<sal_Int32>(eType)] : NULL;
+ return (eType != E_NONE ) ? m_pLists[static_cast<sal_Int32>(eType)].get() : NULL;
}
/// select all entries in the visible control
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index aebcd5d3d35d..5ef2b69be554 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -341,30 +341,41 @@ void OCreationList::KeyInput( const KeyEvent& rKEvt )
OTasksWindow::OTasksWindow(vcl::Window* _pParent,OApplicationDetailView* _pDetailView)
: Window(_pParent,WB_DIALOGCONTROL )
- ,m_aCreation(*this)
- ,m_aDescription(this)
- ,m_aHelpText(this,WB_WORDBREAK)
- ,m_aFL(this,WB_VERT)
+ ,m_aCreation(VclPtr<OCreationList>::Create(*this))
+ ,m_aDescription(VclPtr<FixedText>::Create(this))
+ ,m_aHelpText(VclPtr<FixedText>::Create(this,WB_WORDBREAK))
+ ,m_aFL(VclPtr<FixedLine>::Create(this,WB_VERT))
,m_pDetailView(_pDetailView)
{
SetUniqueId(UID_APP_TASKS_WINDOW);
- m_aCreation.SetHelpId(HID_APP_CREATION_LIST);
- m_aCreation.SetSelectHdl(LINK(this, OTasksWindow, OnEntrySelectHdl));
- m_aHelpText.SetHelpId(HID_APP_HELP_TEXT);
- m_aDescription.SetHelpId(HID_APP_DESCRIPTION_TEXT);
- m_aDescription.SetText(ModuleRes(STR_DESCRIPTION));
+ m_aCreation->SetHelpId(HID_APP_CREATION_LIST);
+ m_aCreation->SetSelectHdl(LINK(this, OTasksWindow, OnEntrySelectHdl));
+ m_aHelpText->SetHelpId(HID_APP_HELP_TEXT);
+ m_aDescription->SetHelpId(HID_APP_DESCRIPTION_TEXT);
+ m_aDescription->SetText(ModuleRes(STR_DESCRIPTION));
ImageProvider aImageProvider;
Image aFolderImage = aImageProvider.getFolderImage( css::sdb::application::DatabaseObject::FORM );
- m_aCreation.SetDefaultCollapsedEntryBmp( aFolderImage );
- m_aCreation.SetDefaultExpandedEntryBmp( aFolderImage );
+ m_aCreation->SetDefaultCollapsedEntryBmp( aFolderImage );
+ m_aCreation->SetDefaultExpandedEntryBmp( aFolderImage );
ImplInitSettings(true,true,true);
}
OTasksWindow::~OTasksWindow()
{
+ disposeOnce();
+}
+
+void OTasksWindow::dispose()
+{
Clear();
+ m_aCreation.disposeAndClear();
+ m_aDescription.disposeAndClear();
+ m_aHelpText.disposeAndClear();
+ m_aFL.disposeAndClear();
+ m_pDetailView.clear();
+ vcl::Window::dispose();
}
void OTasksWindow::DataChanged( const DataChangedEvent& rDCEvt )
@@ -394,23 +405,23 @@ void OTasksWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackgro
{
SetTextColor( rStyleSettings.GetFieldTextColor() );
SetTextFillColor();
- m_aHelpText.SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aHelpText.SetTextFillColor();
- m_aDescription.SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aDescription.SetTextFillColor();
+ m_aHelpText->SetTextColor( rStyleSettings.GetFieldTextColor() );
+ m_aHelpText->SetTextFillColor();
+ m_aDescription->SetTextColor( rStyleSettings.GetFieldTextColor() );
+ m_aDescription->SetTextFillColor();
}
if( bBackground )
{
SetBackground( rStyleSettings.GetFieldColor() );
- m_aHelpText.SetBackground( rStyleSettings.GetFieldColor() );
- m_aDescription.SetBackground( rStyleSettings.GetFieldColor() );
- m_aFL.SetBackground( rStyleSettings.GetFieldColor() );
+ m_aHelpText->SetBackground( rStyleSettings.GetFieldColor() );
+ m_aDescription->SetBackground( rStyleSettings.GetFieldColor() );
+ m_aFL->SetBackground( rStyleSettings.GetFieldColor() );
}
- vcl::Font aFont = m_aDescription.GetControlFont();
+ vcl::Font aFont = m_aDescription->GetControlFont();
aFont.SetWeight(WEIGHT_BOLD);
- m_aDescription.SetControlFont(aFont);
+ m_aDescription->SetControlFont(aFont);
}
void OTasksWindow::setHelpText(sal_uInt16 _nId)
@@ -418,20 +429,20 @@ void OTasksWindow::setHelpText(sal_uInt16 _nId)
if ( _nId )
{
OUString sText = ModuleRes(_nId);
- m_aHelpText.SetText(sText);
+ m_aHelpText->SetText(sText);
}
else
{
- m_aHelpText.SetText(OUString());
+ m_aHelpText->SetText(OUString());
}
}
IMPL_LINK(OTasksWindow, OnEntrySelectHdl, SvTreeListBox*, /*_pTreeBox*/)
{
- SvTreeListEntry* pEntry = m_aCreation.GetHdlEntry();
+ SvTreeListEntry* pEntry = m_aCreation->GetHdlEntry();
if ( pEntry )
- m_aHelpText.SetText( ModuleRes( static_cast< TaskEntry* >( pEntry->GetUserData() )->nHelpID ) );
+ m_aHelpText->SetText( ModuleRes( static_cast< TaskEntry* >( pEntry->GetUserData() )->nHelpID ) );
return 1L;
}
@@ -446,14 +457,14 @@ void OTasksWindow::Resize()
sal_Int32 n6PPT = aFLSize.Height();
long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5);
- m_aCreation.SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
+ m_aCreation->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
// i77897 make the m_aHelpText a little bit smaller. (-5)
sal_Int32 nNewWidth = nOutputWidth - nHalfOutputWidth - aFLSize.Width() - 5;
- m_aDescription.SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, 0), Size(nNewWidth, nOutputHeight) );
- Size aDesc = m_aDescription.CalcMinimumSize();
- m_aHelpText.SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, aDesc.Height() ), Size(nNewWidth, nOutputHeight - aDesc.Height() - n6PPT) );
+ m_aDescription->SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, 0), Size(nNewWidth, nOutputHeight) );
+ Size aDesc = m_aDescription->CalcMinimumSize();
+ m_aHelpText->SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, aDesc.Height() ), Size(nNewWidth, nOutputHeight - aDesc.Height() - n6PPT) );
- m_aFL.SetPosSizePixel( Point(nHalfOutputWidth , 0), Size(aFLSize.Width(), nOutputHeight ) );
+ m_aFL->SetPosSizePixel( Point(nHalfOutputWidth , 0), Size(aFLSize.Width(), nOutputHeight ) );
}
void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
@@ -485,79 +496,88 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
for ( TaskEntryList::const_iterator pTask = _rList.begin(); pTask != aEnd; ++pTask, ++pImages )
{
- SvTreeListEntry* pEntry = m_aCreation.InsertEntry( pTask->sTitle );
+ SvTreeListEntry* pEntry = m_aCreation->InsertEntry( pTask->sTitle );
pEntry->SetUserData( reinterpret_cast< void* >( new TaskEntry( *pTask ) ) );
Image aImage = Image( *pImages );
- m_aCreation.SetExpandedEntryBmp( pEntry, aImage );
- m_aCreation.SetCollapsedEntryBmp( pEntry, aImage );
+ m_aCreation->SetExpandedEntryBmp( pEntry, aImage );
+ m_aCreation->SetCollapsedEntryBmp( pEntry, aImage );
}
}
catch(Exception&)
{
}
- m_aCreation.Show();
- m_aCreation.SelectAll(false);
- m_aHelpText.Show();
- m_aDescription.Show();
- m_aFL.Show();
- m_aCreation.updateHelpText();
+ m_aCreation->Show();
+ m_aCreation->SelectAll(false);
+ m_aHelpText->Show();
+ m_aDescription->Show();
+ m_aFL->Show();
+ m_aCreation->updateHelpText();
Enable(!_rList.empty());
}
void OTasksWindow::Clear()
{
- m_aCreation.resetLastActive();
- SvTreeListEntry* pEntry = m_aCreation.First();
+ m_aCreation->resetLastActive();
+ SvTreeListEntry* pEntry = m_aCreation->First();
while ( pEntry )
{
delete static_cast< TaskEntry* >( pEntry->GetUserData() );
- pEntry = m_aCreation.Next(pEntry);
+ pEntry = m_aCreation->Next(pEntry);
}
- m_aCreation.Clear();
+ m_aCreation->Clear();
}
// class OApplicationDetailView
OApplicationDetailView::OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode) : OSplitterView(&_rParent,false )
- ,m_aHorzSplitter(this)
- ,m_aTasks(this,STR_TASKS,WB_BORDER | WB_DIALOGCONTROL )
- ,m_aContainer(this,0,WB_BORDER | WB_DIALOGCONTROL )
+ ,m_aHorzSplitter(VclPtr<Splitter>::Create(this))
+ ,m_aTasks(VclPtr<dbaui::OTitleWindow>::Create(this,STR_TASKS,WB_BORDER | WB_DIALOGCONTROL) )
+ ,m_aContainer(VclPtr<dbaui::OTitleWindow>::Create(this,0,WB_BORDER | WB_DIALOGCONTROL) )
,m_rBorderWin(_rParent)
{
SetUniqueId(UID_APP_DETAIL_VIEW);
ImplInitSettings( true, true, true );
- m_pControlHelper = new OAppDetailPageHelper(&m_aContainer,m_rBorderWin,_ePreviewMode);
+ m_pControlHelper = VclPtr<OAppDetailPageHelper>::Create(m_aContainer.get(),m_rBorderWin,_ePreviewMode);
m_pControlHelper->Show();
- m_aContainer.setChildWindow(m_pControlHelper);
+ m_aContainer->setChildWindow(m_pControlHelper);
- OTasksWindow* pTasks = new OTasksWindow(&m_aTasks,this);
+ VclPtrInstance<OTasksWindow> pTasks(m_aTasks.get(),this);
pTasks->Show();
pTasks->Disable(m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
- m_aTasks.setChildWindow(pTasks);
- m_aTasks.SetUniqueId(UID_APP_TASKS_VIEW);
- m_aTasks.Show();
+ m_aTasks->setChildWindow(pTasks);
+ m_aTasks->SetUniqueId(UID_APP_TASKS_VIEW);
+ m_aTasks->Show();
- m_aContainer.SetUniqueId(UID_APP_CONTAINER_VIEW);
- m_aContainer.Show();
+ m_aContainer->SetUniqueId(UID_APP_CONTAINER_VIEW);
+ m_aContainer->Show();
const long nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
- m_aHorzSplitter.SetPosSizePixel( Point(0,50), Size(0,nFrameWidth) );
+ m_aHorzSplitter->SetPosSizePixel( Point(0,50), Size(0,nFrameWidth) );
// now set the components at the base class
- set(&m_aContainer,&m_aTasks);
+ set(m_aContainer.get(),m_aTasks.get());
- m_aHorzSplitter.Show();
- m_aHorzSplitter.SetUniqueId(UID_APP_VIEW_HORZ_SPLIT);
- setSplitter(&m_aHorzSplitter);
+ m_aHorzSplitter->Show();
+ m_aHorzSplitter->SetUniqueId(UID_APP_VIEW_HORZ_SPLIT);
+ setSplitter(m_aHorzSplitter.get());
}
OApplicationDetailView::~OApplicationDetailView()
{
+ disposeOnce();
+}
+
+void OApplicationDetailView::dispose()
+{
set(NULL,NULL);
setSplitter(NULL);
- m_pControlHelper = NULL;
+ m_aHorzSplitter.disposeAndClear();
+ m_aTasks.disposeAndClear();
+ m_aContainer.disposeAndClear();
+ m_pControlHelper.clear();
+ OSplitterView::dispose();
}
void OApplicationDetailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackground )
@@ -580,9 +600,9 @@ void OApplicationDetailView::ImplInitSettings( bool bFont, bool bForeground, boo
if( bBackground )
SetBackground( rStyleSettings.GetFieldColor() );
- m_aHorzSplitter.SetBackground( rStyleSettings.GetDialogColor() );
- m_aHorzSplitter.SetFillColor( rStyleSettings.GetDialogColor() );
- m_aHorzSplitter.SetTextFillColor(rStyleSettings.GetDialogColor() );
+ m_aHorzSplitter->SetBackground( rStyleSettings.GetDialogColor() );
+ m_aHorzSplitter->SetFillColor( rStyleSettings.GetDialogColor() );
+ m_aHorzSplitter->SetTextFillColor(rStyleSettings.GetDialogColor() );
}
void OApplicationDetailView::DataChanged( const DataChangedEvent& rDCEvt )
@@ -642,7 +662,7 @@ void OApplicationDetailView::impl_createPage( ElementType _eType, const Referenc
bool bEnabled = !rData.aTasks.empty()
&& getBorderWin().getView()->getCommandController().isCommandEnabled( rData.aTasks[0].sUNOCommand );
getTasksWindow().Enable( bEnabled );
- m_aContainer.setTitle( rData.nTitleId );
+ m_aContainer->setTitle( rData.nTitleId );
// let our helper create the object list
if ( _eType == E_TABLE )
diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx
index f90048248ce8..fadf67574c38 100644
--- a/dbaccess/source/ui/app/AppDetailView.hxx
+++ b/dbaccess/source/ui/app/AppDetailView.hxx
@@ -111,11 +111,11 @@ namespace dbaui
class OTasksWindow : public vcl::Window
{
- OCreationList m_aCreation;
- FixedText m_aDescription;
- FixedText m_aHelpText;
- FixedLine m_aFL;
- OApplicationDetailView* m_pDetailView;
+ VclPtr<OCreationList> m_aCreation;
+ VclPtr<FixedText> m_aDescription;
+ VclPtr<FixedText> m_aHelpText;
+ VclPtr<FixedLine> m_aFL;
+ VclPtr<OApplicationDetailView> m_pDetailView;
DECL_LINK( OnEntrySelectHdl, SvTreeListBox* );
void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
@@ -124,6 +124,7 @@ namespace dbaui
public:
OTasksWindow(vcl::Window* _pParent,OApplicationDetailView* _pDetailView);
virtual ~OTasksWindow();
+ virtual void dispose() SAL_OVERRIDE;
// Window overrides
virtual void Resize() SAL_OVERRIDE;
@@ -135,7 +136,7 @@ namespace dbaui
inline bool HandleKeyInput( const KeyEvent& _rKEvt )
{
- return m_aCreation.HandleKeyInput( _rKEvt );
+ return m_aCreation->HandleKeyInput( _rKEvt );
}
void Clear();
@@ -144,11 +145,11 @@ namespace dbaui
class OApplicationDetailView : public OSplitterView
, public IClipboardTest
{
- Splitter m_aHorzSplitter;
- OTitleWindow m_aTasks;
- OTitleWindow m_aContainer;
+ VclPtr<Splitter> m_aHorzSplitter;
+ VclPtr<OTitleWindow> m_aTasks;
+ VclPtr<OTitleWindow> m_aContainer;
OAppBorderWindow& m_rBorderWin; // my parent
- OAppDetailPageHelper* m_pControlHelper;
+ VclPtr<OAppDetailPageHelper> m_pControlHelper;
::std::vector< TaskPaneData > m_aTaskPaneData;
MnemonicGenerator m_aExternalMnemonics;
@@ -161,6 +162,7 @@ namespace dbaui
OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode);
virtual ~OApplicationDetailView();
// Window overrides
+ virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
/** creates the tables page
@@ -188,7 +190,7 @@ namespace dbaui
bool interceptKeyInput( const KeyEvent& _rEvent );
inline OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
- inline OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_aTasks.getChildWindow() ); }
+ inline OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_aTasks->getChildWindow() ); }
bool isCutAllowed() SAL_OVERRIDE ;
bool isCopyAllowed() SAL_OVERRIDE ;
diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx
index ff73ba0fdafc..a4b7d02bb944 100644
--- a/dbaccess/source/ui/app/AppIconControl.cxx
+++ b/dbaccess/source/ui/app/AppIconControl.cxx
@@ -62,6 +62,11 @@ OApplicationIconControl::OApplicationIconControl(vcl::Window* _pParent)
OApplicationIconControl::~OApplicationIconControl()
{
+ disposeOnce();
+}
+
+void OApplicationIconControl::dispose()
+{
sal_uLong nCount = GetEntryCount();
for ( sal_uLong i = 0; i < nCount; ++i )
{
@@ -72,7 +77,7 @@ OApplicationIconControl::~OApplicationIconControl()
pEntry->SetUserData(NULL);
}
}
-
+ SvtIconChoiceCtrl::dispose();
}
sal_Int8 OApplicationIconControl::AcceptDrop( const AcceptDropEvent& _rEvt )
diff --git a/dbaccess/source/ui/app/AppIconControl.hxx b/dbaccess/source/ui/app/AppIconControl.hxx
index 5fcecef90022..10c425b6ea31 100644
--- a/dbaccess/source/ui/app/AppIconControl.hxx
+++ b/dbaccess/source/ui/app/AppIconControl.hxx
@@ -34,6 +34,7 @@ namespace dbaui
public:
OApplicationIconControl(vcl::Window* _pParent);
virtual ~OApplicationIconControl();
+ virtual void dispose() SAL_OVERRIDE;
void setControlActionListener( IControlActionListener* _pListener ) { m_pActionListener = _pListener; }
IControlActionListener* getControlActionListener( ) const { return m_pActionListener; }
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
index 902c7181d5fe..1f215dfd22b5 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.cxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.cxx
@@ -38,35 +38,41 @@ using namespace ::com::sun::star::container;
// class OApplicationSwapWindow
OApplicationSwapWindow::OApplicationSwapWindow( vcl::Window* _pParent, OAppBorderWindow& _rBorderWindow )
:Window(_pParent,WB_DIALOGCONTROL )
- ,m_aIconControl(this)
+ ,m_aIconControl(VclPtr<OApplicationIconControl>::Create(this))
,m_eLastType(E_NONE)
,m_rBorderWin( _rBorderWindow )
{
ImplInitSettings( true, true, true );
- m_aIconControl.SetClickHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl));
- m_aIconControl.setControlActionListener( &m_rBorderWin.getView()->getAppController() );
- m_aIconControl.SetHelpId(HID_APP_SWAP_ICONCONTROL);
- m_aIconControl.Show();
+ m_aIconControl->SetClickHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl));
+ m_aIconControl->setControlActionListener( &m_rBorderWin.getView()->getAppController() );
+ m_aIconControl->SetHelpId(HID_APP_SWAP_ICONCONTROL);
+ m_aIconControl->Show();
}
OApplicationSwapWindow::~OApplicationSwapWindow()
{
+ disposeOnce();
+}
+void OApplicationSwapWindow::dispose()
+{
+ m_aIconControl.disposeAndClear();
+ vcl::Window::dispose();
}
void OApplicationSwapWindow::Resize()
{
Size aFLSize = LogicToPixel( Size( 8, 0 ), MAP_APPFONT );
long nX = 0;
- if ( m_aIconControl.GetEntryCount() != 0 )
- nX = m_aIconControl.GetBoundingBox( m_aIconControl.GetEntry(0) ).GetWidth() + aFLSize.Width();
+ if ( m_aIconControl->GetEntryCount() != 0 )
+ nX = m_aIconControl->GetBoundingBox( m_aIconControl->GetEntry(0) ).GetWidth() + aFLSize.Width();
Size aOutputSize = GetOutputSize();
- m_aIconControl.SetPosSizePixel( Point(static_cast<long>((aOutputSize.Width() - nX)*0.5), 0) ,Size(nX,aOutputSize.Height()));
- m_aIconControl.ArrangeIcons();
+ m_aIconControl->SetPosSizePixel( Point(static_cast<long>((aOutputSize.Width() - nX)*0.5), 0) ,Size(nX,aOutputSize.Height()));
+ m_aIconControl->ArrangeIcons();
}
void OApplicationSwapWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground )
@@ -106,24 +112,24 @@ void OApplicationSwapWindow::DataChanged( const DataChangedEvent& rDCEvt )
void OApplicationSwapWindow::clearSelection()
{
- m_aIconControl.SetNoSelection();
+ m_aIconControl->SetNoSelection();
sal_uLong nPos = 0;
- SvxIconChoiceCtrlEntry* pEntry = m_aIconControl.GetSelectedEntry(nPos);
+ SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(nPos);
if ( pEntry )
- m_aIconControl.InvalidateEntry(pEntry);
- m_aIconControl.GetClickHdl().Call(&m_aIconControl);
+ m_aIconControl->InvalidateEntry(pEntry);
+ m_aIconControl->GetClickHdl().Call(&m_aIconControl);
}
void OApplicationSwapWindow::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics )
{
- m_aIconControl.CreateAutoMnemonics( _rMnemonics );
+ m_aIconControl->CreateAutoMnemonics( _rMnemonics );
}
bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent )
{
const vcl::KeyCode& rKeyCode = _rEvent.GetKeyCode();
if ( rKeyCode.GetModifier() == KEY_MOD2 )
- return m_aIconControl.DoKeyInput( _rEvent );
+ return m_aIconControl->DoKeyInput( _rEvent );
// not handled
return false;
@@ -132,7 +138,7 @@ bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent )
ElementType OApplicationSwapWindow::getElementType() const
{
sal_uLong nPos = 0;
- SvxIconChoiceCtrlEntry* pEntry = m_aIconControl.GetSelectedEntry(nPos);
+ SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(nPos);
return ( pEntry ) ? *static_cast<ElementType*>(pEntry->GetUserData()) : E_NONE;
}
@@ -174,18 +180,18 @@ IMPL_LINK_NOARG(OApplicationSwapWindow, ChangeToLastSelected)
void OApplicationSwapWindow::selectContainer(ElementType _eType)
{
- sal_uLong nCount = m_aIconControl.GetEntryCount();
+ sal_uLong nCount = m_aIconControl->GetEntryCount();
SvxIconChoiceCtrlEntry* pEntry = NULL;
for (sal_uLong i=0; i < nCount; ++i)
{
- pEntry = m_aIconControl.GetEntry(i);
+ pEntry = m_aIconControl->GetEntry(i);
if ( pEntry && *static_cast<ElementType*>(pEntry->GetUserData()) == _eType )
break;
pEntry = NULL;
}
if ( pEntry )
- m_aIconControl.SetCursor(pEntry); // this call also initiates a onContainerSelected call
+ m_aIconControl->SetCursor(pEntry); // this call also initiates a onContainerSelected call
else
onContainerSelected( _eType );
}
diff --git a/dbaccess/source/ui/app/AppSwapWindow.hxx b/dbaccess/source/ui/app/AppSwapWindow.hxx
index c7b61c4651c6..b655dd8e4dc1 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.hxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.hxx
@@ -21,6 +21,7 @@
#include "IClipBoardTest.hxx"
#include <vcl/lstbox.hxx>
+#include <vcl/vclptr.hxx>
#include "AppIconControl.hxx"
#include "AppElementType.hxx"
@@ -30,7 +31,7 @@ namespace dbaui
class OApplicationSwapWindow : public vcl::Window,
public IClipboardTest
{
- OApplicationIconControl m_aIconControl;
+ VclPtr<OApplicationIconControl> m_aIconControl;
ElementType m_eLastType;
OAppBorderWindow& m_rBorderWin;
@@ -44,6 +45,7 @@ namespace dbaui
OApplicationSwapWindow( vcl::Window* _pParent, OAppBorderWindow& _rBorderWindow );
virtual ~OApplicationSwapWindow();
// Window overrides
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
bool isCutAllowed() SAL_OVERRIDE { return false; }
@@ -54,9 +56,9 @@ namespace dbaui
void cut() SAL_OVERRIDE { }
void paste() SAL_OVERRIDE { }
- inline sal_uLong GetEntryCount() const { return m_aIconControl.GetEntryCount(); }
- inline SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return m_aIconControl.GetEntry(nPos); }
- inline Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const { return m_aIconControl.GetBoundingBox(pEntry); }
+ inline sal_uLong GetEntryCount() const { return m_aIconControl->GetEntryCount(); }
+ inline SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return m_aIconControl->GetEntry(nPos); }
+ inline Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const { return m_aIconControl->GetBoundingBox(pEntry); }
/** automatically creates mnemonics for the icon/texts in our left hand side panel
*/
diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
index 2bbd2c66231c..71317b01a82b 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -29,9 +29,9 @@ namespace dbaui
OTitleWindow::OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _nBits,bool _bShift)
: Window(_pParent,_nBits | WB_DIALOGCONTROL)
-, m_aSpace1(this)
-, m_aSpace2(this)
-, m_aTitle(this)
+, m_aSpace1(VclPtr<FixedText>::Create(this))
+, m_aSpace2(VclPtr<FixedText>::Create(this))
+, m_aTitle(VclPtr<FixedText>::Create(this))
, m_pChild(NULL)
, m_bShift(_bShift)
{
@@ -40,20 +40,27 @@ OTitleWindow::OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _n
SetBorderStyle(WindowBorderStyle::MONO);
ImplInitSettings( true, true, true );
- vcl::Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle };
+ vcl::Window* pWindows [] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get() };
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
pWindows[i]->Show();
}
OTitleWindow::~OTitleWindow()
{
+ disposeOnce();
+}
+
+void OTitleWindow::dispose()
+{
if ( m_pChild )
{
m_pChild->Hide();
- boost::scoped_ptr<vcl::Window> aTemp(m_pChild);
- m_pChild = NULL;
}
-
+ m_pChild.disposeAndClear();
+ m_aSpace1.disposeAndClear();
+ m_aSpace2.disposeAndClear();
+ m_aTitle.disposeAndClear();
+ vcl::Window::dispose();
}
void OTitleWindow::setChildWindow(vcl::Window* _pChild)
@@ -74,11 +81,11 @@ void OTitleWindow::Resize()
sal_Int32 nYOffset = aTextSize.Height();
sal_Int32 nHeight = GetTextHeight() + 2*nYOffset;
- m_aSpace1.SetPosSizePixel( Point(SPACE_BORDER, SPACE_BORDER ),
+ m_aSpace1->SetPosSizePixel( Point(SPACE_BORDER, SPACE_BORDER ),
Size(nXOffset , nHeight - SPACE_BORDER) );
- m_aSpace2.SetPosSizePixel( Point(nXOffset + SPACE_BORDER, SPACE_BORDER ),
+ m_aSpace2->SetPosSizePixel( Point(nXOffset + SPACE_BORDER, SPACE_BORDER ),
Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nYOffset) );
- m_aTitle.SetPosSizePixel( Point(nXOffset + SPACE_BORDER, nYOffset + SPACE_BORDER),
+ m_aTitle->SetPosSizePixel( Point(nXOffset + SPACE_BORDER, nYOffset + SPACE_BORDER),
Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nHeight - nYOffset - SPACE_BORDER) );
if ( m_pChild )
{
@@ -91,7 +98,7 @@ void OTitleWindow::setTitle(sal_uInt16 _nTitleId)
{
if ( _nTitleId != 0 )
{
- m_aTitle.SetText(ModuleRes(_nTitleId));
+ m_aTitle->SetText(ModuleRes(_nTitleId));
}
}
@@ -105,7 +112,7 @@ void OTitleWindow::GetFocus()
long OTitleWindow::GetWidthPixel() const
{
Size aTextSize = LogicToPixel( Size( 12, 0 ), MAP_APPFONT );
- sal_Int32 nWidth = GetTextWidth(m_aTitle.GetText()) + 2*aTextSize.Width();
+ sal_Int32 nWidth = GetTextWidth(m_aTitle->GetText()) + 2*aTextSize.Width();
return nWidth;
}
@@ -151,7 +158,7 @@ void OTitleWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackgro
if( bBackground )
SetBackground( rStyleSettings.GetFieldColor() );
- vcl::Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle};
+ vcl::Window* pWindows [] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get()};
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
{
vcl::Font aFont = pWindows[i]->GetFont();
diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx b/dbaccess/source/ui/app/AppTitleWindow.hxx
index 76228b54b6cf..875f693107ab 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.hxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.hxx
@@ -25,10 +25,10 @@ namespace dbaui
{
class OTitleWindow : public vcl::Window
{
- FixedText m_aSpace1;
- FixedText m_aSpace2;
- FixedText m_aTitle;
- vcl::Window* m_pChild;
+ VclPtr<FixedText> m_aSpace1;
+ VclPtr<FixedText> m_aSpace2;
+ VclPtr<FixedText> m_aTitle;
+ VclPtr<vcl::Window> m_pChild;
bool m_bShift;
void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
protected:
@@ -36,6 +36,7 @@ namespace dbaui
public:
OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _nBits,bool _bShift = true);
virtual ~OTitleWindow();
+ virtual void dispose() SAL_OVERRIDE;
// Window overrides
virtual void Resize() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
index fe2d505e9018..6fa8030ceadc 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -68,9 +68,9 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev
SetBorderStyle(WindowBorderStyle::MONO);
- m_pPanel = new OTitleWindow(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL, false);
+ m_pPanel = VclPtr<OTitleWindow>::Create(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL, false);
m_pPanel->SetBorderStyle(WindowBorderStyle::MONO);
- OApplicationSwapWindow* pSwap = new OApplicationSwapWindow( m_pPanel, *this );
+ VclPtrInstance<OApplicationSwapWindow> pSwap( m_pPanel, *this );
pSwap->Show();
pSwap->SetUniqueId(UID_APP_SWAP_VIEW);
@@ -78,7 +78,7 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev
m_pPanel->SetUniqueId(UID_APP_DATABASE_VIEW);
m_pPanel->Show();
- m_pDetailView = new OApplicationDetailView(*this,_ePreviewMode);
+ m_pDetailView = VclPtr<OApplicationDetailView>::Create(*this,_ePreviewMode);
m_pDetailView->Show();
ImplInitSettings();
@@ -86,20 +86,20 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev
OAppBorderWindow::~OAppBorderWindow()
{
+ disposeOnce();
+}
+
+void OAppBorderWindow::dispose()
+{
// destroy children
if ( m_pPanel )
- {
m_pPanel->Hide();
- boost::scoped_ptr<vcl::Window> aTemp(m_pPanel);
- m_pPanel = NULL;
- }
+ m_pPanel.disposeAndClear();
if ( m_pDetailView )
- {
m_pDetailView->Hide();
- boost::scoped_ptr<vcl::Window> aTemp(m_pDetailView);
- m_pDetailView = NULL;
- }
-
+ m_pDetailView.disposeAndClear();
+ m_pView.clear();
+ vcl::Window::dispose();
}
void OAppBorderWindow::GetFocus()
@@ -195,7 +195,7 @@ OApplicationView::OApplicationView( vcl::Window* pParent
{
}
- m_pWin = new OAppBorderWindow(this,_ePreviewMode);
+ m_pWin = VclPtr<OAppBorderWindow>::Create(this,_ePreviewMode);
m_pWin->SetUniqueId(UID_APP_VIEW_BORDER_WIN);
m_pWin->Show();
@@ -204,13 +204,16 @@ OApplicationView::OApplicationView( vcl::Window* pParent
OApplicationView::~OApplicationView()
{
+ disposeOnce();
+}
- {
- stopComponentListening(m_xObject);
- m_pWin->Hide();
- boost::scoped_ptr<vcl::Window> aTemp(m_pWin);
- m_pWin = NULL;
- }
+void OApplicationView::dispose()
+{
+ stopComponentListening(m_xObject);
+ m_xObject.clear();
+ m_pWin->Hide();
+ m_pWin.disposeAndClear();
+ ODataView::dispose();
}
void OApplicationView::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics )
diff --git a/dbaccess/source/ui/app/AppView.hxx b/dbaccess/source/ui/app/AppView.hxx
index 87288117d2cd..41f30c85b99e 100644
--- a/dbaccess/source/ui/app/AppView.hxx
+++ b/dbaccess/source/ui/app/AppView.hxx
@@ -44,9 +44,9 @@ namespace dbaui
class OTitleWindow;
class OAppBorderWindow : public vcl::Window
{
- OTitleWindow* m_pPanel;
- OApplicationDetailView* m_pDetailView;
- OApplicationView* m_pView;
+ VclPtr<OTitleWindow> m_pPanel;
+ VclPtr<OApplicationDetailView> m_pDetailView;
+ VclPtr<OApplicationView> m_pView;
void ImplInitSettings();
protected:
@@ -55,6 +55,7 @@ namespace dbaui
public:
OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode);
virtual ~OAppBorderWindow();
+ virtual void dispose() SAL_OVERRIDE;
// Window overrides
virtual void GetFocus() SAL_OVERRIDE;
@@ -79,7 +80,7 @@ namespace dbaui
::com::sun::star::lang::Locale m_aLocale;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
m_xObject;
- OAppBorderWindow* m_pWin;
+ VclPtr<OAppBorderWindow> m_pWin;
IApplicationController& m_rAppController;
ChildFocusState m_eChildFocus;
@@ -103,6 +104,7 @@ namespace dbaui
,PreviewMode _ePreviewMode
);
virtual ~OApplicationView();
+ virtual void dispose() SAL_OVERRIDE;
/// automatically creates mnemonics for the icon/texts in our left hand side panel
void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx
index e4c05397585b..880504587747 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.cxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <tools/diagnose_ex.h>
+#include <dbaccess/dataview.hxx>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 0bfddcc7bb6c..d39dd447553b 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -757,7 +757,7 @@ bool SbaXDataBrowserController::Construct(vcl::Window* pParent)
}
// create the view
- setView( * new UnoDataBrowserView( pParent, *this, getORB() ) );
+ setView( VclPtr<UnoDataBrowserView>::Create( pParent, *this, getORB() ) );
if (!getBrowserView())
return false;
@@ -1271,8 +1271,8 @@ IMPL_LINK( SbaXDataBrowserController, OnAsyncDisplayError, void*, /* _pNotIntere
{
if ( m_aCurrentError.isValid() )
{
- OSQLMessageBox aDlg( getBrowserView(), m_aCurrentError );
- aDlg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aDlg( getBrowserView(), m_aCurrentError );
+ aDlg->Execute();
}
return 0L;
}
@@ -1764,19 +1764,19 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(bool bFilter)
Reference< XConnection> xCon(xFormSet->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
if(bFilter)
{
- DlgFilterCrit aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() );
- if ( !aDlg.Execute() )
+ ScopedVclPtrInstance< DlgFilterCrit > aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() );
+ if ( !aDlg->Execute() )
return; // if so we don't need to update the grid
- aDlg.BuildWherePart();
+ aDlg->BuildWherePart();
}
else
{
- DlgOrderCrit aDlg( getBrowserView(),xCon,xParser,xSup->getColumns() );
- if(!aDlg.Execute())
+ ScopedVclPtrInstance< DlgOrderCrit > aDlg( getBrowserView(),xCon,xParser,xSup->getColumns() );
+ if(!aDlg->Execute())
{
return; // if so we don't need to actualize the grid
}
- aDlg.BuildOrderPart();
+ aDlg->BuildOrderPart();
}
}
catch(const SQLException& )
@@ -2172,11 +2172,11 @@ bool SbaXDataBrowserController::SaveModified(bool bAskFor)
{
getBrowserView()->getVclControl()->GrabFocus();
- MessageDialog aQry(getBrowserView()->getVclControl(),
- "SaveModifiedDialog",
- "dbaccess/ui/savemodifieddialog.ui");
+ ScopedVclPtrInstance<MessageDialog> aQry( getBrowserView()->getVclControl(),
+ "SaveModifiedDialog",
+ "dbaccess/ui/savemodifieddialog.ui" );
- switch (aQry.Execute())
+ switch (aQry->Execute())
{
case RET_NO:
Execute(ID_BROWSER_UNDORECORD,Sequence<PropertyValue>());
diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index f41289e3a797..fe0ad003ab79 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -106,7 +106,7 @@ void UnoDataBrowserView::Construct(const Reference< ::com::sun::star::awt::XCont
m_pVclControl = NULL;
getVclControl();
- OSL_ENSURE(m_pVclControl != NULL, "UnoDataBrowserView::Construct : no real grid control !");
+ OSL_ENSURE(m_pVclControl != nullptr, "UnoDataBrowserView::Construct : no real grid control !");
}
catch(const Exception&)
{
@@ -117,17 +117,15 @@ void UnoDataBrowserView::Construct(const Reference< ::com::sun::star::awt::XCont
UnoDataBrowserView::~UnoDataBrowserView()
{
- {
- boost::scoped_ptr<Splitter> aTemp(m_pSplitter);
- m_pSplitter = NULL;
- }
+ disposeOnce();
+}
+
+void UnoDataBrowserView::dispose()
+{
+ m_pSplitter.disposeAndClear();
setTreeView(NULL);
- if ( m_pStatus )
- {
- delete m_pStatus;
- m_pStatus = NULL;
- }
+ m_pStatus.disposeAndClear();
try
{
@@ -136,7 +134,9 @@ UnoDataBrowserView::~UnoDataBrowserView()
}
catch(const Exception&)
{}
-
+ m_pTreeView.clear();
+ m_pVclControl.clear();
+ ODataView::dispose();
}
IMPL_LINK( UnoDataBrowserView, SplitHdl, void*, /*NOINTERESTEDIN*/ )
@@ -157,13 +157,9 @@ void UnoDataBrowserView::setSplitter(Splitter* _pSplitter)
void UnoDataBrowserView::setTreeView(DBTreeView* _pTreeView)
{
- if (m_pTreeView != _pTreeView)
+ if (m_pTreeView.get() != _pTreeView)
{
- if (m_pTreeView)
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pTreeView);
- m_pTreeView = NULL;
- }
+ m_pTreeView.disposeAndClear();
m_pTreeView = _pTreeView;
}
}
@@ -175,7 +171,7 @@ void UnoDataBrowserView::showStatus( const OUString& _rStatus )
else
{
if (!m_pStatus)
- m_pStatus = new FixedText(this);
+ m_pStatus = VclPtr<FixedText>::Create(this);
m_pStatus->SetText(_rStatus);
m_pStatus->Show();
Resize();
@@ -268,7 +264,7 @@ SbaGridControl* UnoDataBrowserView::getVclControl() const
UnoDataBrowserView* pTHIS = const_cast<UnoDataBrowserView*>(this);
if ( pPeer )
{
- m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow());
+ m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow().get());
pTHIS->startComponentListening(Reference<XComponent>(VCLUnoHelper::GetInterface(m_pVclControl),UNO_QUERY));
}
}
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index dc27afe956a3..fd7451f34891 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -42,7 +42,7 @@ namespace dbaui
class ColorChanger
{
protected:
- OutputDevice* m_pDev;
+ VclPtr<OutputDevice> m_pDev;
public:
ColorChanger( OutputDevice* _pDev, const ::Color& _rNewLineColor, const ::Color& _rNewFillColor )
@@ -65,12 +65,11 @@ namespace dbaui
WinBits nStyle)
:Window(pParent,nStyle)
,m_xContext(_rxContext)
- ,m_rController( _rController )
- ,m_aSeparator( this )
+ ,m_xController( &_rController )
+ ,m_aSeparator( VclPtr<FixedLine>::Create(this) )
{
- m_rController.acquire();
m_pAccel.reset(::svt::AcceleratorExecute::createAcceleratorHelper());
- m_aSeparator.Show();
+ m_aSeparator->Show();
}
void ODataView::Construct()
@@ -79,8 +78,15 @@ namespace dbaui
ODataView::~ODataView()
{
+ disposeOnce();
+ }
- m_rController.release();
+ void ODataView::dispose()
+ {
+ m_xController.clear();
+ m_aSeparator.disposeAndClear();
+ m_pAccel.reset();
+ vcl::Window::dispose();
}
void ODataView::resizeDocumentView( Rectangle& /*_rPlayground*/ )
@@ -105,7 +111,7 @@ namespace dbaui
// position the separator
const Size aSeparatorSize = Size( aPlayground.GetWidth(), 2 );
- m_aSeparator.SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
+ m_aSeparator->SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
aPlayground.Top() += aSeparatorSize.Height() + 1;
// position the controls of the document's view
@@ -134,7 +140,7 @@ namespace dbaui
case MouseNotifyEvent::KEYUP:
case MouseNotifyEvent::MOUSEBUTTONDOWN:
case MouseNotifyEvent::MOUSEBUTTONUP:
- bHandled = m_rController.interceptUserInput( _rNEvt );
+ bHandled = m_xController->interceptUserInput( _rNEvt );
break;
default:
break;
@@ -148,7 +154,7 @@ namespace dbaui
if ( nType == StateChangedType::CONTROLBACKGROUND )
{
// Check if we need to get new images for normal/high contrast mode
- m_rController.notifyHiContrastChanged();
+ m_xController->notifyHiContrastChanged();
}
if ( nType == StateChangedType::INITSHOW )
@@ -157,7 +163,7 @@ namespace dbaui
// model's arguments.
try
{
- Reference< XController > xController( m_rController.getXController(), UNO_SET_THROW );
+ Reference< XController > xController( m_xController->getXController(), UNO_SET_THROW );
Reference< XModel > xModel( xController->getModel(), UNO_QUERY );
if ( xModel.is() )
{
@@ -183,7 +189,7 @@ namespace dbaui
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
{
// Check if we need to get new images for normal/high contrast mode
- m_rController.notifyHiContrastChanged();
+ m_xController->notifyHiContrastChanged();
}
}
void ODataView::attachFrame(const Reference< XFrame >& _xFrame)
diff --git a/dbaccess/source/ui/browser/dbtreeview.cxx b/dbaccess/source/ui/browser/dbtreeview.cxx
index 9dba9af17c20..bc0b44194983 100644
--- a/dbaccess/source/ui/browser/dbtreeview.cxx
+++ b/dbaccess/source/ui/browser/dbtreeview.cxx
@@ -36,7 +36,7 @@ DBTreeView::DBTreeView( vcl::Window* pParent, WinBits nBits)
, m_pTreeListBox(NULL)
{
- m_pTreeListBox = new DBTreeListBox(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
+ m_pTreeListBox = VclPtr<DBTreeListBox>::Create(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
m_pTreeListBox->EnableCheckButton(NULL);
m_pTreeListBox->SetDragDropMode( DragDropMode::NONE );
m_pTreeListBox->EnableInplaceEditing( true );
@@ -46,6 +46,11 @@ DBTreeView::DBTreeView( vcl::Window* pParent, WinBits nBits)
DBTreeView::~DBTreeView()
{
+ disposeOnce();
+}
+
+void DBTreeView::dispose()
+{
if (m_pTreeListBox)
{
if (m_pTreeListBox->GetModel())
@@ -53,9 +58,9 @@ DBTreeView::~DBTreeView()
m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
m_pTreeListBox->DisconnectFromModel();
}
- boost::scoped_ptr<vcl::Window> aTemp(m_pTreeListBox);
- m_pTreeListBox = NULL;
}
+ m_pTreeListBox.disposeAndClear();
+ vcl::Window::dispose();
}
void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
diff --git a/dbaccess/source/ui/browser/dbtreeview.hxx b/dbaccess/source/ui/browser/dbtreeview.hxx
index 99bf4416ce8c..5313583fc061 100644
--- a/dbaccess/source/ui/browser/dbtreeview.hxx
+++ b/dbaccess/source/ui/browser/dbtreeview.hxx
@@ -31,7 +31,7 @@ namespace dbaui
class DBTreeView : public vcl::Window
{
private:
- DBTreeListBox* m_pTreeListBox;
+ VclPtr<DBTreeListBox> m_pTreeListBox;
protected:
// window overridables
virtual void Resize() SAL_OVERRIDE;
@@ -40,6 +40,7 @@ namespace dbaui
DBTreeView( vcl::Window* pParent,
WinBits nBits );
virtual ~DBTreeView();
+ virtual void dispose() SAL_OVERRIDE;
/** sets a handler which is called when an list box entry is to be expanded.
<p>When calling the link, the parameter is an SvTreeListEntry marking the entry to be expanded.
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index c0e6c4686d56..7bf028e18ac1 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -291,7 +291,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
xParent = xFrame->getContainerWindow();
VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(xParent);
- vcl::Window* pParentWin = pParentComponent ? pParentComponent->GetWindow() : NULL;
+ VclPtr< vcl::Window > pParentWin = pParentComponent ? pParentComponent->GetWindow() : VclPtr< vcl::Window >();
if (!pParentWin)
{
throw IllegalArgumentException("Parent window is null", *this, 1 );
@@ -312,7 +312,6 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
catch(Exception&)
{
// no one clears my view if I won't
- boost::scoped_ptr<vcl::Window> aTemp(m_pView);
m_pView = NULL;
throw;
}
@@ -983,6 +982,16 @@ Reference< XConnection > OGenericUnoController::connect( const OUString& _rDataS
return xConnection;
}
+void OGenericUnoController::setView( const VclPtr<ODataView> &i_rView )
+{
+ m_pView = i_rView;
+}
+
+void OGenericUnoController::clearView()
+{
+ m_pView = NULL;
+}
+
void OGenericUnoController::showError(const SQLExceptionInfo& _rInfo)
{
::dbaui::showError(_rInfo,getView(),getORB());
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 92bf55a2457e..fad16daabc0b 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -309,7 +309,7 @@ void SAL_CALL SbaXGridPeer::dispose() throw( RuntimeException, std::exception )
void SbaXGridPeer::NotifyStatusChanged(const ::com::sun::star::util::URL& _rUrl, const Reference< ::com::sun::star::frame::XStatusListener > & xControl)
{
- SbaGridControl* pGrid = static_cast<SbaGridControl*>(GetWindow());
+ VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >();
if (!pGrid)
return;
@@ -361,7 +361,7 @@ Reference< ::com::sun::star::frame::XDispatch > SAL_CALL SbaXGridPeer::queryDis
IMPL_LINK( SbaXGridPeer, OnDispatchEvent, void*, /*NOTINTERESTEDIN*/ )
{
- SbaGridControl* pGrid = static_cast< SbaGridControl* >( GetWindow() );
+ VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >();
if ( pGrid ) // if this fails, we were disposing before arriving here
{
if ( Application::GetMainThreadIdentifier() != ::osl::Thread::getCurrentIdentifier() )
@@ -398,7 +398,7 @@ SbaXGridPeer::DispatchType SbaXGridPeer::classifyDispatchURL( const URL& _rURL )
void SAL_CALL SbaXGridPeer::dispatch(const URL& aURL, const Sequence< PropertyValue >& aArgs) throw( RuntimeException, std::exception )
{
- SbaGridControl* pGrid = static_cast<SbaGridControl*>(GetWindow());
+ VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >();
if (!pGrid)
return;
@@ -549,9 +549,9 @@ SbaXGridPeer* SbaXGridPeer::getImplementation(const Reference< XInterface >& _rx
return NULL;
}
-FmGridControl* SbaXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
+VclPtr<FmGridControl> SbaXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
{
- return new SbaGridControl( m_xContext, pParent, this, nStyle);
+ return VclPtr<SbaGridControl>::Create( m_xContext, pParent, this, nStyle);
}
// SbaGridHeader
@@ -717,13 +717,19 @@ SbaGridControl::SbaGridControl(Reference< XComponentContext > _rM,
SbaGridControl::~SbaGridControl()
{
+ disposeOnce();
+}
+
+void SbaGridControl::dispose()
+{
if (m_nAsyncDropEvent)
Application::RemoveUserEvent(m_nAsyncDropEvent);
+ FmGridControl::dispose();
}
-BrowserHeader* SbaGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
+VclPtr<BrowserHeader> SbaGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
{
- return new SbaGridHeader(pParent);
+ return VclPtr<SbaGridHeader>::Create(pParent);
}
CellController* SbaGridControl::GetController(long nRow, sal_uInt16 nCol)
@@ -786,10 +792,10 @@ void SbaGridControl::SetColWidth(sal_uInt16 nColId)
Any aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
sal_Int32 nCurWidth = aWidth.hasValue() ? ::comphelper::getINT32(aWidth) : -1;
- DlgSize aDlgColWidth(this, nCurWidth, false);
- if (aDlgColWidth.Execute())
+ ScopedVclPtrInstance< DlgSize > aDlgColWidth(this, nCurWidth, false);
+ if (aDlgColWidth->Execute())
{
- sal_Int32 nValue = aDlgColWidth.GetValue();
+ sal_Int32 nValue = aDlgColWidth->GetValue();
Any aNewWidth;
if (-1 == nValue)
{ // set to default
@@ -815,10 +821,10 @@ void SbaGridControl::SetRowHeight()
Any aHeight = xCols->getPropertyValue(PROPERTY_ROW_HEIGHT);
sal_Int32 nCurHeight = aHeight.hasValue() ? ::comphelper::getINT32(aHeight) : -1;
- DlgSize aDlgRowHeight(this, nCurHeight, true);
- if (aDlgRowHeight.Execute())
+ ScopedVclPtrInstance< DlgSize > aDlgRowHeight(this, nCurHeight, true);
+ if (aDlgRowHeight->Execute())
{
- sal_Int32 nValue = aDlgRowHeight.GetValue();
+ sal_Int32 nValue = aDlgRowHeight->GetValue();
Any aNewHeight;
if ((sal_Int16)-1 == nValue)
{ // set to default
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index ddc38f897c88..e546a4a7b33e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -348,11 +348,11 @@ bool SbaTableQueryBrowser::Construct(vcl::Window* pParent)
// create controls and set sizes
const long nFrameWidth = getBrowserView()->LogicToPixel( ::Size( 3, 0 ), MAP_APPFONT ).Width();
- m_pSplitter = new Splitter(getBrowserView(),WB_HSCROLL);
+ m_pSplitter = VclPtr<Splitter>::Create(getBrowserView(),WB_HSCROLL);
m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) );
m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
- m_pTreeView = new DBTreeView(getBrowserView(), WB_TABSTOP | WB_BORDER);
+ m_pTreeView = VclPtr<DBTreeView>::Create(getBrowserView(), WB_TABSTOP | WB_BORDER);
m_pTreeView->SetPreExpandHandler(LINK(this, SbaTableQueryBrowser, OnExpandEntry));
m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry));
diff --git a/dbaccess/source/ui/control/ColumnControlWindow.cxx b/dbaccess/source/ui/control/ColumnControlWindow.cxx
index a4d44cbc6464..36aff78e2f96 100644
--- a/dbaccess/source/ui/control/ColumnControlWindow.cxx
+++ b/dbaccess/source/ui/control/ColumnControlWindow.cxx
@@ -47,11 +47,6 @@ OColumnControlWindow::OColumnControlWindow(vcl::Window* pParent
m_aLocale = SvtSysLocale().GetLanguageTag().getLocale();
}
-OColumnControlWindow::~OColumnControlWindow()
-{
-
-}
-
void OColumnControlWindow::ActivateAggregate( EControlType eType )
{
switch(eType )
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 7643cfeb50e0..a6fb6d753efe 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -76,17 +76,15 @@ using namespace ::com::sun::star::util;
namespace
{
- template< typename T1, typename T2> void lcl_HideAndDeleteControl(short& _nPos,T1** _pControl,T2** _pControlText)
+ template< typename T1, typename T2> void lcl_HideAndDeleteControl(short& _nPos,VclPtr<T1>& _pControl, VclPtr<T2>& _pControlText)
{
- if ( *_pControl )
+ if ( _pControl )
{
--_nPos;
- (*_pControl)->Hide();
- (*_pControlText)->Hide();
- delete *_pControl;
- delete *_pControlText;
- (*_pControl) = NULL;
- (*_pControlText) = NULL;
+ _pControl->Hide();
+ _pControlText->Hide();
+ _pControl.disposeAndClear();
+ _pControlText.disposeAndClear();
}
}
@@ -141,8 +139,8 @@ OFieldDescControl::OFieldDescControl( vcl::Window* pParent, OTableDesignHelpBar*
void OFieldDescControl::Contruct()
{
- m_pVertScroll = new ScrollBar(this, WB_VSCROLL | WB_REPEAT | WB_DRAG);
- m_pHorzScroll = new ScrollBar(this, WB_HSCROLL | WB_REPEAT | WB_DRAG);
+ m_pVertScroll = VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_REPEAT | WB_DRAG);
+ m_pHorzScroll = VclPtr<ScrollBar>::Create(this, WB_HSCROLL | WB_REPEAT | WB_DRAG);
m_pVertScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll));
m_pHorzScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll));
m_pVertScroll->Show();
@@ -161,18 +159,13 @@ void OFieldDescControl::Contruct()
OFieldDescControl::~OFieldDescControl()
{
+ disposeOnce();
+}
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pVertScroll);
- m_pVertScroll = NULL;
- }
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pHorzScroll);
- m_pHorzScroll = NULL;
- }
+void OFieldDescControl::dispose()
+{
if ( m_bAdded )
::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- pLastFocusWindow = NULL;
// Destroy children
DeactivateAggregate( tpDefault );
@@ -187,6 +180,37 @@ OFieldDescControl::~OFieldDescControl()
DeactivateAggregate( tpColumnName );
DeactivateAggregate( tpType );
DeactivateAggregate( tpAutoIncrementValue );
+ pHelp.clear();
+ pLastFocusWindow.clear();
+ m_pActFocusWindow.clear();
+ pDefaultText.clear();
+ pRequiredText.clear();
+ pAutoIncrementText.clear();
+ pTextLenText.clear();
+ pNumTypeText.clear();
+ pLengthText.clear();
+ pScaleText.clear();
+ pFormatText.clear();
+ pBoolDefaultText.clear();
+ m_pColumnNameText.clear();
+ m_pTypeText.clear();
+ m_pAutoIncrementValueText.clear();
+ pRequired.clear();
+ pNumType.clear();
+ pAutoIncrement.clear();
+ pDefault.clear();
+ pTextLen.clear();
+ pLength.clear();
+ pScale.clear();
+ pFormatSample.clear();
+ pBoolDefault.clear();
+ m_pColumnName.clear();
+ m_pType.clear();
+ m_pAutoIncrementValue.clear();
+ pFormat.clear();
+ m_pVertScroll.clear();
+ m_pHorzScroll.clear();
+ TabPage::dispose();
}
OUString OFieldDescControl::BoolStringPersistent(const OUString& rUIString) const
@@ -680,8 +704,8 @@ void OFieldDescControl::ArrangeAggregates()
// A Control's description
struct AGGREGATE_DESCRIPTION
{
- Control* pctrlInputControl; // The actual Control for input
- Control* pctrlTextControl; // The corresponding Label
+ VclPtr<Control> pctrlInputControl; // The actual Control for input
+ VclPtr<Control> pctrlTextControl; // The corresponding Label
sal_uInt16 nPosSizeArgument; // The second argument for SetPosSize
};
AGGREGATE_DESCRIPTION adAggregates[] = {
@@ -717,8 +741,8 @@ void OFieldDescControl::ArrangeAggregates()
{
if (adAggregates[i].pctrlInputControl)
{
- SetPosSize(&adAggregates[i].pctrlTextControl, nCurrentControlPos, 0);
- SetPosSize(&adAggregates[i].pctrlInputControl, nCurrentControlPos, adAggregates[i].nPosSizeArgument);
+ SetPosSize(adAggregates[i].pctrlTextControl, nCurrentControlPos, 0);
+ SetPosSize(adAggregates[i].pctrlInputControl, nCurrentControlPos, adAggregates[i].nPosSizeArgument);
// Set the z-order in a way such that the Controls can be traversed in the same sequence in which they have been arranged here
adAggregates[i].pctrlTextControl->SetZOrder(pZOrderPredecessor, pZOrderPredecessor ? WINDOW_ZORDER_BEHIND : WINDOW_ZORDER_FIRST);
@@ -758,7 +782,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
return;
m_nPos++;
pDefaultText = CreateText(STR_DEFAULT_VALUE);
- pDefault = new OPropEditCtrl( this, STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT, WB_BORDER );
+ pDefault = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT, WB_BORDER );
InitializeControl(pDefault,HID_TAB_ENT_DEFAULT,false);
break;
case tpAutoIncrementValue:
@@ -766,7 +790,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
return;
m_nPos++;
m_pAutoIncrementValueText = CreateText(STR_AUTOINCREMENT_VALUE);
- m_pAutoIncrementValue = new OPropEditCtrl( this, STR_HELP_AUTOINCREMENT_VALUE, FIELD_PROPERTY_AUTOINCREMENT, WB_BORDER );
+ m_pAutoIncrementValue = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_AUTOINCREMENT_VALUE, FIELD_PROPERTY_AUTOINCREMENT, WB_BORDER );
m_pAutoIncrementValue->SetText( getAutoIncrementValue() );
InitializeControl(m_pAutoIncrementValue,HID_TAB_AUTOINCREMENTVALUE,false);
break;
@@ -781,7 +805,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
{
m_nPos++;
pRequiredText = CreateText(STR_FIELD_REQUIRED);
- pRequired = new OPropListBoxCtrl( this, STR_HELP_FIELD_REQUIRED, FIELD_PROPERTY_REQUIRED, WB_DROPDOWN);
+ pRequired = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_FIELD_REQUIRED, FIELD_PROPERTY_REQUIRED, WB_DROPDOWN);
pRequired->InsertEntry( aYes );
pRequired->InsertEntry( aNo );
@@ -797,7 +821,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
return;
m_nPos++;
pAutoIncrementText = CreateText(STR_FIELD_AUTOINCREMENT);
- pAutoIncrement = new OPropListBoxCtrl( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_AUTOINC, WB_DROPDOWN );
+ pAutoIncrement = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_AUTOINC, WB_DROPDOWN );
pAutoIncrement->InsertEntry( aYes );
pAutoIncrement->InsertEntry( aNo );
pAutoIncrement->SelectEntryPos(0);
@@ -817,7 +841,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
return;
m_nPos++;
m_pTypeText = CreateText(STR_TAB_FIELD_DATATYPE);
- m_pType = new OPropListBoxCtrl( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE, WB_DROPDOWN );
+ m_pType = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE, WB_DROPDOWN );
m_pType->SetDropDownLineCount(20);
{
const OTypeInfoMap* pTypeInfo = getTypeInfo();
@@ -850,7 +874,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
DBG_UNHANDLED_EXCEPTION();
}
m_pColumnNameText = CreateText(STR_TAB_FIELD_NAME);
- m_pColumnName = new OPropColumnEditCtrl( this,
+ m_pColumnName = VclPtr<OPropColumnEditCtrl>::Create( this,
aTmpString,
STR_HELP_DEFAULT_VALUE,
FIELD_PROPERTY_COLUMNNAME,
@@ -867,7 +891,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
m_nPos++;
pNumTypeText = CreateText(STR_NUMERIC_TYPE);
- pNumType = new OPropListBoxCtrl( this, STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE, WB_DROPDOWN );
+ pNumType = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE, WB_DROPDOWN );
pNumType->SetDropDownLineCount(5);
pNumType->InsertEntry( OUString("Byte") );
@@ -901,12 +925,12 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
m_nPos++;
pFormatText = CreateText(STR_FORMAT);
- pFormatSample = new OPropEditCtrl( this, STR_HELP_FORMAT_CODE, -1, WB_BORDER );
+ pFormatSample = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_FORMAT_CODE, -1, WB_BORDER );
pFormatSample->SetReadOnly(true);
pFormatSample->Enable(false);
InitializeControl(pFormatSample,HID_TAB_ENT_FORMAT_SAMPLE,false);
- pFormat = new PushButton( this, ModuleRes(PB_FORMAT) );
+ pFormat = VclPtr<PushButton>::Create( this, ModuleRes(PB_FORMAT) );
const sal_Int32 nControlHeight = GetMaxControlHeight();
pFormat->SetSizePixel(Size(nControlHeight, nControlHeight));
pFormat->SetClickHdl( LINK( this, OFieldDescControl, FormatClickHdl ) );
@@ -921,7 +945,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
m_nPos++;
pBoolDefaultText = CreateText(STR_DEFAULT_VALUE);
- pBoolDefault = new OPropListBoxCtrl( this, STR_HELP_BOOL_DEFAULT, FIELD_PROPERTY_BOOL_DEFAULT, WB_DROPDOWN );
+ pBoolDefault = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_BOOL_DEFAULT, FIELD_PROPERTY_BOOL_DEFAULT, WB_DROPDOWN );
pBoolDefault->SetDropDownLineCount(3);
pBoolDefault->InsertEntry(OUString(ModuleRes(STR_VALUE_NONE)));
pBoolDefault->InsertEntry(aYes);
@@ -943,17 +967,17 @@ void OFieldDescControl::InitializeControl(Control* _pControl,const OString& _sHe
_pControl->EnableClipSiblings();
}
-FixedText* OFieldDescControl::CreateText(sal_uInt16 _nTextRes)
+VclPtr<FixedText> OFieldDescControl::CreateText(sal_uInt16 _nTextRes)
{
- FixedText* pFixedText = new FixedText( this );
+ VclPtrInstance<FixedText> pFixedText( this );
pFixedText->SetText( ModuleRes(_nTextRes) );
pFixedText->EnableClipSiblings();
return pFixedText;
}
-OPropNumericEditCtrl* OFieldDescControl::CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId)
+VclPtr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId)
{
- OPropNumericEditCtrl* pControl = new OPropNumericEditCtrl( this, _nHelpStr, _nProperty, WB_BORDER );
+ VclPtrInstance<OPropNumericEditCtrl> pControl( this, _nHelpStr, _nProperty, WB_BORDER );
pControl->SetDecimalDigits(0);
pControl->SetMin(0);
pControl->SetMax(0x7FFFFFFF); // Should be changed outside, if needed
@@ -971,62 +995,61 @@ void OFieldDescControl::DeactivateAggregate( EControlType eType )
switch( eType )
{
case tpDefault:
- lcl_HideAndDeleteControl(m_nPos,&pDefault,&pDefaultText);
+ lcl_HideAndDeleteControl(m_nPos,pDefault,pDefaultText);
break;
case tpAutoIncrementValue:
- lcl_HideAndDeleteControl(m_nPos,&m_pAutoIncrementValue,&m_pAutoIncrementValueText);
+ lcl_HideAndDeleteControl(m_nPos,m_pAutoIncrementValue,m_pAutoIncrementValueText);
break;
case tpColumnName:
- lcl_HideAndDeleteControl(m_nPos,&m_pColumnName,&m_pColumnNameText);
+ lcl_HideAndDeleteControl(m_nPos,m_pColumnName,m_pColumnNameText);
break;
case tpType:
- lcl_HideAndDeleteControl(m_nPos,&m_pType,&m_pTypeText);
+ lcl_HideAndDeleteControl(m_nPos,m_pType,m_pTypeText);
break;
case tpAutoIncrement:
- lcl_HideAndDeleteControl(m_nPos,&pAutoIncrement,&pAutoIncrementText);
+ lcl_HideAndDeleteControl(m_nPos,pAutoIncrement,pAutoIncrementText);
break;
case tpRequired:
- lcl_HideAndDeleteControl(m_nPos,&pRequired,&pRequiredText);
+ lcl_HideAndDeleteControl(m_nPos,pRequired,pRequiredText);
break;
case tpTextLen:
- lcl_HideAndDeleteControl(m_nPos,&pTextLen,&pTextLenText);
+ lcl_HideAndDeleteControl(m_nPos,pTextLen,pTextLenText);
break;
case tpNumType:
- lcl_HideAndDeleteControl(m_nPos,&pNumType,&pNumTypeText);
+ lcl_HideAndDeleteControl(m_nPos,pNumType,pNumTypeText);
break;
case tpLength:
- lcl_HideAndDeleteControl(m_nPos,&pLength,&pLengthText);
+ lcl_HideAndDeleteControl(m_nPos,pLength,pLengthText);
break;
case tpScale:
- lcl_HideAndDeleteControl(m_nPos,&pScale,&pScaleText);
+ lcl_HideAndDeleteControl(m_nPos,pScale,pScaleText);
break;
case tpFormat:
// TODO: we have to check if we have to increment m_nPos again
- lcl_HideAndDeleteControl(m_nPos,&pFormat,&pFormatText);
+ lcl_HideAndDeleteControl(m_nPos,pFormat,pFormatText);
if ( pFormatSample )
{
pFormatSample->Hide();
- delete pFormatSample;
- pFormatSample = NULL;
+ pFormatSample.disposeAndClear();
}
break;
case tpBoolDefault:
- lcl_HideAndDeleteControl(m_nPos,&pBoolDefault,&pBoolDefaultText);
+ lcl_HideAndDeleteControl(m_nPos,pBoolDefault,pBoolDefaultText);
break;
}
}
-void OFieldDescControl::SetPosSize( Control** ppControl, long nRow, sal_uInt16 nCol )
+void OFieldDescControl::SetPosSize( VclPtr<Control>& rControl, long nRow, sal_uInt16 nCol )
{
// Calculate size
@@ -1077,18 +1100,18 @@ void OFieldDescControl::SetPosSize( Control** ppControl, long nRow, sal_uInt16 n
aPosition.X() = 0;
}
- (*ppControl)->SetSizePixel( aSize );
- aSize = (*ppControl)->GetSizePixel( );
+ rControl->SetSizePixel( aSize );
+ aSize = rControl->GetSizePixel( );
const sal_Int32 nControl_Spacing_y = LogicToPixel(Size(0, CONTROL_SPACING_Y),MAP_APPFONT).Height();
aPosition.Y() += ((nRow+1)*nControl_Spacing_y) +
(nRow*nControlHeight);
// Display Control
- (*ppControl)->SetPosSizePixel( aPosition, aSize );
- aSize = (*ppControl)->GetSizePixel();
+ rControl->SetPosSizePixel( aPosition, aSize );
+ aSize = rControl->GetSizePixel();
- (*ppControl)->Show();
+ rControl->Show();
}
void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
@@ -1453,7 +1476,7 @@ IMPL_LINK(OFieldDescControl, OnControlFocusGot, Control*, pControl )
if (pControl == pFormat)
strHelpText = ModuleRes(STR_HELP_FORMAT_BUTTON);
- if (!strHelpText.isEmpty() && (pHelp != NULL))
+ if (!strHelpText.isEmpty() && (pHelp != nullptr))
pHelp->SetHelpText(strHelpText);
m_pActFocusWindow = pControl;
@@ -1579,30 +1602,30 @@ void OFieldDescControl::LoseFocus()
bool OFieldDescControl::isCopyAllowed()
{
- bool bAllowed = (m_pActFocusWindow != NULL) &&
+ bool bAllowed = (m_pActFocusWindow != nullptr) &&
(m_pActFocusWindow == pDefault || m_pActFocusWindow == pFormatSample ||
m_pActFocusWindow == pTextLen || m_pActFocusWindow == pLength ||
m_pActFocusWindow == pScale || m_pActFocusWindow == m_pColumnName ||
m_pActFocusWindow == m_pAutoIncrementValue) &&
- !static_cast<Edit*>(m_pActFocusWindow)->GetSelected().isEmpty();
+ !static_cast<Edit*>(m_pActFocusWindow.get())->GetSelected().isEmpty();
return bAllowed;
}
bool OFieldDescControl::isCutAllowed()
{
- bool bAllowed = (m_pActFocusWindow != NULL) &&
+ bool bAllowed = (m_pActFocusWindow != nullptr) &&
(m_pActFocusWindow == pDefault || m_pActFocusWindow == pFormatSample ||
m_pActFocusWindow == pTextLen || m_pActFocusWindow == pLength ||
m_pActFocusWindow == pScale || m_pActFocusWindow == m_pColumnName ||
m_pActFocusWindow == m_pAutoIncrementValue) &&
- !static_cast<Edit*>(m_pActFocusWindow)->GetSelected().isEmpty();
+ !static_cast<Edit*>(m_pActFocusWindow.get())->GetSelected().isEmpty();
return bAllowed;
}
bool OFieldDescControl::isPasteAllowed()
{
- bool bAllowed = (m_pActFocusWindow != NULL) &&
+ bool bAllowed = (m_pActFocusWindow != nullptr) &&
(m_pActFocusWindow == pDefault || m_pActFocusWindow == pFormatSample ||
m_pActFocusWindow == pTextLen || m_pActFocusWindow == pLength ||
m_pActFocusWindow == pScale || m_pActFocusWindow == m_pColumnName ||
@@ -1618,19 +1641,19 @@ bool OFieldDescControl::isPasteAllowed()
void OFieldDescControl::cut()
{
if(isCutAllowed())
- static_cast<Edit*>(m_pActFocusWindow)->Cut();
+ static_cast<Edit*>(m_pActFocusWindow.get())->Cut();
}
void OFieldDescControl::copy()
{
if(isCopyAllowed()) // this only checks if the focus window is valid
- static_cast<Edit*>(m_pActFocusWindow)->Copy();
+ static_cast<Edit*>(m_pActFocusWindow.get())->Copy();
}
void OFieldDescControl::paste()
{
if(m_pActFocusWindow) // this only checks if the focus window is valid
- static_cast<Edit*>(m_pActFocusWindow)->Paste();
+ static_cast<Edit*>(m_pActFocusWindow.get())->Paste();
}
bool OFieldDescControl::isTextFormat(const OFieldDescription* _pFieldDescr, sal_uInt32& _nFormatKey) const
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index 0a7035d6f7f6..f011e060a719 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -59,7 +59,7 @@ namespace dbaui
{
friend class OTableListBoxControl;
- ::std::unique_ptr< ::svt::ListBoxControl> m_pListCell;
+ VclPtr< ::svt::ListBoxControl> m_pListCell;
TTableConnectionData::value_type m_pConnData;
OTableListBoxControl* m_pBoxControl;
long m_nDataPos;
@@ -83,7 +83,6 @@ namespace dbaui
{
m_pBoxControl = pController;
}
- virtual ~ORelationControl();
/** searches for a connection between these two tables
@param _pSource
@@ -102,6 +101,8 @@ namespace dbaui
void lateInit();
protected:
+ virtual ~ORelationControl() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_pListCell.disposeAndClear(); ORelationControl_Base::dispose(); }
virtual void Resize() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
virtual bool PreNotify(NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -144,10 +145,6 @@ namespace dbaui
return new ORelationControl(pParent);
}
- ORelationControl::~ORelationControl()
- {
- }
-
void ORelationControl::Init(const TTableConnectionData::value_type& _pConnData)
{
@@ -170,7 +167,7 @@ namespace dbaui
InsertDataColumn( DEST_COLUMN, m_pConnData->getReferencedTable()->GetWinName(), 100);
// If the Defs do not yet exits, we need to set them with SetSource-/-DestDef
- m_pListCell.reset( new ListBoxControl( &GetDataWindow() ) );
+ m_pListCell.reset( VclPtr<ListBoxControl>::Create( &GetDataWindow() ) );
// set browse mode
SetMode( BrowserMode::COLUMNSELECTION |
diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx
index 122f230d4afb..1496a3610fcd 100644
--- a/dbaccess/source/ui/control/TableGrantCtrl.cxx
+++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx
@@ -71,16 +71,22 @@ OTableGrantControl::OTableGrantControl( vcl::Window* pParent, WinBits nBits)
OTableGrantControl::~OTableGrantControl()
{
+ disposeOnce();
+}
+
+void OTableGrantControl::dispose()
+{
if (m_nDeactivateEvent)
{
Application::RemoveUserEvent(m_nDeactivateEvent);
m_nDeactivateEvent = 0;
}
- delete m_pCheckCell;
- delete m_pEdit;
+ m_pCheckCell.disposeAndClear();
+ m_pEdit.disposeAndClear();
m_xTables = NULL;
+ ::svt::EditBrowseBox::dispose();
}
void OTableGrantControl::setTablesSupplier(const Reference< XTablesSupplier >& _xTablesSup)
@@ -122,10 +128,10 @@ void OTableGrantControl::Init()
// ComboBox instanzieren
if(!m_pCheckCell)
{
- m_pCheckCell = new CheckBoxControl( &GetDataWindow() );
+ m_pCheckCell = VclPtr<CheckBoxControl>::Create( &GetDataWindow() );
m_pCheckCell->GetBox().EnableTriState(false);
- m_pEdit = new Edit( &GetDataWindow() );
+ m_pEdit = VclPtr<Edit>::Create( &GetDataWindow() );
m_pEdit->SetReadOnly();
m_pEdit->Enable(false);
}
diff --git a/dbaccess/source/ui/control/VertSplitView.cxx b/dbaccess/source/ui/control/VertSplitView.cxx
index 5313d4213cb6..5644fbbaf4bf 100644
--- a/dbaccess/source/ui/control/VertSplitView.cxx
+++ b/dbaccess/source/ui/control/VertSplitView.cxx
@@ -39,7 +39,15 @@ OSplitterView::OSplitterView(vcl::Window* _pParent,bool _bVertical) : Window(_pP
OSplitterView::~OSplitterView()
{
- m_pRight = m_pLeft = NULL;
+ disposeOnce();
+}
+
+void OSplitterView::dispose()
+{
+ m_pSplitter.clear();
+ m_pLeft.clear();
+ m_pRight.clear();
+ vcl::Window::dispose();
}
IMPL_LINK( OSplitterView, SplitHdl, Splitter*, /*pSplit*/ )
diff --git a/dbaccess/source/ui/control/charsetlistbox.cxx b/dbaccess/source/ui/control/charsetlistbox.cxx
index 9daa8b9be5de..d7a510b4e255 100644
--- a/dbaccess/source/ui/control/charsetlistbox.cxx
+++ b/dbaccess/source/ui/control/charsetlistbox.cxx
@@ -43,10 +43,6 @@ namespace dbaui
return new CharSetListBox(pParent);
}
- CharSetListBox::~CharSetListBox()
- {
- }
-
void CharSetListBox::SelectEntryByIanaName( const OUString& _rIanaName )
{
OCharsetDisplay::const_iterator aFind = m_aCharSets.findIanaName( _rIanaName );
diff --git a/dbaccess/source/ui/control/curledit.cxx b/dbaccess/source/ui/control/curledit.cxx
index 4dc9d7fffb52..917e8870c43a 100644
--- a/dbaccess/source/ui/control/curledit.cxx
+++ b/dbaccess/source/ui/control/curledit.cxx
@@ -40,11 +40,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeConnectionURLEdit(vcl:
OConnectionURLEdit::~OConnectionURLEdit()
{
- // delete my sub controls
- Edit* pSubEdit = GetSubEdit();
- SetSubEdit(NULL);
- delete pSubEdit;
- delete m_pForcedPrefix;
+ disposeOnce();
+}
+
+void OConnectionURLEdit::dispose()
+{
+ SetSubEdit(nullptr);
+ m_pForcedPrefix.disposeAndClear();
+ Edit::dispose();
}
void OConnectionURLEdit::SetTextNoPrefix(const OUString& _rText)
@@ -86,10 +89,10 @@ void OConnectionURLEdit::SetText(const OUString& _rStr, const Selection& /*_rNew
{
// create new sub controls, if necessary
if (!GetSubEdit())
- SetSubEdit(new Edit(this, 0));
+ SetSubEdit(VclPtr<Edit>::Create(this, 0));
if ( !m_pForcedPrefix )
{
- m_pForcedPrefix = new FixedText(this, WB_VCENTER);
+ m_pForcedPrefix = VclPtr<FixedText>::Create(this, WB_VCENTER);
// we use a gray background for the fixed text
StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 2d4e0cea22aa..afd7b1b60fb0 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -84,7 +84,13 @@ void DBTreeListBox::init()
DBTreeListBox::~DBTreeListBox()
{
+ disposeOnce();
+}
+
+void DBTreeListBox::dispose()
+{
implStopSelectionTimer();
+ SvTreeListBox::dispose();
}
SvTreeListEntry* DBTreeListBox::GetEntryPosByName( const OUString& aName, SvTreeListEntry* pStart, const IEntryFilter* _pFilter ) const
diff --git a/dbaccess/source/ui/control/marktree.cxx b/dbaccess/source/ui/control/marktree.cxx
index 2fc45e769fa2..ddd50aa66e58 100644
--- a/dbaccess/source/ui/control/marktree.cxx
+++ b/dbaccess/source/ui/control/marktree.cxx
@@ -37,8 +37,13 @@ OMarkableTreeListBox::OMarkableTreeListBox( vcl::Window* pParent, WinBits nWinSt
OMarkableTreeListBox::~OMarkableTreeListBox()
{
- delete m_pCheckButton;
+ disposeOnce();
+}
+void OMarkableTreeListBox::dispose()
+{
+ delete m_pCheckButton;
+ DBTreeListBox::dispose();
}
void OMarkableTreeListBox::Paint(const Rectangle& _rRect)
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index ff4007f729f9..9048294db7c3 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -105,6 +105,11 @@ OSqlEdit::OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle ) :
OSqlEdit::~OSqlEdit()
{
+ disposeOnce();
+}
+
+void OSqlEdit::dispose()
+{
if (m_timerUndoActionCreation.IsActive())
m_timerUndoActionCreation.Stop();
css::uno::Reference< css::beans::XMultiPropertySet > n;
@@ -116,6 +121,8 @@ OSqlEdit::~OSqlEdit()
n->removePropertiesChangeListener(m_listener.get());
}
m_ColorConfig.RemoveListener(this);
+ m_pView.clear();
+ MultiLineEditSyntaxHighlight::dispose();
}
void OSqlEdit::KeyInput( const KeyEvent& rKEvt )
diff --git a/dbaccess/source/ui/control/toolboxcontroller.cxx b/dbaccess/source/ui/control/toolboxcontroller.cxx
index cb6d3061ad46..079e4a5f61e8 100644
--- a/dbaccess/source/ui/control/toolboxcontroller.cxx
+++ b/dbaccess/source/ui/control/toolboxcontroller.cxx
@@ -131,7 +131,7 @@ namespace dbaui
for (; aIter != aEnd; ++aIter)
addStatusListener(aIter->first);
- ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
+ VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get());
if ( pToolBox )
{
sal_uInt16 nCount = pToolBox->GetItemCount();
@@ -169,7 +169,7 @@ namespace dbaui
{
m_aCommandURL = aFind->first;
- ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
+ VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get());
lcl_copy(pMenu.get(),nItemId,i,pToolBox,m_nToolBoxId, m_aCommandURL);
break;
}
@@ -228,7 +228,7 @@ namespace dbaui
SolarMutexGuard aSolarMutexGuard;
::osl::MutexGuard aGuard(m_aMutex);
- ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
+ VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get());
::std::unique_ptr<PopupMenu> pMenu = getMenu();
sal_uInt16 nSelected = pMenu->Execute(pToolBox, pToolBox->GetItemRect( m_nToolBoxId ),POPUPMENU_EXECUTE_DOWN);
diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index aa50eb9bc4ca..1ceb8a62931d 100644
--- a/dbaccess/source/ui/dlg/CollectionView.cxx
+++ b/dbaccess/source/ui/dlg/CollectionView.cxx
@@ -91,10 +91,21 @@ OCollectionView::OCollectionView( vcl::Window * pParent
m_pPB_OK->SetClickHdl( LINK( this, OCollectionView, Save_Click ) );
}
-OCollectionView::~OCollectionView( )
+OCollectionView::~OCollectionView()
{
+ disposeOnce();
}
+void OCollectionView::dispose()
+{
+ m_pFTCurrentPath.clear();
+ m_pNewFolder.clear();
+ m_pUp.clear();
+ m_pView.clear();
+ m_pName.clear();
+ m_pPB_OK.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(OCollectionView, Save_Click)
{
@@ -169,8 +180,8 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click)
Reference< XContent> xContent;
if ( xNameContainer->hasByName(sName) )
{
- QueryBox aBox( this, WB_YES_NO, ModuleRes( STR_ALREADYEXISTOVERWRITE ) );
- if ( aBox.Execute() != RET_YES )
+ ScopedVclPtrInstance< QueryBox > aBox( this, WB_YES_NO, ModuleRes( STR_ALREADYEXISTOVERWRITE ) );
+ if ( aBox->Execute() != RET_YES )
return 0;
}
m_pName->SetText(sName);
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index a02b5d68b80b..8bf6989c9ab9 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -91,7 +91,6 @@ namespace dbaui
: OGenericAdministrationPage(pParent, _rId, _rUIXMLDescription, _rCoreAttrs)
, m_bUserGrabFocus(false)
, m_pCollection(NULL)
- , m_bDelete(false)
{
get(m_pFT_Connection, "browseurllabel");
get(m_pConnectionURL, "browseurl");
@@ -110,13 +109,17 @@ namespace dbaui
OConnectionHelper::~OConnectionHelper()
{
- if(m_bDelete)
- {
- delete m_pFT_Connection;
- delete m_pConnectionURL;
- delete m_pPB_Connection;
- delete m_pPB_CreateDB;
- }
+ disposeOnce();
+ }
+
+ void OConnectionHelper::dispose()
+ {
+ // FIXME: used to have an if (m_bDelete) ...
+ m_pFT_Connection.disposeAndClear();
+ m_pConnectionURL.disposeAndClear();
+ m_pPB_Connection.disposeAndClear();
+ m_pPB_CreateDB.disposeAndClear();
+ OGenericAdministrationPage::dispose();
}
void OConnectionHelper::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
@@ -306,16 +309,16 @@ namespace dbaui
aProfiles.insert(pArray[index]);
// execute the select dialog
- ODatasourceSelectDialog aSelector(GetParent(), aProfiles);
+ ScopedVclPtrInstance< ODatasourceSelectDialog > aSelector(GetParent(), aProfiles);
OUString sOldProfile=getURLNoPrefix();
if (!sOldProfile.isEmpty())
- aSelector.Select(sOldProfile);
+ aSelector->Select(sOldProfile);
else
- aSelector.Select(xMozillaBootstrap->getDefaultProfile(profileType));
+ aSelector->Select(xMozillaBootstrap->getDefaultProfile(profileType));
- if ( RET_OK == aSelector.Execute() )
- setURLNoPrefix(aSelector.GetSelected());
+ if ( RET_OK == aSelector->Execute() )
+ setURLNoPrefix(aSelector->GetSelected());
break;
}
case ::dbaccess::DST_FIREBIRD:
@@ -476,8 +479,8 @@ namespace dbaui
sQuery = sQuery.replaceFirst("$path$", aTransformer.get(OFileNotation::N_SYSTEM));
m_bUserGrabFocus = false;
- QueryBox aQuery(GetParent(), WB_YES_NO | WB_DEF_YES, sQuery);
- sal_Int32 nQueryResult = aQuery.Execute();
+ ScopedVclPtrInstance< QueryBox > aQuery(GetParent(), WB_YES_NO | WB_DEF_YES, sQuery);
+ sal_Int32 nQueryResult = aQuery->Execute();
m_bUserGrabFocus = true;
switch (nQueryResult)
@@ -493,8 +496,8 @@ namespace dbaui
sQuery = sQuery.replaceFirst("$name$", aTransformer.get(OFileNotation::N_SYSTEM));
m_bUserGrabFocus = false;
- QueryBox aWhatToDo(GetParent(), WB_RETRY_CANCEL | WB_DEF_RETRY, sQuery);
- nQueryResult = aWhatToDo.Execute();
+ ScopedVclPtrInstance< QueryBox > aWhatToDo(GetParent(), WB_RETRY_CANCEL | WB_DEF_RETRY, sQuery);
+ nQueryResult = aWhatToDo->Execute();
m_bUserGrabFocus = true;
if (RET_RETRY == nQueryResult)
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.hxx b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
index 117295bea89d..9fd69e7459c4 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
@@ -42,10 +42,11 @@ namespace dbaui
public:
OConnectionHelper( vcl::Window* pParent, const OString& _rId, const OUString& _rUIXMLDescription, const SfxItemSet& _rCoreAttrs);
virtual ~OConnectionHelper();
- FixedText *m_pFT_Connection;
- OConnectionURLEdit *m_pConnectionURL;
- PushButton *m_pPB_Connection;
- PushButton *m_pPB_CreateDB;
+ virtual void dispose() SAL_OVERRIDE;
+ VclPtr<FixedText> m_pFT_Connection;
+ VclPtr<OConnectionURLEdit> m_pConnectionURL;
+ VclPtr<PushButton> m_pPB_Connection;
+ VclPtr<PushButton> m_pPB_CreateDB;
OUString m_eType; // the type can't be changed in this class, so we hold it as member.
public:
@@ -95,7 +96,6 @@ namespace dbaui
OUString impl_getURL( bool _bPrefix ) const;
void impl_setURL( const OUString& _rURL, bool _bPrefix );
void implUpdateURLDependentStates() const;
- bool m_bDelete;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 4e7b8cc39987..ed99f813357d 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -81,10 +81,11 @@ namespace dbaui
using namespace ::dbtools;
using namespace ::svt;
- SfxTabPage* OConnectionTabPage::Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> OConnectionTabPage::Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new OConnectionTabPage( pParent, *_rAttrSet ) );
+ return VclPtr<SfxTabPage>(new OConnectionTabPage( pParent, *_rAttrSet ), SAL_NO_ACQUIRE);
}
+
// OConnectionTabPage
OConnectionTabPage::OConnectionTabPage(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs)
:OConnectionHelper(pParent, "ConnectionPage", "dbaccess/ui/connectionpage.ui", _rCoreAttrs)
@@ -111,6 +112,21 @@ namespace dbaui
OConnectionTabPage::~OConnectionTabPage()
{
+ disposeOnce();
+ }
+
+ void OConnectionTabPage::dispose()
+ {
+ m_pFL2.clear();
+ m_pUserNameLabel.clear();
+ m_pUserName.clear();
+ m_pPasswordRequired.clear();
+ m_pFL3.clear();
+ m_pJavaDriverLabel.clear();
+ m_pJavaDriver.clear();
+ m_pTestJavaDriver.clear();
+ m_pTestConnection.clear();
+ OConnectionHelper::dispose();
}
void OConnectionTabPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
@@ -293,8 +309,8 @@ namespace dbaui
const sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
const OSQLMessageBox::MessageType mt = bSuccess ? OSQLMessageBox::Info : OSQLMessageBox::Error;
- OSQLMessageBox aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
- aMsg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
+ aMsg->Execute();
return 0L;
}
bool OConnectionTabPage::checkTestConnection()
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.hxx b/dbaccess/source/ui/dlg/ConnectionPage.hxx
index 5e1c84fb88a1..2b4626d8fa08 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.hxx
@@ -36,26 +36,28 @@ namespace dbaui
{
protected:
// user authentification
- FixedText* m_pFL2;
- FixedText* m_pUserNameLabel;
- Edit* m_pUserName;
- CheckBox* m_pPasswordRequired;
+ VclPtr<FixedText> m_pFL2;
+ VclPtr<FixedText> m_pUserNameLabel;
+ VclPtr<Edit> m_pUserName;
+ VclPtr<CheckBox> m_pPasswordRequired;
// jdbc driver
- FixedText* m_pFL3;
- FixedText* m_pJavaDriverLabel;
- Edit* m_pJavaDriver;
- PushButton* m_pTestJavaDriver;
+ VclPtr<FixedText> m_pFL3;
+ VclPtr<FixedText> m_pJavaDriverLabel;
+ VclPtr<Edit> m_pJavaDriver;
+ VclPtr<PushButton> m_pTestJavaDriver;
// connection test
- PushButton* m_pTestConnection;
+ VclPtr<PushButton> m_pTestConnection;
// called when the test connection button was clicked
- DECL_LINK(OnTestJavaClickHdl,PushButton*);
- DECL_LINK(OnEditModified,Edit*);
+ DECL_LINK(OnTestJavaClickHdl, PushButton*);
+ DECL_LINK(OnEditModified, Edit*);
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet );
+ virtual ~OConnectionTabPage();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet );
virtual bool FillItemSet (SfxItemSet* _rCoreAttrs) SAL_OVERRIDE;
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
@@ -70,7 +72,6 @@ namespace dbaui
private:
OConnectionTabPage(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
// nControlFlags is a combination of the CBTP_xxx-constants
- virtual ~OConnectionTabPage();
private:
/** enables the test connection button, if allowed
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
index db19ebb9d21b..b081ad82c565 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
@@ -63,29 +63,29 @@ namespace dbaui
using namespace ::dbtools;
using namespace ::svt;
- OGenericAdministrationPage* OConnectionTabPageSetup::CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE);
+ return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup ( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE), SAL_NO_ACQUIRE );
}
- OGenericAdministrationPage* OConnectionTabPageSetup::CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE);
+ return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE), SAL_NO_ACQUIRE );
}
- OGenericAdministrationPage* OConnectionTabPageSetup::CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL);
+ return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL), SAL_NO_ACQUIRE );
}
- OGenericAdministrationPage* OConnectionTabPageSetup::CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE);
+ return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE), SAL_NO_ACQUIRE );
}
- OGenericAdministrationPage* OConnectionTabPageSetup::CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, USHRT_MAX, USHRT_MAX, STR_COMMONURL);
+ return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, USHRT_MAX, USHRT_MAX, STR_COMMONURL), SAL_NO_ACQUIRE );
}
OConnectionTabPageSetup::OConnectionTabPageSetup(vcl::Window* pParent, const OString& _rId, const OUString& _rUIXMLDescription, const SfxItemSet& _rCoreAttrs, sal_uInt16 _nHelpTextResId, sal_uInt16 _nHeaderResId, sal_uInt16 _nUrlResId)
@@ -121,6 +121,14 @@ namespace dbaui
OConnectionTabPageSetup::~OConnectionTabPageSetup()
{
+ disposeOnce();
+ }
+
+ void OConnectionTabPageSetup::dispose()
+ {
+ m_pHelpText.clear();
+ m_pHeaderText.clear();
+ OConnectionHelper::dispose();
}
void OConnectionTabPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
index 5705c1530cc2..1f0a22c69cf4 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
@@ -39,18 +39,20 @@ namespace dbaui
bool m_bUserGrabFocus : 1;
protected:
- FixedText *m_pHelpText;
- FixedText *m_pHeaderText;
+ VclPtr<FixedText> m_pHelpText;
+ VclPtr<FixedText> m_pHeaderText;
// called when the test connection button was clicked
DECL_LINK(OnEditModified,Edit*);
public:
- static OGenericAdministrationPage* CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
- static OGenericAdministrationPage* CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
- static OGenericAdministrationPage* CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
- static OGenericAdministrationPage* CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
- static OGenericAdministrationPage* CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ virtual ~OConnectionTabPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<OGenericAdministrationPage> CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
virtual bool FillItemSet (SfxItemSet* _rCoreAttrs) SAL_OVERRIDE;
@@ -71,7 +73,6 @@ namespace dbaui
OConnectionTabPageSetup(vcl::Window* pParent, const OString& _rId, const OUString& _rUIXMLDescription, const SfxItemSet& _rCoreAttrs, sal_uInt16 _nHelpTextResId, sal_uInt16 _nHeaderResId, sal_uInt16 _nUrlResId);
virtual bool checkTestConnection() SAL_OVERRIDE;
// nControlFlags is a combination of the CBTP_xxx-constants
- virtual ~OConnectionTabPageSetup();
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 523b1aa9278d..c457c962c8fa 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -60,9 +60,9 @@ namespace dbaui
{
using namespace ::com::sun::star;
- OGenericAdministrationPage* OTextConnectionPageSetup::CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OTextConnectionPageSetup::CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OTextConnectionPageSetup( pParent, _rAttrSet ) );
+ return VclPtr<OTextConnectionPageSetup>::Create( pParent, _rAttrSet );
}
// OTextConnectionPageSetup
@@ -70,14 +70,19 @@ using namespace ::com::sun::star;
:OConnectionTabPageSetup(pParent, "DBWizTextPage", "dbaccess/ui/dbwiztextpage.ui", _rCoreAttrs, STR_TEXT_HELPTEXT, STR_TEXT_HEADERTEXT, STR_TEXT_PATH_OR_FILE)
{
- m_pTextConnectionHelper = new OTextConnectionHelper( get<VclVBox>("TextPageContainer"), TC_EXTENSION | TC_SEPARATORS );
+ m_pTextConnectionHelper = VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("TextPageContainer"), TC_EXTENSION | TC_SEPARATORS );
m_pTextConnectionHelper->SetClickHandler(LINK( this, OTextConnectionPageSetup, ImplGetExtensionHdl ) );
}
OTextConnectionPageSetup::~OTextConnectionPageSetup()
{
- DELETEZ(m_pTextConnectionHelper);
+ disposeOnce();
+ }
+ void OTextConnectionPageSetup::dispose()
+ {
+ m_pTextConnectionHelper.disposeAndClear();
+ OConnectionTabPageSetup::dispose();
}
IMPL_LINK(OTextConnectionPageSetup, ImplGetExtensionHdl, OTextConnectionHelper*, /*_pTextConnectionHelper*/)
@@ -124,9 +129,9 @@ using namespace ::com::sun::star;
return m_pTextConnectionHelper->prepareLeave();
}
- OGenericAdministrationPage* OLDAPConnectionPageSetup::CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OLDAPConnectionPageSetup::CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OLDAPConnectionPageSetup( pParent, _rAttrSet ) );
+ return VclPtr<OLDAPConnectionPageSetup>::Create( pParent, _rAttrSet );
}
// OLDAPPageSetup
@@ -151,6 +156,25 @@ using namespace ::com::sun::star;
SetRoadmapStateValue(false);
}
+ OLDAPConnectionPageSetup::~OLDAPConnectionPageSetup()
+ {
+ disposeOnce();
+ }
+
+ void OLDAPConnectionPageSetup::dispose()
+ {
+ m_pFTHelpText.clear();
+ m_pFTHostServer.clear();
+ m_pETHostServer.clear();
+ m_pFTBaseDN.clear();
+ m_pETBaseDN.clear();
+ m_pFTPortNumber.clear();
+ m_pNFPortNumber.clear();
+ m_pFTDefaultPortNumber.clear();
+ m_pCBUseSSL.clear();
+ OGenericAdministrationPage::dispose();
+ }
+
bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
{
bool bChangedSomething = false;
@@ -217,9 +241,9 @@ using namespace ::com::sun::star;
return 0L;
}
- OMySQLIntroPageSetup* OMySQLIntroPageSetup::CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OMySQLIntroPageSetup( _pParent, _rAttrSet) );
+ return VclPtr<OMySQLIntroPageSetup>::Create( _pParent, _rAttrSet);
}
@@ -235,15 +259,23 @@ using namespace ::com::sun::star;
m_pNATIVEDatabase->SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
}
- IMPL_LINK(OMySQLIntroPageSetup, OnSetupModeSelected, RadioButton*, /*_pBox*/)
+ OMySQLIntroPageSetup::~OMySQLIntroPageSetup()
{
- maClickHdl.Call( this );
- return long(true);
+ disposeOnce();
}
- OMySQLIntroPageSetup::~OMySQLIntroPageSetup()
+ void OMySQLIntroPageSetup::dispose()
{
+ m_pODBCDatabase.clear();
+ m_pJDBCDatabase.clear();
+ m_pNATIVEDatabase.clear();
+ OGenericAdministrationPage::dispose();
+ }
+ IMPL_LINK(OMySQLIntroPageSetup, OnSetupModeSelected, RadioButton*, /*_pBox*/)
+ {
+ maClickHdl.Call( this );
+ return long(true);
}
void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, bool /*_bSaveValue*/)
@@ -292,38 +324,50 @@ using namespace ::com::sun::star;
// MySQLNativeSetupPage
MySQLNativeSetupPage::MySQLNativeSetupPage( vcl::Window* _pParent, const SfxItemSet& _rCoreAttrs )
:OGenericAdministrationPage( _pParent, "DBWizMysqlNativePage", "dbaccess/ui/dbwizmysqlnativepage.ui", _rCoreAttrs )
- ,m_aMySQLSettings ( *get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink() )
+ ,m_aMySQLSettings ( VclPtr<MySQLNativeSettings>::Create(*get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink()) )
{
get(m_pHelpText, "helptext");
- m_aMySQLSettings.Show();
+ m_aMySQLSettings->Show();
SetRoadmapStateValue(false);
}
- OGenericAdministrationPage* MySQLNativeSetupPage::Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ MySQLNativeSetupPage::~MySQLNativeSetupPage()
+ {
+ disposeOnce();
+ }
+
+ void MySQLNativeSetupPage::dispose()
{
- return new MySQLNativeSetupPage( pParent, _rAttrSet );
+ m_aMySQLSettings.disposeAndClear();
+ m_pHelpText.clear();
+ OGenericAdministrationPage::dispose();
+ }
+
+ VclPtr<OGenericAdministrationPage> MySQLNativeSetupPage::Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ {
+ return VclPtr<MySQLNativeSetupPage>::Create( pParent, _rAttrSet );
}
void MySQLNativeSetupPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
{
- m_aMySQLSettings.fillControls( _rControlList );
+ m_aMySQLSettings->fillControls( _rControlList );
}
void MySQLNativeSetupPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
{
_rControlList.push_back( new ODisableWrapper< FixedText >( m_pHelpText ) );
- m_aMySQLSettings.fillWindows( _rControlList );
+ m_aMySQLSettings->fillWindows( _rControlList );
}
bool MySQLNativeSetupPage::FillItemSet( SfxItemSet* _rSet )
{
- return m_aMySQLSettings.FillItemSet( _rSet );
+ return m_aMySQLSettings->FillItemSet( _rSet );
}
void MySQLNativeSetupPage::implInitControls( const SfxItemSet& _rSet, bool _bSaveValue )
{
- m_aMySQLSettings.implInitControls( _rSet );
+ m_aMySQLSettings->implInitControls( _rSet );
OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
@@ -337,7 +381,7 @@ using namespace ::com::sun::star;
IMPL_LINK( MySQLNativeSetupPage, OnModified, Edit*, _pEdit )
{
- SetRoadmapStateValue( m_aMySQLSettings.canAdvance() );
+ SetRoadmapStateValue( m_aMySQLSettings->canAdvance() );
return OGenericAdministrationPage::getControlModifiedLink().Call( _pEdit );
}
@@ -387,26 +431,48 @@ using namespace ::com::sun::star;
SetRoadmapStateValue(false);
}
- OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ OGeneralSpecialJDBCConnectionPageSetup::~OGeneralSpecialJDBCConnectionPageSetup()
+ {
+ disposeOnce();
+ }
+
+ void OGeneralSpecialJDBCConnectionPageSetup::dispose()
{
- return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
+ m_pHeaderText.clear();
+ m_pFTHelpText.clear();
+ m_pFTDatabasename.clear();
+ m_pETDatabasename.clear();
+ m_pFTHostname.clear();
+ m_pETHostname.clear();
+ m_pFTPortNumber.clear();
+ m_pFTDefaultPortNumber.clear();
+ m_pNFPortNumber.clear();
+ m_pFTDriverClass.clear();
+ m_pETDriverClass.clear();
+ m_pPBTestJavaDriver.clear();
+ OGenericAdministrationPage::dispose();
+ }
+
+ VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ {
+ return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent,
_rAttrSet,
DSID_MYSQL_PORTNUMBER ,
STR_MYSQL_DEFAULT,
STR_MYSQLJDBC_HELPTEXT,
STR_MYSQLJDBC_HEADERTEXT,
- STR_MYSQL_DRIVERCLASSTEXT) );
+ STR_MYSQL_DRIVERCLASSTEXT);
}
- OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
+ return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent,
_rAttrSet,
DSID_ORACLE_PORTNUMBER,
STR_ORACLE_DEFAULT,
STR_ORACLE_HELPTEXT,
STR_ORACLE_HEADERTEXT,
- STR_ORACLE_DRIVERCLASSTEXT) );
+ STR_ORACLE_DRIVERCLASSTEXT);
}
void OGeneralSpecialJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
@@ -497,8 +563,8 @@ using namespace ::com::sun::star;
#endif
const sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
const OSQLMessageBox::MessageType mt = bSuccess ? OSQLMessageBox::Info : OSQLMessageBox::Error;
- OSQLMessageBox aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
- aMsg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
+ aMsg->Execute();
return 0L;
}
@@ -512,9 +578,9 @@ using namespace ::com::sun::star;
return 0L;
}
- OGenericAdministrationPage* OJDBCConnectionPageSetup::CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OJDBCConnectionPageSetup::CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OJDBCConnectionPageSetup( pParent, _rAttrSet));
+ return VclPtr<OJDBCConnectionPageSetup>::Create( pParent, _rAttrSet);
}
// OMySQLJDBCConnectionPageSetup
@@ -529,6 +595,19 @@ using namespace ::com::sun::star;
m_pPBTestJavaDriver->SetClickHdl(LINK(this,OJDBCConnectionPageSetup,OnTestJavaClickHdl));
}
+ OJDBCConnectionPageSetup::~OJDBCConnectionPageSetup()
+ {
+ disposeOnce();
+ }
+
+ void OJDBCConnectionPageSetup::dispose()
+ {
+ m_pFTDriverClass.clear();
+ m_pETDriverClass.clear();
+ m_pPBTestJavaDriver.clear();
+ OConnectionTabPageSetup::dispose();
+ }
+
void OJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
_rControlList.push_back(new OSaveValueWrapper<Edit>(m_pETDriverClass));
@@ -606,8 +685,8 @@ using namespace ::com::sun::star;
}
#endif
sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
- OSQLMessageBox aMsg( this, OUString( ModuleRes( nMessage ) ), OUString() );
- aMsg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aMsg( this, OUString( ModuleRes( nMessage ) ), OUString() );
+ aMsg->Execute();
return 0L;
}
@@ -621,9 +700,9 @@ using namespace ::com::sun::star;
return 0L;
}
- OGenericAdministrationPage* OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OSpreadSheetConnectionPageSetup( pParent, _rAttrSet ) );
+ return VclPtr<OSpreadSheetConnectionPageSetup>::Create( pParent, _rAttrSet );
}
@@ -636,7 +715,13 @@ using namespace ::com::sun::star;
OSpreadSheetConnectionPageSetup::~OSpreadSheetConnectionPageSetup()
{
+ disposeOnce();
+ }
+ void OSpreadSheetConnectionPageSetup::dispose()
+ {
+ m_pPasswordrequired.clear();
+ OConnectionTabPageSetup::dispose();
}
void OSpreadSheetConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
@@ -662,9 +747,9 @@ using namespace ::com::sun::star;
return bChangedSomething;
}
- OGenericAdministrationPage* OAuthentificationPageSetup::CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OAuthentificationPageSetup::CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OAuthentificationPageSetup( pParent, _rAttrSet) );
+ return VclPtr<OAuthentificationPageSetup>::Create( pParent, _rAttrSet);
}
@@ -685,7 +770,17 @@ using namespace ::com::sun::star;
OAuthentificationPageSetup::~OAuthentificationPageSetup()
{
+ disposeOnce();
+ }
+ void OAuthentificationPageSetup::dispose()
+ {
+ m_pFTHelpText.clear();
+ m_pFTUserName.clear();
+ m_pETUserName.clear();
+ m_pCBPasswordRequired.clear();
+ m_pPBTestConnection.clear();
+ OGenericAdministrationPage::dispose();
}
void OAuthentificationPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
@@ -729,9 +824,9 @@ using namespace ::com::sun::star;
return bChangedSomething;
}
- OGenericAdministrationPage* OFinalDBPageSetup::CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet)
+ VclPtr<OGenericAdministrationPage> OFinalDBPageSetup::CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet)
{
- return ( new OFinalDBPageSetup( pParent, _rAttrSet) );
+ return VclPtr<OFinalDBPageSetup>::Create( pParent, _rAttrSet);
}
@@ -755,7 +850,20 @@ using namespace ::com::sun::star;
OFinalDBPageSetup::~OFinalDBPageSetup()
{
+ disposeOnce();
+ }
+ void OFinalDBPageSetup::dispose()
+ {
+ m_pFTFinalHeader.clear();
+ m_pFTFinalHelpText.clear();
+ m_pRBRegisterDataSource.clear();
+ m_pRBDontregisterDataSource.clear();
+ m_pFTAdditionalSettings.clear();
+ m_pCBOpenAfterwards.clear();
+ m_pCBStartTableWizard.clear();
+ m_pFTFinalText.clear();
+ OGenericAdministrationPage::dispose();
}
bool OFinalDBPageSetup::IsDatabaseDocumentToBeRegistered()
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 4756b6c75b57..109c3f3c93d3 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -40,12 +40,13 @@ namespace dbaui
{
public:
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
- static OGenericAdministrationPage* CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
OSpreadSheetConnectionPageSetup(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
+ virtual ~OSpreadSheetConnectionPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
protected:
- CheckBox *m_pPasswordrequired;
- virtual ~OSpreadSheetConnectionPageSetup();
+ VclPtr<CheckBox> m_pPasswordrequired;
protected:
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
@@ -58,14 +59,14 @@ namespace dbaui
class OTextConnectionPageSetup : public OConnectionTabPageSetup
{
public:
+ VclPtr<OTextConnectionHelper> m_pTextConnectionHelper;
+
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
- static OGenericAdministrationPage* CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
OTextConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
- OTextConnectionHelper* m_pTextConnectionHelper;
- private:
-
- protected:
virtual ~OTextConnectionPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
+ protected:
virtual bool prepareLeave() SAL_OVERRIDE;
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
@@ -81,8 +82,10 @@ namespace dbaui
{
public:
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
- static OGenericAdministrationPage* CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
OLDAPConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
+ virtual ~OLDAPConnectionPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
virtual Link getControlModifiedLink() SAL_OVERRIDE { return LINK(this, OLDAPConnectionPageSetup, OnEditModified); }
protected:
@@ -92,28 +95,30 @@ namespace dbaui
DECL_LINK(OnEditModified,Edit*);
private:
- FixedText* m_pFTHelpText;
- FixedText* m_pFTHostServer;
- Edit* m_pETHostServer;
- FixedText* m_pFTBaseDN;
- Edit* m_pETBaseDN;
- FixedText* m_pFTPortNumber;
- NumericField* m_pNFPortNumber;
- FixedText* m_pFTDefaultPortNumber;
- CheckBox* m_pCBUseSSL;
+ VclPtr<FixedText> m_pFTHelpText;
+ VclPtr<FixedText> m_pFTHostServer;
+ VclPtr<Edit> m_pETHostServer;
+ VclPtr<FixedText> m_pFTBaseDN;
+ VclPtr<Edit> m_pETBaseDN;
+ VclPtr<FixedText> m_pFTPortNumber;
+ VclPtr<NumericField> m_pNFPortNumber;
+ VclPtr<FixedText> m_pFTDefaultPortNumber;
+ VclPtr<CheckBox> m_pCBUseSSL;
};
// MySQLNativeSetupPage
class MySQLNativeSetupPage : public OGenericAdministrationPage
{
private:
- FixedText *m_pHelpText;
- MySQLNativeSettings m_aMySQLSettings;
+ VclPtr<FixedText> m_pHelpText;
+ VclPtr<MySQLNativeSettings> m_aMySQLSettings;
public:
MySQLNativeSetupPage( vcl::Window* _pParent, const SfxItemSet& _rCoreAttrs );
+ virtual ~MySQLNativeSetupPage();
+ virtual void dispose() SAL_OVERRIDE;
- static OGenericAdministrationPage* Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
protected:
virtual void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList ) SAL_OVERRIDE;
@@ -139,8 +144,10 @@ namespace dbaui
, sal_uInt16 _nHelpTextResId
, sal_uInt16 _nHeaderTextResId
, sal_uInt16 _nDriverClassId );
- static OGenericAdministrationPage* CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
- static OGenericAdministrationPage* CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ virtual ~OGeneralSpecialJDBCConnectionPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
protected:
virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
@@ -151,19 +158,19 @@ namespace dbaui
DECL_LINK(OnTestJavaClickHdl,PushButton*);
DECL_LINK(OnEditModified,Edit*);
- FixedText* m_pHeaderText;
- FixedText* m_pFTHelpText;
- FixedText* m_pFTDatabasename;
- Edit* m_pETDatabasename;
- FixedText* m_pFTHostname;
- Edit* m_pETHostname;
- FixedText* m_pFTPortNumber;
- FixedText* m_pFTDefaultPortNumber;
- NumericField* m_pNFPortNumber;
-
- FixedText* m_pFTDriverClass;
- Edit* m_pETDriverClass;
- PushButton* m_pPBTestJavaDriver;
+ VclPtr<FixedText> m_pHeaderText;
+ VclPtr<FixedText> m_pFTHelpText;
+ VclPtr<FixedText> m_pFTDatabasename;
+ VclPtr<Edit> m_pETDatabasename;
+ VclPtr<FixedText> m_pFTHostname;
+ VclPtr<Edit> m_pETHostname;
+ VclPtr<FixedText> m_pFTPortNumber;
+ VclPtr<FixedText> m_pFTDefaultPortNumber;
+ VclPtr<NumericField> m_pNFPortNumber;
+
+ VclPtr<FixedText> m_pFTDriverClass;
+ VclPtr<Edit> m_pETDriverClass;
+ VclPtr<PushButton> m_pPBTestJavaDriver;
OUString m_sDefaultJdbcDriverName;
sal_uInt16 m_nPortId;
@@ -174,7 +181,9 @@ namespace dbaui
{
public:
OJDBCConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
- static OGenericAdministrationPage* CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ virtual ~OJDBCConnectionPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<OGenericAdministrationPage> CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
protected:
virtual bool checkTestConnection() SAL_OVERRIDE;
@@ -186,9 +195,9 @@ namespace dbaui
DECL_LINK(OnTestJavaClickHdl,PushButton*);
DECL_LINK(OnEditModified,Edit*);
- FixedText* m_pFTDriverClass;
- Edit* m_pETDriverClass;
- PushButton* m_pPBTestJavaDriver;
+ VclPtr<FixedText> m_pFTDriverClass;
+ VclPtr<Edit> m_pETDriverClass;
+ VclPtr<PushButton> m_pPBTestJavaDriver;
};
// OJDBCConnectionPageSetup
@@ -203,8 +212,10 @@ namespace dbaui
};
OMySQLIntroPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
+ virtual ~OMySQLIntroPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
- static OMySQLIntroPageSetup* CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OMySQLIntroPageSetup> CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet );
ConnectionType getMySQLMode();
Link maClickHdl;
void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
@@ -216,12 +227,11 @@ namespace dbaui
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
- virtual ~OMySQLIntroPageSetup();
private:
- RadioButton *m_pODBCDatabase;
- RadioButton *m_pJDBCDatabase;
- RadioButton *m_pNATIVEDatabase;
+ VclPtr<RadioButton> m_pODBCDatabase;
+ VclPtr<RadioButton> m_pJDBCDatabase;
+ VclPtr<RadioButton> m_pNATIVEDatabase;
DECL_LINK(OnSetupModeSelected, RadioButton*);
@@ -232,16 +242,17 @@ namespace dbaui
{
public:
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
- static OGenericAdministrationPage* CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
OAuthentificationPageSetup(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
+ virtual ~OAuthentificationPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
protected:
- FixedText* m_pFTHelpText;
- FixedText* m_pFTUserName;
- Edit* m_pETUserName;
- CheckBox* m_pCBPasswordRequired;
- PushButton* m_pPBTestConnection;
- virtual ~OAuthentificationPageSetup();
+ VclPtr<FixedText> m_pFTHelpText;
+ VclPtr<FixedText> m_pFTUserName;
+ VclPtr<Edit> m_pETUserName;
+ VclPtr<CheckBox> m_pCBPasswordRequired;
+ VclPtr<PushButton> m_pPBTestConnection;
protected:
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
@@ -254,18 +265,20 @@ namespace dbaui
{
public:
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
- static OGenericAdministrationPage* CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet);
+ static VclPtr<OGenericAdministrationPage> CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet);
- FixedText* m_pFTFinalHeader;
- FixedText* m_pFTFinalHelpText;
- RadioButton* m_pRBRegisterDataSource;
- RadioButton* m_pRBDontregisterDataSource;
- FixedText* m_pFTAdditionalSettings;
- CheckBox* m_pCBOpenAfterwards;
- CheckBox* m_pCBStartTableWizard;
- FixedText* m_pFTFinalText;
+ VclPtr<FixedText> m_pFTFinalHeader;
+ VclPtr<FixedText> m_pFTFinalHelpText;
+ VclPtr<RadioButton> m_pRBRegisterDataSource;
+ VclPtr<RadioButton> m_pRBDontregisterDataSource;
+ VclPtr<FixedText> m_pFTAdditionalSettings;
+ VclPtr<CheckBox> m_pCBOpenAfterwards;
+ VclPtr<CheckBox> m_pCBStartTableWizard;
+ VclPtr<FixedText> m_pFTFinalText;
OFinalDBPageSetup(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
+ virtual ~OFinalDBPageSetup();
+ virtual void dispose() SAL_OVERRIDE;
bool IsDatabaseDocumentToBeRegistered();
bool IsDatabaseDocumentToBeOpened();
bool IsTableWizardToBeStarted();
@@ -276,9 +289,6 @@ namespace dbaui
DECL_LINK(OnOpenSelected, CheckBox*);
protected:
- virtual ~OFinalDBPageSetup();
-
- protected:
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
index 4b46778afb92..890a7acc33cd 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
@@ -35,6 +35,7 @@
#include <svl/itemset.hxx>
#include <com/sun/star/frame/XModel.hpp>
#include <svl/poolitem.hxx>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
namespace dbaui
@@ -68,7 +69,7 @@ namespace dbaui
MapInt2String m_aDirectPropTranslator; /// translating property id's into names (direct properties of a data source)
MapInt2String m_aIndirectPropTranslator; /// translating property id's into names (indirect properties of a data source)
- vcl::Window* m_pParent;
+ VclPtr<vcl::Window> m_pParent;
IItemSetHelper* m_pItemSetHelper;
public:
diff --git a/dbaccess/source/ui/dlg/DriverSettings.hxx b/dbaccess/source/ui/dlg/DriverSettings.hxx
index 6a6ed636f295..071c346df3ba 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.hxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.hxx
@@ -21,6 +21,7 @@
#include "dsntypes.hxx"
#include <svl/poolitem.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
class SfxTabPage;
@@ -44,53 +45,53 @@ namespace dbaui
/** Creates the detail page for Dbase
*/
- static SfxTabPage* CreateDbase2( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateDbase2( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for ado
*/
- static SfxTabPage* CreateDbase( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateDbase( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for ado
*/
- static SfxTabPage* CreateAdo( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateAdo( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for ODBC
*/
- static SfxTabPage* CreateODBC( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateODBC( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for user
*/
- static SfxTabPage* CreateUser( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateUser( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for MySQLODBC
*/
- static SfxTabPage* CreateMySQLODBC( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateMySQLODBC( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for MySQLJDBC
*/
- static SfxTabPage* CreateMySQLJDBC( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateMySQLJDBC( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for MySQLNATIVE
*/
- static SfxTabPage* CreateMySQLNATIVE( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateMySQLNATIVE( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for Oracle JDBC
*/
- static SfxTabPage* CreateOracleJDBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateOracleJDBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet );
/** Creates the detail page for LDAP
*/
- static SfxTabPage* CreateLDAP( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateLDAP( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/// Creates the detail page for Text
- static SfxTabPage* CreateText( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateText( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/// creates the GeneratedValues page
- static SfxTabPage* CreateGeneratedValuesPage( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateGeneratedValuesPage( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
/// creates the "Special Settings" page of the "Advanced Settings" dialog
- static SfxTabPage* CreateSpecialSettingsPage( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> CreateSpecialSettingsPage( vcl::Window* _pParent, const SfxItemSet* _rAttrSet );
};
}
diff --git a/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx b/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx
index 2c8b9b68ab48..7182276a6224 100644
--- a/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx
+++ b/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx
@@ -30,6 +30,15 @@ QueryPropertiesDialog::QueryPropertiesDialog(
QueryPropertiesDialog::~QueryPropertiesDialog()
{
+ disposeOnce();
+}
+
+void QueryPropertiesDialog::dispose()
+{
+ m_pRB_Distinct.clear();
+ m_pRB_NonDistinct.clear();
+ m_pLB_Limit.clear();
+ ModalDialog::dispose();
}
} ///dbaui namespace
diff --git a/dbaccess/source/ui/dlg/RelationDlg.cxx b/dbaccess/source/ui/dlg/RelationDlg.cxx
index 28d33723dae6..50913994c298 100644
--- a/dbaccess/source/ui/dlg/RelationDlg.cxx
+++ b/dbaccess/source/ui/dlg/RelationDlg.cxx
@@ -88,6 +88,26 @@ ORelationDialog::ORelationDialog( OJoinTableView* pParent,
m_xTableControl->NotifyCellChange();
}
+ORelationDialog::~ORelationDialog()
+{
+ disposeOnce();
+}
+
+void ORelationDialog::dispose()
+{
+ m_pRB_NoCascUpd.clear();
+ m_pRB_CascUpd.clear();
+ m_pRB_CascUpdNull.clear();
+ m_pRB_CascUpdDefault.clear();
+ m_pRB_NoCascDel.clear();
+ m_pRB_CascDel.clear();
+ m_pRB_CascDelNull.clear();
+ m_pRB_CascDelDefault.clear();
+ m_pPB_OK.clear();
+ ModalDialog::dispose();
+}
+
+
void ORelationDialog::Init(const TTableConnectionData::value_type& _pConnectionData)
{
ORelationTableConnectionData* pConnData = static_cast<ORelationTableConnectionData*>(_pConnectionData.get());
@@ -132,10 +152,6 @@ void ORelationDialog::Init(const TTableConnectionData::value_type& _pConnectionD
}
}
-ORelationDialog::~ORelationDialog()
-{
-}
-
IMPL_LINK( ORelationDialog, OKClickHdl, Button*, /*pButton*/ )
{
// RadioButtons auslesen
diff --git a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
index a4a51e3d2623..8a29c4873208 100644
--- a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
+++ b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
@@ -54,14 +54,20 @@ OTableSubscriptionDialog::OTableSubscriptionDialog(vcl::Window* pParent
m_pImpl->translateProperties(xDatasource, *m_pOutSet);
SetInputSet(m_pOutSet);
- OTableSubscriptionPage* pTabPage = new OTableSubscriptionPage(get_content_area(), *m_pOutSet, this);
+ VclPtrInstance<OTableSubscriptionPage> pTabPage(get_content_area(), *m_pOutSet, this);
pTabPage->SetServiceFactory(_rxORB);
SetTabPage(pTabPage);
}
OTableSubscriptionDialog::~OTableSubscriptionDialog()
{
+ disposeOnce();
+}
+
+void OTableSubscriptionDialog::dispose()
+{
delete m_pOutSet;
+ SfxSingleTabDialog::dispose();
}
short OTableSubscriptionDialog::Execute()
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
index c99292a925ef..5c8b4b3551aa 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
@@ -114,7 +114,7 @@ namespace dbaui
struct SectionDescriptor
{
short nFlag;
- vcl::Window* pFirstControl;
+ VclPtr<vcl::Window> pFirstControl;
} aSections[] = {
{ TC_EXTENSION, m_pExtensionHeader },
{ TC_SEPARATORS, m_pFormatHeader },
@@ -153,7 +153,31 @@ namespace dbaui
OTextConnectionHelper::~OTextConnectionHelper()
{
+ disposeOnce();
+ }
+ void OTextConnectionHelper::dispose()
+ {
+ m_pExtensionHeader.clear();
+ m_pAccessTextFiles.clear();
+ m_pAccessCSVFiles.clear();
+ m_pAccessOtherFiles.clear();
+ m_pOwnExtension.clear();
+ m_pExtensionExample.clear();
+ m_pFormatHeader.clear();
+ m_pFieldSeparatorLabel.clear();
+ m_pFieldSeparator.clear();
+ m_pTextSeparatorLabel.clear();
+ m_pTextSeparator.clear();
+ m_pDecimalSeparatorLabel.clear();
+ m_pDecimalSeparator.clear();
+ m_pThousandsSeparatorLabel.clear();
+ m_pThousandsSeparator.clear();
+ m_pRowHeader.clear();
+ m_pCharSetHeader.clear();
+ m_pCharSetLabel.clear();
+ m_pCharSet.clear();
+ TabPage::dispose();
}
IMPL_LINK(OTextConnectionHelper, OnControlModified, Control*, /*EMPTYARG*/)
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
index b9317f8b46b6..56610e6e615b 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
@@ -49,27 +49,28 @@ namespace dbaui
public:
OTextConnectionHelper( vcl::Window* pParent, const short _nAvailableSections );
virtual ~OTextConnectionHelper();
+ virtual void dispose() SAL_OVERRIDE;
private:
- FixedText *m_pExtensionHeader;
- RadioButton *m_pAccessTextFiles;
- RadioButton *m_pAccessCSVFiles;
- RadioButton *m_pAccessOtherFiles;
- Edit *m_pOwnExtension;
- FixedText *m_pExtensionExample;
- FixedText *m_pFormatHeader;
- FixedText *m_pFieldSeparatorLabel;
- ComboBox *m_pFieldSeparator;
- FixedText *m_pTextSeparatorLabel;
- ComboBox *m_pTextSeparator;
- FixedText *m_pDecimalSeparatorLabel;
- ComboBox *m_pDecimalSeparator;
- FixedText *m_pThousandsSeparatorLabel;
- ComboBox *m_pThousandsSeparator;
- CheckBox *m_pRowHeader;
- FixedText *m_pCharSetHeader;
- FixedText *m_pCharSetLabel;
- CharSetListBox *m_pCharSet;
+ VclPtr<FixedText> m_pExtensionHeader;
+ VclPtr<RadioButton> m_pAccessTextFiles;
+ VclPtr<RadioButton> m_pAccessCSVFiles;
+ VclPtr<RadioButton> m_pAccessOtherFiles;
+ VclPtr<Edit> m_pOwnExtension;
+ VclPtr<FixedText> m_pExtensionExample;
+ VclPtr<FixedText> m_pFormatHeader;
+ VclPtr<FixedText> m_pFieldSeparatorLabel;
+ VclPtr<ComboBox> m_pFieldSeparator;
+ VclPtr<FixedText> m_pTextSeparatorLabel;
+ VclPtr<ComboBox> m_pTextSeparator;
+ VclPtr<FixedText> m_pDecimalSeparatorLabel;
+ VclPtr<ComboBox> m_pDecimalSeparator;
+ VclPtr<FixedText> m_pThousandsSeparatorLabel;
+ VclPtr<ComboBox> m_pThousandsSeparator;
+ VclPtr<CheckBox> m_pRowHeader;
+ VclPtr<FixedText> m_pCharSetHeader;
+ VclPtr<FixedText> m_pCharSetLabel;
+ VclPtr<CharSetListBox> m_pCharSet;
OUString m_aFieldSeparatorList;
OUString m_aTextSeparatorList;
OUString m_aTextNone;
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index 66556c6b8630..ee25dd304bb1 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -51,17 +51,27 @@ using namespace comphelper;
class OPasswordDialog : public ModalDialog
{
- VclFrame* m_pUser;
- Edit* m_pEDOldPassword;
- Edit* m_pEDPassword;
- Edit* m_pEDPasswordRepeat;
- OKButton* m_pOKBtn;
+ VclPtr<VclFrame> m_pUser;
+ VclPtr<Edit> m_pEDOldPassword;
+ VclPtr<Edit> m_pEDPassword;
+ VclPtr<Edit> m_pEDPasswordRepeat;
+ VclPtr<OKButton> m_pOKBtn;
DECL_LINK( OKHdl_Impl, void * );
DECL_LINK( ModifiedHdl, Edit * );
public:
OPasswordDialog( vcl::Window* pParent,const OUString& _sUserName);
+ virtual ~OPasswordDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ m_pUser.clear();
+ m_pEDOldPassword.clear();
+ m_pEDPassword.clear();
+ m_pEDPasswordRepeat.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+ }
OUString GetOldPassword() const { return m_pEDOldPassword->GetText(); }
OUString GetNewPassword() const { return m_pEDPassword->GetText(); }
@@ -92,8 +102,8 @@ IMPL_LINK_NOARG(OPasswordDialog, OKHdl_Impl)
else
{
OUString aErrorMsg( ModuleRes( STR_ERROR_PASSWORDS_NOT_IDENTICAL));
- MessageDialog aErrorBox(this, aErrorMsg);
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(this, aErrorMsg);
+ aErrorBox->Execute();
m_pEDPassword->SetText( OUString() );
m_pEDPasswordRepeat->SetText( OUString() );
m_pEDPassword->GrabFocus();
@@ -114,9 +124,9 @@ OUserAdmin::OUserAdmin(vcl::Window* pParent,const SfxItemSet& _rAttrSet)
, m_pNEWUSER(0)
, m_pCHANGEPWD(0)
, m_pDELETEUSER(0)
- ,m_TableCtrl(get<VclAlignment>("table"), WB_TABSTOP)
+ ,m_TableCtrl(VclPtr<OTableGrantControl>::Create(get<VclAlignment>("table"), WB_TABSTOP))
{
- m_TableCtrl.Show();
+ m_TableCtrl->Show();
get(m_pUSER, "user");
get(m_pNEWUSER, "add");
get(m_pCHANGEPWD, "changepass");
@@ -131,7 +141,18 @@ OUserAdmin::OUserAdmin(vcl::Window* pParent,const SfxItemSet& _rAttrSet)
OUserAdmin::~OUserAdmin()
{
+ disposeOnce();
+}
+
+void OUserAdmin::dispose()
+{
m_xConnection = NULL;
+ m_TableCtrl.disposeAndClear();
+ m_pUSER.clear();
+ m_pNEWUSER.clear();
+ m_pCHANGEPWD.clear();
+ m_pDELETEUSER.clear();
+ OGenericAdministrationPage::dispose();
}
void OUserAdmin::FillUserNames()
@@ -162,11 +183,11 @@ void OUserAdmin::FillUserNames()
{
Reference<XAuthorizable> xAuth;
m_xUsers->getByName(m_UserName) >>= xAuth;
- m_TableCtrl.setGrantUser(xAuth);
+ m_TableCtrl->setGrantUser(xAuth);
}
- m_TableCtrl.setUserName(GetUser());
- m_TableCtrl.Init();
+ m_TableCtrl->setUserName(GetUser());
+ m_TableCtrl->Init();
}
}
}
@@ -177,13 +198,13 @@ void OUserAdmin::FillUserNames()
m_pDELETEUSER->Enable(xDrop.is());
m_pCHANGEPWD->Enable(m_xUsers.is());
- m_TableCtrl.Enable(m_xUsers.is());
+ m_TableCtrl->Enable(m_xUsers.is());
}
-SfxTabPage* OUserAdmin::Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+VclPtr<SfxTabPage> OUserAdmin::Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new OUserAdmin( pParent, *_rAttrSet ) );
+ return VclPtr<SfxTabPage>(new OUserAdmin( pParent, *_rAttrSet ), SAL_NO_ACQUIRE);
}
IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
@@ -192,16 +213,16 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
{
if(pButton == m_pNEWUSER)
{
- SfxPasswordDialog aPwdDlg(this);
- aPwdDlg.ShowExtras(SfxShowExtras::ALL);
- if(aPwdDlg.Execute())
+ ScopedVclPtrInstance< SfxPasswordDialog > aPwdDlg(this);
+ aPwdDlg->ShowExtras(SfxShowExtras::ALL);
+ if(aPwdDlg->Execute())
{
Reference<XDataDescriptorFactory> xUserFactory(m_xUsers,UNO_QUERY);
Reference<XPropertySet> xNewUser = xUserFactory->createDataDescriptor();
if(xNewUser.is())
{
- xNewUser->setPropertyValue(PROPERTY_NAME,makeAny(OUString(aPwdDlg.GetUser())));
- xNewUser->setPropertyValue(PROPERTY_PASSWORD,makeAny(OUString(aPwdDlg.GetPassword())));
+ xNewUser->setPropertyValue(PROPERTY_NAME,makeAny(OUString(aPwdDlg->GetUser())));
+ xNewUser->setPropertyValue(PROPERTY_PASSWORD,makeAny(OUString(aPwdDlg->GetPassword())));
Reference<XAppend> xAppend(m_xUsers,UNO_QUERY);
if(xAppend.is())
xAppend->appendByDescriptor(xNewUser);
@@ -219,11 +240,11 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
if(xUser.is())
{
OUString sNewPassword,sOldPassword;
- OPasswordDialog aDlg(this,sName);
- if(aDlg.Execute() == RET_OK)
+ ScopedVclPtrInstance< OPasswordDialog > aDlg(this,sName);
+ if(aDlg->Execute() == RET_OK)
{
- sNewPassword = aDlg.GetNewPassword();
- sOldPassword = aDlg.GetOldPassword();
+ sNewPassword = aDlg->GetNewPassword();
+ sOldPassword = aDlg->GetOldPassword();
if(!sNewPassword.isEmpty())
xUser->changePassword(sOldPassword,sNewPassword);
@@ -238,8 +259,8 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
Reference<XDrop> xDrop(m_xUsers,UNO_QUERY);
if(xDrop.is())
{
- MessageDialog aQry(this, ModuleRes(STR_QUERY_USERADMIN_DELETE_USER), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if(aQry.Execute() == RET_YES)
+ ScopedVclPtrInstance< MessageDialog > aQry(this, ModuleRes(STR_QUERY_USERADMIN_DELETE_USER), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if(aQry->Execute() == RET_YES)
xDrop->dropByName(GetUser());
}
}
@@ -261,10 +282,10 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
IMPL_LINK( OUserAdmin, ListDblClickHdl, ListBox *, /*pListBox*/ )
{
- m_TableCtrl.setUserName(GetUser());
- m_TableCtrl.UpdateTables();
- m_TableCtrl.DeactivateCell();
- m_TableCtrl.ActivateCell(m_TableCtrl.GetCurRow(),m_TableCtrl.GetCurColumnId());
+ m_TableCtrl->setUserName(GetUser());
+ m_TableCtrl->UpdateTables();
+ m_TableCtrl->DeactivateCell();
+ m_TableCtrl->ActivateCell(m_TableCtrl->GetCurRow(),m_TableCtrl->GetCurColumnId());
return 0;
}
@@ -283,7 +304,7 @@ void OUserAdmin::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlLis
void OUserAdmin::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
{
- m_TableCtrl.setComponentContext(m_xORB);
+ m_TableCtrl->setComponentContext(m_xORB);
try
{
if ( !m_xConnection.is() && m_pAdminDialog )
@@ -302,7 +323,7 @@ void OUserAdmin::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
}
if ( xUsersSup.is() )
{
- m_TableCtrl.setTablesSupplier(xTablesSup);
+ m_TableCtrl->setTablesSupplier(xTablesSup);
m_xUsers = xUsersSup->getUsers();
}
}
diff --git a/dbaccess/source/ui/dlg/UserAdmin.hxx b/dbaccess/source/ui/dlg/UserAdmin.hxx
index 6f0720d7a43b..eeea260a60ee 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.hxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.hxx
@@ -41,11 +41,11 @@ namespace dbaui
class OUserAdmin : public OGenericAdministrationPage
{
protected:
- ListBox *m_pUSER;
- PushButton *m_pNEWUSER;
- PushButton *m_pCHANGEPWD;
- PushButton *m_pDELETEUSER;
- OTableGrantControl m_TableCtrl; // show the grant rights of one user
+ VclPtr<ListBox> m_pUSER;
+ VclPtr<PushButton> m_pNEWUSER;
+ VclPtr<PushButton> m_pCHANGEPWD;
+ VclPtr<PushButton> m_pDELETEUSER;
+ VclPtr<OTableGrantControl> m_TableCtrl; // show the grant rights of one user
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUsers;
@@ -62,9 +62,10 @@ protected:
OUserAdmin( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet );
virtual ~OUserAdmin();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetUser();
// subclasses must override this, but it isn't pure virtual
diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
index 2b17eccec0f9..57f8c8ec2673 100644
--- a/dbaccess/source/ui/dlg/UserAdminDlg.cxx
+++ b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
@@ -73,6 +73,11 @@ namespace dbaui
OUserAdminDlg::~OUserAdminDlg()
{
+ disposeOnce();
+ }
+
+ void OUserAdminDlg::dispose()
+ {
if ( m_bOwnConnection )
{
try
@@ -86,8 +91,9 @@ namespace dbaui
SetInputSet(NULL);
DELETEZ(pExampleSet);
-
+ SfxTabDialog::dispose();
}
+
short OUserAdminDlg::Execute()
{
try
diff --git a/dbaccess/source/ui/dlg/admincontrols.cxx b/dbaccess/source/ui/dlg/admincontrols.cxx
index ddff2e67b7cf..a4ff866067d7 100644
--- a/dbaccess/source/ui/dlg/admincontrols.cxx
+++ b/dbaccess/source/ui/dlg/admincontrols.cxx
@@ -170,6 +170,24 @@ namespace dbaui
MySQLNativeSettings::~MySQLNativeSettings()
{
+ disposeOnce();
+ }
+
+ void MySQLNativeSettings::dispose()
+ {
+ m_pDatabaseNameLabel.clear();
+ m_pDatabaseName.clear();
+ m_pHostPortRadio.clear();
+ m_pSocketRadio.clear();
+ m_pNamedPipeRadio.clear();
+ m_pHostNameLabel.clear();
+ m_pHostName.clear();
+ m_pPortLabel.clear();
+ m_pPort.clear();
+ m_pDefaultPort.clear();
+ m_pSocket.clear();
+ m_pNamedPipe.clear();
+ TabPage::dispose();
}
void MySQLNativeSettings::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
diff --git a/dbaccess/source/ui/dlg/admincontrols.hxx b/dbaccess/source/ui/dlg/admincontrols.hxx
index e6e214dca1b9..544ef8b89a24 100644
--- a/dbaccess/source/ui/dlg/admincontrols.hxx
+++ b/dbaccess/source/ui/dlg/admincontrols.hxx
@@ -35,18 +35,18 @@ namespace dbaui
class MySQLNativeSettings : public TabPage
{
private:
- FixedText *m_pDatabaseNameLabel;
- Edit *m_pDatabaseName;
- RadioButton *m_pHostPortRadio;
- RadioButton *m_pSocketRadio;
- RadioButton *m_pNamedPipeRadio;
- FixedText *m_pHostNameLabel;
- Edit *m_pHostName;
- FixedText *m_pPortLabel;
- NumericField *m_pPort;
- FixedText *m_pDefaultPort;
- Edit *m_pSocket;
- Edit *m_pNamedPipe;
+ VclPtr<FixedText> m_pDatabaseNameLabel;
+ VclPtr<Edit> m_pDatabaseName;
+ VclPtr<RadioButton> m_pHostPortRadio;
+ VclPtr<RadioButton> m_pSocketRadio;
+ VclPtr<RadioButton> m_pNamedPipeRadio;
+ VclPtr<FixedText> m_pHostNameLabel;
+ VclPtr<Edit> m_pHostName;
+ VclPtr<FixedText> m_pPortLabel;
+ VclPtr<NumericField> m_pPort;
+ VclPtr<FixedText> m_pDefaultPort;
+ VclPtr<Edit> m_pSocket;
+ VclPtr<Edit> m_pNamedPipe;
::svt::ControlDependencyManager
m_aControlDependencies;
@@ -54,7 +54,7 @@ namespace dbaui
public:
MySQLNativeSettings( vcl::Window& _rParent, const Link& _rControlModificationLink );
virtual ~MySQLNativeSettings();
-
+ virtual void dispose() SAL_OVERRIDE;
void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList );
void fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList );
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index ffb2c8d02df4..5848b5b2036c 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -117,19 +117,19 @@ namespace dbaui
// show an error message
OUString sError( ModuleRes( STR_COULD_NOT_LOAD_ODBC_LIB ) );
sError = sError.replaceFirst("#lib#", aEnumeration.getLibraryName());
- MessageDialog aDialog(this, sError);
- aDialog.Execute();
+ ScopedVclPtrInstance< MessageDialog > aDialog(this, sError);
+ aDialog->Execute();
return false;
}
else
{
aEnumeration.getDatasourceNames(aOdbcDatasources);
// execute the select dialog
- ODatasourceSelectDialog aSelector(GetParent(), aOdbcDatasources);
+ ScopedVclPtrInstance< ODatasourceSelectDialog > aSelector(GetParent(), aOdbcDatasources);
if (!_sCurr.isEmpty())
- aSelector.Select(_sCurr);
- if ( RET_OK == aSelector.Execute() )
- _sReturn = aSelector.GetSelected();
+ aSelector->Select(_sCurr);
+ if ( RET_OK == aSelector->Execute() )
+ _sReturn = aSelector->GetSelected();
}
return true;
}
@@ -242,8 +242,8 @@ namespace dbaui
eImage = OSQLMessageBox::Error;
aMessage = ModuleRes(STR_CONNECTION_NO_SUCCESS);
}
- OSQLMessageBox aMsg( this, sTitle, aMessage, WB_OK, eImage );
- aMsg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aMsg( this, sTitle, aMessage, WB_OK, eImage );
+ aMsg->Execute();
}
if ( !bSuccess )
m_pAdminDialog->clearPassword();
diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx
index b866cd721f38..3572cd860055 100644
--- a/dbaccess/source/ui/dlg/adminpages.hxx
+++ b/dbaccess/source/ui/dlg/adminpages.hxx
@@ -231,7 +231,7 @@ namespace dbaui
is modified. The implementation just calls callModifiedHdl.
*/
DECL_LINK(OnControlModified, void*);
- DECL_LINK(OnTestConnectionClickHdl,PushButton*);
+ DECL_LINK(OnTestConnectionClickHdl, PushButton*);
/// may be used in SetXXXHdl calls to controls, is a link to <method>OnControlModified</method>
virtual Link getControlModifiedLink() { return LINK(this, OGenericAdministrationPage, OnControlModified); }
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx
index 5e4cb63aa6f0..1b42d45ffcd1 100644
--- a/dbaccess/source/ui/dlg/adtabdlg.cxx
+++ b/dbaccess/source/ui/dlg/adtabdlg.cxx
@@ -362,7 +362,19 @@ OAddTableDlg::OAddTableDlg( vcl::Window* pParent, IAddTableDialogContext& _rCont
OAddTableDlg::~OAddTableDlg()
{
+ disposeOnce();
+}
+
+void OAddTableDlg::dispose()
+{
m_rContext.onWindowClosing( this );
+ m_pCaseTables.clear();
+ m_pCaseQueries.clear();
+ m_pTableList.clear();
+ m_pQueryList.clear();
+ m_pAddButton.clear();
+ m_pCloseButton.clear();
+ ModelessDialog::dispose();
}
void OAddTableDlg::impl_switchTo( ObjectList _eList )
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 65288cd41c81..2fe318634f13 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -48,7 +48,7 @@ namespace dbaui
// SpecialSettingsPage
struct BooleanSettingDesc
{
- CheckBox** ppControl; // the dialog's control which displays this setting
+ VclPtr<CheckBox>* ppControl; // the dialog's control which displays this setting
OString sControlId; // the widget name of the control in the .ui
sal_uInt16 nItemId; // the ID of the item (in an SfxItemSet) which corresponds to this setting
bool bInvertedDisplay; // true if and only if the checkbox is checked when the item is sal_False, and vice versa
@@ -95,7 +95,7 @@ namespace dbaui
sal_uInt16 nItemId = setting->nItemId;
if ( rFeatures.has( nItemId ) )
{
- get((*setting->ppControl), setting->sControlId);
+ get(*setting->ppControl, setting->sControlId);
(*setting->ppControl)->SetClickHdl( getControlModifiedLink() );
(*setting->ppControl)->Show();
@@ -134,7 +134,33 @@ namespace dbaui
SpecialSettingsPage::~SpecialSettingsPage()
{
+ disposeOnce();
+ }
+
+ void SpecialSettingsPage::dispose()
+ {
m_aControlDependencies.clear();
+ m_pIsSQL92Check.clear();
+ m_pAppendTableAlias.clear();
+ m_pAsBeforeCorrelationName.clear();
+ m_pEnableOuterJoin.clear();
+ m_pIgnoreDriverPrivileges.clear();
+ m_pParameterSubstitution.clear();
+ m_pSuppressVersionColumn.clear();
+ m_pCatalog.clear();
+ m_pSchema.clear();
+ m_pIndexAppendix.clear();
+ m_pDosLineEnds.clear();
+ m_pCheckRequiredFields.clear();
+ m_pIgnoreCurrency.clear();
+ m_pEscapeDateTime.clear();
+ m_pPrimaryKeySupport.clear();
+ m_pRespectDriverResultSetType.clear();
+ m_pBooleanComparisonModeLabel.clear();
+ m_pBooleanComparisonMode.clear();
+ m_pMaxRowScanLabel.clear();
+ m_pMaxRowScan.clear();
+ OGenericAdministrationPage::dispose();
}
void SpecialSettingsPage::impl_initBooleanSettings()
@@ -149,22 +175,21 @@ namespace dbaui
{ &m_pEnableOuterJoin, "useoj", DSID_ENABLEOUTERJOIN, false },
{ &m_pIgnoreDriverPrivileges, "ignoreprivs", DSID_IGNOREDRIVER_PRIV, false },
{ &m_pParameterSubstitution, "replaceparams", DSID_PARAMETERNAMESUBST, false },
- { &m_pSuppressVersionColumn, "displayver", DSID_SUPPRESSVERSIONCL, true },
+ { &m_pSuppressVersionColumn, "displayver", DSID_SUPPRESSVERSIONCL, true },
{ &m_pCatalog, "usecatalogname", DSID_CATALOG, false },
{ &m_pSchema, "useschemaname", DSID_SCHEMA, false },
{ &m_pIndexAppendix, "createindex", DSID_INDEXAPPENDIX, false },
{ &m_pDosLineEnds, "eol", DSID_DOSLINEENDS, false },
- { &m_pCheckRequiredFields, "inputchecks", DSID_CHECK_REQUIRED_FIELDS, false },
- { &m_pIgnoreCurrency, "ignorecurrency", DSID_IGNORECURRENCY, false },
+ { &m_pCheckRequiredFields, "ignorecurrency", DSID_CHECK_REQUIRED_FIELDS, false },
+ { &m_pIgnoreCurrency, "inputchecks", DSID_IGNORECURRENCY, false },
{ &m_pEscapeDateTime, "useodbcliterals", DSID_ESCAPE_DATETIME, false },
{ &m_pPrimaryKeySupport, "primarykeys", DSID_PRIMARY_KEY_SUPPORT, false },
- { &m_pRespectDriverResultSetType, "resulttype", DSID_RESPECTRESULTSETTYPE, false },
- { NULL, "", 0, false }
+ { &m_pRespectDriverResultSetType, "resulttype", DSID_RESPECTRESULTSETTYPE, false }
};
- for ( const BooleanSettingDesc* pCopy = aSettings; pCopy->nItemId != 0; ++pCopy )
+ for ( const BooleanSettingDesc& pCopy : aSettings )
{
- m_aBooleanSettings.push_back( *pCopy );
+ m_aBooleanSettings.push_back( pCopy );
}
}
@@ -187,7 +212,7 @@ namespace dbaui
++setting
)
{
- if ( *setting->ppControl )
+ if ( (*setting->ppControl) )
{
_rControlList.push_back( new OSaveValueWrapper< CheckBox >( *setting->ppControl ) );
}
@@ -217,7 +242,7 @@ namespace dbaui
++setting
)
{
- if ( !*setting->ppControl )
+ if ( !(*setting->ppControl) )
continue;
::boost::optional< bool > aValue(false);
@@ -317,7 +342,19 @@ namespace dbaui
GeneratedValuesPage::~GeneratedValuesPage()
{
+ disposeOnce();
+ }
+
+ void GeneratedValuesPage::dispose()
+ {
m_aControlDependencies.clear();
+ m_pAutoFrame.clear();
+ m_pAutoRetrievingEnabled.clear();
+ m_pAutoIncrementLabel.clear();
+ m_pAutoIncrement.clear();
+ m_pAutoRetrievingLabel.clear();
+ m_pAutoRetrieving.clear();
+ OGenericAdministrationPage::dispose();
}
void GeneratedValuesPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
@@ -406,8 +443,14 @@ namespace dbaui
AdvancedSettingsDialog::~AdvancedSettingsDialog()
{
+ disposeOnce();
+ }
+
+ void AdvancedSettingsDialog::dispose()
+ {
SetInputSet(NULL);
DELETEZ(pExampleSet);
+ SfxTabDialog::dispose();
}
bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const OUString& _sURL )
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx
index 005f0cb909c5..7c08e920a687 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.hxx
@@ -40,28 +40,28 @@ namespace dbaui
class SpecialSettingsPage : public OGenericAdministrationPage
{
protected:
- CheckBox* m_pIsSQL92Check;
- CheckBox* m_pAppendTableAlias;
- CheckBox* m_pAsBeforeCorrelationName;
- CheckBox* m_pEnableOuterJoin;
- CheckBox* m_pIgnoreDriverPrivileges;
- CheckBox* m_pParameterSubstitution;
- CheckBox* m_pSuppressVersionColumn;
- CheckBox* m_pCatalog;
- CheckBox* m_pSchema;
- CheckBox* m_pIndexAppendix;
- CheckBox* m_pDosLineEnds;
- CheckBox* m_pCheckRequiredFields;
- CheckBox* m_pIgnoreCurrency;
- CheckBox* m_pEscapeDateTime;
- CheckBox* m_pPrimaryKeySupport;
- CheckBox* m_pRespectDriverResultSetType;
-
- FixedText* m_pBooleanComparisonModeLabel;
- ListBox* m_pBooleanComparisonMode;
-
- FixedText* m_pMaxRowScanLabel;
- NumericField* m_pMaxRowScan;
+ VclPtr<CheckBox> m_pIsSQL92Check;
+ VclPtr<CheckBox> m_pAppendTableAlias;
+ VclPtr<CheckBox> m_pAsBeforeCorrelationName;
+ VclPtr<CheckBox> m_pEnableOuterJoin;
+ VclPtr<CheckBox> m_pIgnoreDriverPrivileges;
+ VclPtr<CheckBox> m_pParameterSubstitution;
+ VclPtr<CheckBox> m_pSuppressVersionColumn;
+ VclPtr<CheckBox> m_pCatalog;
+ VclPtr<CheckBox> m_pSchema;
+ VclPtr<CheckBox> m_pIndexAppendix;
+ VclPtr<CheckBox> m_pDosLineEnds;
+ VclPtr<CheckBox> m_pCheckRequiredFields;
+ VclPtr<CheckBox> m_pIgnoreCurrency;
+ VclPtr<CheckBox> m_pEscapeDateTime;
+ VclPtr<CheckBox> m_pPrimaryKeySupport;
+ VclPtr<CheckBox> m_pRespectDriverResultSetType;
+
+ VclPtr<FixedText> m_pBooleanComparisonModeLabel;
+ VclPtr<ListBox> m_pBooleanComparisonMode;
+
+ VclPtr<FixedText> m_pMaxRowScanLabel;
+ VclPtr<NumericField> m_pMaxRowScan;
::svt::ControlDependencyManager
m_aControlDependencies;
@@ -78,6 +78,7 @@ namespace dbaui
protected:
virtual ~SpecialSettingsPage();
+ virtual void dispose() SAL_OVERRIDE;
// OGenericAdministrationPage overridables
virtual void implInitControls (const SfxItemSet& _rSet, bool _bSaveValue ) SAL_OVERRIDE;
@@ -97,12 +98,12 @@ namespace dbaui
{
protected:
- VclFrame* m_pAutoFrame;
- CheckBox* m_pAutoRetrievingEnabled;
- FixedText* m_pAutoIncrementLabel;
- Edit* m_pAutoIncrement;
- FixedText* m_pAutoRetrievingLabel;
- Edit* m_pAutoRetrieving;
+ VclPtr<VclFrame> m_pAutoFrame;
+ VclPtr<CheckBox> m_pAutoRetrievingEnabled;
+ VclPtr<FixedText> m_pAutoIncrementLabel;
+ VclPtr<Edit> m_pAutoIncrement;
+ VclPtr<FixedText> m_pAutoRetrievingLabel;
+ VclPtr<Edit> m_pAutoRetrieving;
::svt::ControlDependencyManager
m_aControlDependencies;
@@ -115,6 +116,7 @@ namespace dbaui
// nControlFlags is a combination of the CBTP_xxx-constants
virtual ~GeneratedValuesPage();
+ virtual void dispose() SAL_OVERRIDE;
// subclasses must override this, but it isn't pure virtual
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 7eeedec9500a..6f040bec4838 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -66,9 +66,14 @@ ODbAdminDialog::ODbAdminDialog(vcl::Window* _pParent
ODbAdminDialog::~ODbAdminDialog()
{
+ disposeOnce();
+}
+
+void ODbAdminDialog::dispose()
+{
SetInputSet(NULL);
DELETEZ(pExampleSet);
-
+ SfxTabDialog::dispose();
}
short ODbAdminDialog::Ok()
diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx
index 1493734256b1..f767f4ea31e9 100644
--- a/dbaccess/source/ui/dlg/dbfindex.cxx
+++ b/dbaccess/source/ui/dlg/dbfindex.cxx
@@ -76,6 +76,25 @@ ODbaseIndexDialog::ODbaseIndexDialog(vcl::Window * pParent, const OUString& aDat
SetCtrls();
}
+ODbaseIndexDialog::~ODbaseIndexDialog()
+{
+ disposeOnce();
+}
+
+void ODbaseIndexDialog::dispose()
+{
+ m_pPB_OK.clear();
+ m_pCB_Tables.clear();
+ m_pIndexes.clear();
+ m_pLB_TableIndexes.clear();
+ m_pLB_FreeIndexes.clear();
+ m_pAdd.clear();
+ m_pRemove.clear();
+ m_pAddAll.clear();
+ m_pRemoveAll.clear();
+ ModalDialog::dispose();
+}
+
bool ODbaseIndexDialog::GetTable(const OUString& _rName, TableInfoList::iterator& _rPosition)
{
for ( _rPosition = m_aTableInfoList.begin();
diff --git a/dbaccess/source/ui/dlg/dbfindex.hxx b/dbaccess/source/ui/dlg/dbfindex.hxx
index 58aae3b04091..46aac76028af 100644
--- a/dbaccess/source/ui/dlg/dbfindex.hxx
+++ b/dbaccess/source/ui/dlg/dbfindex.hxx
@@ -73,16 +73,16 @@ typedef ::std::list< OTableInfo > TableInfoList;
class ODbaseIndexDialog : public ModalDialog
{
protected:
- OKButton* m_pPB_OK;
- ComboBox* m_pCB_Tables;
- VclContainer* m_pIndexes;
- ListBox* m_pLB_TableIndexes;
- ListBox* m_pLB_FreeIndexes;
+ VclPtr<OKButton> m_pPB_OK;
+ VclPtr<ComboBox> m_pCB_Tables;
+ VclPtr<VclContainer> m_pIndexes;
+ VclPtr<ListBox> m_pLB_TableIndexes;
+ VclPtr<ListBox> m_pLB_FreeIndexes;
- PushButton* m_pAdd;
- PushButton* m_pRemove;
- PushButton* m_pAddAll;
- PushButton* m_pRemoveAll;
+ VclPtr<PushButton> m_pAdd;
+ VclPtr<PushButton> m_pRemove;
+ VclPtr<PushButton> m_pAddAll;
+ VclPtr<PushButton> m_pRemoveAll;
DECL_LINK( TableSelectHdl, ComboBox* );
DECL_LINK( AddClickHdl, PushButton* );
@@ -113,6 +113,8 @@ protected:
public:
ODbaseIndexDialog( vcl::Window * pParent, const OUString& aDataSrcName );
+ virtual ~ODbaseIndexDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index f39d0dba2454..566c30af0fa0 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -102,7 +102,13 @@ ODbTypeWizDialog::ODbTypeWizDialog(vcl::Window* _pParent
ODbTypeWizDialog::~ODbTypeWizDialog()
{
+ disposeOnce();
+}
+
+void ODbTypeWizDialog::dispose()
+{
delete m_pOutSet;
+ svt::OWizardMachine::dispose();
}
IMPL_LINK(ODbTypeWizDialog, OnTypeSelected, OGeneralPage*, _pTabPage)
@@ -227,16 +233,16 @@ void ODbTypeWizDialog::clearPassword()
m_pImpl->clearPassword();
}
-TabPage* ODbTypeWizDialog::createPage(WizardState _nState)
+VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState)
{
sal_uInt16 nStringId = STR_PAGETITLE_ADVANCED;
- TabPage* pPage = NULL;
+ VclPtr<TabPage> pPage;
switch(_nState)
{
case START_PAGE: // start state
{
- pPage = new OGeneralPageDialog(this,*m_pOutSet);
- OGeneralPage* pGeneralPage = static_cast< OGeneralPage* >( pPage );
+ pPage = VclPtr<OGeneralPageDialog>::Create(this,*m_pOutSet);
+ OGeneralPage* pGeneralPage = static_cast< OGeneralPage* >( pPage.get() );
pGeneralPage->SetTypeSelectHandler( LINK( this, ODbTypeWizDialog, OnTypeSelected));
nStringId = STR_PAGETITLE_GENERAL;
}
@@ -284,8 +290,8 @@ TabPage* ODbTypeWizDialog::createPage(WizardState _nState)
// register ourself as modified listener
if ( pPage )
{
- static_cast<OGenericAdministrationPage*>(pPage)->SetServiceFactory( m_pImpl->getORB() );
- static_cast<OGenericAdministrationPage*>(pPage)->SetAdminDialog(this,this);
+ static_cast<OGenericAdministrationPage*>(pPage.get())->SetServiceFactory( m_pImpl->getORB() );
+ static_cast<OGenericAdministrationPage*>(pPage.get())->SetAdminDialog(this,this);
pPage->SetText(ModuleRes(nStringId));
defaultButton( _nState == START_PAGE ? WZB_NEXT : WZB_FINISH );
enableButtons( WZB_FINISH, _nState != START_PAGE);
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 6a9f3c814928..b063828432e3 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -264,7 +264,16 @@ OUString ODbTypeWizDialogSetup::getStateDisplayName( WizardState _nState ) const
ODbTypeWizDialogSetup::~ODbTypeWizDialogSetup()
{
+ disposeOnce();
+}
+
+void ODbTypeWizDialogSetup::dispose()
+{
delete m_pOutSet;
+ m_pGeneralPage.clear();
+ m_pMySQLIntroPage.clear();
+ m_pFinalPage.clear();
+ svt::RoadmapWizard::dispose();
}
IMPL_LINK(ODbTypeWizDialogSetup, OnTypeSelected, OGeneralPage*, /*_pTabPage*/)
@@ -420,7 +429,7 @@ Reference< XDriver > ODbTypeWizDialogSetup::getDriver()
::dbaccess::DATASOURCE_TYPE LocDatabaseType = _DatabaseType;
if ((LocDatabaseType == ::dbaccess::DST_MYSQL_JDBC) || (LocDatabaseType == ::dbaccess::DST_MYSQL_ODBC) || (LocDatabaseType == ::dbaccess::DST_MYSQL_NATIVE))
{
- if (m_pMySQLIntroPage != NULL)
+ if (m_pMySQLIntroPage != nullptr)
{
switch( m_pMySQLIntroPage->getMySQLMode() )
{
@@ -439,7 +448,7 @@ Reference< XDriver > ODbTypeWizDialogSetup::getDriver()
OUString ODbTypeWizDialogSetup::getDatasourceType(const SfxItemSet& _rSet) const
{
OUString sRet = dbaui::ODbDataSourceAdministrationHelper::getDatasourceType(_rSet);
- if (m_pMySQLIntroPage != NULL && m_pMySQLIntroPage->IsVisible() )
+ if (m_pMySQLIntroPage != nullptr && m_pMySQLIntroPage->IsVisible() )
{
switch( m_pMySQLIntroPage->getMySQLMode() )
{
@@ -462,16 +471,16 @@ void ODbTypeWizDialogSetup::clearPassword()
m_pImpl->clearPassword();
}
-TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
+VclPtr<TabPage> ODbTypeWizDialogSetup::createPage(WizardState _nState)
{
- SfxTabPage* pFirstPage;
- OGenericAdministrationPage* pPage = NULL;
+ VclPtr<SfxTabPage> pFirstPage;
+ VclPtr<OGenericAdministrationPage> pPage;
switch(_nState)
{
case PAGE_DBSETUPWIZARD_INTRO:
- pFirstPage = new OGeneralPageWizard(this,*m_pOutSet);
- pPage = static_cast<OGenericAdministrationPage*> (pFirstPage);
- m_pGeneralPage = static_cast<OGeneralPageWizard*>(pFirstPage);
+ pFirstPage = VclPtr<OGeneralPageWizard>::Create(this,*m_pOutSet);
+ pPage = static_cast<OGenericAdministrationPage*> (pFirstPage.get());
+ m_pGeneralPage = static_cast<OGeneralPageWizard*>(pFirstPage.get());
m_pGeneralPage->SetTypeSelectHandler(LINK(this, ODbTypeWizDialogSetup, OnTypeSelected));
m_pGeneralPage->SetCreationModeHandler(LINK( this, ODbTypeWizDialogSetup, OnChangeCreationMode ) );
m_pGeneralPage->SetDocumentSelectionHandler(LINK( this, ODbTypeWizDialogSetup, OnRecentDocumentSelected ) );
@@ -543,7 +552,7 @@ TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
case PAGE_DBSETUPWIZARD_FINAL:
pPage = OFinalDBPageSetup::CreateFinalDBTabPageSetup(this,*m_pOutSet);
- m_pFinalPage = static_cast<OFinalDBPageSetup*> (pPage);
+ m_pFinalPage = static_cast<OFinalDBPageSetup*> (pPage.get());
break;
}
@@ -734,7 +743,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
if ( m_pGeneralPage->GetDatabaseCreationMode() == OGeneralPageWizard::eOpenExisting )
return true;
- if ( m_pFinalPage != NULL )
+ if ( m_pFinalPage != nullptr )
return m_pFinalPage->IsDatabaseDocumentToBeOpened();
return true;
@@ -745,7 +754,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
if ( m_pGeneralPage->GetDatabaseCreationMode() == OGeneralPageWizard::eOpenExisting )
return false;
- if ( m_pFinalPage != NULL )
+ if ( m_pFinalPage != nullptr )
return m_pFinalPage->IsTableWizardToBeStarted();
return false;
diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx
index 5018b582288d..b090ddc8df06 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -71,7 +71,6 @@ namespace dbaui
,m_pAutoRetrievingLabel(NULL)
,m_pAutoRetrieving(NULL)
,m_nControlFlags(nControlFlags)
- ,m_bDelete(false)
{
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
@@ -97,22 +96,21 @@ namespace dbaui
OCommonBehaviourTabPage::~OCommonBehaviourTabPage()
{
- if(m_bDelete)
- {
- DELETEZ(m_pOptionsLabel);
- DELETEZ(m_pOptions);
-
- DELETEZ(m_pCharsetLabel);
- DELETEZ(m_pCharset);
-
- DELETEZ(m_pAutoIncrementLabel);
- DELETEZ(m_pAutoIncrement);
-
- DELETEZ(m_pAutoRetrievingEnabled);
- DELETEZ(m_pAutoRetrievingLabel);
- DELETEZ(m_pAutoRetrieving);
- }
+ disposeOnce();
+ }
+ void OCommonBehaviourTabPage::dispose()
+ {
+ m_pOptionsLabel.disposeAndClear();
+ m_pOptions.disposeAndClear();
+ m_pCharsetLabel.disposeAndClear();
+ m_pCharset.disposeAndClear();
+ m_pAutoIncrementLabel.disposeAndClear();
+ m_pAutoIncrement.disposeAndClear();
+ m_pAutoRetrievingEnabled.disposeAndClear();
+ m_pAutoRetrievingLabel.disposeAndClear();
+ m_pAutoRetrieving.disposeAndClear();
+ OGenericAdministrationPage::dispose();
}
void OCommonBehaviourTabPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
@@ -196,12 +194,20 @@ namespace dbaui
ODbaseDetailsPage::~ODbaseDetailsPage()
{
+ disposeOnce();
+ }
+ void ODbaseDetailsPage::dispose()
+ {
+ m_pShowDeleted.clear();
+ m_pFT_Message.clear();
+ m_pIndexes.clear();
+ OCommonBehaviourTabPage::dispose();
}
- SfxTabPage* ODriversSettings::CreateDbase( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateDbase( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new ODbaseDetailsPage( pParent, *_rAttrSet ) );
+ return VclPtr<ODbaseDetailsPage>::Create( pParent, *_rAttrSet );
}
void ODbaseDetailsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
@@ -241,8 +247,8 @@ namespace dbaui
{
if (m_pIndexes == pButton)
{
- ODbaseIndexDialog aIndexDialog(this, m_sDsn);
- aIndexDialog.Execute();
+ ScopedVclPtrInstance< ODbaseIndexDialog > aIndexDialog(this, m_sDsn);
+ aIndexDialog->Execute();
}
else
{
@@ -261,13 +267,9 @@ namespace dbaui
}
- OAdoDetailsPage::~OAdoDetailsPage()
- {
-
- }
- SfxTabPage* ODriversSettings::CreateAdo( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateAdo( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new OAdoDetailsPage( pParent, *_rAttrSet ) );
+ return VclPtr<OAdoDetailsPage>::Create( pParent, *_rAttrSet );
}
// OOdbcDetailsPage
@@ -278,9 +280,20 @@ namespace dbaui
m_pUseCatalog->SetToggleHdl(getControlModifiedLink());
}
- SfxTabPage* ODriversSettings::CreateODBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ OOdbcDetailsPage::~OOdbcDetailsPage()
+ {
+ disposeOnce();
+ }
+
+ void OOdbcDetailsPage::dispose()
{
- return ( new OOdbcDetailsPage( pParent, *_rAttrSet ) );
+ m_pUseCatalog.clear();
+ OCommonBehaviourTabPage::dispose();
+ }
+
+ VclPtr<SfxTabPage> ODriversSettings::CreateODBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ {
+ return VclPtr<OOdbcDetailsPage>::Create( pParent, *_rAttrSet );
}
bool OOdbcDetailsPage::FillItemSet( SfxItemSet* _rSet )
@@ -316,9 +329,24 @@ namespace dbaui
m_pUseCatalog->SetToggleHdl(getControlModifiedLink());
}
- SfxTabPage* ODriversSettings::CreateUser( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ OUserDriverDetailsPage::~OUserDriverDetailsPage()
+ {
+ disposeOnce();
+ }
+
+ void OUserDriverDetailsPage::dispose()
+ {
+ m_pFTHostname.clear();
+ m_pEDHostname.clear();
+ m_pPortNumber.clear();
+ m_pNFPortNumber.clear();
+ m_pUseCatalog.clear();
+ OCommonBehaviourTabPage::dispose();
+ }
+
+ VclPtr<SfxTabPage> ODriversSettings::CreateUser( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new OUserDriverDetailsPage( pParent, *_rAttrSet ) );
+ return VclPtr<OUserDriverDetailsPage>::Create( pParent, *_rAttrSet );
}
bool OUserDriverDetailsPage::FillItemSet( SfxItemSet* _rSet )
@@ -373,9 +401,9 @@ namespace dbaui
{
}
- SfxTabPage* ODriversSettings::CreateMySQLODBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateMySQLODBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new OMySQLODBCDetailsPage( pParent, *_rAttrSet ) );
+ return VclPtr<OMySQLODBCDetailsPage>::Create( pParent, *_rAttrSet );
}
// OMySQLJDBCDetailsPage
@@ -422,6 +450,23 @@ namespace dbaui
m_pEDSocket->SetModifyHdl(getControlModifiedLink());
}
+ OGeneralSpecialJDBCDetailsPage::~OGeneralSpecialJDBCDetailsPage()
+ {
+ disposeOnce();
+ }
+
+ void OGeneralSpecialJDBCDetailsPage::dispose()
+ {
+ m_pEDHostname.clear();
+ m_pNFPortNumber.clear();
+ m_pFTSocket.clear();
+ m_pEDSocket.clear();
+ m_pFTDriverClass.clear();
+ m_pEDDriverClass.clear();
+ m_pTestJavaDriver.clear();
+ OCommonBehaviourTabPage::dispose();
+ }
+
bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet* _rSet )
{
bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
@@ -494,8 +539,8 @@ namespace dbaui
#endif
const sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
const OSQLMessageBox::MessageType mt = bSuccess ? OSQLMessageBox::Info : OSQLMessageBox::Error;
- OSQLMessageBox aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
- aMsg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
+ aMsg->Execute();
return 0L;
}
IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnEditModified, Edit*, _pEdit)
@@ -511,7 +556,7 @@ namespace dbaui
// MySQLNativePage
MySQLNativePage::MySQLNativePage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, "MysqlNativePage", "dbaccess/ui/mysqlnativepage.ui", _rCoreAttrs, CBTP_USE_CHARSET )
- ,m_aMySQLSettings ( *get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink() )
+ ,m_aMySQLSettings ( VclPtr<MySQLNativeSettings>::Create(*get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink()) )
{
get(m_pSeparator1, "connectionheader");
get(m_pSeparator2, "userheader");
@@ -521,13 +566,29 @@ namespace dbaui
m_pUserName->SetModifyHdl(getControlModifiedLink());
- m_aMySQLSettings.Show();
+ m_aMySQLSettings->Show();
+ }
+
+ MySQLNativePage::~MySQLNativePage()
+ {
+ disposeOnce();
+ }
+
+ void MySQLNativePage::dispose()
+ {
+ m_aMySQLSettings.disposeAndClear();
+ m_pSeparator1.clear();
+ m_pSeparator2.clear();
+ m_pUserNameLabel.clear();
+ m_pUserName.clear();
+ m_pPasswordRequired.clear();
+ OCommonBehaviourTabPage::dispose();
}
void MySQLNativePage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls( _rControlList );
- m_aMySQLSettings.fillControls( _rControlList );
+ m_aMySQLSettings->fillControls( _rControlList );
_rControlList.push_back(new OSaveValueWrapper<Edit>(m_pUserName));
_rControlList.push_back(new OSaveValueWrapper<CheckBox>(m_pPasswordRequired));
@@ -535,7 +596,7 @@ namespace dbaui
void MySQLNativePage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows( _rControlList );
- m_aMySQLSettings.fillWindows( _rControlList);
+ m_aMySQLSettings->fillWindows( _rControlList);
_rControlList.push_back(new ODisableWrapper<FixedText>(m_pSeparator1));
_rControlList.push_back(new ODisableWrapper<FixedText>(m_pSeparator2));
@@ -546,7 +607,7 @@ namespace dbaui
{
bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet( _rSet );
- bChangedSomething |= m_aMySQLSettings.FillItemSet( _rSet );
+ bChangedSomething |= m_aMySQLSettings->FillItemSet( _rSet );
if ( m_pUserName->IsValueChangedFromSaved() )
{
@@ -564,7 +625,7 @@ namespace dbaui
bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
- m_aMySQLSettings.implInitControls( _rSet );
+ m_aMySQLSettings->implInitControls( _rSet );
SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, true);
SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, true);
@@ -579,18 +640,18 @@ namespace dbaui
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
}
- SfxTabPage* ODriversSettings::CreateMySQLJDBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateMySQLJDBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new OGeneralSpecialJDBCDetailsPage( pParent, *_rAttrSet,DSID_MYSQL_PORTNUMBER ) );
+ return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create( pParent, *_rAttrSet,DSID_MYSQL_PORTNUMBER );
}
- SfxTabPage* ODriversSettings::CreateMySQLNATIVE( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateMySQLNATIVE( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new MySQLNativePage( pParent, *_rAttrSet ) );
+ return VclPtr<MySQLNativePage>::Create( pParent, *_rAttrSet );
}
- SfxTabPage* ODriversSettings::CreateOracleJDBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateOracleJDBC( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new OGeneralSpecialJDBCDetailsPage( pParent, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false) );
+ return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create( pParent, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false);
}
// OLDAPDetailsPage
@@ -614,9 +675,23 @@ namespace dbaui
m_pCBUseSSL->SetClickHdl(LINK(this, OLDAPDetailsPage,OnCheckBoxClick));
}
- SfxTabPage* ODriversSettings::CreateLDAP( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ OLDAPDetailsPage::~OLDAPDetailsPage()
+ {
+ disposeOnce();
+ }
+
+ void OLDAPDetailsPage::dispose()
{
- return ( new OLDAPDetailsPage( pParent, *_rAttrSet ) );
+ m_pETBaseDN.clear();
+ m_pCBUseSSL.clear();
+ m_pNFPortNumber.clear();
+ m_pNFRowCount.clear();
+ OCommonBehaviourTabPage::dispose();
+ }
+
+ VclPtr<SfxTabPage> ODriversSettings::CreateLDAP( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ {
+ return VclPtr<OLDAPDetailsPage>::Create( pParent, *_rAttrSet );
}
bool OLDAPDetailsPage::FillItemSet( SfxItemSet* _rSet )
@@ -675,18 +750,23 @@ namespace dbaui
:OCommonBehaviourTabPage(pParent, "EmptyPage", "dbaccess/ui/emptypage.ui", _rCoreAttrs, 0)
{
- m_pTextConnectionHelper = new OTextConnectionHelper( get<VclVBox>("EmptyPage"), TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET );
+ m_pTextConnectionHelper = VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("EmptyPage"), TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET );
}
OTextDetailsPage::~OTextDetailsPage()
{
- DELETEZ(m_pTextConnectionHelper);
+ disposeOnce();
+ }
+ void OTextDetailsPage::dispose()
+ {
+ m_pTextConnectionHelper.disposeAndClear();
+ OCommonBehaviourTabPage::dispose();
}
- SfxTabPage* ODriversSettings::CreateText( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateText( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
{
- return ( new OTextDetailsPage( pParent, *_rAttrSet ) );
+ return VclPtr<OTextDetailsPage>::Create( pParent, *_rAttrSet );
}
void OTextDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
@@ -722,16 +802,16 @@ namespace dbaui
return m_pTextConnectionHelper->prepareLeave();
}
- SfxTabPage* ODriversSettings::CreateGeneratedValuesPage( vcl::Window* _pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateGeneratedValuesPage( vcl::Window* _pParent, const SfxItemSet* _rAttrSet )
{
- return new GeneratedValuesPage( _pParent, *_rAttrSet );
+ return VclPtr<GeneratedValuesPage>::Create( _pParent, *_rAttrSet );
}
- SfxTabPage* ODriversSettings::CreateSpecialSettingsPage( vcl::Window* _pParent, const SfxItemSet* _rAttrSet )
+ VclPtr<SfxTabPage> ODriversSettings::CreateSpecialSettingsPage( vcl::Window* _pParent, const SfxItemSet* _rAttrSet )
{
OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( *_rAttrSet );
DataSourceMetaData aMetaData( eType );
- return new SpecialSettingsPage( _pParent, *_rAttrSet, aMetaData );
+ return VclPtr<SpecialSettingsPage>::Create( _pParent, *_rAttrSet, aMetaData );
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx
index fd4119bdbbfa..407a986c2c1c 100644
--- a/dbaccess/source/ui/dlg/detailpages.hxx
+++ b/dbaccess/source/ui/dlg/detailpages.hxx
@@ -50,22 +50,20 @@ namespace dbaui
{
protected:
- FixedText* m_pOptionsLabel;
- Edit* m_pOptions;
+ VclPtr<FixedText> m_pOptionsLabel;
+ VclPtr<Edit> m_pOptions;
- FixedText* m_pCharsetLabel;
- CharSetListBox* m_pCharset;
+ VclPtr<FixedText> m_pCharsetLabel;
+ VclPtr<CharSetListBox> m_pCharset;
- CheckBox* m_pAutoRetrievingEnabled;
- FixedText* m_pAutoIncrementLabel;
- Edit* m_pAutoIncrement;
- FixedText* m_pAutoRetrievingLabel;
- Edit* m_pAutoRetrieving;
+ VclPtr<CheckBox> m_pAutoRetrievingEnabled;
+ VclPtr<FixedText> m_pAutoIncrementLabel;
+ VclPtr<Edit> m_pAutoIncrement;
+ VclPtr<FixedText> m_pAutoRetrievingLabel;
+ VclPtr<Edit> m_pAutoRetrieving;
sal_uInt32 m_nControlFlags;
- bool m_bDelete;
-
public:
virtual bool FillItemSet (SfxItemSet* _rCoreAttrs) SAL_OVERRIDE;
@@ -74,6 +72,7 @@ namespace dbaui
protected:
virtual ~OCommonBehaviourTabPage();
+ virtual void dispose() SAL_OVERRIDE;
// subclasses must override this, but it isn't pure virtual
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
@@ -92,18 +91,16 @@ namespace dbaui
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
ODbaseDetailsPage(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
+ virtual ~ODbaseDetailsPage();
+ virtual void dispose() SAL_OVERRIDE;
private:
- CheckBox* m_pShowDeleted;
- FixedText* m_pFT_Message;
- PushButton* m_pIndexes;
+ VclPtr<CheckBox> m_pShowDeleted;
+ VclPtr<FixedText> m_pFT_Message;
+ VclPtr<PushButton> m_pIndexes;
OUString m_sDsn;
protected:
-
- virtual ~ODbaseDetailsPage();
-
- protected:
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
private:
@@ -113,10 +110,7 @@ namespace dbaui
// OAdoDetailsPage
class OAdoDetailsPage : public OCommonBehaviourTabPage
{
- protected:
- virtual ~OAdoDetailsPage();
public:
-
OAdoDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
};
@@ -127,10 +121,12 @@ namespace dbaui
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
OOdbcDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
+ virtual ~OOdbcDetailsPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
private:
- CheckBox* m_pUseCatalog;
+ VclPtr<CheckBox> m_pUseCatalog;
};
// OUserDriverDetailsPage
@@ -140,16 +136,18 @@ namespace dbaui
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
OUserDriverDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
+ virtual ~OUserDriverDetailsPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
private:
- FixedText* m_pFTHostname;
- Edit* m_pEDHostname;
- FixedText* m_pPortNumber;
- NumericField* m_pNFPortNumber;
- CheckBox* m_pUseCatalog;
+ VclPtr<FixedText> m_pFTHostname;
+ VclPtr<Edit> m_pEDHostname;
+ VclPtr<FixedText> m_pPortNumber;
+ VclPtr<NumericField> m_pNFPortNumber;
+ VclPtr<CheckBox> m_pUseCatalog;
};
// OMySQLODBCDetailsPage
@@ -168,6 +166,8 @@ namespace dbaui
, sal_uInt16 _nPortId
, bool bShowSocket = true
);
+ virtual ~OGeneralSpecialJDBCDetailsPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
@@ -177,14 +177,14 @@ namespace dbaui
DECL_LINK(OnTestJavaClickHdl,PushButton*);
DECL_LINK(OnEditModified,Edit*);
- Edit* m_pEDHostname;
- NumericField* m_pNFPortNumber;
- FixedText* m_pFTSocket;
- Edit* m_pEDSocket;
+ VclPtr<Edit> m_pEDHostname;
+ VclPtr<NumericField> m_pNFPortNumber;
+ VclPtr<FixedText> m_pFTSocket;
+ VclPtr<Edit> m_pEDSocket;
- FixedText* m_pFTDriverClass;
- Edit* m_pEDDriverClass;
- PushButton* m_pTestJavaDriver;
+ VclPtr<FixedText> m_pFTDriverClass;
+ VclPtr<Edit> m_pEDDriverClass;
+ VclPtr<PushButton> m_pTestJavaDriver;
OUString m_sDefaultJdbcDriverName;
sal_uInt16 m_nPortId;
@@ -197,15 +197,17 @@ namespace dbaui
public:
MySQLNativePage( vcl::Window* pParent,
const SfxItemSet& _rCoreAttrs );
+ virtual ~MySQLNativePage();
+ virtual void dispose() SAL_OVERRIDE;
private:
- FixedText *m_pSeparator1;
- MySQLNativeSettings m_aMySQLSettings;
+ VclPtr<FixedText> m_pSeparator1;
+ VclPtr<MySQLNativeSettings> m_aMySQLSettings;
- FixedText *m_pSeparator2;
- FixedText *m_pUserNameLabel;
- Edit *m_pUserName;
- CheckBox *m_pPasswordRequired;
+ VclPtr<FixedText> m_pSeparator2;
+ VclPtr<FixedText> m_pUserNameLabel;
+ VclPtr<Edit> m_pUserName;
+ VclPtr<CheckBox> m_pPasswordRequired;
protected:
virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
@@ -221,13 +223,15 @@ namespace dbaui
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
OLDAPDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
+ virtual ~OLDAPDetailsPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
private:
- Edit* m_pETBaseDN;
- CheckBox* m_pCBUseSSL;
- NumericField* m_pNFPortNumber;
- NumericField* m_pNFRowCount;
+ VclPtr<Edit> m_pETBaseDN;
+ VclPtr<CheckBox> m_pCBUseSSL;
+ VclPtr<NumericField> m_pNFPortNumber;
+ VclPtr<NumericField> m_pNFRowCount;
sal_Int32 m_iSSLPort;
sal_Int32 m_iNormalPort;
@@ -237,10 +241,7 @@ namespace dbaui
// OMozillaDetailsPage Detail page for Mozilla and Thunderbird addressbook
class OMozillaDetailsPage : public OCommonBehaviourTabPage
{
- protected:
- virtual ~OMozillaDetailsPage();
public:
-
OMozillaDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
};
@@ -251,10 +252,11 @@ namespace dbaui
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
OTextDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
- OTextConnectionHelper* m_pTextConnectionHelper;
+ VclPtr<OTextConnectionHelper> m_pTextConnectionHelper;
protected:
virtual ~OTextDetailsPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool prepareLeave() SAL_OVERRIDE;
virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index b02b73332e6f..c5ceccbae91b 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -76,11 +76,23 @@ namespace dbaui
DirectSQLDialog::~DirectSQLDialog()
{
+ disposeOnce();
+ }
+
+ void DirectSQLDialog::dispose()
+ {
{
::osl::MutexGuard aGuard(m_aMutex);
stopAllComponentListening();
}
-
+ m_pSQL.clear();
+ m_pExecute.clear();
+ m_pSQLHistory.clear();
+ m_pStatus.clear();
+ m_pShowOutput.clear();
+ m_pOutput.clear();
+ m_pClose.clear();
+ ModalDialog::dispose();
}
void DirectSQLDialog::_disposing( const EventObject& _rSource )
@@ -94,8 +106,8 @@ namespace dbaui
{
OUString sMessage(ModuleRes(STR_DIRECTSQL_CONNECTIONLOST));
- MessageDialog aError(this, sMessage);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(this, sMessage);
+ aError->Execute();
}
PostUserEvent(LINK(this, DirectSQLDialog, OnClose));
diff --git a/dbaccess/source/ui/dlg/dlgattr.cxx b/dbaccess/source/ui/dlg/dlgattr.cxx
index 468233f5c748..1ca5043be4bb 100644
--- a/dbaccess/source/ui/dlg/dlgattr.cxx
+++ b/dbaccess/source/ui/dlg/dlgattr.cxx
@@ -52,8 +52,13 @@ SbaSbAttrDlg::SbaSbAttrDlg(vcl::Window* pParent, const SfxItemSet* pCellAttrs,
SbaSbAttrDlg::~SbaSbAttrDlg()
{
- delete pNumberInfoItem;
+ disposeOnce();
+}
+void SbaSbAttrDlg::dispose()
+{
+ delete pNumberInfoItem;
+ SfxTabDialog::dispose();
}
void SbaSbAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
diff --git a/dbaccess/source/ui/dlg/dlgsave.cxx b/dbaccess/source/ui/dlg/dlgsave.cxx
index e2817a3d9b7a..46bbbacf63c7 100644
--- a/dbaccess/source/ui/dlg/dlgsave.cxx
+++ b/dbaccess/source/ui/dlg/dlgsave.cxx
@@ -48,14 +48,14 @@ namespace dbaui
class OSaveAsDlgImpl
{
public:
- FixedText* m_pDescription;
- FixedText* m_pCatalogLbl;
- OSQLNameComboBox* m_pCatalog;
- FixedText* m_pSchemaLbl;
- OSQLNameComboBox* m_pSchema;
- FixedText* m_pLabel;
- OSQLNameEdit* m_pTitle;
- OKButton* m_pPB_OK;
+ VclPtr<FixedText> m_pDescription;
+ VclPtr<FixedText> m_pCatalogLbl;
+ VclPtr<OSQLNameComboBox> m_pCatalog;
+ VclPtr<FixedText> m_pSchemaLbl;
+ VclPtr<OSQLNameComboBox> m_pSchema;
+ VclPtr<FixedText> m_pLabel;
+ VclPtr<OSQLNameEdit> m_pTitle;
+ VclPtr<OKButton> m_pPB_OK;
OUString m_aQryLabel;
OUString m_sTblLabel;
OUString m_aName;
@@ -285,7 +285,13 @@ OSaveAsDlg::OSaveAsDlg( vcl::Window * pParent,
OSaveAsDlg::~OSaveAsDlg()
{
+ disposeOnce();
+}
+
+void OSaveAsDlg::dispose()
+{
DELETEZ(m_pImpl);
+ ModalDialog::dispose();
}
IMPL_LINK(OSaveAsDlg, ButtonClickHdl, Button *, pButton)
diff --git a/dbaccess/source/ui/dlg/dlgsize.cxx b/dbaccess/source/ui/dlg/dlgsize.cxx
index 11750ab0917a..6c254a494e84 100644
--- a/dbaccess/source/ui/dlg/dlgsize.cxx
+++ b/dbaccess/source/ui/dlg/dlgsize.cxx
@@ -51,6 +51,19 @@ DlgSize::DlgSize( vcl::Window* pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nA
LINK(this,DlgSize,CbClickHdl).Call(m_pCB_STANDARD);
}
+DlgSize::~DlgSize()
+{
+ disposeOnce();
+}
+
+void DlgSize::dispose()
+{
+ m_pMF_VALUE.clear();
+ m_pCB_STANDARD.clear();
+ ModalDialog::dispose();
+}
+
+
void DlgSize::SetValue( sal_Int32 nVal )
{
m_pMF_VALUE->SetValue(nVal, FUNIT_CM );
diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx
index bcd1dc6add60..950903da5ccd 100644
--- a/dbaccess/source/ui/dlg/dsselect.cxx
+++ b/dbaccess/source/ui/dlg/dsselect.cxx
@@ -72,8 +72,18 @@ ODatasourceSelectDialog::ODatasourceSelectDialog(vcl::Window* _pParent, const St
ODatasourceSelectDialog::~ODatasourceSelectDialog()
{
+ disposeOnce();
}
+void ODatasourceSelectDialog::dispose()
+{
+ m_pDatasource.clear();
+ m_pOk.clear();
+ m_pCancel.clear();
+ ModalDialog::dispose();
+}
+
+
IMPL_LINK( ODatasourceSelectDialog, ListDblClickHdl, ListBox *, pListBox )
{
if (pListBox->GetSelectEntryCount())
diff --git a/dbaccess/source/ui/dlg/dsselect.hxx b/dbaccess/source/ui/dlg/dsselect.hxx
index b124fb0cdaee..2cb4cb6537e6 100644
--- a/dbaccess/source/ui/dlg/dsselect.hxx
+++ b/dbaccess/source/ui/dlg/dsselect.hxx
@@ -41,12 +41,12 @@ namespace dbaui
class ODatasourceSelectDialog : public ModalDialog
{
protected:
- ListBox* m_pDatasource;
- OKButton* m_pOk;
- CancelButton* m_pCancel;
+ VclPtr<ListBox> m_pDatasource;
+ VclPtr<OKButton> m_pOk;
+ VclPtr<CancelButton> m_pCancel;
SfxItemSet* m_pOutputSet;
#ifdef HAVE_ODBC_ADMINISTRATION
- PushButton* m_pManageDatasources;
+ VclPtr<PushButton> m_pManageDatasources;
::std::unique_ptr< OOdbcManagement >
m_pODBCManagement;
#endif
@@ -54,7 +54,7 @@ protected:
public:
ODatasourceSelectDialog( vcl::Window* _pParent, const StringBag& _rDatasources, SfxItemSet* _pOutputSet = NULL );
virtual ~ODatasourceSelectDialog();
-
+ virtual void dispose() SAL_OVERRIDE;
OUString GetSelected() const { return m_pDatasource->GetSelectEntry();}
void Select( const OUString& _rEntry ) { m_pDatasource->SelectEntry(_rEntry); }
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index 1a543dce4c73..4ece5045c04d 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -76,6 +76,14 @@ namespace dbaui
OGeneralPage::~OGeneralPage()
{
+ disposeOnce();
+ }
+
+ void OGeneralPage::dispose()
+ {
+ m_pSpecialMessage.clear();
+ m_pDatasourceType.clear();
+ OGenericAdministrationPage::dispose();
}
namespace
@@ -537,6 +545,24 @@ namespace dbaui
m_pPB_OpenDatabase->SetClickHdl( LINK( this, OGeneralPageWizard, OnOpenDocument ) );
}
+ OGeneralPageWizard::~OGeneralPageWizard()
+ {
+ disposeOnce();
+ }
+
+ void OGeneralPageWizard::dispose()
+ {
+ m_pRB_CreateDatabase.clear();
+ m_pRB_OpenExistingDatabase.clear();
+ m_pRB_ConnectDatabase.clear();
+ m_pFT_EmbeddedDBLabel.clear();
+ m_pEmbeddedDBType.clear();
+ m_pFT_DocListLabel.clear();
+ m_pLB_DocumentList.clear();
+ m_pPB_OpenDatabase.clear();
+ OGeneralPage::dispose();
+ }
+
OGeneralPageWizard::CreationMode OGeneralPageWizard::GetDatabaseCreationMode() const
{
if ( m_pRB_CreateDatabase->IsChecked() )
@@ -712,8 +738,8 @@ namespace dbaui
if ( aFileDlg.GetCurrentFilter() != pFilter->GetUIName() || !pFilter->GetWildcard().Matches(sPath) )
{
OUString sMessage(ModuleRes(STR_ERR_USE_CONNECT_TO));
- InfoBox aError(this, sMessage);
- aError.Execute();
+ ScopedVclPtrInstance< InfoBox > aError(this, sMessage);
+ aError->Execute();
m_pRB_ConnectDatabase->Check();
OnSetupModeSelected( m_pRB_ConnectDatabase );
return 0L;
diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx
index 0668f679721a..6c5d3294f749 100644
--- a/dbaccess/source/ui/dlg/generalpage.hxx
+++ b/dbaccess/source/ui/dlg/generalpage.hxx
@@ -34,14 +34,13 @@ namespace dbaui
{
protected:
OGeneralPage( vcl::Window* pParent, const OUString& _rUIXMLDescription, const SfxItemSet& _rItems );
- virtual ~OGeneralPage();
OUString m_eCurrentSelection; /// currently selected type
::dbaccess::DATASOURCE_TYPE
m_eNotSupportedKnownType; /// if a data source of an unsupported, but known type is encountered ....
private:
- FixedText* m_pSpecialMessage;
+ VclPtr<FixedText> m_pSpecialMessage;
enum SPECIAL_MESSAGE
{
@@ -57,7 +56,7 @@ namespace dbaui
void insertDatasourceTypeEntryData( const OUString& _sType, const OUString& sDisplayName );
protected:
- ListBox* m_pDatasourceType;
+ VclPtr<ListBox> m_pDatasourceType;
::dbaccess::ODsnTypeCollection*
m_pCollection; /// the DSN type collection instance
@@ -66,6 +65,9 @@ namespace dbaui
m_aURLPrefixes;
public:
+ virtual ~OGeneralPage();
+ virtual void dispose() SAL_OVERRIDE;
+
/// set a handler which gets called every time the user selects a new type
void SetTypeSelectHandler( const Link& _rHandler ) { m_aTypeSelectHandler = _rHandler; }
@@ -116,7 +118,8 @@ namespace dbaui
{
public:
OGeneralPageWizard( vcl::Window* pParent, const SfxItemSet& _rItems );
-
+ virtual ~OGeneralPageWizard();
+ virtual void dispose() SAL_OVERRIDE;
public:
enum CreationMode
{
@@ -133,16 +136,16 @@ namespace dbaui
private:
// dialog controls
- RadioButton* m_pRB_CreateDatabase;
- RadioButton* m_pRB_OpenExistingDatabase;
- RadioButton* m_pRB_ConnectDatabase;
+ VclPtr<RadioButton> m_pRB_CreateDatabase;
+ VclPtr<RadioButton> m_pRB_OpenExistingDatabase;
+ VclPtr<RadioButton> m_pRB_ConnectDatabase;
- FixedText* m_pFT_EmbeddedDBLabel;
- ListBox* m_pEmbeddedDBType;
+ VclPtr<FixedText> m_pFT_EmbeddedDBLabel;
+ VclPtr<ListBox> m_pEmbeddedDBType;
- FixedText* m_pFT_DocListLabel;
- OpenDocumentListBox* m_pLB_DocumentList;
- OpenDocumentButton* m_pPB_OpenDatabase;
+ VclPtr<FixedText> m_pFT_DocListLabel;
+ VclPtr<OpenDocumentListBox> m_pLB_DocumentList;
+ VclPtr<OpenDocumentButton> m_pPB_OpenDatabase;
// state
DocumentDescriptor m_aBrowsedDocument;
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index d034b68bd597..a033fab3b3bf 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -311,9 +311,23 @@ namespace dbaui
DbaIndexDialog::~DbaIndexDialog( )
{
+ disposeOnce();
+ }
+
+ void DbaIndexDialog::dispose()
+ {
setToolBox(NULL);
delete m_pIndexes;
-
+ m_pActions.clear();
+ m_pIndexList.clear();
+ m_pIndexDetails.clear();
+ m_pDescriptionLabel.clear();
+ m_pDescription.clear();
+ m_pUnique.clear();
+ m_pFieldsLabel.clear();
+ m_pFields.clear();
+ m_pClose.clear();
+ ModalDialog::dispose();
}
bool DbaIndexDialog::implCommit(SvTreeListEntry* _pEntry)
@@ -408,8 +422,8 @@ namespace dbaui
{
OUString sConfirm(ModuleRes(STR_CONFIRM_DROP_INDEX));
sConfirm = sConfirm.replaceFirst("$name$", m_pIndexList->GetEntryText(pSelected));
- MessageDialog aConfirm(this, sConfirm, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if (RET_YES != aConfirm.Execute())
+ ScopedVclPtrInstance< MessageDialog > aConfirm(this, sConfirm, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if (RET_YES != aConfirm->Execute())
return;
}
@@ -572,9 +586,9 @@ namespace dbaui
if (aSelected->isModified() || aSelected->isNew())
{
- MessageDialog aQuestion(this, "SaveIndexDialog",
- "dbaccess/ui/saveindexdialog.ui");
- nResponse = aQuestion.Execute();
+ ScopedVclPtrInstance<MessageDialog> aQuestion(this, "SaveIndexDialog",
+ "dbaccess/ui/saveindexdialog.ui" );
+ nResponse = aQuestion->Execute();
}
}
@@ -616,8 +630,8 @@ namespace dbaui
{
OUString sError(ModuleRes(STR_INDEX_NAME_ALREADY_USED));
sError = sError.replaceFirst("$name$", sNewName);
- MessageDialog aError(this, sError);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(this, sError);
+ aError->Execute();
updateToolbox();
m_bEditAgain = true;
@@ -677,8 +691,8 @@ namespace dbaui
// need at least one field
if (0 == _rPos->aFields.size())
{
- MessageDialog aError(this, ModuleRes(STR_NEED_INDEX_FIELDS));
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(this, ModuleRes(STR_NEED_INDEX_FIELDS));
+ aError->Execute();
m_pFields->GrabFocus();
return false;
}
@@ -695,8 +709,8 @@ namespace dbaui
// a column is specified twice ... won't work anyway, so prevent this here and now
OUString sMessage(ModuleRes(STR_INDEXDESIGN_DOUBLE_COLUMN_NAME));
sMessage = sMessage.replaceFirst("$name$", aFieldCheck->sFieldName);
- MessageDialog aError(this, sMessage);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(this, sMessage);
+ aError->Execute();
m_pFields->GrabFocus();
return false;
}
diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
index dc0d7a40d3b6..a236e46ea7dc 100644
--- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
+++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
@@ -110,9 +110,14 @@ namespace dbaui
IndexFieldsControl::~IndexFieldsControl()
{
- delete m_pSortingCell;
- delete m_pFieldNameCell;
+ disposeOnce();
+ }
+ void IndexFieldsControl::dispose()
+ {
+ m_pSortingCell.disposeAndClear();
+ m_pFieldNameCell.disposeAndClear();
+ ::svt::EditBrowseBox::dispose();
}
bool IndexFieldsControl::SeekRow(long nRow)
@@ -240,7 +245,7 @@ namespace dbaui
nSortOrderColumnWidth += GetTextWidth(OUString('0')) * 2;
InsertDataColumn(COLUMN_ID_ORDER, sColumnName, nSortOrderColumnWidth, HeaderBarItemBits::STDSTYLE, 1);
- m_pSortingCell = new ListBoxControl(&GetDataWindow());
+ m_pSortingCell = VclPtr<ListBoxControl>::Create(&GetDataWindow());
m_pSortingCell->InsertEntry(m_sAscendingText);
m_pSortingCell->InsertEntry(m_sDescendingText);
m_pSortingCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_SORTORDER );
@@ -256,7 +261,7 @@ namespace dbaui
// create the cell controllers
// for the field name cell
- m_pFieldNameCell = new ListBoxControl(&GetDataWindow());
+ m_pFieldNameCell = VclPtr<ListBoxControl>::Create(&GetDataWindow());
m_pFieldNameCell->InsertEntry(OUString());
m_pFieldNameCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_FIELD );
const OUString* pFields = _rAvailableFields.getConstArray();
diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx
index d39d86fb623a..c0425048091a 100644
--- a/dbaccess/source/ui/dlg/paramdialog.cxx
+++ b/dbaccess/source/ui/dlg/paramdialog.cxx
@@ -113,9 +113,19 @@ namespace dbaui
OParameterDialog::~OParameterDialog()
{
+ disposeOnce();
+ }
+
+ void OParameterDialog::dispose()
+ {
if (m_aResetVisitFlag.IsActive())
m_aResetVisitFlag.Stop();
-
+ m_pAllParams.clear();
+ m_pParam.clear();
+ m_pTravelNext.clear();
+ m_pOKBtn.clear();
+ m_pCancelBtn.clear();
+ ModalDialog::dispose();
}
void OParameterDialog::Construct()
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 1274a03bf9b2..a86bd6326e66 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -192,6 +192,23 @@ DlgFilterCrit::DlgFilterCrit(vcl::Window * pParent,
DlgFilterCrit::~DlgFilterCrit()
{
+ disposeOnce();
+}
+
+void DlgFilterCrit::dispose()
+{
+ m_pLB_WHEREFIELD1.clear();
+ m_pLB_WHERECOMP1.clear();
+ m_pET_WHEREVALUE1.clear();
+ m_pLB_WHERECOND2.clear();
+ m_pLB_WHEREFIELD2.clear();
+ m_pLB_WHERECOMP2.clear();
+ m_pET_WHEREVALUE2.clear();
+ m_pLB_WHERECOND3.clear();
+ m_pLB_WHEREFIELD3.clear();
+ m_pLB_WHERECOMP3.clear();
+ m_pET_WHEREVALUE3.clear();
+ ModalDialog::dispose();
}
#define LbText(x) ((x).GetSelectEntry())
diff --git a/dbaccess/source/ui/dlg/queryorder.cxx b/dbaccess/source/ui/dlg/queryorder.cxx
index f58d3ad7f0c5..410598b5663e 100644
--- a/dbaccess/source/ui/dlg/queryorder.cxx
+++ b/dbaccess/source/ui/dlg/queryorder.cxx
@@ -127,6 +127,20 @@ DlgOrderCrit::DlgOrderCrit(vcl::Window * pParent,
DlgOrderCrit::~DlgOrderCrit()
{
+ disposeOnce();
+}
+
+void DlgOrderCrit::dispose()
+{
+ m_pLB_ORDERFIELD1.clear();
+ m_pLB_ORDERVALUE1.clear();
+ m_pLB_ORDERFIELD2.clear();
+ m_pLB_ORDERVALUE2.clear();
+ m_pLB_ORDERFIELD3.clear();
+ m_pLB_ORDERVALUE3.clear();
+ for (auto a : m_aColumnList) a.clear();
+ for (auto a : m_aValueList) a.clear();
+ ModalDialog::dispose();
}
IMPL_LINK_INLINE_START( DlgOrderCrit, FieldListSelectHdl, ListBox *, /*pListBox*/ )
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index 70ba97341669..36341e32751f 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -292,8 +292,8 @@ namespace
class OExceptionChainDialog : public ModalDialog
{
- SvTreeListBox* m_pExceptionList;
- VclMultiLineEdit* m_pExceptionText;
+ VclPtr<SvTreeListBox> m_pExceptionList;
+ VclPtr<VclMultiLineEdit> m_pExceptionText;
OUString m_sStatusLabel;
OUString m_sErrorCodeLabel;
@@ -302,6 +302,13 @@ class OExceptionChainDialog : public ModalDialog
public:
OExceptionChainDialog( vcl::Window* pParent, const ExceptionDisplayChain& _rExceptions );
+ virtual ~OExceptionChainDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ m_pExceptionList.clear();
+ m_pExceptionText.clear();
+ ModalDialog::dispose();
+ }
protected:
DECL_LINK(OnExceptionSelected, void*);
@@ -470,24 +477,24 @@ void OSQLMessageBox::impl_positionControls()
}
// image
- lcl_positionInAppFont( *this, m_aInfoImage, OUTER_MARGIN, OUTER_MARGIN, IMAGE_SIZE, IMAGE_SIZE );
- m_aInfoImage.Show();
+ lcl_positionInAppFont( *this, *m_aInfoImage.get(), OUTER_MARGIN, OUTER_MARGIN, IMAGE_SIZE, IMAGE_SIZE );
+ m_aInfoImage->Show();
// primary text
- lcl_positionInAppFont( *this, m_aTitle, TEXT_POS_X, OUTER_MARGIN, DIALOG_WIDTH - TEXT_POS_X - 2 * OUTER_MARGIN, 16 );
+ lcl_positionInAppFont( *this, *m_aTitle.get(), TEXT_POS_X, OUTER_MARGIN, DIALOG_WIDTH - TEXT_POS_X - 2 * OUTER_MARGIN, 16 );
sPrimary = lcl_stripOOoBaseVendor( sPrimary );
- m_aTitle.SetText( sPrimary );
- m_aTitle.Show();
+ m_aTitle->SetText( sPrimary );
+ m_aTitle->Show();
- Rectangle aPrimaryRect( m_aTitle.GetPosPixel(), m_aTitle.GetSizePixel() );
+ Rectangle aPrimaryRect( m_aTitle->GetPosPixel(), m_aTitle->GetSizePixel() );
// secondary text (if applicable)
- m_aMessage.SetStyle( m_aMessage.GetStyle() | WB_NOLABEL );
+ m_aMessage->SetStyle( m_aMessage->GetStyle() | WB_NOLABEL );
sSecondary = lcl_stripOOoBaseVendor( sSecondary );
- m_aMessage.SetText( sSecondary );
+ m_aMessage->SetText( sSecondary );
- lcl_positionInAppFont( *this, m_aMessage, TEXT_POS_X, OUTER_MARGIN + 16 + 3, DIALOG_WIDTH - TEXT_POS_X - 2 * OUTER_MARGIN, 8 );
- Rectangle aSecondaryRect( m_aMessage.GetPosPixel(), m_aMessage.GetSizePixel() );
+ lcl_positionInAppFont( *this, *m_aMessage.get(), TEXT_POS_X, OUTER_MARGIN + 16 + 3, DIALOG_WIDTH - TEXT_POS_X - 2 * OUTER_MARGIN, 8 );
+ Rectangle aSecondaryRect( m_aMessage->GetPosPixel(), m_aMessage->GetSizePixel() );
bool bHaveSecondaryText = !sSecondary.isEmpty();
@@ -498,8 +505,8 @@ void OSQLMessageBox::impl_positionControls()
aSecondaryRect.Bottom() = aSecondaryRect.Top() - 1;
// adjust secondary control height accordingly
- m_aMessage.SetSizePixel( aSecondaryRect.GetSize() );
- m_aMessage.Show( aSecondaryRect.GetHeight() > 0 );
+ m_aMessage->SetSizePixel( aSecondaryRect.GetSize() );
+ m_aMessage->Show( aSecondaryRect.GetHeight() > 0 );
// if there's no secondary text ...
if ( !bHaveSecondaryText )
@@ -508,23 +515,23 @@ void OSQLMessageBox::impl_positionControls()
aPrimaryRect.Right() = aPrimaryRect.Left() + aSuggestedRect.GetWidth();
aPrimaryRect.Bottom() = aPrimaryRect.Top() + aSuggestedRect.GetHeight();
// and center it horizontally
- m_aTitle.SetStyle( ( m_aTitle.GetStyle() & ~WB_LEFT ) | WB_CENTER );
+ m_aTitle->SetStyle( ( m_aTitle->GetStyle() & ~WB_LEFT ) | WB_CENTER );
- Rectangle aInfoRect( m_aInfoImage.GetPosPixel(), m_aInfoImage.GetSizePixel() );
+ Rectangle aInfoRect( m_aInfoImage->GetPosPixel(), m_aInfoImage->GetSizePixel() );
// also, if it's not as high as the image ...
- if ( aPrimaryRect.GetHeight() < m_aInfoImage.GetSizePixel().Height() )
+ if ( aPrimaryRect.GetHeight() < m_aInfoImage->GetSizePixel().Height() )
{ // ... make it fit the image height
aPrimaryRect.Bottom() += aInfoRect.GetHeight() - aPrimaryRect.GetHeight();
// and center it vertically
- m_aTitle.SetStyle( m_aTitle.GetStyle() | WB_VCENTER );
+ m_aTitle->SetStyle( m_aTitle->GetStyle() | WB_VCENTER );
}
else
{ // ... otherwise, center the image vertically, relative to the primary text
aInfoRect.Move( 0, ( aPrimaryRect.GetHeight() - aInfoRect.GetHeight() ) / 2 );
- m_aInfoImage.SetPosSizePixel( aInfoRect.TopLeft(), aInfoRect.GetSize() );
+ m_aInfoImage->SetPosSizePixel( aInfoRect.TopLeft(), aInfoRect.GetSize() );
}
- m_aTitle.SetPosSizePixel( aPrimaryRect.TopLeft(), aPrimaryRect.GetSize() );
+ m_aTitle->SetPosSizePixel( aPrimaryRect.TopLeft(), aPrimaryRect.GetSize() );
}
// adjust dialog size accordingly
@@ -546,16 +553,16 @@ void OSQLMessageBox::impl_initImage( MessageType _eImage )
OSL_FAIL( "OSQLMessageBox::impl_initImage: unsupported image type!" );
/* Fall through */
case Info:
- m_aInfoImage.SetImage(InfoBox::GetStandardImage());
+ m_aInfoImage->SetImage(InfoBox::GetStandardImage());
break;
case Warning:
- m_aInfoImage.SetImage(WarningBox::GetStandardImage());
+ m_aInfoImage->SetImage(WarningBox::GetStandardImage());
break;
case Error:
- m_aInfoImage.SetImage(ErrorBox::GetStandardImage());
+ m_aInfoImage->SetImage(ErrorBox::GetStandardImage());
break;
case Query:
- m_aInfoImage.SetImage(QueryBox::GetStandardImage());
+ m_aInfoImage->SetImage(QueryBox::GetStandardImage());
break;
}
}
@@ -606,7 +613,7 @@ void OSQLMessageBox::impl_createStandardButtons( WinBits _nStyle )
void OSQLMessageBox::impl_addDetailsButton()
{
- size_t nFirstPageVisible = m_aMessage.IsVisible() ? 2 : 1;
+ size_t nFirstPageVisible = m_aMessage->IsVisible() ? 2 : 1;
bool bMoreDetailsAvailable = m_pImpl->aDisplayInfo.size() > nFirstPageVisible;
if ( !bMoreDetailsAvailable )
@@ -664,9 +671,9 @@ void OSQLMessageBox::Construct( WinBits _nStyle, MessageType _eImage )
OSQLMessageBox::OSQLMessageBox(vcl::Window* _pParent, const SQLExceptionInfo& _rException, WinBits _nStyle, const OUString& _rHelpURL )
:ButtonDialog( _pParent, WB_HORZ | WB_STDDIALOG )
- ,m_aInfoImage( this )
- ,m_aTitle( this, WB_WORDBREAK | WB_LEFT )
- ,m_aMessage( this, WB_WORDBREAK | WB_LEFT )
+ ,m_aInfoImage( VclPtr<FixedImage>::Create(this) )
+ ,m_aTitle( VclPtr<FixedText>::Create(this, WB_WORDBREAK | WB_LEFT) )
+ ,m_aMessage( VclPtr<FixedText>::Create(this, WB_WORDBREAK | WB_LEFT) )
,m_sHelpURL( _rHelpURL )
,m_pImpl( new SQLMessageBox_Impl( _rException ) )
{
@@ -675,9 +682,9 @@ OSQLMessageBox::OSQLMessageBox(vcl::Window* _pParent, const SQLExceptionInfo& _r
OSQLMessageBox::OSQLMessageBox( vcl::Window* _pParent, const OUString& _rTitle, const OUString& _rMessage, WinBits _nStyle, MessageType _eType, const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo )
:ButtonDialog( _pParent, WB_HORZ | WB_STDDIALOG )
- ,m_aInfoImage( this )
- ,m_aTitle( this, WB_WORDBREAK | WB_LEFT )
- ,m_aMessage( this, WB_WORDBREAK | WB_LEFT )
+ ,m_aInfoImage( VclPtr<FixedImage>::Create(this) )
+ ,m_aTitle( VclPtr<FixedText>::Create(this, WB_WORDBREAK | WB_LEFT) )
+ ,m_aMessage( VclPtr<FixedText>::Create(this, WB_WORDBREAK | WB_LEFT) )
{
SQLContext aError;
aError.Message = _rTitle;
@@ -692,12 +699,21 @@ OSQLMessageBox::OSQLMessageBox( vcl::Window* _pParent, const OUString& _rTitle,
OSQLMessageBox::~OSQLMessageBox()
{
+ disposeOnce();
+}
+
+void OSQLMessageBox::dispose()
+{
+ m_aInfoImage.disposeAndClear();
+ m_aTitle.disposeAndClear();
+ m_aMessage.disposeAndClear();
+ ButtonDialog::dispose();
}
IMPL_LINK( OSQLMessageBox, ButtonClickHdl, Button *, /*pButton*/ )
{
- OExceptionChainDialog aDlg( this, m_pImpl->aDisplayInfo );
- aDlg.Execute();
+ ScopedVclPtrInstance< OExceptionChainDialog > aDlg( this, m_pImpl->aDisplayInfo );
+ aDlg->Execute();
return 0;
}
diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx
index 59d9af9d75be..54ab0c3cecdf 100644
--- a/dbaccess/source/ui/dlg/tablespage.cxx
+++ b/dbaccess/source/ui/dlg/tablespage.cxx
@@ -99,13 +99,21 @@ namespace dbaui
OTableSubscriptionPage::~OTableSubscriptionPage()
{
+ disposeOnce();
+ }
+
+ void OTableSubscriptionPage::dispose()
+ {
// just to make sure that our connection will be removed
try
{
::comphelper::disposeComponent(m_xCurrentConnection);
}
catch (RuntimeException&) { }
-
+ m_pTables.clear();
+ m_pTablesList.clear();
+ m_pTablesDlg.clear();
+ OGenericAdministrationPage::dispose();
}
void OTableSubscriptionPage::StateChanged( StateChangedType nType )
@@ -319,8 +327,8 @@ namespace dbaui
if (aErrorInfo.isValid())
{
// establishing the connection failed. Show an error window and exit.
- OSQLMessageBox aMessageBox( GetParentDialog(), aErrorInfo );
- aMessageBox.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aMessageBox( GetParentDialog(), aErrorInfo );
+ aMessageBox->Execute();
m_pTables->Enable(false);
m_pTablesList->Clear();
diff --git a/dbaccess/source/ui/dlg/tablespage.hxx b/dbaccess/source/ui/dlg/tablespage.hxx
index bd1568a82f36..a5dc8e8e9dbc 100644
--- a/dbaccess/source/ui/dlg/tablespage.hxx
+++ b/dbaccess/source/ui/dlg/tablespage.hxx
@@ -36,8 +36,8 @@ namespace dbaui
:public OGenericAdministrationPage
{
private:
- VclContainer* m_pTables;
- OTableTreeListBox* m_pTablesList;
+ VclPtr<VclContainer> m_pTables;
+ VclPtr<OTableTreeListBox> m_pTablesList;
OUString m_sCatalogSeparator;
bool m_bCatalogAtStart : 1;
@@ -46,7 +46,7 @@ namespace dbaui
m_xCurrentConnection; /// valid as long as the page is active
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator >
m_xCollator;
- OTableSubscriptionDialog* m_pTablesDlg;
+ VclPtr<OTableSubscriptionDialog> m_pTablesDlg;
public:
virtual bool FillItemSet(SfxItemSet* _rCoreAttrs) SAL_OVERRIDE;
@@ -62,6 +62,7 @@ namespace dbaui
OTableSubscriptionPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ,OTableSubscriptionDialog* _pTablesDlg);
virtual ~OTableSubscriptionPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/dlg/textconnectionsettings.cxx b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
index 11f84162318b..9fa798b1b096 100644
--- a/dbaccess/source/ui/dlg/textconnectionsettings.cxx
+++ b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
@@ -34,13 +34,21 @@ namespace dbaui
,m_rItems( _rItems )
{
get(m_pOK, "ok");
- m_pTextConnectionHelper.reset( new OTextConnectionHelper( get<VclVBox>("TextPageContainer"), TC_HEADER | TC_SEPARATORS | TC_CHARSET ) );
+ m_pTextConnectionHelper.reset( VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("TextPageContainer"), TC_HEADER | TC_SEPARATORS | TC_CHARSET ) );
m_pOK->SetClickHdl( LINK( this, TextConnectionSettingsDialog, OnOK ) );
}
TextConnectionSettingsDialog::~TextConnectionSettingsDialog()
{
+ disposeOnce();
+ }
+
+ void TextConnectionSettingsDialog::dispose()
+ {
+ m_pOK.clear();
+ m_pTextConnectionHelper.disposeAndClear();
+ ModalDialog::dispose();
}
void TextConnectionSettingsDialog::bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues )
diff --git a/dbaccess/source/ui/inc/CollectionView.hxx b/dbaccess/source/ui/inc/CollectionView.hxx
index 704ea76c6068..f407b70bc918 100644
--- a/dbaccess/source/ui/inc/CollectionView.hxx
+++ b/dbaccess/source/ui/inc/CollectionView.hxx
@@ -34,12 +34,12 @@ namespace dbaui
*/
class OCollectionView : public ModalDialog
{
- FixedText* m_pFTCurrentPath;
- PushButton* m_pNewFolder;
- PushButton* m_pUp;
- SvtFileView* m_pView;
- Edit* m_pName;
- PushButton* m_pPB_OK;
+ VclPtr<FixedText> m_pFTCurrentPath;
+ VclPtr<PushButton> m_pNewFolder;
+ VclPtr<PushButton> m_pUp;
+ VclPtr<SvtFileView> m_pView;
+ VclPtr<Edit> m_pName;
+ VclPtr<PushButton> m_pPB_OK;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> m_xContent;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
bool m_bCreateForm;
@@ -57,7 +57,7 @@ namespace dbaui
,const OUString& _sDefaultName
,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
virtual ~OCollectionView();
-
+ virtual void dispose() SAL_OVERRIDE;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> getSelectedFolder() const { return m_xContent;}
OUString getName() const;
};
diff --git a/dbaccess/source/ui/inc/ColumnControlWindow.hxx b/dbaccess/source/ui/inc/ColumnControlWindow.hxx
index b09d6ff6e030..583481a7d7b2 100644
--- a/dbaccess/source/ui/inc/ColumnControlWindow.hxx
+++ b/dbaccess/source/ui/inc/ColumnControlWindow.hxx
@@ -55,7 +55,6 @@ namespace dbaui
public:
OColumnControlWindow(vcl::Window* pParent
,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
- virtual ~OColumnControlWindow();
void setConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xCon);
diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx
index 6ae780d4705a..f5bef2a5d5d9 100644
--- a/dbaccess/source/ui/inc/ConnectionLine.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLine.hxx
@@ -22,6 +22,7 @@
#include <tools/gen.hxx>
#include "ConnectionLineData.hxx"
#include <functional>
+#include <vcl/vclptr.hxx>
class OutputDevice;
namespace dbaui
@@ -38,7 +39,7 @@ namespace dbaui
class OTableConnection;
class OConnectionLine
{
- OTableConnection* m_pTabConn;
+ VclPtr<OTableConnection> m_pTabConn;
OConnectionLineDataRef m_pData;
Point m_aSourceConnPos,
@@ -72,7 +73,7 @@ namespace dbaui
/// draws a connectionline object on outputdevice
struct TConnectionLineDrawFunctor : ::std::unary_function<OConnectionLine*,void>
{
- OutputDevice* pDevice;
+ VclPtr<OutputDevice> pDevice;
TConnectionLineDrawFunctor(OutputDevice* _pDevice)
{
pDevice = _pDevice;
diff --git a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
index fb63317073f6..8df3cf848f34 100644
--- a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include <cppuhelper/implbase2.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <vcl/vclptr.hxx>
namespace dbaui
{
@@ -35,7 +36,7 @@ namespace dbaui
class OConnectionLineAccess : public VCLXAccessibleComponent
, public OConnectionLineAccess_BASE
{
- const OTableConnection* m_pLine; // the window which I should give accessibility to
+ VclPtr<const OTableConnection> m_pLine; // the window which I should give accessibility to
protected:
/** this function is called upon disposing the component
*/
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index d8913ed932fa..983bfc6d2183 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -65,40 +65,40 @@ namespace dbaui
class OFieldDescControl : public TabPage
{
private:
- OTableDesignHelpBar* pHelp;
- vcl::Window* pLastFocusWindow;
- vcl::Window* m_pActFocusWindow;
-
- FixedText* pDefaultText;
- FixedText* pRequiredText;
- FixedText* pAutoIncrementText;
- FixedText* pTextLenText;
- FixedText* pNumTypeText;
- FixedText* pLengthText;
- FixedText* pScaleText;
- FixedText* pFormatText;
- FixedText* pBoolDefaultText;
- FixedText* m_pColumnNameText;
- FixedText* m_pTypeText;
- FixedText* m_pAutoIncrementValueText;
-
- OPropListBoxCtrl* pRequired;
- OPropListBoxCtrl* pNumType;
- OPropListBoxCtrl* pAutoIncrement;
- OPropEditCtrl* pDefault;
- OPropNumericEditCtrl* pTextLen;
- OPropNumericEditCtrl* pLength;
- OPropNumericEditCtrl* pScale;
- OPropEditCtrl* pFormatSample;
- OPropListBoxCtrl* pBoolDefault;
- OPropColumnEditCtrl* m_pColumnName;
- OPropListBoxCtrl* m_pType;
- OPropEditCtrl* m_pAutoIncrementValue;
-
- PushButton* pFormat;
-
- ScrollBar* m_pVertScroll;
- ScrollBar* m_pHorzScroll;
+ VclPtr<OTableDesignHelpBar> pHelp;
+ VclPtr<vcl::Window> pLastFocusWindow;
+ VclPtr<vcl::Window> m_pActFocusWindow;
+
+ VclPtr<FixedText> pDefaultText;
+ VclPtr<FixedText> pRequiredText;
+ VclPtr<FixedText> pAutoIncrementText;
+ VclPtr<FixedText> pTextLenText;
+ VclPtr<FixedText> pNumTypeText;
+ VclPtr<FixedText> pLengthText;
+ VclPtr<FixedText> pScaleText;
+ VclPtr<FixedText> pFormatText;
+ VclPtr<FixedText> pBoolDefaultText;
+ VclPtr<FixedText> m_pColumnNameText;
+ VclPtr<FixedText> m_pTypeText;
+ VclPtr<FixedText> m_pAutoIncrementValueText;
+
+ VclPtr<OPropListBoxCtrl> pRequired;
+ VclPtr<OPropListBoxCtrl> pNumType;
+ VclPtr<OPropListBoxCtrl> pAutoIncrement;
+ VclPtr<OPropEditCtrl> pDefault;
+ VclPtr<OPropNumericEditCtrl> pTextLen;
+ VclPtr<OPropNumericEditCtrl> pLength;
+ VclPtr<OPropNumericEditCtrl> pScale;
+ VclPtr<OPropEditCtrl> pFormatSample;
+ VclPtr<OPropListBoxCtrl> pBoolDefault;
+ VclPtr<OPropColumnEditCtrl> m_pColumnName;
+ VclPtr<OPropListBoxCtrl> m_pType;
+ VclPtr<OPropEditCtrl> m_pAutoIncrementValue;
+
+ VclPtr<PushButton> pFormat;
+
+ VclPtr<ScrollBar> m_pVertScroll;
+ VclPtr<ScrollBar> m_pHorzScroll;
TOTypeInfoSP m_pPreviousType;
short m_nPos;
@@ -126,15 +126,15 @@ namespace dbaui
void UpdateFormatSample(OFieldDescription* pFieldDescr);
void ArrangeAggregates();
- void SetPosSize( Control** ppControl, long nRow, sal_uInt16 nCol );
+ void SetPosSize( VclPtr<Control>& rControl, long nRow, sal_uInt16 nCol );
void ScrollAggregate(Control* pText, Control* pInput, Control* pButton, long nDeltaX, long nDeltaY);
void ScrollAllAggregates();
bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const;
void Contruct();
- OPropNumericEditCtrl* CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId);
- FixedText* CreateText(sal_uInt16 _nTextRes);
+ VclPtr<OPropNumericEditCtrl> CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId);
+ VclPtr<FixedText> CreateText(sal_uInt16 _nTextRes);
void InitializeControl(Control* _pControl,const OString& _sHelpId,bool _bAddChangeHandler);
protected:
@@ -175,6 +175,7 @@ namespace dbaui
public:
OFieldDescControl( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar);
virtual ~OFieldDescControl();
+ virtual void dispose() SAL_OVERRIDE;
void DisplayData(OFieldDescription* pFieldDescr );
diff --git a/dbaccess/source/ui/inc/JAccess.hxx b/dbaccess/source/ui/inc/JAccess.hxx
index 2306dfef8d4b..11604c2e2fd3 100644
--- a/dbaccess/source/ui/inc/JAccess.hxx
+++ b/dbaccess/source/ui/inc/JAccess.hxx
@@ -21,6 +21,7 @@
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <vcl/vclptr.hxx>
namespace dbaui
{
@@ -32,7 +33,7 @@ namespace dbaui
*/
class OJoinDesignViewAccess : public VCLXAccessibleComponent, public OJoinDesignViewAccess_BASE
{
- OJoinTableView* m_pTableView; // the window which I should give accessibility to
+ VclPtr<OJoinTableView> m_pTableView; // the window which I should give accessibility to
public:
/** OJoinDesignViewAccess needs a valid view
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
index bfbfc560544b..4fd57a929b86 100644
--- a/dbaccess/source/ui/inc/JoinController.hxx
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -51,7 +51,7 @@ namespace dbaui
Fraction m_aZoom;
::dbtools::SQLExceptionInfo m_aExceptionInfo;
- OAddTableDlg* m_pAddTableDialog;
+ VclPtr<OAddTableDlg> m_pAddTableDialog;
::std::unique_ptr< AddTableDialogContext > m_pDialogContext;
Point m_aMinimumTableViewSize;
diff --git a/dbaccess/source/ui/inc/JoinDesignView.hxx b/dbaccess/source/ui/inc/JoinDesignView.hxx
index 7b29ddde90af..da50da1e20ac 100644
--- a/dbaccess/source/ui/inc/JoinDesignView.hxx
+++ b/dbaccess/source/ui/inc/JoinDesignView.hxx
@@ -33,8 +33,8 @@ namespace dbaui
class OJoinDesignView : public ODataView
{
protected:
- OScrollWindowHelper* m_pScrollWindow; // contains only the scrollbars
- OJoinTableView* m_pTableView; // presents the upper window
+ VclPtr<OScrollWindowHelper> m_pScrollWindow; // contains only the scrollbars
+ VclPtr<OJoinTableView> m_pTableView; // presents the upper window
OJoinController& m_rController;
public:
@@ -42,6 +42,7 @@ namespace dbaui
OJoinController& _rController,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
virtual ~OJoinDesignView();
+ virtual void dispose() SAL_OVERRIDE;
// set the view readonly or not
virtual void setReadOnly(bool _bReadOnly);
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
index f43cdd254baf..608c2d82dc98 100644
--- a/dbaccess/source/ui/inc/JoinTableView.hxx
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -23,6 +23,7 @@
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <vcl/scrbar.hxx>
+#include <vcl/vclptr.hxx>
#include <tools/rtti.hxx>
#include <svtools/transfer.hxx>
@@ -51,10 +52,10 @@ namespace dbaui
class OJoinTableView;
class OScrollWindowHelper : public vcl::Window
{
- ScrollBar m_aHScrollBar;
- ScrollBar m_aVScrollBar;
- vcl::Window* m_pCornerWindow;
- OJoinTableView* m_pTableView;
+ VclPtr<ScrollBar> m_aHScrollBar;
+ VclPtr<ScrollBar> m_aVScrollBar;
+ VclPtr<vcl::Window> m_pCornerWindow;
+ VclPtr<OJoinTableView> m_pTableView;
protected:
virtual void Resize() SAL_OVERRIDE;
@@ -62,14 +63,15 @@ namespace dbaui
public:
OScrollWindowHelper( vcl::Window* pParent);
virtual ~OScrollWindowHelper();
+ virtual void dispose() SAL_OVERRIDE;
void setTableView(OJoinTableView* _pTableView);
void resetRange(const Point& _aSize);
// own methods
- ScrollBar& GetHScrollBar() { return m_aHScrollBar; }
- ScrollBar& GetVScrollBar() { return m_aVScrollBar; }
+ ScrollBar& GetHScrollBar() { return *m_aHScrollBar.get(); }
+ ScrollBar& GetVScrollBar() { return *m_aVScrollBar.get(); }
};
@@ -80,11 +82,11 @@ namespace dbaui
friend class OJoinMoveTabWinUndoAct;
public:
- typedef std::map<OUString, OTableWindow*> OTableWindowMap;
+ typedef std::map<OUString, VclPtr<OTableWindow> > OTableWindowMap;
private:
OTableWindowMap m_aTableMap;
- ::std::vector<OTableConnection*> m_vTableConnection;
+ ::std::vector<VclPtr<OTableConnection> > m_vTableConnection;
Idle m_aDragScrollIdle;
Rectangle m_aDragRect;
@@ -95,9 +97,9 @@ namespace dbaui
Size m_aOutputSize;
- OTableWindow* m_pDragWin;
- OTableWindow* m_pSizingWin;
- OTableConnection* m_pSelectedConn;
+ VclPtr<OTableWindow> m_pDragWin;
+ VclPtr<OTableWindow> m_pSizingWin;
+ VclPtr<OTableConnection> m_pSelectedConn;
bool m_bTrackingInitiallyMoved;
@@ -105,13 +107,14 @@ namespace dbaui
DECL_LINK(OnDragScrollTimer, void*);
protected:
- OTableWindow* m_pLastFocusTabWin;
- OJoinDesignView* m_pView;
+ VclPtr<OTableWindow> m_pLastFocusTabWin;
+ VclPtr<OJoinDesignView> m_pView;
OJoinDesignViewAccess* m_pAccessible;
public:
OJoinTableView( vcl::Window* pParent, OJoinDesignView* pView );
virtual ~OJoinTableView();
+ virtual void dispose() SAL_OVERRIDE;
// window override
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
@@ -180,7 +183,7 @@ namespace dbaui
/** gives a read only access to the connection vector
*/
- const ::std::vector<OTableConnection*>& getTableConnections() const { return m_vTableConnection; }
+ const ::std::vector<VclPtr<OTableConnection> >& getTableConnections() const { return m_vTableConnection; }
bool ExistsAConn(const OTableWindow* pFromWin) const;
@@ -189,7 +192,7 @@ namespace dbaui
@param _pFromWin the table for which connections should be found
@return an iterator which can be used to travel all connections of the table
*/
- ::std::vector<OTableConnection*>::const_iterator getTableConnections(const OTableWindow* _pFromWin) const;
+ ::std::vector<VclPtr<OTableConnection> >::const_iterator getTableConnections(const OTableWindow* _pFromWin) const;
/** how many connection belongs to single table
@@ -290,7 +293,7 @@ namespace dbaui
@param _pData The data corresponding to the window.
@return The new TableWindow
*/
- virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData) = 0;
+ virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) = 0;
/** determines whether the classes Init method should accept a query
name, or only table names */
diff --git a/dbaccess/source/ui/inc/LimitBox.hxx b/dbaccess/source/ui/inc/LimitBox.hxx
index 5f9187a38bba..6ff436daa170 100644
--- a/dbaccess/source/ui/inc/LimitBox.hxx
+++ b/dbaccess/source/ui/inc/LimitBox.hxx
@@ -24,7 +24,6 @@ class LimitBox: public NumericBox
{
public:
LimitBox( vcl::Window* pParent, WinBits nStyle );
- virtual ~LimitBox();
virtual OUString CreateFieldText( sal_Int64 nValue ) const SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
index 2baba04ac840..04d2724f94f1 100644
--- a/dbaccess/source/ui/inc/QueryDesignView.hxx
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -64,18 +64,19 @@ namespace dbaui
NONE
};
- Splitter m_aSplitter;
+ VclPtr<Splitter> m_aSplitter;
::com::sun::star::lang::Locale m_aLocale;
- OUString m_sDecimalSep;
+ OUString m_sDecimalSep;
- OSelectionBrowseBox* m_pSelectionBox; // presents the lower window
+ VclPtr<OSelectionBrowseBox> m_pSelectionBox; // presents the lower window
ChildFocusState m_eChildFocus;
- bool m_bInSplitHandler;
+ bool m_bInSplitHandler;
public:
OQueryDesignView(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
virtual ~OQueryDesignView();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool isCutAllowed() SAL_OVERRIDE;
virtual bool isPasteAllowed() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx b/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
index 6b19daedb287..a083b4cca893 100644
--- a/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
+++ b/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
@@ -30,16 +30,16 @@ public:
QueryPropertiesDialog(
vcl::Window* pParent, const bool bDistinct, const sal_Int64 nLimit );
virtual ~QueryPropertiesDialog();
-
+ virtual void dispose() SAL_OVERRIDE;
bool getDistinct() const;
sal_Int64 getLimit() const;
private:
- RadioButton* m_pRB_Distinct;
- RadioButton* m_pRB_NonDistinct;
+ VclPtr<RadioButton> m_pRB_Distinct;
+ VclPtr<RadioButton> m_pRB_NonDistinct;
- LimitBox* m_pLB_Limit;
+ VclPtr<LimitBox> m_pLB_Limit;
};
diff --git a/dbaccess/source/ui/inc/QueryTableView.hxx b/dbaccess/source/ui/inc/QueryTableView.hxx
index 5bac4fb4d2b0..3b8d74618bd9 100644
--- a/dbaccess/source/ui/inc/QueryTableView.hxx
+++ b/dbaccess/source/ui/inc/QueryTableView.hxx
@@ -47,7 +47,7 @@ namespace dbaui
virtual void ConnDoubleClicked(OTableConnection* pConnection) SAL_OVERRIDE;
virtual void KeyInput(const KeyEvent& rEvt) SAL_OVERRIDE;
- virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData) SAL_OVERRIDE;
+ virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) SAL_OVERRIDE;
/** called when init fails at the tablewindowdata because the m_xTable
object could not provide columns, but no exception was thrown.
@@ -58,7 +58,6 @@ namespace dbaui
public:
OQueryTableView(vcl::Window* pParent,OQueryDesignView* pView);
- virtual ~OQueryTableView();
/// base class overwritten: create and delete windows
/// (not really delete, as it becomes an UndoAction)
diff --git a/dbaccess/source/ui/inc/QueryTextView.hxx b/dbaccess/source/ui/inc/QueryTextView.hxx
index 5d9cff71e4e4..ff447f27a476 100644
--- a/dbaccess/source/ui/inc/QueryTextView.hxx
+++ b/dbaccess/source/ui/inc/QueryTextView.hxx
@@ -28,10 +28,11 @@ namespace dbaui
class OQueryTextView : public vcl::Window
{
friend class OQueryViewSwitch;
- OSqlEdit* m_pEdit;
+ VclPtr<OSqlEdit> m_pEdit;
public:
OQueryTextView( OQueryContainerWindow* pParent );
virtual ~OQueryTextView();
+ virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/QueryViewSwitch.hxx b/dbaccess/source/ui/inc/QueryViewSwitch.hxx
index e6f936a57617..ccf45802c394 100644
--- a/dbaccess/source/ui/inc/QueryViewSwitch.hxx
+++ b/dbaccess/source/ui/inc/QueryViewSwitch.hxx
@@ -34,8 +34,8 @@ namespace dbaui
class OQueryContainerWindow;
class OQueryViewSwitch
{
- OQueryDesignView* m_pDesignView;
- OQueryTextView* m_pTextView;
+ VclPtr<OQueryDesignView> m_pDesignView;
+ VclPtr<OQueryTextView> m_pTextView;
bool m_bAddTableDialogWasVisible; // true if so
public:
OQueryViewSwitch(OQueryContainerWindow* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
diff --git a/dbaccess/source/ui/inc/RelationControl.hxx b/dbaccess/source/ui/inc/RelationControl.hxx
index a04c08d5f9ca..12973d55b9f5 100644
--- a/dbaccess/source/ui/inc/RelationControl.hxx
+++ b/dbaccess/source/ui/inc/RelationControl.hxx
@@ -32,10 +32,10 @@ namespace dbaui
class OTableListBoxControl
{
- ListBox* m_pLeftTable;
- ListBox* m_pRightTable;
+ VclPtr<ListBox> m_pLeftTable;
+ VclPtr<ListBox> m_pRightTable;
- ORelationControl* m_pRC_Tables;
+ VclPtr<ORelationControl> m_pRC_Tables;
const OJoinTableView::OTableWindowMap* m_pTableMap;
IRelationControlInterface* m_pParentDialog;
OUString m_strCurrentLeft;
diff --git a/dbaccess/source/ui/inc/RelationDesignView.hxx b/dbaccess/source/ui/inc/RelationDesignView.hxx
index f7a97a9687f5..7f1559427eb9 100644
--- a/dbaccess/source/ui/inc/RelationDesignView.hxx
+++ b/dbaccess/source/ui/inc/RelationDesignView.hxx
@@ -33,7 +33,6 @@ namespace dbaui
{
public:
ORelationDesignView(vcl::Window* pParent, ORelationController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
- virtual ~ORelationDesignView();
// set the statement for representation
/// late construction
diff --git a/dbaccess/source/ui/inc/RelationDlg.hxx b/dbaccess/source/ui/inc/RelationDlg.hxx
index 5950d64f7502..3435632c08f8 100644
--- a/dbaccess/source/ui/inc/RelationDlg.hxx
+++ b/dbaccess/source/ui/inc/RelationDlg.hxx
@@ -27,11 +27,11 @@
#include "JoinTableView.hxx"
#include "RelControliFace.hxx"
#include "moduledbu.hxx"
+#include "RelationControl.hxx"
namespace dbaui
{
class OJoinTableView;
- class OTableListBoxControl;
class ORelationDialog : public ModalDialog
,public IRelationControlInterface
{
@@ -39,16 +39,16 @@ namespace dbaui
boost::scoped_ptr<OTableListBoxControl> m_xTableControl;
OJoinTableView::OTableWindowMap* m_pTableMap;
- RadioButton* m_pRB_NoCascUpd;
- RadioButton* m_pRB_CascUpd;
- RadioButton* m_pRB_CascUpdNull;
- RadioButton* m_pRB_CascUpdDefault;
- RadioButton* m_pRB_NoCascDel;
- RadioButton* m_pRB_CascDel;
- RadioButton* m_pRB_CascDelNull;
- RadioButton* m_pRB_CascDelDefault;
+ VclPtr<RadioButton> m_pRB_NoCascUpd;
+ VclPtr<RadioButton> m_pRB_CascUpd;
+ VclPtr<RadioButton> m_pRB_CascUpdNull;
+ VclPtr<RadioButton> m_pRB_CascUpdDefault;
+ VclPtr<RadioButton> m_pRB_NoCascDel;
+ VclPtr<RadioButton> m_pRB_CascDel;
+ VclPtr<RadioButton> m_pRB_CascDelNull;
+ VclPtr<RadioButton> m_pRB_CascDelDefault;
- OKButton* m_pPB_OK;
+ VclPtr<OKButton> m_pPB_OK;
TTableConnectionData::value_type m_pConnData;
TTableConnectionData::value_type m_pOrigConnData;
@@ -61,6 +61,7 @@ namespace dbaui
const TTableConnectionData::value_type& pConnectionData,
bool bAllowTableSelect = false );
virtual ~ORelationDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection() SAL_OVERRIDE { return m_xConnection; }
diff --git a/dbaccess/source/ui/inc/RelationTableView.hxx b/dbaccess/source/ui/inc/RelationTableView.hxx
index 9b38d8fb47b6..da09f88bf900 100644
--- a/dbaccess/source/ui/inc/RelationTableView.hxx
+++ b/dbaccess/source/ui/inc/RelationTableView.hxx
@@ -32,7 +32,7 @@ namespace dbaui
public OJoinTableView,
public ::comphelper::OContainerListener
{
- OTableConnection* m_pExistingConnection; ///< is set when a connection was draged on an existing connection
+ VclPtr<OTableConnection> m_pExistingConnection; ///< is set when a connection was draged on an existing connection
TTableConnectionData::value_type m_pCurrentlyTabConnData; ///< set when we creating a connection with more than one keycolumn
::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
bool m_bInRemove;
@@ -40,7 +40,7 @@ namespace dbaui
virtual void ConnDoubleClicked( OTableConnection* pConnection ) SAL_OVERRIDE;
virtual void AddTabWin(const OUString& _rComposedName, const OUString& rWinName, bool bNewTable = false) SAL_OVERRIDE;
- virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData) SAL_OVERRIDE;
+ virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) SAL_OVERRIDE;
/** determines whether the classes Init method should accept a query
name, or only table names */
@@ -54,6 +54,7 @@ namespace dbaui
public:
ORelationTableView( vcl::Window* pParent, ORelationDesignView* pView );
virtual ~ORelationTableView();
+ virtual void dispose() SAL_OVERRIDE;
virtual void RemoveTabWin( OTableWindow* pTabWin ) SAL_OVERRIDE;
virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx
index 76428fb60b24..a027fa033e5a 100644
--- a/dbaccess/source/ui/inc/TableConnection.hxx
+++ b/dbaccess/source/ui/inc/TableConnection.hxx
@@ -41,7 +41,7 @@ namespace dbaui
::std::vector<OConnectionLine*> m_vConnLine;
TTableConnectionData::value_type
m_pData;
- OJoinTableView* m_pParent;
+ VclPtr<OJoinTableView> m_pParent;
bool m_bSelected;
@@ -65,6 +65,7 @@ namespace dbaui
eventually.
*/
virtual ~OTableConnection();
+ virtual void dispose() SAL_OVERRIDE;
OTableConnection& operator=( const OTableConnection& rConn );
diff --git a/dbaccess/source/ui/inc/TableDesignControl.hxx b/dbaccess/source/ui/inc/TableDesignControl.hxx
index 4cabf5d7dd7e..97acc014cf04 100644
--- a/dbaccess/source/ui/inc/TableDesignControl.hxx
+++ b/dbaccess/source/ui/inc/TableDesignControl.hxx
@@ -47,7 +47,6 @@ namespace dbaui
public:
OTableRowView(vcl::Window* pParent);
- virtual ~OTableRowView();
virtual void SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) = 0;
virtual void SetCellData( long nRow, sal_uInt16 nColId, const ::com::sun::star::uno::Any& _rNewData ) = 0;
diff --git a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
index 900c32374754..bcc79095dec8 100644
--- a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
+++ b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
@@ -33,7 +33,7 @@ namespace dbaui
{
private:
OUString m_sHelpText;
- MultiLineEdit* m_pTextWin;
+ VclPtr<MultiLineEdit> m_pTextWin;
protected:
virtual void Resize() SAL_OVERRIDE;
@@ -41,6 +41,7 @@ namespace dbaui
public:
OTableDesignHelpBar( vcl::Window* pParent );
virtual ~OTableDesignHelpBar();
+ virtual void dispose() SAL_OVERRIDE;
void SetHelpText( const OUString& rText );
OUString GetHelpText() const { return m_sHelpText; }
diff --git a/dbaccess/source/ui/inc/TableDesignView.hxx b/dbaccess/source/ui/inc/TableDesignView.hxx
index 72ece65cf6cc..7a1016f6753f 100644
--- a/dbaccess/source/ui/inc/TableDesignView.hxx
+++ b/dbaccess/source/ui/inc/TableDesignView.hxx
@@ -32,9 +32,9 @@ namespace dbaui
class OTableEditorCtrl;
class OTableBorderWindow : public vcl::Window
{
- Splitter m_aHorzSplitter;
- OTableFieldDescWin* m_pFieldDescWin;
- OTableEditorCtrl* m_pEditorCtrl;
+ VclPtr<Splitter> m_aHorzSplitter;
+ VclPtr<OTableFieldDescWin> m_pFieldDescWin;
+ VclPtr<OTableEditorCtrl> m_pEditorCtrl;
void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
void ArrangeChildren( long nSplitPos ,Rectangle& rRect);
@@ -45,6 +45,7 @@ namespace dbaui
OTableBorderWindow(vcl::Window* pParent);
virtual ~OTableBorderWindow();
// Window overrides
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
@@ -62,7 +63,7 @@ namespace dbaui
};
private:
::com::sun::star::lang::Locale m_aLocale;
- OTableBorderWindow* m_pWin;
+ VclPtr<OTableBorderWindow> m_pWin;
OTableController& m_rController;
ChildFocusState m_eChildFocus;
@@ -77,6 +78,7 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&,
OTableController& _rController);
virtual ~OTableDesignView();
+ virtual void dispose() SAL_OVERRIDE;
// Window overrides
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx
index 9a6992bd732c..d8e5f3d524d2 100644
--- a/dbaccess/source/ui/inc/TableFieldDescription.hxx
+++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx
@@ -25,6 +25,7 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <rtl/ref.hxx>
+#include <vcl/vclptr.hxx>
#include <salhelper/simplereferenceobject.hxx>
@@ -49,7 +50,7 @@ namespace dbaui
OUString m_aFieldAlias; ///< column alias
OUString m_aFunctionName;///< contains the function name (only if m_eFunctionType != FKT_NONE)
- vcl::Window* m_pTabWindow;
+ VclPtr<vcl::Window> m_pTabWindow;
sal_Int32 m_eDataType;
sal_Int32 m_eFunctionType;
diff --git a/dbaccess/source/ui/inc/TableGrantCtrl.hxx b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
index c16cba5d5568..5f80e75fcbf3 100644
--- a/dbaccess/source/ui/inc/TableGrantCtrl.hxx
+++ b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
@@ -53,14 +53,15 @@ class OTableGrantControl : public ::svt::EditBrowseBox
mutable TTablePrivilegeMap m_aPrivMap;
OUString m_sUserName;
- ::svt::CheckBoxControl* m_pCheckCell;
- Edit* m_pEdit;
+ VclPtr<::svt::CheckBoxControl> m_pCheckCell;
+ VclPtr<Edit> m_pEdit;
long m_nDataPos;
ImplSVEvent * m_nDeactivateEvent;
public:
OTableGrantControl( vcl::Window* pParent, WinBits nBits);
virtual ~OTableGrantControl();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateTables();
void setUserName(const OUString& _sUserName);
void setGrantUser(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable>& _xGrantUser);
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
index 004139a5cb95..2d1aac671a01 100644
--- a/dbaccess/source/ui/inc/TableWindow.hxx
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -54,9 +54,9 @@ namespace dbaui
friend class OTableWindowListBox;
protected:
// and the table itself (needed for me as I want to lock it as long as the window is alive)
- FixedImage m_aTypeImage;
- OTableWindowTitle m_aTitle;
- OTableWindowListBox* m_pListBox;
+ VclPtr<FixedImage> m_aTypeImage;
+ VclPtr<OTableWindowTitle> m_aTitle;
+ VclPtr<OTableWindowListBox> m_pListBox;
OTableWindowAccess* m_pAccessible;
private:
@@ -82,7 +82,7 @@ namespace dbaui
virtual void MouseButtonDown( const MouseEvent& rEvt ) SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
- OTableWindowListBox* CreateListBox();
+ VclPtr<OTableWindowListBox> CreateListBox();
// called at FIRST Init
bool FillListBox();
// called at EACH Init
@@ -125,6 +125,7 @@ namespace dbaui
public:
virtual ~OTableWindow();
+ virtual void dispose() SAL_OVERRIDE;
// late Constructor, see also CreateListbox and FillListbox
virtual bool Init();
@@ -148,7 +149,7 @@ namespace dbaui
OUString GetComposedName() const { return m_pData->GetComposedName(); }
OTableWindowListBox* GetListBox() const { return m_pListBox; }
TTableWindowData::value_type GetData() const { return m_pData; }
- OTableWindowTitle& GetTitleCtrl() { return m_aTitle; }
+ OTableWindowTitle& GetTitleCtrl() { return *m_aTitle.get(); }
/** returns the name which should be used when displaying join or relations
@return
diff --git a/dbaccess/source/ui/inc/TableWindowAccess.hxx b/dbaccess/source/ui/inc/TableWindowAccess.hxx
index 305f89838f20..c03871c2b7ea 100644
--- a/dbaccess/source/ui/inc/TableWindowAccess.hxx
+++ b/dbaccess/source/ui/inc/TableWindowAccess.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include <cppuhelper/implbase2.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <vcl/vclptr.hxx>
namespace dbaui
{
@@ -35,7 +36,7 @@ namespace dbaui
class OTableWindowAccess : public VCLXAccessibleComponent
, public OTableWindowAccess_BASE
{
- OTableWindow* m_pTable; // the window which I should give accessibility to
+ VclPtr<OTableWindow> m_pTable; // the window which I should give accessibility to
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getParentChild(sal_Int32 _nIndex);
protected:
diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx
index 13f30c6437fb..dfd8f4b39e21 100644
--- a/dbaccess/source/ui/inc/TableWindowListBox.hxx
+++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx
@@ -30,7 +30,7 @@ namespace dbaui
struct OJoinExchangeData
{
public:
- OTableWindowListBox* pListBox; // the ListBox inside the same (you can get the TabWin and the WinName out of it)
+ VclPtr<OTableWindowListBox> pListBox; // the ListBox inside the same (you can get the TabWin and the WinName out of it)
SvTreeListEntry* pEntry; // the entry, which was dragged or to which was dropped on
OJoinExchangeData(OTableWindowListBox* pBox);
@@ -56,7 +56,7 @@ namespace dbaui
Timer m_aScrollTimer;
Point m_aMousePos;
- OTableWindow* m_pTabWin;
+ VclPtr<OTableWindow> m_pTabWin;
ImplSVEvent * m_nDropEvent;
ImplSVEvent * m_nUiEvent;
OJoinDropData m_aDropInfo;
@@ -78,6 +78,7 @@ namespace dbaui
public:
OTableWindowListBox(OTableWindow* pParent);
virtual ~OTableWindowListBox();
+ virtual void dispose() SAL_OVERRIDE;
// DnD stuff
virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/TableWindowTitle.hxx b/dbaccess/source/ui/inc/TableWindowTitle.hxx
index 77ac0d4ce89f..3d009e3c603e 100644
--- a/dbaccess/source/ui/inc/TableWindowTitle.hxx
+++ b/dbaccess/source/ui/inc/TableWindowTitle.hxx
@@ -26,7 +26,7 @@ namespace dbaui
class OTableWindow;
class OTableWindowTitle : public FixedText
{
- OTableWindow* m_pTabWin;
+ VclPtr<OTableWindow> m_pTabWin;
protected:
virtual void Command(const CommandEvent& rEvt) SAL_OVERRIDE;
@@ -38,6 +38,7 @@ namespace dbaui
public:
OTableWindowTitle( OTableWindow* pParent );
virtual ~OTableWindowTitle();
+ virtual void dispose() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/TablesSingleDlg.hxx b/dbaccess/source/ui/inc/TablesSingleDlg.hxx
index 7b0bf1651d2a..51977b928e4c 100644
--- a/dbaccess/source/ui/inc/TablesSingleDlg.hxx
+++ b/dbaccess/source/ui/inc/TablesSingleDlg.hxx
@@ -55,6 +55,7 @@ class ODbDataSourceAdministrationHelper;
,const ::com::sun::star::uno::Any& _aDataSourceName
);
virtual ~OTableSubscriptionDialog();
+ virtual void dispose() SAL_OVERRIDE;
// forwards from ODbDataSourceAdministrationHelper
void successfullyConnected();
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
index 6e0cc172a7b7..35b81ad01ea4 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -196,7 +196,7 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > m_xTargetResultSetUpdate;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate > m_xTargetRowUpdate;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xTargetResultSetMetaData;
- vcl::Window* m_pParent;
+ VclPtr<vcl::Window> m_pParent;
bool m_bAlreadyAsked;
bool insertNewRow();
diff --git a/dbaccess/source/ui/inc/UserAdminDlg.hxx b/dbaccess/source/ui/inc/UserAdminDlg.hxx
index a003fe898e3e..cc2df632a9f5 100644
--- a/dbaccess/source/ui/inc/UserAdminDlg.hxx
+++ b/dbaccess/source/ui/inc/UserAdminDlg.hxx
@@ -60,6 +60,7 @@ namespace dbaui
,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection);
virtual ~OUserAdminDlg();
+ virtual void dispose() SAL_OVERRIDE;
virtual const SfxItemSet* getOutputSet() const SAL_OVERRIDE;
virtual SfxItemSet* getWriteOutputSet() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/VertSplitView.hxx b/dbaccess/source/ui/inc/VertSplitView.hxx
index 4a91f47e05d5..ac7bde548eed 100644
--- a/dbaccess/source/ui/inc/VertSplitView.hxx
+++ b/dbaccess/source/ui/inc/VertSplitView.hxx
@@ -27,9 +27,9 @@ namespace dbaui
{
class OSplitterView : public vcl::Window
{
- Splitter* m_pSplitter;
- vcl::Window* m_pLeft;
- vcl::Window* m_pRight;
+ VclPtr<Splitter> m_pSplitter;
+ VclPtr<vcl::Window> m_pLeft;
+ VclPtr<vcl::Window> m_pRight;
bool m_bVertical;
void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
@@ -40,6 +40,7 @@ namespace dbaui
OSplitterView(vcl::Window* _pParent,bool _bVertical = true);
virtual ~OSplitterView();
// Window overrides
+ virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
void setSplitter(Splitter* _pSplitter);
diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx
index e99fcf810529..008a9376ce01 100644
--- a/dbaccess/source/ui/inc/WCPage.hxx
+++ b/dbaccess/source/ui/inc/WCPage.hxx
@@ -34,19 +34,19 @@ namespace dbaui
class OCopyTable : public OWizardPage
{
protected:
- Edit* m_pEdTableName;
- RadioButton* m_pRB_DefData;
- RadioButton* m_pRB_Def;
- RadioButton* m_pRB_View;
- RadioButton* m_pRB_AppendData;
- CheckBox* m_pCB_UseHeaderLine;
- CheckBox* m_pCB_PrimaryColumn;
- FixedText* m_pFT_KeyName;
- Edit* m_pEdKeyName;
+ VclPtr<Edit> m_pEdTableName;
+ VclPtr<RadioButton> m_pRB_DefData;
+ VclPtr<RadioButton> m_pRB_Def;
+ VclPtr<RadioButton> m_pRB_View;
+ VclPtr<RadioButton> m_pRB_AppendData;
+ VclPtr<CheckBox> m_pCB_UseHeaderLine;
+ VclPtr<CheckBox> m_pCB_PrimaryColumn;
+ VclPtr<FixedText> m_pFT_KeyName;
+ VclPtr<Edit> m_pEdKeyName;
sal_Int16 m_nOldOperation;
- OWizColumnSelect* m_pPage2;
- OWizNormalExtend* m_pPage3;
+ VclPtr<OWizColumnSelect> m_pPage2;
+ VclPtr<OWizNormalExtend> m_pPage3;
bool m_bPKeyAllowed;
bool m_bUseHeaderAllowed;
@@ -66,6 +66,7 @@ namespace dbaui
OCopyTable( vcl::Window * pParent );
virtual ~OCopyTable();
+ virtual void dispose() SAL_OVERRIDE;
bool IsOptionDefData() const { return m_pRB_DefData->IsChecked(); }
bool IsOptionDef() const { return m_pRB_Def->IsChecked(); }
diff --git a/dbaccess/source/ui/inc/WColumnSelect.hxx b/dbaccess/source/ui/inc/WColumnSelect.hxx
index 98f029c6c665..9b08f6b97f0d 100644
--- a/dbaccess/source/ui/inc/WColumnSelect.hxx
+++ b/dbaccess/source/ui/inc/WColumnSelect.hxx
@@ -35,12 +35,12 @@ namespace dbaui
class OWizColumnSelect : public OWizardPage
{
- ListBox* m_pOrgColumnNames; // left side
- PushButton* m_pColumn_RH;
- PushButton* m_pColumns_RH;
- PushButton* m_pColumn_LH;
- PushButton* m_pColumns_LH;
- ListBox* m_pNewColumnNames; // right side
+ VclPtr<ListBox> m_pOrgColumnNames; // left side
+ VclPtr<PushButton> m_pColumn_RH;
+ VclPtr<PushButton> m_pColumns_RH;
+ VclPtr<PushButton> m_pColumn_LH;
+ VclPtr<PushButton> m_pColumns_LH;
+ VclPtr<ListBox> m_pNewColumnNames; // right side
DECL_LINK( ButtonClickHdl, Button * );
DECL_LINK( ListDoubleClickHdl, ListBox * );
@@ -80,6 +80,7 @@ namespace dbaui
OWizColumnSelect(vcl::Window* pParent);
virtual ~OWizColumnSelect();
+ virtual void dispose() SAL_OVERRIDE;
};
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WCOLUMNSELECT_HXX
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index 32fa0a79e9cc..8a10f01cc795 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -238,11 +238,11 @@ namespace dbaui
ODatabaseExport::TColumns m_vSourceColumns;
ODatabaseExport::TColumnVector m_vSourceVec;
- HelpButton* m_pbHelp;
- CancelButton* m_pbCancel;
- PushButton* m_pbPrev;
- PushButton* m_pbNext;
- PushButton* m_pbFinish;
+ VclPtr<HelpButton> m_pbHelp;
+ VclPtr<CancelButton> m_pbCancel;
+ VclPtr<PushButton> m_pbPrev;
+ VclPtr<PushButton> m_pbNext;
+ VclPtr<PushButton> m_pbFinish;
OTypeInfoMap m_aTypeInfo;
::std::vector<OTypeInfoMap::iterator> m_aTypeInfoIndex;
@@ -323,6 +323,7 @@ namespace dbaui
);
virtual ~OCopyTableWizard();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool DeactivatePage() SAL_OVERRIDE;
OKButton& GetOKButton() { return static_cast<OKButton&>(*m_pbFinish); }
diff --git a/dbaccess/source/ui/inc/WExtendPages.hxx b/dbaccess/source/ui/inc/WExtendPages.hxx
index e9d19621457f..e51abe09a9bd 100644
--- a/dbaccess/source/ui/inc/WExtendPages.hxx
+++ b/dbaccess/source/ui/inc/WExtendPages.hxx
@@ -35,9 +35,7 @@ namespace dbaui
{
}
- static OWizTypeSelect* Create( vcl::Window* _pParent, SvStream& _rInput ) { return new OWizHTMLExtend( _pParent, _rInput ); }
-
- virtual ~OWizHTMLExtend(){}
+ static VclPtr<OWizTypeSelect> Create( vcl::Window* _pParent, SvStream& _rInput ) { return VclPtr<OWizHTMLExtend>::Create( _pParent, _rInput ); }
};
// Wizard Page: OWizRTFExtend
class OWizRTFExtend : public OWizTypeSelect
@@ -50,9 +48,7 @@ namespace dbaui
{
}
- static OWizTypeSelect* Create( vcl::Window* _pParent, SvStream& _rInput ) { return new OWizRTFExtend( _pParent, _rInput ); }
-
- virtual ~OWizRTFExtend(){}
+ static VclPtr<OWizTypeSelect> Create( vcl::Window* _pParent, SvStream& _rInput ) { return VclPtr<OWizRTFExtend>::Create( _pParent, _rInput ); }
};
// Wizard Page: OWizNormalExtend
diff --git a/dbaccess/source/ui/inc/WNameMatch.hxx b/dbaccess/source/ui/inc/WNameMatch.hxx
index 3feb7dc28e01..61f71b56ce47 100644
--- a/dbaccess/source/ui/inc/WNameMatch.hxx
+++ b/dbaccess/source/ui/inc/WNameMatch.hxx
@@ -50,16 +50,16 @@ namespace dbaui
// Name matching for data appending
class OWizNameMatching : public OWizardPage
{
- FixedText *m_pTABLE_LEFT;
- FixedText *m_pTABLE_RIGHT;
- OColumnTreeBox *m_pCTRL_LEFT; // left side
- OColumnTreeBox *m_pCTRL_RIGHT; // right side
- PushButton *m_pColumn_up;
- PushButton *m_pColumn_down;
- PushButton *m_pColumn_up_right;
- PushButton *m_pColumn_down_right;
- PushButton *m_pAll;
- PushButton *m_pNone;
+ VclPtr<FixedText> m_pTABLE_LEFT;
+ VclPtr<FixedText> m_pTABLE_RIGHT;
+ VclPtr<OColumnTreeBox> m_pCTRL_LEFT; // left side
+ VclPtr<OColumnTreeBox> m_pCTRL_RIGHT; // right side
+ VclPtr<PushButton> m_pColumn_up;
+ VclPtr<PushButton> m_pColumn_down;
+ VclPtr<PushButton> m_pColumn_up_right;
+ VclPtr<PushButton> m_pColumn_down_right;
+ VclPtr<PushButton> m_pAll;
+ VclPtr<PushButton> m_pNone;
OUString m_sSourceText;
OUString m_sDestText;
Image m_aImgUp;
@@ -79,7 +79,7 @@ namespace dbaui
OWizNameMatching(vcl::Window* pParent);
virtual ~OWizNameMatching();
-
+ virtual void dispose() SAL_OVERRIDE;
};
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WNAMEMATCH_HXX
diff --git a/dbaccess/source/ui/inc/WTabPage.hxx b/dbaccess/source/ui/inc/WTabPage.hxx
index 9a30d7c311fb..6a5d3ab48eb1 100644
--- a/dbaccess/source/ui/inc/WTabPage.hxx
+++ b/dbaccess/source/ui/inc/WTabPage.hxx
@@ -29,12 +29,14 @@ namespace dbaui
class OWizardPage : public TabPage
{
protected:
- OCopyTableWizard* m_pParent;
+ VclPtr<OCopyTableWizard> m_pParent;
bool m_bFirstTime; // Page wird das erste mal gerufen ; should be set in the reset methode
OWizardPage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription );
public:
+ virtual ~OWizardPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Reset ( ) = 0;
virtual bool LeavePage() = 0;
virtual OUString GetTitle() const = 0;
diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx
index 5f587481e867..d86c70e5f07a 100644
--- a/dbaccess/source/ui/inc/WTypeSelect.hxx
+++ b/dbaccess/source/ui/inc/WTypeSelect.hxx
@@ -37,7 +37,7 @@ namespace dbaui
class OWizTypeSelectControl : public OFieldDescControl
{
protected:
- vcl::Window* m_pParentTabPage;
+ VclPtr<vcl::Window> m_pParentTabPage;
virtual void ActivateAggregate( EControlType eType ) SAL_OVERRIDE;
virtual void DeactivateAggregate( EControlType eType ) SAL_OVERRIDE;
@@ -53,6 +53,7 @@ namespace dbaui
public:
OWizTypeSelectControl(vcl::Window* pParent, vcl::Window* pParentTabPage, OTableDesignHelpBar* pHelpBar=NULL);
virtual ~OWizTypeSelectControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() SAL_OVERRIDE;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() SAL_OVERRIDE;
@@ -69,13 +70,15 @@ namespace dbaui
bool _bSet = false);
protected:
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
- vcl::Window* m_pParentTabPage;
+ VclPtr<vcl::Window> m_pParentTabPage;
public:
OWizTypeSelectList( vcl::Window* pParent, WinBits nStyle = WB_BORDER )
: MultiListBox(pParent,nStyle)
, m_bPKey(false)
, m_pParentTabPage(NULL)
{}
+ virtual ~OWizTypeSelectList();
+ virtual void dispose() SAL_OVERRIDE;
void SetPKey(bool bPKey) { m_bPKey = bPKey; }
void SetParentTabPage(vcl::Window* pParentTabPage) { m_pParentTabPage = pParentTabPage; }
};
@@ -91,13 +94,13 @@ namespace dbaui
DECL_LINK( ColumnSelectHdl, MultiListBox* );
DECL_LINK( ButtonClickHdl, Button * );
protected:
- OWizTypeSelectList *m_pColumnNames;
- FixedText *m_pColumns;
- OWizTypeSelectControl *m_pTypeControl;
- FixedText *m_pAutoType;
- FixedText *m_pAutoFt;
- NumericField *m_pAutoEt;
- PushButton *m_pAutoPb;
+ VclPtr<OWizTypeSelectList> m_pColumnNames;
+ VclPtr<FixedText> m_pColumns;
+ VclPtr<OWizTypeSelectControl> m_pTypeControl;
+ VclPtr<FixedText> m_pAutoType;
+ VclPtr<FixedText> m_pAutoFt;
+ VclPtr<NumericField> m_pAutoEt;
+ VclPtr<PushButton> m_pAutoPb;
Image m_imgPKey;
SvStream* m_pParserStream; // stream to read the tokens from or NULL
@@ -118,12 +121,13 @@ namespace dbaui
OWizTypeSelect(vcl::Window* pParent, SvStream* _pStream = NULL );
virtual ~OWizTypeSelect();
+ virtual void dispose() SAL_OVERRIDE;
inline void setDisplayRow(sal_Int32 _nRow) { m_nDisplayRow = _nRow - 1; }
inline void setDuplicateName(bool _bDuplicateName) { m_bDuplicateName = _bDuplicateName; }
};
- typedef OWizTypeSelect* (*TypeSelectionPageFactory)( vcl::Window*, SvStream& );
+ typedef VclPtr<OWizTypeSelect> (*TypeSelectionPageFactory)( vcl::Window*, SvStream& );
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
diff --git a/dbaccess/source/ui/inc/adtabdlg.hxx b/dbaccess/source/ui/inc/adtabdlg.hxx
index 360ee70fa9eb..815f8c4d566a 100644
--- a/dbaccess/source/ui/inc/adtabdlg.hxx
+++ b/dbaccess/source/ui/inc/adtabdlg.hxx
@@ -58,15 +58,15 @@ namespace dbaui
class OAddTableDlg : public ModelessDialog
{
- RadioButton* m_pCaseTables;
- RadioButton* m_pCaseQueries;
+ VclPtr<RadioButton> m_pCaseTables;
+ VclPtr<RadioButton> m_pCaseQueries;
- OTableTreeListBox* m_pTableList;
- SvTreeListBox* m_pQueryList;
+ VclPtr<OTableTreeListBox> m_pTableList;
+ VclPtr<SvTreeListBox> m_pQueryList;
boost::scoped_ptr< TableObjectListFacade > m_xCurrentList;
- PushButton* m_pAddButton;
- PushButton* m_pCloseButton;
+ VclPtr<PushButton> m_pAddButton;
+ VclPtr<PushButton> m_pCloseButton;
IAddTableDialogContext& m_rContext;
@@ -81,6 +81,7 @@ namespace dbaui
vcl::Window* _pParent,
IAddTableDialogContext& _rContext );
virtual ~OAddTableDlg();
+ virtual void dispose() SAL_OVERRIDE;
void DetermineAddTable() { m_pAddButton->Enable( impl_isAddAllowed() ); }
void Update();
diff --git a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
index 108467ac78f8..2ba76b55466c 100644
--- a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
+++ b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
@@ -51,6 +51,7 @@ namespace dbaui
,const ::com::sun::star::uno::Any& _aDataSourceName);
virtual ~AdvancedSettingsDialog();
+ virtual void dispose() SAL_OVERRIDE;
/// determines whether or not the given data source type has any advanced setting
static bool doesHaveAnyAdvancedSettings( const OUString& _sURL );
diff --git a/dbaccess/source/ui/inc/brwview.hxx b/dbaccess/source/ui/inc/brwview.hxx
index a214e462e08e..e68ff09847c4 100644
--- a/dbaccess/source/ui/inc/brwview.hxx
+++ b/dbaccess/source/ui/inc/brwview.hxx
@@ -46,10 +46,10 @@ namespace dbaui
protected:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > m_xGrid; // our grid's UNO representation
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xMe; // our own UNO representation
- DBTreeView* m_pTreeView;
- Splitter* m_pSplitter;
- mutable SbaGridControl* m_pVclControl; // our grid's VCL representation
- vcl::Window* m_pStatus;
+ VclPtr<DBTreeView> m_pTreeView;
+ VclPtr<Splitter> m_pSplitter;
+ mutable VclPtr<SbaGridControl> m_pVclControl; // our grid's VCL representation
+ VclPtr<vcl::Window> m_pStatus;
DECL_LINK( SplitHdl, void* );
// attribute access
@@ -62,6 +62,7 @@ namespace dbaui
IController& _rController,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
virtual ~UnoDataBrowserView();
+ virtual void dispose() SAL_OVERRIDE;
/// late construction
void Construct(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel);
@@ -93,7 +94,7 @@ namespace dbaui
class BrowserViewStatusDisplay
{
protected:
- UnoDataBrowserView* m_pView;
+ VclPtr<UnoDataBrowserView> m_pView;
public:
BrowserViewStatusDisplay( UnoDataBrowserView* _pView, const OUString& _rStatus );
diff --git a/dbaccess/source/ui/inc/charsetlistbox.hxx b/dbaccess/source/ui/inc/charsetlistbox.hxx
index 78f2da4f4a28..02641062174a 100644
--- a/dbaccess/source/ui/inc/charsetlistbox.hxx
+++ b/dbaccess/source/ui/inc/charsetlistbox.hxx
@@ -34,7 +34,6 @@ namespace dbaui
{
public:
CharSetListBox( vcl::Window* _pParent, WinBits _nBits );
- virtual ~CharSetListBox();
void SelectEntryByIanaName( const OUString& _rIanaName );
bool StoreSelectedCharSet( SfxItemSet& _rSet, const sal_uInt16 _nItemId );
diff --git a/dbaccess/source/ui/inc/curledit.hxx b/dbaccess/source/ui/inc/curledit.hxx
index cb9201328ada..4dff5e14ca9f 100644
--- a/dbaccess/source/ui/inc/curledit.hxx
+++ b/dbaccess/source/ui/inc/curledit.hxx
@@ -36,13 +36,14 @@ class OConnectionURLEdit : public Edit
{
::dbaccess::ODsnTypeCollection*
m_pTypeCollection;
- FixedText* m_pForcedPrefix;
+ VclPtr<FixedText> m_pForcedPrefix;
OUString m_sSaveValueNoPrefix;
bool m_bShowPrefix; // when <TRUE> the prefix will be visible, otherwise not
public:
OConnectionURLEdit(vcl::Window* pParent, WinBits _nBits,bool _bShowPrefix = false);
virtual ~OConnectionURLEdit();
+ virtual void dispose() SAL_OVERRIDE;
public:
// Edit overridables
diff --git a/dbaccess/source/ui/inc/datasourceconnector.hxx b/dbaccess/source/ui/inc/datasourceconnector.hxx
index f5d64a0f48cd..c5459ecbe15b 100644
--- a/dbaccess/source/ui/inc/datasourceconnector.hxx
+++ b/dbaccess/source/ui/inc/datasourceconnector.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <vcl/vclptr.hxx>
namespace dbtools
{
@@ -38,10 +39,10 @@ namespace dbaui
class ODatasourceConnector
{
protected:
- vcl::Window* m_pErrorMessageParent;
+ VclPtr<vcl::Window> m_pErrorMessageParent;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
- m_xContext;
- OUString m_sContextInformation;
+ m_xContext;
+ OUString m_sContextInformation;
public:
ODatasourceConnector(
diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx
index 7c437d6f1ab7..0510cd6fa10d 100644
--- a/dbaccess/source/ui/inc/dbadmin.hxx
+++ b/dbaccess/source/ui/inc/dbadmin.hxx
@@ -66,6 +66,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB
);
virtual ~ODbAdminDialog();
+ virtual void dispose() SAL_OVERRIDE;
/** create and return an item set for use with the dialog.
@param _pTypeCollection pointer to an <type>ODatasourceMap</type>. May be NULL, in this case
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
index 0a5b71da3809..cbeb1b6e540f 100644
--- a/dbaccess/source/ui/inc/dbtreelistbox.hxx
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -84,6 +84,7 @@ namespace dbaui
,WinBits nWinStyle=0
,bool _bHandleEnterKey = false);
virtual ~DBTreeListBox();
+ virtual void dispose() SAL_OVERRIDE;
void setControlActionListener( IControlActionListener* _pListener ) { m_pActionListener = _pListener; }
void setContextMenuProvider( IContextMenuProvider* _pContextMenuProvider ) { m_pContextMenuProvider = _pContextMenuProvider; }
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index d86e027a0092..ce534eba107d 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -76,6 +76,7 @@ public:
,const ::com::sun::star::uno::Any& _aDataSourceName
);
virtual ~ODbTypeWizDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual const SfxItemSet* getOutputSet() const SAL_OVERRIDE;
virtual SfxItemSet* getWriteOutputSet() SAL_OVERRIDE;
@@ -92,7 +93,7 @@ public:
protected:
/// to override to create new pages
- virtual TabPage* createPage(WizardState _nState) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage(WizardState _nState) SAL_OVERRIDE;
virtual WizardState determineNextState(WizardState _nCurrentState) const SAL_OVERRIDE;
virtual bool leaveState(WizardState _nState) SAL_OVERRIDE;
virtual ::svt::IWizardPageController*
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index 734f967e7ef8..79926668b5d5 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -85,9 +85,9 @@ private:
OUString m_sRM_FinalText;
INetURLObject m_aDocURL;
OUString m_sWorkPath;
- OGeneralPageWizard* m_pGeneralPage;
- OMySQLIntroPageSetup* m_pMySQLIntroPage;
- OFinalDBPageSetup* m_pFinalPage;
+ VclPtr<OGeneralPageWizard> m_pGeneralPage;
+ VclPtr<OMySQLIntroPageSetup> m_pMySQLIntroPage;
+ VclPtr<OFinalDBPageSetup> m_pFinalPage;
::dbaccess::ODsnTypeCollection*
m_pCollection; /// the DSN type collection instance
@@ -102,6 +102,7 @@ public:
,const ::com::sun::star::uno::Any& _aDataSourceName
);
virtual ~ODbTypeWizDialogSetup();
+ virtual void dispose() SAL_OVERRIDE;
virtual const SfxItemSet* getOutputSet() const SAL_OVERRIDE;
virtual SfxItemSet* getWriteOutputSet() SAL_OVERRIDE;
@@ -127,7 +128,7 @@ public:
protected:
/// to override to create new pages
- virtual TabPage* createPage(WizardState _nState) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage(WizardState _nState) SAL_OVERRIDE;
virtual bool leaveState(WizardState _nState) SAL_OVERRIDE;
virtual void enterState(WizardState _nState) SAL_OVERRIDE;
virtual ::svt::IWizardPageController* getPageController( TabPage* _pCurrentPage ) const SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx
index 401b46df7f8e..60a5d05f6b84 100644
--- a/dbaccess/source/ui/inc/directsql.hxx
+++ b/dbaccess/source/ui/inc/directsql.hxx
@@ -49,13 +49,13 @@ namespace dbaui
OModuleClient m_aModuleClient;
::osl::Mutex m_aMutex;
- MultiLineEditSyntaxHighlight* m_pSQL;
- PushButton* m_pExecute;
- ListBox* m_pSQLHistory;
- VclMultiLineEdit* m_pStatus;
- CheckBox* m_pShowOutput;
- VclMultiLineEdit* m_pOutput;
- PushButton* m_pClose;
+ VclPtr<MultiLineEditSyntaxHighlight> m_pSQL;
+ VclPtr<PushButton> m_pExecute;
+ VclPtr<ListBox> m_pSQLHistory;
+ VclPtr<VclMultiLineEdit> m_pStatus;
+ VclPtr<CheckBox> m_pShowOutput;
+ VclPtr<VclMultiLineEdit> m_pOutput;
+ VclPtr<PushButton> m_pClose;
typedef ::std::deque< OUString > StringQueue;
StringQueue m_aStatementHistory; // previous statements
@@ -72,6 +72,7 @@ namespace dbaui
vcl::Window* _pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn);
virtual ~DirectSQLDialog();
+ virtual void dispose() SAL_OVERRIDE;
/// number of history entries
sal_Int32 getHistorySize() const;
diff --git a/dbaccess/source/ui/inc/dlgattr.hxx b/dbaccess/source/ui/inc/dlgattr.hxx
index b6614cf62701..4bf07d1b3406 100644
--- a/dbaccess/source/ui/inc/dlgattr.hxx
+++ b/dbaccess/source/ui/inc/dlgattr.hxx
@@ -35,6 +35,7 @@ namespace dbaui
public:
SbaSbAttrDlg(vcl::Window * pParent, const SfxItemSet*, SvNumberFormatter*, bool bHasFormat, bool bRow = false);
virtual ~SbaSbAttrDlg();
+ virtual void dispose() SAL_OVERRIDE;
virtual void PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) SAL_OVERRIDE;
};
diff --git a/dbaccess/source/ui/inc/dlgsave.hxx b/dbaccess/source/ui/inc/dlgsave.hxx
index 5217e1fcb0a0..38c0f5b7c2d8 100644
--- a/dbaccess/source/ui/inc/dlgsave.hxx
+++ b/dbaccess/source/ui/inc/dlgsave.hxx
@@ -66,6 +66,7 @@ namespace dbaui
const IObjectNameCheck& _rObjectNameCheck,
sal_Int32 _nFlags = SAD_DEFAULT | SAD_TITLE_STORE_AS);
virtual ~OSaveAsDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString getName() const;
OUString getCatalog() const;
diff --git a/dbaccess/source/ui/inc/dlgsize.hxx b/dbaccess/source/ui/inc/dlgsize.hxx
index e145cf7675ad..1d51ed11a534 100644
--- a/dbaccess/source/ui/inc/dlgsize.hxx
+++ b/dbaccess/source/ui/inc/dlgsize.hxx
@@ -39,11 +39,13 @@ namespace dbaui
protected:
DECL_LINK( CbClickHdl, Button * );
- MetricField* m_pMF_VALUE;
- CheckBox* m_pCB_STANDARD;
+ VclPtr<MetricField> m_pMF_VALUE;
+ VclPtr<CheckBox> m_pCB_STANDARD;
public:
DlgSize( vcl::Window * pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nAlternativeStandard = -1 );
+ virtual ~DlgSize();
+ virtual void dispose() SAL_OVERRIDE;
sal_Int32 GetValue();
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/inc/indexdialog.hxx b/dbaccess/source/ui/inc/indexdialog.hxx
index f204c8c3cf89..bd595e012263 100644
--- a/dbaccess/source/ui/inc/indexdialog.hxx
+++ b/dbaccess/source/ui/inc/indexdialog.hxx
@@ -85,15 +85,15 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
SvtViewOptions m_aGeometrySettings;
- ToolBox *m_pActions;
- DbaIndexList *m_pIndexList;
- FixedText *m_pIndexDetails;
- FixedText *m_pDescriptionLabel;
- FixedText *m_pDescription;
- CheckBox *m_pUnique;
- FixedText *m_pFieldsLabel;
- IndexFieldsControl *m_pFields;
- PushButton *m_pClose;
+ VclPtr<ToolBox> m_pActions;
+ VclPtr<DbaIndexList> m_pIndexList;
+ VclPtr<FixedText> m_pIndexDetails;
+ VclPtr<FixedText> m_pDescriptionLabel;
+ VclPtr<FixedText> m_pDescription;
+ VclPtr<CheckBox> m_pUnique;
+ VclPtr<FixedText> m_pFieldsLabel;
+ VclPtr<IndexFieldsControl> m_pFields;
+ VclPtr<PushButton> m_pClose;
OIndexCollection* m_pIndexes;
SvTreeListEntry* m_pPreviousSelection;
@@ -111,6 +111,7 @@ namespace dbaui
sal_Int32 _nMaxColumnsInIndex
);
virtual ~DbaIndexDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/indexfieldscontrol.hxx b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
index fb1347d2b3eb..3f262156d129 100644
--- a/dbaccess/source/ui/inc/indexfieldscontrol.hxx
+++ b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
@@ -40,8 +40,8 @@ namespace dbaui
Link m_aModifyHdl;
- ::svt::ListBoxControl* m_pSortingCell;
- ::svt::ListBoxControl* m_pFieldNameCell;
+ VclPtr<::svt::ListBoxControl> m_pSortingCell;
+ VclPtr<::svt::ListBoxControl> m_pFieldNameCell;
OUString m_sAscendingText;
OUString m_sDescendingText;
@@ -52,6 +52,7 @@ namespace dbaui
public:
IndexFieldsControl( vcl::Window* _pParent, WinBits nWinStyle);
virtual ~IndexFieldsControl();
+ virtual void dispose() SAL_OVERRIDE;
void Init(const ::com::sun::star::uno::Sequence< OUString >& _rAvailableFields, sal_Int32 _nMaxColumnsInIndex,bool _bAddIndexAppendix);
diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx
index 7c597b24624e..a13383b71955 100644
--- a/dbaccess/source/ui/inc/linkeddocuments.hxx
+++ b/dbaccess/source/ui/inc/linkeddocuments.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
#include <comphelper/namedvaluecollection.hxx>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
namespace dbaui
@@ -49,7 +50,7 @@ namespace dbaui
m_xConnection;
::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >
m_xDocumentUI;
- vcl::Window* m_pDialogParent;
+ VclPtr<vcl::Window> m_pDialogParent;
OUString m_sCurrentlyEditing;
OUString m_sDataSourceName;
diff --git a/dbaccess/source/ui/inc/marktree.hxx b/dbaccess/source/ui/inc/marktree.hxx
index 2e10a99b82c6..f39d5281ffde 100644
--- a/dbaccess/source/ui/inc/marktree.hxx
+++ b/dbaccess/source/ui/inc/marktree.hxx
@@ -40,6 +40,7 @@ class OMarkableTreeListBox : public DBTreeListBox
public:
OMarkableTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 );
virtual ~OMarkableTreeListBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void CheckButtonHdl() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/paramdialog.hxx b/dbaccess/source/ui/inc/paramdialog.hxx
index edc37862a366..11db9808841f 100644
--- a/dbaccess/source/ui/inc/paramdialog.hxx
+++ b/dbaccess/source/ui/inc/paramdialog.hxx
@@ -52,11 +52,11 @@ namespace dbaui
{
protected:
// the controls
- ListBox* m_pAllParams;
- Edit* m_pParam;
- PushButton* m_pTravelNext;
- OKButton* m_pOKBtn;
- CancelButton* m_pCancelBtn;
+ VclPtr<ListBox> m_pAllParams;
+ VclPtr<Edit> m_pParam;
+ VclPtr<PushButton> m_pTravelNext;
+ VclPtr<OKButton> m_pOKBtn;
+ VclPtr<CancelButton> m_pCancelBtn;
sal_Int32 m_nCurrentlySelected;
@@ -84,6 +84,7 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > & _rxConnection,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext);
virtual ~OParameterDialog();
+ virtual void dispose() SAL_OVERRIDE;
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
getValues() const { return m_aFinalValues; }
diff --git a/dbaccess/source/ui/inc/querycontainerwindow.hxx b/dbaccess/source/ui/inc/querycontainerwindow.hxx
index 646c5e1488a9..5c1e151aedbe 100644
--- a/dbaccess/source/ui/inc/querycontainerwindow.hxx
+++ b/dbaccess/source/ui/inc/querycontainerwindow.hxx
@@ -42,14 +42,15 @@ namespace dbaui
class OQueryContainerWindow : public ODataView
{
OQueryViewSwitch* m_pViewSwitch;
- OBeamer* m_pBeamer;
- Splitter* m_pSplitter;
+ VclPtr<OBeamer> m_pBeamer;
+ VclPtr<Splitter> m_pSplitter;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame2 > m_xBeamer;
DECL_LINK( SplitHdl, void* );
public:
OQueryContainerWindow(vcl::Window* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
virtual ~OQueryContainerWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Construct() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/queryfilter.hxx b/dbaccess/source/ui/inc/queryfilter.hxx
index b9d76cccca97..06cc9510080f 100644
--- a/dbaccess/source/ui/inc/queryfilter.hxx
+++ b/dbaccess/source/ui/inc/queryfilter.hxx
@@ -67,19 +67,19 @@ namespace dbaui
,public ::svxform::OParseContextClient
{
private:
- ListBox* m_pLB_WHEREFIELD1;
- ListBox* m_pLB_WHERECOMP1;
- Edit* m_pET_WHEREVALUE1;
+ VclPtr<ListBox> m_pLB_WHEREFIELD1;
+ VclPtr<ListBox> m_pLB_WHERECOMP1;
+ VclPtr<Edit> m_pET_WHEREVALUE1;
- ListBox* m_pLB_WHERECOND2;
- ListBox* m_pLB_WHEREFIELD2;
- ListBox* m_pLB_WHERECOMP2;
- Edit* m_pET_WHEREVALUE2;
+ VclPtr<ListBox> m_pLB_WHERECOND2;
+ VclPtr<ListBox> m_pLB_WHEREFIELD2;
+ VclPtr<ListBox> m_pLB_WHERECOMP2;
+ VclPtr<Edit> m_pET_WHEREVALUE2;
- ListBox* m_pLB_WHERECOND3;
- ListBox* m_pLB_WHEREFIELD3;
- ListBox* m_pLB_WHERECOMP3;
- Edit* m_pET_WHEREVALUE3;
+ VclPtr<ListBox> m_pLB_WHERECOND3;
+ VclPtr<ListBox> m_pLB_WHEREFIELD3;
+ VclPtr<ListBox> m_pLB_WHERECOMP3;
+ VclPtr<Edit> m_pET_WHEREVALUE3;
OUString m_aSTR_COMPARE_OPERATORS;
@@ -113,6 +113,7 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _rxCols
);
virtual ~DlgFilterCrit();
+ virtual void dispose() SAL_OVERRIDE;
void BuildWherePart();
diff --git a/dbaccess/source/ui/inc/queryorder.hxx b/dbaccess/source/ui/inc/queryorder.hxx
index 007c42966a6a..46da94464b53 100644
--- a/dbaccess/source/ui/inc/queryorder.hxx
+++ b/dbaccess/source/ui/inc/queryorder.hxx
@@ -59,12 +59,12 @@ namespace dbaui
class DlgOrderCrit : public ModalDialog
{
protected:
- ListBox* m_pLB_ORDERFIELD1;
- ListBox* m_pLB_ORDERVALUE1;
- ListBox* m_pLB_ORDERFIELD2;
- ListBox* m_pLB_ORDERVALUE2;
- ListBox* m_pLB_ORDERFIELD3;
- ListBox* m_pLB_ORDERVALUE3;
+ VclPtr<ListBox> m_pLB_ORDERFIELD1;
+ VclPtr<ListBox> m_pLB_ORDERVALUE1;
+ VclPtr<ListBox> m_pLB_ORDERFIELD2;
+ VclPtr<ListBox> m_pLB_ORDERVALUE2;
+ VclPtr<ListBox> m_pLB_ORDERFIELD3;
+ VclPtr<ListBox> m_pLB_ORDERVALUE3;
OUString aSTR_NOENTRY;
OUString m_sOrgOrder;
@@ -72,8 +72,8 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection;
- ListBox* m_aColumnList[DOG_ROWS];
- ListBox* m_aValueList[DOG_ROWS];
+ VclPtr<ListBox> m_aColumnList[DOG_ROWS];
+ VclPtr<ListBox> m_aValueList[DOG_ROWS];
DECL_LINK( FieldListSelectHdl, ListBox * );
void EnableLines();
@@ -83,8 +83,9 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConnection,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer>& _rxComposer,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _rxCols);
+ virtual ~DlgOrderCrit();
+ virtual void dispose() SAL_OVERRIDE;
- virtual ~DlgOrderCrit();
void BuildOrderPart();
OUString GetOrderList( ) const;
diff --git a/dbaccess/source/ui/inc/queryview.hxx b/dbaccess/source/ui/inc/queryview.hxx
index 0a05a3153b40..645525ca8874 100644
--- a/dbaccess/source/ui/inc/queryview.hxx
+++ b/dbaccess/source/ui/inc/queryview.hxx
@@ -28,7 +28,6 @@ namespace dbaui
{
public:
OQueryView(vcl::Window* pParent, OQueryController& _rController,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
- virtual ~OQueryView();
virtual bool isCutAllowed() = 0;
virtual bool isPasteAllowed() = 0;
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
index 443ed2791a48..25292c90231e 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -127,7 +127,7 @@ namespace dbaui
virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
protected:
- virtual FmGridControl* imp_CreateControl(vcl::Window* pParent, WinBits nStyle) SAL_OVERRIDE;
+ virtual VclPtr<FmGridControl> imp_CreateControl(vcl::Window* pParent, WinBits nStyle) SAL_OVERRIDE;
#ifdef _MSC_VER
typedef ::com::sun::star::frame::XStatusListener xstlist_type;
typedef ::com::sun::star::uno::Reference< xstlist_type > xlistener_type;
@@ -231,6 +231,7 @@ namespace dbaui
public:
SbaGridControl(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >,Window* pParent, FmXGridPeer* _pPeer, WinBits nBits = WB_TABSTOP);
virtual ~SbaGridControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
virtual void Select() SAL_OVERRIDE;
@@ -273,7 +274,7 @@ namespace dbaui
virtual void MouseButtonDown( const BrowserMouseEvent& rMEvt) SAL_OVERRIDE;
// EditBrowseBox overridables
- virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
+ virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol) SAL_OVERRIDE;
// DbGridControl overridables
diff --git a/dbaccess/source/ui/inc/sqledit.hxx b/dbaccess/source/ui/inc/sqledit.hxx
index c941bdfa4c6e..2e5ac221ee65 100644
--- a/dbaccess/source/ui/inc/sqledit.hxx
+++ b/dbaccess/source/ui/inc/sqledit.hxx
@@ -43,7 +43,7 @@ namespace dbaui
Timer m_timerUndoActionCreation;
Link m_lnkTextModifyHdl;
OUString m_strOrigText; // is restored on undo
- OQueryTextView* m_pView;
+ VclPtr<OQueryTextView> m_pView;
bool m_bAccelAction; // is set on cut, copy, paste
bool m_bStopTimer;
svtools::ColorConfig m_ColorConfig;
@@ -68,6 +68,7 @@ namespace dbaui
public:
OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle = WB_LEFT | WB_VSCROLL |WB_BORDER);
virtual ~OSqlEdit();
+ virtual void dispose() SAL_OVERRIDE;
// Edit overridables
virtual void SetText(const OUString& rNewText) SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/inc/sqlmessage.hxx b/dbaccess/source/ui/inc/sqlmessage.hxx
index 1f4200c827ad..51cc296b5624 100644
--- a/dbaccess/source/ui/inc/sqlmessage.hxx
+++ b/dbaccess/source/ui/inc/sqlmessage.hxx
@@ -45,9 +45,9 @@ namespace dbaui
struct SQLMessageBox_Impl;
class OSQLMessageBox : public ButtonDialog
{
- FixedImage m_aInfoImage;
- FixedText m_aTitle;
- FixedText m_aMessage;
+ VclPtr<FixedImage> m_aInfoImage;
+ VclPtr<FixedText> m_aTitle;
+ VclPtr<FixedText> m_aMessage;
OUString m_sHelpURL;
::std::unique_ptr< SQLMessageBox_Impl > m_pImpl;
@@ -90,6 +90,7 @@ public:
const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL );
virtual ~OSQLMessageBox();
+ virtual void dispose() SAL_OVERRIDE;
private:
void Construct( WinBits nStyle, MessageType eImage );
diff --git a/dbaccess/source/ui/inc/textconnectionsettings.hxx b/dbaccess/source/ui/inc/textconnectionsettings.hxx
index 872b02e42734..89bcfc354e9c 100644
--- a/dbaccess/source/ui/inc/textconnectionsettings.hxx
+++ b/dbaccess/source/ui/inc/textconnectionsettings.hxx
@@ -39,6 +39,7 @@ namespace dbaui
public:
TextConnectionSettingsDialog( vcl::Window* _pParent, SfxItemSet& _rItems );
virtual ~TextConnectionSettingsDialog();
+ virtual void dispose() SAL_OVERRIDE;
/** initializes a set of PropertyStorage instaces, which are bound to
the text-connection relevant items in our item sets
@@ -48,8 +49,8 @@ namespace dbaui
virtual short Execute() SAL_OVERRIDE;
private:
- ::std::unique_ptr< OTextConnectionHelper > m_pTextConnectionHelper;
- OKButton *m_pOK;
+ VclPtr<OTextConnectionHelper> m_pTextConnectionHelper;
+ VclPtr<OKButton> m_pOK;
SfxItemSet& m_rItems;
private:
diff --git a/dbaccess/source/ui/inc/undosqledit.hxx b/dbaccess/source/ui/inc/undosqledit.hxx
index e9307c66c599..66a2f48795c3 100644
--- a/dbaccess/source/ui/inc/undosqledit.hxx
+++ b/dbaccess/source/ui/inc/undosqledit.hxx
@@ -21,6 +21,7 @@
#include "GeneralUndo.hxx"
#include "dbu_control.hrc"
+#include <vcl/vclptr.hxx>
namespace dbaui
{
@@ -29,7 +30,7 @@ namespace dbaui
class OSqlEditUndoAct : public OCommentUndoAction
{
protected:
- OSqlEdit* m_pOwner;
+ VclPtr<OSqlEdit> m_pOwner;
OUString m_strNextText;
virtual void Undo() SAL_OVERRIDE { ToggleText(); }
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index a544a2a98fee..18cb4322295c 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -100,11 +100,11 @@ namespace dbaui
OUString m_sQueryCommand; // the command of the query currently loaded (if any)
//OUString m_sToBeLoaded; // contains the element name which should be loaded if any
- DBTreeView* m_pTreeView;
- Splitter* m_pSplitter;
- SvTreeList* m_pTreeModel; // contains the datasources of the registry
- SvTreeListEntry* m_pCurrentlyDisplayed;
- ImplSVEvent * m_nAsyncDrop;
+ VclPtr<DBTreeView> m_pTreeView;
+ VclPtr<Splitter> m_pSplitter;
+ SvTreeList* m_pTreeModel; // contains the datasources of the registry
+ SvTreeListEntry* m_pCurrentlyDisplayed;
+ ImplSVEvent * m_nAsyncDrop;
sal_Int16 m_nBorder; // sal_True when border should be shown
diff --git a/dbaccess/source/ui/inc/unosqlmessage.hxx b/dbaccess/source/ui/inc/unosqlmessage.hxx
index 7028db2c22e6..5a41729aee2c 100644
--- a/dbaccess/source/ui/inc/unosqlmessage.hxx
+++ b/dbaccess/source/ui/inc/unosqlmessage.hxx
@@ -71,7 +71,7 @@ protected:
virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& _rConvertedValue, com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const com::sun::star::uno::Any& _rValue) throw(com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 0f16a402c1f1..67d464ada188 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -687,8 +687,8 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
{
bool bHaveDefaultTable = !m_sDefaultTableName.isEmpty();
OUString sTableName( bHaveDefaultTable ? m_sDefaultTableName : _rTableName );
- OCopyTableWizard aWizard(
- NULL,
+ ScopedVclPtrInstance<OCopyTableWizard> aWizard(
+ nullptr,
sTableName,
bHaveDefaultTable ? CopyTableOperation::AppendData : CopyTableOperation::CopyDefinitionAndData,
m_aDestColumns,
@@ -703,14 +703,14 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
bool bError = false;
try
{
- if (aWizard.Execute())
+ if (aWizard->Execute())
{
- switch(aWizard.getOperation())
+ switch(aWizard->getOperation())
{
case CopyTableOperation::CopyDefinitionAndData:
case CopyTableOperation::AppendData:
{
- m_xTable = aWizard.createTable();
+ m_xTable = aWizard->createTable();
bError = !m_xTable.is();
if(m_xTable.is())
{
@@ -718,10 +718,10 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
if(_aTextColor.hasValue())
m_xTable->setPropertyValue(PROPERTY_TEXTCOLOR,_aTextColor);
}
- m_bIsAutoIncrement = aWizard.shouldCreatePrimaryKey();
- m_vColumns = aWizard.GetColumnPositions();
- m_vColumnTypes = aWizard.GetColumnTypes();
- m_bAppendFirstLine = !aWizard.UseHeaderLine();
+ m_bIsAutoIncrement = aWizard->shouldCreatePrimaryKey();
+ m_vColumns = aWizard->GetColumnPositions();
+ m_vColumnTypes = aWizard->GetColumnTypes();
+ m_bAppendFirstLine = !aWizard->UseHeaderLine();
}
break;
default:
@@ -736,7 +736,7 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
}
catch( const SQLException&)
{
- ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), &aWizard, m_xContext );
+ ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), aWizard.get(), m_xContext );
bError = true;
}
catch( const Exception& )
@@ -754,9 +754,9 @@ void ODatabaseExport::showErrorDialog(const ::com::sun::star::sdbc::SQLException
OUString aMsg(e.Message);
aMsg += "\n";
aMsg += ModuleRes( STR_QRY_CONTINUE );
- OSQLWarningBox aBox( NULL, aMsg, WB_YES_NO | WB_DEF_NO );
+ ScopedVclPtrInstance< OSQLWarningBox > aBox( nullptr, aMsg, WB_YES_NO | WB_DEF_NO );
- if (aBox.Execute() == RET_YES)
+ if (aBox->Execute() == RET_YES)
m_bDontAskAgain = true;
else
m_bError = true;
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx
index 5a061ea0c448..1d2316ad3d02 100644
--- a/dbaccess/source/ui/misc/RowSetDrop.cxx
+++ b/dbaccess/source/ui/misc/RowSetDrop.cxx
@@ -241,8 +241,8 @@ bool ORowSetImportExport::insertNewRow()
if(!m_bAlreadyAsked)
{
OUString sAskIfContinue = ModuleRes(STR_ERROR_OCCURRED_WHILE_COPYING);
- OSQLWarningBox aDlg( m_pParent, sAskIfContinue, WB_YES_NO | WB_DEF_YES );
- if(aDlg.Execute() == RET_YES)
+ ScopedVclPtrInstance< OSQLWarningBox > aDlg( m_pParent, sAskIfContinue, WB_YES_NO | WB_DEF_YES );
+ if(aDlg->Execute() == RET_YES)
m_bAlreadyAsked = true;
else
return false;
diff --git a/dbaccess/source/ui/misc/ToolBoxHelper.cxx b/dbaccess/source/ui/misc/ToolBoxHelper.cxx
index ac5e461bd951..52f658e12aea 100644
--- a/dbaccess/source/ui/misc/ToolBoxHelper.cxx
+++ b/dbaccess/source/ui/misc/ToolBoxHelper.cxx
@@ -92,7 +92,7 @@ namespace dbaui
}
void OToolBoxHelper::setToolBox(ToolBox* _pTB)
{
- bool bFirstTime = (m_pToolBox == NULL);
+ bool bFirstTime = (m_pToolBox == nullptr);
m_pToolBox = _pTB;
if ( m_pToolBox )
{
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index e7dbf9c57e18..397f2a639663 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -852,12 +852,12 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
}
{ // want the dialog to be destroyed before our set
- SbaSbAttrDlg aDlg(_pParent, pFormatDescriptor, _pFormatter, _bHasFormat);
- if (RET_OK == aDlg.Execute())
+ ScopedVclPtrInstance< SbaSbAttrDlg > aDlg(_pParent, pFormatDescriptor, _pFormatter, _bHasFormat);
+ if (RET_OK == aDlg->Execute())
{
// ItemSet->UNO
// UNO-properties
- const SfxItemSet* pSet = aDlg.GetExampleSet();
+ const SfxItemSet* pSet = aDlg->GetExampleSet();
// (of course we could put the modified items directly into the column, but then the UNO-model
// won't reflect these changes, and why do we have a model, then ?)
@@ -875,7 +875,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
bRet = true;
}
// deleted formats
- const SfxItemSet* pResult = aDlg.GetOutputItemSet();
+ const SfxItemSet* pResult = aDlg->GetOutputItemSet();
if (pResult)
{
const SfxPoolItem* pItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
@@ -997,10 +997,10 @@ void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId
Size aDefaultMM = _pBox->PixelToLogic( Size( nDefaultWidth, 0 ), MapMode( MAP_MM ) );
- DlgSize aColumnSizeDlg( _pBox, nColSize, false, aDefaultMM.Width() * 10 );
- if ( aColumnSizeDlg.Execute() )
+ ScopedVclPtrInstance< DlgSize > aColumnSizeDlg( _pBox, nColSize, false, aDefaultMM.Width() * 10 );
+ if ( aColumnSizeDlg->Execute() )
{
- sal_Int32 nValue = aColumnSizeDlg.GetValue();
+ sal_Int32 nValue = aColumnSizeDlg->GetValue();
if ( -1 == nValue )
{ // default width
nValue = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
@@ -1286,13 +1286,13 @@ sal_Int32 askForUserAction(vcl::Window* _pParent,sal_uInt16 _nTitle,sal_uInt16 _
SolarMutexGuard aGuard;
OUString aMsg = ModuleRes(_nText);
aMsg = aMsg.replaceFirst("%1", _sName);
- OSQLMessageBox aAsk(_pParent, ModuleRes(_nTitle ), aMsg,WB_YES_NO | WB_DEF_YES,OSQLMessageBox::Query);
+ ScopedVclPtrInstance< OSQLMessageBox > aAsk(_pParent, ModuleRes(_nTitle ), aMsg,WB_YES_NO | WB_DEF_YES,OSQLMessageBox::Query);
if ( _bAll )
{
- aAsk.AddButton(ModuleRes(STR_BUTTON_TEXT_ALL), RET_ALL, 0);
- aAsk.GetPushButton(RET_ALL)->SetHelpId(HID_CONFIRM_DROP_BUTTON_ALL);
+ aAsk->AddButton(ModuleRes(STR_BUTTON_TEXT_ALL), RET_ALL, 0);
+ aAsk->GetPushButton(RET_ALL)->SetHelpId(HID_CONFIRM_DROP_BUTTON_ALL);
}
- return aAsk.Execute();
+ return aAsk->Execute();
}
namespace
@@ -1431,17 +1431,18 @@ bool insertHierachyElement( vcl::Window* _pParent, const Reference< XComponentCo
// here we have everything needed to create a new query object ...
HierarchicalNameCheck aNameChecker( _xNames.get(), sName );
// ... ehm, except a new name
- OSaveAsDlg aAskForName( _pParent,
+ ScopedVclPtrInstance<OSaveAsDlg> aAskForName(
+ _pParent,
_rxContext,
sTargetName,
sLabel,
aNameChecker,
- SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
- if ( RET_OK != aAskForName.Execute() )
+ SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS );
+ if ( RET_OK != aAskForName->Execute() )
// cancelled by the user
return false;
- sNewName = aAskForName.getName();
+ sNewName = aAskForName->getName();
}
}
else if ( xNameAccess->hasByName(sNewName) )
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 9856a3d8e185..0c99a437378d 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -19,6 +19,8 @@
#include "WCPage.hxx"
#include "WCopyTable.hxx"
+#include "WColumnSelect.hxx"
+#include "WExtendPages.hxx"
#include "defaultobjectnamecheck.hxx"
#include <tools/debug.hxx>
@@ -103,6 +105,23 @@ OCopyTable::OCopyTable(vcl::Window * pParent)
OCopyTable::~OCopyTable()
{
+ disposeOnce();
+}
+
+void OCopyTable::dispose()
+{
+ m_pEdTableName.clear();
+ m_pRB_DefData.clear();
+ m_pRB_Def.clear();
+ m_pRB_View.clear();
+ m_pRB_AppendData.clear();
+ m_pCB_UseHeaderLine.clear();
+ m_pCB_PrimaryColumn.clear();
+ m_pFT_KeyName.clear();
+ m_pEdKeyName.clear();
+ m_pPage2.clear();
+ m_pPage3.clear();
+ OWizardPage::dispose();
}
IMPL_LINK( OCopyTable, AppendDataClickHdl, Button*, /*pButton*/ )
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 0df651f41212..d9ca01bf3565 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -50,6 +50,17 @@ OWizardPage::OWizardPage(vcl::Window* pParent, const OString& rID, const OUStrin
{
}
+OWizardPage::~OWizardPage()
+{
+ disposeOnce();
+}
+
+void OWizardPage::dispose()
+{
+ m_pParent.clear();
+ TabPage::dispose();
+}
+
// OWizColumnSelect
OWizColumnSelect::OWizColumnSelect( vcl::Window* pParent)
:OWizardPage( pParent, "ApplyColPage", "dbaccess/ui/applycolpage.ui")
@@ -81,6 +92,11 @@ OWizColumnSelect::OWizColumnSelect( vcl::Window* pParent)
OWizColumnSelect::~OWizColumnSelect()
{
+ disposeOnce();
+}
+
+void OWizColumnSelect::dispose()
+{
while ( m_pNewColumnNames->GetEntryCount() )
{
void* pData = m_pNewColumnNames->GetEntryData(0);
@@ -90,6 +106,13 @@ OWizColumnSelect::~OWizColumnSelect()
m_pNewColumnNames->RemoveEntry(0);
}
m_pNewColumnNames->Clear();
+ m_pOrgColumnNames.clear();
+ m_pColumn_RH.clear();
+ m_pColumns_RH.clear();
+ m_pColumn_LH.clear();
+ m_pColumns_LH.clear();
+ m_pNewColumnNames.clear();
+ OWizardPage::dispose();
}
void OWizColumnSelect::Reset()
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 90f1894c41bc..9569788f759b 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -578,16 +578,16 @@ OCopyTableWizard::OCopyTableWizard( vcl::Window * pParent, const OUString& _rDef
m_sName = ::dbtools::composeTableName(m_xDestConnection->getMetaData(),sCatalog,sSchema,sTable,false,::dbtools::eInTableDefinitions);
}
- OCopyTable* pPage1( new OCopyTable( this ) );
+ VclPtrInstance<OCopyTable> pPage1( this );
pPage1->disallowUseHeaderLine();
if ( !bAllowViews )
pPage1->disallowViews();
pPage1->setCreateStyleAction();
AddWizardPage(pPage1);
- AddWizardPage( new OWizNameMatching( this ) );
- AddWizardPage( new OWizColumnSelect( this ) );
- AddWizardPage( new OWizNormalExtend( this ) );
+ AddWizardPage( VclPtr<OWizNameMatching>::Create( this ) );
+ AddWizardPage( VclPtr<OWizColumnSelect>::Create( this ) );
+ AddWizardPage( VclPtr<OWizNormalExtend>::Create( this ) );
ActivatePage();
}
@@ -624,13 +624,13 @@ OCopyTableWizard::OCopyTableWizard( vcl::Window* pParent, const OUString& _rDefa
m_xInteractionHandler.set( InteractionHandler::createWithParent(m_xContext, 0), UNO_QUERY );
- OCopyTable* pPage1( new OCopyTable( this ) );
+ VclPtrInstance<OCopyTable> pPage1( this );
pPage1->disallowViews();
pPage1->setCreateStyleAction();
AddWizardPage( pPage1 );
- AddWizardPage( new OWizNameMatching( this ) );
- AddWizardPage( new OWizColumnSelect( this ) );
+ AddWizardPage( VclPtr<OWizNameMatching>::Create( this ) );
+ AddWizardPage( VclPtr<OWizColumnSelect>::Create( this ) );
AddWizardPage( (*_pTypeSelectionPageFactory)( this, _rTypeSelectionPageArg ) );
ActivatePage();
@@ -640,11 +640,11 @@ void OCopyTableWizard::construct()
{
SetSizePixel(Size(580, 350));
- AddButton( m_pbHelp = new HelpButton(this, WB_TABSTOP) );
- AddButton( m_pbCancel = new CancelButton(this, WB_TABSTOP) );
- AddButton( m_pbPrev = new PushButton(this, WB_TABSTOP));
- AddButton( m_pbNext = new PushButton(this, WB_TABSTOP));
- AddButton( m_pbFinish = new PushButton(this, WB_TABSTOP));
+ AddButton( m_pbHelp = VclPtr<HelpButton>::Create(this, WB_TABSTOP) );
+ AddButton( m_pbCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP) );
+ AddButton( m_pbPrev = VclPtr<PushButton>::Create(this, WB_TABSTOP));
+ AddButton( m_pbNext = VclPtr<PushButton>::Create(this, WB_TABSTOP));
+ AddButton( m_pbFinish = VclPtr<PushButton>::Create(this, WB_TABSTOP));
m_pbHelp->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pbCancel->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
@@ -686,13 +686,18 @@ void OCopyTableWizard::construct()
OCopyTableWizard::~OCopyTableWizard()
{
+ disposeOnce();
+}
+
+void OCopyTableWizard::dispose()
+{
for ( ;; )
{
- TabPage *pPage = GetPage(0);
- if ( pPage == NULL )
+ VclPtr<TabPage> pPage = GetPage(0);
+ if ( pPage == nullptr )
break;
RemovePage( pPage );
- delete pPage;
+ pPage.disposeAndClear();
}
if ( m_bDeleteSourceColumns )
@@ -705,11 +710,12 @@ OCopyTableWizard::~OCopyTableWizard()
m_aTypeInfo.clear();
m_aDestTypeInfoIndex.clear();
- delete m_pbHelp;
- delete m_pbCancel;
- delete m_pbPrev;
- delete m_pbNext;
- delete m_pbFinish;
+ m_pbHelp.disposeAndClear();
+ m_pbCancel.disposeAndClear();
+ m_pbPrev.disposeAndClear();
+ m_pbNext.disposeAndClear();
+ m_pbFinish.disposeAndClear();
+ WizardDialog::dispose();
}
IMPL_LINK_NOARG(OCopyTableWizard, ImplPrevHdl)
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index aa35ed9d6c16..c533db6fce9f 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -74,6 +74,22 @@ OWizNameMatching::OWizNameMatching( vcl::Window* pParent)
OWizNameMatching::~OWizNameMatching()
{
+ disposeOnce();
+}
+
+void OWizNameMatching::dispose()
+{
+ m_pTABLE_LEFT.clear();
+ m_pTABLE_RIGHT.clear();
+ m_pCTRL_LEFT.clear();
+ m_pCTRL_RIGHT.clear();
+ m_pColumn_up.clear();
+ m_pColumn_down.clear();
+ m_pColumn_up_right.clear();
+ m_pColumn_down_right.clear();
+ m_pAll.clear();
+ m_pNone.clear();
+ OWizardPage::dispose();
}
void OWizNameMatching::Reset()
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 40e2227fd3ea..e294f324b62a 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -45,13 +45,18 @@ using namespace ::com::sun::star::sdbc;
OWizTypeSelectControl::OWizTypeSelectControl(vcl::Window* pParent, vcl::Window* pParentTabPage, OTableDesignHelpBar* pHelpBar)
: OFieldDescControl(pParent, pHelpBar)
{
-
m_pParentTabPage = pParentTabPage;
}
OWizTypeSelectControl::~OWizTypeSelectControl()
{
+ disposeOnce();
+}
+void OWizTypeSelectControl::dispose()
+{
+ m_pParentTabPage.clear();
+ OFieldDescControl::dispose();
}
void OWizTypeSelectControl::ActivateAggregate( EControlType eType )
@@ -87,7 +92,7 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
OSL_ENSURE(nRow == -1,"nRow muss -1 sein!");
(void)nRow;
- MultiListBox *pListBox = static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_pColumnNames;
+ MultiListBox *pListBox = static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pColumnNames;
OFieldDescription* pCurFieldDescr = getCurrentFieldDescData();
@@ -137,13 +142,13 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
pWiz->showError(strMessage);
pCurFieldDescr->SetName(sName);
DisplayData(pCurFieldDescr);
- static_cast<OWizTypeSelect*>(m_pParentTabPage)->setDuplicateName(true);
+ static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->setDuplicateName(true);
return;
}
OUString sOldName = pCurFieldDescr->GetName();
pCurFieldDescr->SetName(sNewName);
- static_cast<OWizTypeSelect*>(m_pParentTabPage)->setDuplicateName(false);
+ static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->setDuplicateName(false);
// now we change the name
OCopyTableWizard::TNameMapping::iterator aIter = pWiz->m_mNameMapping.begin();
@@ -172,48 +177,48 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
::com::sun::star::lang::Locale OWizTypeSelectControl::GetLocale() const
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_pParent->GetLocale();
+ return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->GetLocale();
}
Reference< XNumberFormatter > OWizTypeSelectControl::GetFormatter() const
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_pParent->GetFormatter();
+ return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->GetFormatter();
}
TOTypeInfoSP OWizTypeSelectControl::getTypeInfo(sal_Int32 _nPos)
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_pParent->getDestTypeInfo(_nPos);
+ return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->getDestTypeInfo(_nPos);
}
const OTypeInfoMap* OWizTypeSelectControl::getTypeInfo() const
{
- return &static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_pParent->getDestTypeInfo();
+ return &static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->getDestTypeInfo();
}
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> OWizTypeSelectControl::getMetaData()
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_pParent->m_xDestConnection->getMetaData();
+ return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->m_xDestConnection->getMetaData();
}
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> OWizTypeSelectControl::getConnection()
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_pParent->m_xDestConnection;
+ return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->m_xDestConnection;
}
bool OWizTypeSelectControl::isAutoIncrementValueEnabled() const
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_bAutoIncrementEnabled;
+ return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_bAutoIncrementEnabled;
}
OUString OWizTypeSelectControl::getAutoIncrementValue() const
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_sAutoIncrementValue;
+ return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_sAutoIncrementValue;
}
#define IMG_PRIMARY_KEY 1
OWizTypeSelect::OWizTypeSelect( vcl::Window* pParent, SvStream* _pStream )
:OWizardPage( pParent, "TypeSelect", "dbaccess/ui/typeselectpage.ui")
- ,m_pTypeControl(new OWizTypeSelectControl(get<VclVBox>("control_container"), this) )
+ ,m_pTypeControl(VclPtr<OWizTypeSelectControl>::Create(get<VclVBox>("control_container"), this) )
,m_pParserStream( _pStream )
,m_nDisplayRow(0)
,m_bAutoIncrementEnabled(false)
@@ -255,7 +260,19 @@ OWizTypeSelect::OWizTypeSelect( vcl::Window* pParent, SvStream* _pStream )
OWizTypeSelect::~OWizTypeSelect()
{
- delete m_pTypeControl;
+ disposeOnce();
+}
+
+void OWizTypeSelect::dispose()
+{
+ m_pTypeControl.disposeAndClear();
+ m_pColumnNames.clear();
+ m_pColumns.clear();
+ m_pAutoType.clear();
+ m_pAutoFt.clear();
+ m_pAutoEt.clear();
+ m_pAutoPb.clear();
+ OWizardPage::dispose();
}
OUString OWizTypeSelect::GetTitle() const
@@ -344,6 +361,17 @@ IMPL_LINK( OWizTypeSelect, ButtonClickHdl, Button *, /*pButton*/ )
return 0;
}
+OWizTypeSelectList::~OWizTypeSelectList()
+{
+ disposeOnce();
+}
+
+void OWizTypeSelectList::dispose()
+{
+ m_pParentTabPage.clear();
+ MultiListBox::dispose();
+}
+
bool OWizTypeSelectList::IsPrimaryKeyAllowed() const
{
sal_uInt16 nCount = GetSelectEntryCount();
@@ -364,7 +392,7 @@ void OWizTypeSelectList::setPrimaryKey(OFieldDescription* _pFieldDescr, sal_uInt
RemoveEntry(_nPos);
_pFieldDescr->SetPrimaryKey(_bSet);
if( _bSet )
- InsertEntry(sColumnName, static_cast<OWizTypeSelect*>(m_pParentTabPage)->m_imgPKey,_nPos);
+ InsertEntry(sColumnName, static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_imgPKey,_nPos);
else if( _pFieldDescr->getTypeInfo()->bNullable )
{
_pFieldDescr->SetControlDefault(Any());
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index cfe5df91130c..1903b0cd6029 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -308,8 +308,8 @@ namespace dbaui
bool bReConnect = true;
if ( _bUI )
{
- MessageDialog aQuery(getView(), ModuleRes(STR_QUERY_CONNECTION_LOST), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- bReConnect = ( RET_YES == aQuery.Execute() );
+ ScopedVclPtrInstance< MessageDialog > aQuery(getView(), ModuleRes(STR_QUERY_CONNECTION_LOST), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ bReConnect = ( RET_YES == aQuery->Execute() );
}
// now really reconnect ...
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index 3f55ef279a78..77408cdaf51a 100644
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -18,6 +18,7 @@
*/
#include <dbaccess/dbaundomanager.hxx>
+#include <dbaccess/dataview.hxx>
#include "singledoccontroller.hxx"
#include "browserids.hxx"
#include "dbu_misc.hrc"
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index e58d60f183f3..9b584be0715b 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -82,10 +82,10 @@ namespace dbaui
{
// search the position of our table window in the table window map
nIndex = m_pLine->GetParent()->GetTabWinMap().size();
- const ::std::vector<OTableConnection*>& rVec = m_pLine->GetParent()->getTableConnections();
- ::std::vector<OTableConnection*>::const_iterator aIter = rVec.begin();
- ::std::vector<OTableConnection*>::const_iterator aEnd = rVec.end();
- for (; aIter != aEnd && (*aIter) != m_pLine; ++nIndex,++aIter)
+ const auto& rVec = m_pLine->GetParent()->getTableConnections();
+ auto aIter = rVec.begin();
+ auto aEnd = rVec.end();
+ for (; aIter != aEnd && (*aIter).get() != m_pLine; ++nIndex,++aIter)
;
nIndex = ( aIter != aEnd ) ? nIndex : -1;
}
@@ -169,8 +169,14 @@ namespace dbaui
}
OTableConnection::~OTableConnection()
{
+ disposeOnce();
+ }
+ void OTableConnection::dispose()
+ {
// clear vector
clearLineData();
+ m_pParent.clear();
+ vcl::Window::dispose();
}
Reference< XAccessibleContext > SAL_CALL OConnectionLineAccess::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index 9e192e66b3ab..ac483039587c 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -170,10 +170,7 @@ OJoinDesignView* OJoinController::getJoinView()
void OJoinController::disposing()
{
- {
- boost::scoped_ptr< vcl::Window > pEnsureDelete( m_pAddTableDialog );
- m_pAddTableDialog = NULL;
- }
+ m_pAddTableDialog = NULL;
OJoinController_BASE::disposing();
@@ -225,7 +222,7 @@ FeatureState OJoinController::GetState(sal_uInt16 _nId) const
case ID_BROWSER_ADDTABLE:
aReturn.bEnabled = ( getView() != NULL )
&& const_cast< OJoinController* >( this )->getJoinView()->getTableView()->IsAddAllowed();
- aReturn.bChecked = aReturn.bEnabled && m_pAddTableDialog != NULL && m_pAddTableDialog->IsVisible() ;
+ aReturn.bChecked = aReturn.bEnabled && m_pAddTableDialog != nullptr && m_pAddTableDialog->IsVisible() ;
if ( aReturn.bEnabled )
aReturn.sTitle = OAddTableDlg::getDialogTitleForContext( impl_getDialogContext() );
break;
@@ -272,7 +269,7 @@ void OJoinController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
return;
case ID_BROWSER_ADDTABLE:
if ( !m_pAddTableDialog )
- m_pAddTableDialog = new OAddTableDlg( getView(), impl_getDialogContext() );
+ m_pAddTableDialog = VclPtr<OAddTableDlg>::Create( getView(), impl_getDialogContext() );
if ( m_pAddTableDialog->IsVisible() )
{
diff --git a/dbaccess/source/ui/querydesign/JoinDesignView.cxx b/dbaccess/source/ui/querydesign/JoinDesignView.cxx
index b61a512c1de6..61e40284dd92 100644
--- a/dbaccess/source/ui/querydesign/JoinDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinDesignView.cxx
@@ -56,15 +56,19 @@ OJoinDesignView::OJoinDesignView(vcl::Window* _pParent, OJoinController& _rContr
,m_pTableView(NULL)
,m_rController( _rController )
{
- m_pScrollWindow = new OScrollWindowHelper(this);
+ m_pScrollWindow = VclPtr<OScrollWindowHelper>::Create(this);
}
OJoinDesignView::~OJoinDesignView()
{
- boost::scoped_ptr<vcl::Window> aT3(m_pScrollWindow);
- m_pScrollWindow = NULL;
- boost::scoped_ptr<vcl::Window> aT2(m_pTableView);
- m_pTableView = NULL;
+ disposeOnce();
+}
+
+void OJoinDesignView::dispose()
+{
+ m_pScrollWindow.disposeAndClear();
+ m_pTableView.disposeAndClear();
+ ODataView::dispose();
}
void OJoinDesignView::Construct()
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 8b0c63d177b8..efc798032f18 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -65,9 +65,9 @@ using namespace ::com::sun::star::lang;
#define TABWIN_HEIGHT_STD 120
OScrollWindowHelper::OScrollWindowHelper( vcl::Window* pParent) : Window( pParent)
- ,m_aHScrollBar( this, WB_HSCROLL|WB_REPEAT|WB_DRAG )
- ,m_aVScrollBar( this, WB_VSCROLL|WB_REPEAT|WB_DRAG )
- ,m_pCornerWindow(new ScrollBarBox(this, WB_3DLOOK))
+ ,m_aHScrollBar( VclPtr<ScrollBar>::Create(this, WB_HSCROLL|WB_REPEAT|WB_DRAG) )
+ ,m_aVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL|WB_REPEAT|WB_DRAG) )
+ ,m_pCornerWindow(VclPtr<ScrollBarBox>::Create(this, WB_3DLOOK))
,m_pTableView(NULL)
{
@@ -89,9 +89,16 @@ OScrollWindowHelper::OScrollWindowHelper( vcl::Window* pParent) : Window( pParen
OScrollWindowHelper::~OScrollWindowHelper()
{
- boost::scoped_ptr<vcl::Window> aTemp(m_pCornerWindow);
- m_pCornerWindow = NULL;
- m_pTableView = NULL;
+ disposeOnce();
+}
+
+void OScrollWindowHelper::dispose()
+{
+ m_aHScrollBar.disposeAndClear();
+ m_aVScrollBar.disposeAndClear();
+ m_pCornerWindow.disposeAndClear();
+ m_pTableView.clear();
+ vcl::Window::dispose();
}
void OScrollWindowHelper::setTableView(OJoinTableView* _pTableView)
@@ -174,6 +181,11 @@ OJoinTableView::OJoinTableView( vcl::Window* pParent, OJoinDesignView* pView )
OJoinTableView::~OJoinTableView()
{
+ disposeOnce();
+}
+
+void OJoinTableView::dispose()
+{
if( m_pAccessible )
{
m_pAccessible->clearTableView();
@@ -181,6 +193,12 @@ OJoinTableView::~OJoinTableView()
}
// delete lists
clearLayoutInformation();
+ m_pDragWin.clear();
+ m_pSizingWin.clear();
+ m_pSelectedConn.clear();
+ m_pLastFocusTabWin.clear();
+ m_pView.clear();
+ vcl::Window::dispose();
}
IMPL_LINK( OJoinTableView, ScrollHdl, ScrollBar*, pScrollBar )
@@ -246,9 +264,7 @@ bool OJoinTableView::RemoveConnection( OTableConnection* _pConn,bool _bDelete )
makeAny(_pConn->GetAccessible()),
Any());
if ( _bDelete )
- {
- delete _pConn;
- }
+ _pConn->disposeOnce();
return true;
}
@@ -257,7 +273,7 @@ OTableWindow* OJoinTableView::GetTabWindow( const OUString& rName )
{
OTableWindowMap::iterator aIter = m_aTableMap.find(rName);
- return aIter == m_aTableMap.end() ? NULL : aIter->second;
+ return aIter == m_aTableMap.end() ? nullptr : aIter->second;
}
TTableWindowData::value_type OJoinTableView::createTableWindowData(const OUString& _rComposedName
@@ -308,7 +324,7 @@ void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& r
TTableWindowData::value_type pNewTabWinData(createTableWindowData( _rComposedName, rWinName,rWinName ));
// insert new window in window list
- OTableWindow* pNewTabWin = createWindow( pNewTabWinData );
+ VclPtr<OTableWindow> pNewTabWin = createWindow( pNewTabWinData );
if ( pNewTabWin->Init() )
{
m_pView->getController().getTableWindowData().push_back( pNewTabWinData);
@@ -330,7 +346,7 @@ void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& r
else
{
pNewTabWin->clearListBox();
- delete pNewTabWin;
+ pNewTabWin.disposeAndClear();
}
}
@@ -340,7 +356,7 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin )
bool bRemove = true;
TTableWindowData::value_type pData = pTabWin->GetData();
sal_Int32 nCount = m_vTableConnection.size();
- ::std::vector<OTableConnection*>::reverse_iterator aIter = m_vTableConnection.rbegin();
+ auto aIter = m_vTableConnection.rbegin();
while(aIter != m_vTableConnection.rend() && bRemove)
{
OTableConnection* pTabConn = (*aIter);
@@ -380,9 +396,9 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin )
m_pLastFocusTabWin = NULL;
pTabWin->clearListBox();
- delete pTabWin;
-
+ pTabWin->disposeOnce();
}
+
if ( (sal_Int32)m_vTableConnection.size() < (nCount-1) ) // if some connections could be removed
modified();
}
@@ -814,8 +830,8 @@ void OJoinTableView::MouseButtonUp( const MouseEvent& rEvt )
{
DeselectConn(GetSelectedConn());
- ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ auto aIter = m_vTableConnection.begin();
+ auto aEnd = m_vTableConnection.end();
for(;aIter != aEnd;++aIter)
{
if( (*aIter)->CheckHit(rEvt.GetPosPixel()) )
@@ -927,20 +943,21 @@ void OJoinTableView::Paint( const Rectangle& rRect )
void OJoinTableView::InvalidateConnections()
{
// draw Joins
- ::std::for_each(m_vTableConnection.begin(),m_vTableConnection.end(),
- ::std::mem_fun(& OTableConnection::InvalidateConnection));
+ for(auto & conn : m_vTableConnection)
+ conn->InvalidateConnection();
}
void OJoinTableView::DrawConnections( const Rectangle& rRect )
{
// draw Joins
- ::std::for_each(m_vTableConnection.begin(),m_vTableConnection.end(),boost::bind( &OTableConnection::Draw, _1, boost::cref( rRect )));
+ for(auto conn : m_vTableConnection)
+ conn->Draw(rRect);
// finally redraw the selected one above all others
if (GetSelectedConn())
GetSelectedConn()->Draw( rRect );
}
-::std::vector<OTableConnection*>::const_iterator OJoinTableView::getTableConnections(const OTableWindow* _pFromWin) const
+::std::vector<VclPtr<OTableConnection> >::const_iterator OJoinTableView::getTableConnections(const OTableWindow* _pFromWin) const
{
return ::std::find_if( m_vTableConnection.begin(),
m_vTableConnection.end(),
@@ -966,8 +983,8 @@ void OJoinTableView::ClearAll()
HideTabWins();
// and the same with the Connections
- ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ auto aIter = m_vTableConnection.begin();
+ auto aEnd = m_vTableConnection.end();
for(;aIter != aEnd;++aIter)
RemoveConnection( *aIter ,true);
m_vTableConnection.clear();
@@ -983,7 +1000,7 @@ void OJoinTableView::ClearAll()
bool OJoinTableView::ScrollWhileDragging()
{
- OSL_ENSURE(m_pDragWin != NULL, "OJoinTableView::ScrollWhileDragging must not be called when a window is being dragged !");
+ OSL_ENSURE(m_pDragWin != nullptr, "OJoinTableView::ScrollWhileDragging must not be called when a window is being dragged !");
// kill the timer
if (m_aDragScrollIdle.IsActive())
@@ -1155,8 +1172,8 @@ void OJoinTableView::Command(const CommandEvent& rEvt)
DeselectConn(pSelConnection);
const Point& aMousePos = rEvt.GetMousePosPixel();
- ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ auto aIter = m_vTableConnection.begin();
+ auto aEnd = m_vTableConnection.end();
for(;aIter != aEnd;++aIter)
{
if( (*aIter)->CheckHit(aMousePos) )
@@ -1185,8 +1202,8 @@ OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTab
{
bool bFoundStart = _rpFirstAfter == nullptr;
- ::std::vector<OTableConnection*>::const_iterator aIter = m_vTableConnection.begin();
- ::std::vector<OTableConnection*>::const_iterator aEnd = m_vTableConnection.end();
+ auto aIter = m_vTableConnection.begin();
+ auto aEnd = m_vTableConnection.end();
for(;aIter != aEnd;++aIter)
{
OTableConnection* pData = *aIter;
@@ -1318,12 +1335,12 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt)
{ // no active tab win -> travel the connections
// find the currently selected conn within the conn list
sal_Int32 i(0);
- for ( ::std::vector<OTableConnection*>::iterator connectionIter = m_vTableConnection.begin();
+ for ( auto connectionIter = m_vTableConnection.begin();
connectionIter != m_vTableConnection.end();
++connectionIter, ++i
)
{
- if ( (*connectionIter) == GetSelectedConn() )
+ if ( (*connectionIter).get() == GetSelectedConn() )
break;
}
if (i == sal_Int32(m_vTableConnection.size() - 1) && bForward)
@@ -1511,16 +1528,14 @@ void OJoinTableView::clearLayoutInformation()
{
if ( aIter->second )
aIter->second->clearListBox();
- boost::scoped_ptr<vcl::Window> aTemp(aIter->second);
aIter->second = NULL;
}
m_aTableMap.clear();
- ::std::vector<OTableConnection*>::const_iterator aIter2 = m_vTableConnection.begin();
- ::std::vector<OTableConnection*>::const_iterator aEnd2 = m_vTableConnection.end();
- for(;aIter2 != aEnd2;++aIter2)
- delete *aIter2;
+ for(auto i = m_vTableConnection.begin();
+ i != m_vTableConnection.end(); ++i)
+ i->disposeAndClear();
m_vTableConnection.clear();
}
diff --git a/dbaccess/source/ui/querydesign/LimitBox.cxx b/dbaccess/source/ui/querydesign/LimitBox.cxx
index 4f4175be859b..4cd42066f4a6 100644
--- a/dbaccess/source/ui/querydesign/LimitBox.cxx
+++ b/dbaccess/source/ui/querydesign/LimitBox.cxx
@@ -47,10 +47,6 @@ LimitBox::LimitBox( vcl::Window* pParent, WinBits nStyle )
SetSizePixel(aSize);
}
-LimitBox::~LimitBox()
-{
-}
-
OUString LimitBox::CreateFieldText( sal_Int64 nValue ) const
{
if( nValue == ALL_INT )
@@ -114,8 +110,7 @@ void LimitBox::LoadDefaultLimits()
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLimitBox( vcl::Window *pParent, VclBuilder::stringmap & )
{
- LimitBox* pBox = new LimitBox( pParent, WB_DROPDOWN | WB_VSCROLL );
- return pBox;
+ return new LimitBox( pParent, WB_DROPDOWN | WB_VSCROLL );
}
diff --git a/dbaccess/source/ui/querydesign/QTableConnection.cxx b/dbaccess/source/ui/querydesign/QTableConnection.cxx
index 2789e7bc11aa..0f546066be32 100644
--- a/dbaccess/source/ui/querydesign/QTableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/QTableConnection.cxx
@@ -37,10 +37,6 @@ OQueryTableConnection::OQueryTableConnection(const OQueryTableConnection& rConn)
// no own members, so base class functionality is sufficient
}
-OQueryTableConnection::~OQueryTableConnection()
-{
-}
-
OQueryTableConnection& OQueryTableConnection::operator=(const OQueryTableConnection& rConn)
{
if (&rConn == this)
diff --git a/dbaccess/source/ui/querydesign/QTableConnection.hxx b/dbaccess/source/ui/querydesign/QTableConnection.hxx
index 414b805346e3..33f492fcc03b 100644
--- a/dbaccess/source/ui/querydesign/QTableConnection.hxx
+++ b/dbaccess/source/ui/querydesign/QTableConnection.hxx
@@ -32,7 +32,6 @@ namespace dbaui
public:
OQueryTableConnection(OQueryTableView* pContainer, const TTableConnectionData::value_type& pTabConnData);
OQueryTableConnection(const OQueryTableConnection& rConn);
- virtual ~OQueryTableConnection();
OQueryTableConnection& operator=(const OQueryTableConnection& rConn);
bool operator==(const OQueryTableConnection& rCompare);
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index 6c3ab2d64d18..607552ff2389 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -66,10 +66,6 @@ OQueryTableWindow::OQueryTableWindow( vcl::Window* pParent, const TTableWindowDa
SetHelpId(HID_CTL_QRYDGNTAB);
}
-OQueryTableWindow::~OQueryTableWindow()
-{
-}
-
bool OQueryTableWindow::Init()
{
bool bSuccess = OTableWindow::Init();
@@ -102,8 +98,8 @@ bool OQueryTableWindow::Init()
SetAliasName(sAliasName);
// SetAliasName passes it as WinName, hence it uses the base class
// reset the title
- m_aTitle.SetText( pWinData->GetWinName() );
- m_aTitle.Show();
+ m_aTitle->SetText( pWinData->GetWinName() );
+ m_aTitle->Show();
getTableView()->getDesignView()->getController().InvalidateFeature(ID_BROWSER_QUERY_EXECUTE);
return bSuccess;
@@ -148,7 +144,7 @@ void OQueryTableWindow::OnEntryDoubleClicked(SvTreeListEntry* pEntry)
bool OQueryTableWindow::ExistsField(const OUString& strFieldName, OTableFieldDescRef& rInfo)
{
- OSL_ENSURE(m_pListBox != NULL, "OQueryTableWindow::ExistsField : doesn't have ::com::sun::star::form::ListBox !");
+ OSL_ENSURE(m_pListBox != nullptr, "OQueryTableWindow::ExistsField : doesn't have ::com::sun::star::form::ListBox !");
OSL_ENSURE(rInfo.is(),"OQueryTableWindow::ExistsField: invalid argument for OTableFieldDescRef!");
Reference< XConnection> xConnection = getTableView()->getDesignView()->getController().getConnection();
bool bExists = false;
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.hxx b/dbaccess/source/ui/querydesign/QTableWindow.hxx
index 95c674107e77..8f64918b4eb5 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.hxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.hxx
@@ -32,7 +32,6 @@ namespace dbaui
OUString m_strInitialAlias;
public:
OQueryTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData, sal_Unicode* pszInitialAlias = NULL );
- virtual ~OQueryTableWindow();
OUString GetAliasName() const
{
diff --git a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
index 61c7507d63f8..a009832b5624 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
@@ -30,7 +30,7 @@ namespace dbaui
class OQueryDesignFieldUndoAct : public OCommentUndoAction
{
protected:
- OSelectionBrowseBox* pOwner;
+ VclPtr<OSelectionBrowseBox> pOwner;
sal_uInt16 m_nColumnPostion;
virtual void Undo() SAL_OVERRIDE = 0;
diff --git a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx
index d74ce27e9fc7..9166a2e782c4 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDESIGNUNDOACTION_HXX
#include "GeneralUndo.hxx"
+#include <vcl/vclptr.hxx>
namespace dbaui
{
@@ -28,7 +29,7 @@ namespace dbaui
class OQueryDesignUndoAction : public OCommentUndoAction
{
protected:
- OJoinTableView* m_pOwner; // in this container it all happens
+ VclPtr<OJoinTableView> m_pOwner; // in this container it all happens
public:
OQueryDesignUndoAction(OJoinTableView* pOwner, sal_uInt16 nCommentID) : OCommentUndoAction(nCommentID), m_pOwner(pOwner) { }
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index dba71c0e72cb..61039e895f6b 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -159,10 +159,10 @@ namespace
}
}
- OQueryTableConnection aInfo(pTableView, aInfoData);
+ ScopedVclPtrInstance< OQueryTableConnection > aInfo(pTableView, aInfoData);
// Because OQueryTableConnection never takes ownership of the data passed to it, but only remembers the pointer,
// this pointer to a local variable is not critical, as aInfoData and aInfo have the same lifetime
- pTableView->NotifyTabConnection( aInfo );
+ pTableView->NotifyTabConnection( *aInfo.get() );
}
else
{
@@ -509,12 +509,12 @@ namespace
pEntryConn->SetVisited(true);
// first search for the "to" window
- const ::std::vector<OTableConnection*>& rConnections = pEntryConn->GetParent()->getTableConnections();
- ::std::vector<OTableConnection*>::const_iterator aIter = rConnections.begin();
- ::std::vector<OTableConnection*>::const_iterator aEnd = rConnections.end();
+ const auto& rConnections = pEntryConn->GetParent()->getTableConnections();
+ auto aIter = rConnections.begin();
+ auto aEnd = rConnections.end();
for(;aIter != aEnd;++aIter)
{
- OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(*aIter);
+ OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>((*aIter).get());
if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabTo || pNext->GetDestWin() == pEntryTabTo))
{
OQueryTableWindow* pEntryTab = pNext->GetSourceWin() == pEntryTabTo ? static_cast<OQueryTableWindow*>(pNext->GetDestWin()) : static_cast<OQueryTableWindow*>(pNext->GetSourceWin());
@@ -532,7 +532,7 @@ namespace
aIter = rConnections.begin();
for(;aIter != aEnd;++aIter)
{
- OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(*aIter);
+ OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>((*aIter).get());
if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabFrom || pNext->GetDestWin() == pEntryTabFrom))
{
OQueryTableWindow* pEntryTab = pNext->GetSourceWin() == pEntryTabFrom ? static_cast<OQueryTableWindow*>(pNext->GetDestWin()) : static_cast<OQueryTableWindow*>(pNext->GetSourceWin());
@@ -666,7 +666,7 @@ namespace
bool bFound = false;
for(;!bFound && tableIter != tableEnd ;++tableIter)
{
- OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(tableIter->second);
+ OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(tableIter->second.get());
bFound = pTabWin->ExistsField( rFieldName, aInfo );
if ( bFound )
@@ -985,13 +985,13 @@ namespace
void GenerateInnerJoinCriterias(const Reference< XConnection>& _xConnection,
OUString& _rJoinCrit,
- const ::std::vector<OTableConnection*>* _pConnList)
+ const ::std::vector<VclPtr<OTableConnection> >& _rConnList)
{
- ::std::vector<OTableConnection*>::const_iterator aIter = _pConnList->begin();
- ::std::vector<OTableConnection*>::const_iterator aEnd = _pConnList->end();
+ auto aIter = _rConnList.begin();
+ auto aEnd = _rConnList.end();
for(;aIter != aEnd;++aIter)
{
- const OQueryTableConnection* pEntryConn = static_cast<const OQueryTableConnection*>(*aIter);
+ const OQueryTableConnection* pEntryConn = static_cast<const OQueryTableConnection*>((*aIter).get());
OQueryTableConnectionData* pEntryConnData = static_cast<OQueryTableConnectionData*>(pEntryConn->GetData().get());
if ( pEntryConnData->GetJoinType() == INNER_JOIN && !pEntryConnData->isNatural() )
{
@@ -1018,7 +1018,7 @@ namespace
}
OUString GenerateFromClause( const Reference< XConnection>& _xConnection,
const OQueryTableView::OTableWindowMap* pTabList,
- const ::std::vector<OTableConnection*>* pConnList
+ const ::std::vector<VclPtr<OTableConnection> >& rConnList
)
{
@@ -1027,14 +1027,14 @@ namespace
tableNames_t aTableNames;
// generate outer join clause in from
- if(!pConnList->empty())
+ if(!rConnList.empty())
{
- ::std::vector<OTableConnection*>::const_iterator aIter = pConnList->begin();
- ::std::vector<OTableConnection*>::const_iterator aEnd = pConnList->end();
+ auto aIter = rConnList.begin();
+ auto aEnd = rConnList.end();
::std::map<OTableWindow*,sal_Int32> aConnectionCount;
for(;aIter != aEnd;++aIter)
{
- static_cast<OQueryTableConnection*>(*aIter)->SetVisited(false);
+ static_cast<OQueryTableConnection*>((*aIter).get())->SetVisited(false);
++aConnectionCount[(*aIter)->GetSourceWin()];
++aConnectionCount[(*aIter)->GetDestWin()];
}
@@ -1051,10 +1051,10 @@ namespace
::std::multimap<sal_Int32 , OTableWindow*>::reverse_iterator aREnd = aMulti.rend();
for(;aRIter != aREnd;++aRIter)
{
- ::std::vector<OTableConnection*>::const_iterator aConIter = aRIter->second->getTableView()->getTableConnections(aRIter->second);
+ auto aConIter = aRIter->second->getTableView()->getTableConnections(aRIter->second);
for(;aConIter != aEnd;++aConIter)
{
- OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aConIter);
+ OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>((*aConIter).get());
if(!pEntryConn->IsVisited() && pEntryConn->GetSourceWin() == aRIter->second )
{
OUString aJoin;
@@ -1097,10 +1097,10 @@ namespace
// "FROM tbl1, tbl2 WHERE tbl1.col1=tlb2.col2"
// rather than
// "FROM tbl1 INNER JOIN tbl2 ON tbl1.col1=tlb2.col2"
- aIter = pConnList->begin();
+ aIter = rConnList.begin();
for(;aIter != aEnd;++aIter)
{
- OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aIter);
+ OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>((*aIter).get());
if(!pEntryConn->IsVisited())
{
searchAndAppendName(_xConnection,
@@ -1120,7 +1120,7 @@ namespace
OQueryTableView::OTableWindowMap::const_iterator aTabEnd = pTabList->end();
for(;aTabIter != aTabEnd;++aTabIter)
{
- const OQueryTableWindow* pEntryTab = static_cast<const OQueryTableWindow*>(aTabIter->second);
+ const OQueryTableWindow* pEntryTab = static_cast<const OQueryTableWindow*>(aTabIter->second.get());
if(!pEntryTab->ExistsAConn())
{
aTableListStr += BuildTable(_xConnection,pEntryTab);
@@ -1541,7 +1541,7 @@ namespace
OJoinTableView::OTableWindowMap::iterator aTabEnd = rTabList.end();
for(;aIter != aTabEnd;++aIter)
{
- OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
+ OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second.get());
if (pTabWin->ExistsField( OUString("*"), aDragLeft ))
{
aDragLeft->SetAlias(OUString());
@@ -1749,7 +1749,7 @@ namespace
OJoinTableView::OTableWindowMap::const_iterator aEnd = _rTabList.end();
for ( ; aIter != aEnd; ++aIter )
{
- OQueryTableWindow* pTabWin = static_cast< OQueryTableWindow* >( aIter->second );
+ OQueryTableWindow* pTabWin = static_cast< OQueryTableWindow* >( aIter->second.get() );
if ( pTabWin && pTabWin->ExistsField( _rColumName, _rInfo ) )
return pTabWin;
}
@@ -2105,7 +2105,7 @@ namespace
OJoinTableView::OTableWindowMap::iterator aEnd = _pTabList->end();
for(;aIter != aEnd && eOk == eErrorCode ;++aIter)
{
- OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
+ OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second.get());
OTableFieldDescRef aInfo = new OTableFieldDesc();
if (pTabWin->ExistsField( sAsterisk, aInfo ))
{
@@ -2202,7 +2202,7 @@ namespace
const OJoinTableView::OTableWindowMap::const_iterator aEnd = pTabList->end();
for(;aIter != aEnd;++aIter)
{
- OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
+ OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second.get());
if (pTabWin->ExistsField( OUString("*"), aInfo ))
{
aInfo->SetAlias(OUString());
@@ -2491,7 +2491,7 @@ OQueryDesignView::OQueryDesignView( OQueryContainerWindow* _pParent,
OQueryController& _rController,
const Reference< XComponentContext >& _rxContext)
:OQueryView( _pParent, _rController, _rxContext )
- ,m_aSplitter( this )
+ ,m_aSplitter( VclPtr<Splitter>::Create(this) )
,m_eChildFocus(NONE)
,m_bInSplitHandler( false )
{
@@ -2506,23 +2506,28 @@ OQueryDesignView::OQueryDesignView( OQueryContainerWindow* _pParent,
{
}
- m_pSelectionBox = new OSelectionBrowseBox(this);
+ m_pSelectionBox = VclPtr<OSelectionBrowseBox>::Create(this);
setNoneVisbleRow(static_cast<OQueryController&>(getController()).getVisibleRows());
m_pSelectionBox->Show();
// setup Splitter
- m_aSplitter.SetSplitHdl(LINK(this, OQueryDesignView,SplitHdl));
- m_aSplitter.Show();
+ m_aSplitter->SetSplitHdl(LINK(this, OQueryDesignView,SplitHdl));
+ m_aSplitter->Show();
}
OQueryDesignView::~OQueryDesignView()
{
+ disposeOnce();
+}
+
+void OQueryDesignView::dispose()
+{
if ( m_pTableView )
::dbaui::notifySystemWindow(this,m_pTableView,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- boost::scoped_ptr<vcl::Window> aTemp(m_pSelectionBox);
- m_pSelectionBox = NULL;
-
+ m_pSelectionBox.disposeAndClear();
+ m_aSplitter.disposeAndClear();
+ OQueryView::dispose();
}
IMPL_LINK( OQueryDesignView, SplitHdl, void*, /*p*/ )
@@ -2530,8 +2535,8 @@ IMPL_LINK( OQueryDesignView, SplitHdl, void*, /*p*/ )
if (!getController().isReadOnly())
{
m_bInSplitHandler = true;
- m_aSplitter.SetPosPixel( Point( m_aSplitter.GetPosPixel().X(),m_aSplitter.GetSplitPosPixel() ) );
- static_cast<OQueryController&>(getController()).setSplitPos(m_aSplitter.GetSplitPosPixel());
+ m_aSplitter->SetPosPixel( Point( m_aSplitter->GetPosPixel().X(),m_aSplitter->GetSplitPosPixel() ) );
+ static_cast<OQueryController&>(getController()).setSplitPos(m_aSplitter->GetSplitPosPixel());
static_cast<OQueryController&>(getController()).setModified( sal_True );
Resize();
m_bInSplitHandler = true;
@@ -2541,7 +2546,7 @@ IMPL_LINK( OQueryDesignView, SplitHdl, void*, /*p*/ )
void OQueryDesignView::Construct()
{
- m_pTableView = new OQueryTableView(m_pScrollWindow,this);
+ m_pTableView = VclPtr<OQueryTableView>::Create(m_pScrollWindow,this);
::dbaui::notifySystemWindow(this,m_pTableView,::comphelper::mem_fun(&TaskPaneList::AddWindow));
OQueryView::Construct();
}
@@ -2550,8 +2555,8 @@ void OQueryDesignView::initialize()
{
if(static_cast<OQueryController&>(getController()).getSplitPos() != -1)
{
- m_aSplitter.SetPosPixel( Point( m_aSplitter.GetPosPixel().X(),static_cast<OQueryController&>(getController()).getSplitPos() ) );
- m_aSplitter.SetSplitPosPixel(static_cast<OQueryController&>(getController()).getSplitPos());
+ m_aSplitter->SetPosPixel( Point( m_aSplitter->GetPosPixel().X(),static_cast<OQueryController&>(getController()).getSplitPos() ) );
+ m_aSplitter->SetSplitPosPixel(static_cast<OQueryController&>(getController()).getSplitPos());
}
m_pSelectionBox->initialize();
reset();
@@ -2572,7 +2577,7 @@ void OQueryDesignView::resizeDocumentView(Rectangle& _rPlayground)
{
// let the selection browse box determine an optimal size
Size aSelectionBoxSize = m_pSelectionBox->CalcOptimalSize( aPlaygroundSize );
- nSplitPos = aPlaygroundSize.Height() - aSelectionBoxSize.Height() - m_aSplitter.GetSizePixel().Height();
+ nSplitPos = aPlaygroundSize.Height() - aSelectionBoxSize.Height() - m_aSplitter->GetSizePixel().Height();
// still an invalid size?
if ( nSplitPos == -1 || nSplitPos >= aPlaygroundSize.Height() )
nSplitPos = sal_Int32(aPlaygroundSize.Height()*0.6);
@@ -2587,13 +2592,13 @@ void OQueryDesignView::resizeDocumentView(Rectangle& _rPlayground)
if ( aSelBoxSize.Height() )
{
// keep the size of the sel box constant
- nSplitPos = aPlaygroundSize.Height() - m_aSplitter.GetSizePixel().Height() - aSelBoxSize.Height();
+ nSplitPos = aPlaygroundSize.Height() - m_aSplitter->GetSizePixel().Height() - aSelBoxSize.Height();
// and if the box is smaller than the optimal size, try to do something about it
Size aSelBoxOptSize = m_pSelectionBox->CalcOptimalSize( aPlaygroundSize );
if ( aSelBoxOptSize.Height() > aSelBoxSize.Height() )
{
- nSplitPos = aPlaygroundSize.Height() - m_aSplitter.GetSizePixel().Height() - aSelBoxOptSize.Height();
+ nSplitPos = aPlaygroundSize.Height() - m_aSplitter->GetSizePixel().Height() - aSelBoxOptSize.Height();
}
static_cast< OQueryController& >(getController()).setSplitPos( nSplitPos );
@@ -2603,7 +2608,7 @@ void OQueryDesignView::resizeDocumentView(Rectangle& _rPlayground)
// normalize the split pos
Point aSplitPos = Point( _rPlayground.Left(), nSplitPos );
- Size aSplitSize = Size( _rPlayground.GetSize().Width(), m_aSplitter.GetSizePixel().Height() );
+ Size aSplitSize = Size( _rPlayground.GetSize().Width(), m_aSplitter->GetSizePixel().Height() );
if( ( aSplitPos.Y() + aSplitSize.Height() ) > ( aPlaygroundSize.Height() ))
aSplitPos.Y() = aPlaygroundSize.Height() - aSplitSize.Height();
@@ -2620,8 +2625,8 @@ void OQueryDesignView::resizeDocumentView(Rectangle& _rPlayground)
m_pSelectionBox->SetPosSizePixel( aPos, Size( aPlaygroundSize.Width(), aPlaygroundSize.Height() - aSplitSize.Height() - aTableViewSize.Height() ));
// set the size of the splitter
- m_aSplitter.SetPosSizePixel( aSplitPos, aSplitSize );
- m_aSplitter.SetDragRectPixel( _rPlayground );
+ m_aSplitter->SetPosSizePixel( aSplitPos, aSplitSize );
+ m_aSplitter->SetDragRectPixel( _rPlayground );
// just for completeness: there is no space left, we occupied it all ...
_rPlayground.SetPos( _rPlayground.BottomRight() );
@@ -2746,7 +2751,7 @@ void OQueryDesignView::fillValidFields(const OUString& sAliasName, ComboBox* pFi
OJoinTableView::OTableWindowMap::iterator aEnd = rTabWins.end();
for(;aIter != aEnd;++aIter)
{
- OQueryTableWindow* pCurrentWin = static_cast<OQueryTableWindow*>(aIter->second);
+ OQueryTableWindow* pCurrentWin = static_cast<OQueryTableWindow*>(aIter->second.get());
if (bAllTables || (pCurrentWin->GetAliasName() == sAliasName))
{
strCurrentPrefix = pCurrentWin->GetAliasName();
@@ -2846,9 +2851,9 @@ OUString OQueryDesignView::getStatement()
// and trigger a error message
// ----------------- Build table list ----------------------
- const ::std::vector<OTableConnection*>& rConnList = m_pTableView->getTableConnections();
+ const auto& rConnList = m_pTableView->getTableConnections();
Reference< XConnection> xConnection = rController.getConnection();
- OUString aTableListStr(GenerateFromClause(xConnection,&rTabList,&rConnList));
+ OUString aTableListStr(GenerateFromClause(xConnection,&rTabList,rConnList));
OSL_ENSURE(!aTableListStr.isEmpty(), "OQueryDesignView::getStatement() : unexpected : have Fields, but no Tables !");
// if fields exist now, these only can be created by inserting from an already existing table; if on the other hand
// a table is deleted, also the belonging fields will be deleted -> therefore it CANNOT occur that fields
@@ -2860,7 +2865,7 @@ OUString OQueryDesignView::getStatement()
return OUString();
OUString aJoinCrit;
- GenerateInnerJoinCriterias(xConnection,aJoinCrit,&rConnList);
+ GenerateInnerJoinCriterias(xConnection,aJoinCrit,rConnList);
if(!aJoinCrit.isEmpty())
{
OUString aTmp = "( " + aJoinCrit + " )";
@@ -2994,8 +2999,8 @@ void OQueryDesignView::SaveUIConfig()
OQueryController& rCtrl = static_cast<OQueryController&>(getController());
rCtrl.SaveTabWinsPosSize( &m_pTableView->GetTabWinMap(), m_pScrollWindow->GetHScrollBar().GetThumbPos(), m_pScrollWindow->GetVScrollBar().GetThumbPos() );
rCtrl.setVisibleRows( m_pSelectionBox->GetNoneVisibleRows() );
- if ( m_aSplitter.GetSplitPosPixel() != 0 )
- rCtrl.setSplitPos( m_aSplitter.GetSplitPosPixel() );
+ if ( m_aSplitter->GetSplitPosPixel() != 0 )
+ rCtrl.setSplitPos( m_aSplitter->GetSplitPosPixel() );
}
OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDescRef pEntry,
diff --git a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx
index 49060c1bc08e..b8c9f52ad0c1 100644
--- a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx
@@ -31,7 +31,7 @@ namespace dbaui
class OJoinMoveTabWinUndoAct : public OQueryDesignUndoAction
{
Point m_ptNextPosition;
- OTableWindow* m_pTabWin;
+ VclPtr<OTableWindow> m_pTabWin;
protected:
void TogglePosition();
diff --git a/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx
index 4de742deb1d4..bd9381468ca0 100644
--- a/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx
@@ -31,7 +31,7 @@ namespace dbaui
{
Point m_ptNextPosition;
Size m_szNextSize;
- OTableWindow* m_pTabWin;
+ VclPtr<OTableWindow> m_pTabWin;
protected:
inline void ToggleSizePosition();
diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx
index 16f8e0e4b7cd..02c59c3cb998 100644
--- a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx
@@ -19,6 +19,7 @@
#include "QueryTabConnUndoAction.hxx"
#include "QTableConnection.hxx"
+#include "QTableWindow.hxx"
#include <tools/debug.hxx>
#include "QueryTableView.hxx"
#include "QueryAddTabConnUndoAction.hxx"
@@ -32,7 +33,7 @@ OQueryTabConnUndoAction::~OQueryTabConnUndoAction()
if (m_bOwnerOfConn)
{ // I have the connection -> delete
m_pOwner->DeselectConn(m_pConnection);
- delete m_pConnection;
+ m_pConnection.disposeAndClear();
}
}
@@ -50,13 +51,13 @@ OQueryAddTabConnUndoAction::OQueryAddTabConnUndoAction(OQueryTableView* pOwner)
void OQueryAddTabConnUndoAction::Undo()
{
- static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection);
+ static_cast<OQueryTableView*>(m_pOwner.get())->DropConnection(m_pConnection);
SetOwnership(true);
}
void OQueryAddTabConnUndoAction::Redo()
{
- static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection);
+ static_cast<OQueryTableView*>(m_pOwner.get())->GetConnection(m_pConnection);
SetOwnership(false);
}
@@ -67,13 +68,13 @@ OQueryDelTabConnUndoAction::OQueryDelTabConnUndoAction(OQueryTableView* pOwner)
void OQueryDelTabConnUndoAction::Undo()
{
- static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection);
+ static_cast<OQueryTableView*>(m_pOwner.get())->GetConnection(m_pConnection);
SetOwnership(false);
}
void OQueryDelTabConnUndoAction::Redo()
{
- static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection);
+ static_cast<OQueryTableView*>(m_pOwner.get())->DropConnection(m_pConnection);
SetOwnership(true);
}
@@ -88,13 +89,13 @@ OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct()
void OQueryTabWinShowUndoAct::Undo()
{
- static_cast<OQueryTableView*>(m_pOwner)->HideTabWin(m_pTabWin, this);
+ static_cast<OQueryTableView*>(m_pOwner.get())->HideTabWin(m_pTabWin, this);
SetOwnership(true);
}
void OQueryTabWinShowUndoAct::Redo()
{
- static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin(m_pTabWin, this,true);
+ static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin(m_pTabWin, this,true);
SetOwnership(false);
}
@@ -109,13 +110,13 @@ OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct()
void OQueryTabWinDelUndoAct::Undo()
{
- static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin( m_pTabWin, this,true );
+ static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin( m_pTabWin, this,true );
SetOwnership(false);
}
void OQueryTabWinDelUndoAct::Redo()
{
- static_cast<OQueryTableView*>(m_pOwner)->HideTabWin( m_pTabWin, this );
+ static_cast<OQueryTableView*>(m_pOwner.get())->HideTabWin( m_pTabWin, this );
SetOwnership(true);
}
diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx
index 72b31532213d..6541a4ed5b42 100644
--- a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx
+++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx
@@ -28,7 +28,7 @@ namespace dbaui
class OQueryTabConnUndoAction : public OQueryDesignUndoAction
{
protected:
- OQueryTableConnection* m_pConnection;
+ VclPtr<OQueryTableConnection> m_pConnection;
bool m_bOwnerOfConn;
// am I the only owner of the connection? (changes with every redo and undo)
diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
index f7bee57ce37a..d898780b9d48 100644
--- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
@@ -51,20 +51,20 @@ OQueryTabWinUndoAct::~OQueryTabWinUndoAct()
if (m_bOwnerOfObjects)
{
// I should take care to delete the window if I am the only owner
- OSL_ENSURE(m_pTabWin != NULL, "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : m_pTabWin sollte nicht NULL sein");
+ OSL_ENSURE(m_pTabWin != nullptr, "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : m_pTabWin sollte nicht NULL sein");
OSL_ENSURE(!m_pTabWin->IsVisible(), "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : *m_pTabWin sollte nicht sichtbar sein");
if ( m_pTabWin )
m_pTabWin->clearListBox();
- delete m_pTabWin;
+ m_pTabWin.disposeAndClear();
// and of course the corresponding connections
- ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ auto aIter = m_vTableConnection.begin();
+ auto aEnd = m_vTableConnection.end();
for(;aIter != aEnd;++aIter)
{
m_pOwner->DeselectConn(*aIter);
- delete (*aIter);
+ aIter->disposeAndClear();
}
m_vTableConnection.clear();
}
diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx
index 22c9921330a6..af22a64063d2 100644
--- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx
@@ -33,8 +33,8 @@ namespace dbaui
class OQueryTabWinUndoAct : public OQueryDesignUndoAction
{
protected:
- ::std::vector<OTableConnection*> m_vTableConnection;
- OQueryTableWindow* m_pTabWin;
+ ::std::vector<VclPtr<OTableConnection> > m_vTableConnection;
+ VclPtr<OQueryTableWindow> m_pTabWin;
bool m_bOwnerOfObjects;
// am I the only owner of the managed objects? (changes with every redo or undo)
@@ -54,7 +54,7 @@ namespace dbaui
// access to the managed connections
sal_uInt16 ConnCount() { return (sal_uInt16)m_vTableConnection.size(); }
- ::std::vector<OTableConnection*>& GetTabConnList() { return m_vTableConnection; }
+ ::std::vector<VclPtr<OTableConnection> >& GetTabConnList() { return m_vTableConnection; }
void InsertConnection( OTableConnection* pConnection ) { m_vTableConnection.push_back(pConnection); }
void RemoveConnection( OTableConnection* pConnection )
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index e3e92e2c3637..b39bf31e0cf0 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -118,11 +118,11 @@ namespace
{
OQueryTableConnectionData* pData = static_cast< OQueryTableConnectionData*>(_pConnectionData.get());
- DlgQryJoin aDlg(_pView,_pConnectionData,&_pView->GetTabWinMap(),_pView->getDesignView()->getController().getConnection(),_bSelectableTables);
- bool bOk = aDlg.Execute() == RET_OK;
+ ScopedVclPtrInstance< DlgQryJoin > aDlg(_pView,_pConnectionData,&_pView->GetTabWinMap(),_pView->getDesignView()->getController().getConnection(),_bSelectableTables);
+ bool bOk = aDlg->Execute() == RET_OK;
if( bOk )
{
- pData->SetJoinType(aDlg.GetJoinType());
+ pData->SetJoinType(aDlg->GetJoinType());
_pView->getDesignView()->getController().setModified(sal_True);
}
@@ -208,10 +208,10 @@ namespace
pNewConnData->AppendConnLine(*pIter,sRelatedColumn);
// now add the Conn itself
- OQueryTableConnection aNewConn(_pView, aNewConnData);
+ ScopedVclPtrInstance< OQueryTableConnection > aNewConn(_pView, aNewConnData);
// referring to the local variable is not important, as NotifyQueryTabConn creates a new copy
// to add me (if not existent)
- _pView->NotifyTabConnection(aNewConn, false);
+ _pView->NotifyTabConnection(*aNewConn.get(), false);
// don't create an Undo-Action for the new connection : the connection is
// covered by the Undo-Action for the tabwin, as the "Undo the insert" will
// automatically remove all connections adjacent to the win.
@@ -228,10 +228,6 @@ OQueryTableView::OQueryTableView( vcl::Window* pParent,OQueryDesignView* pView)
SetHelpId(HID_CTL_QRYDGNTAB);
}
-OQueryTableView::~OQueryTableView()
-{
-}
-
sal_Int32 OQueryTableView::CountTableAlias(const OUString& rName, sal_Int32& rMax)
{
sal_Int32 nRet = 0;
@@ -263,7 +259,7 @@ void OQueryTableView::ReSync()
for(;aIter != rTabWinDataList.rend();++aIter)
{
OQueryTableWindowData* pData = static_cast<OQueryTableWindowData*>(aIter->get());
- OTableWindow* pTabWin = createWindow(*aIter);
+ VclPtr<OTableWindow> pTabWin = createWindow(*aIter);
// I dont't use ShowTabWin as this adds the window data to the list of documents.
// This would be bad as I am getting them from there.
@@ -273,7 +269,7 @@ void OQueryTableView::ReSync()
// The initialisation has gone wrong, this TabWin is not available, so
// I must clean up the data and the document
pTabWin->clearListBox();
- delete pTabWin;
+ pTabWin.disposeAndClear();
arrInvalidTables.push_back(pData->GetAliasName());
rTabWinDataList.erase( ::std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end());
@@ -310,7 +306,7 @@ void OQueryTableView::ReSync()
}
// adds a new connection to join view and notifies our accessible and invaldates the controller
- addConnection(new OQueryTableConnection(this, *aConIter));
+ addConnection(VclPtr<OQueryTableConnection>::Create(this, *aConIter));
}
}
@@ -322,35 +318,35 @@ void OQueryTableView::ClearAll()
m_pView->getController().setModified(sal_True);
}
-OTableWindow* OQueryTableView::createWindow(const TTableWindowData::value_type& _pData)
+VclPtr<OTableWindow> OQueryTableView::createWindow(const TTableWindowData::value_type& _pData)
{
- return new OQueryTableWindow(this,_pData);
+ return VclPtr<OQueryTableWindow>::Create(this,_pData);
}
void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn, bool _bCreateUndoAction)
{
// let's first check if I have the connection already
OQueryTableConnection* pTabConn = NULL;
- const ::std::vector<OTableConnection*>& rConnections = getTableConnections();
- ::std::vector<OTableConnection*>::const_iterator aEnd = rConnections.end();
- ::std::vector<OTableConnection*>::const_iterator aIter = ::std::find( rConnections.begin(),
- aEnd,
- static_cast<const OTableConnection*>(&rNewConn)
- );
+ const auto& rConnections = getTableConnections();
+ auto aEnd = rConnections.end();
+ auto aIter = ::std::find( rConnections.begin(),
+ aEnd,
+ VclPtr<OTableConnection>(const_cast<OTableConnection*>(static_cast<const OTableConnection*>(&rNewConn)))
+ );
if(aIter == aEnd )
{
aIter = rConnections.begin();
for(;aIter != aEnd;++aIter)
{
- if(*static_cast<OQueryTableConnection*>(*aIter) == rNewConn)
+ if(*static_cast<OQueryTableConnection*>((*aIter).get()) == rNewConn)
{
- pTabConn = static_cast<OQueryTableConnection*>(*aIter);
+ pTabConn = static_cast<OQueryTableConnection*>((*aIter).get());
break;
}
}
}
else
- pTabConn = static_cast<OQueryTableConnection*>(*aIter);
+ pTabConn = static_cast<OQueryTableConnection*>((*aIter).get());
// no -> insert
if (pTabConn == NULL)
@@ -359,7 +355,7 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn,
OQueryTableConnectionData* pNewData = static_cast< OQueryTableConnectionData*>(rNewConn.GetData()->NewInstance());
pNewData->CopyFrom(*rNewConn.GetData());
TTableConnectionData::value_type aData(pNewData);
- OQueryTableConnection* pNewConn = new OQueryTableConnection(this, aData);
+ VclPtrInstance<OQueryTableConnection> pNewConn(this, aData);
GetConnection(pNewConn);
connectionModified(this,pNewConn,_bCreateUndoAction);
@@ -461,7 +457,7 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
// I do not need to add TabWinData to the DocShell list, ShowTabWin does that.
// Create a new window
- OQueryTableWindow* pNewTabWin = static_cast<OQueryTableWindow*>(createWindow(pNewTabWinData));
+ VclPtr<OQueryTableWindow> pNewTabWin = static_cast<OQueryTableWindow*>(createWindow(pNewTabWinData).get());
// No need to initialize, as that happens in ShowTabWin
// New UndoAction
@@ -529,14 +525,14 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
{
for(aIter = rTabWins.begin();aIter != aEnd;++aIter)
{
- OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second);
+ OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second.get());
OSL_ENSURE( pTabWinTmp,"TableWindow is null!" );
if ( pTabWinTmp != pNewTabWin && pTabWinTmp->GetComposedName() == aReferencedTable )
break;
}
}
- if ( aIter != aEnd && pNewTabWin != aIter->second )
- addConnections( this, *pNewTabWin, *static_cast<OQueryTableWindow*>(aIter->second), xFKeyColumns );
+ if ( aIter != aEnd && pNewTabWin.get() != aIter->second.get() )
+ addConnections( this, *pNewTabWin, *static_cast<OQueryTableWindow*>(aIter->second.get()), xFKeyColumns );
}
break;
@@ -547,7 +543,7 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
OTableWindowMap::const_iterator aEnd = rTabWins.end();
for(;aIter != aEnd;++aIter)
{
- OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second);
+ OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second.get());
if ( pTabWinTmp == pNewTabWin )
continue;
@@ -625,8 +621,8 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
pNewConnectionData->AppendConnLine( aSourceFieldName,aDestFieldName );
- OQueryTableConnection aNewConnection(this, aNewConnectionData);
- NotifyTabConnection(aNewConnection);
+ ScopedVclPtrInstance< OQueryTableConnection > aNewConnection(this, aNewConnectionData);
+ NotifyTabConnection(*aNewConnection.get());
// As usual with NotifyTabConnection, using a local variable is fine because a copy is made
}
else
@@ -660,8 +656,8 @@ void OQueryTableView::createNewConnection()
if( openJoinDialog(this,pData,true) )
{
OTableWindowMap& rMap = GetTabWinMap();
- OQueryTableWindow* pSourceWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencingTable()->GetWinName()]);
- OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencedTable()->GetWinName()]);
+ OQueryTableWindow* pSourceWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencingTable()->GetWinName()].get());
+ OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencedTable()->GetWinName()].get());
// first we have to look if the this connection already exists
OTableConnection* pConn = GetTabConn(pSourceWin,pDestWin,true);
bool bNew = true;
@@ -673,7 +669,7 @@ void OQueryTableView::createNewConnection()
else
{
// create a new conenction and append it
- OQueryTableConnection* pQConn = new OQueryTableConnection(this, pData);
+ VclPtrInstance<OQueryTableConnection> pQConn(this, pData);
GetConnection(pQConn);
pConn = pQConn;
}
@@ -708,7 +704,7 @@ OQueryTableWindow* OQueryTableView::FindTable(const OUString& rAliasName)
// (it is harmless but does not make sense and indicates that there is probably an error in the caller)
OTableWindowMap::const_iterator aIter = GetTabWinMap().find(rAliasName);
if(aIter != GetTabWinMap().end())
- return static_cast<OQueryTableWindow*>(aIter->second);
+ return static_cast<OQueryTableWindow*>(aIter->second.get());
return NULL;
}
@@ -719,7 +715,7 @@ bool OQueryTableView::FindTableFromField(const OUString& rFieldName, OTableField
OTableWindowMap::const_iterator aEnd = GetTabWinMap().end();
for(;aIter != aEnd;++aIter)
{
- if(static_cast<OQueryTableWindow*>(aIter->second)->ExistsField(rFieldName, rInfo))
+ if(static_cast<OQueryTableWindow*>(aIter->second.get())->ExistsField(rFieldName, rInfo))
++rCnt;
}
@@ -838,11 +834,11 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
// collect connections belonging to the window and pass to UndoAction
sal_Int16 nCnt = 0;
- const ::std::vector<OTableConnection*>& rTabConList = getTableConnections();
- ::std::vector<OTableConnection*>::const_iterator aIter2 = rTabConList.begin();
+ const auto& rTabConList = getTableConnections();
+ auto aIter2 = rTabConList.begin();
for(;aIter2 != rTabConList.end();)// the end may change
{
- OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>(*aIter2);
+ OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>((*aIter2).get());
OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!");
if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() ||
pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() )
@@ -908,12 +904,9 @@ bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
// GetEntryPos, and then in turn by the Connection, when its starting point to the window must be determined.
// the Connections
- ::std::vector<OTableConnection*>& rTableCon = pUndoAction->GetTabConnList();
- ::std::vector<OTableConnection*>::iterator aIter = rTableCon.begin();
- ::std::vector<OTableConnection*>::iterator aEnd = rTableCon.end();
-
- for(;aIter != aEnd;++aIter)
- addConnection(*aIter); // add all connections from the undo action
+ auto rTableCon = pUndoAction->GetTabConnList();
+ for(auto conn : rTableCon)
+ addConnection(conn); // add all connections from the undo action
rTableCon.clear();
@@ -933,7 +926,7 @@ bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
// Initialisation failed
// (for example when the Connection to the database is not available at the moment)
pTabWin->clearListBox();
- delete pTabWin;
+ pTabWin->disposeOnce();
}
}
@@ -954,12 +947,9 @@ void OQueryTableView::InsertField(const OTableFieldDescRef& rInfo)
bool OQueryTableView::ExistsAVisitedConn(const OQueryTableWindow* pFrom) const
{
- const ::std::vector<OTableConnection*>& rList = getTableConnections();
- ::std::vector<OTableConnection*>::const_iterator aIter = rList.begin();
- ::std::vector<OTableConnection*>::const_iterator aEnd = rList.end();
- for(;aIter != aEnd;++aIter)
+ for(auto conn : getTableConnections())
{
- OQueryTableConnection* pTemp = static_cast<OQueryTableConnection*>(*aIter);
+ OQueryTableConnection* pTemp = static_cast<OQueryTableConnection*>(conn.get());
if (pTemp->IsVisited() &&
(pFrom == static_cast< OQueryTableWindow*>(pTemp->GetSourceWin()) || pFrom == static_cast< OQueryTableWindow*>(pTemp->GetDestWin())))
return true;
diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx
index 107daa95ec2d..9c3e7412cc6a 100644
--- a/dbaccess/source/ui/querydesign/QueryTextView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star::frame;
OQueryTextView::OQueryTextView(OQueryContainerWindow* _pParent)
:Window(_pParent)
{
- m_pEdit = new OSqlEdit(this);
+ m_pEdit = VclPtr<OSqlEdit>::Create(this);
m_pEdit->SetRightToLeft(false);
m_pEdit->ClearModifyFlag();
m_pEdit->SaveValue();
@@ -52,8 +52,13 @@ OQueryTextView::OQueryTextView(OQueryContainerWindow* _pParent)
OQueryTextView::~OQueryTextView()
{
- boost::scoped_ptr<vcl::Window> aTemp(m_pEdit);
- m_pEdit = NULL;
+ disposeOnce();
+}
+
+void OQueryTextView::dispose()
+{
+ m_pEdit.disposeAndClear();
+ vcl::Window::dispose();
}
void OQueryTextView::GetFocus()
diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
index cdc16fd0dea1..4baf60797154 100644
--- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
+++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
@@ -36,20 +36,12 @@ OQueryViewSwitch::OQueryViewSwitch(OQueryContainerWindow* _pParent, OQueryContro
: m_bAddTableDialogWasVisible(false)
{
- m_pTextView = new OQueryTextView(_pParent);
- m_pDesignView = new OQueryDesignView( _pParent, _rController, _rxContext );
+ m_pTextView = VclPtr<OQueryTextView>::Create(_pParent);
+ m_pDesignView = VclPtr<OQueryDesignView>::Create( _pParent, _rController, _rxContext );
}
OQueryViewSwitch::~OQueryViewSwitch()
{
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pTextView);
- m_pTextView = NULL;
- }
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pDesignView);
- m_pDesignView = NULL;
- }
}
void OQueryViewSwitch::Construct()
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index b628238191d9..05d3d05219db 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -117,12 +117,12 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent )
| BrowserMode::HLINES | BrowserMode::VLINES
| BrowserMode::HEADERBAR_NEW ;
- m_pTextCell = new Edit(&GetDataWindow(), 0);
- m_pVisibleCell = new CheckBoxControl(&GetDataWindow());
- m_pTableCell = new ListBoxControl(&GetDataWindow()); m_pTableCell->SetDropDownLineCount( 20 );
- m_pFieldCell = new ComboBoxControl(&GetDataWindow()); m_pFieldCell->SetDropDownLineCount( 20 );
- m_pOrderCell = new ListBoxControl(&GetDataWindow());
- m_pFunctionCell = new ListBoxControl(&GetDataWindow()); m_pFunctionCell->SetDropDownLineCount( 20 );
+ m_pTextCell = VclPtr<Edit>::Create(&GetDataWindow(), 0);
+ m_pVisibleCell = VclPtr<CheckBoxControl>::Create(&GetDataWindow());
+ m_pTableCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); m_pTableCell->SetDropDownLineCount( 20 );
+ m_pFieldCell = VclPtr<ComboBoxControl>::Create(&GetDataWindow()); m_pFieldCell->SetDropDownLineCount( 20 );
+ m_pOrderCell = VclPtr<ListBoxControl>::Create(&GetDataWindow());
+ m_pFunctionCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); m_pFunctionCell->SetDropDownLineCount( 20 );
m_pVisibleCell->SetHelpId(HID_QRYDGN_ROW_VISIBLE);
m_pTableCell->SetHelpId(HID_QRYDGN_ROW_TABLE);
@@ -154,13 +154,18 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent )
OSelectionBrowseBox::~OSelectionBrowseBox()
{
+ disposeOnce();
+}
- delete m_pTextCell;
- delete m_pVisibleCell;
- delete m_pFieldCell;
- delete m_pTableCell;
- delete m_pOrderCell;
- delete m_pFunctionCell;
+void OSelectionBrowseBox::dispose()
+{
+ m_pTextCell.disposeAndClear();
+ m_pVisibleCell.disposeAndClear();
+ m_pFieldCell.disposeAndClear();
+ m_pTableCell.disposeAndClear();
+ m_pOrderCell.disposeAndClear();
+ m_pFunctionCell.disposeAndClear();
+ ::svt::EditBrowseBox::dispose();
}
void OSelectionBrowseBox::initialize()
@@ -241,11 +246,13 @@ namespace
{
class OSelectionBrwBoxHeader : public ::svt::EditBrowserHeader
{
- OSelectionBrowseBox* m_pBrowseBox;
+ VclPtr<OSelectionBrowseBox> m_pBrowseBox;
protected:
virtual void Select() SAL_OVERRIDE;
public:
OSelectionBrwBoxHeader(OSelectionBrowseBox* pParent);
+ virtual ~OSelectionBrwBoxHeader() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_pBrowseBox.clear(); ::svt::EditBrowserHeader::dispose(); }
};
OSelectionBrwBoxHeader::OSelectionBrwBoxHeader(OSelectionBrowseBox* pParent)
: ::svt::EditBrowserHeader(pParent,WB_BUTTONSTYLE|WB_DRAG)
@@ -275,9 +282,9 @@ namespace
}
}
-BrowserHeader* OSelectionBrowseBox::imp_CreateHeaderBar(BrowseBox* /*pParent*/)
+VclPtr<BrowserHeader> OSelectionBrowseBox::imp_CreateHeaderBar(BrowseBox* /*pParent*/)
{
- return new OSelectionBrwBoxHeader(this);
+ return VclPtr<OSelectionBrwBoxHeader>::Create(this);
}
void OSelectionBrowseBox::ColumnMoved( sal_uInt16 nColId, bool _bCreateUndo )
@@ -491,7 +498,7 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon
OJoinTableView::OTableWindowMap::iterator aEnd = rTabWinList.end();
for(;aIter != aEnd;++aIter)
- m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(aIter->second)->GetAliasName());
+ m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(aIter->second.get())->GetAliasName());
m_pTableCell->InsertEntry(OUString(ModuleRes(STR_QUERY_NOTABLE)), 0);
if (!pEntry->GetAlias().isEmpty())
@@ -986,7 +993,7 @@ bool OSelectionBrowseBox::SaveModified()
OJoinTableView::OTableWindowMap::iterator aIter = rTabWinList.find(aAliasName);
if(aIter != rTabWinList.end())
{
- OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second);
+ OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second.get());
if (pEntryTab)
{
pEntry->SetTable(pEntryTab->GetTableName());
@@ -2603,7 +2610,7 @@ bool OSelectionBrowseBox::fillEntryTable(OTableFieldDescRef& _pEntry,const OUStr
OJoinTableView::OTableWindowMap::iterator aIter = rTabWinList.find(_sTableName);
if(aIter != rTabWinList.end())
{
- OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second);
+ OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second.get());
if (pEntryTab)
{
_pEntry->SetTable(pEntryTab->GetTableName());
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
index 6d3901e8d4ca..8c30610be159 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
@@ -56,12 +56,12 @@ namespace dbaui
long m_nSeekRow;
BrowserMode m_nMode; // remember the BrowseModes
- Edit* m_pTextCell;
- ::svt::CheckBoxControl* m_pVisibleCell;
- ::svt::ComboBoxControl* m_pFieldCell;
- ::svt::ListBoxControl* m_pFunctionCell;
- ::svt::ListBoxControl* m_pTableCell;
- ::svt::ListBoxControl* m_pOrderCell;
+ VclPtr<Edit> m_pTextCell;
+ VclPtr<::svt::CheckBoxControl> m_pVisibleCell;
+ VclPtr<::svt::ComboBoxControl> m_pFieldCell;
+ VclPtr<::svt::ListBoxControl> m_pFunctionCell;
+ VclPtr<::svt::ListBoxControl> m_pTableCell;
+ VclPtr<::svt::ListBoxControl> m_pOrderCell;
OTableFieldDescRef m_pEmptyEntry; // default entry in the list may reference more than once
@@ -80,6 +80,7 @@ namespace dbaui
DECL_LINK(OnInvalidateTimer, void*);
public: OSelectionBrowseBox( vcl::Window* pParent );
virtual ~OSelectionBrowseBox();
+ virtual void dispose() SAL_OVERRIDE;
void initialize();
OTableFieldDescRef InsertField( const OJoinExchangeData& jxdSource, sal_uInt16 _nColumnPosition = BROWSER_INVALIDID, bool bVis=true, bool bActivate=true );
@@ -205,7 +206,7 @@ namespace dbaui
virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) SAL_OVERRIDE;
// if you want to have an own header ...
- virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
+ virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
void stopTimer();
void startTimer();
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index 6d7864e06db7..457a58481c64 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -43,7 +43,7 @@ namespace dbaui
Show();
}
- OTableConnection::OTableConnection( const OTableConnection& _rConn ) : Window(_rConn.m_pParent)
+ OTableConnection::OTableConnection( const OTableConnection& _rConn ) : Window(_rConn.m_pParent.get())
,m_pData(_rConn.GetData()->NewInstance())
,m_pParent(NULL)
{
diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
index d27e3dadb494..db44c06a982b 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -23,6 +23,7 @@
#include <tools/debug.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
#include <comphelper/namedvaluecollection.hxx>
+#include <vcl/window.hxx>
#include <functional>
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 35888462af34..e0c1e5bf0ea3 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -69,8 +69,8 @@ namespace DatabaseObject = css::sdb::application::DatabaseObject;
OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData )
: ::comphelper::OContainerListener(m_aMutex)
,Window( pParent, WB_3DLOOK|WB_MOVEABLE )
- ,m_aTypeImage( this )
- ,m_aTitle( this )
+ ,m_aTypeImage( VclPtr<FixedImage>::Create(this) )
+ ,m_aTitle( VclPtr<OTableWindowTitle>::Create(this) )
,m_pListBox(NULL)
,m_pAccessible(NULL)
,m_pData( pTabWinData )
@@ -99,17 +99,23 @@ OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_
OTableWindow::~OTableWindow()
{
+ disposeOnce();
+}
+void OTableWindow::dispose()
+{
if (m_pListBox)
{
OSL_ENSURE(m_pListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!");
- boost::scoped_ptr<vcl::Window> aTemp(m_pListBox);
- m_pListBox = NULL;
}
+ m_pListBox.disposeAndClear();
if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
m_pAccessible = NULL;
+ m_aTypeImage.disposeAndClear();
+ m_aTitle.disposeAndClear();
+ vcl::Window::dispose();
}
const OJoinTableView* OTableWindow::getTableView() const
@@ -155,9 +161,9 @@ void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
SetSizePixel( rNewSize );
}
-OTableWindowListBox* OTableWindow::CreateListBox()
+VclPtr<OTableWindowListBox> OTableWindow::CreateListBox()
{
- return new OTableWindowListBox(this);
+ return VclPtr<OTableWindowListBox>::Create(this);
}
bool OTableWindow::FillListBox()
@@ -263,8 +269,8 @@ void OTableWindow::impl_updateImage()
return;
}
- m_aTypeImage.SetModeImage( aImage );
- m_aTypeImage.Show();
+ m_aTypeImage->SetModeImage( aImage );
+ m_aTypeImage->Show();
}
bool OTableWindow::Init()
@@ -273,13 +279,13 @@ bool OTableWindow::Init()
if ( !m_pListBox )
{
m_pListBox = CreateListBox();
- OSL_ENSURE( m_pListBox != NULL, "OTableWindow::Init() : CreateListBox returned NULL !" );
+ OSL_ENSURE( m_pListBox != nullptr, "OTableWindow::Init() : CreateListBox returned NULL !" );
m_pListBox->SetSelectionMode( MULTIPLE_SELECTION );
}
// Set the title
- m_aTitle.SetText( m_pData->GetWinName() );
- m_aTitle.Show();
+ m_aTitle->SetText( m_pData->GetWinName() );
+ m_aTitle->Show();
m_pListBox->Show();
@@ -456,15 +462,15 @@ void OTableWindow::Resize()
long nPositionY = n5Pos;
// position the image which indicates the type
- m_aTypeImage.SetPosPixel( Point( nPositionX, nPositionY ) );
- Size aImageSize( m_aTypeImage.GetImage().GetSizePixel() );
- m_aTypeImage.SetSizePixel( aImageSize );
+ m_aTypeImage->SetPosPixel( Point( nPositionX, nPositionY ) );
+ Size aImageSize( m_aTypeImage->GetImage().GetSizePixel() );
+ m_aTypeImage->SetSizePixel( aImageSize );
if ( nTitleHeight < aImageSize.Height() )
nTitleHeight = aImageSize.Height();
nPositionX += aImageSize.Width() + CalcZoom( 2 );
- m_aTitle.SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) );
+ m_aTitle->SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) );
long nTitleToList = CalcZoom( 3 );
@@ -478,10 +484,10 @@ void OTableWindow::Resize()
void OTableWindow::SetBoldTitle( bool bBold )
{
- vcl::Font aFont = m_aTitle.GetFont();
+ vcl::Font aFont = m_aTitle->GetFont();
aFont.SetWeight( bBold?WEIGHT_BOLD:WEIGHT_NORMAL );
- m_aTitle.SetFont( aFont );
- m_aTitle.Invalidate();
+ m_aTitle->SetFont( aFont );
+ m_aTitle->Invalidate();
}
void OTableWindow::GetFocus()
@@ -559,7 +565,7 @@ void OTableWindow::StateChanged( StateChangedType nType )
aFont.Merge( GetControlFont() );
SetZoomedPointFont( aFont );
- m_aTitle.SetZoom(GetZoom());
+ m_aTitle->SetZoom(GetZoom());
m_pListBox->SetZoom(GetZoom());
Resize();
Invalidate();
@@ -591,7 +597,7 @@ void OTableWindow::Command(const CommandEvent& rEvt)
if ( pCurrent )
ptWhere = m_pListBox->GetEntryPosition(pCurrent);
else
- ptWhere = m_aTitle.GetPosPixel();
+ ptWhere = m_aTitle->GetPosPixel();
}
PopupMenu aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE));
@@ -746,7 +752,7 @@ bool OTableWindow::PreNotify(NotifyEvent& rNEvt)
OUString OTableWindow::getTitle() const
{
- return m_aTitle.GetText();
+ return m_aTitle->GetText();
}
void OTableWindow::_elementInserted( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
index c122c96dc79d..82580fc83f02 100644
--- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
@@ -192,7 +192,7 @@ namespace dbaui
if( m_pTable )
{
OJoinTableView* pView = m_pTable->getTableView();
- ::std::vector<OTableConnection*>::const_iterator aIter = pView->getTableConnections(m_pTable) + nIndex;
+ auto aIter = pView->getTableConnections(m_pTable) + nIndex;
aRet.TargetSet.realloc(1);
aRet.TargetSet[0] = getParentChild(aIter - pView->getTableConnections().begin());
aRet.RelationType = AccessibleRelationType::CONTROLLER_FOR;
@@ -211,10 +211,10 @@ namespace dbaui
if( AccessibleRelationType::CONTROLLER_FOR == aRelationType && m_pTable)
{
OJoinTableView* pView = m_pTable->getTableView();
- const ::std::vector<OTableConnection*>& rConnectionList = pView->getTableConnections();
+ const auto& rConnectionList = pView->getTableConnections();
- ::std::vector<OTableConnection*>::const_iterator aIter = pView->getTableConnections(m_pTable);
- ::std::vector<OTableConnection*>::const_iterator aEnd = rConnectionList.end();
+ auto aIter = pView->getTableConnections(m_pTable);
+ auto aEnd = rConnectionList.end();
::std::vector< Reference<XInterface> > aRelations;
aRelations.reserve(5); // just guessing
for (; aIter != aEnd ; ++aIter )
diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
index 1796dcf8e574..2453bd292f67 100644
--- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
@@ -68,13 +68,19 @@ void OTableWindowListBox::dragFinished( )
OTableWindowListBox::~OTableWindowListBox()
{
+ disposeOnce();
+}
+
+void OTableWindowListBox::dispose()
+{
if (m_nDropEvent)
Application::RemoveUserEvent(m_nDropEvent);
if (m_nUiEvent)
Application::RemoveUserEvent(m_nUiEvent);
if( m_aScrollTimer.IsActive() )
m_aScrollTimer.Stop();
- m_pTabWin = NULL;
+ m_pTabWin.clear();
+ SvTreeListBox::dispose();
}
SvTreeListEntry* OTableWindowListBox::GetEntryFromText( const OUString& rEntryText )
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 79bcc29c871d..a0fba532d142 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -55,7 +55,13 @@ OTableWindowTitle::OTableWindowTitle( OTableWindow* pParent ) :
OTableWindowTitle::~OTableWindowTitle()
{
- m_pTabWin = NULL;
+ disposeOnce();
+}
+
+void OTableWindowTitle::dispose()
+{
+ m_pTabWin.clear();
+ FixedText::dispose();
}
void OTableWindowTitle::GetFocus()
@@ -130,10 +136,8 @@ void OTableWindowTitle::MouseButtonDown( const MouseEvent& rEvt )
OJoinTableView* pView = static_cast<OJoinTableView*>(m_pTabWin->getTableView());
OSL_ENSURE(pView,"No OJoinTableView!");
- const ::std::vector<OTableConnection*>& rConns = pView->getTableConnections();
- ::std::for_each(rConns.begin(),
- rConns.end(),
- ::std::mem_fun(&OTableConnection::RecalcLines));
+ for (auto conn : pView->getTableConnections())
+ conn->RecalcLines();
pView->InvalidateConnections();
pView->getDesignView()->getController().setModified(sal_True);
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index ad0c88866ed6..54a682e77482 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -34,7 +34,6 @@ class LimitBoxImpl: public LimitBox
{
public:
LimitBoxImpl( vcl::Window* pParent, LimitBoxController* pCtrl );
- virtual ~LimitBoxImpl();
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -48,10 +47,6 @@ LimitBoxImpl::LimitBoxImpl( vcl::Window* pParent, LimitBoxController* pCtrl )
{
}
-LimitBoxImpl::~LimitBoxImpl()
-{
-}
-
bool LimitBoxImpl::Notify( NotifyEvent& rNEvt )
{
bool nHandled = false;
@@ -144,8 +139,7 @@ throw (uno::RuntimeException, std::exception)
svt::ToolboxController::dispose();
SolarMutexGuard aSolarMutexGuard;
- delete m_pLimitBox;
- m_pLimitBox = 0;
+ m_pLimitBox.disposeAndClear();
}
/// XStatusListener
@@ -206,7 +200,7 @@ uno::Reference< awt::XWindow > SAL_CALL LimitBoxController::createItemWindow(
if ( pParent )
{
SolarMutexGuard aSolarMutexGuard;
- m_pLimitBox = new LimitBoxImpl(pParent, this);
+ m_pLimitBox = VclPtr<LimitBoxImpl>::Create(pParent, this);
m_pLimitBox->SetSizePixel(m_pLimitBox->CalcBlockSize(6,1));
xItemWindow = VCLUnoHelper::GetInterface( m_pLimitBox );
}
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
index 1db59a8e6ebf..93401164eca1 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
@@ -13,6 +13,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <svtools/toolboxcontroller.hxx>
#include <rtl/ustring.hxx>
+#include <vcl/vclptr.hxx>
#include "apitools.hxx"
@@ -59,7 +60,7 @@ class LimitBoxController: public svt::ToolboxController,
using svt::ToolboxController::dispatchCommand;
private:
- LimitBoxImpl* m_pLimitBox;
+ VclPtr<LimitBoxImpl> m_pLimitBox;
};
} ///dbaui namespace
diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
index 7372ec724d2a..9aa8ba3d6494 100644
--- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
+++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
@@ -49,20 +49,24 @@ namespace dbaui
{
m_pViewSwitch = new OQueryViewSwitch( this, _rController, _rxContext );
- m_pSplitter = new Splitter(this,WB_VSCROLL);
+ m_pSplitter = VclPtr<Splitter>::Create(this,WB_VSCROLL);
m_pSplitter->Hide();
m_pSplitter->SetSplitHdl( LINK( this, OQueryContainerWindow, SplitHdl ) );
m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
}
OQueryContainerWindow::~OQueryContainerWindow()
{
+ disposeOnce();
+ }
+ void OQueryContainerWindow::dispose()
+ {
{
boost::scoped_ptr<OQueryViewSwitch> aTemp(m_pViewSwitch);
m_pViewSwitch = NULL;
}
if ( m_pBeamer )
::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- m_pBeamer = NULL;
+ m_pBeamer.clear();
if ( m_xBeamer.is() )
{
Reference< ::com::sun::star::util::XCloseable > xCloseable(m_xBeamer,UNO_QUERY);
@@ -71,9 +75,8 @@ namespace dbaui
xCloseable->close(sal_False); // false - holds the ownership of this frame
}
- boost::scoped_ptr<vcl::Window> aTemp(m_pSplitter);
- m_pSplitter = NULL;
-
+ m_pSplitter.disposeAndClear();
+ ODataView::dispose();
}
bool OQueryContainerWindow::switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo )
{
@@ -171,7 +174,7 @@ namespace dbaui
{
if(!m_pBeamer)
{
- m_pBeamer = new OBeamer(this);
+ m_pBeamer = VclPtr<OBeamer>::Create(this);
::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::AddWindow));
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 92dde0c697a5..ad454569a103 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -763,9 +763,9 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
if ( pNode )
{
vcl::Window* pView = getView();
- ModalDialog* pWindow = new ModalDialog( pView, WB_STDMODAL | WB_SIZEMOVE | WB_CENTER );
+ ScopedVclPtrInstance<ModalDialog> pWindow( pView, WB_STDMODAL | WB_SIZEMOVE | WB_CENTER );
pWindow->SetSizePixel( ::Size( pView->GetSizePixel().Width() / 2, pView->GetSizePixel().Height() / 2 ) );
- SvTreeListBox* pTreeBox = new SvTreeListBox( pWindow, WB_BORDER | WB_HASLINES | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HASLINESATROOT | WB_VSCROLL );
+ ScopedVclPtrInstance<SvTreeListBox> pTreeBox( pWindow, WB_BORDER | WB_HASLINES | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HASLINESATROOT | WB_VSCROLL );
pTreeBox->SetPosSizePixel( ::Point( 6, 6 ), ::Size( pWindow->GetSizePixel().Width() - 12, pWindow->GetSizePixel().Height() - 12 ));
pTreeBox->SetNodeDefaultImages();
@@ -799,8 +799,6 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
pTreeBox->Show();
pWindow->Execute();
- delete pTreeBox;
- delete pWindow;
delete pNode;
}
break;
@@ -987,8 +985,8 @@ void OQueryController::impl_initialize()
OUString aTitle( ModuleRes( STR_QUERYDESIGN_NO_VIEW_SUPPORT ) );
OUString aMessage( ModuleRes( STR_QUERYDESIGN_NO_VIEW_ASK ) );
ODataView* pWindow = getView();
- OSQLMessageBox aDlg( pWindow, aTitle, aMessage, WB_YES_NO | WB_DEF_YES, OSQLMessageBox::Query );
- bClose = aDlg.Execute() == RET_NO;
+ ScopedVclPtrInstance< OSQLMessageBox > aDlg( pWindow, aTitle, aMessage, WB_YES_NO | WB_DEF_YES, OSQLMessageBox::Query );
+ bClose = aDlg->Execute() == RET_NO;
}
if ( bClose )
throw VetoException();
@@ -1117,7 +1115,7 @@ bool OQueryController::Construct(vcl::Window* pParent)
{
// TODO: we have to check if we should create the text view or the design view
- setView( * new OQueryContainerWindow( pParent, *this, getORB() ) );
+ setView( VclPtr<OQueryContainerWindow>::Create( pParent, *this, getORB() ) );
return OJoinController::Construct(pParent);
}
@@ -1238,13 +1236,13 @@ void OQueryController::loadViewSettings( const ::comphelper::NamedValueCollectio
void OQueryController::execute_QueryPropDlg()
{
- QueryPropertiesDialog aQueryPropDlg(
+ ScopedVclPtrInstance<QueryPropertiesDialog> aQueryPropDlg(
getContainer(), m_bDistinct, m_nLimit );
- if( aQueryPropDlg.Execute() == RET_OK )
+ if( aQueryPropDlg->Execute() == RET_OK )
{
- m_bDistinct = aQueryPropDlg.getDistinct();
- m_nLimit = aQueryPropDlg.getLimit();
+ m_bDistinct = aQueryPropDlg->getDistinct();
+ m_nLimit = aQueryPropDlg->getLimit();
InvalidateFeature( SID_QUERY_DISTINCT_VALUES );
InvalidateFeature( SID_QUERY_LIMIT, 0, true );
}
@@ -1398,7 +1396,7 @@ bool OQueryController::askForNewName(const Reference<XNameAccess>& _xElements, b
}
DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::QUERY );
- OSaveAsDlg aDlg(
+ ScopedVclPtrInstance<OSaveAsDlg> aDlg(
getView(),
m_nCommandType,
getORB(),
@@ -1407,14 +1405,14 @@ bool OQueryController::askForNewName(const Reference<XNameAccess>& _xElements, b
aNameChecker,
SAD_DEFAULT );
- bRet = ( aDlg.Execute() == RET_OK );
+ bRet = ( aDlg->Execute() == RET_OK );
if ( bRet )
{
- m_sName = aDlg.getName();
+ m_sName = aDlg->getName();
if ( editingView() )
{
- m_sUpdateCatalogName = aDlg.getCatalog();
- m_sUpdateSchemaName = aDlg.getSchema();
+ m_sUpdateCatalogName = aDlg->getCatalog();
+ m_sUpdateSchemaName = aDlg->getSchema();
}
}
}
@@ -1802,9 +1800,9 @@ short OQueryController::saveModified()
)
{
OUString sMessageText( lcl_getObjectResourceString( STR_QUERY_SAVEMODIFIED, m_nCommandType ) );
- QueryBox aQry( getView(), WB_YES_NO_CANCEL | WB_DEF_YES, sMessageText );
+ ScopedVclPtrInstance< QueryBox > aQry( getView(), WB_YES_NO_CANCEL | WB_DEF_YES, sMessageText );
- nRet = aQry.Execute();
+ nRet = aQry->Execute();
if ( ( nRet == RET_YES )
&& !doSaveAsDoc( false )
)
@@ -1914,8 +1912,8 @@ void OQueryController::impl_reset( const bool i_bForceCurrentControllerSettings
if ( !i_bForceCurrentControllerSettings && !editingView() )
{
OUString aTitle(ModuleRes(STR_SVT_SQL_SYNTAX_ERROR));
- OSQLMessageBox aDlg(getView(),aTitle,aErrorMsg);
- aDlg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aDlg(getView(),aTitle,aErrorMsg);
+ aDlg->Execute();
}
bError = true;
}
diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx
index 6263d0cd52a7..798fcaef3d80 100644
--- a/dbaccess/source/ui/querydesign/querydlg.cxx
+++ b/dbaccess/source/ui/querydesign/querydlg.cxx
@@ -139,7 +139,18 @@ DlgQryJoin::DlgQryJoin( OQueryTableView * pParent,
DlgQryJoin::~DlgQryJoin()
{
+ disposeOnce();
+}
+
+void DlgQryJoin::dispose()
+{
delete m_pTableControl;
+ m_pML_HelpText.clear();
+ m_pPB_OK.clear();
+ m_pLB_JoinType.clear();
+ m_pCBNatural.clear();
+ m_pTableView.clear();
+ ModalDialog::dispose();
}
IMPL_LINK( DlgQryJoin, LBChangeHdl, ListBox*, /*pListBox*/ )
diff --git a/dbaccess/source/ui/querydesign/querydlg.hxx b/dbaccess/source/ui/querydesign/querydlg.hxx
index e8ce875cbdea..ec31515d007e 100644
--- a/dbaccess/source/ui/querydesign/querydlg.hxx
+++ b/dbaccess/source/ui/querydesign/querydlg.hxx
@@ -39,14 +39,14 @@ namespace dbaui
,public IRelationControlInterface
{
protected:
- FixedText* m_pML_HelpText;
- OKButton* m_pPB_OK;
- ListBox* m_pLB_JoinType;
- CheckBox* m_pCBNatural;
+ VclPtr<FixedText> m_pML_HelpText;
+ VclPtr<OKButton> m_pPB_OK;
+ VclPtr<ListBox> m_pLB_JoinType;
+ VclPtr<CheckBox> m_pCBNatural;
OTableListBoxControl* m_pTableControl;
OJoinTableView::OTableWindowMap* m_pTableMap;
- OQueryTableView* m_pTableView;
+ VclPtr<OQueryTableView> m_pTableView;
EJoinType eJoinType;
TTableConnectionData::value_type m_pConnData; // contains left and right table
@@ -69,6 +69,7 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
bool _bAllowTableSelect);
virtual ~DlgQryJoin();
+ virtual void dispose() SAL_OVERRIDE;
EJoinType GetJoinType() const { return eJoinType; };
/** getConnectionData returns the current connection data
diff --git a/dbaccess/source/ui/querydesign/queryview.cxx b/dbaccess/source/ui/querydesign/queryview.cxx
index a10a73045a0b..c18ef092d24d 100644
--- a/dbaccess/source/ui/querydesign/queryview.cxx
+++ b/dbaccess/source/ui/querydesign/queryview.cxx
@@ -30,9 +30,4 @@ OQueryView::OQueryView(vcl::Window* _pParent, OQueryController& _rController,con
}
-OQueryView::~OQueryView()
-{
-
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
index 03a9b56c8826..1f18d83af39a 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
@@ -38,10 +38,6 @@ ORelationTableConnection::ORelationTableConnection( const ORelationTableConnecti
// no own members, thus the base class functionality is enough
}
-ORelationTableConnection::~ORelationTableConnection()
-{
-}
-
ORelationTableConnection& ORelationTableConnection::operator=( const ORelationTableConnection& rConn )
{
// this doesn't change anything, since the base class tests this, too and I don't have my own members to copy
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.hxx b/dbaccess/source/ui/relationdesign/RTableConnection.hxx
index 24339b521a23..3ebea9b873f3 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnection.hxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.hxx
@@ -31,7 +31,6 @@ namespace dbaui
ORelationTableConnection( ORelationTableView* pContainer, const TTableConnectionData::value_type& pTabConnData );
ORelationTableConnection( const ORelationTableConnection& rConn );
// wichtiger Kommentar zum CopyConstructor siehe OTableConnection(const OTableConnection&)
- virtual ~ORelationTableConnection();
ORelationTableConnection& operator=( const ORelationTableConnection& rConn );
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 2bc001a585bf..430d0a35aef0 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -205,8 +205,8 @@ void ORelationController::impl_initialize()
{
OUString sTitle(ModuleRes(STR_RELATIONDESIGN));
sTitle = sTitle.copy(3);
- OSQLMessageBox aDlg(NULL,sTitle,ModuleRes(STR_RELATIONDESIGN_NOT_AVAILABLE));
- aDlg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aDlg(nullptr,sTitle,ModuleRes(STR_RELATIONDESIGN_NOT_AVAILABLE));
+ aDlg->Execute();
}
disconnect();
throw SQLException();
@@ -245,7 +245,7 @@ OUString ORelationController::getPrivateTitle( ) const
bool ORelationController::Construct(vcl::Window* pParent)
{
- setView( * new ORelationDesignView( pParent, *this, getORB() ) );
+ setView( VclPtr<ORelationDesignView>::Create( pParent, *this, getORB() ) );
OJoinController::Construct(pParent);
return true;
}
@@ -255,9 +255,9 @@ short ORelationController::saveModified()
short nSaved = RET_YES;
if(haveDataSource() && isModified())
{
- MessageDialog aQry(getView(), "DesignSaveModifiedDialog",
- "dbaccess/ui/designsavemodifieddialog.ui");
- nSaved = aQry.Execute();
+ ScopedVclPtrInstance<MessageDialog> aQry(getView(), "DesignSaveModifiedDialog",
+ "dbaccess/ui/designsavemodifieddialog.ui");
+ nSaved = aQry->Execute();
if(nSaved == RET_YES)
Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>());
}
diff --git a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
index a27f4a5b2eb6..72e75deb07b9 100644
--- a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
@@ -50,13 +50,9 @@ ORelationDesignView::ORelationDesignView(vcl::Window* _pParent, ORelationControl
{
}
-ORelationDesignView::~ORelationDesignView()
-{
-}
-
void ORelationDesignView::Construct()
{
- m_pTableView = new ORelationTableView(m_pScrollWindow,this);
+ m_pTableView = VclPtr<ORelationTableView>::Create(m_pScrollWindow,this);
OJoinDesignView::Construct();
}
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index 38ee81fb1715..06f5839c8483 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -73,8 +73,15 @@ ORelationTableView::ORelationTableView( vcl::Window* pParent, ORelationDesignVie
ORelationTableView::~ORelationTableView()
{
+ disposeOnce();
+}
+
+void ORelationTableView::dispose()
+{
if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
+ m_pExistingConnection.clear();
+ OJoinTableView::dispose();
}
void ORelationTableView::ReSync()
@@ -99,14 +106,14 @@ void ORelationTableView::ReSync()
for(;aIter != rTabWinDataList.rend();++aIter)
{
TTableWindowData::value_type pData = *aIter;
- OTableWindow* pTabWin = createWindow(pData);
+ VclPtr<OTableWindow> pTabWin = createWindow(pData);
if (!pTabWin->Init())
{
// initialisation failed, which means this TabWin is not available, therefore,
// it should be cleaned up, including its data in the document
pTabWin->clearListBox();
- delete pTabWin;
+ pTabWin.disposeAndClear();
arrInvalidTables.push_back(pData->GetTableName());
rTabWinDataList.erase( ::std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end());
@@ -144,7 +151,7 @@ void ORelationTableView::ReSync()
}
}
- addConnection( new ORelationTableConnection(this, *aConIter), false ); // don't add the data again
+ addConnection( VclPtr<ORelationTableConnection>::Create(this, *aConIter), false );
}
if ( !GetTabWinMap().empty() )
@@ -164,8 +171,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
OTableWindow* pSourceWin = jxdSource.pListBox->GetTabWin();
OTableWindow* pDestWin = jxdDest.pListBox->GetTabWin();
- ::std::vector<OTableConnection*>::const_iterator aIter = getTableConnections().begin();
- ::std::vector<OTableConnection*>::const_iterator aEnd = getTableConnections().end();
+ auto aIter = getTableConnections().begin();
+ auto aEnd = getTableConnections().end();
for(;aIter != aEnd;++aIter)
{
OTableConnection* pFirst = *aIter;
@@ -200,7 +207,7 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
if( pTabConnData->Update() )
{
// enter UI-object into ConnList
- addConnection( new ORelationTableConnection( this, pTabConnData ) );
+ addConnection( VclPtr<ORelationTableConnection>::Create( this, pTabConnData ) );
}
}
catch(const SQLException&)
@@ -216,8 +223,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
void ORelationTableView::ConnDoubleClicked( OTableConnection* pConnection )
{
- ORelationDialog aRelDlg( this, pConnection->GetData() );
- switch (aRelDlg.Execute())
+ ScopedVclPtrInstance< ORelationDialog > aRelDlg( this, pConnection->GetData() );
+ switch (aRelDlg->Execute())
{
case RET_OK:
// successfully updated
@@ -244,14 +251,14 @@ void ORelationTableView::AddNewRelation()
{
TTableConnectionData::value_type pNewConnData( new ORelationTableConnectionData() );
- ORelationDialog aRelDlg(this, pNewConnData, true);
+ ScopedVclPtrInstance< ORelationDialog > aRelDlg(this, pNewConnData, true);
- bool bSuccess = (aRelDlg.Execute() == RET_OK);
+ bool bSuccess = (aRelDlg->Execute() == RET_OK);
if (bSuccess)
{
// already updated by the dialog
// announce it to the document
- addConnection( new ORelationTableConnection(this, pNewConnData) );
+ addConnection( VclPtr<ORelationTableConnection>::Create(this, pNewConnData) );
}
}
@@ -293,7 +300,7 @@ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUStrin
pNewTabWinData->ShowAll(false);
// link new window into the window list
- OTableWindow* pNewTabWin = createWindow( pNewTabWinData );
+ VclPtr<OTableWindow> pNewTabWin = createWindow( pNewTabWinData );
if(pNewTabWin->Init())
{
m_pView->getController().getTableWindowData().push_back( pNewTabWinData);
@@ -313,14 +320,14 @@ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUStrin
else
{
pNewTabWin->clearListBox();
- delete pNewTabWin;
+ pNewTabWin.disposeAndClear();
}
}
void ORelationTableView::RemoveTabWin( OTableWindow* pTabWin )
{
- OSQLWarningBox aDlg( this, ModuleRes( STR_QUERY_REL_DELETE_WINDOW ), WB_YES_NO | WB_DEF_YES );
- if ( m_bInRemove || aDlg.Execute() == RET_YES )
+ ScopedVclPtrInstance< OSQLWarningBox > aDlg( this, ModuleRes( STR_QUERY_REL_DELETE_WINDOW ), WB_YES_NO | WB_DEF_YES );
+ if ( m_bInRemove || aDlg->Execute() == RET_YES )
{
m_pView->getController().ClearUndoManager();
OJoinTableView::RemoveTabWin( pTabWin );
@@ -337,13 +344,13 @@ void ORelationTableView::lookForUiActivities()
{
OUString sTitle(ModuleRes(STR_RELATIONDESIGN));
sTitle = sTitle.copy(3);
- OSQLMessageBox aDlg(this,ModuleRes(STR_QUERY_REL_EDIT_RELATION),OUString(),0);
- aDlg.SetText(sTitle);
- aDlg.RemoveButton(aDlg.GetButtonId(0));
- aDlg.AddButton( ModuleRes(STR_QUERY_REL_EDIT), RET_OK, BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON);
- aDlg.AddButton( ModuleRes(STR_QUERY_REL_CREATE), RET_YES, 0);
- aDlg.AddButton( StandardButtonType::Cancel,RET_CANCEL,0);
- sal_uInt16 nRet = aDlg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aDlg(this,ModuleRes(STR_QUERY_REL_EDIT_RELATION),OUString(),0);
+ aDlg->SetText(sTitle);
+ aDlg->RemoveButton(aDlg->GetButtonId(0));
+ aDlg->AddButton( ModuleRes(STR_QUERY_REL_EDIT), RET_OK, BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON);
+ aDlg->AddButton( ModuleRes(STR_QUERY_REL_CREATE), RET_YES, 0);
+ aDlg->AddButton( StandardButtonType::Cancel,RET_CANCEL,0);
+ sal_uInt16 nRet = aDlg->Execute();
if( nRet == RET_CANCEL)
{
m_pCurrentlyTabConnData.reset();
@@ -357,19 +364,19 @@ void ORelationTableView::lookForUiActivities()
}
if(m_pCurrentlyTabConnData)
{
- ORelationDialog aRelDlg( this, m_pCurrentlyTabConnData );
- if (aRelDlg.Execute() == RET_OK)
+ ScopedVclPtrInstance< ORelationDialog > aRelDlg( this, m_pCurrentlyTabConnData );
+ if (aRelDlg->Execute() == RET_OK)
{
// already updated by the dialog
- addConnection( new ORelationTableConnection( this, m_pCurrentlyTabConnData ) );
+ addConnection( VclPtr<ORelationTableConnection>::Create( this, m_pCurrentlyTabConnData ) );
}
m_pCurrentlyTabConnData.reset();
}
}
-OTableWindow* ORelationTableView::createWindow(const TTableWindowData::value_type& _pData)
+VclPtr<OTableWindow> ORelationTableView::createWindow(const TTableWindowData::value_type& _pData)
{
- return new ORelationTableWindow(this,_pData);
+ return VclPtr<ORelationTableWindow>::Create(this,_pData);
}
bool ORelationTableView::allowQueries() const
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
index 94f646154b58..3252a5dd510a 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
@@ -31,15 +31,20 @@ using namespace dbaui;
OFieldDescGenWin::OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* pHelp ) :
TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL )
{
- m_pFieldControl = new OTableFieldControl(this,pHelp);
+ m_pFieldControl = VclPtr<OTableFieldControl>::Create(this,pHelp);
m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
m_pFieldControl->Show();
}
OFieldDescGenWin::~OFieldDescGenWin()
{
- boost::scoped_ptr<vcl::Window> aTemp(m_pFieldControl);
- m_pFieldControl = NULL;
+ disposeOnce();
+}
+
+void OFieldDescGenWin::dispose()
+{
+ m_pFieldControl.disposeAndClear();
+ TabPage::dispose();
}
void OFieldDescGenWin::Init()
@@ -74,7 +79,6 @@ void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const OUString& rT
void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr )
{
-
m_pFieldControl->DisplayData(pFieldDescr);
}
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
index 1af0ffd68876..04011c61c340 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
@@ -32,13 +32,14 @@ namespace dbaui
,public IClipboardTest
{
- OTableFieldControl *m_pFieldControl;
+ VclPtr<OTableFieldControl> m_pFieldControl;
protected:
virtual void Resize() SAL_OVERRIDE;
public:
OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar );
virtual ~OFieldDescGenWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 5e1be232385e..d8321b173b39 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -210,19 +210,19 @@ void OTableEditorCtrl::InitCellController()
OSL_FAIL("getMaxColumnNameLength");
}
- pNameCell = new OSQLNameEdit(&GetDataWindow(), WB_LEFT, sExtraNameChars);
+ pNameCell = VclPtr<OSQLNameEdit>::Create(&GetDataWindow(), WB_LEFT, sExtraNameChars);
pNameCell->SetMaxTextLen( nMaxTextLen );
pNameCell->setCheck( isSQL92CheckEnabled(xCon) );
// Cell type
- pTypeCell = new ListBoxControl( &GetDataWindow() );
+ pTypeCell = VclPtr<ListBoxControl>::Create( &GetDataWindow() );
pTypeCell->SetDropDownLineCount( 15 );
// Cell description
- pDescrCell = new Edit( &GetDataWindow(), WB_LEFT );
+ pDescrCell = VclPtr<Edit>::Create( &GetDataWindow(), WB_LEFT );
pDescrCell->SetMaxTextLen( MAX_DESCR_LEN );
- pHelpTextCell = new Edit( &GetDataWindow(), WB_LEFT );
+ pHelpTextCell = VclPtr<Edit>::Create( &GetDataWindow(), WB_LEFT );
pHelpTextCell->SetMaxTextLen( MAX_DESCR_LEN );
pNameCell->SetHelpId(HID_TABDESIGN_NAMECELL);
@@ -253,6 +253,11 @@ void OTableEditorCtrl::ClearModified()
OTableEditorCtrl::~OTableEditorCtrl()
{
+ disposeOnce();
+}
+
+void OTableEditorCtrl::dispose()
+{
// Reset the Undo-Manager
GetUndoManager().Clear();
@@ -269,10 +274,12 @@ OTableEditorCtrl::~OTableEditorCtrl()
Application::RemoveUserEvent( nInvalidateTypeEvent );
// Delete the control types
- delete pNameCell;
- delete pTypeCell;
- delete pDescrCell;
- delete pHelpTextCell;
+ pNameCell.disposeAndClear();
+ pTypeCell.disposeAndClear();
+ pDescrCell.disposeAndClear();
+ pHelpTextCell.disposeAndClear();
+ pDescrWin.clear();
+ OTableRowView::dispose();
}
bool OTableEditorCtrl::SetDataPtr( long nRow )
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx
index bfae245eca31..03f9b4598c67 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -46,11 +46,11 @@ namespace dbaui
::std::vector< ::boost::shared_ptr<OTableRow> > m_aUndoList;
::std::vector< ::boost::shared_ptr<OTableRow> >* m_pRowList;
- OSQLNameEdit* pNameCell;
- ::svt::ListBoxControl* pTypeCell;
- Edit* pHelpTextCell;
- Edit* pDescrCell;
- OTableFieldDescWin* pDescrWin; // properties of one column
+ VclPtr<OSQLNameEdit> pNameCell;
+ VclPtr<::svt::ListBoxControl> pTypeCell;
+ VclPtr<Edit> pHelpTextCell;
+ VclPtr<Edit> pDescrCell;
+ VclPtr<OTableFieldDescWin> pDescrWin; // properties of one column
::boost::shared_ptr<OTableRow> pActRow;
@@ -71,7 +71,7 @@ namespace dbaui
{
private:
AutoTimer m_aInvalidateTimer;
- OTableEditorCtrl* m_pOwner;
+ VclPtr<OTableEditorCtrl> m_pOwner;
public:
ClipboardInvalidator(sal_uLong nTimeout,OTableEditorCtrl*);
@@ -122,6 +122,7 @@ namespace dbaui
public:
OTableEditorCtrl(vcl::Window* pParentWin);
virtual ~OTableEditorCtrl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol) SAL_OVERRIDE;
SfxUndoManager& GetUndoManager() const;
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index a242f10d5bbe..bb7df8cd65f8 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -285,7 +285,7 @@ bool OTableController::doSaveDoc(bool _bSaveAs)
if (!xTablesSup.is())
{
OUString aMessage(ModuleRes(STR_TABLEDESIGN_CONNECTION_MISSING));
- OSQLWarningBox( getView(), aMessage ).Execute();
+ ScopedVclPtrInstance<OSQLWarningBox>(getView(), aMessage )->Execute();
return false;
}
@@ -318,13 +318,13 @@ bool OTableController::doSaveDoc(bool _bSaveAs)
}
DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::TABLE );
- OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), getConnection(), aDefaultName, aNameChecker );
- if ( aDlg.Execute() != RET_OK )
+ ScopedVclPtrInstance< OSaveAsDlg > aDlg( getView(), CommandType::TABLE, getORB(), getConnection(), aDefaultName, aNameChecker );
+ if ( aDlg->Execute() != RET_OK )
return false;
- m_sName = aDlg.getName();
- sCatalog = aDlg.getCatalog();
- sSchema = aDlg.getSchema();
+ m_sName = aDlg->getName();
+ sCatalog = aDlg->getCatalog();
+ sSchema = aDlg->getSchema();
}
// did we get a name
@@ -415,9 +415,9 @@ bool OTableController::doSaveDoc(bool _bSaveAs)
{
OUString sText( ModuleRes( STR_NAME_ALREADY_EXISTS ) );
sText = sText.replaceFirst( "#" , m_sName);
- OSQLMessageBox aDlg( getView(), OUString( ModuleRes( STR_ERROR_DURING_CREATION ) ), sText, WB_OK, OSQLMessageBox::Error );
+ ScopedVclPtrInstance< OSQLMessageBox > aDlg( getView(), OUString( ModuleRes( STR_ERROR_DURING_CREATION ) ), sText, WB_OK, OSQLMessageBox::Error );
- aDlg.Execute();
+ aDlg->Execute();
bError = true;
}
catch( const Exception& )
@@ -447,8 +447,8 @@ void OTableController::doEditIndexes()
// table needs to be saved before editing indexes
if (m_bNew || isModified())
{
- MessageDialog aAsk(getView(), ModuleRes(STR_QUERY_SAVE_TABLE_EDIT_INDEXES), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if (RET_YES != aAsk.Execute())
+ ScopedVclPtrInstance< MessageDialog > aAsk(getView(), ModuleRes(STR_QUERY_SAVE_TABLE_EDIT_INDEXES), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if (RET_YES != aAsk->Execute())
return;
if (!doSaveDoc(false))
@@ -490,8 +490,8 @@ void OTableController::doEditIndexes()
if (!xIndexes.is())
return;
- DbaIndexDialog aDialog(getView(), aFieldNames, xIndexes, getConnection(), getORB(), isConnected() && getConnection()->getMetaData().is() ? getConnection()->getMetaData()->getMaxColumnsInIndex() : 0);
- if (RET_OK != aDialog.Execute())
+ ScopedVclPtrInstance< DbaIndexDialog > aDialog(getView(), aFieldNames, xIndexes, getConnection(), getORB(), isConnected() && getConnection()->getMetaData().is() ? getConnection()->getMetaData()->getMaxColumnsInIndex() : 0);
+ if (RET_OK != aDialog->Execute())
return;
}
@@ -522,7 +522,7 @@ void OTableController::impl_initialize()
}
catch(const SQLException&)
{
- OSQLWarningBox( getView(), ModuleRes( STR_NO_TYPE_INFO_AVAILABLE ) ).Execute();
+ ScopedVclPtrInstance<OSQLWarningBox>(getView(), ModuleRes( STR_NO_TYPE_INFO_AVAILABLE ))->Execute();
throw;
}
try
@@ -540,7 +540,7 @@ void OTableController::impl_initialize()
bool OTableController::Construct(vcl::Window* pParent)
{
- setView( * new OTableDesignView( pParent, getORB(), *this ) );
+ setView( VclPtr<OTableDesignView>::Create( pParent, getORB(), *this ) );
OTableController_BASE::Construct(pParent);
return true;
}
@@ -563,9 +563,9 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) throw( Runti
::boost::mem_fn(&OTableRow::isValid));
if ( aIter != m_vRowList.end() )
{
- MessageDialog aQry(getView(), "TableDesignSaveModifiedDialog",
- "dbaccess/ui/tabledesignsavemodifieddialog.ui");
- switch (aQry.Execute())
+ ScopedVclPtrInstance<MessageDialog> aQry(getView(), "TableDesignSaveModifiedDialog",
+ "dbaccess/ui/tabledesignsavemodifieddialog.ui");
+ switch (aQry->Execute())
{
case RET_YES:
Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>());
@@ -580,9 +580,9 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) throw( Runti
}
else if ( !m_bNew )
{
- MessageDialog aQry(getView(), "DeleteAllRowsDialog",
- "dbaccess/ui/deleteallrowsdialog.ui");
- switch (aQry.Execute())
+ ScopedVclPtrInstance<MessageDialog> aQry(getView(), "DeleteAllRowsDialog",
+ "dbaccess/ui/deleteallrowsdialog.ui");
+ switch (aQry->Execute())
{
case RET_YES:
{
@@ -936,7 +936,7 @@ bool OTableController::checkColumns(bool _bNew)
{
OUString strMessage = ModuleRes(STR_TABLEDESIGN_DUPLICATE_NAME);
strMessage = strMessage.replaceFirst("$column$", pFieldDesc->GetName());
- OSQLWarningBox( getView(), strMessage ).Execute();
+ ScopedVclPtrInstance<OSQLWarningBox>(getView(), strMessage)->Execute();
return false;
}
}
@@ -946,9 +946,9 @@ bool OTableController::checkColumns(bool _bNew)
{
OUString sTitle(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY_HEAD));
OUString sMsg(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY));
- OSQLMessageBox aBox(getView(), sTitle,sMsg, WB_YES_NO_CANCEL | WB_DEF_YES);
+ ScopedVclPtrInstance< OSQLMessageBox > aBox(getView(), sTitle,sMsg, WB_YES_NO_CANCEL | WB_DEF_YES);
- switch ( aBox.Execute() )
+ switch ( aBox->Execute() )
{
case RET_YES:
{
@@ -1075,8 +1075,8 @@ void OTableController::alterColumns()
aMessage = aMessage.replaceFirst( "$column$", pField->GetName() );
SQLExceptionInfo aError( ::cppu::getCaughtException() );
- OSQLWarningBox aMsg( getView(), aMessage, WB_YES_NO | WB_DEF_YES , &aError );
- bNotOk = aMsg.Execute() == RET_YES;
+ ScopedVclPtrInstance< OSQLWarningBox > aMsg( getView(), aMessage, WB_YES_NO | WB_DEF_YES , &aError );
+ bNotOk = aMsg->Execute() == RET_YES;
}
else
throw;
@@ -1131,8 +1131,8 @@ void OTableController::alterColumns()
{
OUString aMessage(ModuleRes(STR_TABLEDESIGN_ALTER_ERROR));
aMessage = aMessage.replaceFirst("$column$",pField->GetName());
- OSQLWarningBox aMsg( getView(), aMessage, WB_YES_NO | WB_DEF_YES );
- if ( aMsg.Execute() != RET_YES )
+ ScopedVclPtrInstance< OSQLWarningBox > aMsg( getView(), aMessage, WB_YES_NO | WB_DEF_YES );
+ if ( aMsg->Execute() != RET_YES )
{
Reference<XPropertySet> xNewColumn(xIdxColumns->getByIndex(nPos),UNO_QUERY_THROW);
OUString sName;
@@ -1198,8 +1198,8 @@ void OTableController::alterColumns()
OUString aMsgT(ModuleRes(STR_TBL_COLUMN_IS_KEYCOLUMN));
aMsgT = aMsgT.replaceFirst("$column$",*pIter);
OUString aTitle(ModuleRes(STR_TBL_COLUMN_IS_KEYCOLUMN_TITLE));
- OSQLMessageBox aMsg(getView(),aTitle,aMsgT,WB_YES_NO| WB_DEF_YES);
- if(aMsg.Execute() == RET_YES)
+ ScopedVclPtrInstance< OSQLMessageBox > aMsg(getView(),aTitle,aMsgT,WB_YES_NO| WB_DEF_YES);
+ if(aMsg->Execute() == RET_YES)
{
xKeyColumns = NULL;
dropPrimaryKey();
diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
index a92af1c10353..81dfc575169d 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
@@ -48,11 +48,6 @@ OTableRowView::OTableRowView(vcl::Window* pParent)
}
-OTableRowView::~OTableRowView()
-{
-
-}
-
void OTableRowView::Init()
{
EditBrowseBox::Init();
diff --git a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
index a5f2010fb15d..5c1fcc11f340 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
@@ -29,7 +29,7 @@ using namespace dbaui;
OTableDesignHelpBar::OTableDesignHelpBar( vcl::Window* pParent ) :
TabPage( pParent, WB_3DLOOK )
{
- m_pTextWin = new MultiLineEdit( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
+ m_pTextWin = VclPtr<MultiLineEdit>::Create( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
m_pTextWin->SetReadOnly();
m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
@@ -38,8 +38,13 @@ OTableDesignHelpBar::OTableDesignHelpBar( vcl::Window* pParent ) :
OTableDesignHelpBar::~OTableDesignHelpBar()
{
- boost::scoped_ptr<vcl::Window> aTemp(m_pTextWin);
- m_pTextWin = NULL;
+ disposeOnce();
+}
+
+void OTableDesignHelpBar::dispose()
+{
+ m_pTextWin.disposeAndClear();
+ TabPage::dispose();
}
void OTableDesignHelpBar::SetHelpText( const OUString& rText )
diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
index 996a84c0e162..9b5598f11a9b 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
@@ -42,13 +42,13 @@ using namespace ::com::sun::star::beans;
// class OTableBorderWindow
OTableBorderWindow::OTableBorderWindow(vcl::Window* pParent) : Window(pParent,WB_BORDER)
- ,m_aHorzSplitter( this )
+ ,m_aHorzSplitter( VclPtr<Splitter>::Create(this) )
{
ImplInitSettings( true, true, true );
// Children erzeugen
- m_pEditorCtrl = new OTableEditorCtrl( this);
- m_pFieldDescWin = new OTableFieldDescWin( this );
+ m_pEditorCtrl = VclPtr<OTableEditorCtrl>::Create( this);
+ m_pFieldDescWin = VclPtr<OTableFieldDescWin>::Create( this );
m_pFieldDescWin->SetHelpId(HID_TAB_DESIGN_DESCWIN);
@@ -56,26 +56,25 @@ OTableBorderWindow::OTableBorderWindow(vcl::Window* pParent) : Window(pParent,WB
m_pEditorCtrl->SetDescrWin(m_pFieldDescWin);
// Splitter einrichten
- m_aHorzSplitter.SetSplitHdl( LINK(this, OTableBorderWindow, SplitHdl) );
- m_aHorzSplitter.Show();
+ m_aHorzSplitter->SetSplitHdl( LINK(this, OTableBorderWindow, SplitHdl) );
+ m_aHorzSplitter->Show();
}
OTableBorderWindow::~OTableBorderWindow()
{
+ disposeOnce();
+}
+
+void OTableBorderWindow::dispose()
+{
// Children zerstoeren
// ::dbaui::notifySystemWindow(this,m_pFieldDescWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
m_pEditorCtrl->Hide();
m_pFieldDescWin->Hide();
-
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pEditorCtrl);
- m_pEditorCtrl = NULL;
- }
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pFieldDescWin);
- m_pFieldDescWin = NULL;
- }
-
+ m_pEditorCtrl.disposeAndClear();
+ m_pFieldDescWin.disposeAndClear();
+ m_aHorzSplitter.disposeAndClear();
+ vcl::Window::dispose();
}
void OTableBorderWindow::Resize()
@@ -86,18 +85,18 @@ void OTableBorderWindow::Resize()
Size aOutputSize( GetOutputSize() );
long nOutputWidth = aOutputSize.Width();
long nOutputHeight = aOutputSize.Height();
- long nSplitPos = m_aHorzSplitter.GetSplitPosPixel();
+ long nSplitPos = m_aHorzSplitter->GetSplitPosPixel();
// Verschiebebereich Splitter mittleres Drittel des Outputs
long nDragPosY = nOutputHeight/3;
long nDragSizeHeight = nOutputHeight/3;
- m_aHorzSplitter.SetDragRectPixel( Rectangle(Point(0,nDragPosY), Size(nOutputWidth,nDragSizeHeight) ), this );
+ m_aHorzSplitter->SetDragRectPixel( Rectangle(Point(0,nDragPosY), Size(nOutputWidth,nDragSizeHeight) ), this );
if( (nSplitPos < nDragPosY) || (nSplitPos > (nDragPosY+nDragSizeHeight)) )
nSplitPos = nDragPosY+nDragSizeHeight-5;
// Splitter setzen
- m_aHorzSplitter.SetPosSizePixel( Point( 0, nSplitPos ), Size(nOutputWidth, nSplitterHeight));
- m_aHorzSplitter.SetSplitPosPixel( nSplitPos );
+ m_aHorzSplitter->SetPosSizePixel( Point( 0, nSplitPos ), Size(nOutputWidth, nSplitterHeight));
+ m_aHorzSplitter->SetSplitPosPixel( nSplitPos );
// Fenster setzen
m_pEditorCtrl->SetPosSizePixel( Point(0, 0), Size(nOutputWidth , nSplitPos) );
@@ -108,9 +107,9 @@ void OTableBorderWindow::Resize()
IMPL_LINK( OTableBorderWindow, SplitHdl, Splitter*, pSplit )
{
- if(pSplit == &m_aHorzSplitter)
+ if(pSplit == m_aHorzSplitter.get())
{
- m_aHorzSplitter.SetPosPixel( Point( m_aHorzSplitter.GetPosPixel().X(),m_aHorzSplitter.GetSplitPosPixel() ) );
+ m_aHorzSplitter->SetPosPixel( Point( m_aHorzSplitter->GetPosPixel().X(),m_aHorzSplitter->GetSplitPosPixel() ) );
Resize();
}
return 0;
@@ -184,18 +183,20 @@ OTableDesignView::OTableDesignView( vcl::Window* pParent,
{
}
- m_pWin = new OTableBorderWindow(this);
+ m_pWin = VclPtr<OTableBorderWindow>::Create(this);
m_pWin->Show();
}
OTableDesignView::~OTableDesignView()
{
- m_pWin->Hide();
+ disposeOnce();
+}
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pWin);
- m_pWin = NULL;
- }
+void OTableDesignView::dispose()
+{
+ m_pWin->Hide();
+ m_pWin.disposeAndClear();
+ ODataView::dispose();
}
void OTableDesignView::initialize()
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
index 1cd013e008cf..e0b89dbfddbe 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
@@ -50,39 +50,36 @@ OTableFieldDescWin::OTableFieldDescWin( vcl::Window* pParent)
, m_eChildFocus(NONE)
{
// Header
- m_pHeader = new FixedText( this, WB_CENTER | WB_INFO ); // | WB_3DLOOK
+ m_pHeader = VclPtr<FixedText>::Create( this, WB_CENTER | WB_INFO );
m_pHeader->SetText( OUString(ModuleRes(STR_TAB_PROPERTIES)) );
m_pHeader->Show();
// HelpBar
- m_pHelpBar = new OTableDesignHelpBar( this );
+ m_pHelpBar = VclPtr<OTableDesignHelpBar>::Create( this );
m_pHelpBar->SetHelpId(HID_TAB_DESIGN_HELP_TEXT_FRAME);
m_pHelpBar->Show();
- m_pGenPage = new OFieldDescGenWin( this, m_pHelpBar );
+ m_pGenPage = VclPtr<OFieldDescGenWin>::Create( this, m_pHelpBar );
getGenPage()->SetHelpId( HID_TABLE_DESIGN_TABPAGE_GENERAL );
getGenPage()->Show();
}
OTableFieldDescWin::~OTableFieldDescWin()
{
+ disposeOnce();
+}
+
+void OTableFieldDescWin::dispose()
+{
// destroy children
m_pHelpBar->Hide();
getGenPage()->Hide();
m_pHeader->Hide();
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pGenPage);
- m_pGenPage = NULL;
- }
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pHeader);
- m_pHeader = NULL;
- }
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pHelpBar);
- m_pHelpBar = NULL;
- }
+ m_pGenPage.disposeAndClear();
+ m_pHeader.disposeAndClear();
+ m_pHelpBar.disposeAndClear();
+ TabPage::dispose();
}
void OTableFieldDescWin::Init()
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
index f2092ff35a13..a8914fd42cb3 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
@@ -41,9 +41,9 @@ namespace dbaui
NONE
};
private:
- OTableDesignHelpBar* m_pHelpBar;
- OFieldDescGenWin* m_pGenPage;
- FixedText* m_pHeader;
+ VclPtr<OTableDesignHelpBar> m_pHelpBar;
+ VclPtr<OFieldDescGenWin> m_pGenPage;
+ VclPtr<FixedText> m_pHeader;
ChildFocusState m_eChildFocus;
IClipboardTest* getActiveChild() const;
@@ -55,6 +55,7 @@ namespace dbaui
public:
OTableFieldDescWin( vcl::Window* pParent);
virtual ~OTableFieldDescWin();
+ virtual void dispose() SAL_OVERRIDE;
void Init();
diff --git a/dbaccess/source/ui/tabledesign/TableUndo.hxx b/dbaccess/source/ui/tabledesign/TableUndo.hxx
index d16e55272fbd..7646684e3a09 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.hxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/uno/Any.h>
#include "TypeInfo.hxx"
+#include <vcl/vclptr.hxx>
namespace dbaui
{
@@ -34,7 +35,7 @@ namespace dbaui
class OTableDesignUndoAct : public OCommentUndoAction
{
protected:
- OTableRowView* m_pTabDgnCtrl;
+ VclPtr<OTableRowView> m_pTabDgnCtrl;
virtual void Undo() SAL_OVERRIDE;
virtual void Redo() SAL_OVERRIDE;
@@ -48,7 +49,7 @@ namespace dbaui
class OTableEditorUndoAct : public OTableDesignUndoAct
{
protected:
- OTableEditorCtrl* pTabEdCtrl;
+ VclPtr<OTableEditorCtrl> pTabEdCtrl;
public:
TYPEINFO_OVERRIDE();
@@ -136,7 +137,7 @@ namespace dbaui
protected:
MultiSelection m_aDelKeys,
m_aInsKeys;
- OTableEditorCtrl* m_pEditorCtrl;
+ VclPtr<OTableEditorCtrl> m_pEditorCtrl;
virtual void Undo() SAL_OVERRIDE;
virtual void Redo() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
index 222903c1af58..3e2cb86fb94e 100644
--- a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
+++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx
@@ -63,7 +63,7 @@ namespace dbaui
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
};
OAdvancedSettingsDialog::OAdvancedSettingsDialog(const Reference< XComponentContext >& _rxORB)
@@ -119,10 +119,9 @@ namespace dbaui
describeProperties(aProps);
return new ::cppu::OPropertyArrayHelper(aProps);
}
- Dialog* OAdvancedSettingsDialog::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> OAdvancedSettingsDialog::createDialog(vcl::Window* _pParent)
{
- AdvancedSettingsDialog* pDlg = new AdvancedSettingsDialog(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
- return pDlg;
+ return VclPtr<AdvancedSettingsDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx
index 1422c629b3a1..7a32f0b175f6 100644
--- a/dbaccess/source/ui/uno/ColumnPeer.cxx
+++ b/dbaccess/source/ui/uno/ColumnPeer.cxx
@@ -36,7 +36,7 @@ OColumnPeer::OColumnPeer(vcl::Window* _pParent,const Reference<XComponentContext
{
osl_atomic_increment( &m_refCount );
{
- OColumnControlWindow* pFieldControl = new OColumnControlWindow(_pParent, _rxContext);
+ VclPtrInstance<OColumnControlWindow> pFieldControl(_pParent, _rxContext);
pFieldControl->SetComponentInterface(this);
pFieldControl->Show();
}
@@ -46,19 +46,16 @@ OColumnPeer::OColumnPeer(vcl::Window* _pParent,const Reference<XComponentContext
void OColumnPeer::setEditWidth(sal_Int32 _nWidth)
{
SolarMutexGuard aGuard;
-
- OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() );
+ VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
if ( pFieldControl )
- {
pFieldControl->setEditWidth(_nWidth);
- }
}
void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn)
{
SolarMutexGuard aGuard;
- OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() );
+ VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
if ( pFieldControl )
{
if ( m_pActFieldDescr )
@@ -105,7 +102,7 @@ void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn)
void OColumnPeer::setConnection(const Reference< XConnection>& _xCon)
{
SolarMutexGuard aGuard;
- OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() );
+ VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
if ( pFieldControl )
pFieldControl->setConnection(_xCon);
}
@@ -131,7 +128,7 @@ void OColumnPeer::setProperty( const OUString& _rPropertyName, const Any& Value)
Any OColumnPeer::getProperty( const OUString& _rPropertyName ) throw( RuntimeException, std::exception )
{
Any aProp;
- OFieldDescControl* pFieldControl = static_cast<OFieldDescControl*>( GetWindow() );
+ VclPtr< OFieldDescControl > pFieldControl = GetAs< OFieldDescControl >();
if (pFieldControl && _rPropertyName == PROPERTY_COLUMN)
{
aProp <<= m_xColumn;
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
index 6c5d796872d1..a667d1f90e56 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx
@@ -92,10 +92,9 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo() thr
return new ::cppu::OPropertyArrayHelper(aProps);
}
-Dialog* ODBTypeWizDialog::createDialog(vcl::Window* _pParent)
+VclPtr<Dialog> ODBTypeWizDialog::createDialog(vcl::Window* _pParent)
{
- ODbTypeWizDialog* pDlg = new ODbTypeWizDialog(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
- return pDlg;
+ return VclPtr<ODbTypeWizDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.hxx b/dbaccess/source/ui/uno/DBTypeWizDlg.hxx
index 10df28c4e6dd..80e8830792b1 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlg.hxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlg.hxx
@@ -55,7 +55,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
index 4c46903fd03b..f13cc2e142e6 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx
@@ -106,16 +106,16 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo(
return new ::cppu::OPropertyArrayHelper(aProps);
}
-Dialog* ODBTypeWizDialogSetup::createDialog(vcl::Window* _pParent)
+VclPtr<Dialog> ODBTypeWizDialogSetup::createDialog(vcl::Window* _pParent)
{
- return new ODbTypeWizDialogSetup(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
+ return VclPtr<ODbTypeWizDialogSetup>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
}
void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult)
{
if ( _nExecutionResult == RET_OK )
{
- const ODbTypeWizDialogSetup* pDialog = static_cast< ODbTypeWizDialogSetup* >( m_pDialog );
+ const ODbTypeWizDialogSetup* pDialog = static_cast< ODbTypeWizDialogSetup* >( m_pDialog.get() );
m_bOpenDatabase = pDialog->IsDatabaseDocumentToBeOpened();
m_bStartTableWizard = pDialog->IsTableWizardToBeStarted();
}
diff --git a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx
index c0f6faeb86a1..2a7112678154 100644
--- a/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx
+++ b/dbaccess/source/ui/uno/DBTypeWizDlgSetup.hxx
@@ -57,7 +57,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void executedDialog(sal_Int16 _nExecutionResult) SAL_OVERRIDE;
};
diff --git a/dbaccess/source/ui/uno/TableFilterDlg.cxx b/dbaccess/source/ui/uno/TableFilterDlg.cxx
index 475c66457157..813736d0ecbf 100644
--- a/dbaccess/source/ui/uno/TableFilterDlg.cxx
+++ b/dbaccess/source/ui/uno/TableFilterDlg.cxx
@@ -92,10 +92,9 @@ Reference<XPropertySetInfo> SAL_CALL OTableFilterDialog::getPropertySetInfo() t
return new ::cppu::OPropertyArrayHelper(aProps);
}
-Dialog* OTableFilterDialog::createDialog(vcl::Window* _pParent)
+VclPtr<Dialog> OTableFilterDialog::createDialog(vcl::Window* _pParent)
{
- OTableSubscriptionDialog* pDlg = new OTableSubscriptionDialog(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
- return pDlg;
+ return VclPtr<OTableSubscriptionDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection);
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/TableFilterDlg.hxx b/dbaccess/source/ui/uno/TableFilterDlg.hxx
index 9acfe840ac87..f3798c29b2d6 100644
--- a/dbaccess/source/ui/uno/TableFilterDlg.hxx
+++ b/dbaccess/source/ui/uno/TableFilterDlg.hxx
@@ -55,7 +55,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.cxx b/dbaccess/source/ui/uno/UserSettingsDlg.cxx
index 55bab9fcb5a2..db51ea598542 100644
--- a/dbaccess/source/ui/uno/UserSettingsDlg.cxx
+++ b/dbaccess/source/ui/uno/UserSettingsDlg.cxx
@@ -92,10 +92,9 @@ Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo()
return new ::cppu::OPropertyArrayHelper(aProps);
}
-Dialog* OUserSettingsDialog::createDialog(vcl::Window* _pParent)
+VclPtr<Dialog> OUserSettingsDialog::createDialog(vcl::Window* _pParent)
{
- OUserAdminDlg* pDlg = new OUserAdminDlg(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection, m_xActiveConnection);
- return pDlg;
+ return VclPtr<OUserAdminDlg>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection, m_xActiveConnection);
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/UserSettingsDlg.hxx b/dbaccess/source/ui/uno/UserSettingsDlg.hxx
index efc682601b62..f8aa793a279e 100644
--- a/dbaccess/source/ui/uno/UserSettingsDlg.hxx
+++ b/dbaccess/source/ui/uno/UserSettingsDlg.hxx
@@ -55,7 +55,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/admindlg.cxx b/dbaccess/source/ui/uno/admindlg.cxx
index d6f7a98d3188..adfe04c33ebe 100644
--- a/dbaccess/source/ui/uno/admindlg.cxx
+++ b/dbaccess/source/ui/uno/admindlg.cxx
@@ -92,10 +92,9 @@ Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetI
return new ::cppu::OPropertyArrayHelper(aProps);
}
-Dialog* ODataSourcePropertyDialog::createDialog(vcl::Window* _pParent)
+VclPtr<Dialog> ODataSourcePropertyDialog::createDialog(vcl::Window* _pParent)
{
-
- ODbAdminDialog* pDialog = new ODbAdminDialog(_pParent, m_pDatasourceItems, m_aContext);
+ VclPtrInstance<ODbAdminDialog> pDialog(_pParent, m_pDatasourceItems, m_aContext);
// the initial selection
if ( m_aInitialSelection.hasValue() )
diff --git a/dbaccess/source/ui/uno/admindlg.hxx b/dbaccess/source/ui/uno/admindlg.hxx
index d326ce1f3693..7c5737d99d5f 100644
--- a/dbaccess/source/ui/uno/admindlg.hxx
+++ b/dbaccess/source/ui/uno/admindlg.hxx
@@ -55,7 +55,7 @@ public:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
};
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/composerdialogs.cxx b/dbaccess/source/ui/uno/composerdialogs.cxx
index 7404f5b4d5d3..a4b29d889ecf 100644
--- a/dbaccess/source/ui/uno/composerdialogs.cxx
+++ b/dbaccess/source/ui/uno/composerdialogs.cxx
@@ -77,7 +77,7 @@ namespace dbaui
IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ComposerDialog )
- Dialog* ComposerDialog::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> ComposerDialog::createDialog(vcl::Window* _pParent)
{
// obtain all the objects needed for the dialog
Reference< XConnection > xConnection;
@@ -140,9 +140,9 @@ namespace dbaui
return static_cast< XServiceInfo* >(new RowsetFilterDialog( comphelper::getComponentContext(_rxORB)));
}
- Dialog* RowsetFilterDialog::createComposerDialog( vcl::Window* _pParent, const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxColumns )
+ VclPtr<Dialog> RowsetFilterDialog::createComposerDialog( vcl::Window* _pParent, const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxColumns )
{
- return new DlgFilterCrit( _pParent, m_aContext, _rxConnection, m_xComposer, _rxColumns );
+ return VclPtr<DlgFilterCrit>::Create( _pParent, m_aContext, _rxConnection, m_xComposer, _rxColumns );
}
void SAL_CALL RowsetFilterDialog::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException, std::exception)
@@ -169,7 +169,7 @@ namespace dbaui
ComposerDialog::executedDialog( _nExecutionResult );
if ( _nExecutionResult && m_pDialog )
- static_cast< DlgFilterCrit* >( m_pDialog )->BuildWherePart();
+ static_cast< DlgFilterCrit* >( m_pDialog.get() )->BuildWherePart();
}
// RowsetOrderDialog
@@ -188,9 +188,9 @@ namespace dbaui
return static_cast< XServiceInfo* >(new RowsetOrderDialog( comphelper::getComponentContext(_rxORB)));
}
- Dialog* RowsetOrderDialog::createComposerDialog( vcl::Window* _pParent, const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxColumns )
+ VclPtr<Dialog> RowsetOrderDialog::createComposerDialog( vcl::Window* _pParent, const Reference< XConnection >& _rxConnection, const Reference< XNameAccess >& _rxColumns )
{
- return new DlgOrderCrit( _pParent, _rxConnection, m_xComposer, _rxColumns );
+ return VclPtr<DlgOrderCrit>::Create( _pParent, _rxConnection, m_xComposer, _rxColumns );
}
void SAL_CALL RowsetOrderDialog::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException, std::exception)
@@ -216,9 +216,9 @@ namespace dbaui
return;
if ( _nExecutionResult )
- static_cast< DlgOrderCrit* >( m_pDialog )->BuildOrderPart();
+ static_cast< DlgOrderCrit* >( m_pDialog.get() )->BuildOrderPart();
else if ( m_xComposer.is() )
- m_xComposer->setOrder( static_cast< DlgOrderCrit* >( m_pDialog )->GetOrignalOrder() );
+ m_xComposer->setOrder( static_cast< DlgOrderCrit* >( m_pDialog.get() )->GetOrignalOrder() );
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/composerdialogs.hxx b/dbaccess/source/ui/uno/composerdialogs.hxx
index 4eb6fe8c2de1..3423427d89af 100644
--- a/dbaccess/source/ui/uno/composerdialogs.hxx
+++ b/dbaccess/source/ui/uno/composerdialogs.hxx
@@ -62,7 +62,7 @@ namespace dbaui
protected:
// own overridables
- virtual Dialog* createComposerDialog(
+ virtual VclPtr<Dialog> createComposerDialog(
vcl::Window* _pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumns
@@ -70,7 +70,7 @@ namespace dbaui
private:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
};
// RowsetFilterDialog
@@ -85,7 +85,7 @@ namespace dbaui
protected:
// own overridables
- virtual Dialog* createComposerDialog(
+ virtual VclPtr<Dialog> createComposerDialog(
vcl::Window* _pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumns
@@ -110,7 +110,7 @@ namespace dbaui
protected:
// own overridables
- virtual Dialog* createComposerDialog(
+ virtual VclPtr<Dialog> createComposerDialog(
vcl::Window* _pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumns
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index cbcadf4f7376..bf5a00634914 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -193,7 +193,7 @@ namespace dbaui
virtual ~CopyTableWizard();
// OGenericUnoDialog overridables
- virtual Dialog* createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
virtual void executedDialog( sal_Int16 _nExecutionResult ) SAL_OVERRIDE;
private:
@@ -548,7 +548,7 @@ void SAL_CALL CopyTableWizard::setTitle( const OUString& _rTitle ) throw (Runtim
OCopyTableWizard& CopyTableWizard::impl_getDialog_throw()
{
- OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >( m_pDialog );
+ OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >( m_pDialog.get() );
if ( !pWizard )
throw DisposedException( OUString(), *this );
return *pWizard;
@@ -1514,12 +1514,12 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
return new ::cppu::OPropertyArrayHelper( aProps );
}
-Dialog* CopyTableWizard::createDialog( vcl::Window* _pParent )
+VclPtr<Dialog> CopyTableWizard::createDialog( vcl::Window* _pParent )
{
OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" );
// this should have been prevented in ::execute already
- OCopyTableWizard* pWizard = new OCopyTableWizard(
+ VclPtrInstance<OCopyTableWizard> pWizard(
_pParent,
m_sDestinationTable,
m_nOperation,
diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx
index 7087c3b04d13..dd2d477dfa84 100644
--- a/dbaccess/source/ui/uno/dbinteraction.cxx
+++ b/dbaccess/source/ui/uno/dbinteraction.cxx
@@ -127,8 +127,8 @@ namespace dbaui
xParamCallback = Reference< XInteractionSupplyParameters >(_rContinuations[nParamPos], UNO_QUERY);
OSL_ENSURE(xParamCallback.is(), "BasicInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s");
- OParameterDialog aDlg(NULL, _rParamRequest.Parameters, _rParamRequest.Connection, m_xContext);
- sal_Int16 nResult = aDlg.Execute();
+ ScopedVclPtrInstance< OParameterDialog > aDlg(nullptr, _rParamRequest.Parameters, _rParamRequest.Connection, m_xContext);
+ sal_Int16 nResult = aDlg->Execute();
try
{
switch (nResult)
@@ -136,7 +136,7 @@ namespace dbaui
case RET_OK:
if (xParamCallback.is())
{
- xParamCallback->setParameters(aDlg.getValues());
+ xParamCallback->setParameters(aDlg->getValues());
xParamCallback->select();
}
break;
@@ -182,9 +182,9 @@ namespace dbaui
}
// execute the dialog
- OSQLMessageBox aDialog(NULL, _rSqlInfo, nDialogStyle);
+ ScopedVclPtrInstance< OSQLMessageBox > aDialog(nullptr, _rSqlInfo, nDialogStyle);
// TODO: need a way to specify the parent window
- sal_Int16 nResult = aDialog.Execute();
+ sal_Int16 nResult = aDialog->Execute();
try
{
switch (nResult)
@@ -256,8 +256,8 @@ namespace dbaui
Reference< XInteractionDocumentSave > xCallback(_rContinuations[nDocuPos], UNO_QUERY);
OSL_ENSURE(xCallback.is(), "BasicInteractionHandler::implHandle(DocumentSaveRequest): can't save document without an appropriate interaction handler!s");
- OCollectionView aDlg(NULL, _rDocuRequest.Content, _rDocuRequest.Name, m_xContext);
- sal_Int16 nResult = aDlg.Execute();
+ ScopedVclPtrInstance< OCollectionView > aDlg(nullptr, _rDocuRequest.Content, _rDocuRequest.Name, m_xContext);
+ sal_Int16 nResult = aDlg->Execute();
try
{
switch (nResult)
@@ -265,7 +265,7 @@ namespace dbaui
case RET_OK:
if (xCallback.is())
{
- xCallback->setName(aDlg.getName(),aDlg.getSelectedFolder());
+ xCallback->setName(aDlg->getName(), aDlg->getSelectedFolder());
xCallback->select();
}
break;
diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
index d0c4969b57fb..9744b5af026b 100644
--- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
+++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
@@ -104,7 +104,7 @@ namespace dbaui
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
virtual void implInitialize( const com::sun::star::uno::Any& _rValue ) SAL_OVERRIDE;
protected:
using OTextConnectionSettingsDialog_BASE::getFastPropertyValue;
@@ -204,9 +204,9 @@ namespace dbaui
return new ::cppu::OPropertyArrayHelper( aProps );
}
- Dialog* OTextConnectionSettingsDialog::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> OTextConnectionSettingsDialog::createDialog(vcl::Window* _pParent)
{
- return new TextConnectionSettingsDialog( _pParent, *m_pDatasourceItems );
+ return VclPtr<TextConnectionSettingsDialog>::Create( _pParent, *m_pDatasourceItems );
}
void OTextConnectionSettingsDialog::implInitialize(const Any& _rValue)
diff --git a/dbaccess/source/ui/uno/unoDirectSql.cxx b/dbaccess/source/ui/uno/unoDirectSql.cxx
index 9f752dac81d0..94b57f10f090 100644
--- a/dbaccess/source/ui/uno/unoDirectSql.cxx
+++ b/dbaccess/source/ui/uno/unoDirectSql.cxx
@@ -78,7 +78,7 @@ namespace dbaui
IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog )
- Dialog* ODirectSQLDialog::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> ODirectSQLDialog::createDialog(vcl::Window* _pParent)
{
// obtain all the objects needed for the dialog
Reference< XConnection > xConnection = m_xActiveConnection;
@@ -99,7 +99,7 @@ namespace dbaui
// can't create the dialog if I have improper settings
return NULL;
- return new DirectSQLDialog( _pParent, xConnection);
+ return VclPtr<DirectSQLDialog>::Create( _pParent, xConnection );
}
void ODirectSQLDialog::implInitialize(const Any& _rValue)
{
diff --git a/dbaccess/source/ui/uno/unoDirectSql.hxx b/dbaccess/source/ui/uno/unoDirectSql.hxx
index 43844874009e..d3330170b538 100644
--- a/dbaccess/source/ui/uno/unoDirectSql.hxx
+++ b/dbaccess/source/ui/uno/unoDirectSql.hxx
@@ -57,7 +57,7 @@ namespace dbaui
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void implInitialize(const com::sun::star::uno::Any& _rValue) SAL_OVERRIDE;
};
diff --git a/dbaccess/source/ui/uno/unosqlmessage.cxx b/dbaccess/source/ui/uno/unosqlmessage.cxx
index ec22c959d384..914974d9efed 100644
--- a/dbaccess/source/ui/uno/unosqlmessage.cxx
+++ b/dbaccess/source/ui/uno/unosqlmessage.cxx
@@ -141,13 +141,13 @@ Reference<XPropertySetInfo> SAL_CALL OSQLMessageDialog::getPropertySetInfo() th
return new ::cppu::OPropertyArrayHelper(aProps);
}
-Dialog* OSQLMessageDialog::createDialog(vcl::Window* _pParent)
+VclPtr<Dialog> OSQLMessageDialog::createDialog(vcl::Window* _pParent)
{
if ( m_aException.hasValue() )
- return new OSQLMessageBox( _pParent, SQLExceptionInfo( m_aException ), WB_OK | WB_DEF_OK, m_sHelpURL );
+ return VclPtr<OSQLMessageBox>::Create( _pParent, SQLExceptionInfo( m_aException ), WB_OK | WB_DEF_OK, m_sHelpURL );
OSL_FAIL("OSQLMessageDialog::createDialog : You should use the SQLException property to specify the error to display!");
- return new OSQLMessageBox(_pParent, SQLException());
+ return VclPtr<OSQLMessageBox>::Create(_pParent, SQLException());
}
} // namespace dbaui
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index f0c5d8090458..389389294551 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -709,9 +709,9 @@ void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStat
OUString const aMessage(aDiagnosticMessage + "\n");
- MessageDialog aBootstrapFailedBox(NULL, aMessage);
- aBootstrapFailedBox.SetText( aProductKey );
- aBootstrapFailedBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBootstrapFailedBox(nullptr, aMessage);
+ aBootstrapFailedBox->SetText( aProductKey );
+ aBootstrapFailedBox->Execute();
}
}
@@ -2355,8 +2355,8 @@ void Desktop::OpenClients()
ResMgr* pDtResMgr = GetDesktopResManager();
if( pDtResMgr )
{
- MessageDialog aBox(NULL, ResId(STR_ERR_PRINTDISABLED, *pDtResMgr));
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(nullptr, ResId(STR_ERR_PRINTDISABLED, *pDtResMgr));
+ aBox->Execute();
}
}
diff --git a/desktop/source/app/cmdlinehelp.hxx b/desktop/source/app/cmdlinehelp.hxx
index 07b4f520979d..d7b7233ab3ac 100644
--- a/desktop/source/app/cmdlinehelp.hxx
+++ b/desktop/source/app/cmdlinehelp.hxx
@@ -34,10 +34,10 @@ namespace desktop
public:
CmdlineHelpDialog();
- FixedText* m_pftHead;
- FixedText* m_pftLeft;
- FixedText* m_pftRight;
- FixedText* m_pftBottom;
+ VclPtr<FixedText> m_pftHead;
+ VclPtr<FixedText> m_pftLeft;
+ VclPtr<FixedText> m_pftRight;
+ VclPtr<FixedText> m_pftBottom;
};
#endif
}
diff --git a/desktop/source/app/lockfile2.cxx b/desktop/source/app/lockfile2.cxx
index c590ab7cf799..7636431048a6 100644
--- a/desktop/source/app/lockfile2.cxx
+++ b/desktop/source/app/lockfile2.cxx
@@ -38,22 +38,22 @@ bool Lockfile_execWarning( Lockfile * that )
OString aTime = aConfig.ReadKey( LOCKFILE_TIMEKEY );
// display warning and return response
- MessageDialog aBox(NULL, DesktopResId(STR_QUERY_USERDATALOCKED),
- VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ ScopedVclPtrInstance<MessageDialog> aBox(nullptr, DesktopResId(STR_QUERY_USERDATALOCKED),
+ VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
// set box title
OUString aTitle = OUString( DesktopResId( STR_TITLE_USERDATALOCKED ));
- aBox.SetText( aTitle );
+ aBox->SetText( aTitle );
// insert values...
- OUString aMsgText = aBox.get_primary_text();
+ OUString aMsgText = aBox->get_primary_text();
aMsgText = aMsgText.replaceFirst(
"$u", OStringToOUString( aUser, RTL_TEXTENCODING_ASCII_US) );
aMsgText = aMsgText.replaceFirst(
"$h", OStringToOUString( aHost, RTL_TEXTENCODING_ASCII_US) );
aMsgText = aMsgText.replaceFirst(
"$t", OStringToOUString( aTime, RTL_TEXTENCODING_ASCII_US) );
- aBox.set_primary_text(aMsgText);
+ aBox->set_primary_text(aMsgText);
// do it
- return aBox.Execute( ) == RET_YES;
+ return aBox->Execute( ) == RET_YES;
}
}
diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx b/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx
index da831ad9b38f..56db76bd1b64 100644
--- a/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx
@@ -50,6 +50,14 @@ DependencyDialog::DependencyDialog(
}
}
-DependencyDialog::~DependencyDialog() {}
+DependencyDialog::~DependencyDialog()
+{
+ disposeOnce();
+}
+void DependencyDialog::dispose()
+{
+ m_list.clear();
+ ModalDialog::dispose();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx b/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx
index 1175470c33d5..2d7d3e9a13da 100644
--- a/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx
@@ -37,14 +37,14 @@ class DependencyDialog: public ModalDialog {
public:
DependencyDialog(
vcl::Window * parent, std::vector< OUString > const & dependencies);
-
virtual ~DependencyDialog();
+ virtual void dispose() SAL_OVERRIDE;
private:
DependencyDialog(DependencyDialog &) SAL_DELETED_FUNCTION;
void operator =(DependencyDialog &) SAL_DELETED_FUNCTION;
- ListBox* m_list;
+ VclPtr<ListBox> m_list;
};
}
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 0aba4b407dcb..60c9db1ee306 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -116,11 +116,11 @@ class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
{
bool m_bInterfaceLocked;
- PushButton *m_pOptionsBtn;
- PushButton *m_pEnableBtn;
- PushButton *m_pRemoveBtn;
+ VclPtr<PushButton> m_pOptionsBtn;
+ VclPtr<PushButton> m_pEnableBtn;
+ VclPtr<PushButton> m_pRemoveBtn;
- ExtMgrDialog *m_pParent;
+ VclPtr<ExtMgrDialog> m_pParent;
void SetButtonPos( const Rectangle& rRect );
void SetButtonStatus( const TEntry_Impl& rEntry );
@@ -137,6 +137,7 @@ class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
public:
ExtBoxWithBtns_Impl(vcl::Window* pParent);
virtual ~ExtBoxWithBtns_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void InitFromDialog(ExtMgrDialog *pParentDialog);
@@ -165,9 +166,9 @@ void ExtBoxWithBtns_Impl::InitFromDialog(ExtMgrDialog *pParentDialog)
m_pParent = pParentDialog;
- m_pOptionsBtn = new PushButton( this, WB_TABSTOP );
- m_pEnableBtn = new PushButton( this, WB_TABSTOP );
- m_pRemoveBtn = new PushButton( this, WB_TABSTOP );
+ m_pOptionsBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP );
+ m_pEnableBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP );
+ m_pRemoveBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP );
SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
m_pOptionsBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_OPTIONS );
@@ -202,9 +203,16 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeExtBoxWithBtns(vcl::Wi
ExtBoxWithBtns_Impl::~ExtBoxWithBtns_Impl()
{
- delete m_pOptionsBtn;
- delete m_pEnableBtn;
- delete m_pRemoveBtn;
+ disposeOnce();
+}
+
+void ExtBoxWithBtns_Impl::dispose()
+{
+ m_pOptionsBtn.disposeAndClear();
+ m_pEnableBtn.disposeAndClear();
+ m_pRemoveBtn.disposeAndClear();
+ m_pParent.clear();
+ ExtensionBox_Impl::dispose();
}
@@ -400,8 +408,8 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
break;
case CMD_SHOW_LICENSE:
{
- ShowLicenseDialog aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage );
- aLicenseDlg.Execute();
+ ScopedVclPtrInstance< ShowLicenseDialog > aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage );
+ aLicenseDlg->Execute();
break;
}
}
@@ -587,12 +595,11 @@ bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::
if ( !bHadWarning && IsSharedPkgMgr( xPackage ) )
{
const SolarMutexGuard guard;
- MessageDialog aInfoBox(pParent, getResId(nResID),
- VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
-
+ ScopedVclPtrInstance<MessageDialog> aInfoBox(pParent, getResId(nResID),
+ VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
bHadWarning = true;
- if ( RET_OK == aInfoBox.Execute() )
+ if ( RET_OK == aInfoBox->Execute() )
return true;
else
return false;
@@ -619,32 +626,32 @@ void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle
uno::Any exc( ::cppu::getCaughtException() );
OUString msg( ::comphelper::anyToString( exc ) );
const SolarMutexGuard guard;
- MessageDialog aErrorBox(NULL, msg);
- aErrorBox.SetText( sTitle );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg);
+ aErrorBox->SetText( sTitle );
+ aErrorBox->Execute();
}
}
bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const
{
const SolarMutexGuard guard;
- MessageDialog aInfo(m_pVCLWindow, getResId(RID_STR_WARNING_INSTALL_EXTENSION),
- VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
+ ScopedVclPtrInstance<MessageDialog> aInfo(m_pVCLWindow, getResId(RID_STR_WARNING_INSTALL_EXTENSION),
+ VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
- OUString sText(aInfo.get_primary_text());
+ OUString sText(aInfo->get_primary_text());
sText = sText.replaceAll("%NAME", rExtensionName);
- aInfo.set_primary_text(sText);
+ aInfo->set_primary_text(sText);
- return ( RET_OK == aInfo.Execute() );
+ return ( RET_OK == aInfo->Execute() );
}
bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const
{
const SolarMutexGuard guard;
- MessageDialog aQuery(m_pVCLWindow, "InstallForAllDialog",
- "desktop/ui/installforalldialog.ui");
+ ScopedVclPtrInstance<MessageDialog> aQuery(m_pVCLWindow, "InstallForAllDialog",
+ "desktop/ui/installforalldialog.ui");
- short nRet = aQuery.Execute();
+ short nRet = aQuery->Execute();
if (nRet == RET_CANCEL)
return false;
@@ -716,7 +723,24 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager)
ExtMgrDialog::~ExtMgrDialog()
{
+ disposeOnce();
+}
+
+void ExtMgrDialog::dispose()
+{
m_aIdle.Stop();
+ m_pExtensionBox.clear();
+ m_pAddBtn.clear();
+ m_pUpdateBtn.clear();
+ m_pCloseBtn.clear();
+ m_pBundledCbx.clear();
+ m_pSharedCbx.clear();
+ m_pUserCbx.clear();
+ m_pGetExtensions.clear();
+ m_pProgressText.clear();
+ m_pProgressBar.clear();
+ m_pCancelBtn.clear();
+ ModelessDialog::dispose();
}
@@ -769,14 +793,14 @@ void ExtMgrDialog::checkEntries()
bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const
{
const SolarMutexGuard guard;
- MessageDialog aInfo(const_cast<ExtMgrDialog*>(this), getResId(RID_STR_WARNING_REMOVE_EXTENSION),
- VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
+ ScopedVclPtrInstance<MessageDialog> aInfo(const_cast<ExtMgrDialog*>(this), getResId(RID_STR_WARNING_REMOVE_EXTENSION),
+ VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
- OUString sText(aInfo.get_primary_text());
+ OUString sText(aInfo->get_primary_text());
sText = sText.replaceAll("%NAME", rExtensionName);
- aInfo.set_primary_text(sText);
+ aInfo->set_primary_text(sText);
- return ( RET_OK == aInfo.Execute() );
+ return ( RET_OK == aInfo->Execute() );
}
bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage,
@@ -1197,7 +1221,20 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan
UpdateRequiredDialog::~UpdateRequiredDialog()
{
+ disposeOnce();
+}
+
+void UpdateRequiredDialog::dispose()
+{
m_aIdle.Stop();
+ m_pExtensionBox.clear();
+ m_pUpdateNeeded.clear();
+ m_pUpdateBtn.clear();
+ m_pCloseBtn.clear();
+ m_pCancelBtn.clear();
+ m_pProgressText.clear();
+ m_pProgressBar.clear();
+ ModalDialog::dispose();
}
long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
@@ -1570,6 +1607,16 @@ ShowLicenseDialog::ShowLicenseDialog( vcl::Window * pParent,
m_pLicenseText->SetText(xPackage->getLicenseText());
}
+ShowLicenseDialog::~ShowLicenseDialog()
+{
+ disposeOnce();
+}
+
+void ShowLicenseDialog::dispose()
+{
+ m_pLicenseText.clear();
+ ModalDialog::dispose();
+}
// UpdateRequiredDialogService
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index 0db6be025f18..2f6052be71af 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -55,7 +55,7 @@ class TheExtensionManager;
class DialogHelper
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
- Dialog* m_pVCLWindow;
+ VclPtr<Dialog> m_pVCLWindow;
ImplSVEvent * m_nEventID;
bool m_bIsBusy;
@@ -99,17 +99,17 @@ public:
class ExtMgrDialog : public ModelessDialog,
public DialogHelper
{
- ExtBoxWithBtns_Impl *m_pExtensionBox;
- PushButton *m_pAddBtn;
- PushButton *m_pUpdateBtn;
- CloseButton *m_pCloseBtn;
- CheckBox *m_pBundledCbx;
- CheckBox *m_pSharedCbx;
- CheckBox *m_pUserCbx;
- FixedHyperlink *m_pGetExtensions;
- FixedText *m_pProgressText;
- ProgressBar *m_pProgressBar;
- CancelButton *m_pCancelBtn;
+ VclPtr<ExtBoxWithBtns_Impl> m_pExtensionBox;
+ VclPtr<PushButton> m_pAddBtn;
+ VclPtr<PushButton> m_pUpdateBtn;
+ VclPtr<CloseButton> m_pCloseBtn;
+ VclPtr<CheckBox> m_pBundledCbx;
+ VclPtr<CheckBox> m_pSharedCbx;
+ VclPtr<CheckBox> m_pUserCbx;
+ VclPtr<FixedHyperlink> m_pGetExtensions;
+ VclPtr<FixedText> m_pProgressText;
+ VclPtr<ProgressBar> m_pProgressBar;
+ VclPtr<CancelButton> m_pCancelBtn;
const OUString m_sAddPackages;
OUString m_sProgressText;
OUString m_sLastFolderURL;
@@ -141,6 +141,7 @@ class ExtMgrDialog : public ModelessDialog,
public:
ExtMgrDialog( vcl::Window * pParent, TheExtensionManager *pManager );
virtual ~ExtMgrDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
@@ -173,13 +174,13 @@ public:
class UpdateRequiredDialog : public ModalDialog,
public DialogHelper
{
- ExtensionBox_Impl* m_pExtensionBox;
- FixedText* m_pUpdateNeeded;
- PushButton* m_pUpdateBtn;
- PushButton* m_pCloseBtn;
- CancelButton* m_pCancelBtn;
- FixedText* m_pProgressText;
- ProgressBar* m_pProgressBar;
+ VclPtr<ExtensionBox_Impl> m_pExtensionBox;
+ VclPtr<FixedText> m_pUpdateNeeded;
+ VclPtr<PushButton> m_pUpdateBtn;
+ VclPtr<PushButton> m_pCloseBtn;
+ VclPtr<CancelButton> m_pCancelBtn;
+ VclPtr<FixedText> m_pProgressText;
+ VclPtr<ProgressBar> m_pProgressBar;
const OUString m_sAddPackages;
const OUString m_sCloseText;
OUString m_sProgressText;
@@ -212,6 +213,7 @@ class UpdateRequiredDialog : public ModalDialog,
public:
UpdateRequiredDialog( vcl::Window * pParent, TheExtensionManager *pManager );
virtual ~UpdateRequiredDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
@@ -240,9 +242,11 @@ public:
class ShowLicenseDialog : public ModalDialog
{
- VclMultiLineEdit* m_pLicenseText;
+ VclPtr<VclMultiLineEdit> m_pLicenseText;
public:
ShowLicenseDialog(vcl::Window * pParent, const css::uno::Reference< css::deployment::XPackage > &xPackage);
+ virtual ~ShowLicenseDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index adcb6c740fa3..7e97c526d33c 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -451,12 +451,12 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
verExc.Deployed->getDisplayName());
{
SolarMutexGuard guard;
- MessageDialog box(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL,
- ResId(id, *DeploymentGuiResMgr::get()), VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
+ ScopedVclPtrInstance<MessageDialog> box(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL,
+ ResId(id, *DeploymentGuiResMgr::get()), VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
OUString s;
if (bEqualNames)
{
- s = box.get_primary_text();
+ s = box->get_primary_text();
}
else if (id == RID_STR_WARNING_VERSION_EQUAL)
{
@@ -477,8 +477,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
s = s.replaceAll("$OLDNAME", verExc.Deployed->getDisplayName());
s = s.replaceAll("$NEW", getVersion(verExc.NewVersion));
s = s.replaceAll("$DEPLOYED", getVersion(verExc.Deployed));
- box.set_primary_text(s);
- approve = box.Execute() == RET_OK;
+ box->set_primary_text(s);
+ approve = box->Execute() == RET_OK;
abort = !approve;
}
}
@@ -506,8 +506,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
SolarMutexGuard guard;
OUString sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get()).toString());
sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName());
- MessageDialog box(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, sMsg);
- box.Execute();
+ ScopedVclPtrInstance< MessageDialog > box(m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, sMsg);
+ box->Execute();
approve = true;
}
@@ -571,7 +571,7 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus )
text = ::comphelper::anyToString( rStatus ); // fallback
const SolarMutexGuard aGuard;
- const boost::scoped_ptr<MessageDialog> aBox(new MessageDialog(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, text));
+ ScopedVclPtrInstance< MessageDialog > aBox(m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, text);
aBox->Execute();
}
++m_nCurrentProgress;
@@ -813,8 +813,8 @@ void ExtensionCmdQueue::Thread::execute()
msg = ::comphelper::anyToString(exc);
const SolarMutexGuard guard;
- boost::scoped_ptr<MessageDialog> box(
- new MessageDialog(currentCmdEnv->activeDialog(), msg));
+ ScopedVclPtr<MessageDialog> box(
+ VclPtr<MessageDialog>::Create(currentCmdEnv->activeDialog(), msg));
if ( m_pDialogHelper )
box->SetText( m_pDialogHelper->getWindow()->GetText() );
box->Execute();
@@ -923,12 +923,10 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE
void ExtensionCmdQueue::Thread::_checkForUpdates(
const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList )
{
- UpdateDialog* pUpdateDialog;
- std::vector< UpdateData > vData;
-
const SolarMutexGuard guard;
- pUpdateDialog = new UpdateDialog( m_xContext, m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, vExtensionList, &vData );
+ std::vector< UpdateData > vData;
+ ScopedVclPtrInstance<UpdateDialog> pUpdateDialog( m_xContext, m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, vExtensionList, &vData );
pUpdateDialog->notifyMenubar( true, false ); // prepare the checking, if there updates to be notified via menu bar icon
@@ -970,7 +968,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates(
else
pUpdateDialog->notifyMenubar( false, false ); // check if there updates to be notified via menu bar icon
- delete pUpdateDialog;
+ pUpdateDialog.disposeAndClear();
}
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index ade275724174..1b3f6a17fc8e 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -201,7 +201,7 @@ void ExtensionBox_Impl::Init()
{
SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
- m_pScrollBar = new ScrollBar( this, WB_VERT );
+ m_pScrollBar = VclPtr<ScrollBar>::Create( this, WB_VERT );
m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
m_pScrollBar->EnableDrag();
@@ -239,6 +239,11 @@ void ExtensionBox_Impl::Init()
ExtensionBox_Impl::~ExtensionBox_Impl()
{
+ disposeOnce();
+}
+
+void ExtensionBox_Impl::dispose()
+{
if ( ! m_bInDelete )
DeleteRemoved();
@@ -248,22 +253,19 @@ ExtensionBox_Impl::~ExtensionBox_Impl()
for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
{
- if ( (*iIndex)->m_pPublisher )
- {
- delete (*iIndex)->m_pPublisher;
- (*iIndex)->m_pPublisher = NULL;
- }
+ (*iIndex)->m_pPublisher.disposeAndClear();
(*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
}
m_vEntries.clear();
- delete m_pScrollBar;
+ m_pScrollBar.disposeAndClear();
m_xRemoveListener.clear();
delete m_pLocale;
delete m_pCollator;
+ ::svt::IExtensionListBox::dispose();
}
@@ -433,11 +435,7 @@ void ExtensionBox_Impl::DeleteRemoved()
for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex )
{
- if ( (*iIndex)->m_pPublisher )
- {
- delete (*iIndex)->m_pPublisher;
- (*iIndex)->m_pPublisher = NULL;
- }
+ (*iIndex)->m_pPublisher.disposeAndClear();
}
m_vRemovedEntries.clear();
@@ -546,7 +544,7 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl& rEnt
// Init publisher link here
if ( !rEntry->m_pPublisher && !rEntry->m_sPublisher.isEmpty() )
{
- rEntry->m_pPublisher = new FixedHyperlink( this );
+ rEntry->m_pPublisher = VclPtr<FixedHyperlink>::Create( this );
rEntry->m_pPublisher->SetBackground();
rEntry->m_pPublisher->SetPaintTransparent( true );
rEntry->m_pPublisher->SetURL( rEntry->m_sPublisherURL );
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index 1590f82500a5..d49e4a132690 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -78,7 +78,7 @@ struct Entry_Impl
OUString m_sLicenseText;
Image m_aIcon;
Image m_aIconHC;
- FixedHyperlink* m_pPublisher;
+ VclPtr<FixedHyperlink> m_pPublisher;
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
@@ -99,7 +99,7 @@ class ExtensionBox_Impl;
class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
{
- ExtensionBox_Impl *m_pParent;
+ VclPtr<ExtensionBox_Impl> m_pParent;
public:
@@ -134,7 +134,7 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox
Image m_aDefaultImage;
Link m_aClickHdl;
- ScrollBar *m_pScrollBar;
+ VclPtr<ScrollBar> m_pScrollBar;
com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener;
@@ -182,6 +182,7 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox
public:
ExtensionBox_Impl(vcl::Window* pParent);
virtual ~ExtensionBox_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle &rPaintRect ) SAL_OVERRIDE;
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index 45839a498619..f07042d44a23 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -223,9 +223,8 @@ void ServiceImpl::startExecuteModal(
catch (const Exception & exc) {
if (bAppUp) {
const SolarMutexGuard guard;
- boost::scoped_ptr<MessageDialog> box(
- new MessageDialog(Application::GetActiveTopWindow(),
- exc.Message));
+ ScopedVclPtrInstance<MessageDialog> box(
+ Application::GetActiveTopWindow(), exc.Message);
box->Execute();
}
throw;
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index f3584d043640..3980a2396b81 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -98,8 +98,8 @@ TheExtensionManager::TheExtensionManager( vcl::Window *pParent,
TheExtensionManager::~TheExtensionManager()
{
- delete m_pUpdReqDialog;
- delete m_pExtMgrDialog;
+ m_pUpdReqDialog.disposeAndClear();
+ m_pExtMgrDialog.disposeAndClear();
delete m_pExecuteCmdQueue;
}
@@ -112,7 +112,7 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg )
{
if ( !m_pUpdReqDialog )
{
- m_pUpdReqDialog = new UpdateRequiredDialog( NULL, this );
+ m_pUpdReqDialog = VclPtr<UpdateRequiredDialog>::Create( nullptr, this );
delete m_pExecuteCmdQueue;
m_pExecuteCmdQueue = new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext );
createPackageList();
@@ -120,7 +120,7 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg )
}
else if ( !m_pExtMgrDialog )
{
- m_pExtMgrDialog = new ExtMgrDialog( m_pParent, this );
+ m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( m_pParent, this );
delete m_pExecuteCmdQueue;
m_pExecuteCmdQueue = new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext );
m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL );
@@ -171,8 +171,7 @@ sal_Int16 TheExtensionManager::execute()
if ( m_pUpdReqDialog )
{
nRet = m_pUpdReqDialog->Execute();
- delete m_pUpdReqDialog;
- m_pUpdReqDialog = NULL;
+ m_pUpdReqDialog.disposeAndClear();
}
return nRet;
@@ -259,10 +258,8 @@ void TheExtensionManager::terminateDialog()
if ( ! dp_misc::office_is_running() )
{
const SolarMutexGuard guard;
- delete m_pExtMgrDialog;
- m_pExtMgrDialog = NULL;
- delete m_pUpdReqDialog;
- m_pUpdReqDialog = NULL;
+ m_pExtMgrDialog.disposeAndClear();
+ m_pUpdReqDialog.disposeAndClear();
Application::Quit();
}
}
@@ -426,10 +423,8 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt )
if ( dp_misc::office_is_running() )
{
const SolarMutexGuard guard;
- delete m_pExtMgrDialog;
- m_pExtMgrDialog = NULL;
- delete m_pUpdReqDialog;
- m_pUpdReqDialog = NULL;
+ m_pExtMgrDialog.disposeAndClear();
+ m_pUpdReqDialog.disposeAndClear();
}
s_ExtMgr.clear();
}
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
index 67836b2223d3..9281ddef4c05 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
@@ -53,9 +53,9 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes;
- vcl::Window *m_pParent;
- ExtMgrDialog *m_pExtMgrDialog;
- UpdateRequiredDialog *m_pUpdReqDialog;
+ VclPtr<vcl::Window> m_pParent;
+ VclPtr<ExtMgrDialog> m_pExtMgrDialog;
+ VclPtr<UpdateRequiredDialog> m_pUpdReqDialog;
ExtensionCmdQueue *m_pExecuteCmdQueue;
OUString m_sGetExtensionsURL;
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 5a66653d400e..8e75bd04b42a 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -520,7 +520,7 @@ UpdateDialog::UpdateDialog(
get(m_pthrobber, "THROBBER");
get(m_pUpdate, "UPDATE_LABEL");
get(m_pContainer, "UPDATES_CONTAINER");
- m_pUpdates = new UpdateDialog::CheckListBox(m_pContainer, *this);
+ m_pUpdates = VclPtr<UpdateDialog::CheckListBox>::Create(m_pContainer, *this);
Size aSize(LogicToPixel(Size(240, 51), MAP_APPFONT));
m_pUpdates->set_width_request(aSize.Width());
m_pUpdates->set_height_request(aSize.Height());
@@ -564,6 +564,11 @@ UpdateDialog::UpdateDialog(
UpdateDialog::~UpdateDialog()
{
+ disposeOnce();
+}
+
+void UpdateDialog::dispose()
+{
storeIgnoredUpdates();
for ( std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() ); i != m_ListboxEntries.end(); ++i )
@@ -574,7 +579,22 @@ UpdateDialog::~UpdateDialog()
{
delete (*i);
}
- delete m_pUpdates;
+ m_pUpdates.disposeAndClear();
+ m_pchecking.clear();
+ m_pthrobber.clear();
+ m_pUpdate.clear();
+ m_pContainer.clear();
+ m_pAll.clear();
+ m_pDescription.clear();
+ m_pPublisherLabel.clear();
+ m_pPublisherLink.clear();
+ m_pReleaseNotesLabel.clear();
+ m_pReleaseNotesLink.clear();
+ m_pDescriptions.clear();
+ m_pHelp.clear();
+ m_pOk.clear();
+ m_pClose.clear();
+ ModalDialog::dispose();
}
@@ -599,9 +619,6 @@ UpdateDialog::CheckListBox::CheckListBox( vcl::Window* pParent, UpdateDialog & d
SetNormalStaticImage(Image(DpGuiResId(RID_DLG_UPDATE_NORMALALERT)));
}
-UpdateDialog::CheckListBox::~CheckListBox() {}
-
-
sal_uInt16 UpdateDialog::CheckListBox::getItemCount() const {
sal_uLong i = GetEntryCount();
OSL_ASSERT(i <= std::numeric_limits< sal_uInt16 >::max());
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index c2eedcbba4b2..18fa9de6ebde 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -85,6 +85,7 @@ public:
std::vector< dp_gui::UpdateData > * updateData);
virtual ~UpdateDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
@@ -111,8 +112,6 @@ private:
CheckListBox(
vcl::Window* pParent, UpdateDialog & dialog);
- virtual ~CheckListBox();
-
sal_uInt16 getItemCount() const;
private:
@@ -169,21 +168,21 @@ private:
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
m_context;
- FixedText* m_pchecking;
- Throbber* m_pthrobber;
- FixedText* m_pUpdate;
- VclViewport* m_pContainer;
- UpdateDialog::CheckListBox* m_pUpdates;
- CheckBox* m_pAll;
- FixedText* m_pDescription;
- FixedText* m_pPublisherLabel;
- FixedHyperlink* m_pPublisherLink;
- FixedText* m_pReleaseNotesLabel;
- FixedHyperlink* m_pReleaseNotesLink;
- VclMultiLineEdit* m_pDescriptions;
- HelpButton* m_pHelp;
- PushButton* m_pOk;
- PushButton* m_pClose;
+ VclPtr<FixedText> m_pchecking;
+ VclPtr<Throbber> m_pthrobber;
+ VclPtr<FixedText> m_pUpdate;
+ VclPtr<VclViewport> m_pContainer;
+ VclPtr<UpdateDialog::CheckListBox> m_pUpdates;
+ VclPtr<CheckBox> m_pAll;
+ VclPtr<FixedText> m_pDescription;
+ VclPtr<FixedText> m_pPublisherLabel;
+ VclPtr<FixedHyperlink> m_pPublisherLink;
+ VclPtr<FixedText> m_pReleaseNotesLabel;
+ VclPtr<FixedHyperlink> m_pReleaseNotesLink;
+ VclPtr<VclMultiLineEdit> m_pDescriptions;
+ VclPtr<HelpButton> m_pHelp;
+ VclPtr<PushButton> m_pOk;
+ VclPtr<PushButton> m_pClose;
OUString m_error;
OUString m_none;
OUString m_noInstallable;
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
index e844e35fa5bd..69c49d8bbeac 100644
--- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
@@ -237,7 +237,22 @@ UpdateInstallDialog::UpdateInstallDialog(
m_pHelp->Disable();
}
-UpdateInstallDialog::~UpdateInstallDialog() {}
+UpdateInstallDialog::~UpdateInstallDialog()
+{
+ disposeOnce();
+}
+
+void UpdateInstallDialog::dispose()
+{
+ m_pFt_action.clear();
+ m_pStatusbar.clear();
+ m_pFt_extension_name.clear();
+ m_pMle_info.clear();
+ m_pHelp.clear();
+ m_pOk.clear();
+ m_pCancel.clear();
+ ModalDialog::dispose();
+}
bool UpdateInstallDialog::Close()
{
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx
index bff71e788820..9c05abd36358 100644
--- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx
@@ -60,6 +60,7 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xCtx);
virtual ~UpdateInstallDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool Close() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
@@ -104,13 +105,13 @@ private:
OUString m_sNoInstall;
OUString m_sThisErrorOccurred;
- FixedText *m_pFt_action;
- ProgressBar *m_pStatusbar;
- FixedText *m_pFt_extension_name;
- VclMultiLineEdit *m_pMle_info;
- HelpButton *m_pHelp;
- OKButton *m_pOk;
- CancelButton *m_pCancel;
+ VclPtr<FixedText> m_pFt_action;
+ VclPtr<ProgressBar> m_pStatusbar;
+ VclPtr<FixedText> m_pFt_extension_name;
+ VclPtr<VclMultiLineEdit> m_pMle_info;
+ VclPtr<HelpButton> m_pHelp;
+ VclPtr<OKButton> m_pOk;
+ VclPtr<CancelButton> m_pCancel;
};
}
diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx
index c9aab531d127..710052f3180f 100644
--- a/desktop/source/deployment/gui/license_dialog.cxx
+++ b/desktop/source/deployment/gui/license_dialog.cxx
@@ -57,6 +57,7 @@ class LicenseView : public MultiLineEdit, public SfxListener
public:
LicenseView( vcl::Window* pParent, WinBits nStyle );
virtual ~LicenseView();
+ virtual void dispose() SAL_OVERRIDE;
void ScrollDown( ScrollType eScroll );
@@ -76,14 +77,14 @@ protected:
struct LicenseDialogImpl : public ModalDialog
{
cssu::Reference<cssu::XComponentContext> m_xComponentContext;
- FixedText* m_pFtHead;
- FixedImage* m_pArrow1;
- FixedImage* m_pArrow2;
- LicenseView* m_pLicense;
- PushButton* m_pDown;
+ VclPtr<FixedText> m_pFtHead;
+ VclPtr<FixedImage> m_pArrow1;
+ VclPtr<FixedImage> m_pArrow2;
+ VclPtr<LicenseView> m_pLicense;
+ VclPtr<PushButton> m_pDown;
- PushButton* m_pAcceptButton;
- PushButton* m_pDeclineButton;
+ VclPtr<PushButton> m_pAcceptButton;
+ VclPtr<PushButton> m_pDeclineButton;
DECL_LINK(PageDownHdl, void *);
DECL_LINK(ScrolledHdl, void *);
@@ -98,11 +99,26 @@ struct LicenseDialogImpl : public ModalDialog
css::uno::Reference< css::uno::XComponentContext > const & xContext,
const OUString & sExtensionName,
const OUString & sLicenseText);
+ virtual ~LicenseDialogImpl() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
virtual void Activate() SAL_OVERRIDE;
};
+void LicenseDialogImpl::dispose()
+{
+ m_pFtHead.clear();
+ m_pArrow1.clear();
+ m_pArrow2.clear();
+ m_pLicense.clear();
+ m_pDown.clear();
+ m_pAcceptButton.clear();
+ m_pDeclineButton.clear();
+ ModalDialog::dispose();
+}
+
+
LicenseView::LicenseView( vcl::Window* pParent, WinBits nStyle )
: MultiLineEdit( pParent, nStyle )
{
@@ -122,9 +138,15 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLicenseView(vcl::Windo
LicenseView::~LicenseView()
{
+ disposeOnce();
+}
+
+void LicenseView::dispose()
+{
maEndReachedHdl = Link();
maScrolledHdl = Link();
EndListeningAll();
+ MultiLineEdit::dispose();
}
void LicenseView::ScrollDown( ScrollType eScroll )
@@ -307,8 +329,9 @@ sal_Int16 LicenseDialog::execute() throw (RuntimeException, std::exception)
sal_Int16 LicenseDialog::solar_execute()
{
- std::unique_ptr<LicenseDialogImpl> dlg(
- new LicenseDialogImpl(
+ VclPtr<LicenseDialogImpl> dlg(
+ VclPtr<LicenseDialogImpl>::Create(
+
VCLUnoHelper::GetWindow(m_parent),
m_xComponentContext, m_sExtensionName, m_sLicenseText));
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b783612ecb73..67e4750c05cb 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -610,21 +610,21 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
#ifndef IOS
InitSvpForLibreOfficeKit();
- VirtualDevice aDevice(0, Size(1, 1), (sal_uInt16)32);
+ ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ;
boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
- aDevice.SetOutputSizePixelScaleOffsetAndBuffer(
+ pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
aBuffer, true );
- pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
+ pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
#else
SystemGraphicsData aData;
aData.rCGContext = reinterpret_cast<CGContextRef>(pBuffer);
// the Size argument is irrelevant, I hope
- VirtualDevice aDevice(&aData, Size(1, 1), (sal_uInt16)0);
+ ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), (sal_uInt16)0);
- pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
+ pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
#endif
@@ -633,12 +633,12 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
{
// Draw a small red rectangle in the top left corner so that it's easy to see where a new tile begins.
Rectangle aRect(0, 0, 5, 5);
- aRect = aDevice.PixelToLogic(aRect);
- aDevice.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
- aDevice.SetFillColor(COL_LIGHTRED);
- aDevice.SetLineColor();
- aDevice.DrawRect(aRect);
- aDevice.Pop();
+ aRect = pDevice->PixelToLogic(aRect);
+ pDevice->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+ pDevice->SetFillColor(COL_LIGHTRED);
+ pDevice->SetLineColor();
+ pDevice->DrawRect(aRect);
+ pDevice->Pop();
}
#else
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index b4ab62a5a309..d86a455238cf 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -472,10 +472,10 @@ Reference<XComponentContext> getUNO(
if ( ! InitVCL() )
throw RuntimeException( "Cannot initialize VCL!" );
{
- WarningBox warn(NULL, WB_OK | WB_DEF_OK, sMsg);
- warn.SetText(utl::ConfigManager::getProductName());
- warn.SetIcon(0);
- warn.Execute();
+ ScopedVclPtrInstance< WarningBox > warn(nullptr, WB_OK | WB_DEF_OK, sMsg);
+ warn->SetText(utl::ConfigManager::getProductName());
+ warn->SetIcon(0);
+ warn->Execute();
}
DeInitVCL();
}
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 2cfba719e758..156a2d103f11 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -47,13 +47,29 @@ using namespace ::com::sun::star::uno;
namespace {
+class SplashScreen;
+
+class SplashScreenWindow : public IntroWindow
+{
+public:
+ SplashScreen *pSpl;
+ ScopedVclPtr<VirtualDevice> _vdev;
+ SplashScreenWindow(SplashScreen *);
+ virtual ~SplashScreenWindow() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
+ // workwindow
+ virtual void Paint( const Rectangle& ) SAL_OVERRIDE;
+};
+
class SplashScreen
: public ::cppu::WeakImplHelper3< XStatusIndicator, XInitialization, XServiceInfo >
- , public IntroWindow
{
+ friend SplashScreenWindow;
private:
enum BitmapMode { BM_FULLSCREEN, BM_DEFAULTMODE };
+ VclPtr<SplashScreenWindow> pWindow;
+
DECL_LINK( AppEventListenerHdl, VclWindowEvent * );
virtual ~SplashScreen();
void loadConfig();
@@ -63,7 +79,6 @@ private:
static osl::Mutex _aMutex;
- VirtualDevice _vdev;
BitmapEx _aIntroBmp;
Color _cProgressFrameColor;
Color _cProgressBarColor;
@@ -112,15 +127,24 @@ public:
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ return desktop::splash::getSupportedServiceNames(); }
+};
- // workwindow
- virtual void Paint( const Rectangle& ) SAL_OVERRIDE;
+SplashScreenWindow::SplashScreenWindow(SplashScreen *pSplash)
+ : IntroWindow()
+ , pSpl( pSplash )
+ , _vdev(VclPtr<VirtualDevice>::Create(*this))
+{
+ _vdev->EnableRTL(IsRTLEnabled());
+}
-};
+void SplashScreenWindow::dispose()
+{
+ pSpl = NULL;
+ IntroWindow::dispose();
+}
SplashScreen::SplashScreen()
- : IntroWindow()
- , _vdev(*((IntroWindow*)this))
+ : pWindow( new SplashScreenWindow (this) )
, _cProgressFrameColor(sal::static_int_cast< ColorData >(NOT_LOADED))
, _cProgressBarColor(sal::static_int_cast< ColorData >(NOT_LOADED))
, _cProgressTextColor(sal::static_int_cast< ColorData >(NOT_LOADED))
@@ -150,15 +174,14 @@ SplashScreen::SplashScreen()
, _yoffset(18)
{
loadConfig();
- _vdev.EnableRTL(IsRTLEnabled());
}
SplashScreen::~SplashScreen()
{
Application::RemoveEventListener(
LINK( this, SplashScreen, AppEventListenerHdl ) );
- Hide();
-
+ pWindow->Hide();
+ pWindow.disposeAndClear();
}
void SAL_CALL SplashScreen::start(const OUString&, sal_Int32 nRange)
@@ -169,10 +192,10 @@ void SAL_CALL SplashScreen::start(const OUString&, sal_Int32 nRange)
_bProgressEnd = false;
SolarMutexGuard aSolarGuard;
if ( _eBitmapMode == BM_FULLSCREEN )
- ShowFullScreenMode( true );
- Show();
- Paint(Rectangle());
- Flush();
+ pWindow->ShowFullScreenMode( true );
+ pWindow->Show();
+ pWindow->Paint(Rectangle());
+ pWindow->Flush();
}
}
@@ -183,8 +206,8 @@ void SAL_CALL SplashScreen::end()
if (_bVisible )
{
if ( _eBitmapMode == BM_FULLSCREEN )
- EndFullScreenMode();
- Hide();
+ pWindow->EndFullScreenMode();
+ pWindow->Hide();
}
_bProgressEnd = true;
}
@@ -196,8 +219,8 @@ void SAL_CALL SplashScreen::reset()
if (_bVisible && !_bProgressEnd )
{
if ( _eBitmapMode == BM_FULLSCREEN )
- ShowFullScreenMode( true );
- Show();
+ pWindow->ShowFullScreenMode( true );
+ pWindow->Show();
updateStatus();
}
}
@@ -213,8 +236,8 @@ void SAL_CALL SplashScreen::setText(const OUString& rText)
if (_bVisible && !_bProgressEnd)
{
if ( _eBitmapMode == BM_FULLSCREEN )
- ShowFullScreenMode( true );
- Show();
+ pWindow->ShowFullScreenMode( true );
+ pWindow->Show();
updateStatus();
}
}
@@ -228,11 +251,13 @@ void SAL_CALL SplashScreen::setValue(sal_Int32 nValue)
SolarMutexGuard aSolarGuard;
if (_bVisible && !_bProgressEnd) {
if ( _eBitmapMode == BM_FULLSCREEN )
- ShowFullScreenMode( true );
- Show();
- if (nValue >= _iMax) _iProgress = _iMax;
- else _iProgress = nValue;
- updateStatus();
+ pWindow->ShowFullScreenMode( true );
+ pWindow->Show();
+ if (nValue >= _iMax)
+ _iProgress = _iMax;
+ else
+ _iProgress = nValue;
+ updateStatus();
}
}
@@ -252,8 +277,8 @@ SplashScreen::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::sta
if ( _bShowLogo )
SetScreenBitmap (_aIntroBmp);
Size aSize = _aIntroBmp.GetSizePixel();
- SetOutputSizePixel( aSize );
- _vdev.SetOutputSizePixel( aSize );
+ pWindow->SetOutputSizePixel( aSize );
+ pWindow->_vdev->SetOutputSizePixel( aSize );
_height = aSize.Height();
_width = aSize.Width();
if (_width > 500)
@@ -323,10 +348,12 @@ SplashScreen::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::sta
void SplashScreen::updateStatus()
{
- if (!_bVisible || _bProgressEnd) return;
- if (!_bPaintProgress) _bPaintProgress = true;
- Paint(Rectangle());
- Flush();
+ if (!_bVisible || _bProgressEnd)
+ return;
+ if (!_bPaintProgress)
+ _bPaintProgress = true;
+ pWindow->Paint(Rectangle());
+ pWindow->Flush();
}
// internal private methods
@@ -337,7 +364,7 @@ IMPL_LINK( SplashScreen, AppEventListenerHdl, VclWindowEvent *, inEvent )
switch ( inEvent->GetId() )
{
case VCLEVENT_WINDOW_SHOW:
- Paint( Rectangle() );
+ pWindow->Paint( Rectangle() );
break;
default:
break;
@@ -578,18 +605,19 @@ void SplashScreen::determineProgressRatioValues(
}
}
-void SplashScreen::Paint( const Rectangle&)
+void SplashScreenWindow::Paint( const Rectangle&)
{
- if(!_bVisible) return;
+ if (!pSpl || !pSpl->_bVisible)
+ return;
//native drawing
// in case of native controls we need to draw directly to the window
- if( _bNativeProgress && IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) )
+ if( pSpl->_bNativeProgress && IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) )
{
- DrawBitmapEx( Point(), _aIntroBmp );
+ DrawBitmapEx( Point(), pSpl->_aIntroBmp );
- ImplControlValue aValue( _iProgress * _barwidth / _iMax);
- Rectangle aDrawRect( Point(_tlx, _tly), Size( _barwidth, _barheight ) );
+ ImplControlValue aValue( pSpl->_iProgress * pSpl->_barwidth / pSpl->_iMax);
+ Rectangle aDrawRect( Point(pSpl->_tlx, pSpl->_tly), Size( pSpl->_barwidth, pSpl->_barheight ) );
Rectangle aNativeControlRegion, aNativeContentRegion;
if( GetNativeControlRegion( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect,
@@ -597,41 +625,42 @@ void SplashScreen::Paint( const Rectangle&)
aNativeControlRegion, aNativeContentRegion ) )
{
long nProgressHeight = aNativeControlRegion.GetHeight();
- aDrawRect.Top() -= (nProgressHeight - _barheight)/2;
- aDrawRect.Bottom() += (nProgressHeight - _barheight)/2;
+ aDrawRect.Top() -= (nProgressHeight - pSpl->_barheight)/2;
+ aDrawRect.Bottom() += (nProgressHeight - pSpl->_barheight)/2;
}
if( (DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect,
- ControlState::ENABLED, aValue, _sProgressText )) )
+ ControlState::ENABLED, aValue, pSpl->_sProgressText )) )
{
return;
}
}
- //non native drawing
+
+ // non native drawing
// draw bitmap
- if (_bPaintBitmap)
- _vdev.DrawBitmapEx( Point(), _aIntroBmp );
+ if (pSpl->_bPaintBitmap)
+ _vdev->DrawBitmapEx( Point(), pSpl->_aIntroBmp );
- if (_bPaintProgress) {
+ if (pSpl->_bPaintProgress) {
// draw progress...
- long length = (_iProgress * _barwidth / _iMax) - (2 * _barspace);
+ long length = (pSpl->_iProgress * pSpl->_barwidth / pSpl->_iMax) - (2 * pSpl->_barspace);
if (length < 0) length = 0;
// border
- _vdev.SetFillColor();
- _vdev.SetLineColor( _cProgressFrameColor );
- _vdev.DrawRect(Rectangle(_tlx, _tly, _tlx+_barwidth, _tly+_barheight));
- _vdev.SetFillColor( _cProgressBarColor );
- _vdev.SetLineColor();
- _vdev.DrawRect(Rectangle(_tlx+_barspace, _tly+_barspace, _tlx+_barspace+length, _tly+_barheight-_barspace));
+ _vdev->SetFillColor();
+ _vdev->SetLineColor( pSpl->_cProgressFrameColor );
+ _vdev->DrawRect(Rectangle(pSpl->_tlx, pSpl->_tly, pSpl->_tlx+pSpl->_barwidth, pSpl->_tly+pSpl->_barheight));
+ _vdev->SetFillColor( pSpl->_cProgressBarColor );
+ _vdev->SetLineColor();
+ _vdev->DrawRect(Rectangle(pSpl->_tlx+pSpl->_barspace, pSpl->_tly+pSpl->_barspace, pSpl->_tlx+pSpl->_barspace+length, pSpl->_tly+pSpl->_barheight-pSpl->_barspace));
vcl::Font aFont;
aFont.SetSize(Size(0, 12));
aFont.SetAlign(ALIGN_BASELINE);
- _vdev.SetFont(aFont);
- _vdev.SetTextColor(_cProgressTextColor);
- _vdev.DrawText(Point(_tlx, _textBaseline), _sProgressText);
+ _vdev->SetFont(aFont);
+ _vdev->SetTextColor(pSpl->_cProgressTextColor);
+ _vdev->DrawText(Point(pSpl->_tlx, pSpl->_textBaseline), pSpl->_sProgressText);
}
- DrawOutDev(Point(), GetOutputSizePixel(), Point(), _vdev.GetOutputSizePixel(), _vdev );
+ DrawOutDev(Point(), GetOutputSizePixel(), Point(), _vdev->GetOutputSizePixel(), *_vdev.get() );
}
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index b764e02c21d1..d782962fa11d 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -116,15 +116,15 @@ namespace drawinglayer
if(nSizeX > 0 && nSizeY > 0)
{
// prepare VirtualDevice
- VirtualDevice aVirtualDevice(*Application::GetDefaultDevice());
+ ScopedVclPtrInstance< VirtualDevice > aVirtualDevice(*Application::GetDefaultDevice());
const Size aSizePixel(nSizeX, nSizeY);
- aVirtualDevice.SetOutputSizePixel(aSizePixel);
+ aVirtualDevice->SetOutputSizePixel(aSizePixel);
// set size at control
xControlWindow->setPosSize(0, 0, nSizeX, nSizeY, awt::PosSize::POSSIZE);
// get graphics and view
- uno::Reference< awt::XGraphics > xGraphics(aVirtualDevice.CreateUnoGraphics());
+ uno::Reference< awt::XGraphics > xGraphics(aVirtualDevice->CreateUnoGraphics());
uno::Reference< awt::XView > xControlView(rXControl, uno::UNO_QUERY);
if(xGraphics.is() && xControlView.is())
@@ -190,7 +190,7 @@ namespace drawinglayer
xControlView->draw(0, 0);
// get bitmap
- const Bitmap aContent(aVirtualDevice.GetBitmap(Point(), aSizePixel));
+ const Bitmap aContent(aVirtualDevice->GetBitmap(Point(), aSizePixel));
// to avoid scaling, use the Bitmap pixel size as primitive size
const Size aBitmapSize(aContent.GetSizePixel());
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index ecf3bb257ce0..7ed0045f778a 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -96,16 +96,16 @@ namespace
// with a step count of zero
if(maAnimation.Count())
{
- VirtualDevice aVirtualDevice(*Application::GetDefaultDevice());
- VirtualDevice aVirtualDeviceMask(*Application::GetDefaultDevice(), 1L);
+ ScopedVclPtrInstance< VirtualDevice > aVirtualDevice(*Application::GetDefaultDevice());
+ ScopedVclPtrInstance< VirtualDevice > aVirtualDeviceMask(*Application::GetDefaultDevice(), 1L);
// Prepare VirtualDevices and their states
- aVirtualDevice.EnableMapMode(false);
- aVirtualDeviceMask.EnableMapMode(false);
- aVirtualDevice.SetOutputSizePixel(maAnimation.GetDisplaySizePixel());
- aVirtualDeviceMask.SetOutputSizePixel(maAnimation.GetDisplaySizePixel());
- aVirtualDevice.Erase();
- aVirtualDeviceMask.Erase();
+ aVirtualDevice->EnableMapMode(false);
+ aVirtualDeviceMask->EnableMapMode(false);
+ aVirtualDevice->SetOutputSizePixel(maAnimation.GetDisplaySizePixel());
+ aVirtualDeviceMask->SetOutputSizePixel(maAnimation.GetDisplaySizePixel());
+ aVirtualDevice->Erase();
+ aVirtualDeviceMask->Erase();
for(sal_uInt16 a(0L); a < maAnimation.Count(); a++)
{
@@ -119,20 +119,20 @@ namespace
{
case DISPOSE_NOT:
{
- aVirtualDevice.DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx);
+ aVirtualDevice->DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx);
Bitmap aMask = rAnimBitmap.aBmpEx.GetMask();
if(aMask.IsEmpty())
{
const Point aEmpty;
- const Rectangle aRect(aEmpty, aVirtualDeviceMask.GetOutputSizePixel());
+ const Rectangle aRect(aEmpty, aVirtualDeviceMask->GetOutputSizePixel());
const Wallpaper aWallpaper(COL_BLACK);
- aVirtualDeviceMask.DrawWallpaper(aRect, aWallpaper);
+ aVirtualDeviceMask->DrawWallpaper(aRect, aWallpaper);
}
else
{
BitmapEx aExpandVisibilityMask = BitmapEx(aMask, aMask);
- aVirtualDeviceMask.DrawBitmapEx(rAnimBitmap.aPosPix, aExpandVisibilityMask);
+ aVirtualDeviceMask->DrawBitmapEx(rAnimBitmap.aPosPix, aExpandVisibilityMask);
}
break;
@@ -143,42 +143,42 @@ namespace
const Bitmap aMask(rAnimBitmap.aBmpEx.GetMask());
const Bitmap aContent(rAnimBitmap.aBmpEx.GetBitmap());
- aVirtualDeviceMask.Erase();
- aVirtualDevice.DrawBitmap(rAnimBitmap.aPosPix, aContent);
+ aVirtualDeviceMask->Erase();
+ aVirtualDevice->DrawBitmap(rAnimBitmap.aPosPix, aContent);
if(aMask.IsEmpty())
{
const Rectangle aRect(rAnimBitmap.aPosPix, aContent.GetSizePixel());
- aVirtualDeviceMask.SetFillColor(COL_BLACK);
- aVirtualDeviceMask.SetLineColor();
- aVirtualDeviceMask.DrawRect(aRect);
+ aVirtualDeviceMask->SetFillColor(COL_BLACK);
+ aVirtualDeviceMask->SetLineColor();
+ aVirtualDeviceMask->DrawRect(aRect);
}
else
{
- aVirtualDeviceMask.DrawBitmap(rAnimBitmap.aPosPix, aMask);
+ aVirtualDeviceMask->DrawBitmap(rAnimBitmap.aPosPix, aMask);
}
break;
}
case DISPOSE_FULL:
{
- aVirtualDevice.DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx);
+ aVirtualDevice->DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx);
break;
}
case DISPOSE_PREVIOUS :
{
- aVirtualDevice.DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx);
- aVirtualDeviceMask.DrawBitmap(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx.GetMask());
+ aVirtualDevice->DrawBitmapEx(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx);
+ aVirtualDeviceMask->DrawBitmap(rAnimBitmap.aPosPix, rAnimBitmap.aBmpEx.GetMask());
break;
}
}
// create BitmapEx
- Bitmap aMainBitmap = aVirtualDevice.GetBitmap(Point(), aVirtualDevice.GetOutputSizePixel());
+ Bitmap aMainBitmap = aVirtualDevice->GetBitmap(Point(), aVirtualDevice->GetOutputSizePixel());
#if defined(MACOSX) || defined(IOS)
- AlphaMask aMaskBitmap( aVirtualDeviceMask.GetBitmap( Point(), aVirtualDeviceMask.GetOutputSizePixel()));
+ AlphaMask aMaskBitmap( aVirtualDeviceMask->GetBitmap( Point(), aVirtualDeviceMask->GetOutputSizePixel()));
#else
- Bitmap aMaskBitmap = aVirtualDeviceMask.GetBitmap( Point(), aVirtualDeviceMask.GetOutputSizePixel());
+ Bitmap aMaskBitmap = aVirtualDeviceMask->GetBitmap( Point(), aVirtualDeviceMask->GetOutputSizePixel());
#endif
aNextStep.maBitmapEx = BitmapEx(aMainBitmap, aMaskBitmap);
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 93dfc867d3e5..a9dfdb6a75bc 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -59,7 +59,7 @@ namespace
class ImpTimedRefDev : public Timer
{
scoped_timed_RefDev& mrOwnerOfMe;
- VirtualDevice* mpVirDev;
+ VclPtr<VirtualDevice> mpVirDev;
sal_uInt32 mnUseCount;
public:
@@ -84,7 +84,7 @@ namespace
{
OSL_ENSURE(0L == mnUseCount, "destruction of a still used ImpTimedRefDev (!)");
const SolarMutexGuard aGuard;
- delete mpVirDev;
+ mpVirDev.disposeAndClear();
}
void ImpTimedRefDev::Invoke()
@@ -97,7 +97,7 @@ namespace
{
if(!mpVirDev)
{
- mpVirDev = new VirtualDevice();
+ mpVirDev = VclPtr<VirtualDevice>::Create();
mpVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
}
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index efa41c8565bc..93919c0019a2 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -32,7 +32,7 @@
namespace
{
- typedef ::std::vector< VirtualDevice* > aBuffers;
+ typedef ::std::vector< VclPtr<VirtualDevice> > aBuffers;
class VDevBuffer : public Timer, protected comphelper::OBaseMutex
{
@@ -69,13 +69,13 @@ namespace
while(!maFreeBuffers.empty())
{
- delete *(maFreeBuffers.end() - 1);
+ (*(maFreeBuffers.end() - 1)).disposeAndClear();
maFreeBuffers.pop_back();
}
while(!maUsedBuffers.empty())
{
- delete *(maUsedBuffers.end() - 1);
+ (*(maUsedBuffers.end() - 1)).disposeAndClear();
maUsedBuffers.pop_back();
}
}
@@ -163,7 +163,7 @@ namespace
// no success yet, create new buffer
if(!pRetval)
{
- pRetval = new VirtualDevice(rOutDev, nBits);
+ pRetval = VclPtr<VirtualDevice>::Create(rOutDev, nBits);
pRetval->SetOutputSizePixel(rSizePixel, bClear);
}
else
@@ -197,7 +197,7 @@ namespace
while(!maFreeBuffers.empty())
{
- delete *(maFreeBuffers.end() - 1);
+ (*(maFreeBuffers.end() - 1)).disposeAndClear();
maFreeBuffers.pop_back();
}
}
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
index 02aa3c0024ab..0ba73114dc4f 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
@@ -35,9 +35,9 @@ namespace drawinglayer
class impBufferDevice
{
OutputDevice& mrOutDev;
- VirtualDevice* mpContent;
- VirtualDevice* mpMask;
- VirtualDevice* mpAlpha;
+ VclPtr<VirtualDevice> mpContent;
+ VclPtr<VirtualDevice> mpMask;
+ VclPtr<VirtualDevice> mpAlpha;
Rectangle maDestPixel;
public:
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 2b2c0b86d220..4c8df82cf393 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -252,20 +252,20 @@ namespace drawinglayer
const Rectangle aPrimitiveRectangle(
basegfx::fround(aPrimitiveRange.getMinX()), basegfx::fround(aPrimitiveRange.getMinY()),
basegfx::fround(aPrimitiveRange.getMaxX()), basegfx::fround(aPrimitiveRange.getMaxY()));
- VirtualDevice aContentVDev;
+ ScopedVclPtrInstance< VirtualDevice > aContentVDev;
MapMode aNewMapMode(pLastOutputDevice->GetMapMode());
- mpOutputDevice = &aContentVDev;
+ mpOutputDevice = aContentVDev.get();
mpMetaFile = &o_rContentMetafile;
- aContentVDev.EnableOutput(false);
- aContentVDev.SetMapMode(pLastOutputDevice->GetMapMode());
- o_rContentMetafile.Record(&aContentVDev);
- aContentVDev.SetLineColor(pLastOutputDevice->GetLineColor());
- aContentVDev.SetFillColor(pLastOutputDevice->GetFillColor());
- aContentVDev.SetFont(pLastOutputDevice->GetFont());
- aContentVDev.SetDrawMode(pLastOutputDevice->GetDrawMode());
- aContentVDev.SetSettings(pLastOutputDevice->GetSettings());
- aContentVDev.SetRefPoint(pLastOutputDevice->GetRefPoint());
+ aContentVDev->EnableOutput(false);
+ aContentVDev->SetMapMode(pLastOutputDevice->GetMapMode());
+ o_rContentMetafile.Record(aContentVDev.get());
+ aContentVDev->SetLineColor(pLastOutputDevice->GetLineColor());
+ aContentVDev->SetFillColor(pLastOutputDevice->GetFillColor());
+ aContentVDev->SetFont(pLastOutputDevice->GetFont());
+ aContentVDev->SetDrawMode(pLastOutputDevice->GetDrawMode());
+ aContentVDev->SetSettings(pLastOutputDevice->GetSettings());
+ aContentVDev->SetRefPoint(pLastOutputDevice->GetRefPoint());
// dump to MetaFile
process(rContent);
@@ -2016,7 +2016,7 @@ namespace drawinglayer
const Rectangle aRectPixel(mpOutputDevice->LogicToPixel(aRectLogic));
Size aSizePixel(aRectPixel.GetSize());
const Point aEmptyPoint;
- VirtualDevice aBufferDevice;
+ ScopedVclPtrInstance< VirtualDevice > aBufferDevice;
const sal_uInt32 nMaxQuadratPixels(500000);
const sal_uInt32 nViewVisibleArea(aSizePixel.getWidth() * aSizePixel.getHeight());
double fReduceFactor(1.0);
@@ -2029,20 +2029,20 @@ namespace drawinglayer
basegfx::fround((double)aSizePixel.getHeight() * fReduceFactor));
}
- if(aBufferDevice.SetOutputSizePixel(aSizePixel))
+ if(aBufferDevice->SetOutputSizePixel(aSizePixel))
{
// create and set MapModes for target devices
MapMode aNewMapMode(mpOutputDevice->GetMapMode());
aNewMapMode.SetOrigin(Point(-aRectLogic.Left(), -aRectLogic.Top()));
- aBufferDevice.SetMapMode(aNewMapMode);
+ aBufferDevice->SetMapMode(aNewMapMode);
// prepare view transformation for target renderers
// ATTENTION! Need to apply another scaling because of the potential DPI differences
// between Printer and VDev (mpOutputDevice and aBufferDevice here).
// To get the DPI, LogicToPixel from (1,1) from MAP_INCH needs to be used.
- basegfx::B2DHomMatrix aViewTransform(aBufferDevice.GetViewTransformation());
+ basegfx::B2DHomMatrix aViewTransform(aBufferDevice->GetViewTransformation());
const Size aDPIOld(mpOutputDevice->LogicToPixel(Size(1, 1), MAP_INCH));
- const Size aDPINew(aBufferDevice.LogicToPixel(Size(1, 1), MAP_INCH));
+ const Size aDPINew(aBufferDevice->LogicToPixel(Size(1, 1), MAP_INCH));
const double fDPIXChange((double)aDPIOld.getWidth() / (double)aDPINew.getWidth());
const double fDPIYChange((double)aDPIOld.getHeight() / (double)aDPINew.getHeight());
@@ -2067,16 +2067,16 @@ namespace drawinglayer
getViewInformation2D().getViewTime(),
getViewInformation2D().getExtendedInformationSequence());
- VclPixelProcessor2D aBufferProcessor(aViewInfo, aBufferDevice);
+ VclPixelProcessor2D aBufferProcessor(aViewInfo, *aBufferDevice.get());
// draw content using pixel renderer
aBufferProcessor.process(rContent);
- const Bitmap aBmContent(aBufferDevice.GetBitmap(aEmptyPoint, aSizePixel));
+ const Bitmap aBmContent(aBufferDevice->GetBitmap(aEmptyPoint, aSizePixel));
// draw transparence using pixel renderer
- aBufferDevice.Erase();
+ aBufferDevice->Erase();
aBufferProcessor.process(rTransparence);
- const AlphaMask aBmAlpha(aBufferDevice.GetBitmap(aEmptyPoint, aSizePixel));
+ const AlphaMask aBmAlpha(aBufferDevice->GetBitmap(aEmptyPoint, aSizePixel));
// paint
mpOutputDevice->DrawBitmapEx(
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.hxx b/drawinglayer/source/processor2d/vclprocessor2d.hxx
index 70de6a19aca1..a527bb27c5e3 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.hxx
@@ -26,6 +26,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/color/bcolormodifier.hxx>
#include <svtools/optionsdrawinglayer.hxx>
+#include <vcl/vclptr.hxx>
// predefines
@@ -70,7 +71,7 @@ namespace drawinglayer
{
protected:
// the destination OutDev
- OutputDevice* mpOutputDevice;
+ VclPtr<OutputDevice> mpOutputDevice;
// the modifiedColorPrimitive stack
basegfx::BColorModifierStack maBColorModifierStack;
diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx
index 188bfa9f5327..2dd3d9d8d2ee 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -73,21 +73,21 @@ namespace drawinglayer
const Point aEmptyPoint;
const Size aSizePixel(nDiscreteWidth, nDiscreteHeight);
geometry::ViewInformation2D aViewInformation2D(rViewInformation2D);
- VirtualDevice maContent;
+ ScopedVclPtrInstance< VirtualDevice > maContent;
// prepare vdev
- maContent.SetOutputSizePixel(aSizePixel, false);
- maContent.SetMapMode(aMapModePixel);
+ maContent->SetOutputSizePixel(aSizePixel, false);
+ maContent->SetMapMode(aMapModePixel);
// set to all white
- maContent.SetBackground(Wallpaper(Color(COL_WHITE)));
- maContent.Erase();
+ maContent->SetBackground(Wallpaper(Color(COL_WHITE)));
+ maContent->Erase();
// create pixel processor, also already takes care of AAing and
// checking the getOptionsDrawinglayer().IsAntiAliasing() switch. If
// not wanted, change after this call as needed
processor2d::BaseProcessor2D* pContentProcessor = processor2d::createPixelProcessor2DFromOutputDevice(
- maContent,
+ *maContent.get(),
aViewInformation2D);
if(pContentProcessor)
@@ -96,8 +96,8 @@ namespace drawinglayer
pContentProcessor->process(aSequence);
// get content
- maContent.EnableMapMode(false);
- const Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel));
+ maContent->EnableMapMode(false);
+ const Bitmap aContent(maContent->GetBitmap(aEmptyPoint, aSizePixel));
#ifdef DBG_UTIL
if(bDoSaveForVisualControl)
@@ -108,10 +108,10 @@ namespace drawinglayer
}
#endif
// prepare for mask creation
- maContent.SetMapMode(aMapModePixel);
+ maContent->SetMapMode(aMapModePixel);
// set alpha to all white (fully transparent)
- maContent.Erase();
+ maContent->Erase();
// embed primitives to paint them black
const primitive2d::Primitive2DReference xRef(
@@ -127,8 +127,8 @@ namespace drawinglayer
delete pContentProcessor;
// get alpha cahannel from vdev
- maContent.EnableMapMode(false);
- const Bitmap aAlpha(maContent.GetBitmap(aEmptyPoint, aSizePixel));
+ maContent->EnableMapMode(false);
+ const Bitmap aAlpha(maContent->GetBitmap(aEmptyPoint, aSizePixel));
#ifdef DBG_UTIL
if(bDoSaveForVisualControl)
{
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index e1b0cd615b7a..e62e29de8353 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1755,14 +1755,14 @@ SvxFont EditEngine::GetStandardSvxFont( sal_Int32 nPara )
void EditEngine::StripPortions()
{
- VirtualDevice aTmpDev;
+ ScopedVclPtrInstance< VirtualDevice > aTmpDev;
Rectangle aBigRect( Point( 0, 0 ), Size( 0x7FFFFFFF, 0x7FFFFFFF ) );
if ( IsVertical() )
{
aBigRect.Right() = 0;
aBigRect.Left() = -0x7FFFFFFF;
}
- pImpEditEngine->Paint( &aTmpDev, aBigRect, Point(), true );
+ pImpEditEngine->Paint( aTmpDev.get(), aBigRect, Point(), true );
}
void EditEngine::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList )
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 6805c60de4ff..2061716107bd 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1593,7 +1593,7 @@ void ImpEditView::ShowDDCursor( const Rectangle& rRect )
#endif
if ( !pDragAndDropInfo->pBackground )
{
- pDragAndDropInfo->pBackground = new VirtualDevice( *GetWindow() );
+ pDragAndDropInfo->pBackground = VclPtr<VirtualDevice>::Create( *GetWindow() );
MapMode aMapMode( GetWindow()->GetMapMode() );
aMapMode.SetOrigin( Point( 0, 0 ) );
pDragAndDropInfo->pBackground->SetMapMode( aMapMode );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 23ac30e6538d..fccd6d8e99af 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -32,6 +32,7 @@
#include <vcl/virdev.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/cursor.hxx>
+#include <vcl/vclptr.hxx>
#include <tools/fract.hxx>
#include <vcl/idle.hxx>
@@ -114,7 +115,7 @@ struct DragAndDropInfo
EditPaM aDropDest;
sal_Int32 nOutlinerDropDest;
ESelection aDropSel;
- VirtualDevice* pBackground;
+ VclPtr<VirtualDevice> pBackground;
const SvxFieldItem* pField;
bool bVisCursor : 1;
bool bDroppedInMe : 1;
@@ -223,7 +224,7 @@ private:
LibreOfficeKitCallback mpLibreOfficeKitCallback;
void* mpLibreOfficeKitData;
EditEngine* pEditEngine;
- vcl::Window* pOutWin;
+ VclPtr<vcl::Window> pOutWin;
Pointer* pPointer;
DragAndDropInfo* pDragAndDropInfo;
@@ -421,8 +422,8 @@ private:
SfxStyleSheetPool* pStylePool;
SfxItemPool* pTextObjectPool;
- VirtualDevice* pVirtDev;
- OutputDevice* pRefDev;
+ VclPtr< VirtualDevice> pVirtDev;
+ VclPtr< OutputDevice > pRefDev;
svtools::ColorConfig* pColorConfig;
mutable SvtCTLOptions* pCTLOptions;
@@ -663,7 +664,7 @@ private:
bool IsForceAutoColor() const { return bForceAutoColor; }
inline VirtualDevice* GetVirtualDevice( const MapMode& rMapMode, sal_uLong nDrawMode );
- inline void EraseVirtualDevice();
+ inline void EraseVirtualDevice() { pVirtDev.disposeAndClear(); }
DECL_LINK(StatusTimerHdl, void *);
DECL_LINK(IdleFormatHdl, void *);
@@ -874,7 +875,7 @@ public:
void UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle );
void RemoveStyleFromParagraphs( SfxStyleSheet* pStyle );
- OutputDevice* GetRefDevice() const { return pRefDev; }
+ OutputDevice* GetRefDevice() const { return pRefDev.get(); }
void SetRefDevice( OutputDevice* pRefDef );
const MapMode& GetRefMapMode() { return pRefDev->GetMapMode(); }
@@ -1084,12 +1085,6 @@ inline VirtualDevice* ImpEditEngine::GetVirtualDevice( const MapMode& rMapMode,
return pVirtDev;
}
-inline void ImpEditEngine::EraseVirtualDevice()
-{
- delete pVirtDev;
- pVirtDev = 0;
-}
-
inline void ImpEditEngine::IdleFormatAndUpdate( EditView* pCurView )
{
aIdleFormatter.DoIdleFormat( pCurView );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 732264986921..975da67f5500 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -172,7 +172,7 @@ ImpEditEngine::~ImpEditEngine()
bDowning = true;
SetUpdateMode( false );
- delete pVirtDev;
+ pVirtDev.disposeAndClear();
delete pEmptyItemSet;
delete pUndoManager;
delete pTextRanger;
@@ -180,14 +180,14 @@ ImpEditEngine::~ImpEditEngine()
delete pColorConfig;
delete pCTLOptions;
if ( bOwnerOfRefDev )
- delete pRefDev;
+ pRefDev.disposeAndClear();
delete pSpellInfo;
}
void ImpEditEngine::SetRefDevice( OutputDevice* pRef )
{
if ( bOwnerOfRefDev )
- delete pRefDev;
+ pRefDev.disposeAndClear();
if ( !pRef )
{
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 427f333bb285..915cced1e8c8 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2811,7 +2811,7 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics
if ( ( nIntLeading == 0 ) && ( pRefDev->GetOutDevType() == OUTDEV_PRINTER ) )
{
// Lets see what Leading one gets on the screen
- VirtualDevice* pVDev = GetVirtualDevice( pRefDev->GetMapMode(), pRefDev->GetDrawMode() );
+ VclPtr<VirtualDevice> pVDev = GetVirtualDevice( pRefDev->GetMapMode(), pRefDev->GetDrawMode() );
rFont.SetPhysFont( pVDev );
aMetric = pVDev->GetFontMetric();
diff --git a/editeng/source/editeng/textconv.hxx b/editeng/source/editeng/textconv.hxx
index 012811c457c8..50cbbcf0bc07 100644
--- a/editeng/source/editeng/textconv.hxx
+++ b/editeng/source/editeng/textconv.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.hxx>
#include <editeng/hangulhanja.hxx>
+#include <vcl/vclptr.hxx>
class EditView;
@@ -39,7 +40,7 @@ class TextConvWrapper : public editeng::HangulHanjaConversion
// starts from the cursor position
EditView * m_pEditView;
- vcl::Window * m_pWin;
+ VclPtr<vcl::Window> m_pWin;
bool m_bStartChk;
bool m_bStartDone;
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index e93edd42e372..da7e9183e4ad 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -163,7 +163,7 @@ OUString SvxFont::CalcCaseMap(const OUString &rTxt) const
class SvxDoCapitals
{
protected:
- OutputDevice *pOut;
+ VclPtr<OutputDevice> pOut;
const OUString &rTxt;
const sal_Int32 nIdx;
const sal_Int32 nLen;
diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx
index ea6c1f0eee61..72d695da51f6 100644
--- a/editeng/source/misc/hangulhanja.cxx
+++ b/editeng/source/misc/hangulhanja.cxx
@@ -69,7 +69,7 @@ namespace editeng
// general
AbstractHangulHanjaConversionDialog*
m_pConversionDialog; // the dialog to display for user interaction
- vcl::Window* m_pUIParent; // the parent window for any UI we raise
+ VclPtr<vcl::Window> m_pUIParent; // the parent window for any UI we raise
Reference< XComponentContext >
m_xContext; // the service factory to use
Reference< XExtendedTextConversion >
diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx
index 69d2fc2d555a..c5a81952fe38 100644
--- a/editeng/source/misc/splwrap.cxx
+++ b/editeng/source/misc/splwrap.cxx
@@ -39,9 +39,9 @@
#include <editeng/editerr.hxx>
#include <boost/scoped_ptr.hpp>
-#define WAIT_ON() if(pWin != NULL) { pWin->EnterWait(); }
+#define WAIT_ON() if(pWin != nullptr) { pWin->EnterWait(); }
-#define WAIT_OFF() if(pWin != NULL) { pWin->LeaveWait(); }
+#define WAIT_OFF() if(pWin != nullptr) { pWin->LeaveWait(); }
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -411,8 +411,8 @@ bool SvxSpellWrapper::SpellNext( )
WAIT_OFF();
sal_uInt16 nResId = bReverse ? RID_SVXSTR_QUERY_BW_CONTINUE : RID_SVXSTR_QUERY_CONTINUE;
- MessageDialog aBox(pWin, EditResId(nResId), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( aBox.Execute() != RET_YES )
+ ScopedVclPtrInstance< MessageDialog > aBox(pWin, EditResId(nResId), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if ( aBox->Execute() != RET_YES )
{
// sacrifice the other area if necessary ask for special area
WAIT_ON();
diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx
index 1cf24b87a2ac..bb9e12a31d8d 100644
--- a/extensions/source/abpilot/abpfinalpage.cxx
+++ b/extensions/source/abpilot/abpfinalpage.cxx
@@ -64,7 +64,19 @@ namespace abp
FinalPage::~FinalPage()
{
+ disposeOnce();
+ }
+
+ void FinalPage::dispose()
+ {
delete m_pLocationController;
+ m_pLocation.clear();
+ m_pBrowse.clear();
+ m_pRegisterName.clear();
+ m_pNameLabel.clear();
+ m_pName.clear();
+ m_pDuplicateNameError.clear();
+ AddressBookSourcePage::dispose();
}
bool FinalPage::isValidName() const
diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx
index 821f39f62525..eedeac43b25d 100644
--- a/extensions/source/abpilot/abpfinalpage.hxx
+++ b/extensions/source/abpilot/abpfinalpage.hxx
@@ -26,6 +26,7 @@
#include <svtools/urlcontrol.hxx>
#include <svx/databaselocationinput.hxx>
#include <vcl/edit.hxx>
+#include <vcl/vclptr.hxx>
namespace abp
@@ -38,12 +39,12 @@ namespace abp
class FinalPage : public AddressBookSourcePage
{
protected:
- ::svt::OFileURLControl* m_pLocation;
- PushButton* m_pBrowse;
- CheckBox* m_pRegisterName;
- FixedText* m_pNameLabel;
- Edit* m_pName;
- FixedText* m_pDuplicateNameError;
+ VclPtr<::svt::OFileURLControl> m_pLocation;
+ VclPtr<PushButton> m_pBrowse;
+ VclPtr<CheckBox> m_pRegisterName;
+ VclPtr<FixedText> m_pNameLabel;
+ VclPtr<Edit> m_pName;
+ VclPtr<FixedText> m_pDuplicateNameError;
::svx::DatabaseLocationInputController*
m_pLocationController;
@@ -53,6 +54,7 @@ namespace abp
public:
FinalPage( OAddessBookSourcePilot* _pParent );
virtual ~FinalPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// OWizardPage overridables
diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx
index 45abc6bf7036..f06fa97156f9 100644
--- a/extensions/source/abpilot/abspilot.cxx
+++ b/extensions/source/abpilot/abspilot.cxx
@@ -130,11 +130,6 @@ namespace abp
SetHelpId(HID_ABSPILOT);
}
- OAddessBookSourcePilot::~OAddessBookSourcePilot()
- {
- }
-
-
OUString OAddessBookSourcePilot::getStateDisplayName( WizardState _nState ) const
{
sal_uInt16 nResId = 0;
@@ -413,24 +408,24 @@ namespace abp
}
- OWizardPage* OAddessBookSourcePilot::createPage(WizardState _nState)
+ VclPtr<TabPage> OAddessBookSourcePilot::createPage(WizardState _nState)
{
switch (_nState)
{
case STATE_SELECT_ABTYPE:
- return new TypeSelectionPage( this );
+ return VclPtr<TypeSelectionPage>::Create( this );
case STATE_INVOKE_ADMIN_DIALOG:
- return new AdminDialogInvokationPage( this );
+ return VclPtr<AdminDialogInvokationPage>::Create( this );
case STATE_TABLE_SELECTION:
- return new TableSelectionPage( this );
+ return VclPtr<TableSelectionPage>::Create( this );
case STATE_MANUAL_FIELD_MAPPING:
- return new FieldMappingPage( this );
+ return VclPtr<FieldMappingPage>::Create( this );
case STATE_FINAL_CONFIRM:
- return new FinalPage( this );
+ return VclPtr<FinalPage>::Create( this );
default:
OSL_FAIL("OAddessBookSourcePilot::createPage: invalid state!");
diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx
index de7a5895b627..5b24ff244e45 100644
--- a/extensions/source/abpilot/abspilot.hxx
+++ b/extensions/source/abpilot/abspilot.hxx
@@ -49,8 +49,6 @@ namespace abp
OAddessBookSourcePilot(
vcl::Window* _pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB);
- /// dtor
- virtual ~OAddessBookSourcePilot();
/// get the service factory which was used to create the dialog
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
@@ -69,7 +67,7 @@ namespace abp
protected:
// OWizardMachine overridables
- virtual ::svt::OWizardPage* createPage( WizardState _nState ) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage( WizardState _nState ) SAL_OVERRIDE;
virtual void enterState( WizardState _nState ) SAL_OVERRIDE;
virtual bool prepareLeaveCurrentState( CommitPageReason _eReason ) SAL_OVERRIDE;
virtual bool onFinish() SAL_OVERRIDE;
diff --git a/extensions/source/abpilot/admininvokationimpl.hxx b/extensions/source/abpilot/admininvokationimpl.hxx
index 486223ca30c0..9dc5d3b0cb8a 100644
--- a/extensions/source/abpilot/admininvokationimpl.hxx
+++ b/extensions/source/abpilot/admininvokationimpl.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
@@ -36,7 +37,7 @@ namespace abp
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDataSource;
- vcl::Window* m_pMessageParent;
+ VclPtr<vcl::Window> m_pMessageParent;
public:
OAdminDialogInvokation(
diff --git a/extensions/source/abpilot/admininvokationpage.cxx b/extensions/source/abpilot/admininvokationpage.cxx
index a92e90d7eb1e..57bb822c076f 100644
--- a/extensions/source/abpilot/admininvokationpage.cxx
+++ b/extensions/source/abpilot/admininvokationpage.cxx
@@ -34,7 +34,16 @@ namespace abp
get(m_pErrorMessage, "warning");
m_pInvokeAdminDialog->SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) );
}
-
+ AdminDialogInvokationPage::~AdminDialogInvokationPage()
+ {
+ disposeOnce();
+ }
+ void AdminDialogInvokationPage::dispose()
+ {
+ m_pInvokeAdminDialog.clear();
+ m_pErrorMessage.clear();
+ AddressBookSourcePage::dispose();
+ }
void AdminDialogInvokationPage::ActivatePage()
{
AddressBookSourcePage::ActivatePage();
diff --git a/extensions/source/abpilot/admininvokationpage.hxx b/extensions/source/abpilot/admininvokationpage.hxx
index 4b264274f290..7e2e7efce8c2 100644
--- a/extensions/source/abpilot/admininvokationpage.hxx
+++ b/extensions/source/abpilot/admininvokationpage.hxx
@@ -29,14 +29,15 @@ namespace abp
class AdminDialogInvokationPage : public AddressBookSourcePage
{
protected:
- PushButton* m_pInvokeAdminDialog;
- FixedText* m_pErrorMessage;
+ VclPtr<PushButton> m_pInvokeAdminDialog;
+ VclPtr<FixedText> m_pErrorMessage;
bool m_bSuccessfullyExecutedDialog;
public:
AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent );
-
+ virtual ~AdminDialogInvokationPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// TabDialog overridables
virtual void ActivatePage() SAL_OVERRIDE;
diff --git a/extensions/source/abpilot/fieldmappingpage.cxx b/extensions/source/abpilot/fieldmappingpage.cxx
index c30bf82265c6..9ad8a3b0f11d 100644
--- a/extensions/source/abpilot/fieldmappingpage.cxx
+++ b/extensions/source/abpilot/fieldmappingpage.cxx
@@ -37,6 +37,18 @@ namespace abp
m_pInvokeDialog->SetClickHdl( LINK( this, FieldMappingPage, OnInvokeDialog ) );
}
+ FieldMappingPage::~FieldMappingPage()
+ {
+ disposeOnce();
+ }
+
+ void FieldMappingPage::dispose()
+ {
+ m_pInvokeDialog.clear();
+ m_pHint.clear();
+ AddressBookSourcePage::dispose();
+ }
+
void FieldMappingPage::ActivatePage()
{
AddressBookSourcePage::ActivatePage();
diff --git a/extensions/source/abpilot/fieldmappingpage.hxx b/extensions/source/abpilot/fieldmappingpage.hxx
index 35ce8a2fcc3b..6adaf511800a 100644
--- a/extensions/source/abpilot/fieldmappingpage.hxx
+++ b/extensions/source/abpilot/fieldmappingpage.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_EXTENSIONS_SOURCE_ABPILOT_FIELDMAPPINGPAGE_HXX
#include "abspage.hxx"
+#include <vcl/vclptr.hxx>
namespace abp
@@ -33,12 +34,13 @@ namespace abp
class FieldMappingPage : public AddressBookSourcePage
{
protected:
- PushButton* m_pInvokeDialog;
- FixedText* m_pHint;
+ VclPtr<PushButton> m_pInvokeDialog;
+ VclPtr<FixedText> m_pHint;
public:
FieldMappingPage( OAddessBookSourcePilot* _pParent );
-
+ virtual ~FieldMappingPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// OWizardPage overridables
virtual void initializePage() SAL_OVERRIDE;
diff --git a/extensions/source/abpilot/tableselectionpage.cxx b/extensions/source/abpilot/tableselectionpage.cxx
index 61ac27d8f1ce..537ef7b2b73e 100644
--- a/extensions/source/abpilot/tableselectionpage.cxx
+++ b/extensions/source/abpilot/tableselectionpage.cxx
@@ -41,6 +41,16 @@ namespace abp
m_pTableList->SetDoubleClickHdl( LINK( this, TableSelectionPage, OnTableDoubleClicked ) );
}
+ TableSelectionPage::~TableSelectionPage()
+ {
+ disposeOnce();
+ }
+
+ void TableSelectionPage::dispose()
+ {
+ m_pTableList.clear();
+ AddressBookSourcePage::dispose();
+ }
void TableSelectionPage::ActivatePage()
{
diff --git a/extensions/source/abpilot/tableselectionpage.hxx b/extensions/source/abpilot/tableselectionpage.hxx
index c9fcd755920d..7abcf547af45 100644
--- a/extensions/source/abpilot/tableselectionpage.hxx
+++ b/extensions/source/abpilot/tableselectionpage.hxx
@@ -22,6 +22,7 @@
#include "abspage.hxx"
#include <vcl/lstbox.hxx>
+#include <vcl/vclptr.hxx>
namespace abp
@@ -34,11 +35,12 @@ namespace abp
class TableSelectionPage : public AddressBookSourcePage
{
protected:
- ListBox* m_pTableList;
+ VclPtr<ListBox> m_pTableList;
public:
TableSelectionPage( OAddessBookSourcePilot* _pParent );
-
+ virtual ~TableSelectionPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// OWizardPage overridables
virtual void initializePage() SAL_OVERRIDE;
diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx
index 79361869e8b7..f732eff901b4 100644
--- a/extensions/source/abpilot/typeselectionpage.cxx
+++ b/extensions/source/abpilot/typeselectionpage.cxx
@@ -151,11 +151,28 @@ namespace abp
TypeSelectionPage::~TypeSelectionPage()
{
+ disposeOnce();
+ }
+
+ void TypeSelectionPage::dispose()
+ {
for ( ::std::vector< ButtonItem >::iterator loop = m_aAllTypes.begin();
loop != m_aAllTypes.end(); ++loop )
{
loop->m_bVisible = false;
}
+ m_pEvolution.clear();
+ m_pEvolutionGroupwise.clear();
+ m_pEvolutionLdap.clear();
+ m_pMORK.clear();
+ m_pThunderbird.clear();
+ m_pKab.clear();
+ m_pMacab.clear();
+ m_pLDAP.clear();
+ m_pOutlook.clear();
+ m_pOE.clear();
+ m_pOther.clear();
+ AddressBookSourcePage::dispose();
}
@@ -226,8 +243,8 @@ namespace abp
if (AST_INVALID == getSelectedType( ))
{
- MessageDialog aError(this, ModuleRes(RID_STR_NEEDTYPESELECTION));
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(this, ModuleRes(RID_STR_NEEDTYPESELECTION));
+ aError->Execute();
return false;
}
diff --git a/extensions/source/abpilot/typeselectionpage.hxx b/extensions/source/abpilot/typeselectionpage.hxx
index 2e4437e285f8..b7c628f884c1 100644
--- a/extensions/source/abpilot/typeselectionpage.hxx
+++ b/extensions/source/abpilot/typeselectionpage.hxx
@@ -23,6 +23,7 @@
#include "abspage.hxx"
#include "addresssettings.hxx"
#include <vcl/edit.hxx>
+#include <vcl/vclptr.hxx>
namespace abp
@@ -35,20 +36,20 @@ namespace abp
class TypeSelectionPage : public AddressBookSourcePage
{
protected:
- RadioButton* m_pEvolution;
- RadioButton* m_pEvolutionGroupwise;
- RadioButton* m_pEvolutionLdap;
- RadioButton* m_pMORK;
- RadioButton* m_pThunderbird;
- RadioButton* m_pKab;
- RadioButton* m_pMacab;
- RadioButton* m_pLDAP;
- RadioButton* m_pOutlook;
- RadioButton* m_pOE;
- RadioButton* m_pOther;
+ VclPtr<RadioButton> m_pEvolution;
+ VclPtr<RadioButton> m_pEvolutionGroupwise;
+ VclPtr<RadioButton> m_pEvolutionLdap;
+ VclPtr<RadioButton> m_pMORK;
+ VclPtr<RadioButton> m_pThunderbird;
+ VclPtr<RadioButton> m_pKab;
+ VclPtr<RadioButton> m_pMacab;
+ VclPtr<RadioButton> m_pLDAP;
+ VclPtr<RadioButton> m_pOutlook;
+ VclPtr<RadioButton> m_pOE;
+ VclPtr<RadioButton> m_pOther;
struct ButtonItem {
- RadioButton *m_pItem;
+ VclPtr<RadioButton> m_pItem;
AddressSourceType m_eType;
bool m_bVisible;
@@ -66,6 +67,7 @@ namespace abp
public:
TypeSelectionPage( OAddessBookSourcePilot* _pParent );
virtual ~TypeSelectionPage();
+ virtual void dispose() SAL_OVERRIDE;
// retrieves the currently selected type
AddressSourceType getSelectedType() const;
diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx
index f8afef08c385..fdf27d8a7609 100644
--- a/extensions/source/abpilot/unodialogabp.cxx
+++ b/extensions/source/abpilot/unodialogabp.cxx
@@ -152,9 +152,9 @@ namespace abp
}
- Dialog* OABSPilotUno::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> OABSPilotUno::createDialog(vcl::Window* _pParent)
{
- return new OAddessBookSourcePilot(_pParent, m_aContext );
+ return VclPtr<OAddessBookSourcePilot>::Create(_pParent, m_aContext );
}
@@ -179,7 +179,7 @@ namespace abp
{
if ( _nExecutionResult == RET_OK )
{
- const AddressSettings& aSettings = static_cast<OAddessBookSourcePilot*>(m_pDialog)->getSettings();
+ const AddressSettings& aSettings = static_cast<OAddessBookSourcePilot*>(m_pDialog.get())->getSettings();
m_sDataSourceName = aSettings.bRegisterDataSource ? aSettings.sRegisteredDataSourceName : aSettings.sDataSourceName;
}
}
diff --git a/extensions/source/abpilot/unodialogabp.hxx b/extensions/source/abpilot/unodialogabp.hxx
index b444095823a5..efd84acdfb11 100644
--- a/extensions/source/abpilot/unodialogabp.hxx
+++ b/extensions/source/abpilot/unodialogabp.hxx
@@ -84,7 +84,7 @@ namespace abp
using OABSPilotUno_DBase::execute;
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void executedDialog(sal_Int16 _nExecutionResult) SAL_OVERRIDE;
};
diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx
index 72120f8d36ce..9e6235055801 100644
--- a/extensions/source/bibliography/bibbeam.cxx
+++ b/extensions/source/bibliography/bibbeam.cxx
@@ -29,6 +29,7 @@
#include <vcl/edit.hxx>
#include <tools/debug.hxx>
#include "bibbeam.hxx"
+#include "bibview.hxx"
#include "toolbar.hrc"
#include "bibresid.hxx"
#include "datman.hxx"
@@ -87,6 +88,7 @@ namespace bib
BibGridwin(vcl::Window* pParent, WinBits nStyle = WB_3DLOOK );
virtual ~BibGridwin();
+ virtual void dispose() SAL_OVERRIDE;
void createGridWin(const Reference< awt::XControlModel > & xDbForm);
void disposeGridWin();
@@ -107,9 +109,15 @@ namespace bib
BibGridwin::~BibGridwin()
{
+ disposeOnce();
+ }
+
+ void BibGridwin::dispose()
+ {
RemoveFromTaskPaneList( this );
disposeGridWin();
+ vcl::Window::dispose();
}
void BibGridwin::Resize()
@@ -195,6 +203,11 @@ namespace bib
BibBeamer::~BibBeamer()
{
+ disposeOnce();
+ }
+
+ void BibBeamer::dispose()
+ {
if ( isFormConnected() )
disconnectForm();
@@ -202,25 +215,16 @@ namespace bib
m_xToolBarRef->dispose();
if ( pToolBar )
- {
pDatMan->SetToolbar(0);
- DELETEZ( pToolBar );
- }
-
- if( pGridWin )
- {
- BibGridwin* pDel = pGridWin;
- pGridWin = NULL;
- pDel->disposeGridWin();
- delete pDel;
- }
-
+ pToolBar.disposeAndClear();
+ pGridWin.disposeAndClear();
+ BibSplitWindow::dispose();
}
void BibBeamer::createToolBar()
{
- pToolBar= new BibToolBar(this, LINK( this, BibBeamer, RecalcLayout_Impl ));
+ pToolBar= VclPtr<BibToolBar>::Create(this, LINK( this, BibBeamer, RecalcLayout_Impl ));
::Size aSize=pToolBar->GetSizePixel();
InsertItem(ID_TOOLBAR, pToolBar, aSize.Height(), 0, 0, SWIB_FIXED );
if ( m_xController.is() )
@@ -229,7 +233,7 @@ namespace bib
void BibBeamer::createGridWin()
{
- pGridWin = new BibGridwin(this,0);
+ pGridWin = VclPtr<BibGridwin>::Create(this,0);
InsertItem(ID_GRIDWIN, pGridWin, 40, 1, 0, SWIB_RELATIVESIZE );
diff --git a/extensions/source/bibliography/bibbeam.hxx b/extensions/source/bibliography/bibbeam.hxx
index bfecf435ecb5..aea7d49db079 100644
--- a/extensions/source/bibliography/bibbeam.hxx
+++ b/extensions/source/bibliography/bibbeam.hxx
@@ -52,8 +52,8 @@ namespace bib
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xGridWin;
BibDataManager* pDatMan;
- BibToolBar* pToolBar;
- BibGridwin* pGridWin;
+ VclPtr<BibToolBar> pToolBar;
+ VclPtr<BibGridwin> pGridWin;
DECL_LINK( RecalcLayout_Impl, void* );
@@ -72,6 +72,7 @@ namespace bib
BibBeamer(vcl::Window* pParent,BibDataManager* pDatMan, WinBits nStyle = WB_3DLOOK );
virtual ~BibBeamer();
+ virtual void dispose() SAL_OVERRIDE;
void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx
index 954700c24277..5eba4bac1bbc 100644
--- a/extensions/source/bibliography/bibcont.cxx
+++ b/extensions/source/bibliography/bibcont.cxx
@@ -31,6 +31,7 @@
#include "datman.hxx"
#include "bibcont.hxx"
+#include "bibview.hxx"
BibShortCutHandler::~BibShortCutHandler()
@@ -56,20 +57,11 @@ BibSplitWindow::BibSplitWindow( vcl::Window* pParent, WinBits nStyle ) : SplitWi
{
}
-BibSplitWindow::~BibSplitWindow()
-{
-}
-
BibTabPage::BibTabPage( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription ) :
TabPage( pParent, rID, rUIXMLDescription ), BibShortCutHandler( this )
{
}
-BibTabPage::~BibTabPage()
-{
-}
-
-
using namespace osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -94,12 +86,18 @@ BibWindowContainer::BibWindowContainer( vcl::Window* pParent, BibShortCutHandler
BibWindowContainer::~BibWindowContainer()
{
+ disposeOnce();
+}
+
+void BibWindowContainer::dispose()
+{
if( pChild )
{
- vcl::Window* pDel = GetChild();
+ VclPtr<vcl::Window> pDel = GetChild();
pChild = NULL; // prevents GetFocus for child while deleting!
- delete pDel;
+ pDel.disposeAndClear();
}
+ vcl::Window::dispose();
}
void BibWindowContainer::Resize()
@@ -132,6 +130,11 @@ BibBookContainer::BibBookContainer(vcl::Window* pParent, WinBits nStyle):
BibBookContainer::~BibBookContainer()
{
+ disposeOnce();
+}
+
+void BibBookContainer::dispose()
+{
if( xTopFrameRef.is() )
xTopFrameRef->dispose();
if( xBottomFrameRef.is() )
@@ -139,19 +142,22 @@ BibBookContainer::~BibBookContainer()
if( pTopWin )
{
- vcl::Window* pDel = pTopWin;
+ VclPtr<vcl::Window> pDel = pTopWin;
pTopWin = NULL; // prevents GetFocus for child while deleting!
- delete pDel;
+ pDel.disposeAndClear();
}
if( pBottomWin )
{
- vcl::Window* pDel = pBottomWin;
+ VclPtr<vcl::Window> pDel = pBottomWin;
pBottomWin = NULL; // prevents GetFocus for child while deleting!
- delete pDel;
+ pDel.disposeAndClear();
}
CloseBibModul( pBibMod );
+ pTopWin.clear();
+ pBottomWin.clear();
+ BibSplitWindow::dispose();
}
void BibBookContainer::Split()
@@ -175,9 +181,9 @@ void BibBookContainer::createTopFrame( BibShortCutHandler* pWin )
if(pTopWin)
{
RemoveItem(TOP_WINDOW);
- delete pTopWin;
+ pTopWin.disposeAndClear();
}
- pTopWin=new BibWindowContainer(this,pWin);
+ pTopWin=VclPtr<BibWindowContainer>::Create(this,pWin);
pTopWin->Show();
BibConfig* pConfig = BibModul::GetConfig();
long nSize = pConfig->getBeamerSize();
@@ -192,10 +198,10 @@ void BibBookContainer::createBottomFrame( BibShortCutHandler* pWin )
if(pBottomWin)
{
RemoveItem(BOTTOM_WINDOW);
- delete pBottomWin;
+ pBottomWin.disposeAndClear();
}
- pBottomWin=new BibWindowContainer(this,pWin);
+ pBottomWin=VclPtr<BibWindowContainer>::Create(this,pWin);
BibConfig* pConfig = BibModul::GetConfig();
long nSize = pConfig->getViewSize();
diff --git a/extensions/source/bibliography/bibcont.hxx b/extensions/source/bibliography/bibcont.hxx
index af6a78839900..3488c2ee27ee 100644
--- a/extensions/source/bibliography/bibcont.hxx
+++ b/extensions/source/bibliography/bibcont.hxx
@@ -43,8 +43,9 @@ class BibWindowContainer : public BibWindow //Window
public:
BibWindowContainer( vcl::Window* pParent, BibShortCutHandler* pChild, WinBits nStyle = WB_3DLOOK);
virtual ~BibWindowContainer();
+ virtual void dispose() SAL_OVERRIDE;
- inline vcl::Window* GetChild();
+ inline vcl::Window* GetChild();
virtual void GetFocus() SAL_OVERRIDE;
@@ -55,7 +56,7 @@ class BibWindowContainer : public BibWindow //Window
inline vcl::Window* BibWindowContainer::GetChild()
{
- return pChild? pChild->GetWindow() : NULL;
+ return pChild ? pChild->GetWindow() : NULL;
}
@@ -69,8 +70,8 @@ class BibBookContainer: public BibSplitWindow
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xTopPeerRef;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xBottomPeerRef;
- BibWindowContainer* pTopWin;
- BibWindowContainer* pBottomWin;
+ VclPtr<BibWindowContainer> pTopWin;
+ VclPtr<BibWindowContainer> pBottomWin;
HdlBibModul pBibMod;
Idle aIdle;
@@ -86,6 +87,7 @@ class BibBookContainer: public BibSplitWindow
BibBookContainer(vcl::Window* pParent, WinBits nStyle = WB_3DLOOK );
virtual ~BibBookContainer();
+ virtual void dispose() SAL_OVERRIDE;
inline BibWindow* GetTopWin() {return pTopWin;}
inline BibWindow* GetBottomWin() {return pBottomWin;}
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index 97ad1f1fa9e8..afa6cb083076 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -273,7 +273,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
vcl::Window* pParent = VCLUnoHelper::GetWindow( aWindow );
- BibBookContainer *pMyWindow = new BibBookContainer( pParent );
+ VclPtrInstance<BibBookContainer> pMyWindow( pParent );
pMyWindow->Show();
::bib::BibView* pView = new ::bib::BibView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK );
diff --git a/extensions/source/bibliography/bibmod.cxx b/extensions/source/bibliography/bibmod.cxx
index 4336c1a54461..cda8769d0204 100644
--- a/extensions/source/bibliography/bibmod.cxx
+++ b/extensions/source/bibliography/bibmod.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/lang/XLocalizable.hpp>
#include "bibmod.hxx"
+#include "bibview.hxx"
#include "bibresid.hxx"
#include "datman.hxx"
#include "bibconfig.hxx"
diff --git a/extensions/source/bibliography/bibshortcuthandler.hxx b/extensions/source/bibliography/bibshortcuthandler.hxx
index 45bf279df404..d6310f549629 100644
--- a/extensions/source/bibliography/bibshortcuthandler.hxx
+++ b/extensions/source/bibliography/bibshortcuthandler.hxx
@@ -31,7 +31,7 @@
class BibShortCutHandler
{
private:
- vcl::Window* pBaseClass; // in cases, where BibShortCutHandler also has to be a window
+ VclPtr<vcl::Window> pBaseClass; // in cases, where BibShortCutHandler also has to be a window
protected:
inline BibShortCutHandler( vcl::Window* pBaseClass );
@@ -63,14 +63,12 @@ class BibSplitWindow : public SplitWindow, public BibShortCutHandler
{
public:
BibSplitWindow( vcl::Window* pParent,WinBits nStyle = WB_3DLOOK);
- virtual ~BibSplitWindow();
};
class BibTabPage : public TabPage, public BibShortCutHandler
{
public:
BibTabPage( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription );
- virtual ~BibTabPage();
};
#endif
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
index 2d715d040d5a..dd13a1e2453d 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -52,16 +52,22 @@ namespace bib
,m_pDatMan( _pManager )
,m_xDatMan( _pManager )
,m_pGeneralPage( NULL )
+ ,m_aFormControlContainer(this)
{
if ( m_xDatMan.is() )
- connectForm( m_xDatMan );
+ m_aFormControlContainer.connectForm( m_xDatMan );
}
BibView::~BibView()
{
+ disposeOnce();
+ }
+
+ void BibView::dispose()
+ {
BibGeneralPage* pGeneralPage = m_pGeneralPage;
- m_pGeneralPage = NULL;
+ m_pGeneralPage.clear();
pGeneralPage->CommitActiveControl();
Reference< XForm > xForm = m_pDatMan->getForm();
@@ -92,11 +98,12 @@ namespace bib
}
}
- if ( isFormConnected() )
- disconnectForm();
+ if ( m_aFormControlContainer.isFormConnected() )
+ m_aFormControlContainer.disconnectForm();
pGeneralPage->RemoveListeners();
m_xGeneralPage = NULL;
+ BibWindow::dispose();
}
void BibView::UpdatePages()
@@ -112,7 +119,8 @@ namespace bib
m_xGeneralPage = 0;
}
- m_xGeneralPage = m_pGeneralPage = new BibGeneralPage( this, m_pDatMan );
+ m_pGeneralPage = VclPtr<BibGeneralPage>::Create( this, m_pDatMan );
+ m_xGeneralPage = &m_pGeneralPage->GetFocusListener();
m_pGeneralPage->Show();
if( HasFocus() )
@@ -133,11 +141,11 @@ namespace bib
{
sErrorString += "\n";
sErrorString += BIB_RESSTR(RID_MAP_QUESTION);
- QueryBox aQuery( this, WB_YES_NO, sErrorString );
- aQuery.SetDefaultCheckBoxText();
- short nResult = aQuery.Execute();
+ ScopedVclPtrInstance< QueryBox > aQuery(this, WB_YES_NO, sErrorString);
+ aQuery->SetDefaultCheckBoxText();
+ short nResult = aQuery->Execute();
BibModul::GetConfig()->SetShowColumnAssignmentWarning(
- !aQuery.GetCheckBoxState());
+ !aQuery->GetCheckBoxState());
if( RET_YES != nResult )
{
bExecute = false;
@@ -150,18 +158,20 @@ namespace bib
}
}
- void BibView::_loaded( const EventObject& _rEvent )
+ BibViewFormControlContainer::BibViewFormControlContainer(BibView *pBibView) : mpBibView(pBibView) {}
+
+ void BibViewFormControlContainer::_loaded( const EventObject& _rEvent )
{
- UpdatePages();
+ mpBibView->UpdatePages();
FormControlContainer::_loaded( _rEvent );
- Resize();
+ mpBibView->Resize();
}
- void BibView::_reloaded( const EventObject& _rEvent )
+ void BibViewFormControlContainer::_reloaded( const EventObject& _rEvent )
{
- UpdatePages();
+ mpBibView->UpdatePages();
FormControlContainer::_loaded( _rEvent );
- Resize();
+ mpBibView->Resize();
}
IMPL_STATIC_LINK( BibView, CallMappingHdl, BibView*, EMPTYARG )
@@ -180,6 +190,11 @@ namespace bib
Window::Resize();
}
+ Reference< awt::XControlContainer > BibViewFormControlContainer::getControlContainer()
+ {
+ return mpBibView->getControlContainer();
+ }
+
Reference< awt::XControlContainer > BibView::getControlContainer()
{
Reference< awt::XControlContainer > xReturn;
diff --git a/extensions/source/bibliography/bibview.hxx b/extensions/source/bibliography/bibview.hxx
index add53d7c2bbe..1f797c6e990f 100644
--- a/extensions/source/bibliography/bibview.hxx
+++ b/extensions/source/bibliography/bibview.hxx
@@ -34,35 +34,48 @@ namespace bib
{
+ class BibView;
+ class BibViewFormControlContainer : public FormControlContainer
+ {
+ private:
+ VclPtr<BibView> mpBibView;
+ protected:
+ // FormControlContainer
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
+ getControlContainer() SAL_OVERRIDE;
+ // XLoadListener equivalents
+ virtual void _loaded( const ::com::sun::star::lang::EventObject& _rEvent ) SAL_OVERRIDE;
+ virtual void _reloaded( const ::com::sun::star::lang::EventObject& _rEvent ) SAL_OVERRIDE;
+ public:
+ using FormControlContainer::connectForm;
+ using FormControlContainer::disconnectForm;
+ using FormControlContainer::isFormConnected;
+ BibViewFormControlContainer(BibView *pBibView);
+ };
- class BibView : public BibWindow, public FormControlContainer
+ class BibView : public BibWindow
{
private:
BibDataManager* m_pDatMan;
::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable> m_xDatMan;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener> m_xGeneralPage;
- BibGeneralPage* m_pGeneralPage;
+ VclPtr<BibGeneralPage> m_pGeneralPage;
+ BibViewFormControlContainer m_aFormControlContainer;
private:
DECL_STATIC_LINK(BibView, CallMappingHdl, BibView*);
- protected:
+ public:
// Window overridables
- virtual void Resize() SAL_OVERRIDE;
-
- // FormControlContainer
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
- getControlContainer() SAL_OVERRIDE;
-
- // XLoadListener equivalents
- virtual void _loaded( const ::com::sun::star::lang::EventObject& _rEvent ) SAL_OVERRIDE;
- virtual void _reloaded( const ::com::sun::star::lang::EventObject& _rEvent ) SAL_OVERRIDE;
+ virtual void Resize() SAL_OVERRIDE;
public:
BibView( vcl::Window* _pParent, BibDataManager* _pDatMan, WinBits nStyle = WB_3DLOOK );
virtual ~BibView();
+ virtual void dispose() SAL_OVERRIDE;
void UpdatePages();
+ css::uno::Reference< css::awt::XControlContainer > getControlContainer();
virtual void GetFocus() SAL_OVERRIDE;
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index 257d08d189e0..b6681c756320 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -197,39 +197,39 @@ Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm)
class MappingDialog_Impl : public ModalDialog
{
BibDataManager* pDatMan;
- OKButton* pOKBT;
- ListBox* pIdentifierLB;
- ListBox* pAuthorityTypeLB;
- ListBox* pAuthorLB;
- ListBox* pTitleLB;
- ListBox* pMonthLB;
- ListBox* pYearLB;
- ListBox* pISBNLB;
- ListBox* pBooktitleLB;
- ListBox* pChapterLB;
- ListBox* pEditionLB;
- ListBox* pEditorLB;
- ListBox* pHowpublishedLB;
- ListBox* pInstitutionLB;
- ListBox* pJournalLB;
- ListBox* pNoteLB;
- ListBox* pAnnoteLB;
- ListBox* pNumberLB;
- ListBox* pOrganizationsLB;
- ListBox* pPagesLB;
- ListBox* pPublisherLB;
- ListBox* pAddressLB;
- ListBox* pSchoolLB;
- ListBox* pSeriesLB;
- ListBox* pReportTypeLB;
- ListBox* pVolumeLB;
- ListBox* pURLLB;
- ListBox* pCustom1LB;
- ListBox* pCustom2LB;
- ListBox* pCustom3LB;
- ListBox* pCustom4LB;
- ListBox* pCustom5LB;
- ListBox* aListBoxes[COLUMN_COUNT];
+ VclPtr<OKButton> pOKBT;
+ VclPtr<ListBox> pIdentifierLB;
+ VclPtr<ListBox> pAuthorityTypeLB;
+ VclPtr<ListBox> pAuthorLB;
+ VclPtr<ListBox> pTitleLB;
+ VclPtr<ListBox> pMonthLB;
+ VclPtr<ListBox> pYearLB;
+ VclPtr<ListBox> pISBNLB;
+ VclPtr<ListBox> pBooktitleLB;
+ VclPtr<ListBox> pChapterLB;
+ VclPtr<ListBox> pEditionLB;
+ VclPtr<ListBox> pEditorLB;
+ VclPtr<ListBox> pHowpublishedLB;
+ VclPtr<ListBox> pInstitutionLB;
+ VclPtr<ListBox> pJournalLB;
+ VclPtr<ListBox> pNoteLB;
+ VclPtr<ListBox> pAnnoteLB;
+ VclPtr<ListBox> pNumberLB;
+ VclPtr<ListBox> pOrganizationsLB;
+ VclPtr<ListBox> pPagesLB;
+ VclPtr<ListBox> pPublisherLB;
+ VclPtr<ListBox> pAddressLB;
+ VclPtr<ListBox> pSchoolLB;
+ VclPtr<ListBox> pSeriesLB;
+ VclPtr<ListBox> pReportTypeLB;
+ VclPtr<ListBox> pVolumeLB;
+ VclPtr<ListBox> pURLLB;
+ VclPtr<ListBox> pCustom1LB;
+ VclPtr<ListBox> pCustom2LB;
+ VclPtr<ListBox> pCustom3LB;
+ VclPtr<ListBox> pCustom4LB;
+ VclPtr<ListBox> pCustom5LB;
+ VclPtr<ListBox> aListBoxes[COLUMN_COUNT];
OUString sNone;
bool bModified;
@@ -242,6 +242,7 @@ class MappingDialog_Impl : public ModalDialog
public:
MappingDialog_Impl(vcl::Window* pParent, BibDataManager* pDatMan);
virtual ~MappingDialog_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void SetModified() {bModified = true;}
@@ -378,7 +379,48 @@ MappingDialog_Impl::MappingDialog_Impl(vcl::Window* pParent, BibDataManager* pMa
}
MappingDialog_Impl::~MappingDialog_Impl()
-{}
+{
+ disposeOnce();
+}
+
+void MappingDialog_Impl::dispose()
+{
+ pOKBT.clear();
+ pIdentifierLB.clear();
+ pAuthorityTypeLB.clear();
+ pAuthorLB.clear();
+ pTitleLB.clear();
+ pMonthLB.clear();
+ pYearLB.clear();
+ pISBNLB.clear();
+ pBooktitleLB.clear();
+ pChapterLB.clear();
+ pEditionLB.clear();
+ pEditorLB.clear();
+ pHowpublishedLB.clear();
+ pInstitutionLB.clear();
+ pJournalLB.clear();
+ pNoteLB.clear();
+ pAnnoteLB.clear();
+ pNumberLB.clear();
+ pOrganizationsLB.clear();
+ pPagesLB.clear();
+ pPublisherLB.clear();
+ pAddressLB.clear();
+ pSchoolLB.clear();
+ pSeriesLB.clear();
+ pReportTypeLB.clear();
+ pVolumeLB.clear();
+ pURLLB.clear();
+ pCustom1LB.clear();
+ pCustom2LB.clear();
+ pCustom3LB.clear();
+ pCustom4LB.clear();
+ pCustom5LB.clear();
+ for(auto & a : aListBoxes)
+ a.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK(MappingDialog_Impl, ListBoxSelectHdl, ListBox*, pListBox)
{
@@ -428,7 +470,7 @@ IMPL_LINK_NOARG(MappingDialog_Impl, OkHdl)
class DBChangeDialog_Impl : public ModalDialog
{
- ListBox* m_pSelectionLB;
+ VclPtr<ListBox> m_pSelectionLB;
DBChangeDialogConfig_Impl aConfig;
BibDataManager* pDatMan;
@@ -437,6 +479,7 @@ class DBChangeDialog_Impl : public ModalDialog
public:
DBChangeDialog_Impl(vcl::Window* pParent, BibDataManager* pMan );
virtual ~DBChangeDialog_Impl();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetCurrentURL()const;
};
@@ -479,6 +522,13 @@ IMPL_LINK(DBChangeDialog_Impl, DoubleClickHdl, SvTabListBox*, /*pLB*/)
DBChangeDialog_Impl::~DBChangeDialog_Impl()
{
+ disposeOnce();
+}
+
+void DBChangeDialog_Impl::dispose()
+{
+ m_pSelectionLB.clear();
+ ModalDialog::dispose();
}
OUString DBChangeDialog_Impl::GetCurrentURL()const
@@ -1492,7 +1542,7 @@ void BibDataManager::RemoveMeAsUidListener()
void BibDataManager::CreateMappingDialog(vcl::Window* pParent)
{
- boost::scoped_ptr<MappingDialog_Impl> pDlg(new MappingDialog_Impl(pParent, this));
+ VclPtrInstance< MappingDialog_Impl > pDlg(pParent, this);
if(RET_OK == pDlg->Execute() && pBibView)
{
reload();
@@ -1502,7 +1552,7 @@ void BibDataManager::CreateMappingDialog(vcl::Window* pParent)
OUString BibDataManager::CreateDBChangeDialog(vcl::Window* pParent)
{
OUString uRet;
- boost::scoped_ptr<DBChangeDialog_Impl> pDlg(new DBChangeDialog_Impl(pParent, this ));
+ VclPtrInstance< DBChangeDialog_Impl > pDlg(pParent, this );
if(RET_OK == pDlg->Execute())
{
OUString sNewURL = pDlg->GetCurrentURL();
diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx
index 655644ed07fa..366c81f952d5 100644
--- a/extensions/source/bibliography/datman.hxx
+++ b/extensions/source/bibliography/datman.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
#include <cppuhelper/implbase1.hxx>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
@@ -100,8 +101,8 @@ private:
::cppu::OInterfaceContainerHelper m_aLoadListeners;
- ::bib::BibView* pBibView;
- BibToolBar* pToolbar;
+ VclPtr<::bib::BibView> pBibView;
+ VclPtr<BibToolBar> pToolbar;
OUString sIdentifierMapping;
protected:
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index a586fe69aa4c..563aa8a57067 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -25,6 +25,7 @@
#include <comphelper/sequence.hxx>
#include "framectr.hxx"
#include "datman.hxx"
+#include "bibview.hxx"
#include "bibresid.hxx"
#include "bib.hrc"
#include <toolkit/helper/vclunohelper.hxx>
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 238b1606d1e6..f84ab5855411 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -35,6 +35,7 @@
#include "bibprop.hrc"
#include "bib.hrc"
#include "bibmod.hxx"
+#include "bibview.hxx"
#include "bibtools.hxx"
#include "bibliography.hrc"
#include <tools/debug.hxx>
@@ -69,7 +70,7 @@ static OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos
class BibPosListener :public cppu::WeakImplHelper1 <sdbc::XRowSetListener>
{
- BibGeneralPage* pParentPage;
+ VclPtr<BibGeneralPage> pParentPage;
public:
BibPosListener(BibGeneralPage* pParent);
@@ -167,6 +168,7 @@ void BibPosListener::disposing(const lang::EventObject& /*Source*/) throw( uno::
BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan):
BibTabPage(pParent, "GeneralPage", "modules/sbibliography/ui/generalpage.ui"),
sErrorPrefix(BIB_RESSTR(ST_ERROR_PREFIX)),
+ maBibGeneralPageFocusListener(this),
pDatMan(pMan)
{
get(pIdentifierFT, "shortname");
@@ -340,12 +342,52 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan):
BibGeneralPage::~BibGeneralPage()
{
+ disposeOnce();
+}
+
+void BibGeneralPage::dispose()
+{
if (pDatMan && xPosListener.is())
{
uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY);
if(xRowSet.is())
xRowSet->removeRowSetListener(xPosListener);
}
+ pGrid.clear();
+ pScrolledWindow.clear();
+ pIdentifierFT.clear();
+ pAuthTypeFT.clear();
+ pYearFT.clear();
+ pAuthorFT.clear();
+ pTitleFT.clear();
+ pPublisherFT.clear();
+ pAddressFT.clear();
+ pISBNFT.clear();
+ pChapterFT.clear();
+ pPagesFT.clear();
+ pEditorFT.clear();
+ pEditionFT.clear();
+ pBooktitleFT.clear();
+ pVolumeFT.clear();
+ pHowpublishedFT.clear();
+ pOrganizationsFT.clear();
+ pInstitutionFT.clear();
+ pSchoolFT.clear();
+ pReportTypeFT.clear();
+ pMonthFT.clear();
+ pJournalFT.clear();
+ pNumberFT.clear();
+ pSeriesFT.clear();
+ pAnnoteFT.clear();
+ pNoteFT.clear();
+ pURLFT.clear();
+ pCustom1FT.clear();
+ pCustom2FT.clear();
+ pCustom3FT.clear();
+ pCustom4FT.clear();
+ pCustom5FT.clear();
+ for (auto & a: aFixedTexts) a.clear();
+ BibTabPage::dispose();
}
void BibGeneralPage::RemoveListeners()
@@ -355,7 +397,7 @@ void BibGeneralPage::RemoveListeners()
if(aControls[i].is())
{
uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY );
- xCtrWin->removeFocusListener( this );
+ xCtrWin->removeFocusListener( &maBibGeneralPageFocusListener );
aControls[i] = 0;
}
}
@@ -446,7 +488,7 @@ uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
// Peer as Child to the FrameWindow
xCtrlContnr->addControl(rName, xControl);
uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY );
- xCtrWin->addFocusListener( this );
+ xCtrWin->addFocusListener( &maBibGeneralPageFocusListener );
rIndex = -1; // -> implies, that not found
for(sal_uInt16 i = 0; i < FIELD_COUNT; i++)
if(!aControls[i].is())
@@ -567,10 +609,6 @@ void BibGeneralPage::focusLost(const awt::FocusEvent& ) throw( uno::RuntimeExcep
CommitActiveControl();
}
-void BibGeneralPage::disposing(const lang::EventObject& /*Source*/) throw( uno::RuntimeException, std::exception )
-{
-}
-
void BibGeneralPage::GetFocus()
{
Reference< awt::XWindow >* pxControl = aControls;
@@ -653,4 +691,20 @@ bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent )
return bHandled;
}
+BibGeneralPageFocusListener::BibGeneralPageFocusListener(BibGeneralPage *pBibGeneralPage): mpBibGeneralPage(pBibGeneralPage)
+{}
+
+void BibGeneralPageFocusListener::focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException, std::exception )
+{
+ mpBibGeneralPage->focusGained(e);
+}
+
+void BibGeneralPageFocusListener::focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException, std::exception )
+{
+ mpBibGeneralPage->focusLost(e);
+}
+
+void BibGeneralPageFocusListener::disposing( const ::com::sun::star::lang::EventObject& ) throw( com::sun::star::uno::RuntimeException, std::exception )
+{}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx
index 2c0c17aaf5fe..e566c9f15e81 100644
--- a/extensions/source/bibliography/general.hxx
+++ b/extensions/source/bibliography/general.hxx
@@ -41,56 +41,70 @@ class BibDataManager;
#define TYPE_COUNT 22
#define FIELD_COUNT 31
-typedef cppu::WeakAggImplHelper1 < ::com::sun::star::awt::XFocusListener > BibGeneralPageBaseClass;
+/**
+ * We need to split off the listener because both it and the vcl::Window baseclass are ref-counted
+ */
+class BibGeneralPage;
+class BibGeneralPageFocusListener : public cppu::WeakAggImplHelper1 < ::com::sun::star::awt::XFocusListener >
+{
+private:
+ VclPtr<BibGeneralPage> mpBibGeneralPage;
+public:
+ BibGeneralPageFocusListener(BibGeneralPage *pBibGeneralPage);
+ virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-class BibGeneralPage: public BibGeneralPageBaseClass, public BibTabPage
+};
+
+class BibGeneralPage: public BibTabPage
{
- VclGrid* pGrid;
- VclScrolledWindow* pScrolledWindow;
+ VclPtr<VclGrid> pGrid;
+ VclPtr<VclScrolledWindow> pScrolledWindow;
- FixedText* pIdentifierFT;
- FixedText* pAuthTypeFT;
- FixedText* pYearFT;
+ VclPtr<FixedText> pIdentifierFT;
+ VclPtr<FixedText> pAuthTypeFT;
+ VclPtr<FixedText> pYearFT;
- FixedText* pAuthorFT;
- FixedText* pTitleFT;
+ VclPtr<FixedText> pAuthorFT;
+ VclPtr<FixedText> pTitleFT;
- FixedText* pPublisherFT;
- FixedText* pAddressFT;
- FixedText* pISBNFT;
+ VclPtr<FixedText> pPublisherFT;
+ VclPtr<FixedText> pAddressFT;
+ VclPtr<FixedText> pISBNFT;
- FixedText* pChapterFT;
- FixedText* pPagesFT;
+ VclPtr<FixedText> pChapterFT;
+ VclPtr<FixedText> pPagesFT;
- FixedText* pEditorFT;
- FixedText* pEditionFT;
+ VclPtr<FixedText> pEditorFT;
+ VclPtr<FixedText> pEditionFT;
- FixedText* pBooktitleFT;
- FixedText* pVolumeFT;
- FixedText* pHowpublishedFT;
+ VclPtr<FixedText> pBooktitleFT;
+ VclPtr<FixedText> pVolumeFT;
+ VclPtr<FixedText> pHowpublishedFT;
- FixedText* pOrganizationsFT;
- FixedText* pInstitutionFT;
- FixedText* pSchoolFT;
+ VclPtr<FixedText> pOrganizationsFT;
+ VclPtr<FixedText> pInstitutionFT;
+ VclPtr<FixedText> pSchoolFT;
- FixedText* pReportTypeFT;
- FixedText* pMonthFT;
+ VclPtr<FixedText> pReportTypeFT;
+ VclPtr<FixedText> pMonthFT;
- FixedText* pJournalFT;
- FixedText* pNumberFT;
- FixedText* pSeriesFT;
+ VclPtr<FixedText> pJournalFT;
+ VclPtr<FixedText> pNumberFT;
+ VclPtr<FixedText> pSeriesFT;
- FixedText* pAnnoteFT;
- FixedText* pNoteFT;
- FixedText* pURLFT;
+ VclPtr<FixedText> pAnnoteFT;
+ VclPtr<FixedText> pNoteFT;
+ VclPtr<FixedText> pURLFT;
- FixedText* pCustom1FT;
- FixedText* pCustom2FT;
- FixedText* pCustom3FT;
- FixedText* pCustom4FT;
- FixedText* pCustom5FT;
+ VclPtr<FixedText> pCustom1FT;
+ VclPtr<FixedText> pCustom2FT;
+ VclPtr<FixedText> pCustom3FT;
+ VclPtr<FixedText> pCustom4FT;
+ VclPtr<FixedText> pCustom5FT;
- FixedText* aFixedTexts[ FIELD_COUNT ];
+ VclPtr<FixedText> aFixedTexts[ FIELD_COUNT ];
sal_Int16 nFT2CtrlMap[ FIELD_COUNT ];
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
@@ -113,6 +127,7 @@ class BibGeneralPage: public BibGeneralPageBaseClass, public BibTabPage
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >
xPosListener;
+ BibGeneralPageFocusListener maBibGeneralPageFocusListener;
BibDataManager* pDatMan;
@@ -130,6 +145,7 @@ protected:
public:
BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan);
virtual ~BibGeneralPage();
+ virtual void dispose() SAL_OVERRIDE;
inline const OUString& GetErrorString() const;
@@ -142,16 +158,17 @@ public:
void CommitActiveControl();
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-
- void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
- void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
-
void RemoveListeners();
virtual void GetFocus() SAL_OVERRIDE;
virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) SAL_OVERRIDE; // returns true, if key was handled
+
+ inline BibGeneralPageFocusListener& GetFocusListener() { return maBibGeneralPageFocusListener; }
+
+ void focusGained(const css::awt::FocusEvent& rEvent) throw( css::uno::RuntimeException, std::exception );
+ void focusLost(const css::awt::FocusEvent& rEvent) throw( css::uno::RuntimeException, std::exception );
+
};
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index 66ed1ca4bea9..f6db18010275 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -31,6 +31,7 @@
#include <vcl/settings.hxx>
#include <vcl/mnemonic.hxx>
#include "bibbeam.hxx"
+#include "bibview.hxx"
#include "toolbar.hrc"
#include "bibresid.hxx"
@@ -179,10 +180,10 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle):
ToolBox(pParent,BibResId(RID_BIB_TOOLBAR)),
aImgLst(BibResId( RID_TOOLBAR_IMGLIST )),
aBigImgLst(BibResId( RID_TOOLBAR_BIGIMGLIST )),
- aFtSource(this,WB_VCENTER),
- aLBSource(this,WB_DROPDOWN),
- aFtQuery(this,WB_VCENTER),
- aEdQuery(this),
+ aFtSource(VclPtr<FixedText>::Create(this,WB_VCENTER)),
+ aLBSource(VclPtr<ListBox>::Create(this,WB_DROPDOWN)),
+ aFtQuery(VclPtr<FixedText>::Create(this,WB_VCENTER)),
+ aEdQuery(VclPtr<Edit>::Create(this)),
nMenuId(0),
nSelMenuItem(0),
aLayoutManager( aLink ),
@@ -198,10 +199,10 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle):
SetOutStyle(TOOLBOX_STYLE_FLAT);
Size a2Size(GetOutputSizePixel());
a2Size.Width()=100;
- aLBSource.SetSizePixel(a2Size);
- aLBSource.SetDropDownLineCount(9);
- aLBSource.Show();
- aLBSource.SetSelectHdl(LINK( this, BibToolBar, SelHdl));
+ aLBSource->SetSizePixel(a2Size);
+ aLBSource->SetDropDownLineCount(9);
+ aLBSource->Show();
+ aLBSource->SetSelectHdl(LINK( this, BibToolBar, SelHdl));
SvtMiscOptions().AddListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) );
Application::AddEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) );
@@ -211,32 +212,42 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle):
SetDropdownClickHdl( LINK( this, BibToolBar, MenuHdl));
- aEdQuery.SetSizePixel(aLBSource.GetSizePixel());
- aEdQuery.Show();
+ aEdQuery->SetSizePixel(aLBSource->GetSizePixel());
+ aEdQuery->Show();
OUString aStr=GetItemText(TBC_FT_SOURCE);
- aFtSource.SetText(aStr);
- aFtSource.SetSizePixel(aFtSource.get_preferred_size());
- aFtSource.SetBackground(Wallpaper( COL_TRANSPARENT ));
+ aFtSource->SetText(aStr);
+ aFtSource->SetSizePixel(aFtSource->get_preferred_size());
+ aFtSource->SetBackground(Wallpaper( COL_TRANSPARENT ));
aStr=GetItemText(TBC_FT_QUERY);
- aFtQuery.SetText(aStr);
- aFtQuery.SetSizePixel(aFtQuery.get_preferred_size());
- aFtQuery.SetBackground(Wallpaper( COL_TRANSPARENT ));
+ aFtQuery->SetText(aStr);
+ aFtQuery->SetSizePixel(aFtQuery->get_preferred_size());
+ aFtQuery->SetBackground(Wallpaper( COL_TRANSPARENT ));
- SetItemWindow(TBC_FT_SOURCE,&aFtSource);
- SetItemWindow(TBC_LB_SOURCE,&aLBSource);
- SetItemWindow(TBC_FT_QUERY ,&aFtQuery);
- SetItemWindow(TBC_ED_QUERY ,&aEdQuery);
+ SetItemWindow(TBC_FT_SOURCE, aFtSource.get());
+ SetItemWindow(TBC_LB_SOURCE, aLBSource.get());
+ SetItemWindow(TBC_FT_QUERY , aFtQuery.get());
+ SetItemWindow(TBC_ED_QUERY , aEdQuery.get());
::bib::AddToTaskPaneList( this );
}
BibToolBar::~BibToolBar()
{
+ disposeOnce();
+}
+
+void BibToolBar::dispose()
+{
SvtMiscOptions().RemoveListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) );
Application::RemoveEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) );
::bib::RemoveFromTaskPaneList( this );
+ aFtSource.disposeAndClear();
+ aFtQuery.disposeAndClear();
+ aEdQuery.disposeAndClear();
+ aLBSource.disposeAndClear();
+ ToolBox::dispose();
}
void BibToolBar::InitListener()
@@ -308,7 +319,7 @@ void BibToolBar::Select()
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name="QueryText";
- OUString aSelection = aEdQuery.GetText();
+ OUString aSelection = aEdQuery->GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name="QueryField";
@@ -386,39 +397,39 @@ void BibToolBar::SelectFilterItem(sal_uInt16 nId)
void BibToolBar::EnableSourceList(bool bFlag)
{
- aFtSource.Enable(bFlag);
- aLBSource.Enable(bFlag);
+ aFtSource->Enable(bFlag);
+ aLBSource->Enable(bFlag);
}
void BibToolBar::ClearSourceList()
{
- aLBSource.Clear();
+ aLBSource->Clear();
}
void BibToolBar::UpdateSourceList(bool bFlag)
{
- aLBSource.SetUpdateMode(bFlag);
+ aLBSource->SetUpdateMode(bFlag);
}
void BibToolBar::InsertSourceEntry(const OUString& aEntry, sal_Int32 nPos)
{
- aLBSource.InsertEntry(aEntry, nPos);
+ aLBSource->InsertEntry(aEntry, nPos);
}
void BibToolBar::SelectSourceEntry(const OUString& aStr)
{
- aLBSource.SelectEntry(aStr);
+ aLBSource->SelectEntry(aStr);
}
void BibToolBar::EnableQuery(bool bFlag)
{
- aFtQuery.Enable(bFlag);
- aEdQuery.Enable(bFlag);
+ aFtQuery->Enable(bFlag);
+ aEdQuery->Enable(bFlag);
}
void BibToolBar::SetQueryString(const OUString& aStr)
{
- aEdQuery.SetText(aStr);
+ aEdQuery->SetText(aStr);
}
@@ -427,7 +438,7 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt )
bool nResult = true;
MouseNotifyEvent nSwitch=rNEvt.GetType();
- if(aEdQuery.HasFocus() && nSwitch==MouseNotifyEvent::KEYINPUT)
+ if(aEdQuery->HasFocus() && nSwitch==MouseNotifyEvent::KEYINPUT)
{
const vcl::KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode();
sal_uInt16 nKey = aKeyCode.GetCode();
@@ -436,7 +447,7 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt )
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name = "QueryText";
- OUString aSelection = aEdQuery.GetText();
+ OUString aSelection = aEdQuery->GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name="QueryField";
pPropertyVal[1].Value <<= aQueryField;
@@ -462,7 +473,7 @@ IMPL_LINK( BibToolBar, SendSelHdl, Timer*,/*pT*/)
Sequence<PropertyValue> aPropVal(1);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name = "DataSourceName";
- OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( aLBSource.GetSelectEntry() ) );
+ OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( aLBSource->GetSelectEntry() ) );
OUString aSelection = aEntry;
pPropertyVal[0].Value <<= aSelection;
SendDispatch(TBC_LB_SOURCE,aPropVal);
@@ -490,7 +501,7 @@ IMPL_LINK( BibToolBar, MenuHdl, ToolBox*, /*pToolbox*/)
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name = "QueryText";
- OUString aSelection = aEdQuery.GetText();
+ OUString aSelection = aEdQuery->GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name="QueryField";
pPropertyVal[1].Value <<= aQueryField;
diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx
index 177fc0b195df..f7eef64155bd 100644
--- a/extensions/source/bibliography/toolbar.hxx
+++ b/extensions/source/bibliography/toolbar.hxx
@@ -39,12 +39,12 @@ class BibToolBarListener: public cppu::WeakImplHelper1 < ::com::sun::star::frame
{
private:
- sal_uInt16 nIndex;
+ sal_uInt16 nIndex;
OUString aCommand;
protected:
- BibToolBar *pToolBar;
+ VclPtr<BibToolBar> pToolBar;
public:
@@ -109,20 +109,20 @@ class BibToolBar: public ToolBox
private:
BibToolBarListenerArr aListenerArr;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController;
+ css::uno::Reference< css::frame::XController > xController;
Idle aIdle;
ImageList aImgLst;
ImageList aImgLstHC;
ImageList aBigImgLst;
ImageList aBigImgLstHC;
- FixedText aFtSource;
- ListBox aLBSource;
- FixedText aFtQuery;
- Edit aEdQuery;
+ VclPtr<FixedText> aFtSource;
+ VclPtr<ListBox> aLBSource;
+ VclPtr<FixedText> aFtQuery;
+ VclPtr<Edit> aEdQuery;
PopupMenu aPopupMenu;
sal_uInt16 nMenuId;
sal_uInt16 nSelMenuItem;
- OUString aQueryField;
+ OUString aQueryField;
Link aLayoutManager;
sal_Int16 nSymbolsSize;
sal_Int16 nOutStyle;
@@ -150,6 +150,7 @@ class BibToolBar: public ToolBox
BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle = WB_3DLOOK );
virtual ~BibToolBar();
+ virtual void dispose() SAL_OVERRIDE;
void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx
index 5a9817164ca0..5c730601a17c 100644
--- a/extensions/source/dbpilots/commonpagesdbp.cxx
+++ b/extensions/source/dbpilots/commonpagesdbp.cxx
@@ -77,6 +77,19 @@ namespace dbp
m_pDatasource->SetDropDownLineCount(10);
}
+ OTableSelectionPage::~OTableSelectionPage()
+ {
+ disposeOnce();
+ }
+
+ void OTableSelectionPage::dispose()
+ {
+ m_pDatasourceLabel.clear();
+ m_pDatasource.clear();
+ m_pSearchDatabase.clear();
+ m_pTable.clear();
+ OControlWizardPage::dispose();
+ }
void OTableSelectionPage::ActivatePage()
{
@@ -383,6 +396,19 @@ namespace dbp
{
}
+ OMaybeListSelectionPage::~OMaybeListSelectionPage()
+ {
+ disposeOnce();
+ }
+
+ void OMaybeListSelectionPage::dispose()
+ {
+ m_pYes.clear();
+ m_pNo.clear();
+ m_pList.clear();
+ OControlWizardPage::dispose();
+ }
+
void OMaybeListSelectionPage::announceControls(RadioButton& _rYesButton, RadioButton& _rNoButton, ListBox& _rSelection)
{
m_pYes = &_rYesButton;
@@ -453,6 +479,19 @@ namespace dbp
m_pStoreWhere->SetDropDownLineCount(10);
}
+ ODBFieldPage::~ODBFieldPage()
+ {
+ disposeOnce();
+ }
+
+ void ODBFieldPage::dispose()
+ {
+ m_pDescription.clear();
+ m_pStoreYes.clear();
+ m_pStoreNo.clear();
+ m_pStoreWhere.clear();
+ OMaybeListSelectionPage::dispose();
+ }
void ODBFieldPage::initializePage()
{
diff --git a/extensions/source/dbpilots/commonpagesdbp.hxx b/extensions/source/dbpilots/commonpagesdbp.hxx
index 8d9d9c801d3f..1ff1d51b4601 100644
--- a/extensions/source/dbpilots/commonpagesdbp.hxx
+++ b/extensions/source/dbpilots/commonpagesdbp.hxx
@@ -36,16 +36,18 @@ namespace dbp
class OTableSelectionPage : public OControlWizardPage
{
protected:
- FixedText *m_pDatasourceLabel;
- ListBox *m_pDatasource;
- PushButton *m_pSearchDatabase;
- ListBox *m_pTable;
+ VclPtr<FixedText> m_pDatasourceLabel;
+ VclPtr<ListBox> m_pDatasource;
+ VclPtr<PushButton> m_pSearchDatabase;
+ VclPtr<ListBox> m_pTable;
::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
m_xDSContext;
public:
OTableSelectionPage(OControlWizard* _pParent);
+ virtual ~OTableSelectionPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// TabPage overridables
@@ -74,12 +76,14 @@ namespace dbp
class OMaybeListSelectionPage : public OControlWizardPage
{
protected:
- RadioButton* m_pYes;
- RadioButton* m_pNo;
- ListBox* m_pList;
+ VclPtr<RadioButton> m_pYes;
+ VclPtr<RadioButton> m_pNo;
+ VclPtr<ListBox> m_pList;
public:
OMaybeListSelectionPage( OControlWizard* _pParent, const OString& _rID, const OUString& _rUIXMLDescription );
+ virtual ~OMaybeListSelectionPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
DECL_LINK( OnRadioSelected, RadioButton* );
@@ -105,13 +109,15 @@ namespace dbp
class ODBFieldPage : public OMaybeListSelectionPage
{
protected:
- FixedText* m_pDescription;
- RadioButton* m_pStoreYes;
- RadioButton* m_pStoreNo;
- ListBox* m_pStoreWhere;
+ VclPtr<FixedText> m_pDescription;
+ VclPtr<RadioButton> m_pStoreYes;
+ VclPtr<RadioButton> m_pStoreNo;
+ VclPtr<ListBox> m_pStoreWhere;
public:
ODBFieldPage( OControlWizard* _pParent );
+ virtual ~ODBFieldPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
void setDescriptionText(const OUString& _rDesc) { m_pDescription->SetText(_rDesc); }
diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx
index c3f8c025d20c..9128bbbf4589 100644
--- a/extensions/source/dbpilots/controlwizard.cxx
+++ b/extensions/source/dbpilots/controlwizard.cxx
@@ -86,6 +86,18 @@ namespace dbp
OControlWizardPage::~OControlWizardPage()
{
+ disposeOnce();
+ }
+
+ void OControlWizardPage::dispose()
+ {
+ m_pFormDatasourceLabel.clear();
+ m_pFormDatasource.clear();
+ m_pFormContentTypeLabel.clear();
+ m_pFormContentType.clear();
+ m_pFormTableLabel.clear();
+ m_pFormTable.clear();
+ OControlWizardPage_Base::dispose();
}
OControlWizard* OControlWizardPage::getDialog()
diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx
index 879520db1c99..529e94bb25c4 100644
--- a/extensions/source/dbpilots/controlwizard.hxx
+++ b/extensions/source/dbpilots/controlwizard.hxx
@@ -57,12 +57,12 @@ namespace dbp
class OControlWizardPage : public OControlWizardPage_Base
{
protected:
- FixedText* m_pFormDatasourceLabel;
- FixedText* m_pFormDatasource;
- FixedText* m_pFormContentTypeLabel;
- FixedText* m_pFormContentType;
- FixedText* m_pFormTableLabel;
- FixedText* m_pFormTable;
+ VclPtr<FixedText> m_pFormDatasourceLabel;
+ VclPtr<FixedText> m_pFormDatasource;
+ VclPtr<FixedText> m_pFormContentTypeLabel;
+ VclPtr<FixedText> m_pFormContentType;
+ VclPtr<FixedText> m_pFormTableLabel;
+ VclPtr<FixedText> m_pFormTable;
protected:
OControlWizard* getDialog();
@@ -75,6 +75,7 @@ namespace dbp
public:
OControlWizardPage( OControlWizard* _pParent, const OString& rID, const OUString& rUIXMLDescription );
virtual ~OControlWizardPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
static void fillListBox(
diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx
index 882847b0f99f..aec86cd649ca 100644
--- a/extensions/source/dbpilots/gridwizard.cxx
+++ b/extensions/source/dbpilots/gridwizard.cxx
@@ -228,17 +228,16 @@ namespace dbp
}
- OWizardPage* OGridWizard::createPage(WizardState _nState)
+ VclPtr<TabPage> OGridWizard::createPage(WizardState _nState)
{
switch (_nState)
{
case GW_STATE_DATASOURCE_SELECTION:
- return new OTableSelectionPage(this);
+ return VclPtr<OTableSelectionPage>::Create(this);
case GW_STATE_FIELDSELECTION:
- return new OGridFieldsSelection(this);
+ return VclPtr<OGridFieldsSelection>::Create(this);
}
-
- return NULL;
+ return VclPtr<TabPage>();
}
@@ -319,6 +318,21 @@ namespace dbp
m_pSelFields->SetDoubleClickHdl(LINK(this, OGridFieldsSelection, OnEntryDoubleClicked));
}
+ OGridFieldsSelection::~OGridFieldsSelection()
+ {
+ disposeOnce();
+ }
+
+ void OGridFieldsSelection::dispose()
+ {
+ m_pExistFields.clear();
+ m_pSelectOne.clear();
+ m_pSelectAll.clear();
+ m_pDeselectOne.clear();
+ m_pDeselectAll.clear();
+ m_pSelFields.clear();
+ OGridPage::dispose();
+ }
void OGridFieldsSelection::ActivatePage()
{
diff --git a/extensions/source/dbpilots/gridwizard.hxx b/extensions/source/dbpilots/gridwizard.hxx
index 91da2fd5bee7..9c66ae9e72cd 100644
--- a/extensions/source/dbpilots/gridwizard.hxx
+++ b/extensions/source/dbpilots/gridwizard.hxx
@@ -56,7 +56,7 @@ namespace dbp
protected:
// OWizardMachine overridables
- virtual ::svt::OWizardPage* createPage( WizardState _nState ) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage( WizardState _nState ) SAL_OVERRIDE;
virtual WizardState determineNextState( WizardState _nCurrentState ) const SAL_OVERRIDE;
virtual void enterState( WizardState _nState ) SAL_OVERRIDE;
virtual bool leaveState( WizardState _nState ) SAL_OVERRIDE;
@@ -82,15 +82,17 @@ namespace dbp
class OGridFieldsSelection : public OGridPage
{
protected:
- ListBox *m_pExistFields;
- PushButton *m_pSelectOne;
- PushButton *m_pSelectAll;
- PushButton *m_pDeselectOne;
- PushButton *m_pDeselectAll;
- ListBox *m_pSelFields;
+ VclPtr<ListBox> m_pExistFields;
+ VclPtr<PushButton> m_pSelectOne;
+ VclPtr<PushButton> m_pSelectAll;
+ VclPtr<PushButton> m_pDeselectOne;
+ VclPtr<PushButton> m_pDeselectAll;
+ VclPtr<ListBox> m_pSelFields;
public:
OGridFieldsSelection( OGridWizard* _pParent );
+ virtual ~OGridFieldsSelection();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// TabPage overridables
diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx
index 2f165addf0cf..fbcaa668990b 100644
--- a/extensions/source/dbpilots/groupboxwiz.cxx
+++ b/extensions/source/dbpilots/groupboxwiz.cxx
@@ -69,24 +69,24 @@ namespace dbp
}
- OWizardPage* OGroupBoxWizard::createPage(::svt::WizardTypes::WizardState _nState)
+ VclPtr<TabPage> OGroupBoxWizard::createPage(::svt::WizardTypes::WizardState _nState)
{
switch (_nState)
{
case GBW_STATE_OPTIONLIST:
- return new ORadioSelectionPage(this);
+ return VclPtr<ORadioSelectionPage>::Create(this);
case GBW_STATE_DEFAULTOPTION:
- return new ODefaultFieldSelectionPage(this);
+ return VclPtr<ODefaultFieldSelectionPage>::Create(this);
case GBW_STATE_OPTIONVALUES:
- return new OOptionValuesPage(this);
+ return VclPtr<OOptionValuesPage>::Create(this);
case GBW_STATE_DBFIELD:
- return new OOptionDBFieldPage(this);
+ return VclPtr<OOptionDBFieldPage>::Create(this);
case GBW_STATE_FINALIZE:
- return new OFinalizeGBWPage(this);
+ return VclPtr<OFinalizeGBWPage>::Create(this);
}
return NULL;
@@ -207,11 +207,24 @@ namespace dbp
implCheckMoveButtons();
m_pExistingRadios->EnableMultiSelection(true);
- getDialog()->defaultButton(m_pMoveRight);
+ getDialog()->defaultButton(m_pMoveRight.get());
m_pExistingRadios->SetAccessibleRelationMemberOf(m_pExistingRadios);
}
+ ORadioSelectionPage::~ORadioSelectionPage()
+ {
+ disposeOnce();
+ }
+
+ void ORadioSelectionPage::dispose()
+ {
+ m_pRadioName.clear();
+ m_pMoveRight.clear();
+ m_pMoveLeft.clear();
+ m_pExistingRadios.clear();
+ OGBWPage::dispose();
+ }
void ORadioSelectionPage::ActivatePage()
{
@@ -315,7 +328,7 @@ namespace dbp
if (bUnfinishedInput)
{
if (0 == (m_pMoveRight->GetStyle() & WB_DEFBUTTON))
- getDialog()->defaultButton(m_pMoveRight);
+ getDialog()->defaultButton(m_pMoveRight.get());
}
else
{
@@ -341,6 +354,18 @@ namespace dbp
m_pDefSelection->SetStyle(WB_DROPDOWN);
}
+ ODefaultFieldSelectionPage::~ODefaultFieldSelectionPage()
+ {
+ disposeOnce();
+ }
+
+ void ODefaultFieldSelectionPage::dispose()
+ {
+ m_pDefSelYes.clear();
+ m_pDefSelNo.clear();
+ m_pDefSelection.clear();
+ OMaybeListSelectionPage::dispose();
+ }
void ODefaultFieldSelectionPage::initializePage()
{
@@ -388,6 +413,17 @@ namespace dbp
m_pOptions->SetAccessibleRelationMemberOf(m_pOptions);
}
+ OOptionValuesPage::~OOptionValuesPage()
+ {
+ disposeOnce();
+ }
+
+ void OOptionValuesPage::dispose()
+ {
+ m_pValue.clear();
+ m_pOptions.clear();
+ OGBWPage::dispose();
+ }
IMPL_LINK( OOptionValuesPage, OnOptionSelected, ListBox*, /*NOTINTERESTEDIN*/ )
{
@@ -486,6 +522,16 @@ namespace dbp
get(m_pName, "nameit");
}
+ OFinalizeGBWPage::~OFinalizeGBWPage()
+ {
+ disposeOnce();
+ }
+
+ void OFinalizeGBWPage::dispose()
+ {
+ m_pName.clear();
+ OGBWPage::dispose();
+ }
void OFinalizeGBWPage::ActivatePage()
{
diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx
index e37840f88216..9413628bcc88 100644
--- a/extensions/source/dbpilots/groupboxwiz.hxx
+++ b/extensions/source/dbpilots/groupboxwiz.hxx
@@ -62,7 +62,7 @@ namespace dbp
protected:
// OWizardMachine overridables
- virtual ::svt::OWizardPage* createPage( WizardState _nState ) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage( WizardState _nState ) SAL_OVERRIDE;
virtual WizardState determineNextState( WizardState _nCurrentState ) const SAL_OVERRIDE;
virtual void enterState( WizardState _nState ) SAL_OVERRIDE;
virtual bool onFinish() SAL_OVERRIDE;
@@ -94,13 +94,15 @@ namespace dbp
class ORadioSelectionPage : public OGBWPage
{
protected:
- Edit *m_pRadioName;
- PushButton *m_pMoveRight;
- PushButton *m_pMoveLeft;
- ListBox *m_pExistingRadios;
+ VclPtr<Edit> m_pRadioName;
+ VclPtr<PushButton> m_pMoveRight;
+ VclPtr<PushButton> m_pMoveLeft;
+ VclPtr<ListBox> m_pExistingRadios;
public:
ORadioSelectionPage( OControlWizard* _pParent );
+ virtual ~ORadioSelectionPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// TabPage overridables
@@ -124,12 +126,14 @@ namespace dbp
class ODefaultFieldSelectionPage : public OMaybeListSelectionPage
{
protected:
- RadioButton *m_pDefSelYes;
- RadioButton *m_pDefSelNo;
- ListBox *m_pDefSelection;
+ VclPtr<RadioButton> m_pDefSelYes;
+ VclPtr<RadioButton> m_pDefSelNo;
+ VclPtr<ListBox> m_pDefSelection;
public:
ODefaultFieldSelectionPage( OControlWizard* _pParent );
+ virtual ~ODefaultFieldSelectionPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// OWizardPage overridables
@@ -145,8 +149,8 @@ namespace dbp
class OOptionValuesPage : public OGBWPage
{
protected:
- Edit *m_pValue;
- ListBox *m_pOptions;
+ VclPtr<Edit> m_pValue;
+ VclPtr<ListBox> m_pOptions;
StringArray m_aUncommittedValues;
::svt::WizardTypes::WizardState
@@ -154,6 +158,8 @@ namespace dbp
public:
OOptionValuesPage( OControlWizard* _pParent );
+ virtual ~OOptionValuesPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// TabPage overridables
@@ -189,10 +195,12 @@ namespace dbp
class OFinalizeGBWPage : public OGBWPage
{
protected:
- Edit *m_pName;
+ VclPtr<Edit> m_pName;
public:
OFinalizeGBWPage( OControlWizard* _pParent );
+ virtual ~OFinalizeGBWPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// TabPage overridables
diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx
index 6349c0796c58..0173584e3455 100644
--- a/extensions/source/dbpilots/listcombowizard.cxx
+++ b/extensions/source/dbpilots/listcombowizard.cxx
@@ -88,23 +88,23 @@ namespace dbp
}
- OWizardPage* OListComboWizard::createPage(WizardState _nState)
+ VclPtr<TabPage> OListComboWizard::createPage(WizardState _nState)
{
switch (_nState)
{
case LCW_STATE_DATASOURCE_SELECTION:
- return new OTableSelectionPage(this);
+ return VclPtr<OTableSelectionPage>::Create(this);
case LCW_STATE_TABLESELECTION:
- return new OContentTableSelection(this);
+ return VclPtr<OContentTableSelection>::Create(this);
case LCW_STATE_FIELDSELECTION:
- return new OContentFieldSelection(this);
+ return VclPtr<OContentFieldSelection>::Create(this);
case LCW_STATE_FIELDLINK:
- return new OLinkFieldsPage(this);
+ return VclPtr<OLinkFieldsPage>::Create(this);
case LCW_STATE_COMBODBFIELD:
- return new OComboDBFieldPage(this);
+ return VclPtr<OComboDBFieldPage>::Create(this);
}
- return NULL;
+ return VclPtr<TabPage>();
}
@@ -285,6 +285,16 @@ namespace dbp
m_pSelectTable->SetSelectHdl(LINK(this, OContentTableSelection, OnTableSelected));
}
+ OContentTableSelection::~OContentTableSelection()
+ {
+ disposeOnce();
+ }
+
+ void OContentTableSelection::dispose()
+ {
+ m_pSelectTable.clear();
+ OLCPage::dispose();
+ }
void OContentTableSelection::ActivatePage()
{
@@ -369,6 +379,18 @@ namespace dbp
m_pSelectTableField->SetDoubleClickHdl(LINK(this, OContentFieldSelection, OnTableDoubleClicked));
}
+ OContentFieldSelection::~OContentFieldSelection()
+ {
+ disposeOnce();
+ }
+
+ void OContentFieldSelection::dispose()
+ {
+ m_pSelectTableField.clear();
+ m_pDisplayedField.clear();
+ m_pInfo.clear();
+ OLCPage::dispose();
+ }
void OContentFieldSelection::ActivatePage()
{
@@ -439,6 +461,17 @@ namespace dbp
m_pTableField->SetSelectHdl(LINK(this, OLinkFieldsPage, OnSelectionModified));
}
+ OLinkFieldsPage::~OLinkFieldsPage()
+ {
+ disposeOnce();
+ }
+
+ void OLinkFieldsPage::dispose()
+ {
+ m_pValueListField.clear();
+ m_pTableField.clear();
+ OLCPage::dispose();
+ }
void OLinkFieldsPage::ActivatePage()
{
diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx
index 6d4908cdda5c..ec28093479ce 100644
--- a/extensions/source/dbpilots/listcombowizard.hxx
+++ b/extensions/source/dbpilots/listcombowizard.hxx
@@ -68,7 +68,7 @@ namespace dbp
protected:
// OWizardMachine overridables
- virtual ::svt::OWizardPage* createPage( WizardState _nState ) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage( WizardState _nState ) SAL_OVERRIDE;
virtual WizardState determineNextState( WizardState _nCurrentState ) const SAL_OVERRIDE;
virtual void enterState( WizardState _nState ) SAL_OVERRIDE;
virtual bool leaveState( WizardState _nState ) SAL_OVERRIDE;
@@ -108,10 +108,12 @@ namespace dbp
class OContentTableSelection : public OLCPage
{
protected:
- ListBox *m_pSelectTable;
+ VclPtr<ListBox> m_pSelectTable;
public:
OContentTableSelection( OListComboWizard* _pParent );
+ virtual ~OContentTableSelection();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// TabPage overridables
@@ -133,13 +135,15 @@ namespace dbp
class OContentFieldSelection : public OLCPage
{
protected:
- ListBox *m_pSelectTableField;
- Edit *m_pDisplayedField;
- FixedText *m_pInfo;
+ VclPtr<ListBox> m_pSelectTableField;
+ VclPtr<Edit> m_pDisplayedField;
+ VclPtr<FixedText> m_pInfo;
public:
OContentFieldSelection( OListComboWizard* _pParent );
+ virtual ~OContentFieldSelection();
+ virtual void dispose() SAL_OVERRIDE;
protected:
DECL_LINK( OnFieldSelected, ListBox* );
@@ -160,12 +164,14 @@ namespace dbp
class OLinkFieldsPage : public OLCPage
{
protected:
- ComboBox *m_pValueListField;
- ComboBox *m_pTableField;
+ VclPtr<ComboBox> m_pValueListField;
+ VclPtr<ComboBox> m_pTableField;
public:
OLinkFieldsPage( OListComboWizard* _pParent );
+ virtual ~OLinkFieldsPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// TabPage overridables
diff --git a/extensions/source/dbpilots/unoautopilot.hxx b/extensions/source/dbpilots/unoautopilot.hxx
index c70597fca7d5..0e669efb8af9 100644
--- a/extensions/source/dbpilots/unoautopilot.hxx
+++ b/extensions/source/dbpilots/unoautopilot.hxx
@@ -85,7 +85,7 @@ namespace dbp
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void implInitialize(const com::sun::star::uno::Any& _rValue) SAL_OVERRIDE;
};
diff --git a/extensions/source/dbpilots/unoautopilot.inl b/extensions/source/dbpilots/unoautopilot.inl
index 77f3cf6e795d..55e5861f3595 100644
--- a/extensions/source/dbpilots/unoautopilot.inl
+++ b/extensions/source/dbpilots/unoautopilot.inl
@@ -96,9 +96,9 @@ template <class TYPE, class SERVICEINFO>
template <class TYPE, class SERVICEINFO>
-Dialog* OUnoAutoPilot<TYPE, SERVICEINFO>::createDialog(::vcl::Window* _pParent)
+VclPtr<Dialog> OUnoAutoPilot<TYPE, SERVICEINFO>::createDialog(::vcl::Window* _pParent)
{
- return new TYPE(_pParent, m_xObjectModel, m_aContext);
+ return VclPtr<TYPE>::Create(_pParent, m_xObjectModel, m_aContext);
}
diff --git a/extensions/source/plugin/base/plctrl.cxx b/extensions/source/plugin/base/plctrl.cxx
index 6ad9fdd5aa5b..4276ba98eb01 100644
--- a/extensions/source/plugin/base/plctrl.cxx
+++ b/extensions/source/plugin/base/plctrl.cxx
@@ -169,7 +169,7 @@ void PluginControl_Impl::createPeer( const Reference< ::com::sun::star::awt::XTo
vcl::Window* pImpl = VCLUnoHelper::GetWindow( xParentPeer );
if (pImpl)
{
- _pSysChild = new SystemChildWindow( pImpl, WB_CLIPCHILDREN );
+ _pSysChild = VclPtr<SystemChildWindow>::Create( pImpl, WB_CLIPCHILDREN );
if (pImpl->HasFocus())
_pSysChild->GrabFocus();
diff --git a/extensions/source/plugin/inc/plugin/plctrl.hxx b/extensions/source/plugin/inc/plugin/plctrl.hxx
index 0684a9a6fe20..2a0db6ff7bda 100644
--- a/extensions/source/plugin/inc/plugin/plctrl.hxx
+++ b/extensions/source/plugin/inc/plugin/plctrl.hxx
@@ -60,6 +60,7 @@
#include <com/sun/star/awt/PosSize.hpp>
#include <cppuhelper/implbase4.hxx>
+#include <vcl/vclptr.hxx>
#include <list>
@@ -152,9 +153,9 @@ protected:
protected:
::std::list< Reference< ::com::sun::star::lang::XEventListener > > _aDisposeListeners;
- MRCListenerMultiplexerHelper* _pMultiplexer;
+ MRCListenerMultiplexerHelper* _pMultiplexer;
- Reference< XInterface > _xContext;
+ Reference< XInterface > _xContext;
sal_Int32 _nX;
sal_Int32 _nY;
@@ -162,11 +163,11 @@ protected:
sal_Int32 _nHeight;
sal_Int16 _nFlags;
- bool _bVisible;
- bool _bInDesignMode;
- bool _bEnable;
+ bool _bVisible;
+ bool _bInDesignMode;
+ bool _bEnable;
- SystemChildWindow* _pSysChild;
+ VclPtr<SystemChildWindow> _pSysChild;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > _xPeer;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > _xPeerWindow;
diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx
index 8f7f24b9d5cd..7803b2951f20 100644
--- a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx
+++ b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx
@@ -103,9 +103,9 @@ namespace pcr
}
- Dialog* MasterDetailLinkDialog::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> MasterDetailLinkDialog::createDialog(vcl::Window* _pParent)
{
- return new FormLinkDialog(_pParent,m_xDetail,m_xMaster, m_aContext
+ return VclPtr<FormLinkDialog>::Create(_pParent,m_xDetail,m_xMaster, m_aContext
,m_sExplanation,m_sDetailLabel,m_sMasterLabel);
}
diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx
index 28a6ddfa7875..a00f852028b2 100644
--- a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx
+++ b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx
@@ -60,7 +60,7 @@ namespace pcr
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void implInitialize(const com::sun::star::uno::Any& _rValue) SAL_OVERRIDE;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xDetail;
diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx
index bd0b335f6af7..174c01eef667 100644
--- a/extensions/source/propctrlr/browserline.cxx
+++ b/extensions/source/propctrlr/browserline.cxx
@@ -55,7 +55,7 @@ namespace pcr
OBrowserLine::OBrowserLine( const OUString& _rEntryName, vcl::Window* pParent )
:m_sEntryName( _rEntryName )
- ,m_aFtTitle(pParent)
+ ,m_aFtTitle(VclPtr<FixedText>::Create(pParent))
,m_pControlWindow( NULL )
,m_pBrowseButton(NULL)
,m_pAdditionalBrowseButton( NULL )
@@ -66,7 +66,7 @@ namespace pcr
,m_bIndentTitle( false )
,m_bReadOnly( false )
{
- m_aFtTitle.Show();
+ m_aFtTitle->Show();
}
@@ -109,7 +109,7 @@ namespace pcr
void OBrowserLine::setControl( const Reference< XPropertyControl >& _rxControl )
{
m_xControl = _rxControl;
- m_pControlWindow = m_xControl.is() ? VCLUnoHelper::GetWindow( _rxControl->getControlWindow() ) : NULL;
+ m_pControlWindow = m_xControl.is() ? VCLUnoHelper::GetWindow( _rxControl->getControlWindow() ) : VclPtr<vcl::Window>();
DBG_ASSERT( m_pControlWindow, "OBrowserLine::setControl: setting NULL controls/windows is not allowed!" );
if ( m_pControlWindow )
@@ -123,7 +123,7 @@ namespace pcr
vcl::Window* OBrowserLine::GetRefWindow()
{
- vcl::Window* pRefWindow=&m_aFtTitle;
+ vcl::Window* pRefWindow = m_aFtTitle.get();
if(m_pBrowseButton)
{
@@ -139,9 +139,9 @@ namespace pcr
void OBrowserLine::SetTabOrder(vcl::Window* pRefWindow, sal_uInt16 nFlags )
{
- m_aFtTitle.SetZOrder(pRefWindow,nFlags);
+ m_aFtTitle->SetZOrder(pRefWindow,nFlags);
if ( m_pControlWindow )
- m_pControlWindow->SetZOrder( (vcl::Window*)&m_aFtTitle, WINDOW_ZORDER_BEHIND );
+ m_pControlWindow->SetZOrder( m_aFtTitle.get(), WINDOW_ZORDER_BEHIND );
if ( m_pBrowseButton && m_pControlWindow )
m_pBrowseButton->SetZOrder( m_pControlWindow, WINDOW_ZORDER_BEHIND );
@@ -185,7 +185,7 @@ namespace pcr
void OBrowserLine::Show(bool bFlag)
{
- m_aFtTitle.Show(bFlag);
+ m_aFtTitle->Show(bFlag);
if ( m_pControlWindow )
m_pControlWindow->Show( bFlag );
if ( m_pBrowseButton )
@@ -203,7 +203,7 @@ namespace pcr
bool OBrowserLine::IsVisible()
{
- return m_aFtTitle.IsVisible();
+ return m_aFtTitle->IsVisible();
}
@@ -219,7 +219,7 @@ namespace pcr
aTitlePos.X() += aIndent.Width();
aTitleSize.Width() -= aIndent.Width();
}
- m_aFtTitle.SetPosSizePixel( aTitlePos, aTitleSize );
+ m_aFtTitle->SetPosSizePixel( aTitlePos, aTitleSize );
}
sal_Int32 nBrowseButtonSize = m_aOutputSize.Height() - 4;
@@ -255,7 +255,7 @@ namespace pcr
if ( GetTitle() == _rNewTtile )
return;
// #99102# --------------
- m_aFtTitle.SetText( _rNewTtile );
+ m_aFtTitle->SetText( _rNewTtile );
if ( m_pControlWindow )
m_pControlWindow->SetAccessibleName( _rNewTtile );
if ( m_pBrowseButton )
@@ -268,7 +268,7 @@ namespace pcr
{
if( m_pTheParent )
{
- OUStringBuffer aText( m_aFtTitle.GetText() );
+ OUStringBuffer aText( m_aFtTitle->GetText() );
while( m_pTheParent->GetTextWidth( aText.toString() ) < m_nNameWidth )
aText.append("...........");
@@ -280,14 +280,14 @@ namespace pcr
aText.append( OUString(cRTL_mark) );
}
- m_aFtTitle.SetText( aText.makeStringAndClear() );
+ m_aFtTitle->SetText( aText.makeStringAndClear() );
}
}
OUString OBrowserLine::GetTitle() const
{
- OUString sDisplayName = m_aFtTitle.GetText();
+ OUString sDisplayName = m_aFtTitle->GetText();
// for Issue 69452
if (AllSettings::GetLayoutRTL())
@@ -341,7 +341,7 @@ namespace pcr
void OBrowserLine::implUpdateEnabledDisabled()
{
- implEnable( &m_aFtTitle, m_nEnableFlags, PropertyLineElement::CompleteLine );
+ implEnable( m_aFtTitle.get(), m_nEnableFlags, PropertyLineElement::CompleteLine );
if ( m_pControlWindow )
implEnable( m_pControlWindow, m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::InputControl );
@@ -376,11 +376,11 @@ namespace pcr
PushButton& OBrowserLine::impl_ensureButton( bool _bPrimary )
{
- PushButton*& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton;
+ VclPtr<PushButton>& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton;
if ( !rpButton )
{
- rpButton = new PushButton( m_pTheParent, WB_NOPOINTERFOCUS );
+ rpButton = VclPtr<PushButton>::Create( m_pTheParent, WB_NOPOINTERFOCUS );
rpButton->SetGetFocusHdl( LINK( this, OBrowserLine, OnButtonFocus ) );
rpButton->SetClickHdl( LINK( this, OBrowserLine, OnButtonClicked ) );
rpButton->SetText(OUString("..."));
@@ -443,13 +443,12 @@ namespace pcr
void OBrowserLine::implHideBrowseButton( bool _bPrimary, bool _bReLayout )
{
- PushButton*& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton;
+ VclPtr<PushButton>& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton;
if ( rpButton )
{
rpButton->Hide();
- delete rpButton;
- rpButton = NULL;
+ rpButton.disposeAndClear();
}
if ( _bReLayout )
diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx
index 1fa64a89a47c..9f39ec6277f3 100644
--- a/extensions/source/propctrlr/browserline.hxx
+++ b/extensions/source/propctrlr/browserline.hxx
@@ -50,17 +50,17 @@ namespace pcr
class OBrowserLine
{
private:
- OUString m_sEntryName;
- FixedText m_aFtTitle;
+ OUString m_sEntryName;
+ VclPtr<FixedText> m_aFtTitle;
Size m_aOutputSize;
Point m_aLinePos;
::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
m_xControl;
- vcl::Window* m_pControlWindow;
- PushButton* m_pBrowseButton;
- PushButton* m_pAdditionalBrowseButton;
+ VclPtr<vcl::Window> m_pControlWindow;
+ VclPtr<PushButton> m_pBrowseButton;
+ VclPtr<PushButton> m_pAdditionalBrowseButton;
IButtonClickListener* m_pClickListener;
- vcl::Window* m_pTheParent;
+ VclPtr<vcl::Window> m_pTheParent;
sal_uInt16 m_nNameWidth;
sal_uInt16 m_nEnableFlags;
bool m_bIndentTitle;
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index f31fd5de1a82..13b2df89e334 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -345,9 +345,9 @@ namespace pcr
OBrowserListBox::OBrowserListBox( vcl::Window* pParent, WinBits nWinStyle)
:Control(pParent, nWinStyle| WB_CLIPCHILDREN)
- ,m_aLinesPlayground(this,WB_DIALOGCONTROL | WB_CLIPCHILDREN)
- ,m_aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG)
- ,m_pHelpWindow( new InspectorHelpWindow( this ) )
+ ,m_aLinesPlayground(VclPtr<vcl::Window>::Create(this,WB_DIALOGCONTROL | WB_CLIPCHILDREN))
+ ,m_aVScroll(VclPtr<ScrollBar>::Create(this,WB_VSCROLL|WB_REPEAT|WB_DRAG))
+ ,m_pHelpWindow( VclPtr<InspectorHelpWindow>::Create( this ) )
,m_pLineListener(NULL)
,m_pControlObserver( NULL )
,m_nYOffset(0)
@@ -357,23 +357,27 @@ namespace pcr
,m_bUpdate(true)
,m_pControlContextImpl( new PropertyControlContext_Impl( *this ) )
{
-
- ListBox aListBox(this,WB_DROPDOWN);
- aListBox.SetPosSizePixel(Point(0,0),Size(100,100));
- m_nRowHeight = aListBox.GetSizePixel().Height()+2;
+ ScopedVclPtrInstance< ListBox > aListBox(this,WB_DROPDOWN);
+ aListBox->SetPosSizePixel(Point(0,0),Size(100,100));
+ m_nRowHeight = aListBox->GetSizePixel().Height()+2;
SetBackground( pParent->GetBackground() );
- m_aLinesPlayground.SetBackground( GetBackground() );
+ m_aLinesPlayground->SetBackground( GetBackground() );
- m_aLinesPlayground.SetPosPixel(Point(0,0));
- m_aLinesPlayground.SetPaintTransparent(true);
- m_aLinesPlayground.Show();
- m_aVScroll.Hide();
- m_aVScroll.SetScrollHdl(LINK(this, OBrowserListBox, ScrollHdl));
+ m_aLinesPlayground->SetPosPixel(Point(0,0));
+ m_aLinesPlayground->SetPaintTransparent(true);
+ m_aLinesPlayground->Show();
+ m_aVScroll->Hide();
+ m_aVScroll->SetScrollHdl(LINK(this, OBrowserListBox, ScrollHdl));
}
OBrowserListBox::~OBrowserListBox()
{
+ disposeOnce();
+ }
+
+ void OBrowserListBox::dispose()
+ {
OSL_ENSURE( !IsModified(), "OBrowserListBox::~OBrowserListBox: still modified - should have been committed before!" );
// doing the commit here, while we, as well as our owner, as well as some other components,
// are already "half dead" (means within their dtor) is potentially dangerous.
@@ -384,7 +388,10 @@ namespace pcr
Hide();
Clear();
-
+ m_aLinesPlayground.disposeAndClear();
+ m_aVScroll.disposeAndClear();
+ m_pHelpWindow.disposeAndClear();
+ Control::dispose();
}
@@ -425,7 +432,7 @@ namespace pcr
if (m_bIsActive)
{
// TODO: what's the sense of this?
- m_aVScroll.SetThumbPos(100);
+ m_aVScroll->SetThumbPos(100);
MoveThumbTo(0);
Resize();
}
@@ -452,31 +459,31 @@ namespace pcr
aLinesArea.Bottom() -= nHelpWindowHeight;
aLinesArea.Bottom() -= aHelpWindowDistance.Height();
}
- m_aLinesPlayground.SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() );
+ m_aLinesPlayground->SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() );
UpdateVScroll();
bool bNeedScrollbar = m_aLines.size() > (sal_uInt32)CalcVisibleLines();
if ( !bNeedScrollbar )
{
- if ( m_aVScroll.IsVisible() )
- m_aVScroll.Hide();
+ if ( m_aVScroll->IsVisible() )
+ m_aVScroll->Hide();
// scroll to top
m_nYOffset = 0;
- m_aVScroll.SetThumbPos( 0 );
+ m_aVScroll->SetThumbPos( 0 );
}
else
{
- Size aVScrollSize( m_aVScroll.GetSizePixel() );
+ Size aVScrollSize( m_aVScroll->GetSizePixel() );
// adjust the playground's width
aLinesArea.Right() -= aVScrollSize.Width();
- m_aLinesPlayground.SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() );
+ m_aLinesPlayground->SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() );
// position the scrollbar
aVScrollSize.Height() = aLinesArea.GetHeight();
Point aVScrollPos( aLinesArea.GetWidth(), 0 );
- m_aVScroll.SetPosSizePixel( aVScrollPos, aVScrollSize );
+ m_aVScroll->SetPosSizePixel( aVScrollPos, aVScrollSize );
}
for ( sal_uInt16 i = 0; i < m_aLines.size(); ++i )
@@ -489,7 +496,7 @@ namespace pcr
// show the scrollbar
if ( bNeedScrollbar )
- m_aVScroll.Show();
+ m_aVScroll->Show();
// position the help window
if ( bPositionHelpWindow )
@@ -543,7 +550,7 @@ namespace pcr
sal_uInt16 OBrowserListBox::CalcVisibleLines()
{
- Size aSize(m_aLinesPlayground.GetOutputSizePixel());
+ Size aSize(m_aLinesPlayground->GetOutputSizePixel());
sal_uInt16 nResult = 0;
if (0 != m_nRowHeight)
nResult = (sal_uInt16) aSize.Height()/m_nRowHeight;
@@ -555,18 +562,18 @@ namespace pcr
void OBrowserListBox::UpdateVScroll()
{
sal_uInt16 nLines = CalcVisibleLines();
- m_aVScroll.SetPageSize(nLines-1);
- m_aVScroll.SetVisibleSize(nLines-1);
+ m_aVScroll->SetPageSize(nLines-1);
+ m_aVScroll->SetVisibleSize(nLines-1);
size_t nCount = m_aLines.size();
if (nCount>0)
{
- m_aVScroll.SetRange(Range(0,nCount-1));
- m_nYOffset = -m_aVScroll.GetThumbPos()*m_nRowHeight;
+ m_aVScroll->SetRange(Range(0,nCount-1));
+ m_nYOffset = -m_aVScroll->GetThumbPos()*m_nRowHeight;
}
else
{
- m_aVScroll.SetRange(Range(0,0));
+ m_aVScroll->SetRange(Range(0,0));
m_nYOffset = 0;
}
}
@@ -574,7 +581,7 @@ namespace pcr
void OBrowserListBox::PositionLine( sal_uInt16 _nIndex )
{
- Size aSize(m_aLinesPlayground.GetOutputSizePixel());
+ Size aSize(m_aLinesPlayground->GetOutputSizePixel());
Point aPos(0, m_nYOffset);
aSize.Height() = m_nRowHeight;
@@ -612,7 +619,7 @@ namespace pcr
void OBrowserListBox::UpdatePlayGround()
{
- sal_Int32 nThumbPos = m_aVScroll.GetThumbPos();
+ sal_Int32 nThumbPos = m_aVScroll->GetThumbPos();
sal_Int32 nLines = CalcVisibleLines();
sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + nLines);
@@ -729,7 +736,7 @@ namespace pcr
sal_uInt16 OBrowserListBox::InsertEntry(const OLineDescriptor& _rPropertyData, sal_uInt16 _nPos)
{
// create a new line
- BrowserLinePointer pBrowserLine( new OBrowserLine( _rPropertyData.sName, &m_aLinesPlayground ) );
+ BrowserLinePointer pBrowserLine( new OBrowserLine( _rPropertyData.sName, m_aLinesPlayground.get() ) );
// check that the name is unique
ListBoxLines::iterator it = m_aLines.begin();
@@ -794,7 +801,7 @@ namespace pcr
{
if ( _nPos < m_aLines.size() )
{
- sal_Int32 nThumbPos = m_aVScroll.GetThumbPos();
+ sal_Int32 nThumbPos = m_aVScroll->GetThumbPos();
if (_nPos < nThumbPos)
MoveThumbTo(_nPos);
@@ -812,19 +819,19 @@ namespace pcr
void OBrowserListBox::MoveThumbTo(sal_Int32 _nNewThumbPos)
{
// disable painting to prevent flicker
- m_aLinesPlayground.EnablePaint(false);
+ m_aLinesPlayground->EnablePaint(false);
- sal_Int32 nDelta = _nNewThumbPos - m_aVScroll.GetThumbPos();
+ sal_Int32 nDelta = _nNewThumbPos - m_aVScroll->GetThumbPos();
// adjust the scrollbar
- m_aVScroll.SetThumbPos(_nNewThumbPos);
+ m_aVScroll->SetThumbPos(_nNewThumbPos);
sal_Int32 nThumbPos = _nNewThumbPos;
- m_nYOffset = -m_aVScroll.GetThumbPos() * m_nRowHeight;
+ m_nYOffset = -m_aVScroll->GetThumbPos() * m_nRowHeight;
sal_Int32 nLines = CalcVisibleLines();
sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + nLines);
- m_aLinesPlayground.Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN);
+ m_aLinesPlayground->Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN);
if (1 == nDelta)
{
@@ -841,27 +848,27 @@ namespace pcr
UpdatePlayGround();
}
- m_aLinesPlayground.EnablePaint(true);
- m_aLinesPlayground.Invalidate(INVALIDATE_CHILDREN);
+ m_aLinesPlayground->EnablePaint(true);
+ m_aLinesPlayground->Invalidate(INVALIDATE_CHILDREN);
}
IMPL_LINK(OBrowserListBox, ScrollHdl, ScrollBar*, _pScrollBar )
{
- DBG_ASSERT(_pScrollBar == &m_aVScroll, "OBrowserListBox::ScrollHdl: where does this come from?");
+ DBG_ASSERT(_pScrollBar == m_aVScroll.get(), "OBrowserListBox::ScrollHdl: where does this come from?");
(void)_pScrollBar;
// disable painting to prevent flicker
- m_aLinesPlayground.EnablePaint(false);
+ m_aLinesPlayground->EnablePaint(false);
- sal_Int32 nThumbPos = m_aVScroll.GetThumbPos();
+ sal_Int32 nThumbPos = m_aVScroll->GetThumbPos();
- sal_Int32 nDelta = m_aVScroll.GetDelta();
+ sal_Int32 nDelta = m_aVScroll->GetDelta();
m_nYOffset = -nThumbPos * m_nRowHeight;
sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + CalcVisibleLines());
- m_aLinesPlayground.Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN);
+ m_aLinesPlayground->Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN);
if (1 == nDelta)
{
@@ -872,12 +879,12 @@ namespace pcr
{
PositionLine((sal_uInt16)nThumbPos);
}
- else if (nDelta!=0 || m_aVScroll.GetType() == SCROLL_DONTKNOW)
+ else if (nDelta!=0 || m_aVScroll->GetType() == SCROLL_DONTKNOW)
{
UpdatePlayGround();
}
- m_aLinesPlayground.EnablePaint(true);
+ m_aLinesPlayground->EnablePaint(true);
return 0;
}
@@ -1129,7 +1136,7 @@ namespace pcr
rLine.pLine->SetTitle(_rPropertyData.DisplayName);
rLine.xHandler = _rPropertyData.xPropertyHandler;
- sal_uInt16 nTextWidth = (sal_uInt16)m_aLinesPlayground.GetTextWidth(_rPropertyData.DisplayName);
+ sal_uInt16 nTextWidth = (sal_uInt16)m_aLinesPlayground->GetTextWidth(_rPropertyData.DisplayName);
if (m_nTheNameSize< nTextWidth)
m_nTheNameSize = nTextWidth;
@@ -1216,21 +1223,21 @@ namespace pcr
break;
long nScrollOffset = 0;
- if ( m_aVScroll.IsVisible() )
+ if ( m_aVScroll->IsVisible() )
{
if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP )
- nScrollOffset = -m_aVScroll.GetPageSize();
+ nScrollOffset = -m_aVScroll->GetPageSize();
else if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN )
- nScrollOffset = m_aVScroll.GetPageSize();
+ nScrollOffset = m_aVScroll->GetPageSize();
}
if ( nScrollOffset )
{
- long nNewThumbPos = m_aVScroll.GetThumbPos() + nScrollOffset;
- nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll.GetRangeMin() );
- nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll.GetRangeMax() );
- m_aVScroll.DoScroll( nNewThumbPos );
- nNewThumbPos = m_aVScroll.GetThumbPos();
+ long nNewThumbPos = m_aVScroll->GetThumbPos() + nScrollOffset;
+ nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll->GetRangeMin() );
+ nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll->GetRangeMax() );
+ m_aVScroll->DoScroll( nNewThumbPos );
+ nNewThumbPos = m_aVScroll->GetThumbPos();
sal_uInt16 nFocusControlPos = 0;
sal_uInt16 nActiveControlPos = impl_getControlPos( m_xActiveControl );
@@ -1271,9 +1278,9 @@ namespace pcr
)
{
// interested in scroll events if we have a scrollbar
- if ( m_aVScroll.IsVisible() )
+ if ( m_aVScroll->IsVisible() )
{
- HandleScrollCommand( *pCommand, NULL, &m_aVScroll );
+ HandleScrollCommand( *pCommand, NULL, m_aVScroll.get() );
}
}
}
diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx
index 3b50d467c943..f8b3c754839f 100644
--- a/extensions/source/propctrlr/browserlistbox.hxx
+++ b/extensions/source/propctrlr/browserlistbox.hxx
@@ -93,10 +93,9 @@ namespace pcr
,public PcrClient
{
protected:
- Window m_aLinesPlayground;
- ScrollBar m_aVScroll;
- ::std::unique_ptr< InspectorHelpWindow >
- m_pHelpWindow;
+ VclPtr<Window> m_aLinesPlayground;
+ VclPtr<ScrollBar> m_aVScroll;
+ VclPtr<InspectorHelpWindow> m_pHelpWindow;
ListBoxLines m_aLines;
IPropertyLineListener* m_pLineListener;
IPropertyControlObserver* m_pControlObserver;
@@ -125,6 +124,7 @@ namespace pcr
OBrowserListBox( vcl::Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL );
virtual ~OBrowserListBox();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateAll();
diff --git a/extensions/source/propctrlr/browserpage.cxx b/extensions/source/propctrlr/browserpage.cxx
index 2e733a9ed727..dfb0236317fd 100644
--- a/extensions/source/propctrlr/browserpage.cxx
+++ b/extensions/source/propctrlr/browserpage.cxx
@@ -35,25 +35,31 @@ namespace pcr
OBrowserPage::OBrowserPage(vcl::Window* pParent,WinBits nWinStyle)
:TabPage(pParent,nWinStyle)
- ,m_aListBox(this)
+ ,m_aListBox(VclPtr<OBrowserListBox>::Create(this))
{
- m_aListBox.SetBackground(GetBackground());
- m_aListBox.SetPaintTransparent( true );
- m_aListBox.Show();
+ m_aListBox->SetBackground(GetBackground());
+ m_aListBox->SetPaintTransparent( true );
+ m_aListBox->Show();
}
OBrowserPage::~OBrowserPage()
{
+ disposeOnce();
}
+ void OBrowserPage::dispose()
+ {
+ m_aListBox.disposeAndClear();
+ TabPage::dispose();
+ }
void OBrowserPage::Resize()
{
Size aSize( GetOutputSizePixel() );
aSize.Width() -= LAYOUT_BORDER_LEFT + LAYOUT_BORDER_RIGHT;
aSize.Height() -= LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM;
- m_aListBox.SetPosSizePixel( Point( LAYOUT_BORDER_LEFT, LAYOUT_BORDER_TOP ), aSize );
+ m_aListBox->SetPosSizePixel( Point( LAYOUT_BORDER_LEFT, LAYOUT_BORDER_TOP ), aSize );
}
@@ -65,19 +71,19 @@ namespace pcr
{
Window::StateChanged( nType);
if (StateChangedType::VISIBLE == nType)
- m_aListBox.ActivateListBox(IsVisible());
+ m_aListBox->ActivateListBox(IsVisible());
}
sal_Int32 OBrowserPage::getMinimumWidth()
{
- return m_aListBox.GetMinimumWidth() + LAYOUT_BORDER_LEFT + LAYOUT_BORDER_RIGHT;
+ return m_aListBox->GetMinimumWidth() + LAYOUT_BORDER_LEFT + LAYOUT_BORDER_RIGHT;
}
sal_Int32 OBrowserPage::getMinimumHeight()
{
- return m_aListBox.GetMinimumHeight() + LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM;
+ return m_aListBox->GetMinimumHeight() + LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM;
}
diff --git a/extensions/source/propctrlr/browserpage.hxx b/extensions/source/propctrlr/browserpage.hxx
index 6ef6ef80bce9..8ce0b50cd8fe 100644
--- a/extensions/source/propctrlr/browserpage.hxx
+++ b/extensions/source/propctrlr/browserpage.hxx
@@ -34,7 +34,7 @@ namespace pcr
class OBrowserPage : public TabPage
{
private:
- OBrowserListBox m_aListBox;
+ VclPtr<OBrowserListBox> m_aListBox;
protected:
virtual void Resize() SAL_OVERRIDE;
@@ -43,12 +43,13 @@ namespace pcr
public:
OBrowserPage(vcl::Window* pParent, WinBits nWinStyle = 0);
virtual ~OBrowserPage();
+ virtual void dispose() SAL_OVERRIDE;
sal_Int32 getMinimumWidth();
sal_Int32 getMinimumHeight();
- OBrowserListBox& getListBox() { return m_aListBox; }
- const OBrowserListBox& getListBox() const { return m_aListBox; }
+ OBrowserListBox& getListBox() { return *m_aListBox.get(); }
+ const OBrowserListBox& getListBox() const { return *m_aListBox.get(); }
};
diff --git a/extensions/source/propctrlr/browserview.cxx b/extensions/source/propctrlr/browserview.cxx
index 4179cbe8e3ed..ab512b46eccc 100644
--- a/extensions/source/propctrlr/browserview.cxx
+++ b/extensions/source/propctrlr/browserview.cxx
@@ -21,6 +21,7 @@
#include "propertyeditor.hxx"
#include "propctrlr.hrc"
#include <boost/scoped_ptr.hpp>
+#include <vcl/tabpage.hxx>
namespace pcr
{
@@ -34,7 +35,7 @@ namespace pcr
:Window(_pParent, nBits | WB_3DLOOK)
,m_nActivePage(0)
{
- m_pPropBox = new OPropertyEditor( this );
+ m_pPropBox = VclPtr<OPropertyEditor>::Create( this );
m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR);
m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation));
@@ -53,15 +54,19 @@ namespace pcr
OPropertyBrowserView::~OPropertyBrowserView()
{
+ disposeOnce();
+ }
+
+ void OPropertyBrowserView::dispose()
+ {
if(m_pPropBox)
{
sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
if (nTmpPage)
m_nActivePage = nTmpPage;
- boost::scoped_ptr<vcl::Window> aTemp(m_pPropBox);
- m_pPropBox = NULL;
}
-
+ m_pPropBox.disposeAndClear();
+ vcl::Window::dispose();
}
diff --git a/extensions/source/propctrlr/browserview.hxx b/extensions/source/propctrlr/browserview.hxx
index c87dd55b3c0a..9ae97d364295 100644
--- a/extensions/source/propctrlr/browserview.hxx
+++ b/extensions/source/propctrlr/browserview.hxx
@@ -37,7 +37,7 @@ namespace pcr
class OPropertyBrowserView : public vcl::Window
{
- OPropertyEditor* m_pPropBox;
+ VclPtr<OPropertyEditor> m_pPropBox;
sal_uInt16 m_nActivePage;
Link m_aPageActivationHandler;
@@ -50,6 +50,7 @@ namespace pcr
OPropertyBrowserView( vcl::Window* pParent, WinBits nBits = 0);
virtual ~OPropertyBrowserView();
+ virtual void dispose() SAL_OVERRIDE;
OPropertyEditor& getPropertyBox() { return *m_pPropBox; }
diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx
index ac33ace00daa..e337ccf7a0dc 100644
--- a/extensions/source/propctrlr/commoncontrol.cxx
+++ b/extensions/source/propctrlr/commoncontrol.cxx
@@ -47,7 +47,7 @@ namespace pcr
,m_pModifyListener( _pModifyListener )
,m_bModified( false )
{
- DBG_ASSERT( m_pControlWindow != NULL, "ControlHelper::ControlHelper: invalid window!" );
+ DBG_ASSERT( m_pControlWindow != nullptr, "ControlHelper::ControlHelper: invalid window!" );
}
@@ -55,11 +55,6 @@ namespace pcr
{
}
-
-
-
-
-
void SAL_CALL ControlHelper::setControlContext( const Reference< XPropertyControlContext >& _controlcontext ) throw (RuntimeException)
{
m_xContext = _controlcontext;
@@ -93,7 +88,7 @@ namespace pcr
void SAL_CALL ControlHelper::dispose()
{
- DELETEZ( m_pControlWindow );
+ m_pControlWindow.disposeAndClear();
}
@@ -103,9 +98,9 @@ namespace pcr
if ( !m_pControlWindow )
return;
- ComboBox aComboBox(m_pControlWindow, WB_DROPDOWN);
- aComboBox.SetPosSizePixel(Point(0,0), Size(100,100));
- m_pControlWindow->SetSizePixel(aComboBox.GetSizePixel());
+ ScopedVclPtrInstance< ComboBox > aComboBox(m_pControlWindow, WB_DROPDOWN);
+ aComboBox->SetPosSizePixel(Point(0,0), Size(100,100));
+ m_pControlWindow->SetSizePixel(aComboBox->GetSizePixel());
// TODO/UNOize: why do the controls this themselves? Shouldn't this be the task
// of the browser listbox/line?
diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx
index 629660eda8d7..cbe825f32156 100644
--- a/extensions/source/propctrlr/commoncontrol.hxx
+++ b/extensions/source/propctrlr/commoncontrol.hxx
@@ -86,7 +86,7 @@ namespace pcr
class ControlHelper
{
private:
- vcl::Window* m_pControlWindow;
+ VclPtr<vcl::Window> m_pControlWindow;
sal_Int16 m_nControlType;
::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlContext >
m_xContext;
diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx
index 675f2aa74739..54ae2733d633 100644
--- a/extensions/source/propctrlr/controlfontdialog.cxx
+++ b/extensions/source/propctrlr/controlfontdialog.cxx
@@ -141,7 +141,7 @@ namespace pcr
}
- Dialog* OControlFontDialog::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> OControlFontDialog::createDialog(vcl::Window* _pParent)
{
ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults);
@@ -152,8 +152,7 @@ namespace pcr
// sets a new introspectee and re-executes us. In this case, the dialog returned here (upon the first
// execute) will be re-used upon the second execute, and thus it won't be initialized correctly.
- ControlCharacterDialog* pDialog = new ControlCharacterDialog(_pParent, *m_pFontItems);
- return pDialog;
+ return VclPtr<ControlCharacterDialog>::Create(_pParent, *m_pFontItems);
}
@@ -169,7 +168,7 @@ namespace pcr
OSL_ENSURE(m_pDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!");
if (m_pDialog && (RET_OK == _nExecutionResult) && m_xControlModel.is())
{
- const SfxItemSet* pOutput = static_cast<ControlCharacterDialog*>(m_pDialog)->GetOutputItemSet();
+ const SfxItemSet* pOutput = static_cast<ControlCharacterDialog*>(m_pDialog.get())->GetOutputItemSet();
if (pOutput)
ControlCharacterDialog::translateItemsToProperties( *pOutput, m_xControlModel );
}
diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx
index 3df0b46fcdc5..e9d30f4c67d0 100644
--- a/extensions/source/propctrlr/controlfontdialog.hxx
+++ b/extensions/source/propctrlr/controlfontdialog.hxx
@@ -82,7 +82,7 @@ namespace pcr
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void destroyDialog() SAL_OVERRIDE;
virtual void executedDialog(sal_Int16 _nExecutionResult) SAL_OVERRIDE;
};
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index e45398145741..a13fd939a3dc 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2608,9 +2608,9 @@ namespace pcr
OSL_PRECOND( m_pInfoService.get(), "FormComponentPropertyHandler::impl_dialogListSelection_nothrow: no property meta data!" );
OUString sPropertyUIName( m_pInfoService->getPropertyTranslation( m_pInfoService->getPropertyId( _rProperty ) ) );
- ListSelectionDialog aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, _rProperty, sPropertyUIName );
+ ScopedVclPtrInstance< ListSelectionDialog > aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, _rProperty, sPropertyUIName );
_rClearBeforeDialog.clear();
- return ( RET_OK == aDialog.Execute() );
+ return ( RET_OK == aDialog->Execute() );
}
@@ -2685,9 +2685,9 @@ namespace pcr
return false;
- FormLinkDialog aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, xMasterProp, m_xContext );
+ ScopedVclPtrInstance< FormLinkDialog > aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, xMasterProp, m_xContext );
_rClearBeforeDialog.clear();
- return ( RET_OK == aDialog.Execute() );
+ return ( RET_OK == aDialog->Execute() );
}
@@ -2722,9 +2722,8 @@ namespace pcr
aCoreSet.Put( aFormatter );
// a tab dialog with a single page
- boost::scoped_ptr< SfxSingleTabDialog > xDialog(new SfxSingleTabDialog(
- impl_getDefaultDialogParent_nothrow(), aCoreSet,
- "FormatNumberDialog", "cui/ui/formatnumberdialog.ui"));
+ ScopedVclPtrInstance< SfxSingleTabDialog > xDialog( impl_getDefaultDialogParent_nothrow(), aCoreSet,
+ "FormatNumberDialog", "cui/ui/formatnumberdialog.ui");
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT( pFact, "CreateFactory fail!" );
::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );
@@ -2871,11 +2870,11 @@ namespace pcr
{ // do this in an own block. The dialog needs to be destroyed before we call
// destroyItemSet
- ControlCharacterDialog aDlg( impl_getDefaultDialogParent_nothrow(), *pSet );
+ ScopedVclPtrInstance< ControlCharacterDialog > aDlg( impl_getDefaultDialogParent_nothrow(), *pSet );
_rClearBeforeDialog.clear();
- if ( RET_OK == aDlg.Execute() )
+ if ( RET_OK == aDlg->Execute() )
{
- const SfxItemSet* pOut = aDlg.GetOutputItemSet();
+ const SfxItemSet* pOut = aDlg->GetOutputItemSet();
if ( pOut )
{
Sequence< NamedValue > aFontPropertyValues;
@@ -2942,11 +2941,11 @@ namespace pcr
bool FormComponentPropertyHandler::impl_dialogChooseLabelControl_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
{
- OSelectLabelDialog dlgSelectLabel( impl_getDefaultDialogParent_nothrow(), m_xComponent );
+ ScopedVclPtrInstance< OSelectLabelDialog > dlgSelectLabel( impl_getDefaultDialogParent_nothrow(), m_xComponent );
_rClearBeforeDialog.clear();
- bool bSuccess = ( RET_OK == dlgSelectLabel.Execute() );
+ bool bSuccess = ( RET_OK == dlgSelectLabel->Execute() );
if ( bSuccess )
- _out_rNewValue <<= dlgSelectLabel.GetSelected();
+ _out_rNewValue <<= dlgSelectLabel->GetSelected();
return bSuccess;
}
@@ -2965,14 +2964,14 @@ namespace pcr
OSL_PRECOND( impl_getContextControlContainer_nothrow().is(), "FormComponentPropertyHandler::impl_dialogChangeTabOrder_nothrow: invalid control context!" );
Reference< XTabControllerModel > xTabControllerModel( impl_getRowSet_nothrow(), UNO_QUERY );
- TabOrderDialog aDialog(
+ ScopedVclPtrInstance<TabOrderDialog> aDialog(
impl_getDefaultDialogParent_nothrow(),
xTabControllerModel,
impl_getContextControlContainer_nothrow(),
m_xContext
);
_rClearBeforeDialog.clear();
- return ( RET_OK == aDialog.Execute() );
+ return ( RET_OK == aDialog->Execute() );
}
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index 3a7d97003c6d..3689a775c961 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -65,13 +65,15 @@ namespace pcr
class FieldLinkRow : public TabPage
{
private:
- ComboBox* m_pDetailColumn;
- ComboBox* m_pMasterColumn;
+ VclPtr<ComboBox> m_pDetailColumn;
+ VclPtr<ComboBox> m_pMasterColumn;
Link m_aLinkChangeHandler;
public:
FieldLinkRow( vcl::Window* _pParent );
+ virtual ~FieldLinkRow();
+ virtual void dispose() SAL_OVERRIDE;
inline void SetLinkChangeHandler( const Link& _rHdl ) { m_aLinkChangeHandler = _rHdl; }
@@ -106,6 +108,17 @@ namespace pcr
m_pMasterColumn->SetModifyHdl( LINK( this, FieldLinkRow, OnFieldNameChanged ) );
}
+ FieldLinkRow::~FieldLinkRow()
+ {
+ disposeOnce();
+ }
+
+ void FieldLinkRow::dispose()
+ {
+ m_pDetailColumn.clear();
+ m_pMasterColumn.clear();
+ TabPage::dispose();
+ }
void FieldLinkRow::fillList( LinkParticipant _eWhich, const Sequence< OUString >& _rFieldNames )
{
@@ -156,10 +169,10 @@ namespace pcr
const OUString& _sDetailLabel,
const OUString& _sMasterLabel)
:ModalDialog( _pParent, "FormLinks", "modules/spropctrlr/ui/formlinksdialog.ui" )
- ,m_aRow1 ( new FieldLinkRow( get<VclVBox>("box") ) )
- ,m_aRow2 ( new FieldLinkRow( get<VclVBox>("box") ) )
- ,m_aRow3 ( new FieldLinkRow( get<VclVBox>("box") ) )
- ,m_aRow4 ( new FieldLinkRow( get<VclVBox>("box") ) )
+ ,m_aRow1 ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) )
+ ,m_aRow2 ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) )
+ ,m_aRow3 ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) )
+ ,m_aRow4 ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) )
,m_xContext ( _rxContext )
,m_xDetailForm( _rxDetailForm )
,m_xMasterForm( _rxMasterForm )
@@ -194,8 +207,24 @@ namespace pcr
FormLinkDialog::~FormLinkDialog( )
{
+ disposeOnce();
}
+ void FormLinkDialog::dispose( )
+ {
+ m_pExplanation.clear();
+ m_pDetailLabel.clear();
+ m_pMasterLabel.clear();
+ m_pOK.clear();
+ m_pSuggest.clear();
+
+ m_aRow1.disposeAndClear();
+ m_aRow2.disposeAndClear();
+ m_aRow3.disposeAndClear();
+ m_aRow4.disposeAndClear();
+
+ ModalDialog::dispose();
+ }
void FormLinkDialog::commitLinkPairs()
{
diff --git a/extensions/source/propctrlr/formlinkdialog.hxx b/extensions/source/propctrlr/formlinkdialog.hxx
index 6dd94e915dd4..9ce65e8377ce 100644
--- a/extensions/source/propctrlr/formlinkdialog.hxx
+++ b/extensions/source/propctrlr/formlinkdialog.hxx
@@ -44,15 +44,15 @@ namespace pcr
class FormLinkDialog : public ModalDialog
{
private:
- FixedText* m_pExplanation;
- FixedText* m_pDetailLabel;
- FixedText* m_pMasterLabel;
- ::std::unique_ptr< FieldLinkRow > m_aRow1;
- ::std::unique_ptr< FieldLinkRow > m_aRow2;
- ::std::unique_ptr< FieldLinkRow > m_aRow3;
- ::std::unique_ptr< FieldLinkRow > m_aRow4;
- OKButton* m_pOK;
- PushButton* m_pSuggest;
+ VclPtr<FixedText> m_pExplanation;
+ VclPtr<FixedText> m_pDetailLabel;
+ VclPtr<FixedText> m_pMasterLabel;
+ VclPtr<FieldLinkRow> m_aRow1;
+ VclPtr<FieldLinkRow> m_aRow2;
+ VclPtr<FieldLinkRow> m_aRow3;
+ VclPtr<FieldLinkRow> m_aRow4;
+ VclPtr<OKButton> m_pOK;
+ VclPtr<PushButton> m_pSuggest;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
m_xContext;
@@ -80,6 +80,7 @@ namespace pcr
const OUString& _sMasterLabel = OUString()
);
virtual ~FormLinkDialog( );
+ virtual void dispose() SAL_OVERRIDE;
// Dialog overridables
virtual short Execute() SAL_OVERRIDE;
diff --git a/extensions/source/propctrlr/inspectorhelpwindow.cxx b/extensions/source/propctrlr/inspectorhelpwindow.cxx
index b62010cf6cd9..b174b69bd6c2 100644
--- a/extensions/source/propctrlr/inspectorhelpwindow.cxx
+++ b/extensions/source/propctrlr/inspectorhelpwindow.cxx
@@ -29,27 +29,38 @@ namespace pcr
InspectorHelpWindow::InspectorHelpWindow( vcl::Window* _pParent )
:Window( _pParent, WB_DIALOGCONTROL )
- ,m_aSeparator( this )
- ,m_aHelpText( this, WB_LEFT | WB_READONLY | WB_AUTOVSCROLL )
+ ,m_aSeparator( VclPtr<FixedLine>::Create(this) )
+ ,m_aHelpText( VclPtr<MultiLineEdit>::Create(this, WB_LEFT | WB_READONLY | WB_AUTOVSCROLL) )
,m_nMinLines( 3 )
,m_nMaxLines( 8 )
{
SetBackground();
SetPaintTransparent(true);
- m_aSeparator.SetText( PcrRes(RID_STR_HELP_SECTION_LABEL).toString() );
- m_aSeparator.SetBackground();
- m_aSeparator.Show();
-
- m_aHelpText.SetControlBackground( /*m_aSeparator.GetBackground().GetColor() */);
- m_aHelpText.SetBackground();
- m_aHelpText.SetPaintTransparent(true);
- m_aHelpText.Show();
+ m_aSeparator->SetText( PcrRes(RID_STR_HELP_SECTION_LABEL).toString() );
+ m_aSeparator->SetBackground();
+ m_aSeparator->Show();
+
+ m_aHelpText->SetControlBackground( /*m_aSeparator->GetBackground().GetColor() */);
+ m_aHelpText->SetBackground();
+ m_aHelpText->SetPaintTransparent(true);
+ m_aHelpText->Show();
}
+ InspectorHelpWindow::~InspectorHelpWindow()
+ {
+ disposeOnce();
+ }
+
+ void InspectorHelpWindow::dispose()
+ {
+ m_aSeparator.disposeAndClear();
+ m_aHelpText.disposeAndClear();
+ vcl::Window::dispose();
+ }
void InspectorHelpWindow::SetText( const OUString& _rStr )
{
- m_aHelpText.SetText( _rStr );
+ m_aHelpText->SetText( _rStr );
}
@@ -63,7 +74,7 @@ namespace pcr
long InspectorHelpWindow::impl_getHelpTextBorderHeight()
{
sal_Int32 nTop(0), nBottom(0), nDummy(0);
- m_aHelpText.GetBorder( nDummy, nTop, nDummy, nBottom );
+ m_aHelpText->GetBorder( nDummy, nTop, nDummy, nBottom );
return nTop + nBottom;
}
@@ -84,13 +95,13 @@ namespace pcr
long InspectorHelpWindow::impl_getMinimalTextWindowHeight()
{
- return impl_getHelpTextBorderHeight() + m_aHelpText.GetTextHeight() * m_nMinLines;
+ return impl_getHelpTextBorderHeight() + m_aHelpText->GetTextHeight() * m_nMinLines;
}
long InspectorHelpWindow::impl_getMaximalTextWindowHeight()
{
- return impl_getHelpTextBorderHeight() + m_aHelpText.GetTextHeight() * m_nMaxLines;
+ return impl_getHelpTextBorderHeight() + m_aHelpText->GetTextHeight() * m_nMaxLines;
}
@@ -100,8 +111,8 @@ namespace pcr
long nMinTextWindowHeight = impl_getMinimalTextWindowHeight();
long nMaxTextWindowHeight = impl_getMaximalTextWindowHeight();
- Rectangle aTextRect( Point( 0, 0 ), m_aHelpText.GetOutputSizePixel() );
- aTextRect = m_aHelpText.GetTextRect( aTextRect, m_aHelpText.GetText(),
+ Rectangle aTextRect( Point( 0, 0 ), m_aHelpText->GetOutputSizePixel() );
+ aTextRect = m_aHelpText->GetTextRect( aTextRect, m_aHelpText->GetText(),
TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
long nActTextWindowHeight = impl_getHelpTextBorderHeight() + aTextRect.GetHeight();
@@ -120,11 +131,11 @@ namespace pcr
Rectangle aSeparatorArea( aPlayground );
aSeparatorArea.Bottom() = aSeparatorArea.Top() + LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height();
- m_aSeparator.SetPosSizePixel( aSeparatorArea.TopLeft(), aSeparatorArea.GetSize() );
+ m_aSeparator->SetPosSizePixel( aSeparatorArea.TopLeft(), aSeparatorArea.GetSize() );
Rectangle aTextArea( aPlayground );
aTextArea.Top() = aSeparatorArea.Bottom() + a3AppFont.Height();
- m_aHelpText.SetPosSizePixel( aTextArea.TopLeft(), aTextArea.GetSize() );
+ m_aHelpText->SetPosSizePixel( aTextArea.TopLeft(), aTextArea.GetSize() );
}
diff --git a/extensions/source/propctrlr/inspectorhelpwindow.hxx b/extensions/source/propctrlr/inspectorhelpwindow.hxx
index 9419a72ec7a9..0159cff96ca6 100644
--- a/extensions/source/propctrlr/inspectorhelpwindow.hxx
+++ b/extensions/source/propctrlr/inspectorhelpwindow.hxx
@@ -33,14 +33,16 @@ namespace pcr
class InspectorHelpWindow : public vcl::Window
{
private:
- FixedLine m_aSeparator;
- MultiLineEdit m_aHelpText;
+ VclPtr<FixedLine> m_aSeparator;
+ VclPtr<MultiLineEdit> m_aHelpText;
sal_Int32 m_nMinLines;
sal_Int32 m_nMaxLines;
public:
InspectorHelpWindow( vcl::Window* _pParent );
+ virtual ~InspectorHelpWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
diff --git a/extensions/source/propctrlr/listselectiondlg.cxx b/extensions/source/propctrlr/listselectiondlg.cxx
index fdb6229dc370..9b2bbedcb368 100644
--- a/extensions/source/propctrlr/listselectiondlg.cxx
+++ b/extensions/source/propctrlr/listselectiondlg.cxx
@@ -48,6 +48,17 @@ namespace pcr
initialize( );
}
+ ListSelectionDialog::~ListSelectionDialog()
+ {
+ disposeOnce();
+ }
+
+ void ListSelectionDialog::dispose()
+ {
+ m_pEntries.clear();
+ ModalDialog::dispose();
+ }
+
short ListSelectionDialog::Execute()
{
short nResult = ModalDialog::Execute();
diff --git a/extensions/source/propctrlr/listselectiondlg.hxx b/extensions/source/propctrlr/listselectiondlg.hxx
index aaccb0754ec2..ca9a118c06f9 100644
--- a/extensions/source/propctrlr/listselectiondlg.hxx
+++ b/extensions/source/propctrlr/listselectiondlg.hxx
@@ -31,7 +31,7 @@ namespace pcr
class ListSelectionDialog : public ModalDialog
{
private:
- ListBox* m_pEntries;
+ VclPtr<ListBox> m_pEntries;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
m_xListBox;
@@ -44,6 +44,8 @@ namespace pcr
const OUString& _rPropertyName,
const OUString& _rPropertyUIName
);
+ virtual ~ListSelectionDialog();
+ virtual void dispose() SAL_OVERRIDE;
// Dialog overridables
virtual short Execute() SAL_OVERRIDE;
diff --git a/extensions/source/propctrlr/newdatatype.cxx b/extensions/source/propctrlr/newdatatype.cxx
index 62cc6da9c247..50f85e22489b 100644
--- a/extensions/source/propctrlr/newdatatype.cxx
+++ b/extensions/source/propctrlr/newdatatype.cxx
@@ -67,6 +67,17 @@ namespace pcr
OnNameModified( NULL );
}
+ NewDataTypeDialog::~NewDataTypeDialog()
+ {
+ disposeOnce();
+ }
+
+ void NewDataTypeDialog::dispose()
+ {
+ m_pName.clear();
+ m_pOK.clear();
+ ModalDialog::dispose();
+ }
IMPL_LINK( NewDataTypeDialog, OnNameModified, void*, /*_pNotInterestedIn*/ )
{
diff --git a/extensions/source/propctrlr/newdatatype.hxx b/extensions/source/propctrlr/newdatatype.hxx
index 135514aaa271..abccb19bd1f9 100644
--- a/extensions/source/propctrlr/newdatatype.hxx
+++ b/extensions/source/propctrlr/newdatatype.hxx
@@ -35,14 +35,16 @@ namespace pcr
class NewDataTypeDialog : public ModalDialog
{
private:
- Edit* m_pName;
- OKButton* m_pOK;
+ VclPtr<Edit> m_pName;
+ VclPtr<OKButton> m_pOK;
::std::set< OUString > m_aProhibitedNames;
public:
NewDataTypeDialog(vcl::Window* _pParent, const OUString& _rNameBase,
const ::std::vector< OUString >& _rProhibitedNames );
+ virtual ~NewDataTypeDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetName() const { return m_pName->GetText(); }
diff --git a/extensions/source/propctrlr/pcrunodialogs.cxx b/extensions/source/propctrlr/pcrunodialogs.cxx
index 2f2d56086fb6..98c4b49ad590 100644
--- a/extensions/source/propctrlr/pcrunodialogs.cxx
+++ b/extensions/source/propctrlr/pcrunodialogs.cxx
@@ -130,9 +130,9 @@ namespace pcr
}
- Dialog* OTabOrderDialog::createDialog( vcl::Window* _pParent )
+ VclPtr<Dialog> OTabOrderDialog::createDialog( vcl::Window* _pParent )
{
- return new TabOrderDialog( _pParent, m_xTabbingModel, m_xControlContext, m_aContext );
+ return VclPtr<TabOrderDialog>::Create( _pParent, m_xTabbingModel, m_xControlContext, m_aContext );
}
void OTabOrderDialog::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException, std::exception)
diff --git a/extensions/source/propctrlr/pcrunodialogs.hxx b/extensions/source/propctrlr/pcrunodialogs.hxx
index e0e6e4325e22..35663f1e6b7b 100644
--- a/extensions/source/propctrlr/pcrunodialogs.hxx
+++ b/extensions/source/propctrlr/pcrunodialogs.hxx
@@ -78,7 +78,7 @@ namespace pcr
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
};
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index 77b518878526..dc85415a63fa 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -44,6 +44,7 @@
#include <comphelper/property.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/tabpage.hxx>
#include <osl/mutex.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/component_context.hxx>
@@ -374,7 +375,7 @@ namespace pcr
// announcement is responsible for calling setComponent, too.
Reference< XWindow > xContainerWindow = m_xFrame->getContainerWindow();
VCLXWindow* pContainerWindow = VCLXWindow::GetImplementation(xContainerWindow);
- vcl::Window* pParentWin = pContainerWindow ? pContainerWindow->GetWindow() : NULL;
+ VclPtr<vcl::Window> pParentWin = pContainerWindow ? pContainerWindow->GetWindow() : VclPtr<vcl::Window>();
if (!pParentWin)
throw RuntimeException("The frame is invalid. Unable to extract the container window.",*this);
@@ -702,7 +703,7 @@ namespace pcr
DBG_ASSERT(!haveView(), "OPropertyBrowserController::Construct: already have a view!");
DBG_ASSERT(_pParentWin, "OPropertyBrowserController::Construct: invalid parent window!");
- m_pView = new OPropertyBrowserView(_pParentWin);
+ m_pView = VclPtr<OPropertyBrowserView>::Create(_pParentWin);
m_pView->setPageActivationHandler(LINK(this, OPropertyBrowserController, OnPageActivation));
// add as dispose listener for our view. The view is disposed by the frame we're plugged into,
diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx
index af943de01f13..f204a86c8735 100644
--- a/extensions/source/propctrlr/propcontroller.hxx
+++ b/extensions/source/propctrlr/propcontroller.hxx
@@ -105,7 +105,7 @@ namespace pcr
::cppu::OInterfaceContainerHelper m_aDisposeListeners;
::cppu::OInterfaceContainerHelper m_aControlObservers;
// meta data about the properties
- OPropertyBrowserView* m_pView;
+ VclPtr<OPropertyBrowserView> m_pView;
OUString m_sPageSelection;
OUString m_sLastValidPageSelection;
@@ -242,7 +242,7 @@ namespace pcr
// stop the inspection
void stopInspection( bool _bCommitModified );
- bool haveView() const { return NULL != m_pView; }
+ bool haveView() const { return nullptr != m_pView; }
OPropertyEditor& getPropertyBox() { return m_pView->getPropertyBox(); }
// does the inspection of the objects as indicated by our model
diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx
index 5fcafaf92c64..daa9e8c965f6 100644
--- a/extensions/source/propctrlr/propertyeditor.cxx
+++ b/extensions/source/propctrlr/propertyeditor.cxx
@@ -43,7 +43,7 @@ namespace pcr
OPropertyEditor::OPropertyEditor( vcl::Window* pParent, WinBits nWinStyle)
:Control(pParent, nWinStyle)
- ,m_aTabControl( this )
+ ,m_aTabControl( VclPtr<TabControl>::Create(this) )
,m_pListener(NULL)
,m_pObserver(NULL)
,m_nNextId(1)
@@ -52,37 +52,44 @@ namespace pcr
,m_nMaxHelpLines( 0 )
{
- m_aTabControl.Show();
- m_aTabControl.SetDeactivatePageHdl(LINK(this, OPropertyEditor, OnPageDeactivate));
- m_aTabControl.SetActivatePageHdl(LINK(this, OPropertyEditor, OnPageActivate));
- m_aTabControl.SetBackground(GetBackground());
- m_aTabControl.SetPaintTransparent(true);
+ m_aTabControl->Show();
+ m_aTabControl->SetDeactivatePageHdl(LINK(this, OPropertyEditor, OnPageDeactivate));
+ m_aTabControl->SetActivatePageHdl(LINK(this, OPropertyEditor, OnPageActivate));
+ m_aTabControl->SetBackground(GetBackground());
+ m_aTabControl->SetPaintTransparent(true);
}
OPropertyEditor::~OPropertyEditor()
{
+ disposeOnce();
+ }
+
+ void OPropertyEditor::dispose()
+ {
Hide();
ClearAll();
+ m_aTabControl.disposeAndClear();
+ Control::dispose();
}
void OPropertyEditor::ClearAll()
{
m_nNextId=1;
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for(long i = nCount-1; i >= 0; --i)
{
- sal_uInt16 nID = m_aTabControl.GetPageId((sal_uInt16)i);
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
+ sal_uInt16 nID = m_aTabControl->GetPageId((sal_uInt16)i);
+ VclPtr<OBrowserPage> pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
if (pPage)
{
pPage->EnableInput(false);
- m_aTabControl.RemovePage(nID);
- delete pPage;
+ m_aTabControl->RemovePage(nID);
+ pPage.disposeAndClear();
}
}
- m_aTabControl.Clear();
+ m_aTabControl->Clear();
{
MapStringToPageId aEmpty;
@@ -91,9 +98,10 @@ namespace pcr
while ( !m_aHiddenPages.empty() )
{
- delete m_aHiddenPages.begin()->second.pPage;
+ m_aHiddenPages.begin()->second.pPage.disposeAndClear();
m_aHiddenPages.erase( m_aHiddenPages.begin() );
}
+ m_aHiddenPages.clear();
}
@@ -101,16 +109,16 @@ namespace pcr
{
sal_Int32 nMinHeight( LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM );
- if ( m_aTabControl.GetPageCount() > 0 )
+ if ( m_aTabControl->GetPageCount() > 0 )
{
- sal_uInt16 nFirstID = m_aTabControl.GetPageId( 0 );
+ sal_uInt16 nFirstID = m_aTabControl->GetPageId( 0 );
// reserve space for the tabs themself
- Rectangle aTabArea( m_aTabControl.GetTabBounds( nFirstID ) );
+ Rectangle aTabArea( m_aTabControl->GetTabBounds( nFirstID ) );
nMinHeight += aTabArea.GetHeight();
// ask the page how much it requires
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nFirstID ) );
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( nFirstID ) );
if ( pPage )
nMinHeight += pPage->getMinimumHeight();
}
@@ -123,12 +131,12 @@ namespace pcr
sal_Int32 OPropertyEditor::getMinimumWidth()
{
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
sal_Int32 nPageMinWidth = 0;
for(long i = nCount-1; i >= 0; --i)
{
- sal_uInt16 nID = m_aTabControl.GetPageId((sal_uInt16)i);
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
+ sal_uInt16 nID = m_aTabControl->GetPageId((sal_uInt16)i);
+ OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
if (pPage)
{
sal_Int32 nCurPageMinWidth = pPage->getMinimumWidth();
@@ -144,11 +152,11 @@ namespace pcr
{
// commit all of my pages, if necessary
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- sal_uInt16 nID = m_aTabControl.GetPageId( i );
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nID ) );
+ sal_uInt16 nID = m_aTabControl->GetPageId( i );
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( nID ) );
if ( pPage && pPage->getListBox().IsModified() )
pPage->getListBox().CommitModified();
@@ -158,7 +166,7 @@ namespace pcr
void OPropertyEditor::GetFocus()
{
- m_aTabControl.GrabFocus();
+ m_aTabControl->GrabFocus();
}
@@ -167,7 +175,7 @@ namespace pcr
OBrowserPage* pPage = NULL;
MapStringToPageId::const_iterator aPropertyPageIdPos = m_aPropertyPageIds.find( _rPropertyName );
if ( aPropertyPageIdPos != m_aPropertyPageIds.end() )
- pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( aPropertyPageIdPos->second ) );
+ pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( aPropertyPageIdPos->second ) );
return pPage;
}
@@ -180,7 +188,7 @@ namespace pcr
OBrowserPage* OPropertyEditor::getPage( sal_uInt16& _rPageId )
{
- return static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( _rPageId ) );
+ return static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( _rPageId ) );
}
@@ -201,7 +209,7 @@ namespace pcr
);
Rectangle aTabArea( aPlayground );
- m_aTabControl.SetPosSizePixel( aTabArea.TopLeft(), aTabArea.GetSize() );
+ m_aTabControl->SetPosSizePixel( aTabArea.TopLeft(), aTabArea.GetSize() );
}
@@ -210,13 +218,13 @@ namespace pcr
// obtain a new id
sal_uInt16 nId = m_nNextId++;
// insert the id
- m_aTabControl.InsertPage(nId, _rText);
+ m_aTabControl->InsertPage(nId, _rText);
// create a new page
- OBrowserPage* pPage = new OBrowserPage(&m_aTabControl);
+ VclPtrInstance<OBrowserPage> pPage(m_aTabControl.get());
pPage->SetText( _rText );
// some knittings
- pPage->SetSizePixel(m_aTabControl.GetTabPageSizePixel());
+ pPage->SetSizePixel(m_aTabControl->GetTabPageSizePixel());
pPage->getListBox().SetListener(m_pListener);
pPage->getListBox().SetObserver(m_pObserver);
pPage->getListBox().EnableHelpSection( m_bHasHelpSection );
@@ -224,8 +232,8 @@ namespace pcr
pPage->SetHelpId( _rHelpId );
// immediately activate the page
- m_aTabControl.SetTabPage(nId, pPage);
- m_aTabControl.SetCurPageId(nId);
+ m_aTabControl->SetTabPage(nId, pPage);
+ m_aTabControl->SetCurPageId(nId);
return nId;
}
@@ -234,32 +242,31 @@ namespace pcr
void OPropertyEditor::SetHelpId( const OString& rHelpId )
{
Control::SetHelpId("");
- m_aTabControl.SetHelpId(rHelpId);
+ m_aTabControl->SetHelpId(rHelpId);
}
void OPropertyEditor::RemovePage(sal_uInt16 nID)
{
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
+ VclPtr<OBrowserPage> pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
if (pPage)
pPage->EnableInput(false);
- m_aTabControl.RemovePage(nID);
- if (pPage)
- delete pPage;
+ m_aTabControl->RemovePage(nID);
+ pPage.disposeAndClear();
}
void OPropertyEditor::SetPage(sal_uInt16 nId)
{
- m_aTabControl.SetCurPageId(nId);
+ m_aTabControl->SetCurPageId(nId);
}
sal_uInt16 OPropertyEditor::GetCurPage()
{
- if(m_aTabControl.GetPageCount()>0)
- return m_aTabControl.GetCurPageId();
+ if(m_aTabControl->GetPageCount()>0)
+ return m_aTabControl->GetCurPageId();
else
return 0;
}
@@ -268,11 +275,11 @@ namespace pcr
void OPropertyEditor::Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction)
{
// forward this to all our pages
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for (sal_uInt16 i=0;i<nCount;++i)
{
- sal_uInt16 nID = m_aTabControl.GetPageId(i);
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
+ sal_uInt16 nID = m_aTabControl->GetPageId(i);
+ OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
if (pPage)
_aUpdateFunction(&pPage->getListBox());
}
@@ -291,11 +298,11 @@ namespace pcr
void OPropertyEditor::forEachPage( PageOperation _pOperation, const void* _pArgument )
{
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- sal_uInt16 nID = m_aTabControl.GetPageId(i);
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nID ) );
+ sal_uInt16 nID = m_aTabControl->GetPageId(i);
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( nID ) );
if ( !pPage )
continue;
(this->*_pOperation)( *pPage, _pArgument );
@@ -340,11 +347,11 @@ namespace pcr
void OPropertyEditor::SetHelpText( const OUString& _rHelpText )
{
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- sal_uInt16 nID = m_aTabControl.GetPageId(i);
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nID ) );
+ sal_uInt16 nID = m_aTabControl->GetPageId(i);
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( nID ) );
if ( !pPage )
continue;
setHelpSectionText( *pPage, &_rHelpText );
@@ -445,13 +452,13 @@ namespace pcr
{
if ( !_bShow )
{
- sal_uInt16 nPagePos = m_aTabControl.GetPagePos( _nPageId );
+ sal_uInt16 nPagePos = m_aTabControl->GetPagePos( _nPageId );
if ( TAB_PAGE_NOTFOUND == nPagePos )
return;
DBG_ASSERT( m_aHiddenPages.find( _nPageId ) == m_aHiddenPages.end(), "OPropertyEditor::ShowPropertyPage: page already hidden!" );
- m_aHiddenPages[ _nPageId ] = HiddenPage( nPagePos, m_aTabControl.GetTabPage( _nPageId ) );
- m_aTabControl.RemovePage( _nPageId );
+ m_aHiddenPages[ _nPageId ] = HiddenPage( nPagePos, m_aTabControl->GetTabPage( _nPageId ) );
+ m_aTabControl->RemovePage( _nPageId );
}
else
{
@@ -459,9 +466,9 @@ namespace pcr
if ( aPagePos == m_aHiddenPages.end() )
return;
- aPagePos->second.pPage->SetSizePixel( m_aTabControl.GetTabPageSizePixel() );
- m_aTabControl.InsertPage( aPagePos->first, aPagePos->second.pPage->GetText(), aPagePos->second.nPos );
- m_aTabControl.SetTabPage( aPagePos->first, aPagePos->second.pPage );
+ aPagePos->second.pPage->SetSizePixel( m_aTabControl->GetTabPageSizePixel() );
+ m_aTabControl->InsertPage( aPagePos->first, aPagePos->second.pPage->GetText(), aPagePos->second.nPos );
+ m_aTabControl->SetTabPage( aPagePos->first, aPagePos->second.pPage );
m_aHiddenPages.erase( aPagePos );
}
@@ -470,9 +477,9 @@ namespace pcr
void OPropertyEditor::EnablePropertyControls( const OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable )
{
- for ( sal_uInt16 i = 0; i < m_aTabControl.GetPageCount(); ++i )
+ for ( sal_uInt16 i = 0; i < m_aTabControl->GetPageCount(); ++i )
{
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( m_aTabControl.GetPageId( i ) ) );
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( m_aTabControl->GetPageId( i ) ) );
if ( pPage )
pPage->getListBox().EnablePropertyControls( _rEntryName, _nControls, _bEnable );
}
@@ -481,9 +488,9 @@ namespace pcr
void OPropertyEditor::EnablePropertyLine( const OUString& _rEntryName, bool _bEnable )
{
- for ( sal_uInt16 i = 0; i < m_aTabControl.GetPageCount(); ++i )
+ for ( sal_uInt16 i = 0; i < m_aTabControl->GetPageCount(); ++i )
{
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( m_aTabControl.GetPageId( i ) ) );
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( m_aTabControl->GetPageId( i ) ) );
if ( pPage )
pPage->getListBox().EnablePropertyLine( _rEntryName, _bEnable );
}
@@ -494,7 +501,7 @@ namespace pcr
{
Reference< XPropertyControl > xControl;
// let the current page handle this
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(m_aTabControl.GetCurPageId()));
+ OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(m_aTabControl->GetCurPageId()));
if (pPage)
xControl = pPage->getListBox().GetPropertyControl(rEntryName);
return xControl;
@@ -513,8 +520,8 @@ namespace pcr
{
// commit the data on the current (to-be-decativated) tab page
// (79404)
- sal_Int32 nCurrentId = m_aTabControl.GetCurPageId();
- OBrowserPage* pCurrentPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage((sal_uInt16)nCurrentId));
+ sal_Int32 nCurrentId = m_aTabControl->GetCurPageId();
+ OBrowserPage* pCurrentPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage((sal_uInt16)nCurrentId));
if ( !pCurrentPage )
return 1L;
diff --git a/extensions/source/propctrlr/propertyeditor.hxx b/extensions/source/propctrlr/propertyeditor.hxx
index 18861826ed7a..3a868386d7b0 100644
--- a/extensions/source/propctrlr/propertyeditor.hxx
+++ b/extensions/source/propctrlr/propertyeditor.hxx
@@ -24,13 +24,13 @@
#include <com/sun/star/inspection/XPropertyControl.hpp>
#include <vcl/tabctrl.hxx>
+#include <vcl/vclptr.hxx>
+#include <boost/mem_fn.hpp>
#include <map>
-
namespace pcr
{
-
class IPropertyLineListener;
class IPropertyControlObserver;
class OBrowserPage;
@@ -47,13 +47,13 @@ namespace pcr
struct HiddenPage
{
sal_uInt16 nPos;
- TabPage* pPage;
+ VclPtr<TabPage> pPage;
HiddenPage() : nPos( 0 ), pPage( NULL ) { }
HiddenPage( sal_uInt16 _nPos, TabPage* _pPage ) : nPos( _nPos ), pPage( _pPage ) { }
};
private:
- TabControl m_aTabControl;
+ VclPtr<TabControl> m_aTabControl;
IPropertyLineListener* m_pListener;
IPropertyControlObserver* m_pObserver;
sal_uInt16 m_nNextId;
@@ -73,6 +73,7 @@ namespace pcr
OPropertyEditor (vcl::Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL);
virtual ~OPropertyEditor();
+ virtual void dispose() SAL_OVERRIDE;
void EnableUpdate();
void DisableUpdate();
diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx
index 27ed6d5d1799..43f372deecc1 100644
--- a/extensions/source/propctrlr/selectlabeldialog.cxx
+++ b/extensions/source/propctrlr/selectlabeldialog.cxx
@@ -145,6 +145,11 @@ namespace pcr
OSelectLabelDialog::~OSelectLabelDialog()
{
+ disposeOnce();
+ }
+
+ void OSelectLabelDialog::dispose()
+ {
// delete the entry datas of the listbox entries
SvTreeListEntry* pLoop = m_pControlTree->First();
while (pLoop)
@@ -154,7 +159,10 @@ namespace pcr
delete static_cast<Reference< XPropertySet > *>(pData);
pLoop = m_pControlTree->Next(pLoop);
}
-
+ m_pMainDesc.clear();
+ m_pControlTree.clear();
+ m_pNoAssignment.clear();
+ ModalDialog::dispose();
}
sal_Int32 OSelectLabelDialog::InsertEntries(const Reference< XInterface > & _xContainer, SvTreeListEntry* pContainerEntry)
diff --git a/extensions/source/propctrlr/selectlabeldialog.hxx b/extensions/source/propctrlr/selectlabeldialog.hxx
index abb138248f97..45144c646738 100644
--- a/extensions/source/propctrlr/selectlabeldialog.hxx
+++ b/extensions/source/propctrlr/selectlabeldialog.hxx
@@ -40,9 +40,9 @@ namespace pcr
:public ModalDialog
,public PcrClient
{
- FixedText *m_pMainDesc;
- SvTreeListBox *m_pControlTree;
- CheckBox *m_pNoAssignment;
+ VclPtr<FixedText> m_pMainDesc;
+ VclPtr<SvTreeListBox> m_pControlTree;
+ VclPtr<CheckBox> m_pNoAssignment;
ImageList m_aModelImages;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xControlModel;
@@ -58,6 +58,7 @@ namespace pcr
public:
OSelectLabelDialog(vcl::Window* pParent, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xControlModel);
virtual ~OSelectLabelDialog();
+ virtual void dispose() SAL_OVERRIDE;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetSelected() const { return m_pNoAssignment->IsChecked() ? ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > () : m_xSelectedControl; }
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index af4d001dc784..240b3f51131c 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -959,14 +959,16 @@ namespace pcr
class OMultilineFloatingEdit : public FloatingWindow
{
private:
- MultiLineEdit m_aImplEdit;
+ VclPtr<MultiLineEdit> m_aImplEdit;
protected:
virtual void Resize() SAL_OVERRIDE;
public:
OMultilineFloatingEdit(vcl::Window* _pParen);
- MultiLineEdit& getEdit() { return m_aImplEdit; }
+ virtual ~OMultilineFloatingEdit();
+ virtual void dispose() SAL_OVERRIDE;
+ MultiLineEdit& getEdit() { return *m_aImplEdit.get(); }
protected:
virtual bool PreNotify(NotifyEvent& _rNEvt) SAL_OVERRIDE;
@@ -975,15 +977,25 @@ namespace pcr
OMultilineFloatingEdit::OMultilineFloatingEdit(vcl::Window* _pParent)
:FloatingWindow(_pParent, WB_BORDER)
- ,m_aImplEdit(this, WB_VSCROLL|WB_IGNORETAB|WB_NOBORDER)
+ ,m_aImplEdit(VclPtr<MultiLineEdit>::Create(this, WB_VSCROLL|WB_IGNORETAB|WB_NOBORDER))
{
- m_aImplEdit.Show();
+ m_aImplEdit->Show();
}
+ OMultilineFloatingEdit::~OMultilineFloatingEdit()
+ {
+ disposeOnce();
+ }
+
+ void OMultilineFloatingEdit::dispose()
+ {
+ m_aImplEdit.disposeAndClear();
+ FloatingWindow::dispose();
+ }
void OMultilineFloatingEdit::Resize()
{
- m_aImplEdit.SetSizePixel(GetOutputSizePixel());
+ m_aImplEdit->SetSizePixel(GetOutputSizePixel());
}
@@ -1023,26 +1035,25 @@ namespace pcr
DropDownEditControl::DropDownEditControl( vcl::Window* _pParent, WinBits _nStyle )
:DropDownEditControl_Base( _pParent, _nStyle )
,m_pFloatingEdit( NULL )
- ,m_pImplEdit( NULL )
,m_pDropdownButton( NULL )
,m_nOperationMode( eStringList )
,m_bDropdown( false )
{
SetCompoundControl( true );
- m_pImplEdit = new MultiLineEdit( this, WB_TABSTOP | WB_IGNORETAB | WB_NOBORDER | (_nStyle & WB_READONLY) );
+ m_pImplEdit = VclPtr<MultiLineEdit>::Create( this, WB_TABSTOP | WB_IGNORETAB | WB_NOBORDER | (_nStyle & WB_READONLY) );
SetSubEdit( m_pImplEdit );
m_pImplEdit->Show();
if ( _nStyle & WB_DROPDOWN )
{
- m_pDropdownButton = new PushButton( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP);
+ m_pDropdownButton = VclPtr<PushButton>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP);
m_pDropdownButton->SetSymbol(SymbolType::SPIN_DOWN);
m_pDropdownButton->SetClickHdl( LINK( this, DropDownEditControl, DropDownHdl ) );
m_pDropdownButton->Show();
}
- m_pFloatingEdit = new OMultilineFloatingEdit(this); //FloatingWindow
+ m_pFloatingEdit = VclPtr<OMultilineFloatingEdit>::Create(this);
m_pFloatingEdit->SetPopupModeEndHdl( LINK( this, DropDownEditControl, ReturnHdl ) );
m_pFloatingEdit->getEdit().SetReadOnly( ( _nStyle & WB_READONLY ) != 0 );
@@ -1061,19 +1072,16 @@ namespace pcr
DropDownEditControl::~DropDownEditControl()
{
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pFloatingEdit);
- m_pFloatingEdit = NULL;
- }
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pImplEdit);
- SetSubEdit( NULL );
- m_pImplEdit = NULL;
- }
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pDropdownButton);
- m_pDropdownButton = NULL;
- }
+ disposeOnce();
+ }
+
+ void DropDownEditControl::dispose()
+ {
+ SetSubEdit(nullptr);
+ m_pImplEdit.disposeAndClear();
+ m_pFloatingEdit.disposeAndClear();
+ m_pDropdownButton.disposeAndClear();
+ DropDownEditControl_Base::dispose();
}
@@ -1081,7 +1089,7 @@ namespace pcr
{
::Size aOutSz = GetOutputSizePixel();
- if (m_pDropdownButton!=NULL)
+ if (m_pDropdownButton!=nullptr)
{
long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
nSBWidth = CalcZoom( nSBWidth );
@@ -1106,7 +1114,7 @@ namespace pcr
{
if ( m_pHelper )
{
- m_pHelper->LoseFocusHdl( m_pImplEdit );
+ m_pHelper->LoseFocusHdl( m_pImplEdit.get() );
m_pHelper->activateNextControl();
}
}
diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx
index 8c80714bc3d5..9eb99354abda 100644
--- a/extensions/source/propctrlr/standardcontrol.hxx
+++ b/extensions/source/propctrlr/standardcontrol.hxx
@@ -374,15 +374,16 @@ namespace pcr
class DropDownEditControl : public DropDownEditControl_Base
{
private:
- OMultilineFloatingEdit* m_pFloatingEdit;
- MultiLineEdit* m_pImplEdit;
- PushButton* m_pDropdownButton;
+ VclPtr<OMultilineFloatingEdit> m_pFloatingEdit;
+ VclPtr<MultiLineEdit> m_pImplEdit;
+ VclPtr<PushButton> m_pDropdownButton;
MultiLineOperationMode m_nOperationMode;
bool m_bDropdown : 1;
public:
DropDownEditControl( vcl::Window* _pParent, WinBits _nStyle );
virtual ~DropDownEditControl();
+ virtual void dispose() SAL_OVERRIDE;
void setOperationMode( MultiLineOperationMode _eMode ) { m_nOperationMode = _eMode; }
MultiLineOperationMode getOperationMode() const { return m_nOperationMode; }
diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx
index 8c64920aad01..8189fca44a92 100644
--- a/extensions/source/propctrlr/taborder.cxx
+++ b/extensions/source/propctrlr/taborder.cxx
@@ -118,10 +118,20 @@ namespace pcr
TabOrderDialog::~TabOrderDialog()
{
+ disposeOnce();
+ }
+
+ void TabOrderDialog::dispose()
+ {
m_pLB_Controls->Hide();
// delete pLB_Controls;
delete pImageList;
-
+ m_pLB_Controls.clear();
+ m_pPB_OK.clear();
+ m_pPB_MoveUp.clear();
+ m_pPB_MoveDown.clear();
+ m_pPB_AutoOrder.clear();
+ ModalDialog::dispose();
}
diff --git a/extensions/source/propctrlr/taborder.hxx b/extensions/source/propctrlr/taborder.hxx
index d70e60cce47f..f56d4b45bc01 100644
--- a/extensions/source/propctrlr/taborder.hxx
+++ b/extensions/source/propctrlr/taborder.hxx
@@ -73,13 +73,13 @@ namespace pcr
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
m_xORB;
- TabOrderListBox* m_pLB_Controls;
+ VclPtr<TabOrderListBox> m_pLB_Controls;
- OKButton* m_pPB_OK;
+ VclPtr<OKButton> m_pPB_OK;
- PushButton* m_pPB_MoveUp;
- PushButton* m_pPB_MoveDown;
- PushButton* m_pPB_AutoOrder;
+ VclPtr<PushButton> m_pPB_MoveUp;
+ VclPtr<PushButton> m_pPB_MoveDown;
+ VclPtr<PushButton> m_pPB_AutoOrder;
ImageList* pImageList;
@@ -102,6 +102,7 @@ namespace pcr
);
virtual ~TabOrderDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetModified();
};
diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx
index 99df0140e250..5d01cc891db5 100644
--- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx
+++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx
@@ -496,11 +496,11 @@ namespace pcr
::std::vector< OUString > aExistentNames;
m_pHelper->getAvailableDataTypeNames( aExistentNames );
- NewDataTypeDialog aDialog( NULL, pType->getName(), aExistentNames ); // TODO/eForms: proper parent
- if ( aDialog.Execute() != RET_OK )
+ ScopedVclPtrInstance<NewDataTypeDialog> aDialog( nullptr, pType->getName(), aExistentNames ); // TODO/eForms: proper parent
+ if ( aDialog->Execute() != RET_OK )
return false;
- _rNewName = aDialog.GetName();
+ _rNewName = aDialog->GetName();
return true;
}
@@ -535,8 +535,8 @@ namespace pcr
// confirmation message
OUString sConfirmation( PcrRes( RID_STR_CONFIRM_DELETE_DATA_TYPE ).toString() );
sConfirmation = sConfirmation.replaceFirst( "#type#", pType->getName() );
- QueryBox aQuery( NULL, WB_YES_NO, sConfirmation ); // TODO/eForms: proper parent
- if ( aQuery.Execute() != RET_YES )
+ ScopedVclPtrInstance<QueryBox> aQuery( nullptr, WB_YES_NO, sConfirmation ); // TODO/eForms: proper parent
+ if ( aQuery->Execute() != RET_YES )
return false;
return true;
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 1056a1474c9b..346715b4bc28 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -120,6 +120,7 @@ public:
GridWindow(vcl::Window* pParent);
void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap);
virtual ~GridWindow();
+ virtual void dispose() SAL_OVERRIDE;
void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
@@ -212,9 +213,29 @@ GridDialog::GridDialog(double* pXValues, double* pYValues, int nValues, vcl::Win
m_pResetButton->SetClickHdl( LINK( this, GridDialog, ClickButtonHdl ) );
}
+GridDialog::~GridDialog()
+{
+ disposeOnce();
+}
+
+void GridDialog::dispose()
+{
+ m_pOKButton.clear();
+ m_pResetTypeBox.clear();
+ m_pResetButton.clear();
+ m_pGridWindow.clear();
+ ModalDialog::dispose();
+}
+
GridWindow::~GridWindow()
{
+ disposeOnce();
+}
+
+void GridWindow::dispose()
+{
delete [] m_pNewYValues;
+ vcl::Window::dispose();
}
double GridWindow::findMinX()
diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx
index 6fca647facd5..940dec60097e 100644
--- a/extensions/source/scanner/grid.hxx
+++ b/extensions/source/scanner/grid.hxx
@@ -37,19 +37,20 @@ enum resetType
class GridDialog : public ModalDialog
{
- OKButton* m_pOKButton;
+ VclPtr<OKButton> m_pOKButton;
- ListBox* m_pResetTypeBox;
- PushButton* m_pResetButton;
+ VclPtr<ListBox> m_pResetTypeBox;
+ VclPtr<PushButton> m_pResetButton;
- GridWindow* m_pGridWindow;
+ VclPtr<GridWindow> m_pGridWindow;
DECL_LINK( ClickButtonHdl, Button* );
public:
GridDialog(double* pXValues, double* pYValues, int nValues,
vcl::Window* pParent, bool bCutValues = true);
-
+ virtual ~GridDialog();
+ virtual void dispose() SAL_OVERRIDE;
void setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY);
double* getNewYValues();
};
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index ae9c4d5cc00d..384be4d3371d 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -43,7 +43,7 @@ private:
Rectangle maPreviewRect;
Point maTopLeft, maBottomRight;
Point maMinTopLeft, maMaxBottomRight;
- SaneDlg* mpParentDialog;
+ VclPtr<SaneDlg> mpParentDialog;
DragDirection meDragDirection;
bool mbDragEnable;
bool mbDragDrawn;
@@ -61,6 +61,12 @@ public:
, mbIsDragging(false)
{
}
+ virtual ~ScanPreview() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ mpParentDialog.clear();
+ vcl::Window::dispose();
+ }
void Init(SaneDlg *pParent)
{
mpParentDialog = pParent;
@@ -151,8 +157,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScanPreview(vcl::Windo
OString sBorder = VclBuilder::extractCustomProperty(rMap);
if (!sBorder.isEmpty())
nWinStyle |= WB_BORDER;
- ScanPreview *pWindow = new ScanPreview(pParent, nWinStyle);
- return pWindow;
+ return new ScanPreview(pParent, nWinStyle);
}
SaneDlg::SaneDlg( vcl::Window* pParent, Sane& rSane, bool bScanEnabled ) :
@@ -239,7 +244,37 @@ SaneDlg::SaneDlg( vcl::Window* pParent, Sane& rSane, bool bScanEnabled ) :
SaneDlg::~SaneDlg()
{
+ disposeOnce();
+}
+
+void SaneDlg::dispose()
+{
mrSane.SetReloadOptionsHdl( maOldLink );
+ mpOKButton.clear();
+ mpCancelButton.clear();
+ mpDeviceInfoButton.clear();
+ mpPreviewButton.clear();
+ mpScanButton.clear();
+ mpButtonOption.clear();
+ mpOptionTitle.clear();
+ mpOptionDescTxt.clear();
+ mpVectorTxt.clear();
+ mpLeftField.clear();
+ mpTopField.clear();
+ mpRightField.clear();
+ mpBottomField.clear();
+ mpDeviceBox.clear();
+ mpReslBox.clear();
+ mpAdvancedBox.clear();
+ mpVectorBox.clear();
+ mpQuantumRangeBox.clear();
+ mpStringRangeBox.clear();
+ mpBoolCheckBox.clear();
+ mpStringEdit.clear();
+ mpNumericEdit.clear();
+ mpOptionBox.clear();
+ mpPreview.clear();
+ ModalDialog::dispose();
}
namespace {
@@ -256,8 +291,8 @@ short SaneDlg::Execute()
{
if( ! Sane::IsSane() )
{
- MessageDialog aErrorBox(NULL, SaneResId(STR_COULD_NOT_BE_INIT));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SaneResId(STR_COULD_NOT_BE_INIT));
+ aErrorBox->Execute();
return RET_CANCEL;
}
LoadState();
@@ -539,8 +574,8 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
aString = aString.replaceFirst( "%s", Sane::GetVendor( mrSane.GetDeviceNumber() ) );
aString = aString.replaceFirst( "%s", Sane::GetModel( mrSane.GetDeviceNumber() ) );
aString = aString.replaceFirst( "%s", Sane::GetType( mrSane.GetDeviceNumber() ) );
- MessageDialog aInfoBox(this, aString, VCL_MESSAGE_INFO);
- aInfoBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aInfoBox(this, aString, VCL_MESSAGE_INFO);
+ aInfoBox->Execute();
}
else if( pButton == mpPreviewButton )
AcquirePreview();
@@ -568,11 +603,11 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
x[ i ] = (double)i;
mrSane.GetOptionValue( mnCurrentOption, y.get() );
- GridDialog aGrid( x.get(), y.get(), nElements, this );
- aGrid.SetText( mrSane.GetOptionName( mnCurrentOption ) );
- aGrid.setBoundings( 0, mfMin, nElements, mfMax );
- if( aGrid.Execute() && aGrid.getNewYValues() )
- mrSane.SetOptionValue( mnCurrentOption, aGrid.getNewYValues() );
+ ScopedVclPtrInstance< GridDialog > aGrid( x.get(), y.get(), nElements, this );
+ aGrid->SetText( mrSane.GetOptionName( mnCurrentOption ) );
+ aGrid->setBoundings( 0, mfMin, nElements, mfMax );
+ if( aGrid->Execute() && aGrid->getNewYValues() )
+ mrSane.SetOptionValue( mnCurrentOption, aGrid->getNewYValues() );
}
break;
case SANE_TYPE_BOOL:
@@ -820,8 +855,8 @@ void SaneDlg::AcquirePreview()
if( nOption == -1 )
{
OUString aString(SaneResId(STR_SLOW_PREVIEW));
- MessageDialog aBox(this, aString, VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
- if (aBox.Execute() == RET_CANCEL)
+ ScopedVclPtrInstance< MessageDialog > aBox(this, aString, VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
+ if (aBox->Execute() == RET_CANCEL)
return;
}
else
@@ -830,8 +865,8 @@ void SaneDlg::AcquirePreview()
BitmapTransporter aTransporter;
if( ! mrSane.Start( aTransporter ) )
{
- MessageDialog aErrorBox(this, SaneResId(STR_ERROR_SCAN));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SaneResId(STR_ERROR_SCAN));
+ aErrorBox->Execute();
}
else
{
diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx
index 57eaa54b0cb3..6aca2733c3a7 100644
--- a/extensions/source/scanner/sanedlg.hxx
+++ b/extensions/source/scanner/sanedlg.hxx
@@ -40,38 +40,38 @@ private:
Link maOldLink;
- OKButton* mpOKButton;
- CancelButton* mpCancelButton;
- PushButton* mpDeviceInfoButton;
- PushButton* mpPreviewButton;
- PushButton* mpScanButton;
- PushButton* mpButtonOption;
+ VclPtr<OKButton> mpOKButton;
+ VclPtr<CancelButton> mpCancelButton;
+ VclPtr<PushButton> mpDeviceInfoButton;
+ VclPtr<PushButton> mpPreviewButton;
+ VclPtr<PushButton> mpScanButton;
+ VclPtr<PushButton> mpButtonOption;
- FixedText* mpOptionTitle;
- FixedText* mpOptionDescTxt;
- FixedText* mpVectorTxt;
+ VclPtr<FixedText> mpOptionTitle;
+ VclPtr<FixedText> mpOptionDescTxt;
+ VclPtr<FixedText> mpVectorTxt;
- MetricField* mpLeftField;
- MetricField* mpTopField;
- MetricField* mpRightField;
- MetricField* mpBottomField;
+ VclPtr<MetricField> mpLeftField;
+ VclPtr<MetricField> mpTopField;
+ VclPtr<MetricField> mpRightField;
+ VclPtr<MetricField> mpBottomField;
- ListBox* mpDeviceBox;
- NumericBox* mpReslBox;
- CheckBox* mpAdvancedBox;
+ VclPtr<ListBox> mpDeviceBox;
+ VclPtr<NumericBox> mpReslBox;
+ VclPtr<CheckBox> mpAdvancedBox;
- NumericField* mpVectorBox;
- ListBox* mpQuantumRangeBox;
- ListBox* mpStringRangeBox;
+ VclPtr<NumericField> mpVectorBox;
+ VclPtr<ListBox> mpQuantumRangeBox;
+ VclPtr<ListBox> mpStringRangeBox;
- CheckBox* mpBoolCheckBox;
+ VclPtr<CheckBox> mpBoolCheckBox;
- Edit* mpStringEdit;
- Edit* mpNumericEdit;
+ VclPtr<Edit> mpStringEdit;
+ VclPtr<Edit> mpNumericEdit;
- SvTreeListBox* mpOptionBox;
+ VclPtr<SvTreeListBox> mpOptionBox;
- ScanPreview* mpPreview;
+ VclPtr<ScanPreview> mpPreview;
int mnCurrentOption;
int mnCurrentElement;
@@ -105,6 +105,7 @@ private:
public:
SaneDlg( vcl::Window*, Sane&, bool );
virtual ~SaneDlg();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
void UpdateScanArea( bool );
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index a66d797587dc..7d4da1f523fe 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -299,9 +299,9 @@ sal_Bool ScannerManager::configureScannerAndScan( ScannerContext& scanner_contex
);
pHolder->m_bBusy = true;
- SaneDlg aDlg( NULL, pHolder->m_aSane, listener.is() );
- bRet = aDlg.Execute();
- bScan = aDlg.getDoScan();
+ ScopedVclPtrInstance< SaneDlg > aDlg(nullptr, pHolder->m_aSane, listener.is());
+ bRet = aDlg->Execute();
+ bScan = aDlg->getDoScan();
pHolder->m_bBusy = false;
}
if ( bScan )
diff --git a/extensions/workben/testframecontrol.cxx b/extensions/workben/testframecontrol.cxx
index bb22d173db05..5cfa08c2c2a5 100644
--- a/extensions/workben/testframecontrol.cxx
+++ b/extensions/workben/testframecontrol.cxx
@@ -239,7 +239,7 @@ void FrameControlApplication::init()
XInterfaceRef xInst = xMgr->createInstance( L"stardiv.one.frame.FrameControl" );
if (xInst->queryInterface( XControl::getSmartUik(), _xControl ))
{
- _pWorkWin = new WorkWindow( NULL, WB_APP | WB_STDWORK );
+ _pWorkWin = VclPtr<WorkWindow>::Create( nullptr, WB_APP | WB_STDWORK );
_pWorkWin->Show();
XWindowPeerRef xParent( _pWorkWin->GetComponentInterface() );
diff --git a/filter/source/flash/impswfdialog.cxx b/filter/source/flash/impswfdialog.cxx
index fe6b7fe7c485..bbe0bfbb7f98 100644
--- a/filter/source/flash/impswfdialog.cxx
+++ b/filter/source/flash/impswfdialog.cxx
@@ -60,8 +60,21 @@ ImpSWFDialog::ImpSWFDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFi
ImpSWFDialog::~ImpSWFDialog()
{
+ disposeOnce();
}
+void ImpSWFDialog::dispose()
+{
+ mpNumFldQuality.clear();
+ mpCheckExportAll.clear();
+ mpCheckExportBackgrounds.clear();
+ mpCheckExportBackgroundObjects.clear();
+ mpCheckExportSlideContents.clear();
+ mpCheckExportSound.clear();
+ mpCheckExportOLEAsJPEG.clear();
+ mpCheckExportMultipleFiles.clear();
+ ModalDialog::dispose();
+}
Sequence< PropertyValue > ImpSWFDialog::GetFilterData()
diff --git a/filter/source/flash/impswfdialog.hxx b/filter/source/flash/impswfdialog.hxx
index cb128448112e..aae9ecf7f1c2 100644
--- a/filter/source/flash/impswfdialog.hxx
+++ b/filter/source/flash/impswfdialog.hxx
@@ -41,14 +41,14 @@ namespace vcl { class Window; }
class ImpSWFDialog : public ModalDialog
{
private:
- NumericField * mpNumFldQuality;
- CheckBox * mpCheckExportAll;
- CheckBox * mpCheckExportBackgrounds;
- CheckBox * mpCheckExportBackgroundObjects;
- CheckBox * mpCheckExportSlideContents;
- CheckBox * mpCheckExportSound;
- CheckBox * mpCheckExportOLEAsJPEG;
- CheckBox * mpCheckExportMultipleFiles;
+ VclPtr<NumericField> mpNumFldQuality;
+ VclPtr<CheckBox> mpCheckExportAll;
+ VclPtr<CheckBox> mpCheckExportBackgrounds;
+ VclPtr<CheckBox> mpCheckExportBackgroundObjects;
+ VclPtr<CheckBox> mpCheckExportSlideContents;
+ VclPtr<CheckBox> mpCheckExportSound;
+ VclPtr<CheckBox> mpCheckExportOLEAsJPEG;
+ VclPtr<CheckBox> mpCheckExportMultipleFiles;
FilterConfigItem maConfigItem;
@@ -58,6 +58,7 @@ public:
ImpSWFDialog( vcl::Window* pParent,
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData );
virtual ~ImpSWFDialog();
+ virtual void dispose() SAL_OVERRIDE;
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetFilterData();
};
diff --git a/filter/source/flash/swfdialog.cxx b/filter/source/flash/swfdialog.cxx
index 64a182f47db3..dcfac419788c 100644
--- a/filter/source/flash/swfdialog.cxx
+++ b/filter/source/flash/swfdialog.cxx
@@ -146,9 +146,9 @@ Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames()
-Dialog* SWFDialog::createDialog( vcl::Window* pParent )
+VclPtr<Dialog> SWFDialog::createDialog( vcl::Window* pParent )
{
- Dialog* pRet = NULL;
+ VclPtr<Dialog> pRet;
if (mxSrcDoc.is())
{
@@ -172,8 +172,7 @@ Dialog* SWFDialog::createDialog( vcl::Window* pParent )
{
}
*/
- ImpSWFDialog* pDlg = new ImpSWFDialog( pParent, maFilterData );
- pRet = pDlg;
+ pRet.reset( VclPtr<ImpSWFDialog>::Create( pParent, maFilterData ) );
}
return pRet;
@@ -184,7 +183,7 @@ Dialog* SWFDialog::createDialog( vcl::Window* pParent )
void SWFDialog::executedDialog( sal_Int16 nExecutionResult )
{
if( nExecutionResult && m_pDialog )
- maFilterData = static_cast< ImpSWFDialog* >( m_pDialog )->GetFilterData();
+ maFilterData = static_cast< ImpSWFDialog* >( m_pDialog.get() )->GetFilterData();
destroyDialog();
}
diff --git a/filter/source/flash/swfdialog.hxx b/filter/source/flash/swfdialog.hxx
index 931432e33c4c..2130f79f38b2 100644
--- a/filter/source/flash/swfdialog.hxx
+++ b/filter/source/flash/swfdialog.hxx
@@ -54,7 +54,7 @@ protected:
virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- virtual Dialog* createDialog( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) SAL_OVERRIDE;
virtual void executedDialog( sal_Int16 nExecutionResult ) SAL_OVERRIDE;
virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx
index 4e2021264605..9f80ca9afaeb 100644
--- a/filter/source/flash/swfwriter.cxx
+++ b/filter/source/flash/swfwriter.cxx
@@ -49,7 +49,6 @@ Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int
mnGlobalTransparency(0),
mnJPEGCompressMode(nJPEGcompressMode)
{
- mpVDev = new VirtualDevice;
mpVDev->EnableOutput( false );
maMovieTempFile.EnableKillingFile();
@@ -100,7 +99,7 @@ Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int
Writer::~Writer()
{
- delete mpVDev;
+ mpVDev.disposeAndClear();
delete mpSprite;
delete mpTag;
}
diff --git a/filter/source/flash/swfwriter.hxx b/filter/source/flash/swfwriter.hxx
index 218459b00f6e..786410259559 100644
--- a/filter/source/flash/swfwriter.hxx
+++ b/filter/source/flash/swfwriter.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <vcl/font.hxx>
#include <vcl/gradient.hxx>
+#include <vcl/vclptr.hxx>
#include <unotools/tempfile.hxx>
#include <tools/color.hxx>
#include <tools/poly.hxx>
@@ -395,7 +396,7 @@ private:
sal_uInt16 mnWhiteBackgroundShapeId;
sal_uInt16 mnPageButtonId;
- VirtualDevice* mpVDev;
+ VclPtrInstance<VirtualDevice> mpVDev;
const tools::PolyPolygon* mpClipPolyPolygon;
diff --git a/filter/source/graphic/GraphicExportDialog.cxx b/filter/source/graphic/GraphicExportDialog.cxx
index ca98685e20ab..94f02c58e62d 100644
--- a/filter/source/graphic/GraphicExportDialog.cxx
+++ b/filter/source/graphic/GraphicExportDialog.cxx
@@ -107,10 +107,10 @@ void GraphicExportDialog::setTitle( const OUString& aTitle )
sal_Int16 GraphicExportDialog::execute() throw ( RuntimeException, std::exception )
{
sal_Int16 nReturn = ui::dialogs::ExecutableDialogResults::CANCEL;
- GraphicExportOptionsDialog graphicExportOptionsDialog( Application::GetDefDialogParent(), mxSourceDocument );
- if (graphicExportOptionsDialog.Execute() == RET_OK )
+ ScopedVclPtrInstance< GraphicExportOptionsDialog > graphicExportOptionsDialog( Application::GetDefDialogParent(), mxSourceDocument );
+ if (graphicExportOptionsDialog->Execute() == RET_OK )
{
- maFilterDataSequence = graphicExportOptionsDialog.getFilterData();
+ maFilterDataSequence = graphicExportOptionsDialog->getFilterData();
nReturn = ui::dialogs::ExecutableDialogResults::OK;
}
return nReturn;
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
index 501a9a8ac31d..ef7b1307e1bf 100644
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -156,8 +156,8 @@ private:
sal_uInt32 nWrittenBitmaps; // number of already written Bitmaps
sal_uInt32 nActBitmapPercent; // percentage of the next bitmap that's already written
- ::std::unique_ptr< VirtualDevice > apDummyVDev;
- OutputDevice* pCompDev;
+ ScopedVclPtr<VirtualDevice> apDummyVDev;
+ VclPtr<OutputDevice> pCompDev;
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
@@ -261,6 +261,7 @@ public:
pCompDev = reinterpret_cast< OutputDevice* >( Application::GetAppWindow() );
if( !pCompDev )
{
+ apDummyVDev.disposeAndClear();
apDummyVDev.reset( new VirtualDevice );
pCompDev = apDummyVDev.get();
}
@@ -1850,12 +1851,12 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
if( aGDIFont.GetAlign() != ALIGN_BASELINE)
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
if( aGDIFont.GetAlign()==ALIGN_TOP )
- aPt.Y()+=(long)aVDev.GetFontMetric( aGDIFont ).GetAscent();
+ aPt.Y()+=(long)pVDev->GetFontMetric( aGDIFont ).GetAscent();
else
- aPt.Y()-=(long)aVDev.GetFontMetric( aGDIFont ).GetDescent();
+ aPt.Y()-=(long)pVDev->GetFontMetric( aGDIFont ).GetDescent();
}
METSetMix(eGDIRasterOp);
@@ -1879,11 +1880,11 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
if( aGDIFont.GetAlign() != ALIGN_BASELINE )
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
if( aGDIFont.GetAlign() == ALIGN_TOP )
- aPt.Y()+=(long)aVDev.GetFontMetric(aGDIFont).GetAscent();
+ aPt.Y()+=(long)pVDev->GetFontMetric(aGDIFont).GetAscent();
else
- aPt.Y()-=(long)aVDev.GetFontMetric(aGDIFont).GetDescent();
+ aPt.Y()-=(long)pVDev->GetFontMetric(aGDIFont).GetDescent();
}
METSetMix(eGDIRasterOp);
@@ -1922,7 +1923,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
case META_STRETCHTEXT_ACTION:
{
const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction*>(pMA);
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
sal_uInt16 i;
sal_Int32 nNormSize;
OUString aStr;
@@ -1931,14 +1932,14 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
Point aPt( pA->GetPoint() );
Point aPt2;
- aVDev.SetFont( aGDIFont );
+ pVDev->SetFont( aGDIFont );
if( aGDIFont.GetAlign() != ALIGN_BASELINE)
{
if( aGDIFont.GetAlign() == ALIGN_TOP )
- aPt.Y()+=(long)aVDev.GetFontMetric().GetAscent();
+ aPt.Y()+=(long)pVDev->GetFontMetric().GetAscent();
else
- aPt.Y()-=(long)aVDev.GetFontMetric().GetDescent();
+ aPt.Y()-=(long)pVDev->GetFontMetric().GetDescent();
}
METSetMix(eGDIRasterOp);
@@ -1949,7 +1950,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
METSetChrSet(FindChrSet(aGDIFont));
aStr = pA->GetText().copy(pA->GetIndex(),pA->GetLen());
boost::scoped_array<long> pDXAry(new long[aStr.getLength()]);
- nNormSize = aVDev.GetTextArray( aStr, pDXAry.get() );
+ nNormSize = pVDev->GetTextArray( aStr, pDXAry.get() );
for ( i = 0; i < aStr.getLength(); i++ )
{
@@ -2067,24 +2068,24 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
case META_GRADIENT_ACTION:
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
GDIMetaFile aTmpMtf;
const MetaGradientAction* pA = static_cast<const MetaGradientAction*>(pMA);
- aVDev.SetMapMode( aTargetMapMode );
- aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ pVDev->SetMapMode( aTargetMapMode );
+ pVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
WriteOrders( &aTmpMtf );
}
break;
case META_HATCH_ACTION:
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
GDIMetaFile aTmpMtf;
const MetaHatchAction* pA = static_cast<const MetaHatchAction*>(pMA);
- aVDev.SetMapMode( aTargetMapMode );
- aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ pVDev->SetMapMode( aTargetMapMode );
+ pVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
WriteOrders( &aTmpMtf );
}
break;
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index 6631bdfc3671..9bf395375689 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -1699,12 +1699,11 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
if ( aSrcFont.GetAlign() != ALIGN_BASELINE )
{
- VirtualDevice aVirDev;
-
+ ScopedVclPtrInstance< VirtualDevice > pVirDev;
if (aSrcFont.GetAlign()==ALIGN_TOP)
- aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent();
else
- aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent();
}
SetAttrForText();
@@ -1720,12 +1719,12 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
{
- VirtualDevice aVirDev;
+ ScopedVclPtrInstance< VirtualDevice > pVirDev;
if (aSrcFont.GetAlign()==ALIGN_TOP)
- aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent();
else
- aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent();
}
SetAttrForText();
OUString aStr = pA->GetText().copy( pA->GetIndex(),pA->GetLen() );
@@ -1738,16 +1737,16 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction*>(pMA);
Point aPt( pA->GetPoint() );
OUString aStr = pA->GetText().copy( pA->GetIndex(),pA->GetLen() );
- VirtualDevice aVirDev;
+ ScopedVclPtrInstance< VirtualDevice > pVirDev;
boost::scoped_array<long> pDXAry(new long[ aStr.getLength() ]);
- sal_Int32 nNormSize( aVirDev.GetTextArray( aStr,pDXAry.get() ) );
+ sal_Int32 nNormSize( pVirDev->GetTextArray( aStr,pDXAry.get() ) );
if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
{
if (aSrcFont.GetAlign()==ALIGN_TOP)
- aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent();
else
- aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent();
}
sal_Int32 nLength = aStr.getLength() - 1;
@@ -1774,9 +1773,9 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
{
const MetaBmpAction* pA = static_cast<const MetaBmpAction*>(pMA);
const Bitmap aBmp( pA->GetBitmap() );
- VirtualDevice aVirDev;
+ ScopedVclPtrInstance< VirtualDevice > pVirDev;
- WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
+ WriteOpcode_BitsRect( pA->GetPoint(), pVirDev->PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
}
break;
@@ -1801,9 +1800,9 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
{
const MetaBmpExAction* pA = static_cast<const MetaBmpExAction*>(pMA);
const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
- VirtualDevice aVirDev;
+ ScopedVclPtrInstance< VirtualDevice > pVirDev;
- WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
+ WriteOpcode_BitsRect( pA->GetPoint(), pVirDev->PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
}
break;
@@ -1855,24 +1854,24 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
case META_GRADIENT_ACTION:
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance<VirtualDevice> aVDev;
GDIMetaFile aTmpMtf;
const MetaGradientAction* pA = static_cast<const MetaGradientAction*>(pMA);
- aVDev.SetMapMode( aTargetMapMode );
- aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ aVDev->SetMapMode( aTargetMapMode );
+ aVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
WriteOpcodes( aTmpMtf );
}
break;
case META_HATCH_ACTION:
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance<VirtualDevice> aVDev;
GDIMetaFile aTmpMtf;
const MetaHatchAction* pA = static_cast<const MetaHatchAction*>(pMA);
- aVDev.SetMapMode( aTargetMapMode );
- aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ aVDev->SetMapMode( aTargetMapMode );
+ aVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
WriteOpcodes( aTmpMtf );
}
break;
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index cfe790a290f3..20f6a2f9d1d3 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -116,7 +116,7 @@ private:
SvStream* mpPS;
const GDIMetaFile* pMTF;
GDIMetaFile* pAMTF; // only created if Graphics is not a Metafile
- VirtualDevice aVDev;
+ ScopedVclPtr<VirtualDevice> pVDev;
double nBoundingX1; // this represents the bounding box
double nBoundingY1;
@@ -257,7 +257,7 @@ PSWriter::PSWriter()
, mpPS(NULL)
, pMTF(NULL)
, pAMTF(NULL)
- , aVDev()
+ , pVDev()
, nBoundingX1(0)
, nBoundingY1(0)
, nBoundingX2(0)
@@ -418,14 +418,14 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
{
Bitmap aBmp( rGraphic.GetBitmap() );
pAMTF = new GDIMetaFile();
- VirtualDevice aTmpVDev;
- pAMTF->Record( &aTmpVDev );
- aTmpVDev.DrawBitmap( Point(), aBmp );
+ ScopedVclPtrInstance< VirtualDevice > pTmpVDev;
+ pAMTF->Record( pTmpVDev );
+ pTmpVDev->DrawBitmap( Point(), aBmp );
pAMTF->Stop();
pAMTF->SetPrefSize( aBmp.GetSizePixel() );
pMTF = pAMTF;
}
- aVDev.SetMapMode( pMTF->GetPrefMapMode() );
+ pVDev->SetMapMode( pMTF->GetPrefMapMode() );
nBoundingX1 = nBoundingY1 = 0;
nBoundingX2 = pMTF->GetPrefSize().Width();
nBoundingY2 = pMTF->GetPrefSize().Height();
@@ -454,7 +454,7 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
{
ImplWriteProlog( ( mnPreview & EPS_PREVIEW_EPSI ) ? &rGraphic : NULL );
mnCursorPos = 0;
- ImplWriteActions( *pMTF, aVDev );
+ ImplWriteActions( *pMTF, *pVDev.get() );
ImplWriteEpilog();
if ( mnPreview & EPS_PREVIEW_TIFF )
{
@@ -486,8 +486,8 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
pResMgr = ResMgr::CreateResMgr( "eps", Application::GetSettings().GetUILanguageTag() );
if( pResMgr )
{
- InfoBox aInfoBox( NULL, ResId(KEY_VERSION_CHECK, *pResMgr).toString() );
- aInfoBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aInfoBox( nullptr, ResId(KEY_VERSION_CHECK, *pResMgr).toString() );
+ aInfoBox->Execute();
delete pResMgr;
}
}
@@ -940,12 +940,12 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
case META_HATCH_ACTION :
{
- VirtualDevice l_aVDev;
+ ScopedVclPtrInstance< VirtualDevice > l_pVirDev;
GDIMetaFile aTmpMtf;
- l_aVDev.SetMapMode( rVDev.GetMapMode() );
- l_aVDev.AddHatchActions( static_cast<const MetaHatchAction*>(pMA)->GetPolyPolygon(),
- static_cast<const MetaHatchAction*>(pMA)->GetHatch(), aTmpMtf );
+ l_pVirDev->SetMapMode( rVDev.GetMapMode() );
+ l_pVirDev->AddHatchActions( static_cast<const MetaHatchAction*>(pMA)->GetPolyPolygon(),
+ static_cast<const MetaHatchAction*>(pMA)->GetHatch(), aTmpMtf );
ImplWriteActions( aTmpMtf, rVDev );
}
break;
@@ -1608,10 +1608,10 @@ void PSWriter::ImplIntersect( const tools::PolyPolygon& rPolyPoly )
void PSWriter::ImplWriteGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rVDev )
{
- VirtualDevice l_aVDev;
+ ScopedVclPtrInstance< VirtualDevice > l_pVDev;
GDIMetaFile aTmpMtf;
- l_aVDev.SetMapMode( rVDev.GetMapMode() );
- l_aVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
+ l_pVDev->SetMapMode( rVDev.GetMapMode() );
+ l_pVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
ImplWriteActions( aTmpMtf, rVDev );
}
@@ -2141,10 +2141,10 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const lo
vcl::Font aNotRotatedFont( maFont );
aNotRotatedFont.SetOrientation( 0 );
- VirtualDevice aVirDev( 1 );
- aVirDev.SetMapMode( rVDev.GetMapMode() );
- aVirDev.SetFont( aNotRotatedFont );
- aVirDev.SetTextAlign( eTextAlign );
+ ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 );
+ pVirDev->SetMapMode( rVDev.GetMapMode() );
+ pVirDev->SetFont( aNotRotatedFont );
+ pVirDev->SetTextAlign( eTextAlign );
sal_Int16 nRotation = maFont.GetOrientation();
Polygon aPolyDummy( 1 );
@@ -2159,7 +2159,7 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const lo
bool bOldLineColor = bLineColor;
bLineColor = false;
std::vector<tools::PolyPolygon> aPolyPolyVec;
- if ( aVirDev.GetTextOutlines( aPolyPolyVec, rUniString, 0, 0, -1, true, nWidth, pDXArry ) )
+ if ( pVirDev->GetTextOutlines( aPolyPolyVec, rUniString, 0, 0, -1, true, nWidth, pDXArry ) )
{
// always adjust text position to match baseline alignment
ImplWriteLine( "pum" );
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index 55a6158e8b46..30c8c474f7ee 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -80,7 +80,7 @@ CGM::~CGM()
mpGDIMetaFile->Stop();
mpGDIMetaFile->SetPrefMapMode( MapMode() );
mpGDIMetaFile->SetPrefSize( Size( static_cast< long >( mnOutdx ), static_cast< long >( mnOutdy ) ) );
- delete mpVirDev;
+ mpVirDev.disposeAndClear();
*mpGraphic = Graphic( *mpGDIMetaFile );
}
for( size_t i = 0, n = maDefRepList.size(); i < n; ++i )
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
index 1ee13eaf9a6b..f9e6fa455325 100644
--- a/filter/source/graphicfilter/icgm/cgm.hxx
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -28,6 +28,7 @@
#include <rtl/ustring.hxx>
#include <vector>
+#include <vcl/vclptr.hxx>
#include "cgmtypes.hxx"
class Graphic;
@@ -138,7 +139,7 @@ class CGM
~CGM();
CGM( sal_uInt32 nMode, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > const & rModel );
- VirtualDevice* mpVirDev;
+ VclPtr<VirtualDevice> mpVirDev;
GDIMetaFile* mpGDIMetaFile;
sal_uInt32 GetBackGroundColor();
bool IsValid() const { return mbStatus; };
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index bacd08189425..ffca879871cb 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -885,7 +885,7 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF
rMTF.SetPrefMapMode( MapMode( MAP_100TH_MM ) );
}
- delete pVirDev;
+ pVirDev.disposeAndClear();
return bStatus;
}
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx b/filter/source/graphicfilter/idxf/dxf2mtf.hxx
index 3adc4eee9aff..e88fcc3c9f27 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.hxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.hxx
@@ -34,7 +34,7 @@ enum BrushStyle { BRUSH_NULL, BRUSH_SOLID, BRUSH_HORZ, BRUSH_VERT,
class DXF2GDIMetaFile {
private:
- VirtualDevice * pVirDev;
+ VclPtr<VirtualDevice> pVirDev;
const DXFRepresentation * pDXF;
bool bStatus;
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index b933574f4ed8..503606dd4977 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -125,7 +125,7 @@ static int ImplGetLen( sal_uInt8* pBuf, int nMax )
static void MakeAsMeta(Graphic &rGraphic)
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
GDIMetaFile aMtf;
Bitmap aBmp( rGraphic.GetBitmap() );
Size aSize = aBmp.GetPrefSize();
@@ -137,9 +137,9 @@ static void MakeAsMeta(Graphic &rGraphic)
aSize = OutputDevice::LogicToLogic( aSize,
aBmp.GetPrefMapMode(), MAP_100TH_MM );
- aVDev.EnableOutput( false );
- aMtf.Record( &aVDev );
- aVDev.DrawBitmap( Point(), aSize, rGraphic.GetBitmap() );
+ pVDev->EnableOutput( false );
+ aMtf.Record( pVDev );
+ pVDev->DrawBitmap( Point(), aSize, rGraphic.GetBitmap() );
aMtf.Stop();
aMtf.WindStart();
aMtf.SetPrefMapMode( MAP_100TH_MM );
@@ -442,22 +442,22 @@ void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead,
long nWidth, long nHeight, Graphic &rGraphic)
{
GDIMetaFile aMtf;
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
vcl::Font aFont;
- aVDev.EnableOutput( false );
- aMtf.Record( &aVDev );
- aVDev.SetLineColor( Color( COL_RED ) );
- aVDev.SetFillColor();
+ pVDev->EnableOutput( false );
+ aMtf.Record( pVDev );
+ pVDev->SetLineColor( Color( COL_RED ) );
+ pVDev->SetFillColor();
aFont.SetColor( COL_LIGHTRED );
// aFont.SetSize( Size( 0, 32 ) );
- aVDev.Push( PushFlags::FONT );
- aVDev.SetFont( aFont );
+ pVDev->Push( PushFlags::FONT );
+ pVDev->SetFont( aFont );
Rectangle aRect( Point( 1, 1 ), Size( nWidth - 2, nHeight - 2 ) );
- aVDev.DrawRect( aRect );
+ pVDev->DrawRect( aRect );
OUString aString;
int nLen;
@@ -511,8 +511,8 @@ void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead,
aString += " LanguageLevel:" + OUString::number( nNumber );
}
}
- aVDev.DrawText( aRect, aString, TEXT_DRAW_CLIP | TEXT_DRAW_MULTILINE );
- aVDev.Pop();
+ pVDev->DrawText( aRect, aString, TEXT_DRAW_CLIP | TEXT_DRAW_MULTILINE );
+ pVDev->Pop();
aMtf.Stop();
aMtf.WindStart();
aMtf.SetPrefMapMode( MAP_POINT );
@@ -679,17 +679,17 @@ GraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
}
if ( bIsValid )
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance<VirtualDevice> pVDev;
GDIMetaFile aMtf;
Size aSize;
- aVDev.EnableOutput( false );
- aMtf.Record( &aVDev );
+ pVDev->EnableOutput( false );
+ aMtf.Record( pVDev );
aSize = aBitmap.GetPrefSize();
if( !aSize.Width() || !aSize.Height() )
aSize = Application::GetDefaultDevice()->PixelToLogic( aBitmap.GetSizePixel(), MAP_100TH_MM );
else
aSize = OutputDevice::LogicToLogic( aSize, aBitmap.GetPrefMapMode(), MAP_100TH_MM );
- aVDev.DrawBitmap( Point(), aSize, aBitmap );
+ pVDev->DrawBitmap( Point(), aSize, aBitmap );
aMtf.Stop();
aMtf.WindStart();
aMtf.SetPrefMapMode( MAP_100TH_MM );
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 435a6e164597..7b024ae84eb3 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -345,7 +345,7 @@ private:
long ErrorCode;
SvStream * pOS2MET; // the OS2MET file to be read
- VirtualDevice * pVirDev; // here the drawing methods are being called
+ VclPtr<VirtualDevice> pVirDev; // here the drawing methods are being called
// While doing this a recording in the GDIMetaFile
// will take place.
sal_uLong nOrigPos; // initial position in pOS2MET
@@ -2601,7 +2601,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF
pOrdFile=NULL;
- pVirDev = new VirtualDevice();
+ pVirDev = VclPtr<VirtualDevice>::Create();
pVirDev->EnableOutput(false);
rGDIMetaFile.Record(pVirDev);
@@ -2657,7 +2657,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF
}
rGDIMetaFile.Stop();
- delete pVirDev;
+ pVirDev.disposeAndClear();
rGDIMetaFile.SetPrefMapMode( aGlobMapMode );
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index badebaf82c3a..6621eddd3c60 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -146,7 +146,7 @@ class PictReader {
private:
SvStream * pPict; // The Pict file to read.
- VirtualDevice * pVirDev; // Here the drawing methos will be called.
+ VclPtr<VirtualDevice> pVirDev; // Here the drawing methos will be called.
// A recording into the GDIMetaFile will take place.
sal_uLong nOrigPos; // Initial position in pPict.
@@ -1881,7 +1881,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile )
aHRes = aVRes = Fraction( 1, 1 );
- pVirDev = new VirtualDevice();
+ pVirDev = VclPtr<VirtualDevice>::Create();
pVirDev->EnableOutput(false);
rGDIMetaFile.Record(pVirDev);
@@ -1942,7 +1942,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile )
pVirDev->SetClipRegion();
rGDIMetaFile.Stop();
- delete pVirDev;
+ pVirDev.disposeAndClear();
rGDIMetaFile.SetPrefMapMode( MapMode( MAP_INCH, Point(), aHRes, aVRes ) );
rGDIMetaFile.SetPrefSize( aBoundingRect.GetSize() );
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index c7444bfceb1e..dc1e3705d72e 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1387,18 +1387,18 @@ GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, cons
// do not create a bitmap in page size, that would explode file sizes (and have no good quality).
// Better use a MetaFile graphic in page size; thus we have good quality due to vector format and
// no bit file sizes.
- VirtualDevice aOut;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
GDIMetaFile aMtf;
- aOut.SetOutputSizePixel(Size(2, 2));
- aOut.EnableOutput(false);
- aOut.SetMapMode(MapMode(MAP_100TH_MM));
+ pVDev->SetOutputSizePixel(Size(2, 2));
+ pVDev->EnableOutput(false);
+ pVDev->SetMapMode(MapMode(MAP_100TH_MM));
aMtf.Clear();
- aMtf.Record(&aOut);
- aOut.SetLineColor();
- aOut.SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT));
- aOut.DrawRect(rRect);
- aOut.DrawHatch(tools::PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle));
+ aMtf.Record(pVDev);
+ pVDev->SetLineColor();
+ pVDev->SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT));
+ pVDev->DrawRect(rRect);
+ pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle));
aMtf.Stop();
aMtf.WindStart();
aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM));
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 0dce7915648e..6dfba0986eee 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4397,8 +4397,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
rOutliner.SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pModel->GetStyleSheetPool()) );
rOutliner.SetUpdateMode( false );
rOutliner.SetText( *pParaObj );
- VirtualDevice aVirDev( 1 );
- aVirDev.SetMapMode( MAP_100TH_MM );
+ ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 );
+ pVirDev->SetMapMode( MAP_100TH_MM );
sal_Int32 i, nParagraphs = rOutliner.GetParagraphCount();
if ( nParagraphs )
{
@@ -4406,7 +4406,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
for ( i = 0; i < nParagraphs; i++ )
{
OUString aString(rOutliner.GetText(rOutliner.GetParagraph(i)));
- bool bIsRTL = aVirDev.GetTextIsRTL(aString, 0, aString.getLength());
+ bool bIsRTL = pVirDev->GetTextIsRTL(aString, 0, aString.getLength());
if ( bIsRTL )
{
SfxItemSet aSet2( rOutliner.GetParaAttribs( i ) );
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 9851aa811a7c..af2e7e7c8a73 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -312,6 +312,11 @@ IMPL_LINK_NOARG(ImpPDFTabDialog, CancelHdl)
ImpPDFTabDialog::~ImpPDFTabDialog()
{
+ disposeOnce();
+}
+
+void ImpPDFTabDialog::dispose()
+{
//delete the pages, needed because otherwise the child tab pages
//don't get destroyed
RemoveTabPage(mnGeneralPageId);
@@ -320,6 +325,7 @@ ImpPDFTabDialog::~ImpPDFTabDialog()
RemoveTabPage(mnLinksPage);
RemoveTabPage(mnSecurityPageId);
RemoveTabPage(mnSigningPageId);
+ SfxTabDialog::dispose();
}
@@ -546,10 +552,42 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe
ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage()
{
+ disposeOnce();
}
+void ImpPDFTabGeneralPage::dispose()
+{
+ mpRbAll.clear();
+ mpRbRange.clear();
+ mpRbSelection.clear();
+ mpEdPages.clear();
+ mpRbLosslessCompression.clear();
+ mpRbJPEGCompression.clear();
+ mpQualityFrame.clear();
+ mpNfQuality.clear();
+ mpCbReduceImageResolution.clear();
+ mpCoReduceImageResolution.clear();
+ mpCbPDFA1b.clear();
+ mpCbTaggedPDF.clear();
+ mpCbExportFormFields.clear();
+ mpFormsFrame.clear();
+ mpLbFormsFormat.clear();
+ mpCbAllowDuplicateFieldNames.clear();
+ mpCbExportBookmarks.clear();
+ mpCbExportHiddenSlides.clear();
+ mpCbExportNotes.clear();
+ mpCbViewPDF.clear();
+ mpCbExportNotesPages.clear();
+ mpCbExportEmptyPages.clear();
+ mpCbAddStream.clear();
+ mpCbWatermark.clear();
+ mpFtWatermark.clear();
+ mpEdWatermark.clear();
+ mpaParent.clear();
+ SfxTabPage::dispose();
+}
-void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
+void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
{
mpaParent = paParent;
@@ -696,10 +734,10 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
}
-SfxTabPage* ImpPDFTabGeneralPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> ImpPDFTabGeneralPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return ( new ImpPDFTabGeneralPage( pParent, *rAttrSet ) );
+ return VclPtr<ImpPDFTabGeneralPage>::Create( pParent, *rAttrSet );
}
@@ -806,8 +844,8 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl)
// if a password was set, inform the user that this will not be used in PDF/A case
if( mpCbPDFA1b->IsChecked() && pSecPage && pSecPage->hasPassword() )
{
- MessageDialog aBox(this, PDFFilterResId(STR_WARN_PASSWORD_PDFA), VCL_MESSAGE_WARNING);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, PDFFilterResId(STR_WARN_PASSWORD_PDFA), VCL_MESSAGE_WARNING);
+ aBox->Execute();
}
return 0;
@@ -844,13 +882,33 @@ ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage(vcl::Window* pParent, const SfxItemSet&
ImpPDFTabOpnFtrPage::~ImpPDFTabOpnFtrPage()
{
+ disposeOnce();
}
+void ImpPDFTabOpnFtrPage::dispose()
+{
+ mpRbOpnPageOnly.clear();
+ mpRbOpnOutline.clear();
+ mpRbOpnThumbs.clear();
+ mpNumInitialPage.clear();
+ mpRbMagnDefault.clear();
+ mpRbMagnFitWin.clear();
+ mpRbMagnFitWidth.clear();
+ mpRbMagnFitVisible.clear();
+ mpRbMagnZoom.clear();
+ mpNumZoom.clear();
+ mpRbPgLyDefault.clear();
+ mpRbPgLySinglePage.clear();
+ mpRbPgLyContinue.clear();
+ mpRbPgLyContinueFacing.clear();
+ mpCbPgLyFirstOnLeft.clear();
+ SfxTabPage::dispose();
+}
-SfxTabPage* ImpPDFTabOpnFtrPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> ImpPDFTabOpnFtrPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return ( new ImpPDFTabOpnFtrPage( pParent, *rAttrSet ) );
+ return VclPtr<ImpPDFTabOpnFtrPage>::Create( pParent, *rAttrSet );
}
@@ -999,6 +1057,23 @@ ImpPDFTabViewerPage::ImpPDFTabViewerPage( vcl::Window* pParent,
ImpPDFTabViewerPage::~ImpPDFTabViewerPage()
{
+ disposeOnce();
+}
+
+void ImpPDFTabViewerPage::dispose()
+{
+ m_pCbResWinInit.clear();
+ m_pCbCenterWindow.clear();
+ m_pCbOpenFullScreen.clear();
+ m_pCbDispDocTitle.clear();
+ m_pCbHideViewerMenubar.clear();
+ m_pCbHideViewerToolbar.clear();
+ m_pCbHideViewerWindowControls.clear();
+ m_pCbTransitionEffects.clear();
+ m_pRbAllBookmarkLevels.clear();
+ m_pRbVisibleBookmarkLevels.clear();
+ m_pNumBookmarkLevels.clear();
+ SfxTabPage::dispose();
}
IMPL_LINK( ImpPDFTabViewerPage, ToggleRbBookmarksHdl, void*, )
@@ -1007,10 +1082,10 @@ IMPL_LINK( ImpPDFTabViewerPage, ToggleRbBookmarksHdl, void*, )
return 0;
}
-SfxTabPage* ImpPDFTabViewerPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> ImpPDFTabViewerPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return ( new ImpPDFTabViewerPage( pParent, *rAttrSet ) );
+ return VclPtr<ImpPDFTabViewerPage>::Create( pParent, *rAttrSet );
}
@@ -1096,13 +1171,38 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(vcl::Window* i_pParent, const SfxIt
ImpPDFTabSecurityPage::~ImpPDFTabSecurityPage()
{
+ disposeOnce();
}
+void ImpPDFTabSecurityPage::dispose()
+{
+ mpPbSetPwd.clear();
+ mpUserPwdSet.clear();
+ mpUserPwdUnset.clear();
+ mpUserPwdPdfa.clear();
+ mpOwnerPwdSet.clear();
+ mpOwnerPwdUnset.clear();
+ mpOwnerPwdPdfa.clear();
+ mpPrintPermissions.clear();
+ mpRbPrintNone.clear();
+ mpRbPrintLowRes.clear();
+ mpRbPrintHighRes.clear();
+ mpChangesAllowed.clear();
+ mpRbChangesNone.clear();
+ mpRbChangesInsDel.clear();
+ mpRbChangesFillForm.clear();
+ mpRbChangesComment.clear();
+ mpRbChangesAnyNoCopy.clear();
+ mpContent.clear();
+ mpCbEnableCopy.clear();
+ mpCbEnableAccessibility.clear();
+ SfxTabPage::dispose();
+}
-SfxTabPage* ImpPDFTabSecurityPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> ImpPDFTabSecurityPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return ( new ImpPDFTabSecurityPage( pParent, *rAttrSet ) );
+ return VclPtr<ImpPDFTabSecurityPage>::Create( pParent, *rAttrSet );
}
@@ -1191,17 +1291,17 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParen
IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl)
{
- SfxPasswordDialog aPwdDialog( this, &msUserPwdTitle );
- aPwdDialog.SetMinLen( 0 );
- aPwdDialog.ShowMinLengthText(false);
- aPwdDialog.ShowExtras( SfxShowExtras::CONFIRM | SfxShowExtras::PASSWORD2 | SfxShowExtras::CONFIRM2 );
- aPwdDialog.SetText(msStrSetPwd);
- aPwdDialog.SetGroup2Text(msOwnerPwdTitle);
- aPwdDialog.AllowAsciiOnly();
- if( aPwdDialog.Execute() == RET_OK ) //OK issued get password and set it
+ ScopedVclPtrInstance< SfxPasswordDialog > aPwdDialog( this, &msUserPwdTitle );
+ aPwdDialog->SetMinLen( 0 );
+ aPwdDialog->ShowMinLengthText(false);
+ aPwdDialog->ShowExtras( SfxShowExtras::CONFIRM | SfxShowExtras::PASSWORD2 | SfxShowExtras::CONFIRM2 );
+ aPwdDialog->SetText(msStrSetPwd);
+ aPwdDialog->SetGroup2Text(msOwnerPwdTitle);
+ aPwdDialog->AllowAsciiOnly();
+ if( aPwdDialog->Execute() == RET_OK ) //OK issued get password and set it
{
- OUString aUserPW( aPwdDialog.GetPassword() );
- OUString aOwnerPW( aPwdDialog.GetPassword2() );
+ OUString aUserPW( aPwdDialog->GetPassword() );
+ OUString aOwnerPW( aPwdDialog->GetPassword2() );
mbHaveUserPassword = !aUserPW.isEmpty();
mbHaveOwnerPassword = !aOwnerPW.isEmpty();
@@ -1317,13 +1417,24 @@ ImpPDFTabLinksPage::ImpPDFTabLinksPage( vcl::Window* pParent,
ImpPDFTabLinksPage::~ImpPDFTabLinksPage()
{
+ disposeOnce();
}
+void ImpPDFTabLinksPage::dispose()
+{
+ m_pCbExprtBmkrToNmDst.clear();
+ m_pCbOOoToPDFTargets.clear();
+ m_pCbExportRelativeFsysLinks.clear();
+ m_pRbOpnLnksDefault.clear();
+ m_pRbOpnLnksLaunch.clear();
+ m_pRbOpnLnksBrowser.clear();
+ SfxTabPage::dispose();
+}
-SfxTabPage* ImpPDFTabLinksPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> ImpPDFTabLinksPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return ( new ImpPDFTabLinksPage( pParent, *rAttrSet ) );
+ return VclPtr<ImpPDFTabLinksPage>::Create( pParent, *rAttrSet );
}
@@ -1511,9 +1622,17 @@ ImplErrorDialog::ImplErrorDialog(const std::set< vcl::PDFWriter::ErrorCode >& rE
ImplErrorDialog::~ImplErrorDialog()
{
+ disposeOnce();
+}
+
+void ImplErrorDialog::dispose()
+{
// free strings again
for( sal_uInt16 n = 0; n < m_pErrors->GetEntryCount(); n++ )
delete static_cast<OUString*>(m_pErrors->GetEntryData( n ));
+ m_pErrors.clear();
+ m_pExplanation.clear();
+ MessageDialog::dispose();
}
IMPL_LINK_NOARG(ImplErrorDialog, SelectHdl)
@@ -1548,6 +1667,19 @@ ImpPDFTabSigningPage::ImpPDFTabSigningPage(vcl::Window* pParent, const SfxItemSe
ImpPDFTabSigningPage::~ImpPDFTabSigningPage()
{
+ disposeOnce();
+}
+
+void ImpPDFTabSigningPage::dispose()
+{
+ mpEdSignCert.clear();
+ mpPbSignCertSelect.clear();
+ mpPbSignCertClear.clear();
+ mpEdSignPassword.clear();
+ mpEdSignLocation.clear();
+ mpEdSignContactInfo.clear();
+ mpEdSignReason.clear();
+ SfxTabPage::dispose();
}
IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect )
@@ -1610,10 +1742,10 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, SelectLBSignTSA )
return 0;
}
-SfxTabPage* ImpPDFTabSigningPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> ImpPDFTabSigningPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return ( new ImpPDFTabSigningPage( pParent, *rAttrSet ) );
+ return VclPtr<ImpPDFTabSigningPage>::Create( pParent, *rAttrSet );
}
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index dc4a78789ce3..dc2f9d35d0fa 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -56,13 +56,14 @@ public:
class ImplErrorDialog : public MessageDialog
{
- ListBox* m_pErrors;
- FixedText* m_pExplanation;
+ VclPtr<ListBox> m_pErrors;
+ VclPtr<FixedText> m_pExplanation;
DECL_LINK(SelectHdl, void *);
public:
ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& );
virtual ~ImplErrorDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
class ImpPDFTabSecurityPage;
@@ -171,6 +172,7 @@ public:
const css::uno::Reference< XComponent >& rDoc
);
virtual ~ImpPDFTabDialog();
+ virtual void dispose() SAL_OVERRIDE;
Sequence< PropertyValue > GetFilterData();
@@ -189,45 +191,45 @@ class ImpPDFTabGeneralPage : public SfxTabPage
{
friend class ImpPDFTabLinksPage;
- RadioButton* mpRbAll;
- RadioButton* mpRbRange;
- RadioButton* mpRbSelection;
- Edit* mpEdPages;
+ VclPtr<RadioButton> mpRbAll;
+ VclPtr<RadioButton> mpRbRange;
+ VclPtr<RadioButton> mpRbSelection;
+ VclPtr<Edit> mpEdPages;
- RadioButton* mpRbLosslessCompression;
- RadioButton* mpRbJPEGCompression;
- VclContainer* mpQualityFrame;
- MetricField* mpNfQuality;
- CheckBox* mpCbReduceImageResolution;
- ComboBox* mpCoReduceImageResolution;
+ VclPtr<RadioButton> mpRbLosslessCompression;
+ VclPtr<RadioButton> mpRbJPEGCompression;
+ VclPtr<VclContainer> mpQualityFrame;
+ VclPtr<MetricField> mpNfQuality;
+ VclPtr<CheckBox> mpCbReduceImageResolution;
+ VclPtr<ComboBox> mpCoReduceImageResolution;
- CheckBox* mpCbPDFA1b;
- CheckBox* mpCbTaggedPDF;
+ VclPtr<CheckBox> mpCbPDFA1b;
+ VclPtr<CheckBox> mpCbTaggedPDF;
bool mbTaggedPDFUserSelection;
- CheckBox* mpCbExportFormFields;
+ VclPtr<CheckBox> mpCbExportFormFields;
bool mbExportFormFieldsUserSelection;
- VclContainer* mpFormsFrame;
- ListBox* mpLbFormsFormat;
- CheckBox* mpCbAllowDuplicateFieldNames;
+ VclPtr<VclContainer> mpFormsFrame;
+ VclPtr<ListBox> mpLbFormsFormat;
+ VclPtr<CheckBox> mpCbAllowDuplicateFieldNames;
- CheckBox* mpCbExportBookmarks;
- CheckBox* mpCbExportHiddenSlides;
- CheckBox* mpCbExportNotes;
- CheckBox* mpCbViewPDF;
- CheckBox* mpCbExportNotesPages;
+ VclPtr<CheckBox> mpCbExportBookmarks;
+ VclPtr<CheckBox> mpCbExportHiddenSlides;
+ VclPtr<CheckBox> mpCbExportNotes;
+ VclPtr<CheckBox> mpCbViewPDF;
+ VclPtr<CheckBox> mpCbExportNotesPages;
- CheckBox* mpCbExportEmptyPages;
- CheckBox* mpCbAddStream;
+ VclPtr<CheckBox> mpCbExportEmptyPages;
+ VclPtr<CheckBox> mpCbAddStream;
- CheckBox* mpCbWatermark;
- FixedText* mpFtWatermark;
- Edit* mpEdWatermark;
+ VclPtr<CheckBox> mpCbWatermark;
+ VclPtr<FixedText> mpFtWatermark;
+ VclPtr<Edit> mpEdWatermark;
bool mbIsPresentation;
bool mbIsWriter;
- const ImpPDFTabDialog* mpaParent;
+ VclPtr<ImpPDFTabDialog> mpaParent;
DECL_LINK( TogglePagesHdl, void* );
DECL_LINK( ToggleCompressionHdl, void* );
@@ -241,36 +243,37 @@ public:
ImpPDFTabGeneralPage( vcl::Window* pParent,
const SfxItemSet& rSet );
-
virtual ~ImpPDFTabGeneralPage();
- static SfxTabPage* Create( vcl::Window* pParent,
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
void GetFilterConfigItem(ImpPDFTabDialog* paParent);
- void SetFilterConfigItem(const ImpPDFTabDialog* paParent);
+ void SetFilterConfigItem(ImpPDFTabDialog* paParent);
bool IsPdfaSelected() const { return mpCbPDFA1b->IsChecked(); }
};
//class tab page viewer
class ImpPDFTabOpnFtrPage : public SfxTabPage
{
- RadioButton* mpRbOpnPageOnly;
- RadioButton* mpRbOpnOutline;
- RadioButton* mpRbOpnThumbs;
- NumericField* mpNumInitialPage;
-
- RadioButton* mpRbMagnDefault;
- RadioButton* mpRbMagnFitWin;
- RadioButton* mpRbMagnFitWidth;
- RadioButton* mpRbMagnFitVisible;
- RadioButton* mpRbMagnZoom;
- NumericField* mpNumZoom;
-
- RadioButton* mpRbPgLyDefault;
- RadioButton* mpRbPgLySinglePage;
- RadioButton* mpRbPgLyContinue;
- RadioButton* mpRbPgLyContinueFacing;
- CheckBox* mpCbPgLyFirstOnLeft;
+ VclPtr<RadioButton> mpRbOpnPageOnly;
+ VclPtr<RadioButton> mpRbOpnOutline;
+ VclPtr<RadioButton> mpRbOpnThumbs;
+ VclPtr<NumericField> mpNumInitialPage;
+
+ VclPtr<RadioButton> mpRbMagnDefault;
+ VclPtr<RadioButton> mpRbMagnFitWin;
+ VclPtr<RadioButton> mpRbMagnFitWidth;
+ VclPtr<RadioButton> mpRbMagnFitVisible;
+ VclPtr<RadioButton> mpRbMagnZoom;
+ VclPtr<NumericField> mpNumZoom;
+
+ VclPtr<RadioButton> mpRbPgLyDefault;
+ VclPtr<RadioButton> mpRbPgLySinglePage;
+ VclPtr<RadioButton> mpRbPgLyContinue;
+ VclPtr<RadioButton> mpRbPgLyContinueFacing;
+ VclPtr<CheckBox> mpCbPgLyFirstOnLeft;
bool mbUseCTLFont;
@@ -282,7 +285,8 @@ public:
const SfxItemSet& rSet );
virtual ~ImpPDFTabOpnFtrPage();
- static SfxTabPage* Create( vcl::Window* pParent,
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
void GetFilterConfigItem( ImpPDFTabDialog* paParent);
@@ -292,22 +296,22 @@ public:
//class tab page viewer
class ImpPDFTabViewerPage : public SfxTabPage
{
- CheckBox* m_pCbResWinInit;
- CheckBox* m_pCbCenterWindow;
- CheckBox* m_pCbOpenFullScreen;
- CheckBox* m_pCbDispDocTitle;
+ VclPtr<CheckBox> m_pCbResWinInit;
+ VclPtr<CheckBox> m_pCbCenterWindow;
+ VclPtr<CheckBox> m_pCbOpenFullScreen;
+ VclPtr<CheckBox> m_pCbDispDocTitle;
- CheckBox* m_pCbHideViewerMenubar;
- CheckBox* m_pCbHideViewerToolbar;
- CheckBox* m_pCbHideViewerWindowControls;
+ VclPtr<CheckBox> m_pCbHideViewerMenubar;
+ VclPtr<CheckBox> m_pCbHideViewerToolbar;
+ VclPtr<CheckBox> m_pCbHideViewerWindowControls;
- CheckBox* m_pCbTransitionEffects;
+ VclPtr<CheckBox> m_pCbTransitionEffects;
bool mbIsPresentation;
- RadioButton* m_pRbAllBookmarkLevels;
- RadioButton* m_pRbVisibleBookmarkLevels;
- NumericField* m_pNumBookmarkLevels;
+ VclPtr<RadioButton> m_pRbAllBookmarkLevels;
+ VclPtr<RadioButton> m_pRbVisibleBookmarkLevels;
+ VclPtr<NumericField> m_pNumBookmarkLevels;
DECL_LINK( ToggleRbBookmarksHdl, void* );
public:
@@ -315,7 +319,8 @@ public:
const SfxItemSet& rSet );
virtual ~ImpPDFTabViewerPage();
- static SfxTabPage* Create( vcl::Window* pParent,
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
void GetFilterConfigItem( ImpPDFTabDialog* paParent);
@@ -325,32 +330,32 @@ public:
//class security tab page
class ImpPDFTabSecurityPage : public SfxTabPage
{
- PushButton* mpPbSetPwd;
+ VclPtr<PushButton> mpPbSetPwd;
OUString msStrSetPwd;
- VclContainer* mpUserPwdSet;
- VclContainer* mpUserPwdUnset;
- VclContainer* mpUserPwdPdfa;
+ VclPtr<VclContainer> mpUserPwdSet;
+ VclPtr<VclContainer> mpUserPwdUnset;
+ VclPtr<VclContainer> mpUserPwdPdfa;
- VclContainer* mpOwnerPwdSet;
- VclContainer* mpOwnerPwdUnset;
- VclContainer* mpOwnerPwdPdfa;
+ VclPtr<VclContainer> mpOwnerPwdSet;
+ VclPtr<VclContainer> mpOwnerPwdUnset;
+ VclPtr<VclContainer> mpOwnerPwdPdfa;
- VclContainer* mpPrintPermissions;
- RadioButton* mpRbPrintNone;
- RadioButton* mpRbPrintLowRes;
- RadioButton* mpRbPrintHighRes;
+ VclPtr<VclContainer> mpPrintPermissions;
+ VclPtr<RadioButton> mpRbPrintNone;
+ VclPtr<RadioButton> mpRbPrintLowRes;
+ VclPtr<RadioButton> mpRbPrintHighRes;
- VclContainer* mpChangesAllowed;
- RadioButton* mpRbChangesNone;
- RadioButton* mpRbChangesInsDel;
- RadioButton* mpRbChangesFillForm;
- RadioButton* mpRbChangesComment;
- RadioButton* mpRbChangesAnyNoCopy;
+ VclPtr<VclContainer> mpChangesAllowed;
+ VclPtr<RadioButton> mpRbChangesNone;
+ VclPtr<RadioButton> mpRbChangesInsDel;
+ VclPtr<RadioButton> mpRbChangesFillForm;
+ VclPtr<RadioButton> mpRbChangesComment;
+ VclPtr<RadioButton> mpRbChangesAnyNoCopy;
- VclContainer* mpContent;
- CheckBox* mpCbEnableCopy;
- CheckBox* mpCbEnableAccessibility;
+ VclPtr<VclContainer> mpContent;
+ VclPtr<CheckBox> mpCbEnableCopy;
+ VclPtr<CheckBox> mpCbEnableAccessibility;
OUString msUserPwdTitle;
@@ -370,7 +375,8 @@ public:
const SfxItemSet& rSet );
virtual ~ImpPDFTabSecurityPage();
- static SfxTabPage* Create( vcl::Window* pParent,
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
void GetFilterConfigItem( ImpPDFTabDialog* paParent);
@@ -382,15 +388,15 @@ public:
//class to implement the relative link stuff
class ImpPDFTabLinksPage : public SfxTabPage
{
- CheckBox* m_pCbExprtBmkrToNmDst;
- CheckBox* m_pCbOOoToPDFTargets;
- CheckBox* m_pCbExportRelativeFsysLinks;
+ VclPtr<CheckBox> m_pCbExprtBmkrToNmDst;
+ VclPtr<CheckBox> m_pCbOOoToPDFTargets;
+ VclPtr<CheckBox> m_pCbExportRelativeFsysLinks;
- RadioButton* m_pRbOpnLnksDefault;
+ VclPtr<RadioButton> m_pRbOpnLnksDefault;
bool mbOpnLnksDefaultUserState;
- RadioButton* m_pRbOpnLnksLaunch;
+ VclPtr<RadioButton> m_pRbOpnLnksLaunch;
bool mbOpnLnksLaunchUserState;
- RadioButton* m_pRbOpnLnksBrowser;
+ VclPtr<RadioButton> m_pRbOpnLnksBrowser;
bool mbOpnLnksBrowserUserState;
DECL_LINK( ClickRbOpnLnksDefaultHdl, void* );
@@ -401,7 +407,8 @@ public:
const SfxItemSet& rSet );
virtual ~ImpPDFTabLinksPage();
- static SfxTabPage* Create( vcl::Window* pParent,
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
void GetFilterConfigItem( ImpPDFTabDialog* paParent);
@@ -413,14 +420,14 @@ public:
//class to implement the digital signing
class ImpPDFTabSigningPage : public SfxTabPage
{
- Edit* mpEdSignCert;
- PushButton* mpPbSignCertSelect;
- PushButton* mpPbSignCertClear;
- Edit* mpEdSignPassword;
- Edit* mpEdSignLocation;
- Edit* mpEdSignContactInfo;
- Edit* mpEdSignReason;
- ListBox* mpLBSignTSA;
+ VclPtr<Edit> mpEdSignCert;
+ VclPtr<PushButton> mpPbSignCertSelect;
+ VclPtr<PushButton> mpPbSignCertClear;
+ VclPtr<Edit> mpEdSignPassword;
+ VclPtr<Edit> mpEdSignLocation;
+ VclPtr<Edit> mpEdSignContactInfo;
+ VclPtr<Edit> mpEdSignReason;
+ VclPtr<ListBox> mpLBSignTSA;
com::sun::star::uno::Reference< com::sun::star::security::XCertificate > maSignCertificate;
DECL_LINK( ClickmaPbSignCertSelect, void* );
@@ -432,7 +439,8 @@ public:
const SfxItemSet& rSet );
virtual ~ImpPDFTabSigningPage();
- static SfxTabPage* Create( vcl::Window* pParent,
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
void GetFilterConfigItem( ImpPDFTabDialog* paParent);
diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx
index 93de5b4e9bc7..02042739e549 100644
--- a/filter/source/pdf/pdfdialog.cxx
+++ b/filter/source/pdf/pdfdialog.cxx
@@ -107,17 +107,11 @@ Sequence< OUString > SAL_CALL PDFDialog::getSupportedServiceNames()
-Dialog* PDFDialog::createDialog( vcl::Window* pParent )
+VclPtr<Dialog> PDFDialog::createDialog( vcl::Window* pParent )
{
- Dialog* pRet = NULL;
-
if( mxSrcDoc.is() )
- {
- ImpPDFTabDialog* pDlg = new ImpPDFTabDialog( pParent, maFilterData, mxSrcDoc );
- pRet = pDlg;
- }
-
- return pRet;
+ return VclPtr<ImpPDFTabDialog>::Create( pParent, maFilterData, mxSrcDoc );
+ return VclPtr<Dialog>();
}
@@ -125,7 +119,7 @@ Dialog* PDFDialog::createDialog( vcl::Window* pParent )
void PDFDialog::executedDialog( sal_Int16 nExecutionResult )
{
if( nExecutionResult && m_pDialog )
- maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog )->GetFilterData();
+ maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog.get() )->GetFilterData();
destroyDialog();
}
diff --git a/filter/source/pdf/pdfdialog.hxx b/filter/source/pdf/pdfdialog.hxx
index 85135fa24079..e343902e2481 100644
--- a/filter/source/pdf/pdfdialog.hxx
+++ b/filter/source/pdf/pdfdialog.hxx
@@ -51,7 +51,7 @@ protected:
virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual OUString SAL_CALL getImplementationName() throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException, std::exception) SAL_OVERRIDE;
- virtual Dialog* createDialog( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) SAL_OVERRIDE;
virtual void executedDialog( sal_Int16 nExecutionResult ) SAL_OVERRIDE;
virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 3e1349bf54f2..9605032b0981 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -131,8 +131,8 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
class FocusWindowWaitCursor
{
- vcl::Window* m_pFocusWindow;
- public:
+ VclPtr<vcl::Window> m_pFocusWindow;
+public:
FocusWindowWaitCursor() :
m_pFocusWindow( Application::GetFocusWindow() )
{
diff --git a/filter/source/pdf/pdfinteract.cxx b/filter/source/pdf/pdfinteract.cxx
index 579d9ef3fb40..d01281211ebf 100644
--- a/filter/source/pdf/pdfinteract.cxx
+++ b/filter/source/pdf/pdfinteract.cxx
@@ -53,8 +53,8 @@ sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Referen
sal_Int32 nCodes = aExc.ErrorCodes.getLength();
for( sal_Int32 i = 0; i < nCodes; i++ )
aCodes.insert( (vcl::PDFWriter::ErrorCode)aExc.ErrorCodes.getConstArray()[i] );
- ImplErrorDialog aDlg( aCodes );
- aDlg.Execute();
+ ScopedVclPtrInstance< ImplErrorDialog > aDlg( aCodes );
+ aDlg->Execute();
bHandled = true;
}
return bHandled;
diff --git a/filter/source/svg/impsvgdialog.cxx b/filter/source/svg/impsvgdialog.cxx
index 5fd3e6d218b4..2e70390f4890 100644
--- a/filter/source/svg/impsvgdialog.cxx
+++ b/filter/source/svg/impsvgdialog.cxx
@@ -36,73 +36,86 @@ inline sal_Int32 implMap( vcl::Window& /*rWnd*/, sal_Int32 nVal )
ImpSVGDialog::ImpSVGDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFilterData ) :
ModalDialog( pParent ),
- maFI( this ),
- maCBTinyProfile( this ),
- maCBEmbedFonts( this ),
- maCBUseNativeDecoration( this ),
- maBTOK( this, WB_DEF_OK ),
- maBTCancel( this ),
- maBTHelp( this ),
+ maFI( VclPtr<FixedLine>::Create(this) ),
+ maCBTinyProfile( VclPtr<CheckBox>::Create(this) ),
+ maCBEmbedFonts( VclPtr<CheckBox>::Create(this) ),
+ maCBUseNativeDecoration( VclPtr<CheckBox>::Create(this) ),
+ maBTOK( VclPtr<OKButton>::Create(this, WB_DEF_OK) ),
+ maBTCancel( VclPtr<CancelButton>::Create(this) ),
+ maBTHelp( VclPtr<HelpButton>::Create(this) ),
maConfigItem( SVG_EXPORTFILTER_CONFIGPATH, &rFilterData ),
mbOldNativeDecoration( false )
{
SetText( "SVG Export Options" );
SetOutputSizePixel( Size( implMap( *this, 177 ), implMap( *this, 77 ) ) );
- maFI.SetText( "Export" );
- maFI.SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
+ maFI->SetText( "Export" );
+ maFI->SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
Size( implMap( *this, 165 ), implMap( *this, 8 ) ) );
- maCBTinyProfile.SetText( "Use SVG Tiny profile" );
- maCBTinyProfile.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
+ maCBTinyProfile->SetText( "Use SVG Tiny profile" );
+ maCBTinyProfile->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
- maCBEmbedFonts.SetText( "Embed fonts" );
- maCBEmbedFonts.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
+ maCBEmbedFonts->SetText( "Embed fonts" );
+ maCBEmbedFonts->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
- maCBUseNativeDecoration.SetText( "Use SVG native text decoration" );
- maCBUseNativeDecoration.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
+ maCBUseNativeDecoration->SetText( "Use SVG native text decoration" );
+ maCBUseNativeDecoration->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
- maCBTinyProfile.Check( maConfigItem.ReadBool( OUString( SVG_PROP_TINYPROFILE ), false ) );
- maCBEmbedFonts.Check( maConfigItem.ReadBool( OUString( SVG_PROP_EMBEDFONTS ), true ) );
- maCBUseNativeDecoration.Check( maConfigItem.ReadBool( OUString( SVG_PROP_NATIVEDECORATION ), true ) );
+ maCBTinyProfile->Check( maConfigItem.ReadBool( OUString( SVG_PROP_TINYPROFILE ), false ) );
+ maCBEmbedFonts->Check( maConfigItem.ReadBool( OUString( SVG_PROP_EMBEDFONTS ), true ) );
+ maCBUseNativeDecoration->Check( maConfigItem.ReadBool( OUString( SVG_PROP_NATIVEDECORATION ), true ) );
- maBTOK.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
+ maBTOK->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
- maBTCancel.SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
+ maBTCancel->SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
- maBTHelp.SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
+ maBTHelp->SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
- maCBTinyProfile.SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) );
- OnToggleCheckbox( &maCBTinyProfile );
+ maCBTinyProfile->SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) );
+ OnToggleCheckbox( maCBTinyProfile.get() );
- maFI.Show();
+ maFI->Show();
- maCBTinyProfile.Show();
- maCBEmbedFonts.Show();
- maCBUseNativeDecoration.Show();
+ maCBTinyProfile->Show();
+ maCBEmbedFonts->Show();
+ maCBUseNativeDecoration->Show();
- maBTOK.Show();
- maBTCancel.Show();
- maBTHelp.Show();
+ maBTOK->Show();
+ maBTCancel->Show();
+ maBTHelp->Show();
}
ImpSVGDialog::~ImpSVGDialog()
{
+ disposeOnce();
+}
+
+void ImpSVGDialog::dispose()
+{
+ maFI.disposeAndClear();
+ maCBTinyProfile.disposeAndClear();
+ maCBEmbedFonts.disposeAndClear();
+ maCBUseNativeDecoration.disposeAndClear();
+ maBTOK.disposeAndClear();
+ maBTCancel.disposeAndClear();
+ maBTHelp.disposeAndClear();
+ ModalDialog::dispose();
}
Sequence< PropertyValue > ImpSVGDialog::GetFilterData()
{
- maConfigItem.WriteBool( OUString( SVG_PROP_TINYPROFILE ), maCBTinyProfile.IsChecked() );
- maConfigItem.WriteBool( OUString( SVG_PROP_EMBEDFONTS ), maCBEmbedFonts.IsChecked() );
- maConfigItem.WriteBool( OUString( SVG_PROP_NATIVEDECORATION ), maCBUseNativeDecoration.IsChecked() );
+ maConfigItem.WriteBool( OUString( SVG_PROP_TINYPROFILE ), maCBTinyProfile->IsChecked() );
+ maConfigItem.WriteBool( OUString( SVG_PROP_EMBEDFONTS ), maCBEmbedFonts->IsChecked() );
+ maConfigItem.WriteBool( OUString( SVG_PROP_NATIVEDECORATION ), maCBUseNativeDecoration->IsChecked() );
return( maConfigItem.GetFilterData() );
}
@@ -111,19 +124,19 @@ Sequence< PropertyValue > ImpSVGDialog::GetFilterData()
IMPL_LINK( ImpSVGDialog, OnToggleCheckbox, CheckBox*, pBox )
{
- if( pBox == &maCBTinyProfile )
+ if( pBox == maCBTinyProfile.get() )
{
if( pBox->IsChecked() )
{
- mbOldNativeDecoration = maCBUseNativeDecoration.IsChecked();
+ mbOldNativeDecoration = maCBUseNativeDecoration->IsChecked();
- maCBUseNativeDecoration.Check( false );
- maCBUseNativeDecoration.Disable();
+ maCBUseNativeDecoration->Check( false );
+ maCBUseNativeDecoration->Disable();
}
else
{
- maCBUseNativeDecoration.Enable();
- maCBUseNativeDecoration.Check( mbOldNativeDecoration );
+ maCBUseNativeDecoration->Enable();
+ maCBUseNativeDecoration->Check( mbOldNativeDecoration );
}
}
diff --git a/filter/source/svg/impsvgdialog.hxx b/filter/source/svg/impsvgdialog.hxx
index 657cd9a47bb9..ada5b71df1e3 100644
--- a/filter/source/svg/impsvgdialog.hxx
+++ b/filter/source/svg/impsvgdialog.hxx
@@ -48,17 +48,17 @@ class ImpSVGDialog : public ModalDialog
{
private:
- FixedLine maFI;
- CheckBox maCBTinyProfile;
- CheckBox maCBEmbedFonts;
- CheckBox maCBUseNativeDecoration;
+ VclPtr<FixedLine> maFI;
+ VclPtr<CheckBox> maCBTinyProfile;
+ VclPtr<CheckBox> maCBEmbedFonts;
+ VclPtr<CheckBox> maCBUseNativeDecoration;
- OKButton maBTOK;
- CancelButton maBTCancel;
- HelpButton maBTHelp;
+ VclPtr<OKButton> maBTOK;
+ VclPtr<CancelButton> maBTCancel;
+ VclPtr<HelpButton> maBTHelp;
- FilterConfigItem maConfigItem;
- bool mbOldNativeDecoration;
+ FilterConfigItem maConfigItem;
+ bool mbOldNativeDecoration;
DECL_LINK( OnToggleCheckbox, CheckBox* );
@@ -67,6 +67,7 @@ public:
ImpSVGDialog( vcl::Window* pParent, /*ResMgr& rResMgr,*/
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData );
virtual ~ImpSVGDialog();
+ virtual void dispose() SAL_OVERRIDE;
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetFilterData();
};
diff --git a/filter/source/svg/svgdialog.cxx b/filter/source/svg/svgdialog.cxx
index ccc9b45ee653..764fc89c99bb 100644
--- a/filter/source/svg/svgdialog.cxx
+++ b/filter/source/svg/svgdialog.cxx
@@ -143,11 +143,12 @@ Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames()
-Dialog* SVGDialog::createDialog( vcl::Window* pParent )
+VclPtr<Dialog> SVGDialog::createDialog( vcl::Window* pParent )
{
- return( ( /*KA: *mapResMgr.get() &&*/ mxSrcDoc.is() ) ?
- new ImpSVGDialog( pParent/*KA: , *mapResMgr*/, maFilterData ) :
- NULL );
+ if( mxSrcDoc.is() )
+ return VclPtr<ImpSVGDialog>::Create( pParent, maFilterData );
+ else
+ return VclPtr<Dialog>();
}
@@ -155,7 +156,7 @@ Dialog* SVGDialog::createDialog( vcl::Window* pParent )
void SVGDialog::executedDialog( sal_Int16 nExecutionResult )
{
if( nExecutionResult && m_pDialog )
- maFilterData = static_cast< ImpSVGDialog* >( m_pDialog )->GetFilterData();
+ maFilterData = static_cast< ImpSVGDialog* >( m_pDialog.get() )->GetFilterData();
destroyDialog();
}
diff --git a/filter/source/svg/svgdialog.hxx b/filter/source/svg/svgdialog.hxx
index 064240ff49c7..7c87789c2438 100644
--- a/filter/source/svg/svgdialog.hxx
+++ b/filter/source/svg/svgdialog.hxx
@@ -56,7 +56,7 @@ protected:
virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- virtual Dialog* createDialog( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog( vcl::Window* pParent ) SAL_OVERRIDE;
virtual void executedDialog( sal_Int16 nExecutionResult ) SAL_OVERRIDE;
virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
index b65370a423cb..231639aac3c3 100644
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@ -78,10 +78,10 @@ SVGFontExport::GlyphSet& SVGFontExport::implGetGlyphSet( const vcl::Font& rFont
void SVGFontExport::implCollectGlyphs()
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
ObjectVector::const_iterator aIter( maObjects.begin() );
- aVDev.EnableOutput( false );
+ pVDev->EnableOutput( false );
while( aIter != maObjects.end() )
{
@@ -89,7 +89,7 @@ void SVGFontExport::implCollectGlyphs()
{
const GDIMetaFile& rMtf = (*aIter).GetRepresentation();
- aVDev.Push();
+ pVDev->Push();
for( size_t i = 0, nCount = rMtf.GetActionSize(); i < nCount; ++i )
{
@@ -131,13 +131,13 @@ void SVGFontExport::implCollectGlyphs()
break;
default:
- pAction->Execute( &aVDev );
+ pAction->Execute( pVDev );
break;
}
if( !aText.isEmpty() )
{
- GlyphSet& rGlyphSet = implGetGlyphSet( aVDev.GetFont() );
+ GlyphSet& rGlyphSet = implGetGlyphSet( pVDev->GetFont() );
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBI(
::vcl::unohelper::CreateBreakIterator() );
@@ -168,7 +168,7 @@ void SVGFontExport::implCollectGlyphs()
}
}
- aVDev.Pop();
+ pVDev->Pop();
}
++aIter;
@@ -192,14 +192,14 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, "defs", true, true );
OUString aCurIdStr( aEmbeddedFontStr );
OUString aUnitsPerEM( OUString::number( nFontEM ) );
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
vcl::Font aFont( rFont );
aFont.SetSize( Size( 0, nFontEM ) );
aFont.SetAlign( ALIGN_BASELINE );
- aVDev.SetMapMode( MAP_100TH_MM );
- aVDev.SetFont( aFont );
+ pVDev->SetMapMode( MAP_100TH_MM );
+ pVDev->SetFont( aFont );
mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", aCurIdStr += OUString::number( ++mnCurFontId ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", aUnitsPerEM );
@@ -226,8 +226,8 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
mrExport.AddAttribute( XML_NAMESPACE_NONE, "units-per-em", aUnitsPerEM );
mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-weight", aFontWeight );
mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-style", aFontStyle );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", OUString::number( aVDev.GetFontMetric().GetAscent() ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", OUString::number( aVDev.GetFontMetric().GetDescent() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", OUString::number( pVDev->GetFontMetric().GetAscent() ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", OUString::number( pVDev->GetFontMetric().GetDescent() ) );
{
SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "font-face", true, true );
@@ -248,7 +248,7 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
while( aIter != rGlyphSet.end() )
{
- implEmbedGlyph( aVDev, *aIter );
+ implEmbedGlyph( *pVDev.get(), *aIter );
++aIter;
}
}
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 5774dfda9f04..59437328cd73 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1658,7 +1658,7 @@ SVGActionWriter::SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport
SVGActionWriter::~SVGActionWriter()
{
DBG_ASSERT( !mpContext, "Not all contexts are closed" );
- delete mpVDev;
+ mpVDev.disposeAndClear();
}
long SVGActionWriter::ImplMap( sal_Int32 nVal ) const
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index a74ca3032de4..2de237a268b2 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -178,7 +178,7 @@ class SVGTextWriter
private:
SVGExport& mrExport;
SVGAttributeWriter* mpContext;
- VirtualDevice* mpVDev;
+ VclPtr<VirtualDevice> mpVDev;
bool mbIsTextShapeStarted;
Reference<XText> mrTextShape;
OUString msShapeId;
@@ -303,7 +303,7 @@ private:
SVGFontExport& mrFontExport;
SVGAttributeWriter* mpContext;
SVGTextWriter maTextWriter;
- VirtualDevice* mpVDev;
+ VclPtr<VirtualDevice> mpVDev;
MapMode maTargetMapMode;
sal_uInt32 mnInnerMtfCount;
bool mbClipAttrChanged;
diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
index 4ca2d999d1b6..5d710e5b8e5d 100644
--- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
+++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
@@ -107,7 +107,7 @@ private:
com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxParent; /// parent window
com::sun::star::uno::Reference< XComponentContext > mxContext;
- XMLFilterSettingsDialog* mpDialog;
+ VclPtr<XMLFilterSettingsDialog> mpDialog;
};
@@ -266,11 +266,7 @@ void SAL_CALL XMLFilterDialogComponent::disposing()
{
::SolarMutexGuard aGuard;
- if( mpDialog )
- {
- delete mpDialog;
- mpDialog = NULL;
- }
+ mpDialog.disposeAndClear();
if (pXSLTResMgr)
{
@@ -328,14 +324,14 @@ sal_Int16 SAL_CALL XMLFilterDialogComponent::execute( ) throw(RuntimeException,
pXSLTResMgr = ResMgr::CreateResMgr( "xsltdlg", Application::GetSettings().GetUILanguageTag() );
}
- if( NULL == mpDialog )
+ if( nullptr == mpDialog )
{
vcl::Window* pParent = DIALOG_NO_PARENT;
if (mxParent.is())
pParent = VCLUnoHelper::GetWindow(mxParent);
Reference< XComponent > xComp( this );
- mpDialog = new XMLFilterSettingsDialog(pParent, mxContext);
+ mpDialog = VclPtr<XMLFilterSettingsDialog>::Create(pParent, mxContext);
mpDialog->Execute();
}
else if( !mpDialog->IsVisible() )
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index ba832bfea60b..5865d812f555 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -103,7 +103,24 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent,
}
}
+XMLFilterSettingsDialog::~XMLFilterSettingsDialog()
+{
+ disposeOnce();
+}
+void XMLFilterSettingsDialog::dispose()
+{
+ m_pFilterListBox.clear();
+ m_pCtrlFilterList.clear();
+ m_pPBNew.clear();
+ m_pPBEdit.clear();
+ m_pPBTest.clear();
+ m_pPBDelete.clear();
+ m_pPBSave.clear();
+ m_pPBOpen.clear();
+ m_pPBClose.clear();
+ ModelessDialog::dispose();
+}
IMPL_LINK(XMLFilterSettingsDialog, ClickHdl_Impl, PushButton *, pButton )
{
@@ -225,11 +242,11 @@ void XMLFilterSettingsDialog::onNew()
aTempInfo.maDocumentService = "com.sun.star.text.TextDocument";
// execute XML Filter Dialog
- XMLFilterTabDialog aDlg( this, *getXSLTDialogResMgr(), mxContext, &aTempInfo );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr(), mxContext, &aTempInfo );
+ if ( aDlg->Execute() == RET_OK )
{
// insert the new filter
- insertOrEdit( aDlg.getNewFilterInfo() );
+ insertOrEdit( aDlg->getNewFilterInfo() );
}
}
@@ -246,10 +263,10 @@ void XMLFilterSettingsDialog::onEdit()
filter_info_impl* pOldInfo = static_cast<filter_info_impl*>(pEntry->GetUserData());
// execute XML Filter Dialog
- XMLFilterTabDialog aDlg( this, *getXSLTDialogResMgr(), mxContext, pOldInfo );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr(), mxContext, pOldInfo );
+ if ( aDlg->Execute() == RET_OK )
{
- filter_info_impl* pNewInfo = aDlg.getNewFilterInfo();
+ filter_info_impl* pNewInfo = aDlg->getNewFilterInfo();
if( !(*pOldInfo == *pNewInfo) )
{
@@ -771,8 +788,8 @@ void XMLFilterSettingsDialog::onTest()
{
filter_info_impl* pInfo = static_cast<filter_info_impl*>(pEntry->GetUserData());
- XMLFilterTestDialog aDlg(this, mxContext);
- aDlg.test( *pInfo );
+ ScopedVclPtrInstance< XMLFilterTestDialog > aDlg(this, mxContext);
+ aDlg->test( *pInfo );
}
}
@@ -789,8 +806,8 @@ void XMLFilterSettingsDialog::onDelete()
OUString aMessage(RESIDSTR(STR_WARN_DELETE));
aMessage = aMessage.replaceFirst( aPlaceHolder, pInfo->maFilterName );
- WarningBox aWarnBox(this, (WinBits)(WB_YES_NO | WB_DEF_YES), aMessage );
- if( aWarnBox.Execute() == RET_YES )
+ ScopedVclPtrInstance< WarningBox > aWarnBox(this, (WinBits)(WB_YES_NO | WB_DEF_YES), aMessage );
+ if( aWarnBox->Execute() == RET_YES )
{
try
{
@@ -919,8 +936,8 @@ void XMLFilterSettingsDialog::onSave()
aMsg = aMsg.replaceFirst( sPlaceholder, aURL.GetName() );
}
- InfoBox aBox(this, aMsg );
- aBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aBox(this, aMsg );
+ aBox->Execute();
}
}
@@ -985,8 +1002,8 @@ void XMLFilterSettingsDialog::onOpen()
aMsg = aMsg.replaceFirst( sPlaceholder, OUString::number( nFilters ) );
}
- InfoBox aBox(this, aMsg );
- aBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aBox(this, aMsg );
+ aBox->Execute();
}
}
@@ -1339,12 +1356,12 @@ SvxPathControl::SvxPathControl(vcl::Window* pParent)
: Window(pParent, WB_HIDE | WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL | WB_BORDER)
, bHasBeenShown(false)
{
- m_pVBox = new VclVBox(this);
+ m_pVBox = VclPtr<VclVBox>::Create(this);
- m_pHeaderBar = new HeaderBar(m_pVBox, WB_BOTTOMBORDER);
+ m_pHeaderBar = VclPtr<HeaderBar>::Create(m_pVBox, WB_BOTTOMBORDER);
m_pHeaderBar->set_height_request(GetTextHeight() + 6);
- m_pFocusCtrl = new XMLFilterListBox(m_pVBox, this);
+ m_pFocusCtrl = VclPtr<XMLFilterListBox>::Create(m_pVBox, this);
m_pFocusCtrl->set_fill(true);
m_pFocusCtrl->set_expand(true);
@@ -1399,8 +1416,15 @@ Size SvxPathControl::GetOptimalSize() const
SvxPathControl::~SvxPathControl()
{
- delete m_pFocusCtrl;
- delete m_pHeaderBar;
+ disposeOnce();
+}
+
+void SvxPathControl::dispose()
+{
+ m_pFocusCtrl.disposeAndClear();
+ m_pHeaderBar.disposeAndClear();
+ m_pVBox.disposeAndClear();
+ vcl::Window::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPathControl(vcl::Window *pParent, VclBuilder::stringmap &)
@@ -1446,7 +1470,16 @@ XMLFilterListBox::XMLFilterListBox(Window* pParent, SvxPathControl* pPathControl
m_pHeaderBar->Show();
}
+XMLFilterListBox::~XMLFilterListBox()
+{
+ disposeOnce();
+}
+void XMLFilterListBox::dispose()
+{
+ m_pHeaderBar.clear();
+ SvTabListBox::dispose();
+}
void XMLFilterListBox::Paint( const Rectangle& rRect )
{
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
index 85bb4d79094a..df26aaf95685 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
@@ -39,9 +39,9 @@ class SvxPathControl : public vcl::Window
{
private:
bool bHasBeenShown;
- VclVBox* m_pVBox;
- HeaderBar* m_pHeaderBar;
- XMLFilterListBox* m_pFocusCtrl;
+ VclPtr<VclVBox> m_pVBox;
+ VclPtr<HeaderBar> m_pHeaderBar;
+ VclPtr<XMLFilterListBox> m_pFocusCtrl;
protected:
virtual void Resize() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
@@ -50,6 +50,7 @@ public:
HeaderBar* getHeaderBar() { return m_pHeaderBar; }
XMLFilterListBox* getListBox() { return m_pFocusCtrl; }
virtual ~SvxPathControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
@@ -59,7 +60,7 @@ class HeaderBar;
class XMLFilterListBox : public SvTabListBox
{
private:
- HeaderBar* m_pHeaderBar;
+ VclPtr<HeaderBar> m_pHeaderBar;
DECL_LINK( TabBoxScrollHdl_Impl, SvTabListBox* );
DECL_LINK( HeaderEndDrag_Impl, HeaderBar* );
@@ -68,6 +69,8 @@ private:
public:
XMLFilterListBox(Window* pParent, SvxPathControl* pPathControl);
+ virtual ~XMLFilterListBox();
+ virtual void dispose() SAL_OVERRIDE;
/** adds a new filter info entry to the ui filter list */
void addFilterEntry( const filter_info_impl* pInfo );
@@ -84,6 +87,8 @@ class XMLFilterSettingsDialog : public ModelessDialog
public:
XMLFilterSettingsDialog(vcl::Window* pParent,
const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext);
+ virtual ~XMLFilterSettingsDialog();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK(ClickHdl_Impl, PushButton * );
DECL_LINK(SelectionChangedHdl_Impl, void * );
@@ -124,15 +129,15 @@ private:
std::vector< filter_info_impl* > maFilterVector;
- XMLFilterListBox* m_pFilterListBox;
- SvxPathControl* m_pCtrlFilterList;
- PushButton* m_pPBNew;
- PushButton* m_pPBEdit;
- PushButton* m_pPBTest;
- PushButton* m_pPBDelete;
- PushButton* m_pPBSave;
- PushButton* m_pPBOpen;
- CloseButton* m_pPBClose;
+ VclPtr<XMLFilterListBox> m_pFilterListBox;
+ VclPtr<SvxPathControl> m_pCtrlFilterList;
+ VclPtr<PushButton> m_pPBNew;
+ VclPtr<PushButton> m_pPBEdit;
+ VclPtr<PushButton> m_pPBTest;
+ VclPtr<PushButton> m_pPBDelete;
+ VclPtr<PushButton> m_pPBSave;
+ VclPtr<PushButton> m_pPBOpen;
+ VclPtr<CloseButton> m_pPBClose;
bool m_bIsClosable;
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
index 4494a74ba799..ff725cc040fe 100644
--- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
@@ -56,13 +56,13 @@ XMLFilterTabDialog::XMLFilterTabDialog(vcl::Window *pParent, ResMgr& rResMgr,
m_pTabCtrl->SetActivatePageHdl( LINK( this, XMLFilterTabDialog, ActivatePageHdl ) );
m_pTabCtrl->SetDeactivatePageHdl( LINK( this, XMLFilterTabDialog, DeactivatePageHdl ) );
- mpBasicPage = new XMLFilterTabPageBasic(m_pTabCtrl);
+ mpBasicPage = VclPtr<XMLFilterTabPageBasic>::Create(m_pTabCtrl);
mpBasicPage->SetInfo( mpNewInfo );
m_nBasicPageId = m_pTabCtrl->GetPageId("general");
m_pTabCtrl->SetTabPage(m_nBasicPageId, mpBasicPage);
- mpXSLTPage = new XMLFilterTabPageXSLT(m_pTabCtrl);
+ mpXSLTPage = VclPtr<XMLFilterTabPageXSLT>::Create(m_pTabCtrl);
mpXSLTPage->SetInfo( mpNewInfo );
m_nXSLTPageId = m_pTabCtrl->GetPageId("transformation");
@@ -75,9 +75,17 @@ XMLFilterTabDialog::XMLFilterTabDialog(vcl::Window *pParent, ResMgr& rResMgr,
XMLFilterTabDialog::~XMLFilterTabDialog()
{
- delete mpBasicPage;
- delete mpXSLTPage;
+ disposeOnce();
+}
+
+void XMLFilterTabDialog::dispose()
+{
+ mpBasicPage.disposeAndClear();
+ mpXSLTPage.disposeAndClear();
delete mpNewInfo;
+ m_pTabCtrl.clear();
+ m_pOKBtn.clear();
+ TabDialog::dispose();
}
@@ -257,8 +265,8 @@ bool XMLFilterTabDialog::onOk()
aMessage = aMessage.replaceAll( "%s", aReplace1 );
}
- MessageDialog aBox(this, aMessage);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, aMessage);
+ aBox->Execute();
if( pFocusWindow )
pFocusWindow->GrabFocus();
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hxx b/filter/source/xsltdialog/xmlfiltertabdialog.hxx
index 1ec8594ceac4..221b704bb050 100644
--- a/filter/source/xsltdialog/xmlfiltertabdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.hxx
@@ -36,6 +36,7 @@ class XMLFilterTabDialog: public TabDialog
public:
XMLFilterTabDialog(vcl::Window *pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo);
virtual ~XMLFilterTabDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool onOk();
@@ -53,14 +54,14 @@ private:
const filter_info_impl* mpOldInfo;
filter_info_impl* mpNewInfo;
- TabControl* m_pTabCtrl;
- OKButton* m_pOKBtn;
+ VclPtr<TabControl> m_pTabCtrl;
+ VclPtr<OKButton> m_pOKBtn;
sal_Int16 m_nBasicPageId;
sal_Int16 m_nXSLTPageId;
- XMLFilterTabPageBasic* mpBasicPage;
- XMLFilterTabPageXSLT* mpXSLTPage;
+ VclPtr<XMLFilterTabPageBasic> mpBasicPage;
+ VclPtr<XMLFilterTabPageXSLT> mpXSLTPage;
};
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
index fb1d35ac2599..3f4d285a71a3 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
@@ -44,7 +44,19 @@ XMLFilterTabPageBasic::XMLFilterTabPageBasic(vcl::Window* pParent)
XMLFilterTabPageBasic::~XMLFilterTabPageBasic()
{
+ disposeOnce();
}
+
+void XMLFilterTabPageBasic::dispose()
+{
+ m_pEDFilterName.clear();
+ m_pCBApplication.clear();
+ m_pEDInterfaceName.clear();
+ m_pEDExtension.clear();
+ m_pEDDescription.clear();
+ TabPage::dispose();
+}
+
static OUString checkExtensions( const OUString& rExtensions )
{
const sal_Unicode* pSource = rExtensions.getStr();
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx
index 13d38d11e046..ac3876c868b8 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx
@@ -34,6 +34,7 @@ class XMLFilterTabPageBasic : public TabPage
public:
XMLFilterTabPageBasic(vcl::Window* pParent);
virtual ~XMLFilterTabPageBasic();
+ virtual void dispose() SAL_OVERRIDE;
bool FillInfo( filter_info_impl* pInfo );
void SetInfo(const filter_info_impl* pInfo);
@@ -41,11 +42,11 @@ public:
static OUString decodeComment( const OUString& rComment );
static OUString encodeComment( const OUString& rComment );
- Edit* m_pEDFilterName;
- ComboBox* m_pCBApplication;
- Edit* m_pEDInterfaceName;
- Edit* m_pEDExtension;
- VclMultiLineEdit* m_pEDDescription;
+ VclPtr<Edit> m_pEDFilterName;
+ VclPtr<ComboBox> m_pCBApplication;
+ VclPtr<Edit> m_pEDInterfaceName;
+ VclPtr<Edit> m_pEDExtension;
+ VclPtr<VclMultiLineEdit> m_pEDDescription;
};
#endif
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
index a9d1cae94360..717463bc5bc5 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
@@ -58,6 +58,20 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( vcl::Window* pParent) :
XMLFilterTabPageXSLT::~XMLFilterTabPageXSLT()
{
+ disposeOnce();
+}
+
+void XMLFilterTabPageXSLT::dispose()
+{
+ m_pEDDocType.clear();
+ m_pEDExportXSLT.clear();
+ m_pPBExprotXSLT.clear();
+ m_pEDImportXSLT.clear();
+ m_pPBImportXSLT.clear();
+ m_pEDImportTemplate.clear();
+ m_pPBImportTemplate.clear();
+ m_pCBNeedsXSLT2.clear();
+ TabPage::dispose();
}
bool XMLFilterTabPageXSLT::FillInfo( filter_info_impl* pInfo )
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx
index 01f36d518a7e..09c110fdb504 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx
@@ -35,6 +35,7 @@ class XMLFilterTabPageXSLT : public TabPage
public:
XMLFilterTabPageXSLT( vcl::Window* pParent);
virtual ~XMLFilterTabPageXSLT();
+ virtual void dispose() SAL_OVERRIDE;
bool FillInfo( filter_info_impl* pInfo );
void SetInfo(const filter_info_impl* pInfo);
@@ -42,18 +43,18 @@ public:
DECL_LINK( ClickBrowseHdl_Impl, PushButton * );
- Edit* m_pEDDocType;
+ VclPtr<Edit> m_pEDDocType;
- SvtURLBox* m_pEDExportXSLT;
- PushButton* m_pPBExprotXSLT;
+ VclPtr<SvtURLBox> m_pEDExportXSLT;
+ VclPtr<PushButton> m_pPBExprotXSLT;
- SvtURLBox* m_pEDImportXSLT;
- PushButton* m_pPBImportXSLT;
+ VclPtr<SvtURLBox> m_pEDImportXSLT;
+ VclPtr<PushButton> m_pPBImportXSLT;
- SvtURLBox* m_pEDImportTemplate;
- PushButton* m_pPBImportTemplate;
+ VclPtr<SvtURLBox> m_pEDImportTemplate;
+ VclPtr<PushButton> m_pPBImportTemplate;
- CheckBox* m_pCBNeedsXSLT2;
+ VclPtr<CheckBox> m_pCBNeedsXSLT2;
private:
void SetURL( SvtURLBox *rURLBox, const OUString& rURL );
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 359300e31ea9..2563cadada86 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -79,7 +79,7 @@ public:
// lang::XEventListener
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
private:
- XMLFilterTestDialog* mpDialog;
+ VclPtr<XMLFilterTestDialog> mpDialog;
};
GlobalEventListenerImpl::GlobalEventListenerImpl( XMLFilterTestDialog* pDialog )
@@ -178,6 +178,11 @@ XMLFilterTestDialog::XMLFilterTestDialog(vcl::Window* pParent,
XMLFilterTestDialog::~XMLFilterTestDialog()
{
+ disposeOnce();
+}
+
+void XMLFilterTestDialog::dispose()
+{
try
{
if( mxGlobalBroadcaster.is() )
@@ -189,6 +194,21 @@ XMLFilterTestDialog::~XMLFilterTestDialog()
}
delete m_pFilterInfo;
+ m_pExport.clear();
+ m_pFTExportXSLTFile.clear();
+ m_pPBExportBrowse.clear();
+ m_pPBCurrentDocument.clear();
+ m_pFTNameOfCurrentFile.clear();
+ m_pImport.clear();
+ m_pFTImportXSLTFile.clear();
+ m_pFTImportTemplate.clear();
+ m_pFTImportTemplateFile.clear();
+ m_pCBXDisplaySource.clear();
+ m_pPBImportBrowse.clear();
+ m_pPBRecentFile.clear();
+ m_pFTNameOfRecentFile.clear();
+ m_pPBClose.clear();
+ ModalDialog::dispose();
}
void XMLFilterTestDialog::test( const filter_info_impl& rFilterInfo )
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.hxx b/filter/source/xsltdialog/xmlfiltertestdialog.hxx
index 45953483b43a..3d69341fec30 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.hxx
@@ -37,6 +37,7 @@ public:
XMLFilterTestDialog(vcl::Window* pParent,
const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext);
virtual ~XMLFilterTestDialog();
+ virtual void dispose() SAL_OVERRIDE;
void test( const filter_info_impl& rFilterInfo );
@@ -65,21 +66,21 @@ private:
OUString m_sImportRecentFile;
OUString m_sExportRecentFile;
- VclContainer* m_pExport;
- FixedText* m_pFTExportXSLTFile;
- PushButton* m_pPBExportBrowse;
- PushButton* m_pPBCurrentDocument;
- FixedText* m_pFTNameOfCurrentFile;
-
- VclContainer* m_pImport;
- FixedText* m_pFTImportXSLTFile;
- FixedText* m_pFTImportTemplate;
- FixedText* m_pFTImportTemplateFile;
- CheckBox* m_pCBXDisplaySource;
- PushButton* m_pPBImportBrowse;
- PushButton* m_pPBRecentFile;
- FixedText* m_pFTNameOfRecentFile;
- CloseButton* m_pPBClose;
+ VclPtr<VclContainer> m_pExport;
+ VclPtr<FixedText> m_pFTExportXSLTFile;
+ VclPtr<PushButton> m_pPBExportBrowse;
+ VclPtr<PushButton> m_pPBCurrentDocument;
+ VclPtr<FixedText> m_pFTNameOfCurrentFile;
+
+ VclPtr<VclContainer> m_pImport;
+ VclPtr<FixedText> m_pFTImportXSLTFile;
+ VclPtr<FixedText> m_pFTImportTemplate;
+ VclPtr<FixedText> m_pFTImportTemplateFile;
+ VclPtr<CheckBox> m_pCBXDisplaySource;
+ VclPtr<PushButton> m_pPBImportBrowse;
+ VclPtr<PushButton> m_pPBRecentFile;
+ VclPtr<FixedText> m_pFTNameOfRecentFile;
+ VclPtr<CloseButton> m_pPBClose;
filter_info_impl* m_pFilterInfo;
diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx
index 39a29a2b9651..03d708752ae5 100644
--- a/forms/source/richtext/richtextcontrol.cxx
+++ b/forms/source/richtext/richtextcontrol.cxx
@@ -290,7 +290,7 @@ namespace frm
pPeer->acquire(); // by definition, the returned object is acquired once
// the VCL control for the peer
- RichTextControl* pRichTextControl = new RichTextControl( pEngine, _pParentWindow, _nStyle, NULL, pPeer );
+ VclPtrInstance<RichTextControl> pRichTextControl( pEngine, _pParentWindow, _nStyle, nullptr, pPeer );
// some knittings
pRichTextControl->SetComponentInterface( pPeer );
@@ -314,7 +314,7 @@ namespace frm
{
{
SolarMutexGuard aGuard;
- RichTextControl* pRichTextControl = static_cast< RichTextControl* >( GetWindow() );
+ VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl >();
if ( pRichTextControl )
{
@@ -340,7 +340,7 @@ namespace frm
{
SolarMutexGuard aGuard;
- RichTextControl* pControl = static_cast< RichTextControl* >( GetWindow() );
+ VclPtr< RichTextControl > pControl = GetAs< RichTextControl >();
if ( !pControl )
return;
@@ -375,7 +375,7 @@ namespace frm
if ( _rPropertyName == PROPERTY_BACKGROUNDCOLOR )
{
- RichTextControl* pControl = static_cast< RichTextControl* >( GetWindow() );
+ VclPtr< RichTextControl > pControl = GetAs< RichTextControl >();
if ( !_rValue.hasValue() )
{
pControl->SetBackgroundColor( );
@@ -401,7 +401,7 @@ namespace frm
}
else if ( _rPropertyName == PROPERTY_READONLY )
{
- RichTextControl* pControl = static_cast< RichTextControl* >( GetWindow() );
+ VclPtr< RichTextControl > pControl = GetAs< RichTextControl >();
bool bReadOnly( pControl->IsReadOnly() );
OSL_VERIFY( _rValue >>= bReadOnly );
pControl->SetReadOnly( bReadOnly );
@@ -417,7 +417,7 @@ namespace frm
}
else if ( _rPropertyName == PROPERTY_HIDEINACTIVESELECTION )
{
- RichTextControl* pRichTextControl = static_cast< RichTextControl* >( GetWindow() );
+ VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl >();
bool bHide = pRichTextControl->GetHideInactiveSelection();
OSL_VERIFY( _rValue >>= bHide );
pRichTextControl->SetHideInactiveSelection( bHide );
@@ -469,7 +469,7 @@ namespace frm
ORichTextPeer::SingleAttributeDispatcher ORichTextPeer::implCreateDispatcher( SfxSlotId _nSlotId, const ::com::sun::star::util::URL& _rURL )
{
- RichTextControl* pRichTextControl = static_cast< RichTextControl* >( GetWindow() );
+ VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl >();
OSL_PRECOND( pRichTextControl, "ORichTextPeer::implCreateDispatcher: invalid window!" );
if ( !pRichTextControl )
return SingleAttributeDispatcher( NULL );
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx
index a29f626749af..50c483b97151 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -56,7 +56,7 @@ namespace frm
OSL_ENSURE( m_pAntiImpl, "RichTextControlImpl::RichTextControlImpl: invalid window!" );
OSL_ENSURE( m_pEngine, "RichTextControlImpl::RichTextControlImpl: invalid edit engine! This will *definitely* crash!" );
- m_pViewport = new RichTextViewPort( m_pAntiImpl );
+ m_pViewport = VclPtr<RichTextViewPort>::Create( m_pAntiImpl );
m_pViewport->setAttributeInvalidationHandler( LINK( this, RichTextControlImpl, OnInvalidateAllAttributes ) );
m_pViewport->Show();
@@ -91,10 +91,10 @@ namespace frm
m_pEngine->RemoveView( m_pView );
m_pEngine->revokeEngineStatusListener( this );
delete m_pView;
- delete m_pViewport;
- delete m_pHScroll;
- delete m_pVScroll;
- delete m_pScrollCorner;
+ m_pViewport.disposeAndClear();
+ m_pHScroll.disposeAndClear();
+ m_pVScroll.disposeAndClear();
+ m_pScrollCorner.disposeAndClear();
}
@@ -344,38 +344,35 @@ namespace frm
// create or delete the scrollbars, as necessary
if ( !bNeedVScroll )
{
- delete m_pVScroll;
- m_pVScroll = NULL;
+ m_pVScroll.disposeAndClear();
}
else
{
- m_pVScroll = new ScrollBar( m_pAntiImpl, WB_VSCROLL | WB_DRAG | WB_REPEAT );
+ m_pVScroll = VclPtr<ScrollBar>::Create( m_pAntiImpl, WB_VSCROLL | WB_DRAG | WB_REPEAT );
m_pVScroll->SetScrollHdl ( LINK( this, RichTextControlImpl, OnVScroll ) );
m_pVScroll->Show();
}
if ( !bNeedHScroll )
{
- delete m_pHScroll;
- m_pHScroll = NULL;
+ m_pHScroll.disposeAndClear();
}
else
{
- m_pHScroll = new ScrollBar( m_pAntiImpl, WB_HSCROLL | WB_DRAG | WB_REPEAT );
+ m_pHScroll = VclPtr<ScrollBar>::Create( m_pAntiImpl, WB_HSCROLL | WB_DRAG | WB_REPEAT );
m_pHScroll->SetScrollHdl ( LINK( this, RichTextControlImpl, OnHScroll ) );
m_pHScroll->Show();
}
if ( m_pHScroll && m_pVScroll )
{
- delete m_pScrollCorner;
- m_pScrollCorner = new ScrollBarBox( m_pAntiImpl );
+ m_pScrollCorner.disposeAndClear();
+ m_pScrollCorner = VclPtr<ScrollBarBox>::Create( m_pAntiImpl );
m_pScrollCorner->Show();
}
else
{
- delete m_pScrollCorner;
- m_pScrollCorner = NULL;
+ m_pScrollCorner.disposeAndClear();
}
layoutWindow();
diff --git a/forms/source/richtext/richtextimplcontrol.hxx b/forms/source/richtext/richtextimplcontrol.hxx
index 0b6c42cc63ad..2f0acb1da700 100644
--- a/forms/source/richtext/richtextimplcontrol.hxx
+++ b/forms/source/richtext/richtextimplcontrol.hxx
@@ -52,11 +52,11 @@ namespace frm
ESelection m_aLastKnownSelection;
- Control* m_pAntiImpl;
- RichTextViewPort* m_pViewport;
- ScrollBar* m_pHScroll;
- ScrollBar* m_pVScroll;
- ScrollBarBox* m_pScrollCorner;
+ VclPtr<Control> m_pAntiImpl;
+ VclPtr<RichTextViewPort> m_pViewport;
+ VclPtr<ScrollBar> m_pHScroll;
+ VclPtr<ScrollBar> m_pVScroll;
+ VclPtr<ScrollBarBox> m_pScrollCorner;
RichTextEngine* m_pEngine;
EditView* m_pView;
ITextAttributeListener* m_pTextAttrListener;
@@ -166,8 +166,8 @@ namespace frm
/// ensures that our "automatic line break" setting matches the current WinBits of the window
void ensureLineBreakSetting();
- inline bool hasVScrollBar( ) const { return m_pVScroll != NULL; }
- inline bool hasHScrollBar( ) const { return m_pHScroll != NULL; }
+ inline bool hasVScrollBar( ) const { return m_pVScroll != nullptr; }
+ inline bool hasHScrollBar( ) const { return m_pHScroll != nullptr; }
// IEngineStatusListener overridables
virtual void EditEngineStatusChanged( const EditStatus& _rStatus ) SAL_OVERRIDE;
diff --git a/forms/source/richtext/richtextvclcontrol.cxx b/forms/source/richtext/richtextvclcontrol.cxx
index 722bdefa52d7..d7286204921c 100644
--- a/forms/source/richtext/richtextvclcontrol.cxx
+++ b/forms/source/richtext/richtextvclcontrol.cxx
@@ -59,7 +59,13 @@ namespace frm
RichTextControl::~RichTextControl( )
{
+ disposeOnce();
+ }
+
+ void RichTextControl::dispose()
+ {
delete m_pImpl;
+ Control::dispose();
}
diff --git a/forms/source/richtext/richtextvclcontrol.hxx b/forms/source/richtext/richtextvclcontrol.hxx
index 4e3123d0b75a..b5532ca4bc0f 100644
--- a/forms/source/richtext/richtextvclcontrol.hxx
+++ b/forms/source/richtext/richtextvclcontrol.hxx
@@ -52,6 +52,7 @@ namespace frm
);
virtual ~RichTextControl( );
+ virtual void dispose() SAL_OVERRIDE;
/* enables the change notifications for a particular attribute
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index e6e831d27539..880fa0f405ba 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -445,8 +445,8 @@ namespace frm
if(needConfirmation)
{
// TODO: shouldn't this be done with an interaction handler?
- QueryBox aQuery( NULL, WB_YES_NO_CANCEL | WB_DEF_YES, FRM_RES_STRING( RID_STR_QUERY_SAVE_MODIFIED_ROW ) );
- switch ( aQuery.Execute() )
+ ScopedVclPtrInstance< QueryBox > aQuery( nullptr, WB_YES_NO_CANCEL | WB_DEF_YES, FRM_RES_STRING( RID_STR_QUERY_SAVE_MODIFIED_ROW ) );
+ switch ( aQuery->Execute() )
{
case RET_NO:
shouldCommit = false;
diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx
index 3f2afea11653..6d335d9bf3de 100644
--- a/forms/source/solar/component/navbarcontrol.cxx
+++ b/forms/source/solar/component/navbarcontrol.cxx
@@ -223,7 +223,7 @@ namespace frm
// the VCL control for the peer
Reference< XModel > xContextDocument( getXModel( _rxModel ) );
- NavigationToolBar* pNavBar = new NavigationToolBar(
+ VclPtrInstance<NavigationToolBar> pNavBar(
_pParentWindow,
lcl_getWinBits_nothrow( _rxModel ),
createDocumentCommandImageProvider( _rxORB, xContextDocument ),
@@ -275,7 +275,7 @@ namespace frm
{
SolarMutexGuard aGuard;
- NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
+ VclPtr< NavigationToolBar > pNavBar = GetAs< NavigationToolBar >();
if ( !pNavBar )
{
VCLXWindow::setProperty( _rPropertyName, _rValue );
@@ -356,7 +356,7 @@ namespace frm
SolarMutexGuard aGuard;
Any aReturn;
- NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
+ VclPtr< NavigationToolBar > pNavBar = GetAs< NavigationToolBar >();
if ( _rPropertyName == PROPERTY_BACKGROUNDCOLOR )
{
@@ -408,7 +408,7 @@ namespace frm
void ONavigationBarPeer::featureStateChanged( sal_Int16 _nFeatureId, bool _bEnabled )
{
// enable this button on the toolbox
- NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
+ VclPtr< NavigationToolBar > pNavBar = GetAs< NavigationToolBar >();
if ( pNavBar )
{
pNavBar->enableFeature( _nFeatureId, _bEnabled );
@@ -436,7 +436,7 @@ namespace frm
void ONavigationBarPeer::allFeatureStatesChanged( )
{
// force the control to update it's states
- NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
+ VclPtr< NavigationToolBar > pNavBar = GetAs< NavigationToolBar >();
if ( pNavBar )
pNavBar->setDispatcher( this );
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx
index 3ccbf2eb8457..19bcd6937d5f 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -147,14 +147,16 @@ namespace frm
NavigationToolBar::~NavigationToolBar( )
{
- for ( ::std::vector< vcl::Window* >::iterator loopChildWins = m_aChildWins.begin();
- loopChildWins != m_aChildWins.end();
- ++loopChildWins
- )
- {
- delete *loopChildWins;
- }
- delete m_pToolbar;
+ disposeOnce();
+ }
+
+ void NavigationToolBar::dispose()
+ {
+ for (auto i = m_aChildWins.begin(); i != m_aChildWins.end(); ++i)
+ i->disposeAndClear();
+ m_aChildWins.clear();
+ m_pToolbar.disposeAndClear();
+ vcl::Window::dispose();
}
@@ -234,7 +236,7 @@ namespace frm
void NavigationToolBar::implInit( )
{
- m_pToolbar = new ImplNavToolBar( this );
+ m_pToolbar = VclPtr<ImplNavToolBar>::Create( this );
m_pToolbar->SetOutStyle( TOOLBOX_STYLE_FLAT );
m_pToolbar->Show();
@@ -299,17 +301,17 @@ namespace frm
vcl::Window* pItemWindow = NULL;
if ( FormFeature::MoveAbsolute == pSupportedFeatures->nId )
{
- pItemWindow = new RecordPositionInput( m_pToolbar );
+ pItemWindow = VclPtr<RecordPositionInput>::Create( m_pToolbar );
static_cast< RecordPositionInput* >( pItemWindow )->setDispatcher( m_pDispatcher );
}
else if ( LID_RECORD_FILLER == pSupportedFeatures->nId )
{
- pItemWindow = new FixedText( m_pToolbar, WB_CENTER | WB_VCENTER );
+ pItemWindow = VclPtr<FixedText>::Create( m_pToolbar, WB_CENTER | WB_VCENTER );
pItemWindow->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
}
else
{
- pItemWindow = new FixedText( m_pToolbar, WB_VCENTER );
+ pItemWindow = VclPtr<FixedText>::Create( m_pToolbar, WB_VCENTER );
pItemWindow->SetBackground();
pItemWindow->SetPaintTransparent(true);
}
@@ -658,11 +660,6 @@ namespace frm
}
- RecordPositionInput::~RecordPositionInput()
- {
- }
-
-
void RecordPositionInput::setDispatcher( const IFeatureDispatcher* _pDispatcher )
{
m_pDispatcher = _pDispatcher;
diff --git a/forms/source/solar/inc/navtoolbar.hxx b/forms/source/solar/inc/navtoolbar.hxx
index 5be47c86c5f1..79d126655a03 100644
--- a/forms/source/solar/inc/navtoolbar.hxx
+++ b/forms/source/solar/inc/navtoolbar.hxx
@@ -60,8 +60,8 @@ namespace frm
const ::boost::shared_ptr< const ICommandDescriptionProvider >
m_pDescriptionProvider;
ImageSize m_eImageSize;
- ImplNavToolBar* m_pToolbar;
- ::std::vector< vcl::Window* > m_aChildWins;
+ VclPtr<ImplNavToolBar> m_pToolbar;
+ ::std::vector< VclPtr<vcl::Window> > m_aChildWins;
public:
NavigationToolBar(
@@ -71,6 +71,7 @@ namespace frm
const ::boost::shared_ptr< const ICommandDescriptionProvider >& _pDescriptionProvider
);
virtual ~NavigationToolBar( );
+ virtual void dispose() SAL_OVERRIDE;
/** sets the dispatcher which is to be used for the features
@@ -158,7 +159,6 @@ namespace frm
public:
RecordPositionInput( vcl::Window* _pParent );
- virtual ~RecordPositionInput();
/** sets the dispatcher which is to be used for the features
*/
diff --git a/formula/source/ui/dlg/ControlHelper.hxx b/formula/source/ui/dlg/ControlHelper.hxx
index 4c7e56420c22..aba773361dcf 100644
--- a/formula/source/ui/dlg/ControlHelper.hxx
+++ b/formula/source/ui/dlg/ControlHelper.hxx
@@ -29,7 +29,7 @@ class EditBox : public Control
{
private:
- MultiLineEdit* pMEdit;
+ VclPtr<MultiLineEdit> pMEdit;
Link aSelChangedLink;
Selection aOldSel;
bool bMouseFlag;
@@ -48,6 +48,7 @@ public:
EditBox( vcl::Window* pParent, WinBits nBits );
virtual ~EditBox();
+ virtual void dispose() SAL_OVERRIDE;
MultiLineEdit* GetEdit() {return pMEdit;}
@@ -64,6 +65,8 @@ class ArgEdit : public RefEdit
{
public:
ArgEdit( vcl::Window* pParent, WinBits nBits );
+ virtual ~ArgEdit();
+ virtual void dispose() SAL_OVERRIDE;
void Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
ScrollBar& rArgSlider, sal_uInt16 nArgCount );
@@ -72,9 +75,9 @@ protected:
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
private:
- ArgEdit* pEdPrev;
- ArgEdit* pEdNext;
- ScrollBar* pSlider;
+ VclPtr<ArgEdit> pEdPrev;
+ VclPtr<ArgEdit> pEdNext;
+ VclPtr<ScrollBar> pSlider;
sal_uInt16 nArgs;
};
@@ -93,10 +96,10 @@ private:
Link aEdFocusLink;
Link aEdModifyLink;
- FixedText* pFtArg;
- PushButton* pBtnFx;
- ArgEdit* pEdArg;
- RefButton* pRefBtn;
+ VclPtr<FixedText> pFtArg;
+ VclPtr<PushButton> pBtnFx;
+ VclPtr<ArgEdit> pEdArg;
+ VclPtr<RefButton> pRefBtn;
DECL_LINK( FxBtnClickHdl, ImageButton* );
DECL_LINK( RefBtnClickHdl,RefButton* );
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 15ca7bde9c9b..7f20431ab1bb 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -146,43 +146,43 @@ namespace formula
mutable const sheet::FormulaOpCodeMapEntry* m_pBinaryOpCodesEnd;
::std::map<FormulaToken*,sheet::FormulaToken> m_aTokenMap;
IFormulaEditorHelper* m_pHelper;
- Dialog* m_pParent;
+ VclPtr<Dialog> m_pParent;
IControlReferenceHandler* m_pDlg;
- TabControl *m_pTabCtrl;
- VclVBox *m_pParaWinBox;
- ParaWin* pParaWin;
- FixedText *m_pFtHeadLine;
- FixedText *m_pFtFuncName;
- FixedText *m_pFtFuncDesc;
+ VclPtr<TabControl> m_pTabCtrl;
+ VclPtr<VclVBox> m_pParaWinBox;
+ VclPtr<ParaWin> pParaWin;
+ VclPtr<FixedText> m_pFtHeadLine;
+ VclPtr<FixedText> m_pFtFuncName;
+ VclPtr<FixedText> m_pFtFuncDesc;
- FixedText *m_pFtEditName;
+ VclPtr<FixedText> m_pFtEditName;
- FixedText *m_pFtResult;
- Edit *m_pWndResult;
+ VclPtr<FixedText> m_pFtResult;
+ VclPtr<Edit> m_pWndResult;
- FixedText *m_pFtFormula;
- EditBox *m_pMEFormula;
+ VclPtr<FixedText> m_pFtFormula;
+ VclPtr<EditBox> m_pMEFormula;
- CheckBox *m_pBtnMatrix;
- CancelButton *m_pBtnCancel;
+ VclPtr<CheckBox> m_pBtnMatrix;
+ VclPtr<CancelButton> m_pBtnCancel;
- PushButton *m_pBtnBackward;
- PushButton *m_pBtnForward;
- OKButton *m_pBtnEnd;
+ VclPtr<PushButton> m_pBtnBackward;
+ VclPtr<PushButton> m_pBtnForward;
+ VclPtr<OKButton> m_pBtnEnd;
- RefEdit *m_pEdRef;
- RefButton *m_pRefBtn;
+ VclPtr<RefEdit> m_pEdRef;
+ VclPtr<RefButton> m_pRefBtn;
- FixedText *m_pFtFormResult;
- Edit *m_pWndFormResult;
+ VclPtr<FixedText> m_pFtFormResult;
+ VclPtr<Edit> m_pWndFormResult;
- RefEdit* pTheRefEdit;
- RefButton* pTheRefButton;
- FuncPage* pFuncPage;
- StructPage* pStructPage;
+ VclPtr<RefEdit> pTheRefEdit;
+ VclPtr<RefButton> pTheRefButton;
+ VclPtr<FuncPage> pFuncPage;
+ VclPtr<StructPage> pStructPage;
OUString aOldFormula;
bool bStructUpdate;
- MultiLineEdit* pMEdit;
+ VclPtr<MultiLineEdit> pMEdit;
bool bUserMatrixFlag;
Idle aIdle;
@@ -286,7 +286,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
pParent->get(m_pRefBtn, "RB_REF");
m_pRefBtn->SetReferences(_pDlg, m_pEdRef);
- pParaWin = new ParaWin(m_pParaWinBox, _pDlg);
+ pParaWin = VclPtr<ParaWin>::Create(m_pParaWinBox, _pDlg);
pParaWin->Show();
m_pParaWinBox->Hide();
m_pFtEditName->Hide();
@@ -306,8 +306,8 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
pParaWin->SetArgModifiedHdl(LINK( this, FormulaDlg_Impl, ModifyHdl ) );
pParaWin->SetFxHdl(LINK( this, FormulaDlg_Impl, FxHdl ) );
- pFuncPage= new FuncPage( m_pTabCtrl,_pFunctionMgr);
- pStructPage= new StructPage( m_pTabCtrl);
+ pFuncPage= VclPtr<FuncPage>::Create( m_pTabCtrl,_pFunctionMgr);
+ pStructPage= VclPtr<StructPage>::Create( m_pTabCtrl);
pFuncPage->Hide();
pStructPage->Hide();
m_pTabCtrl->SetTabPage( TP_FUNCTION, pFuncPage);
@@ -364,9 +364,9 @@ FormulaDlg_Impl::~FormulaDlg_Impl()
m_pTabCtrl->RemovePage(TP_FUNCTION);
m_pTabCtrl->RemovePage(TP_STRUCT);
- delete pStructPage;
- delete pFuncPage;
- delete pParaWin;
+ pStructPage.disposeAndClear();
+ pFuncPage.disposeAndClear();
+ pParaWin.disposeAndClear();
DeleteArgs();
}
@@ -1426,7 +1426,7 @@ void FormulaDlg_Impl::UpdateSelection()
m_pRefBtn->Show( pButton != NULL );
::std::pair<RefButton*,RefEdit*> aPair;
- aPair.first = pButton ? m_pRefBtn : NULL;
+ aPair.first = pButton ? m_pRefBtn.get() : NULL;
aPair.second = m_pEdRef;
return aPair;
}
@@ -1473,7 +1473,7 @@ void FormulaDlg_Impl::RefInputDoneAfter( bool bForced )
}
RefEdit* FormulaDlg_Impl::GetCurrRefEdit()
{
- return m_pEdRef->IsVisible() ? m_pEdRef : pParaWin->GetActiveEdit();
+ return m_pEdRef->IsVisible() ? m_pEdRef.get() : pParaWin->GetActiveEdit();
}
void FormulaDlg_Impl::Update()
{
@@ -1612,7 +1612,7 @@ bool FormulaDlg_Impl::UpdateParaWin(Selection& _rSelection)
OUString aStrEd;
Edit* pEd = GetCurrRefEdit();
- if(pEd!=NULL && pTheRefEdit==NULL)
+ if(pEd!=NULL && pTheRefEdit==nullptr)
{
_rSelection=pEd->GetSelection();
_rSelection.Justify();
@@ -1626,7 +1626,7 @@ bool FormulaDlg_Impl::UpdateParaWin(Selection& _rSelection)
_rSelection.Justify();
aStrEd= m_pEdRef->GetText();
}
- return pTheRefEdit == NULL;
+ return pTheRefEdit == nullptr;
}
void FormulaDlg_Impl::SetEdSelection()
diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx
index a977b174d543..886cab46c063 100644
--- a/formula/source/ui/dlg/funcpage.cxx
+++ b/formula/source/ui/dlg/funcpage.cxx
@@ -91,6 +91,18 @@ FuncPage::FuncPage(vcl::Window* pParent,const IFunctionManager* _pFunctionManage
m_pLbFunction->SetDoubleClickHdl( LINK( this, FuncPage, DblClkHdl ) );
}
+FuncPage::~FuncPage()
+{
+ disposeOnce();
+}
+
+void FuncPage::dispose()
+{
+ m_pLbCategory.clear();
+ m_pLbFunction.clear();
+ TabPage::dispose();
+}
+
void FuncPage::impl_addFunctions(const IFunctionCategory* _pCategory)
{
const sal_uInt32 nCount = _pCategory->getCount();
diff --git a/formula/source/ui/dlg/funcpage.hxx b/formula/source/ui/dlg/funcpage.hxx
index 62d803dd8ed6..87a2799dcfac 100644
--- a/formula/source/ui/dlg/funcpage.hxx
+++ b/formula/source/ui/dlg/funcpage.hxx
@@ -64,8 +64,8 @@ private:
OModuleClient m_aModuleClient;
Link aDoubleClickLink;
Link aSelectionLink;
- ListBox *m_pLbCategory;
- FormulaListBox *m_pLbFunction;
+ VclPtr<ListBox> m_pLbCategory;
+ VclPtr<FormulaListBox> m_pLbFunction;
const IFunctionManager*
m_pFunctionManager;
@@ -86,6 +86,8 @@ protected:
public:
FuncPage( vcl::Window* pParent,const IFunctionManager* _pFunctionManager);
+ virtual ~FuncPage();
+ virtual void dispose() SAL_OVERRIDE;
void SetCategory(sal_Int32 nCat);
void SetFunction(sal_Int32 nFunc);
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index d6313d418a0a..271d8b83cafa 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -42,6 +42,19 @@ ArgEdit::ArgEdit( vcl::Window* pParent, WinBits nBits )
{
}
+ArgEdit::~ArgEdit()
+{
+ disposeOnce();
+}
+
+void ArgEdit::dispose()
+{
+ pEdPrev.clear();
+ pEdNext.clear();
+ pSlider.clear();
+ RefEdit::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeArgEdit(vcl::Window *pParent, VclBuilder::stringmap &)
{
return new ArgEdit(pParent, WB_BORDER);
@@ -149,17 +162,17 @@ void ArgInput::InitArgInput( FixedText* pftArg, PushButton* pbtnFx,
pEdArg =pedArg;
pRefBtn=prefBtn;
- if(pBtnFx!=NULL)
+ if(pBtnFx!=nullptr)
{
pBtnFx->SetClickHdl ( LINK( this, ArgInput, FxBtnClickHdl ) );
pBtnFx->SetGetFocusHdl( LINK( this, ArgInput, FxBtnFocusHdl ) );
}
- if(pRefBtn!=NULL)
+ if(pRefBtn!=nullptr)
{
pRefBtn->SetClickHdl ( LINK( this, ArgInput, RefBtnClickHdl ) );
pRefBtn->SetGetFocusHdl( LINK( this, ArgInput, RefBtnFocusHdl ) );
}
- if(pEdArg!=NULL)
+ if(pEdArg!=nullptr)
{
pEdArg->SetGetFocusHdl ( LINK( this, ArgInput, EdFocusHdl ) );
pEdArg->SetModifyHdl ( LINK( this, ArgInput, EdModifyHdl ) );
@@ -170,14 +183,14 @@ void ArgInput::InitArgInput( FixedText* pftArg, PushButton* pbtnFx,
// Sets the Name for the Argument
void ArgInput::SetArgName(const OUString &aArg)
{
- if(pFtArg !=NULL) pFtArg->SetText(aArg );
+ if(pFtArg !=nullptr) pFtArg->SetText(aArg );
}
// Returns the Name for the Argument
OUString ArgInput::GetArgName()
{
OUString aPrivArgName;
- if(pFtArg !=NULL)
+ if(pFtArg !=nullptr)
aPrivArgName=pFtArg->GetText();
return aPrivArgName;
@@ -186,19 +199,19 @@ OUString ArgInput::GetArgName()
//Sets the Name for the Argument
void ArgInput::SetArgNameFont (const vcl::Font &aFont)
{
- if(pFtArg !=NULL) pFtArg->SetFont(aFont);
+ if(pFtArg !=nullptr) pFtArg->SetFont(aFont);
}
//Sets up the Selection for the EditBox.
void ArgInput::SetArgSelection (const Selection& rSel )
{
- if(pEdArg !=NULL) pEdArg ->SetSelection(rSel );
+ if(pEdArg !=nullptr) pEdArg ->SetSelection(rSel );
}
//Sets the Value for the Argument
void ArgInput::SetArgVal(const OUString &rVal)
{
- if(pEdArg !=NULL)
+ if(pEdArg != nullptr)
{
pEdArg ->SetRefString(rVal);
}
@@ -208,7 +221,7 @@ void ArgInput::SetArgVal(const OUString &rVal)
OUString ArgInput::GetArgVal()
{
OUString aResult;
- if(pEdArg!=NULL)
+ if(pEdArg!=nullptr)
{
aResult=pEdArg->GetText();
}
@@ -340,7 +353,7 @@ EditBox::EditBox( vcl::Window* pParent, WinBits nBits )
WinBits nStyle=GetStyle();
SetStyle( nStyle| WB_DIALOGCONTROL);
- pMEdit=new MultiLineEdit(this,WB_LEFT | WB_VSCROLL | (nStyle & WB_TABSTOP) |
+ pMEdit=VclPtr<MultiLineEdit>::Create(this,WB_LEFT | WB_VSCROLL | (nStyle & WB_TABSTOP) |
WB_NOBORDER | WB_NOHIDESELECTION | WB_IGNORETAB);
pMEdit->Show();
aOldSel=pMEdit->GetSelection();
@@ -361,10 +374,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeEditBox(vcl::Window *p
EditBox::~EditBox()
{
- MultiLineEdit* pTheEdit=pMEdit;
+ disposeOnce();
+}
+
+void EditBox::dispose()
+{
pMEdit->Disable();
- pMEdit=NULL;
- delete pTheEdit;
+ pMEdit.disposeAndClear();
+ Control::dispose();
}
// When the selection is changed this function will be called
@@ -377,14 +394,14 @@ void EditBox::SelectionChanged()
void EditBox::Resize()
{
Size aSize=GetOutputSizePixel();
- if(pMEdit!=NULL) pMEdit->SetOutputSizePixel(aSize);
+ if(pMEdit!=nullptr) pMEdit->SetOutputSizePixel(aSize);
}
// When the Control is activated, the Selection is repealed
// and the Cursor set at the end.
void EditBox::GetFocus()
{
- if(pMEdit!=NULL)
+ if(pMEdit!=nullptr)
{
pMEdit->GrabFocus();
}
@@ -396,7 +413,7 @@ bool EditBox::PreNotify( NotifyEvent& rNEvt )
{
bool nResult = true;
- if(pMEdit==NULL) return nResult;
+ if(pMEdit==nullptr) return nResult;
MouseNotifyEvent nSwitch=rNEvt.GetType();
if(nSwitch==MouseNotifyEvent::KEYINPUT)// || nSwitch==MouseNotifyEvent::KEYUP)
@@ -431,7 +448,7 @@ bool EditBox::PreNotify( NotifyEvent& rNEvt )
//first called.
IMPL_LINK_NOARG(EditBox, ChangedHdl)
{
- if(pMEdit!=NULL)
+ if(pMEdit!=nullptr)
{
Selection aNewSel=pMEdit->GetSelection();
@@ -481,8 +498,15 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRefEdit(vcl::Window *p
RefEdit::~RefEdit()
{
+ disposeOnce();
+}
+
+void RefEdit::dispose()
+{
aIdle.SetIdleHdl( Link() );
aIdle.Stop();
+ pLabelWidget.clear();
+ Edit::dispose();
}
void RefEdit::SetRefString( const OUString& rStr )
@@ -581,6 +605,17 @@ RefButton::RefButton( vcl::Window* _pParent, WinBits nStyle ) :
SetStartImage();
}
+RefButton::~RefButton()
+{
+ disposeOnce();
+}
+
+void RefButton::dispose()
+{
+ pRefEdit.clear();
+ ImageButton::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRefButton(vcl::Window *pParent, VclBuilder::stringmap &)
{
return new RefButton(pParent, 0);
diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx
index 9e3a647eed04..539661b05b1c 100644
--- a/formula/source/ui/dlg/parawin.cxx
+++ b/formula/source/ui/dlg/parawin.cxx
@@ -221,6 +221,11 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i )
ParaWin::~ParaWin()
{
+ disposeOnce();
+}
+
+void ParaWin::dispose()
+{
// #i66422# if the focus changes during destruction of the controls,
// don't call the focus handlers
Link aEmptyLink;
@@ -228,6 +233,27 @@ ParaWin::~ParaWin()
m_pBtnFx2->SetGetFocusHdl( aEmptyLink );
m_pBtnFx3->SetGetFocusHdl( aEmptyLink );
m_pBtnFx4->SetGetFocusHdl( aEmptyLink );
+ m_pFtEditDesc.clear();
+ m_pFtArgName.clear();
+ m_pFtArgDesc.clear();
+ m_pBtnFx1.clear();
+ m_pFtArg1.clear();
+ m_pEdArg1.clear();
+ m_pRefBtn1.clear();
+ m_pBtnFx2.clear();
+ m_pFtArg2.clear();
+ m_pEdArg2.clear();
+ m_pRefBtn2.clear();
+ m_pBtnFx3.clear();
+ m_pFtArg3.clear();
+ m_pEdArg3.clear();
+ m_pRefBtn3.clear();
+ m_pBtnFx4.clear();
+ m_pFtArg4.clear();
+ m_pEdArg4.clear();
+ m_pRefBtn4.clear();
+ m_pSlider.clear();
+ TabPage::dispose();
}
diff --git a/formula/source/ui/dlg/parawin.hxx b/formula/source/ui/dlg/parawin.hxx
index 5bf159b4f5d4..6a83c4d59218 100644
--- a/formula/source/ui/dlg/parawin.hxx
+++ b/formula/source/ui/dlg/parawin.hxx
@@ -56,31 +56,31 @@ private:
vcl::Font aFntBold;
vcl::Font aFntLight;
- FixedText *m_pFtEditDesc;
- FixedText *m_pFtArgName;
- FixedText *m_pFtArgDesc;
-
- PushButton *m_pBtnFx1;
- FixedText *m_pFtArg1;
- ArgEdit *m_pEdArg1;
- RefButton *m_pRefBtn1;
-
- PushButton *m_pBtnFx2;
- FixedText *m_pFtArg2;
- ArgEdit *m_pEdArg2;
- RefButton *m_pRefBtn2;
-
- PushButton *m_pBtnFx3;
- FixedText *m_pFtArg3;
- ArgEdit *m_pEdArg3;
- RefButton *m_pRefBtn3;
-
- PushButton *m_pBtnFx4;
- FixedText *m_pFtArg4;
- ArgEdit *m_pEdArg4;
- RefButton *m_pRefBtn4;
-
- ScrollBar *m_pSlider;
+ VclPtr<FixedText> m_pFtEditDesc;
+ VclPtr<FixedText> m_pFtArgName;
+ VclPtr<FixedText> m_pFtArgDesc;
+
+ VclPtr<PushButton> m_pBtnFx1;
+ VclPtr<FixedText> m_pFtArg1;
+ VclPtr<ArgEdit> m_pEdArg1;
+ VclPtr<RefButton> m_pRefBtn1;
+
+ VclPtr<PushButton> m_pBtnFx2;
+ VclPtr<FixedText> m_pFtArg2;
+ VclPtr<ArgEdit> m_pEdArg2;
+ VclPtr<RefButton> m_pRefBtn2;
+
+ VclPtr<PushButton> m_pBtnFx3;
+ VclPtr<FixedText> m_pFtArg3;
+ VclPtr<ArgEdit> m_pEdArg3;
+ VclPtr<RefButton> m_pRefBtn3;
+
+ VclPtr<PushButton> m_pBtnFx4;
+ VclPtr<FixedText> m_pFtArg4;
+ VclPtr<ArgEdit> m_pEdArg4;
+ VclPtr<RefButton> m_pRefBtn4;
+
+ VclPtr<ScrollBar> m_pSlider;
OUString m_sOptional;
OUString m_sRequired;
bool bRefMode;
@@ -125,6 +125,7 @@ protected:
public:
ParaWin(vcl::Window* pParent,IControlReferenceHandler* _pDlg);
virtual ~ParaWin();
+ virtual void dispose() SAL_OVERRIDE;
void SetFunctionDesc(const IFunctionDescription* pFDesc);
void SetArgumentOffset(sal_uInt16 nOffset);
diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx
index 4bcdc15e44b9..eb39a60e55d6 100644
--- a/formula/source/ui/dlg/structpg.cxx
+++ b/formula/source/ui/dlg/structpg.cxx
@@ -103,6 +103,17 @@ StructPage::StructPage(vcl::Window* pParent):
m_pTlbStruct->SetSelectHdl(LINK( this, StructPage, SelectHdl ) );
}
+StructPage::~StructPage()
+{
+ disposeOnce();
+}
+
+void StructPage::dispose()
+{
+ m_pTlbStruct.clear();
+ TabPage::dispose();
+}
+
void StructPage::ClearStruct()
{
m_pTlbStruct->SetActiveFlag(false);
diff --git a/formula/source/ui/dlg/structpg.hxx b/formula/source/ui/dlg/structpg.hxx
index bdd4fcd7d70d..d0a3b35066e9 100644
--- a/formula/source/ui/dlg/structpg.hxx
+++ b/formula/source/ui/dlg/structpg.hxx
@@ -73,7 +73,7 @@ private:
OModuleClient m_aModuleClient;
Link aSelLink;
- StructListBox *m_pTlbStruct;
+ VclPtr<StructListBox> m_pTlbStruct;
Image maImgEnd;
Image maImgError;
@@ -90,6 +90,8 @@ protected:
public:
StructPage( vcl::Window* pParent);
+ virtual ~StructPage();
+ virtual void dispose() SAL_OVERRIDE;
void ClearStruct();
virtual SvTreeListEntry* InsertEntry(const OUString& rText, SvTreeListEntry* pParent,
diff --git a/fpicker/source/office/OfficeControlAccess.hxx b/fpicker/source/office/OfficeControlAccess.hxx
index 3214ebe534b4..e1ff8050c23c 100644
--- a/fpicker/source/office/OfficeControlAccess.hxx
+++ b/fpicker/source/office/OfficeControlAccess.hxx
@@ -46,7 +46,7 @@ namespace svt
class OControlAccess
{
IFilePickerController* m_pFilePickerController;
- SvtFileView* m_pFileView;
+ VclPtr<SvtFileView> m_pFileView;
public:
OControlAccess( IFilePickerController* _pController, SvtFileView* _pFileView );
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index f9d755ac4fcc..6fd28edfd242 100644
--- a/fpicker/source/office/OfficeFilePicker.cxx
+++ b/fpicker/source/office/OfficeFilePicker.cxx
@@ -463,12 +463,12 @@ sal_Int16 SvtFilePicker::implExecutePicker( )
}
-SvtFileDialog* SvtFilePicker::implCreateDialog( vcl::Window* _pParent )
+VclPtr<SvtFileDialog> SvtFilePicker::implCreateDialog( vcl::Window* _pParent )
{
WinBits nExtraBits;
WinBits nBits = getWinBits( nExtraBits );
- SvtFileDialog* dialog = new SvtFileDialog( _pParent, nBits, nExtraBits );
+ VclPtrInstance<SvtFileDialog> dialog( _pParent, nBits, nExtraBits );
// Set StandardDir if present
if ( !m_aStandardDir.isEmpty())
diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx
index 65e4eab4b970..fa8313e16a85 100644
--- a/fpicker/source/office/OfficeFilePicker.hxx
+++ b/fpicker/source/office/OfficeFilePicker.hxx
@@ -205,7 +205,7 @@ protected:
// OCommonPicker overridables
- virtual SvtFileDialog* implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
+ virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE;
virtual bool implHandleInitializationArgument(
const OUString& _rName,
diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx
index de062ac8e7cc..8f524856884c 100644
--- a/fpicker/source/office/OfficeFolderPicker.cxx
+++ b/fpicker/source/office/OfficeFolderPicker.cxx
@@ -69,9 +69,9 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s
getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) );
}
-SvtFileDialog* SvtFolderPicker::implCreateDialog( vcl::Window* _pParent )
+VclPtr<SvtFileDialog> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent )
{
- return new SvtFileDialog( _pParent, SFXWB_PATHDIALOG );
+ return VclPtr<SvtFileDialog>::Create( _pParent, SFXWB_PATHDIALOG );
}
sal_Int16 SvtFolderPicker::implExecutePicker( )
diff --git a/fpicker/source/office/OfficeFolderPicker.hxx b/fpicker/source/office/OfficeFolderPicker.hxx
index 6261c50f74f0..266c99cbef8a 100644
--- a/fpicker/source/office/OfficeFolderPicker.hxx
+++ b/fpicker/source/office/OfficeFolderPicker.hxx
@@ -99,7 +99,7 @@ protected:
// OCommonPicker overridables
- virtual SvtFileDialog* implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
+ virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE;
};
diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx
index d5baa25babdd..5d75edd0e095 100644
--- a/fpicker/source/office/PlacesListBox.cxx
+++ b/fpicker/source/office/PlacesListBox.cxx
@@ -24,7 +24,7 @@ PlacesListBox_Impl::PlacesListBox_Impl( PlacesListBox* pParent, const OUString&
mpParent( pParent )
{
Size aBoxSize = pParent->GetSizePixel( );
- mpHeaderBar = new HeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ mpHeaderBar = VclPtr<HeaderBar>::Create( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( 600, 16 ) );
long pTabs[] = { 2, 20, 600 };
@@ -43,8 +43,14 @@ PlacesListBox_Impl::PlacesListBox_Impl( PlacesListBox* pParent, const OUString&
PlacesListBox_Impl::~PlacesListBox_Impl( )
{
- delete mpHeaderBar;
- mpParent = NULL;
+ disposeOnce();
+}
+
+void PlacesListBox_Impl::dispose()
+{
+ mpHeaderBar.disposeAndClear();
+ mpParent.clear();
+ SvHeaderTabListBox::dispose();
}
void PlacesListBox_Impl::MouseButtonUp( const MouseEvent& rMEvt )
@@ -64,17 +70,17 @@ PlacesListBox::PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, con
mbUpdated( false ),
mbSelectionChanged( false )
{
- mpImpl = new PlacesListBox_Impl( this, rTitle );
+ mpImpl = VclPtr<PlacesListBox_Impl>::Create( this, rTitle );
mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) );
mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ;
- mpAddBtn = new ImageButton( this, 0 );
+ mpAddBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
mpAddBtn->SetText( OUString( "+" ) );
mpAddBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
mpAddBtn->Show();
- mpDelBtn = new ImageButton( this, 0 );
+ mpDelBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
mpDelBtn->SetText( OUString( "-" ) );
mpDelBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
mpDelBtn->Show();
@@ -82,9 +88,16 @@ PlacesListBox::PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, con
PlacesListBox::~PlacesListBox( )
{
- delete mpImpl;
- delete mpAddBtn;
- delete mpDelBtn;
+ disposeOnce();
+}
+
+void PlacesListBox::dispose()
+{
+ mpImpl.disposeAndClear();
+ mpAddBtn.disposeAndClear();
+ mpDelBtn.disposeAndClear();
+ mpDlg.clear();
+ Control::dispose();
}
void PlacesListBox::AppendPlace( PlacePtr pPlace )
@@ -181,13 +194,13 @@ IMPL_LINK ( PlacesListBox, DoubleClick, void*, EMPTYARG )
PlacePtr pPlace = maPlaces[nSelected];
if ( pPlace->IsEditable() && !pPlace->IsLocal( ) )
{
- PlaceEditDialog aDlg( mpDlg, pPlace );
- short aRetCode = aDlg.Execute();
+ ScopedVclPtrInstance< PlaceEditDialog > aDlg(mpDlg, pPlace);
+ short aRetCode = aDlg->Execute();
switch(aRetCode) {
case RET_OK :
{
- pPlace->SetName ( aDlg.GetServerName() );
- pPlace->SetUrl( aDlg.GetServerUrl() );
+ pPlace->SetName ( aDlg->GetServerName() );
+ pPlace->SetUrl( aDlg->GetServerUrl() );
mbUpdated = true;
break;
}
diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx
index 8fa24beb2907..0cf700d6b142 100644
--- a/fpicker/source/office/PlacesListBox.hxx
+++ b/fpicker/source/office/PlacesListBox.hxx
@@ -23,12 +23,13 @@ class PlacesListBox;
class PlacesListBox_Impl : public SvHeaderTabListBox
{
private:
- HeaderBar* mpHeaderBar;
- PlacesListBox* mpParent;
+ VclPtr<HeaderBar> mpHeaderBar;
+ VclPtr<PlacesListBox> mpParent;
public:
PlacesListBox_Impl( PlacesListBox* pParent, const OUString& rTitle );
virtual ~PlacesListBox_Impl( );
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
};
@@ -39,10 +40,10 @@ class PlacesListBox : public Control
{
private:
std::vector< PlacePtr > maPlaces;
- SvtFileDialog* mpDlg;
- PlacesListBox_Impl* mpImpl;
- PushButton* mpAddBtn;
- PushButton* mpDelBtn;
+ VclPtr<SvtFileDialog> mpDlg;
+ VclPtr<PlacesListBox_Impl> mpImpl;
+ VclPtr<PushButton> mpAddBtn;
+ VclPtr<PushButton> mpDelBtn;
sal_Int32 mnNbEditables;
bool mbUpdated;
bool mbSelectionChanged;
@@ -50,6 +51,7 @@ class PlacesListBox : public Control
public:
PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, const OUString& rTitle, WinBits nBits );
virtual ~PlacesListBox( );
+ virtual void dispose() SAL_OVERRIDE;
void AppendPlace( PlacePtr pPlace );
void RemovePlace( sal_uInt16 nPos );
diff --git a/fpicker/source/office/QueryFolderName.hxx b/fpicker/source/office/QueryFolderName.hxx
index 49733bbb46a4..cf864aff88ef 100644
--- a/fpicker/source/office/QueryFolderName.hxx
+++ b/fpicker/source/office/QueryFolderName.hxx
@@ -28,9 +28,9 @@
class QueryFolderNameDialog : public ModalDialog
{
private:
- Edit* m_pNameEdit;
- VclFrame* m_pNameLine;
- OKButton* m_pOKBtn;
+ VclPtr<Edit> m_pNameEdit;
+ VclPtr<VclFrame> m_pNameLine;
+ VclPtr<OKButton> m_pOKBtn;
DECL_LINK( OKHdl, void * );
DECL_LINK( NameHdl, void * );
@@ -38,6 +38,8 @@ private:
public:
QueryFolderNameDialog(vcl::Window* _pParent, const OUString& rTitle,
const OUString& rDefaultText, OUString* pGroupName = NULL);
+ virtual ~QueryFolderNameDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetName() const { return m_pNameEdit->GetText(); }
};
diff --git a/fpicker/source/office/asyncfilepicker.hxx b/fpicker/source/office/asyncfilepicker.hxx
index a2dfa11c7076..2174eb50e6ca 100644
--- a/fpicker/source/office/asyncfilepicker.hxx
+++ b/fpicker/source/office/asyncfilepicker.hxx
@@ -25,6 +25,7 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.h>
#include <salhelper/simplereferenceobject.hxx>
+#include <vcl/vclptr.hxx>
class SvtFileView;
class SvtFileDialog;
@@ -52,8 +53,8 @@ namespace svt
private:
Action m_eAction;
- SvtFileView* m_pView;
- SvtFileDialog* m_pDialog;
+ VclPtr<SvtFileView> m_pView;
+ VclPtr<SvtFileDialog> m_pDialog;
OUString m_sURL;
OUString m_sFileName;
bool m_bRunning;
diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx
index c6da4db6ac26..b3192d2c419d 100644
--- a/fpicker/source/office/commonpicker.cxx
+++ b/fpicker/source/office/commonpicker.cxx
@@ -123,8 +123,7 @@ namespace svt
m_pDlg->EndDialog( RET_CANCEL );
}
- delete m_pDlg;
- m_pDlg = NULL;
+ m_pDlg.disposeAndClear();
m_xWindow = NULL;
m_xDialogParent = NULL;
}
@@ -150,9 +149,10 @@ namespace svt
stopWindowListening();
if ( !bDialogDying ) // it's the parent which is dying -> delete the dialog
- delete m_pDlg;
+ m_pDlg.disposeAndClear();
+ else
+ m_pDlg.clear();
- m_pDlg = NULL;
m_xWindow = NULL;
m_xDialogParent = NULL;
}
@@ -201,7 +201,7 @@ namespace svt
{
if ( !m_pDlg )
{
- m_pDlg = implCreateDialog( VCLUnoHelper::GetWindow( m_xDialogParent ) );
+ m_pDlg.reset( implCreateDialog( VCLUnoHelper::GetWindow( m_xDialogParent ) ) );
DBG_ASSERT( m_pDlg, "OCommonPicker::createPicker: invalid dialog returned!" );
if ( m_pDlg )
@@ -240,7 +240,7 @@ namespace svt
}
}
- return NULL != m_pDlg;
+ return nullptr != m_pDlg;
}
diff --git a/fpicker/source/office/commonpicker.hxx b/fpicker/source/office/commonpicker.hxx
index a0cb97896b4c..a08c31ee2ba0 100644
--- a/fpicker/source/office/commonpicker.hxx
+++ b/fpicker/source/office/commonpicker.hxx
@@ -33,6 +33,7 @@
#include <comphelper/proparrhlp.hxx>
#include <comphelper/uno3.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
class SvtFileDialog;
namespace vcl { class Window; }
@@ -64,7 +65,7 @@ namespace svt
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow;
// </properties>
- SvtFileDialog* m_pDlg;
+ VclPtr<SvtFileDialog> m_pDlg;
ImplSVEvent * m_nCancelEvent;
bool m_bExecuting;
@@ -92,7 +93,7 @@ namespace svt
// overridables
// will be called with locked SolarMutex
- virtual SvtFileDialog* implCreateDialog( vcl::Window* _pParent ) = 0;
+ virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) = 0;
virtual sal_Int16 implExecutePicker( ) = 0;
// do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ...
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 93ace60721cd..fda0c56321b9 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -348,8 +348,8 @@ SvtFileDialog::SvtFileDialog ( vcl::Window* _pParent, WinBits nBits )
class CustomContainer : public vcl::Window
{
SvtExpFileDlg_Impl* _pImp;
- SvtFileView* _pFileView;
- Splitter* _pSplitter;
+ VclPtr<SvtFileView> _pFileView;
+ VclPtr<Splitter> _pSplitter;
public:
CustomContainer(vcl::Window *pParent)
@@ -359,6 +359,13 @@ public:
, _pSplitter(NULL)
{
}
+ virtual ~CustomContainer() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ _pFileView.clear();
+ _pSplitter.clear();
+ vcl::Window::dispose();
+ }
void init(SvtExpFileDlg_Impl* pImp,
SvtFileView* pFileView,
@@ -404,6 +411,11 @@ public:
SvtFileDialog::~SvtFileDialog()
{
+ disposeOnce();
+}
+
+void SvtFileDialog::dispose()
+{
if ( !_pImp->_aIniKey.isEmpty() )
{
// save window state
@@ -437,10 +449,17 @@ SvtFileDialog::~SvtFileDialog()
}
delete _pImp;
- delete _pFileView;
- delete _pSplitter;
- delete _pContainer;
- delete _pPrevBmp;
+ _pFileView.disposeAndClear();
+ _pSplitter.disposeAndClear();
+ _pContainer.disposeAndClear();
+ _pPrevBmp.disposeAndClear();
+ _pCbReadOnly.clear();
+ _pCbLinkBox.clear();
+ _pCbPreviewBox.clear();
+ _pCbSelection.clear();
+ _pPbPlay.clear();
+ _pPrevWin.clear();
+ ModalDialog::dispose();
}
void SvtFileDialog::Init_Impl
@@ -480,7 +499,7 @@ void SvtFileDialog::Init_Impl
m_aImages = ImageList( SvtResId( RID_FILEPICKER_IMAGES ) );
vcl::Window *pUpContainer = get<vcl::Window>("up");
- _pImp->_pBtnUp = new SvtUpButton_Impl(pUpContainer, this, 0);
+ _pImp->_pBtnUp = VclPtr<SvtUpButton_Impl>::Create(pUpContainer, this, 0);
_pImp->_pBtnUp->SetHelpId( HID_FILEOPEN_LEVELUP );
_pImp->_pBtnUp->set_vexpand(true);
_pImp->_pBtnUp->Show();
@@ -522,7 +541,7 @@ void SvtFileDialog::Init_Impl
if ( ( nStyle & SFXWB_MULTISELECTION ) == SFXWB_MULTISELECTION )
_pImp->_bMultiSelection = true;
- _pContainer = new CustomContainer(get<vcl::Window>("container"));
+ _pContainer.reset(VclPtr<CustomContainer>::Create(get<vcl::Window>("container")));
Size aSize(LogicToPixel(Size(270, 85), MAP_APPFONT));
_pContainer->set_height_request(aSize.Height());
_pContainer->set_width_request(aSize.Width());
@@ -530,7 +549,7 @@ void SvtFileDialog::Init_Impl
_pContainer->set_vexpand(true);
_pContainer->SetStyle( _pContainer->GetStyle() | WB_TABSTOP );
- _pFileView = new SvtFileView( _pContainer, WB_BORDER,
+ _pFileView = VclPtr<SvtFileView>::Create( _pContainer, WB_BORDER,
FILEDLG_TYPE_PATHDLG == _pImp->_eDlgType,
_pImp->_bMultiSelection );
_pFileView->Show();
@@ -538,7 +557,7 @@ void SvtFileDialog::Init_Impl
_pFileView->SetHelpId( HID_FILEDLG_STANDARD );
_pFileView->SetStyle( _pFileView->GetStyle() | WB_TABSTOP );
- _pSplitter = new Splitter( _pContainer, WB_HSCROLL );
+ _pSplitter = VclPtr<Splitter>::Create( _pContainer, WB_HSCROLL );
_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
_pSplitter->SetSplitHdl( LINK( this, SvtFileDialog, Split_Hdl ) );
@@ -662,17 +681,17 @@ IMPL_STATIC_LINK( SvtFileDialog, NewFolderHdl_Impl, PushButton*, EMPTYARG )
SmartContent aContent( pThis->_pFileView->GetViewURL( ) );
OUString aTitle;
aContent.getTitle( aTitle );
- QueryFolderNameDialog aDlg( pThis, aTitle, SVT_RESSTR(STR_SVT_NEW_FOLDER) );
+ ScopedVclPtrInstance< QueryFolderNameDialog > aDlg(pThis, aTitle, SVT_RESSTR(STR_SVT_NEW_FOLDER));
bool bHandled = false;
while ( !bHandled )
{
- if ( aDlg.Execute() == RET_OK )
+ if ( aDlg->Execute() == RET_OK )
{
- OUString aUrl = aContent.createFolder( aDlg.GetName( ) );
+ OUString aUrl = aContent.createFolder( aDlg->GetName( ) );
if ( !aUrl.isEmpty( ) )
{
- pThis->_pFileView->CreatedFolder( aUrl, aDlg.GetName() );
+ pThis->_pFileView->CreatedFolder( aUrl, aDlg->GetName() );
bHandled = true;
}
}
@@ -1046,8 +1065,8 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
"$filename$",
aFileObj.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET)
);
- MessageDialog aBox(pThis, aMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( aBox.Execute() != RET_YES )
+ ScopedVclPtrInstance< MessageDialog > aBox(pThis, aMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if ( aBox->Execute() != RET_YES )
return 0;
}
else
@@ -1091,8 +1110,8 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
}
sError = sError.replaceFirst( "$name$", sInvalidFile );
- MessageDialog aError(pThis, sError);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(pThis, sError);
+ aError->Execute();
return 0;
}
}
@@ -1244,13 +1263,13 @@ IMPL_STATIC_LINK ( SvtFileDialog, ConnectToServerPressed_Hdl, void*, EMPTYARG )
{
pThis->_pFileView->EndInplaceEditing( false );
- PlaceEditDialog aDlg( pThis );
- short aRetCode = aDlg.Execute();
+ ScopedVclPtrInstance< PlaceEditDialog > aDlg(pThis);
+ short aRetCode = aDlg->Execute();
switch (aRetCode) {
case RET_OK :
{
- PlacePtr newPlace = aDlg.GetPlace();
+ PlacePtr newPlace = aDlg->GetPlace();
pThis->_pImp->_pPlaces->AppendPlace(newPlace);
break;
@@ -1625,7 +1644,7 @@ bool SvtFileDialog::Notify( NotifyEvent& rNEvt )
class SvtDefModalDialogParent_Impl
{
private:
- vcl::Window* _pOld;
+ VclPtr<vcl::Window> _pOld;
public:
SvtDefModalDialogParent_Impl( vcl::Window *pNew ) :
@@ -1812,7 +1831,7 @@ void SvtFileDialog::EnableUI( bool _bEnable )
if ( _bEnable )
{
- for ( ::std::set< Control* >::iterator aLoop = m_aDisabledControls.begin();
+ for ( auto aLoop = m_aDisabledControls.begin();
aLoop != m_aDisabledControls.end();
++aLoop
)
@@ -1835,7 +1854,7 @@ void SvtFileDialog::EnableControl( Control* _pControl, bool _bEnable )
if ( _bEnable )
{
- ::std::set< Control* >::iterator aPos = m_aDisabledControls.find( _pControl );
+ auto aPos = m_aDisabledControls.find( _pControl );
if ( m_aDisabledControls.end() != aPos )
m_aDisabledControls.erase( aPos );
}
@@ -1880,8 +1899,8 @@ short SvtFileDialog::PrepareExecute()
if ( bEmpty )
{
- MessageDialog aBox(this, SVT_RESSTR(STR_SVT_NOREMOVABLEDEVICE));
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SVT_RESSTR(STR_SVT_NOREMOVABLEDEVICE));
+ aBox->Execute();
return 0;
}
}
@@ -2528,7 +2547,7 @@ void SvtFileDialog::AddControls_Impl( )
_pPrevWin->SetOutputSizePixel(Size(200, 300));
_pPrevWin->Show();
- _pPrevBmp = new FixedBitmap( _pPrevWin, WinBits( WB_BORDER ) );
+ _pPrevBmp = VclPtr<FixedBitmap>::Create( _pPrevWin, WinBits( WB_BORDER ) );
_pPrevBmp->SetBackground( Wallpaper( Color( COL_WHITE ) ) );
_pPrevBmp->SetSizePixel(_pPrevWin->GetSizePixel());
_pPrevBmp->Show();
@@ -2593,7 +2612,7 @@ void SvtFileDialog::AddControls_Impl( )
_pImp->_pLbImageTemplates->Show();
}
- _pImp->_pPlaces = new PlacesListBox(_pContainer, this, SVT_RESSTR(STR_PLACES_TITLE), WB_BORDER);
+ _pImp->_pPlaces = VclPtr<PlacesListBox>::Create(_pContainer, this, SVT_RESSTR(STR_PLACES_TITLE), WB_BORDER);
_pImp->_pPlaces->SetHelpId("SVT_HID_FILESAVE_PLACES_LISTBOX");
Size aSize(LogicToPixel(Size(50, 85), MAP_APPFONT));
_pImp->_pPlaces->set_height_request(aSize.Height());
@@ -2829,6 +2848,18 @@ QueryFolderNameDialog::QueryFolderNameDialog(vcl::Window* _pParent,
m_pNameLine->set_label( *pGroupName );
};
+QueryFolderNameDialog::~QueryFolderNameDialog()
+{
+ disposeOnce();
+}
+
+void QueryFolderNameDialog::dispose()
+{
+ m_pNameEdit.clear();
+ m_pNameLine.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
IMPL_LINK_NOARG(QueryFolderNameDialog, OKHdl)
{
diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx
index 1bb88689b353..d25ce831110e 100644
--- a/fpicker/source/office/iodlg.hxx
+++ b/fpicker/source/office/iodlg.hxx
@@ -82,16 +82,16 @@ class CustomContainer;
class SvtFileDialog : public ModalDialog, public ::svt::IFilePickerController
{
private:
- CheckBox* _pCbReadOnly;
- CheckBox* _pCbLinkBox;
- CheckBox* _pCbPreviewBox;
- CheckBox* _pCbSelection;
- PushButton* _pPbPlay;
- vcl::Window* _pPrevWin;
- FixedBitmap* _pPrevBmp;
- CustomContainer* _pContainer;
- SvtFileView* _pFileView;
- Splitter* _pSplitter;
+ VclPtr<CheckBox> _pCbReadOnly;
+ VclPtr<CheckBox> _pCbLinkBox;
+ VclPtr<CheckBox> _pCbPreviewBox;
+ VclPtr<CheckBox> _pCbSelection;
+ VclPtr<PushButton> _pPbPlay;
+ VclPtr<vcl::Window> _pPrevWin;
+ VclPtr<FixedBitmap> _pPrevBmp;
+ VclPtr<CustomContainer> _pContainer;
+ VclPtr<SvtFileView> _pFileView;
+ VclPtr<Splitter> _pSplitter;
::svt::IFilePickerListener* _pFileNotifier;
SvtExpFileDlg_Impl* _pImp;
WinBits _nExtraBits;
@@ -100,7 +100,7 @@ private:
ImageList m_aImages;
::svt::SmartContent m_aContent;
- ::std::set< Control* > m_aDisabledControls;
+ ::std::set< VclPtr<Control> > m_aDisabledControls;
::utl::OConfigurationNode m_aConfiguration;
::rtl::Reference< ::svt::AsyncPickerAction >
@@ -194,6 +194,7 @@ public:
SvtFileDialog( vcl::Window* _pParent, WinBits nBits, WinBits nExtraBits );
SvtFileDialog( vcl::Window* _pParent, WinBits nBits );
virtual ~SvtFileDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
virtual void StartExecuteModal( const Link& rEndDialogHdl ) SAL_OVERRIDE;
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 8994f9a2c027..99cf5b0e8ea6 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -106,7 +106,14 @@ SvtFileDialogURLSelector::SvtFileDialogURLSelector( vcl::Window* _pParent, SvtFi
SvtFileDialogURLSelector::~SvtFileDialogURLSelector()
{
+ disposeOnce();
+}
+
+void SvtFileDialogURLSelector::dispose()
+{
delete m_pMenu;
+ m_pDlg.clear();
+ MenuButton::dispose();
}
@@ -244,10 +251,10 @@ SvtExpFileDlg_Impl::SvtExpFileDlg_Impl( WinBits ) :
SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl()
{
- delete _pBtnUp;
+ _pBtnUp.disposeAndClear();
delete _pUserFilter;
delete _pFilter;
- delete _pPlaces;
+ _pPlaces.disposeAndClear();
}
diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx
index 2af75e6cb7b1..04b986453a21 100644
--- a/fpicker/source/office/iodlgimp.hxx
+++ b/fpicker/source/office/iodlgimp.hxx
@@ -78,20 +78,19 @@ enum SvtFileDlgType
class SvtFileDialogURLSelector : public MenuButton
{
+public:
+ virtual ~SvtFileDialogURLSelector();
+ virtual void dispose() SAL_OVERRIDE;
private:
- SvtFileDialog* m_pDlg;
+ VclPtr<SvtFileDialog> m_pDlg;
PopupMenu* m_pMenu;
protected:
inline SvtFileDialog* GetDialogParent() { return m_pDlg; }
-protected:
-
virtual void FillURLMenu( PopupMenu* _pMenu ) = 0;
-protected:
SvtFileDialogURLSelector( vcl::Window* _pParent, SvtFileDialog* _pDlg, WinBits nBits, sal_uInt16 _nButtonId );
- virtual ~SvtFileDialogURLSelector();
virtual void Activate() SAL_OVERRIDE;
};
@@ -133,32 +132,32 @@ public:
SvtFileDialogFilterList_Impl* _pFilter;
SvtFileDialogFilter_Impl* _pUserFilter;
- FixedText* _pFtFileName;
- SvtURLBox* _pEdFileName;
+ VclPtr<FixedText> _pFtFileName;
+ VclPtr<SvtURLBox> _pEdFileName;
- FixedText* _pFtFileVersion;
- ListBox* _pLbFileVersion;
+ VclPtr<FixedText> _pFtFileVersion;
+ VclPtr<ListBox> _pLbFileVersion;
- FixedText* _pFtTemplates;
- ListBox* _pLbTemplates;
+ VclPtr<FixedText> _pFtTemplates;
+ VclPtr<ListBox> _pLbTemplates;
- FixedText* _pFtImageTemplates;
- ListBox* _pLbImageTemplates;
+ VclPtr<FixedText> _pFtImageTemplates;
+ VclPtr<ListBox> _pLbImageTemplates;
- FixedText* _pFtFileType;
- ListBox* _pLbFilter;
- PushButton* _pBtnFileOpen;
- PushButton* _pBtnCancel;
- HelpButton* _pBtnHelp;
- SvtUpButton_Impl* _pBtnUp;
- PushButton* _pBtnNewFolder;
- CheckBox* _pCbPassword;
- SvtURLBox* _pEdCurrentPath;
- CheckBox* _pCbAutoExtension;
- CheckBox* _pCbOptions;
+ VclPtr<FixedText> _pFtFileType;
+ VclPtr<ListBox> _pLbFilter;
+ VclPtr<PushButton> _pBtnFileOpen;
+ VclPtr<PushButton> _pBtnCancel;
+ VclPtr<HelpButton> _pBtnHelp;
+ VclPtr<SvtUpButton_Impl> _pBtnUp;
+ VclPtr<PushButton> _pBtnNewFolder;
+ VclPtr<CheckBox> _pCbPassword;
+ VclPtr<SvtURLBox> _pEdCurrentPath;
+ VclPtr<CheckBox> _pCbAutoExtension;
+ VclPtr<CheckBox> _pCbOptions;
- PlacesListBox* _pPlaces;
- PushButton* _pBtnConnectToServer;
+ VclPtr<PlacesListBox> _pPlaces;
+ VclPtr<PushButton> _pBtnConnectToServer;
SvtFileDlgMode _eMode;
SvtFileDlgType _eDlgType;
diff --git a/fpicker/test/svdem.cxx b/fpicker/test/svdem.cxx
index 1f4bc6b58e9f..61217a7c692a 100644
--- a/fpicker/test/svdem.cxx
+++ b/fpicker/test/svdem.cxx
@@ -185,9 +185,8 @@ IMPL_LINK( MyWin, Test, PushButton*, pBtn )
printf("Test\n");
if ( pBtn == &aOKBtn )
{
- SvtFileDialog* pDlg = new SvtFileDialog( this,SFXWB_PATHDIALOG);
+ ScopedVclPtrInstance<SvtFileDialog> pDlg(this,SFXWB_PATHDIALOG);
pDlg->Execute();
- delete pDlg;
printf("ok\n");
}
diff --git a/framework/inc/classes/fwktabwindow.hxx b/framework/inc/classes/fwktabwindow.hxx
index ebbac7fc80bb..ed3d82c80e2c 100644
--- a/framework/inc/classes/fwktabwindow.hxx
+++ b/framework/inc/classes/fwktabwindow.hxx
@@ -68,6 +68,7 @@ public:
const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider );
virtual ~FwkTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual void DeactivatePage() SAL_OVERRIDE;
@@ -77,8 +78,8 @@ public:
struct TabEntry
{
sal_Int32 m_nIndex;
- FwkTabPage* m_pPage;
- OUString m_sPageURL;
+ ScopedVclPtr<FwkTabPage> m_pPage;
+ OUString m_sPageURL;
css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
TabEntry() :
@@ -86,8 +87,7 @@ struct TabEntry
TabEntry( sal_Int32 nIndex, const OUString& sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) :
m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {}
-
- ~TabEntry() { delete m_pPage; }
+ ~TabEntry() { m_pPage.disposeAndClear(); }
};
typedef std::vector< TabEntry* > TabEntryList;
@@ -95,8 +95,8 @@ typedef std::vector< TabEntry* > TabEntryList;
class FwkTabWindow : public vcl::Window
{
private:
- FwkTabControl m_aTabCtrl;
- TabEntryList m_TabList;
+ VclPtr<FwkTabControl> m_aTabCtrl;
+ TabEntryList m_TabList;
css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
@@ -110,6 +110,7 @@ private:
public:
FwkTabWindow( vcl::Window* pParent );
virtual ~FwkTabWindow();
+ virtual void dispose() SAL_OVERRIDE;
void AddEventListener( const Link& rEventListener );
void RemoveEventListener( const Link& rEventListener );
diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx
index 25c19f107e6b..e8e9d0567927 100644
--- a/framework/inc/dispatch/closedispatcher.hxx
+++ b/framework/inc/dispatch/closedispatcher.hxx
@@ -39,6 +39,7 @@
#include <boost/scoped_ptr.hpp>
#include <cppuhelper/implbase2.hxx>
#include <vcl/evntpost.hxx>
+#include <vcl/vclptr.hxx>
class SystemWindow;
@@ -105,7 +106,7 @@ class CloseDispatcher : public ::cppu::WeakImplHelper2<
/** @short holded alive for internally asynchronous operations! */
css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener;
- SystemWindow* m_pSysWindow;
+ VclPtr<SystemWindow> m_pSysWindow;
// native interface
diff --git a/framework/inc/helper/vclstatusindicator.hxx b/framework/inc/helper/vclstatusindicator.hxx
index 4a68b79d8271..c5e115567a5e 100644
--- a/framework/inc/helper/vclstatusindicator.hxx
+++ b/framework/inc/helper/vclstatusindicator.hxx
@@ -52,7 +52,7 @@ class VCLStatusIndicator : public ::cppu::WeakImplHelper1< css::task::XStatusIn
Its guarded by the solarmutex only. Otherwise
we have to lock two of them, which can force a deadlock ...
*/
- StatusBar* m_pStatusBar;
+ VclPtr<StatusBar> m_pStatusBar;
/** knows the current info text of the progress. */
OUString m_sText;
diff --git a/framework/inc/uielement/buttontoolbarcontroller.hxx b/framework/inc/uielement/buttontoolbarcontroller.hxx
index 561ef253f587..8949b58e90c1 100644
--- a/framework/inc/uielement/buttontoolbarcontroller.hxx
+++ b/framework/inc/uielement/buttontoolbarcontroller.hxx
@@ -34,6 +34,7 @@
#include <comphelper/broadcasthelper.hxx>
#include <cppuhelper/weak.hxx>
+#include <vcl/vclptr.hxx>
class ToolBox;
@@ -84,13 +85,13 @@ class ButtonToolbarController : public ::com::sun::star::frame::XStatusListener,
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
private:
- bool m_bInitialized : 1,
+ bool m_bInitialized : 1,
m_bDisposed : 1;
- OUString m_aCommandURL;
+ OUString m_aCommandURL;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
- ToolBox* m_pToolbar;
+ VclPtr<ToolBox> m_pToolbar;
};
}
diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx
index d04537495217..1850c45eb669 100644
--- a/framework/inc/uielement/comboboxtoolbarcontroller.hxx
+++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx
@@ -78,7 +78,7 @@ class ComboboxToolbarController : public IComboBoxListener,
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const SAL_OVERRIDE;
private:
- ComboBoxControl* m_pComboBox;
+ VclPtr<ComboBoxControl> m_pComboBox;
};
}
diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx
index 88084f8d1661..b24186f644bf 100644
--- a/framework/inc/uielement/complextoolbarcontroller.hxx
+++ b/framework/inc/uielement/complextoolbarcontroller.hxx
@@ -28,6 +28,7 @@
#include <svtools/toolboxcontroller.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
class ToolBox;
namespace vcl { class Window; }
@@ -87,9 +88,9 @@ class ComplexToolbarController : public svt::ToolboxController
void notifyFocusLost();
void notifyTextChanged( const OUString& aText );
- ToolBox* m_pToolbar;
+ VclPtr<ToolBox> m_pToolbar;
sal_uInt16 m_nID;
- bool m_bMadeInvisible;
+ bool m_bMadeInvisible;
mutable ::com::sun::star::util::URL m_aURL;
::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
};
diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx
index e9e09f27e813..9b3703687dc4 100644
--- a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx
+++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx
@@ -26,6 +26,7 @@
#include <uielement/complextoolbarcontroller.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/vclptr.hxx>
class ToolBox;
@@ -74,7 +75,7 @@ class DropdownToolbarController : public IListBoxListener,
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const SAL_OVERRIDE;
private:
- ListBoxControl* m_pListBoxControl;
+ VclPtr<ListBoxControl> m_pListBoxControl;
};
}
diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx
index 8ebdca95a37c..0b8f9b6c90dc 100644
--- a/framework/inc/uielement/edittoolbarcontroller.hxx
+++ b/framework/inc/uielement/edittoolbarcontroller.hxx
@@ -75,7 +75,7 @@ class EditToolbarController : public IEditListener,
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const SAL_OVERRIDE;
private:
- EditControl* m_pEditControl;
+ VclPtr<EditControl> m_pEditControl;
};
}
diff --git a/framework/inc/uielement/generictoolbarcontroller.hxx b/framework/inc/uielement/generictoolbarcontroller.hxx
index c6d867b3b261..26ebeb61ab46 100644
--- a/framework/inc/uielement/generictoolbarcontroller.hxx
+++ b/framework/inc/uielement/generictoolbarcontroller.hxx
@@ -23,6 +23,7 @@
#include <svtools/toolboxcontroller.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
class PopupMenu;
class ToolBox;
@@ -53,11 +54,11 @@ class GenericToolbarController : public svt::ToolboxController
DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo* );
protected:
- ToolBox* m_pToolbar;
- sal_uInt16 m_nID;
- bool m_bEnumCommand : 1,
- m_bMadeInvisible : 1;
- OUString m_aEnumCommand;
+ VclPtr<ToolBox> m_pToolbar;
+ sal_uInt16 m_nID;
+ bool m_bEnumCommand : 1,
+ m_bMadeInvisible : 1;
+ OUString m_aEnumCommand;
};
class MenuToolbarController : public GenericToolbarController
diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx
index ebef21894081..7d9a8e86eec7 100644
--- a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx
+++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx
@@ -26,6 +26,7 @@
#include <uielement/complextoolbarcontroller.hxx>
#include <vcl/spinfld.hxx>
+#include <vcl/vclptr.hxx>
class ToolBox;
@@ -97,7 +98,7 @@ class SpinfieldToolbarController : public ISpinfieldListener,
double m_nMin;
double m_nValue;
double m_nStep;
- SpinfieldControl* m_pSpinfieldControl;
+ VclPtr<SpinfieldControl> m_pSpinfieldControl;
OUString m_aOutFormat;
};
diff --git a/framework/inc/uielement/statusbar.hxx b/framework/inc/uielement/statusbar.hxx
index be957eaedfb7..c192d50b48b2 100644
--- a/framework/inc/uielement/statusbar.hxx
+++ b/framework/inc/uielement/statusbar.hxx
@@ -33,7 +33,6 @@ class FrameworkStatusBar : public StatusBar
FrameworkStatusBar( vcl::Window* pParent,
WinBits nWinBits );
- virtual ~FrameworkStatusBar();
void SetStatusBarManager( StatusBarManager* pStatusBarManager );
diff --git a/framework/inc/uielement/statusbaritem.hxx b/framework/inc/uielement/statusbaritem.hxx
index e5afc02c5480..e05cd37ded3c 100644
--- a/framework/inc/uielement/statusbaritem.hxx
+++ b/framework/inc/uielement/statusbaritem.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/ui/XStatusbarItem.hpp>
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/basemutex.hxx>
+#include <vcl/vclptr.hxx>
class StatusBar;
@@ -67,7 +68,7 @@ public:
virtual void SAL_CALL repaint( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
private:
- StatusBar *m_pStatusBar;
+ VclPtr<StatusBar> m_pStatusBar;
AddonStatusbarItemData *m_pItemData;
sal_uInt16 m_nId;
sal_uInt16 m_nStyle;
diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx
index efbe5486b0db..2167b0cc9e3d 100644
--- a/framework/inc/uielement/statusbarmanager.hxx
+++ b/framework/inc/uielement/statusbarmanager.hxx
@@ -37,6 +37,7 @@
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <vcl/status.hxx>
+#include <vcl/vclptr.hxx>
#include <map>
namespace framework
@@ -98,13 +99,13 @@ class StatusBarManager : public ::cppu::WeakImplHelper3<
protected:
typedef std::map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusbarController > > StatusBarControllerMap;
- bool m_bDisposed : 1,
+ bool m_bDisposed : 1,
m_bFrameActionRegistered : 1,
m_bUpdateControllers : 1;
- bool m_bModuleIdentified;
- StatusBar* m_pStatusBar;
- OUString m_aModuleIdentifier;
- OUString m_aResourceName;
+ bool m_bModuleIdentified;
+ VclPtr<StatusBar> m_pStatusBar;
+ OUString m_aModuleIdentifier;
+ OUString m_aResourceName;
com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame;
com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels;
StatusBarControllerMap m_aControllerMap;
diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index 90b68ac4a139..95381c3120a4 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -189,7 +189,7 @@ class ToolBarManager : public ToolbarManager_Base
long m_lImageRotation;
- ToolBox* m_pToolBar;
+ VclPtr<ToolBox> m_pToolBar;
OUString m_aModuleIdentifier;
OUString m_aResourceName;
diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx
index 8a595a9878fa..0902ff36a9e1 100644
--- a/framework/inc/uielement/toolbarmerger.hxx
+++ b/framework/inc/uielement/toolbarmerger.hxx
@@ -61,7 +61,7 @@ typedef ::std::vector< AddonToolbarItem > AddonToolbarItemContainer;
struct ReferenceToolbarPathInfo
{
- ToolBox* pToolbar;
+ VclPtr<ToolBox> pToolbar;
sal_uInt16 nPos;
bool bResult;
};
diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx
index b01cf418f48a..da2c187e9f68 100644
--- a/framework/source/classes/fwktabwindow.cxx
+++ b/framework/source/classes/fwktabwindow.cxx
@@ -81,8 +81,14 @@ FwkTabPage::FwkTabPage(
FwkTabPage::~FwkTabPage()
{
+ disposeOnce();
+}
+
+void FwkTabPage::dispose()
+{
Hide();
DeactivatePage();
+ TabPage::dispose();
}
void FwkTabPage::CreateDialog()
@@ -174,20 +180,27 @@ void FwkTabPage::Resize()
// class FwkTabWindow ---------------------------------------------
FwkTabWindow::FwkTabWindow( vcl::Window* pParent )
: Window(pParent)
- , m_aTabCtrl(this)
+ , m_aTabCtrl(VclPtr<FwkTabControl>::Create(this))
{
m_xWinProvider = awt::ContainerWindowProvider::create( ::comphelper::getProcessComponentContext() );
SetPaintTransparent(true);
- m_aTabCtrl.SetActivatePageHdl( LINK( this, FwkTabWindow, ActivatePageHdl ) );
- m_aTabCtrl.SetDeactivatePageHdl( LINK( this, FwkTabWindow, DeactivatePageHdl ) );
- m_aTabCtrl.Show();
+ m_aTabCtrl->SetActivatePageHdl( LINK( this, FwkTabWindow, ActivatePageHdl ) );
+ m_aTabCtrl->SetDeactivatePageHdl( LINK( this, FwkTabWindow, DeactivatePageHdl ) );
+ m_aTabCtrl->Show();
}
FwkTabWindow::~FwkTabWindow()
{
+ disposeOnce();
+}
+
+void FwkTabWindow::dispose()
+{
ClearEntryList();
+ m_aTabCtrl.disposeAndClear();
+ vcl::Window::dispose();
}
void FwkTabWindow::ClearEntryList()
@@ -245,40 +258,40 @@ TabEntry* FwkTabWindow::FindEntry( sal_Int32 nIndex ) const
IMPL_LINK_NOARG(FwkTabWindow, ActivatePageHdl)
{
- const sal_uInt16 nId = m_aTabCtrl.GetCurPageId();
- FwkTabPage* pTabPage = static_cast< FwkTabPage* >( m_aTabCtrl.GetTabPage( nId ) );
+ const sal_uInt16 nId = m_aTabCtrl->GetCurPageId();
+ FwkTabPage* pTabPage = static_cast< FwkTabPage* >( m_aTabCtrl->GetTabPage( nId ) );
if ( !pTabPage )
{
TabEntry* pEntry = FindEntry( nId );
if ( pEntry )
{
- pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_xEventHdl, m_xWinProvider );
+ pTabPage = VclPtr<FwkTabPage>::Create( m_aTabCtrl.get(), pEntry->m_sPageURL, pEntry->m_xEventHdl, m_xWinProvider );
pEntry->m_pPage = pTabPage;
- m_aTabCtrl.SetTabPage( nId, pTabPage );
+ m_aTabCtrl->SetTabPage( nId, pTabPage );
pTabPage->Show();
pTabPage->ActivatePage();
}
} else {
pTabPage->ActivatePage();
}
- m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_ACTIVATE );
+ m_aTabCtrl->BroadcastEvent( VCLEVENT_TABPAGE_ACTIVATE );
return 1;
}
IMPL_LINK_NOARG(FwkTabWindow, DeactivatePageHdl)
{
- m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_DEACTIVATE );
+ m_aTabCtrl->BroadcastEvent( VCLEVENT_TABPAGE_DEACTIVATE );
return 1;
}
void FwkTabWindow::AddEventListener( const Link& rEventListener )
{
- m_aTabCtrl.AddEventListener( rEventListener );
+ m_aTabCtrl->AddEventListener( rEventListener );
}
void FwkTabWindow::RemoveEventListener( const Link& rEventListener )
{
- m_aTabCtrl.RemoveEventListener( rEventListener );
+ m_aTabCtrl->RemoveEventListener( rEventListener );
}
FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< beans::NamedValue >& rProperties )
@@ -311,20 +324,20 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea
TabEntry* pEntry = new TabEntry( nIndex, sPageURL, xEventHdl );
m_TabList.push_back( pEntry );
sal_uInt16 nIdx = static_cast< sal_uInt16 >( nIndex );
- m_aTabCtrl.InsertPage( nIdx, sTitle );
+ m_aTabCtrl->InsertPage( nIdx, sTitle );
if ( !sToolTip.isEmpty() )
- m_aTabCtrl.SetHelpText( nIdx, sToolTip );
+ m_aTabCtrl->SetHelpText( nIdx, sToolTip );
if ( xImage.is() )
- m_aTabCtrl.SetPageImage( nIdx, Image( xImage ) );
+ m_aTabCtrl->SetPageImage( nIdx, Image( xImage ) );
if ( bDisabled )
- m_aTabCtrl.EnablePage( nIdx, false );
+ m_aTabCtrl->EnablePage( nIdx, false );
return pEntry->m_pPage;
}
void FwkTabWindow::ActivatePage( sal_Int32 nIndex )
{
- m_aTabCtrl.SetCurPageId( static_cast< sal_uInt16 >( nIndex ) );
+ m_aTabCtrl->SetCurPageId( static_cast< sal_uInt16 >( nIndex ) );
ActivatePageHdl( &m_aTabCtrl );
}
@@ -333,7 +346,7 @@ void FwkTabWindow::RemovePage( sal_Int32 nIndex )
TabEntry* pEntry = FindEntry(nIndex);
if ( pEntry )
{
- m_aTabCtrl.RemovePage( static_cast< sal_uInt16 >( nIndex ) );
+ m_aTabCtrl->RemovePage( static_cast< sal_uInt16 >( nIndex ) );
if (RemoveEntry(nIndex))
delete pEntry;
}
@@ -342,7 +355,7 @@ void FwkTabWindow::RemovePage( sal_Int32 nIndex )
void FwkTabWindow::Resize()
{
Size aPageSize = GetSizePixel();
- m_aTabCtrl.SetTabPageSizePixel( aPageSize );
+ m_aTabCtrl->SetTabPageSizePixel( aPageSize );
}
} // namespace framework
diff --git a/framework/source/helper/vclstatusindicator.cxx b/framework/source/helper/vclstatusindicator.cxx
index e02c4e747ca9..18f08294d489 100644
--- a/framework/source/helper/vclstatusindicator.cxx
+++ b/framework/source/helper/vclstatusindicator.cxx
@@ -48,7 +48,7 @@ void SAL_CALL VCLStatusIndicator::start(const OUString& sText ,
vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(m_xParentWindow);
if (!m_pStatusBar)
- m_pStatusBar = new StatusBar(pParentWindow, WB_3DLOOK|WB_BORDER);
+ m_pStatusBar = VclPtr<StatusBar>::Create(pParentWindow, WB_3DLOOK|WB_BORDER);
VCLStatusIndicator::impl_recalcLayout(m_pStatusBar, pParentWindow);
@@ -91,8 +91,7 @@ void SAL_CALL VCLStatusIndicator::end()
m_pStatusBar->EndProgressMode();
m_pStatusBar->Show(false);
- delete m_pStatusBar;
- m_pStatusBar = 0;
+ m_pStatusBar.disposeAndClear();
}
}
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index f3434b739541..6ccaf62f89e6 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -906,7 +906,7 @@ void LayoutManager::implts_createProgressBar()
vcl::Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
if ( pWindow )
{
- StatusBar* pStatusBar = new StatusBar( pWindow, WinBits( WB_LEFT | WB_3DLOOK ) );
+ VclPtrInstance<StatusBar> pStatusBar( pWindow, WinBits( WB_LEFT | WB_3DLOOK ) );
Reference< awt::XWindow > xStatusBarWindow2( VCLUnoHelper::GetInterface( pStatusBar ));
pWrapper->setStatusBar( xStatusBarWindow2, true );
}
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index f40b98d068f2..1b1b9fc41948 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -1031,14 +1031,14 @@ void ToolbarLayoutManager::setParentWindow(
if ( xParentWindow.is() )
{
SolarMutexGuard aGuard;
- ::DockingAreaWindow* pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ) );
+ VclPtr< ::DockingAreaWindow > pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ).get() );
if( pWindow ) pWindow->SetAlign( WINDOWALIGN_TOP );
- pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ) );
- if( pWindow ) pWindow->SetAlign( WINDOWALIGN_BOTTOM );
- pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ) );
- if( pWindow ) pWindow->SetAlign( WINDOWALIGN_LEFT );
- pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ) );
- if( pWindow ) pWindow->SetAlign( WINDOWALIGN_RIGHT );
+ pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ).get() );
+ if( pWindow ) pWindow->SetAlign( WINDOWALIGN_BOTTOM );
+ pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ).get() );
+ if( pWindow ) pWindow->SetAlign( WINDOWALIGN_LEFT );
+ pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ).get() );
+ if( pWindow ) pWindow->SetAlign( WINDOWALIGN_RIGHT );
implts_reparentToolbars();
}
else
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index b235a624cd4e..0a23fa606e66 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -4205,11 +4205,11 @@ void AutoRecovery::impl_showFullDiscError()
if (sBackupPath.getLength() < 1)
sBackupPath = sBackupURL;
- ErrorBox dlgError(
- 0, WB_OK,
+ ScopedVclPtrInstance<ErrorBox> dlgError(
+ nullptr, WB_OK,
sMsg.replaceAll("%PATH", sBackupPath));
- dlgError.SetButtonText(dlgError.GetButtonId(0), sBtn);
- dlgError.Execute();
+ dlgError->SetButtonText(dlgError->GetButtonId(0), sBtn);
+ dlgError->Execute();
}
void AutoRecovery::impl_establishProgress(const AutoRecovery::TDocumentInfo& rInfo ,
diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx
index dd9c46e58235..f93aee07ed9a 100644
--- a/framework/source/services/tabwindowservice.cxx
+++ b/framework/source/services/tabwindowservice.cxx
@@ -68,8 +68,8 @@ struct TTabPageInfo
public:
::sal_Int32 m_nIndex;
- bool m_bCreated;
- FwkTabPage* m_pPage;
+ bool m_bCreated;
+ VclPtr<FwkTabPage> m_pPage;
css::uno::Sequence< css::beans::NamedValue > m_lProperties;
};
@@ -159,7 +159,7 @@ private:
css::uno::Reference< css::awt::XWindow > m_xTabWin;
/// the VCL tab window
- FwkTabWindow* m_pTabWin;
+ VclPtr<FwkTabWindow> m_pTabWin;
/// container of inserted tab pages
TTabPageInfoHash m_lTabPageInfos;
@@ -356,7 +356,7 @@ void SAL_CALL TabWindowService::dispose()
if (m_pTabWin)
m_pTabWin->RemoveEventListener( LINK( this, TabWindowService, EventListener ) );
- m_pTabWin = NULL;
+ m_pTabWin.clear();
m_xTabWin.clear();
}
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 77987fa3c279..35506a24e86c 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -114,7 +114,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument
{
sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
- pToolBar = new ToolBox( pWindow, nStyles );
+ pToolBar = VclPtr<ToolBox>::Create( pWindow, nStyles );
pToolBarManager = new AddonsToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar );
m_xToolBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
}
diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx
index 2219b5c6ff97..aaf068591354 100644
--- a/framework/source/uielement/buttontoolbarcontroller.cxx
+++ b/framework/source/uielement/buttontoolbarcontroller.cxx
@@ -152,7 +152,7 @@ void SAL_CALL ButtonToolbarController::dispose() throw (::com::sun::star::uno::R
m_xContext.clear();
m_xURLTransformer.clear();
m_xFrame.clear();
- m_pToolbar = 0;
+ m_pToolbar.clear();
m_bDisposed = true;
}
}
diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx
index 2f3cefb4f4d0..15fb15cfd3a9 100644
--- a/framework/source/uielement/comboboxtoolbarcontroller.cxx
+++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx
@@ -55,6 +55,7 @@ class ComboBoxControl : public ComboBox
public:
ComboBoxControl( vcl::Window* pParent, WinBits nStyle, IComboBoxListener* pComboBoxListener );
virtual ~ComboBoxControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Select() SAL_OVERRIDE;
virtual void DoubleClick() SAL_OVERRIDE;
@@ -76,7 +77,13 @@ ComboBoxControl::ComboBoxControl( vcl::Window* pParent, WinBits nStyle, IComboBo
ComboBoxControl::~ComboBoxControl()
{
+ disposeOnce();
+}
+
+void ComboBoxControl::dispose()
+{
m_pComboBoxListener = 0;
+ ComboBox::dispose();
}
void ComboBoxControl::Select()
@@ -142,7 +149,7 @@ ComboboxToolbarController::ComboboxToolbarController(
ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand )
, m_pComboBox( 0 )
{
- m_pComboBox = new ComboBoxControl( m_pToolbar, WB_DROPDOWN, this );
+ m_pComboBox = VclPtr<ComboBoxControl>::Create( m_pToolbar, WB_DROPDOWN, this );
if ( nWidth == 0 )
nWidth = 100;
@@ -164,11 +171,9 @@ throw ( RuntimeException, std::exception )
SolarMutexGuard aSolarMutexGuard;
m_pToolbar->SetItemWindow( m_nID, 0 );
- delete m_pComboBox;
+ m_pComboBox.disposeAndClear();
ComplexToolbarController::dispose();
-
- m_pComboBox = 0;
}
Sequence<PropertyValue> ComboboxToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx
index 871c7b2bba6a..05f1d1c27a44 100644
--- a/framework/source/uielement/complextoolbarcontroller.cxx
+++ b/framework/source/uielement/complextoolbarcontroller.cxx
@@ -76,7 +76,7 @@ throw ( RuntimeException, std::exception )
svt::ToolboxController::dispose();
m_xURLTransformer.clear();
- m_pToolbar = 0;
+ m_pToolbar.clear();
m_nID = 0;
}
diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
index 5eb339284cb9..7d00fbcd70d9 100644
--- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
+++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx
@@ -54,6 +54,7 @@ class ListBoxControl : public ListBox
public:
ListBoxControl( vcl::Window* pParent, WinBits nStyle, IListBoxListener* pListBoxListener );
virtual ~ListBoxControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Select() SAL_OVERRIDE;
virtual void DoubleClick() SAL_OVERRIDE;
@@ -73,7 +74,13 @@ ListBoxControl::ListBoxControl( vcl::Window* pParent, WinBits nStyle, IListBoxLi
ListBoxControl::~ListBoxControl()
{
+ disposeOnce();
+}
+
+void ListBoxControl::dispose()
+{
m_pListBoxListener = 0;
+ ListBox::dispose();
}
void ListBoxControl::Select()
@@ -125,7 +132,7 @@ DropdownToolbarController::DropdownToolbarController(
ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand )
, m_pListBoxControl( 0 )
{
- m_pListBoxControl = new ListBoxControl( m_pToolbar, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER, this );
+ m_pListBoxControl = VclPtr<ListBoxControl>::Create( m_pToolbar, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER, this );
if ( nWidth == 0 )
nWidth = 100;
@@ -148,11 +155,9 @@ throw ( RuntimeException, std::exception )
SolarMutexGuard aSolarMutexGuard;
m_pToolbar->SetItemWindow( m_nID, 0 );
- delete m_pListBoxControl;
+ m_pListBoxControl.disposeAndClear();
ComplexToolbarController::dispose();
-
- m_pListBoxControl = 0;
}
Sequence<PropertyValue> DropdownToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx
index 67cdcb1e2e3d..41403fd9f7e7 100644
--- a/framework/source/uielement/edittoolbarcontroller.cxx
+++ b/framework/source/uielement/edittoolbarcontroller.cxx
@@ -53,6 +53,7 @@ class EditControl : public Edit
public:
EditControl( vcl::Window* pParent, WinBits nStyle, IEditListener* pEditListener );
virtual ~EditControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Modify() SAL_OVERRIDE;
virtual void KeyInput( const ::KeyEvent& rKEvt ) SAL_OVERRIDE;
@@ -72,7 +73,13 @@ EditControl::EditControl( vcl::Window* pParent, WinBits nStyle, IEditListener* p
EditControl::~EditControl()
{
+ disposeOnce();
+}
+
+void EditControl::dispose()
+{
m_pEditListener = 0;
+ Edit::dispose();
}
void EditControl::Modify()
@@ -124,7 +131,7 @@ EditToolbarController::EditToolbarController(
ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand )
, m_pEditControl( 0 )
{
- m_pEditControl = new EditControl( m_pToolbar, WB_BORDER, this );
+ m_pEditControl = VclPtr<EditControl>::Create( m_pToolbar, WB_BORDER, this );
if ( nWidth == 0 )
nWidth = 100;
@@ -145,11 +152,9 @@ throw ( RuntimeException, std::exception )
SolarMutexGuard aSolarMutexGuard;
m_pToolbar->SetItemWindow( m_nID, 0 );
- delete m_pEditControl;
+ m_pEditControl.disposeAndClear();
ComplexToolbarController::dispose();
-
- m_pEditControl = 0;
}
Sequence<PropertyValue> EditToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx
index 3e097655c9ab..7ad43146d4cc 100644
--- a/framework/source/uielement/fontsizemenucontroller.cxx
+++ b/framework/source/uielement/fontsizemenucontroller.cxx
@@ -135,7 +135,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r
if ( pVCLPopupMenu )
{
boost::scoped_ptr<FontList> pFontList;
- boost::scoped_ptr<Printer> pInfoPrinter;
+ ScopedVclPtr<Printer> pInfoPrinter;
OUString aPrinterName;
SolarMutexGuard aSolarMutexGuard;
@@ -144,7 +144,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r
aPrinterName = retrievePrinterName( m_xFrame );
if ( !aPrinterName.isEmpty() )
{
- pInfoPrinter.reset(new Printer( aPrinterName ));
+ pInfoPrinter.reset(VclPtr<Printer>::Create( aPrinterName ));
if ( pInfoPrinter && pInfoPrinter->GetDevFontCount() > 0 )
pFontList.reset(new FontList( pInfoPrinter.get() ));
}
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index c2cdf4058fe4..7bf96258312d 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -125,7 +125,7 @@ throw ( RuntimeException, std::exception )
svt::ToolboxController::dispose();
- m_pToolbar = 0;
+ m_pToolbar.clear();
m_nID = 0;
}
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 259601ea8855..c2e324717825 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -146,7 +146,7 @@ throw ( css::uno::Exception, css::uno::RuntimeException, std::exception )
}
SolarMutexGuard aSolarLock;
- ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if ( pToolBox )
{
ToolBoxItemBits nCurStyle( pToolBox->GetItemBits( m_nToolBoxId ) );
@@ -181,7 +181,7 @@ PopupMenuToolbarController::createPopupWindow()
createPopupMenuController();
SolarMutexGuard aSolarLock;
- ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if ( !pToolBox )
return xRet;
@@ -540,7 +540,7 @@ static bool Impl_ExistURLInMenu(
void NewToolbarController::setItemImage( const OUString &rCommand )
{
SolarMutexGuard aSolarLock;
- ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ VclPtr< ToolBox> pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if ( !pToolBox )
return;
diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx
index efe6a711877f..3d60f613e000 100644
--- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx
+++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx
@@ -59,6 +59,7 @@ class SpinfieldControl : public SpinField
public:
SpinfieldControl( vcl::Window* pParent, WinBits nStyle, ISpinfieldListener* pSpinFieldListener );
virtual ~SpinfieldControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Up() SAL_OVERRIDE;
virtual void Down() SAL_OVERRIDE;
@@ -84,7 +85,13 @@ SpinfieldControl::SpinfieldControl( vcl::Window* pParent, WinBits nStyle, ISpinf
SpinfieldControl::~SpinfieldControl()
{
+ disposeOnce();
+}
+
+void SpinfieldControl::dispose()
+{
m_pSpinFieldListener = 0;
+ SpinField::dispose();
}
void SpinfieldControl::Up()
@@ -185,7 +192,7 @@ SpinfieldToolbarController::SpinfieldToolbarController(
, m_nStep( 0.0 )
, m_pSpinfieldControl( 0 )
{
- m_pSpinfieldControl = new SpinfieldControl( m_pToolbar, WB_SPIN|WB_BORDER, this );
+ m_pSpinfieldControl = VclPtr<SpinfieldControl>::Create( m_pToolbar, WB_SPIN|WB_BORDER, this );
if ( nWidth == 0 )
nWidth = 100;
@@ -206,11 +213,9 @@ throw ( RuntimeException, std::exception )
SolarMutexGuard aSolarMutexGuard;
m_pToolbar->SetItemWindow( m_nID, 0 );
- delete m_pSpinfieldControl;
+ m_pSpinfieldControl.disposeAndClear();
ComplexToolbarController::dispose();
-
- m_pSpinfieldControl = 0;
}
Sequence<PropertyValue> SpinfieldToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
diff --git a/framework/source/uielement/statusbar.cxx b/framework/source/uielement/statusbar.cxx
index 9358efe228b2..2f520ec46d95 100644
--- a/framework/source/uielement/statusbar.cxx
+++ b/framework/source/uielement/statusbar.cxx
@@ -34,10 +34,6 @@ FrameworkStatusBar::FrameworkStatusBar(
SetOutputSizePixel( CalcWindowSizePixel() );
}
-FrameworkStatusBar::~FrameworkStatusBar()
-{
-}
-
void FrameworkStatusBar::SetStatusBarManager( StatusBarManager* pStatusBarManager )
{
SolarMutexGuard aSolarMutexGuard;
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index d04529352636..f6bfb7eaf03e 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -200,40 +200,39 @@ void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException, std::exc
{
SolarMutexGuard g;
- if ( !m_bDisposed )
+ if ( m_bDisposed )
+ return;
+
+ RemoveControllers();
+
+ // destroy the item data
+ for ( sal_uInt16 n = 0; n < m_pStatusBar->GetItemCount(); n++ )
{
- RemoveControllers();
+ AddonStatusbarItemData *pUserData = static_cast< AddonStatusbarItemData *>(
+ m_pStatusBar->GetItemData( m_pStatusBar->GetItemId( n ) ) );
+ if ( pUserData )
+ delete pUserData;
+ }
- // destroy the item data
- for ( sal_uInt16 n = 0; n < m_pStatusBar->GetItemCount(); n++ )
+ m_pStatusBar.disposeAndClear();
+
+ if ( m_bFrameActionRegistered && m_xFrame.is() )
+ {
+ try
{
- AddonStatusbarItemData *pUserData = static_cast< AddonStatusbarItemData *>(
- m_pStatusBar->GetItemData( m_pStatusBar->GetItemId( n ) ) );
- if ( pUserData )
- delete pUserData;
+ m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >(
+ static_cast< ::cppu::OWeakObject *>( this ),
+ uno::UNO_QUERY ));
}
-
- delete m_pStatusBar;
- m_pStatusBar = 0;
-
- if ( m_bFrameActionRegistered && m_xFrame.is() )
+ catch ( const uno::Exception& )
{
- try
- {
- m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >(
- static_cast< ::cppu::OWeakObject *>( this ),
- uno::UNO_QUERY ));
- }
- catch ( const uno::Exception& )
- {
- }
}
+ }
- m_xFrame.clear();
- m_xContext.clear();
+ m_xFrame.clear();
+ m_xContext.clear();
- m_bDisposed = true;
- }
+ m_bDisposed = true;
}
}
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index 7d5322f12e8a..2f1f74028a0c 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -110,7 +110,7 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< Any >& aArguments )
{
sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK );
- pStatusBar = new FrameworkStatusBar( pWindow, nStyles );
+ pStatusBar = VclPtr<FrameworkStatusBar>::Create( pWindow, nStyles );
pStatusBarManager = new StatusBarManager( m_xContext, xFrame, m_aResourceURL, pStatusBar );
static_cast<FrameworkStatusBar*>(pStatusBar)->SetStatusBarManager( pStatusBarManager );
m_xStatusBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pStatusBarManager ), UNO_QUERY );
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 4de9df463d66..aca1580fef76 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -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.
*
@@ -250,7 +249,7 @@ ToolBarManager::~ToolBarManager()
void ToolBarManager::Destroy()
{
- OSL_ASSERT( m_pToolBar != 0 );
+ OSL_ASSERT( m_pToolBar != nullptr );
SolarMutexGuard g;
if ( m_bAddedToTaskPaneList )
{
@@ -288,7 +287,7 @@ void ToolBarManager::Destroy()
m_pToolBar->SetDataChangedHdl( aEmpty );
m_pToolBar->SetCommandHdl( aEmpty );
- m_pToolBar = 0;
+ m_pToolBar.clear();
SvtMiscOptions().RemoveListenerLink( LINK( this, ToolBarManager, MiscOptionsChanged ) );
}
@@ -599,6 +598,7 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException, std::exception
// We have to destroy our toolbar instance now.
Destroy();
+ m_pToolBar.clear();
if ( m_bFrameActionRegistered && m_xFrame.is() )
{
@@ -727,7 +727,7 @@ void ToolBarManager::setToolBarImage(const Image& _aImage,const CommandToInfoMap
{
const ::std::vector< sal_uInt16 >& _rIDs = _pIter->second.aIds;
m_pToolBar->SetItemImage( _pIter->second.nId, _aImage );
- ::std::for_each(_rIDs.begin(),_rIDs.end(),::boost::bind(&ToolBox::SetItemImage,m_pToolBar,_1,_aImage));
+ ::std::for_each(_rIDs.begin(),_rIDs.end(),::boost::bind(&ToolBox::SetItemImage,m_pToolBar.get(),_1,_aImage));
}
void SAL_CALL ToolBarManager::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception)
diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx
index ad609a20cca8..36f9909a250b 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -150,7 +150,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) th
{
sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
- pToolBar = new ToolBox( pWindow, nStyles );
+ pToolBar = VclPtr<ToolBox>::Create( pWindow, nStyles );
pToolBarManager = new ToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar );
m_xToolBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
pToolBar->WillUsePopupMode( bPopupMode );
diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx
index 101c6c623dfc..bb24bd08ff0a 100644
--- a/include/avmedia/mediaplayer.hxx
+++ b/include/avmedia/mediaplayer.hxx
@@ -45,6 +45,7 @@ public:
MediaFloater( SfxBindings* pBindings, SfxChildWindow* pCW, vcl::Window* pParent );
virtual ~MediaFloater();
+ virtual void dispose() SAL_OVERRIDE;
void setURL( const OUString& rURL, const OUString& rReferer, bool bPlayImmediately );
diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx
index 4c512979288a..fb61d33b865f 100644
--- a/include/avmedia/mediatoolbox.hxx
+++ b/include/avmedia/mediatoolbox.hxx
@@ -45,7 +45,7 @@ public:
virtual ~MediaToolBoxControl();
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;
private:
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
index b17ffe4afbc8..3eeb7078552b 100644
--- a/include/avmedia/mediawindow.hxx
+++ b/include/avmedia/mediawindow.hxx
@@ -28,6 +28,7 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <vcl/bitmapex.hxx>
+#include <vcl/vclptr.hxx>
#include <avmedia/avmediadllapi.h>
#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0
@@ -115,7 +116,7 @@ namespace avmedia
MediaWindow& operator =( const MediaWindow& ) SAL_DELETED_FUNCTION;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxIFace;
- std::unique_ptr<priv::MediaWindowImpl> mpImpl;
+ VclPtr<priv::MediaWindowImpl> mpImpl;
};
}
diff --git a/include/dbaccess/ToolBoxHelper.hxx b/include/dbaccess/ToolBoxHelper.hxx
index 4757c8ffb802..d9671b45fe3b 100644
--- a/include/dbaccess/ToolBoxHelper.hxx
+++ b/include/dbaccess/ToolBoxHelper.hxx
@@ -23,6 +23,7 @@
#include <sal/types.h>
#include <tools/link.hxx>
#include <vcl/image.hxx>
+#include <vcl/vclptr.hxx>
#include <dbaccess/dbaccessdllapi.h>
class SvtMiscOptions;
@@ -34,7 +35,7 @@ namespace dbaui
class DBACCESS_DLLPUBLIC OToolBoxHelper
{
sal_Int16 m_nSymbolsSize; // shows the toolbox large or small bitmaps
- ToolBox* m_pToolBox; // our toolbox (may be NULL)
+ VclPtr<ToolBox> m_pToolBox; // our toolbox (may be NULL)
public:
OToolBoxHelper();
virtual ~OToolBoxHelper();
diff --git a/include/dbaccess/dataview.hxx b/include/dbaccess/dataview.hxx
index 8189cc93a4f0..4dabda021210 100644
--- a/include/dbaccess/dataview.hxx
+++ b/include/dbaccess/dataview.hxx
@@ -37,8 +37,8 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; // the service factory to work with
protected:
- IController& m_rController; // the controller in where we resides in
- FixedLine m_aSeparator;
+ rtl::Reference<IController> m_xController; // the controller in where we resides in
+ VclPtr<FixedLine> m_aSeparator;
::std::unique_ptr< ::svt::AcceleratorExecute> m_pAccel;
public:
@@ -47,6 +47,7 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ,
WinBits nStyle = 0 );
virtual ~ODataView();
+ virtual void dispose() SAL_OVERRIDE;
/// late construction
virtual void Construct();
@@ -57,7 +58,7 @@ namespace dbaui
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
- inline IController& getCommandController() const { return m_rController; }
+ inline IController& getCommandController() const { return *m_xController.get(); }
/** will be called when the controls need to be resized.
*/
diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx
index 4dffac9b87f7..c98af7393b5e 100644
--- a/include/dbaccess/genericcontroller.hxx
+++ b/include/dbaccess/genericcontroller.hxx
@@ -59,6 +59,7 @@
#include <boost/optional.hpp>
#include <sfx2/userinputinterception.hxx>
+#include <vcl/vclptr.hxx>
namespace dbtools
{
@@ -212,7 +213,7 @@ namespace dbaui
::std::unique_ptr< OGenericUnoController_Data >
m_pData;
- ODataView* m_pView; // our (VCL) "main window"
+ VclPtr<ODataView> m_pView; // our (VCL) "main window"
#ifdef DBG_UTIL
bool m_bDescribingSupportedFeatures;
@@ -407,8 +408,8 @@ namespace dbaui
public:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const { return m_xContext; }
ODataView* getView() const { return m_pView; }
- void setView( ODataView& i_rView ) { m_pView = &i_rView; }
- void clearView() { m_pView = NULL; }
+ void setView( const VclPtr<ODataView>& i_rView );
+ void clearView();
// shows a error box if the SQLExceptionInfo is valid
void showError(const ::dbtools::SQLExceptionInfo& _rInfo);
diff --git a/include/drawinglayer/processor2d/canvasprocessor.hxx b/include/drawinglayer/processor2d/canvasprocessor.hxx
index d928a84a5d35..fb10ad339e0b 100644
--- a/include/drawinglayer/processor2d/canvasprocessor.hxx
+++ b/include/drawinglayer/processor2d/canvasprocessor.hxx
@@ -71,7 +71,7 @@ namespace drawinglayer
{
private:
// the (current) destination OutDev and canvas
- OutputDevice* mpOutputDevice;
+ VclPtr<OutputDevice> mpOutputDevice;
com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > mxCanvas;
com::sun::star::rendering::ViewState maViewState;
com::sun::star::rendering::RenderState maRenderState;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 12bb7792fe13..9bfb4b4552c8 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -30,6 +30,7 @@
#include <tools/color.hxx>
#include <tools/contnr.hxx>
#include <vcl/graph.hxx>
+#include <vcl/outdev.hxx>
#include <tools/link.hxx>
#include <rsc/rscsfx.hxx>
#include <editeng/editengdllapi.h>
@@ -476,7 +477,7 @@ struct EDITENG_DLLPUBLIC PaintFirstLineInfo
long mnBaseLineY;
const Point& mrOrigin;
short mnOrientation;
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
PaintFirstLineInfo( sal_Int32 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
: mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev )
diff --git a/include/editeng/splwrap.hxx b/include/editeng/splwrap.hxx
index 6c77e530e1e9..5e879f453381 100644
--- a/include/editeng/splwrap.hxx
+++ b/include/editeng/splwrap.hxx
@@ -23,6 +23,7 @@
#include <editeng/svxenum.hxx>
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Reference.hxx>
+#include <vcl/vclptr.hxx>
// forward ---------------------------------------------------------------
@@ -48,7 +49,7 @@ private:
friend class SvxHyphenWordDialog;
friend struct SvxHyphenWordDialog_Impl;
- vcl::Window* pWin;
+ VclPtr<vcl::Window> pWin;
::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface > xLast; // result of last spelling/hyphenation attempt
::com::sun::star::uno::Reference<
diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx
index bc407057d183..400a49b79876 100644
--- a/include/formula/funcutl.hxx
+++ b/include/formula/funcutl.hxx
@@ -34,7 +34,7 @@ class FORMULA_DLLPUBLIC RefEdit : public Edit
private:
Idle aIdle;
IControlReferenceHandler* pAnyRefDlg; // parent dialog
- vcl::Window* pLabelWidget;
+ VclPtr<vcl::Window> pLabelWidget;
DECL_LINK( UpdateHdl, void* );
@@ -48,6 +48,7 @@ public:
RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits nStyle = WB_BORDER );
virtual ~RefEdit();
+ virtual void dispose() SAL_OVERRIDE;
void SetRefString( const OUString& rStr );
@@ -86,7 +87,7 @@ private:
OUString aShrinkQuickHelp;
OUString aExpandQuickHelp;
IControlReferenceHandler* pAnyRefDlg; // parent dialog
- RefEdit* pRefEdit; // zugeordnetes Edit-Control
+ VclPtr<RefEdit> pRefEdit; // zugeordnetes Edit-Control
protected:
virtual void Click() SAL_OVERRIDE;
@@ -96,6 +97,8 @@ protected:
public:
RefButton(vcl::Window* _pParent, WinBits nStyle = 0);
+ virtual ~RefButton();
+ virtual void dispose() SAL_OVERRIDE;
void SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit );
void SetStartImage();
void SetEndImage();
diff --git a/include/rtl/ref.hxx b/include/rtl/ref.hxx
index 942923ad6819..097584b1a276 100644
--- a/include/rtl/ref.hxx
+++ b/include/rtl/ref.hxx
@@ -49,6 +49,13 @@ public:
/** Constructor...
*/
+ inline Reference (reference_type * pBody, __sal_NoAcquire)
+ : m_pBody (pBody)
+ {
+ }
+
+ /** Constructor...
+ */
inline Reference (reference_type * pBody)
: m_pBody (pBody)
{
@@ -56,7 +63,6 @@ public:
m_pBody->acquire();
}
-
/** Copy constructor...
*/
inline Reference (const Reference<reference_type> & handle)
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index 5a19603bdca8..99feed27df20 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -81,6 +81,7 @@ protected:
public:
virtual ~SfxModalDialog();
+ virtual void dispose() SAL_OVERRIDE;
const SfxItemSet* GetOutputItemSet() const { return pOutputSet; }
const SfxItemSet* GetInputItemSet() const { return pInputSet; }
};
@@ -102,6 +103,7 @@ protected:
SfxModelessDialog( SfxBindings*, SfxChildWindow*,
vcl::Window*, const OUString& rID, const OUString& rUIXMLDescription );
virtual ~SfxModelessDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void Move() SAL_OVERRIDE;
@@ -140,6 +142,7 @@ protected:
const OString& rID, const OUString& rUIXMLDescription,
const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
virtual ~SfxFloatingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
@@ -161,16 +164,12 @@ public:
struct SingleTabDlgImpl
{
- SfxTabPage* m_pSfxPage;
- FixedLine* m_pLine;
+ VclPtr<SfxTabPage> m_pSfxPage;
+ VclPtr<FixedLine> m_pLine;
OUString m_sInfoURL;
Link m_aInfoLink;
- SingleTabDlgImpl()
- : m_pSfxPage(NULL)
- , m_pLine(NULL)
- {
- }
+ SingleTabDlgImpl();
};
typedef const sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte
@@ -187,6 +186,7 @@ public:
const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"));
virtual ~SfxSingleTabDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0);
SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; }
@@ -197,9 +197,9 @@ public:
protected:
GetTabPageRanges fnGetRanges;
- OKButton* pOKBtn;
- CancelButton* pCancelBtn;
- HelpButton* pHelpBtn;
+ VclPtr<OKButton> pOKBtn;
+ VclPtr<CancelButton> pCancelBtn;
+ VclPtr<HelpButton> pHelpBtn;
SingleTabDlgImpl* pImpl;
diff --git a/include/sfx2/checkin.hxx b/include/sfx2/checkin.hxx
index c5d93f68846d..54d2dffa2174 100644
--- a/include/sfx2/checkin.hxx
+++ b/include/sfx2/checkin.hxx
@@ -16,15 +16,17 @@
class SfxCheckinDialog : public ModalDialog
{
private:
- Edit* m_pCommentED;
- CheckBox* m_pMajorCB;
+ VclPtr<Edit> m_pCommentED;
+ VclPtr<CheckBox> m_pMajorCB;
- OKButton* m_pOKBtn;
+ VclPtr<OKButton> m_pOKBtn;
DECL_DLLPRIVATE_LINK(OKHdl, void *);
public:
SfxCheckinDialog( vcl::Window* pParent );
+ virtual ~SfxCheckinDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetComment( );
bool IsMajor( );
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index a74b236a3f63..eb43f8e38343 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -124,7 +124,7 @@ struct SfxChildWindow_Impl;
class SFX2_DLLPUBLIC SfxChildWindowContext
{
friend class SfxChildWindow;
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
sal_uInt16 nContextId;
protected:
@@ -148,12 +148,12 @@ public:
class SFX2_DLLPUBLIC SfxChildWindow
{
- vcl::Window* pParent; // parent window ( Topwindow )
- sal_uInt16 nType; // ChildWindow-Id
+ VclPtr<vcl::Window> pParent; // parent window ( Topwindow )
+ sal_uInt16 nType; // ChildWindow-Id
protected:
SfxChildAlignment eChildAlignment; // Current ::com::sun::star::drawing::Alignment
- vcl::Window* pWindow; // actual contents
+ VclPtr<vcl::Window> pWindow; // actual contents
SfxChildWindow_Impl* pImp; // Implementation data
private:
diff --git a/include/sfx2/ctrlitem.hxx b/include/sfx2/ctrlitem.hxx
index aa38dc0e54b9..24f64d9a73c1 100644
--- a/include/sfx2/ctrlitem.hxx
+++ b/include/sfx2/ctrlitem.hxx
@@ -56,6 +56,7 @@ public:
SfxControllerItem(); // for arrays
SfxControllerItem( sal_uInt16 nId, SfxBindings & );
virtual ~SfxControllerItem();
+ virtual void dispose();
void Bind( sal_uInt16 nNewId, SfxBindings * = 0); // Register in SfxBindings
void UnBind();
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 58c874cba363..babea564b5df 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -180,27 +180,27 @@ public:
class SfxDocumentPage : public SfxTabPage
{
private:
- FixedImage* m_pBmp;
- SelectableFixedText* m_pNameED;
- PushButton* m_pChangePassBtn;
+ VclPtr<FixedImage> m_pBmp;
+ VclPtr<SelectableFixedText> m_pNameED;
+ VclPtr<PushButton> m_pChangePassBtn;
- SelectableFixedText* m_pShowTypeFT;
- Edit* m_pFileValEd;
- SelectableFixedText* m_pShowSizeFT;
+ VclPtr<SelectableFixedText> m_pShowTypeFT;
+ VclPtr<Edit> m_pFileValEd;
+ VclPtr<SelectableFixedText> m_pShowSizeFT;
- SelectableFixedText* m_pCreateValFt;
- SelectableFixedText* m_pChangeValFt;
- SelectableFixedText* m_pSignedValFt;
- PushButton* m_pSignatureBtn;
- SelectableFixedText* m_pPrintValFt;
- SelectableFixedText* m_pTimeLogValFt;
- SelectableFixedText* m_pDocNoValFt;
+ VclPtr<SelectableFixedText> m_pCreateValFt;
+ VclPtr<SelectableFixedText> m_pChangeValFt;
+ VclPtr<SelectableFixedText> m_pSignedValFt;
+ VclPtr<PushButton> m_pSignatureBtn;
+ VclPtr<SelectableFixedText> m_pPrintValFt;
+ VclPtr<SelectableFixedText> m_pTimeLogValFt;
+ VclPtr<SelectableFixedText> m_pDocNoValFt;
- CheckBox* m_pUseUserDataCB;
- PushButton* m_pDeleteBtn;
+ VclPtr<CheckBox> m_pUseUserDataCB;
+ VclPtr<PushButton> m_pDeleteBtn;
- FixedText* m_pTemplFt;
- SelectableFixedText* m_pTemplValFt;
+ VclPtr<FixedText> m_pTemplFt;
+ VclPtr<SelectableFixedText> m_pTemplValFt;
OUString m_aUnknownSize;
OUString m_aMultiSignedStr;
@@ -215,13 +215,15 @@ private:
void ImplCheckPasswordState();
protected:
- SfxDocumentPage( vcl::Window* pParent, const SfxItemSet& );
+ virtual ~SfxDocumentPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* );
+ SfxDocumentPage( vcl::Window* pParent, const SfxItemSet& );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* );
void EnableUseUserData();
};
@@ -231,20 +233,22 @@ public:
class SfxDocumentDescPage : public SfxTabPage
{
private:
- Edit* m_pTitleEd;
- Edit* m_pThemaEd;
- Edit* m_pKeywordsEd;
- VclMultiLineEdit* m_pCommentEd;
- SfxDocumentInfoItem* m_pInfoItem;
+ VclPtr<Edit> m_pTitleEd;
+ VclPtr<Edit> m_pThemaEd;
+ VclPtr<Edit> m_pKeywordsEd;
+ VclPtr<VclMultiLineEdit> m_pCommentEd;
+ SfxDocumentInfoItem* m_pInfoItem;
protected:
- SfxDocumentDescPage( vcl::Window* pParent, const SfxItemSet& );
+ virtual ~SfxDocumentDescPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* );
+ SfxDocumentDescPage( vcl::Window* pParent, const SfxItemSet& );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* );
};
// class SfxDocumentInfoDialog -------------------------------------------
@@ -335,7 +339,6 @@ protected:
virtual void RequestHelp(const HelpEvent& rEvt) SAL_OVERRIDE;
public:
CustomPropertiesDurationField(vcl::Window* pParent, WinBits nStyle, CustomPropertyLine* pLine);
- virtual ~CustomPropertiesDurationField();
void SetDuration( const com::sun::star::util::Duration& rDuration );
const com::sun::star::util::Duration& GetDuration() const { return m_aDuration; }
@@ -347,7 +350,6 @@ class CustomPropertiesEditButton : public PushButton
public:
CustomPropertiesEditButton(vcl::Window* pParent, WinBits nStyle, CustomPropertyLine* pLine);
- virtual ~CustomPropertiesEditButton();
DECL_LINK(ClickHdl, void *);
};
@@ -370,33 +372,35 @@ public:
class CustomPropertiesYesNoButton : public Control
{
private:
- RadioButton m_aYesButton;
- RadioButton m_aNoButton;
+ VclPtr<RadioButton> m_aYesButton;
+ VclPtr<RadioButton> m_aNoButton;
public:
CustomPropertiesYesNoButton( vcl::Window* pParent, const ResId& rResId );
+ virtual ~CustomPropertiesYesNoButton();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
- inline void CheckYes() { m_aYesButton.Check(); }
- inline void CheckNo() { m_aNoButton.Check(); }
- inline bool IsYesChecked() const { return m_aYesButton.IsChecked(); }
+ inline void CheckYes() { m_aYesButton->Check(); }
+ inline void CheckNo() { m_aNoButton->Check(); }
+ inline bool IsYesChecked() const { return m_aYesButton->IsChecked(); }
};
// struct CustomPropertyLine ---------------------------------------------
struct CustomPropertyLine
{
- ComboBox m_aNameBox;
- CustomPropertiesTypeBox m_aTypeBox;
- CustomPropertiesEdit m_aValueEdit;
- CustomPropertiesDateField m_aDateField;
- CustomPropertiesTimeField m_aTimeField;
- const OUString m_sDurationFormat;
- CustomPropertiesDurationField m_aDurationField;
- CustomPropertiesEditButton m_aEditButton;
- CustomPropertiesYesNoButton m_aYesNoButton;
- CustomPropertiesRemoveButton m_aRemoveButton;
+ VclPtr<ComboBox> m_aNameBox;
+ VclPtr<CustomPropertiesTypeBox> m_aTypeBox;
+ VclPtr<CustomPropertiesEdit> m_aValueEdit;
+ VclPtr<CustomPropertiesDateField> m_aDateField;
+ VclPtr<CustomPropertiesTimeField> m_aTimeField;
+ const OUString m_sDurationFormat;
+ VclPtr<CustomPropertiesDurationField> m_aDurationField;
+ VclPtr<CustomPropertiesEditButton> m_aEditButton;
+ VclPtr<CustomPropertiesYesNoButton> m_aYesNoButton;
+ VclPtr<CustomPropertiesRemoveButton> m_aRemoveButton;
bool m_bIsDate;
bool m_bIsRemoved;
@@ -412,19 +416,19 @@ struct CustomPropertyLine
class CustomPropertiesWindow : public vcl::Window
{
private:
- FixedText* m_pHeaderAccName;
- FixedText* m_pHeaderAccType;
- FixedText* m_pHeaderAccValue;
-
- ComboBox m_aNameBox;
- ListBox m_aTypeBox;
- Edit m_aValueEdit;
- DateField m_aDateField;
- TimeField m_aTimeField;
- Edit m_aDurationField;
- PushButton m_aEditButton;
- CustomPropertiesYesNoButton m_aYesNoButton;
- ImageButton m_aRemoveButton;
+ VclPtr<FixedText> m_pHeaderAccName;
+ VclPtr<FixedText> m_pHeaderAccType;
+ VclPtr<FixedText> m_pHeaderAccValue;
+
+ VclPtr<ComboBox> m_aNameBox;
+ VclPtr<ListBox> m_aTypeBox;
+ VclPtr<Edit> m_aValueEdit;
+ VclPtr<DateField> m_aDateField;
+ VclPtr<TimeField> m_aTimeField;
+ VclPtr<Edit> m_aDurationField;
+ VclPtr<PushButton> m_aEditButton;
+ VclPtr<CustomPropertiesYesNoButton> m_aYesNoButton;
+ VclPtr<ImageButton> m_aRemoveButton;
sal_Int32 m_nLineHeight;
sal_Int32 m_nScrollPos;
@@ -454,6 +458,7 @@ public:
FixedText *pHeaderAccType,
FixedText *pHeaderAccValue);
virtual ~CustomPropertiesWindow();
+ virtual void dispose() SAL_OVERRIDE;
bool InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
sal_uInt16 GetVisibleLineCount() const;
@@ -476,11 +481,11 @@ public:
class CustomPropertiesControl : public vcl::Window
{
private:
- VclVBox* m_pVBox;
- HeaderBar* m_pHeaderBar;
- VclHBox* m_pBody;
- CustomPropertiesWindow* m_pPropertiesWin;
- ScrollBar* m_pVertScroll;
+ VclPtr<VclVBox> m_pVBox;
+ VclPtr<HeaderBar> m_pHeaderBar;
+ VclPtr<VclHBox> m_pBody;
+ VclPtr<CustomPropertiesWindow> m_pPropertiesWin;
+ VclPtr<ScrollBar> m_pVertScroll;
sal_Int32 m_nThumbPos;
@@ -490,6 +495,7 @@ private:
public:
CustomPropertiesControl(vcl::Window* pParent);
virtual ~CustomPropertiesControl();
+ virtual void dispose() SAL_OVERRIDE;
void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive );
@@ -507,42 +513,44 @@ public:
class SfxCustomPropertiesPage : public SfxTabPage
{
private:
- CustomPropertiesControl* m_pPropertiesCtrl;
+ VclPtr<CustomPropertiesControl> m_pPropertiesCtrl;
DECL_LINK(AddHdl, void *);
using TabPage::DeactivatePage;
protected:
- SfxCustomPropertiesPage( vcl::Window* pParent, const SfxItemSet& );
+ virtual ~SfxCustomPropertiesPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = NULL ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* );
+ SfxCustomPropertiesPage( vcl::Window* pParent, const SfxItemSet& );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* );
};
struct CmisValue : public VclBuilderContainer
{
- Edit* m_aValueEdit;
+ VclPtr<Edit> m_aValueEdit;
CmisValue( vcl::Window* pParent, const OUString& aStr );
};
struct CmisDateTime : public VclBuilderContainer
{
- DateField* m_aDateField;
- TimeField* m_aTimeField;
+ VclPtr<DateField> m_aDateField;
+ VclPtr<TimeField> m_aTimeField;
CmisDateTime( vcl::Window* pParent, const ::com::sun::star::util::DateTime& aDateTime );
};
struct CmisYesNo : public VclBuilderContainer
{
- RadioButton* m_aYesButton;
- RadioButton* m_aNoButton;
+ VclPtr<RadioButton> m_aYesButton;
+ VclPtr<RadioButton> m_aNoButton;
CmisYesNo( vcl::Window* pParent, bool bValue);
};
@@ -551,15 +559,15 @@ struct CmisYesNo : public VclBuilderContainer
struct CmisPropertyLine : public VclBuilderContainer
{
- VclFrame* m_pFrame;
+ VclPtr<VclFrame> m_pFrame;
OUString m_sId;
OUString m_sType;
bool m_bUpdatable;
bool m_bRequired;
bool m_bMultiValued;
bool m_bOpenChoice;
- FixedText* m_aName;
- FixedText* m_aType;
+ VclPtr<FixedText> m_aName;
+ VclPtr<FixedText> m_aType;
std::vector< CmisValue* > m_aValues;
std::vector< CmisDateTime* > m_aDateTimes;
std::vector< CmisYesNo* > m_aYesNos;
@@ -574,7 +582,7 @@ struct CmisPropertyLine : public VclBuilderContainer
class CmisPropertiesWindow
{
private:
- VclBox* m_pBox;
+ VclPtr<VclBox> m_pBox;
sal_Int32 m_nItemHeight;
SvNumberFormatter m_aNumberFormatter;
std::vector< CmisPropertyLine* > m_aCmisPropertiesLines;
@@ -636,14 +644,13 @@ private:
DECL_LINK(UpdateHdl, void *);
protected:
- SfxCmisPropertiesPage( vcl::Window* pParent, const SfxItemSet& );
-
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = NULL ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* );
+ SfxCmisPropertiesPage( vcl::Window* pParent, const SfxItemSet& );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* );
};
#endif // #ifndef _ INCLUDED_SFX2_DINFDLG_HXX
diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx
index 57f256707658..e5a5ff8a704b 100644
--- a/include/sfx2/dockwin.hxx
+++ b/include/sfx2/dockwin.hxx
@@ -84,6 +84,7 @@ public:
vcl::Window* pParent,
const OString& rID, const OUString& rUIXMLDescription );
virtual ~SfxDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
void Initialize (SfxChildWinInfo* pInfo);
virtual void FillInfo(SfxChildWinInfo&) const;
diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx
index 7e66740176ac..1c325b92f628 100644
--- a/include/sfx2/fcontnr.hxx
+++ b/include/sfx2/fcontnr.hxx
@@ -57,14 +57,13 @@ public:
class SfxFrameWindow
{
- vcl::Window* pWindow;
+ ScopedVclPtr<vcl::Window> pWindow;
public:
SfxFrameWindow( vcl::Window *pWin )
: pWindow( pWin )
{}
- virtual ~SfxFrameWindow()
- { delete pWindow; }
+ virtual ~SfxFrameWindow() {}
vcl::Window* GetWindow() const
{ return pWindow; }
void SetWindow( vcl::Window *pWin )
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index fcd6c46c748b..d9c3620ee1eb 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <vcl/vclptr.hxx>
namespace com
{
@@ -103,7 +104,7 @@ private:
SfxFrame* pParentFrame;
SfxFrameArr_Impl* pChildArr;
SfxFrame_Impl* pImp;
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
protected:
bool Close();
diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx
index eb0c4c6dcb8c..7a89267b3bc5 100644
--- a/include/sfx2/infobar.hxx
+++ b/include/sfx2/infobar.hxx
@@ -43,16 +43,16 @@ class SFX2_DLLPUBLIC SfxInfoBarContainerChild : public SfxChildWindow
class SfxInfoBarWindow : public vcl::Window
{
private:
- OUString m_sId;
-
- std::unique_ptr<FixedText> m_pMessage;
- std::unique_ptr<Button> m_pCloseBtn;
-
- boost::ptr_vector<PushButton> m_aActionBtns;
+ OUString m_sId;
+ VclPtr<FixedText> m_pMessage;
+ VclPtr<Button> m_pCloseBtn;
+ std::vector< VclPtr<PushButton> > m_aActionBtns;
public:
- SfxInfoBarWindow(vcl::Window* parent, const OUString& sId, const OUString& sMessage);
+ SfxInfoBarWindow( vcl::Window* parent, const OUString& sId,
+ const OUString& sMessage );
virtual ~SfxInfoBarWindow( );
+ virtual void dispose() SAL_OVERRIDE;
const OUString& getId() const { return m_sId; }
virtual void Paint( const Rectangle& ) SAL_OVERRIDE;
@@ -71,12 +71,13 @@ class SfxInfoBarWindow : public vcl::Window
class SfxInfoBarContainerWindow : public vcl::Window
{
private:
- SfxInfoBarContainerChild* m_pChildWin;
- boost::ptr_vector<SfxInfoBarWindow> m_pInfoBars;
+ SfxInfoBarContainerChild* m_pChildWin;
+ std::vector< VclPtr<SfxInfoBarWindow> > m_pInfoBars;
public:
SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin);
virtual ~SfxInfoBarContainerWindow( );
+ virtual void dispose() SAL_OVERRIDE;
SfxInfoBarWindow* appendInfoBar(const OUString& sId, const OUString& sMessage);
SfxInfoBarWindow* getInfoBar(const OUString& sId);
diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx
index 10ab174bbdbd..9022f73573c7 100644
--- a/include/sfx2/ipclient.hxx
+++ b/include/sfx2/ipclient.hxx
@@ -29,11 +29,11 @@
#include <tools/gen.hxx>
#include <sfx2/objsh.hxx>
+#include <vcl/window.hxx>
class SfxInPlaceClient_Impl;
class SfxViewShell;
class SfxObjectShell;
-namespace vcl { class Window; }
class Fraction;
@@ -44,7 +44,7 @@ friend class SfxInPlaceClient_Impl;
SfxInPlaceClient_Impl* m_pImp;
SfxViewShell* m_pViewSh;
- vcl::Window* m_pEditWin;
+ VclPtr<vcl::Window> m_pEditWin;
// called after the requested new object area was negotiated
SAL_DLLPRIVATE virtual void ObjectAreaChanged();
diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
index 6b5ba434c562..f8f4b5556be6 100644
--- a/include/sfx2/mgetempl.hxx
+++ b/include/sfx2/mgetempl.hxx
@@ -36,23 +36,23 @@ class SfxStyleSheetBase;
class SfxManageStyleSheetPage : public SfxTabPage
{
- VclMultiLineEdit* m_pNameRo;
- Edit* m_pNameRw;
+ VclPtr<VclMultiLineEdit> m_pNameRo;
+ VclPtr<Edit> m_pNameRw;
- CheckBox* m_pAutoCB;
+ VclPtr<CheckBox> m_pAutoCB;
- FixedText* m_pFollowFt;
- ListBox* m_pFollowLb;
- PushButton* m_pEditStyleBtn;
+ VclPtr<FixedText> m_pFollowFt;
+ VclPtr<ListBox> m_pFollowLb;
+ VclPtr<PushButton> m_pEditStyleBtn;
- FixedText* m_pBaseFt;
- ListBox* m_pBaseLb;
- PushButton* m_pEditLinkStyleBtn;
+ VclPtr<FixedText> m_pBaseFt;
+ VclPtr<ListBox> m_pBaseLb;
+ VclPtr<PushButton> m_pEditLinkStyleBtn;
- FixedText* m_pFilterFt;
- ListBox* m_pFilterLb;
+ VclPtr<FixedText> m_pFilterFt;
+ VclPtr<ListBox> m_pFilterLb;
- FixedText *m_pDescFt;
+ VclPtr<FixedText> m_pDescFt;
SfxStyleSheetBase *pStyle;
SfxStyleFamilies *pFamilies;
@@ -79,10 +79,10 @@ friend class SfxStyleDialog;
void UpdateName_Impl(ListBox *, const OUString &rNew);
void SetDescriptionText_Impl();
- SfxManageStyleSheetPage(vcl::Window *pParent, const SfxItemSet &rAttrSet );
virtual ~SfxManageStyleSheetPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window *pParent, const SfxItemSet *rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* );
protected:
virtual bool FillItemSet(SfxItemSet *) SAL_OVERRIDE;
@@ -95,6 +95,9 @@ protected:
virtual void ActivatePage(const SfxItemSet &) SAL_OVERRIDE;
using TabPage::DeactivatePage;
virtual sfxpg DeactivatePage(SfxItemSet * = 0) SAL_OVERRIDE;
+
+public:
+ SfxManageStyleSheetPage(vcl::Window *pParent, const SfxItemSet &rAttrSet );
};
#endif
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 4c30e4f2cac4..d98b5c9c190d 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -83,7 +83,7 @@ public:
void RegisterStatusBarControl(SfxStbCtrlFactory*);
void RegisterMenuControl(SfxMenuCtrlFactory*);
- virtual SfxTabPage* CreateTabPage( sal_uInt16 nId,
+ virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId,
vcl::Window* pParent,
const SfxItemSet& rSet );
virtual void Invalidate(sal_uInt16 nId = 0) SAL_OVERRIDE;
diff --git a/include/sfx2/new.hxx b/include/sfx2/new.hxx
index 48b6dab5cc38..05482a4e1027 100644
--- a/include/sfx2/new.hxx
+++ b/include/sfx2/new.hxx
@@ -67,6 +67,7 @@ public:
SfxNewFileDialog(vcl::Window *pParent, sal_uInt16 nFlags = 0);
virtual ~SfxNewFileDialog();
+ virtual void dispose() SAL_OVERRIDE;
// Returns false, when '- No -' is set as Template
// Template names can only be obtained when IsTemplate() returns true.
diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx
index f0f47e26bb15..1a23a8d78683 100644
--- a/include/sfx2/newstyle.hxx
+++ b/include/sfx2/newstyle.hxx
@@ -33,10 +33,10 @@ class SfxStyleSheetBasePool;
class SFX2_DLLPUBLIC SfxNewStyleDlg : public ModalDialog
{
private:
- ComboBox* m_pColBox;
- OKButton* m_pOKBtn;
+ VclPtr<ComboBox> m_pColBox;
+ VclPtr<OKButton> m_pOKBtn;
- MessageDialog aQueryOverwriteBox;
+ VclPtr<MessageDialog> aQueryOverwriteBox;
SfxStyleSheetBasePool& rPool;
DECL_DLLPRIVATE_LINK( OKHdl, Control * );
@@ -45,6 +45,7 @@ private:
public:
SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& );
virtual ~SfxNewStyleDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetName() const { return comphelper::string::stripStart(m_pColBox->GetText(), ' '); }
};
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 041631e3aa01..b9d20fe2d6a1 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -37,6 +37,7 @@
#include <com/sun/star/document/CmisVersion.hpp>
#include <vcl/timer.hxx>
+#include <vcl/vclptr.hxx>
#include <svl/poolitem.hxx>
#include <vcl/bitmap.hxx>
#include <sot/storage.hxx>
@@ -370,7 +371,7 @@ public:
SignatureState GetScriptingSignatureState();
void SignScriptingContent();
- virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
+ virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(
vcl::Window *pParent, const SfxItemSet& );
ErrCode CallBasic( const OUString& rMacro, const OUString& rBasicName,
diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx
index 4b241d0a243c..647776241eaa 100644
--- a/include/sfx2/passwd.hxx
+++ b/include/sfx2/passwd.hxx
@@ -50,23 +50,23 @@ namespace o3tl
class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog
{
private:
- VclFrame* mpPassword1Box;
- FixedText* mpUserFT;
- Edit* mpUserED;
- FixedText* mpPassword1FT;
- Edit* mpPassword1ED;
- FixedText* mpConfirm1FT;
- Edit* mpConfirm1ED;
+ VclPtr<VclFrame> mpPassword1Box;
+ VclPtr<FixedText> mpUserFT;
+ VclPtr<Edit> mpUserED;
+ VclPtr<FixedText> mpPassword1FT;
+ VclPtr<Edit> mpPassword1ED;
+ VclPtr<FixedText> mpConfirm1FT;
+ VclPtr<Edit> mpConfirm1ED;
- VclFrame* mpPassword2Box;
- FixedText* mpPassword2FT;
- Edit* mpPassword2ED;
- FixedText* mpConfirm2FT;
- Edit* mpConfirm2ED;
+ VclPtr<VclFrame> mpPassword2Box;
+ VclPtr<FixedText> mpPassword2FT;
+ VclPtr<Edit> mpPassword2ED;
+ VclPtr<FixedText> mpConfirm2FT;
+ VclPtr<Edit> mpConfirm2ED;
- FixedText* mpMinLengthFT;
+ VclPtr<FixedText> mpMinLengthFT;
- OKButton* mpOKBtn;
+ VclPtr<OKButton> mpOKBtn;
OUString maMinLenPwdStr;
OUString maMinLenPwdStr1;
@@ -83,6 +83,8 @@ private:
public:
SfxPasswordDialog(vcl::Window* pParent, const OUString* pGroupText = NULL);
+ virtual ~SfxPasswordDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetUser() const
{
diff --git a/include/sfx2/printer.hxx b/include/sfx2/printer.hxx
index f07a135c8ece..d419b356507d 100644
--- a/include/sfx2/printer.hxx
+++ b/include/sfx2/printer.hxx
@@ -51,10 +51,11 @@ public:
const JobSetup &rTheOrigJobSetup );
SfxPrinter( const SfxPrinter &rPrinter );
virtual ~SfxPrinter();
+ virtual void dispose() SAL_OVERRIDE;
- SfxPrinter* Clone() const;
+ VclPtr<SfxPrinter> Clone() const;
- static SfxPrinter* Create( SvStream &rStream, SfxItemSet *pOptions );
+ static VclPtr<SfxPrinter> Create( SvStream &rStream, SfxItemSet *pOptions );
SvStream& Store( SvStream &rStream ) const;
const JobSetup& GetOrigJobSetup() const { return aOrigJobSetup; }
diff --git a/include/sfx2/printopt.hxx b/include/sfx2/printopt.hxx
index 3fcf7a0fdd4e..f969b5ff645f 100644
--- a/include/sfx2/printopt.hxx
+++ b/include/sfx2/printopt.hxx
@@ -41,32 +41,32 @@ class SFX2_DLLPUBLIC SfxCommonPrintOptionsTabPage : public SfxTabPage
{
private:
- RadioButton* m_pPrinterOutputRB;
- RadioButton* m_pPrintFileOutputRB;
+ VclPtr<RadioButton> m_pPrinterOutputRB;
+ VclPtr<RadioButton> m_pPrintFileOutputRB;
- CheckBox* m_pReduceTransparencyCB;
- RadioButton* m_pReduceTransparencyAutoRB;
- RadioButton* m_pReduceTransparencyNoneRB;
+ VclPtr<CheckBox> m_pReduceTransparencyCB;
+ VclPtr<RadioButton> m_pReduceTransparencyAutoRB;
+ VclPtr<RadioButton> m_pReduceTransparencyNoneRB;
- CheckBox* m_pReduceGradientsCB;
- RadioButton* m_pReduceGradientsStripesRB;
- RadioButton* m_pReduceGradientsColorRB;
- NumericField* m_pReduceGradientsStepCountNF;
+ VclPtr<CheckBox> m_pReduceGradientsCB;
+ VclPtr<RadioButton> m_pReduceGradientsStripesRB;
+ VclPtr<RadioButton> m_pReduceGradientsColorRB;
+ VclPtr<NumericField> m_pReduceGradientsStepCountNF;
- CheckBox* m_pReduceBitmapsCB;
- RadioButton* m_pReduceBitmapsOptimalRB;
- RadioButton* m_pReduceBitmapsNormalRB;
- RadioButton* m_pReduceBitmapsResolutionRB;
- ListBox* m_pReduceBitmapsResolutionLB;
- CheckBox* m_pReduceBitmapsTransparencyCB;
+ VclPtr<CheckBox> m_pReduceBitmapsCB;
+ VclPtr<RadioButton> m_pReduceBitmapsOptimalRB;
+ VclPtr<RadioButton> m_pReduceBitmapsNormalRB;
+ VclPtr<RadioButton> m_pReduceBitmapsResolutionRB;
+ VclPtr<ListBox> m_pReduceBitmapsResolutionLB;
+ VclPtr<CheckBox> m_pReduceBitmapsTransparencyCB;
- CheckBox* m_pConvertToGreyscalesCB;
+ VclPtr<CheckBox> m_pConvertToGreyscalesCB;
- CheckBox* m_pPDFCB;
+ VclPtr<CheckBox> m_pPDFCB;
- CheckBox* m_pPaperSizeCB;
- CheckBox* m_pPaperOrientationCB;
- CheckBox* m_pTransparencyCB;
+ VclPtr<CheckBox> m_pPaperSizeCB;
+ VclPtr<CheckBox> m_pPaperOrientationCB;
+ VclPtr<CheckBox> m_pTransparencyCB;
private:
@@ -94,14 +94,14 @@ protected:
public:
SfxCommonPrintOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~SfxCommonPrintOptionsTabPage();
-
+ virtual ~SfxCommonPrintOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual vcl::Window* GetParentLabeledBy( const vcl::Window* pLabel ) const SAL_OVERRIDE;
virtual vcl::Window* GetParentLabelFor( const vcl::Window* pLabel ) const SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* );
};
#endif // INCLUDED_SFX2_PRINTOPT_HXX
diff --git a/include/sfx2/prnmon.hxx b/include/sfx2/prnmon.hxx
index 1468ee81fe82..ff42cb0253df 100644
--- a/include/sfx2/prnmon.hxx
+++ b/include/sfx2/prnmon.hxx
@@ -38,13 +38,14 @@ private:
SfxPrintOptDlg_Impl* pDlgImpl;
SfxViewShell* pViewSh;
SfxItemSet* pOptions;
- SfxTabPage* pPage;
+ VclPtr<SfxTabPage> pPage;
public:
SfxPrintOptionsDialog( vcl::Window *pParent,
SfxViewShell *pViewShell,
const SfxItemSet *rOptions );
virtual ~SfxPrintOptionsDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool Construct();
virtual short Execute() SAL_OVERRIDE;
diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx
index 68176cf8a7eb..1affc2e23b58 100644
--- a/include/sfx2/recentdocsview.hxx
+++ b/include/sfx2/recentdocsview.hxx
@@ -42,7 +42,6 @@ class SFX2_DLLPUBLIC RecentDocsView : public ThumbnailView
{
public:
RecentDocsView( vcl::Window* pParent );
- virtual ~RecentDocsView();
void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId);
diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx
index 2777088ddc60..84ad9dc0e609 100644
--- a/include/sfx2/securitypage.hxx
+++ b/include/sfx2/securitypage.hxx
@@ -33,14 +33,12 @@ class SfxSecurityPage : public SfxTabPage
std::unique_ptr< SfxSecurityPage_Impl > m_pImpl;
protected:
- SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& );
- virtual ~SfxSecurityPage();
-
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* );
+ SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* );
};
diff --git a/include/sfx2/sidebar/ControlFactory.hxx b/include/sfx2/sidebar/ControlFactory.hxx
index a078e00c20c2..142f249c4627 100644
--- a/include/sfx2/sidebar/ControlFactory.hxx
+++ b/include/sfx2/sidebar/ControlFactory.hxx
@@ -22,6 +22,7 @@
#include <sfx2/dllapi.h>
#include <sfx2/sidebar/SidebarToolBox.hxx>
#include <vcl/button.hxx>
+#include <vcl/vclptr.hxx>
#include <com/sun/star/frame/XFrame.hpp>
class ToolBox;
@@ -39,9 +40,9 @@ class SFX2_DLLPUBLIC ControlFactory
public:
/** Create the menu button for the task bar.
*/
- static CheckBox* CreateMenuButton (vcl::Window* pParentWindow);
+ static VclPtr<CheckBox> CreateMenuButton (vcl::Window* pParentWindow);
- static ImageRadioButton* CreateTabItem (vcl::Window* pParentWindow);
+ static VclPtr<ImageRadioButton> CreateTabItem (vcl::Window* pParentWindow);
};
diff --git a/include/sfx2/sidebar/ControllerItem.hxx b/include/sfx2/sidebar/ControllerItem.hxx
index 7210dea31c3d..ef1a6db600fa 100644
--- a/include/sfx2/sidebar/ControllerItem.hxx
+++ b/include/sfx2/sidebar/ControllerItem.hxx
@@ -80,6 +80,9 @@ public:
SfxBindings &rBindings,
ItemUpdateReceiverInterface& rItemUpdateReceiver);
+ /// releases our action listener
+ virtual void dispose() SAL_OVERRIDE;
+
virtual ~ControllerItem();
/** Returns </TRUE> when the slot/command has not been disabled.
diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx
index 2f34065a8480..a60f951b618f 100644
--- a/include/sfx2/sidebar/SidebarPanelBase.hxx
+++ b/include/sfx2/sidebar/SidebarPanelBase.hxx
@@ -33,6 +33,7 @@
#include <boost/noncopyable.hpp>
#include <boost/function.hpp>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
@@ -111,7 +112,7 @@ protected:
throw (css::uno::RuntimeException) SAL_OVERRIDE;
private:
- vcl::Window* mpControl;
+ VclPtr<vcl::Window> mpControl;
const ::rtl::OUString msResourceURL;
const css::ui::LayoutSize maLayoutSize;
};
diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx
index a19e182f648a..129940de2ccf 100644
--- a/include/sfx2/sidebar/SidebarToolBox.hxx
+++ b/include/sfx2/sidebar/SidebarToolBox.hxx
@@ -41,6 +41,7 @@ class SFX2_DLLPUBLIC SidebarToolBox
public:
SidebarToolBox(vcl::Window* pParentWindow);
virtual ~SidebarToolBox();
+ virtual void dispose() SAL_OVERRIDE;
using ToolBox::InsertItem;
virtual void InsertItem(const OUString& rCommand,
diff --git a/include/sfx2/stbitem.hxx b/include/sfx2/stbitem.hxx
index 835fcff98b46..9e4850a46e15 100644
--- a/include/sfx2/stbitem.hxx
+++ b/include/sfx2/stbitem.hxx
@@ -59,9 +59,9 @@ class UserDrawEvent;
class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController
{
- sal_uInt16 nSlotId;
- sal_uInt16 nId;
- StatusBar* pBar;
+ sal_uInt16 nSlotId;
+ sal_uInt16 nId;
+ VclPtr<StatusBar> pBar;
protected:
// new controller API
diff --git a/include/sfx2/styledlg.hxx b/include/sfx2/styledlg.hxx
index 9e9bef903aeb..e837c87d6ae1 100644
--- a/include/sfx2/styledlg.hxx
+++ b/include/sfx2/styledlg.hxx
@@ -41,6 +41,7 @@ public:
const OUString& rUIXMLDescription, SfxStyleSheetBase&);
virtual ~SfxStyleDialog();
+ virtual void dispose() SAL_OVERRIDE;
SfxStyleSheetBase& GetStyleSheet() { return *pStyle; }
const SfxStyleSheetBase& GetStyleSheet() const { return *pStyle; }
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index b54d974f306e..88a05b95ea30 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -37,7 +37,7 @@ class SfxViewFrame;
class SfxTabPage;
class SfxBindings;
-typedef SfxTabPage* (*CreateTabPage)(vcl::Window *pParent, const SfxItemSet *rAttrSet);
+typedef VclPtr<SfxTabPage> (*CreateTabPage)(vcl::Window *pParent, const SfxItemSet *rAttrSet);
typedef const sal_uInt16* (*GetTabPageRanges)(); // provides international Which-value
struct TabPageImpl;
@@ -64,16 +64,16 @@ friend class SfxTabDialogController;
SfxViewFrame* pFrame;
- VclBox *m_pBox;
- TabControl *m_pTabCtrl;
+ VclPtr<VclBox> m_pBox;
+ VclPtr<TabControl> m_pTabCtrl;
- PushButton* m_pOKBtn;
- PushButton* m_pApplyBtn;
- PushButton* m_pUserBtn;
- CancelButton* m_pCancelBtn;
- HelpButton* m_pHelpBtn;
- PushButton* m_pResetBtn;
- PushButton* m_pBaseFmtBtn;
+ VclPtr<PushButton> m_pOKBtn;
+ VclPtr<PushButton> m_pApplyBtn;
+ VclPtr<PushButton> m_pUserBtn;
+ VclPtr<CancelButton> m_pCancelBtn;
+ VclPtr<HelpButton> m_pHelpBtn;
+ VclPtr<PushButton> m_pResetBtn;
+ VclPtr<PushButton> m_pBaseFmtBtn;
bool m_bOwnsOKBtn;
bool m_bOwnsCancelBtn;
@@ -106,7 +106,7 @@ protected:
virtual void RefreshInputSet();
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
- VclButtonBox* m_pActionArea;
+ VclPtr<VclButtonBox> m_pActionArea;
SfxItemSet* pExampleSet;
SfxItemSet* GetInputSetImpl();
SfxTabPage* GetTabPage( sal_uInt16 nPageId ) const;
@@ -129,6 +129,7 @@ public:
const OUString& rID, const OUString& rUIXMLDescription,
const SfxItemSet * = 0, bool bEditFmt = false);
virtual ~SfxTabDialog();
+ virtual void dispose() SAL_OVERRIDE;
sal_uInt16 AddTabPage( const OString& rName, // Name of the label for the page in the notebook .ui
CreateTabPage pCreateFunc, // != 0
@@ -249,6 +250,7 @@ protected:
public:
virtual ~SfxTabPage();
+ virtual void dispose() SAL_OVERRIDE;
const SfxItemSet& GetItemSet() const { return *pSet; }
diff --git a/include/sfx2/taskpane.hxx b/include/sfx2/taskpane.hxx
index dadbdf1d300f..21556961e85f 100644
--- a/include/sfx2/taskpane.hxx
+++ b/include/sfx2/taskpane.hxx
@@ -163,6 +163,8 @@ namespace sfx2
public:
TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper,
vcl::Window* i_pParent, WinBits i_nBits );
+ virtual ~TaskPaneDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
// ITaskPaneToolPanelAccess
virtual void ActivateToolPanel( const OUString& i_rPanelURL ) SAL_OVERRIDE;
@@ -175,8 +177,8 @@ namespace sfx2
virtual void onLayoutDone() SAL_OVERRIDE;
private:
- ModuleTaskPane m_aTaskPane;
- TaskPaneController m_aPaneController;
+ VclPtr<ModuleTaskPane> m_aTaskPane;
+ TaskPaneController m_aPaneController;
};
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index b76a9d06980b..402d0c1df6e6 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -151,8 +151,9 @@ public:
vcl::Window* pParentWindow,
WinBits nBits );
virtual ~SfxPopupWindow();
+ virtual void dispose() SAL_OVERRIDE;
- virtual SfxPopupWindow* Clone() const;
+ virtual VclPtr<SfxPopupWindow> Clone() const;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
void StartCascading();
@@ -200,9 +201,9 @@ protected:
virtual void DoubleClick();
virtual void Click();
virtual SfxPopupWindowType GetPopupWindowType() const;
- virtual SfxPopupWindow* CreatePopupWindow();
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow();
virtual SfxPopupWindow* CreatePopupWindowCascading();
- virtual vcl::Window* CreateItemWindow( vcl::Window *pParent );
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent );
// Must be called by subclass to set a new popup window instance
void SetPopupWindow( SfxPopupWindow* pWindow );
@@ -305,7 +306,7 @@ class SfxDragToolBoxControl_Impl : public SfxToolBoxControl
public:
SFX_DECL_TOOLBOX_CONTROL();
SfxDragToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox );
- virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
};
@@ -329,7 +330,7 @@ public:
virtual ~SfxRecentFilesToolBoxControl();
protected:
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
class SfxReloadToolBoxControl_Impl : public SfxToolBoxControl
diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx
index 5509374c25b2..41979ca0dfc6 100644
--- a/include/sfx2/templateabstractview.hxx
+++ b/include/sfx2/templateabstractview.hxx
@@ -83,7 +83,8 @@ public:
TemplateAbstractView(vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
TemplateAbstractView(vcl::Window* pParent);
- virtual ~TemplateAbstractView ();
+ virtual ~TemplateAbstractView();
+ virtual void dispose() SAL_OVERRIDE;
void insertItem (const TemplateItemProperties &rTemplate);
@@ -137,8 +138,8 @@ protected:
sal_uInt16 mnCurRegionId;
OUString maCurRegionName;
- PushButton maAllButton;
- FixedText maFTName;
+ VclPtr<PushButton> maAllButton;
+ VclPtr<FixedText> maFTName;
Link maOpenRegionHdl;
Link maOpenTemplateHdl;
diff --git a/include/sfx2/templatedefaultview.hxx b/include/sfx2/templatedefaultview.hxx
index 005201b364d7..205083554d52 100644
--- a/include/sfx2/templatedefaultview.hxx
+++ b/include/sfx2/templatedefaultview.hxx
@@ -17,7 +17,6 @@ class SFX2_DLLPUBLIC TemplateDefaultView : public TemplateLocalView
{
public:
TemplateDefaultView(Window *pParent);
- virtual ~TemplateDefaultView();
virtual void reload() SAL_OVERRIDE;
protected:
diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx
index 17ba13a0b432..f26792bb0a04 100644
--- a/include/sfx2/templatedlg.hxx
+++ b/include/sfx2/templatedlg.hxx
@@ -50,7 +50,8 @@ public:
SfxTemplateManagerDlg(vcl::Window *parent = NULL);
- virtual ~SfxTemplateManagerDlg ();
+ virtual ~SfxTemplateManagerDlg();
+ virtual void dispose() SAL_OVERRIDE;
void setSaveMode();
@@ -142,16 +143,16 @@ private:
private:
- TabControl *mpTabControl;
+ VclPtr<TabControl> mpTabControl;
- Edit *mpSearchEdit;
- ToolBox *mpViewBar;
- ToolBox *mpActionBar;
- ToolBox *mpTemplateBar;
- TemplateSearchView *mpSearchView;
- TemplateAbstractView *mpCurView;
- TemplateLocalView *mpLocalView;
- TemplateRemoteView *mpRemoteView;
+ VclPtr<Edit> mpSearchEdit;
+ VclPtr<ToolBox> mpViewBar;
+ VclPtr<ToolBox> mpActionBar;
+ VclPtr<ToolBox> mpTemplateBar;
+ VclPtr<TemplateSearchView> mpSearchView;
+ VclPtr<TemplateAbstractView> mpCurView;
+ VclPtr<TemplateLocalView> mpLocalView;
+ VclPtr<TemplateRemoteView> mpRemoteView;
PopupMenu *mpActionMenu;
PopupMenu *mpRepositoryMenu;
PopupMenu *mpTemplateDefaultMenu;
diff --git a/include/sfx2/templateinfodlg.hxx b/include/sfx2/templateinfodlg.hxx
index 9f5d9dfd2965..97a711c58028 100644
--- a/include/sfx2/templateinfodlg.hxx
+++ b/include/sfx2/templateinfodlg.hxx
@@ -27,7 +27,8 @@ public:
SfxTemplateInfoDlg (vcl::Window *pParent = NULL);
- virtual ~SfxTemplateInfoDlg ();
+ virtual ~SfxTemplateInfoDlg();
+ virtual void dispose() SAL_OVERRIDE;
void loadDocument (const OUString &rURL);
@@ -37,11 +38,11 @@ protected:
private:
- PushButton* mpBtnClose;
- VclBox* mpBox;
+ VclPtr<PushButton> mpBtnClose;
+ VclPtr<VclBox> mpBox;
- vcl::Window *mpPreviewView; // gets released when xWindows get destroyed (dont delete in constructor)
- svtools::ODocumentInfoPreview *mpInfoView;
+ VclPtr<vcl::Window> mpPreviewView; // gets released when xWindows get destroyed (dont delete in constructor)
+ VclPtr<svtools::ODocumentInfoPreview> mpInfoView;
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 > m_xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow;
diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx
index 6d2e1d044dcf..123a6f6f13b5 100644
--- a/include/sfx2/templatelocalview.hxx
+++ b/include/sfx2/templatelocalview.hxx
@@ -32,6 +32,7 @@ public:
TemplateLocalView ( vcl::Window* pParent );
virtual ~TemplateLocalView ();
+ virtual void dispose() SAL_OVERRIDE;
// Fill view with template folders thumbnails
virtual void Populate () SAL_OVERRIDE;
diff --git a/include/sfx2/templateremoteview.hxx b/include/sfx2/templateremoteview.hxx
index 6c64e9a6dcaf..ada041dcb85e 100644
--- a/include/sfx2/templateremoteview.hxx
+++ b/include/sfx2/templateremoteview.hxx
@@ -23,8 +23,6 @@ public:
TemplateRemoteView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
- virtual ~TemplateRemoteView ();
-
virtual void showRootRegion () SAL_OVERRIDE;
virtual void showRegion (ThumbnailViewItem *pItem) SAL_OVERRIDE;
diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx
index 280610ff3e14..4e9ada86b359 100644
--- a/include/sfx2/templdlg.hxx
+++ b/include/sfx2/templdlg.hxx
@@ -43,6 +43,7 @@ class SFX2_DLLPUBLIC SfxTemplatePanelControl : public DockingWindow
public:
SfxTemplatePanelControl (SfxBindings* pBindings, vcl::Window* pParentWindow);
virtual ~SfxTemplatePanelControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& _rDCEvt ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
@@ -50,7 +51,7 @@ public:
void FreeResource();
private:
- const std::unique_ptr<SfxTemplateDialog_Impl> pImpl;
+ std::unique_ptr<SfxTemplateDialog_Impl> pImpl;
SfxBindings* mpBindings;
};
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
index 2c9967b601da..0e4a7e0af1cf 100644
--- a/include/sfx2/thumbnailview.hxx
+++ b/include/sfx2/thumbnailview.hxx
@@ -183,6 +183,7 @@ public:
ThumbnailView(vcl::Window* pParent, WinBits nWinStyle = WB_TABSTOP, bool bDisableTransientChildren = false);
virtual ~ThumbnailView();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;
@@ -308,7 +309,7 @@ protected:
ThumbnailValueItemList mItemList;
ThumbnailValueItemList mFilteredItemList; ///< Cache to store the filtered items
ThumbnailValueItemList::iterator mpStartSelRange;
- ScrollBar* mpScrBar;
+ VclPtr<ScrollBar> mpScrBar;
long mnHeaderHeight;
long mnItemWidth;
long mnItemHeight;
diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx
index 9136a5688476..a4c7bbcdb920 100644
--- a/include/sfx2/thumbnailviewitem.hxx
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -138,7 +138,7 @@ protected:
Rectangle maDrawArea;
Link maClickHdl;
bool mbEditTitle;
- VclMultiLineEdit* mpTitleED;
+ VclPtr<VclMultiLineEdit> mpTitleED;
Rectangle maTextEditMaxArea;
};
diff --git a/include/sfx2/titledockwin.hxx b/include/sfx2/titledockwin.hxx
index 61db702d236c..44d8a68c511a 100644
--- a/include/sfx2/titledockwin.hxx
+++ b/include/sfx2/titledockwin.hxx
@@ -24,6 +24,7 @@
#include <sfx2/dockwin.hxx>
#include <vcl/toolbox.hxx>
+#include <vcl/vclptr.hxx>
#include <tools/svborder.hxx>
@@ -43,6 +44,7 @@ namespace sfx2
);
virtual ~TitledDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
/** sets a title to be displayed in the docking window
*/
@@ -77,11 +79,11 @@ namespace sfx2
/** returns the content window, which is to be used as parent window for any content to be displayed
in the docking window.
*/
- vcl::Window& GetContentWindow() { return m_aContentWindow; }
- const vcl::Window& GetContentWindow() const { return m_aContentWindow; }
+ vcl::Window& GetContentWindow() { return *m_aContentWindow.get(); }
+ const vcl::Window& GetContentWindow() const { return *m_aContentWindow.get(); }
- ToolBox& GetToolBox() { return m_aToolbox; }
- const ToolBox& GetToolBox() const { return m_aToolbox; }
+ ToolBox& GetToolBox() { return *m_aToolbox.get(); }
+ const ToolBox& GetToolBox() const { return *m_aToolbox.get(); }
/** Return the border that is painted around the inner window as
decoration.
@@ -126,8 +128,8 @@ namespace sfx2
private:
OUString m_sTitle;
- ToolBox m_aToolbox;
- Window m_aContentWindow;
+ VclPtr<ToolBox> m_aToolbox;
+ VclPtr<Window> m_aContentWindow;
Link m_aEndDockingHdl;
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index c0f38d1fe436..39effbb31caf 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -37,6 +37,8 @@
#include <tools/errcode.hxx>
#include <vcl/jobset.hxx>
#include <o3tl/typed_flags_set.hxx>
+#include <vcl/vclptr.hxx>
+#include <sfx2/tabdlg.hxx>
class SfxBaseController;
class Size;
@@ -51,7 +53,6 @@ class SfxMedium;
class SfxModule;
class SfxViewFrame;
class SfxItemPool;
-class SfxTabPage;
class SfxFrameSetDescriptor;
class Printer;
class SfxPrinter;
@@ -145,7 +146,7 @@ friend class SfxPrinterController;
struct SfxViewShell_Impl* pImp;
SfxViewFrame* pFrame;
SfxShell* pSubShell;
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
bool bNoNewWindow;
protected:
@@ -233,7 +234,7 @@ public:
virtual SfxPrinter* GetPrinter( bool bCreate = false );
virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
virtual bool HasPrintOptionsPage() const;
- virtual SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions );
+ virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions );
static JobSetup GetJobSetup();
Printer* GetActivePrinter() const;
@@ -294,7 +295,7 @@ public:
SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient *pIP );
SAL_DLLPRIVATE void DiscardClients_Impl();
- SAL_DLLPRIVATE SfxPrinter* SetPrinter_Impl( SfxPrinter *pNewPrinter );
+ SAL_DLLPRIVATE SfxPrinter* SetPrinter_Impl( VclPtr<SfxPrinter>& pNewPrinter );
SAL_DLLPRIVATE bool IsShowView_Impl() const;
SAL_DLLPRIVATE bool HandleNotifyEvent_Impl( NotifyEvent& rEvent );
diff --git a/include/svtools/DocumentInfoPreview.hxx b/include/svtools/DocumentInfoPreview.hxx
index e75877588029..9eba310af05c 100644
--- a/include/svtools/DocumentInfoPreview.hxx
+++ b/include/svtools/DocumentInfoPreview.hxx
@@ -43,6 +43,7 @@ public:
ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits);
virtual ~ODocumentInfoPreview();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
@@ -54,8 +55,8 @@ public:
OUString const & rURL);
private:
- ExtMultiLineEdit m_pEditWin;
- std::unique_ptr< SvtDocInfoTable_Impl > m_xInfoTable;
+ VclPtr<ExtMultiLineEdit> m_pEditWin;
+ boost::scoped_ptr< SvtDocInfoTable_Impl > m_xInfoTable;
LanguageTag m_aLanguageTag;
void insertEntry(OUString const & title, OUString const & value);
diff --git a/include/svtools/GraphicExportOptionsDialog.hxx b/include/svtools/GraphicExportOptionsDialog.hxx
index 1982aa1bc679..884e08b3e2a2 100644
--- a/include/svtools/GraphicExportOptionsDialog.hxx
+++ b/include/svtools/GraphicExportOptionsDialog.hxx
@@ -37,9 +37,9 @@
class SVT_DLLPUBLIC GraphicExportOptionsDialog : public ModalDialog
{
private:
- NumericField* mpWidth;
- NumericField* mpHeight;
- ComboBox* mpResolution;
+ VclPtr<NumericField> mpWidth;
+ VclPtr<NumericField> mpHeight;
+ VclPtr<ComboBox> mpResolution;
Size mSize100mm;
double mResolution;
@@ -63,7 +63,7 @@ private:
public:
GraphicExportOptionsDialog( vcl::Window* pWindow, const css::uno::Reference<css::lang::XComponent>& rxSourceDocument );
virtual ~GraphicExportOptionsDialog();
-
+ virtual void dispose() SAL_OVERRIDE;
css::uno::Sequence<css::beans::PropertyValue> getFilterData();
};
diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx
index 5cdad02f1807..a3e4c2caa77b 100644
--- a/include/svtools/PlaceEditDialog.hxx
+++ b/include/svtools/PlaceEditDialog.hxx
@@ -27,16 +27,15 @@
class SVT_DLLPUBLIC PlaceEditDialog : public ModalDialog
{
private :
-
- Edit* m_pEDServerName;
- ListBox* m_pLBServerType;
+ VclPtr<Edit> m_pEDServerName;
+ VclPtr<ListBox> m_pLBServerType;
std::shared_ptr< DetailsContainer > m_xCurrentDetails;
- Edit* m_pEDUsername;
- OKButton* m_pBTOk;
- CancelButton* m_pBTCancel;
+ VclPtr<Edit> m_pEDUsername;
+ VclPtr<OKButton> m_pBTOk;
+ VclPtr<CancelButton> m_pBTCancel;
- PushButton* m_pBTDelete;
+ VclPtr<PushButton> m_pBTDelete;
/** Vector holding the details UI control for each server type.
@@ -51,11 +50,12 @@ public :
PlaceEditDialog( vcl::Window* pParent);
PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Place> &rPlace );
virtual ~PlaceEditDialog();
+ virtual void dispose() SAL_OVERRIDE;
// Returns a place instance with given information
std::shared_ptr<Place> GetPlace();
- OUString GetServerName() { return m_pEDServerName->GetText(); }
+ OUString GetServerName() { return m_pEDServerName->GetText(); }
OUString GetServerUrl();
private:
diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx
index a4997b3113c7..9c17ecea0191 100644
--- a/include/svtools/ServerDetailsControls.hxx
+++ b/include/svtools/ServerDetailsControls.hxx
@@ -25,7 +25,7 @@ class DetailsContainer
{
private:
Link m_aChangeHdl;
- VclFrame* m_pFrame;
+ VclPtr<VclFrame> m_pFrame;
public:
DetailsContainer( VclBuilderContainer* pBuilder, const OString& rFrame );
@@ -57,9 +57,9 @@ class HostDetailsContainer : public DetailsContainer
OUString m_sScheme;
protected:
- Edit* m_pEDHost;
- NumericField* m_pEDPort;
- Edit* m_pEDPath;
+ VclPtr<Edit> m_pEDHost;
+ VclPtr<NumericField> m_pEDPort;
+ VclPtr<Edit> m_pEDPath;
public:
HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, const OUString& sScheme );
@@ -81,7 +81,7 @@ class HostDetailsContainer : public DetailsContainer
class DavDetailsContainer : public HostDetailsContainer
{
private:
- CheckBox* m_pCBDavs;
+ VclPtr<CheckBox> m_pCBDavs;
public:
DavDetailsContainer( VclBuilderContainer* pBuilder );
@@ -99,9 +99,9 @@ class DavDetailsContainer : public HostDetailsContainer
class SmbDetailsContainer : public DetailsContainer
{
private:
- Edit* m_pEDHost;
- Edit* m_pEDShare;
- Edit* m_pEDPath;
+ VclPtr<Edit> m_pEDHost;
+ VclPtr<Edit> m_pEDShare;
+ VclPtr<Edit> m_pEDPath;
public:
SmbDetailsContainer( VclBuilderContainer* pBuilder );
@@ -120,11 +120,11 @@ class CmisDetailsContainer : public DetailsContainer
std::vector< OUString > m_aRepoIds;
OUString m_sRepoId;
- Edit* m_pEDBinding;
- ListBox* m_pLBRepository;
- Button* m_pBTRepoRefresh;
- ListBox* m_pLBServerType;
- Edit* m_pEDPath;
+ VclPtr<Edit> m_pEDBinding;
+ VclPtr<ListBox> m_pLBRepository;
+ VclPtr<Button> m_pBTRepoRefresh;
+ VclPtr<ListBox> m_pLBServerType;
+ VclPtr<Edit> m_pEDPath;
public:
CmisDetailsContainer( VclBuilderContainer* pBuilder );
diff --git a/include/svtools/accessibleruler.hxx b/include/svtools/accessibleruler.hxx
index 0c286ee73cd2..b8811613da1b 100644
--- a/include/svtools/accessibleruler.hxx
+++ b/include/svtools/accessibleruler.hxx
@@ -38,6 +38,7 @@
#include <comphelper/broadcasthelper.hxx>
#include <cppuhelper/implbase5.hxx>
#include <comphelper/servicehelper.hxx>
+#include <vcl/vclptr.hxx>
namespace com { namespace sun { namespace star { namespace awt {
struct Point;
@@ -198,7 +199,7 @@ private:
mxParent;
/// pointer to internal representation
- Ruler* mpRepr;
+ VclPtr<Ruler> mpRepr;
/// client id in the AccessibleEventNotifier queue
sal_uInt32 mnClientId;
diff --git a/include/svtools/addresstemplate.hxx b/include/svtools/addresstemplate.hxx
index d771efb5e473..28bc7edfcc1d 100644
--- a/include/svtools/addresstemplate.hxx
+++ b/include/svtools/addresstemplate.hxx
@@ -48,10 +48,10 @@ namespace svt
{
private:
// Controls
- ComboBox* m_pDatasource;
- PushButton* m_pAdministrateDatasources;
- ComboBox* m_pTable;
- ScrollBar* m_pFieldScroller;
+ VclPtr<ComboBox> m_pDatasource;
+ VclPtr<PushButton> m_pAdministrateDatasources;
+ VclPtr<ComboBox> m_pTable;
+ VclPtr<ScrollBar> m_pFieldScroller;
// string to display for "no selection"
const OUString m_sNoFieldSelection;
@@ -100,6 +100,7 @@ namespace svt
);
virtual ~AddressBookSourceDialog();
+ virtual void dispose() SAL_OVERRIDE;
// to be used if the object was constructed for editing a field mapping only
void getFieldMapping(
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 8ad76b82caab..fb8fc3a63aa1 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -22,6 +22,7 @@
#include <svtools/svtdllapi.h>
#include <vcl/scrbar.hxx>
#include <vcl/ctrl.hxx>
+#include <vcl/vclptr.hxx>
#include <tools/multisel.hxx>
#include <svtools/headbar.hxx>
#include <svtools/transfer.hxx>
@@ -129,9 +130,9 @@ namespace o3tl
class BrowseEvent
{
- vcl::Window* pWin;
- long nRow;
- Rectangle aRect;
+ VclPtr<vcl::Window> pWin;
+ long nRow;
+ Rectangle aRect;
sal_uInt16 nCol;
sal_uInt16 nColId;
@@ -142,10 +143,10 @@ public:
sal_uInt16 nColumn, sal_uInt16 nColumnId,
const Rectangle& rRect );
- vcl::Window* GetWindow() const { return pWin; }
+ vcl::Window* GetWindow() const { return pWin; }
long GetRow() const { return nRow; }
- sal_uInt16 GetColumn() const { return nCol; }
- sal_uInt16 GetColumnId() const { return nColId; }
+ sal_uInt16 GetColumn() const { return nCol; }
+ sal_uInt16 GetColumnId() const { return nColId; }
const Rectangle& GetRect() const { return aRect; }
};
@@ -218,9 +219,9 @@ public:
static const sal_uInt16 HandleColumnId = 0;
private:
- vcl::Window* pDataWin; // window to display data rows
- ScrollBar* pVScroll; // vertical scrollbar
- ScrollBar aHScroll; // horizontal scrollbar
+ VclPtr<vcl::Window> pDataWin; // window to display data rows
+ VclPtr<ScrollBar> pVScroll; // vertical scrollbar
+ VclPtr<ScrollBar> aHScroll; // horizontal scrollbar
long nDataRowHeight; // height of a single data-row
sal_uInt16 nTitleLines; // number of lines in title row
@@ -391,7 +392,7 @@ protected:
void DoHideCursor( const char *pWhoLog );
short GetCursorHideCount() const;
- virtual BrowserHeader* CreateHeaderBar( BrowseBox* pParent );
+ virtual VclPtr<BrowserHeader> CreateHeaderBar( BrowseBox* pParent );
// HACK(virtual create is not called in Ctor)
void SetHeaderBar( BrowserHeader* );
@@ -423,7 +424,8 @@ public:
BrowserMode nMode = BrowserMode::NONE );
BrowseBox( vcl::Window* pParent, const ResId& rId,
BrowserMode nMode = BrowserMode::NONE );
- virtual ~BrowseBox();
+ virtual ~BrowseBox();
+ virtual void dispose() SAL_OVERRIDE;
// override inherited handler
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/include/svtools/brwhead.hxx b/include/svtools/brwhead.hxx
index e60949100731..c82ccace0601 100644
--- a/include/svtools/brwhead.hxx
+++ b/include/svtools/brwhead.hxx
@@ -29,8 +29,11 @@ class BrowseBox;
class SVT_DLLPUBLIC BrowserHeader: public HeaderBar
{
- BrowseBox* _pBrowseBox;
+ VclPtr<BrowseBox> _pBrowseBox;
+public:
+ virtual ~BrowserHeader();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
virtual void Select() SAL_OVERRIDE;
diff --git a/include/svtools/calendar.hxx b/include/svtools/calendar.hxx
index e970842480a7..48173a37003c 100644
--- a/include/svtools/calendar.hxx
+++ b/include/svtools/calendar.hxx
@@ -258,7 +258,8 @@ protected:
public:
Calendar( vcl::Window* pParent, WinBits nWinStyle = 0 );
- virtual ~Calendar();
+ virtual ~Calendar();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -400,11 +401,11 @@ method in CalendarField and create an own calendar there ourselves.
class SVT_DLLPUBLIC CalendarField : public DateField
{
private:
- ImplCFieldFloatWin* mpFloatWin;
- Calendar* mpCalendar;
+ VclPtr<ImplCFieldFloatWin> mpFloatWin;
+ VclPtr<Calendar> mpCalendar;
WinBits mnCalendarStyle;
- PushButton* mpTodayBtn;
- PushButton* mpNoneBtn;
+ VclPtr<PushButton> mpTodayBtn;
+ VclPtr<PushButton> mpNoneBtn;
Date maDefaultDate;
bool mbToday;
bool mbNone;
@@ -416,12 +417,13 @@ private:
public:
CalendarField( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~CalendarField();
+ virtual ~CalendarField();
+ virtual void dispose() SAL_OVERRIDE;
void Select();
virtual bool ShowDropDown( bool bShow ) SAL_OVERRIDE;
- Calendar* CreateCalendar( vcl::Window* pParent );
+ VclPtr<Calendar> CreateCalendar( vcl::Window* pParent );
Calendar* GetCalendar();
void SetDefaultDate( const Date& rDate ) { maDefaultDate = rDate; }
diff --git a/include/svtools/colrdlg.hxx b/include/svtools/colrdlg.hxx
index 1919ba0666c4..4fe31bfa1d8a 100644
--- a/include/svtools/colrdlg.hxx
+++ b/include/svtools/colrdlg.hxx
@@ -21,7 +21,7 @@
#define INCLUDED_SVTOOLS_COLRDLG_HXX
#include <svtools/svtdllapi.h>
-
+#include <vcl/vclptr.hxx>
#include <tools/color.hxx>
namespace vcl { class Window; }
@@ -50,9 +50,9 @@ public:
short Execute();
private:
- vcl::Window* mpParent;
- Color maColor;
- sal_Int16 meMode;
+ VclPtr<vcl::Window> mpParent;
+ Color maColor;
+ sal_Int16 meMode;
};
#endif // INCLUDED_SVTOOLS_COLRDLG_HXX
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index fe29ee120083..a38f00940fb2 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -155,6 +155,7 @@ public:
WinBits nWinStyle = WB_BORDER );
ColorListBox( vcl::Window* pParent, const ResId& rResId );
virtual ~ColorListBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
@@ -287,7 +288,7 @@ class SVT_DLLPUBLIC LineListBox : public ListBox
long m_nWidth;
OUString m_sNone;
- VirtualDevice aVirDev;
+ ScopedVclPtr<VirtualDevice> aVirDev;
Size aTxtSize;
Color aColor;
Color maPaintCol;
@@ -311,6 +312,7 @@ public:
LineListBox( vcl::Window* pParent, WinBits nWinStyle = WB_BORDER );
virtual ~LineListBox();
+ virtual void dispose() SAL_OVERRIDE;
/** Set the width in Twips */
void SetWidth( long nWidth );
@@ -408,6 +410,7 @@ public:
FontNameBox( vcl::Window* pParent,
WinBits nWinStyle = WB_SORT );
virtual ~FontNameBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
@@ -433,7 +436,6 @@ private:
using ComboBox::SetText;
public:
FontStyleBox( vcl::Window* pParent, WinBits nBits );
- virtual ~FontStyleBox();
virtual void Select() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
@@ -477,7 +479,6 @@ protected:
public:
FontSizeBox( vcl::Window* pParent, WinBits nWinStyle = 0 );
- virtual ~FontSizeBox();
void Reformat() SAL_OVERRIDE;
void Modify() SAL_OVERRIDE;
diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx
index 5ff6a2df5510..c6be1c49acf7 100644
--- a/include/svtools/ctrltool.hxx
+++ b/include/svtools/ctrltool.hxx
@@ -147,8 +147,8 @@ private:
OUString maBlack;
OUString maBlackItalic;
sal_IntPtr* mpSizeAry;
- OutputDevice* mpDev;
- OutputDevice* mpDev2;
+ VclPtr<OutputDevice> mpDev;
+ VclPtr<OutputDevice> mpDev2;
boost::ptr_vector<ImplFontListNameInfo> maEntries;
SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const;
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 43320ef78185..dbc921b58d80 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -85,7 +85,7 @@ namespace svt
friend class EditBrowseBox;
protected:
- Control* pWindow;
+ VclPtr<Control> pWindow;
bool bSuspended; // <true> if the window is hidden and disabled
public:
@@ -279,13 +279,14 @@ namespace svt
class SVT_DLLPUBLIC CheckBoxControl : public Control
{
- CheckBox* pBox;
+ VclPtr<CheckBox> pBox;
Rectangle aFocusRect;
Link m_aClickLink,m_aModifyLink;
public:
CheckBoxControl(vcl::Window* pParent, WinBits nWinStyle = 0);
virtual ~CheckBoxControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual bool PreNotify(NotifyEvent& rEvt) SAL_OVERRIDE;
@@ -479,7 +480,7 @@ namespace svt
aOldController;
ImplSVEvent * nStartEvent, * nEndEvent, * nCellModifiedEvent; // event ids
- vcl::Window* m_pFocusWhileRequest;
+ VclPtr<vcl::Window> m_pFocusWhileRequest;
// In ActivateCell, we grab the focus asynchronously, but if between requesting activation
// and the asynchornous event the focus has changed, we won't grab it for ourself.
@@ -491,14 +492,14 @@ namespace svt
mutable bool bPaintStatus : 1; // paint a status (image) in the handle column
bool bActiveBeforeTracking;
- CheckBoxControl* pCheckBoxPaint;
+ VclPtr<CheckBoxControl> pCheckBoxPaint;
EditBrowseBoxFlags m_nBrowserFlags;
ImageList m_aStatusImages;
::std::unique_ptr< EditBrowseBoxImpl> m_aImpl;
protected:
- BrowserHeader* pHeader;
+ VclPtr<BrowserHeader> pHeader;
bool isGetCellFocusPending() const { return nStartEvent != 0; }
void cancelGetCellFocus() { if (nStartEvent) Application::RemoveUserEvent(nStartEvent); nStartEvent = 0; }
@@ -509,10 +510,10 @@ namespace svt
protected:
BrowserHeader* GetHeaderBar() const {return pHeader;}
- virtual BrowserHeader* CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
+ virtual VclPtr<BrowserHeader> CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
// if you want to have an own header ...
- virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent);
+ virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent);
virtual void ColumnMoved(sal_uInt16 nId) SAL_OVERRIDE;
virtual void ColumnResized(sal_uInt16 nColId) SAL_OVERRIDE;
@@ -598,6 +599,7 @@ namespace svt
EditBrowseBox(vcl::Window* pParent, EditBrowseBoxFlags nBrowserFlags = EditBrowseBoxFlags::NONE, WinBits nBits = WB_TABSTOP, BrowserMode nMode = BrowserMode::NONE );
EditBrowseBox(vcl::Window* pParent, const ResId& rId, EditBrowseBoxFlags nBrowserFlags = EditBrowseBoxFlags::NONE, BrowserMode nMode = BrowserMode::NONE );
virtual ~EditBrowseBox();
+ virtual void dispose() SAL_OVERRIDE;
bool IsEditing() const {return aController.Is();}
void InvalidateStatusCell(long nRow) {RowModified(nRow, 0);}
diff --git a/include/svtools/editsyntaxhighlighter.hxx b/include/svtools/editsyntaxhighlighter.hxx
index 5099750026b2..be6da6e118e2 100644
--- a/include/svtools/editsyntaxhighlighter.hxx
+++ b/include/svtools/editsyntaxhighlighter.hxx
@@ -40,7 +40,6 @@ class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public MultiLineEdit
public:
MultiLineEditSyntaxHighlight( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = HIGHLIGHT_SQL);
- virtual ~MultiLineEditSyntaxHighlight();
virtual void UpdateData() SAL_OVERRIDE;
virtual void SetText(const OUString& rNewText) SAL_OVERRIDE;
diff --git a/include/svtools/filectrl.hxx b/include/svtools/filectrl.hxx
index 53486c0e4d35..20506dbd7b51 100644
--- a/include/svtools/filectrl.hxx
+++ b/include/svtools/filectrl.hxx
@@ -54,8 +54,8 @@ namespace o3tl
class SVT_DLLPUBLIC FileControl : public vcl::Window
{
private:
- Edit maEdit;
- PushButton maButton;
+ VclPtr<Edit> maEdit;
+ VclPtr<PushButton> maButton;
OUString maButtonText;
bool mbOpenDlg;
@@ -77,10 +77,11 @@ protected:
public:
FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode = FileControlMode::NONE );
- virtual ~FileControl();
+ virtual ~FileControl();
+ virtual void dispose() SAL_OVERRIDE;
- Edit& GetEdit() { return maEdit; }
- PushButton& GetButton() { return maButton; }
+ Edit& GetEdit() { return *maEdit.get(); }
+ PushButton& GetButton() { return *maButton.get(); }
void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
@@ -89,13 +90,13 @@ public:
void SetText( const OUString& rStr ) SAL_OVERRIDE;
OUString GetText() const SAL_OVERRIDE;
- OUString GetSelectedText() const { return maEdit.GetSelected(); }
+ OUString GetSelectedText() const { return maEdit->GetSelected(); }
- void SetSelection( const Selection& rSelection ) { maEdit.SetSelection( rSelection ); }
- Selection GetSelection() const { return maEdit.GetSelection(); }
+ void SetSelection( const Selection& rSelection ) { maEdit->SetSelection( rSelection ); }
+ Selection GetSelection() const { return maEdit->GetSelection(); }
- void SetReadOnly( bool bReadOnly = true ) { maEdit.SetReadOnly( bReadOnly ); }
- bool IsReadOnly() const { return maEdit.IsReadOnly(); }
+ void SetReadOnly( bool bReadOnly = true ) { maEdit->SetReadOnly( bReadOnly ); }
+ bool IsReadOnly() const { return maEdit->IsReadOnly(); }
//use this to manipulate the dialog bevore executing it:
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index 27384412655a..690efd1aa076 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -76,6 +76,7 @@ protected:
public:
SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection );
virtual ~SvtFileView();
+ virtual void dispose() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
@@ -205,10 +206,12 @@ enum QueryDeleteResult_Impl
class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public MessageDialog
{
private:
- PushButton* m_pAllButton;
+ VclPtr<PushButton> m_pAllButton;
public:
QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& rName);
+ virtual ~QueryDeleteDlg_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void EnableAllButton() { m_pAllButton->Enable(true); }
};
diff --git a/include/svtools/fmtfield.hxx b/include/svtools/fmtfield.hxx
index 9e8eaf7fe4cb..562cf5ca14f5 100644
--- a/include/svtools/fmtfield.hxx
+++ b/include/svtools/fmtfield.hxx
@@ -95,7 +95,6 @@ protected:
public:
FormattedField(vcl::Window* pParent, WinBits nStyle = 0, SvNumberFormatter* pInitialFormatter = NULL, sal_Int32 nFormatKey = 0);
- virtual ~FormattedField();
// Min-/Max-management
bool HasMinValue() const { return m_bHasMin; }
@@ -270,6 +269,7 @@ public:
}
virtual ~DoubleNumericField();
+ virtual void dispose() SAL_OVERRIDE;
protected:
virtual bool CheckText(const OUString& sText) const SAL_OVERRIDE;
diff --git a/include/svtools/generictoolboxcontroller.hxx b/include/svtools/generictoolboxcontroller.hxx
index 15b542cc3458..d5bf7d7fc51d 100644
--- a/include/svtools/generictoolboxcontroller.hxx
+++ b/include/svtools/generictoolboxcontroller.hxx
@@ -50,8 +50,8 @@ class SVT_DLLPUBLIC GenericToolboxController : public svt::ToolboxController
DECL_STATIC_LINK( GenericToolboxController, ExecuteHdl_Impl, ExecuteInfo* );
private:
- ToolBox* m_pToolbox;
- sal_uInt16 m_nID;
+ VclPtr<ToolBox> m_pToolbox;
+ sal_uInt16 m_nID;
};
}
diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx
index f0445ff96405..072516f3d5ce 100644
--- a/include/svtools/genericunodialog.hxx
+++ b/include/svtools/genericunodialog.hxx
@@ -38,6 +38,7 @@
#include <comphelper/propertycontainer.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
class Dialog;
namespace vcl { class Window; }
@@ -73,7 +74,7 @@ namespace svt
::osl::Mutex m_aExecutionMutex; /// access safety for execute/cancel
protected:
- Dialog* m_pDialog; /// the dialog to execute
+ VclPtr<Dialog> m_pDialog; /// the dialog to execute
bool m_bExecuting : 1; /// we're currently executing the dialog
bool m_bCanceled : 1; /// endDialog was called while we were executing
bool m_bTitleAmbiguous : 1; /// m_sTitle has not been set yet
@@ -124,7 +125,7 @@ namespace svt
but the application-wide solar mutex is (to guard the not thread-safe ctor of the dialog).
@param pParent the parent window for the new dialog
*/
- virtual Dialog* createDialog(vcl::Window* _pParent) = 0;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) = 0;
/// called to destroy the dialog used. the default implementation just deletes m_pDialog and resets it to NULL
virtual void destroyDialog();
diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx
index acdb018a59ae..27fd4e8f7865 100644
--- a/include/svtools/headbar.hxx
+++ b/include/svtools/headbar.hxx
@@ -288,6 +288,7 @@ private:
public:
HeaderBar( vcl::Window* pParent, WinBits nWinBits = WB_STDHEADERBAR );
virtual ~HeaderBar();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/hyperlabel.hxx b/include/svtools/hyperlabel.hxx
index eacfe4896372..cdda74067bab 100644
--- a/include/svtools/hyperlabel.hxx
+++ b/include/svtools/hyperlabel.hxx
@@ -32,7 +32,7 @@ namespace svt
{
- class HyperLabelImpl;
+ class HyperLabelImpl;
class HyperLabel : public FixedText
{
@@ -54,6 +54,7 @@ namespace svt
public:
HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle = 0 );
virtual ~HyperLabel( );
+ virtual void dispose() SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index 7d2d4f5ccbee..35a0893ec09f 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -63,6 +63,7 @@ public:
SvtURLBox( vcl::Window* pParent, WinBits _nStyle, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true );
SvtURLBox( vcl::Window* pParent, const ResId& _rResId, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true );
virtual ~SvtURLBox();
+ virtual void dispose() SAL_OVERRIDE;
void SetBaseURL( const OUString& rURL );
const OUString& GetBaseURL() const { return aBaseURL; }
diff --git a/include/svtools/ivctrl.hxx b/include/svtools/ivctrl.hxx
index c48803c88ee9..d862e7d0b31c 100644
--- a/include/svtools/ivctrl.hxx
+++ b/include/svtools/ivctrl.hxx
@@ -268,6 +268,7 @@ public:
SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle = WB_ICON | WB_BORDER );
virtual ~SvtIconChoiceCtrl();
+ virtual void dispose() SAL_OVERRIDE;
void SetStyle( WinBits nWinStyle );
WinBits GetStyle() const;
diff --git a/include/svtools/popupwindowcontroller.hxx b/include/svtools/popupwindowcontroller.hxx
index d505e2f04dc2..a455670b8c95 100644
--- a/include/svtools/popupwindowcontroller.hxx
+++ b/include/svtools/popupwindowcontroller.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <svtools/toolboxcontroller.hxx>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
@@ -40,7 +41,7 @@ public:
const OUString& aCommandURL );
virtual ~PopupWindowController();
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) = 0;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) = 0;
// XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/include/svtools/prnsetup.hxx b/include/svtools/prnsetup.hxx
index b7ed0fd8f3dc..62d430a053c3 100644
--- a/include/svtools/prnsetup.hxx
+++ b/include/svtools/prnsetup.hxx
@@ -40,16 +40,16 @@ class QueueInfo;
class SVT_DLLPUBLIC PrinterSetupDialog : public ModalDialog
{
private:
- ListBox* m_pLbName;
- PushButton* m_pBtnProperties;
- PushButton* m_pBtnOptions;
- FixedText* m_pFiStatus;
- FixedText* m_pFiType;
- FixedText* m_pFiLocation;
- FixedText* m_pFiComment;
- AutoTimer maStatusTimer;
- Printer* mpPrinter;
- Printer* mpTempPrinter;
+ VclPtr<ListBox> m_pLbName;
+ VclPtr<PushButton> m_pBtnProperties;
+ VclPtr<PushButton> m_pBtnOptions;
+ VclPtr<FixedText> m_pFiStatus;
+ VclPtr<FixedText> m_pFiType;
+ VclPtr<FixedText> m_pFiLocation;
+ VclPtr<FixedText> m_pFiComment;
+ AutoTimer maStatusTimer;
+ VclPtr<Printer> mpPrinter;
+ VclPtr<Printer> mpTempPrinter;
SVT_DLLPRIVATE void ImplSetInfo();
@@ -60,7 +60,8 @@ private:
public:
PrinterSetupDialog( vcl::Window* pWindow );
- virtual ~PrinterSetupDialog();
+ virtual ~PrinterSetupDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetPrinter( Printer* pNewPrinter ) { mpPrinter = pNewPrinter; }
Printer* GetPrinter() const { return mpPrinter; }
diff --git a/include/svtools/roadmapwizard.hxx b/include/svtools/roadmapwizard.hxx
index 578ba284adb8..237d0f17d78b 100644
--- a/include/svtools/roadmapwizard.hxx
+++ b/include/svtools/roadmapwizard.hxx
@@ -36,7 +36,7 @@ namespace svt
public:
typedef sal_Int16 PathId;
typedef ::std::vector< WizardTypes::WizardState > WizardPath;
- typedef TabPage* (* RoadmapPageFactory)( RoadmapWizard& );
+ typedef VclPtr<TabPage> (* RoadmapPageFactory)( RoadmapWizard& );
};
@@ -77,6 +77,7 @@ namespace svt
sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP
);
virtual ~RoadmapWizard( );
+ virtual void dispose() SAL_OVERRIDE;
void SetRoadmapHelpId( const OString& _rId );
@@ -89,7 +90,7 @@ namespace svt
virtual bool canAdvance() const SAL_OVERRIDE;
virtual void updateTravelUI() SAL_OVERRIDE;
-protected:
+ protected:
/** declares a valid path in the wizard
The very first path which is declared is automatically activated.
@@ -207,7 +208,7 @@ protected:
This member is inherited from OWizardMachine, and default-implemented in this class
for all states which have been described using describeState.
*/
- virtual TabPage* createPage( WizardState _nState ) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage( WizardState _nState ) SAL_OVERRIDE;
/** asks for a new label of the wizard page
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
index 76a7bc57889d..0f9f68359533 100644
--- a/include/svtools/ruler.hxx
+++ b/include/svtools/ruler.hxx
@@ -606,7 +606,7 @@ class ImplRulerData;
class SVT_DLLPUBLIC Ruler : public vcl::Window
{
private:
- VirtualDevice maVirDev;
+ ScopedVclPtr<VirtualDevice> maVirDev;
MapMode maMapMode;
long mnBorderOff;
long mnWinOff;
@@ -708,6 +708,7 @@ protected:
public:
Ruler( vcl::Window* pParent, WinBits nWinStyle = WB_STDRULER );
virtual ~Ruler();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/scrwin.hxx b/include/svtools/scrwin.hxx
index 4e034e69f82d..2396725af54c 100644
--- a/include/svtools/scrwin.hxx
+++ b/include/svtools/scrwin.hxx
@@ -23,6 +23,7 @@
#include <svtools/svtdllapi.h>
#include <vcl/scrbar.hxx>
#include <o3tl/typed_flags_set.hxx>
+#include <vcl/vclptr.hxx>
class DataChangedEvent;
@@ -54,9 +55,9 @@ private:
long nLinePixH; // size of a line/column (pixel)
long nColumnPixW;
- ScrollBar aVScroll; // the scrollbars
- ScrollBar aHScroll;
- ScrollBarBox aCornerWin; // window in the bottom right corner
+ VclPtr<ScrollBar> aVScroll; // the scrollbars
+ VclPtr<ScrollBar> aHScroll;
+ VclPtr<ScrollBarBox> aCornerWin; // window in the bottom right corner
bool bScrolling:1, // user controlled scrolling
bHandleDragging:1, // scroll window while dragging
bHCenter:1,
@@ -69,6 +70,8 @@ private:
public:
ScrollableWindow( vcl::Window* pParent, WinBits nBits = 0,
ScrollableWindowFlags = ScrollableWindowFlags::DEFAULT );
+ virtual ~ScrollableWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/simptabl.hxx b/include/svtools/simptabl.hxx
index e3fc9f9cb929..07eb53d48e59 100644
--- a/include/svtools/simptabl.hxx
+++ b/include/svtools/simptabl.hxx
@@ -29,13 +29,15 @@ class SvSimpleTable;
class SVT_DLLPUBLIC SvSimpleTableContainer : public Control
{
private:
- SvSimpleTable* m_pTable;
+ VclPtr<SvSimpleTable> m_pTable;
protected:
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
public:
SvSimpleTableContainer( vcl::Window* pParent, WinBits nBits = WB_BORDER );
+ virtual ~SvSimpleTableContainer();
+ virtual void dispose() SAL_OVERRIDE;
void SetTable(SvSimpleTable* pTable);
@@ -53,7 +55,7 @@ private:
Link aHeaderBarDblClickLink;
Link aCommandLink;
CommandEvent aCEvt;
- HeaderBar aHeaderBar;
+ VclPtr<HeaderBar> aHeaderBar;
long nOldPos;
sal_uInt16 nHeaderItemId;
bool bPaintFlag;
@@ -89,6 +91,7 @@ public:
SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
virtual ~SvSimpleTable();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateViewSize();
@@ -126,9 +129,9 @@ public:
void SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; }
const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
- void SetHeaderBarHelpId(const OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
+ void SetHeaderBarHelpId(const OString& rHelpId) { aHeaderBar->SetHelpId(rHelpId); }
- HeaderBar& GetTheHeaderBar() {return aHeaderBar;}
+ HeaderBar& GetTheHeaderBar() { return *aHeaderBar.get(); }
};
diff --git a/include/svtools/svmedit.hxx b/include/svtools/svmedit.hxx
index 33c2b90fe6f2..0c322f267e04 100644
--- a/include/svtools/svmedit.hxx
+++ b/include/svtools/svmedit.hxx
@@ -27,7 +27,6 @@
#include <svtools/colorcfg.hxx>
-
class SVT_DLLPUBLIC MultiLineEdit : public VclMultiLineEdit
{
public:
diff --git a/include/svtools/svmedit2.hxx b/include/svtools/svmedit2.hxx
index 2e17023629c9..d6c30d26872b 100644
--- a/include/svtools/svmedit2.hxx
+++ b/include/svtools/svmedit2.hxx
@@ -28,7 +28,6 @@ class SVT_DLLPUBLIC ExtMultiLineEdit : public MultiLineEdit
{
public:
ExtMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
- virtual ~ExtMultiLineEdit();
// methods of TextView
void InsertText( const OUString& rNew, bool bSelect = false );
@@ -37,7 +36,7 @@ public:
// methods of TextEngine
void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
void SetLeftMargin( sal_uInt16 nLeftMargin );
- sal_uLong GetParagraphCount() const;
+ sal_uLong GetParagraphCount() const;
};
#endif
diff --git a/include/svtools/svtabbx.hxx b/include/svtools/svtabbx.hxx
index dcded33f9c90..5d1d9e1320b9 100644
--- a/include/svtools/svtabbx.hxx
+++ b/include/svtools/svtabbx.hxx
@@ -65,8 +65,9 @@ protected:
public:
SvTabListBox( vcl::Window* pParent, WinBits = WB_BORDER );
virtual ~SvTabListBox();
+ virtual void dispose() SAL_OVERRIDE;
void SetTabs(const long* pTabs, MapUnit = MAP_APPFONT);
- sal_uInt16 TabCount() const { return (sal_uInt16)nTabCount; }
+ sal_uInt16 TabCount() const { return (sal_uInt16)nTabCount; }
using SvTreeListBox::GetTab;
long GetTab( sal_uInt16 nTab ) const;
void SetTab( sal_uInt16 nTab, long nValue, MapUnit = MAP_APPFONT );
@@ -139,6 +140,7 @@ private:
public:
SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits );
virtual ~SvHeaderTabListBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& ) SAL_OVERRIDE;
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
index 7e5dc03e90ad..fc44b0f75d3b 100644
--- a/include/svtools/tabbar.hxx
+++ b/include/svtools/tabbar.hxx
@@ -315,6 +315,8 @@ class SVT_DLLPUBLIC TabBar : public vcl::Window
private:
std::unique_ptr<TabBar_Impl> mpImpl;
+ ImplTabBarList* mpItemList;
+
OUString maEditText;
Color maSelColor;
Color maSelTextColor;
@@ -384,6 +386,7 @@ public:
TabBar( vcl::Window* pParent, WinBits nWinStyle = WB_STDTABBAR );
virtual ~TabBar();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx
index 2b20a31c5f2f..7c679ac5bdb3 100644
--- a/include/svtools/toolbarmenu.hxx
+++ b/include/svtools/toolbarmenu.hxx
@@ -51,6 +51,7 @@ public:
WinBits nBits );
virtual ~ToolbarMenu();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -68,7 +69,7 @@ public:
void appendSeparator();
/** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */
- ValueSet* createEmptyValueSetControl();
+ VclPtr<ValueSet> createEmptyValueSetControl();
void checkEntry( int nEntryId, bool bCheck = true );
diff --git a/include/svtools/toolpanel/drawerlayouter.hxx b/include/svtools/toolpanel/drawerlayouter.hxx
index cba7f020e735..e35d0dd211c9 100644
--- a/include/svtools/toolpanel/drawerlayouter.hxx
+++ b/include/svtools/toolpanel/drawerlayouter.hxx
@@ -29,12 +29,8 @@
namespace svt
{
-
-
class ToolPanelViewShell;
class ToolPanelDrawer;
- typedef std::shared_ptr< ToolPanelDrawer > PToolPanelDrawer;
-
//= ToolPanelDrawer
@@ -79,7 +75,7 @@ namespace svt
private:
vcl::Window& m_rParentWindow;
IToolPanelDeck& m_rPanelDeck;
- ::std::vector< PToolPanelDrawer > m_aDrawers;
+ ::std::vector< VclPtr<ToolPanelDrawer> > m_aDrawers;
::boost::optional< size_t > m_aLastKnownActivePanel;
};
diff --git a/include/svtools/toolpanel/paneltabbar.hxx b/include/svtools/toolpanel/paneltabbar.hxx
index 18e4d1ea1197..3e20b2dede70 100644
--- a/include/svtools/toolpanel/paneltabbar.hxx
+++ b/include/svtools/toolpanel/paneltabbar.hxx
@@ -52,6 +52,7 @@ namespace svt
public:
PanelTabBar( vcl::Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
virtual ~PanelTabBar();
+ virtual void dispose() SAL_OVERRIDE;
// attribute access
TabItemContent GetTabItemContent() const;
diff --git a/include/svtools/toolpanel/toolpaneldeck.hxx b/include/svtools/toolpanel/toolpaneldeck.hxx
index d9c06ced6771..211c099deb93 100644
--- a/include/svtools/toolpanel/toolpaneldeck.hxx
+++ b/include/svtools/toolpanel/toolpaneldeck.hxx
@@ -138,6 +138,7 @@ namespace svt
public:
ToolPanelDeck( vcl::Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL );
virtual ~ToolPanelDeck();
+ virtual void dispose() SAL_OVERRIDE;
// attributes
PDeckLayouter GetLayouter() const;
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index 3f74b4c7fa37..7d55c17ad403 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -373,6 +373,7 @@ public:
SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 );
SvTreeListBox( vcl::Window* pParent, const ResId& rResId );
virtual ~SvTreeListBox();
+ virtual void dispose() SAL_OVERRIDE;
SvTreeList* GetModel() const
{
@@ -385,11 +386,11 @@ public:
sal_uLong GetEntryCount() const
{
- return pModel->GetEntryCount();
+ return pModel ? pModel->GetEntryCount() : 0;
}
SvTreeListEntry* First() const
{
- return pModel->First();
+ return pModel ? pModel->First() : NULL;
}
SvTreeListEntry* Next( SvTreeListEntry* pEntry, sal_uInt16* pDepth = 0 ) const
{
@@ -401,7 +402,7 @@ public:
}
SvTreeListEntry* Last() const
{
- return pModel->Last();
+ return pModel ? pModel->Last() : NULL;
}
SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
@@ -820,7 +821,7 @@ public:
struct SvLBoxDDInfo
{
Application* pApp;
- SvTreeListBox* pSource;
+ VclPtr<SvTreeListBox> pSource;
SvTreeListEntry* pDDStartEntry;
// Relative position in the Entry at DragBeginn (IconView)
long nMouseRelX,nMouseRelY;
@@ -833,7 +834,7 @@ class SvInplaceEdit2
Accelerator aAccReturn;
Accelerator aAccEscape;
Idle aIdle;
- Edit* pEdit;
+ VclPtr<Edit> pEdit;
bool bCanceled;
bool bAlreadyInCallBack;
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index baebae42db8c..a6a8e5e47ffc 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -197,11 +197,11 @@ class SVT_DLLPUBLIC ValueSet : public Control
{
private:
- VirtualDevice maVirDev;
+ ScopedVclPtr<VirtualDevice> maVirDev;
Timer maTimer;
ValueItemList mItemList;
ValueSetItemPtr mpNoneItem;
- std::unique_ptr<ScrollBar> mxScrollBar;
+ VclPtr<ScrollBar> mxScrollBar;
Rectangle maNoneItemRect;
Rectangle maItemListRect;
long mnItemWidth;
@@ -284,7 +284,8 @@ protected:
public:
ValueSet( vcl::Window* pParent, WinBits nWinStyle, bool bDisableTransientChildren = false );
ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
- virtual ~ValueSet();
+ virtual ~ValueSet();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/wizardmachine.hxx b/include/svtools/wizardmachine.hxx
index b5cd150dee07..6865c4e2e74a 100644
--- a/include/svtools/wizardmachine.hxx
+++ b/include/svtools/wizardmachine.hxx
@@ -100,6 +100,7 @@ namespace svt
*/
OWizardPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription);
virtual ~OWizardPage();
+ virtual void dispose() SAL_OVERRIDE;
// IWizardPageController overridables
virtual void initializePage() SAL_OVERRIDE;
@@ -154,15 +155,14 @@ namespace svt
// So use the travelXXX methods if you need to travel
protected:
- OKButton* m_pFinish;
- CancelButton* m_pCancel;
- PushButton* m_pNextPage;
- PushButton* m_pPrevPage;
- HelpButton* m_pHelp;
+ VclPtr<OKButton> m_pFinish;
+ VclPtr<CancelButton> m_pCancel;
+ VclPtr<PushButton> m_pNextPage;
+ VclPtr<PushButton> m_pPrevPage;
+ VclPtr<HelpButton> m_pHelp;
private:
- WizardMachineImplData*
- m_pImpl;
+ WizardMachineImplData* m_pImpl;
// hold members in this structure to allow keeping compatible when members are added
SVT_DLLPRIVATE void addButtons(vcl::Window* _pParent, sal_uInt32 _nButtonFlags);
@@ -175,6 +175,7 @@ namespace svt
OWizardMachine(vcl::Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags );
OWizardMachine(vcl::Window* _pParent, sal_uInt32 _nButtonFlags );
virtual ~OWizardMachine();
+ virtual void dispose() SAL_OVERRIDE;
/// enable (or disable) buttons
void enableButtons(sal_uInt32 _nWizardButtonFlags, bool _bEnable);
@@ -205,7 +206,7 @@ namespace svt
// our own overridables
/// to override to create new pages
- virtual TabPage* createPage(WizardState _nState) = 0;
+ virtual VclPtr<TabPage> createPage(WizardState _nState) = 0;
/// will be called when a new page is about to be displayed
virtual void enterState(WizardState _nState);
diff --git a/include/svtools/wizdlg.hxx b/include/svtools/wizdlg.hxx
index a8c7e4e332f7..00f9d95b9db7 100644
--- a/include/svtools/wizdlg.hxx
+++ b/include/svtools/wizdlg.hxx
@@ -202,10 +202,10 @@ private:
Size maPageSize;
ImplWizPageData* mpFirstPage;
ImplWizButtonData* mpFirstBtn;
- TabPage* mpCurTabPage;
- PushButton* mpPrevBtn;
- PushButton* mpNextBtn;
- vcl::Window* mpViewWindow;
+ VclPtr<TabPage> mpCurTabPage;
+ VclPtr<PushButton> mpPrevBtn;
+ VclPtr<PushButton> mpNextBtn;
+ VclPtr<vcl::Window> mpViewWindow;
sal_uInt16 mnCurLevel;
WindowAlign meViewAlign;
Link maActivateHdl;
@@ -242,6 +242,7 @@ public:
WizardDialog( vcl::Window* pParent, WinBits nStyle = WB_STDTABDIALOG );
WizardDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription );
virtual ~WizardDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
@@ -272,7 +273,7 @@ public:
PushButton* GetNextButton() const { return mpNextBtn; }
void SetViewWindow( vcl::Window* pWindow ) { mpViewWindow = pWindow; }
- vcl::Window* GetViewWindow() const { return mpViewWindow; }
+ vcl::Window* GetViewWindow() const { return mpViewWindow; }
void SetViewAlign( WindowAlign eAlign ) { meViewAlign = eAlign; }
WindowAlign GetViewAlign() const { return meViewAlign; }
diff --git a/include/svx/AccessibleShapeTreeInfo.hxx b/include/svx/AccessibleShapeTreeInfo.hxx
index 65aae3bd00eb..aca3221ffc52 100644
--- a/include/svx/AccessibleShapeTreeInfo.hxx
+++ b/include/svx/AccessibleShapeTreeInfo.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/frame/XController.hpp>
#include <svx/IAccessibleViewForwarder.hxx>
#include <svx/svxdllapi.h>
+#include <vcl/vclptr.hxx>
class SdrView;
namespace vcl { class Window; }
@@ -176,7 +177,7 @@ private:
/** This window is necessary to construct an SvxTextEditSource which in
turn is used to create an accessible edit engine.
*/
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
/** The view forwarder allows the transformation between internal
and pixel coordinates and can be asked for the visible area.
diff --git a/include/svx/ParaLineSpacingPopup.hxx b/include/svx/ParaLineSpacingPopup.hxx
index ba8cebc6e103..1460c744f384 100644
--- a/include/svx/ParaLineSpacingPopup.hxx
+++ b/include/svx/ParaLineSpacingPopup.hxx
@@ -39,7 +39,7 @@ public:
virtual ~ParaLineSpacingPopup();
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
} // namespace svx
diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx
index 7be37ee40177..81bdd06253cd 100644
--- a/include/svx/bmpmask.hxx
+++ b/include/svx/bmpmask.hxx
@@ -81,33 +81,33 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxBmpMask : public SfxDockingWindow
friend class MaskData;
friend class MaskSet;
- ToolBox* m_pTbxPipette;
- ColorWindow* m_pCtlPipette;
- PushButton* m_pBtnExec;
-
- CheckBox* m_pCbx1;
- MaskSet* m_pQSet1;
- MetricField* m_pSp1;
- ColorLB* m_pLbColor1;
-
- CheckBox* m_pCbx2;
- MaskSet* m_pQSet2;
- MetricField* m_pSp2;
- ColorLB* m_pLbColor2;
-
- CheckBox* m_pCbx3;
- MaskSet* m_pQSet3;
- MetricField* m_pSp3;
- ColorLB* m_pLbColor3;
-
- CheckBox* m_pCbx4;
- MaskSet* m_pQSet4;
- MetricField* m_pSp4;
- ColorLB* m_pLbColor4;
+ VclPtr<ToolBox> m_pTbxPipette;
+ VclPtr<ColorWindow> m_pCtlPipette;
+ VclPtr<PushButton> m_pBtnExec;
+
+ VclPtr<CheckBox> m_pCbx1;
+ VclPtr<MaskSet> m_pQSet1;
+ VclPtr<MetricField> m_pSp1;
+ VclPtr<ColorLB> m_pLbColor1;
+
+ VclPtr<CheckBox> m_pCbx2;
+ VclPtr<MaskSet> m_pQSet2;
+ VclPtr<MetricField> m_pSp2;
+ VclPtr<ColorLB> m_pLbColor2;
+
+ VclPtr<CheckBox> m_pCbx3;
+ VclPtr<MaskSet> m_pQSet3;
+ VclPtr<MetricField> m_pSp3;
+ VclPtr<ColorLB> m_pLbColor3;
+
+ VclPtr<CheckBox> m_pCbx4;
+ VclPtr<MaskSet> m_pQSet4;
+ VclPtr<MetricField> m_pSp4;
+ VclPtr<ColorLB> m_pLbColor4;
MaskData* pData;
- CheckBox* m_pCbxTrans;
- ColorLB* m_pLbColorTrans;
+ VclPtr<CheckBox> m_pCbxTrans;
+ VclPtr<ColorLB> m_pLbColorTrans;
XColorListRef pColLst;
Color aPipetteColor;
@@ -135,6 +135,7 @@ public:
SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* pParent);
virtual ~SvxBmpMask();
+ virtual void dispose() SAL_OVERRIDE;
void SetColor( const Color& rColor );
void PipetteClicked();
diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index fd9a1d00c15d..cf05bf2764a3 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -22,6 +22,8 @@
#include <vcl/ctrl.hxx>
#include <vcl/metric.hxx>
#include <vcl/scrbar.hxx>
+#include <vcl/vclptr.hxx>
+#include <boost/shared_ptr.hpp>
#include <map>
#include <memory>
#include <svx/svxdllapi.h>
@@ -44,6 +46,7 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxShowCharSet : public Control
public:
SvxShowCharSet( vcl::Window* pParent );
virtual ~SvxShowCharSet();
+ virtual void dispose() SAL_OVERRIDE;
void SetFont( const vcl::Font& rFont );
@@ -71,7 +74,7 @@ public:
static sal_uInt16 GetRowPos(sal_uInt16 _nPos);
static sal_uInt16 GetColumnPos(sal_uInt16 _nPos);
- ScrollBar& getScrollBar() { return aVscrollSB;}
+ ScrollBar& getScrollBar() { return *aVscrollSB.get();}
void ReleaseAccessible();
sal_Int32 getMaxCharCount() const;
@@ -112,7 +115,7 @@ private:
sal_Int32 nSelectedIndex;
FontCharMapPtr mpFontCharMap;
- ScrollBar aVscrollSB;
+ VclPtr<ScrollBar> aVscrollSB;
private:
void DrawChars_Impl( int n1, int n2);
diff --git a/include/svx/checklbx.hxx b/include/svx/checklbx.hxx
index dd15c8a66c07..63db8545c3bd 100644
--- a/include/svx/checklbx.hxx
+++ b/include/svx/checklbx.hxx
@@ -46,6 +46,7 @@ public:
SvxCheckListBox( vcl::Window* pParent, WinBits nWinStyle = 0 );
void SetNormalStaticImage(const Image& rNormalStaticImage);
virtual ~SvxCheckListBox();
+ virtual void dispose() SAL_OVERRIDE;
void InsertEntry ( const OUString& rStr,
sal_uLong nPos = TREELIST_APPEND,
diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx
index 07c5bbb0dc70..64ed0d94e832 100644
--- a/include/svx/clipboardctl.hxx
+++ b/include/svx/clipboardctl.hxx
@@ -45,7 +45,7 @@ public:
virtual ~SvxClipBoardControl();
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/include/svx/colrctrl.hxx b/include/svx/colrctrl.hxx
index 0987da9dea53..04e67f1f0a9f 100644
--- a/include/svx/colrctrl.hxx
+++ b/include/svx/colrctrl.hxx
@@ -26,6 +26,7 @@
#include <svl/lstner.hxx>
#include <svx/svxdllapi.h>
#include <svx/xtable.hxx>
+#include <vcl/vclptr.hxx>
class SvData;
@@ -75,7 +76,7 @@ friend class SvxColorChildWindow;
private:
XColorListRef pColorList;
- SvxColorValueSet_docking aColorSet;
+ VclPtr<SvxColorValueSet_docking> aColorSet;
sal_uInt16 nLeftSlot;
sal_uInt16 nRightSlot;
sal_uInt16 nCols;
@@ -103,6 +104,7 @@ public:
SfxChildWindow *pCW,
vcl::Window* pParent);
virtual ~SvxColorDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
diff --git a/include/svx/compressgraphicdialog.hxx b/include/svx/compressgraphicdialog.hxx
index 17aa10ad09a2..ba5e51aa52c1 100644
--- a/include/svx/compressgraphicdialog.hxx
+++ b/include/svx/compressgraphicdialog.hxx
@@ -33,22 +33,22 @@ class SdrGrafObj;
class SVX_DLLPUBLIC SAL_WARN_UNUSED CompressGraphicsDialog : public ModalDialog
{
private:
- FixedText* m_pLabelGraphicType;
- FixedText* m_pFixedText2;
- FixedText* m_pFixedText3;
- FixedText* m_pFixedText5;
- FixedText* m_pFixedText6;
-
- CheckBox* m_pReduceResolutionCB;
- NumericField* m_pMFNewWidth;
- NumericField* m_pMFNewHeight;
- ComboBox* m_pResolutionLB;
- RadioButton* m_pLosslessRB;
- RadioButton* m_pJpegCompRB;
- NumericField* m_pCompressionMF;
- NumericField* m_pQualityMF;
- PushButton* m_pBtnCalculate;
- ListBox* m_pInterpolationCombo;
+ VclPtr<FixedText> m_pLabelGraphicType;
+ VclPtr<FixedText> m_pFixedText2;
+ VclPtr<FixedText> m_pFixedText3;
+ VclPtr<FixedText> m_pFixedText5;
+ VclPtr<FixedText> m_pFixedText6;
+
+ VclPtr<CheckBox> m_pReduceResolutionCB;
+ VclPtr<NumericField> m_pMFNewWidth;
+ VclPtr<NumericField> m_pMFNewHeight;
+ VclPtr<ComboBox> m_pResolutionLB;
+ VclPtr<RadioButton> m_pLosslessRB;
+ VclPtr<RadioButton> m_pJpegCompRB;
+ VclPtr<NumericField> m_pCompressionMF;
+ VclPtr<NumericField> m_pQualityMF;
+ VclPtr<PushButton> m_pBtnCalculate;
+ VclPtr<ListBox> m_pInterpolationCombo;
SdrGrafObj* m_pGraphicObj;
Graphic m_aGraphic;
@@ -83,8 +83,8 @@ private:
public:
CompressGraphicsDialog( vcl::Window* pParent, SdrGrafObj* pGraphicObj, SfxBindings& rBindings );
CompressGraphicsDialog( vcl::Window* pParent, Graphic& rGraphic, Size rViewSize100mm, Rectangle& rCropRectangle, SfxBindings& rBindings );
-
virtual ~CompressGraphicsDialog();
+ virtual void dispose() SAL_OVERRIDE;
SdrGrafObj* GetCompressedSdrGrafObj();
Graphic GetCompressedGraphic();
diff --git a/include/svx/connctrl.hxx b/include/svx/connctrl.hxx
index 7febedffef35..1c037d88584c 100644
--- a/include/svx/connctrl.hxx
+++ b/include/svx/connctrl.hxx
@@ -46,6 +46,7 @@ private:
public:
SvxXConnectionPreview( vcl::Window* pParent, WinBits nStyle);
virtual ~SvxXConnectionPreview();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
diff --git a/include/svx/contdlg.hxx b/include/svx/contdlg.hxx
index 57080eb7da0f..de25491cb15c 100644
--- a/include/svx/contdlg.hxx
+++ b/include/svx/contdlg.hxx
@@ -47,18 +47,19 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxContourDlg : public SfxFloatingWindow
{
using Window::Update;
- SvxSuperContourDlg* pSuperClass;
+ VclPtr<SvxSuperContourDlg> pSuperClass;
protected:
- void SetSuperClass( SvxSuperContourDlg& rSuperClass ) { pSuperClass = &rSuperClass; }
+ void SetSuperClass( SvxSuperContourDlg& rSuperClass );
public:
SvxContourDlg(SfxBindings *pBindings, SfxChildWindow *pCW,
vcl::Window* pParent);
- virtual ~SvxContourDlg();
+ virtual ~SvxContourDlg();
+ virtual void dispose() SAL_OVERRIDE;
const Graphic& GetGraphic() const;
bool IsGraphicChanged() const;
diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
index 160ef1000237..83c590d57ac0 100644
--- a/include/svx/ctredlin.hxx
+++ b/include/svx/ctredlin.hxx
@@ -116,6 +116,7 @@ public:
SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
virtual ~SvxRedlinTable();
+ virtual void dispose() SAL_OVERRIDE;
// For FilterPage only {
void SetFilterDate(bool bFlag=true);
@@ -179,25 +180,25 @@ private:
Link aRefLink;
Link aModifyComLink;
- SvxRedlinTable* pRedlinTable;
- CheckBox* m_pCbDate;
- ListBox* m_pLbDate;
- DateField* m_pDfDate;
- TimeField* m_pTfDate;
- PushButton* m_pIbClock;
- FixedText* m_pFtDate2;
- DateField* m_pDfDate2;
- TimeField* m_pTfDate2;
- PushButton* m_pIbClock2;
- CheckBox* m_pCbAuthor;
- ListBox* m_pLbAuthor;
- CheckBox* m_pCbRange;
- Edit* m_pEdRange;
- PushButton* m_pBtnRange;
- CheckBox* m_pCbAction;
- ListBox* m_pLbAction;
- CheckBox* m_pCbComment;
- Edit* m_pEdComment;
+ VclPtr<SvxRedlinTable> pRedlinTable;
+ VclPtr<CheckBox> m_pCbDate;
+ VclPtr<ListBox> m_pLbDate;
+ VclPtr<DateField> m_pDfDate;
+ VclPtr<TimeField> m_pTfDate;
+ VclPtr<PushButton> m_pIbClock;
+ VclPtr<FixedText> m_pFtDate2;
+ VclPtr<DateField> m_pDfDate2;
+ VclPtr<TimeField> m_pTfDate2;
+ VclPtr<PushButton> m_pIbClock2;
+ VclPtr<CheckBox> m_pCbAuthor;
+ VclPtr<ListBox> m_pLbAuthor;
+ VclPtr<CheckBox> m_pCbRange;
+ VclPtr<Edit> m_pEdRange;
+ VclPtr<PushButton> m_pBtnRange;
+ VclPtr<CheckBox> m_pCbAction;
+ VclPtr<ListBox> m_pLbAction;
+ VclPtr<CheckBox> m_pCbComment;
+ VclPtr<Edit> m_pEdComment;
bool bModified;
DECL_LINK( SelDateHdl, ListBox* );
@@ -215,6 +216,8 @@ protected:
public:
SvxTPFilter( vcl::Window * pParent);
+ virtual ~SvxTPFilter();
+ virtual void dispose() SAL_OVERRIDE;
virtual void DeactivatePage() SAL_OVERRIDE;
void SetRedlinTable(SvxRedlinTable*);
@@ -304,12 +307,12 @@ private:
Link RejectAllClickLk;
Link UndoClickLk;
- SvxRedlinTable* m_pViewData;
- PushButton* m_pAccept;
- PushButton* m_pReject;
- PushButton* m_pAcceptAll;
- PushButton* m_pRejectAll;
- PushButton* m_pUndo;
+ VclPtr<SvxRedlinTable> m_pViewData;
+ VclPtr<PushButton> m_pAccept;
+ VclPtr<PushButton> m_pReject;
+ VclPtr<PushButton> m_pAcceptAll;
+ VclPtr<PushButton> m_pRejectAll;
+ VclPtr<PushButton> m_pUndo;
bool bEnableAccept;
bool bEnableAcceptAll;
@@ -322,6 +325,7 @@ private:
public:
SvxTPView(vcl::Window * pParent, VclBuilderContainer *pTopLevel);
virtual ~SvxTPView();
+ virtual void dispose() SAL_OVERRIDE;
void InsertWriterHeader();
void InsertCalcHeader();
@@ -370,8 +374,8 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxAcceptChgCtr
{
private:
- SvxTPFilter* pTPFilter;
- SvxTPView* pTPView;
+ VclPtr<SvxTPFilter> pTPFilter;
+ VclPtr<SvxTPView> pTPView;
sal_uInt16 m_nViewPageId;
sal_uInt16 m_nFilterPageId;
@@ -380,6 +384,7 @@ public:
SvxAcceptChgCtr(vcl::Window* pParent, VclBuilderContainer* pTopLevel);
virtual ~SvxAcceptChgCtr();
+ virtual void dispose() SAL_OVERRIDE;
void ShowFilterPage();
void ShowViewPage();
diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx
index 36ac077369d9..9477de1f7a9b 100644
--- a/include/svx/dialcontrol.hxx
+++ b/include/svx/dialcontrol.hxx
@@ -80,8 +80,6 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED DialControl : public Control
public:
explicit DialControl( vcl::Window* pParent, WinBits nBits );
- virtual ~DialControl();
-
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
@@ -126,11 +124,11 @@ public:
protected:
struct DialControl_Impl
{
- std::unique_ptr<DialControlBmp> mxBmpEnabled;
- std::unique_ptr<DialControlBmp> mxBmpDisabled;
- std::unique_ptr<DialControlBmp> mxBmpBuffered;
+ ScopedVclPtr<DialControlBmp> mxBmpEnabled;
+ ScopedVclPtr<DialControlBmp> mxBmpDisabled;
+ ScopedVclPtr<DialControlBmp> mxBmpBuffered;
Link maModifyHdl;
- NumericField* mpLinkField;
+ VclPtr<NumericField> mpLinkField;
sal_Int32 mnLinkedFieldValueMultiplyer;
Size maWinSize;
vcl::Font maWinFont;
diff --git a/include/svx/dlgctl3d.hxx b/include/svx/dlgctl3d.hxx
index 09b1c52c55d1..a9eab331774b 100644
--- a/include/svx/dlgctl3d.hxx
+++ b/include/svx/dlgctl3d.hxx
@@ -51,6 +51,7 @@ protected:
public:
Svx3DPreviewControl(vcl::Window* pParent, WinBits nStyle = 0);
virtual ~Svx3DPreviewControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -104,7 +105,6 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED Svx3DLightControl : public Svx3DPreviewContr
public:
Svx3DLightControl(vcl::Window* pParent, WinBits nStyle = 0);
- virtual ~Svx3DLightControl();
virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE;
virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
@@ -145,18 +145,19 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxLightCtl3D : public Control
{
private:
// local controls
- Svx3DLightControl maLightControl;
- ScrollBar maHorScroller;
- ScrollBar maVerScroller;
- PushButton maSwitcher;
+ VclPtr<Svx3DLightControl> maLightControl;
+ VclPtr<ScrollBar> maHorScroller;
+ VclPtr<ScrollBar> maVerScroller;
+ VclPtr<PushButton> maSwitcher;
// callback for interactive changes
- Link maUserInteractiveChangeCallback;
- Link maUserSelectionChangeCallback;
+ Link maUserInteractiveChangeCallback;
+ Link maUserSelectionChangeCallback;
public:
SvxLightCtl3D(vcl::Window* pParent);
virtual ~SvxLightCtl3D();
+ virtual void dispose() SAL_OVERRIDE;
// react to size changes
virtual void Resize() SAL_OVERRIDE;
@@ -166,7 +167,7 @@ public:
void CheckSelection();
// bring further settings to the outside world
- Svx3DLightControl& GetSvx3DLightControl() { return maLightControl; }
+ Svx3DLightControl& GetSvx3DLightControl() { return *maLightControl.get(); }
// register user callback
void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 95713734122a..119aafa84290 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -100,6 +100,7 @@ public:
void SetControlSettings(RECT_POINT eRpt = RP_MM, sal_uInt16 nBorder = 200,
sal_uInt16 nCircle = 80, CTL_STYLE eStyle = CS_RECT);
virtual ~SvxRectCtl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -179,6 +180,7 @@ public:
SvxPixelCtl( vcl::Window* pParent, sal_uInt16 nNumber = 8 );
virtual ~SvxPixelCtl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -322,7 +324,6 @@ private:
public:
LineLB(vcl::Window* pParent, WinBits aWB);
- virtual ~LineLB();
void Fill(const XDashListRef &pList);
bool getAddStandardFields() const { return mbAddStandardFields; }
@@ -341,7 +342,6 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED LineEndLB : public ListBox
public:
LineEndLB( vcl::Window* pParent, WinBits aWB );
- virtual ~LineEndLB();
void Fill( const XLineEndListRef &pList, bool bStart = true );
@@ -350,7 +350,6 @@ public:
};
-
class SdrObject;
class SdrPathObj;
class SdrModel;
@@ -358,8 +357,8 @@ class SdrModel;
class SAL_WARN_UNUSED SvxPreviewBase : public Control
{
private:
- SdrModel* mpModel;
- VirtualDevice* mpBufferDevice;
+ SdrModel* mpModel;
+ VclPtr<VirtualDevice> mpBufferDevice;
protected:
void InitSettings(bool bForeground, bool bBackground);
@@ -373,6 +372,7 @@ protected:
public:
SvxPreviewBase(vcl::Window* pParent);
virtual ~SvxPreviewBase();
+ virtual void dispose() SAL_OVERRIDE;
// change support
virtual void StateChanged(StateChangedType nStateChange) SAL_OVERRIDE;
@@ -403,6 +403,7 @@ private:
public:
SvxXLinePreview( vcl::Window* pParent );
virtual ~SvxXLinePreview();
+ virtual void dispose() SAL_OVERRIDE;
void SetLineAttributes(const SfxItemSet& rItemSet);
@@ -429,6 +430,7 @@ private:
public:
SvxXRectPreview(vcl::Window* pParent);
virtual ~SvxXRectPreview();
+ virtual void dispose() SAL_OVERRIDE;
void SetAttributes(const SfxItemSet& rItemSet);
@@ -454,6 +456,7 @@ public:
SvxXShadowPreview(vcl::Window *pParent);
virtual ~SvxXShadowPreview();
+ virtual void dispose() SAL_OVERRIDE;
void SetRectangleAttributes(const SfxItemSet& rItemSet);
void SetShadowAttributes(const SfxItemSet& rItemSet);
diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx
index 60955a6a6219..d33c5e6c3739 100644
--- a/include/svx/fillctrl.hxx
+++ b/include/svx/fillctrl.hxx
@@ -50,9 +50,9 @@ private:
XFillHatchItem* mpHatchItem;
XFillBitmapItem* mpBitmapItem;
- FillControl* mpFillControl;
- SvxFillTypeBox* mpFillTypeLB;
- SvxFillAttrBox* mpFillAttrLB;
+ VclPtr<FillControl> mpFillControl;
+ VclPtr<SvxFillTypeBox> mpFillTypeLB;
+ VclPtr<SvxFillAttrBox> mpFillAttrLB;
css::drawing::FillStyle meLastXFS;
@@ -67,7 +67,7 @@ public:
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE;
void Update(const SfxPoolItem* pState);
- virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
};
@@ -77,8 +77,8 @@ class SAL_WARN_UNUSED FillControl : public vcl::Window
private:
friend class SvxFillToolBoxControl;
- SvxFillTypeBox* mpLbFillType;
- SvxFillAttrBox* mpLbFillAttr;
+ VclPtr<SvxFillTypeBox> mpLbFillType;
+ VclPtr<SvxFillAttrBox> mpLbFillAttr;
Size maLogicalFillSize;
Size maLogicalAttrSize;
@@ -101,6 +101,7 @@ private:
public:
FillControl(vcl::Window* pParent, WinBits nStyle = 0);
virtual ~FillControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
};
diff --git a/include/svx/float3d.hxx b/include/svx/float3d.hxx
index f538f7d53aed..04c166228a94 100644
--- a/include/svx/float3d.hxx
+++ b/include/svx/float3d.hxx
@@ -60,108 +60,108 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED Svx3DWin : public SfxDockingWindow
using Window::Update;
private:
- PushButton* m_pBtnGeo;
- PushButton* m_pBtnRepresentation;
- PushButton* m_pBtnLight;
- PushButton* m_pBtnTexture;
- PushButton* m_pBtnMaterial;
- PushButton* m_pBtnUpdate;
- PushButton* m_pBtnAssign;
+ VclPtr<PushButton> m_pBtnGeo;
+ VclPtr<PushButton> m_pBtnRepresentation;
+ VclPtr<PushButton> m_pBtnLight;
+ VclPtr<PushButton> m_pBtnTexture;
+ VclPtr<PushButton> m_pBtnMaterial;
+ VclPtr<PushButton> m_pBtnUpdate;
+ VclPtr<PushButton> m_pBtnAssign;
// geometry
- VclContainer* m_pFLGeometrie;
- FixedText* m_pFtPercentDiagonal;
- MetricField* m_pMtrPercentDiagonal;
- FixedText* m_pFtBackscale;
- MetricField* m_pMtrBackscale;
- FixedText* m_pFtEndAngle;
- MetricField* m_pMtrEndAngle;
- FixedText* m_pFtDepth;
- MetricField* m_pMtrDepth;
-
- VclContainer* m_pFLSegments;
- NumericField* m_pNumHorizontal;
- NumericField* m_pNumVertical;
-
- VclContainer* m_pFLNormals;
- PushButton* m_pBtnNormalsObj;
- PushButton* m_pBtnNormalsFlat;
- PushButton* m_pBtnNormalsSphere;
- PushButton* m_pBtnNormalsInvert;
- PushButton* m_pBtnTwoSidedLighting;
- PushButton* m_pBtnDoubleSided;
+ VclPtr<VclContainer> m_pFLGeometrie;
+ VclPtr<FixedText> m_pFtPercentDiagonal;
+ VclPtr<MetricField> m_pMtrPercentDiagonal;
+ VclPtr<FixedText> m_pFtBackscale;
+ VclPtr<MetricField> m_pMtrBackscale;
+ VclPtr<FixedText> m_pFtEndAngle;
+ VclPtr<MetricField> m_pMtrEndAngle;
+ VclPtr<FixedText> m_pFtDepth;
+ VclPtr<MetricField> m_pMtrDepth;
+
+ VclPtr<VclContainer> m_pFLSegments;
+ VclPtr<NumericField> m_pNumHorizontal;
+ VclPtr<NumericField> m_pNumVertical;
+
+ VclPtr<VclContainer> m_pFLNormals;
+ VclPtr<PushButton> m_pBtnNormalsObj;
+ VclPtr<PushButton> m_pBtnNormalsFlat;
+ VclPtr<PushButton> m_pBtnNormalsSphere;
+ VclPtr<PushButton> m_pBtnNormalsInvert;
+ VclPtr<PushButton> m_pBtnTwoSidedLighting;
+ VclPtr<PushButton> m_pBtnDoubleSided;
// presentation
- VclContainer* m_pFLRepresentation;
- ListBox* m_pLbShademode;
+ VclPtr<VclContainer> m_pFLRepresentation;
+ VclPtr<ListBox> m_pLbShademode;
- VclContainer* m_pFLShadow;
- PushButton* m_pBtnShadow3d;
- FixedText* m_pFtSlant;
- MetricField* m_pMtrSlant;
+ VclPtr<VclContainer> m_pFLShadow;
+ VclPtr<PushButton> m_pBtnShadow3d;
+ VclPtr<FixedText> m_pFtSlant;
+ VclPtr<MetricField> m_pMtrSlant;
- VclContainer* m_pFLCamera;
- MetricField* m_pMtrDistance;
- MetricField* m_pMtrFocalLength;
+ VclPtr<VclContainer> m_pFLCamera;
+ VclPtr<MetricField> m_pMtrDistance;
+ VclPtr<MetricField> m_pMtrFocalLength;
// lighting
- VclContainer* m_pFLLight;
- PushButton* m_pBtnLight1;
- PushButton* m_pBtnLight2;
- PushButton* m_pBtnLight3;
- PushButton* m_pBtnLight4;
- PushButton* m_pBtnLight5;
- PushButton* m_pBtnLight6;
- PushButton* m_pBtnLight7;
- PushButton* m_pBtnLight8;
- ColorLB* m_pLbLight1;
- ColorLB* m_pLbLight2;
- ColorLB* m_pLbLight3;
- ColorLB* m_pLbLight4;
- ColorLB* m_pLbLight5;
- ColorLB* m_pLbLight6;
- ColorLB* m_pLbLight7;
- ColorLB* m_pLbLight8;
- PushButton* m_pBtnLightColor;
- ColorLB* m_pLbAmbientlight; // ListBox
- PushButton* m_pBtnAmbientColor; // color button
+ VclPtr<VclContainer> m_pFLLight;
+ VclPtr<PushButton> m_pBtnLight1;
+ VclPtr<PushButton> m_pBtnLight2;
+ VclPtr<PushButton> m_pBtnLight3;
+ VclPtr<PushButton> m_pBtnLight4;
+ VclPtr<PushButton> m_pBtnLight5;
+ VclPtr<PushButton> m_pBtnLight6;
+ VclPtr<PushButton> m_pBtnLight7;
+ VclPtr<PushButton> m_pBtnLight8;
+ VclPtr<ColorLB> m_pLbLight1;
+ VclPtr<ColorLB> m_pLbLight2;
+ VclPtr<ColorLB> m_pLbLight3;
+ VclPtr<ColorLB> m_pLbLight4;
+ VclPtr<ColorLB> m_pLbLight5;
+ VclPtr<ColorLB> m_pLbLight6;
+ VclPtr<ColorLB> m_pLbLight7;
+ VclPtr<ColorLB> m_pLbLight8;
+ VclPtr<PushButton> m_pBtnLightColor;
+ VclPtr<ColorLB> m_pLbAmbientlight; // ListBox
+ VclPtr<PushButton> m_pBtnAmbientColor; // color button
// Textures
- VclContainer* m_pFLTexture;
- PushButton* m_pBtnTexLuminance;
- PushButton* m_pBtnTexColor;
- PushButton* m_pBtnTexReplace;
- PushButton* m_pBtnTexModulate;
- PushButton* m_pBtnTexBlend;
- PushButton* m_pBtnTexObjectX;
- PushButton* m_pBtnTexParallelX;
- PushButton* m_pBtnTexCircleX;
- PushButton* m_pBtnTexObjectY;
- PushButton* m_pBtnTexParallelY;
- PushButton* m_pBtnTexCircleY;
- PushButton* m_pBtnTexFilter;
+ VclPtr<VclContainer> m_pFLTexture;
+ VclPtr<PushButton> m_pBtnTexLuminance;
+ VclPtr<PushButton> m_pBtnTexColor;
+ VclPtr<PushButton> m_pBtnTexReplace;
+ VclPtr<PushButton> m_pBtnTexModulate;
+ VclPtr<PushButton> m_pBtnTexBlend;
+ VclPtr<PushButton> m_pBtnTexObjectX;
+ VclPtr<PushButton> m_pBtnTexParallelX;
+ VclPtr<PushButton> m_pBtnTexCircleX;
+ VclPtr<PushButton> m_pBtnTexObjectY;
+ VclPtr<PushButton> m_pBtnTexParallelY;
+ VclPtr<PushButton> m_pBtnTexCircleY;
+ VclPtr<PushButton> m_pBtnTexFilter;
// material
// material editor
- VclContainer* m_pFLMaterial;
- ListBox* m_pLbMatFavorites;
- ColorLB* m_pLbMatColor;
- PushButton* m_pBtnMatColor;
- ColorLB* m_pLbMatEmission;
- PushButton* m_pBtnEmissionColor;
+ VclPtr<VclContainer> m_pFLMaterial;
+ VclPtr<ListBox> m_pLbMatFavorites;
+ VclPtr<ColorLB> m_pLbMatColor;
+ VclPtr<PushButton> m_pBtnMatColor;
+ VclPtr<ColorLB> m_pLbMatEmission;
+ VclPtr<PushButton> m_pBtnEmissionColor;
- VclContainer* m_pFLMatSpecular;
- ColorLB* m_pLbMatSpecular;
- PushButton* m_pBtnSpecularColor;
- MetricField* m_pMtrMatSpecularIntensity;
+ VclPtr<VclContainer> m_pFLMatSpecular;
+ VclPtr<ColorLB> m_pLbMatSpecular;
+ VclPtr<PushButton> m_pBtnSpecularColor;
+ VclPtr<MetricField> m_pMtrMatSpecularIntensity;
- Svx3DPreviewControl* m_pCtlPreview;
- SvxLightCtl3D* m_pCtlLightPreview;
+ VclPtr<Svx3DPreviewControl> m_pCtlPreview;
+ VclPtr<SvxLightCtl3D> m_pCtlLightPreview;
// bottom part
- PushButton* m_pBtnConvertTo3D;
- PushButton* m_pBtnLatheObject;
- PushButton* m_pBtnPerspective;
+ VclPtr<PushButton> m_pBtnConvertTo3D;
+ VclPtr<PushButton> m_pBtnLatheObject;
+ VclPtr<PushButton> m_pBtnPerspective;
// the rest ...
Image aImgLightOn;
@@ -171,7 +171,7 @@ private:
// Model, Page, View etc. for favourites
FmFormModel* pModel;
- VirtualDevice* pVDev;
+ VclPtr<VirtualDevice> pVDev;
E3dView* p3DView;
SfxBindings* pBindings;
@@ -189,8 +189,6 @@ private:
bool bOnly3DChanged;
-
-
DECL_LINK( ClickViewTypeHdl, void * );
DECL_LINK( ClickUpdateHdl, void * );
DECL_LINK( ClickAssignHdl, void * );
@@ -220,6 +218,7 @@ public:
Svx3DWin( SfxBindings* pBindings, SfxChildWindow *pCW,
vcl::Window* pParent );
virtual ~Svx3DWin();
+ virtual void dispose() SAL_OVERRIDE;
void InitColorLB( const SdrModel* pDoc );
bool IsUpdateMode() const { return bUpdate; }
diff --git a/include/svx/fmgridcl.hxx b/include/svx/fmgridcl.hxx
index 0bcb6124e7ff..7bb356852b28 100644
--- a/include/svx/fmgridcl.hxx
+++ b/include/svx/fmgridcl.hxx
@@ -43,6 +43,7 @@ protected:
public:
FmGridHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
virtual ~FmGridHeader();
+ virtual void dispose() SAL_OVERRIDE;
public:
struct AccessControl { friend class FmGridControl; private: AccessControl() { } };
@@ -153,7 +154,7 @@ public:
protected:
virtual void Command(const CommandEvent& rEvt) SAL_OVERRIDE;
- virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
+ virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE;
virtual long QueryMinimumRowHeight() SAL_OVERRIDE;
virtual void RowHeightChanged() SAL_OVERRIDE;
virtual void ColumnResized(sal_uInt16 nId) SAL_OVERRIDE;
diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx
index bb9d2fcfa18c..d752b881e064 100644
--- a/include/svx/fmgridif.hxx
+++ b/include/svx/fmgridif.hxx
@@ -501,7 +501,7 @@ public:
virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
protected:
- virtual FmGridControl* imp_CreateControl(vcl::Window* pParent, WinBits nStyle);
+ virtual VclPtr<FmGridControl> imp_CreateControl(vcl::Window* pParent, WinBits nStyle);
static ::com::sun::star::uno::Sequence< ::com::sun::star::util::URL>& getSupportedURLs();
static ::com::sun::star::uno::Sequence<sal_uInt16>& getSupportedGridSlots();
diff --git a/include/svx/fmshell.hxx b/include/svx/fmshell.hxx
index 462c304590d1..8249ef9c46b7 100644
--- a/include/svx/fmshell.hxx
+++ b/include/svx/fmshell.hxx
@@ -88,7 +88,7 @@ class SVX_DLLPUBLIC FmFormShell : public SfxShell
class FormShellWaitObject
{
- vcl::Window* m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
public:
FormShellWaitObject(const FmFormShell* _pShell);
~FormShellWaitObject();
diff --git a/include/svx/fntctrl.hxx b/include/svx/fntctrl.hxx
index a9ad36d99855..2278f0c3f755 100644
--- a/include/svx/fntctrl.hxx
+++ b/include/svx/fntctrl.hxx
@@ -49,6 +49,7 @@ public:
SvxFontPrevWindow( vcl::Window* pParent, const ResId& rId );
SvxFontPrevWindow(vcl::Window* pParent, WinBits nStyle);
virtual ~SvxFontPrevWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
diff --git a/include/svx/fontwork.hxx b/include/svx/fontwork.hxx
index 6760ace56b0e..8905b76b9511 100644
--- a/include/svx/fontwork.hxx
+++ b/include/svx/fontwork.hxx
@@ -92,20 +92,22 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxFontWorkDialog : public SfxDockingWindow
SvxFontWorkControllerItem* pCtrlItems[CONTROLLER_COUNT];
- ToolBox* m_pTbxStyle;
- ToolBox* m_pTbxAdjust;
+ VclPtr<ToolBox> m_pTbxStyle;
+ VclPtr<ToolBox> m_pTbxAdjust;
- MetricField* m_pMtrFldDistance;
- MetricField* m_pMtrFldTextStart;
+ VclPtr<FixedImage> m_pFbDistance;
+ VclPtr<MetricField> m_pMtrFldDistance;
+ VclPtr<FixedImage> m_pFbTextStart;
+ VclPtr<MetricField> m_pMtrFldTextStart;
- ToolBox* m_pTbxShadow;
+ VclPtr<ToolBox> m_pTbxShadow;
- FixedImage* m_pFbShadowX;
- MetricField* m_pMtrFldShadowX;
- FixedImage* m_pFbShadowY;
- MetricField* m_pMtrFldShadowY;
+ VclPtr<FixedImage> m_pFbShadowX;
+ VclPtr<MetricField> m_pMtrFldShadowX;
+ VclPtr<FixedImage> m_pFbShadowY;
+ VclPtr<MetricField> m_pMtrFldShadowY;
- ColorLB* m_pShadowColorLB;
+ VclPtr<ColorLB> m_pShadowColorLB;
SfxBindings& rBindings;
Idle aInputIdle;
@@ -172,6 +174,7 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxFontWorkDialog : public SfxDockingWindow
SvxFontWorkDialog(SfxBindings *pBinding, SfxChildWindow *pCW,
vcl::Window* pParent);
virtual ~SvxFontWorkDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetColorList(const XColorListRef &pTable);
};
diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx
index 56787ec3df65..dfae49d09336 100644
--- a/include/svx/fontworkgallery.hxx
+++ b/include/svx/fontworkgallery.hxx
@@ -57,23 +57,25 @@ public:
virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
class SAL_WARN_UNUSED FontworkCharacterSpacingDialog : public ModalDialog
{
- MetricField* m_pMtrScale;
+ VclPtr<MetricField> m_pMtrScale;
public:
FontworkCharacterSpacingDialog( vcl::Window* pParent, sal_Int32 nScale );
+ virtual ~FontworkCharacterSpacingDialog();
+ virtual void dispose() SAL_OVERRIDE;
sal_Int32 getScale() const;
};
class SVX_DLLPUBLIC SAL_WARN_UNUSED FontWorkGalleryDialog : public ModalDialog
{
- ValueSet* mpCtlFavorites;
- OKButton* mpOKButton;
+ VclPtr<ValueSet> mpCtlFavorites;
+ VclPtr<OKButton> mpOKButton;
sal_uInt16 mnThemeId;
@@ -96,6 +98,7 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED FontWorkGalleryDialog : public ModalDialog
public:
FontWorkGalleryDialog( SdrView* pView, vcl::Window* pParent, sal_uInt16 nSID );
virtual ~FontWorkGalleryDialog();
+ virtual void dispose() SAL_OVERRIDE;
// SJ: if the SdrObject** is set, the SdrObject is not inserted into the page when executing the dialog
void SetSdrObjectRef( SdrObject**, SdrModel* pModel );
diff --git a/include/svx/frmdirlbox.hxx b/include/svx/frmdirlbox.hxx
index d584acc91104..d4df82a607c8 100644
--- a/include/svx/frmdirlbox.hxx
+++ b/include/svx/frmdirlbox.hxx
@@ -40,7 +40,6 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED FrameDirectionListBox : public ListBox
{
public:
explicit FrameDirectionListBox( vcl::Window* pParent, WinBits nBits );
- virtual ~FrameDirectionListBox();
/** Inserts a string with corresponding direction enum into the listbox. */
void InsertEntryValue(
diff --git a/include/svx/frmsel.hxx b/include/svx/frmsel.hxx
index aa34ef62c504..48bb2f90d785 100644
--- a/include/svx/frmsel.hxx
+++ b/include/svx/frmsel.hxx
@@ -84,7 +84,7 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED FrameSelector : public Control
{
public:
FrameSelector(vcl::Window* pParent);
- virtual ~FrameSelector();
+ virtual ~FrameSelector();
/** Initializes the control, enables/disables frame borders according to flags. */
void Initialize( FrameSelFlags nFlags );
diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx
index 4508e283cc6f..d0ccb6c62323 100644
--- a/include/svx/galctrl.hxx
+++ b/include/svx/galctrl.hxx
@@ -109,7 +109,6 @@ private:
public:
GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
- virtual ~GalleryIconView();
};
class GalleryListView : public BrowseBox
@@ -144,7 +143,6 @@ private:
public:
GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
- virtual ~GalleryListView();
void SetSelectHdl( const Link& rSelectHdl ) { maSelectHdl = rSelectHdl; }
diff --git a/include/svx/grafctrl.hxx b/include/svx/grafctrl.hxx
index acfd5f356cfa..ba4124de41e1 100644
--- a/include/svx/grafctrl.hxx
+++ b/include/svx/grafctrl.hxx
@@ -54,7 +54,7 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
@@ -68,7 +68,7 @@ public:
virtual ~SvxGrafToolBoxControl();
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;
};
@@ -160,7 +160,7 @@ public:
virtual ~SvxGrafModeToolBoxControl();
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;
};
diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx
index d941b6fbb581..3d646afa2baf 100644
--- a/include/svx/graphctl.hxx
+++ b/include/svx/graphctl.hxx
@@ -80,8 +80,9 @@ protected:
public:
- GraphCtrl( vcl::Window* pParent, WinBits nStyle );
- virtual ~GraphCtrl();
+ GraphCtrl( vcl::Window* pParent, WinBits nStyle );
+ virtual ~GraphCtrl();
+ virtual void dispose() SAL_OVERRIDE;
void SetWinStyle( WinBits nWinBits );
WinBits GetWinStyle() const { return nWinStyle; }
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index bf42c434ea13..94bbad044a2b 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -151,20 +151,20 @@ public:
friend class NavigationBar::AbsolutePos;
// zusaetzliche Controls
- FixedText m_aRecordText;
- AbsolutePos m_aAbsolute; // absolute positioning
- FixedText m_aRecordOf;
- FixedText m_aRecordCount;
+ VclPtr<FixedText> m_aRecordText;
+ VclPtr<AbsolutePos> m_aAbsolute; // absolute positioning
+ VclPtr<FixedText> m_aRecordOf;
+ VclPtr<FixedText> m_aRecordCount;
- ImageButton m_aFirstBtn; // ImageButton for 'go to the first record'
- ImageButton m_aPrevBtn; // ImageButton for 'go to the previous record'
- ImageButton m_aNextBtn; // ImageButton for 'go to the next record'
- ImageButton m_aLastBtn; // ImageButton for 'go to the last record'
- ImageButton m_aNewBtn; // ImageButton for 'go to a new record'
- sal_uInt16 m_nDefaultWidth;
- sal_Int32 m_nCurrentPos;
+ VclPtr<ImageButton> m_aFirstBtn; // ImageButton for 'go to the first record'
+ VclPtr<ImageButton> m_aPrevBtn; // ImageButton for 'go to the previous record'
+ VclPtr<ImageButton> m_aNextBtn; // ImageButton for 'go to the next record'
+ VclPtr<ImageButton> m_aLastBtn; // ImageButton for 'go to the last record'
+ VclPtr<ImageButton> m_aNewBtn; // ImageButton for 'go to a new record'
+ sal_uInt16 m_nDefaultWidth;
+ sal_Int32 m_nCurrentPos;
- bool m_bPositioning; // protect PositionDataSource against recursion
+ bool m_bPositioning; // protect PositionDataSource against recursion
public:
// StatusIds for Controls of the Bar
@@ -183,6 +183,8 @@ public:
};
NavigationBar(vcl::Window* pParent, WinBits nStyle = 0);
+ virtual ~NavigationBar();
+ virtual void dispose() SAL_OVERRIDE;
// Status methods for Controls
void InvalidateAll(sal_Int32 nCurrentPos = -1, bool bAll = false);
@@ -225,7 +227,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
DbGridColumns m_aColumns; // Column description
- NavigationBar m_aBar;
+ VclPtr<NavigationBar> m_aBar;
DbGridRowRef m_xDataRow; // Row which can be modified
// comes from the data cursor
DbGridRowRef m_xSeekRow, // Row to which the iterator can set
@@ -370,6 +372,7 @@ public:
WinBits nBits = WB_BORDER);
virtual ~DbGridControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Init() SAL_OVERRIDE;
virtual void InitColumnsByFields(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xFields) = 0;
@@ -431,7 +434,7 @@ public:
bool HasNavigationBar() const {return m_bNavigationBar;}
sal_uInt16 GetOptions() const {return m_nOptions;}
- NavigationBar& GetNavigationBar() {return m_aBar;}
+ NavigationBar& GetNavigationBar() {return *m_aBar.get();}
sal_uInt16 SetOptions(sal_uInt16 nOpt);
// The new options are interpreted with respect to the current data source. If it is unable
// to update, to insert or to restore, the according options are ignored. If the grid isn't
diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx
index 53450d36491a..7df23df2dc70 100644
--- a/include/svx/hdft.hxx
+++ b/include/svx/hdft.hxx
@@ -52,6 +52,7 @@ public:
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual ~SvxHFPage();
+ virtual void dispose() SAL_OVERRIDE;
void DisableDeleteQueryBox() { mbDisableQueryBox = true; }
void EnableBackgroundSelector(bool bNew) { mbEnableBackgroundSelector = bNew; }
@@ -69,22 +70,22 @@ protected:
SvxHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId );
- FixedText* m_pPageLbl;
- CheckBox* m_pTurnOnBox;
- CheckBox* m_pCntSharedBox;
- CheckBox* m_pCntSharedFirstBox;
- FixedText* m_pLMLbl;
- MetricField* m_pLMEdit;
- FixedText* m_pRMLbl;
- MetricField* m_pRMEdit;
- FixedText* m_pDistFT;
- MetricField* m_pDistEdit;
- CheckBox* m_pDynSpacingCB;
- FixedText* m_pHeightFT;
- MetricField* m_pHeightEdit;
- CheckBox* m_pHeightDynBtn;
- SvxPageWindow* m_pBspWin;
- PushButton* m_pBackgroundBtn;
+ VclPtr<FixedText> m_pPageLbl;
+ VclPtr<CheckBox> m_pTurnOnBox;
+ VclPtr<CheckBox> m_pCntSharedBox;
+ VclPtr<CheckBox> m_pCntSharedFirstBox;
+ VclPtr<FixedText> m_pLMLbl;
+ VclPtr<MetricField> m_pLMEdit;
+ VclPtr<FixedText> m_pRMLbl;
+ VclPtr<MetricField> m_pRMEdit;
+ VclPtr<FixedText> m_pDistFT;
+ VclPtr<MetricField> m_pDistEdit;
+ VclPtr<CheckBox> m_pDynSpacingCB;
+ VclPtr<FixedText> m_pHeightFT;
+ VclPtr<MetricField> m_pHeightEdit;
+ VclPtr<CheckBox> m_pHeightDynBtn;
+ VclPtr<SvxPageWindow> m_pBspWin;
+ VclPtr<PushButton> m_pBackgroundBtn;
sal_uInt16 nId;
SfxItemSet* pBBSet;
@@ -112,12 +113,10 @@ private:
class SVX_DLLPUBLIC SvxHeaderPage : public SvxHFPage
{
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
// returns the Which values to the range
- static const sal_uInt16* GetRanges() { return pRanges; }
-
-private:
- SvxHeaderPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ static const sal_uInt16* GetRanges() { return pRanges; }
+ SVX_DLLPRIVATE SvxHeaderPage( vcl::Window* pParent, const SfxItemSet& rSet );
};
// class SvxFooterPage ---------------------------------------------------
@@ -125,10 +124,8 @@ private:
class SVX_DLLPUBLIC SvxFooterPage : public SvxHFPage
{
public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
- static const sal_uInt16* GetRanges() { return pRanges; }
-
-private:
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static const sal_uInt16* GetRanges() { return pRanges; }
SVX_DLLPRIVATE SvxFooterPage( vcl::Window* pParent, const SfxItemSet& rSet );
};
diff --git a/include/svx/imapdlg.hxx b/include/svx/imapdlg.hxx
index 7c288fed577a..fc0b758d3c37 100644
--- a/include/svx/imapdlg.hxx
+++ b/include/svx/imapdlg.hxx
@@ -82,14 +82,14 @@ class SVX_DLLPUBLIC SvxIMapDlg : public SfxModelessDialog // SfxFloatingWindow
friend class IMapOwnData;
friend class IMapWindow;
- ToolBox *m_pTbxIMapDlg1;
- FixedText *m_pFtURL;
- SvtURLBox *m_pURLBox;
- FixedText *m_pFtText;
- Edit *m_pEdtText;
- FixedText *m_pFtTarget;
- ComboBox *m_pCbbTarget;
- StatusBar *m_pStbStatus;
+ VclPtr<ToolBox> m_pTbxIMapDlg1;
+ VclPtr<FixedText> m_pFtURL;
+ VclPtr<SvtURLBox> m_pURLBox;
+ VclPtr<FixedText> m_pFtText;
+ VclPtr<Edit> m_pEdtText;
+ VclPtr<FixedText> m_pFtTarget;
+ VclPtr<ComboBox> m_pCbbTarget;
+ VclPtr<StatusBar> m_pStbStatus;
sal_uInt16 mnApplyId;
sal_uInt16 mnOpenId;
@@ -110,7 +110,7 @@ class SVX_DLLPUBLIC SvxIMapDlg : public SfxModelessDialog // SfxFloatingWindow
sal_uInt16 mnPropertyId;
Size aLastSize;
- IMapWindow* pIMapWnd;
+ VclPtr<IMapWindow> pIMapWnd;
IMapOwnData* pOwnData;
void* pCheckObj;
SvxIMapDlgItem aIMapItem;
@@ -136,6 +136,7 @@ public:
SvxIMapDlg( SfxBindings *pBindings, SfxChildWindow *pCW,
vcl::Window* pParent );
virtual ~SvxIMapDlg();
+ virtual void dispose() SAL_OVERRIDE;
void SetExecState( bool bEnable );
diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx
index a71d9bcb0026..8d2c1bfb6726 100644
--- a/include/svx/itemwin.hxx
+++ b/include/svx/itemwin.hxx
@@ -49,7 +49,6 @@ public:
SvxLineBox( vcl::Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL );
- virtual ~SvxLineBox();
void FillControl();
@@ -87,7 +86,6 @@ public:
SvxMetricField( vcl::Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
WinBits nBits = WB_BORDER | WB_SPIN | WB_REPEAT );
- virtual ~SvxMetricField();
void Update( const XLineWidthItem* pItem );
void SetCoreUnit( SfxMapUnit eUnit );
@@ -100,7 +98,6 @@ class SvxFillTypeBox : public FillTypeLB
{
public:
SvxFillTypeBox( vcl::Window* pParent, WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL );
- virtual ~SvxFillTypeBox();
void Selected() { bSelect = true; }
bool IsRelease() { return bRelease;}
@@ -123,7 +120,6 @@ class SvxFillAttrBox : public FillAttrLB
{
public:
SvxFillAttrBox( vcl::Window* pParent, WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL );
- virtual ~SvxFillAttrBox();
bool IsRelease() { return bRelease;}
diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx
index f804f32b0d33..7cc8a3e9afe5 100644
--- a/include/svx/langbox.hxx
+++ b/include/svx/langbox.hxx
@@ -116,7 +116,6 @@ class SVX_DLLPUBLIC SvxLanguageBox : public ListBox, public SvxLanguageBoxBase
{
public:
SvxLanguageBox( vcl::Window* pParent, WinBits nBits, bool bCheck = false );
- virtual ~SvxLanguageBox();
private:
SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ) SAL_OVERRIDE;
@@ -143,7 +142,6 @@ class SVX_DLLPUBLIC SvxLanguageComboBox : public ComboBox, public SvxLanguageBox
{
public:
SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits, bool bCheck = false );
- virtual ~SvxLanguageComboBox();
enum EditedAndValid
{
diff --git a/include/svx/layctrl.hxx b/include/svx/layctrl.hxx
index 9652aea57322..05eaf5dec50d 100644
--- a/include/svx/layctrl.hxx
+++ b/include/svx/layctrl.hxx
@@ -31,7 +31,7 @@ private:
public:
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
virtual SfxPopupWindow* CreatePopupWindowCascading() SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID,
SfxItemState eState,
@@ -50,7 +50,7 @@ class SVX_DLLPUBLIC SvxColumnsToolBoxControl : public SfxToolBoxControl
bool bEnabled;
public:
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
virtual SfxPopupWindow* CreatePopupWindowCascading() SAL_OVERRIDE;
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/include/svx/lboxctrl.hxx b/include/svx/lboxctrl.hxx
index 30a21b37f71a..fe3062d18a40 100644
--- a/include/svx/lboxctrl.hxx
+++ b/include/svx/lboxctrl.hxx
@@ -34,7 +34,7 @@ class SvxListBoxControl : public SfxToolBoxControl
{
protected:
OUString aActionStr;
- SvxPopupWindowListBox * pPopupWin;
+ VclPtr<SvxPopupWindowListBox> pPopupWin;
void Impl_SetInfo( sal_uInt16 nCount );
@@ -46,7 +46,7 @@ public:
virtual ~SvxListBoxControl();
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;
@@ -69,7 +69,7 @@ public:
SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
#endif
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index 1c3a90ee50ca..a6576387bef5 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -52,7 +52,7 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
void Update( const SfxPoolItem* pState );
- virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
};
@@ -69,7 +69,7 @@ public:
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;
};
@@ -82,7 +82,7 @@ class SvxLineEndWindow : public SfxPopupWindow
private:
XLineEndListRef pLineEndList;
- ValueSet aLineEndSet;
+ VclPtr<ValueSet> aLineEndSet;
sal_uInt16 nCols;
sal_uInt16 nLines;
sal_uIntPtr nLineEndWidth;
@@ -118,12 +118,13 @@ public:
vcl::Window* pParentWindow,
const OUString& rWndTitle );
virtual ~SvxLineEndWindow();
+ virtual void dispose() SAL_OVERRIDE;
void StartSelection();
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
- virtual SfxPopupWindow* Clone() const SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
};
@@ -140,7 +141,7 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
diff --git a/include/svx/linkwarn.hxx b/include/svx/linkwarn.hxx
index 8fc66afffb18..b832637fc8b9 100644
--- a/include/svx/linkwarn.hxx
+++ b/include/svx/linkwarn.hxx
@@ -27,11 +27,12 @@
class SVX_DLLPUBLIC SvxLinkWarningDialog : public MessageDialog
{
private:
- CheckBox* m_pWarningOnBox;
+ VclPtr<CheckBox> m_pWarningOnBox;
public:
SvxLinkWarningDialog(vcl::Window* pParent, const OUString& _rFileName);
virtual ~SvxLinkWarningDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif // INCLUDED_SVX_LINKWARN_HXX
diff --git a/include/svx/measctrl.hxx b/include/svx/measctrl.hxx
index 83161ca627ed..4753ab17a671 100644
--- a/include/svx/measctrl.hxx
+++ b/include/svx/measctrl.hxx
@@ -43,6 +43,7 @@ private:
public:
SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle);
virtual ~SvxXMeasurePreview();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
diff --git a/include/svx/numvset.hxx b/include/svx/numvset.hxx
index f5e3781e6642..d4a13cb1d3b8 100644
--- a/include/svx/numvset.hxx
+++ b/include/svx/numvset.hxx
@@ -53,7 +53,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
sal_uInt16 nPageType;
bool bHTMLMode;
Rectangle aOrgRect;
- VirtualDevice* pVDev;
+ VclPtr<VirtualDevice> pVDev;
com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter;
com::sun::star::lang::Locale aLocale;
@@ -66,27 +66,26 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
com::sun::star::uno::Reference<
com::sun::star::container::XIndexAccess> > aOutlineSettings;
- public:
+public:
SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits = WB_TABSTOP);
void init(sal_uInt16 nType);
virtual ~SvxNumValueSet();
+ virtual void dispose() SAL_OVERRIDE;
virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
void SetHTMLMode(bool bSet) {bHTMLMode = bSet;}
void SetNumberingSettings(
- const com::sun::star::uno::Sequence<
- com::sun::star::uno::Sequence<
- com::sun::star::beans::PropertyValue> >& aNum,
- com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter,
- const com::sun::star::lang::Locale& rLocale );
+ const css::uno::Sequence<
+ css::uno::Sequence<css::beans::PropertyValue> >& aNum,
+ css::uno::Reference<css::text::XNumberingFormatter>& xFormatter,
+ const css::lang::Locale& rLocale );
void SetOutlineNumberingSettings(
- com::sun::star::uno::Sequence<
- com::sun::star::uno::Reference<
- com::sun::star::container::XIndexAccess> >& rOutline,
- com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter,
- const com::sun::star::lang::Locale& rLocale);
+ css::uno::Sequence<
+ css::uno::Reference<css::container::XIndexAccess> >& rOutline,
+ css::uno::Reference<css::text::XNumberingFormatter>& xFormatter,
+ const css::lang::Locale& rLocale);
};
class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet
@@ -96,7 +95,7 @@ class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet
void init();
- protected:
+protected:
DECL_LINK(FormatHdl_Impl, void *);
void SetGrfNotFound(bool bSet) {bGrfNotFound = bSet;}
@@ -104,9 +103,10 @@ class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet
Idle& GetFormatIdle() {return aFormatIdle;}
- public:
+public:
SvxBmpNumValueSet(vcl::Window* pParent, WinBits nWinBits = WB_TABSTOP);
virtual ~SvxBmpNumValueSet();
+ virtual void dispose() SAL_OVERRIDE;
virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
diff --git a/include/svx/optgrid.hxx b/include/svx/optgrid.hxx
index 02c74ca42b05..9aeee8d1c8c1 100644
--- a/include/svx/optgrid.hxx
+++ b/include/svx/optgrid.hxx
@@ -101,8 +101,10 @@ class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
public:
SvxGridTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxGridTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet& rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet& rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -111,30 +113,30 @@ public:
virtual sfxpg DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
private:
- CheckBox* pCbxUseGridsnap;
- CheckBox* pCbxGridVisible;
+ VclPtr<CheckBox> pCbxUseGridsnap;
+ VclPtr<CheckBox> pCbxGridVisible;
- MetricField* pMtrFldDrawX;
- MetricField* pMtrFldDrawY;
+ VclPtr<MetricField> pMtrFldDrawX;
+ VclPtr<MetricField> pMtrFldDrawY;
- NumericField* pNumFldDivisionX;
- NumericField* pNumFldDivisionY;
+ VclPtr<NumericField> pNumFldDivisionX;
+ VclPtr<NumericField> pNumFldDivisionY;
- CheckBox* pCbxSynchronize;
+ VclPtr<CheckBox> pCbxSynchronize;
protected:
//these controls are used in draw and impress
- VclContainer* pSnapFrames;
- CheckBox* pCbxSnapHelplines;
- CheckBox* pCbxSnapBorder;
- CheckBox* pCbxSnapFrame;
- CheckBox* pCbxSnapPoints;
- MetricField* pMtrFldSnapArea;
-
- CheckBox* pCbxOrtho;
- CheckBox* pCbxBigOrtho;
- CheckBox* pCbxRotate;
- MetricField* pMtrFldAngle;
- MetricField* pMtrFldBezAngle;
+ VclPtr<VclContainer> pSnapFrames;
+ VclPtr<CheckBox> pCbxSnapHelplines;
+ VclPtr<CheckBox> pCbxSnapBorder;
+ VclPtr<CheckBox> pCbxSnapFrame;
+ VclPtr<CheckBox> pCbxSnapPoints;
+ VclPtr<MetricField> pMtrFldSnapArea;
+
+ VclPtr<CheckBox> pCbxOrtho;
+ VclPtr<CheckBox> pCbxBigOrtho;
+ VclPtr<CheckBox> pCbxRotate;
+ VclPtr<MetricField> pMtrFldAngle;
+ VclPtr<MetricField> pMtrFldBezAngle;
private:
bool bAttrModified;
diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx
index 8b6da4dd29f0..007d4caf5634 100644
--- a/include/svx/pagectrl.hxx
+++ b/include/svx/pagectrl.hxx
@@ -89,6 +89,7 @@ protected:
public:
SvxPageWindow( vcl::Window* pParent );
virtual ~SvxPageWindow();
+ virtual void dispose() SAL_OVERRIDE;
//UUUU
void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maHeaderFillAttributes = rFillAttributes; }
diff --git a/include/svx/passwd.hxx b/include/svx/passwd.hxx
index 920fa19c7c68..89fbbded5221 100644
--- a/include/svx/passwd.hxx
+++ b/include/svx/passwd.hxx
@@ -33,12 +33,12 @@
class SVX_DLLPUBLIC SvxPasswordDialog : public SfxModalDialog
{
private:
- FixedText* m_pOldFL;
- FixedText* m_pOldPasswdFT;
- Edit* m_pOldPasswdED;
- Edit* m_pNewPasswdED;
- Edit* m_pRepeatPasswdED;
- OKButton* m_pOKBtn;
+ VclPtr<FixedText> m_pOldFL;
+ VclPtr<FixedText> m_pOldPasswdFT;
+ VclPtr<Edit> m_pOldPasswdED;
+ VclPtr<Edit> m_pNewPasswdED;
+ VclPtr<Edit> m_pRepeatPasswdED;
+ VclPtr<OKButton> m_pOKBtn;
OUString aOldPasswdErrStr;
OUString aRepeatPasswdErrStr;
@@ -52,7 +52,8 @@ private:
public:
SvxPasswordDialog( vcl::Window* pParent, bool bAllowEmptyPasswords = false, bool bDisableOldPassword = false );
- virtual ~SvxPasswordDialog();
+ virtual ~SvxPasswordDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetOldPassword() const { return m_pOldPasswdED->GetText(); }
OUString GetNewPassword() const { return m_pNewPasswdED->GetText(); }
diff --git a/include/svx/prtqry.hxx b/include/svx/prtqry.hxx
index afe6b9b6d85a..a2f4e9298262 100644
--- a/include/svx/prtqry.hxx
+++ b/include/svx/prtqry.hxx
@@ -26,7 +26,6 @@ class SVX_DLLPUBLIC SvxPrtQryBox : public MessBox
{
public:
SvxPrtQryBox(vcl::Window* pParent);
- virtual ~SvxPrtQryBox();
};
#endif
diff --git a/include/svx/rubydialog.hxx b/include/svx/rubydialog.hxx
index d0e9429501a2..4ea04bcd041d 100644
--- a/include/svx/rubydialog.hxx
+++ b/include/svx/rubydialog.hxx
@@ -44,10 +44,12 @@ class RubyPreview : public vcl::Window
{
protected:
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
- SvxRubyDialog* m_pParentDlg;
+ VclPtr<SvxRubyDialog> m_pParentDlg;
public:
RubyPreview(vcl::Window *pParent);
+ virtual ~RubyPreview();
+ virtual void dispose() SAL_OVERRIDE;
void setRubyDialog(SvxRubyDialog* pParentDlg)
{
m_pParentDlg = pParentDlg;
@@ -89,33 +91,33 @@ class SvxRubyDialog : public SfxModelessDialog
{
friend class RubyPreview;
- FixedText* m_pLeftFT;
- FixedText* m_pRightFT;
- RubyEdit* m_pLeft1ED;
- RubyEdit* m_pRight1ED;
- RubyEdit* m_pLeft2ED;
- RubyEdit* m_pRight2ED;
- RubyEdit* m_pLeft3ED;
- RubyEdit* m_pRight3ED;
- RubyEdit* m_pLeft4ED;
- RubyEdit* m_pRight4ED;
+ VclPtr<FixedText> m_pLeftFT;
+ VclPtr<FixedText> m_pRightFT;
+ VclPtr<RubyEdit> m_pLeft1ED;
+ VclPtr<RubyEdit> m_pRight1ED;
+ VclPtr<RubyEdit> m_pLeft2ED;
+ VclPtr<RubyEdit> m_pRight2ED;
+ VclPtr<RubyEdit> m_pLeft3ED;
+ VclPtr<RubyEdit> m_pRight3ED;
+ VclPtr<RubyEdit> m_pLeft4ED;
+ VclPtr<RubyEdit> m_pRight4ED;
- RubyEdit* aEditArr[8];
- VclScrolledWindow* m_pScrolledWindow;
- ScrollBar* m_pScrollSB;
+ VclPtr<RubyEdit> aEditArr[8];
+ VclPtr<VclScrolledWindow> m_pScrolledWindow;
+ VclPtr<ScrollBar> m_pScrollSB;
- ListBox* m_pAdjustLB;
+ VclPtr<ListBox> m_pAdjustLB;
- ListBox* m_pPositionLB;
+ VclPtr<ListBox> m_pPositionLB;
- FixedText* m_pCharStyleFT;
- ListBox* m_pCharStyleLB;
- PushButton* m_pStylistPB;
+ VclPtr<FixedText> m_pCharStyleFT;
+ VclPtr<ListBox> m_pCharStyleLB;
+ VclPtr<PushButton> m_pStylistPB;
- RubyPreview* m_pPreviewWin;
+ VclPtr<RubyPreview> m_pPreviewWin;
- PushButton* m_pApplyPB;
- PushButton* m_pClosePB;
+ VclPtr<PushButton> m_pApplyPB;
+ VclPtr<PushButton> m_pClosePB;
long nLastPos;
long nCurrentEdit;
@@ -143,7 +145,7 @@ class SvxRubyDialog : public SfxModelessDialog
void AssertOneEntry();
void Update();
- virtual bool Close() SAL_OVERRIDE;
+ virtual bool Close() SAL_OVERRIDE;
long GetLastPos() const {return nLastPos;}
void SetLastPos(long nSet) {nLastPos = nSet;}
@@ -163,6 +165,7 @@ public:
SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW,
vcl::Window* pParent);
virtual ~SvxRubyDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Activate() SAL_OVERRIDE;
virtual void Deactivate() SAL_OVERRIDE;
diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx
index 2cef64f3691d..007f4d89c378 100644
--- a/include/svx/ruler.hxx
+++ b/include/svx/ruler.hxx
@@ -57,7 +57,7 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
std::unique_ptr<SvxColumnItem> mxColumnItem; // columns
std::unique_ptr<SvxObjectItem> mxObjectItem; // object
- vcl::Window* pEditWin;
+ VclPtr<vcl::Window> pEditWin;
std::unique_ptr<SvxRuler_Impl> mxRulerImpl;
@@ -254,6 +254,7 @@ public:
SvxRuler(vcl::Window* pParent, vcl::Window *pEditWin, sal_uInt16 nRulerFlags,
SfxBindings &rBindings, WinBits nWinStyle = WB_STDRULER);
virtual ~SvxRuler();
+ virtual void dispose() SAL_OVERRIDE;
void SetMinFrameSize(long lSize);
long GetMinFrameSize() const ;
diff --git a/include/svx/sdrpaintwindow.hxx b/include/svx/sdrpaintwindow.hxx
index 3a1f1ef7f986..d8f091885c95 100644
--- a/include/svx/sdrpaintwindow.hxx
+++ b/include/svx/sdrpaintwindow.hxx
@@ -50,10 +50,10 @@ PaintTransparentChildren(vcl::Window & rWindow, Rectangle const& rPixelRect);
class SdrPreRenderDevice
{
// The original OutputDevice
- OutputDevice& mrOutputDevice;
+ OutputDevice& mrOutputDevice;
// The VirtualDevice for PreRendering
- VirtualDevice maPreRenderDevice;
+ VclPtr<VirtualDevice> mpPreRenderDevice;
public:
explicit SdrPreRenderDevice(OutputDevice& rOriginal);
@@ -63,7 +63,7 @@ public:
void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; }
- OutputDevice& GetPreRenderDevice() { return maPreRenderDevice; }
+ OutputDevice& GetPreRenderDevice() { return *mpPreRenderDevice.get(); }
};
diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx
index 6eac3d3eef90..82790a402e62 100644
--- a/include/svx/sidebar/PanelLayout.hxx
+++ b/include/svx/sidebar/PanelLayout.hxx
@@ -16,6 +16,7 @@
#include <vcl/ctrl.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
+#include <vcl/vclptr.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XFrame.hpp>
@@ -34,6 +35,7 @@ public:
PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame);
virtual ~PanelLayout();
+ virtual void dispose() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL) SAL_OVERRIDE;
diff --git a/include/svx/sidebar/Popup.hxx b/include/svx/sidebar/Popup.hxx
index 7f0d804f78c2..4fd74d14db8a 100644
--- a/include/svx/sidebar/Popup.hxx
+++ b/include/svx/sidebar/Popup.hxx
@@ -22,6 +22,9 @@
#include <svx/svxdllapi.h>
#include <rtl/ustring.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
+#include <svx/sidebar/PopupContainer.hxx>
+#include <svx/sidebar/PopupControl.hxx>
#include <boost/function.hpp>
@@ -30,9 +33,6 @@ class ToolBox;
namespace svx { namespace sidebar {
-class PopupContainer;
-class PopupControl;
-
/** A wrapper around a PopupContainer and a PopupControl object.
Usually used as drop down for a toolbox. Use Show() to start
drop down mode and Hide() to end it.
@@ -76,7 +76,7 @@ public :
void SetPopupModeEndHandler (const ::boost::function<void()>& rCallback);
protected:
- std::unique_ptr<PopupControl> mxControl;
+ VclPtr<PopupControl> mxControl;
/** Make sure that both PopupContainer and PopupControl objects
exist. Calls the maControlCreator functor if necessary.
@@ -89,11 +89,11 @@ protected:
void CreateContainerAndControl();
private:
- vcl::Window* mpParent;
- ::boost::function<PopupControl*(PopupContainer*)> maControlCreator;
+ VclPtr<vcl::Window> mpParent;
+ ::boost::function<VclPtr<PopupControl>(PopupContainer*)> maControlCreator;
::boost::function<void()> maPopupModeEndCallback;
const ::rtl::OUString msAccessibleName;
- std::unique_ptr<PopupContainer> mxContainer;
+ VclPtr<PopupContainer> mxContainer;
DECL_LINK(PopupModeEndHandler, void*);
};
diff --git a/include/svx/sidebar/PopupControl.hxx b/include/svx/sidebar/PopupControl.hxx
index 32658b3ae4d7..626e7074501d 100644
--- a/include/svx/sidebar/PopupControl.hxx
+++ b/include/svx/sidebar/PopupControl.hxx
@@ -38,7 +38,6 @@ public :
PopupControl (
vcl::Window* pParent,
const ResId& rResId);
- virtual ~PopupControl();
virtual void Paint (const Rectangle& rect) SAL_OVERRIDE;
};
diff --git a/include/svx/sidebar/SidebarDialControl.hxx b/include/svx/sidebar/SidebarDialControl.hxx
index 1d829d27fe76..52d798e2ab89 100644
--- a/include/svx/sidebar/SidebarDialControl.hxx
+++ b/include/svx/sidebar/SidebarDialControl.hxx
@@ -29,7 +29,6 @@ class SVX_DLLPUBLIC SidebarDialControl : public svx::DialControl
{
public:
SidebarDialControl (vcl::Window* pParent, WinBits nBits = 0);
- virtual ~SidebarDialControl();
virtual Size GetOptimalSize() const SAL_OVERRIDE;
virtual void MouseButtonDown (const MouseEvent& rMEvt) SAL_OVERRIDE;
diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx
index e6724b278c9c..e0c941d19645 100644
--- a/include/svx/sidebar/ValueSetWithTextControl.hxx
+++ b/include/svx/sidebar/ValueSetWithTextControl.hxx
@@ -52,8 +52,6 @@ public:
vcl::Window* pParent,
const ResId& rResId);
- virtual ~ValueSetWithTextControl();
-
// add item for control type IMAGE_TEXT
// if control type does not match IMAGE_TEXT no item is added.
// @param pSelectedItemImage
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 5750ca0857da..ec241902877b 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -89,7 +89,7 @@ enum SearchLabel
class SvxSearchDialog;
class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow
{
- SvxSearchDialog *dialog;
+ VclPtr<SvxSearchDialog> dialog;
public:
SvxSearchDialogWrapper( vcl::Window*pParent, sal_uInt16 nId,
SfxBindings* pBindings, SfxChildWinInfo* pInfo );
@@ -120,6 +120,7 @@ friend class SvxJSearchOptionsDialog;
public:
SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
virtual ~SvxSearchDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
@@ -150,57 +151,57 @@ public:
void SetSearchLabel(const OUString& rStr) { m_pSearchLabel->SetText(rStr); }
private:
- vcl::Window* mpDocWin;
+ VclPtr<vcl::Window> mpDocWin;
bool mbSuccess;
- VclFrame* m_pSearchFrame;
- ComboBox* m_pSearchLB;
- ListBox* m_pSearchTmplLB;
- FixedText* m_pSearchAttrText;
- FixedText* m_pSearchLabel;
-
- VclFrame* m_pReplaceFrame;
- ComboBox* m_pReplaceLB;
- ListBox* m_pReplaceTmplLB;
- FixedText* m_pReplaceAttrText;
-
- PushButton* m_pSearchBtn;
- PushButton* m_pSearchAllBtn;
- PushButton* m_pReplaceBtn;
- PushButton* m_pReplaceAllBtn;
-
- VclFrame* m_pComponentFrame;
- PushButton* m_pSearchComponent1PB;
- PushButton* m_pSearchComponent2PB;
-
- CheckBox* m_pMatchCaseCB;
- CheckBox* m_pWordBtn;
-
- PushButton* m_pCloseBtn;
- CheckBox* m_pIgnoreDiacritics;
- CheckBox* m_pIgnoreKashida;
- CheckBox* m_pSelectionBtn;
- CheckBox* m_pBackwardsBtn;
- CheckBox* m_pRegExpBtn;
- CheckBox* m_pSimilarityBox;
- PushButton* m_pSimilarityBtn;
- CheckBox* m_pLayoutBtn;
- CheckBox* m_pNotesBtn;
- CheckBox* m_pJapMatchFullHalfWidthCB;
- CheckBox* m_pJapOptionsCB;
- PushButton* m_pJapOptionsBtn;
-
- PushButton* m_pAttributeBtn;
- PushButton* m_pFormatBtn;
- PushButton* m_pNoFormatBtn;
-
- VclContainer* m_pCalcGrid;
- FixedText* m_pCalcSearchInFT;
- ListBox* m_pCalcSearchInLB;
- FixedText* m_pCalcSearchDirFT;
- RadioButton* m_pRowsBtn;
- RadioButton* m_pColumnsBtn;
- CheckBox* m_pAllSheetsCB;
+ VclPtr<VclFrame> m_pSearchFrame;
+ VclPtr<ComboBox> m_pSearchLB;
+ VclPtr<ListBox> m_pSearchTmplLB;
+ VclPtr<FixedText> m_pSearchAttrText;
+ VclPtr<FixedText> m_pSearchLabel;
+
+ VclPtr<VclFrame> m_pReplaceFrame;
+ VclPtr<ComboBox> m_pReplaceLB;
+ VclPtr<ListBox> m_pReplaceTmplLB;
+ VclPtr<FixedText> m_pReplaceAttrText;
+
+ VclPtr<PushButton> m_pSearchBtn;
+ VclPtr<PushButton> m_pSearchAllBtn;
+ VclPtr<PushButton> m_pReplaceBtn;
+ VclPtr<PushButton> m_pReplaceAllBtn;
+
+ VclPtr<VclFrame> m_pComponentFrame;
+ VclPtr<PushButton> m_pSearchComponent1PB;
+ VclPtr<PushButton> m_pSearchComponent2PB;
+
+ VclPtr<CheckBox> m_pMatchCaseCB;
+ VclPtr<CheckBox> m_pWordBtn;
+
+ VclPtr<PushButton> m_pCloseBtn;
+ VclPtr<CheckBox> m_pIgnoreDiacritics;
+ VclPtr<CheckBox> m_pIgnoreKashida;
+ VclPtr<CheckBox> m_pSelectionBtn;
+ VclPtr<CheckBox> m_pBackwardsBtn;
+ VclPtr<CheckBox> m_pRegExpBtn;
+ VclPtr<CheckBox> m_pSimilarityBox;
+ VclPtr<PushButton> m_pSimilarityBtn;
+ VclPtr<CheckBox> m_pLayoutBtn;
+ VclPtr<CheckBox> m_pNotesBtn;
+ VclPtr<CheckBox> m_pJapMatchFullHalfWidthCB;
+ VclPtr<CheckBox> m_pJapOptionsCB;
+ VclPtr<PushButton> m_pJapOptionsBtn;
+
+ VclPtr<PushButton> m_pAttributeBtn;
+ VclPtr<PushButton> m_pFormatBtn;
+ VclPtr<PushButton> m_pNoFormatBtn;
+
+ VclPtr<VclContainer> m_pCalcGrid;
+ VclPtr<FixedText> m_pCalcSearchInFT;
+ VclPtr<ListBox> m_pCalcSearchInLB;
+ VclPtr<FixedText> m_pCalcSearchDirFT;
+ VclPtr<RadioButton> m_pRowsBtn;
+ VclPtr<RadioButton> m_pColumnsBtn;
+ VclPtr<CheckBox> m_pAllSheetsCB;
SfxBindings& rBindings;
bool bWriter;
diff --git a/include/svx/stddlg.hxx b/include/svx/stddlg.hxx
index 85cdf46c5b52..a3e3df05f628 100644
--- a/include/svx/stddlg.hxx
+++ b/include/svx/stddlg.hxx
@@ -28,7 +28,6 @@ class SVX_DLLPUBLIC SvxStandardDialog: public SfxModalDialog
{
public:
SvxStandardDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription );
- virtual ~SvxStandardDialog();
short Execute() SAL_OVERRIDE;
diff --git a/include/svx/subtoolboxcontrol.hxx b/include/svx/subtoolboxcontrol.hxx
index e7f2904a456f..7921a270f405 100644
--- a/include/svx/subtoolboxcontrol.hxx
+++ b/include/svx/subtoolboxcontrol.hxx
@@ -36,7 +36,7 @@ public:
virtual ~SvxSubToolBoxControl();
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 08231959c61f..ed0ce097989c 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -65,12 +65,12 @@ protected:
SdrPageView* pTextEditPV;
SdrOutliner* pTextEditOutliner; // outliner for the TextEdit
OutlinerView* pTextEditOutlinerView; // current view of the outliners
- vcl::Window* pTextEditWin; // matching window to pTextEditOutlinerView
+ VclPtr<vcl::Window> pTextEditWin; // matching window to pTextEditOutlinerView
vcl::Cursor* pTextEditCursorMerker; // to restore the cursor in each window
ImpSdrEditPara* pEditPara; // trashbin for everything else to stay compatible
SdrObject* pMacroObj;
SdrPageView* pMacroPV;
- vcl::Window* pMacroWin;
+ VclPtr<vcl::Window> pMacroWin;
Rectangle aTextEditArea;
Rectangle aMinTextEditArea;
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 917182aface2..ea9e4c222919 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -170,7 +170,7 @@ protected:
SdrOutliner* pDrawOutliner; // an Outliner for outputting text
SdrOutliner* pHitTestOutliner;// an Outliner for the HitTest
sal_uIntPtr nDefTextHgt; // Default text heigth in logical units
- OutputDevice* pRefOutDev; // ReferenceDevice for the EditEngine
+ VclPtr<OutputDevice> pRefOutDev; // ReferenceDevice for the EditEngine
/// Set if we are doing tiled rendering.
bool mbTiledRendering;
LibreOfficeKitCallback mpLibreOfficeKitCallback;
@@ -335,7 +335,7 @@ public:
// ReferenceDevice for the EditEngine
void SetRefDevice(OutputDevice* pDev);
- OutputDevice* GetRefDevice() const { return pRefOutDev; }
+ OutputDevice* GetRefDevice() const { return pRefOutDev.get(); }
/// Set if we are doing tiled rendering.
void setTiledRendering(bool bTiledRendering);
/// Are we doing tiled rendering?
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index ffa7f29ea5fb..74b5a18ee290 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <cppuhelper/weakref.hxx>
#include <rtl/ustring.hxx>
+#include <vcl/vclptr.hxx>
#include <svl/lstner.hxx>
#include <svl/poolitem.hxx>
#include <svx/svdtypes.hxx>
@@ -174,7 +175,7 @@ class SVX_DLLPUBLIC SdrObjMacroHitRec
public:
Point aPos;
Point aDownPos;
- OutputDevice* pOut;
+ VclPtr<OutputDevice> pOut;
const SetOfByte* pVisiLayer;
const SdrPageView* pPageView;
sal_uInt16 nTol;
diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx
index f228a1c308f1..cdb2ea62c7ba 100644
--- a/include/svx/svdpntv.hxx
+++ b/include/svx/svdpntv.hxx
@@ -134,10 +134,10 @@ class SVX_DLLPUBLIC SdrPaintView : public SfxListener, public SfxRepeatTarget, p
protected:
SdrModel* pMod;
#ifdef DBG_UTIL
- SdrItemBrowser* pItemBrowser;
+ VclPtr<SdrItemBrowser> pItemBrowser;
#endif
- const OutputDevice* pActualOutDev; // Nur zum vergleichen
- OutputDevice* pDragWin;
+ VclPtr<OutputDevice> pActualOutDev; // Nur zum vergleichen
+ VclPtr<OutputDevice> pDragWin;
SfxStyleSheet* pDefaultStyleSheet;
OUString aAktLayer; // Aktueller Zeichenlayer
@@ -517,7 +517,7 @@ public:
// bei bShow=sal_False wird der Browser destruiert
#ifdef DBG_UTIL
void ShowItemBrowser(bool bShow=true);
- bool IsItemBrowserVisible() const { return pItemBrowser!=NULL && GetItemBrowser()->IsVisible(); }
+ bool IsItemBrowserVisible() const { return pItemBrowser!=nullptr && GetItemBrowser()->IsVisible(); }
vcl::Window* GetItemBrowser() const;
#endif
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 080c807aa562..87ada7aa6c11 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -42,8 +42,8 @@ namespace linguistic2{
}}}}
class SvxSpellWrapper;
-typedef SfxTabPage* (*CreateSvxDistributePage)(vcl::Window *pParent, const SfxItemSet &rAttrSet, SvxDistributeHorizontal eHor, SvxDistributeVertical eVer);
-typedef const sal_uInt16* (*DialogGetRanges)();
+typedef VclPtr<SfxTabPage> (*CreateSvxDistributePage)(vcl::Window *pParent, const SfxItemSet &rAttrSet, SvxDistributeHorizontal eHor, SvxDistributeVertical eVer);
+typedef const sal_uInt16* (*DialogGetRanges)();
struct ExchangeData;
class INetURLObject;
diff --git a/include/svx/swframeexample.hxx b/include/svx/swframeexample.hxx
index 45bb9098c83a..494c241f74e9 100644
--- a/include/svx/swframeexample.hxx
+++ b/include/svx/swframeexample.hxx
@@ -74,7 +74,6 @@ protected:
public:
SvxSwFrameExample(vcl::Window* pParent, WinBits nStyle);
- virtual ~SvxSwFrameExample();
inline void SetWrap(sal_uInt16 nW) { nWrap = nW; }
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 329bb208145b..42c79454ee20 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -163,7 +163,7 @@ public:
SvxStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
virtual ~SvxStyleToolBoxControl();
- virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState) SAL_OVERRIDE;
@@ -210,7 +210,7 @@ public:
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 BorderColorStatus
@@ -242,7 +242,7 @@ public:
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState) SAL_OVERRIDE;
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
};
@@ -253,7 +253,7 @@ public:
SvxFrameToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
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;
};
@@ -265,7 +265,7 @@ public:
SvxFrameLineStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
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/include/svx/tbxalign.hxx b/include/svx/tbxalign.hxx
index 00a98d1eaf80..71322ee67bcf 100644
--- a/include/svx/tbxalign.hxx
+++ b/include/svx/tbxalign.hxx
@@ -32,7 +32,7 @@ public:
virtual void SAL_CALL updateImage() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/include/svx/tbxcolorupdate.hxx b/include/svx/tbxcolorupdate.hxx
index 343d0fe768f5..9f00d1386a64 100644
--- a/include/svx/tbxcolorupdate.hxx
+++ b/include/svx/tbxcolorupdate.hxx
@@ -24,6 +24,7 @@
#include <tools/gen.hxx>
#include <tools/color.hxx>
+#include <vcl/vclptr.hxx>
class ToolBox;
class VirtualDevice;
@@ -44,8 +45,8 @@ namespace svx
{
public:
ToolboxButtonColorUpdater( sal_uInt16 nSlotId,
- sal_uInt16 nTbxBtnId,
- ToolBox* ptrTbx);
+ sal_uInt16 nTbxBtnId,
+ ToolBox* ptrTbx);
~ToolboxButtonColorUpdater();
void Update( const Color& rColor );
@@ -53,7 +54,7 @@ namespace svx
private:
sal_uInt16 mnBtnId;
sal_uInt16 mnSlotId;
- ToolBox* mpTbx;
+ VclPtr<ToolBox> mpTbx;
Color maCurColor;
Rectangle maUpdRect;
Size maBmpSize;
diff --git a/include/svx/tbxcustomshapes.hxx b/include/svx/tbxcustomshapes.hxx
index c4ebc1b5dd9f..2be1ac8807c9 100644
--- a/include/svx/tbxcustomshapes.hxx
+++ b/include/svx/tbxcustomshapes.hxx
@@ -35,7 +35,7 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/include/svx/txencbox.hxx b/include/svx/txencbox.hxx
index e0df5adeef38..43f028bcaae7 100644
--- a/include/svx/txencbox.hxx
+++ b/include/svx/txencbox.hxx
@@ -35,6 +35,7 @@ private:
public:
SvxTextEncodingBox( vcl::Window* pParent, WinBits nBits );
virtual ~SvxTextEncodingBox();
+ virtual void dispose() SAL_OVERRIDE;
/** Fill with all known encodings but exclude those matching one or more
given flags as defined in rtl/tencinfo.h
diff --git a/include/toolkit/awt/scrollabledialog.hxx b/include/toolkit/awt/scrollabledialog.hxx
index e75fac70b0ed..70e2b32be919 100644
--- a/include/toolkit/awt/scrollabledialog.hxx
+++ b/include/toolkit/awt/scrollabledialog.hxx
@@ -43,8 +43,8 @@ namespace toolkit
template < class T >
class ScrollableWrapper : public T, public ScrollableInterface
{
- ScrollBar maHScrollBar;
- ScrollBar maVScrollBar;
+ VclPtr<ScrollBar> maHScrollBar;
+ VclPtr<ScrollBar> maVScrollBar;
Size maScrollArea;
bool mbHasHoriBar;
bool mbHasVertBar;
@@ -59,6 +59,7 @@ namespace toolkit
public:
ScrollableWrapper( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
virtual ~ScrollableWrapper();
+ virtual void dispose() SAL_OVERRIDE;
virtual void SetScrollWidth( long nWidth ) SAL_OVERRIDE;
virtual long GetScrollWidth() SAL_OVERRIDE { return maScrollArea.Width(); }
virtual void SetScrollHeight( long nHeight ) SAL_OVERRIDE;
diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx
index 62d167ba10f1..0fdc2a8f083f 100644
--- a/include/toolkit/awt/vclxaccessiblecomponent.hxx
+++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx
@@ -33,6 +33,7 @@
#include <comphelper/accessiblecomponenthelper.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
class VCLXWindow;
@@ -83,7 +84,11 @@ public:
virtual ~VCLXAccessibleComponent();
VCLXWindow* GetVCLXWindow() const { return mpVCLXindow; }
- vcl::Window* GetWindow() const;
+ VclPtr<vcl::Window> GetWindow() const;
+ template< class derived_type > VclPtr< derived_type > GetAs() const {
+ return VclPtr< derived_type >( static_cast< derived_type * >( GetWindow().get() ) ); }
+ template< class derived_type > VclPtr< derived_type > GetAsDynamic() const {
+ return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetWindow().get() ) ); }
virtual void SAL_CALL disposing() SAL_OVERRIDE;
diff --git a/include/toolkit/awt/vclxdevice.hxx b/include/toolkit/awt/vclxdevice.hxx
index 61d568911b38..47a99ea1995e 100644
--- a/include/toolkit/awt/vclxdevice.hxx
+++ b/include/toolkit/awt/vclxdevice.hxx
@@ -27,43 +27,40 @@
#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/vclptr.hxx>
#include <com/sun/star/awt/XUnitConversion.hpp>
class OutputDevice;
class VirtualDevice;
-
-// class VCLXDevice
-
-
// For using nDummy, no incompatible update, add a sal_Bool bCreatedWithToolkitMember later...
#define FLAGS_CREATEDWITHTOOLKIT 0x00000001
-class TOOLKIT_DLLPUBLIC VCLXDevice : public ::com::sun::star::awt::XDevice,
+/// An UNO wrapper for the VCL OutputDevice
+class TOOLKIT_DLLPUBLIC VCLXDevice :
+ public ::com::sun::star::awt::XDevice,
public ::com::sun::star::lang::XTypeProvider,
public ::com::sun::star::lang::XUnoTunnel,
public ::com::sun::star::awt::XUnitConversion,
public ::cppu::OWeakObject
{
friend class VCLXGraphics;
+ friend class VCLXVirtualDevice;
private:
- OutputDevice* mpOutputDevice;
+ VclPtr<OutputDevice> mpOutputDevice;
public:
void* pDummy;
sal_uInt32 nFlags;
-protected:
- void DestroyOutputDevice();
-
public:
VCLXDevice();
virtual ~VCLXDevice();
- void SetOutputDevice( OutputDevice* pOutDev ) { mpOutputDevice = pOutDev; }
- OutputDevice* GetOutputDevice() const { return mpOutputDevice; }
+ void SetOutputDevice( const VclPtr<OutputDevice> &pOutDev ) { mpOutputDevice = pOutDev; }
+ VclPtr<OutputDevice> GetOutputDevice() const { return mpOutputDevice; }
void SetCreatedWithToolkit( bool bCreatedWithToolkit );
diff --git a/include/toolkit/awt/vclxgraphics.hxx b/include/toolkit/awt/vclxgraphics.hxx
index 627b6759f43b..89a568fe6fa9 100644
--- a/include/toolkit/awt/vclxgraphics.hxx
+++ b/include/toolkit/awt/vclxgraphics.hxx
@@ -31,6 +31,7 @@
#include <vcl/font.hxx>
#include <tools/color.hxx>
#include <vcl/vclenum.hxx>
+#include <vcl/vclptr.hxx>
class OutputDevice;
namespace vcl { class Region; }
@@ -55,7 +56,7 @@ private:
// used to return same reference on each call to getDevice()
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice> mxDevice;
- OutputDevice* mpOutputDevice;
+ VclPtr<OutputDevice> mpOutputDevice;
vcl::Font maFont;
Color maTextColor;
Color maTextFillColor;
diff --git a/include/toolkit/awt/vclxprinter.hxx b/include/toolkit/awt/vclxprinter.hxx
index 892cc4cb0839..a63f7746911d 100644
--- a/include/toolkit/awt/vclxprinter.hxx
+++ b/include/toolkit/awt/vclxprinter.hxx
@@ -57,11 +57,11 @@ class VCLXPrinterPropertySet :public VCLXPrinterPropertySet_Base
,public ::cppu::OPropertySetHelper
{
protected:
- std::shared_ptr<Printer> mxPrinter;
+ VclPtr<Printer> mxPrinter;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice;
sal_Int16 mnOrientation;
- bool mbHorizontal;
+ bool mbHorizontal;
public:
VCLXPrinterPropertySet( const OUString& rPrinterName );
virtual ~VCLXPrinterPropertySet();
diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx
index 6306ce6717e3..1ab1f9e8a8d2 100644
--- a/include/toolkit/awt/vclxwindow.hxx
+++ b/include/toolkit/awt/vclxwindow.hxx
@@ -128,8 +128,12 @@ public:
VCLXWindow( bool bWithDefaultProps = false );
virtual ~VCLXWindow();
- virtual void SetWindow( vcl::Window* pWindow );
- vcl::Window* GetWindow() const { return static_cast<vcl::Window*>(GetOutputDevice()); }
+ virtual void SetWindow( const VclPtr< vcl::Window > &pWindow );
+ template< class derived_type > VclPtr< derived_type > GetAs() const {
+ return VclPtr< derived_type >( static_cast< derived_type * >( GetOutputDevice().get() ) ); }
+ template< class derived_type > VclPtr< derived_type > GetAsDynamic() const {
+ return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetOutputDevice().get() ) ); }
+ VclPtr<vcl::Window> GetWindow() const { return GetAs<vcl::Window>(); }
void suspendVclEventListening( );
void resumeVclEventListening( );
diff --git a/include/toolkit/controls/accessiblecontrolcontext.hxx b/include/toolkit/controls/accessiblecontrolcontext.hxx
index 78fdfe7cc4d8..b991b80793f3 100644
--- a/include/toolkit/controls/accessiblecontrolcontext.hxx
+++ b/include/toolkit/controls/accessiblecontrolcontext.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XWindow.hpp>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
@@ -116,7 +117,7 @@ namespace toolkit
// stops listening at the control model
void stopModelListening( );
- vcl::Window* implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const;
+ VclPtr< vcl::Window > implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const;
};
diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx
index dc1ae888476f..c902e5c9155c 100644
--- a/include/toolkit/helper/vclunohelper.hxx
+++ b/include/toolkit/helper/vclunohelper.hxx
@@ -56,11 +56,12 @@ namespace com { namespace sun { namespace star { namespace awt {
#include <vcl/bitmapex.hxx>
#include <vcl/region.hxx>
#include <vcl/metric.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
#include <tools/mapunit.hxx>
#include <tools/fldunit.hxx>
#include <tools/poly.hxx>
-namespace vcl { class Window; }
class OutputDevice;
class MouseEvent;
class KeyEvent;
@@ -79,9 +80,9 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap );
// Window
- static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow );
- static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 );
- static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer );
+ static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow );
+ static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 );
+ static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer );
static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> GetInterface( vcl::Window* pWindow );
// OutputDevice
diff --git a/include/tools/errinf.hxx b/include/tools/errinf.hxx
index a16b56a179f4..4a9f07a69d62 100644
--- a/include/tools/errinf.hxx
+++ b/include/tools/errinf.hxx
@@ -28,9 +28,11 @@
#include <tools/errcode.hxx>
#include <tools/toolsdllapi.h>
+// FIXME: horrible legacy dependency on VCL from tools.
+namespace vcl { class Window; }
+
class EDcr_Impl;
class ErrHdl_Impl;
-namespace vcl { class Window; }
class ErrorInfo
{
@@ -115,20 +117,20 @@ private:
OUString aArg;
};
+struct ErrorContextImpl;
class TOOLS_DLLPUBLIC ErrorContext
{
friend class ErrorHandler;
private:
- ErrorContext* pNext;
- vcl::Window* pWin;
+ ErrorContextImpl *pImpl;
public:
ErrorContext(vcl::Window *pWin=0);
virtual ~ErrorContext();
virtual bool GetString( sal_uIntPtr nErrId, OUString& rCtxStr ) = 0;
- vcl::Window* GetParent() { return pWin; }
+ vcl::Window* GetParent();
static ErrorContext* GetContext();
};
diff --git a/include/vcl/animate.hxx b/include/vcl/animate.hxx
index e966e3feac81..17d62a1a3d1a 100644
--- a/include/vcl/animate.hxx
+++ b/include/vcl/animate.hxx
@@ -23,6 +23,7 @@
#include <vcl/dllapi.h>
#include <vcl/timer.hxx>
#include <vcl/bitmapex.hxx>
+#include <vcl/vclptr.hxx>
#define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
@@ -108,17 +109,13 @@ struct AInfo
Point aLastSavePoint;
Point aStartOrg;
Size aStartSize;
- OutputDevice* pOutDev;
+ VclPtr<OutputDevice> pOutDev;
void* pViewData;
long nExtraData;
bool bWithSize;
bool bPause;
- AInfo() : pOutDev( NULL ),
- pViewData( NULL ),
- nExtraData( 0L ),
- bWithSize( false ),
- bPause( false ) {}
+ AInfo();
};
class ImplAnimView;
diff --git a/include/vcl/btndlg.hxx b/include/vcl/btndlg.hxx
index fc51c15b95d1..c7fdab639d1b 100644
--- a/include/vcl/btndlg.hxx
+++ b/include/vcl/btndlg.hxx
@@ -40,6 +40,7 @@ class VCL_DLLPUBLIC ButtonDialog : public Dialog
public:
ButtonDialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
virtual ~ButtonDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 011d45e14399..4b7683d467ae 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -17,6 +17,7 @@
#include <tools/fldunit.hxx>
#include <vcl/dllapi.h>
#include <vcl/window.hxx>
+#include <vcl/vclptr.hxx>
#include <map>
#include <set>
#include <stack>
@@ -45,6 +46,7 @@ class VCL_DLLPUBLIC VclBuilder
{
public:
typedef std::map<OString, OString> stringmap;
+ /// These functions return a vcl::Window with a reference count of one.
typedef vcl::Window* (*customMakeWidget)(vcl::Window *pParent, stringmap &rVec);
public:
@@ -56,8 +58,11 @@ public:
const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
~VclBuilder();
+ ///releases references and disposes all children.
+ void disposeBuilder();
+
//sID must exist and be of type T
- template <typename T> T* get(T*& ret, const OString& sID);
+ template <typename T> T* get(VclPtr<T>& ret, const OString& sID);
//sID may not exist, but must be of type T if it does
template <typename T /*= vcl::Window if we had c++11*/> T* get(const OString& sID);
@@ -73,7 +78,7 @@ public:
short get_response(const vcl::Window *pWindow) const;
OString get_by_window(const vcl::Window *pWindow) const;
- void delete_by_window(const vcl::Window *pWindow);
+ void delete_by_window(vcl::Window *pWindow);
//release ownership of pWindow, i.e. don't delete it
void drop_ownership(const vcl::Window *pWindow);
@@ -147,7 +152,7 @@ private:
struct WinAndId
{
OString m_sID;
- vcl::Window *m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
short m_nResponseId;
PackingData m_aPackingData;
WinAndId(const OString &rId, vcl::Window *pWindow, bool bVertical)
@@ -263,7 +268,7 @@ private:
}
};
- typedef std::map< vcl::Window*, stringmap> AtkMap;
+ typedef std::map< VclPtr<vcl::Window>, stringmap> AtkMap;
struct ParserState
{
@@ -290,7 +295,7 @@ private:
Translations m_aTranslations;
- std::map< vcl::Window*, vcl::Window*> m_aRedundantParentWidgets;
+ std::map< VclPtr<vcl::Window>, VclPtr<vcl::Window> > m_aRedundantParentWidgets;
std::vector<SizeGroup> m_aSizeGroups;
@@ -298,13 +303,11 @@ private:
std::vector<MnemonicWidgetMap> m_aMnemonicWidgetMaps;
- std::vector<VclExpander*> m_aExpanderWidgets;
+ std::vector< VclPtr<VclExpander> > m_aExpanderWidgets;
sal_uInt16 m_nLastToolbarId;
- ParserState()
- : m_nLastToolbarId(0)
- {}
+ ParserState();
};
void loadTranslations(const LanguageTag &rLanguageTag, const OUString &rUri);
@@ -313,7 +316,7 @@ private:
OString m_sID;
OString m_sHelpRoot;
ResHookProc m_pStringReplace;
- vcl::Window *m_pParent;
+ VclPtr<vcl::Window> m_pParent;
bool m_bToplevelHasDeferredInit;
bool m_bToplevelHasDeferredProperties;
bool m_bToplevelParentFound;
@@ -339,12 +342,12 @@ private:
css::uno::Reference<css::frame::XFrame> m_xFrame;
private:
- vcl::Window *insertObject(vcl::Window *pParent,
+ VclPtr<vcl::Window> insertObject(vcl::Window *pParent,
const OString &rClass, const OString &rID,
stringmap &rProps, stringmap &rPangoAttributes,
stringmap &rAtkProps);
- vcl::Window *makeObject(vcl::Window *pParent,
+ VclPtr<vcl::Window> makeObject(vcl::Window *pParent,
const OString &rClass, const OString &rID,
stringmap &rVec);
@@ -363,7 +366,7 @@ private:
void handleTranslations(xmlreader::XmlReader &reader);
void handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader);
- vcl::Window* handleObject(vcl::Window *pParent, xmlreader::XmlReader &reader);
+ VclPtr<vcl::Window> handleObject(vcl::Window *pParent, xmlreader::XmlReader &reader);
void handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader);
void applyPackingProperty(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader);
void collectProperty(xmlreader::XmlReader &reader, const OString &rID, stringmap &rVec);
@@ -405,7 +408,7 @@ private:
};
template <typename T>
-inline T* VclBuilder::get(T*& ret, const OString& sID)
+inline T* VclBuilder::get(VclPtr<T>& ret, const OString& sID)
{
vcl::Window *w = get_by_name(sID);
SAL_WARN_IF(!w, "vcl.layout", "widget \"" << sID.getStr() << "\" not found in .ui");
@@ -414,7 +417,7 @@ inline T* VclBuilder::get(T*& ret, const OString& sID)
assert(w);
assert(dynamic_cast<T*>(w));
ret = static_cast<T*>(w);
- return ret;
+ return ret.get();
}
//sID may not exist, but must be of type T if it does
@@ -446,19 +449,24 @@ inline PopupMenu* VclBuilder::get_menu(PopupMenu*& ret, const OString& sID)
//
//i.e. class Dialog : public SystemWindow, public VclBuilderContainer
//not class Dialog : public VclBuilderContainer, public SystemWindow
+//
+//With the new 'dispose' framework, it is necessary to force the builder
+//dispose before the Window dispose; so a Dialog::dispose() method would
+//finish: disposeBuilder(); SystemWindow::dispose() to capture this ordering.
class VCL_DLLPUBLIC VclBuilderContainer
{
public:
VclBuilderContainer();
virtual ~VclBuilderContainer();
+ void disposeBuilder();
static OUString getUIRootDir();
bool hasBuilder() const { return m_pUIBuilder != NULL; }
css::uno::Reference<css::frame::XFrame> getFrame() { return m_pUIBuilder->getFrame(); }
- template <typename T> T* get(T*& ret, const OString& sID)
+ template <typename T> T* get(VclPtr<T>& ret, const OString& sID)
{
return m_pUIBuilder->get<T>(ret, sID);
}
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index 1a100c0f83dd..937c4ff75f48 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -28,7 +28,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/salnativewidgets.hxx>
#include <rsc/rsc-vcl-shared-types.hxx>
-
+#include <vcl/vclptr.hxx>
#include <vector>
class UserDrawEvent;
@@ -37,7 +37,7 @@ class ImplCommonButtonData;
class VCL_DLLPUBLIC Button : public Control
{
private:
- ImplCommonButtonData *mpButtonData;
+ std::unique_ptr<ImplCommonButtonData> mpButtonData;
Link maClickHdl;
/// Command URL (like .uno:Save) in case the button should handle it.
@@ -64,6 +64,7 @@ protected:
public:
virtual ~Button();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Click();
@@ -153,7 +154,6 @@ protected:
public:
explicit PushButton( vcl::Window* pParent, WinBits nStyle = 0 );
explicit PushButton( vcl::Window* pParent, const ResId& );
- virtual ~PushButton();
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
@@ -226,7 +226,6 @@ public:
virtual void Click() SAL_OVERRIDE;
};
-
class VCL_DLLPUBLIC CancelButton : public PushButton
{
protected:
@@ -275,7 +274,7 @@ public:
class VCL_DLLPUBLIC RadioButton : public Button
{
private:
- std::shared_ptr< std::vector<RadioButton*> > m_xGroup;
+ std::shared_ptr< std::vector< VclPtr< RadioButton > > > m_xGroup;
Rectangle maStateRect;
Rectangle maMouseRect;
Image maImage;
@@ -336,6 +335,7 @@ public:
explicit RadioButton( vcl::Window* pParent, WinBits nWinStyle = 0 );
explicit RadioButton( vcl::Window* pParent, const ResId& );
virtual ~RadioButton();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
@@ -389,7 +389,7 @@ public:
on return contains the <code>RadioButton</code>s
in the same group as this <code>RadioButton</code>.
*/
- std::vector<RadioButton*> GetRadioButtonGroup(bool bIncludeThis = true) const;
+ std::vector<VclPtr<RadioButton> > GetRadioButtonGroup(bool bIncludeThis = true) const;
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
@@ -518,9 +518,8 @@ private:
ImageButton & operator= ( const ImageButton & ) SAL_DELETED_FUNCTION;
public:
- ImageButton( vcl::Window* pParent, WinBits nStyle = 0 );
- ImageButton( vcl::Window* pParent, const ResId& rResId );
- virtual ~ImageButton();
+ ImageButton( vcl::Window* pParent, WinBits nStyle = 0 );
+ ImageButton( vcl::Window* pParent, const ResId& rResId );
};
class VCL_DLLPUBLIC ImageRadioButton : public RadioButton
@@ -530,7 +529,6 @@ class VCL_DLLPUBLIC ImageRadioButton : public RadioButton
public:
explicit ImageRadioButton( vcl::Window* pParent, WinBits nStyle = 0 );
- virtual ~ImageRadioButton();
};
class VCL_DLLPUBLIC TriStateBox : public CheckBox
@@ -540,7 +538,6 @@ class VCL_DLLPUBLIC TriStateBox : public CheckBox
public:
explicit TriStateBox( vcl::Window* pParent, WinBits nStyle = 0 );
- virtual ~TriStateBox();
};
class VCL_DLLPUBLIC DisclosureButton : public CheckBox
@@ -553,8 +550,6 @@ public:
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
};
-typedef rtl::Reference<DisclosureButton> DisclosureButtonPtr;
-
#endif // INCLUDED_VCL_BUTTON_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/cairo.hxx b/include/vcl/cairo.hxx
index c8cc23e802b3..13983a84d63f 100644
--- a/include/vcl/cairo.hxx
+++ b/include/vcl/cairo.hxx
@@ -22,6 +22,7 @@
#include <sal/config.h>
#include <boost/shared_ptr.hpp>
+#include <vcl/vclptr.hxx>
typedef struct _cairo_surface cairo_surface_t;
typedef struct _cairo cairo_t;
@@ -49,7 +50,7 @@ namespace cairo {
virtual boost::shared_ptr<Surface> getSimilar(int cairo_content_type, int width, int height) const = 0;
/// factory for VirDev on this surface
- virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const = 0;
+ virtual VclPtr<VirtualDevice> createVirtualDevice() const = 0;
/// Resize the surface (possibly destroying content), only possible for X11 typically
/// so on failure caller must create a new surface instead
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 95ec9bc9e215..a835a40d215f 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -32,23 +32,19 @@ class ImplListBoxFloatingWindow;
class ImplListBox;
class ImplBtn;
-
-// - ComboBox -
-
-
class VCL_DLLPUBLIC ComboBox : public Edit
{
private:
- Edit* mpSubEdit;
- ImplListBox* mpImplLB;
- ImplBtn* mpBtn;
- ImplListBoxFloatingWindow* mpFloatWin;
+ VclPtr<Edit> mpSubEdit;
+ VclPtr<ImplListBox> mpImplLB;
+ VclPtr<ImplBtn> mpBtn;
+ VclPtr<ImplListBoxFloatingWindow> mpFloatWin;
sal_uInt16 mnDDHeight;
sal_Unicode mcMultiSep;
bool mbDDAutoSize : 1;
bool mbSyntheticModify : 1;
bool mbMatchCase : 1;
- sal_Int32 m_nMaxWidthChars;
+ sal_Int32 m_nMaxWidthChars;
Link maSelectHdl;
Link maDoubleClickHdl;
boost::signals2::scoped_connection mAutocompleteConnection;
@@ -73,7 +69,7 @@ private:
DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* );
DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* );
DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* );
- DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
+ DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
SAL_DLLPRIVATE void ImplClickButtonHandler( ImplBtn* );
SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* );
@@ -90,11 +86,13 @@ protected:
protected:
bool IsDropDownBox() const { return mpFloatWin != nullptr; }
- virtual void FillLayoutData() const SAL_OVERRIDE;
+ virtual void FillLayoutData() const SAL_OVERRIDE;
+
public:
explicit ComboBox( vcl::Window* pParent, WinBits nStyle = 0 );
explicit ComboBox( vcl::Window* pParent, const ResId& );
virtual ~ComboBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
@@ -117,12 +115,12 @@ public:
Rectangle GetDropDownPosSizePixel() const;
- void AdaptDropDownLineCountToMaximum();
+ void AdaptDropDownLineCountToMaximum();
void SetDropDownLineCount( sal_uInt16 nLines );
sal_uInt16 GetDropDownLineCount() const;
void EnableAutoSize( bool bAuto );
- bool IsAutoSizeEnabled() const { return mbDDAutoSize; }
+ bool IsAutoSizeEnabled() const { return mbDDAutoSize; }
void EnableDDAutoWidth( bool b );
diff --git a/include/vcl/controllayout.hxx b/include/vcl/controllayout.hxx
index 0856a69946b5..ea85d379a792 100644
--- a/include/vcl/controllayout.hxx
+++ b/include/vcl/controllayout.hxx
@@ -24,8 +24,7 @@
#include <tools/gen.hxx>
#include <vector>
#include <vcl/dllapi.h>
-
-class Control;
+#include <vcl/ctrl.hxx>
namespace vcl
{
@@ -42,9 +41,9 @@ struct VCL_DLLPUBLIC ControlLayoutData
// start indices of lines
std::vector< long > m_aLineIndices;
// notify parent control on destruction
- const Control* m_pParent;
+ VclPtr<const Control> m_pParent;
- ControlLayoutData() : m_pParent( NULL ) {}
+ ControlLayoutData();
~ControlLayoutData();
Rectangle GetCharacterBounds( long nIndex ) const;
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index d85c85885b2c..4d1f9030a074 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -127,6 +127,7 @@ public:
explicit Control( vcl::Window* pParent, WinBits nWinStyle = 0 );
explicit Control( vcl::Window* pParent, const ResId& );
virtual ~Control();
+ virtual void dispose() SAL_OVERRIDE;
virtual void EnableRTL ( bool bEnable = true ) SAL_OVERRIDE;
diff --git a/include/vcl/cursor.hxx b/include/vcl/cursor.hxx
index 2d3b83c0b119..eecbd0c0ca8a 100644
--- a/include/vcl/cursor.hxx
+++ b/include/vcl/cursor.hxx
@@ -23,6 +23,7 @@
#include <tools/gen.hxx>
#include <tools/link.hxx>
#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
struct ImplCursorData;
namespace vcl { class Window; }
@@ -40,7 +41,7 @@ class VCL_DLLPUBLIC Cursor
{
private:
ImplCursorData* mpData;
- vcl::Window* mpWindow; // only for shadow cursor
+ VclPtr<vcl::Window> mpWindow; // only for shadow cursor
long mnSlant;
Size maSize;
Point maPos;
diff --git a/include/vcl/decoview.hxx b/include/vcl/decoview.hxx
index 4094f693bca2..2de96a5941dd 100644
--- a/include/vcl/decoview.hxx
+++ b/include/vcl/decoview.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_VCL_DECOVIEW_HXX
#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
#include <rsc/rsc-vcl-shared-types.hxx>
class Rectangle;
@@ -70,7 +71,7 @@ class OutputDevice;
class VCL_DLLPUBLIC DecorationView
{
private:
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
public:
DecorationView(OutputDevice* pOutDev);
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 3dbde87e371c..652a06965e27 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -24,6 +24,7 @@
#include <vcl/dllapi.h>
#include <vcl/syswin.hxx>
#include <vcl/timer.hxx>
+#include <vcl/vclptr.hxx>
// parameter to pass to the dialog constructor if really no parent is wanted
// whereas NULL chooses the default dialog parent
@@ -39,7 +40,7 @@ class VclButtonBox;
class VCL_DLLPUBLIC Dialog : public SystemWindow
{
private:
- Dialog* mpPrevExecuteDlg;
+ VclPtr<Dialog> mpPrevExecuteDlg;
DialogImpl* mpDialogImpl;
long mnMousePositioned;
bool mbInExecute;
@@ -47,8 +48,8 @@ private:
bool mbInClose;
bool mbModalMode;
- VclButtonBox* mpActionArea;
- VclBox* mpContentArea;
+ VclPtr<VclButtonBox> mpActionArea;
+ VclPtr<VclBox> mpContentArea;
SAL_DLLPRIVATE void ImplInitDialogData();
SAL_DLLPRIVATE void ImplInitSettings();
@@ -74,13 +75,14 @@ protected:
protected:
friend class VclBuilder;
- void set_action_area(VclButtonBox *pBox);
- void set_content_area(VclBox *pBox);
+ void set_action_area(VclButtonBox* pBox);
+ void set_content_area(VclBox* pBox);
public:
explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription );
virtual ~Dialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
@@ -88,8 +90,8 @@ public:
virtual void queue_resize(StateChangedType eReason = StateChangedType::LAYOUT) SAL_OVERRIDE;
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
- VclButtonBox* get_action_area() { return mpActionArea;}
- VclBox* get_content_area() { return mpContentArea;}
+ VclButtonBox* get_action_area() { return mpActionArea; }
+ VclBox* get_content_area() { return mpContentArea; }
virtual bool Close() SAL_OVERRIDE;
diff --git a/include/vcl/dockingarea.hxx b/include/vcl/dockingarea.hxx
index 7fa2ad55fec0..4bc2deff6b02 100644
--- a/include/vcl/dockingarea.hxx
+++ b/include/vcl/dockingarea.hxx
@@ -37,6 +37,7 @@ private:
public:
explicit DockingAreaWindow( vcl::Window* pParent );
virtual ~DockingAreaWindow();
+ virtual void dispose() SAL_OVERRIDE;
void SetAlign( WindowAlign eNewAlign );
WindowAlign GetAlign() const;
diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx
index dac66c731c06..71c81818fa22 100644
--- a/include/vcl/dockwin.hxx
+++ b/include/vcl/dockwin.hxx
@@ -80,12 +80,12 @@ class ImplDockingWindowWrapper
private:
// the original 'Docking'window
- vcl::Window *mpDockingWindow;
+ VclPtr<vcl::Window> mpDockingWindow;
// the original DockingWindow members
- FloatingWindow* mpFloatWin;
- vcl::Window* mpOldBorderWin;
- vcl::Window* mpParent;
+ VclPtr<FloatingWindow> mpFloatWin;
+ VclPtr<vcl::Window> mpOldBorderWin;
+ VclPtr<vcl::Window> mpParent;
Point maFloatPos;
Point maDockPos;
Point maMouseOff;
@@ -225,8 +225,8 @@ class VCL_DLLPUBLIC DockingWindow
{
class ImplData;
private:
- FloatingWindow* mpFloatWin;
- vcl::Window* mpOldBorderWin;
+ VclPtr<FloatingWindow> mpFloatWin;
+ VclPtr<vcl::Window> mpOldBorderWin;
ImplData* mpImplData;
Point maFloatPos;
Point maDockPos;
@@ -261,7 +261,7 @@ private:
mbIsCalculatingInitialLayoutSize:1,
mbInitialLayoutDone:1;
- vcl::Window* mpDialogParent;
+ VclPtr<vcl::Window> mpDialogParent;
SAL_DLLPRIVATE void ImplInitDockingWindowData();
SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
@@ -299,6 +299,7 @@ public:
DockingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
virtual ~DockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void StartDocking();
virtual bool Docking( const Point& rPos, Rectangle& rRect );
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index ec05923011b8..f32c93269f80 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -28,6 +28,7 @@
#include <vcl/ctrl.hxx>
#include <vcl/menu.hxx>
#include <vcl/dndhelp.hxx>
+#include <vcl/vclptr.hxx>
#include <com/sun/star/uno/Reference.h>
namespace com {
@@ -68,7 +69,7 @@ enum AutocompleteAction{ AUTOCOMPLETE_KEYINPUT, AUTOCOMPLETE_TABFORWARD, AUTOCOM
class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient
{
private:
- Edit* mpSubEdit;
+ VclPtr<Edit> mpSubEdit;
Timer* mpUpdateDataTimer;
TextFilter* mpFilterText;
DDInfo* mpDDInfo;
@@ -85,7 +86,7 @@ private:
sal_Int32 mnMaxWidthChars;
AutocompleteAction meAutocompleteAction;
sal_Unicode mcEchoChar;
- bool mbModified:1,
+ bool mbModified:1,
mbInternModified:1,
mbReadOnly:1,
mbInsertMode:1,
@@ -164,6 +165,7 @@ public:
Edit( vcl::Window* pParent, WinBits nStyle = WB_BORDER );
Edit( vcl::Window* pParent, const ResId& rResId );
virtual ~Edit();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx
index 05a54dc7dfc5..89929d085018 100644
--- a/include/vcl/event.hxx
+++ b/include/vcl/event.hxx
@@ -26,10 +26,11 @@
#include <vcl/keycod.hxx>
#include <vcl/cmdevt.hxx>
#include <vcl/settings.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
class AllSettings;
-class OutputDevice;
-namespace vcl { class Window; }
struct IDataObject;
namespace com { namespace sun { namespace star { namespace awt {
@@ -302,7 +303,7 @@ inline HelpEvent::HelpEvent( HelpEventMode nHelpMode )
class VCL_DLLPUBLIC UserDrawEvent
{
private:
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
Rectangle maOutRect;
sal_uInt16 mnItemId;
sal_uInt16 mnStyle;
@@ -411,7 +412,7 @@ enum class MouseNotifyEvent
class VCL_DLLPUBLIC NotifyEvent
{
private:
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
void* mpData;
MouseNotifyEvent mnEventType;
long mnRetValue;
@@ -435,23 +436,6 @@ public:
const CommandEvent* GetCommandEvent() const;
};
-inline NotifyEvent::NotifyEvent()
-{
- mpWindow = NULL;
- mpData = NULL;
- mnEventType = MouseNotifyEvent::NONE;
- mnRetValue = 0;
-}
-
-inline NotifyEvent::NotifyEvent( MouseNotifyEvent nEventType, vcl::Window* pWindow,
- const void* pEvent, long nRet )
-{
- mpWindow = pWindow;
- mpData = const_cast<void*>(pEvent);
- mnEventType = nEventType;
- mnRetValue = nRet;
-}
-
inline const KeyEvent* NotifyEvent::GetKeyEvent() const
{
if ( (mnEventType == MouseNotifyEvent::KEYINPUT) || (mnEventType == MouseNotifyEvent::KEYUP) )
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 179c16a974a1..cdc80d9cd31c 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -41,7 +41,7 @@ class LanguageTag;
class VCL_DLLPUBLIC FormatterBase
{
private:
- Edit* mpField;
+ VclPtr<Edit> mpField;
LocaleDataWrapper* mpLocaleDataWrapper;
Link maErrorLink;
bool mbReformat;
@@ -485,7 +485,6 @@ class VCL_DLLPUBLIC PatternField : public SpinField, public PatternFormatter
{
public:
explicit PatternField( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~PatternField();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -505,7 +504,6 @@ protected:
public:
explicit NumericField( vcl::Window* pParent, WinBits nWinStyle );
explicit NumericField( vcl::Window* pParent, const ResId& );
- virtual ~NumericField();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -535,7 +533,6 @@ protected:
public:
explicit MetricField( vcl::Window* pParent, WinBits nWinStyle );
explicit MetricField( vcl::Window* pParent, const ResId& );
- virtual ~MetricField();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -602,7 +599,6 @@ class VCL_DLLPUBLIC CurrencyField : public SpinField, public CurrencyFormatter
{
public:
CurrencyField( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~CurrencyField();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -632,7 +628,6 @@ protected:
public:
explicit DateField( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~DateField();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -666,7 +661,6 @@ protected:
public:
explicit TimeField( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~TimeField();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -696,7 +690,6 @@ class VCL_DLLPUBLIC PatternBox : public ComboBox, public PatternFormatter
{
public:
PatternBox( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~PatternBox();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -715,7 +708,6 @@ class VCL_DLLPUBLIC NumericBox : public ComboBox, public NumericFormatter
{
public:
explicit NumericBox( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~NumericBox();
virtual Size CalcMinimumSize() const SAL_OVERRIDE;
@@ -739,7 +731,6 @@ class VCL_DLLPUBLIC MetricBox : public ComboBox, public MetricFormatter
{
public:
explicit MetricBox( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~MetricBox();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -772,7 +763,6 @@ class VCL_DLLPUBLIC CurrencyBox : public ComboBox, public CurrencyFormatter
{
public:
explicit CurrencyBox( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~CurrencyBox();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -793,7 +783,6 @@ class VCL_DLLPUBLIC DateBox : public ComboBox, public DateFormatter
{
public:
explicit DateBox( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~DateBox();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -813,7 +802,6 @@ class VCL_DLLPUBLIC TimeBox : public ComboBox, public TimeFormatter
{
public:
explicit TimeBox( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~TimeBox();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx
index 109cecfe812d..3ba8b2c9fa1c 100644
--- a/include/vcl/fixed.hxx
+++ b/include/vcl/fixed.hxx
@@ -38,7 +38,7 @@ class VCL_DLLPUBLIC FixedText : public Control
private:
sal_Int32 m_nMaxWidthChars;
sal_Int32 m_nMinWidthChars;
- vcl::Window *m_pMnemonicWindow;
+ VclPtr<vcl::Window> m_pMnemonicWindow;
using Control::ImplInitSettings;
using Window::ImplInit;
@@ -62,6 +62,7 @@ public:
explicit FixedText( vcl::Window* pParent, WinBits nStyle = 0 );
explicit FixedText( vcl::Window* pParent, const ResId& rResId );
virtual ~FixedText();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
@@ -140,7 +141,6 @@ private:
public:
explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 );
- virtual ~FixedBitmap();
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
@@ -178,7 +178,6 @@ protected:
public:
explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 );
explicit FixedImage( vcl::Window* pParent, const ResId& );
- virtual ~FixedImage();
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
diff --git a/include/vcl/fixedhyper.hxx b/include/vcl/fixedhyper.hxx
index c85bd1cb6ac0..2fc8e2f95469 100644
--- a/include/vcl/fixedhyper.hxx
+++ b/include/vcl/fixedhyper.hxx
@@ -66,11 +66,6 @@ class VCL_DLLPUBLIC FixedHyperlink : public FixedText
*/
FixedHyperlink( vcl::Window* pParent, WinBits nWinStyle = 0 );
- /** dtor
-
- */
- virtual ~FixedHyperlink();
-
/** overwrites Window::GetFocus().
Changes the color of the text and shows a focus rectangle.
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index b000fb7940e5..a9033a22670b 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -73,8 +73,8 @@ class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
{
class ImplData;
private:
- FloatingWindow* mpNextFloat;
- vcl::Window* mpFirstPopupModeWin;
+ VclPtr<FloatingWindow> mpNextFloat;
+ VclPtr<vcl::Window> mpFirstPopupModeWin;
ImplData* mpImplData;
Rectangle maFloatRect;
ImplSVEvent * mnPostId;
@@ -122,6 +122,7 @@ public:
explicit FloatingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
virtual ~FloatingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
diff --git a/include/vcl/fltcall.hxx b/include/vcl/fltcall.hxx
index 6e7ab514ea5a..48f7ac973534 100644
--- a/include/vcl/fltcall.hxx
+++ b/include/vcl/fltcall.hxx
@@ -33,7 +33,7 @@ namespace vcl { class Window; }
struct FltCallDialogParameter
{
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
ResMgr* pResMgr;
FieldUnit eFieldUnit;
OUString aFilterExt;
diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index 05ab48ad2c98..e860dda464b1 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -25,6 +25,7 @@
#include <tools/link.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/bitmap.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
class OutputDevice;
@@ -80,7 +81,7 @@ private:
Link aHookHdlLink;
GDIMetaFile* pPrev;
GDIMetaFile* pNext;
- OutputDevice* pOutDev;
+ VclPtr<OutputDevice> pOutDev;
bool bPause;
bool bRecord;
bool bUseCanvas;
diff --git a/include/vcl/introwin.hxx b/include/vcl/introwin.hxx
index 7b9fc1e837ea..8576ecda3e81 100644
--- a/include/vcl/introwin.hxx
+++ b/include/vcl/introwin.hxx
@@ -30,8 +30,10 @@ private:
SAL_DLLPRIVATE void ImplInitIntroWindowData();
public:
- IntroWindow();
- virtual ~IntroWindow();
+ IntroWindow();
+ virtual ~IntroWindow();
+ virtual void dispose() SAL_OVERRIDE;
+
};
#endif // INCLUDED_VCL_INTROWIN_HXX
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 24ad21732d4c..bec9976a7317 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -17,6 +17,7 @@
#include <vcl/scrbar.hxx>
#include <vcl/vclmedit.hxx>
#include <vcl/window.hxx>
+#include <vcl/vclptr.hxx>
#include <boost/multi_array.hpp>
#include <set>
@@ -353,7 +354,7 @@ private:
struct GridEntry
{
- vcl::Window *pChild;
+ VclPtr<vcl::Window> pChild;
sal_Int32 nSpanWidth;
sal_Int32 nSpanHeight;
GridEntry()
@@ -455,7 +456,7 @@ public:
class VCL_DLLPUBLIC VclFrame : public VclBin
{
private:
- vcl::Window *m_pLabel;
+ VclPtr<vcl::Window> m_pLabel;
private:
friend class VclBuilder;
void designate_label(vcl::Window *pWindow);
@@ -466,6 +467,8 @@ public:
, m_pLabel(NULL)
{
}
+ virtual ~VclFrame();
+ virtual void dispose() SAL_OVERRIDE;
void set_label(const OUString &rLabel);
OUString get_label() const;
virtual vcl::Window *get_child() SAL_OVERRIDE;
@@ -514,11 +517,13 @@ public:
VclExpander(vcl::Window *pParent)
: VclBin(pParent)
, m_bResizeTopLevel(true)
- , m_pDisclosureButton(new DisclosureButton(this))
+ , m_pDisclosureButton(VclPtr<DisclosureButton>::Create(this))
{
m_pDisclosureButton->SetToggleHdl(LINK(this, VclExpander, ClickHdl));
m_pDisclosureButton->Show();
}
+ virtual ~VclExpander() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
virtual vcl::Window *get_child() SAL_OVERRIDE;
virtual const vcl::Window *get_child() const SAL_OVERRIDE;
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
@@ -544,10 +549,9 @@ public:
protected:
virtual Size calculateRequisition() const SAL_OVERRIDE;
virtual void setAllocation(const Size &rAllocation) SAL_OVERRIDE;
- void dispose() SAL_OVERRIDE { m_pDisclosureButton.clear(); VclBin::dispose(); }
private:
bool m_bResizeTopLevel;
- DisclosureButtonPtr m_pDisclosureButton;
+ VclPtr<DisclosureButton> m_pDisclosureButton;
Link maExpandedHdl;
DECL_DLLPRIVATE_LINK(ClickHdl, DisclosureButton* pBtn);
};
@@ -556,11 +560,13 @@ class VCL_DLLPUBLIC VclScrolledWindow : public VclBin
{
public:
VclScrolledWindow(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN | WB_AUTOHSCROLL | WB_AUTOVSCROLL);
+ virtual ~VclScrolledWindow() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
virtual vcl::Window *get_child() SAL_OVERRIDE;
virtual const vcl::Window *get_child() const SAL_OVERRIDE;
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
- ScrollBar& getVertScrollBar() { return *m_pVScroll.get(); }
- ScrollBar& getHorzScrollBar() { return *m_pHScroll.get(); }
+ ScrollBar& getVertScrollBar() { return *m_pVScroll; }
+ ScrollBar& getHorzScrollBar() { return *m_pHScroll; }
Size getVisibleChildSize() const;
//set to true to disable the built-in scrolling callbacks to allow the user
//to override it
@@ -571,12 +577,11 @@ protected:
DECL_LINK(ScrollBarHdl, void *);
void InitScrollBars(const Size &rRequest);
virtual bool Notify(NotifyEvent& rNEvt) SAL_OVERRIDE;
- void dispose() SAL_OVERRIDE { m_pVScroll.clear(); m_pHScroll.clear(); VclBin::dispose(); }
private:
bool m_bUserManagedScrolling;
- ScrollBarPtr m_pVScroll;
- ScrollBarPtr m_pHScroll;
- ScrollBarBox m_aScrollBarBox;
+ VclPtr<ScrollBar> m_pVScroll;
+ VclPtr<ScrollBar> m_pHScroll;
+ VclPtr<ScrollBarBox> m_aScrollBarBox;
};
class VCL_DLLPUBLIC VclViewport : public VclBin
@@ -618,13 +623,16 @@ private:
}
};
- EventBoxHelper m_aEventBoxHelper;
+ VclPtr<EventBoxHelper> m_aEventBoxHelper;
+protected:
+ virtual void dispose() SAL_OVERRIDE;
+ virtual ~VclEventBox();
public:
VclEventBox(vcl::Window* pParent)
: VclBin(pParent)
- , m_aEventBoxHelper(this)
+ , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this))
{
- m_aEventBoxHelper.Show();
+ m_aEventBoxHelper->Show();
}
virtual vcl::Window *get_child() SAL_OVERRIDE;
virtual const vcl::Window *get_child() const SAL_OVERRIDE;
@@ -645,7 +653,7 @@ enum VclSizeGroupMode
class VCL_DLLPUBLIC VclSizeGroup
{
private:
- std::set<vcl::Window*> m_aWindows;
+ std::set< VclPtr<vcl::Window> > m_aWindows;
bool m_bIgnoreHidden;
VclSizeGroupMode m_eMode;
@@ -658,17 +666,17 @@ public:
}
void insert(vcl::Window *pWindow)
{
- m_aWindows.insert(pWindow);
+ m_aWindows.insert(VclPtr<vcl::Window>(pWindow));
}
void erase(vcl::Window *pWindow)
{
- m_aWindows.erase(pWindow);
+ m_aWindows.erase(VclPtr<vcl::Window>(pWindow));
}
- const std::set<vcl::Window*>& get_widgets() const
+ const std::set< VclPtr<vcl::Window> >& get_widgets() const
{
return m_aWindows;
}
- std::set<vcl::Window*>& get_widgets()
+ std::set< VclPtr<vcl::Window> >& get_widgets()
{
return m_aWindows;
}
@@ -708,14 +716,14 @@ class VCL_DLLPUBLIC MessageDialog : public Dialog
private:
VclButtonsType m_eButtonsType;
VclMessageType m_eMessageType;
- VclBox *m_pOwnedContentArea;
- VclButtonBox *m_pOwnedActionArea;
- VclGrid* m_pGrid;
- FixedImage* m_pImage;
- VclMultiLineEdit* m_pPrimaryMessage;
- VclMultiLineEdit* m_pSecondaryMessage;
- std::vector<PushButton*> m_aOwnedButtons;
- std::map<const vcl::Window*, short> m_aResponses;
+ VclPtr<VclBox> m_pOwnedContentArea;
+ VclPtr<VclButtonBox> m_pOwnedActionArea;
+ VclPtr<VclGrid> m_pGrid;
+ VclPtr<FixedImage> m_pImage;
+ VclPtr<VclMultiLineEdit> m_pPrimaryMessage;
+ VclPtr<VclMultiLineEdit> m_pSecondaryMessage;
+ std::vector<VclPtr<PushButton> > m_aOwnedButtons;
+ std::map< VclPtr<const vcl::Window>, short> m_aResponses;
OUString m_sPrimaryString;
OUString m_sSecondaryString;
DECL_DLLPRIVATE_LINK(ButtonHdl, Button *);
@@ -742,6 +750,7 @@ public:
void set_primary_text(const OUString &rPrimaryString);
void set_secondary_text(const OUString &rSecondaryString);
virtual ~MessageDialog();
+ virtual void dispose() SAL_OVERRIDE;
static void SetMessagesWidths(vcl::Window *pParent, VclMultiLineEdit *pPrimaryMessage,
VclMultiLineEdit *pSecondaryMessage);
diff --git a/include/vcl/lazydelete.hxx b/include/vcl/lazydelete.hxx
index ad4e9cfaeb8e..08da855ac360 100644
--- a/include/vcl/lazydelete.hxx
+++ b/include/vcl/lazydelete.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_VCL_LAZYDELETE_HXX
#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
#include <unordered_map>
#include <vector>
@@ -101,8 +102,8 @@ namespace vcl
struct DeleteObjectEntry
{
- T* m_pObject;
- bool m_bDeleted;
+ VclPtr<T> m_pObject;
+ bool m_bDeleted;
DeleteObjectEntry() :
m_pObject( NULL ),
@@ -136,7 +137,7 @@ namespace vcl
// do the actual work
unsigned int nCount = m_aObjects.size();
- std::vector<T*> aRealDelete;
+ std::vector< VclPtr < T > > aRealDelete;
aRealDelete.reserve( nCount );
for( unsigned int i = 0; i < nCount; i++ )
{
@@ -158,8 +159,8 @@ namespace vcl
#endif
// check if the object to be deleted is not already destroyed
// as a side effect of a previous lazily destroyed object
- if( ! m_aObjects[ m_aPtrToIndex[ reinterpret_cast<sal_IntPtr>(aRealDelete[n]) ] ].m_bDeleted )
- delete aRealDelete[n];
+ if( ! m_aObjects[ m_aPtrToIndex[ reinterpret_cast<sal_IntPtr>(aRealDelete[n].get()) ] ].m_bDeleted )
+ aRealDelete[n].disposeAndClear();
}
}
diff --git a/include/vcl/longcurr.hxx b/include/vcl/longcurr.hxx
index 0c2d1a969de0..0dbe82ca401f 100644
--- a/include/vcl/longcurr.hxx
+++ b/include/vcl/longcurr.hxx
@@ -90,7 +90,6 @@ private:
public:
LongCurrencyField( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~LongCurrencyField();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -117,7 +116,6 @@ class VCL_DLLPUBLIC LongCurrencyBox : public ComboBox, public LongCurrencyFormat
{
public:
LongCurrencyBox( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~LongCurrencyBox();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 3f03f63d1b55..5647f974f396 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -37,10 +37,10 @@ class ImplWin;
class VCL_DLLPUBLIC ListBox : public Control
{
private:
- ImplListBox* mpImplLB;
- ImplListBoxFloatingWindow* mpFloatWin;
- ImplWin* mpImplWin;
- ImplBtn* mpBtn;
+ VclPtr<ImplListBox> mpImplLB;
+ VclPtr<ImplListBoxFloatingWindow> mpFloatWin;
+ VclPtr<ImplWin> mpImplWin;
+ VclPtr<ImplBtn> mpBtn;
sal_uInt16 mnDDHeight;
sal_Int32 mnSaveValue;
sal_Int32 m_nMaxWidthChars;
@@ -83,6 +83,7 @@ public:
explicit ListBox( vcl::Window* pParent, WinBits nStyle = WB_BORDER );
explicit ListBox( vcl::Window* pParent, const ResId& );
virtual ~ListBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index ef4f1eec5762..32dfd5a73d28 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -124,7 +124,7 @@ private:
MenuItemList* pItemList; // Liste mit den MenuItems
MenuLogo* pLogo;
Menu* pStartedFrom;
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
Link aActivateHdl; // Active-Handler
Link aDeactivateHdl; // Deactivate-Handler
diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index 41e03c6462f9..eb2c446a4a53 100644
--- a/include/vcl/menubtn.hxx
+++ b/include/vcl/menubtn.hxx
@@ -57,6 +57,7 @@ protected:
public:
explicit MenuButton( vcl::Window* pParent, WinBits nStyle = 0 );
virtual ~MenuButton();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
diff --git a/include/vcl/morebtn.hxx b/include/vcl/morebtn.hxx
index 4dbd6da57736..936cbba77d9e 100644
--- a/include/vcl/morebtn.hxx
+++ b/include/vcl/morebtn.hxx
@@ -35,7 +35,7 @@ class VCL_DLLPUBLIC MoreButton : public PushButton
{
private:
ImplMoreButtonData* mpMBData;
- sal_uLong mnDelta;
+ sal_uLong mnDelta;
MapUnit meUnit;
bool mbState;
@@ -50,6 +50,7 @@ protected:
public:
explicit MoreButton( vcl::Window* pParent, WinBits nStyle = 0 );
virtual ~MoreButton();
+ virtual void dispose() SAL_OVERRIDE;
void Click() SAL_OVERRIDE;
diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx
index 04ea155cb6d8..8147821280c1 100644
--- a/include/vcl/msgbox.hxx
+++ b/include/vcl/msgbox.hxx
@@ -32,14 +32,14 @@ class CheckBox;
class VCL_DLLPUBLIC MessBox : public ButtonDialog
{
protected:
- VclMultiLineEdit* mpVCLMultiLineEdit;
- FixedImage* mpFixedImage;
- OUString maMessText;
- Image maImage;
- bool mbHelpBtn;
- CheckBox* mpCheckBox;
- OUString maCheckBoxText;
- bool mbCheck;
+ VclPtr<VclMultiLineEdit> mpVCLMultiLineEdit;
+ VclPtr<FixedImage> mpFixedImage;
+ OUString maMessText;
+ Image maImage;
+ bool mbHelpBtn;
+ VclPtr<CheckBox> mpCheckBox;
+ OUString maCheckBoxText;
+ bool mbCheck;
SAL_DLLPRIVATE void ImplInitMessBoxData();
SAL_DLLPRIVATE void ImplInitButtons();
@@ -48,7 +48,8 @@ protected:
public:
MessBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rTitle, const OUString& rMessage );
- virtual ~MessBox();
+ virtual ~MessBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/include/vcl/oldprintadaptor.hxx b/include/vcl/oldprintadaptor.hxx
index 72d1163d67c4..987b58ff3aa3 100644
--- a/include/vcl/oldprintadaptor.hxx
+++ b/include/vcl/oldprintadaptor.hxx
@@ -29,7 +29,7 @@ namespace vcl
{
ImplOldStyleAdaptorData* mpData;
public:
- OldStylePrintAdaptor(const std::shared_ptr<Printer>&);
+ OldStylePrintAdaptor( const VclPtr< Printer >& );
virtual ~OldStylePrintAdaptor();
void StartPage();
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index d733560f2a2b..2d2ce8f823d5 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -249,10 +249,9 @@ private:
#endif
GLWindow m_aGLWin;
- std::unique_ptr<vcl::Window> m_xWindow;
- vcl::Window* mpWindow; //points to m_xWindow or the parent window, don't delete it
- SystemChildWindow* m_pChildWindow;
- std::unique_ptr<SystemChildWindow> m_xChildWindowGC;
+ VclPtr<vcl::Window> m_xWindow;
+ VclPtr<vcl::Window> mpWindow; //points to m_pWindow or the parent window, don't delete it
+ VclPtr<SystemChildWindow> m_pChildWindow;
bool mbInitialized;
int mnRefCount;
bool mbRequestLegacyContext;
diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx
index dfeb95c076e6..e8c2a1e545a7 100644
--- a/include/vcl/openglwin.hxx
+++ b/include/vcl/openglwin.hxx
@@ -33,8 +33,10 @@ public:
class VCL_DLLPUBLIC OpenGLWindow : public vcl::Window
{
public:
- OpenGLWindow(vcl::Window* pParent);
- virtual ~OpenGLWindow();
+ OpenGLWindow(vcl::Window* pParent);
+ virtual ~OpenGLWindow();
+ virtual void dispose() SAL_OVERRIDE;
+
OpenGLContext& getContext();
void setRenderer(IRenderer* pRenderer);
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 4cf24545c928..16f44b8085f5 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -263,13 +263,34 @@ class VCL_DLLPUBLIC OutputDevice
friend class vcl::PDFWriterImpl;
friend void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight );
+ // All of this will need to be replicated in Window
+ // or a shared base-class as/when we can break the
+ // OutputDevice -> Window inheritance.
+private:
+ mutable int mnRefCnt; // reference count
+
+ template<typename T> friend class ::rtl::Reference;
+ template<typename T> friend class ::VclPtr;
+
+ inline void acquire() const
+ {
+ mnRefCnt++;
+ }
+
+ inline void release() const
+ {
+ assert(mnRefCnt>0);
+ if (!--mnRefCnt)
+ delete this;
+ }
+
private:
OutputDevice(const OutputDevice&) SAL_DELETED_FUNCTION;
OutputDevice& operator=(const OutputDevice&) SAL_DELETED_FUNCTION;
mutable SalGraphics* mpGraphics; ///< Graphics context to draw on
- mutable OutputDevice* mpPrevGraphics; ///< Previous output device in list
- mutable OutputDevice* mpNextGraphics; ///< Next output device in list
+ mutable VclPtr<OutputDevice> mpPrevGraphics; ///< Previous output device in list
+ mutable VclPtr<OutputDevice> mpNextGraphics; ///< Next output device in list
GDIMetaFile* mpMetaFile;
mutable ImplFontEntry* mpFontEntry;
mutable ImplFontCache* mpFontCache;
@@ -283,7 +304,7 @@ private:
vcl::ExtOutDevData* mpExtOutDevData;
// TEMP TEMP TEMP
- VirtualDevice* mpAlphaVDev;
+ VclPtr<VirtualDevice> mpAlphaVDev;
/// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
long mnOutOffOrigX;
@@ -352,6 +373,7 @@ private:
mutable bool mbTextSpecial : 1;
mutable bool mbRefPoint : 1;
mutable bool mbEnableRTL : 1;
+ mutable bool mbDisposed : 1;
/** @name Initialization and accessor functions
*/
@@ -359,10 +381,18 @@ private:
protected:
OutputDevice();
-
public:
virtual ~OutputDevice();
+protected:
+ /// release all references to other objects.
+ virtual void dispose();
+
+public:
+ /// call the dispose() method if we have not already been disposed.
+ void disposeOnce();
+ bool isDisposed() const { return mbDisposed; }
+
public:
/** Get the graphic context that the output device uses to draw on.
diff --git a/include/vcl/popupmenuwindow.hxx b/include/vcl/popupmenuwindow.hxx
index 266738a170c3..13d699f69542 100644
--- a/include/vcl/popupmenuwindow.hxx
+++ b/include/vcl/popupmenuwindow.hxx
@@ -30,6 +30,7 @@ private:
public:
PopupMenuFloatingWindow( vcl::Window* pParent, WinBits nStyle = (WB_SYSTEMFLOATWIN|WB_SYSTEMWINDOW|WB_NOBORDER) );
virtual ~PopupMenuFloatingWindow();
+ virtual void dispose() SAL_OVERRIDE;
sal_uInt16 GetMenuStackLevel() const;
void SetMenuStackLevel( sal_uInt16 nLevel );
diff --git a/include/vcl/prgsbar.hxx b/include/vcl/prgsbar.hxx
index 782b2c549a9a..43d340689d18 100644
--- a/include/vcl/prgsbar.hxx
+++ b/include/vcl/prgsbar.hxx
@@ -61,8 +61,8 @@ private:
Point maPos;
long mnPrgsWidth;
long mnPrgsHeight;
- sal_uInt16 mnPercent;
- sal_uInt16 mnPercentCount;
+ sal_uInt16 mnPercent;
+ sal_uInt16 mnPercentCount;
bool mbCalcNew;
using Window::ImplInit;
@@ -72,7 +72,6 @@ private:
public:
ProgressBar( vcl::Window* pParent, WinBits nWinBits = WB_STDPROGRESSBAR );
- virtual ~ProgressBar();
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index d74976981bd8..be18fd06bb6a 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -203,9 +203,9 @@ private:
SalInfoPrinter* mpInfoPrinter;
SalPrinter* mpPrinter;
SalGraphics* mpJobGraphics;
- Printer* mpPrev;
- Printer* mpNext;
- VirtualDevice* mpDisplayDev;
+ VclPtr<Printer> mpPrev;
+ VclPtr<Printer> mpNext;
+ VclPtr<VirtualDevice> mpDisplayDev;
PrinterOptions* mpPrinterOptions;
OUString maPrinterName;
OUString maDriver;
@@ -299,6 +299,7 @@ public:
Printer( const QueueInfo& rQueueInfo );
Printer( const OUString& rPrinterName );
virtual ~Printer();
+ virtual void dispose() SAL_OVERRIDE;
static const std::vector< OUString >& GetPrinterQueues();
static const QueueInfo* GetQueueInfo( const OUString& rPrinterName, bool bStatusUpdate );
@@ -309,7 +310,7 @@ public:
const OUString& GetName() const { return maPrinterName; }
const OUString& GetDriverName() const { return maDriver; }
bool IsDefPrinter() const { return mbDefPrinter; }
- bool IsDisplayPrinter() const { return mpDisplayDev != NULL; }
+ bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; }
bool IsValid() const { return !IsDisplayPrinter(); }
sal_uLong GetCapabilities( sal_uInt16 nType ) const;
@@ -426,7 +427,7 @@ class VCL_DLLPUBLIC PrinterController
{
ImplPrinterControllerData* mpImplData;
protected:
- PrinterController( const std::shared_ptr<Printer>& );
+ PrinterController( const VclPtr<Printer>& );
public:
enum NupOrderType
{ LRTB, TBLR, TBRL, RLTB };
@@ -469,7 +470,7 @@ public:
virtual ~PrinterController();
- const std::shared_ptr<Printer>& getPrinter() const;
+ const VclPtr<Printer>& getPrinter() const;
/* for implementations: get current job properties as changed by e.g. print dialog
this gets the current set of properties initially told to Printer::PrintJob
@@ -550,7 +551,7 @@ public:
SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false );
VCL_PLUGIN_PUBLIC PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
VCL_PLUGIN_PUBLIC void printFilteredPage( int i_nPage );
- SAL_DLLPRIVATE void setPrinter( const std::shared_ptr<Printer>& );
+ SAL_DLLPRIVATE void setPrinter( const VclPtr<Printer>& );
SAL_DLLPRIVATE void setOptionChangeHdl( const Link& );
VCL_PLUGIN_PUBLIC void createProgressDialog();
VCL_PLUGIN_PUBLIC bool isProgressCanceled() const;
diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx
index da949dfdf8d2..27871afc2cb6 100644
--- a/include/vcl/scrbar.hxx
+++ b/include/vcl/scrbar.hxx
@@ -91,6 +91,7 @@ private:
public:
explicit ScrollBar( vcl::Window* pParent, WinBits nStyle = WB_VERT );
virtual ~ScrollBar();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
@@ -141,8 +142,6 @@ public:
virtual Size GetOptimalSize() const SAL_OVERRIDE;
};
-typedef rtl::Reference<ScrollBar> ScrollBarPtr;
-
// - ScrollBarBox -
diff --git a/include/vcl/seleng.hxx b/include/vcl/seleng.hxx
index cbfd9c3a0970..781527157607 100644
--- a/include/vcl/seleng.hxx
+++ b/include/vcl/seleng.hxx
@@ -83,7 +83,7 @@ class VCL_DLLPUBLIC SelectionEngine
{
private:
FunctionSet* pFunctionSet;
- vcl::Window* pWin;
+ VclPtr<vcl::Window> pWin;
Rectangle aArea;
Timer aWTimer; // generate fake mouse moves
MouseEvent aLastMove;
diff --git a/include/vcl/spin.hxx b/include/vcl/spin.hxx
index 4fb25f31829f..ad261f2ef478 100644
--- a/include/vcl/spin.hxx
+++ b/include/vcl/spin.hxx
@@ -57,7 +57,6 @@ private:
public:
explicit SpinButton( vcl::Window* pParent, WinBits nStyle = 0 );
- virtual ~SpinButton();
void Up();
void Down();
diff --git a/include/vcl/spinfld.hxx b/include/vcl/spinfld.hxx
index fe5431be04b6..b0474b1685c9 100644
--- a/include/vcl/spinfld.hxx
+++ b/include/vcl/spinfld.hxx
@@ -26,13 +26,10 @@
#include <vcl/timer.hxx>
-// - SpinField -
-
-
class VCL_DLLPUBLIC SpinField : public Edit
{
protected:
- Edit* mpEdit;
+ VclPtr<Edit> mpEdit;
AutoTimer maRepeatTimer;
Rectangle maUpperRect;
Rectangle maLowerRect;
@@ -73,6 +70,7 @@ public:
explicit SpinField( vcl::Window* pParent, WinBits nWinStyle = 0 );
explicit SpinField( vcl::Window* pParent, const ResId& );
virtual ~SpinField();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool ShowDropDown( bool bShow );
diff --git a/include/vcl/split.hxx b/include/vcl/split.hxx
index fbc833272ce7..86df902692b4 100644
--- a/include/vcl/split.hxx
+++ b/include/vcl/split.hxx
@@ -28,7 +28,7 @@
class VCL_DLLPUBLIC Splitter : public vcl::Window
{
private:
- vcl::Window* mpRefWin;
+ VclPtr<vcl::Window> mpRefWin;
long mnSplitPos;
long mnLastSplitPos;
long mnStartSplitPos;
@@ -63,6 +63,7 @@ protected:
public:
explicit Splitter( vcl::Window* pParent, WinBits nStyle = WB_VSCROLL );
virtual ~Splitter();
+ virtual void dispose() SAL_OVERRIDE;
void StartSplit();
void EndSplit();
diff --git a/include/vcl/splitwin.hxx b/include/vcl/splitwin.hxx
index 157f0c23ed60..009f9e9fb274 100644
--- a/include/vcl/splitwin.hxx
+++ b/include/vcl/splitwin.hxx
@@ -123,7 +123,8 @@ private:
SplitWindow & operator= (const SplitWindow &) SAL_DELETED_FUNCTION;
public:
SplitWindow( vcl::Window* pParent, WinBits nStyle = 0 );
- virtual ~SplitWindow();
+ virtual ~SplitWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void StartSplit();
virtual void Split();
diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
index a9ad080e8715..6824233e43d3 100644
--- a/include/vcl/status.hxx
+++ b/include/vcl/status.hxx
@@ -85,9 +85,9 @@ private:
long mnCalcHeight;
long mnTextY;
long mnItemY;
- sal_uInt16 mnCurItemId;
- sal_uInt16 mnPercent;
- sal_uInt16 mnPercentCount;
+ sal_uInt16 mnCurItemId;
+ sal_uInt16 mnPercent;
+ sal_uInt16 mnPercentCount;
bool mbVisibleItems;
bool mbFormat;
bool mbProgressMode;
@@ -113,7 +113,8 @@ private:
public:
StatusBar( vcl::Window* pParent,
WinBits nWinStyle = WB_BORDER | WB_RIGHT );
- virtual ~StatusBar();
+ virtual ~StatusBar();
+ virtual void dispose() SAL_OVERRIDE;
void AdjustItemWidthsForHiDPI(bool bAdjustHiDPI);
diff --git a/include/vcl/syschild.hxx b/include/vcl/syschild.hxx
index 87e16fcc183a..928c1861b52a 100644
--- a/include/vcl/syschild.hxx
+++ b/include/vcl/syschild.hxx
@@ -42,6 +42,7 @@ public:
// create a SystemChildWindow using the given SystemWindowData
explicit SystemChildWindow( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow = true );
virtual ~SystemChildWindow();
+ virtual void dispose() SAL_OVERRIDE;
const SystemEnvData* GetSystemData() const;
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index c313e2ff2c34..f90fb16bfeea 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -149,7 +149,7 @@ private:
Idle maLayoutIdle;
protected:
bool mbIsDefferedInit;
- vcl::Window* mpDialogParent;
+ VclPtr<vcl::Window> mpDialogParent;
public:
using Window::ImplIsInTaskPaneList;
SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin );
@@ -172,7 +172,9 @@ protected:
SAL_DLLPRIVATE void DoInitialLayout();
public:
- virtual ~SystemWindow();
+ virtual ~SystemWindow();
+ virtual void dispose() SAL_OVERRIDE;
+
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 526bc25ddfec..a3b8aa0f0bec 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -42,13 +42,13 @@ private:
long mnLastHeight;
long mnBtnSize;
long mnMaxPageWidth;
- sal_uInt16 mnActPageId;
- sal_uInt16 mnCurPageId;
+ sal_uInt16 mnActPageId;
+ sal_uInt16 mnCurPageId;
bool mbFormat;
bool mbRestoreHelpId;
bool mbRestoreUnqId;
bool mbSmallInvalidate;
- bool mbLayoutDirty;
+ bool mbLayoutDirty;
Link maActivateHdl;
Link maDeactivateHdl;
@@ -83,6 +83,7 @@ public:
TabControl( vcl::Window* pParent,
WinBits nStyle = WB_STDTABCONTROL );
virtual ~TabControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
diff --git a/include/vcl/tabdlg.hxx b/include/vcl/tabdlg.hxx
index f02efc726596..db3f592ea20b 100644
--- a/include/vcl/tabdlg.hxx
+++ b/include/vcl/tabdlg.hxx
@@ -29,8 +29,8 @@ class TabControl;
class VCL_DLLPUBLIC TabDialog : public Dialog
{
private:
- FixedLine* mpFixedLine;
- vcl::Window* mpViewWindow;
+ VclPtr<FixedLine> mpFixedLine;
+ VclPtr<vcl::Window> mpViewWindow;
WindowAlign meViewAlign;
bool mbPosControls;
@@ -41,7 +41,8 @@ public:
TabDialog( vcl::Window* pParent,
WinBits nStyle = WB_STDTABDIALOG );
TabDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription );
- virtual ~TabDialog();
+ virtual ~TabDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx
index c7361972ccb1..702a42c756b6 100644
--- a/include/vcl/tabpage.hxx
+++ b/include/vcl/tabpage.hxx
@@ -41,6 +41,8 @@ private:
public:
explicit TabPage( vcl::Window* pParent, WinBits nStyle = 0 );
explicit TabPage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription );
+ virtual ~TabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
diff --git a/include/vcl/taskpanelist.hxx b/include/vcl/taskpanelist.hxx
index c8a6abd0e489..738f2b81f3a9 100644
--- a/include/vcl/taskpanelist.hxx
+++ b/include/vcl/taskpanelist.hxx
@@ -27,7 +27,7 @@
class VCL_DLLPUBLIC TaskPaneList
{
- ::std::vector<vcl::Window *> mTaskPanes;
+ ::std::vector< VclPtr<vcl::Window> > mTaskPanes;
vcl::Window *FindNextFloat( vcl::Window *pWindow, bool bForward = true );
vcl::Window *FindNextSplitter( vcl::Window *pWindow, bool bForward = true );
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 3464b2460629..f5273d9d9b33 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_VCL_TEXTENG_HXX
#include <vcl/dllapi.h>
+#include <vcl/vclptr.hxx>
class TextDoc;
class TextView;
@@ -91,7 +92,7 @@ class VCL_DLLPUBLIC TextEngine : public SfxBroadcaster
private:
TextDoc* mpDoc;
TEParaPortions* mpTEParaPortions;
- OutputDevice* mpRefDev;
+ VclPtr<OutputDevice> mpRefDev;
TextViews* mpViews;
TextView* mpActiveView;
diff --git a/include/vcl/throbber.hxx b/include/vcl/throbber.hxx
index aaf8edf5fba5..f7cbbedf62e2 100644
--- a/include/vcl/throbber.hxx
+++ b/include/vcl/throbber.hxx
@@ -48,6 +48,7 @@ public:
public:
Throbber(vcl::Window* i_parentWindow, WinBits i_style, const ImageSet i_imageSet = IMAGES_AUTO);
virtual ~Throbber();
+ virtual void dispose() SAL_OVERRIDE;
// Properties
void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; }
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index d723e6ee3ab1..269c51883836 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -42,7 +42,7 @@ class PopupMenu;
class VCL_DLLPUBLIC ToolBoxCustomizeEvent
{
private:
- ToolBox* mpTargetBox;
+ VclPtr<ToolBox> mpTargetBox;
void* mpData;
sal_uInt16 mnIdFrom;
sal_uInt16 mnPosTo;
@@ -131,7 +131,7 @@ private:
Rectangle maOutDockRect;
Rectangle maInDockRect;
Rectangle maPaintRect;
- FloatingWindow* mpFloatWin;
+ VclPtr<FloatingWindow> mpFloatWin;
sal_uInt16 mnKeyModifier;
long mnDX;
long mnDY;
@@ -281,7 +281,8 @@ protected:
public:
ToolBox( vcl::Window* pParent, WinBits nStyle = 0 );
ToolBox( vcl::Window* pParent, const ResId& rResId );
- virtual ~ToolBox();
+ virtual ~ToolBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Click();
void DoubleClick();
diff --git a/include/vcl/vclevent.hxx b/include/vcl/vclevent.hxx
index 4e165a438643..99f329e8da65 100644
--- a/include/vcl/vclevent.hxx
+++ b/include/vcl/vclevent.hxx
@@ -24,13 +24,14 @@
#include <tools/rtti.hxx>
#include <vcl/dllapi.h>
#include <vcl/impdel.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <list>
#include <vector>
-namespace vcl { class Window; }
class Menu;
namespace com { namespace sun { namespace star {
@@ -213,12 +214,12 @@ public:
class VCL_DLLPUBLIC VclWindowEvent : public VclSimpleEvent
{
private:
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
void* pData;
public:
- VclWindowEvent( vcl::Window* pWin, sal_uLong n, void* pDat = NULL ) : VclSimpleEvent(n) { pWindow = pWin; pData = pDat; }
- virtual ~VclWindowEvent() {}
+ VclWindowEvent( vcl::Window* pWin, sal_uLong n, void* pDat = NULL );
+ virtual ~VclWindowEvent();
TYPEINFO_OVERRIDE();
vcl::Window* GetWindow() const { return pWindow; }
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 649725b1c1f2..034c25412969 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -25,7 +25,6 @@
#include <vcl/edit.hxx>
#include <vcl/dllapi.h>
-
class ImpVclMEdit;
class Timer;
class ExtTextEngine;
@@ -58,8 +57,10 @@ protected:
ScrollBar* GetVScrollBar() const;
public:
- VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
- virtual ~VclMultiLineEdit();
+ VclMultiLineEdit( vcl::Window* pParent,
+ WinBits nWinStyle = WB_LEFT | WB_BORDER );
+ virtual ~VclMultiLineEdit();
+ virtual void dispose() SAL_OVERRIDE;
void SelectionChanged();
void CaretChanged();
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
new file mode 100644
index 000000000000..5ad0bdabfd2d
--- /dev/null
+++ b/include/vcl/vclptr.hxx
@@ -0,0 +1,357 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_PTR_HXX
+#define INCLUDED_VCL_PTR_HXX
+
+#include <rtl/ref.hxx>
+#include <cstddef>
+#include <utility>
+#include <type_traits>
+
+/// @cond INTERNAL
+namespace vcl { namespace detail {
+
+// A mechanism to enable up-casts, used by the VclReference conversion constructor,
+// heavily borrowed from boost::is_base_and_derived
+// (which manages to avoid compilation problems with ambiguous bases and cites
+// comp.lang.c++.moderated mail <http://groups.google.com/groups?
+// selm=df893da6.0301280859.522081f7%40posting.google.com> "SuperSubclass
+// (is_base_and_derived) complete implementation!" by Rani Sharoni and cites
+// Aleksey Gurtovoy for the workaround for MSVC), to avoid including Boost
+// headers in URE headers (could ultimately be based on C++11 std::is_base_of):
+
+template< typename T1, typename T2 > struct UpCast {
+private:
+ template< bool, typename U1, typename > struct C
+ { typedef U1 t; };
+
+ template< typename U1, typename U2 > struct C< false, U1, U2 >
+ { typedef U2 t; };
+
+ struct S { char c[2]; };
+
+#if defined _MSC_VER
+ static char f(T2 *, long);
+ static S f(T1 * const &, int);
+#else
+ template< typename U > static char f(T2 *, U);
+ static S f(T1 *, int);
+#endif
+
+ struct H {
+ H(); // avoid C2514 "class has no constructors" from MSVC 2008
+#if defined _MSC_VER
+ operator T1 * const & () const;
+#else
+ operator T1 * () const;
+#endif
+ operator T2 * ();
+ };
+
+public:
+ typedef typename C< sizeof (f(H(), 0)) == 1, void *, void >::t t;
+};
+
+}; }; // namespace detail, namespace vcl
+
+namespace vcl { class Window; }
+
+/**
+ * A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for references to vcl::Window subclasses.
+ *
+ * For more details on the design please see vcl/README.lifecycle
+ *
+ * @param reference_type must be a subclass of vcl::Window
+ */
+template <class reference_type>
+class VclPtr
+{
+ ::rtl::Reference<reference_type> m_rInnerRef;
+
+public:
+ /** Constructor...
+ */
+ inline VclPtr()
+ : m_rInnerRef()
+ {}
+
+ /** Constructor...
+ */
+ inline VclPtr (reference_type * pBody)
+ : m_rInnerRef(pBody)
+ {}
+
+ /** Constructor... that doesn't take a ref.
+ */
+ inline VclPtr (reference_type * pBody, __sal_NoAcquire)
+ : m_rInnerRef(pBody, SAL_NO_ACQUIRE)
+ {}
+
+ /** Copy constructor...
+ */
+ inline VclPtr (const VclPtr<reference_type> & handle)
+ : m_rInnerRef (handle.m_rInnerRef)
+ {}
+
+ /** Up-casting conversion constructor: Copies interface reference.
+
+ Does not work for up-casts to ambiguous bases. For the special case of
+ up-casting to Reference< XInterface >, see the corresponding conversion
+ operator.
+
+ @param rRef another reference
+ */
+ template< class derived_type >
+ inline VclPtr(
+ const VclPtr< derived_type > & rRef,
+ typename ::vcl::detail::UpCast< reference_type, derived_type >::t = 0 )
+ : m_rInnerRef( static_cast<reference_type*>(rRef) )
+ {
+ }
+
+ /**
+ * A construction helper for VclPtr. Since VclPtr types are created
+ * with a reference-count of one - to help fit into the existing
+ * code-flow; this helps us to construct them easily.
+ *
+ * For more details on the design please see vcl/README.lifecycle
+ *
+ * @param reference_type must be a subclass of vcl::Window
+ */
+ template<typename... Arg> static VclPtr< reference_type > Create(Arg &&... arg)
+ {
+ return VclPtr< reference_type >( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE );
+ }
+
+ /** Probably most common used: handle->someBodyOp().
+ */
+ inline reference_type * SAL_CALL operator->() const
+ {
+ return m_rInnerRef.get();
+ }
+
+ /** Get the body. Can be used instead of operator->().
+ I.e. handle->someBodyOp() and handle.get()->someBodyOp()
+ are the same.
+ */
+ inline reference_type * SAL_CALL get() const
+ {
+ return m_rInnerRef.get();
+ }
+
+ inline void SAL_CALL set(reference_type *pBody)
+ {
+ m_rInnerRef.set(pBody);
+ }
+
+ inline void SAL_CALL reset(reference_type *pBody)
+ {
+ m_rInnerRef.set(pBody);
+ }
+
+ /** Up-casting conversion constructor: Copies interface reference.
+
+ Does not work for up-casts to ambiguous bases. For the special case of
+ up-casting to Reference< XInterface >, see the corresponding conversion
+ operator.
+
+ @param rRef another reference
+ */
+ template< class derived_type, class = typename std::enable_if< ::vcl::detail::UpCast< reference_type, derived_type >::t >::type >
+ inline VclPtr<reference_type>& SAL_CALL operator= (derived_type * pBody)
+ {
+ m_rInnerRef.set(pBody);
+ return *this;
+ }
+
+ inline SAL_CALL operator reference_type * () const
+ {
+ return m_rInnerRef.get();
+ }
+
+ inline SAL_CALL operator bool () const
+ {
+ return m_rInnerRef.get() != NULL;
+ }
+
+ inline void SAL_CALL clear()
+ {
+ m_rInnerRef.clear();
+ }
+
+ inline void SAL_CALL reset()
+ {
+ m_rInnerRef.clear();
+ }
+
+ inline void disposeAndClear()
+ {
+ // hold it alive for the lifetime of this method
+ ::rtl::Reference<reference_type> aTmp(m_rInnerRef);
+ m_rInnerRef.clear(); // we should use some 'swap' method ideally ;-)
+ if (aTmp.get()) {
+ aTmp->disposeOnce();
+ }
+ }
+
+ /** Returns True if handle points to the same body.
+ */
+ template<class T>
+ inline bool SAL_CALL operator== (const VclPtr<T> & handle) const
+ {
+ return (get() == handle.get());
+ }
+
+ /** Needed to place VclPtr's into STL collection.
+ */
+ inline bool SAL_CALL operator!= (const VclPtr<reference_type> & handle) const
+ {
+ return (m_rInnerRef != handle.m_rInnerRef);
+ }
+
+ /** Makes comparing against NULL easier, resolves compile-time ambiguity */
+ inline bool SAL_CALL operator!= (::std::nullptr_t ) const
+ {
+ return (get() != nullptr);
+ }
+
+ /** Needed to place VclPtr's into STL collection.
+ */
+ inline bool SAL_CALL operator< (const VclPtr<reference_type> & handle) const
+ {
+ return (m_rInnerRef < handle.m_rInnerRef);
+ }
+
+ /** Needed to place VclPtr's into STL collection.
+ */
+ inline bool SAL_CALL operator> (const VclPtr<reference_type> & handle) const
+ {
+ return (m_rInnerRef > handle.m_rInnerRef);
+ }
+}; // class VclPtr
+
+/**
+ * A construction helper for a temporary VclPtr. Since VclPtr types
+ * are created with a reference-count of one - to help fit into
+ * the existing code-flow; this helps us to construct them easily.
+ * see also VclPtr::Create and ScopedVclPtr
+ *
+ * For more details on the design please see vcl/README.lifecycle
+ *
+ * @param reference_type must be a subclass of vcl::Window
+ */
+template <class reference_type>
+class VclPtrInstance : public VclPtr<reference_type>
+{
+public:
+ template<typename... Arg> VclPtrInstance(Arg &&... arg)
+ : VclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE )
+ {
+ }
+};
+
+template <class reference_type>
+class ScopedVclPtr : public VclPtr<reference_type>
+{
+public:
+ /** Constructor...
+ */
+ inline ScopedVclPtr()
+ : VclPtr<reference_type>()
+ {}
+
+ /** Constructor
+ */
+ inline ScopedVclPtr (reference_type * pBody)
+ : VclPtr<reference_type>(pBody)
+ {}
+
+ /** Copy constructor...
+ */
+ inline ScopedVclPtr (const VclPtr<reference_type> & handle)
+ : VclPtr<reference_type>(handle)
+ {}
+
+ /**
+ Assignment that releases the last reference.
+ */
+ inline ScopedVclPtr<reference_type>& SAL_CALL operator= (reference_type * pBody)
+ {
+ VclPtr<reference_type>::disposeAndClear();
+ VclPtr<reference_type>::set(pBody);
+ return *this;
+ }
+
+ /** Up-casting conversion constructor: Copies interface reference.
+
+ Does not work for up-casts to ambiguous bases. For the special case of
+ up-casting to Reference< XInterface >, see the corresponding conversion
+ operator.
+
+ @param rRef another reference
+ */
+ template< class derived_type >
+ inline ScopedVclPtr(
+ const VclPtr< derived_type > & rRef,
+ typename ::vcl::detail::UpCast< reference_type, derived_type >::t = 0 )
+ : VclPtr<reference_type>( rRef )
+ {
+ }
+
+ ~ScopedVclPtr()
+ {
+ VclPtr<reference_type>::disposeAndClear();
+ assert(VclPtr<reference_type>::get() == nullptr); // make sure there are no lingering references
+ }
+
+private:
+ // Most likely we don't want this default copy-construtor.
+ ScopedVclPtr (const ScopedVclPtr<reference_type> &) SAL_DELETED_FUNCTION;
+ // And certainly we don't want a default assignment operator.
+ ScopedVclPtr<reference_type>& SAL_CALL operator= (const ScopedVclPtr<reference_type> &) SAL_DELETED_FUNCTION;
+
+protected:
+ inline ScopedVclPtr (reference_type * pBody, __sal_NoAcquire)
+ : VclPtr<reference_type>(pBody, SAL_NO_ACQUIRE)
+ {}
+};
+
+/**
+ * A construction helper for ScopedVclPtr. Since VclPtr types are created
+ * with a reference-count of one - to help fit into the existing
+ * code-flow; this helps us to construct them easily.
+ *
+ * For more details on the design please see vcl/README.lifecycle
+ *
+ * @param reference_type must be a subclass of vcl::Window
+ */
+template <class reference_type>
+class ScopedVclPtrInstance : public ScopedVclPtr<reference_type>
+{
+public:
+ template<typename... Arg> ScopedVclPtrInstance(Arg &&... arg)
+ : ScopedVclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE )
+ {
+ }
+};
+
+#endif // INCLUDED_VCL_PTR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index 06dbae6ddffa..3720a19c98f3 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -35,8 +35,8 @@ class VCL_DLLPUBLIC VirtualDevice : public OutputDevice
private:
SalVirtualDevice* mpVirDev;
- VirtualDevice* mpPrev;
- VirtualDevice* mpNext;
+ VclPtr<VirtualDevice> mpPrev;
+ VclPtr<VirtualDevice> mpNext;
sal_uInt16 mnBitCount;
bool mbScreenComp;
sal_Int8 mnAlphaDepth;
@@ -118,6 +118,7 @@ public:
sal_uInt16 nBitCount);
virtual ~VirtualDevice();
+ virtual void dispose() SAL_OVERRIDE;
virtual void EnableRTL( bool bEnable = true ) SAL_OVERRIDE;
diff --git a/include/vcl/waitobj.hxx b/include/vcl/waitobj.hxx
index d6deecf33f29..daf0e2a68a4f 100644
--- a/include/vcl/waitobj.hxx
+++ b/include/vcl/waitobj.hxx
@@ -26,7 +26,7 @@
class VCL_DLLPUBLIC WaitObject
{
private:
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
public:
WaitObject( vcl::Window* pWindow )
{
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index bc20cbe7550b..3134e5012258 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -31,9 +31,7 @@
#include <vcl/apptypes.hxx>
#include <vcl/cursor.hxx>
#include <vcl/inputctx.hxx>
-#include <vcl/vclevent.hxx>
-// Only for compatibility - because many people outside haven't included event.hxx
-#include <vcl/event.hxx>
+#include <vcl/keycodes.hxx>
#include <vcl/region.hxx>
#include <vcl/salnativewidgets.hxx>
#include <rtl/ustring.hxx>
@@ -63,6 +61,7 @@ class CommandEvent;
class TrackingEvent;
class HelpEvent;
class DataChangedEvent;
+class VclSimpleEvent;
class NotifyEvent;
class SystemWindow;
class SalFrame;
@@ -119,6 +118,8 @@ namespace vcl {
namespace svt { class PopupWindowControllerImpl; }
+template<class T> class VclPtr;
+
// - WindowTypes -
@@ -361,6 +362,8 @@ class VclBuilder;
class ImplDockingWindowWrapper;
class ImplPopupFloatWin;
class MenuFloatingWindow;
+class LifecycleTest;
+
namespace svt { class PopupWindowControllerImpl; }
struct WindowResHeader
@@ -390,6 +393,7 @@ class VCL_DLLPUBLIC Window : public ::OutputDevice, public Resource
friend class ::ImplBorderWindow;
friend class ::VclBuilder;
friend class ::PaintHelper;
+ friend class ::LifecycleTest;
// TODO: improve missing functionality
// only required because of SetFloatingMode()
@@ -411,12 +415,6 @@ private:
WindowImpl* mpWindowImpl;
- // This is a first attempt to start to remove the dependency of Window on
- // OutputDevice
- ::OutputDevice* mpOutputDevice;
-
- mutable int mnRefCnt; // reference count
-
#ifdef DBG_UTIL
friend const char* ::ImplDbgCheckWindow( const void* pObj );
#endif
@@ -495,24 +493,10 @@ public:
SAL_DLLPRIVATE static void ImplCalcSymbolRect( Rectangle& rRect );
-private:
- template<typename T> friend class ::rtl::Reference;
-
- inline void acquire() const
- {
- mnRefCnt++;
- }
-
- inline void release() const
- {
- if (!--mnRefCnt)
- delete this;
- }
-
protected:
/** This is intended to be used to clear any locally held references to other Window-subclass objects */
- virtual void dispose() {}
+ virtual void dispose() SAL_OVERRIDE;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData );
@@ -656,7 +640,7 @@ private:
SAL_DLLPRIVATE long ImplGetUnmirroredOutOffX();
// retrieves the list of owner draw decorated windows for this window hiearchy
- SAL_DLLPRIVATE ::std::vector<vcl::Window *>& ImplGetOwnerDrawList();
+ SAL_DLLPRIVATE ::std::vector<VclPtr<vcl::Window> >& ImplGetOwnerDrawList();
SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow();
@@ -706,8 +690,8 @@ public:
Window( vcl::Window* pParent, const ResId& rResId );
virtual ~Window();
- ::OutputDevice const* GetOutDev() const { return mpOutputDevice; };
- ::OutputDevice* GetOutDev() { return mpOutputDevice; };
+ ::OutputDevice const* GetOutDev() const;
+ ::OutputDevice* GetOutDev();
virtual void EnableRTL ( bool bEnable = true ) SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt );
@@ -765,6 +749,7 @@ public:
bool IsMenuFloatingWindow() const;
bool IsToolbarFloatingWindow() const;
bool IsTopWindow() const;
+ bool IsDisposed() const;
SystemWindow* GetSystemWindow() const;
void EnableAllResize( bool bEnable = true );
@@ -1424,7 +1409,7 @@ public:
*/
void add_mnemonic_label(FixedText *pLabel);
void remove_mnemonic_label(FixedText *pLabel);
- std::vector<FixedText*> list_mnemonic_labels() const;
+ std::vector<VclPtr<FixedText> > list_mnemonic_labels() const;
/*
* Move this widget to be the nNewPosition'd child of its parent
@@ -1468,6 +1453,11 @@ public:
}
+// Only for compatibility - because many people outside haven't included event.hxx
+// These require Window to be defined for VclPtr<Window>
+#include <vcl/vclevent.hxx>
+#include <vcl/event.hxx>
+
#endif // INCLUDED_VCL_WINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/wrkwin.hxx b/include/vcl/wrkwin.hxx
index 637bfc8779a6..9fa12281bc02 100644
--- a/include/vcl/wrkwin.hxx
+++ b/include/vcl/wrkwin.hxx
@@ -66,6 +66,7 @@ public:
explicit WorkWindow( vcl::Window* pParent, const ::com::sun::star::uno::Any& aSystemWorkWindowToken, WinBits nStyle = WB_STDWORK );
explicit WorkWindow( SystemParentData* pParent ); // Not in the REMOTE-Version
virtual ~WorkWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index d5b22e58d834..08b76150a4ff 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -640,12 +640,12 @@ void LwpPageLayout::GetWidthAndHeight(double& fWidth, double& fHeight)
if(GetUsePrinterSettings())
{
//replaced by printer paper size
- Printer aPrinter;
- bool bScreen = aPrinter.IsDisplayPrinter();
+ ScopedVclPtrInstance< Printer > pPrinter;
+ bool bScreen = pPrinter->IsDisplayPrinter();
if (!bScreen)//Printer available
{
- Size aPaperSize = aPrinter.GetPaperSize();
- aPaperSize = aPrinter.PixelToLogic( aPaperSize, MapMode( MAP_10TH_MM ) );
+ Size aPaperSize = pPrinter->GetPaperSize();
+ aPaperSize = pPrinter->PixelToLogic( aPaperSize, MapMode( MAP_10TH_MM ) );
fWidth = static_cast<double>(aPaperSize.Width())/100; //cm unit
fHeight = static_cast<double>(aPaperSize.Height())/100;
}
diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx
index d26558bae931..47ffd8d8e824 100644
--- a/mysqlc/source/mysqlc_connection.cxx
+++ b/mysqlc/source/mysqlc_connection.cxx
@@ -531,7 +531,7 @@ void SAL_CALL OConnection::close()
MutexGuard aGuard(m_aMutex);
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
}
- dispose();
+ disposeOnce();
}
// XWarningsSupplier
diff --git a/mysqlc/source/mysqlc_resultset.cxx b/mysqlc/source/mysqlc_resultset.cxx
index 2ef646c906f0..662cd458cf99 100644
--- a/mysqlc/source/mysqlc_resultset.cxx
+++ b/mysqlc/source/mysqlc_resultset.cxx
@@ -615,7 +615,7 @@ void SAL_CALL OResultSet::close() throw(SQLException, RuntimeException, std::exc
mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
}
- dispose();
+ disposeOnce();
}
sal_Bool SAL_CALL OResultSet::first() throw(SQLException, RuntimeException, std::exception)
diff --git a/mysqlc/source/mysqlc_statement.cxx b/mysqlc/source/mysqlc_statement.cxx
index f2a15d38f7af..c645a815ee37 100644
--- a/mysqlc/source/mysqlc_statement.cxx
+++ b/mysqlc/source/mysqlc_statement.cxx
@@ -138,7 +138,7 @@ void SAL_CALL OCommonStatement::close()
MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
}
- dispose();
+ disposeOnce();
}
void SAL_CALL OStatement::clearBatch()
diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx
index 0530fedb2aec..2c535c924be0 100644
--- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx
+++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx
@@ -318,7 +318,7 @@ void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
}
- dispose();
+ disposeOnce();
}
// XWarningsSupplier
diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx
index 40582fc07dd3..ece9cea5fb5e 100644
--- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx
+++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx
@@ -410,7 +410,7 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
}
- dispose();
+ disposeOnce();
}
diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx
index bc84cc43c9d5..57ac76492579 100644
--- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx
+++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx
@@ -133,7 +133,7 @@ void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
}
- dispose();
+ disposeOnce();
}
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index d9c6e05b8608..7a7c03b0b331 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -62,11 +62,12 @@ using namespace ::svx;
class OAddFieldWindowListBox: public SvTreeListBox
{
- OAddFieldWindow* m_pTabWin;
+ VclPtr<OAddFieldWindow> m_pTabWin;
public:
OAddFieldWindowListBox( OAddFieldWindow* _pParent );
virtual ~OAddFieldWindowListBox();
+ virtual void dispose() SAL_OVERRIDE;
sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
@@ -113,8 +114,14 @@ OAddFieldWindowListBox::OAddFieldWindowListBox( OAddFieldWindow* _pParent )
OAddFieldWindowListBox::~OAddFieldWindowListBox()
{
+ disposeOnce();
}
+void OAddFieldWindowListBox::dispose()
+{
+ m_pTabWin.clear();
+ SvTreeListBox::dispose();
+}
sal_Int8 OAddFieldWindowListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
{
@@ -151,11 +158,11 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent
,::comphelper::OPropertyChangeListener(m_aMutex)
,::comphelper::OContainerListener(m_aMutex)
,m_xRowSet(_xRowSet)
- ,m_aActions(this,ModuleRes(RID_TB_SORTING))
- ,m_pListBox(new OAddFieldWindowListBox( this ))
- ,m_aFixedLine(this, ModuleRes(ADDFIELD_FL_HELP_SEPARATOR) )
- ,m_aHelpText(this, ModuleRes(ADDFIELD_HELP_FIELD) )
- ,m_aInsertButton(this, WB_TABSTOP|WB_CENTER)
+ ,m_aActions(VclPtr<ToolBox>::Create(this,ModuleRes(RID_TB_SORTING)))
+ ,m_pListBox(VclPtr<OAddFieldWindowListBox>::Create( this ))
+ ,m_aFixedLine(VclPtr<FixedLine>::Create(this, ModuleRes(ADDFIELD_FL_HELP_SEPARATOR) ))
+ ,m_aHelpText(VclPtr<FixedText>::Create(this, ModuleRes(ADDFIELD_HELP_FIELD) ))
+ ,m_aInsertButton(VclPtr<PushButton>::Create(this, WB_TABSTOP|WB_CENTER))
,m_nCommandType(0)
,m_bEscapeProcessing(false)
,m_pChangeListener(NULL)
@@ -165,13 +172,13 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent
SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
SetMinOutputSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
- m_aActions.SetStyle(m_aActions.GetStyle()|WB_LINESPACING);
- m_aActions.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
+ m_aActions->SetStyle(m_aActions->GetStyle()|WB_LINESPACING);
+ m_aActions->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
- m_aActions.SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction));
- setToolBox(&m_aActions);
- m_aActions.CheckItem(SID_FM_SORTUP);
- m_aActions.EnableItem(SID_ADD_CONTROL_PAIR, false);
+ m_aActions->SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction));
+ setToolBox(m_aActions.get());
+ m_aActions->CheckItem(SID_FM_SORTUP);
+ m_aActions->EnableItem(SID_ADD_CONTROL_PAIR, false);
m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
m_pListBox->SetSelectHdl(LINK( this, OAddFieldWindow, OnSelectHdl ) );
@@ -179,12 +186,12 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent
m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
m_pListBox->Show();
const OUString sTitle(ModuleRes(RID_STR_INSERT));
- m_aInsertButton.SetText(sTitle);
- m_aInsertButton.SetClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
- m_aInsertButton.Show();
+ m_aInsertButton->SetText(sTitle);
+ m_aInsertButton->SetClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
+ m_aInsertButton->Show();
- m_aFixedLine.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
- m_aHelpText.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
+ m_aFixedLine->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
+ m_aHelpText->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
@@ -209,6 +216,11 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent
OAddFieldWindow::~OAddFieldWindow()
{
+ disposeOnce();
+}
+
+void OAddFieldWindow::dispose()
+{
if ( m_pListBox.get() )
{
SvTreeList* pModel = m_pListBox->GetModel();
@@ -222,6 +234,13 @@ OAddFieldWindow::~OAddFieldWindow()
m_pChangeListener->dispose();
if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
+
+ m_aActions.disposeAndClear();
+ m_aFixedLine.disposeAndClear();
+ m_aHelpText.disposeAndClear();
+ m_aInsertButton.disposeAndClear();
+ m_pListBox.disposeAndClear();
+ FloatingWindow::dispose();
}
@@ -307,10 +326,10 @@ void OAddFieldWindow::Update()
{
// ListBox loeschen
m_pListBox->Clear();
- const sal_uInt16 nItemCount = m_aActions.GetItemCount();
+ const sal_uInt16 nItemCount = m_aActions->GetItemCount();
for (sal_uInt16 j = 0; j< nItemCount; ++j)
{
- m_aActions.EnableItem(m_aActions.GetItemId(j),false);
+ m_aActions->EnableItem(m_aActions->GetItemId(j),false);
}
OUString aTitle(ModuleRes(RID_STR_FIELDSELECTION));
@@ -356,7 +375,7 @@ void OAddFieldWindow::Update()
{
for (sal_uInt16 i = 0; i < nItemCount; ++i)
{
- m_aActions.EnableItem(m_aActions.GetItemId(i));
+ m_aActions->EnableItem(m_aActions->GetItemId(i));
}
}
OnSelectHdl(NULL);
@@ -380,15 +399,15 @@ void OAddFieldWindow::Resize()
const Size aFixedTextSize(LogicToPixel( Size( FIXEDTEXT_WIDTH, FIXEDTEXT_HEIGHT ), MAP_APPFONT ));
// ToolBar
- Size aToolbarSize( m_aActions.GetSizePixel() );
+ Size aToolbarSize( m_aActions->GetSizePixel() );
Point aToolbarPos( aRelated.Width(), aRelated.Height());
- m_aActions.SetPosPixel(Point(aToolbarPos.X(), aToolbarPos.Y()));
+ m_aActions->SetPosPixel(Point(aToolbarPos.X(), aToolbarPos.Y()));
Size aLBSize( aWindowSize );
aLBSize.Width() -= ( 2 * aRelated.Width() );
// help text
- const Size aHelpTextSize = m_aHelpText.CalcMinimumSize(aLBSize.Width());
+ const Size aHelpTextSize = m_aHelpText->CalcMinimumSize(aLBSize.Width());
// ListBox
Point aLBPos( aRelated.Width(), aRelated.Height() + aToolbarSize.Height() + aRelated.Height() );
@@ -402,11 +421,11 @@ void OAddFieldWindow::Resize()
// FixedLine
Size aFLSize( aLBSize.Width(),aFixedTextSize.Height() );
Point aFLPos( aRelated.Width(), aLBPos.Y() + aLBSize.Height() + aRelated.Height());
- m_aFixedLine.SetPosSizePixel( aFLPos, aFLSize );
+ m_aFixedLine->SetPosSizePixel( aFLPos, aFLSize );
// Help text
Point aFTPos( aRelated.Width(), aFLPos.Y() + aFLSize.Height() + aRelated.Height() );
- m_aHelpText.SetPosSizePixel( aFTPos, aHelpTextSize );
+ m_aHelpText->SetPosSizePixel( aFTPos, aHelpTextSize );
}
uno::Reference< sdbc::XConnection> OAddFieldWindow::getConnection() const
@@ -477,7 +496,7 @@ void OAddFieldWindow::_elementReplaced( const container::ContainerEvent& /*_rEve
IMPL_LINK( OAddFieldWindow, OnSelectHdl, void* ,/*_pAddFieldDlg*/)
{
- m_aActions.EnableItem(SID_ADD_CONTROL_PAIR, ( m_pListBox.get() && m_pListBox->GetSelectionCount() > 0 ));
+ m_aActions->EnableItem(SID_ADD_CONTROL_PAIR, ( m_pListBox.get() && m_pListBox->GetSelectionCount() > 0 ));
return 0L;
}
@@ -495,7 +514,7 @@ void OAddFieldWindow::setImageList(sal_Int16 _eBitmapSet)
sal_Int16 nN = IMG_ADDFIELD_DLG_SC;
if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE )
nN = IMG_ADDFIELD_DLG_LC;
- m_aActions.SetImageList(ImageList(ModuleRes(nN)));
+ m_aActions->SetImageList(ImageList(ModuleRes(nN)));
}
void OAddFieldWindow::resizeControls(const Size& _rDiff)
@@ -509,27 +528,27 @@ void OAddFieldWindow::resizeControls(const Size& _rDiff)
IMPL_LINK( OAddFieldWindow, OnSortAction, ToolBox*, /*NOTINTERESTEDIN*/ )
{
- const sal_uInt16 nCurItem = m_aActions.GetCurItemId();
+ const sal_uInt16 nCurItem = m_aActions->GetCurItemId();
if ( SID_ADD_CONTROL_PAIR == nCurItem )
OnDoubleClickHdl(NULL);
else
{
- if ( SID_FM_REMOVE_FILTER_SORT == nCurItem || !m_aActions.IsItemChecked(nCurItem) )
+ if ( SID_FM_REMOVE_FILTER_SORT == nCurItem || !m_aActions->IsItemChecked(nCurItem) )
{
- const sal_uInt16 nItemCount = m_aActions.GetItemCount();
+ const sal_uInt16 nItemCount = m_aActions->GetItemCount();
for (sal_uInt16 j = 0; j< nItemCount; ++j)
{
- const sal_uInt16 nItemId = m_aActions.GetItemId(j);
+ const sal_uInt16 nItemId = m_aActions->GetItemId(j);
if ( nCurItem != nItemId )
- m_aActions.CheckItem(nItemId,false);
+ m_aActions->CheckItem(nItemId,false);
}
SvSortMode eSortMode = SortNone;
if ( SID_FM_REMOVE_FILTER_SORT != nCurItem )
{
- m_aActions.CheckItem(nCurItem,!m_aActions.IsItemChecked(nCurItem));
- if ( m_aActions.IsItemChecked(SID_FM_SORTUP) )
+ m_aActions->CheckItem(nCurItem,!m_aActions->IsItemChecked(nCurItem));
+ if ( m_aActions->IsItemChecked(SID_FM_SORTUP) )
eSortMode = SortAscending;
- else if ( m_aActions.IsItemChecked(SID_FM_SORTDOWN) )
+ else if ( m_aActions->IsItemChecked(SID_FM_SORTDOWN) )
eSortMode = SortDescending;
}
diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx
index 16aa8a31120e..24e2bce7782f 100644
--- a/reportdesign/source/ui/dlg/CondFormat.cxx
+++ b/reportdesign/source/ui/dlg/CondFormat.cxx
@@ -130,7 +130,16 @@ namespace rptui
ConditionalFormattingDialog::~ConditionalFormattingDialog()
{
+ disposeOnce();
+ }
+
+ void ConditionalFormattingDialog::dispose()
+ {
m_aConditions.clear();
+ m_pConditionPlayground.clear();
+ m_pScrollWindow.clear();
+ m_pCondScroll.clear();
+ ModalDialog::dispose();
}
void ConditionalFormattingDialog::impl_updateConditionIndicies()
@@ -183,7 +192,7 @@ namespace rptui
::comphelper::copyProperties(m_xCopy.get(),xCond.get());
m_xCopy->insertByIndex( _nNewCondIndex, makeAny( xCond ) );
- ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) );
+ VclPtrInstance<Condition> pCon( m_pConditionPlayground, *this, m_rController );
pCon->setCondition( xCond );
pCon->reorderWithinParent(_nNewCondIndex);
m_aConditions.insert( m_aConditions.begin() + _nNewCondIndex, pCon );
@@ -264,7 +273,7 @@ namespace rptui
// do this in two steps, so we don't become inconsistent if any of the UNO actions fails
Any aMovedCondition;
- ConditionPtr pMovedCondition;
+ Condition *pMovedCondition;
try
{
aMovedCondition = m_xCopy->getByIndex( (sal_Int32)nOldConditionIndex );
@@ -342,7 +351,7 @@ namespace rptui
sal_Int32 nCount = m_xCopy->getCount();
for ( sal_Int32 i = 0; i < nCount ; ++i )
{
- ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) );
+ VclPtrInstance<Condition> pCon( m_pConditionPlayground, *this, m_rController );
Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY );
pCon->reorderWithinParent(i);
pCon->setCondition( xCond );
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index 26e5989dce07..1ef8d1e7bf90 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -97,11 +97,13 @@ IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton )
class OColorPopup : public FloatingWindow
{
DECL_LINK( SelectHdl, void * );
- Condition* m_pCondition;
+ VclPtr<Condition> m_pCondition;
sal_uInt16 m_nSlotId;
public:
OColorPopup(vcl::Window* _pParent,Condition* _pCondition);
- ValueSet m_aColorSet;
+ virtual ~OColorPopup();
+ virtual void dispose() SAL_OVERRIDE;
+ VclPtr<ValueSet> m_aColorSet;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
@@ -114,9 +116,9 @@ OColorPopup::OColorPopup(vcl::Window* _pParent,Condition* _pCondition)
:FloatingWindow(_pParent, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL ))
,m_pCondition(_pCondition)
,m_nSlotId(0)
-,m_aColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) )
+,m_aColorSet( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT)) )
{
- m_aColorSet.SetHelpId( HID_RPT_POPUP_COLOR_CTRL );
+ m_aColorSet->SetHelpId( HID_RPT_POPUP_COLOR_CTRL );
SetHelpId( HID_RPT_POPUP_COLOR );
const Size aSize12( 13, 13 );
short i = 0;
@@ -127,34 +129,47 @@ OColorPopup::OColorPopup(vcl::Window* _pParent,Condition* _pCondition)
if ( nCount > PALETTE_SIZE )
// Show scrollbar if more than PALLETTE_SIZE colors are available
- m_aColorSet.SetStyle( m_aColorSet.GetStyle() | WB_VSCROLL );
+ m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_VSCROLL );
for ( i = 0; i < nCount; i++ )
{
XColorEntry* pEntry = pColorList->GetColor(i);
- m_aColorSet.InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() );
+ m_aColorSet->InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() );
}
while ( i < PALETTE_SIZE )
{
// fill empty elements if less then PALLETTE_SIZE colors are available
- m_aColorSet.InsertItem( i+1, aColWhite, aStrWhite );
+ m_aColorSet->InsertItem( i+1, aColWhite, aStrWhite );
i++;
}
- m_aColorSet.SetSelectHdl( LINK( this, OColorPopup, SelectHdl ) );
- m_aColorSet.SetColCount( PALETTE_X );
- m_aColorSet.SetLineCount( PALETTE_Y );
- Size aSize = m_aColorSet.CalcWindowSizePixel( aSize12 );
+ m_aColorSet->SetSelectHdl( LINK( this, OColorPopup, SelectHdl ) );
+ m_aColorSet->SetColCount( PALETTE_X );
+ m_aColorSet->SetLineCount( PALETTE_Y );
+ Size aSize = m_aColorSet->CalcWindowSizePixel( aSize12 );
aSize.Width() += 4;
aSize.Height() += 4;
SetOutputSizePixel( aSize );
- m_aColorSet.Show();
+ m_aColorSet->Show();
+}
+
+OColorPopup::~OColorPopup()
+{
+ disposeOnce();
+}
+
+void OColorPopup::dispose()
+{
+ disposeBuilder();
+ m_aColorSet.clear();
+ m_pCondition.clear();
+ FloatingWindow::dispose();
}
void OColorPopup::KeyInput( const KeyEvent& rKEvt )
{
- m_aColorSet.KeyInput(rKEvt);
+ m_aColorSet->KeyInput(rKEvt);
}
void OColorPopup::Resize()
@@ -162,12 +177,12 @@ void OColorPopup::Resize()
Size aSize = GetOutputSizePixel();
aSize.Width() -= 4;
aSize.Height() -= 4;
- m_aColorSet.SetPosSizePixel( Point(2,2), aSize );
+ m_aColorSet->SetPosSizePixel( Point(2,2), aSize );
}
void OColorPopup::StartSelection()
{
- m_aColorSet.StartSelection();
+ m_aColorSet->StartSelection();
}
void OColorPopup::SetSlotId(sal_uInt16 _nSlotId)
@@ -175,20 +190,20 @@ void OColorPopup::SetSlotId(sal_uInt16 _nSlotId)
m_nSlotId = _nSlotId;
if ( SID_ATTR_CHAR_COLOR_BACKGROUND == _nSlotId || SID_BACKGROUND_COLOR == _nSlotId )
{
- m_aColorSet.SetStyle( m_aColorSet.GetStyle() | WB_NONEFIELD );
- m_aColorSet.SetText( OUString(ModuleRes( STR_TRANSPARENT )) );
+ m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_NONEFIELD );
+ m_aColorSet->SetText( OUString(ModuleRes( STR_TRANSPARENT )) );
}
}
IMPL_LINK_NOARG(OColorPopup, SelectHdl)
{
- sal_uInt16 nItemId = m_aColorSet.GetSelectItemId();
- Color aColor( nItemId == 0 ? Color( COL_TRANSPARENT ) : m_aColorSet.GetItemColor( nItemId ) );
+ sal_uInt16 nItemId = m_aColorSet->GetSelectItemId();
+ Color aColor( nItemId == 0 ? Color( COL_TRANSPARENT ) : m_aColorSet->GetItemColor( nItemId ) );
/* #i33380# Moved the following line above the Dispatch() calls.
This instance may be deleted in the meantime (i.e. when a dialog is opened
while in Dispatch()), accessing members will crash in this case. */
- m_aColorSet.SetNoSelection();
+ m_aColorSet->SetNoSelection();
if ( IsInPopupMode() )
EndPopupMode();
@@ -294,20 +309,36 @@ sal_uInt16 Condition::mapToolbarItemToSlotId(sal_uInt16 nItemId) const
Condition::~Condition()
{
+ disposeOnce();
+}
+
+void Condition::dispose()
+{
m_bInDestruction = true;
- delete m_pColorFloat;
delete m_pBtnUpdaterFontColor;
delete m_pCondLHS;
delete m_pCondRHS;
delete m_pBtnUpdaterBackgroundColor;
+ m_pHeader.clear();
+ m_pConditionType.clear();
+ m_pOperationList.clear();
+ m_pOperandGlue.clear();
+ m_pActions.clear();
+ m_pPreview.clear();
+ m_pMoveUp.clear();
+ m_pMoveDown.clear();
+ m_pAddCondition.clear();
+ m_pRemoveCondition.clear();
+ m_pColorFloat.disposeAndClear();
+ VclHBox::dispose();
}
IMPL_LINK( Condition, DropdownClick, ToolBox*, /*pToolBar*/ )
{
sal_uInt16 nId( m_pActions->GetCurItemId() );
if ( !m_pColorFloat )
- m_pColorFloat = new OColorPopup(m_pActions,this);
+ m_pColorFloat = VclPtr<OColorPopup>::Create(m_pActions,this);
sal_uInt16 nTextId = 0;
if (nId == m_nFontColorId)
diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx
index 14fa15fba7cc..01a3b8cb29cf 100644
--- a/reportdesign/source/ui/dlg/Condition.hxx
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -49,9 +49,9 @@ namespace rptui
class ConditionField
{
- Condition* m_pParent;
- Edit* m_pSubEdit;
- PushButton* m_pFormula;
+ VclPtr<Condition> m_pParent;
+ VclPtr<Edit> m_pSubEdit;
+ VclPtr<PushButton> m_pFormula;
DECL_LINK( OnFormula, Button* );
public:
@@ -77,19 +77,19 @@ namespace rptui
::rptui::OReportController& m_rController;
IConditionalFormatAction& m_rAction;
- FixedText* m_pHeader;
- ListBox* m_pConditionType;
- ListBox* m_pOperationList;
- ConditionField* m_pCondLHS;
- FixedText* m_pOperandGlue;
- ConditionField* m_pCondRHS;
- ToolBox* m_pActions;
- SvxFontPrevWindow* m_pPreview;
- PushButton* m_pMoveUp;
- PushButton* m_pMoveDown;
- PushButton* m_pAddCondition;
- PushButton* m_pRemoveCondition;
- OColorPopup* m_pColorFloat;
+ VclPtr<FixedText> m_pHeader;
+ VclPtr<ListBox> m_pConditionType;
+ VclPtr<ListBox> m_pOperationList;
+ ConditionField* m_pCondLHS;
+ VclPtr<FixedText> m_pOperandGlue;
+ ConditionField* m_pCondRHS;
+ VclPtr<ToolBox> m_pActions;
+ VclPtr<SvxFontPrevWindow> m_pPreview;
+ VclPtr<PushButton> m_pMoveUp;
+ VclPtr<PushButton> m_pMoveDown;
+ VclPtr<PushButton> m_pAddCondition;
+ VclPtr<PushButton> m_pRemoveCondition;
+ VclPtr<OColorPopup> m_pColorFloat;
::svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon
::svx::ToolboxButtonColorUpdater* m_pBtnUpdaterBackgroundColor;
@@ -107,6 +107,7 @@ namespace rptui
public:
Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController );
virtual ~Condition();
+ virtual void dispose() SAL_OVERRIDE;
/** will be called when the id of the image list needs to change.
@param _eBitmapSet
diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx
index eaba66735718..caad1e3bf1aa 100644
--- a/reportdesign/source/ui/dlg/DateTime.cxx
+++ b/reportdesign/source/ui/dlg/DateTime.cxx
@@ -113,6 +113,19 @@ ODateTimeDialog::ODateTimeDialog( vcl::Window* _pParent
ODateTimeDialog::~ODateTimeDialog()
{
+ disposeOnce();
+}
+
+void ODateTimeDialog::dispose()
+{
+ m_pDate.clear();
+ m_pFTDateFormat.clear();
+ m_pDateListBox.clear();
+ m_pTime.clear();
+ m_pFTTimeFormat.clear();
+ m_pTimeListBox.clear();
+ m_pPB_OK.clear();
+ ModalDialog::dispose();
}
short ODateTimeDialog::Execute()
diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx
index 4d7746303d45..0854653fb21c 100644
--- a/reportdesign/source/ui/dlg/Formula.cxx
+++ b/reportdesign/source/ui/dlg/Formula.cxx
@@ -87,16 +87,21 @@ void FormulaDialog::fill()
FormulaDialog::~FormulaDialog()
{
+ disposeOnce();
+}
+
+void FormulaDialog::dispose()
+{
if ( m_pAddField )
{
SvtViewOptions aDlgOpt( E_WINDOW, OUString( HID_RPT_FIELD_SEL_WIN ) );
aDlgOpt.SetWindowState(OStringToOUString(m_pAddField->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)), RTL_TEXTENCODING_ASCII_US));
-
- boost::scoped_ptr<vcl::Window> aTemp2(m_pAddField);
- m_pAddField = NULL;
}
StoreFormEditData( m_pFormulaData );
+ m_pEdit.clear();
+ m_pAddField.clear();
+ formula::FormulaModalDialog::dispose();
}
@@ -199,7 +204,7 @@ void FormulaDialog::ToggleCollapsed( RefEdit* _pEdit, RefButton* _pButton)
if ( !m_pAddField )
{
- m_pAddField = new OAddFieldWindow(this,m_xRowSet);
+ m_pAddField = VclPtr<OAddFieldWindow>::Create(this,m_xRowSet);
m_pAddField->SetCreateHdl(LINK( this, FormulaDialog, OnClickHdl ) );
SvtViewOptions aDlgOpt( E_WINDOW, OUString( HID_RPT_FIELD_SEL_WIN ) );
if ( aDlgOpt.Exists() )
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index d420b3611531..5b65fc96568c 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -76,34 +76,51 @@ using namespace ::comphelper;
}
}
-typedef ::svt::EditBrowseBox OFieldExpressionControl_Base;
-typedef ::cppu::WeakImplHelper1< container::XContainerListener > TContainerListenerBase;
-class OFieldExpressionControl : public TContainerListenerBase
- ,public OFieldExpressionControl_Base
+/**
+ * Separated out from OFieldExpressionControl to prevent collision of ref-counted base classes
+ */
+class OFieldExpressionControl;
+class OFieldExpressionControlContainerListener : public ::cppu::WeakImplHelper1< container::XContainerListener >
+{
+ VclPtr<OFieldExpressionControl> mpParent;
+public:
+ OFieldExpressionControlContainerListener(OFieldExpressionControl* pParent) : mpParent(pParent) {}
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ // XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+};
+
+class OFieldExpressionControl : public ::svt::EditBrowseBox
{
::osl::Mutex m_aMutex;
::std::vector<sal_Int32> m_aGroupPositions;
::std::vector<ColumnInfo> m_aColumnInfo;
- ::svt::ComboBoxControl* m_pComboCell;
+ VclPtr<::svt::ComboBoxControl> m_pComboCell;
sal_Int32 m_nDataPos;
sal_Int32 m_nCurrentPos;
ImplSVEvent * m_nPasteEvent;
ImplSVEvent * m_nDeleteEvent;
- OGroupsSortingDialog* m_pParent;
+ VclPtr<OGroupsSortingDialog> m_pParent;
bool m_bIgnoreEvent;
+ OFieldExpressionControlContainerListener aContainerListener;
bool SaveModified(bool _bAppend);
public:
OFieldExpressionControl(OGroupsSortingDialog* _pParentDialog, vcl::Window *_pParent);
virtual ~OFieldExpressionControl();
+ virtual void dispose() SAL_OVERRIDE;
// XEventListener
- virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception );
// XContainerListener
- virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception);
+ void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception);
+ void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception);
virtual Size GetOptimalSize() const SAL_OVERRIDE;
@@ -128,7 +145,7 @@ public:
void moveGroups(const uno::Sequence<uno::Any>& _aGroups,sal_Int32 _nRow,bool _bSelect = true);
virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol) SAL_OVERRIDE;
- using OFieldExpressionControl_Base::GetRowCount;
+ using ::svt::EditBrowseBox::GetRowCount;
protected:
virtual bool IsTabAllowed(bool bForward) const SAL_OVERRIDE;
@@ -163,6 +180,20 @@ public:
};
+
+void OFieldExpressionControlContainerListener::disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception )
+{ mpParent->disposing(Source); }
+
+void OFieldExpressionControlContainerListener::elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception)
+{ mpParent->elementInserted(rEvent); }
+
+void OFieldExpressionControlContainerListener::elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception)
+{ mpParent->elementReplaced(rEvent); }
+
+void OFieldExpressionControlContainerListener::elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception)
+{ mpParent->elementRemoved(rEvent); }
+
+
// class OFieldExpressionControl
OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* _pParentDialog, vcl::Window *_pParent)
:EditBrowseBox( _pParent, EditBrowseBoxFlags::NONE, WB_TABSTOP,
@@ -176,6 +207,7 @@ OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* _pParentD
,m_nDeleteEvent(0)
,m_pParent(_pParentDialog)
,m_bIgnoreEvent(false)
+ ,aContainerListener(this)
{
SetBorderStyle(WindowBorderStyle::MONO);
}
@@ -183,9 +215,15 @@ OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* _pParentD
OFieldExpressionControl::~OFieldExpressionControl()
{
- WeakImplHelper1::acquire();
+ disposeOnce();
+}
+
+
+void OFieldExpressionControl::dispose()
+{
+ aContainerListener.WeakImplHelper1::acquire();
uno::Reference< report::XGroups > xGroups = m_pParent->getGroups();
- xGroups->removeContainerListener(this);
+ xGroups->removeContainerListener(&aContainerListener);
// delete events from queue
if( m_nPasteEvent )
@@ -193,7 +231,9 @@ OFieldExpressionControl::~OFieldExpressionControl()
if( m_nDeleteEvent )
Application::RemoveUserEvent( m_nDeleteEvent );
- delete m_pComboCell;
+ m_pComboCell.disposeAndClear();
+ m_pParent.clear();
+ ::svt::EditBrowseBox::dispose();
}
uno::Sequence<uno::Any> OFieldExpressionControl::fillSelectedGroups()
@@ -352,7 +392,7 @@ void OFieldExpressionControl::lateInit()
InsertHandleColumn(static_cast<sal_uInt16>(GetTextWidth(OUString('0')) * 4)/*, sal_True */);
InsertDataColumn( FIELD_EXPRESSION, OUString(ModuleRes(STR_RPT_EXPRESSION)), 100);
- m_pComboCell = new ComboBoxControl( &GetDataWindow() );
+ m_pComboCell = VclPtr<ComboBoxControl>::Create( &GetDataWindow() );
m_pComboCell->SetSelectHdl(LINK(this,OFieldExpressionControl,CBChangeHdl));
m_pComboCell->SetHelpId(HID_RPT_FIELDEXPRESSION);
@@ -370,7 +410,7 @@ void OFieldExpressionControl::lateInit()
if( m_pParent->isReadOnly() )
nMode |= BrowserMode::HIDECURSOR;
SetMode(nMode);
- xGroups->addContainerListener(this);
+ xGroups->addContainerListener(&aContainerListener);
}
else
// not the first call
@@ -936,7 +976,7 @@ OGroupsSortingDialog::OGroupsSortingDialog(vcl::Window* _pParent, bool _bReadOnl
get(m_pHelpWindow, "helptext");
m_pHelpWindow->set_height_request(GetTextHeight() * 4);
get(m_pProperties, "properties");
- m_pFieldExpression = new OFieldExpressionControl(this, get<vcl::Window>("box"));
+ m_pFieldExpression = VclPtr<OFieldExpressionControl>::Create(this, get<vcl::Window>("box"));
m_pFieldExpression->set_hexpand(true);
m_pFieldExpression->set_vexpand(true);
@@ -971,11 +1011,26 @@ OGroupsSortingDialog::OGroupsSortingDialog(vcl::Window* _pParent, bool _bReadOnl
OGroupsSortingDialog::~OGroupsSortingDialog()
{
- delete m_pFieldExpression;
+ disposeOnce();
+}
+
+void OGroupsSortingDialog::dispose()
+{
m_xColumns.clear();
m_pReportListener->dispose();
if ( m_pCurrentGroupListener.is() )
m_pCurrentGroupListener->dispose();
+ m_pToolBox.clear();
+ m_pProperties.clear();
+ m_pOrderLst.clear();
+ m_pHeaderLst.clear();
+ m_pFooterLst.clear();
+ m_pGroupOnLst.clear();
+ m_pGroupIntervalEd.clear();
+ m_pKeepTogetherLst.clear();
+ m_pHelpWindow.clear();
+ m_pFieldExpression.disposeAndClear();
+ FloatingWindow::dispose();
}
void OGroupsSortingDialog::UpdateData( )
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index a85071eebd3f..dd4185ddab20 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -121,7 +121,7 @@ class NavigatorTree : public ::cppu::BaseMutex
uno::Reference< uno::XInterface > m_xContent;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pListener;
::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
- NavigatorTree* m_pTree;
+ VclPtr<NavigatorTree> m_pTree;
public:
UserData(NavigatorTree* _pTree,const uno::Reference<uno::XInterface>& _xContent);
virtual ~UserData();
@@ -182,6 +182,7 @@ protected:
public:
NavigatorTree(vcl::Window* pParent,OReportController& _rController );
virtual ~NavigatorTree();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK(OnEntrySelDesel, NavigatorTree*);
DECL_LINK( OnDropActionTimer, void* );
@@ -255,6 +256,11 @@ NavigatorTree::NavigatorTree( vcl::Window* pParent,OReportController& _rControll
NavigatorTree::~NavigatorTree()
{
+ disposeOnce();
+}
+
+void NavigatorTree::dispose()
+{
SvTreeListEntry* pCurrent = First();
while ( pCurrent )
{
@@ -263,6 +269,7 @@ NavigatorTree::~NavigatorTree()
}
m_pReportListener->dispose();
m_pSelectionListener->dispose();
+ SvTreeListBox::dispose();
}
void NavigatorTree::Command( const CommandEvent& rEvt )
@@ -875,13 +882,13 @@ public:
uno::Reference< report::XReportDefinition> m_xReport;
::rptui::OReportController& m_rController;
- ::std::unique_ptr<NavigatorTree> m_pNavigatorTree;
+ VclPtr<NavigatorTree> m_pNavigatorTree;
};
ONavigatorImpl::ONavigatorImpl(OReportController& _rController,ONavigator* _pParent)
:m_xReport(_rController.getReportDefinition())
,m_rController(_rController)
- ,m_pNavigatorTree(new NavigatorTree(_pParent->get<vcl::Window>("box"),_rController))
+ ,m_pNavigatorTree(VclPtr<NavigatorTree>::Create(_pParent->get<vcl::Window>("box"),_rController))
{
reportdesign::OReportVisitor aVisitor(m_pNavigatorTree.get());
aVisitor.start(m_xReport);
diff --git a/reportdesign/source/ui/dlg/PageNumber.cxx b/reportdesign/source/ui/dlg/PageNumber.cxx
index bc2419b412f2..f7a799a53832 100644
--- a/reportdesign/source/ui/dlg/PageNumber.cxx
+++ b/reportdesign/source/ui/dlg/PageNumber.cxx
@@ -63,6 +63,18 @@ OPageNumberDialog::OPageNumberDialog( vcl::Window* _pParent
OPageNumberDialog::~OPageNumberDialog()
{
+ disposeOnce();
+}
+
+void OPageNumberDialog::dispose()
+{
+ m_pPageN.clear();
+ m_pPageNofM.clear();
+ m_pTopPage.clear();
+ m_pBottomPage.clear();
+ m_pAlignmentLst.clear();
+ m_pShowNumberOnFirstPage.clear();
+ ModalDialog::dispose();
}
short OPageNumberDialog::Execute()
diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx
index fba3c7abf59c..6a30ee88da2e 100644
--- a/reportdesign/source/ui/inc/AddField.hxx
+++ b/reportdesign/source/ui/inc/AddField.hxx
@@ -54,18 +54,18 @@ class OAddFieldWindow :public FloatingWindow
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xRowSet;
- ToolBox m_aActions;
+ VclPtr<ToolBox> m_aActions;
- ::std::unique_ptr<OAddFieldWindowListBox> m_pListBox;
- FixedLine m_aFixedLine;
- FixedText m_aHelpText;
+ VclPtr<OAddFieldWindowListBox> m_pListBox;
+ VclPtr<FixedLine> m_aFixedLine;
+ VclPtr<FixedText> m_aHelpText;
- PushButton m_aInsertButton;
+ VclPtr<PushButton> m_aInsertButton;
Link m_aCreateLink;
- OUString m_aCommandName;
- OUString m_sFilter;
+ OUString m_aCommandName;
+ OUString m_sFilter;
sal_Int32 m_nCommandType;
- bool m_bEscapeProcessing;
+ bool m_bEscapeProcessing;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener;
::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
@@ -80,6 +80,7 @@ public:
, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet);
virtual ~OAddFieldWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& _rNEvt ) SAL_OVERRIDE;
diff --git a/reportdesign/source/ui/inc/ColorChanger.hxx b/reportdesign/source/ui/inc/ColorChanger.hxx
index 7a26c606e05b..247863a03211 100644
--- a/reportdesign/source/ui/inc/ColorChanger.hxx
+++ b/reportdesign/source/ui/inc/ColorChanger.hxx
@@ -27,7 +27,7 @@ namespace rptui
class ColorChanger
{
protected:
- OutputDevice* m_pDev;
+ VclPtr<OutputDevice> m_pDev;
public:
ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor)
diff --git a/reportdesign/source/ui/inc/ColorListener.hxx b/reportdesign/source/ui/inc/ColorListener.hxx
index e85da835e3df..c0ebffb83922 100644
--- a/reportdesign/source/ui/inc/ColorListener.hxx
+++ b/reportdesign/source/ui/inc/ColorListener.hxx
@@ -48,6 +48,7 @@ namespace rptui
public:
OColorListener(vcl::Window* _pParent,const OUString& _sColorEntry);
virtual ~OColorListener();
+ virtual void dispose() SAL_OVERRIDE;
using Window::Notify;
// SfxListener
diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx
index 19c3cc24440e..e0ebc887027d 100644
--- a/reportdesign/source/ui/inc/CondFormat.hxx
+++ b/reportdesign/source/ui/inc/CondFormat.hxx
@@ -70,14 +70,13 @@ namespace rptui
class ConditionalFormattingDialog :public ModalDialog
,public IConditionalFormatAction
{
- typedef ::boost::shared_ptr< Condition > ConditionPtr;
- typedef ::std::vector< ConditionPtr > Conditions;
+ typedef ::std::vector< VclPtr<Condition> > Conditions;
- OModuleClient m_aModuleClient;
- vcl::Window* m_pConditionPlayground;
- Conditions m_aConditions;
- VclScrolledWindow* m_pScrollWindow;
- ScrollBar* m_pCondScroll;
+ OModuleClient m_aModuleClient;
+ VclPtr<vcl::Window> m_pConditionPlayground;
+ Conditions m_aConditions;
+ VclPtr<VclScrolledWindow> m_pScrollWindow;
+ VclPtr<ScrollBar> m_pCondScroll;
::rptui::OReportController& m_rController;
::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel >
@@ -95,7 +94,7 @@ namespace rptui
::rptui::OReportController& _rController
);
virtual ~ConditionalFormattingDialog();
-
+ virtual void dispose() SAL_OVERRIDE;
// Dialog overridables
virtual short Execute() SAL_OVERRIDE;
diff --git a/reportdesign/source/ui/inc/DateTime.hxx b/reportdesign/source/ui/inc/DateTime.hxx
index e03f3ed2b41c..66639a9cafd8 100644
--- a/reportdesign/source/ui/inc/DateTime.hxx
+++ b/reportdesign/source/ui/inc/DateTime.hxx
@@ -40,13 +40,13 @@ class OReportController;
\************************************************************************/
class ODateTimeDialog : public ModalDialog
{
- CheckBox* m_pDate;
- FixedText* m_pFTDateFormat;
- ListBox* m_pDateListBox;
- CheckBox* m_pTime;
- FixedText* m_pFTTimeFormat;
- ListBox* m_pTimeListBox;
- OKButton* m_pPB_OK;
+ VclPtr<CheckBox> m_pDate;
+ VclPtr<FixedText> m_pFTDateFormat;
+ VclPtr<ListBox> m_pDateListBox;
+ VclPtr<CheckBox> m_pTime;
+ VclPtr<FixedText> m_pFTTimeFormat;
+ VclPtr<ListBox> m_pTimeListBox;
+ VclPtr<OKButton> m_pPB_OK;
svt::ControlDependencyManager m_aDateControlling;
svt::ControlDependencyManager m_aTimeControlling;
@@ -81,6 +81,7 @@ public:
,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xHoldAlive
,::rptui::OReportController* _pController);
virtual ~ODateTimeDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
};
diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx
index 0faeb693bd84..90faf2d78595 100644
--- a/reportdesign/source/ui/inc/DesignView.hxx
+++ b/reportdesign/source/ui/inc/DesignView.hxx
@@ -59,21 +59,21 @@ namespace rptui
class ODesignView : public dbaui::ODataView, public SfxBroadcaster, public IMarkedSection
{
private:
- SplitWindow m_aSplitWin;
+ VclPtr<SplitWindow> m_aSplitWin;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xReportComponent;
OReportController& m_rReportController;
- OScrollWindowHelper m_aScrollWindow;
- vcl::Window* m_pTaskPane;
- PropBrw* m_pPropWin;
- OAddFieldWindow* m_pAddField;
+ VclPtr<OScrollWindowHelper> m_aScrollWindow;
+ VclPtr<vcl::Window> m_pTaskPane;
+ VclPtr<PropBrw> m_pPropWin;
+ VclPtr<OAddFieldWindow> m_pAddField;
OSectionView* m_pCurrentView;
- ONavigator* m_pReportExplorer;
+ VclPtr<ONavigator> m_pReportExplorer;
Idle m_aMarkIdle;
Point m_aScrollOffset;
DlgEdMode m_eMode;
- sal_uInt16 m_nCurrentPosition;
- sal_uInt16 m_eActObj;
+ sal_uInt16 m_nCurrentPosition;
+ sal_uInt16 m_eActObj;
bool m_bFirstDraw;
Size m_aGridSizeCoarse;
Size m_aGridSizeFine;
@@ -100,6 +100,7 @@ namespace rptui
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&,
OReportController& _rController);
virtual ~ODesignView();
+ virtual void dispose() SAL_OVERRIDE;
// Window overrides
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -212,8 +213,8 @@ namespace rptui
::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const;
// IMarkedSection
- ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
- ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
+ OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;
/** fills the positions of all collapsed sections.
diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx
index f6d686747f1e..499525178a25 100644
--- a/reportdesign/source/ui/inc/Formula.hxx
+++ b/reportdesign/source/ui/inc/Formula.hxx
@@ -46,12 +46,12 @@ class FormulaDialog : public formula::FormulaModalDialog,
public formula::IControlReferenceHandler
{
::boost::shared_ptr< formula::IFunctionManager > m_aFunctionManager;
- formula::FormEditData* m_pFormulaData;
- OAddFieldWindow* m_pAddField;
+ formula::FormEditData* m_pFormulaData;
+ VclPtr<OAddFieldWindow> m_pAddField;
::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > m_xRowSet;
::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFormulaParser> m_xParser;
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
- formula::RefEdit* m_pEdit;
+ VclPtr<formula::RefEdit> m_pEdit;
OUString m_sFormula;
sal_Int32 m_nStart;
sal_Int32 m_nEnd;
@@ -68,6 +68,7 @@ public:
, svl::SharedStringPool& rStrPool );
virtual ~FormulaDialog();
+ virtual void dispose() SAL_OVERRIDE;
// IFormulaEditorHelper
virtual void notifyChange() SAL_OVERRIDE;
diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx
index 49b6ad0843a7..b67c1285ba98 100644
--- a/reportdesign/source/ui/inc/GroupsSorting.hxx
+++ b/reportdesign/source/ui/inc/GroupsSorting.hxx
@@ -60,21 +60,21 @@ class OGroupsSortingDialog : public FloatingWindow
{
friend class OFieldExpressionControl;
- ToolBox* m_pToolBox;
+ VclPtr<ToolBox> m_pToolBox;
sal_uInt16 m_nMoveUpId;
sal_uInt16 m_nMoveDownId;
sal_uInt16 m_nDeleteId;
- VclContainer* m_pProperties;
- ListBox* m_pOrderLst;
- ListBox* m_pHeaderLst;
- ListBox* m_pFooterLst;
- ListBox* m_pGroupOnLst;
- NumericField* m_pGroupIntervalEd;
- ListBox* m_pKeepTogetherLst;
- FixedText* m_pHelpWindow;
+ VclPtr<VclContainer> m_pProperties;
+ VclPtr<ListBox> m_pOrderLst;
+ VclPtr<ListBox> m_pHeaderLst;
+ VclPtr<ListBox> m_pFooterLst;
+ VclPtr<ListBox> m_pGroupOnLst;
+ VclPtr<NumericField> m_pGroupIntervalEd;
+ VclPtr<ListBox> m_pKeepTogetherLst;
+ VclPtr<FixedText> m_pHelpWindow;
- OFieldExpressionControl* m_pFieldExpression;
+ VclPtr<OFieldExpressionControl> m_pFieldExpression;
::rptui::OReportController* m_pController;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
@@ -145,6 +145,7 @@ public:
,bool _bReadOnly
,::rptui::OReportController* _pController);
virtual ~OGroupsSortingDialog();
+ virtual void dispose() SAL_OVERRIDE;
/** sets the newe columns at the groups dialog.
@param _xColumns the new columns
diff --git a/reportdesign/source/ui/inc/MarkedSection.hxx b/reportdesign/source/ui/inc/MarkedSection.hxx
index 52ee1d3f62e8..84f9258809a2 100644
--- a/reportdesign/source/ui/inc/MarkedSection.hxx
+++ b/reportdesign/source/ui/inc/MarkedSection.hxx
@@ -38,7 +38,7 @@ namespace rptui
public:
/** returns the section which is currently marked.
*/
- virtual ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa) const =0;
+ virtual OSectionWindow* getMarkedSection(NearSectionAccess nsa) const =0;
/** mark the section on the given position .
*
diff --git a/reportdesign/source/ui/inc/PageNumber.hxx b/reportdesign/source/ui/inc/PageNumber.hxx
index fcf6d6b24fe0..43a1915d8e81 100644
--- a/reportdesign/source/ui/inc/PageNumber.hxx
+++ b/reportdesign/source/ui/inc/PageNumber.hxx
@@ -37,14 +37,14 @@ class OReportController;
\************************************************************************/
class OPageNumberDialog : public ModalDialog
{
- RadioButton* m_pPageN;
- RadioButton* m_pPageNofM;
+ VclPtr<RadioButton> m_pPageN;
+ VclPtr<RadioButton> m_pPageNofM;
- RadioButton* m_pTopPage;
- RadioButton* m_pBottomPage;
- ListBox* m_pAlignmentLst;
+ VclPtr<RadioButton> m_pTopPage;
+ VclPtr<RadioButton> m_pBottomPage;
+ VclPtr<ListBox> m_pAlignmentLst;
- CheckBox* m_pShowNumberOnFirstPage;
+ VclPtr<CheckBox> m_pShowNumberOnFirstPage;
::rptui::OReportController* m_pController;
::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>
@@ -57,6 +57,7 @@ public:
,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xHoldAlive
,::rptui::OReportController* _pController);
virtual ~OPageNumberDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
};
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
index aa749e833fd8..a902da39ccb2 100644
--- a/reportdesign/source/ui/inc/ReportController.hxx
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -93,7 +93,7 @@ namespace rptui
TransferableDataHelper m_aSystemClipboard; // content of the clipboard
TransferableClipboardListener*
m_pClipbordNotifier; /// notifier for changes in the clipboard
- OGroupsSortingDialog* m_pGroupsFloater;
+ VclPtr<OGroupsSortingDialog> m_pGroupsFloater;
OXReportControllerObserver* m_pReportControllerObserver;
@@ -457,7 +457,7 @@ namespace rptui
// cppu::OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
- ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const;
OUString getColumnLabel_throw(const OUString& i_sColumnName) const;
diff --git a/reportdesign/source/ui/inc/ReportSection.hxx b/reportdesign/source/ui/inc/ReportSection.hxx
index bef2ae1e2ea4..a34a4fc98322 100644
--- a/reportdesign/source/ui/inc/ReportSection.hxx
+++ b/reportdesign/source/ui/inc/ReportSection.hxx
@@ -45,7 +45,7 @@ namespace rptui
{
OReportPage* m_pPage;
OSectionView* m_pView;
- OSectionWindow* m_pParent;
+ VclPtr<OSectionWindow> m_pParent;
::std::unique_ptr<DlgEdFunc> m_pFunc;
::boost::shared_ptr<OReportModel> m_pModel;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pMulti;
@@ -81,6 +81,7 @@ namespace rptui
public:
OReportSection(OSectionWindow* _pParent,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
virtual ~OReportSection();
+ virtual void dispose() SAL_OVERRIDE;
// window overrides
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx
index a416b74a94bd..7c974bd0ad58 100644
--- a/reportdesign/source/ui/inc/ReportWindow.hxx
+++ b/reportdesign/source/ui/inc/ReportWindow.hxx
@@ -45,10 +45,10 @@ namespace rptui
, public ::cppu::BaseMutex
, public ::comphelper::OPropertyChangeListener
{
- Ruler m_aHRuler;
- ODesignView* m_pView;
- OScrollWindowHelper* m_pParent;
- OViewsWindow m_aViewsWindow;
+ VclPtr<Ruler> m_aHRuler;
+ VclPtr<ODesignView> m_pView;
+ VclPtr<OScrollWindowHelper> m_pParent;
+ VclPtr<OViewsWindow> m_aViewsWindow;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
::std::unique_ptr<DlgEdFactory>
m_pObjFac;
@@ -67,6 +67,7 @@ namespace rptui
public:
OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView);
virtual ~OReportWindow();
+ virtual void dispose() SAL_OVERRIDE;
// Window overrides
virtual void Resize() SAL_OVERRIDE;
@@ -136,7 +137,7 @@ namespace rptui
*/
void showRuler(bool _bShow);
- inline sal_Int32 getRulerHeight() const { return m_aHRuler.GetSizePixel().Height(); }
+ inline sal_Int32 getRulerHeight() const { return m_aHRuler->GetSizePixel().Height(); }
/** returns the total width of the first section
*/
@@ -179,8 +180,8 @@ namespace rptui
void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark);
// IMarkedSection
- ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
- ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
+ OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;
diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx
index ec5cc90d2439..e45d9daac713 100644
--- a/reportdesign/source/ui/inc/ScrollHelper.hxx
+++ b/reportdesign/source/ui/inc/ScrollHelper.hxx
@@ -48,14 +48,14 @@ namespace rptui
, public IMarkedSection
{
private:
- ScrollBar m_aHScroll;
- ScrollBar m_aVScroll;
- ScrollBarBox m_aCornerWin; // window in the bottom right corner
- Size m_aTotalPixelSize;
- ODesignView* m_pParent;
- OReportWindow m_aReportWindow;
+ VclPtr<ScrollBar> m_aHScroll;
+ VclPtr<ScrollBar> m_aVScroll;
+ VclPtr<ScrollBarBox> m_aCornerWin; // window in the bottom right corner
+ Size m_aTotalPixelSize;
+ VclPtr<ODesignView> m_pParent;
+ VclPtr<OReportWindow> m_aReportWindow;
::rtl::Reference<comphelper::OPropertyChangeMultiplexer >
- m_pReportDefintionMultiPlexer; // listener for property changes
+ m_pReportDefintionMultiPlexer; // listener for property changes
DECL_LINK( ScrollHdl, ScrollBar*);
Size ResizeScrollBars();
@@ -74,17 +74,18 @@ namespace rptui
public:
OScrollWindowHelper( ODesignView* _pReportDesignView);
virtual ~OScrollWindowHelper();
+ virtual void dispose() SAL_OVERRIDE;
/** late ctor
*/
void initialize();
- inline Point getThumbPos() const { return Point(m_aHScroll.GetThumbPos(),m_aVScroll.GetThumbPos())/*m_aScrollOffset*/; }
- inline const OReportWindow& getReportWindow() const { return m_aReportWindow; }
+ inline Point getThumbPos() const { return Point(m_aHScroll->GetThumbPos(),m_aVScroll->GetThumbPos())/*m_aScrollOffset*/; }
+ inline const OReportWindow& getReportWindow() const { return *m_aReportWindow.get(); }
void setTotalSize(sal_Int32 _nWidth, sal_Int32 _nHeight);
inline Size getTotalSize() const { return m_aTotalPixelSize; }
- inline ScrollBar& GetHScroll() { return m_aHScroll; }
- inline ScrollBar& GetVScroll() { return m_aVScroll; }
+ inline ScrollBar& GetHScroll() { return *m_aHScroll.get(); }
+ inline ScrollBar& GetVScroll() { return *m_aVScroll.get(); }
// forwards
void SetMode( DlgEdMode _eMode );
@@ -173,8 +174,8 @@ namespace rptui
void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark);
// IMarkedSection
- ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
- ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
+ OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;
diff --git a/reportdesign/source/ui/inc/SectionView.hxx b/reportdesign/source/ui/inc/SectionView.hxx
index 14de81adc63e..c8f14e26ee4b 100644
--- a/reportdesign/source/ui/inc/SectionView.hxx
+++ b/reportdesign/source/ui/inc/SectionView.hxx
@@ -34,8 +34,8 @@ class OReportSection;
class OSectionView : public SdrView
{
private:
- OReportWindow* m_pReportWindow;
- OReportSection* m_pSectionWindow;
+ VclPtr<OReportWindow> m_pReportWindow;
+ VclPtr<OReportSection> m_pSectionWindow;
void ObjectRemovedInAliveMode( const SdrObject* pObject );
OSectionView(const OSectionView&) SAL_DELETED_FUNCTION;
diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx
index 79e184cb9d0b..166c25cd6a48 100644
--- a/reportdesign/source/ui/inc/SectionWindow.hxx
+++ b/reportdesign/source/ui/inc/SectionWindow.hxx
@@ -47,11 +47,11 @@ namespace rptui
, public ::cppu::BaseMutex
, public ::comphelper::OPropertyChangeListener
{
- OViewsWindow* m_pParent;
- OStartMarker m_aStartMarker;
- OReportSection m_aReportSection;
- Splitter m_aSplitter;
- OEndMarker m_aEndMarker;
+ VclPtr<OViewsWindow> m_pParent;
+ VclPtr<OStartMarker> m_aStartMarker;
+ VclPtr<OReportSection> m_aReportSection;
+ VclPtr<Splitter> m_aSplitter;
+ VclPtr<OEndMarker> m_aEndMarker;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pSectionMulti;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pGroupMulti;
@@ -98,10 +98,11 @@ namespace rptui
,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
,const OUString& _sColorEntry);
virtual ~OSectionWindow();
+ virtual void dispose() SAL_OVERRIDE;
- inline OStartMarker& getStartMarker() { return m_aStartMarker; }
- inline OReportSection& getReportSection() { return m_aReportSection; }
- inline OEndMarker& getEndMarker() { return m_aEndMarker; }
+ inline OStartMarker& getStartMarker() { return *m_aStartMarker.get(); }
+ inline OReportSection& getReportSection() { return *m_aReportSection.get(); }
+ inline OEndMarker& getEndMarker() { return *m_aEndMarker.get(); }
inline OViewsWindow* getViewsWindow() { return m_pParent; }
void setCollapsed(bool _bCollapsed);
diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx
index e390024f51a9..270939c266d0 100644
--- a/reportdesign/source/ui/inc/StartMarker.hxx
+++ b/reportdesign/source/ui/inc/StartMarker.hxx
@@ -31,10 +31,10 @@ namespace rptui
class OStartMarker : public OColorListener
{
- Ruler m_aVRuler;
- FixedText m_aText;
- FixedImage m_aImage;
- OSectionWindow* m_pParent;
+ VclPtr<Ruler> m_aVRuler;
+ VclPtr<FixedText> m_aText;
+ VclPtr<FixedImage> m_aImage;
+ VclPtr<OSectionWindow> m_pParent;
static Image* s_pDefCollapsed;
static Image* s_pDefExpanded;
static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed
@@ -50,6 +50,7 @@ namespace rptui
public:
OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry);
virtual ~OStartMarker();
+ virtual void dispose() SAL_OVERRIDE;
// SfxListener
virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint) SAL_OVERRIDE;
diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx
index 8acd960804d1..f16fd59f2f77 100644
--- a/reportdesign/source/ui/inc/ViewsWindow.hxx
+++ b/reportdesign/source/ui/inc/ViewsWindow.hxx
@@ -32,7 +32,6 @@
#include <unotools/options.hxx>
#include <list>
#include <vector>
-#include <boost/shared_ptr.hpp>
#include "MarkedSection.hxx"
#include "SectionWindow.hxx"
@@ -75,7 +74,7 @@ namespace rptui
class OWindowPositionCorrector
{
- ::std::vector< ::std::pair<vcl::Window*,Point> > m_aChildren;
+ ::std::vector< ::std::pair<VclPtr<vcl::Window>,Point> > m_aChildren;
long m_nDeltaX;
long m_nDeltaY;
public:
@@ -91,8 +90,8 @@ namespace rptui
}
~OWindowPositionCorrector()
{
- ::std::vector< ::std::pair<vcl::Window*,Point> >::iterator aIter = m_aChildren.begin();
- ::std::vector< ::std::pair<vcl::Window*,Point> >::iterator aEnd = m_aChildren.end();
+ auto aIter = m_aChildren.begin();
+ auto aEnd = m_aChildren.end();
for (; aIter != aEnd; ++aIter)
{
const Point aPos = aIter->first->GetPosPixel();
@@ -108,7 +107,7 @@ namespace rptui
{
typedef ::std::multimap<Rectangle,::std::pair<SdrObject*,OSectionView*>,RectangleLess> TRectangleMap;
public:
- typedef ::std::vector< ::boost::shared_ptr<OSectionWindow> > TSectionsMap;
+ typedef ::std::vector< VclPtr<OSectionWindow> > TSectionsMap;
struct TReportPairHelper : public ::std::unary_function< TSectionsMap::value_type, OReportSection >
{
@@ -127,9 +126,9 @@ namespace rptui
private:
TSectionsMap m_aSections;
svtools::ColorConfig m_aColorConfig;
- OReportWindow* m_pParent;
- OUString m_sShapeType;
- bool m_bInUnmark;
+ VclPtr<OReportWindow> m_pParent;
+ OUString m_sShapeType;
+ bool m_bInUnmark;
void ImplInitSettings();
/** returns the iterator at pos _nPos or the end()
@@ -153,6 +152,7 @@ namespace rptui
OViewsWindow(
OReportWindow* _pReportWindow);
virtual ~OViewsWindow();
+ virtual void dispose() SAL_OVERRIDE;
// Window overrides
virtual void Resize() SAL_OVERRIDE;
@@ -181,7 +181,7 @@ namespace rptui
* \param _nPos
* \return the section at this pos or an empty section
*/
- ::boost::shared_ptr<OSectionWindow> getSectionWindow(const sal_uInt16 _nPos) const;
+ OSectionWindow* getSectionWindow(const sal_uInt16 _nPos) const;
/** turns the grid on or off
*
@@ -235,7 +235,7 @@ namespace rptui
/** returns the report section window for the given xsection
@param _xSection the section
*/
- ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
/** checks if the keycode is known by the child windows
@param _rCode the keycode
@@ -252,7 +252,7 @@ namespace rptui
void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark);
// IMarkedSection
- ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
+ OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;
/** align all marked objects in all sections
diff --git a/reportdesign/source/ui/inc/dlgedfunc.hxx b/reportdesign/source/ui/inc/dlgedfunc.hxx
index b9d0275ce673..8f8938b6f545 100644
--- a/reportdesign/source/ui/inc/dlgedfunc.hxx
+++ b/reportdesign/source/ui/inc/dlgedfunc.hxx
@@ -41,7 +41,7 @@ class DlgEdFunc /* : public LinkHdl */
DlgEdFunc(const DlgEdFunc&) SAL_DELETED_FUNCTION;
void operator =(const DlgEdFunc&) SAL_DELETED_FUNCTION;
protected:
- OReportSection* m_pParent;
+ VclPtr<OReportSection> m_pParent;
OSectionView& m_rView;
Timer aScrollTimer;
Point m_aMDPos;
diff --git a/reportdesign/source/ui/inc/propbrw.hxx b/reportdesign/source/ui/inc/propbrw.hxx
index 43ec71c790b2..67a48b248691 100644
--- a/reportdesign/source/ui/inc/propbrw.hxx
+++ b/reportdesign/source/ui/inc/propbrw.hxx
@@ -58,7 +58,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
m_xLastSection; /// is the previously displayed section
OUString m_sLastActivePage;
- ODesignView* m_pDesignView;
+ VclPtr<ODesignView> m_pDesignView;
OSectionView* m_pView;
bool m_bInitialStateChange;
@@ -90,6 +90,7 @@ public:
,Window* pParent
,ODesignView* _pDesignView);
virtual ~PropBrw();
+ virtual void dispose() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
diff --git a/reportdesign/source/ui/misc/ColorListener.cxx b/reportdesign/source/ui/misc/ColorListener.cxx
index 8bbd52dd88ad..abe070802e9b 100644
--- a/reportdesign/source/ui/misc/ColorListener.cxx
+++ b/reportdesign/source/ui/misc/ColorListener.cxx
@@ -40,7 +40,13 @@ OColorListener::OColorListener(vcl::Window* _pParent ,const OUString& _sColorEnt
OColorListener::~OColorListener()
{
+ disposeOnce();
+}
+
+void OColorListener::dispose()
+{
EndListening(m_aExtendedColorConfig);
+ vcl::Window::dispose();
}
void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint)
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 01533c7520ee..b5da44b8e31e 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -712,16 +712,16 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor );
{ // want the dialog to be destroyed before our set
- ORptPageDialog aDlg(pParent, pDescriptor.get(), "CharDialog");
+ ScopedVclPtrInstance< ORptPageDialog > aDlg(pParent, pDescriptor.get(), "CharDialog");
uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY );
if ( xShape.is() )
- aDlg.RemoveTabPage("background");
- bSuccess = ( RET_OK == aDlg.Execute() );
+ aDlg->RemoveTabPage("background");
+ bSuccess = ( RET_OK == aDlg->Execute() );
if ( bSuccess )
{
lcl_itemsToCharProperties( lcl_getReportControlFont( _rxReportControlFormat,WESTERN ),
lcl_getReportControlFont( _rxReportControlFormat,ASIAN ),
- lcl_getReportControlFont( _rxReportControlFormat,COMPLEX ), *aDlg.GetOutputItemSet(), _out_rNewValues );
+ lcl_getReportControlFont( _rxReportControlFormat,COMPLEX ), *aDlg->GetOutputItemSet(), _out_rNewValues );
}
}
}
@@ -1027,13 +1027,14 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula
CharClass aCC(_xContext, aLangTag);
svl::SharedStringPool aStringPool(&aCC);
- FormulaDialog aDlg(
- pParent, xServiceFactory, pFormulaManager, aFormula.getUndecoratedContent(), _xRowSet, aStringPool);
+ ScopedVclPtrInstance<FormulaDialog> aDlg(
+ pParent, xServiceFactory, pFormulaManager,
+ aFormula.getUndecoratedContent(), _xRowSet, aStringPool);
- bSuccess = aDlg.Execute() == RET_OK;
+ bSuccess = aDlg->Execute() == RET_OK;
if ( bSuccess )
{
- OUString sFormula = aDlg.getCurrentFormula();
+ OUString sFormula = aDlg->getCurrentFormula();
if ( sFormula[0] == '=' )
_in_out_rFormula = "rpt:" + sFormula.copy(1);
else
diff --git a/reportdesign/source/ui/misc/statusbarcontroller.cxx b/reportdesign/source/ui/misc/statusbarcontroller.cxx
index c59c587f0211..420f83f4b84b 100644
--- a/reportdesign/source/ui/misc/statusbarcontroller.cxx
+++ b/reportdesign/source/ui/misc/statusbarcontroller.cxx
@@ -86,7 +86,7 @@ void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArgumen
SolarMutexGuard aSolarMutexGuard;
::osl::MutexGuard aGuard(m_aMutex);
- StatusBar* pStatusBar = static_cast<StatusBar*>(VCLUnoHelper::GetWindow(m_xParentWindow));
+ VclPtr< StatusBar > pStatusBar = static_cast<StatusBar*>(VCLUnoHelper::GetWindow(m_xParentWindow).get());
if ( pStatusBar )
{
const sal_uInt16 nCount = pStatusBar->GetItemCount();
diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx
index 788cc1fddfc6..aa9eb3f27672 100644
--- a/reportdesign/source/ui/misc/toolboxcontroller.cxx
+++ b/reportdesign/source/ui/misc/toolboxcontroller.cxx
@@ -127,7 +127,7 @@ void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments
SolarMutexGuard aSolarMutexGuard;
::osl::MutexGuard aGuard(m_aMutex);
- ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
+ VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get());
if ( pToolBox )
{
const sal_uInt16 nCount = pToolBox->GetItemCount();
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index 96953d86019a..698b065796f6 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -59,9 +59,11 @@ using namespace container;
class OTaskWindow : public vcl::Window
{
- PropBrw* m_pPropWin;
+ VclPtr<PropBrw> m_pPropWin;
public:
OTaskWindow(vcl::Window* _pParent) : Window(_pParent),m_pPropWin(NULL){}
+ virtual ~OTaskWindow() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_pPropWin.clear(); vcl::Window::dispose(); }
inline void setPropertyBrowser(PropBrw* _pPropWin)
{
@@ -84,9 +86,9 @@ ODesignView::ODesignView( vcl::Window* pParent,
const Reference< XComponentContext >& _rxOrb,
OReportController& _rController) :
ODataView( pParent, _rController, _rxOrb, WB_DIALOGCONTROL )
- ,m_aSplitWin(this)
+ ,m_aSplitWin(VclPtr<SplitWindow>::Create(this))
,m_rReportController( _rController )
- ,m_aScrollWindow(this)
+ ,m_aScrollWindow(VclPtr<rptui::OScrollWindowHelper>::Create(this))
,m_pPropWin(NULL)
,m_pAddField(NULL)
,m_pCurrentView(NULL)
@@ -107,16 +109,16 @@ ODesignView::ODesignView( vcl::Window* pParent,
SetMapMode( MapMode( MAP_100TH_MM ) );
// now create the task pane on the right side :-)
- m_pTaskPane = new OTaskWindow(this);
+ m_pTaskPane = VclPtr<OTaskWindow>::Create(this);
- m_aSplitWin.InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET );
- m_aSplitWin.InsertItem( REPORT_ID, &m_aScrollWindow, 100, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE);
+ m_aSplitWin->InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET );
+ m_aSplitWin->InsertItem( REPORT_ID, m_aScrollWindow.get(), 100, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE);
// Splitter einrichten
- m_aSplitWin.SetSplitHdl(LINK(this, ODesignView,SplitHdl));
- m_aSplitWin.ShowAutoHideButton();
- m_aSplitWin.SetAlign(WINDOWALIGN_LEFT);
- m_aSplitWin.Show();
+ m_aSplitWin->SetSplitHdl(LINK(this, ODesignView,SplitHdl));
+ m_aSplitWin->ShowAutoHideButton();
+ m_aSplitWin->SetAlign(WINDOWALIGN_LEFT);
+ m_aSplitWin->Show();
m_aMarkIdle.SetPriority( SchedulerPriority::LOW );
m_aMarkIdle.SetIdleHdl( LINK( this, ODesignView, MarkTimeout ) );
@@ -125,43 +127,46 @@ ODesignView::ODesignView( vcl::Window* pParent,
ODesignView::~ODesignView()
{
+ disposeOnce();
+}
+
+void ODesignView::dispose()
+{
m_bDeleted = true;
Hide();
- m_aScrollWindow.Hide();
+ m_aScrollWindow->Hide();
m_aMarkIdle.Stop();
if ( m_pPropWin )
{
notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- ::std::unique_ptr<vcl::Window> aTemp2(m_pPropWin);
- m_pPropWin = NULL;
}
if ( m_pAddField )
{
SvtViewOptions aDlgOpt( E_WINDOW, OUString( UID_RPT_RPT_APP_VIEW ) );
aDlgOpt.SetWindowState(OStringToOUString(m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US));
notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- ::std::unique_ptr<vcl::Window> aTemp2(m_pAddField);
- m_pAddField = NULL;
}
if ( m_pReportExplorer )
{
SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pReportExplorer->GetHelpId(), RTL_TEXTENCODING_UTF8));
aDlgOpt.SetWindowState(OStringToOUString(m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US));
notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
- ::std::unique_ptr<vcl::Window> aTemp2(m_pReportExplorer);
- m_pReportExplorer = NULL;
- }
- {
- ::std::unique_ptr<vcl::Window> aTemp2(m_pTaskPane);
- m_pTaskPane = NULL;
}
+
+ m_aSplitWin.disposeAndClear();
+ m_aScrollWindow.disposeAndClear();
+ m_pTaskPane.clear();
+ m_pReportExplorer.clear();
+ m_pPropWin.clear();
+ m_pAddField.clear();
+ dbaui::ODataView::dispose();
}
void ODesignView::initialize()
{
SetMapMode( MapMode( MAP_100TH_MM ) );
- m_aScrollWindow.initialize();
- m_aScrollWindow.Show();
+ m_aScrollWindow->initialize();
+ m_aScrollWindow->Show();
}
void ODesignView::DataChanged( const DataChangedEvent& rDCEvt )
@@ -197,7 +202,7 @@ bool ODesignView::PreNotify( NotifyEvent& rNEvt )
const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
util::URL aUrl;
aUrl.Complete = m_pAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rCode));
- if ( aUrl.Complete.isEmpty() || !m_rController.isCommandEnabled( aUrl.Complete ) )
+ if ( aUrl.Complete.isEmpty() || !m_xController->isCommandEnabled( aUrl.Complete ) )
nRet = false;
}
}
@@ -231,7 +236,7 @@ void ODesignView::resizeDocumentView(Rectangle& _rPlayground)
}
}
- if ( m_aSplitWin.IsItemValid(TASKPANE_ID) )
+ if ( m_aSplitWin->IsItemValid(TASKPANE_ID) )
{
// normalize the split pos
const long nSplitterWidth = GetSettings().GetStyleSettings().GetSplitSize();
@@ -248,15 +253,15 @@ void ODesignView::resizeDocumentView(Rectangle& _rPlayground)
getController().setSplitPos(nSplitPos);
const long nTaskPaneSize = static_cast<long>((aPlaygroundSize.Width() - aTaskPanePos.X())*100/aPlaygroundSize.Width());
- if ( m_aSplitWin.GetItemSize( TASKPANE_ID ) != nTaskPaneSize )
+ if ( m_aSplitWin->GetItemSize( TASKPANE_ID ) != nTaskPaneSize )
{
- m_aSplitWin.SetItemSize( REPORT_ID, 99 - nTaskPaneSize );
- m_aSplitWin.SetItemSize( TASKPANE_ID, nTaskPaneSize );
+ m_aSplitWin->SetItemSize( REPORT_ID, 99 - nTaskPaneSize );
+ m_aSplitWin->SetItemSize( TASKPANE_ID, nTaskPaneSize );
}
}
}
// set the size of the report window
- m_aSplitWin.SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize );
+ m_aSplitWin->SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize );
}
// just for completeness: there is no space left, we occupied it all ...
_rPlayground.SetPos( _rPlayground.BottomRight() );
@@ -273,7 +278,7 @@ IMPL_LINK_NOARG(ODesignView, MarkTimeout)
if ( xProp.is() )
{
m_pPropWin->Update(xProp);
- static_cast<OTaskWindow*>(m_pTaskPane)->Resize();
+ static_cast<OTaskWindow*>(m_pTaskPane.get())->Resize();
}
Resize();
}
@@ -288,18 +293,18 @@ void ODesignView::SetMode( DlgEdMode _eNewMode )
if ( m_eMode == RPTUI_SELECT )
m_eActObj = OBJ_NONE;
- m_aScrollWindow.SetMode(_eNewMode);
+ m_aScrollWindow->SetMode(_eNewMode);
}
void ODesignView::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType )
{
m_eActObj = eObj;
- m_aScrollWindow.SetInsertObj( eObj,_sShapeType );
+ m_aScrollWindow->SetInsertObj( eObj,_sShapeType );
}
OUString ODesignView::GetInsertObjString() const
{
- return m_aScrollWindow.GetInsertObjString();
+ return m_aScrollWindow->GetInsertObjString();
}
@@ -315,30 +320,30 @@ void ODesignView::Cut()
void ODesignView::Copy()
{
- m_aScrollWindow.Copy();
+ m_aScrollWindow->Copy();
}
void ODesignView::Paste()
{
- m_aScrollWindow.Paste();
+ m_aScrollWindow->Paste();
}
void ODesignView::Delete()
{
- m_aScrollWindow.Delete();
+ m_aScrollWindow->Delete();
}
bool ODesignView::HasSelection() const
{
- return m_aScrollWindow.HasSelection();
+ return m_aScrollWindow->HasSelection();
}
bool ODesignView::IsPasteAllowed() const
{
- return m_aScrollWindow.IsPasteAllowed();
+ return m_aScrollWindow->IsPasteAllowed();
}
@@ -347,10 +352,10 @@ void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView)
if ( m_pCurrentView != &_rView )
{
if ( m_pCurrentView )
- m_aScrollWindow.setMarked(m_pCurrentView,false);
+ m_aScrollWindow->setMarked(m_pCurrentView,false);
m_pCurrentView = &_rView;
if ( m_pCurrentView )
- m_aScrollWindow.setMarked(m_pCurrentView,true);
+ m_aScrollWindow->setMarked(m_pCurrentView,true);
m_xReportComponent.clear();
DlgEdHint aHint( RPTUI_HINT_SELECTIONCHANGED );
Broadcast( aHint );
@@ -361,27 +366,27 @@ void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView)
void ODesignView::toggleGrid(bool _bGridVisible)
{
- m_aScrollWindow.toggleGrid(_bGridVisible);
+ m_aScrollWindow->toggleGrid(_bGridVisible);
}
sal_uInt16 ODesignView::getSectionCount() const
{
- return m_aScrollWindow.getSectionCount();
+ return m_aScrollWindow->getSectionCount();
}
void ODesignView::showRuler(bool _bShow)
{
- m_aScrollWindow.showRuler(_bShow);
+ m_aScrollWindow->showRuler(_bShow);
}
void ODesignView::removeSection(sal_uInt16 _nPosition)
{
- m_aScrollWindow.removeSection(_nPosition);
+ m_aScrollWindow->removeSection(_nPosition);
}
void ODesignView::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition)
{
- m_aScrollWindow.addSection(_xSection,_sColorEntry,_nPosition);
+ m_aScrollWindow->addSection(_xSection,_sColorEntry,_nPosition);
}
void ODesignView::GetFocus()
@@ -390,7 +395,7 @@ void ODesignView::GetFocus()
if ( !m_bDeleted )
{
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow.getMarkedSection();
+ OSectionWindow* pSectionWindow = m_aScrollWindow->getMarkedSection();
if ( pSectionWindow )
pSectionWindow->GrabFocus();
}
@@ -406,12 +411,12 @@ void ODesignView::ImplInitSettings()
IMPL_LINK( ODesignView, SplitHdl, void*, )
{
const Size aOutputSize = GetOutputSizePixel();
- const long nTest = aOutputSize.Width() * m_aSplitWin.GetItemSize(TASKPANE_ID) / 100;
+ const long nTest = aOutputSize.Width() * m_aSplitWin->GetItemSize(TASKPANE_ID) / 100;
long nMinWidth = static_cast<long>(0.1*aOutputSize.Width());
if ( m_pPropWin && m_pPropWin->IsVisible() )
nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width();
- if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow.getMaxMarkerWidth(false) )
+ if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow->getMaxMarkerWidth(false) )
{
long nOldSplitPos = getController().getSplitPos();
(void)nOldSplitPos;
@@ -423,21 +428,21 @@ IMPL_LINK( ODesignView, SplitHdl, void*, )
void ODesignView::SelectAll(const sal_uInt16 _nObjectType)
{
- m_aScrollWindow.SelectAll(_nObjectType);
+ m_aScrollWindow->SelectAll(_nObjectType);
}
void ODesignView::unmarkAllObjects(OSectionView* _pSectionView)
{
- m_aScrollWindow.unmarkAllObjects(_pSectionView);
+ m_aScrollWindow->unmarkAllObjects(_pSectionView);
}
void ODesignView::togglePropertyBrowser(bool _bToogleOn)
{
if ( !m_pPropWin && _bToogleOn )
{
- m_pPropWin = new PropBrw(getController().getORB(), m_pTaskPane,this);
+ m_pPropWin = VclPtr<PropBrw>::Create(getController().getORB(), m_pTaskPane,this);
m_pPropWin->Invalidate();
- static_cast<OTaskWindow*>(m_pTaskPane)->setPropertyBrowser(m_pPropWin);
+ static_cast<OTaskWindow*>(m_pTaskPane.get())->setPropertyBrowser(m_pPropWin);
notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::AddWindow));
}
if ( m_pPropWin && _bToogleOn != m_pPropWin->IsVisible() )
@@ -451,9 +456,9 @@ void ODesignView::togglePropertyBrowser(bool _bToogleOn)
m_pTaskPane->Invalidate();
if ( bWillBeVisible )
- m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE);
+ m_aSplitWin->InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE);
else
- m_aSplitWin.RemoveItem(TASKPANE_ID);
+ m_aSplitWin->RemoveItem(TASKPANE_ID);
if ( bWillBeVisible )
m_aMarkIdle.Start();
@@ -466,7 +471,7 @@ void ODesignView::showProperties(const uno::Reference< uno::XInterface>& _xRepor
{
m_xReportComponent = _xReportComponent;
if ( m_pCurrentView )
- m_aScrollWindow.setMarked(m_pCurrentView,false);
+ m_aScrollWindow->setMarked(m_pCurrentView,false);
m_pCurrentView = NULL;
m_aMarkIdle.Start();
}
@@ -482,7 +487,7 @@ void ODesignView::toggleReportExplorer()
if ( !m_pReportExplorer )
{
OReportController& rReportController = getController();
- m_pReportExplorer = new ONavigator(this,rReportController);
+ m_pReportExplorer = VclPtr<ONavigator>::Create(this,rReportController);
SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pReportExplorer->GetHelpId(), RTL_TEXTENCODING_UTF8));
if ( aDlgOpt.Exists() )
m_pReportExplorer->SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US));
@@ -518,7 +523,7 @@ void ODesignView::toggleAddField()
xReport = xSection->getReportDefinition();
}
uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY);
- m_pAddField = new OAddFieldWindow(this,xSet);
+ m_pAddField = VclPtr<OAddFieldWindow>::Create(this,xSet);
m_pAddField->SetCreateHdl(LINK( &rReportController, OReportController, OnCreateHdl ) );
SvtViewOptions aDlgOpt( E_WINDOW, OUString( UID_RPT_RPT_APP_VIEW ) );
if ( aDlgOpt.Exists() )
@@ -551,29 +556,29 @@ uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel()
return xModel;
}
-::boost::shared_ptr<OSectionWindow> ODesignView::getMarkedSection(NearSectionAccess nsa) const
+OSectionWindow* ODesignView::getMarkedSection(NearSectionAccess nsa) const
{
- return m_aScrollWindow.getMarkedSection(nsa);
+ return m_aScrollWindow->getMarkedSection(nsa);
}
-::boost::shared_ptr<OSectionWindow> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
+OSectionWindow* ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
{
- return m_aScrollWindow.getSectionWindow(_xSection);
+ return m_aScrollWindow->getSectionWindow(_xSection);
}
void ODesignView::markSection(const sal_uInt16 _nPos)
{
- m_aScrollWindow.markSection(_nPos);
+ m_aScrollWindow->markSection(_nPos);
}
void ODesignView::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
{
- m_aScrollWindow.fillCollapsedSections(_rCollapsedPositions);
+ m_aScrollWindow->fillCollapsedSections(_rCollapsedPositions);
}
void ODesignView::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections)
{
- m_aScrollWindow.collapseSections(_aCollpasedSections);
+ m_aScrollWindow->collapseSections(_aCollpasedSections);
}
OUString ODesignView::getCurrentPage() const
@@ -589,7 +594,7 @@ void ODesignView::setCurrentPage(const OUString& _sLastActivePage)
void ODesignView::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
{
- m_aScrollWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects);
+ m_aScrollWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects);
}
bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent)
@@ -600,12 +605,12 @@ bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent)
return false;
if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) )
return false;
- return m_aScrollWindow.handleKeyEvent(_rEvent);
+ return m_aScrollWindow->handleKeyEvent(_rEvent);
}
void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,bool _bMark)
{
- m_aScrollWindow.setMarked(_xSection,_bMark);
+ m_aScrollWindow->setMarked(_xSection,_bMark);
if ( _bMark )
UpdatePropertyBrowserDelayed(getMarkedSection()->getReportSection().getSectionView());
else
@@ -614,7 +619,7 @@ void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,b
void ODesignView::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,bool _bMark)
{
- m_aScrollWindow.setMarked(_aShapes,_bMark);
+ m_aScrollWindow->setMarked(_aShapes,_bMark);
if ( _aShapes.hasElements() && _bMark )
showProperties(_aShapes[0]);
else
@@ -634,7 +639,7 @@ void ODesignView::MouseButtonDown( const MouseEvent& rMEvt )
uno::Any ODesignView::getCurrentlyShownProperty() const
{
uno::Any aRet;
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = getMarkedSection();
+ OSectionWindow* pSectionWindow = getMarkedSection();
if ( pSectionWindow )
{
::std::vector< uno::Reference< uno::XInterface > > aSelection;
@@ -655,18 +660,18 @@ uno::Any ODesignView::getCurrentlyShownProperty() const
void ODesignView::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
{
- m_aScrollWindow.fillControlModelSelection(_rSelection);
+ m_aScrollWindow->fillControlModelSelection(_rSelection);
}
void ODesignView::setGridSnap(bool bOn)
{
- m_aScrollWindow.setGridSnap(bOn);
+ m_aScrollWindow->setGridSnap(bOn);
}
void ODesignView::setDragStripes(bool bOn)
{
- m_aScrollWindow.setDragStripes(bOn);
+ m_aScrollWindow->setDragStripes(bOn);
}
bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const
@@ -676,17 +681,17 @@ bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const
sal_uInt32 ODesignView::getMarkedObjectCount() const
{
- return m_aScrollWindow.getMarkedObjectCount();
+ return m_aScrollWindow->getMarkedObjectCount();
}
void ODesignView::zoom(const Fraction& _aZoom)
{
- m_aScrollWindow.zoom(_aZoom);
+ m_aScrollWindow->zoom(_aZoom);
}
sal_uInt16 ODesignView::getZoomFactor(SvxZoomType _eType) const
{
- return m_aScrollWindow.getZoomFactor(_eType);
+ return m_aScrollWindow->getZoomFactor(_eType);
}
} // rptui
diff --git a/reportdesign/source/ui/report/FixedTextColor.cxx b/reportdesign/source/ui/report/FixedTextColor.cxx
index ca3029b0ad31..8ccfc48ac682 100644
--- a/reportdesign/source/ui/report/FixedTextColor.cxx
+++ b/reportdesign/source/ui/report/FixedTextColor.cxx
@@ -172,7 +172,7 @@ namespace rptui
OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject);
if ( pUnoObj ) // this doesn't need to be done for shapes
{
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = pController->getSectionWindow(xSection);
+ OSectionWindow* pSectionWindow = pController->getSectionWindow(xSection);
if (pSectionWindow != 0)
{
OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice
diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
index a2ca68daba83..1255d686fe23 100644
--- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
+++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
@@ -173,7 +173,7 @@ namespace rptui
OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject);
if ( pUnoObj ) // this doesn't need to be done for shapes
{
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_rReportController.getSectionWindow(xSection);
+ OSectionWindow* pSectionWindow = m_rReportController.getSectionWindow(xSection);
if (pSectionWindow != 0)
{
OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index bd7f17eb582a..24f274ee56dd 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -339,7 +339,6 @@ void OReportController::disposing()
{
SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pGroupsFloater->GetHelpId(), RTL_TEXTENCODING_UTF8));
aDlgOpt.SetWindowState(OStringToOUString(m_pGroupsFloater->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US));
- ::std::unique_ptr<FloatingWindow> aTemp(m_pGroupsFloater);
m_pGroupsFloater = NULL;
}
@@ -362,7 +361,7 @@ void OReportController::disposing()
{
try
{
- ::boost::shared_ptr<OSectionWindow> pSectionWindow;
+ OSectionWindow* pSectionWindow = NULL;
if ( getDesignView() )
pSectionWindow = getDesignView()->getMarkedSection();
if ( pSectionWindow )
@@ -583,7 +582,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId);
if ( aReturn.bEnabled )
{
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
+ OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
if ( pSectionWindow )
aReturn.bEnabled = !pSectionWindow->getReportSection().isUiActive();
}
@@ -1135,7 +1134,7 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
break;
case SID_TERMINATE_INPLACEACTIVATION:
{
- ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
+ OSectionWindow* pSection = getDesignView()->getMarkedSection();
if ( pSection )
pSection->getReportSection().deactivateOle();
}
@@ -1568,8 +1567,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
if ( xFormattedField.is() )
{
- ConditionalFormattingDialog aDlg( getView(), xFormattedField.get(), *this );
- aDlg.Execute();
+ ScopedVclPtrInstance< ConditionalFormattingDialog > aDlg( getView(), xFormattedField.get(), *this );
+ aDlg->Execute();
}
}
break;
@@ -1578,8 +1577,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
{
if ( !aArgs.getLength() )
{
- ODateTimeDialog aDlg(getView(),getDesignView()->getCurrentSection(),this);
- aDlg.Execute();
+ ScopedVclPtrInstance< ODateTimeDialog > aDlg(getView(),getDesignView()->getCurrentSection(),this);
+ aDlg->Execute();
}
else
createDateTime(aArgs);
@@ -1590,8 +1589,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
{
if ( !aArgs.getLength() )
{
- OPageNumberDialog aDlg(getView(),m_xReportDefinition,this);
- aDlg.Execute();
+ ScopedVclPtrInstance< OPageNumberDialog > aDlg(getView(),m_xReportDefinition,this);
+ aDlg->Execute();
}
else
createPageNumber(aArgs);
@@ -1783,9 +1782,9 @@ void OReportController::doOpenHelpAgent()
bool OReportController::Construct(vcl::Window* pParent)
{
- ODesignView* pMyOwnView = new ODesignView( pParent, m_xContext, *this );
+ VclPtrInstance<ODesignView> pMyOwnView( pParent, m_xContext, *this );
StartListening( *pMyOwnView );
- setView( *pMyOwnView );
+ setView( pMyOwnView );
// now that we have a view we can create the clipboard listener
m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() );
@@ -2481,15 +2480,16 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
}
{ // want the dialog to be destroyed before our set
- ORptPageDialog aDlg(getView(), pDescriptor.get(),_xSection.is()
- ? OUString("BackgroundDialog")
- : OUString("PageDialog"));
- if (RET_OK == aDlg.Execute())
+ ScopedVclPtrInstance<ORptPageDialog> aDlg(
+ getView(), pDescriptor.get(),_xSection.is()
+ ? OUString("BackgroundDialog")
+ : OUString("PageDialog"));
+ if (RET_OK == aDlg->Execute())
{
// ItemSet->UNO
// UNO-properties
- const SfxItemSet* pSet = aDlg.GetOutputItemSet();
+ const SfxItemSet* pSet = aDlg->GetOutputItemSet();
if ( _xSection.is() )
{
const SfxPoolItem* pItem;
@@ -2578,7 +2578,7 @@ void OReportController::openSortingAndGroupingDialog()
return;
if ( !m_pGroupsFloater )
{
- m_pGroupsFloater = new OGroupsSortingDialog(getView(),!isEditable(),this);
+ m_pGroupsFloater = VclPtr<OGroupsSortingDialog>::Create(getView(),!isEditable(),this);
SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pGroupsFloater->GetHelpId(), RTL_TEXTENCODING_UTF8));
if ( aDlgOpt.Exists() )
m_pGroupsFloater->SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US));
@@ -2791,8 +2791,8 @@ uno::Any SAL_CALL OReportController::getViewData() throw( uno::RuntimeException,
aViewData.put( "CollapsedSections", aCollapsedSections );
}
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
- if ( pSectionWindow.get() )
+ OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
+ if ( pSectionWindow )
{
aViewData.put( "MarkedSection", (sal_Int32)pSectionWindow->getReportSection().getPage()->GetPageNum() );
}
@@ -3159,7 +3159,7 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
{
SequenceAsHashMap aMap(_aArgs);
getDesignView()->setMarked(_xSection, true);
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
+ OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
if ( !pSectionWindow )
return;
@@ -3337,7 +3337,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
getDesignView()->unmarkAllObjects(NULL);
// Anhand des FormatKeys wird festgestellt, welches Feld benoetigt wird
- ::boost::shared_ptr<OSectionWindow> pSectionWindow[2];
+ OSectionWindow* pSectionWindow[2];
pSectionWindow[0] = getDesignView()->getMarkedSection();
if ( !pSectionWindow[0] )
@@ -3651,8 +3651,8 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
OSectionView* OReportController::getCurrentSectionView() const
{
OSectionView* pSectionView = NULL;
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
- if ( pSectionWindow.get() )
+ OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
+ if ( pSectionWindow )
pSectionView = &pSectionWindow->getReportSection().getSectionView();
return pSectionView;
}
@@ -3966,7 +3966,7 @@ void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader
void OReportController::collapseSection(const bool _bCollapse)
{
- ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
+ OSectionWindow *pSection = getDesignView()->getMarkedSection();
if ( pSection )
{
pSection->setCollapsed(_bCollapse);
@@ -3975,10 +3975,10 @@ void OReportController::collapseSection(const bool _bCollapse)
void OReportController::markSection(const bool _bNext)
{
- ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
+ OSectionWindow *pSection = getDesignView()->getMarkedSection();
if ( pSection )
{
- ::boost::shared_ptr<OSectionWindow> pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS);
+ OSectionWindow *pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS);
if ( pPrevSection != pSection && pPrevSection )
select(uno::makeAny(pPrevSection->getReportSection().getSection()));
else
@@ -4219,16 +4219,15 @@ void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomSh
}
-::boost::shared_ptr<OSectionWindow> OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
+OSectionWindow* OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
{
if ( getDesignView() )
{
- return getDesignView()->getSectionWindow(_xSection);
+ return getDesignView()->getSectionWindow(_xSection);
}
// throw NullPointerException?
- ::boost::shared_ptr<OSectionWindow> pEmpty;
- return pEmpty;
+ return NULL;
}
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 1a70619ecc33..22a1d986e98d 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -111,6 +111,11 @@ OReportSection::OReportSection(OSectionWindow* _pParent,const uno::Reference< re
OReportSection::~OReportSection()
{
+ disposeOnce();
+}
+
+void OReportSection::dispose()
+{
m_pPage = NULL;
if ( m_pMulti.is() )
m_pMulti->dispose();
@@ -125,6 +130,8 @@ OReportSection::~OReportSection()
m_pView->EndListening( *m_pModel );
m_pView = NULL;
}
+ m_pParent.clear();
+ vcl::Window::dispose();
}
void OReportSection::Paint( const Rectangle& rRect )
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
index 74148f6700f3..d43d5584fe8e 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -58,26 +58,26 @@ using namespace ::comphelper;
OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView)
: Window(_pParent,WB_DIALOGCONTROL)
, ::comphelper::OPropertyChangeListener(m_aMutex)
-,m_aHRuler(this)
+,m_aHRuler(VclPtr<Ruler>::Create(this))
,m_pView(_pView)
,m_pParent(_pParent)
-,m_aViewsWindow(this)
+,m_aViewsWindow(VclPtr<rptui::OViewsWindow>::Create(this))
,m_pObjFac( new DlgEdFactory() )
{
SetHelpId(UID_RPT_REPORTWINDOW);
SetMapMode( MapMode( MAP_100TH_MM ) );
- m_aViewsWindow.Show();
+ m_aViewsWindow->Show();
- m_aHRuler.Show();
- m_aHRuler.Activate();
- m_aHRuler.SetPagePos(0);
- m_aHRuler.SetBorders();
- m_aHRuler.SetIndents();
- m_aHRuler.SetMargin1();
- m_aHRuler.SetMargin2();
+ m_aHRuler->Show();
+ m_aHRuler->Activate();
+ m_aHRuler->SetPagePos(0);
+ m_aHRuler->SetBorders();
+ m_aHRuler->SetIndents();
+ m_aHRuler->SetMargin1();
+ m_aHRuler->SetMargin2();
const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
- m_aHRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
+ m_aHRuler->SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
ImplInitSettings();
m_pReportListener = addStyleListener(_pView->getController().getReportDefinition(),this);
@@ -85,31 +85,40 @@ OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView)
OReportWindow::~OReportWindow()
{
+ disposeOnce();
+}
+
+void OReportWindow::dispose()
+{
if ( m_pReportListener.is() )
m_pReportListener->dispose();
+ m_aHRuler.disposeAndClear();
+ m_aViewsWindow.disposeAndClear();
+ m_pView.clear();
+ m_pParent.clear();
+ vcl::Window::dispose();
}
void OReportWindow::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType )
{
- m_aViewsWindow.SetInsertObj( eObj,_sShapeType);
+ m_aViewsWindow->SetInsertObj( eObj,_sShapeType);
}
-
OUString OReportWindow::GetInsertObjString() const
{
- return m_aViewsWindow.GetInsertObjString();
+ return m_aViewsWindow->GetInsertObjString();
}
void OReportWindow::SetMode( DlgEdMode eNewMode )
{
- m_aViewsWindow.SetMode(eNewMode);
+ m_aViewsWindow->SetMode(eNewMode);
}
void OReportWindow::removeSection(sal_uInt16 _nPosition)
{
- m_aViewsWindow.removeSection(_nPosition);
+ m_aViewsWindow->removeSection(_nPosition);
m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
- m_aViewsWindow.Invalidate(INVALIDATE_TRANSPARENT);
+ m_aViewsWindow->Invalidate(INVALIDATE_TRANSPARENT);
}
void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition)
@@ -117,27 +126,27 @@ void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSecti
if ( !_xSection.is() )
return;
- m_aViewsWindow.addSection(_xSection,_sColorEntry,_nPosition);
+ m_aViewsWindow->addSection(_xSection,_sColorEntry,_nPosition);
m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
}
void OReportWindow::toggleGrid(bool _bVisible)
{
- m_aViewsWindow.toggleGrid(_bVisible);
+ m_aViewsWindow->toggleGrid(_bVisible);
}
void OReportWindow::showRuler(bool _bShow)
{
- m_aHRuler.Show(_bShow);
+ m_aHRuler->Show(_bShow);
- m_aViewsWindow.showRuler(_bShow);
+ m_aViewsWindow->showRuler(_bShow);
}
sal_Int32 OReportWindow::getMaxMarkerWidth(bool _bWithEnd) const
{
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
- aStartWidth *= m_aViewsWindow.GetMapMode().GetScaleX();
+ aStartWidth *= m_aViewsWindow->GetMapMode().GetScaleX();
if ( _bWithEnd )
aStartWidth += Fraction(long(REPORT_ENDMARKER_WIDTH));
return sal_Int32((long)aStartWidth);
@@ -146,7 +155,7 @@ sal_Int32 OReportWindow::getMaxMarkerWidth(bool _bWithEnd) const
sal_Int32 OReportWindow::GetTotalWidth() const
{
sal_Int32 nWidth = 0;
- if ( !m_aViewsWindow.empty() )
+ if ( !m_aViewsWindow->empty() )
{
Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH ));
const Fraction aZoom(m_pView->getController().getZoomValue(),100);
@@ -163,7 +172,7 @@ sal_Int32 OReportWindow::GetTotalWidth() const
void OReportWindow::Resize()
{
Window::Resize();
- if ( !m_aViewsWindow.empty() )
+ if ( !m_aViewsWindow->empty() )
{
const Size aTotalOutputSize = GetOutputSizePixel();
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100);
@@ -174,26 +183,26 @@ void OReportWindow::Resize()
const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
- Size aPageSize = m_aViewsWindow.LogicToPixel(Size(nPaperWidth ,0));
- nLeftMargin = m_aViewsWindow.LogicToPixel(Size(nLeftMargin,0)).Width();
- nRightMargin = m_aViewsWindow.LogicToPixel(Size(nRightMargin,0)).Width();
+ Size aPageSize = m_aViewsWindow->LogicToPixel(Size(nPaperWidth ,0));
+ nLeftMargin = m_aViewsWindow->LogicToPixel(Size(nLeftMargin,0)).Width();
+ nRightMargin = m_aViewsWindow->LogicToPixel(Size(nRightMargin,0)).Width();
- aPageSize.Height() = m_aHRuler.GetSizePixel().Height();
+ aPageSize.Height() = m_aHRuler->GetSizePixel().Height();
- const long nTermp(m_aViewsWindow.getTotalHeight() + aPageSize.Height());
+ const long nTermp(m_aViewsWindow->getTotalHeight() + aPageSize.Height());
long nSectionsHeight = ::std::max<long>(nTermp,aTotalOutputSize.Height());
- m_aHRuler.SetPosSizePixel(aStartPoint,aPageSize);
- m_aHRuler.SetNullOffset(nLeftMargin);
- m_aHRuler.SetMargin1(0);
- m_aHRuler.SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin);
+ m_aHRuler->SetPosSizePixel(aStartPoint,aPageSize);
+ m_aHRuler->SetNullOffset(nLeftMargin);
+ m_aHRuler->SetMargin1(0);
+ m_aHRuler->SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin);
aStartPoint.Y() += aPageSize.Height();
nSectionsHeight -= aStartPoint.Y();
aStartPoint.X() = aOffset.X();
- m_aViewsWindow.SetPosSizePixel(aStartPoint,Size(aTotalOutputSize.Width(),nSectionsHeight));
+ m_aViewsWindow->SetPosSizePixel(aStartPoint,Size(aTotalOutputSize.Width(),nSectionsHeight));
}
}
@@ -221,26 +230,26 @@ void OReportWindow::DataChanged( const DataChangedEvent& rDCEvt )
sal_Int32 OReportWindow::GetTotalHeight() const
{
- return m_aViewsWindow.getTotalHeight();
+ return m_aViewsWindow->getTotalHeight();
}
void OReportWindow::ScrollChildren(const Point& _aThumbPos)
{
- MapMode aMap = m_aHRuler.GetMapMode();
+ MapMode aMap = m_aHRuler->GetMapMode();
Point aOrg( aMap.GetOrigin() );
if ( aOrg.X() != (-_aThumbPos.X()) )
{
aMap.SetOrigin( Point(- _aThumbPos.X(), aOrg.Y()));
- m_aHRuler.SetMapMode( aMap );
- m_aHRuler.Scroll(-(aOrg.X() + _aThumbPos.X()),0);
+ m_aHRuler->SetMapMode( aMap );
+ m_aHRuler->Scroll(-(aOrg.X() + _aThumbPos.X()),0);
}
- m_aViewsWindow.scrollChildren(_aThumbPos);
+ m_aViewsWindow->scrollChildren(_aThumbPos);
}
sal_uInt16 OReportWindow::getSectionCount() const
{
- return m_aViewsWindow.getSectionCount();
+ return m_aViewsWindow->getSectionCount();
}
void OReportWindow::notifySizeChanged()
@@ -250,129 +259,129 @@ void OReportWindow::notifySizeChanged()
bool OReportWindow::HasSelection() const
{
- return m_aViewsWindow.HasSelection();
+ return m_aViewsWindow->HasSelection();
}
void OReportWindow::Delete()
{
- m_aViewsWindow.Delete();
+ m_aViewsWindow->Delete();
}
void OReportWindow::Copy()
{
- m_aViewsWindow.Copy();
+ m_aViewsWindow->Copy();
}
void OReportWindow::Paste()
{
- m_aViewsWindow.Paste();
+ m_aViewsWindow->Paste();
}
bool OReportWindow::IsPasteAllowed() const
{
- return m_aViewsWindow.IsPasteAllowed();
+ return m_aViewsWindow->IsPasteAllowed();
}
void OReportWindow::SelectAll(const sal_uInt16 _nObjectType)
{
- m_aViewsWindow.SelectAll(_nObjectType);
+ m_aViewsWindow->SelectAll(_nObjectType);
}
void OReportWindow::unmarkAllObjects(OSectionView* _pSectionView)
{
- m_aViewsWindow.unmarkAllObjects(_pSectionView);
+ m_aViewsWindow->unmarkAllObjects(_pSectionView);
}
void OReportWindow::showProperties(const uno::Reference< report::XSection>& _xReportComponent)
{
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aViewsWindow.getSectionWindow( _xReportComponent );
+ OSectionWindow* pSectionWindow = m_aViewsWindow->getSectionWindow( _xReportComponent );
m_pView->UpdatePropertyBrowserDelayed(pSectionWindow->getReportSection().getSectionView());
}
bool OReportWindow::handleKeyEvent(const KeyEvent& _rEvent)
{
- return m_aViewsWindow.handleKeyEvent(_rEvent);
+ return m_aViewsWindow->handleKeyEvent(_rEvent);
}
void OReportWindow::setMarked(OSectionView* _pSectionView, bool _bMark)
{
if ( _pSectionView )
- m_aViewsWindow.setMarked(_pSectionView,_bMark);
+ m_aViewsWindow->setMarked(_pSectionView,_bMark);
}
void OReportWindow::setMarked(const uno::Reference< report::XSection>& _xSection, bool _bMark)
{
- m_aViewsWindow.setMarked(_xSection,_bMark);
+ m_aViewsWindow->setMarked(_xSection,_bMark);
}
void OReportWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape, bool _bMark)
{
- m_aViewsWindow.setMarked(_xShape,_bMark);
+ m_aViewsWindow->setMarked(_xShape,_bMark);
}
-::boost::shared_ptr<OSectionWindow> OReportWindow::getMarkedSection(NearSectionAccess nsa) const
+OSectionWindow* OReportWindow::getMarkedSection(NearSectionAccess nsa) const
{
- return m_aViewsWindow.getMarkedSection(nsa);
+ return m_aViewsWindow->getMarkedSection(nsa);
}
-::boost::shared_ptr<OSectionWindow> OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
+OSectionWindow* OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
{
- return m_aViewsWindow.getSectionWindow(_xSection);
+ return m_aViewsWindow->getSectionWindow(_xSection);
}
void OReportWindow::markSection(const sal_uInt16 _nPos)
{
- m_aViewsWindow.markSection(_nPos);
+ m_aViewsWindow->markSection(_nPos);
}
void OReportWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
{
- m_aViewsWindow.fillCollapsedSections(_rCollapsedPositions);
+ m_aViewsWindow->fillCollapsedSections(_rCollapsedPositions);
}
void OReportWindow::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections)
{
- m_aViewsWindow.collapseSections(_aCollpasedSections);
+ m_aViewsWindow->collapseSections(_aCollpasedSections);
}
void OReportWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
{
- m_aViewsWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects);
+ m_aViewsWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects);
}
void OReportWindow::setGridSnap(bool bOn)
{
- m_aViewsWindow.setGridSnap(bOn);
+ m_aViewsWindow->setGridSnap(bOn);
}
void OReportWindow::setDragStripes(bool bOn)
{
- m_aViewsWindow.setDragStripes(bOn);
+ m_aViewsWindow->setDragStripes(bOn);
}
sal_uInt32 OReportWindow::getMarkedObjectCount() const
{
- return m_aViewsWindow.getMarkedObjectCount();
+ return m_aViewsWindow->getMarkedObjectCount();
}
void OReportWindow::zoom(const Fraction& _aZoom)
{
- m_aHRuler.SetZoom(_aZoom);
- m_aHRuler.Invalidate();
+ m_aHRuler->SetZoom(_aZoom);
+ m_aHRuler->Invalidate();
- m_aViewsWindow.zoom(_aZoom);
+ m_aViewsWindow->zoom(_aZoom);
notifySizeChanged();
const Point aNewThumbPos( m_pParent->getThumbPos() );
@@ -385,7 +394,7 @@ void OReportWindow::zoom(const Fraction& _aZoom)
void OReportWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
{
- m_aViewsWindow.fillControlModelSelection(_rSelection);
+ m_aViewsWindow->fillControlModelSelection(_rSelection);
}
sal_Int32 OReportWindow::impl_getRealPixelWidth() const
@@ -411,7 +420,7 @@ sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const
{
nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
MapMode aMap( MAP_100TH_MM );
- const Size aHeight = m_aViewsWindow.LogicToPixel(m_aViewsWindow.PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler.GetSizePixel().Height())),aMap);
+ const Size aHeight = m_aViewsWindow->LogicToPixel(m_aViewsWindow->PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler->GetSizePixel().Height())),aMap);
nZoom = ::std::min(nZoom,(sal_uInt16)(long)Fraction(aSize.Height()*100,aHeight.Height()));
}
break;
@@ -429,7 +438,7 @@ void OReportWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
{
(void)_rEvent;
Resize();
- m_aViewsWindow.Resize();
+ m_aViewsWindow->Resize();
static sal_Int32 nIn = INVALIDATE_TRANSPARENT;
Invalidate(nIn);
}
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx
index d5cf903a4bac..ba789bc9f774 100644
--- a/reportdesign/source/ui/report/ScrollHelper.cxx
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -46,20 +46,20 @@ void lcl_setScrollBar(sal_Int32 _nNewValue,const Point& _aPos,const Size& _aSize
OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView)
: OScrollWindowHelper_BASE( _pDesignView,WB_DIALOGCONTROL)
,OPropertyChangeListener(m_aMutex)
- ,m_aHScroll( this, WB_HSCROLL|WB_REPEAT|WB_DRAG )
- ,m_aVScroll( this, WB_VSCROLL|WB_REPEAT|WB_DRAG )
- ,m_aCornerWin( this )
+ ,m_aHScroll( VclPtr<ScrollBar>::Create(this, WB_HSCROLL|WB_REPEAT|WB_DRAG) )
+ ,m_aVScroll( VclPtr<ScrollBar>::Create(this, WB_VSCROLL|WB_REPEAT|WB_DRAG) )
+ ,m_aCornerWin( VclPtr<ScrollBarBox>::Create(this) )
,m_pParent(_pDesignView)
- ,m_aReportWindow(this,m_pParent)
+ ,m_aReportWindow(VclPtr<rptui::OReportWindow>::Create(this,m_pParent))
,m_pReportDefintionMultiPlexer(NULL)
{
SetMapMode( MapMode( MAP_100TH_MM ) );
- impl_initScrollBar( m_aHScroll );
- impl_initScrollBar( m_aVScroll );
+ impl_initScrollBar( *m_aHScroll.get() );
+ impl_initScrollBar( *m_aVScroll.get() );
- m_aReportWindow.SetMapMode( MapMode( MAP_100TH_MM ) );
- m_aReportWindow.Show();
+ m_aReportWindow->SetMapMode( MapMode( MAP_100TH_MM ) );
+ m_aReportWindow->Show();
// normally we should be SCROLL_PANE
SetAccessibleRole(css::accessibility::AccessibleRole::SCROLL_PANE);
@@ -69,8 +69,20 @@ OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView)
OScrollWindowHelper::~OScrollWindowHelper()
{
+ disposeOnce();
+}
+
+void OScrollWindowHelper::dispose()
+{
if ( m_pReportDefintionMultiPlexer.is() )
m_pReportDefintionMultiPlexer->dispose();
+
+ m_aHScroll.disposeAndClear();
+ m_aVScroll.disposeAndClear();
+ m_aCornerWin.disposeAndClear();
+ m_aReportWindow.disposeAndClear();
+ m_pParent.clear();
+ OScrollWindowHelper_BASE::dispose();
}
@@ -101,8 +113,8 @@ void OScrollWindowHelper::setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight)
// now set the ranges without start marker
Fraction aStartWidth(REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue(),100);
long nWidth = long(_nWidth - (double)aStartWidth);
- m_aHScroll.SetRangeMax( nWidth );
- m_aVScroll.SetRangeMax( m_aTotalPixelSize.Height() );
+ m_aHScroll->SetRangeMax( nWidth );
+ m_aVScroll->SetRangeMax( m_aTotalPixelSize.Height() );
Resize();
}
@@ -114,7 +126,7 @@ Size OScrollWindowHelper::ResizeScrollBars()
if ( aOutPixSz.Width() == 0 || aOutPixSz.Height() == 0 )
return aOutPixSz;
- aOutPixSz.Height() -= m_aReportWindow.getRulerHeight();
+ aOutPixSz.Height() -= m_aReportWindow->getRulerHeight();
// determine the size of the output-area and if we need scrollbars
const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize();
bool bVVisible = false; // by default no vertical-ScrollBar
@@ -143,31 +155,31 @@ Size OScrollWindowHelper::ResizeScrollBars()
}
while ( bChanged ); // until no visibility has changed
- aOutPixSz.Height() += m_aReportWindow.getRulerHeight();
+ aOutPixSz.Height() += m_aReportWindow->getRulerHeight();
// show or hide scrollbars
- m_aVScroll.Show( bVVisible );
- m_aHScroll.Show( bHVisible );
+ m_aVScroll->Show( bVVisible );
+ m_aHScroll->Show( bHVisible );
// disable painting in the corner between the scrollbars
if ( bVVisible && bHVisible )
{
- m_aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) );
- m_aCornerWin.Show();
+ m_aCornerWin->SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) );
+ m_aCornerWin->Show();
}
else
- m_aCornerWin.Hide();
+ m_aCornerWin->Hide();
const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, SECTION_OFFSET ), MAP_APPFONT );
// resize scrollbars and set their ranges
{
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100);
const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - (long)aStartWidth;
- lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ),Size( nNewWidth, nScrSize ),m_aHScroll);
+ lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll.get());
}
{
- const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow.getRulerHeight();
- lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow.getRulerHeight() ),Size( nScrSize,nNewHeight),m_aVScroll);
+ const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow->getRulerHeight();
+ lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow->getRulerHeight() ), Size( nScrSize,nNewHeight), *m_aVScroll.get());
}
return aOutPixSz;
@@ -178,12 +190,12 @@ void OScrollWindowHelper::Resize()
OScrollWindowHelper_BASE::Resize();
const Size aTotalOutputSize = ResizeScrollBars();
- m_aReportWindow.SetPosSizePixel(Point( 0, 0 ),aTotalOutputSize);
+ m_aReportWindow->SetPosSizePixel(Point( 0, 0 ),aTotalOutputSize);
}
IMPL_LINK( OScrollWindowHelper, ScrollHdl, ScrollBar*, /*pScroll*/ )
{
- m_aReportWindow.ScrollChildren( getThumbPos() );
+ m_aReportWindow->ScrollChildren( getThumbPos() );
return 0;
}
@@ -191,127 +203,127 @@ void OScrollWindowHelper::addSection(const uno::Reference< report::XSection >& _
,const OUString& _sColorEntry
,sal_uInt16 _nPosition)
{
- m_aReportWindow.addSection(_xSection,_sColorEntry,_nPosition);
+ m_aReportWindow->addSection(_xSection,_sColorEntry,_nPosition);
}
void OScrollWindowHelper::removeSection(sal_uInt16 _nPosition)
{
- m_aReportWindow.removeSection(_nPosition);
+ m_aReportWindow->removeSection(_nPosition);
}
void OScrollWindowHelper::toggleGrid(bool _bVisible)
{
- m_aReportWindow.toggleGrid(_bVisible);
+ m_aReportWindow->toggleGrid(_bVisible);
}
sal_uInt16 OScrollWindowHelper::getSectionCount() const
{
- return m_aReportWindow.getSectionCount();
+ return m_aReportWindow->getSectionCount();
}
void OScrollWindowHelper::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType )
{
- m_aReportWindow.SetInsertObj(eObj,_sShapeType);
+ m_aReportWindow->SetInsertObj(eObj,_sShapeType);
}
OUString OScrollWindowHelper::GetInsertObjString() const
{
- return m_aReportWindow.GetInsertObjString();
+ return m_aReportWindow->GetInsertObjString();
}
void OScrollWindowHelper::SetMode( DlgEdMode _eNewMode )
{
- m_aReportWindow.SetMode(_eNewMode);
+ m_aReportWindow->SetMode(_eNewMode);
}
bool OScrollWindowHelper::HasSelection() const
{
- return m_aReportWindow.HasSelection();
+ return m_aReportWindow->HasSelection();
}
void OScrollWindowHelper::Delete()
{
- m_aReportWindow.Delete();
+ m_aReportWindow->Delete();
}
void OScrollWindowHelper::Copy()
{
- m_aReportWindow.Copy();
+ m_aReportWindow->Copy();
}
void OScrollWindowHelper::Paste()
{
- m_aReportWindow.Paste();
+ m_aReportWindow->Paste();
}
bool OScrollWindowHelper::IsPasteAllowed() const
{
- return m_aReportWindow.IsPasteAllowed();
+ return m_aReportWindow->IsPasteAllowed();
}
void OScrollWindowHelper::SelectAll(const sal_uInt16 _nObjectType)
{
- m_aReportWindow.SelectAll(_nObjectType);
+ m_aReportWindow->SelectAll(_nObjectType);
}
void OScrollWindowHelper::unmarkAllObjects(OSectionView* _pSectionView)
{
- m_aReportWindow.unmarkAllObjects(_pSectionView);
+ m_aReportWindow->unmarkAllObjects(_pSectionView);
}
sal_Int32 OScrollWindowHelper::getMaxMarkerWidth(bool _bWithEnd) const
{
- return m_aReportWindow.getMaxMarkerWidth(_bWithEnd);
+ return m_aReportWindow->getMaxMarkerWidth(_bWithEnd);
}
void OScrollWindowHelper::showRuler(bool _bShow)
{
- m_aReportWindow.showRuler(_bShow);
+ m_aReportWindow->showRuler(_bShow);
}
bool OScrollWindowHelper::handleKeyEvent(const KeyEvent& _rEvent)
{
- return m_aReportWindow.handleKeyEvent(_rEvent);
+ return m_aReportWindow->handleKeyEvent(_rEvent);
}
void OScrollWindowHelper::setMarked(OSectionView* _pSectionView, bool _bMark)
{
- m_aReportWindow.setMarked(_pSectionView,_bMark);
+ m_aReportWindow->setMarked(_pSectionView,_bMark);
}
void OScrollWindowHelper::setMarked(const uno::Reference< report::XSection>& _xSection, bool _bMark)
{
- m_aReportWindow.setMarked(_xSection,_bMark);
+ m_aReportWindow->setMarked(_xSection,_bMark);
}
void OScrollWindowHelper::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape, bool _bMark)
{
- m_aReportWindow.setMarked(_xShape,_bMark);
+ m_aReportWindow->setMarked(_xShape,_bMark);
}
-::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const
+OSectionWindow* OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const
{
- return m_aReportWindow.getMarkedSection(nsa);
+ return m_aReportWindow->getMarkedSection(nsa);
}
-::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
+OSectionWindow* OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
{
- return m_aReportWindow.getSectionWindow(_xSection);
+ return m_aReportWindow->getSectionWindow(_xSection);
}
void OScrollWindowHelper::markSection(const sal_uInt16 _nPos)
{
- m_aReportWindow.markSection(_nPos);
+ m_aReportWindow->markSection(_nPos);
}
void OScrollWindowHelper::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
{
- m_aReportWindow.fillCollapsedSections(_rCollapsedPositions);
+ m_aReportWindow->fillCollapsedSections(_rCollapsedPositions);
}
void OScrollWindowHelper::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections)
{
- m_aReportWindow.collapseSections(_aCollpasedSections);
+ m_aReportWindow->collapseSections(_aCollpasedSections);
}
bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt )
@@ -324,11 +336,11 @@ bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt )
{
ScrollBar* pHScrBar = NULL;
ScrollBar* pVScrBar = NULL;
- if ( m_aHScroll.IsVisible() )
- pHScrBar = &m_aHScroll;
+ if ( m_aHScroll->IsVisible() )
+ pHScrBar = m_aHScroll.get();
- if ( m_aVScroll.IsVisible() )
- pVScrBar = &m_aVScroll;
+ if ( m_aVScroll->IsVisible() )
+ pVScrBar = m_aVScroll.get();
if ( HandleScrollCommand( *pCommandEvent, pHScrBar, pVScrBar ) )
return true;
@@ -338,7 +350,7 @@ bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt )
void OScrollWindowHelper::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
{
- m_aReportWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects);
+ m_aReportWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects);
}
void OScrollWindowHelper::ImplInitSettings()
@@ -363,39 +375,39 @@ void OScrollWindowHelper::DataChanged( const DataChangedEvent& rDCEvt )
void OScrollWindowHelper::_propertyChanged(const beans::PropertyChangeEvent& /*_rEvent*/)
throw (uno::RuntimeException, std::exception)
{
- m_aReportWindow.notifySizeChanged();
+ m_aReportWindow->notifySizeChanged();
}
void OScrollWindowHelper::setGridSnap(bool bOn)
{
- m_aReportWindow.setGridSnap(bOn);
+ m_aReportWindow->setGridSnap(bOn);
}
void OScrollWindowHelper::setDragStripes(bool bOn)
{
- m_aReportWindow.setDragStripes(bOn);
+ m_aReportWindow->setDragStripes(bOn);
}
sal_uInt32 OScrollWindowHelper::getMarkedObjectCount() const
{
- return m_aReportWindow.getMarkedObjectCount();
+ return m_aReportWindow->getMarkedObjectCount();
}
void OScrollWindowHelper::zoom(const Fraction& _aZoom)
{
- m_aReportWindow.zoom(_aZoom);
+ m_aReportWindow->zoom(_aZoom);
Resize();
Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_TRANSPARENT);
}
void OScrollWindowHelper::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
{
- m_aReportWindow.fillControlModelSelection(_rSelection);
+ m_aReportWindow->fillControlModelSelection(_rSelection);
}
sal_uInt16 OScrollWindowHelper::getZoomFactor(SvxZoomType _eType) const
{
- return m_aReportWindow.getZoomFactor(_eType);
+ return m_aReportWindow->getZoomFactor(_eType);
}
} // rptui
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index b3c50f17b7e6..bb37ceb4cdd4 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -48,35 +48,35 @@ OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< rep
: Window( _pParent,WB_DIALOGCONTROL)
,OPropertyChangeListener(m_aMutex)
,m_pParent(_pParent)
-,m_aStartMarker( this,_sColorEntry)
-,m_aReportSection( this,_xSection)
-,m_aSplitter(this)
-,m_aEndMarker( this,_sColorEntry)
+,m_aStartMarker( VclPtr<rptui::OStartMarker>::Create(this,_sColorEntry))
+,m_aReportSection( VclPtr<rptui::OReportSection>::Create(this,_xSection))
+,m_aSplitter(VclPtr<Splitter>::Create(this))
+,m_aEndMarker( VclPtr<rptui::OEndMarker>::Create(this,_sColorEntry))
{
SetUniqueId(UID_RPT_SECTIONSWINDOW);
const MapMode& rMapMode = _pParent->GetMapMode();
SetMapMode( rMapMode );
ImplInitSettings();
// TRY
- m_aSplitter.SetMapMode( MapMode( MAP_100TH_MM ) );
- m_aSplitter.SetStartSplitHdl(LINK(this, OSectionWindow,StartSplitHdl));
- m_aSplitter.SetSplitHdl(LINK(this, OSectionWindow,SplitHdl));
- m_aSplitter.SetEndSplitHdl(LINK(this, OSectionWindow,EndSplitHdl));
- m_aSplitter.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
- m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,_xSection->getHeight())).Height());
+ m_aSplitter->SetMapMode( MapMode( MAP_100TH_MM ) );
+ m_aSplitter->SetStartSplitHdl(LINK(this, OSectionWindow,StartSplitHdl));
+ m_aSplitter->SetSplitHdl(LINK(this, OSectionWindow,SplitHdl));
+ m_aSplitter->SetEndSplitHdl(LINK(this, OSectionWindow,EndSplitHdl));
+ m_aSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
+ m_aSplitter->SetSplitPosPixel(m_aSplitter->LogicToPixel(Size(0,_xSection->getHeight())).Height());
- m_aStartMarker.setCollapsedHdl(LINK(this,OSectionWindow,Collapsed));
+ m_aStartMarker->setCollapsedHdl(LINK(this,OSectionWindow,Collapsed));
- m_aStartMarker.zoom(rMapMode.GetScaleX());
- setZoomFactor(rMapMode.GetScaleX(),m_aReportSection);
- setZoomFactor(rMapMode.GetScaleX(),m_aSplitter);
- setZoomFactor(rMapMode.GetScaleX(),m_aEndMarker);
+ m_aStartMarker->zoom(rMapMode.GetScaleX());
+ setZoomFactor(rMapMode.GetScaleX(), *m_aReportSection.get());
+ setZoomFactor(rMapMode.GetScaleX(), *m_aSplitter.get());
+ setZoomFactor(rMapMode.GetScaleX(), *m_aEndMarker.get());
- m_aSplitter.Show();
- m_aStartMarker.Show();
- m_aReportSection.Show();
- m_aEndMarker.Show();
+ m_aSplitter->Show();
+ m_aStartMarker->Show();
+ m_aReportSection->Show();
+ m_aEndMarker->Show();
Show();
m_pSectionMulti = new OPropertyChangeMultiplexer(this,_xSection.get());
@@ -100,6 +100,11 @@ OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< rep
OSectionWindow::~OSectionWindow()
{
+ disposeOnce();
+}
+
+void OSectionWindow::dispose()
+{
try
{
if ( m_pSectionMulti.is() )
@@ -110,6 +115,12 @@ OSectionWindow::~OSectionWindow()
catch (uno::Exception&)
{
}
+ m_aStartMarker.disposeAndClear();
+ m_aReportSection.disposeAndClear();
+ m_aSplitter.disposeAndClear();
+ m_aEndMarker.disposeAndClear();
+ m_pParent.clear();
+ vcl::Window::dispose();
}
void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
@@ -119,7 +130,7 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
const uno::Reference< report::XSection > xSection(_rEvent.Source,uno::UNO_QUERY);
if ( xSection.is() )
{
- const uno::Reference< report::XSection> xCurrentSection = m_aReportSection.getSection();
+ const uno::Reference< report::XSection> xCurrentSection = m_aReportSection->getSection();
if ( _rEvent.PropertyName == PROPERTY_HEIGHT )
{
m_pParent->getView()->SetUpdateMode(false);
@@ -137,13 +148,13 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
|| setReportSectionTitle(xReport,RID_STR_PAGE_HEADER,::std::mem_fun(&OReportHelper::getPageHeader),::std::mem_fun(&OReportHelper::getPageHeaderOn))
|| setReportSectionTitle(xReport,RID_STR_PAGE_FOOTER,::std::mem_fun(&OReportHelper::getPageFooter),::std::mem_fun(&OReportHelper::getPageFooterOn)) )
{
- m_aStartMarker.Invalidate(INVALIDATE_NOERASE);
+ m_aStartMarker->Invalidate(INVALIDATE_NOERASE);
}
else
{
OUString sTitle = ModuleRes(RID_STR_DETAIL);
- m_aStartMarker.setTitle(sTitle);
- m_aStartMarker.Invalidate(INVALIDATE_CHILDREN);
+ m_aStartMarker->setTitle(sTitle);
+ m_aStartMarker->Invalidate(INVALIDATE_CHILDREN);
}
}
}
@@ -160,12 +171,12 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
bool OSectionWindow::setReportSectionTitle(const uno::Reference< report::XReportDefinition>& _xReport,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OReportHelper> _pGetSection, const ::std::mem_fun_t<bool,OReportHelper>& _pIsSectionOn)
{
OReportHelper aReportHelper(_xReport);
- const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection.getSection();
+ const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection->getSection();
if ( bRet )
{
OUString sTitle = ModuleRes(_nResId);
- m_aStartMarker.setTitle(sTitle);
- m_aStartMarker.Invalidate(INVALIDATE_CHILDREN);
+ m_aStartMarker->setTitle(sTitle);
+ m_aStartMarker->Invalidate(INVALIDATE_CHILDREN);
}
return bRet;
}
@@ -173,7 +184,7 @@ bool OSectionWindow::setReportSectionTitle(const uno::Reference< report::XReport
bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>& _xGroup,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OGroupHelper> _pGetSection, const ::std::mem_fun_t<bool,OGroupHelper>& _pIsSectionOn)
{
OGroupHelper aGroupHelper(_xGroup);
- const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection.getSection() ;
+ const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection->getSection() ;
if ( bRet )
{
OUString sExpression = _xGroup->getExpression();
@@ -185,8 +196,8 @@ bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>&
OUString sTitle( ModuleRes(_nResId).toString() );
sTitle = sTitle.replaceFirst("#", sExpression);
- m_aStartMarker.setTitle( sTitle );
- m_aStartMarker.Invalidate(INVALIDATE_CHILDREN);
+ m_aStartMarker->setTitle( sTitle );
+ m_aStartMarker->Invalidate(INVALIDATE_CHILDREN);
}
return bRet;
}
@@ -225,12 +236,12 @@ void OSectionWindow::Resize()
const Point aThumbPos = m_pParent->getView()->getThumbPos();
aOutputSize.Width() -= aThumbPos.X();
- aOutputSize.Height() -= m_aSplitter.GetSizePixel().Height();
+ aOutputSize.Height() -= m_aSplitter->GetSizePixel().Height();
- if ( m_aStartMarker.isCollapsed() )
+ if ( m_aStartMarker->isCollapsed() )
{
Point aPos(0,0);
- m_aStartMarker.SetPosSizePixel(aPos,aOutputSize);
+ m_aStartMarker->SetPosSizePixel(aPos,aOutputSize);
}
else
{
@@ -240,49 +251,49 @@ void OSectionWindow::Resize()
aStartWidth *= GetMapMode().GetScaleX();
// set start marker
- m_aStartMarker.SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height()));
+ m_aStartMarker->SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height()));
// set report section
- const uno::Reference< report::XSection> xSection = m_aReportSection.getSection();
+ const uno::Reference< report::XSection> xSection = m_aReportSection->getSection();
Size aSectionSize = LogicToPixel( Size( 0,xSection->getHeight() ) );
Point aReportPos(aStartWidth,0);
aSectionSize.Width() = aOutputSize.Width() - (long)aStartWidth;
if ( bShowEndMarker )
aSectionSize.Width() -= (long)aEndWidth;
- m_aReportSection.SetPosSizePixel(aReportPos,aSectionSize);
+ m_aReportSection->SetPosSizePixel(aReportPos,aSectionSize);
// set splitter
aReportPos.Y() += aSectionSize.Height();
- m_aSplitter.SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter.GetSizePixel().Height()));
+ m_aSplitter->SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter->GetSizePixel().Height()));
aSectionSize.Height() = (long)(1000 * (double)GetMapMode().GetScaleY());
- m_aSplitter.SetDragRectPixel( Rectangle(Point(aStartWidth,0),aSectionSize));
+ m_aSplitter->SetDragRectPixel( Rectangle(Point(aStartWidth,0),aSectionSize));
// set end marker
aReportPos.X() += aSectionSize.Width();
aReportPos.Y() = 0;
- m_aEndMarker.Show(bShowEndMarker);
- m_aEndMarker.SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height()));
+ m_aEndMarker->Show(bShowEndMarker);
+ m_aEndMarker->SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height()));
}
}
void OSectionWindow::setCollapsed(bool _bCollapsed)
{
- if ( m_aStartMarker.isCollapsed() != _bCollapsed )
+ if ( m_aStartMarker->isCollapsed() != _bCollapsed )
{
- m_aStartMarker.setCollapsed(_bCollapsed);
+ m_aStartMarker->setCollapsed(_bCollapsed);
}
}
void OSectionWindow::showProperties()
{
- m_pParent->getView()->showProperties( m_aReportSection.getSection().get() );
+ m_pParent->getView()->showProperties( m_aReportSection->getSection().get() );
}
void OSectionWindow::setMarked(bool _bMark)
{
- m_aStartMarker.setMarked(_bMark);
- m_aEndMarker.setMarked(_bMark);
+ m_aStartMarker->setMarked(_bMark);
+ m_aEndMarker->setMarked(_bMark);
}
IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker )
@@ -290,9 +301,9 @@ IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker )
if ( _pMarker )
{
bool bShow = !_pMarker->isCollapsed();
- m_aReportSection.Show(bShow);
- m_aEndMarker.Show(bShow);
- m_aSplitter.Show(bShow);
+ m_aReportSection->Show(bShow);
+ m_aEndMarker->Show(bShow);
+ m_aSplitter->Show(bShow);
m_pParent->resize(*this);
}
@@ -302,11 +313,11 @@ IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker )
void OSectionWindow::zoom(const Fraction& _aZoom)
{
setZoomFactor(_aZoom,*this);
- m_aStartMarker.zoom(_aZoom);
+ m_aStartMarker->zoom(_aZoom);
- setZoomFactor(_aZoom,m_aReportSection);
- setZoomFactor(_aZoom,m_aSplitter);
- setZoomFactor(_aZoom,m_aEndMarker);
+ setZoomFactor(_aZoom, *m_aReportSection.get());
+ setZoomFactor(_aZoom, *m_aSplitter.get());
+ setZoomFactor(_aZoom, *m_aEndMarker.get());
Invalidate();
}
@@ -332,8 +343,8 @@ IMPL_LINK( OSectionWindow, SplitHdl, Splitter*, _pSplitter )
sal_Int32 nSplitPos = _pSplitter->GetSplitPosPixel();
- const uno::Reference< report::XSection> xSection = m_aReportSection.getSection();
- nSplitPos = m_aSplitter.PixelToLogic(Size(0,nSplitPos)).Height();
+ const uno::Reference< report::XSection> xSection = m_aReportSection->getSection();
+ nSplitPos = m_aSplitter->PixelToLogic(Size(0,nSplitPos)).Height();
const sal_Int32 nCount = xSection->getCount();
for (sal_Int32 i = 0; i < nCount; ++i)
@@ -349,7 +360,7 @@ IMPL_LINK( OSectionWindow, SplitHdl, Splitter*, _pSplitter )
nSplitPos = 0;
xSection->setHeight(nSplitPos);
- m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,nSplitPos)).Height());
+ m_aSplitter->SetSplitPosPixel(m_aSplitter->LogicToPixel(Size(0,nSplitPos)).Height());
return 0L;
}
@@ -371,21 +382,21 @@ void OSectionWindow::scrollChildren(long _nX)
{
const Point aDelta( _nX,0 );
- MapMode aMapMode( m_aReportSection.GetMapMode() );
+ MapMode aMapMode( m_aReportSection->GetMapMode() );
const Point aOld = aMapMode.GetOrigin();
- lcl_setOrigin(m_aReportSection,aDelta.X(), 0);
+ lcl_setOrigin(*m_aReportSection.get(), aDelta.X(), 0);
- aMapMode = m_aReportSection.GetMapMode();
+ aMapMode = m_aReportSection->GetMapMode();
const Point aNew = aMapMode.GetOrigin();
const Point aDiff = aOld - aNew;
{
- lcl_scroll(m_aReportSection,aDiff);
+ lcl_scroll(*m_aReportSection.get(), aDiff);
}
- lcl_scroll(m_aEndMarker,m_aEndMarker.PixelToLogic(Point(_nX,0)));
+ lcl_scroll(*m_aEndMarker.get(), m_aEndMarker->PixelToLogic(Point(_nX,0)));
- lcl_setOrigin(m_aSplitter,_nX, 0);
- lcl_scroll(m_aSplitter,aDiff);
+ lcl_setOrigin(*m_aSplitter.get(),_nX, 0);
+ lcl_scroll(*m_aSplitter.get(),aDiff);
}
} // rptui
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index 37a1e7ce4608..a435b02a38ed 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -48,9 +48,9 @@ oslInterlockedCount OStartMarker::s_nImageRefCount = 0;
OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry)
: OColorListener(_pParent,_sColorEntry)
-,m_aVRuler(this,WB_VERT)
-,m_aText(this,WB_HYPHENATION)
-,m_aImage(this,WB_LEFT|WB_TOP|WB_SCALE)
+,m_aVRuler(VclPtr<Ruler>::Create(this,WB_VERT))
+,m_aText(VclPtr<FixedText>::Create(this,WB_HYPHENATION))
+,m_aImage(VclPtr<FixedImage>::Create(this,WB_LEFT|WB_TOP|WB_SCALE))
,m_pParent(_pParent)
,m_bShowRuler(true)
{
@@ -59,20 +59,20 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry
osl_atomic_increment(&s_nImageRefCount);
initDefaultNodeImages();
ImplInitSettings();
- m_aText.SetHelpId(HID_RPT_START_TITLE);
- m_aText.SetPaintTransparent(true);
- m_aImage.SetHelpId(HID_RPT_START_IMAGE);
- m_aText.Show();
- m_aImage.Show();
- m_aVRuler.Show();
- m_aVRuler.Activate();
- m_aVRuler.SetPagePos(0);
- m_aVRuler.SetBorders();
- m_aVRuler.SetIndents();
- m_aVRuler.SetMargin1();
- m_aVRuler.SetMargin2();
+ m_aText->SetHelpId(HID_RPT_START_TITLE);
+ m_aText->SetPaintTransparent(true);
+ m_aImage->SetHelpId(HID_RPT_START_IMAGE);
+ m_aText->Show();
+ m_aImage->Show();
+ m_aVRuler->Show();
+ m_aVRuler->Activate();
+ m_aVRuler->SetPagePos(0);
+ m_aVRuler->SetBorders();
+ m_aVRuler->SetIndents();
+ m_aVRuler->SetMargin1();
+ m_aVRuler->SetMargin2();
const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
- m_aVRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
+ m_aVRuler->SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
EnableChildTransparentMode( true );
SetParentClipMode( PARENTCLIPMODE_NOCLIP );
SetPaintTransparent( true );
@@ -80,18 +80,28 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry
OStartMarker::~OStartMarker()
{
+ disposeOnce();
+}
+
+void OStartMarker::dispose()
+{
if ( osl_atomic_decrement(&s_nImageRefCount) == 0 )
{
DELETEZ(s_pDefCollapsed);
DELETEZ(s_pDefExpanded);
}
+ m_aVRuler.disposeAndClear();
+ m_aText.disposeAndClear();
+ m_aImage.disposeAndClear();
+ m_pParent.clear();
+ OColorListener::dispose();
}
sal_Int32 OStartMarker::getMinHeight() const
{
Fraction aExtraWidth(long(2*REPORT_EXTRA_SPACE));
aExtraWidth *= GetMapMode().GetScaleX();
- return LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() + (long)aExtraWidth;
+ return LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() + (long)aExtraWidth;
}
void OStartMarker::Paint( const Rectangle& rRect )
@@ -107,7 +117,7 @@ void OStartMarker::Paint( const Rectangle& rRect )
}
else
{
- const long nVRulerWidth = m_aVRuler.GetSizePixel().Width();
+ const long nVRulerWidth = m_aVRuler->GetSizePixel().Width();
nSize = aSize.Width() - nVRulerWidth;
aSize.Width() += nCornerWidth;
SetClipRegion(vcl::Region(PixelToLogic(Rectangle(Point(),Size(nSize,aSize.Height())))));
@@ -148,8 +158,8 @@ void OStartMarker::setColor()
Color aTextColor = GetTextColor();
if ( aColor.GetLuminance() < 128 )
aTextColor = COL_WHITE;
- m_aText.SetTextColor(aTextColor);
- m_aText.SetLineColor(m_nColor);
+ m_aText->SetTextColor(aTextColor);
+ m_aText->SetLineColor(m_nColor);
}
void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt )
@@ -162,14 +172,14 @@ void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt )
const Size aOutputSize = GetOutputSizePixel();
if( aPos.X() > aOutputSize.Width() || aPos.Y() > aOutputSize.Height() )
return;
- Rectangle aRect(m_aImage.GetPosPixel(),m_aImage.GetSizePixel());
+ Rectangle aRect(m_aImage->GetPosPixel(),m_aImage->GetSizePixel());
if ( rMEvt.GetClicks() == 2 || aRect.IsInside( aPos ) )
{
m_bCollapsed = !m_bCollapsed;
changeImage();
- m_aVRuler.Show(!m_bCollapsed && m_bShowRuler);
+ m_aVRuler->Show(!m_bCollapsed && m_bShowRuler);
if ( m_aCollapsedLink.IsSet() )
m_aCollapsedLink.Call(this);
}
@@ -180,7 +190,7 @@ void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt )
void OStartMarker::changeImage()
{
Image* pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded;
- m_aImage.SetImage(*pImage);
+ m_aImage->SetImage(*pImage);
}
void OStartMarker::initDefaultNodeImages()
@@ -192,11 +202,11 @@ void OStartMarker::initDefaultNodeImages()
}
Image* pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded;
- m_aImage.SetImage(*pImage);
- m_aImage.SetMouseTransparent(true);
- m_aImage.SetBackground();
- m_aText.SetBackground();
- m_aText.SetMouseTransparent(true);
+ m_aImage->SetImage(*pImage);
+ m_aImage->SetMouseTransparent(true);
+ m_aImage->SetBackground();
+ m_aText->SetBackground();
+ m_aText->SetMouseTransparent(true);
}
void OStartMarker::ImplInitSettings()
@@ -212,11 +222,11 @@ void OStartMarker::Resize()
const long nOutputWidth = aOutputSize.Width();
const long nOutputHeight = aOutputSize.Height();
- const long nVRulerWidth = m_aVRuler.GetSizePixel().Width();
+ const long nVRulerWidth = m_aVRuler->GetSizePixel().Width();
const Point aRulerPos(nOutputWidth - nVRulerWidth,0);
- m_aVRuler.SetPosSizePixel(aRulerPos,Size(nVRulerWidth,nOutputHeight));
+ m_aVRuler->SetPosSizePixel(aRulerPos,Size(nVRulerWidth,nOutputHeight));
- Size aImageSize = m_aImage.GetImage().GetSizePixel();
+ Size aImageSize = m_aImage->GetImage().GetSizePixel();
const MapMode& rMapMode = GetMapMode();
aImageSize.Width() = long(aImageSize.Width() * (double)rMapMode.GetScaleX());
aImageSize.Height() = long(aImageSize.Height() * (double)rMapMode.GetScaleY());
@@ -225,17 +235,17 @@ void OStartMarker::Resize()
aExtraWidth *= rMapMode.GetScaleX();
Point aPos(aImageSize.Width() + (long)(aExtraWidth + aExtraWidth), aExtraWidth);
- const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText.GetTextHeight())).Height());
- m_aText.SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight));
+ const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText->GetTextHeight())).Height());
+ m_aText->SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight));
aPos.X() = aExtraWidth;
- aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ;
- m_aImage.SetPosSizePixel(aPos,aImageSize);
+ aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ;
+ m_aImage->SetPosSizePixel(aPos,aImageSize);
}
void OStartMarker::setTitle(const OUString& _sTitle)
{
- m_aText.SetText(_sTitle);
+ m_aText->SetText(_sTitle);
}
void OStartMarker::Notify(SfxBroadcaster & rBc, SfxHint const & rHint)
@@ -252,12 +262,12 @@ void OStartMarker::Notify(SfxBroadcaster & rBc, SfxHint const & rHint)
void OStartMarker::showRuler(bool _bShow)
{
m_bShowRuler = _bShow;
- m_aVRuler.Show(!m_bCollapsed && m_bShowRuler);
+ m_aVRuler->Show(!m_bCollapsed && m_bShowRuler);
}
void OStartMarker::RequestHelp( const HelpEvent& rHEvt )
{
- if( !m_aText.GetText().isEmpty())
+ if( !m_aText->GetText().isEmpty())
{
// Hilfe anzeigen
Rectangle aItemRect(rHEvt.GetMousePosPixel(),Size(GetSizePixel().Width(),getMinHeight()));
@@ -268,9 +278,9 @@ void OStartMarker::RequestHelp( const HelpEvent& rHEvt )
aItemRect.Right() = aPt.X();
aItemRect.Bottom() = aPt.Y();
if( rHEvt.GetMode() == HelpEventMode::BALLOON )
- Help::ShowBalloon( this, aItemRect.Center(), aItemRect, m_aText.GetText());
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, m_aText->GetText());
else
- Help::ShowQuickHelp( this, aItemRect, m_aText.GetText() );
+ Help::ShowQuickHelp( this, aItemRect, m_aText->GetText() );
}
}
@@ -284,8 +294,8 @@ void OStartMarker::setCollapsed(bool _bCollapsed)
void OStartMarker::zoom(const Fraction& _aZoom)
{
setZoomFactor(_aZoom,*this);
- m_aVRuler.SetZoom(_aZoom);
- setZoomFactor(_aZoom,m_aText);
+ m_aVRuler->SetZoom(_aZoom);
+ setZoomFactor(_aZoom, *m_aText.get());
Resize();
Invalidate();
}
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 9a7afeeae66c..49bf68956faf 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -185,8 +185,15 @@ OViewsWindow::OViewsWindow( OReportWindow* _pReportWindow)
OViewsWindow::~OViewsWindow()
{
+ disposeOnce();
+}
+
+void OViewsWindow::dispose()
+{
m_aColorConfig.RemoveListener(this);
m_aSections.clear();
+ m_pParent.clear();
+ vcl::Window::dispose();
}
void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet)
@@ -219,8 +226,8 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
TSectionsMap::iterator aEnd = m_aSections.end();
for (;aIter != aEnd ; ++aIter)
{
- const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter);
- if ( pSectionWindow.get() == &_rSectionWindow )
+ OSectionWindow* pSectionWindow = (*aIter);
+ if ( pSectionWindow == &_rSectionWindow )
{
aStartPoint = pSectionWindow->GetPosPixel();
bSet = true;
@@ -228,7 +235,7 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
if ( bSet )
{
- impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,bSet);
+ impl_resizeSectionWindow(*pSectionWindow,aStartPoint,bSet);
static sal_Int32 nIn = INVALIDATE_UPDATE | INVALIDATE_TRANSPARENT;
pSectionWindow->getStartMarker().Invalidate( nIn ); // INVALIDATE_NOERASE |INVALIDATE_NOCHILDREN| INVALIDATE_TRANSPARENT
pSectionWindow->getEndMarker().Invalidate( nIn );
@@ -248,8 +255,8 @@ void OViewsWindow::Resize()
TSectionsMap::iterator aEnd = m_aSections.end();
for (;aIter != aEnd ; ++aIter)
{
- const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter);
- impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,true);
+ OSectionWindow* pSectionWindow = (*aIter);
+ impl_resizeSectionWindow(*pSectionWindow,aStartPoint,true);
}
}
}
@@ -292,7 +299,7 @@ void OViewsWindow::DataChanged( const DataChangedEvent& rDCEvt )
void OViewsWindow::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition)
{
- ::boost::shared_ptr<OSectionWindow> pSectionWindow( new OSectionWindow(this,_xSection,_sColorEntry) );
+ VclPtrInstance<OSectionWindow> pSectionWindow(this,_xSection,_sColorEntry);
m_aSections.insert(getIteratorAtPos(_nPosition) , TSectionsMap::value_type(pSectionWindow));
m_pParent->setMarked(&pSectionWindow->getReportSection().getSectionView(),m_aSections.size() == 1);
Resize();
@@ -392,17 +399,17 @@ void OViewsWindow::Paste()
::o3tl::compose1(::boost::bind(&OReportSection::Paste,_1,aCopies,false),TReportPairHelper()));
else
{
- ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
+ OSectionWindow* pMarkedSection = getMarkedSection();
if ( pMarkedSection )
pMarkedSection->getReportSection().Paste(aCopies,true);
}
}
-::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const
+OSectionWindow* OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const
{
OSL_ENSURE(_xSection.is(),"Section is NULL!");
- ::boost::shared_ptr<OSectionWindow> pSectionWindow;
+ OSectionWindow* pSectionWindow = NULL;
TSectionsMap::const_iterator aIter = m_aSections.begin();
TSectionsMap::const_iterator aEnd = m_aSections.end();
for (; aIter != aEnd ; ++aIter)
@@ -418,9 +425,9 @@ void OViewsWindow::Paste()
}
-::boost::shared_ptr<OSectionWindow> OViewsWindow::getMarkedSection(NearSectionAccess nsa) const
+OSectionWindow* OViewsWindow::getMarkedSection(NearSectionAccess nsa) const
{
- ::boost::shared_ptr<OSectionWindow> pRet;
+ OSectionWindow* pRet = NULL;
TSectionsMap::const_iterator aIter = m_aSections.begin();
TSectionsMap::const_iterator aEnd = m_aSections.end();
sal_uInt32 nCurrentPosition = 0;
@@ -624,7 +631,7 @@ void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepor
bFirst = false;
m_pParent->setMarked(xSection,_bMark);
}
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = getSectionWindow(xSection);
+ OSectionWindow* pSectionWindow = getSectionWindow(xSection);
if ( pSectionWindow )
{
SvxShape* pShape = SvxShape::getImplementation( *pIter );
@@ -881,7 +888,7 @@ void OViewsWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAli
void OViewsWindow::createDefault()
{
- ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
+ OSectionWindow* pMarkedSection = getMarkedSection();
if ( pMarkedSection )
pMarkedSection->getReportSection().createDefault(m_sShapeType);
}
@@ -922,9 +929,9 @@ sal_uInt16 OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) cons
return nPosition;
}
-::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const
+OSectionWindow* OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const
{
- ::boost::shared_ptr<OSectionWindow> aReturn;
+ OSectionWindow* aReturn = NULL;
if ( _nPos < m_aSections.size() )
aReturn = m_aSections[_nPos];
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index 0e8f7b6492c1..0fb2b0e62dfe 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -185,6 +185,11 @@ PropBrw::PropBrw(const Reference< XComponentContext >& _xORB, vcl::Window* pPare
PropBrw::~PropBrw()
{
+ disposeOnce();
+}
+
+void PropBrw::dispose()
+{
if (m_xBrowserController.is())
implDetachController();
@@ -204,6 +209,8 @@ PropBrw::~PropBrw()
{}
::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
+ m_pDesignView.clear();
+ DockingWindow::dispose();
}
void PropBrw::setCurrentPage(const OUString& _sLastActivePage)
@@ -507,7 +514,7 @@ void PropBrw::Update( OSectionView* pNewView )
const sal_uInt16 nSectionCount = pViews->getSectionCount();
for (sal_uInt16 i = 0; i < nSectionCount; ++i)
{
- ::boost::shared_ptr<OSectionWindow> pSectionWindow = pViews->getSectionWindow(i);
+ OSectionWindow* pSectionWindow = pViews->getSectionWindow(i);
if ( pSectionWindow )
{
const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList();
diff --git a/sc/inc/AccessibleFilterMenu.hxx b/sc/inc/AccessibleFilterMenu.hxx
index 65da10f1e4f9..2fa0a383fd22 100644
--- a/sc/inc/AccessibleFilterMenu.hxx
+++ b/sc/inc/AccessibleFilterMenu.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/accessibility/XAccessibleText.hpp>
#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
#include <com/sun/star/accessibility/TextSegment.hpp>
+#include <vcl/vclptr.hxx>
#include <vector>
@@ -169,7 +170,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
size_t mnMenuPos;
- ScMenuFloatingWindow* mpWindow;
+ VclPtr<ScMenuFloatingWindow> mpWindow;
bool mbEnabled:1;
};
diff --git a/sc/inc/AccessibleFilterMenuItem.hxx b/sc/inc/AccessibleFilterMenuItem.hxx
index dc723e7e2091..7eb2e8a74efb 100644
--- a/sc/inc/AccessibleFilterMenuItem.hxx
+++ b/sc/inc/AccessibleFilterMenuItem.hxx
@@ -24,6 +24,7 @@
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <vcl/vclptr.hxx>
class ScMenuFloatingWindow;
@@ -104,7 +105,7 @@ private:
private:
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
- ScMenuFloatingWindow* mpWindow;
+ VclPtr<ScMenuFloatingWindow> mpWindow;
size_t mnMenuPos;
bool mbEnabled;
};
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 838c100ce643..5b32930858b7 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -26,6 +26,7 @@
#include "scdllapi.h"
#include "cellvalue.hxx"
#include "mtvelements.hxx"
+#include <vcl/vclptr.hxx>
#include <memory>
@@ -588,7 +589,7 @@ private:
private:
ScDocument& mrDoc;
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
double mfPPTX;
double mfPPTY;
const ::std::vector<TabRanges>* mpTabRangesArray;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index bf9f078fbadd..8f2e65fae59e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -24,7 +24,7 @@
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <com/sun/star/uno/Reference.hxx>
-#include <rtl/ref.hxx>
+#include <vcl/vclptr.hxx>
#include "scdllapi.h"
#include "rangelst.hxx"
#include "rangenam.hxx"
@@ -286,8 +286,8 @@ private:
ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper
ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper
SfxObjectShell* pShell;
- SfxPrinter* pPrinter;
- VirtualDevice* pVirtualDevice_100th_mm;
+ VclPtr<SfxPrinter> pPrinter;
+ VclPtr<VirtualDevice> pVirtualDevice_100th_mm;
ScDrawLayer* pDrawLayer; // SdrModel
rtl::Reference<XColorList> pColorList;
ScValidationDataList* pValidationList; // validity
diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 3b9b53a40d0e..5e3a12693b53 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -28,8 +28,8 @@
#include <tools/time.hxx>
#include <tools/gen.hxx>
#include <tools/fract.hxx>
+#include <vcl/outdev.hxx>
-class OutputDevice;
class ScDocument;
class ScPatternAttr;
class ScEditEngineDefaulter;
@@ -41,7 +41,7 @@ class ScEditUtil
SCROW nRow;
SCTAB nTab;
Point aScrPos;
- OutputDevice* pDev; // MapMode has to be set
+ VclPtr<OutputDevice> pDev; // MapMode has to be set
double nPPTX;
double nPPTY;
Fraction aZoomX;
@@ -80,10 +80,7 @@ public:
ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
const Point& rScrPosPixel,
OutputDevice* pDevice, double nScaleX, double nScaleY,
- const Fraction& rX, const Fraction& rY ) :
- pDoc(pDocument),nCol(nX),nRow(nY),nTab(nZ),
- aScrPos(rScrPosPixel),pDev(pDevice),
- nPPTX(nScaleX),nPPTY(nScaleY),aZoomX(rX),aZoomY(rY) {}
+ const Fraction& rX, const Fraction& rY );
Rectangle GetEditArea( const ScPatternAttr* pPattern, bool bForceToTop );
};
diff --git a/sc/inc/rowheightcontext.hxx b/sc/inc/rowheightcontext.hxx
index a077bd0d3361..f801ee466f29 100644
--- a/sc/inc/rowheightcontext.hxx
+++ b/sc/inc/rowheightcontext.hxx
@@ -13,11 +13,11 @@
#include "scdllapi.h"
#include <tools/fract.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/outdev.hxx>
#include <vector>
-class OutputDevice;
-
namespace sc {
class SC_DLLPUBLIC RowHeightContext
@@ -28,7 +28,7 @@ class SC_DLLPUBLIC RowHeightContext
double mfPPTY;
Fraction maZoomX;
Fraction maZoomY;
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
sal_uInt16 mnExtraHeight;
bool mbForceAutoSize; /// whether to set height to optimal even when the manual height flag is set.
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 2673e2f1ad7d..31d90b6b00d8 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -112,8 +112,8 @@ class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener
bool mbIsInSharedDocLoading:1;
bool mbIsInSharedDocSaving:1;
- std::map<sal_uInt16, std::list<vcl::Window*> > m_mapRefWindow;
- std::stack<ScAnyRefModalDlg*> maAnyRefDlgStack;
+ std::map<sal_uInt16, std::list<VclPtr<vcl::Window> > > m_mapRefWindow;
+ std::stack<VclPtr<ScAnyRefModalDlg> > maAnyRefDlgStack;
public:
SFX_DECL_INTERFACE(SCID_APP)
@@ -247,7 +247,7 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO
// virtual methods for the options dialog
virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
- virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
+ virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
void SetInSharedDocLoading( bool bNew ) { mbIsInSharedDocLoading = bNew; }
bool IsInSharedDocLoading() const { return mbIsInSharedDocLoading; }
diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx
index f0b7bf60e2e9..c246fa9171b8 100644
--- a/sc/inc/scopetools.hxx
+++ b/sc/inc/scopetools.hxx
@@ -11,6 +11,7 @@
#define INCLUDED_SC_INC_SCOPETOOLS_HXX
#include "scdllapi.h"
+#include <vcl/vclptr.hxx>
class ScDocument;
namespace vcl { class Window; }
@@ -58,7 +59,7 @@ public:
class WaitPointerSwitch
{
- vcl::Window* mpFrameWin;
+ VclPtr<vcl::Window> mpFrameWin;
public:
WaitPointerSwitch(vcl::Window* pWin);
~WaitPointerSwitch();
diff --git a/sc/inc/waitoff.hxx b/sc/inc/waitoff.hxx
index 0e7672022809..6c8b5f91bf7f 100644
--- a/sc/inc/waitoff.hxx
+++ b/sc/inc/waitoff.hxx
@@ -27,7 +27,7 @@ namespace vcl { class Window; }
class ScWaitCursorOff
{
private:
- vcl::Window* pWin;
+ VclPtr<vcl::Window> pWin;
sal_uInt32 nWaiters;
public:
ScWaitCursorOff( vcl::Window* pWin );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 15a5a46066c8..05274b57691c 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -417,7 +417,7 @@ ScDocument::~ScDocument()
delete pChartCollection;
DeleteDrawLayer();
delete pFormatExchangeList;
- delete pPrinter;
+ pPrinter.disposeAndClear();
ImplDeleteOptions();
delete pConsolidateDlgData;
delete pClipData;
@@ -426,7 +426,7 @@ ScDocument::~ScDocument()
delete pEditEngine;
delete pNoteEngine;
delete pChangeViewSettings; // and delete
- delete pVirtualDevice_100th_mm;
+ pVirtualDevice_100th_mm.disposeAndClear();
delete pDPCollection;
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 4098c7e0d2ff..2bdfa30e3160 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -138,7 +138,7 @@ SfxPrinter* ScDocument::GetPrinter(bool bCreateIfNotExist)
pSet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, static_cast<int>(nFlags) ) );
pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning() ) );
- pPrinter = new SfxPrinter( pSet );
+ pPrinter = VclPtr<SfxPrinter>::Create( pSet );
pPrinter->SetMapMode( MAP_100TH_MM );
UpdateDrawPrinter();
pPrinter->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
@@ -149,7 +149,7 @@ SfxPrinter* ScDocument::GetPrinter(bool bCreateIfNotExist)
void ScDocument::SetPrinter( SfxPrinter* pNewPrinter )
{
- if ( pNewPrinter == pPrinter )
+ if ( pNewPrinter == pPrinter.get() )
{
// #i6706# SetPrinter is called with the same printer again if
// the JobSetup has changed. In that case just call UpdateDrawPrinter
@@ -158,11 +158,10 @@ void ScDocument::SetPrinter( SfxPrinter* pNewPrinter )
}
else
{
- SfxPrinter* pOld = pPrinter;
+ ScopedVclPtr<SfxPrinter> pOld( pPrinter );
pPrinter = pNewPrinter;
UpdateDrawPrinter();
pPrinter->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
- delete pOld;
}
InvalidateTextWidth(NULL, NULL, false); // in both cases
}
@@ -194,9 +193,9 @@ VirtualDevice* ScDocument::GetVirtualDevice_100th_mm()
if (!pVirtualDevice_100th_mm)
{
#ifdef IOS
- pVirtualDevice_100th_mm = new VirtualDevice( 8 );
+ pVirtualDevice_100th_mm = VclPtr<VirtualDevice>::Create( 8 );
#else
- pVirtualDevice_100th_mm = new VirtualDevice( 1 );
+ pVirtualDevice_100th_mm = VclPtr<VirtualDevice>::Create( 1 );
#endif
pVirtualDevice_100th_mm->SetReferenceDevice(VirtualDevice::REFDEV_MODE_MSO1);
MapMode aMapMode( pVirtualDevice_100th_mm->GetMapMode() );
@@ -844,8 +843,8 @@ void ScDocument::UpdateExternalRefLinks(vcl::Window* pWin)
aBuf.append(OUString(ScResId(SCSTR_EXTDOC_NOT_LOADED)));
aBuf.appendAscii("\n\n");
aBuf.append(aFile);
- MessageDialog aBox(pWin, aBuf.makeStringAndClear());
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(pWin, aBuf.makeStringAndClear());
+ aBox->Execute();
}
pExternalRefMgr->enableDocTimer(true);
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 532090d238d1..30884cc17bc5 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -3204,9 +3204,9 @@ uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet(
}
catch ( const sdbc::SQLException& rError )
{
- //TODO: store error message
- InfoBox aInfoBox( 0, OUString(rError.Message) );
- aInfoBox.Execute();
+ //! store error message
+ ScopedVclPtrInstance< InfoBox > aInfoBox( nullptr, OUString(rError.Message) );
+ aInfoBox->Execute();
}
catch ( uno::Exception& )
{
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index b7145d569445..12b7cbbe6b56 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -577,13 +577,13 @@ void ScGlobal::InitTextHeight(SfxItemPool* pPool)
}
OutputDevice* pDefaultDev = Application::GetDefaultDevice();
- VirtualDevice aVirtWindow( *pDefaultDev );
- aVirtWindow.SetMapMode(MAP_PIXEL);
+ ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *pDefaultDev );
+ pVirtWindow->SetMapMode(MAP_PIXEL);
vcl::Font aDefFont;
- pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, &aVirtWindow); // Font color doesn't matter here
- aVirtWindow.SetFont(aDefFont);
+ pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color doesn't matter here
+ pVirtWindow->SetFont(aDefFont);
sal_uInt16 nTest = static_cast<sal_uInt16>(
- aVirtWindow.PixelToLogic(Size(0, aVirtWindow.GetTextHeight()), MAP_TWIP).Height());
+ pVirtWindow->PixelToLogic(Size(0, pVirtWindow->GetTextHeight()), MAP_TWIP).Height());
if (nTest > nDefFontHeight)
nDefFontHeight = nTest;
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 1d95c3f4c529..4b47cf4525a2 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -253,8 +253,8 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput,
{
//TODO: different error message, if found, but not bAllowed ??
- MessageDialog aBox( pParent, ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND));
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox( pParent, ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND));
+ aBox->Execute();
}
return bScriptReturnedFalse;
@@ -359,8 +359,8 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput,
{
//TODO: different error message, if found, but not bAllowed ??
- MessageDialog aBox(pParent, ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND));
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(pParent, ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND));
+ aBox->Execute();
}
return bRet;
@@ -410,8 +410,8 @@ bool ScValidationData::DoError( vcl::Window* pParent, const OUString& rInput,
}
}
- MessBox aBox( pParent, WinBits(nStyle), aTitle, aMessage );
- sal_uInt16 nRet = aBox.Execute();
+ ScopedVclPtrInstance< MessBox > aBox( pParent, WinBits(nStyle), aTitle, aMessage );
+ sal_uInt16 nRet = aBox->Execute();
return ( eErrorStyle == SC_VALERR_STOP || nRet == RET_CANCEL );
}
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index dce8dd7cd0ed..4d797ccda674 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -53,6 +53,14 @@ using namespace com::sun::star;
// STATIC DATA
// Delimiters zusaetzlich zu EditEngine-Default:
+ScEditUtil::ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
+ const Point& rScrPosPixel,
+ OutputDevice* pDevice, double nScaleX, double nScaleY,
+ const Fraction& rX, const Fraction& rY ) :
+ pDoc(pDocument),nCol(nX),nRow(nY),nTab(nZ),
+ aScrPos(rScrPosPixel),pDev(pDevice),
+ nPPTX(nScaleX),nPPTY(nScaleY),aZoomX(rX),aZoomY(rY) {}
+
OUString ScEditUtil::ModifyDelimiters( const OUString& rOld )
{
// underscore is used in function argument names
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index 3403d4c670a6..bb00ad9aaa06 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -110,7 +110,7 @@ class ScHTMLExport : public ScExportBase
OUString aStreamPath;
OUString aFilterOptions;
OUString aCId; // Content-Id for Mail-Export
- OutputDevice* pAppWin; // for Pixel-work
+ VclPtr<OutputDevice> pAppWin; // for Pixel-work
FileNameMapPtr pFileNameMap; // for CopyLocalFileToINet
OUString aNonConvertibleChars; // collect nonconvertible characters
rtl_TextEncoding eDestEnc;
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 05a409c4359c..c25004ecff3c 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -662,15 +662,15 @@ void WorkbookGlobals::recalcFormulaCells()
if (rDoc.IsUserInteractionEnabled())
{
// Ask the user if full re-calculation is desired.
- QueryBox aBox(
+ ScopedVclPtrInstance<QueryBox> aBox(
rDocSh.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
- aBox.SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED));
+ aBox->SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED));
- sal_Int32 nRet = aBox.Execute();
+ sal_Int32 nRet = aBox->Execute();
bHardRecalc = nRet == RET_YES;
- if (aBox.GetCheckBoxState())
+ if (aBox->GetCheckBoxState())
{
// Always perform selected action in the future.
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 973446dfc3af..c72336d30938 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -433,8 +433,8 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
// Factor is printer to display ratio
double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / nOutputFactor;
double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom;
- VirtualDevice aVirtDev;
- sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoom, aZoom, &aVirtDev);
+ ScopedVclPtrInstance< VirtualDevice > pVirtDev;
+ sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoom, aZoom, pVirtDev);
aCxt.setExtraHeight(ScGlobal::nLastRowHeightExtra);
mpDoc->SetOptimalHeight(aCxt, 0, nEndRow, 0);
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)
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx
index f4b1a6f64deb..a23fa4463284 100644
--- a/sd/inc/Outliner.hxx
+++ b/sd/inc/Outliner.hxx
@@ -190,7 +190,7 @@ private:
*/
::boost::weak_ptr<ViewShell> mpWeakViewShell;
/// This window contains the view.
- ::sd::Window* mpWindow;
+ VclPtr<::sd::Window> mpWindow;
/// The document on whose objects and pages this class operates.
SdDrawDocument* mpDrawDocument;
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index 5ad63fd081ee..5dfaf5a96eb9 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -125,7 +125,7 @@ public:
// virtual methods for the option dialog
virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
- virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
+ virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
@@ -144,7 +144,7 @@ protected:
in the sense that it does not represent a printer. The pointer may
be NULL when the virtual device could not be created.
*/
- OutputDevice* mpVirtualRefDevice;
+ VclPtr< OutputDevice > mpVirtualRefDevice;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 33e457b03cc9..58c246f8035a 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -242,8 +242,8 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium& rMedium)
if (!bOK)
{
- MessageDialog aErrorBox(NULL, SD_RESSTR(STR_READ_DATA_ERROR));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SD_RESSTR(STR_READ_DATA_ERROR));
+ aErrorBox->Execute();
CloseBookmarkDoc();
pBookmarkDoc = NULL;
diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index b012245b4132..e616a0524d38 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -35,6 +35,8 @@
#include <com/sun/star/presentation/XPresentationSupplier.hpp>
#include <com/sun/star/presentation/FadeEffect.hpp>
#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <vcl/vclptr.hxx>
+#include <vcl/outdev.hxx>
#include "grouptable.hxx"
@@ -176,7 +178,6 @@ struct FontCollectionEntry
void ImplInit( const OUString& rName );
};
-class VirtualDevice;
class FontCollection
{
public :
@@ -197,7 +198,7 @@ public :
private:
- VirtualDevice* pVDev;
+ VclPtr<VirtualDevice> pVDev;
boost::ptr_vector<FontCollectionEntry> maFonts;
};
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 192d4eb31384..a8c3e90ef9a9 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -1396,7 +1396,7 @@ void FontCollectionEntry::ImplInit( const OUString& rName )
FontCollection::~FontCollection()
{
- delete pVDev;
+ pVDev.disposeAndClear();
xPPTBreakIter = NULL;
}
diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
index 727fba485427..c8ec3ee85e24 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -169,8 +169,8 @@ void SdGRFFilter::HandleGraphicFilterError( sal_uInt16 nFilterError, sal_uLong n
ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
else
{
- MessageDialog aErrorBox(NULL, SD_RESSTR(nId));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SD_RESSTR(nId));
+ aErrorBox->Execute();
}
}
diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx
index fbc76de77900..ab7590f09bee 100644
--- a/sd/source/filter/html/buttonset.cxx
+++ b/sd/source/filter/html/buttonset.cxx
@@ -197,8 +197,8 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton
std::vector< Graphic > aGraphics;
- VirtualDevice aDev;
- aDev.SetMapMode(MapMode(MAP_PIXEL));
+ ScopedVclPtrInstance< VirtualDevice > pDev;
+ pDev->SetMapMode(MapMode(MAP_PIXEL));
Size aSize;
std::vector< OUString >::const_iterator aIter( rButtons.begin() );
@@ -210,7 +210,7 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton
aGraphics.push_back(aGraphic);
- Size aGraphicSize( aGraphic.GetSizePixel( &aDev ) );
+ Size aGraphicSize( aGraphic.GetSizePixel( pDev ) );
aSize.Width() += aGraphicSize.Width();
if( aSize.Height() < aGraphicSize.Height() )
@@ -220,7 +220,7 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton
aSize.Width() += 3;
}
- aDev.SetOutputSizePixel( aSize );
+ pDev->SetOutputSizePixel( aSize );
Point aPos;
@@ -229,12 +229,12 @@ bool ButtonSetImpl::getPreview( int nSet, const std::vector< OUString >& rButton
{
Graphic aGraphic( (*aGraphIter++) );
- aGraphic.Draw( &aDev, aPos );
+ aGraphic.Draw( pDev, aPos );
aPos.X() += aGraphic.GetSizePixel().Width() + 3;
}
- rImage = Image( aDev.GetBitmapEx( Point(), aSize ) );
+ rImage = Image( pDev->GetBitmapEx( Point(), aSize ) );
return true;
}
return false;
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index d743aeb854f2..d761c2367f1d 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -3113,9 +3113,9 @@ bool HtmlExport::checkForExistingFiles()
OUString aSystemPath;
osl::FileBase::getSystemPathFromFileURL( maExportPath, aSystemPath );
aMsg = aMsg.replaceFirst( "%FILENAME", aSystemPath );
- WarningBox aWarning( 0, WB_YES_NO | WB_DEF_YES, aMsg );
- aWarning.SetImage( WarningBox::GetStandardImage() );
- bFound = ( RET_NO == aWarning.Execute() );
+ ScopedVclPtrInstance< WarningBox > aWarning( nullptr, WB_YES_NO | WB_DEF_YES, aMsg );
+ aWarning->SetImage( WarningBox::GetStandardImage() );
+ bFound = ( RET_NO == aWarning->Execute() );
delete pResMgr;
}
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index a581a66d82b6..033eeb0fe52b 100644
--- a/sd/source/filter/html/pubdlg.cxx
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -347,12 +347,13 @@ SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDes
class SdDesignNameDlg : public ModalDialog
{
private:
- Edit* m_pEdit;
- OKButton* m_pBtnOK;
+ VclPtr<Edit> m_pEdit;
+ VclPtr<OKButton> m_pBtnOK;
public:
SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName );
-
+ virtual ~SdDesignNameDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetDesignName();
DECL_LINK(ModifyHdl, void *);
};
@@ -483,8 +484,97 @@ SdPublishingDlg::SdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType)
SdPublishingDlg::~SdPublishingDlg()
{
+ disposeOnce();
+}
+
+void SdPublishingDlg::dispose()
+{
+ pPage1.clear();
+ pPage1_Titel.clear();
+ pPage1_NewDesign.clear();
+ pPage1_OldDesign.clear();
+ pPage1_Designs.clear();
+ pPage1_DelDesign.clear();
+ pPage1_Desc.clear();
+ pPage2.clear();
+ pPage2Frame2.clear();
+ pPage2Frame3.clear();
+ pPage2Frame4.clear();
+ pPage2_Titel.clear();
+ pPage2_Standard.clear();
+ pPage2_Frames.clear();
+ pPage2_SingleDocument.clear();
+ pPage2_Kiosk.clear();
+ pPage2_WebCast.clear();
+ pPage2_Standard_FB.clear();
+ pPage2_Frames_FB.clear();
+ pPage2_Kiosk_FB.clear();
+ pPage2_WebCast_FB.clear();
+ pPage2_Titel_Html.clear();
+ pPage2_Content.clear();
+ pPage2_Notes.clear();
+ pPage2_Titel_WebCast.clear();
+ pPage2_ASP.clear();
+ pPage2_PERL.clear();
+ pPage2_URL_txt.clear();
+ pPage2_URL.clear();
+ pPage2_CGI_txt.clear();
+ pPage2_CGI.clear();
+ pPage2_Index_txt.clear();
+ pPage2_Index.clear();
+ pPage2_Titel_Kiosk.clear();
+ pPage2_ChgDefault.clear();
+ pPage2_ChgAuto.clear();
+ pPage2_Duration_txt.clear();
+ pPage2_Duration.clear();
+ pPage2_Endless.clear();
+ pPage3.clear();
+ pPage3_Titel1.clear();
+ pPage3_Png.clear();
+ pPage3_Gif.clear();
+ pPage3_Jpg.clear();
+ pPage3_Quality_txt.clear();
+ pPage3_Quality.clear();
+ pPage3_Titel2.clear();
+ pPage3_Resolution_1.clear();
+ pPage3_Resolution_2.clear();
+ pPage3_Resolution_3.clear();
+ pPage3_Titel3.clear();
+ pPage3_SldSound.clear();
+ pPage3_HiddenSlides.clear();
+ pPage4.clear();
+ pPage4_Titel1.clear();
+ pPage4_Author_txt.clear();
+ pPage4_Author.clear();
+ pPage4_Email_txt.clear();
+ pPage4_Email.clear();
+ pPage4_WWW_txt.clear();
+ pPage4_WWW.clear();
+ pPage4_Titel2.clear();
+ pPage4_Misc.clear();
+ pPage4_Download.clear();
+ pPage5.clear();
+ pPage5_Titel.clear();
+ pPage5_TextOnly.clear();
+ pPage5_Buttons.clear();
+ pPage6.clear();
+ pPage6_Titel.clear();
+ pPage6_Default.clear();
+ pPage6_User.clear();
+ pPage6_Back.clear();
+ pPage6_Text.clear();
+ pPage6_Link.clear();
+ pPage6_VLink.clear();
+ pPage6_ALink.clear();
+ pPage6_DocColors.clear();
+ pPage6_Preview.clear();
+ pLastPageButton.clear();
+ pNextPageButton.clear();
+ pFinishButton.clear();
+ ModalDialog::dispose();
}
+
// Generate dialog controls and embed them in the pages
void SdPublishingDlg::CreatePages()
{
@@ -1072,11 +1162,11 @@ IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl)
{
bRetry = false;
- SdDesignNameDlg aDlg(this, aName );
+ ScopedVclPtrInstance< SdDesignNameDlg > aDlg(this, aName );
- if ( aDlg.Execute() == RET_OK )
+ if ( aDlg->Execute() == RET_OK )
{
- pDesign->m_aDesignName = aDlg.GetDesignName();
+ pDesign->m_aDesignName = aDlg->GetDesignName();
boost::ptr_vector<SdPublishingDesign>::iterator iter;
for (iter = m_aDesignList.begin(); iter != m_aDesignList.end(); ++iter)
@@ -1087,9 +1177,9 @@ IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl)
if (iter != m_aDesignList.end())
{
- MessageDialog aErrorBox(this, SD_RESSTR(STR_PUBDLG_SAMENAME),
+ ScopedVclPtrInstance<MessageDialog> aErrorBox(this, SD_RESSTR(STR_PUBDLG_SAMENAME),
VCL_MESSAGE_ERROR, VCL_BUTTONS_YES_NO);
- bRetry = aErrorBox.Execute() == RET_NO;
+ bRetry = aErrorBox->Execute() == RET_NO;
if(!bRetry)
m_aDesignList.erase(iter);
@@ -1542,6 +1632,18 @@ SdDesignNameDlg::SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName)
m_pBtnOK->Enable(!aName.isEmpty());
}
+SdDesignNameDlg::~SdDesignNameDlg()
+{
+ disposeOnce();
+}
+
+void SdDesignNameDlg::dispose()
+{
+ m_pEdit.clear();
+ m_pBtnOK.clear();
+ ModalDialog::dispose();
+}
+
OUString SdDesignNameDlg::GetDesignName()
{
return m_pEdit->GetText();
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index 6cde28c4d4f1..f2f4f4a9df0c 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -96,7 +96,7 @@ private:
sal_Int32 mnFirstVisibleChild;
sal_Int32 mnLastVisibleChild;
bool mbListeningToDocument;
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
sal_Int32 mnFocusedIndex;
bool mbModelChangeLocked;
ImplSVEvent * mnUpdateChildrenUserEventId;
@@ -221,7 +221,7 @@ Reference<XAccessible > SAL_CALL AccessibleSlideSorterView::getAccessibleParent(
const SolarMutexGuard aSolarGuard;
Reference<XAccessible> xParent;
- if (mpContentWindow != NULL)
+ if (mpContentWindow != nullptr)
{
vcl::Window* pParent = mpContentWindow->GetAccessibleParentWindow();
if (pParent != NULL)
@@ -302,7 +302,7 @@ Reference<XAccessibleStateSet > SAL_CALL
pStateSet->AddState(AccessibleStateType::ACTIVE);
pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
pStateSet->AddState(AccessibleStateType::OPAQUE);
- if (mpContentWindow!=NULL)
+ if (mpContentWindow!=nullptr)
{
if (mpContentWindow->IsVisible())
pStateSet->AddState(AccessibleStateType::VISIBLE);
@@ -416,7 +416,7 @@ awt::Rectangle SAL_CALL AccessibleSlideSorterView::getBounds()
const SolarMutexGuard aSolarGuard;
awt::Rectangle aBBox;
- if (mpContentWindow != NULL)
+ if (mpContentWindow != nullptr)
{
const Point aPosition (mpContentWindow->GetPosPixel());
const Size aSize (mpContentWindow->GetOutputSizePixel());
@@ -436,7 +436,7 @@ awt::Point SAL_CALL AccessibleSlideSorterView::getLocation()
ThrowIfDisposed();
awt::Point aLocation;
- if (mpContentWindow != NULL)
+ if (mpContentWindow != nullptr)
{
const Point aPosition (mpContentWindow->GetPosPixel());
aLocation.X = aPosition.X();
@@ -478,7 +478,7 @@ awt::Size SAL_CALL AccessibleSlideSorterView::getSize()
ThrowIfDisposed();
awt::Size aSize;
- if (mpContentWindow != NULL)
+ if (mpContentWindow != nullptr)
{
const Size aOutputSize (mpContentWindow->GetOutputSizePixel());
aSize.Width = aOutputSize.Width();
@@ -813,7 +813,7 @@ void AccessibleSlideSorterView::Implementation::ConnectListeners()
StartListening (*mrSlideSorter.GetViewShell());
mbListeningToDocument = true;
- if (mpWindow != NULL)
+ if (mpWindow != nullptr)
mpWindow->AddEventListener(
LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
@@ -834,7 +834,7 @@ void AccessibleSlideSorterView::Implementation::ReleaseListeners()
mrSlideSorter.GetView().RemoveVisibilityChangeListener(
LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
- if (mpWindow != NULL)
+ if (mpWindow != nullptr)
mpWindow->RemoveEventListener(
LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
index 239f19586dd9..59bcdecaceb0 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
@@ -165,6 +165,7 @@ class CustomAnimationCreateTabPage : public TabPage
public:
CustomAnimationCreateTabPage( vcl::Window* pParent, CustomAnimationCreateDialog* pDialogParent, sal_uInt16 nTabId, const PresetCategoryList& rCategoryList, bool bHasText, bool bIsMotionPath = false );
virtual ~CustomAnimationCreateTabPage();
+ virtual void dispose() SAL_OVERRIDE;
PathKind getCreatePathKind() const;
CustomAnimationPresetPtr getSelectedPreset() const;
@@ -187,12 +188,12 @@ private:
void clearEffects();
private:
- CategoryListBox* mpLBEffects;
- FixedText* mpFTSpeed;
- ListBox* mpCBSpeed;
- CheckBox* mpCBXPReview;
+ VclPtr<CategoryListBox> mpLBEffects;
+ VclPtr<FixedText> mpFTSpeed;
+ VclPtr<ListBox> mpCBSpeed;
+ VclPtr<CheckBox> mpCBXPReview;
- CustomAnimationCreateDialog* mpParent;
+ VclPtr<CustomAnimationCreateDialog> mpParent;
sal_uInt16 mnId;
@@ -296,7 +297,18 @@ CustomAnimationCreateTabPage::CustomAnimationCreateTabPage( vcl::Window* pParent
CustomAnimationCreateTabPage::~CustomAnimationCreateTabPage()
{
+ disposeOnce();
+}
+
+void CustomAnimationCreateTabPage::dispose()
+{
clearEffects();
+ mpLBEffects.clear();
+ mpFTSpeed.clear();
+ mpCBSpeed.clear();
+ mpCBXPReview.clear();
+ mpParent.clear();
+ TabPage::dispose();
}
IMPL_LINK( CustomAnimationCreateTabPage, implSelectHdl, Control*, pControl )
@@ -497,15 +509,15 @@ CustomAnimationCreateDialog::CustomAnimationCreateDialog( vcl::Window* pParent,
mnMiscId = mpTabControl->GetPageId("misc_effects");
const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
- mpTabPages[ENTRANCE] = new CustomAnimationCreateTabPage( mpTabControl, this, mnEntranceId, rPresets.getEntrancePresets(), bHasText );
+ mpTabPages[ENTRANCE] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnEntranceId, rPresets.getEntrancePresets(), bHasText );
mpTabControl->SetTabPage( mnEntranceId, mpTabPages[ENTRANCE] );
- mpTabPages[EMPHASIS] = new CustomAnimationCreateTabPage( mpTabControl, this, mnEmphasisId, rPresets.getEmphasisPresets(), bHasText );
+ mpTabPages[EMPHASIS] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnEmphasisId, rPresets.getEmphasisPresets(), bHasText );
mpTabControl->SetTabPage( mnEmphasisId, mpTabPages[EMPHASIS] );
- mpTabPages[EXIT] = new CustomAnimationCreateTabPage( mpTabControl, this, mnExitId, rPresets.getExitPresets(), bHasText );
+ mpTabPages[EXIT] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnExitId, rPresets.getExitPresets(), bHasText );
mpTabControl->SetTabPage( mnExitId, mpTabPages[EXIT] );
- mpTabPages[MOTIONPATH] = new CustomAnimationCreateTabPage( mpTabControl, this, mnMPathId, rPresets.getMotionPathsPresets(), bHasText, true );
+ mpTabPages[MOTIONPATH] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnMPathId, rPresets.getMotionPathsPresets(), bHasText, true );
mpTabControl->SetTabPage( mnMPathId, mpTabPages[MOTIONPATH] );
- mpTabPages[MISCEFFECTS] = new CustomAnimationCreateTabPage( mpTabControl, this, mnMiscId, rPresets.getMiscPresets(), bHasText );
+ mpTabPages[MISCEFFECTS] = VclPtr<CustomAnimationCreateTabPage>::Create( mpTabControl, this, mnMiscId, rPresets.getMiscPresets(), bHasText );
mpTabControl->SetTabPage( mnMiscId, mpTabPages[MISCEFFECTS] );
getCurrentPage()->setDuration( mfDuration );
@@ -532,17 +544,25 @@ CustomAnimationCreateDialog::CustomAnimationCreateDialog( vcl::Window* pParent,
CustomAnimationCreateDialog::~CustomAnimationCreateDialog()
{
+ disposeOnce();
+}
+
+void CustomAnimationCreateDialog::dispose()
+{
storePosition();
SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
pOptions->SetPreviewNewEffects( getCurrentPage()->getIsPreview() );
- delete mpTabPages[ENTRANCE];
- delete mpTabPages[EMPHASIS];
- delete mpTabPages[EXIT];
- delete mpTabPages[MOTIONPATH];
- delete mpTabPages[MISCEFFECTS];
+ mpTabPages[ENTRANCE].disposeAndClear();
+ mpTabPages[EMPHASIS].disposeAndClear();
+ mpTabPages[EXIT].disposeAndClear();
+ mpTabPages[MOTIONPATH].disposeAndClear();
+ mpTabPages[MISCEFFECTS].disposeAndClear();
+ mpTabControl.clear();
+ mpPane.clear();
+ TabDialog::dispose();
}
CustomAnimationCreateTabPage* CustomAnimationCreateDialog::getCurrentPage() const
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
index b17be8894781..68a5c811bc87 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
@@ -41,6 +41,7 @@ class CustomAnimationCreateDialog : public TabDialog
public:
CustomAnimationCreateDialog( vcl::Window* pParent, CustomAnimationPane* pPane, const std::vector< ::com::sun::star::uno::Any >& rTargets, bool bHasText, const OUString& rsPresetId, double fDuration );
virtual ~CustomAnimationCreateDialog();
+ virtual void dispose() SAL_OVERRIDE;
PathKind getCreatePathKind() const;
CustomAnimationPresetPtr getSelectedPreset() const;
@@ -56,15 +57,15 @@ private:
DECL_LINK(implDeactivatePagekHdl, void *);
private:
- CustomAnimationPane* mpPane;
+ VclPtr<CustomAnimationPane> mpPane;
const std::vector< ::com::sun::star::uno::Any >& mrTargets;
double mfDuration;
bool mbIsPreview;
- TabControl* mpTabControl;
+ VclPtr<TabControl> mpTabControl;
- CustomAnimationCreateTabPage* mpTabPages[5];
+ VclPtr<CustomAnimationCreateTabPage> mpTabPages[5];
sal_uInt16 mnEntranceId, mnEmphasisId, mnExitId, mnMPathId, mnMiscId;
};
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 5a4577aeb74a..c2bd3292e100 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -107,13 +107,13 @@ public:
private:
std::map< sal_uInt16, OUString > maPropertyValues;
- ListBox* mpControl;
+ VclPtr<ListBox> mpControl;
};
PresetPropertyBox::PresetPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const OUString& aPresetId, const Link& rModifyHdl )
: PropertySubControl( nControlType )
{
- mpControl = new ListBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
+ mpControl = VclPtr<ListBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
mpControl->SetDropDownLineCount( 10 );
mpControl->SetSelectHdl( rModifyHdl );
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX );
@@ -159,7 +159,7 @@ void PresetPropertyBox::setValue( const Any& rValue, const OUString& rPresetId )
PresetPropertyBox::~PresetPropertyBox()
{
- delete mpControl;
+ mpControl.disposeAndClear();
}
Any PresetPropertyBox::getValue()
@@ -183,13 +183,13 @@ public:
virtual Control* getControl() SAL_OVERRIDE;
private:
- ColorListBox* mpControl;
+ VclPtr<ColorListBox> mpControl;
};
ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl )
: PropertySubControl( nControlType )
{
- mpControl = new ColorListBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
+ mpControl = VclPtr<ColorListBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
mpControl->SetDropDownLineCount( 10 );
mpControl->SetSelectHdl( rModifyHdl );
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX );
@@ -219,7 +219,7 @@ ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent
ColorPropertyBox::~ColorPropertyBox()
{
- delete mpControl;
+ mpControl.disposeAndClear();
}
void ColorPropertyBox::setValue( const Any& rValue, const OUString& )
@@ -256,13 +256,13 @@ public:
virtual Control* getControl() SAL_OVERRIDE;
private:
- FontNameBox* mpControl;
+ VclPtr<FontNameBox> mpControl;
};
FontPropertyBox::FontPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl )
: PropertySubControl( nControlType )
{
- mpControl = new FontNameBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
+ mpControl = VclPtr<FontNameBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
mpControl->SetDropDownLineCount( 10 );
mpControl->SetSelectHdl( rModifyHdl );
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX );
@@ -303,7 +303,7 @@ void FontPropertyBox::setValue( const Any& rValue, const OUString& )
FontPropertyBox::~FontPropertyBox()
{
- delete mpControl;
+ mpControl.disposeAndClear();
}
Any FontPropertyBox::getValue()
@@ -322,6 +322,7 @@ class DropdownMenuBox : public Edit
public:
DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu );
virtual ~DropdownMenuBox();
+ virtual void dispose() SAL_OVERRIDE;
void Resize() SAL_OVERRIDE;
bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -329,16 +330,16 @@ public:
void SetMenuSelectHdl( const Link& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); }
private:
- Edit* mpSubControl;
- MenuButton* mpDropdownButton;
- PopupMenu* mpMenu;
+ VclPtr<Edit> mpSubControl;
+ VclPtr<MenuButton> mpDropdownButton;
+ PopupMenu* mpMenu;
};
DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu )
: Edit( pParent, WB_BORDER|WB_TABSTOP| WB_DIALOGCONTROL ),
mpSubControl(pSubControl),mpDropdownButton(0),mpMenu(pMenu)
{
- mpDropdownButton = new MenuButton( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP);
+ mpDropdownButton = VclPtr<MenuButton>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP);
mpDropdownButton->SetSymbol(SymbolType::SPIN_DOWN);
mpDropdownButton->Show();
mpDropdownButton->SetPopupMenu( pMenu );
@@ -350,10 +351,16 @@ DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, Popup
DropdownMenuBox::~DropdownMenuBox()
{
- SetSubEdit( 0 );
- delete mpSubControl;
- delete mpDropdownButton;
+ disposeOnce();
+}
+
+void DropdownMenuBox::dispose()
+{
+ SetSubEdit(nullptr);
+ mpDropdownButton.disposeAndClear();
delete mpMenu;
+ mpSubControl.disposeAndClear();
+ Edit::dispose();
}
void DropdownMenuBox::Resize()
@@ -405,21 +412,21 @@ public:
DECL_LINK( implMenuSelectHdl, MenuButton* );
private:
- DropdownMenuBox* mpControl;
+ VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
- MetricField* mpMetric;
+ VclPtr<MetricField> mpMetric;
};
CharHeightPropertyBox::CharHeightPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl )
: PropertySubControl( nControlType )
{
- mpMetric = new MetricField( pParent, WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER);
+ mpMetric.set( VclPtr<MetricField>::Create( pParent, WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) );
mpMetric->SetUnit( FUNIT_PERCENT );
mpMetric->SetMin( 0 );
mpMetric->SetMax( 1000 );
mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSIZE_POPUP ) );
- mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu );
+ mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, CharHeightPropertyBox, implMenuSelectHdl ));
mpControl->SetModifyHdl( rModifyHdl );
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX );
@@ -430,7 +437,7 @@ CharHeightPropertyBox::CharHeightPropertyBox( sal_Int32 nControlType, vcl::Windo
CharHeightPropertyBox::~CharHeightPropertyBox()
{
- delete mpControl;
+ mpControl.disposeAndClear();
}
IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
@@ -450,7 +457,7 @@ IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
void CharHeightPropertyBox::setValue( const Any& rValue, const OUString& )
{
- if( mpMetric )
+ if( mpMetric.get() )
{
double fValue = 0.0;
rValue >>= fValue;
@@ -485,9 +492,9 @@ public:
void updateMenu();
private:
- DropdownMenuBox* mpControl;
+ VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
- MetricField* mpMetric;
+ VclPtr<MetricField> mpMetric;
Link maModifyHdl;
};
@@ -495,7 +502,7 @@ TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::W
: PropertySubControl( nControlType )
, maModifyHdl( rModifyHdl )
{
- mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER);
+ mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) );
mpMetric->SetUnit( FUNIT_PERCENT );
mpMetric->SetMin( 0 );
mpMetric->SetMax( 100 );
@@ -508,7 +515,7 @@ TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::W
mpMenu->InsertItem( i, aStr );
}
- mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu );
+ mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, TransparencyPropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX );
@@ -521,7 +528,7 @@ TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::W
TransparencyPropertyBox::~TransparencyPropertyBox()
{
- delete mpControl;
+ mpControl.disposeAndClear();
}
void TransparencyPropertyBox::updateMenu()
@@ -534,7 +541,7 @@ void TransparencyPropertyBox::updateMenu()
IMPL_LINK_NOARG(TransparencyPropertyBox, implModifyHdl)
{
updateMenu();
- maModifyHdl.Call(mpMetric);
+ maModifyHdl.Call(mpMetric.get());
return 0;
}
@@ -552,7 +559,7 @@ IMPL_LINK( TransparencyPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
void TransparencyPropertyBox::setValue( const Any& rValue, const OUString& )
{
- if( mpMetric )
+ if( mpMetric.get() )
{
double fValue = 0.0;
rValue >>= fValue;
@@ -589,9 +596,9 @@ public:
void updateMenu();
private:
- DropdownMenuBox* mpControl;
+ VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
- MetricField* mpMetric;
+ VclPtr<MetricField> mpMetric;
Link maModifyHdl;
};
@@ -599,14 +606,14 @@ RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* p
: PropertySubControl( nControlType )
, maModifyHdl( rModifyHdl )
{
- mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER);
+ mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) );
mpMetric->SetUnit( FUNIT_CUSTOM );
mpMetric->SetCustomUnitText( OUString( sal_Unicode(0xb0)) ); // degree sign
mpMetric->SetMin( -10000 );
mpMetric->SetMax( 10000 );
mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_ROTATION_POPUP ) );
- mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu );
+ mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, RotationPropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX );
@@ -619,7 +626,7 @@ RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* p
RotationPropertyBox::~RotationPropertyBox()
{
- delete mpControl;
+ mpControl.disposeAndClear();
}
void RotationPropertyBox::updateMenu()
@@ -640,7 +647,7 @@ void RotationPropertyBox::updateMenu()
IMPL_LINK_NOARG(RotationPropertyBox, implModifyHdl)
{
updateMenu();
- maModifyHdl.Call(mpMetric);
+ maModifyHdl.Call(mpMetric.get());
return 0;
}
@@ -677,7 +684,7 @@ IMPL_LINK( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
void RotationPropertyBox::setValue( const Any& rValue, const OUString& )
{
- if( mpMetric )
+ if( mpMetric.get() )
{
double fValue = 0.0;
rValue >>= fValue;
@@ -714,9 +721,9 @@ public:
void updateMenu();
private:
- DropdownMenuBox* mpControl;
+ VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
- MetricField* mpMetric;
+ VclPtr<MetricField> mpMetric;
Link maModifyHdl;
int mnDirection;
};
@@ -725,13 +732,13 @@ ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent
: PropertySubControl( nControlType )
, maModifyHdl( rModifyHdl )
{
- mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER);
+ mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) );
mpMetric->SetUnit( FUNIT_PERCENT );
mpMetric->SetMin( 0 );
mpMetric->SetMax( 10000 );
mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_SCALE_POPUP ) );
- mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu );
+ mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, ScalePropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX );
@@ -744,7 +751,7 @@ ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent
ScalePropertyBox::~ScalePropertyBox()
{
- delete mpControl;
+ mpControl.disposeAndClear();
}
void ScalePropertyBox::updateMenu()
@@ -764,7 +771,7 @@ void ScalePropertyBox::updateMenu()
IMPL_LINK_NOARG(ScalePropertyBox, implModifyHdl)
{
updateMenu();
- maModifyHdl.Call(mpMetric);
+ maModifyHdl.Call(mpMetric.get());
return 0;
}
@@ -810,7 +817,7 @@ IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb )
void ScalePropertyBox::setValue( const Any& rValue, const OUString& )
{
- if( mpMetric )
+ if( mpMetric.get() )
{
ValuePair aValues;
rValue >>= aValues;
@@ -876,9 +883,9 @@ public:
void update();
private:
- DropdownMenuBox* mpControl;
+ VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
- Edit* mpEdit;
+ VclPtr<Edit> mpEdit;
Link maModifyHdl;
float mfFontWeight;
@@ -890,11 +897,11 @@ FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window*
: PropertySubControl( nControlType )
, maModifyHdl( rModifyHdl )
{
- mpEdit = new Edit( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY);
+ mpEdit.set( VclPtr<Edit>::Create( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY) );
mpEdit->SetText( SD_RESSTR(STR_CUSTOMANIMATION_SAMPLE) );
mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSTYLE_POPUP ) );
- mpControl = new DropdownMenuBox( pParent, mpEdit, mpMenu );
+ mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpEdit, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, FontStylePropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX );
@@ -904,7 +911,7 @@ FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window*
FontStylePropertyBox::~FontStylePropertyBox()
{
- delete mpControl;
+ mpControl.disposeAndClear();
}
void FontStylePropertyBox::update()
@@ -950,7 +957,7 @@ IMPL_LINK( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb )
}
update();
- maModifyHdl.Call(mpEdit);
+ maModifyHdl.Call(mpEdit.get());
return 0;
}
@@ -986,6 +993,7 @@ class CustomAnimationEffectTabPage : public TabPage
public:
CustomAnimationEffectTabPage( vcl::Window* pParent, const STLPropertySet* pSet );
virtual ~CustomAnimationEffectTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void update( STLPropertySet* pSet );
DECL_LINK( implSelectHdl, Control* );
@@ -1003,24 +1011,24 @@ private:
bool mbHasText;
const STLPropertySet* mpSet;
- VclFrame* mpSettings;
- FixedText* mpFTProperty1;
- PropertyControl* mpLBProperty1;
- VclHBox* mpPlaceholderBox;
- CheckBox* mpCBSmoothStart;
- CheckBox* mpCBSmoothEnd;
-
- FixedText* mpFTSound;
- ListBox* mpLBSound;
- PushButton* mpPBSoundPreview;
- FixedText* mpFTAfterEffect;
- ListBox* mpLBAfterEffect;
- FixedText* mpFTDimColor;
- ColorListBox* mpCLBDimColor;
- FixedText* mpFTTextAnim;
- ListBox* mpLBTextAnim;
- MetricField* mpMFTextDelay;
- FixedText* mpFTTextDelay;
+ VclPtr<VclFrame> mpSettings;
+ VclPtr<FixedText> mpFTProperty1;
+ VclPtr<PropertyControl> mpLBProperty1;
+ VclPtr<VclHBox> mpPlaceholderBox;
+ VclPtr<CheckBox> mpCBSmoothStart;
+ VclPtr<CheckBox> mpCBSmoothEnd;
+
+ VclPtr<FixedText> mpFTSound;
+ VclPtr<ListBox> mpLBSound;
+ VclPtr<PushButton> mpPBSoundPreview;
+ VclPtr<FixedText> mpFTAfterEffect;
+ VclPtr<ListBox> mpLBAfterEffect;
+ VclPtr<FixedText> mpFTDimColor;
+ VclPtr<ColorListBox> mpCLBDimColor;
+ VclPtr<FixedText> mpFTTextAnim;
+ VclPtr<ListBox> mpLBTextAnim;
+ VclPtr<MetricField> mpMFTextDelay;
+ VclPtr<FixedText> mpFTTextDelay;
::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
};
@@ -1255,7 +1263,30 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent
CustomAnimationEffectTabPage::~CustomAnimationEffectTabPage()
{
+ disposeOnce();
+}
+
+void CustomAnimationEffectTabPage::dispose()
+{
clearSoundListBox();
+ mpSettings.clear();
+ mpFTProperty1.clear();
+ mpLBProperty1.clear();
+ mpPlaceholderBox.clear();
+ mpCBSmoothStart.clear();
+ mpCBSmoothEnd.clear();
+ mpFTSound.clear();
+ mpLBSound.clear();
+ mpPBSoundPreview.clear();
+ mpFTAfterEffect.clear();
+ mpLBAfterEffect.clear();
+ mpFTDimColor.clear();
+ mpCLBDimColor.clear();
+ mpFTTextAnim.clear();
+ mpLBTextAnim.clear();
+ mpMFTextDelay.clear();
+ mpFTTextDelay.clear();
+ TabPage::dispose();
}
void CustomAnimationEffectTabPage::updateControlStates()
@@ -1517,9 +1548,9 @@ void CustomAnimationEffectTabPage::openSoundFileDialog()
{
OUString aStrWarning(SD_RESSTR(STR_WARNING_NOSOUNDFILE));
aStrWarning = aStrWarning.replaceFirst("%", aFile);
- WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning );
- aWarningBox.SetModalInputMode (true);
- bQuitLoop = aWarningBox.Execute() != RET_RETRY;
+ ScopedVclPtrInstance< WarningBox > aWarningBox( nullptr, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning );
+ aWarningBox->SetModalInputMode (true);
+ bQuitLoop = aWarningBox->Execute() != RET_RETRY;
bValidSoundFile=false;
}
@@ -1558,6 +1589,7 @@ class CustomAnimationDurationTabPage : public TabPage
public:
CustomAnimationDurationTabPage( vcl::Window* pParent, const STLPropertySet* pSet );
virtual ~CustomAnimationDurationTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void update( STLPropertySet* pSet );
@@ -1566,18 +1598,18 @@ public:
private:
const STLPropertySet* mpSet;
- FixedText* mpFTStart;
- ListBox* mpLBStart;
- FixedText* mpFTStartDelay;
- MetricField* mpMFStartDelay;
- FixedText* mpFTDuration;
- ListBox* mpCBDuration;
- FixedText* mpFTRepeat;
- ListBox* mpCBRepeat;
- CheckBox* mpCBXRewind;
- RadioButton* mpRBClickSequence;
- RadioButton* mpRBInteractive;
- ListBox* mpLBTrigger;
+ VclPtr<FixedText> mpFTStart;
+ VclPtr<ListBox> mpLBStart;
+ VclPtr<FixedText> mpFTStartDelay;
+ VclPtr<MetricField> mpMFStartDelay;
+ VclPtr<FixedText> mpFTDuration;
+ VclPtr<ListBox> mpCBDuration;
+ VclPtr<FixedText> mpFTRepeat;
+ VclPtr<ListBox> mpCBRepeat;
+ VclPtr<CheckBox> mpCBXRewind;
+ VclPtr<RadioButton> mpRBClickSequence;
+ VclPtr<RadioButton> mpRBInteractive;
+ VclPtr<ListBox> mpLBTrigger;
};
CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(vcl::Window* pParent, const STLPropertySet* pSet)
@@ -1755,6 +1787,24 @@ CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(vcl::Window* pPar
CustomAnimationDurationTabPage::~CustomAnimationDurationTabPage()
{
+ disposeOnce();
+}
+
+void CustomAnimationDurationTabPage::dispose()
+{
+ mpFTStart.clear();
+ mpLBStart.clear();
+ mpFTStartDelay.clear();
+ mpMFStartDelay.clear();
+ mpFTDuration.clear();
+ mpCBDuration.clear();
+ mpFTRepeat.clear();
+ mpCBRepeat.clear();
+ mpCBXRewind.clear();
+ mpRBClickSequence.clear();
+ mpRBInteractive.clear();
+ mpLBTrigger.clear();
+ TabPage::dispose();
}
IMPL_LINK( CustomAnimationDurationTabPage, implControlHdl, Control*, pControl )
@@ -1924,6 +1974,8 @@ class CustomAnimationTextAnimTabPage : public TabPage
{
public:
CustomAnimationTextAnimTabPage( vcl::Window* pParent, const STLPropertySet* pSet );
+ virtual ~CustomAnimationTextAnimTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void update( STLPropertySet* pSet );
@@ -1931,12 +1983,12 @@ public:
DECL_LINK(implSelectHdl, void *);
private:
- FixedText* maFTGroupText;
- ListBox* maLBGroupText;
- CheckBox* maCBXGroupAuto;
- MetricField* maMFGroupAuto;
- CheckBox* maCBXAnimateForm;
- CheckBox* maCBXReverse;
+ VclPtr<FixedText> maFTGroupText;
+ VclPtr<ListBox> maLBGroupText;
+ VclPtr<CheckBox> maCBXGroupAuto;
+ VclPtr<MetricField> maMFGroupAuto;
+ VclPtr<CheckBox> maCBXAnimateForm;
+ VclPtr<CheckBox> maCBXReverse;
const STLPropertySet* mpSet;
@@ -2023,6 +2075,22 @@ CustomAnimationTextAnimTabPage::CustomAnimationTextAnimTabPage(vcl::Window* pPar
updateControlStates();
}
+CustomAnimationTextAnimTabPage::~CustomAnimationTextAnimTabPage()
+{
+ disposeOnce();
+}
+
+void CustomAnimationTextAnimTabPage::dispose()
+{
+ maFTGroupText.clear();
+ maLBGroupText.clear();
+ maCBXGroupAuto.clear();
+ maMFGroupAuto.clear();
+ maCBXAnimateForm.clear();
+ maCBXReverse.clear();
+ TabPage::dispose();
+}
+
void CustomAnimationTextAnimTabPage::update( STLPropertySet* pSet )
{
sal_Int32 nPos = maLBGroupText->GetSelectEntryPos();
@@ -2113,9 +2181,9 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe
sal_uInt16 mnTimingId = mpTabControl->GetPageId("timing");
sal_uInt16 mnTextAnimId = mpTabControl->GetPageId("textanim");
- mpEffectTabPage = new CustomAnimationEffectTabPage( mpTabControl, mpSet );
+ mpEffectTabPage = VclPtr<CustomAnimationEffectTabPage>::Create( mpTabControl, mpSet );
mpTabControl->SetTabPage( mnEffectId, mpEffectTabPage );
- mpDurationTabPage = new CustomAnimationDurationTabPage( mpTabControl, mpSet );
+ mpDurationTabPage = VclPtr<CustomAnimationDurationTabPage>::Create( mpTabControl, mpSet );
mpTabControl->SetTabPage( mnTimingId, mpDurationTabPage );
bool bHasText = false;
@@ -2124,7 +2192,7 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe
if( bHasText )
{
- mpTextAnimTabPage = new CustomAnimationTextAnimTabPage( mpTabControl, mpSet );
+ mpTextAnimTabPage = VclPtr<CustomAnimationTextAnimTabPage>::Create( mpTabControl, mpSet );
mpTabControl->SetTabPage( mnTextAnimId, mpTextAnimTabPage );
}
else
@@ -2139,12 +2207,20 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe
CustomAnimationDialog::~CustomAnimationDialog()
{
- delete mpEffectTabPage;
- delete mpDurationTabPage;
- delete mpTextAnimTabPage;
+ disposeOnce();
+}
+
+void CustomAnimationDialog::dispose()
+{
+ mpEffectTabPage.disposeAndClear();
+ mpDurationTabPage.disposeAndClear();
+ mpTextAnimTabPage.disposeAndClear();
delete mpSet;
delete mpResultSet;
+
+ mpTabControl.clear();
+ TabDialog::dispose();
}
STLPropertySet* CustomAnimationDialog::getResultSet()
@@ -2222,8 +2298,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makePropertyControl( vcl::
PropertyControl::~PropertyControl()
{
+ disposeOnce();
+}
+
+void PropertyControl::dispose()
+{
if( mpSubControl )
delete mpSubControl;
+ ListBox::dispose();
}
void PropertyControl::setSubControl( PropertySubControl* pSubControl )
diff --git a/sd/source/ui/animations/CustomAnimationDialog.hxx b/sd/source/ui/animations/CustomAnimationDialog.hxx
index 2fcdc742073a..3754d93ffdbf 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.hxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.hxx
@@ -123,6 +123,7 @@ class PropertyControl : public ListBox
public:
PropertyControl( vcl::Window* pParent );
virtual ~PropertyControl();
+ virtual void dispose() SAL_OVERRIDE;
void setSubControl( PropertySubControl* pSubControl );
PropertySubControl* getSubControl() const { return mpSubControl; }
@@ -143,6 +144,7 @@ class CustomAnimationDialog : public TabDialog
public:
CustomAnimationDialog(vcl::Window* pParent, STLPropertySet* pSet, const OString& Page = OString());
virtual ~CustomAnimationDialog();
+ virtual void dispose() SAL_OVERRIDE;
STLPropertySet* getDefaultSet() { return mpSet; }
STLPropertySet* getResultSet();
@@ -154,11 +156,11 @@ private:
STLPropertySet* mpResultSet;
CustomAnimationEffectPtr mpEffect;
- TabControl* mpTabControl;
+ VclPtr<TabControl> mpTabControl;
- CustomAnimationDurationTabPage* mpDurationTabPage;
- CustomAnimationEffectTabPage* mpEffectTabPage;
- CustomAnimationTextAnimTabPage* mpTextAnimTabPage;
+ VclPtr<CustomAnimationDurationTabPage> mpDurationTabPage;
+ VclPtr<CustomAnimationEffectTabPage> mpEffectTabPage;
+ VclPtr<CustomAnimationTextAnimTabPage> mpTextAnimTabPage;
};
}
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index c7f62dad3a59..dd4441aeebfb 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -210,7 +210,7 @@ public:
virtual void Paint(
const Point&, SvTreeListBox& rDev, const SvViewDataEntry* pView,const SvTreeListEntry* pEntry) SAL_OVERRIDE;
private:
- CustomAnimationList* mpParent;
+ VclPtr<CustomAnimationList> mpParent;
OUString maDescription;
CustomAnimationEffectPtr mpEffect;
};
@@ -444,10 +444,16 @@ const Image& CustomAnimationList::getImage( sal_uInt16 nId )
CustomAnimationList::~CustomAnimationList()
{
+ disposeOnce();
+}
+
+void CustomAnimationList::dispose()
+{
if( mpMainSequence.get() )
mpMainSequence->removeListener( this );
clear();
+ SvTreeListBox::dispose();
}
void CustomAnimationList::KeyInput( const KeyEvent& rKEvt )
diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx
index 66301bb6f830..18fde3c2db14 100644
--- a/sd/source/ui/animations/CustomAnimationList.hxx
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -48,6 +48,7 @@ class CustomAnimationList : public SvTreeListBox, public ISequenceListener
public:
CustomAnimationList( vcl::Window* pParent );
virtual ~CustomAnimationList();
+ virtual void dispose() SAL_OVERRIDE;
// methods
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 6e36b0b64d84..431c75b661f5 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -225,6 +225,11 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
CustomAnimationPane::~CustomAnimationPane()
{
+ disposeOnce();
+}
+
+void CustomAnimationPane::dispose()
+{
maLateInitTimer.Stop();
removeListener();
@@ -235,6 +240,24 @@ CustomAnimationPane::~CustomAnimationPane()
for( aIter = aTags.begin(); aIter != aTags.end(); ++aIter )
(*aIter)->Dispose();
+ mpPBAddEffect.clear();
+ mpPBChangeEffect.clear();
+ mpPBRemoveEffect.clear();
+ mpFTEffect.clear();
+ mpFTStart.clear();
+ mpLBStart.clear();
+ mpFTProperty.clear();
+ mpPlaceholderBox.clear();
+ mpLBProperty.clear();
+ mpPBPropertyMore.clear();
+ mpFTSpeed.clear();
+ mpCBSpeed.clear();
+ mpCustomAnimationList.clear();
+ mpPBMoveUp.clear();
+ mpPBMoveDown.clear();
+ mpPBPlay.clear();
+ mpCBAutoPreview.clear();
+ PanelLayout::dispose();
}
void CustomAnimationPane::addUndo()
@@ -809,11 +832,11 @@ void CustomAnimationPane::UpdateLook()
::sfx2::sidebar::Theme::GetWallpaper(
::sfx2::sidebar::Theme::Paint_PanelBackground));
SetBackground(aBackground);
- if (mpFTStart != NULL)
+ if (mpFTStart != nullptr)
mpFTStart->SetBackground(aBackground);
- if (mpFTProperty != NULL)
+ if (mpFTProperty != nullptr)
mpFTProperty->SetBackground(aBackground);
- if (mpFTSpeed != NULL)
+ if (mpFTSpeed != nullptr)
mpFTSpeed->SetBackground(aBackground);
}
@@ -1550,7 +1573,7 @@ void CustomAnimationPane::showOptions(const OString& sPage)
{
STLPropertySet* pSet = createSelectionSet();
- boost::scoped_ptr<CustomAnimationDialog> pDlg(new CustomAnimationDialog(this, pSet, sPage));
+ VclPtrInstance< CustomAnimationDialog > pDlg(this, pSet, sPage);
if( pDlg->Execute() )
{
addUndo();
@@ -1729,7 +1752,7 @@ void CustomAnimationPane::onChange( bool bCreate )
}
}
- boost::scoped_ptr<CustomAnimationCreateDialog> pDlg(new CustomAnimationCreateDialog( this, this, aTargets, bHasText, sPresetId, fDuration ));
+ VclPtrInstance< CustomAnimationCreateDialog > pDlg( this, this, aTargets, bHasText, sPresetId, fDuration );
if( pDlg->Execute() )
{
addUndo();
@@ -2263,7 +2286,7 @@ void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< Mot
if( pDocSh )
{
const Size aMinSize( pParent->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) );
- pWindow = new CustomAnimationPane( pParent, rBase, rxFrame, aMinSize );
+ pWindow = VclPtr<CustomAnimationPane>::Create( pParent, rBase, rxFrame, aMinSize );
}
return pWindow;
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index 57d10c613611..0fd6f19a6595 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -64,6 +64,7 @@ class CustomAnimationPane : public PanelLayout, public ICustomAnimationListContr
public:
CustomAnimationPane( vcl::Window* pParent, ViewShellBase& rBase, const css::uno::Reference<css::frame::XFrame>& rxFrame, const Size& rMinSize );
virtual ~CustomAnimationPane();
+ virtual void dispose() SAL_OVERRIDE;
// callbacks
void onSelectionChanged();
@@ -125,23 +126,23 @@ private:
const CustomAnimationPresets* mpCustomAnimationPresets;
- PushButton* mpPBAddEffect;
- PushButton* mpPBChangeEffect;
- PushButton* mpPBRemoveEffect;
- FixedText* mpFTEffect;
- FixedText* mpFTStart;
- ListBox* mpLBStart;
- FixedText* mpFTProperty;
- VclHBox* mpPlaceholderBox;
- PropertyControl* mpLBProperty;
- PushButton* mpPBPropertyMore;
- FixedText* mpFTSpeed;
- ListBox* mpCBSpeed;
- CustomAnimationList* mpCustomAnimationList;
- PushButton* mpPBMoveUp;
- PushButton* mpPBMoveDown;
- PushButton* mpPBPlay;
- CheckBox* mpCBAutoPreview;
+ VclPtr<PushButton> mpPBAddEffect;
+ VclPtr<PushButton> mpPBChangeEffect;
+ VclPtr<PushButton> mpPBRemoveEffect;
+ VclPtr<FixedText> mpFTEffect;
+ VclPtr<FixedText> mpFTStart;
+ VclPtr<ListBox> mpLBStart;
+ VclPtr<FixedText> mpFTProperty;
+ VclPtr<VclHBox> mpPlaceholderBox;
+ VclPtr<PropertyControl> mpLBProperty;
+ VclPtr<PushButton> mpPBPropertyMore;
+ VclPtr<FixedText> mpFTSpeed;
+ VclPtr<ListBox> mpCBSpeed;
+ VclPtr<CustomAnimationList> mpCustomAnimationList;
+ VclPtr<PushButton> mpPBMoveUp;
+ VclPtr<PushButton> mpPBMoveDown;
+ VclPtr<PushButton> mpPBPlay;
+ VclPtr<CheckBox> mpCBAutoPreview;
OUString maStrModify;
OUString maStrProperty;
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index 56bf1437dcb3..917a53e03b77 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -386,7 +386,7 @@ struct lcl_AppendSoundToListBox : public ::std::unary_function< OUString, void >
}
private:
- ListBox* mrListBox;
+ VclPtr<ListBox> mrListBox;
};
void lcl_FillSoundListBox(
@@ -483,8 +483,27 @@ SlideTransitionPane::SlideTransitionPane(
SlideTransitionPane::~SlideTransitionPane()
{
+ disposeOnce();
+}
+
+void SlideTransitionPane::dispose()
+{
maLateInitTimer.Stop();
removeListener();
+ mpLB_SLIDE_TRANSITIONS.clear();
+ mpFT_SPEED.clear();
+ mpLB_SPEED.clear();
+ mpFT_SOUND.clear();
+ mpLB_SOUND.clear();
+ mpCB_LOOP_SOUND.clear();
+ mpRB_ADVANCE_ON_MOUSE.clear();
+ mpRB_ADVANCE_AUTO.clear();
+ mpMF_ADVANCE_AUTO_AFTER.clear();
+ mpPB_APPLY_TO_ALL.clear();
+ mpPB_PLAY.clear();
+ mpPB_SLIDE_SHOW.clear();
+ mpCB_AUTO_PREVIEW.clear();
+ PanelLayout::dispose();
}
void SlideTransitionPane::DataChanged (const DataChangedEvent& rEvent)
@@ -724,9 +743,9 @@ void SlideTransitionPane::openSoundFileDialog()
{
OUString aStrWarning(SD_RESSTR(STR_WARNING_NOSOUNDFILE));
aStrWarning = aStrWarning.replaceFirst("%", aFile);
- WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning );
- aWarningBox.SetModalInputMode (true);
- bQuitLoop = (aWarningBox.Execute() != RET_RETRY);
+ ScopedVclPtrInstance< WarningBox > aWarningBox( nullptr, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning );
+ aWarningBox->SetModalInputMode (true);
+ bQuitLoop = (aWarningBox->Execute() != RET_RETRY);
bValidSoundFile = false;
}
@@ -1082,7 +1101,7 @@ IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback)
if( pDocSh )
{
Size aMinSize( pParent->LogicToPixel( Size( 72, 216 ), MAP_APPFONT ) );
- pWindow = new SlideTransitionPane( pParent, rBase, aMinSize, pDocSh->GetDoc(), rxFrame );
+ pWindow = VclPtr<SlideTransitionPane>::Create( pParent, rBase, aMinSize, pDocSh->GetDoc(), rxFrame );
}
return pWindow;
diff --git a/sd/source/ui/animations/SlideTransitionPane.hxx b/sd/source/ui/animations/SlideTransitionPane.hxx
index 3bb556d74112..63e76e3d1242 100644
--- a/sd/source/ui/animations/SlideTransitionPane.hxx
+++ b/sd/source/ui/animations/SlideTransitionPane.hxx
@@ -58,6 +58,7 @@ public:
SdDrawDocument* pDoc,
const css::uno::Reference<css::frame::XFrame>& rxFrame );
virtual ~SlideTransitionPane();
+ virtual void dispose() SAL_OVERRIDE;
// Window
virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
@@ -104,19 +105,19 @@ private:
SdDrawDocument * mpDrawDoc;
Size maMinSize;
- ListBox* mpLB_SLIDE_TRANSITIONS;
- FixedText* mpFT_SPEED;
- ListBox* mpLB_SPEED;
- FixedText* mpFT_SOUND;
- ListBox* mpLB_SOUND;
- CheckBox* mpCB_LOOP_SOUND;
- RadioButton* mpRB_ADVANCE_ON_MOUSE;
- RadioButton* mpRB_ADVANCE_AUTO;
- MetricField* mpMF_ADVANCE_AUTO_AFTER;
- PushButton* mpPB_APPLY_TO_ALL;
- PushButton* mpPB_PLAY;
- PushButton* mpPB_SLIDE_SHOW;
- CheckBox* mpCB_AUTO_PREVIEW;
+ VclPtr<ListBox> mpLB_SLIDE_TRANSITIONS;
+ VclPtr<FixedText> mpFT_SPEED;
+ VclPtr<ListBox> mpLB_SPEED;
+ VclPtr<FixedText> mpFT_SOUND;
+ VclPtr<ListBox> mpLB_SOUND;
+ VclPtr<CheckBox> mpCB_LOOP_SOUND;
+ VclPtr<RadioButton> mpRB_ADVANCE_ON_MOUSE;
+ VclPtr<RadioButton> mpRB_ADVANCE_AUTO;
+ VclPtr<MetricField> mpMF_ADVANCE_AUTO_AFTER;
+ VclPtr<PushButton> mpPB_APPLY_TO_ALL;
+ VclPtr<PushButton> mpPB_PLAY;
+ VclPtr<PushButton> mpPB_SLIDE_SHOW;
+ VclPtr<CheckBox> mpCB_AUTO_PREVIEW;
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index b856cb1e0b89..21614cd73662 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -694,10 +694,9 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward)
// Pop up question box that asks the user whether to wrap around.
// The dialog is made modal with respect to the whole application.
- QueryBox aQuestionBox ( NULL, (WB_YES_NO | WB_DEF_YES), SD_RESSTR(nStringId));
- aQuestionBox.SetImage (QueryBox::GetStandardImage());
- short nBoxResult = aQuestionBox.Execute();
- if (nBoxResult != RET_YES)
+ ScopedVclPtrInstance< QueryBox > aQuestionBox( nullptr, (WB_YES_NO | WB_DEF_YES), SD_RESSTR(nStringId));
+ aQuestionBox->SetImage( QueryBox::GetStandardImage() );
+ if (aQuestionBox->Execute() != RET_YES)
break;
}
while( true );
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 610ed613588f..ae9dc833b3fe 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -515,19 +515,19 @@ void AnnotationTag::deselect()
BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected )
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
OUString sAuthor( getInitials( mxAnnotation->getAuthor() ) );
sAuthor += OUString( ' ' );
sAuthor += OUString::number( mnIndex );
- aVDev.SetFont( mrFont );
+ pVDev->SetFont( mrFont );
const int BORDER_X = 4; // pixels
const int BORDER_Y = 4; // pixels
- maSize = Size( aVDev.GetTextWidth( sAuthor ) + 2*BORDER_X, aVDev.GetTextHeight() + 2*BORDER_Y );
- aVDev.SetOutputSizePixel( maSize, false );
+ maSize = Size( pVDev->GetTextWidth( sAuthor ) + 2*BORDER_X, pVDev->GetTextHeight() + 2*BORDER_Y );
+ pVDev->SetOutputSizePixel( maSize, false );
Color aBorderColor( maColor );
@@ -549,14 +549,14 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected )
Point aPos;
Rectangle aBorderRect( aPos, maSize );
- aVDev.SetLineColor(aBorderColor);
- aVDev.SetFillColor(maColor);
- aVDev.DrawRect( aBorderRect );
+ pVDev->SetLineColor(aBorderColor);
+ pVDev->SetFillColor(maColor);
+ pVDev->DrawRect( aBorderRect );
- aVDev.SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK );
- aVDev.DrawText( Point( BORDER_X, BORDER_Y ), sAuthor );
+ pVDev->SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK );
+ pVDev->DrawText( Point( BORDER_X, BORDER_Y ), sAuthor );
- return aVDev.GetBitmapEx( aPos, maSize );
+ return pVDev->GetBitmapEx( aPos, maSize );
}
void AnnotationTag::OpenPopup( bool bEdit )
@@ -577,7 +577,7 @@ void AnnotationTag::OpenPopup( bool bEdit )
Rectangle aRect( aPos, maSize );
- mpAnnotationWindow.reset( new AnnotationWindow( mrManager, mrView.GetDocSh(), pWindow->GetWindow(WINDOW_FRAME) ) );
+ mpAnnotationWindow.reset( VclPtr<AnnotationWindow>::Create( mrManager, mrView.GetDocSh(), pWindow->GetWindow(WINDOW_FRAME) ) );
mpAnnotationWindow->InitControls();
mpAnnotationWindow->setAnnotation(mxAnnotation);
diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx
index 96085f253fcb..d53c5445f4d7 100644
--- a/sd/source/ui/annotations/annotationtag.hxx
+++ b/sd/source/ui/annotations/annotationtag.hxx
@@ -79,13 +79,13 @@ protected:
private:
AnnotationManagerImpl& mrManager;
css::uno::Reference< css::office::XAnnotation > mxAnnotation;
- std::unique_ptr<AnnotationWindow> mpAnnotationWindow;
+ VclPtr<AnnotationWindow> mpAnnotationWindow;
Color maColor;
int mnIndex;
const ::vcl::Font& mrFont;
Size maSize;
ImplSVEvent * mnClosePopupEvent;
- vcl::Window* mpListenWindow;
+ VclPtr<vcl::Window> mpListenWindow;
Point maMouseDownPos;
};
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 9129ca8f952b..830180347e13 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -118,6 +118,13 @@ AnnotationTextWindow::AnnotationTextWindow( AnnotationWindow* pParent, WinBits n
AnnotationTextWindow::~AnnotationTextWindow()
{
+ disposeOnce();
+}
+
+void AnnotationTextWindow::dispose()
+{
+ mpAnnotationWindow.clear();
+ Control::dispose();
}
void AnnotationTextWindow::Paint( const Rectangle& rRect)
@@ -284,21 +291,27 @@ AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShel
AnnotationWindow::~AnnotationWindow()
{
- delete mpMeta;
+ disposeOnce();
+}
+
+void AnnotationWindow::dispose()
+{
+ mpMeta.disposeAndClear();
delete mpOutlinerView;
delete mpOutliner;
- delete mpVScrollbar;
- delete mpTextWindow;
+ mpVScrollbar.disposeAndClear();
+ mpTextWindow.disposeAndClear();
+ FloatingWindow::dispose();
}
void AnnotationWindow::InitControls()
{
// actual window which holds the user text
- mpTextWindow = new AnnotationTextWindow(this, WB_NODIALOGCONTROL);
+ mpTextWindow = VclPtr<AnnotationTextWindow>::Create(this, WB_NODIALOGCONTROL);
mpTextWindow->SetPointer(Pointer(POINTER_TEXT));
// window control for author and date
- mpMeta = new MultiLineEdit(this,0);
+ mpMeta = VclPtr<MultiLineEdit>::Create(this,0);
mpMeta->SetReadOnly();
mpMeta->SetRightToLeft(AllSettings::GetLayoutRTL());
mpMeta->AlwaysDisableInput(true);
@@ -332,7 +345,7 @@ void AnnotationWindow::InitControls()
mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
//create Scrollbars
- mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ mpVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
mpVScrollbar->EnableNativeWidget(false);
mpVScrollbar->EnableRTL( false );
mpVScrollbar->SetScrollHdl(LINK(this, AnnotationWindow, ScrollHdl));
diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx
index f8adcdf99a81..766ea975b31f 100644
--- a/sd/source/ui/annotations/annotationwindow.hxx
+++ b/sd/source/ui/annotations/annotationwindow.hxx
@@ -50,7 +50,7 @@ class AnnotationTextWindow : public Control
{
private:
OutlinerView* mpOutlinerView;
- AnnotationWindow* mpAnnotationWindow;
+ VclPtr<AnnotationWindow> mpAnnotationWindow;
protected:
virtual void Paint( const Rectangle& rRect) SAL_OVERRIDE;
@@ -64,6 +64,7 @@ protected:
public:
AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits );
virtual ~AnnotationTextWindow();
+ virtual void dispose() SAL_OVERRIDE;
void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; }
@@ -83,13 +84,13 @@ class AnnotationWindow : public FloatingWindow
OutlinerView* mpOutlinerView;
Outliner* mpOutliner;
- ScrollBar* mpVScrollbar;
+ VclPtr<ScrollBar> mpVScrollbar;
::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation;
bool mbReadonly;
bool mbProtected;
bool mbMouseOverButton;
- AnnotationTextWindow* mpTextWindow;
- MultiLineEdit* mpMeta;
+ VclPtr<AnnotationTextWindow> mpTextWindow;
+ VclPtr<MultiLineEdit> mpMeta;
Rectangle maRectMetaButton;
basegfx::B2DPolygon maPopupTriangle;
@@ -102,6 +103,7 @@ class AnnotationWindow : public FloatingWindow
public:
AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, vcl::Window* pParent );
virtual ~AnnotationWindow();
+ virtual void dispose() SAL_OVERRIDE;
void StartEdit();
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index b982264de845..5c3b2dde6ecd 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -119,7 +119,7 @@ SdModule::~SdModule()
(*ppShellPointer) = NULL;
delete mpErrorHdl;
- delete static_cast< VirtualDevice* >( mpVirtualRefDevice );
+ mpVirtualRefDevice.disposeAndClear();
}
/// get notifications
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 5d36c8f6b7dd..9e8ea11ddae4 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -727,9 +727,9 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet )
pViewShell->GetViewFrame()->GetBindings().InvalidateAll( true );
}
-SfxTabPage* SdModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
+VclPtr<SfxTabPage> SdModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
{
- SfxTabPage* pRet = NULL;
+ VclPtr<SfxTabPage> pRet;
SfxAllItemSet aSet(*(rSet.GetPool()));
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
if( pFact )
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 283544f8aa99..ed424d464275 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -141,7 +141,7 @@ SdTransferable::~SdTransferable()
delete mpBookmark;
delete mpImageMap;
- delete mpVDev;
+ mpVDev.disposeAndClear();
delete mpObjDesc;
//call explicitly at end of dtor to be covered by above SolarMutex
@@ -262,7 +262,7 @@ void SdTransferable::CreateData()
if( 1 == pPage->GetObjCount() )
CreateObjectReplacement( pPage->GetObj( 0 ) );
- mpVDev = new VirtualDevice( *Application::GetDefaultDevice() );
+ mpVDev = VclPtr<VirtualDevice>::Create( *Application::GetDefaultDevice() );
mpVDev->SetMapMode( MapMode( mpSdDrawDocumentIntern->GetScaleUnit(), Point(), mpSdDrawDocumentIntern->GetScaleFraction(), mpSdDrawDocumentIntern->GetScaleFraction() ) );
mpSdViewIntern = new ::sd::View( *mpSdDrawDocumentIntern, mpVDev );
mpSdViewIntern->EndListening(*mpSdDrawDocumentIntern );
diff --git a/sd/source/ui/app/tbxww.cxx b/sd/source/ui/app/tbxww.cxx
index cbf40156aa4b..2aed6b89c96e 100644
--- a/sd/source/ui/app/tbxww.cxx
+++ b/sd/source/ui/app/tbxww.cxx
@@ -62,7 +62,7 @@ SfxPopupWindowType SdTbxControl::GetPopupWindowType() const
* rItemRect are screen coordinates
*/
-SfxPopupWindow* SdTbxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SdTbxControl::CreatePopupWindow()
{
SfxPopupWindow *pWin = NULL;
OUString aToolBarResStr;
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index 7c8d02a46819..468428081523 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -67,6 +67,7 @@ class LayoutToolbarMenu : public svtools::ToolbarMenu
public:
LayoutToolbarMenu( SlideLayoutController& rController, const Reference< XFrame >& xFrame, vcl::Window* pParent, const bool bInsertPage );
virtual ~LayoutToolbarMenu();
+ virtual void dispose() SAL_OVERRIDE;
protected:
DECL_LINK( SelectHdl, void * );
@@ -75,8 +76,8 @@ private:
SlideLayoutController& mrController;
Reference< XFrame > mxFrame;
bool mbInsertPage;
- ValueSet* mpLayoutSet1;
- ValueSet* mpLayoutSet2;
+ VclPtr<ValueSet> mpLayoutSet1;
+ VclPtr<ValueSet> mpLayoutSet2;
};
struct snewfoil_value_info
@@ -210,7 +211,7 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, const
if( bVerticalEnabled && (eMode == DrawViewMode_DRAW) )
{
- mpLayoutSet2 = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
+ mpLayoutSet2 = VclPtr<ValueSet>::Create( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
mpLayoutSet2->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) );
mpLayoutSet2->SetColCount( 4 );
@@ -256,6 +257,14 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, const
LayoutToolbarMenu::~LayoutToolbarMenu()
{
+ disposeOnce();
+}
+
+void LayoutToolbarMenu::dispose()
+{
+ mpLayoutSet1.clear();
+ mpLayoutSet2.clear();
+ svtools::ToolbarMenu::dispose();
}
IMPL_LINK( LayoutToolbarMenu, SelectHdl, void *, pControl )
@@ -342,9 +351,9 @@ void SAL_CALL SlideLayoutController::initialize( const css::uno::Sequence< css::
}
}
-::vcl::Window* SlideLayoutController::createPopupWindow( ::vcl::Window* pParent )
+VclPtr<::vcl::Window> SlideLayoutController::createPopupWindow( ::vcl::Window* pParent )
{
- return new sd::LayoutToolbarMenu( *this, m_xFrame, pParent, mbInsertPage );
+ return VclPtr<sd::LayoutToolbarMenu>::Create( *this, m_xFrame, pParent, mbInsertPage );
}
// XServiceInfo
diff --git a/sd/source/ui/controller/slidelayoutcontroller.hxx b/sd/source/ui/controller/slidelayoutcontroller.hxx
index 0104119dc45d..d97656cef5dc 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.hxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.hxx
@@ -32,7 +32,7 @@ public:
const OUString& sCommandURL,
bool bInsertPage );
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
diff --git a/sd/source/ui/dlg/AnimationChildWindow.cxx b/sd/source/ui/dlg/AnimationChildWindow.cxx
index 7e7ec61574db..d59f0ac2a083 100644
--- a/sd/source/ui/dlg/AnimationChildWindow.cxx
+++ b/sd/source/ui/dlg/AnimationChildWindow.cxx
@@ -39,7 +39,7 @@ AnimationChildWindow::AnimationChildWindow(
SfxChildWinInfo* pInfo )
: SfxChildWindow( _pParent, nId )
{
- AnimationWindow* pAnimWin = new AnimationWindow(pBindings, this, _pParent);
+ VclPtr<AnimationWindow> pAnimWin = VclPtr<AnimationWindow>::Create(pBindings, this, _pParent);
pWindow = pAnimWin;
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx
index cfc97fd3a543..934c5bbf89f9 100644
--- a/sd/source/ui/dlg/LayerTabBar.cxx
+++ b/sd/source/ui/dlg/LayerTabBar.cxx
@@ -203,9 +203,9 @@ TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming()
(rLayerAdmin.GetLayer( aNewName, false ) && aLayerName != aNewName) )
{
// Name already exists
- WarningBox aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ),
+ ScopedVclPtrInstance<WarningBox> aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ),
SD_RESSTR( STR_WARN_NAME_DUPLICATE ) );
- aWarningBox.Execute();
+ aWarningBox->Execute();
bOK = false;
}
diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx
index 480a5f74e0e7..0beb6d1f38e0 100644
--- a/sd/source/ui/dlg/NavigatorChildWindow.cxx
+++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx
@@ -52,7 +52,8 @@ NavigatorChildWindow::NavigatorChildWindow (
SfxChildWinInfo* )
: SfxChildWindowContext( nId )
{
- SdNavigatorWin* pNavWin = new SdNavigatorWin(
+ VclPtr<SdNavigatorWin> pNavWin = VclPtr<SdNavigatorWin>::Create(
+
pParent,
this,
SdResId( FLT_NAVIGATOR ),
diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx
index 364a4dc47b4b..b004e766131a 100644
--- a/sd/source/ui/dlg/PaneChildWindows.cxx
+++ b/sd/source/ui/dlg/PaneChildWindows.cxx
@@ -56,13 +56,14 @@ PaneChildWindow::PaneChildWindow (
SfxChildAlignment eAlignment)
: SfxChildWindow (pParentWindow, nId)
{
- pWindow = new PaneDockingWindow(
+ pWindow = VclPtr<PaneDockingWindow>::Create(
+
pBindings,
this,
pParentWindow,
SD_RESSTR(nTitleBarResId));
eChildAlignment = eAlignment;
- static_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo);
+ static_cast<SfxDockingWindow*>(pWindow.get())->Initialize(pInfo);
SetHideNotDelete(true);
ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pBindings->GetDispatcher()->GetFrame());
@@ -75,7 +76,7 @@ PaneChildWindow::PaneChildWindow (
PaneChildWindow::~PaneChildWindow()
{
ViewShellBase* pBase = NULL;
- PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow);
+ PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow.get());
if (pDockingWindow != NULL)
pBase = ViewShellBase::GetViewShellBase(
pDockingWindow->GetBindings().GetDispatcher()->GetFrame());
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index a3da722b97e5..ecf89cf9054f 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -76,6 +76,23 @@ SdPhotoAlbumDialog::SdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pAc
SdPhotoAlbumDialog::~SdPhotoAlbumDialog()
{
+ disposeOnce();
+}
+
+void SdPhotoAlbumDialog::dispose()
+{
+ pCancelBtn.clear();
+ pCreateBtn.clear();
+ pAddBtn.clear();
+ pUpBtn.clear();
+ pDownBtn.clear();
+ pRemoveBtn.clear();
+ pImagesLst.clear();
+ pImg.clear();
+ pInsTypeCombo.clear();
+ pASRCheck.clear();
+ pCapCheck.clear();
+ ModalDialog::dispose();
}
IMPL_LINK_NOARG(SdPhotoAlbumDialog, CancelHdl)
@@ -88,8 +105,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
{
if (pImagesLst->GetEntryCount() == 0)
{
- WarningBox aWarning(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING));
- aWarning.Execute();
+ ScopedVclPtrInstance< WarningBox > aWarning(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING));
+ aWarning->Execute();
}
else
{
@@ -445,8 +462,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
}
else
{
- InfoBox aInfo(this, OUString("Function is not implemented!"));
- aInfo.Execute();
+ ScopedVclPtrInstance< InfoBox > aInfo(this, OUString("Function is not implemented!"));
+ aInfo->Execute();
}
EndDialog();
return 0;
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.hxx b/sd/source/ui/dlg/PhotoAlbumDialog.hxx
index c7d12e47bcc8..44b1f5c97a1e 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.hxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.hxx
@@ -46,25 +46,27 @@ class SdPhotoAlbumDialog : public ModalDialog
public:
SdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pActDoc);
virtual ~SdPhotoAlbumDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
private:
static OUString sDirUrl;
- CancelButton* pCancelBtn;
- PushButton* pCreateBtn;
+ VclPtr<CancelButton> pCancelBtn;
+ VclPtr<PushButton> pCreateBtn;
- PushButton* pAddBtn;
- PushButton* pUpBtn;
- PushButton* pDownBtn;
- PushButton* pRemoveBtn;
+ VclPtr<PushButton> pAddBtn;
+ VclPtr<PushButton> pUpBtn;
+ VclPtr<PushButton> pDownBtn;
+ VclPtr<PushButton> pRemoveBtn;
- ListBox* pImagesLst;
- FixedImage* pImg;
+ VclPtr<ListBox> pImagesLst;
+ VclPtr<FixedImage> pImg;
+
+ VclPtr<ListBox> pInsTypeCombo;
+ VclPtr<CheckBox> pASRCheck;
+ VclPtr<CheckBox> pCapCheck;
- ListBox* pInsTypeCombo;
- CheckBox* pASRCheck;
- CheckBox* pCapCheck;
SdDrawDocument* pDoc;
GraphicFilter* mpGraphicFilter;
diff --git a/sd/source/ui/dlg/RemoteDialog.cxx b/sd/source/ui/dlg/RemoteDialog.cxx
index f9cd67cb8dad..62c9d3eaffe7 100644
--- a/sd/source/ui/dlg/RemoteDialog.cxx
+++ b/sd/source/ui/dlg/RemoteDialog.cxx
@@ -30,6 +30,19 @@ RemoteDialog::RemoteDialog( vcl::Window *pWindow )
m_pButtonClose->SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) );
}
+RemoteDialog::~RemoteDialog()
+{
+ disposeOnce();
+}
+
+void RemoteDialog::dispose()
+{
+ m_pButtonConnect.clear();
+ m_pButtonClose.clear();
+ m_pClientBox.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
{
// setBusy( true );
diff --git a/sd/source/ui/dlg/RemoteDialog.hxx b/sd/source/ui/dlg/RemoteDialog.hxx
index 7334c4bea548..3c936eb10a1a 100644
--- a/sd/source/ui/dlg/RemoteDialog.hxx
+++ b/sd/source/ui/dlg/RemoteDialog.hxx
@@ -24,14 +24,16 @@ namespace sd
class RemoteDialog : public ModalDialog
{
private:
- PushButton* m_pButtonConnect;
- CloseButton* m_pButtonClose;
- ClientBox* m_pClientBox;
+ VclPtr<PushButton> m_pButtonConnect;
+ VclPtr<CloseButton> m_pButtonClose;
+ VclPtr<ClientBox> m_pClientBox;
DECL_DLLPRIVATE_LINK( HandleConnectButton, void * );
DECL_LINK( CloseHdl, void * );
public:
RemoteDialog( vcl::Window* pWindow );
+ virtual ~RemoteDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
}
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
index c3f4ebafb86b..83abb22a0184 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
@@ -73,16 +73,16 @@ ClientBox::ClientBox( vcl::Window* pParent, WinBits nStyle ) :
m_nTopIndex( 0 ),
m_nActiveHeight( 0 ),
m_nExtraHeight( 2 ),
- m_aPinBox( this, 0 ),
- m_aDeauthoriseButton( this ),
- m_aScrollBar( this, WB_VERT )
+ m_aPinBox( VclPtr<NumericBox>::Create( this, 0 ) ),
+ m_aDeauthoriseButton( VclPtr<PushButton>::Create( this ) ),
+ m_aScrollBar( VclPtr<ScrollBar>::Create( this, WB_VERT ) )
{
- m_aScrollBar.SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) );
- m_aScrollBar.EnableDrag();
+ m_aScrollBar->SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) );
+ m_aScrollBar->EnableDrag();
- m_aPinBox.SetUseThousandSep(false);
- m_aDeauthoriseButton.SetText( SD_RESSTR(STR_DEAUTHORISE_CLIENT) );
- m_aDeauthoriseButton.SetClickHdl( LINK( this, ClientBox, DeauthoriseHdl ) );
+ m_aPinBox->SetUseThousandSep(false);
+ m_aDeauthoriseButton->SetText( SD_RESSTR(STR_DEAUTHORISE_CLIENT) );
+ m_aDeauthoriseButton->SetClickHdl( LINK( this, ClientBox, DeauthoriseHdl ) );
SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
@@ -124,6 +124,11 @@ Size ClientBox::GetOptimalSize() const
ClientBox::~ClientBox()
{
+ disposeOnce();
+}
+
+void ClientBox::dispose()
+{
if ( ! m_bInDelete )
DeleteRemoved();
@@ -132,6 +137,11 @@ ClientBox::~ClientBox()
m_vEntries.clear();
m_xRemoveListener.clear();
+
+ m_aPinBox.disposeAndClear();
+ m_aDeauthoriseButton.disposeAndClear();
+ m_aScrollBar.disposeAndClear();
+ Control::dispose();
}
// Title + description
@@ -152,7 +162,7 @@ void ClientBox::CalcActiveHeight( const long nPos )
// Text entry height
Size aSize = GetOutputSizePixel();
if ( m_bHasScrollBar )
- aSize.Width() -= m_aScrollBar.GetSizePixel().Width();
+ aSize.Width() -= m_aScrollBar->GetSizePixel().Width();
aSize.Width() -= ICON_OFFSET;
@@ -173,7 +183,7 @@ Rectangle ClientBox::GetEntryRect( const long nPos ) const
Size aSize( GetOutputSizePixel() );
if ( m_bHasScrollBar )
- aSize.Width() -= m_aScrollBar.GetSizePixel().Width();
+ aSize.Width() -= m_aScrollBar->GetSizePixel().Width();
if ( m_vEntries[ nPos ]->m_bActive )
aSize.Height() = m_nActiveHeight;
@@ -246,7 +256,7 @@ void ClientBox::selectEntry( const long nPos )
// We empty the pin box now too, just in case the user previously
// entered a pin, but then changed their selected device.
- m_aPinBox.SetText( "" );
+ m_aPinBox->SetText( "" );
if ( m_bHasActive )
{
bool bAlreadyAuthorised =
@@ -254,11 +264,11 @@ void ClientBox::selectEntry( const long nPos )
if ( bAlreadyAuthorised )
{
- m_aDeauthoriseButton.GetFocus();
+ m_aDeauthoriseButton->GetFocus();
}
else
{
- m_aPinBox.GetFocus();
+ m_aPinBox->GetFocus();
}
}
@@ -350,19 +360,19 @@ void ClientBox::RecalcAll()
Size aPBSize = LogicToPixel(
Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ),
MapMode( MAP_APPFONT ) );
- m_aPinBox.SetSizePixel( aPBSize );
- m_aDeauthoriseButton.SetSizePixel( m_aDeauthoriseButton.GetOptimalSize() );
+ m_aPinBox->SetSizePixel( aPBSize );
+ m_aDeauthoriseButton->SetSizePixel( m_aDeauthoriseButton->GetOptimalSize() );
if ( !m_bHasActive )
{
- m_aPinBox.Show( false );
- m_aDeauthoriseButton.Show( false );
+ m_aPinBox->Show( false );
+ m_aDeauthoriseButton->Show( false );
}
else
{
Rectangle aEntryRect = GetEntryRect( m_nActive );
- Size aPinBoxSize( m_aPinBox.GetSizePixel() );
+ Size aPinBoxSize( m_aPinBox->GetSizePixel() );
Point aPos( aEntryRect.Left(),
aEntryRect.Bottom() - TOP_OFFSET - aPinBoxSize.Height() );
@@ -378,7 +388,7 @@ void ClientBox::RecalcAll()
aPos = Point( aEntryRect.Left() + GetTextWidth( sPinText ),
aEntryRect.Bottom() - TOP_OFFSET - aPinBoxSize.Height() );
- m_aPinBox.SetPosPixel( aPos );
+ m_aPinBox->SetPosPixel( aPos );
// The text would have it's TOP aligned with the top of
// the pin box -- hence we push it down to align baselines.
m_sPinTextRect += Point( 0, 4 );
@@ -386,11 +396,11 @@ void ClientBox::RecalcAll()
else
{
aPos += Point( 20, 0 );
- m_aDeauthoriseButton.SetPosPixel( aPos );
+ m_aDeauthoriseButton->SetPosPixel( aPos );
}
- m_aPinBox.Show( !bAlreadyAuthorised );
- m_aDeauthoriseButton.Show( bAlreadyAuthorised );
+ m_aPinBox->Show( !bAlreadyAuthorised );
+ m_aDeauthoriseButton->Show( bAlreadyAuthorised );
if ( m_bAdjustActive )
{
@@ -424,7 +434,7 @@ void ClientBox::RecalcAll()
}
if ( m_bHasScrollBar )
- m_aScrollBar.SetThumbPos( m_nTopIndex );
+ m_aScrollBar->SetThumbPos( m_nTopIndex );
}
}
@@ -487,7 +497,7 @@ void ClientBox::Paint( const Rectangle &/*rPaintRect*/ )
Size aSize( GetOutputSizePixel() );
if ( m_bHasScrollBar )
- aSize.Width() -= m_aScrollBar.GetSizePixel().Width();
+ aSize.Width() -= m_aScrollBar->GetSizePixel().Width();
const ::osl::MutexGuard aGuard( m_entriesMutex );
@@ -525,20 +535,20 @@ void ClientBox::SetupScrollBar()
if ( m_nTopIndex + aSize.Height() > nTotalHeight )
m_nTopIndex = nTotalHeight - aSize.Height();
- m_aScrollBar.SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
+ m_aScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
Size( nScrBarSize, aSize.Height() ) );
- m_aScrollBar.SetRangeMax( nTotalHeight );
- m_aScrollBar.SetVisibleSize( aSize.Height() );
- m_aScrollBar.SetPageSize( ( aSize.Height() * 4 ) / 5 );
- m_aScrollBar.SetLineSize( m_nStdHeight );
- m_aScrollBar.SetThumbPos( m_nTopIndex );
+ m_aScrollBar->SetRangeMax( nTotalHeight );
+ m_aScrollBar->SetVisibleSize( aSize.Height() );
+ m_aScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
+ m_aScrollBar->SetLineSize( m_nStdHeight );
+ m_aScrollBar->SetThumbPos( m_nTopIndex );
if ( !m_bHasScrollBar )
- m_aScrollBar.Show();
+ m_aScrollBar->Show();
}
else if ( m_bHasScrollBar )
{
- m_aScrollBar.Hide();
+ m_aScrollBar->Hide();
m_nTopIndex = 0;
}
@@ -567,7 +577,7 @@ long ClientBox::PointToPos( const Point& rPos )
OUString ClientBox::getPin()
{
- return OUString::number( m_aPinBox.GetValue() );
+ return OUString::number( m_aPinBox->GetValue() );
}
void ClientBox::MouseButtonDown( const MouseEvent& rMEvt )
@@ -608,11 +618,11 @@ bool ClientBox::Notify( NotifyEvent& rNEvt )
const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
if ( pData->GetMode() == CommandWheelMode::SCROLL )
{
- long nThumbPos = m_aScrollBar.GetThumbPos();
+ long nThumbPos = m_aScrollBar->GetThumbPos();
if ( pData->GetDelta() < 0 )
- m_aScrollBar.DoScroll( nThumbPos + m_nStdHeight );
+ m_aScrollBar->DoScroll( nThumbPos + m_nStdHeight );
else
- m_aScrollBar.DoScroll( nThumbPos - m_nStdHeight );
+ m_aScrollBar->DoScroll( nThumbPos - m_nStdHeight );
bHandled = true;
}
}
@@ -702,13 +712,13 @@ void ClientBox::populateEntries()
void ClientBox::DoScroll( long nDelta )
{
m_nTopIndex += nDelta;
- Point aNewSBPt( m_aScrollBar.GetPosPixel() );
+ Point aNewSBPt( m_aScrollBar->GetPosPixel() );
Rectangle aScrRect( Point(), GetOutputSizePixel() );
- aScrRect.Right() -= m_aScrollBar.GetSizePixel().Width();
+ aScrRect.Right() -= m_aScrollBar->GetSizePixel().Width();
Scroll( 0, -nDelta, aScrRect );
- m_aScrollBar.SetPosPixel( aNewSBPt );
+ m_aScrollBar->SetPosPixel( aNewSBPt );
}
IMPL_LINK( ClientBox, ScrollHdl, ScrollBar*, pScrBar )
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
index 1dc481ebd79a..63bf2db5a577 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
@@ -69,7 +69,7 @@ class ClientBox;
class ClientRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
{
- ClientBox *m_pParent;
+ VclPtr<ClientBox> m_pParent;
public:
@@ -101,11 +101,11 @@ class ClientBox:
Link m_aClickHdl;
Link m_aDeauthoriseHdl;
- NumericBox m_aPinBox;
- PushButton m_aDeauthoriseButton;
- Rectangle m_sPinTextRect;
+ VclPtr<NumericBox> m_aPinBox;
+ VclPtr<PushButton> m_aDeauthoriseButton;
+ Rectangle m_sPinTextRect;
- ScrollBar m_aScrollBar;
+ VclPtr<ScrollBar> m_aScrollBar;
com::sun::star::uno::Reference< ClientRemovedListener > m_xRemoveListener;
@@ -136,7 +136,8 @@ class ClientBox:
public:
ClientBox( vcl::Window* pParent, WinBits nStyle );
- virtual ~ClientBox();
+ virtual ~ClientBox();
+ virtual void dispose() SAL_OVERRIDE;
void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
void Paint( const Rectangle &rPaintRect ) SAL_OVERRIDE;
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 1eaf723dd3bd..272c2f6e16bd 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -158,7 +158,7 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW,
get(m_pLbAdjustment, "alignment");
get(m_pBtnCreateGroup, "create");
- m_pCtlDisplay = new SdDisplay(get<Window>("box"));
+ m_pCtlDisplay = VclPtr<SdDisplay>::Create(get<Window>("box"));
m_pCtlDisplay->set_hexpand(true);
m_pCtlDisplay->set_vexpand(true);
m_pCtlDisplay->Show();
@@ -206,6 +206,11 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW,
AnimationWindow::~AnimationWindow()
{
+ disposeOnce();
+}
+
+void AnimationWindow::dispose()
+{
delete pControllerItem;
for (size_t i = 0; i < m_FrameList.size(); ++i)
@@ -219,7 +224,27 @@ AnimationWindow::~AnimationWindow()
// delete the clones
delete pMyDoc;
- delete m_pCtlDisplay;
+ m_pCtlDisplay.disposeAndClear();
+ m_pBtnFirst.clear();
+ m_pBtnReverse.clear();
+ m_pBtnStop.clear();
+ m_pBtnPlay.clear();
+ m_pBtnLast.clear();
+ m_pNumFldBitmap.clear();
+ m_pTimeField.clear();
+ m_pLbLoopCount.clear();
+ m_pBtnGetOneObject.clear();
+ m_pBtnGetAllObjects.clear();
+ m_pBtnRemoveBitmap.clear();
+ m_pBtnRemoveAll.clear();
+ m_pFiCount.clear();
+ m_pRbtGroup.clear();
+ m_pRbtBitmap.clear();
+ m_pFtAdjustment.clear();
+ m_pLbAdjustment.clear();
+ m_pBtnCreateGroup.clear();
+ pWin.clear();
+ SfxDockingWindow::dispose();
}
IMPL_LINK_NOARG(AnimationWindow, ClickFirstHdl)
@@ -430,8 +455,8 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn )
}
else // delete everything
{
- WarningBox aWarnBox( this, WB_YES_NO, SD_RESSTR( STR_ASK_DELETE_ALL_PICTURES ) );
- short nReturn = aWarnBox.Execute();
+ ScopedVclPtrInstance< WarningBox > aWarnBox( this, WB_YES_NO, SD_RESSTR( STR_ASK_DELETE_ALL_PICTURES ) );
+ short nReturn = aWarnBox->Execute();
if( nReturn == RET_YES )
{
@@ -523,23 +548,23 @@ void AnimationWindow::UpdateControl(bool const bDisableCtrls)
static_cast<SdrObject*>(pPage->GetObj(m_nCurrentFrame));
if( pObject )
{
- VirtualDevice aVD;
+ ScopedVclPtrInstance< VirtualDevice > pVD;
Rectangle aObjRect( pObject->GetCurrentBoundRect() );
Size aObjSize( aObjRect.GetSize() );
Point aOrigin( Point( -aObjRect.Left(), -aObjRect.Top() ) );
- MapMode aMap( aVD.GetMapMode() );
+ MapMode aMap( pVD->GetMapMode() );
aMap.SetMapUnit( MAP_100TH_MM );
aMap.SetOrigin( aOrigin );
- aVD.SetMapMode( aMap );
- aVD.SetOutputSize( aObjSize );
+ pVD->SetMapMode( aMap );
+ pVD->SetOutputSize( aObjSize );
const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
- aVD.SetBackground( Wallpaper( rStyles.GetFieldColor() ) );
- aVD.SetDrawMode( rStyles.GetHighContrastMode()
+ pVD->SetBackground( Wallpaper( rStyles.GetFieldColor() ) );
+ pVD->SetDrawMode( rStyles.GetHighContrastMode()
? ViewShell::OUTPUT_DRAWMODE_CONTRAST
: ViewShell::OUTPUT_DRAWMODE_COLOR );
- aVD.Erase();
- pObject->SingleObjectPainter( aVD );
- aBmp = BitmapEx( aVD.GetBitmap( aObjRect.TopLeft(), aObjSize ) );
+ pVD->Erase();
+ pObject->SingleObjectPainter( *pVD.get() );
+ aBmp = BitmapEx( pVD->GetBitmap( aObjRect.TopLeft(), aObjSize ) );
}
m_pCtlDisplay->SetBitmapEx(&aBmp);
diff --git a/sd/source/ui/dlg/assclass.cxx b/sd/source/ui/dlg/assclass.cxx
index e77375bb10a0..7049c5b10946 100644
--- a/sd/source/ui/dlg/assclass.cxx
+++ b/sd/source/ui/dlg/assclass.cxx
@@ -86,8 +86,8 @@ bool Assistent::GotoPage(const int nPageToGo)
{
int nIndex=mnCurrentPage-1;
- std::vector<vcl::Window*>::iterator iter = maPages[nIndex].begin();
- std::vector<vcl::Window*>::iterator iterEnd = maPages[nIndex].end();
+ auto iter = maPages[nIndex].begin();
+ auto iterEnd = maPages[nIndex].end();
for(; iter != iterEnd; ++iter)
{
diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx
index ce7448d5caa2..eff19c5f365f 100644
--- a/sd/source/ui/dlg/brkdlg.cxx
+++ b/sd/source/ui/dlg/brkdlg.cxx
@@ -67,8 +67,20 @@ BreakDlg::BreakDlg(
BreakDlg::~BreakDlg()
{
+ disposeOnce();
+}
+
+void BreakDlg::dispose()
+{
delete mpProgress;
+ mpProgress = NULL;
delete pProgrInfo;
+ pProgrInfo = NULL;
+ m_pFiObjInfo.clear();
+ m_pFiActInfo.clear();
+ m_pFiInsInfo.clear();
+ m_pBtnCancel.clear();
+ SfxModalDialog::dispose();
}
// Control-Handler for cancel button
@@ -93,8 +105,8 @@ IMPL_LINK( BreakDlg, UpDate, void*, nInit )
// update status bar or show a error message?
if(nInit == reinterpret_cast<void*>(1L))
{
- MessageDialog aErrBox(this, SD_RESSTR(STR_BREAK_FAIL));
- aErrBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrBox(this, SD_RESSTR(STR_BREAK_FAIL));
+ aErrBox->Execute();
}
else
{
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index c0b9b05f0b02..b87f58e0908c 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -84,30 +84,23 @@ CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs,
CopyDlg::~CopyDlg()
{
- OUString& rStr = GetExtraData();
-
- rStr = OUString::number(m_pNumFldCopies->GetValue());
- rStr += OUString(TOKEN);
-
- rStr += OUString::number(m_pMtrFldMoveX->GetValue());
- rStr += OUString( TOKEN );
-
- rStr += OUString::number(m_pMtrFldMoveY->GetValue());
- rStr += OUString( TOKEN );
-
- rStr += OUString::number(m_pMtrFldAngle->GetValue());
- rStr += OUString( TOKEN );
-
- rStr += OUString::number(m_pMtrFldWidth->GetValue());
- rStr += OUString( TOKEN );
-
- rStr += OUString::number(m_pMtrFldHeight->GetValue());
- rStr += OUString( TOKEN );
-
- rStr += OUString::number( m_pLbStartColor->GetSelectEntryColor().GetColor() );
- rStr += OUString( TOKEN );
+ disposeOnce();
+}
- rStr += OUString::number( m_pLbEndColor->GetSelectEntryColor().GetColor() );
+void CopyDlg::dispose()
+{
+ m_pNumFldCopies.clear();
+ m_pBtnSetViewData.clear();
+ m_pMtrFldMoveX.clear();
+ m_pMtrFldMoveY.clear();
+ m_pMtrFldAngle.clear();
+ m_pMtrFldWidth.clear();
+ m_pMtrFldHeight.clear();
+ m_pLbStartColor.clear();
+ m_pFtEndColor.clear();
+ m_pLbEndColor.clear();
+ m_pBtnSetDefault.clear();
+ SfxModalDialog::dispose();
}
/**
diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
index 45355fee5ad7..8de00aa58c42 100644
--- a/sd/source/ui/dlg/custsdlg.cxx
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -85,6 +85,21 @@ SdCustomShowDlg::SdCustomShowDlg( vcl::Window* pWindow,
SdCustomShowDlg::~SdCustomShowDlg()
{
+ disposeOnce();
+}
+
+void SdCustomShowDlg::dispose()
+{
+ m_pLbCustomShows.clear();
+ m_pCbxUseCustomShow.clear();
+ m_pBtnNew.clear();
+ m_pBtnEdit.clear();
+ m_pBtnRemove.clear();
+ m_pBtnCopy.clear();
+ m_pBtnHelp.clear();
+ m_pBtnStartShow.clear();
+ m_pBtnOK.clear();
+ ModalDialog::dispose();
}
void SdCustomShowDlg::CheckState()
@@ -111,8 +126,8 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
if( p == m_pBtnNew )
{
pCustomShow = NULL;
- SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow );
- if( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< SdDefineCustomShowDlg > aDlg( this, rDoc, pCustomShow );
+ if( aDlg->Execute() == RET_OK )
{
if( pCustomShow )
{
@@ -125,7 +140,7 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
m_pLbCustomShows->SelectEntry( pCustomShow->GetName() );
}
- if( aDlg.IsModified() )
+ if( aDlg->IsModified() )
bModified = true;
}
else if( pCustomShow )
@@ -139,9 +154,9 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
{
DBG_ASSERT( pCustomShowList, "pCustomShowList does not exist" );
pCustomShow = (*pCustomShowList)[ nPos ];
- SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow );
+ ScopedVclPtrInstance< SdDefineCustomShowDlg > aDlg( this, rDoc, pCustomShow );
- if( aDlg.Execute() == RET_OK )
+ if( aDlg->Execute() == RET_OK )
{
if( pCustomShow )
{
@@ -151,7 +166,7 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
m_pLbCustomShows->InsertEntry( pCustomShow->GetName(), nPos );
m_pLbCustomShows->SelectEntryPos( nPos );
}
- if( aDlg.IsModified() )
+ if( aDlg->IsModified() )
bModified = true;
}
}
@@ -336,6 +351,20 @@ SdDefineCustomShowDlg::SdDefineCustomShowDlg( vcl::Window* pWindow,
SdDefineCustomShowDlg::~SdDefineCustomShowDlg()
{
+ disposeOnce();
+}
+
+void SdDefineCustomShowDlg::dispose()
+{
+ m_pEdtName.clear();
+ m_pLbPages.clear();
+ m_pBtnAdd.clear();
+ m_pBtnRemove.clear();
+ m_pLbCustomPages.clear();
+ m_pBtnOK.clear();
+ m_pBtnCancel.clear();
+ m_pBtnHelp.clear();
+ ModalDialog::dispose();
}
// CheckState
diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx
index 41c2754c2a4f..e2307ac7c2c8 100644
--- a/sd/source/ui/dlg/diactrl.cxx
+++ b/sd/source/ui/dlg/diactrl.cxx
@@ -132,9 +132,9 @@ void SdTbxCtlDiaPages::StateChanged( sal_uInt16,
}
}
-vcl::Window* SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent )
{
- return new SdPagesField( pParent, m_xFrame );
+ return VclPtrInstance<SdPagesField>( pParent, m_xFrame ).get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 98df35d60900..69219b06c354 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -101,8 +101,8 @@ public:
void Enable (bool bEnable);
private:
- PushButton* mpNextButton1;
- PushButton* mpNextButton2;
+ VclPtr<PushButton> mpNextButton1;
+ VclPtr<PushButton> mpNextButton2;
bool mbIsFirstButtonActive;
};
@@ -160,7 +160,7 @@ public:
*/
bool mbPreviewUpdating;
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
void SavePassword( SfxObjectShellLock xDoc, const OUString& rPath );
void RestorePassword( SfxItemSet* pSet, const OUString& rPath );
@@ -247,74 +247,74 @@ public:
// Common
Assistent maAssistentFunc;
- CheckBox* mpPreviewFlag;
- CheckBox* mpStartWithFlag;
- PushButton* mpLastPageButton;
- NextButton* mpNextPageButton;
- PushButton* mpFinishButton;
- SdDocPreviewWin* mpPreview;
- VclContainer* mpPage1235;
+ VclPtr<CheckBox> mpPreviewFlag;
+ VclPtr<CheckBox> mpStartWithFlag;
+ VclPtr<PushButton> mpLastPageButton;
+ NextButton* mpNextPageButton;
+ VclPtr<PushButton> mpFinishButton;
+ VclPtr<SdDocPreviewWin> mpPreview;
+ VclPtr<VclContainer> mpPage1235;
// page 1
- VclContainer* mpPage1;
- FixedImage* mpPage1FB;
- FixedText* mpPage1ArtFL;
- RadioButton* mpPage1EmptyRB;
- RadioButton* mpPage1TemplateRB;
- ListBox* mpPage1RegionLB;
- ListBox* mpPage1TemplateLB;
- RadioButton* mpPage1OpenRB;
- ListBox* mpPage1OpenLB;
- PushButton* mpPage1OpenPB;
+ VclPtr<VclContainer> mpPage1;
+ VclPtr<FixedImage> mpPage1FB;
+ VclPtr<FixedText> mpPage1ArtFL;
+ VclPtr<RadioButton> mpPage1EmptyRB;
+ VclPtr<RadioButton> mpPage1TemplateRB;
+ VclPtr<ListBox> mpPage1RegionLB;
+ VclPtr<ListBox> mpPage1TemplateLB;
+ VclPtr<RadioButton> mpPage1OpenRB;
+ VclPtr<ListBox> mpPage1OpenLB;
+ VclPtr<PushButton> mpPage1OpenPB;
// page 2
- VclContainer* mpPage2;
- FixedImage* mpPage2FB;
- FixedText* mpPage2LayoutFL;
- ListBox* mpPage2RegionLB;
- ListBox* mpPage2LayoutLB;
- FixedText* mpPage2OutTypesFL;
- RadioButton* mpPage2Medium1RB;
- RadioButton* mpPage2Medium2RB;
- RadioButton* mpPage2Medium3RB;
- RadioButton* mpPage2Medium4RB;
- RadioButton* mpPage2Medium5RB;
- RadioButton* mpPage2Medium6RB;
+ VclPtr<VclContainer> mpPage2;
+ VclPtr<FixedImage> mpPage2FB;
+ VclPtr<FixedText> mpPage2LayoutFL;
+ VclPtr<ListBox> mpPage2RegionLB;
+ VclPtr<ListBox> mpPage2LayoutLB;
+ VclPtr<FixedText> mpPage2OutTypesFL;
+ VclPtr<RadioButton> mpPage2Medium1RB;
+ VclPtr<RadioButton> mpPage2Medium2RB;
+ VclPtr<RadioButton> mpPage2Medium3RB;
+ VclPtr<RadioButton> mpPage2Medium4RB;
+ VclPtr<RadioButton> mpPage2Medium5RB;
+ VclPtr<RadioButton> mpPage2Medium6RB;
// page 3
- VclContainer* mpPage3;
- FixedImage* mpPage3FB;
- FixedText* mpPage3EffectFL;
- FixedText* mpPage3EffectFT;
- FadeEffectLB* mpPage3EffectLB;
- FixedText* mpPage3SpeedFT;
- ListBox* mpPage3SpeedLB;
- FixedText* mpPage3PresTypeFL;
- RadioButton* mpPage3PresTypeLiveRB;
- RadioButton* mpPage3PresTypeKioskRB;
- FixedText* mpPage3PresTimeFT;
- TimeField* mpPage3PresTimeTMF;
- FixedText* mpPage3BreakFT;
- TimeField* mpPage3BreakTMF;
- CheckBox* mpPage3LogoCB;
+ VclPtr<VclContainer> mpPage3;
+ VclPtr<FixedImage> mpPage3FB;
+ VclPtr<FixedText> mpPage3EffectFL;
+ VclPtr<FixedText> mpPage3EffectFT;
+ VclPtr<FadeEffectLB> mpPage3EffectLB;
+ VclPtr<FixedText> mpPage3SpeedFT;
+ VclPtr<ListBox> mpPage3SpeedLB;
+ VclPtr<FixedText> mpPage3PresTypeFL;
+ VclPtr<RadioButton> mpPage3PresTypeLiveRB;
+ VclPtr<RadioButton> mpPage3PresTypeKioskRB;
+ VclPtr<FixedText> mpPage3PresTimeFT;
+ VclPtr<TimeField> mpPage3PresTimeTMF;
+ VclPtr<FixedText> mpPage3BreakFT;
+ VclPtr<TimeField> mpPage3BreakTMF;
+ VclPtr<CheckBox> mpPage3LogoCB;
// page 4
- VclContainer* mpPage4;
- FixedImage* mpPage4FB;
- FixedText* mpPage4PersonalFL;
- FixedText* mpPage4AskNameFT;
- Edit* mpPage4AskNameEDT;
- FixedText* mpPage4AskTopicFT;
- Edit* mpPage4AskTopicEDT;
- FixedText* mpPage4AskInfoFT;
- VclMultiLineEdit* mpPage4AskInfoEDT;
+ VclPtr<VclContainer> mpPage4;
+ VclPtr<FixedImage> mpPage4FB;
+ VclPtr<FixedText> mpPage4PersonalFL;
+ VclPtr<FixedText> mpPage4AskNameFT;
+ VclPtr<Edit> mpPage4AskNameEDT;
+ VclPtr<FixedText> mpPage4AskTopicFT;
+ VclPtr<Edit> mpPage4AskTopicEDT;
+ VclPtr<FixedText> mpPage4AskInfoFT;
+ VclPtr<VclMultiLineEdit> mpPage4AskInfoEDT;
// page 5
- VclContainer* mpPage5;
- FixedImage* mpPage5FB;
- FixedText* mpPage5PageListFT;
- SdPageListControl* mpPage5PageListCT;
- CheckBox* mpPage5SummaryCB;
+ VclPtr<VclContainer> mpPage5;
+ VclPtr<FixedImage> mpPage5FB;
+ VclPtr<FixedText> mpPage5PageListFT;
+ VclPtr<SdPageListControl> mpPage5PageListCT;
+ VclPtr<CheckBox> mpPage5SummaryCB;
};
@@ -1769,7 +1769,13 @@ IMPL_LINK_NOARG(AssistentDlg, FinishHdl)
AssistentDlg::~AssistentDlg()
{
+ disposeOnce();
+}
+
+void AssistentDlg::dispose()
+{
delete mpImpl;
+ ModalDialog::dispose();
}
SfxObjectShellLock AssistentDlg::GetDocument()
diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx
index 5eaab0185c9f..652a2b232c26 100644
--- a/sd/source/ui/dlg/dlgassim.cxx
+++ b/sd/source/ui/dlg/dlgassim.cxx
@@ -78,7 +78,13 @@ IMPL_LINK_NOARG(SdPageListControl, CheckButtonClickHdl)
SdPageListControl::~SdPageListControl()
{
+ disposeOnce();
+}
+
+void SdPageListControl::dispose()
+{
delete m_pCheckButton;
+ SvTreeListBox::dispose();
}
void SdPageListControl::Clear()
diff --git a/sd/source/ui/dlg/dlgassim.hxx b/sd/source/ui/dlg/dlgassim.hxx
index 8e966f856323..ee39788cb136 100644
--- a/sd/source/ui/dlg/dlgassim.hxx
+++ b/sd/source/ui/dlg/dlgassim.hxx
@@ -37,6 +37,7 @@ private:
public:
SdPageListControl( vcl::Window* pParent, const WinBits nStyle );
virtual ~SdPageListControl();
+ virtual void dispose() SAL_OVERRIDE;
void Fill( SdDrawDocument* pDoc );
void Clear();
diff --git a/sd/source/ui/dlg/dlgctrls.cxx b/sd/source/ui/dlg/dlgctrls.cxx
index 10923287ac1b..cb9df95d7261 100644
--- a/sd/source/ui/dlg/dlgctrls.cxx
+++ b/sd/source/ui/dlg/dlgctrls.cxx
@@ -40,7 +40,13 @@ FadeEffectLB::FadeEffectLB(vcl::Window* pParent, WinBits nStyle)
FadeEffectLB::~FadeEffectLB()
{
+ disposeOnce();
+}
+
+void FadeEffectLB::dispose()
+{
delete mpImpl;
+ ListBox::dispose();
}
void FadeEffectLB::Fill()
diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx
index 64e4d476baa7..7927f4d9f54a 100644
--- a/sd/source/ui/dlg/dlgfield.cxx
+++ b/sd/source/ui/dlg/dlgfield.cxx
@@ -53,6 +53,21 @@ SdModifyFieldDlg::SdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pI
FillControls();
}
+SdModifyFieldDlg::~SdModifyFieldDlg()
+{
+ disposeOnce();
+}
+
+void SdModifyFieldDlg::dispose()
+{
+ m_pRbtFix.clear();
+ m_pRbtVar.clear();
+ m_pLbLanguage.clear();
+ m_pLbFormat.clear();
+ ModalDialog::dispose();
+}
+
+
/**
* Returns the new field, owned by caller.
* Returns NULL if nothing has changed.
diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx
index c3a77103b247..2582ca25c534 100644
--- a/sd/source/ui/dlg/dlgolbul.cxx
+++ b/sd/source/ui/dlg/dlgolbul.cxx
@@ -138,7 +138,13 @@ OutlineBulletDlg::OutlineBulletDlg(
OutlineBulletDlg::~OutlineBulletDlg()
{
+ disposeOnce();
+}
+
+void OutlineBulletDlg::dispose()
+{
delete pOutputSet;
+ SfxTabDialog::dispose();
}
void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx
index 07d6e2c2886d..aed2a1059f4a 100644
--- a/sd/source/ui/dlg/dlgsnap.cxx
+++ b/sd/source/ui/dlg/dlgsnap.cxx
@@ -111,6 +111,25 @@ SdSnapLineDlg::SdSnapLineDlg(
m_pRbPoint->Check();
}
+SdSnapLineDlg::~SdSnapLineDlg()
+{
+ disposeOnce();
+}
+
+void SdSnapLineDlg::dispose()
+{
+ m_pFtX.clear();
+ m_pMtrFldX.clear();
+ m_pFtY.clear();
+ m_pMtrFldY.clear();
+ m_pRadioGroup.clear();
+ m_pRbPoint.clear();
+ m_pRbVert.clear();
+ m_pRbHorz.clear();
+ m_pBtnDelete.clear();
+ ModalDialog::dispose();
+}
+
/**
* fills provided item sets with dialog box attributes
*/
diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx
index e3f9a2a394c5..e0895092d7fb 100644
--- a/sd/source/ui/dlg/docprev.cxx
+++ b/sd/source/ui/dlg/docprev.cxx
@@ -83,7 +83,13 @@ SdDocPreviewWin::SdDocPreviewWin( vcl::Window* pParent, const WinBits nStyle )
SdDocPreviewWin::~SdDocPreviewWin()
{
+ disposeOnce();
+}
+
+void SdDocPreviewWin::dispose()
+{
delete pMetaFile;
+ Control::dispose();
}
Size SdDocPreviewWin::GetOptimalSize() const
@@ -235,17 +241,17 @@ void SdDocPreviewWin::updateViewSettings()
pMtf = new GDIMetaFile;
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
const Fraction aFrac( pDoc->GetScaleFraction() );
const MapMode aMap( pDoc->GetScaleUnit(), Point(), aFrac, aFrac );
- aVDev.SetMapMode( aMap );
+ pVDev->SetMapMode( aMap );
// Disable output, as we only want to record a metafile
- aVDev.EnableOutput( false );
+ pVDev->EnableOutput( false );
- pMtf->Record( &aVDev );
+ pMtf->Record( pVDev );
::sd::DrawView* pView = new ::sd::DrawView(pDocShell, this, NULL);
@@ -261,18 +267,18 @@ void SdDocPreviewWin::updateViewSettings()
const Rectangle aClipRect( aNewOrg, aNewSize );
MapMode aVMap( aMap );
- aVDev.Push();
+ pVDev->Push();
aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
- aVDev.SetRelativeMapMode( aVMap );
- aVDev.IntersectClipRegion( aClipRect );
+ pVDev->SetRelativeMapMode( aVMap );
+ pVDev->IntersectClipRegion( aClipRect );
// Use new StandardCheckVisisbilityRedirector
StandardCheckVisisbilityRedirector aRedirector;
const Rectangle aRedrawRectangle = Rectangle( Point(), aNewSize );
vcl::Region aRedrawRegion(aRedrawRectangle);
- pView->SdrPaintView::CompleteRedraw(&aVDev,aRedrawRegion,&aRedirector);
+ pView->SdrPaintView::CompleteRedraw(pVDev,aRedrawRegion,&aRedirector);
- aVDev.Pop();
+ pVDev->Pop();
pMtf->Stop();
pMtf->WindStart();
diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx
index b21f7104b53c..181dd7af049f 100644
--- a/sd/source/ui/dlg/gluectrl.cxx
+++ b/sd/source/ui/dlg/gluectrl.cxx
@@ -160,14 +160,12 @@ void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId,
SfxToolBoxControl::StateChanged( nSId, eState, pState );
}
-vcl::Window* SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent )
{
if( GetSlotId() == SID_GLUE_ESCDIR )
- {
- return new GlueEscDirLB( pParent, m_xFrame );
- }
+ return VclPtr<GlueEscDirLB>::Create( pParent, m_xFrame ).get();
- return NULL;
+ return VclPtr<vcl::Window>();
}
/**
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index e7590357f67e..84d0da17bd27 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -115,29 +115,29 @@ class HeaderFooterTabPage : public TabPage
{
private:
- FixedText* mpFTIncludeOn;
+ VclPtr<FixedText> mpFTIncludeOn;
- CheckBox* mpCBHeader;
- VclContainer* mpHeaderBox;
- Edit* mpTBHeader;
+ VclPtr<CheckBox> mpCBHeader;
+ VclPtr<VclContainer> mpHeaderBox;
+ VclPtr<Edit> mpTBHeader;
- CheckBox* mpCBDateTime;
- RadioButton* mpRBDateTimeFixed;
- RadioButton* mpRBDateTimeAutomatic;
- Edit* mpTBDateTimeFixed;
- ListBox* mpCBDateTimeFormat;
- FixedText* mpFTDateTimeLanguage;
- SvxLanguageBox* mpCBDateTimeLanguage;
+ VclPtr<CheckBox> mpCBDateTime;
+ VclPtr<RadioButton> mpRBDateTimeFixed;
+ VclPtr<RadioButton> mpRBDateTimeAutomatic;
+ VclPtr<Edit> mpTBDateTimeFixed;
+ VclPtr<ListBox> mpCBDateTimeFormat;
+ VclPtr<FixedText> mpFTDateTimeLanguage;
+ VclPtr<SvxLanguageBox> mpCBDateTimeLanguage;
- CheckBox* mpCBFooter;
- VclContainer* mpFooterBox;
- Edit* mpTBFooter;
+ VclPtr<CheckBox> mpCBFooter;
+ VclPtr<VclContainer> mpFooterBox;
+ VclPtr<Edit> mpTBFooter;
- CheckBox* mpCBSlideNumber;
+ VclPtr<CheckBox> mpCBSlideNumber;
- CheckBox* mpCBNotOnTitle;
+ VclPtr<CheckBox> mpCBNotOnTitle;
- PresLayoutPreview* mpCTPreview;
+ VclPtr<PresLayoutPreview> mpCTPreview;
SdDrawDocument* mpDoc;
LanguageType meOldLanguage;
@@ -155,6 +155,7 @@ private:
public:
HeaderFooterTabPage( vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode );
virtual ~HeaderFooterTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void init( const HeaderFooterSettings& rSettings, bool bNotOnTitle );
void getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle );
@@ -198,7 +199,7 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar
mpTabCtrl->Show();
mnSlidesId = mpTabCtrl->GetPageId("slides");
- mpSlideTabPage = new HeaderFooterTabPage( mpTabCtrl, pDoc, pSlide, false );
+ mpSlideTabPage = VclPtr<HeaderFooterTabPage>::Create( mpTabCtrl, pDoc, pSlide, false );
mpTabCtrl->SetTabPage( mnSlidesId, mpSlideTabPage );
Size aSiz = mpSlideTabPage->GetSizePixel();
@@ -211,7 +212,7 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar
}
mnNotesId = mpTabCtrl->GetPageId("notes");
- mpNotesHandoutsTabPage = new HeaderFooterTabPage( mpTabCtrl, pDoc, pNotes, true );
+ mpNotesHandoutsTabPage = VclPtr<HeaderFooterTabPage>::Create( mpTabCtrl, pDoc, pNotes, true );
mpTabCtrl->SetTabPage( mnNotesId, mpNotesHandoutsTabPage );
get(maPBApplyToAll, "apply_all" );
@@ -240,8 +241,18 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar
HeaderFooterDialog::~HeaderFooterDialog()
{
- delete mpSlideTabPage;
- delete mpNotesHandoutsTabPage;
+ disposeOnce();
+}
+
+void HeaderFooterDialog::dispose()
+{
+ mpSlideTabPage.disposeAndClear();
+ mpNotesHandoutsTabPage.disposeAndClear();
+ mpTabCtrl.clear();
+ maPBApplyToAll.clear();
+ maPBApply.clear();
+ maPBCancel.clear();
+ TabDialog::dispose();
}
IMPL_LINK( HeaderFooterDialog, ActivatePageHdl, TabControl *, pTabCtrl )
@@ -451,6 +462,29 @@ HeaderFooterTabPage::HeaderFooterTabPage( vcl::Window* pWindow, SdDrawDocument*
HeaderFooterTabPage::~HeaderFooterTabPage()
{
+ disposeOnce();
+}
+
+void HeaderFooterTabPage::dispose()
+{
+ mpFTIncludeOn.clear();
+ mpCBHeader.clear();
+ mpHeaderBox.clear();
+ mpTBHeader.clear();
+ mpCBDateTime.clear();
+ mpRBDateTimeFixed.clear();
+ mpRBDateTimeAutomatic.clear();
+ mpTBDateTimeFixed.clear();
+ mpCBDateTimeFormat.clear();
+ mpFTDateTimeLanguage.clear();
+ mpCBDateTimeLanguage.clear();
+ mpCBFooter.clear();
+ mpFooterBox.clear();
+ mpTBFooter.clear();
+ mpCBSlideNumber.clear();
+ mpCBNotOnTitle.clear();
+ mpCTPreview.clear();
+ TabPage::dispose();
}
IMPL_LINK_NOARG(HeaderFooterTabPage, LanguageChangeHdl)
diff --git a/sd/source/ui/dlg/ins_paste.cxx b/sd/source/ui/dlg/ins_paste.cxx
index a256990697e0..ad9e9821e4e0 100644
--- a/sd/source/ui/dlg/ins_paste.cxx
+++ b/sd/source/ui/dlg/ins_paste.cxx
@@ -28,6 +28,18 @@ SdInsertPasteDlg::SdInsertPasteDlg(vcl::Window* pWindow)
m_pRbAfter->Check( true );
}
+SdInsertPasteDlg::~SdInsertPasteDlg()
+{
+ disposeOnce();
+}
+
+void SdInsertPasteDlg::dispose()
+{
+ m_pRbBefore.clear();
+ m_pRbAfter.clear();
+ ModalDialog::dispose();
+}
+
bool SdInsertPasteDlg::IsInsertBefore() const
{
return( m_pRbBefore->IsChecked() );
diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx
index 5593562947c1..c77ba67a4c40 100644
--- a/sd/source/ui/dlg/inspagob.cxx
+++ b/sd/source/ui/dlg/inspagob.cxx
@@ -55,6 +55,15 @@ SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
{
+ disposeOnce();
+}
+
+void SdInsertPagesObjsDlg::dispose()
+{
+ m_pLbTree.clear();
+ m_pCbxLink.clear();
+ m_pCbxMasters.clear();
+ ModalDialog::dispose();
}
/**
diff --git a/sd/source/ui/dlg/layeroptionsdlg.cxx b/sd/source/ui/dlg/layeroptionsdlg.cxx
index 86df27c22cb1..a1e5d7f1a03b 100644
--- a/sd/source/ui/dlg/layeroptionsdlg.cxx
+++ b/sd/source/ui/dlg/layeroptionsdlg.cxx
@@ -50,6 +50,22 @@ SdInsertLayerDlg::SdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInA
get<VclContainer>("nameframe")->Enable(bDeletable);
}
+SdInsertLayerDlg::~SdInsertLayerDlg()
+{
+ disposeOnce();
+}
+
+void SdInsertLayerDlg::dispose()
+{
+ m_pEdtName.clear();
+ m_pEdtTitle.clear();
+ m_pEdtDesc.clear();
+ m_pCbxVisible.clear();
+ m_pCbxPrintable.clear();
+ m_pCbxLocked.clear();
+ ModalDialog::dispose();
+}
+
void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs )
{
rAttrs.Put( SdAttrLayerName( m_pEdtName->GetText() ) );
diff --git a/sd/source/ui/dlg/masterlayoutdlg.cxx b/sd/source/ui/dlg/masterlayoutdlg.cxx
index d10f8224ad8b..e1cce5c63ec6 100644
--- a/sd/source/ui/dlg/masterlayoutdlg.cxx
+++ b/sd/source/ui/dlg/masterlayoutdlg.cxx
@@ -75,6 +75,21 @@ MasterLayoutDialog::MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pD
mpCBPageNumber->Check( mbOldPageNumber );
}
+MasterLayoutDialog::~MasterLayoutDialog()
+{
+ disposeOnce();
+}
+
+void MasterLayoutDialog::dispose()
+{
+ mpCBDate.clear();
+ mpCBPageNumber.clear();
+ mpCBSlideNumber.clear();
+ mpCBHeader.clear();
+ mpCBFooter.clear();
+ ModalDialog::dispose();
+}
+
short MasterLayoutDialog::Execute()
{
if ( ModalDialog::Execute() )
diff --git a/sd/source/ui/dlg/morphdlg.cxx b/sd/source/ui/dlg/morphdlg.cxx
index db55129d3f8a..ebd28b18dad1 100644
--- a/sd/source/ui/dlg/morphdlg.cxx
+++ b/sd/source/ui/dlg/morphdlg.cxx
@@ -66,6 +66,15 @@ MorphDlg::MorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObjec
MorphDlg::~MorphDlg()
{
+ disposeOnce();
+}
+
+void MorphDlg::dispose()
+{
+ m_pMtfSteps.clear();
+ m_pCbxAttributes.clear();
+ m_pCbxOrientation.clear();
+ ModalDialog::dispose();
}
void MorphDlg::LoadSettings()
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 21fa0d9998d6..a37b13015a77 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -68,9 +68,9 @@ SdNavigatorWin::SdNavigatorWin(
SfxBindings* pInBindings,
const UpdateRequestFunctor& rUpdateRequest)
: vcl::Window( pParent, rSdResId )
- , maToolbox ( this, SdResId( 1 ) )
- , maTlbObjects( this, SdResId( TLB_OBJECTS ) )
- , maLbDocs ( this, SdResId( LB_DOCS ) )
+ , maToolbox ( VclPtr<ToolBox>::Create( this, SdResId( 1 ) ) )
+ , maTlbObjects( VclPtr<SdPageObjsTLB>::Create( this, SdResId( TLB_OBJECTS ) ) )
+ , maLbDocs ( VclPtr<ListBox>::Create( this, SdResId( LB_DOCS ) ) )
, mpChildWinContext( pChWinCtxt )
, mbDocImported ( false )
// On changes of the DragType: adjust SelectionMode of TLB!
@@ -78,58 +78,58 @@ SdNavigatorWin::SdNavigatorWin(
, mpBindings ( pInBindings )
, maImageList ( SdResId( IL_NAVIGATR ) )
{
- maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() );
+ maTlbObjects->SetViewFrame( mpBindings->GetDispatcher()->GetFrame() );
FreeResource();
- maTlbObjects.SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE));
+ maTlbObjects->SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE));
mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest);
mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest);
ApplyImageList(); // load images *before* calculating sizes to get something useful !!!
- Size aTbxSize( maToolbox.CalcWindowSizePixel() );
- maToolbox.SetOutputSizePixel( aTbxSize );
- maToolbox.SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) );
- maToolbox.SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) );
- maToolbox.SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) );
- maToolbox.SetItemBits( TBI_DRAGTYPE, maToolbox.GetItemBits( TBI_DRAGTYPE ) | ToolBoxItemBits::DROPDOWNONLY );
+ Size aTbxSize( maToolbox->CalcWindowSizePixel() );
+ maToolbox->SetOutputSizePixel( aTbxSize );
+ maToolbox->SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) );
+ maToolbox->SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) );
+ maToolbox->SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) );
+ maToolbox->SetItemBits( TBI_DRAGTYPE, maToolbox->GetItemBits( TBI_DRAGTYPE ) | ToolBoxItemBits::DROPDOWNONLY );
// Shape filter drop down menu.
- maToolbox.SetItemBits(
+ maToolbox->SetItemBits(
TBI_SHAPE_FILTER,
- maToolbox.GetItemBits(TBI_SHAPE_FILTER) | ToolBoxItemBits::DROPDOWNONLY);
+ maToolbox->GetItemBits(TBI_SHAPE_FILTER) | ToolBoxItemBits::DROPDOWNONLY);
// TreeListBox
// set position below toolbox
- long nListboxYPos = maToolbox.GetPosPixel().Y() + maToolbox.GetSizePixel().Height() + 4;
- maTlbObjects.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
- maTlbObjects.SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) );
- maTlbObjects.SetSelectionMode( SINGLE_SELECTION );
+ long nListboxYPos = maToolbox->GetPosPixel().Y() + maToolbox->GetSizePixel().Height() + 4;
+ maTlbObjects->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+ maTlbObjects->SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) );
+ maTlbObjects->SetSelectionMode( SINGLE_SELECTION );
// set focus to listbox, otherwise it is in the toolbox which is only useful
// for keyboard navigation
- maTlbObjects.GrabFocus();
- maTlbObjects.SetSdNavigatorWinFlag(true);
+ maTlbObjects->GrabFocus();
+ maTlbObjects->SetSdNavigatorWinFlag(true);
// DragTypeListBox
- maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) );
+ maLbDocs->SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) );
// set position below treelistbox
- nListboxYPos = maTlbObjects.GetPosPixel().Y() + maTlbObjects.GetSizePixel().Height() + 4;
- maLbDocs.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+ nListboxYPos = maTlbObjects->GetPosPixel().Y() + maTlbObjects->GetSizePixel().Height() + 4;
+ maLbDocs->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
// assure that tool box is at least as wide as the tree list box
{
- const Size aTlbSize( maTlbObjects.GetOutputSizePixel() );
+ const Size aTlbSize( maTlbObjects->GetOutputSizePixel() );
if ( aTlbSize.Width() > aTbxSize.Width() )
{
- maToolbox.setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH );
- aTbxSize = maToolbox.GetOutputSizePixel();
+ maToolbox->setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH );
+ aTbxSize = maToolbox->GetOutputSizePixel();
}
}
// set min outputsize after all sizes are known
- const long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4;
+ const long nFullHeight = nListboxYPos + maLbDocs->GetSizePixel().Height() + 4;
maSize = GetOutputSizePixel();
if( maSize.Height() < nFullHeight )
{
@@ -137,7 +137,7 @@ SdNavigatorWin::SdNavigatorWin(
SetOutputSizePixel( maSize );
}
maMinSize = maSize;
- const long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox
+ const long nMinWidth = 2*maToolbox->GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox
if( nMinWidth > maMinSize.Width() )
maMinSize.Width() = nMinWidth;
maMinSize.Height() -= 40;
@@ -152,8 +152,17 @@ SdNavigatorWin::SdNavigatorWin(
SdNavigatorWin::~SdNavigatorWin()
{
+ disposeOnce();
+}
+
+void SdNavigatorWin::dispose()
+{
delete mpNavigatorCtrlItem;
delete mpPageNameCtrlItem;
+ maToolbox.disposeAndClear();
+ maTlbObjects.disposeAndClear();
+ maLbDocs.disposeAndClear();
+ vcl::Window::dispose();
}
//when object is marked , fresh the corresponding entry tree .
@@ -163,17 +172,17 @@ void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc )
sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh();
OUString aDocShName( pDocShell->GetName() );
OUString aDocName = pDocShell->GetMedium()->GetName();
- maTlbObjects.SetSaveTreeItemStateFlag(true); //Added by yanjun for sym2_6385
- maTlbObjects.Clear();
- maTlbObjects.Fill( pDoc, false, aDocName ); // Nur normale Seiten
- maTlbObjects.SetSaveTreeItemStateFlag(false); //Added by yanjun for sym2_6385
+ maTlbObjects->SetSaveTreeItemStateFlag(true); //Added by yanjun for sym2_6385
+ maTlbObjects->Clear();
+ maTlbObjects->Fill( pDoc, false, aDocName ); // Nur normale Seiten
+ maTlbObjects->SetSaveTreeItemStateFlag(false); //Added by yanjun for sym2_6385
RefreshDocumentLB();
- maLbDocs.SelectEntry( aDocShName );
+ maLbDocs->SelectEntry( aDocShName );
}
void SdNavigatorWin::FreshEntry( )
{
- maTlbObjects.FreshCurEntry();
+ maTlbObjects->FreshCurEntry();
}
void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc )
@@ -189,35 +198,35 @@ void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc )
{
::sd::FrameView* pFrameView = pViewShell->GetFrameView();
if (pFrameView != NULL)
- maTlbObjects.SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false);
+ maTlbObjects->SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false);
}
// Disable the shape filter drop down menu when there is a running slide
// show.
if (pViewShell!=NULL && sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ))
- maToolbox.EnableItem(TBI_SHAPE_FILTER, false);
+ maToolbox->EnableItem(TBI_SHAPE_FILTER, false);
else
- maToolbox.EnableItem(TBI_SHAPE_FILTER);
+ maToolbox->EnableItem(TBI_SHAPE_FILTER);
- if( !maTlbObjects.IsEqualToDoc( pDoc ) )
+ if( !maTlbObjects->IsEqualToDoc( pDoc ) )
{
OUString aDocName = pDocShell->GetMedium()->GetName();
- maTlbObjects.Clear();
- maTlbObjects.Fill( pDoc, false, aDocName ); // only normal pages
+ maTlbObjects->Clear();
+ maTlbObjects->Fill( pDoc, false, aDocName ); // only normal pages
RefreshDocumentLB();
- maLbDocs.SelectEntry( aDocShName );
+ maLbDocs->SelectEntry( aDocShName );
}
else
{
- maLbDocs.SetNoSelection();
- maLbDocs.SelectEntry( aDocShName );
+ maLbDocs->SetNoSelection();
+ maLbDocs->SelectEntry( aDocShName );
// commented in order to fix 30246
-// if( maLbDocs.GetSelectEntryCount() == 0 )
+// if( maLbDocs->GetSelectEntryCount() == 0 )
{
RefreshDocumentLB();
- maLbDocs.SelectEntry( aDocShName );
+ maLbDocs->SelectEntry( aDocShName );
}
}
@@ -235,7 +244,7 @@ NavigatorDragType SdNavigatorWin::GetNavigatorDragType()
NavigatorDragType eDT = meDragType;
NavDocInfo* pInfo = GetDocInfo();
- if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) )
+ if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() ) )
eDT = NAVIGATOR_DRAGTYPE_NONE;
return eDT;
@@ -252,7 +261,7 @@ sd::DrawDocShell* SdNavigatorWin::GetDrawDocShell( const SdDrawDocument* pDoc )
IMPL_LINK_NOARG(SdNavigatorWin, SelectToolboxHdl)
{
- sal_uInt16 nId = maToolbox.GetCurItemId();
+ sal_uInt16 nId = maToolbox->GetCurItemId();
sal_uInt16 nSId = 0;
PageJump ePage = PAGE_NONE;
@@ -307,7 +316,7 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickToolboxHdl)
IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
{
- sal_uInt16 nId = maToolbox.GetCurItemId();
+ sal_uInt16 nId = maToolbox->GetCurItemId();
switch( nId )
{
@@ -339,7 +348,7 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
}
NavDocInfo* pInfo = GetDocInfo();
- if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() )
+ if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() )
{
pMenu->EnableItem( NAVIGATOR_DRAGTYPE_LINK, false );
pMenu->EnableItem( NAVIGATOR_DRAGTYPE_URL, false );
@@ -349,7 +358,7 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
pMenu->CheckItem( (sal_uInt16)meDragType );
pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, MenuSelectHdl ) );
- pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
+ pMenu->Execute( this, maToolbox->GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
pBox->EndSelection();
delete pMenu;
}
@@ -366,13 +375,13 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
nShowAllShapesFilter,
SD_RESSTR(STR_NAVIGATOR_SHOW_ALL_SHAPES));
- if (maTlbObjects.GetShowAllShapes())
+ if (maTlbObjects->GetShowAllShapes())
pMenu->CheckItem(nShowAllShapesFilter);
else
pMenu->CheckItem(nShowNamedShapesFilter);
pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, ShapeFilterCallback ) );
- pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
+ pMenu->Execute( this, maToolbox->GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
pBox->EndSelection();
delete pMenu;
}
@@ -383,14 +392,14 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl)
{
- if( !mbDocImported || maLbDocs.GetSelectEntryPos() != 0 )
+ if( !mbDocImported || maLbDocs->GetSelectEntryPos() != 0 )
{
NavDocInfo* pInfo = GetDocInfo();
// if it is the active window, we jump to the page
if( pInfo && pInfo->IsActive() )
{
- OUString aStr( maTlbObjects.GetSelectEntry() );
+ OUString aStr( maTlbObjects->GetSelectEntry() );
if( !aStr.isEmpty() )
{
@@ -398,7 +407,7 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl)
mpBindings->GetDispatcher()->Execute(
SID_NAVIGATOR_OBJECT, SfxCallMode::SLOT | SfxCallMode::RECORD, &aItem, 0L );
//set sign variable
- maTlbObjects.MarkCurEntry(aStr);
+ maTlbObjects->MarkCurEntry(aStr);
// moved here from SetGetFocusHdl. Reset the
// focus only if something has been selected in the
@@ -419,8 +428,8 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl)
IMPL_LINK_NOARG(SdNavigatorWin, SelectDocumentHdl)
{
- OUString aStrLb = maLbDocs.GetSelectEntry();
- long nPos = maLbDocs.GetSelectEntryPos();
+ OUString aStrLb = maLbDocs->GetSelectEntry();
+ long nPos = maLbDocs->GetSelectEntryPos();
bool bFound = false;
::sd::DrawDocShell* pDocShell = NULL;
NavDocInfo* pInfo = GetDocInfo();
@@ -441,18 +450,18 @@ IMPL_LINK_NOARG(SdNavigatorWin, SelectDocumentHdl)
if( bFound )
{
SdDrawDocument* pDoc = pDocShell->GetDoc();
- if( !maTlbObjects.IsEqualToDoc( pDoc ) )
+ if( !maTlbObjects->IsEqualToDoc( pDoc ) )
{
SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can...
::sd::DrawDocShell* pNCDocShell = pNonConstDoc->GetDocSh();
OUString aDocName = pNCDocShell->GetMedium()->GetName();
- maTlbObjects.Clear();
- maTlbObjects.Fill( pDoc, false, aDocName ); // only normal pages
+ maTlbObjects->Clear();
+ maTlbObjects->Fill( pDoc, false, aDocName ); // only normal pages
}
}
// check if link or url is possible
- if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) )
+ if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) )
{
meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED;
SetDragImage();
@@ -484,13 +493,13 @@ IMPL_LINK( SdNavigatorWin, MenuSelectHdl, Menu *, pMenu )
if( meDragType == NAVIGATOR_DRAGTYPE_URL )
{
// patch, prevents endless loop
- if( maTlbObjects.GetSelectionCount() > 1 )
- maTlbObjects.SelectAll( false );
+ if( maTlbObjects->GetSelectionCount() > 1 )
+ maTlbObjects->SelectAll( false );
- maTlbObjects.SetSelectionMode( SINGLE_SELECTION );
+ maTlbObjects->SetSelectionMode( SINGLE_SELECTION );
}
else
- maTlbObjects.SetSelectionMode( MULTIPLE_SELECTION );
+ maTlbObjects->SetSelectionMode( MULTIPLE_SELECTION );
}
}
return 0;
@@ -500,7 +509,7 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu )
{
if (pMenu != NULL)
{
- bool bShowAllShapes (maTlbObjects.GetShowAllShapes());
+ bool bShowAllShapes (maTlbObjects->GetShowAllShapes());
sal_uInt16 nMenuId (pMenu->GetCurItemId());
switch (nMenuId)
{
@@ -518,7 +527,7 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu )
break;
}
- maTlbObjects.SetShowAllShapes(bShowAllShapes, true);
+ maTlbObjects->SetShowAllShapes(bShowAllShapes, true);
// Remember the selection in the FrameView.
NavDocInfo* pInfo = GetDocInfo();
@@ -554,26 +563,26 @@ void SdNavigatorWin::Resize()
aDiffSize.Height() = aWinSize.Height() - maSize.Height();
// change size of Toolbox
- Size aObjSize( maToolbox.GetOutputSizePixel() );
+ Size aObjSize( maToolbox->GetOutputSizePixel() );
aObjSize.Width() += aDiffSize.Width();
- maToolbox.SetOutputSizePixel( aObjSize );
+ maToolbox->SetOutputSizePixel( aObjSize );
// change size of TreeLB
- aObjSize = maTlbObjects.GetSizePixel();
+ aObjSize = maTlbObjects->GetSizePixel();
aObjSize.Width() += aDiffSize.Width();
- aObjSize.Height() = maLbDocs.GetPosPixel().Y() + aDiffSize.Height() -
- maTlbObjects.GetPosPixel().Y() - 4;
- maTlbObjects.SetSizePixel( aObjSize );
+ aObjSize.Height() = maLbDocs->GetPosPixel().Y() + aDiffSize.Height() -
+ maTlbObjects->GetPosPixel().Y() - 4;
+ maTlbObjects->SetSizePixel( aObjSize );
Point aPt( 0, aDiffSize.Height() );
// move other controls (DocumentLB)
- maLbDocs.Hide();
- aObjSize = maLbDocs.GetOutputSizePixel();
+ maLbDocs->Hide();
+ aObjSize = maLbDocs->GetOutputSizePixel();
aObjSize.Width() += aDiffSize.Width();
- maLbDocs.SetPosPixel( maLbDocs.GetPosPixel() + aPt );
- maLbDocs.SetOutputSizePixel( aObjSize );
- maLbDocs.Show();
+ maLbDocs->SetPosPixel( maLbDocs->GetPosPixel() + aPt );
+ maLbDocs->SetOutputSizePixel( aObjSize );
+ maLbDocs->Show();
maSize = aWinSize;
}
@@ -623,19 +632,19 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName)
if (pMedium->IsStorage())
{
// Now depending on mode:
- // maTlbObjects.SetSelectionMode(MULTIPLE_SELECTION);
+ // maTlbObjects->SetSelectionMode(MULTIPLE_SELECTION);
// handover of ownership of pMedium;
- SdDrawDocument* pDropDoc = maTlbObjects.GetBookmarkDoc(pMedium);
+ SdDrawDocument* pDropDoc = maTlbObjects->GetBookmarkDoc(pMedium);
if (pDropDoc)
{
- maTlbObjects.Clear();
+ maTlbObjects->Clear();
maDropFileName = aFileName;
- if( !maTlbObjects.IsEqualToDoc( pDropDoc ) )
+ if( !maTlbObjects->IsEqualToDoc( pDropDoc ) )
{
// only normal pages
- maTlbObjects.Fill(pDropDoc, false, maDropFileName);
+ maTlbObjects->Fill(pDropDoc, false, maDropFileName);
RefreshDocumentLB( &maDropFileName );
}
}
@@ -662,28 +671,28 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName )
if( pDocName )
{
if( mbDocImported )
- maLbDocs.RemoveEntry( 0 );
+ maLbDocs->RemoveEntry( 0 );
- maLbDocs.InsertEntry( *pDocName, 0 );
+ maLbDocs->InsertEntry( *pDocName, 0 );
mbDocImported = true;
}
else
{
- nPos = maLbDocs.GetSelectEntryPos();
+ nPos = maLbDocs->GetSelectEntryPos();
if( nPos == LISTBOX_ENTRY_NOTFOUND )
nPos = 0;
OUString aStr;
if( mbDocImported )
- aStr = maLbDocs.GetEntry( 0 );
+ aStr = maLbDocs->GetEntry( 0 );
- maLbDocs.Clear();
+ maLbDocs->Clear();
// delete list of DocInfos
maDocList.clear();
if( mbDocImported )
- maLbDocs.InsertEntry( aStr, 0 );
+ maLbDocs->InsertEntry( aStr, 0 );
::sd::DrawDocShell* pCurrentDocShell =
PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
@@ -707,7 +716,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName )
// is shown in url notation!
aStr = pDocShell->GetName();
- maLbDocs.InsertEntry( aStr, LISTBOX_APPEND );
+ maLbDocs->InsertEntry( aStr, LISTBOX_APPEND );
if( pDocShell == pCurrentDocShell )
aInfo.SetActive();
@@ -719,7 +728,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName )
pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0, false );
}
}
- maLbDocs.SelectEntryPos( nPos );
+ maLbDocs->SelectEntryPos( nPos );
}
sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, bool bImage )
@@ -741,7 +750,7 @@ sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, bool bImag
NavDocInfo* SdNavigatorWin::GetDocInfo()
{
- sal_uInt32 nPos = maLbDocs.GetSelectEntryPos();
+ sal_uInt32 nPos = maLbDocs->GetSelectEntryPos();
if( mbDocImported )
{
@@ -834,14 +843,14 @@ void SdNavigatorWin::DataChanged( const DataChangedEvent& rDCEvt )
void SdNavigatorWin::SetDragImage()
{
- maToolbox.SetItemImage( TBI_DRAGTYPE, maToolbox.GetImageList().GetImage( GetDragTypeSdResId( meDragType, true ) ) );
+ maToolbox->SetItemImage( TBI_DRAGTYPE, maToolbox->GetImageList().GetImage( GetDragTypeSdResId( meDragType, true ) ) );
}
void SdNavigatorWin::ApplyImageList()
{
- maToolbox.SetImageList( maImageList );
- maToolbox.SetItemImage(TBI_SHAPE_FILTER, Image(BitmapEx(SdResId(BMP_GRAPHIC))));
+ maToolbox->SetImageList( maImageList );
+ maToolbox->SetItemImage(TBI_SHAPE_FILTER, Image(BitmapEx(SdResId(BMP_GRAPHIC))));
SetDragImage();
}
@@ -871,17 +880,17 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId,
// pen
if( nState & NAVBTN_PEN_ENABLED &&
- !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_PEN );
+ !pNavigatorWin->maToolbox->IsItemEnabled( TBI_PEN ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_PEN );
if( nState & NAVBTN_PEN_DISABLED &&
- pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_PEN, false );
+ pNavigatorWin->maToolbox->IsItemEnabled( TBI_PEN ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_PEN, false );
if( nState & NAVBTN_PEN_CHECKED &&
- !pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) )
- pNavigatorWin->maToolbox.CheckItem( TBI_PEN );
+ !pNavigatorWin->maToolbox->IsItemChecked( TBI_PEN ) )
+ pNavigatorWin->maToolbox->CheckItem( TBI_PEN );
if( nState & NAVBTN_PEN_UNCHECKED &&
- pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) )
- pNavigatorWin->maToolbox.CheckItem( TBI_PEN, false );
+ pNavigatorWin->maToolbox->IsItemChecked( TBI_PEN ) )
+ pNavigatorWin->maToolbox->CheckItem( TBI_PEN, false );
// only if doc in LB is the active
NavDocInfo* pInfo = pNavigatorWin->GetDocInfo();
@@ -889,35 +898,35 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId,
{
// First
if( nState & NAVBTN_FIRST_ENABLED &&
- !pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_FIRST );
+ !pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_FIRST );
if( nState & NAVBTN_FIRST_DISABLED &&
- pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_FIRST, false );
+ pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_FIRST, false );
// Prev
if( nState & NAVBTN_PREV_ENABLED &&
- !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS );
+ !pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS );
if( nState & NAVBTN_PREV_DISABLED &&
- pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS, false );
+ pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS, false );
// Last
if( nState & NAVBTN_LAST_ENABLED &&
- !pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_LAST );
+ !pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_LAST );
if( nState & NAVBTN_LAST_DISABLED &&
- pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_LAST, false );
+ pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_LAST, false );
// Next
if( nState & NAVBTN_NEXT_ENABLED &&
- !pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_NEXT );
+ !pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_NEXT );
if( nState & NAVBTN_NEXT_DISABLED &&
- pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) )
- pNavigatorWin->maToolbox.EnableItem( TBI_NEXT, false );
+ pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) )
+ pNavigatorWin->maToolbox->EnableItem( TBI_NEXT, false );
if( nState & NAVTLB_UPDATE )
{
@@ -956,14 +965,14 @@ void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId,
DBG_ASSERT( pStateItem, "SfxStringItem expected");
OUString aPageName = pStateItem->GetValue();
- if( !pNavigatorWin->maTlbObjects.HasSelectedChildren( aPageName ) )
+ if( !pNavigatorWin->maTlbObjects->HasSelectedChildren( aPageName ) )
{
- if( pNavigatorWin->maTlbObjects.GetSelectionMode() == MULTIPLE_SELECTION )
+ if( pNavigatorWin->maTlbObjects->GetSelectionMode() == MULTIPLE_SELECTION )
{
// because otherwise it is always additional select
- pNavigatorWin->maTlbObjects.SelectAll( false );
+ pNavigatorWin->maTlbObjects->SelectAll( false );
}
- pNavigatorWin->maTlbObjects.SelectEntry( aPageName );
+ pNavigatorWin->maTlbObjects->SelectEntry( aPageName );
}
}
}
diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx
index 53fb0adb873e..29bc961a7e41 100644
--- a/sd/source/ui/dlg/paragr.cxx
+++ b/sd/source/ui/dlg/paragr.cxx
@@ -39,17 +39,18 @@ class SdParagraphNumTabPage : public SfxTabPage
public:
SdParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SdParagraphNumTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
static const sal_uInt16* GetRanges();
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
private:
- TriStateBox* m_pNewStartCB;
- TriStateBox* m_pNewStartNumberCB;
- NumericField* m_pNewStartNF;
+ VclPtr<TriStateBox> m_pNewStartCB;
+ VclPtr<TriStateBox> m_pNewStartNumberCB;
+ VclPtr<NumericField> m_pNewStartNF;
bool mbModified;
DECL_LINK( ImplNewStartHdl, void* );
@@ -72,11 +73,20 @@ SdParagraphNumTabPage::SdParagraphNumTabPage(vcl::Window* pParent, const SfxItem
SdParagraphNumTabPage::~SdParagraphNumTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SdParagraphNumTabPage::Create(vcl::Window *pParent, const SfxItemSet * rAttrSet)
+void SdParagraphNumTabPage::dispose()
{
- return new SdParagraphNumTabPage( pParent, *rAttrSet );
+ m_pNewStartCB.clear();
+ m_pNewStartNumberCB.clear();
+ m_pNewStartNF.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SdParagraphNumTabPage::Create(vcl::Window *pParent, const SfxItemSet * rAttrSet)
+{
+ return VclPtr<SdParagraphNumTabPage>::Create( pParent, *rAttrSet );
}
const sal_uInt16* SdParagraphNumTabPage::GetRanges()
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
index c4b95a9d2458..bd635ad96676 100644
--- a/sd/source/ui/dlg/present.cxx
+++ b/sd/source/ui/dlg/present.cxx
@@ -150,6 +150,39 @@ SdStartPresentationDlg::SdStartPresentationDlg( vcl::Window* pWindow,
ChangePauseHdl( NULL );
}
+SdStartPresentationDlg::~SdStartPresentationDlg()
+{
+ disposeOnce();
+}
+
+void SdStartPresentationDlg::dispose()
+{
+ aRbtAll.clear();
+ aRbtAtDia.clear();
+ aRbtCustomshow.clear();
+ aLbDias.clear();
+ aLbCustomshow.clear();
+ aRbtStandard.clear();
+ aRbtWindow.clear();
+ aRbtAuto.clear();
+ aTmfPause.clear();
+ aCbxAutoLogo.clear();
+ aCbxManuel.clear();
+ aCbxMousepointer.clear();
+ aCbxPen.clear();
+ aCbxNavigator.clear();
+ aCbxAnimationAllowed.clear();
+ aCbxChangePage.clear();
+ aCbxAlwaysOnTop.clear();
+ maFtMonitor.clear();
+ maLBMonitor.clear();
+ msMonitor.clear();
+ msAllMonitors.clear();
+ msMonitorExternal.clear();
+ msExternal.clear();
+ ModalDialog::dispose();
+}
+
OUString SdStartPresentationDlg::GetDisplayName( sal_Int32 nDisplay,
DisplayType eType )
{
diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx
index e2330f9f6b2f..42a02cc15734 100644
--- a/sd/source/ui/dlg/prltempl.cxx
+++ b/sd/source/ui/dlg/prltempl.cxx
@@ -223,7 +223,13 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
SdPresLayoutTemplateDlg::~SdPresLayoutTemplateDlg()
{
+ disposeOnce();
+}
+
+void SdPresLayoutTemplateDlg::dispose()
+{
delete pOutSet;
+ SfxTabDialog::dispose();
}
void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx
index 943144be7a53..3785de353d1f 100644
--- a/sd/source/ui/dlg/prntopts.cxx
+++ b/sd/source/ui/dlg/prntopts.cxx
@@ -30,7 +30,7 @@
*/
SdPrintOptions::SdPrintOptions( vcl::Window* pParent, const SfxItemSet& rInAttrs ) :
SfxTabPage ( pParent, "prntopts" , "modules/simpress/ui/prntopts.ui" , &rInAttrs ),
- rOutAttrs ( rInAttrs )
+ rOutAttrs ( rInAttrs )
{
get( m_pFrmContent , "contentframe" );
get( m_pCbxDraw , "drawingcb" );
@@ -74,6 +74,31 @@ SdPrintOptions::SdPrintOptions( vcl::Window* pParent, const SfxItemSet& rInAttrs
SdPrintOptions::~SdPrintOptions()
{
+ disposeOnce();
+}
+
+void SdPrintOptions::dispose()
+{
+ m_pFrmContent.clear();
+ m_pCbxDraw.clear();
+ m_pCbxNotes.clear();
+ m_pCbxHandout.clear();
+ m_pCbxOutline.clear();
+ m_pRbtColor.clear();
+ m_pRbtGrayscale.clear();
+ m_pRbtBlackWhite.clear();
+ m_pCbxPagename.clear();
+ m_pCbxDate.clear();
+ m_pCbxTime.clear();
+ m_pCbxHiddenPages.clear();
+ m_pRbtDefault.clear();
+ m_pRbtPagesize.clear();
+ m_pRbtPagetile.clear();
+ m_pRbtBooklet.clear();
+ m_pCbxFront.clear();
+ m_pCbxBack.clear();
+ m_pCbxPaperbin.clear();
+ SfxTabPage::dispose();
}
bool SdPrintOptions::FillItemSet( SfxItemSet* rAttrs )
@@ -182,10 +207,10 @@ void SdPrintOptions::Reset( const SfxItemSet* rAttrs )
ClickBookletHdl( NULL );
}
-SfxTabPage* SdPrintOptions::Create( vcl::Window* pWindow,
- const SfxItemSet* rOutAttrs )
+VclPtr<SfxTabPage> SdPrintOptions::Create( vcl::Window* pWindow,
+ const SfxItemSet* rOutAttrs )
{
- return( new SdPrintOptions( pWindow, *rOutAttrs ) );
+ return VclPtr<SdPrintOptions>::Create( pWindow, *rOutAttrs );
}
IMPL_LINK( SdPrintOptions, ClickCheckboxHdl, CheckBox *, pCbx )
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index 8e5c87a381d3..ad902b933e38 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -121,37 +121,37 @@ OUString SdAbstractTabDialog_Impl::GetText() const
void AbstractBulletDialog_Impl::SetCurPageId( sal_uInt16 nId )
{
- static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetCurPageId( nId );
+ static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( nId );
}
void AbstractBulletDialog_Impl::SetCurPageId( const OString& rName )
{
- static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetCurPageId( rName );
+ static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( rName );
}
const SfxItemSet* AbstractBulletDialog_Impl::GetOutputItemSet() const
{
- return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetOutputItemSet();
+ return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetOutputItemSet();
}
const sal_uInt16* AbstractBulletDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
{
- return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetInputRanges( pItem );
+ return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetInputRanges( pItem );
}
void AbstractBulletDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
{
- static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetInputSet( pInSet );
+ static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetInputSet( pInSet );
}
void AbstractBulletDialog_Impl::SetText( const OUString& rStr )
{
- static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetText( rStr );
+ static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetText( rStr );
}
OUString AbstractBulletDialog_Impl::GetText() const
{
- return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetText();
+ return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetText();
}
void SdPresLayoutTemplateDlg_Impl::SetCurPageId( sal_uInt16 nId )
@@ -391,47 +391,47 @@ AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg(
AbstractSdCustomShowDlg * SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg( vcl::Window* pWindow, SdDrawDocument& rDrawDoc )
{
- return new AbstractSdCustomShowDlg_Impl( new SdCustomShowDlg( pWindow, rDrawDoc ) );
+ return new AbstractSdCustomShowDlg_Impl( VclPtr<SdCustomShowDlg>::Create( pWindow, rDrawDoc ) );
}
SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabCharDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell )
{
- return new SdAbstractTabDialog_Impl( new SdCharDlg( pParent, pAttr, pDocShell ) );
+ return new SdAbstractTabDialog_Impl( VclPtr<SdCharDlg>::Create( pParent, pAttr, pDocShell ) );
}
SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabPageDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage )
{
- return new SdAbstractTabDialog_Impl( new SdPageDlg( pDocShell, pParent, pAttr, bAreaPage ) );
+ return new SdAbstractTabDialog_Impl( VclPtr<SdPageDlg>::Create( pDocShell, pParent, pAttr, bAreaPage ) );
}
AbstractAssistentDlg * SdAbstractDialogFactory_Impl::CreateAssistentDlg( vcl::Window* pParent, bool bAutoPilot)
{
- return new AbstractAssistentDlg_Impl( new AssistentDlg( pParent, bAutoPilot ) );
+ return new AbstractAssistentDlg_Impl( VclPtr<AssistentDlg>::Create( pParent, bAutoPilot ) );
}
AbstractSdModifyFieldDlg * SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet )
{
- return new AbstractSdModifyFieldDlg_Impl( new SdModifyFieldDlg( pWindow, pInField, rSet ) );
+ return new AbstractSdModifyFieldDlg_Impl( VclPtr<SdModifyFieldDlg>::Create( pWindow, pInField, rSet ) );
}
AbstractSdSnapLineDlg * SdAbstractDialogFactory_Impl::CreateSdSnapLineDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView)
{
- return new AbstractSdSnapLineDlg_Impl( new SdSnapLineDlg( pWindow, rInAttrs, pView ) );
+ return new AbstractSdSnapLineDlg_Impl( VclPtr<SdSnapLineDlg>::Create( pWindow, rInAttrs, pView ) );
}
AbstractSdInsertLayerDlg * SdAbstractDialogFactory_Impl::CreateSdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr )
{
- return new AbstractSdInsertLayerDlg_Impl( new SdInsertLayerDlg( pWindow, rInAttrs, bDeletable, aStr ) );
+ return new AbstractSdInsertLayerDlg_Impl( VclPtr<SdInsertLayerDlg>::Create( pWindow, rInAttrs, bDeletable, aStr ) );
}
AbstractSdInsertPasteDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPasteDlg( vcl::Window* pWindow )
{
- return new AbstractSdInsertPasteDlg_Impl( new SdInsertPasteDlg( pWindow ) );
+ return new AbstractSdInsertPasteDlg_Impl( VclPtr<SdInsertPasteDlg>::Create( pWindow ) );
}
AbstractSdInsertPagesObjsDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg( vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName )
{
- return new AbstractSdInsertPagesObjsDlg_Impl( new SdInsertPagesObjsDlg( pParent, pDoc, pSfxMedium, rFileName ) );
+ return new AbstractSdInsertPagesObjsDlg_Impl( VclPtr<SdInsertPagesObjsDlg>::Create( pParent, pDoc, pSfxMedium, rFileName ) );
}
AbstractMorphDlg * SdAbstractDialogFactory_Impl::CreateMorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2)
@@ -446,13 +446,13 @@ SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDl
SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdParagraphTabDlg( vcl::Window* pParent, const SfxItemSet* pAttr )
{
- return new SdAbstractTabDialog_Impl( new SdParagraphDlg( pParent, pAttr ) );
+ return new SdAbstractTabDialog_Impl( VclPtr<SdParagraphDlg>::Create( pParent, pAttr ) );
}
AbstractSdStartPresDlg * SdAbstractDialogFactory_Impl::CreateSdStartPresentationDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs,
const std::vector<OUString> &rPageNames, SdCustomShowList* pCSList )
{
- return new AbstractSdStartPresDlg_Impl( new SdStartPresentationDlg( pWindow, rInAttrs, rPageNames, pCSList ) );
+ return new AbstractSdStartPresDlg_Impl( VclPtr<SdStartPresentationDlg>::Create( pWindow, rInAttrs, rPageNames, pCSList ) );
}
VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateRemoteDialog( vcl::Window* pWindow )
@@ -462,32 +462,32 @@ VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateRemoteDialog( vcl::Windo
SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, vcl::Window* pParent, const SdResId& DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool )
{
- return new SdPresLayoutTemplateDlg_Impl( new SdPresLayoutTemplateDlg( pDocSh, pParent, DlgId, rStyleBase, ePO, pSSPool ) );
+ return new SdPresLayoutTemplateDlg_Impl( VclPtr<SdPresLayoutTemplateDlg>::Create( pDocSh, pParent, DlgId, rStyleBase, ePO, pSSPool ) );
}
AbstractSdPresLayoutDlg * SdAbstractDialogFactory_Impl::CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, vcl::Window* pWindow, const SfxItemSet& rInAttrs)
{
- return new AbstractSdPresLayoutDlg_Impl( new SdPresLayoutDlg( pDocShell, pWindow, rInAttrs ) );
+ return new AbstractSdPresLayoutDlg_Impl( VclPtr<SdPresLayoutDlg>::Create( pDocShell, pWindow, rInAttrs ) );
}
SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabTemplateDlg( vcl::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView )
{
- return new SdAbstractTabDialog_Impl( new SdTabTemplateDlg( pParent, pDocShell, rStyleBase, pModel, pView ) );
+ return new SdAbstractTabDialog_Impl( VclPtr<SdTabTemplateDlg>::Create( pParent, pDocShell, rStyleBase, pModel, pView ) );
}
SfxAbstractDialog* SdAbstractDialogFactory_Impl::CreatSdActionDialog( vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView )
{
- return new SdAbstractSfxDialog_Impl( new SdActionDlg( pParent, pAttr, pView ) );
+ return new SdAbstractSfxDialog_Impl( VclPtr<SdActionDlg>::Create( pParent, pAttr, pView ) );
}
AbstractSdVectorizeDlg * SdAbstractDialogFactory_Impl::CreateSdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell )
{
- return new AbstractSdVectorizeDlg_Impl( new SdVectorizeDlg( pParent, rBmp, pDocShell ) );
+ return new AbstractSdVectorizeDlg_Impl( VclPtr<SdVectorizeDlg>::Create( pParent, rBmp, pDocShell ) );
}
AbstractSdPublishingDlg * SdAbstractDialogFactory_Impl::CreateSdPublishingDlg( vcl::Window* pWindow, DocumentType eDocType)
{
- return new AbstractSdPublishingDlg_Impl( new SdPublishingDlg( pWindow, eDocType ) );
+ return new AbstractSdPublishingDlg_Impl( VclPtr<SdPublishingDlg>::Create( pWindow, eDocType ) );
}
// Factories for TabPages
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index 38d6d1e4c1e7..3ba9b486d787 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -23,7 +23,7 @@
#include <sfx2/basedlgs.hxx>
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
- DialogClass* pDlg; \
+ ScopedVclPtr<DialogClass> pDlg; \
public: \
Class( DialogClass* p) \
: pDlg(p) \
@@ -34,7 +34,6 @@ public: \
#define IMPL_ABSTDLG_BASE(Class) \
Class::~Class() \
{ \
- delete pDlg; \
} \
short Class::Execute() \
{ \
diff --git a/sd/source/ui/dlg/sdpreslt.cxx b/sd/source/ui/dlg/sdpreslt.cxx
index 21d8a89afb6f..51206936dd07 100644
--- a/sd/source/ui/dlg/sdpreslt.cxx
+++ b/sd/source/ui/dlg/sdpreslt.cxx
@@ -55,6 +55,16 @@ SdPresLayoutDlg::SdPresLayoutDlg(::sd::DrawDocShell* pDocShell,
SdPresLayoutDlg::~SdPresLayoutDlg()
{
+ disposeOnce();
+}
+
+void SdPresLayoutDlg::dispose()
+{
+ m_pVS.clear();
+ m_pCbxMasterPage.clear();
+ m_pCbxCheckMasters.clear();
+ m_pBtnLoad.clear();
+ ModalDialog::dispose();
}
/**
@@ -169,7 +179,7 @@ IMPL_LINK_NOARG(SdPresLayoutDlg, ClickLayoutHdl)
*/
IMPL_LINK_NOARG(SdPresLayoutDlg, ClickLoadHdl)
{
- boost::scoped_ptr<SfxNewFileDialog> pDlg(new SfxNewFileDialog(this, SFXWB_PREVIEW));
+ VclPtrInstance< SfxNewFileDialog > pDlg(this, SFXWB_PREVIEW);
pDlg->SetText(SD_RESSTR(STR_LOAD_PRESENTATION_LAYOUT));
if(!IsReallyVisible())
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 0a96dd736de3..5e358bf35578 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -255,11 +255,19 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle )
SdPageObjsTLB::~SdPageObjsTLB()
{
+ disposeOnce();
+}
+
+void SdPageObjsTLB::dispose()
+{
if ( mpBookmarkDoc )
CloseBookmarkDoc();
else
// no document was created from mpMedium, so this object is still the owner of it
delete mpMedium;
+ mpParent.clear();
+ mpDropNavWin.clear();
+ SvTreeListBox::dispose();
}
// helper function for GetEntryAltText and GetEntryLongDescription
@@ -1004,8 +1012,8 @@ SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed)
if ( !mpBookmarkDoc )
{
- MessageDialog aErrorBox(this, SD_RESSTR(STR_READ_DATA_ERROR));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SD_RESSTR(STR_READ_DATA_ERROR));
+ aErrorBox->Execute();
mpMedium = 0; //On failure the SfxMedium is invalid
}
}
@@ -1343,7 +1351,7 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt )
OUString aFile;
if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aFile ) &&
- static_cast<SdNavigatorWin*>(mpParent)->InsertFile( aFile ) )
+ static_cast<SdNavigatorWin*>(mpParent.get())->InsertFile( aFile ) )
{
nRet = rEvt.mnAction;
}
diff --git a/sd/source/ui/dlg/sduiexp.cxx b/sd/source/ui/dlg/sduiexp.cxx
index 3c526380a538..84127950fcd2 100644
--- a/sd/source/ui/dlg/sduiexp.cxx
+++ b/sd/source/ui/dlg/sduiexp.cxx
@@ -18,6 +18,21 @@
*/
#include "sddlgfact.hxx"
+#include "morphdlg.hxx"
+#include "present.hxx"
+#include "inspagob.hxx"
+#include "vectdlg.hxx"
+#include "sdpreslt.hxx"
+#include "headerfooterdlg.hxx"
+#include "pubdlg.hxx"
+#include "ins_paste.hxx"
+#include "layeroptionsdlg.hxx"
+#include "dlgsnap.hxx"
+#include "dlgfield.hxx"
+#include "dlgass.hxx"
+#include "prltempl.hxx"
+#include "custsdlg.hxx"
+#include "copydlg.hxx"
#include "sal/types.h"
extern "C"
diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx
index 253e7142aa34..e038120c6a00 100644
--- a/sd/source/ui/dlg/tpaction.cxx
+++ b/sd/source/ui/dlg/tpaction.cxx
@@ -83,12 +83,12 @@ SdActionDlg::SdActionDlg (
, rOutAttrs(*pAttr)
{
// FreeResource();
- SfxTabPage* pNewPage = SdTPAction::Create(get_content_area(), rOutAttrs);
+ VclPtr<SfxTabPage> pNewPage = SdTPAction::Create(get_content_area(), rOutAttrs);
assert(pNewPage); //Unable to create page
// formerly in PageCreated
- static_cast<SdTPAction*>( pNewPage )->SetView( pView );
- static_cast<SdTPAction*>( pNewPage )->Construct();
+ static_cast<SdTPAction*>( pNewPage.get() )->SetView( pView );
+ static_cast<SdTPAction*>( pNewPage.get() )->Construct();
SetTabPage( pNewPage );
}
@@ -142,6 +142,25 @@ SdTPAction::SdTPAction(vcl::Window* pWindow, const SfxItemSet& rInAttrs)
SdTPAction::~SdTPAction()
{
+ disposeOnce();
+}
+
+void SdTPAction::dispose()
+{
+ m_pLbAction.clear();
+ m_pFtTree.clear();
+ m_pLbTree.clear();
+ m_pLbTreeDocument.clear();
+ m_pLbOLEAction.clear();
+ m_pFrame.clear();
+ m_pEdtSound.clear();
+ m_pEdtBookmark.clear();
+ m_pEdtDocument.clear();
+ m_pEdtProgram.clear();
+ m_pEdtMacro.clear();
+ m_pBtnSearch.clear();
+ m_pBtnSeek.clear();
+ SfxTabPage::dispose();
}
void SdTPAction::SetView( const ::sd::View* pSdView )
@@ -359,10 +378,10 @@ SfxTabPage::sfxpg SdTPAction::DeactivatePage( SfxItemSet* pPageSet )
return LEAVE_PAGE;
}
-SfxTabPage* SdTPAction::Create( vcl::Window* pWindow,
- const SfxItemSet& rAttrs )
+VclPtr<SfxTabPage> SdTPAction::Create( vcl::Window* pWindow,
+ const SfxItemSet& rAttrs )
{
- return new SdTPAction( pWindow, rAttrs );
+ return VclPtr<SdTPAction>::Create( pWindow, rAttrs );
}
void SdTPAction::UpdateTree()
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index cc69f5e8627a..35c5cb3435af 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -99,10 +99,10 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
pCbxRotate->GetClickHdl().Call(0);
}
-SfxTabPage* SdTpOptionsSnap::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SdTpOptionsSnap::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SdTpOptionsSnap( pWindow, *rAttrs );
+ return VclPtr<SdTpOptionsSnap>::Create( pWindow, *rAttrs );
}
/*************************************************************************
@@ -122,6 +122,16 @@ SdTpOptionsContents::SdTpOptionsContents( vcl::Window* pParent, const SfxItemSet
SdTpOptionsContents::~SdTpOptionsContents()
{
+ disposeOnce();
+}
+
+void SdTpOptionsContents::dispose()
+{
+ m_pCbxRuler.clear();
+ m_pCbxDragStripes.clear();
+ m_pCbxHandlesBezier.clear();
+ m_pCbxMoveOutline.clear();
+ SfxTabPage::dispose();
}
bool SdTpOptionsContents::FillItemSet( SfxItemSet* rAttrs )
@@ -165,10 +175,10 @@ void SdTpOptionsContents::Reset( const SfxItemSet* rAttrs )
m_pCbxHandlesBezier->SaveValue();
}
-SfxTabPage* SdTpOptionsContents::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SdTpOptionsContents::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SdTpOptionsContents( pWindow, *rAttrs );
+ return VclPtr<SdTpOptionsContents>::Create( pWindow, *rAttrs );
}
/*************************************************************************
@@ -276,6 +286,38 @@ SdTpOptionsMisc::SdTpOptionsMisc(vcl::Window* pParent, const SfxItemSet& rInAttr
SdTpOptionsMisc::~SdTpOptionsMisc()
{
+ disposeOnce();
+}
+
+void SdTpOptionsMisc::dispose()
+{
+ m_pCbxQuickEdit.clear();
+ m_pCbxPickThrough.clear();
+ m_pNewDocumentFrame.clear();
+ m_pCbxStartWithTemplate.clear();
+ m_pCbxMasterPageCache.clear();
+ m_pCbxCopy.clear();
+ m_pCbxMarkedHitMovesAlways.clear();
+ m_pPresentationFrame.clear();
+ m_pLbMetric.clear();
+ m_pMtrFldTabstop.clear();
+ m_pCbxEnableSdremote.clear();
+ m_pCbxEnablePresenterScreen.clear();
+ m_pCbxUsePrinterMetrics.clear();
+ m_pCbxCompatibility.clear();
+ m_pScaleFrame.clear();
+ m_pCbScale.clear();
+ m_pNewDocLb.clear();
+ m_pFiInfo1.clear();
+ m_pMtrFldOriginalWidth.clear();
+ m_pWidthLb.clear();
+ m_pHeightLb.clear();
+ m_pFiInfo2.clear();
+ m_pMtrFldOriginalHeight.clear();
+ m_pCbxDistrot.clear();
+ m_pMtrFldInfo1.clear();
+ m_pMtrFldInfo2.clear();
+ SfxTabPage::dispose();
}
void SdTpOptionsMisc::ActivatePage( const SfxItemSet& rSet )
@@ -331,10 +373,9 @@ SfxTabPage::sfxpg SdTpOptionsMisc::DeactivatePage( SfxItemSet* pActiveSet )
FillItemSet( pActiveSet );
return LEAVE_PAGE;
}
- WarningBox aWarnBox( GetParent(), WB_YES_NO, SD_RESSTR( STR_WARN_SCALE_FAIL ) );
- short nReturn = aWarnBox.Execute();
+ ScopedVclPtrInstance< WarningBox > aWarnBox( GetParent(), WB_YES_NO, SD_RESSTR( STR_WARN_SCALE_FAIL ) );
- if( nReturn == RET_YES )
+ if( aWarnBox->Execute() == RET_YES )
return KEEP_PAGE;
if( pActiveSet )
@@ -488,10 +529,10 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs )
UpdateCompatibilityControls ();
}
-SfxTabPage* SdTpOptionsMisc::Create( vcl::Window* pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SdTpOptionsMisc::Create( vcl::Window* pWindow,
+ const SfxItemSet* rAttrs )
{
- return new SdTpOptionsMisc( pWindow, *rAttrs );
+ return VclPtr<SdTpOptionsMisc>::Create( pWindow, *rAttrs );
}
IMPL_LINK_NOARG(SdTpOptionsMisc, SelectMetricHdl_Impl)
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
index f533073cfe32..d7cde0582f7e 100644
--- a/sd/source/ui/dlg/vectdlg.cxx
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -72,6 +72,22 @@ SdVectorizeDlg::SdVectorizeDlg(vcl::Window* pParent, const Bitmap& rBmp, ::sd::D
SdVectorizeDlg::~SdVectorizeDlg()
{
+ disposeOnce();
+}
+
+void SdVectorizeDlg::dispose()
+{
+ m_pNmLayers.clear();
+ m_pMtReduce.clear();
+ m_pFtFillHoles.clear();
+ m_pMtFillHoles.clear();
+ m_pCbFillHoles.clear();
+ m_pBmpWin.clear();
+ m_pMtfWin.clear();
+ m_pPrgs.clear();
+ m_pBtnOK.clear();
+ m_pBtnPreview.clear();
+ ModalDialog::dispose();
}
Rectangle SdVectorizeDlg::GetRect( const Size& rDispSize, const Size& rBmpSize ) const
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx
index 1646ed348244..b4e66d5caf4c 100644
--- a/sd/source/ui/docshell/docshel2.cxx
+++ b/sd/source/ui/docshell/docshel2.cxx
@@ -193,26 +193,26 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe
MapMode aMapMode( MAP_100TH_MM );
const Size aSize( pPage->GetSize() );
const Point aNullPt;
- VirtualDevice aVDev( *Application::GetDefaultDevice() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( *Application::GetDefaultDevice() );
- aVDev.SetMapMode( aMapMode );
+ pVDev->SetMapMode( aMapMode );
- const Size aPixSize( aVDev.LogicToPixel( aSize ) );
+ const Size aPixSize( pVDev->LogicToPixel( aSize ) );
const sal_uLong nMaxEdgePix = std::max( aPixSize.Width(), aPixSize.Height() );
Fraction aFrac( nMaxEdgePixel, nMaxEdgePix );
aMapMode.SetScaleX( aFrac );
aMapMode.SetScaleY( aFrac );
- aVDev.SetMapMode( aMapMode );
- aVDev.SetOutputSize( aSize );
+ pVDev->SetMapMode( aMapMode );
+ pVDev->SetOutputSize( aSize );
// that we also get the dark lines at the right and bottom page margin
aFrac = Fraction( nMaxEdgePixel - 1, nMaxEdgePix );
aMapMode.SetScaleX( aFrac );
aMapMode.SetScaleY( aFrac );
- aVDev.SetMapMode( aMapMode );
+ pVDev->SetMapMode( aMapMode );
- ClientView* pView = new ClientView( this, &aVDev, NULL );
+ ClientView* pView = new ClientView( this, pVDev, NULL );
FrameView* pFrameView = GetFrameView();
pView->ShowSdrPage( pPage );
@@ -263,14 +263,14 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe
pView->SetActiveLayer( pFrameView->GetActiveLayer() );
}
- pView->CompleteRedraw( &aVDev, vcl::Region(Rectangle(aNullPt, aSize)) );
+ pView->CompleteRedraw( pVDev, vcl::Region(Rectangle(aNullPt, aSize)) );
// IsRedrawReady() always gives sal_True while ( !pView->IsRedrawReady() ) {}
delete pView;
- aVDev.SetMapMode( MapMode() );
+ pVDev->SetMapMode( MapMode() );
- Bitmap aPreview( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
+ Bitmap aPreview( pVDev->GetBitmap( aNullPt, pVDev->GetOutputSizePixel() ) );
DBG_ASSERT(!!aPreview, "Preview-Bitmap could not be generated");
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 2705eaed58b6..05edd42ed21f 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -109,7 +109,7 @@ SfxPrinter* DrawDocShell::GetPrinter(bool bCreate)
pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) );
pSet->Put( aFlagItem );
- mpPrinter = new SfxPrinter(pSet);
+ mpPrinter = VclPtr<SfxPrinter>::Create(pSet);
mbOwnPrinter = true;
// set output quality
@@ -144,10 +144,8 @@ void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter)
pView->SdrEndTextEdit();
}
- if ( mpPrinter && mbOwnPrinter && (mpPrinter != pNewPrinter) )
- {
- delete mpPrinter;
- }
+ if ( mpPrinter && mbOwnPrinter && (mpPrinter.get() != pNewPrinter) )
+ mpPrinter.disposeAndClear();
mpPrinter = pNewPrinter;
mbOwnPrinter = true;
@@ -204,11 +202,11 @@ void DrawDocShell::UpdateRefDevice()
if( mpDoc )
{
// Determine the device for which the output will be formatted.
- OutputDevice* pRefDevice = NULL;
+ VclPtr< OutputDevice > pRefDevice;
switch (mpDoc->GetPrinterIndependentLayout())
{
case ::com::sun::star::document::PrinterIndependentLayout::DISABLED:
- pRefDevice = mpPrinter;
+ pRefDevice = mpPrinter.get();
break;
case ::com::sun::star::document::PrinterIndependentLayout::ENABLED:
@@ -221,10 +219,10 @@ void DrawDocShell::UpdateRefDevice()
// as a fall-back.
DBG_ASSERT(false, "DrawDocShell::UpdateRefDevice(): Unexpected printer layout mode");
- pRefDevice = mpPrinter;
+ pRefDevice = mpPrinter.get();
break;
}
- mpDoc->SetRefDevice( pRefDevice );
+ mpDoc->SetRefDevice( pRefDevice.get() );
::sd::Outliner* pOutl = mpDoc->GetOutliner( false );
@@ -1132,9 +1130,9 @@ void DrawDocShell::OpenBookmark( const OUString& rBookmarkURL )
( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs );
}
-SfxDocumentInfoDialog* DrawDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet )
+VclPtr<SfxDocumentInfoDialog> DrawDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet )
{
- SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog( pParent, rSet );
+ VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create( pParent, rSet );
DrawDocShell* pDocSh = PTR_CAST(DrawDocShell,SfxObjectShell::Current());
if( pDocSh == this )
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
index f49f523eaec5..ca32796f60db 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -185,7 +185,7 @@ DrawDocShell::~DrawDocShell()
delete mpUndoManager;
if (mbOwnPrinter)
- delete mpPrinter;
+ mpPrinter.disposeAndClear();
if( mbOwnDocument )
delete mpDoc;
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 21be69f667a8..065499bac8e5 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -91,7 +91,7 @@ BasicViewFactory::BasicViewFactory (
mpViewShellContainer(new ViewShellContainer()),
mpBase(NULL),
mpFrameView(NULL),
- mpWindow(new WorkWindow(NULL,WB_STDWORK)),
+ mpWindow(VclPtr<WorkWindow>::Create(nullptr,WB_STDWORK)),
mpViewCache(new ViewCache()),
mxLocalPane(new Pane(Reference<XResourceId>(), mpWindow.get()))
{
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/framework/factories/BasicViewFactory.hxx
index 6d6d89591fa3..1f4cd342bdb9 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.hxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.hxx
@@ -34,6 +34,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
+#include <vcl/vclptr.hxx>
namespace sd {
class ViewShell;
@@ -104,7 +105,7 @@ private:
FrameView* mpFrameView;
class ViewCache;
- ::boost::shared_ptr<vcl::Window> mpWindow;
+ VclPtr<vcl::Window> mpWindow;
::boost::shared_ptr<ViewCache> mpViewCache;
css::uno::Reference<css::drawing::framework::XPane> mxLocalPane;
diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx
index 69e79836ba6f..9f70355fb5f0 100644
--- a/sd/source/ui/framework/factories/ChildWindowPane.cxx
+++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx
@@ -188,7 +188,7 @@ void SAL_CALL ChildWindowPane::disposing()
Reference<awt::XWindow> SAL_CALL ChildWindowPane::getWindow()
throw (RuntimeException, std::exception)
{
- if (mpWindow == NULL || ! mxWindow.is())
+ if (mpWindow == nullptr || ! mxWindow.is())
GetWindow();
return Pane::getWindow();
}
diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx
index 009975465541..ba793b25961c 100644
--- a/sd/source/ui/framework/factories/FullScreenPane.cxx
+++ b/sd/source/ui/framework/factories/FullScreenPane.cxx
@@ -46,7 +46,8 @@ FullScreenPane::FullScreenPane (
mpWorkWindow(NULL)
{
vcl::Window* pParent = NULL;
- mpWorkWindow.reset(new WorkWindow(
+ mpWorkWindow.reset(VclPtr<WorkWindow>::Create(
+
pParent,
0)); // For debugging (non-fullscreen) use WB_BORDER | WB_MOVEABLE | WB_SIZEABLE));
@@ -86,7 +87,7 @@ FullScreenPane::FullScreenPane (
// For some reason the VCL canvas can not paint into a WorkWindow.
// Therefore a child window is created that covers the WorkWindow
// completely.
- mpWindow = new vcl::Window(mpWorkWindow.get());
+ mpWindow = VclPtr<vcl::Window>::Create(mpWorkWindow.get());
mpWindow->SetPosSizePixel(Point(0,0), mpWorkWindow->GetSizePixel());
mpWindow->SetBackground(Wallpaper());
mxWindow = VCLUnoHelper::GetInterface(mpWindow);
@@ -103,11 +104,7 @@ FullScreenPane::~FullScreenPane() throw()
void SAL_CALL FullScreenPane::disposing()
{
- // We have created the window pointed to by mpWindow, we delete it.
- if (mpWindow != NULL)
- {
- delete mpWindow;
- }
+ mpWindow.disposeAndClear();
if (mpWorkWindow.get() != NULL)
{
@@ -126,7 +123,7 @@ sal_Bool SAL_CALL FullScreenPane::isVisible()
{
ThrowIfDisposed();
- if (mpWindow != NULL)
+ if (mpWindow != nullptr)
return mpWindow->IsReallyVisible();
else
return false;
@@ -137,9 +134,9 @@ void SAL_CALL FullScreenPane::setVisible (const sal_Bool bIsVisible)
{
ThrowIfDisposed();
- if (mpWindow != NULL)
+ if (mpWindow != nullptr)
mpWindow->Show(bIsVisible);
- if (mpWorkWindow != 0)
+ if (mpWorkWindow != nullptr)
mpWorkWindow->Show(bIsVisible);
}
@@ -148,7 +145,7 @@ Reference<css::accessibility::XAccessible> SAL_CALL FullScreenPane::getAccessibl
{
ThrowIfDisposed();
- if (mpWorkWindow != 0)
+ if (mpWorkWindow != nullptr)
return mpWorkWindow->GetAccessible(false);
else
return NULL;
@@ -160,7 +157,7 @@ void SAL_CALL FullScreenPane::setAccessible (
{
ThrowIfDisposed();
- if (mpWindow != NULL)
+ if (mpWindow != nullptr)
{
Reference<lang::XInitialization> xInitializable (rxAccessible, UNO_QUERY);
if (xInitializable.is())
diff --git a/sd/source/ui/framework/factories/FullScreenPane.hxx b/sd/source/ui/framework/factories/FullScreenPane.hxx
index 0c2e1afac517..7e5e839f647e 100644
--- a/sd/source/ui/framework/factories/FullScreenPane.hxx
+++ b/sd/source/ui/framework/factories/FullScreenPane.hxx
@@ -80,7 +80,7 @@ protected:
private:
css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
- ::boost::scoped_ptr<WorkWindow> mpWorkWindow;
+ VclPtr<WorkWindow> mpWorkWindow;
void ExtractArguments (
const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx
index 0fd14c668bb2..696724e4d863 100644
--- a/sd/source/ui/framework/factories/Pane.cxx
+++ b/sd/source/ui/framework/factories/Pane.cxx
@@ -175,7 +175,7 @@ Reference<rendering::XCanvas> Pane::CreateCanvas()
{
Reference<rendering::XCanvas> xCanvas;
- if (mpWindow != NULL)
+ if (mpWindow != nullptr)
{
::cppcanvas::SpriteCanvasSharedPtr pCanvas (
cppcanvas::VCLFactory::createSpriteCanvas(*mpWindow));
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index bd21323f0984..a12d8b2ed52a 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -151,8 +151,8 @@ void FuInsertGraphic::DoExecute( SfxRequest& )
// really store as link only?
if( SvtMiscOptions().ShowLinkWarningDialog() )
{
- SvxLinkWarningDialog aWarnDlg(mpWindow,aDlg.GetPath());
- if( aWarnDlg.Execute() != RET_OK )
+ ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(mpWindow,aDlg.GetPath());
+ if( aWarnDlg->Execute() != RET_OK )
return; // don't store as link
}
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 7b554d2f74d7..c0bbd9f3deeb 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -317,8 +317,8 @@ void FuInsertFile::DoExecute( SfxRequest& rReq )
if( !bInserted )
{
- MessageDialog aErrorBox(mpWindow, SD_RESSTR( STR_READ_DATA_ERROR));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SD_RESSTR( STR_READ_DATA_ERROR));
+ aErrorBox->Execute();
delete pMedium;
}
}
@@ -467,8 +467,8 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
if (nErr || pOutliner->GetEditEngine().GetText().isEmpty())
{
- MessageDialog aErrorBox(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR));
+ aErrorBox->Execute();
}
else
{
@@ -611,8 +611,8 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
if (nErr || pOutliner->GetEditEngine().GetText().isEmpty())
{
- MessageDialog aErrorBox(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR));
+ aErrorBox->Execute();
}
else
{
diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx
index e8f441cc7398..b963b06e5cf8 100644
--- a/sd/source/ui/func/fulinend.cxx
+++ b/sd/source/ui/func/fulinend.cxx
@@ -138,9 +138,9 @@ void FuLineEnd::DoExecute( SfxRequest& )
}
else
{
- WarningBox aWarningBox( mpWindow, WinBits( WB_OK ),
+ ScopedVclPtrInstance<WarningBox> aWarningBox( mpWindow, WinBits( WB_OK ),
SD_RESSTR( STR_WARN_NAME_DUPLICATE ) );
- aWarningBox.Execute();
+ aWarningBox->Execute();
}
}
}
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index bbccfbcaa613..a099da6dc8ed 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -351,13 +351,13 @@ const SfxItemSet* FuPage::ExecuteDialog( ::vcl::Window* pParent )
// notice-masterpage (at the moment)
if( ePageKind != PK_NOTES )
{
- MessBox aQuestionBox (
+ ScopedVclPtrInstance<MessBox> aQuestionBox (
pParent,
WB_YES_NO | WB_DEF_YES,
SD_RESSTR(STR_PAGE_BACKGROUND_TITLE),
SD_RESSTR(STR_PAGE_BACKGROUND_TXT) );
- aQuestionBox.SetImage( QueryBox::GetStandardImage() );
- bSetToAllPages = ( RET_YES == aQuestionBox.Execute() );
+ aQuestionBox->SetImage( QueryBox::GetStandardImage() );
+ bSetToAllPages = ( RET_YES == aQuestionBox->Execute() );
}
if( mbPageBckgrdDeleted )
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index f522f6eba3f2..8ea8462ceedc 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -100,10 +100,8 @@ FuPoor::~FuPoor()
{
aDragTimer.Stop();
aScrollTimer.Stop();
- aDelayToScrollTimer.Stop ();
-
- if (pDialog)
- delete pDialog;
+ aDelayToScrollTimer.Stop();
+ pDialog.disposeAndClear();
}
void FuPoor::Activate()
@@ -130,6 +128,11 @@ void FuPoor::Deactivate()
if (mpWindow) mpWindow->ReleaseMouse ();
}
+void FuPoor::SetWindow(::sd::Window* pWin)
+{
+ mpWindow = pWin;
+}
+
/**
* scroll when approached the border of the window; is called by MouseMove
*/
diff --git a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
index 8c4977b243c5..674a8c6e7bc4 100644
--- a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
+++ b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
@@ -278,7 +278,7 @@ private:
protected:
/// The core window that is made accessible.
- ::sd::Window* mpWindow;
+ VclPtr<::sd::Window> mpWindow;
/// The API window that is made accessible.
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>
diff --git a/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/sd/source/ui/inc/AccessibleSlideSorterView.hxx
index 68b044ef2666..f1ac5a189f33 100644
--- a/sd/source/ui/inc/AccessibleSlideSorterView.hxx
+++ b/sd/source/ui/inc/AccessibleSlideSorterView.hxx
@@ -31,6 +31,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/awt/XFocusListener.hpp>
#include <com/sun/star/document/XEventListener.hpp>
+#include <vcl/vclptr.hxx>
#include <memory>
@@ -288,7 +289,7 @@ private:
sal_uInt32 mnClientId;
- vcl::Window* mpContentWindow;
+ VclPtr<vcl::Window> mpContentWindow;
/** Check whether or not the object has been disposed (or is in the
state of being disposed). If that is the case then
diff --git a/sd/source/ui/inc/BreakDlg.hxx b/sd/source/ui/inc/BreakDlg.hxx
index bddf639c16a3..40c650c5ee7f 100644
--- a/sd/source/ui/inc/BreakDlg.hxx
+++ b/sd/source/ui/inc/BreakDlg.hxx
@@ -53,14 +53,15 @@ public:
sal_uLong nSumActionCount,
sal_uLong nObjCount);
virtual ~BreakDlg();
+ virtual void dispose() SAL_OVERRIDE;
short Execute() SAL_OVERRIDE;
private:
- FixedText* m_pFiObjInfo;
- FixedText* m_pFiActInfo;
- FixedText* m_pFiInsInfo;
- CancelButton* m_pBtnCancel;
+ VclPtr<FixedText> m_pFiObjInfo;
+ VclPtr<FixedText> m_pFiActInfo;
+ VclPtr<FixedText> m_pFiInsInfo;
+ VclPtr<CancelButton> m_pBtnCancel;
DrawView* pDrView;
diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx
index df23e0a35a56..df7e337c1f1b 100644
--- a/sd/source/ui/inc/DrawDocShell.hxx
+++ b/sd/source/ui/inc/DrawDocShell.hxx
@@ -102,7 +102,7 @@ public:
virtual Size GetFirstPageSize() SAL_OVERRIDE;
virtual void FillClass(SvGlobalName* pClassName, SotClipboardFormatId* pFormat, OUString* pAppName, OUString* pFullTypeName, OUString* pShortTypeName, sal_Int32 nFileFormat, bool bTemplate = false ) const SAL_OVERRIDE;
virtual void SetModified( bool = true ) SAL_OVERRIDE;
- virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( ::vcl::Window *pParent,
+ virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( ::vcl::Window *pParent,
const SfxItemSet &rSet ) SAL_OVERRIDE;
using SfxObjectShell::GetVisArea;
@@ -211,7 +211,7 @@ protected:
SdDrawDocument* mpDoc;
SfxUndoManager* mpUndoManager;
- SfxPrinter* mpPrinter;
+ VclPtr<SfxPrinter> mpPrinter;
::sd::ViewShell* mpViewShell;
FontList* mpFontList;
rtl::Reference<FuPoor> mxDocShellFunction;
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 0012c2a9d7fd..a54937f2fabf 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -279,7 +279,7 @@ public:
void UnlockInput();
bool IsInputLocked() const { return mnLockCount > 0UL; }
- sal_uInt16 GetCurPageId() { return( maTabControl.GetCurPageId() ); }
+ sal_uInt16 GetCurPageId() { return maTabControl->GetCurPageId(); }
/** Show controls of the UI or hide them, depending on the given flag.
Do not call this method directly. Call the method at ViewShellBase
@@ -345,7 +345,7 @@ public:
/** Return a pointer to the tab control for pages.
*/
- TabControl& GetPageTabControl() { return maTabControl;}
+ TabControl& GetPageTabControl() { return *maTabControl.get(); }
/** Return a pointer to the tab control for layers.
*/
@@ -384,7 +384,7 @@ protected:
Rectangle maMarkRect;
Point maMousePos;
bool mbMousePosFreezed;
- TabControl maTabControl;
+ VclPtr<TabControl> maTabControl;
EditMode meEditMode;
PageKind mePageKind;
bool mbZoomOnPage;
diff --git a/sd/source/ui/inc/FormShellManager.hxx b/sd/source/ui/inc/FormShellManager.hxx
index ef8a4212dcea..0c9c19660e6c 100644
--- a/sd/source/ui/inc/FormShellManager.hxx
+++ b/sd/source/ui/inc/FormShellManager.hxx
@@ -24,6 +24,7 @@
#include <tools/link.hxx>
#include <svl/lstner.hxx>
+#include <vcl/vclptr.hxx>
class VclWindowEvent;
class FmFormShell;
@@ -89,7 +90,7 @@ private:
bool mbIsMainViewChangePending;
- vcl::Window* mpMainViewShellWindow;
+ VclPtr<vcl::Window> mpMainViewShellWindow;
/** Register at window of center pane and at the form shell that
represents the form tool bar. The former informs this manager about
diff --git a/sd/source/ui/inc/OutlineBulletDlg.hxx b/sd/source/ui/inc/OutlineBulletDlg.hxx
index 19ae1f8cad0e..5a88788bfc73 100644
--- a/sd/source/ui/inc/OutlineBulletDlg.hxx
+++ b/sd/source/ui/inc/OutlineBulletDlg.hxx
@@ -38,6 +38,7 @@ public:
const SfxItemSet* pAttr,
::sd::View* pView );
virtual ~OutlineBulletDlg ();
+ virtual void dispose() SAL_OVERRIDE;
const SfxItemSet* GetOutputItemSet() const;
diff --git a/sd/source/ui/inc/PreviewRenderer.hxx b/sd/source/ui/inc/PreviewRenderer.hxx
index ec7c5fadcadc..7784b00630c7 100644
--- a/sd/source/ui/inc/PreviewRenderer.hxx
+++ b/sd/source/ui/inc/PreviewRenderer.hxx
@@ -126,7 +126,7 @@ protected:
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE;
private:
- ::std::unique_ptr<VirtualDevice> mpPreviewDevice;
+ ScopedVclPtr<VirtualDevice> mpPreviewDevice;
::std::unique_ptr<DrawView> mpView;
DrawDocShell* mpDocShellOfView;
const Color maFrameColor;
diff --git a/sd/source/ui/inc/Ruler.hxx b/sd/source/ui/inc/Ruler.hxx
index 64d214f77420..9186ebdf3f0e 100644
--- a/sd/source/ui/inc/Ruler.hxx
+++ b/sd/source/ui/inc/Ruler.hxx
@@ -41,6 +41,7 @@ public:
SfxBindings& rBindings,
WinBits nWinStyle);
virtual ~Ruler();
+ virtual void dispose() SAL_OVERRIDE;
void SetNullOffset(const Point& rOffset);
@@ -49,7 +50,7 @@ public:
using ::Ruler::SetNullOffset;
protected:
::sd::View* pSdView;
- ::sd::Window* pSdWin;
+ VclPtr<::sd::Window> pSdWin;
DrawViewShell* pDrViewShell;
RulerCtrlItem* pCtrlItem;
bool bHorz;
diff --git a/sd/source/ui/inc/SlideSorter.hxx b/sd/source/ui/inc/SlideSorter.hxx
index 8854e242eee1..940ec902a27d 100644
--- a/sd/source/ui/inc/SlideSorter.hxx
+++ b/sd/source/ui/inc/SlideSorter.hxx
@@ -29,6 +29,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/current_function.hpp>
+#include <vcl/scrbar.hxx>
class ScrollBar;
class ScrollBarBox;
@@ -55,8 +56,6 @@ class SlotManager;
class Properties;
} } }
-typedef ::boost::shared_ptr<sd::Window> SharedSdWindow;
-
namespace sd { namespace slidesorter {
/** Show previews for all the slides in a document and allow the user to
@@ -98,10 +97,10 @@ public:
*/
static ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
ViewShell& rViewShell,
- const ::boost::shared_ptr<sd::Window>& rpContentWindow,
- const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
- const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
- const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
+ sd::Window* pContentWindow,
+ ScrollBar* pHorizontalScrollBar,
+ ScrollBar* pVerticalScrollBar,
+ ScrollBarBox* pScrollBarBox);
/** Create a new slide sorter that is losely coupled to the given view
shell. The view shell may even be missing.
@@ -120,21 +119,21 @@ public:
/** Return the control of the vertical scroll bar.
*/
- ::boost::shared_ptr<ScrollBar> GetVerticalScrollBar() const { return mpVerticalScrollBar;}
+ VclPtr<ScrollBar> GetVerticalScrollBar() const { return mpVerticalScrollBar;}
/** Return the control of the horizontal scroll bar.
*/
- ::boost::shared_ptr<ScrollBar> GetHorizontalScrollBar() const { return mpHorizontalScrollBar;}
+ VclPtr<ScrollBar> GetHorizontalScrollBar() const { return mpHorizontalScrollBar;}
/** Return the scroll bar filler that paints the little square that is
enclosed by the two scroll bars.
*/
- ::boost::shared_ptr<ScrollBarBox> GetScrollBarFiller() const { return mpScrollBarBox;}
+ VclPtr<ScrollBarBox> GetScrollBarFiller (void) const { return mpScrollBarBox;}
/** Return the content window. This is a sibling and is geometrically
enclosed by the scroll bars.
*/
- SharedSdWindow GetContentWindow() const { return mpContentWindow;}
+ VclPtr<sd::Window> GetContentWindow() const { return mpContentWindow;}
model::SlideSorterModel& GetModel() const;
@@ -222,11 +221,11 @@ private:
::com::sun::star::uno::WeakReference<com::sun::star::frame::XController> mxControllerWeak;
ViewShell* mpViewShell;
ViewShellBase* mpViewShellBase;
- SharedSdWindow mpContentWindow;
+ VclPtr<sd::Window> mpContentWindow;
bool mbOwnesContentWindow;
- ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
- ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
- ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
+ VclPtr<ScrollBar> mpHorizontalScrollBar;
+ VclPtr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<ScrollBarBox> mpScrollBarBox;
/** Set this flag to <TRUE/> to force a layout before the next paint.
*/
@@ -240,10 +239,10 @@ private:
SlideSorter (
ViewShell& rViewShell,
- const ::boost::shared_ptr<sd::Window>& rpContentWindow,
- const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
- const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
- const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
+ sd::Window* pContentWindow,
+ ScrollBar* pHorizontalScrollBar,
+ ScrollBar* pVerticalScrollBar,
+ ScrollBarBox* pScrollBarBox);
SlideSorter (
ViewShellBase& rBase,
ViewShell* pViewShell,
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 1b22016d93e2..f4823faa8cdd 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -59,8 +59,8 @@ class ViewClipboard;
// SdViewRedrawRec
struct SdViewRedrawRec
{
- OutputDevice* mpOut;
- Rectangle aRect;
+ VclPtr<OutputDevice> mpOut;
+ Rectangle aRect;
};
//For master view we want to force that master
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 1b46129e1087..53ffbfd756f7 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -465,26 +465,26 @@ protected:
document.
*/
- ::boost::shared_ptr<sd::Window> mpContentWindow;
+ VclPtr<sd::Window> mpContentWindow;
/// Horizontal scroll bar for the current slide is displayed when needed.
- ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
+ VclPtr<ScrollBar> mpHorizontalScrollBar;
/// Vertical scroll bar for whole document is always visible.
- ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<ScrollBar> mpVerticalScrollBar;
/// Horizontal ruler is not shown by default.
- ::std::unique_ptr<SvxRuler> mpHorizontalRuler;
+ VclPtr<SvxRuler> mpHorizontalRuler;
/// Vertical ruler is not shown by default.
- ::std::unique_ptr<SvxRuler> mpVerticalRuler;
+ VclPtr<SvxRuler> mpVerticalRuler;
/// Filler of the little square enclosed by the two scroll bars.
- ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
+ VclPtr<ScrollBarBox> mpScrollBarBox;
/// Layer tab bar.
- ::std::unique_ptr<LayerTabBar> mpLayerTabBar;
+ VclPtr<LayerTabBar> mpLayerTabBar;
/// This flag controls whether the rulers are visible.
bool mbHasRulers;
/// The active window.
- ::sd::Window* mpActiveWindow;
+ VclPtr<::sd::Window> mpActiveWindow;
::sd::View* mpView;
FrameView* mpFrameView;
@@ -568,7 +568,7 @@ protected:
void doShow();
private:
- ::vcl::Window* mpParentWindow;
+ VclPtr<::vcl::Window> mpParentWindow;
/** This window updater is used to keep all relevant windows up to date
with reference to the digit language used to display digits in text
shapes.
diff --git a/sd/source/ui/inc/ViewTabBar.hxx b/sd/source/ui/inc/ViewTabBar.hxx
index f3b40694cc33..82ed1d584df2 100644
--- a/sd/source/ui/inc/ViewTabBar.hxx
+++ b/sd/source/ui/inc/ViewTabBar.hxx
@@ -67,7 +67,7 @@ public:
virtual void SAL_CALL disposing() SAL_OVERRIDE;
- ::boost::shared_ptr< ::TabControl> GetTabControl() const { return mpTabControl;}
+ VclPtr<::TabControl> GetTabControl() const { return mpTabControl;}
bool ActivatePage();
@@ -149,14 +149,14 @@ public:
GetTabBarButtons();
private:
- ::boost::shared_ptr< ::TabControl> mpTabControl;
+ VclPtr< ::TabControl> mpTabControl;
::com::sun::star::uno::Reference<
::com::sun::star::frame::XController> mxController;
::com::sun::star::uno::Reference<
::com::sun::star::drawing::framework::XConfigurationController> mxConfigurationController;
typedef ::std::vector<com::sun::star::drawing::framework::TabBarButton> TabBarButtonList;
TabBarButtonList maTabBarButtons;
- ::boost::scoped_ptr<TabPage> mpTabPage;
+ VclPtr<TabPage> mpTabPage;
::com::sun::star::uno::Reference<
::com::sun::star::drawing::framework::XResourceId> mxViewTabBarId;
ViewShellBase* mpViewShellBase;
diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx
index 718c17842a5b..bd83e2146491 100644
--- a/sd/source/ui/inc/Window.hxx
+++ b/sd/source/ui/inc/Window.hxx
@@ -45,7 +45,8 @@ class Window
{
public:
Window (vcl::Window* pParent);
- virtual ~Window();
+ virtual ~Window ();
+ virtual void dispose() SAL_OVERRIDE;
void SetViewShell (ViewShell* pViewSh);
@@ -149,7 +150,7 @@ public:
void DropScroll (const Point& rMousePos);
virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
protected:
- ::sd::Window* mpShareWin;
+ VclPtr<::sd::Window> mpShareWin;
Point maWinPos;
Point maViewOrigin;
Size maViewSize;
diff --git a/sd/source/ui/inc/WindowUpdater.hxx b/sd/source/ui/inc/WindowUpdater.hxx
index f7f2a1830a64..626dda1bbe34 100644
--- a/sd/source/ui/inc/WindowUpdater.hxx
+++ b/sd/source/ui/inc/WindowUpdater.hxx
@@ -22,6 +22,7 @@
#include <svl/lstner.hxx>
#include <svl/ctloptions.hxx>
+#include <vcl/vclptr.hxx>
#include "sddllapi.h"
#include <vector>
@@ -120,7 +121,7 @@ private:
/** Type and data member for a list of devices that have to be kept
up-to-date.
*/
- typedef ::std::vector< vcl::Window*> tWindowList;
+ typedef ::std::vector< VclPtr<vcl::Window> > tWindowList;
tWindowList maWindowList;
/** The central method of this class. Update the given output device.
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
index 45a9a3e8d354..20f3ffeccddd 100644
--- a/sd/source/ui/inc/animobjs.hxx
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -85,6 +85,7 @@ class AnimationWindow : public SfxDockingWindow
public:
AnimationWindow(SfxBindings* pBindings, SfxChildWindow *pCW, vcl::Window* pParent);
virtual ~AnimationWindow();
+ virtual void dispose() SAL_OVERRIDE;
void AddObj( ::sd::View& rView );
void CreateAnimObj( ::sd::View& rView );
@@ -97,28 +98,28 @@ protected:
virtual void FillInfo( SfxChildWinInfo& ) const SAL_OVERRIDE;
private:
- SdDisplay* m_pCtlDisplay;
- PushButton* m_pBtnFirst;
- PushButton* m_pBtnReverse;
- PushButton* m_pBtnStop;
- PushButton* m_pBtnPlay;
- PushButton* m_pBtnLast;
- NumericField* m_pNumFldBitmap;
- TimeField* m_pTimeField;
- ListBox* m_pLbLoopCount;
- PushButton* m_pBtnGetOneObject;
- PushButton* m_pBtnGetAllObjects;
- PushButton* m_pBtnRemoveBitmap;
- PushButton* m_pBtnRemoveAll;
- FixedText* m_pFiCount;
-
- RadioButton* m_pRbtGroup;
- RadioButton* m_pRbtBitmap;
- FixedText* m_pFtAdjustment;
- ListBox* m_pLbAdjustment;
- PushButton* m_pBtnCreateGroup;
-
- vcl::Window* pWin;
+ VclPtr<SdDisplay> m_pCtlDisplay;
+ VclPtr<PushButton> m_pBtnFirst;
+ VclPtr<PushButton> m_pBtnReverse;
+ VclPtr<PushButton> m_pBtnStop;
+ VclPtr<PushButton> m_pBtnPlay;
+ VclPtr<PushButton> m_pBtnLast;
+ VclPtr<NumericField> m_pNumFldBitmap;
+ VclPtr<TimeField> m_pTimeField;
+ VclPtr<ListBox> m_pLbLoopCount;
+ VclPtr<PushButton> m_pBtnGetOneObject;
+ VclPtr<PushButton> m_pBtnGetAllObjects;
+ VclPtr<PushButton> m_pBtnRemoveBitmap;
+ VclPtr<PushButton> m_pBtnRemoveAll;
+ VclPtr<FixedText> m_pFiCount;
+
+ VclPtr<RadioButton> m_pRbtGroup;
+ VclPtr<RadioButton> m_pRbtBitmap;
+ VclPtr<FixedText> m_pFtAdjustment;
+ VclPtr<ListBox> m_pLbAdjustment;
+ VclPtr<PushButton> m_pBtnCreateGroup;
+
+ VclPtr<vcl::Window> pWin;
::std::vector< ::std::pair<BitmapEx*, ::tools::Time*> > m_FrameList;
static const size_t EMPTY_FRAMELIST;
size_t m_nCurrentFrame;
@@ -163,7 +164,7 @@ protected:
virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
private:
- AnimationWindow* pAnimationWin;
+ VclPtr<AnimationWindow> pAnimationWin;
};
} // end of namespace sd
diff --git a/sd/source/ui/inc/assclass.hxx b/sd/source/ui/inc/assclass.hxx
index 3e95415d7a9d..6a0709da717a 100644
--- a/sd/source/ui/inc/assclass.hxx
+++ b/sd/source/ui/inc/assclass.hxx
@@ -33,7 +33,7 @@ class SD_DLLPUBLIC Assistent
{
/** contains for every page the controls, which have to be
connected? correctly */
- std::vector<vcl::Window*> maPages[MAX_PAGES];
+ std::vector<VclPtr<vcl::Window> > maPages[MAX_PAGES];
/// number of pages
int mnPages;
diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx
index 7a9d696f62e1..1da44c927a6c 100644
--- a/sd/source/ui/inc/copydlg.hxx
+++ b/sd/source/ui/inc/copydlg.hxx
@@ -42,26 +42,27 @@ public:
CopyDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs,
const XColorListRef &pColList, ::sd::View* pView );
virtual ~CopyDlg();
+ virtual void dispose() SAL_OVERRIDE;
void GetAttr( SfxItemSet& rOutAttrs );
void Reset();
private:
- NumericField* m_pNumFldCopies;
- Button* m_pBtnSetViewData;
+ VclPtr<NumericField> m_pNumFldCopies;
+ VclPtr<Button> m_pBtnSetViewData;
- MetricField* m_pMtrFldMoveX;
- MetricField* m_pMtrFldMoveY;
- MetricField* m_pMtrFldAngle;
+ VclPtr<MetricField> m_pMtrFldMoveX;
+ VclPtr<MetricField> m_pMtrFldMoveY;
+ VclPtr<MetricField> m_pMtrFldAngle;
- MetricField* m_pMtrFldWidth;
- MetricField* m_pMtrFldHeight;
+ VclPtr<MetricField> m_pMtrFldWidth;
+ VclPtr<MetricField> m_pMtrFldHeight;
- ColorLB* m_pLbStartColor;
- FixedText* m_pFtEndColor;
- ColorLB* m_pLbEndColor;
+ VclPtr<ColorLB> m_pLbStartColor;
+ VclPtr<FixedText> m_pFtEndColor;
+ VclPtr<ColorLB> m_pLbEndColor;
- PushButton* m_pBtnSetDefault;
+ VclPtr<PushButton> m_pBtnSetDefault;
const SfxItemSet& mrOutAttrs;
XColorListRef mpColorList;
diff --git a/sd/source/ui/inc/createtabledesignpanel.hxx b/sd/source/ui/inc/createtabledesignpanel.hxx
index 2d8f1c36f504..44fc06e19334 100644
--- a/sd/source/ui/inc/createtabledesignpanel.hxx
+++ b/sd/source/ui/inc/createtabledesignpanel.hxx
@@ -21,10 +21,11 @@
#define INCLUDED_SD_SOURCE_UI_INC_CREATETABLEDESIGNPANEL_HXX
#include <sal/config.h>
+#include <vcl/vclptr.hxx>
namespace sd {
-::vcl::Window * createTableDesignPanel (::vcl::Window* pParent, ViewShellBase& rBase);
+VclPtr<::vcl::Window> createTableDesignPanel (::vcl::Window* pParent, ViewShellBase& rBase);
}
diff --git a/sd/source/ui/inc/custsdlg.hxx b/sd/source/ui/inc/custsdlg.hxx
index 54f1cfe6b73b..4fcbc7d54c75 100644
--- a/sd/source/ui/inc/custsdlg.hxx
+++ b/sd/source/ui/inc/custsdlg.hxx
@@ -34,15 +34,15 @@ class SdCustomShowList;
class SdCustomShowDlg : public ModalDialog
{
private:
- ListBox* m_pLbCustomShows;
- CheckBox* m_pCbxUseCustomShow;
- PushButton* m_pBtnNew;
- PushButton* m_pBtnEdit;
- PushButton* m_pBtnRemove;
- PushButton* m_pBtnCopy;
- HelpButton* m_pBtnHelp;
- PushButton* m_pBtnStartShow;
- OKButton* m_pBtnOK;
+ VclPtr<ListBox> m_pLbCustomShows;
+ VclPtr<CheckBox> m_pCbxUseCustomShow;
+ VclPtr<PushButton> m_pBtnNew;
+ VclPtr<PushButton> m_pBtnEdit;
+ VclPtr<PushButton> m_pBtnRemove;
+ VclPtr<PushButton> m_pBtnCopy;
+ VclPtr<HelpButton> m_pBtnHelp;
+ VclPtr<PushButton> m_pBtnStartShow;
+ VclPtr<OKButton> m_pBtnOK;
SdDrawDocument& rDoc;
SdCustomShowList* pCustomShowList;
@@ -57,22 +57,22 @@ private:
public:
SdCustomShowDlg( vcl::Window* pWindow, SdDrawDocument& rDrawDoc );
virtual ~SdCustomShowDlg();
-
- bool IsModified() const { return bModified; }
- bool IsCustomShow() const;
+ virtual void dispose() SAL_OVERRIDE;
+ bool IsModified() const { return bModified; }
+ bool IsCustomShow() const;
};
class SdDefineCustomShowDlg : public ModalDialog
{
private:
- Edit* m_pEdtName;
- ListBox* m_pLbPages;
- PushButton* m_pBtnAdd;
- PushButton* m_pBtnRemove;
- SvTreeListBox* m_pLbCustomPages;
- OKButton* m_pBtnOK;
- CancelButton* m_pBtnCancel;
- HelpButton* m_pBtnHelp;
+ VclPtr<Edit> m_pEdtName;
+ VclPtr<ListBox> m_pLbPages;
+ VclPtr<PushButton> m_pBtnAdd;
+ VclPtr<PushButton> m_pBtnRemove;
+ VclPtr<SvTreeListBox> m_pLbCustomPages;
+ VclPtr<OKButton> m_pBtnOK;
+ VclPtr<CancelButton> m_pBtnCancel;
+ VclPtr<HelpButton> m_pBtnHelp;
SdDrawDocument& rDoc;
SdCustomShow*& rpCustomShow;
@@ -90,6 +90,7 @@ public:
SdDefineCustomShowDlg( vcl::Window* pWindow,
SdDrawDocument& rDrawDoc, SdCustomShow*& rpCS );
virtual ~SdDefineCustomShowDlg();
+ virtual void dispose() SAL_OVERRIDE;
bool IsModified() const { return bModified; }
};
diff --git a/sd/source/ui/inc/diactrl.hxx b/sd/source/ui/inc/diactrl.hxx
index fdb61e8dca23..a6f6006445ad 100644
--- a/sd/source/ui/inc/diactrl.hxx
+++ b/sd/source/ui/inc/diactrl.hxx
@@ -55,7 +55,7 @@ class SdTbxCtlDiaPages : public SfxToolBoxControl
public:
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;
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/sd/source/ui/inc/dlgass.hxx b/sd/source/ui/inc/dlgass.hxx
index 4ee19ec4abe2..b9f9136e2fd3 100644
--- a/sd/source/ui/inc/dlgass.hxx
+++ b/sd/source/ui/inc/dlgass.hxx
@@ -43,6 +43,7 @@ private:
public:
AssistentDlg(vcl::Window* pParent, bool bAutoPilot);
virtual ~AssistentDlg();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK( FinishHdl, void * );
diff --git a/sd/source/ui/inc/dlgctrls.hxx b/sd/source/ui/inc/dlgctrls.hxx
index daa1ad28ac4f..5cb90587b76b 100644
--- a/sd/source/ui/inc/dlgctrls.hxx
+++ b/sd/source/ui/inc/dlgctrls.hxx
@@ -37,7 +37,8 @@ class SD_DLLPUBLIC FadeEffectLB : public ListBox
public:
FadeEffectLB(vcl::Window* pParent, WinBits nStyle);
virtual ~FadeEffectLB();
- void Fill();
+ virtual void dispose() SAL_OVERRIDE;
+ void Fill();
/* void selectEffectFromPage( SdPage* pPage ); */
void applySelected( SdPage* pSlide ) const;
diff --git a/sd/source/ui/inc/dlgfield.hxx b/sd/source/ui/inc/dlgfield.hxx
index b458b8df84b9..fe11b0768b45 100644
--- a/sd/source/ui/inc/dlgfield.hxx
+++ b/sd/source/ui/inc/dlgfield.hxx
@@ -34,10 +34,10 @@ class SvxFieldData;
class SdModifyFieldDlg : public ModalDialog
{
private:
- RadioButton* m_pRbtFix;
- RadioButton* m_pRbtVar;
- SvxLanguageBox* m_pLbLanguage;
- ListBox* m_pLbFormat;
+ VclPtr<RadioButton> m_pRbtFix;
+ VclPtr<RadioButton> m_pRbtVar;
+ VclPtr<SvxLanguageBox> m_pLbLanguage;
+ VclPtr<ListBox> m_pLbFormat;
SfxItemSet maInputSet;
const SvxFieldData* pField;
@@ -49,7 +49,8 @@ private:
public:
SdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet );
- virtual ~SdModifyFieldDlg() {}
+ virtual ~SdModifyFieldDlg();
+ virtual void dispose() SAL_OVERRIDE;
SvxFieldData* GetField();
SfxItemSet GetItemSet();
diff --git a/sd/source/ui/inc/dlgsnap.hxx b/sd/source/ui/inc/dlgsnap.hxx
index ab431c856be3..f17a7c5c3413 100644
--- a/sd/source/ui/inc/dlgsnap.hxx
+++ b/sd/source/ui/inc/dlgsnap.hxx
@@ -41,15 +41,15 @@ namespace sd {
class SdSnapLineDlg : public ModalDialog
{
private:
- FixedText* m_pFtX;
- MetricField* m_pMtrFldX;
- FixedText* m_pFtY;
- MetricField* m_pMtrFldY;
- VclContainer* m_pRadioGroup;
- RadioButton* m_pRbPoint;
- RadioButton* m_pRbVert;
- RadioButton* m_pRbHorz;
- PushButton* m_pBtnDelete;
+ VclPtr<FixedText> m_pFtX;
+ VclPtr<MetricField> m_pMtrFldX;
+ VclPtr<FixedText> m_pFtY;
+ VclPtr<MetricField> m_pMtrFldY;
+ VclPtr<VclContainer> m_pRadioGroup;
+ VclPtr<RadioButton> m_pRbPoint;
+ VclPtr<RadioButton> m_pRbVert;
+ VclPtr<RadioButton> m_pRbHorz;
+ VclPtr<PushButton> m_pBtnDelete;
long nXValue;
long nYValue;
FieldUnit eUIUnit;
@@ -59,6 +59,8 @@ private:
public:
SdSnapLineDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView);
+ virtual ~SdSnapLineDlg();
+ virtual void dispose() SAL_OVERRIDE;
void GetAttr(SfxItemSet& rOutAttrs);
diff --git a/sd/source/ui/inc/docprev.hxx b/sd/source/ui/inc/docprev.hxx
index b4d3b28a8c73..ea1e5876211d 100644
--- a/sd/source/ui/inc/docprev.hxx
+++ b/sd/source/ui/inc/docprev.hxx
@@ -65,6 +65,7 @@ protected:
public:
SdDocPreviewWin( vcl::Window* pParent, const WinBits nStyle );
virtual ~SdDocPreviewWin();
+ virtual void dispose() SAL_OVERRIDE;
void SetObjectShell( SfxObjectShell* pObj, sal_uInt16 nShowPage = 0 );
virtual void Resize() SAL_OVERRIDE;
void startPreview();
diff --git a/sd/source/ui/inc/drawview.hxx b/sd/source/ui/inc/drawview.hxx
index 7d4ad1c6780a..d9fc8b5b7ec1 100644
--- a/sd/source/ui/inc/drawview.hxx
+++ b/sd/source/ui/inc/drawview.hxx
@@ -65,7 +65,7 @@ protected:
private:
DrawDocShell* mpDocShell;
DrawViewShell* mpDrawViewShell;
- VirtualDevice* mpVDev;
+ VclPtr<VirtualDevice> mpVDev;
sal_uInt16 mnPOCHSmph; ///< for blocking PageOrderChangedHint
};
diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx
index e9c94df151db..a38ae7bb1103 100644
--- a/sd/source/ui/inc/framework/Pane.hxx
+++ b/sd/source/ui/inc/framework/Pane.hxx
@@ -29,6 +29,7 @@
#include <cppuhelper/compbase3.hxx>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
@@ -135,7 +136,7 @@ public:
protected:
::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow;
::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas;
diff --git a/sd/source/ui/inc/fupoor.hxx b/sd/source/ui/inc/fupoor.hxx
index 9f50c75ed925..f127a167bf8e 100644
--- a/sd/source/ui/inc/fupoor.hxx
+++ b/sd/source/ui/inc/fupoor.hxx
@@ -82,7 +82,7 @@ public:
virtual void Activate(); ///< activates the function
virtual void Deactivate(); ///< deactivates the function
- void SetWindow(::sd::Window* pWin) { mpWindow = pWin; }
+ void SetWindow(::sd::Window* pWin);
virtual void SelectionHasChanged();
@@ -150,14 +150,14 @@ protected:
::sd::View* mpView;
ViewShell* mpViewShell;
- ::sd::Window* mpWindow;
+ VclPtr<::sd::Window> mpWindow;
DrawDocShell* mpDocSh;
SdDrawDocument* mpDoc;
sal_uInt16 nSlotId;
sal_uInt16 nSlotValue;
- Dialog* pDialog;
+ VclPtr<Dialog> pDialog;
Timer aScrollTimer; ///< for auto-scrolling
DECL_LINK( ScrollHdl, void * );
diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx
index d3b2e0a8055b..fde273c0aaa3 100644
--- a/sd/source/ui/inc/gluectrl.hxx
+++ b/sd/source/ui/inc/gluectrl.hxx
@@ -51,7 +51,7 @@ private:
public:
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;
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/sd/source/ui/inc/headerfooterdlg.hxx b/sd/source/ui/inc/headerfooterdlg.hxx
index 6f19a555b962..4206cd4dc62b 100644
--- a/sd/source/ui/inc/headerfooterdlg.hxx
+++ b/sd/source/ui/inc/headerfooterdlg.hxx
@@ -44,17 +44,17 @@ private:
DECL_LINK( ClickApplyHdl, void * );
DECL_LINK( ClickCancelHdl, void * );
- TabControl* mpTabCtrl;
+ VclPtr<TabControl> mpTabCtrl;
- HeaderFooterTabPage* mpSlideTabPage;
- HeaderFooterTabPage* mpNotesHandoutsTabPage;
+ VclPtr<HeaderFooterTabPage> mpSlideTabPage;
+ VclPtr<HeaderFooterTabPage> mpNotesHandoutsTabPage;
sal_uInt16 mnSlidesId;
sal_uInt16 mnNotesId;
- PushButton* maPBApplyToAll;
- PushButton* maPBApply;
- CancelButton* maPBCancel;
+ VclPtr<PushButton> maPBApplyToAll;
+ VclPtr<PushButton> maPBApply;
+ VclPtr<CancelButton> maPBCancel;
HeaderFooterSettings maSlideSettings;
HeaderFooterSettings maNotesHandoutSettings;
@@ -69,6 +69,7 @@ private:
public:
HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage );
virtual ~HeaderFooterDialog();
+ virtual void dispose() SAL_OVERRIDE;
void ApplyToAll();
void Apply();
diff --git a/sd/source/ui/inc/ins_paste.hxx b/sd/source/ui/inc/ins_paste.hxx
index 0cd396f4c31a..78362535242b 100644
--- a/sd/source/ui/inc/ins_paste.hxx
+++ b/sd/source/ui/inc/ins_paste.hxx
@@ -31,11 +31,13 @@
class SD_DLLPUBLIC SdInsertPasteDlg : public ModalDialog
{
private:
- RadioButton* m_pRbBefore;
- RadioButton* m_pRbAfter;
+ VclPtr<RadioButton> m_pRbBefore;
+ VclPtr<RadioButton> m_pRbAfter;
public:
SdInsertPasteDlg( vcl::Window* pWindow );
+ virtual ~SdInsertPasteDlg();
+ virtual void dispose() SAL_OVERRIDE;
bool IsInsertBefore() const;
};
diff --git a/sd/source/ui/inc/inspagob.hxx b/sd/source/ui/inc/inspagob.hxx
index f7a0e12ae859..7dd1c7541b94 100644
--- a/sd/source/ui/inc/inspagob.hxx
+++ b/sd/source/ui/inc/inspagob.hxx
@@ -29,9 +29,9 @@ class SdDrawDocument;
class SdInsertPagesObjsDlg : public ModalDialog
{
private:
- SdPageObjsTLB* m_pLbTree;
- CheckBox* m_pCbxLink;
- CheckBox* m_pCbxMasters;
+ VclPtr<SdPageObjsTLB> m_pLbTree;
+ VclPtr<CheckBox> m_pCbxLink;
+ VclPtr<CheckBox> m_pCbxMasters;
SfxMedium* pMedium;
const SdDrawDocument* mpDoc;
@@ -46,6 +46,7 @@ public:
SfxMedium* pSfxMedium,
const OUString& rFileName );
virtual ~SdInsertPagesObjsDlg();
+ virtual void dispose() SAL_OVERRIDE;
/** returns the list
nType == 0 -> pages
diff --git a/sd/source/ui/inc/layeroptionsdlg.hxx b/sd/source/ui/inc/layeroptionsdlg.hxx
index e3ad80873223..ec0b1d24ad30 100644
--- a/sd/source/ui/inc/layeroptionsdlg.hxx
+++ b/sd/source/ui/inc/layeroptionsdlg.hxx
@@ -35,12 +35,12 @@ class SfxItemSet;
class SD_DLLPUBLIC SdInsertLayerDlg : public ModalDialog
{
private:
- Edit* m_pEdtName;
- Edit* m_pEdtTitle;
- VclMultiLineEdit* m_pEdtDesc;
- CheckBox* m_pCbxVisible;
- CheckBox* m_pCbxPrintable;
- CheckBox* m_pCbxLocked;
+ VclPtr<Edit> m_pEdtName;
+ VclPtr<Edit> m_pEdtTitle;
+ VclPtr<VclMultiLineEdit> m_pEdtDesc;
+ VclPtr<CheckBox> m_pCbxVisible;
+ VclPtr<CheckBox> m_pCbxPrintable;
+ VclPtr<CheckBox> m_pCbxLocked;
const SfxItemSet& mrOutAttrs;
@@ -48,6 +48,9 @@ public:
SdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs,
bool bDeletable, const OUString& rStr );
+ virtual ~SdInsertLayerDlg();
+ virtual void dispose() SAL_OVERRIDE;
+
void GetAttr( SfxItemSet& rOutAttrs );
};
diff --git a/sd/source/ui/inc/masterlayoutdlg.hxx b/sd/source/ui/inc/masterlayoutdlg.hxx
index b6c216944d8b..f6be32bc6ab1 100644
--- a/sd/source/ui/inc/masterlayoutdlg.hxx
+++ b/sd/source/ui/inc/masterlayoutdlg.hxx
@@ -37,11 +37,11 @@ private:
SdDrawDocument* mpDoc;
SdPage* mpCurrentPage;
- CheckBox* mpCBDate;
- CheckBox* mpCBPageNumber;
- CheckBox* mpCBSlideNumber;
- CheckBox* mpCBHeader;
- CheckBox* mpCBFooter;
+ VclPtr<CheckBox> mpCBDate;
+ VclPtr<CheckBox> mpCBPageNumber;
+ VclPtr<CheckBox> mpCBSlideNumber;
+ VclPtr<CheckBox> mpCBHeader;
+ VclPtr<CheckBox> mpCBFooter;
bool mbOldHeader;
bool mbOldFooter;
@@ -54,6 +54,8 @@ private:
public:
MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage );
+ virtual ~MasterLayoutDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
};
diff --git a/sd/source/ui/inc/morphdlg.hxx b/sd/source/ui/inc/morphdlg.hxx
index 06b5b3624495..f675535a1ba1 100644
--- a/sd/source/ui/inc/morphdlg.hxx
+++ b/sd/source/ui/inc/morphdlg.hxx
@@ -39,6 +39,7 @@ public:
const SdrObject* pObj1,
const SdrObject* pObj2);
virtual ~MorphDlg();
+ virtual void dispose() SAL_OVERRIDE;
void SaveSettings() const;
sal_uInt16 GetFadeSteps() const { return (sal_uInt16) m_pMtfSteps->GetValue(); }
@@ -46,9 +47,9 @@ public:
bool IsOrientationFade() const { return m_pCbxOrientation->IsChecked(); }
private:
- NumericField* m_pMtfSteps;
- CheckBox* m_pCbxAttributes;
- CheckBox* m_pCbxOrientation;
+ VclPtr<NumericField> m_pMtfSteps;
+ VclPtr<CheckBox> m_pCbxAttributes;
+ VclPtr<CheckBox> m_pCbxOrientation;
void LoadSettings();
};
diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx
index b5771f38b92e..e6dff433bc22 100644
--- a/sd/source/ui/inc/navigatr.hxx
+++ b/sd/source/ui/inc/navigatr.hxx
@@ -98,6 +98,7 @@ public:
SfxBindings* pBindings,
const UpdateRequestFunctor& rUpdateRequest);
virtual ~SdNavigatorWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
@@ -118,9 +119,9 @@ private:
friend class SdNavigatorControllerItem;
friend class SdPageNameControllerItem;
- ToolBox maToolbox;
- SdPageObjsTLB maTlbObjects;
- ListBox maLbDocs;
+ VclPtr<ToolBox> maToolbox;
+ VclPtr<SdPageObjsTLB> maTlbObjects;
+ VclPtr<ListBox> maLbDocs;
::sd::NavigatorChildWindow* mpChildWinContext;
Size maSize;
@@ -177,7 +178,7 @@ protected:
const SfxPoolItem* pState ) SAL_OVERRIDE;
private:
- SdNavigatorWin* pNavigatorWin;
+ VclPtr<SdNavigatorWin> pNavigatorWin;
const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
};
@@ -195,7 +196,7 @@ protected:
const SfxPoolItem* pState ) SAL_OVERRIDE;
private:
- SdNavigatorWin* pNavigatorWin;
+ VclPtr<SdNavigatorWin> pNavigatorWin;
const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest;
};
diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx
index ea2fcde3e25d..0398823c783d 100644
--- a/sd/source/ui/inc/present.hxx
+++ b/sd/source/ui/inc/present.hxx
@@ -37,37 +37,37 @@ class SdStartPresentationDlg : public ModalDialog
{
private:
- RadioButton* aRbtAll;
- RadioButton* aRbtAtDia;
- RadioButton* aRbtCustomshow;
- ListBox* aLbDias;
- ListBox* aLbCustomshow;
+ VclPtr<RadioButton> aRbtAll;
+ VclPtr<RadioButton> aRbtAtDia;
+ VclPtr<RadioButton> aRbtCustomshow;
+ VclPtr<ListBox> aLbDias;
+ VclPtr<ListBox> aLbCustomshow;
- RadioButton* aRbtStandard;
- RadioButton* aRbtWindow;
- RadioButton* aRbtAuto;
- TimeField* aTmfPause;
- CheckBox* aCbxAutoLogo;
+ VclPtr<RadioButton> aRbtStandard;
+ VclPtr<RadioButton> aRbtWindow;
+ VclPtr<RadioButton> aRbtAuto;
+ VclPtr<TimeField> aTmfPause;
+ VclPtr<CheckBox> aCbxAutoLogo;
- CheckBox* aCbxManuel;
- CheckBox* aCbxMousepointer;
- CheckBox* aCbxPen;
- CheckBox* aCbxNavigator;
- CheckBox* aCbxAnimationAllowed;
- CheckBox* aCbxChangePage;
- CheckBox* aCbxAlwaysOnTop;
+ VclPtr<CheckBox> aCbxManuel;
+ VclPtr<CheckBox> aCbxMousepointer;
+ VclPtr<CheckBox> aCbxPen;
+ VclPtr<CheckBox> aCbxNavigator;
+ VclPtr<CheckBox> aCbxAnimationAllowed;
+ VclPtr<CheckBox> aCbxChangePage;
+ VclPtr<CheckBox> aCbxAlwaysOnTop;
- FixedText* maFtMonitor;
- ListBox* maLBMonitor;
+ VclPtr<FixedText> maFtMonitor;
+ VclPtr<ListBox> maLBMonitor;
SdCustomShowList* pCustomShowList;
const SfxItemSet& rOutAttrs;
sal_Int32 mnMonitors;
- FixedText* msMonitor;
- FixedText* msAllMonitors;
- FixedText* msMonitorExternal;
- FixedText* msExternal;
+ VclPtr<FixedText> msMonitor;
+ VclPtr<FixedText> msAllMonitors;
+ VclPtr<FixedText> msMonitorExternal;
+ VclPtr<FixedText> msExternal;
DECL_LINK( ChangeRangeHdl, void * );
DECL_LINK( ClickWindowPresentationHdl, void * );
@@ -88,6 +88,8 @@ public:
const SfxItemSet& rInAttrs,
const std::vector<OUString> &rPageNames,
SdCustomShowList* pCSList );
+ virtual ~SdStartPresentationDlg();
+ virtual void dispose() SAL_OVERRIDE;
void GetAttr( SfxItemSet& rOutAttrs );
};
diff --git a/sd/source/ui/inc/prltempl.hxx b/sd/source/ui/inc/prltempl.hxx
index 71c6c3f9b8ef..a4e5cca4e2e8 100644
--- a/sd/source/ui/inc/prltempl.hxx
+++ b/sd/source/ui/inc/prltempl.hxx
@@ -86,6 +86,7 @@ private:
public:
SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, vcl::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool );
virtual ~SdPresLayoutTemplateDlg();
+ virtual void dispose() SAL_OVERRIDE;
const SfxItemSet* GetOutputItemSet() const;
};
diff --git a/sd/source/ui/inc/prntopts.hxx b/sd/source/ui/inc/prntopts.hxx
index 9ae6631f435e..4c013ce36db1 100644
--- a/sd/source/ui/inc/prntopts.hxx
+++ b/sd/source/ui/inc/prntopts.hxx
@@ -32,25 +32,25 @@ class SdPrintOptions : public SfxTabPage
friend class SdModule;
private:
- VclFrame *m_pFrmContent;
- CheckBox *m_pCbxDraw;
- CheckBox *m_pCbxNotes;
- CheckBox *m_pCbxHandout;
- CheckBox *m_pCbxOutline;
- RadioButton *m_pRbtColor;
- RadioButton *m_pRbtGrayscale;
- RadioButton *m_pRbtBlackWhite;
- CheckBox *m_pCbxPagename;
- CheckBox *m_pCbxDate;
- CheckBox *m_pCbxTime;
- CheckBox *m_pCbxHiddenPages;
- RadioButton *m_pRbtDefault;
- RadioButton *m_pRbtPagesize;
- RadioButton *m_pRbtPagetile;
- RadioButton *m_pRbtBooklet;
- CheckBox *m_pCbxFront;
- CheckBox *m_pCbxBack;
- CheckBox *m_pCbxPaperbin;
+ VclPtr<VclFrame> m_pFrmContent;
+ VclPtr<CheckBox> m_pCbxDraw;
+ VclPtr<CheckBox> m_pCbxNotes;
+ VclPtr<CheckBox> m_pCbxHandout;
+ VclPtr<CheckBox> m_pCbxOutline;
+ VclPtr<RadioButton> m_pRbtColor;
+ VclPtr<RadioButton> m_pRbtGrayscale;
+ VclPtr<RadioButton> m_pRbtBlackWhite;
+ VclPtr<CheckBox> m_pCbxPagename;
+ VclPtr<CheckBox> m_pCbxDate;
+ VclPtr<CheckBox> m_pCbxTime;
+ VclPtr<CheckBox> m_pCbxHiddenPages;
+ VclPtr<RadioButton> m_pRbtDefault;
+ VclPtr<RadioButton> m_pRbtPagesize;
+ VclPtr<RadioButton> m_pRbtPagetile;
+ VclPtr<RadioButton> m_pRbtBooklet;
+ VclPtr<CheckBox> m_pCbxFront;
+ VclPtr<CheckBox> m_pCbxBack;
+ VclPtr<CheckBox> m_pCbxPaperbin;
const SfxItemSet& rOutAttrs;
@@ -63,8 +63,9 @@ private:
public:
SdPrintOptions( vcl::Window* pParent, const SfxItemSet& rInAttrs);
virtual ~SdPrintOptions();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
diff --git a/sd/source/ui/inc/pubdlg.hxx b/sd/source/ui/inc/pubdlg.hxx
index bbb4f264d8ee..f9670c7b038f 100644
--- a/sd/source/ui/inc/pubdlg.hxx
+++ b/sd/source/ui/inc/pubdlg.hxx
@@ -53,104 +53,104 @@ class SdPublishingDlg : public ModalDialog
{
private:
// page 1 controls
- VclContainer* pPage1;
- FixedText* pPage1_Titel;
- RadioButton* pPage1_NewDesign;
- RadioButton* pPage1_OldDesign;
- ListBox* pPage1_Designs;
- PushButton* pPage1_DelDesign;
- FixedText* pPage1_Desc;
+ VclPtr<VclContainer> pPage1;
+ VclPtr<FixedText> pPage1_Titel;
+ VclPtr<RadioButton> pPage1_NewDesign;
+ VclPtr<RadioButton> pPage1_OldDesign;
+ VclPtr<ListBox> pPage1_Designs;
+ VclPtr<PushButton> pPage1_DelDesign;
+ VclPtr<FixedText> pPage1_Desc;
// page 2 controls
- VclContainer* pPage2;
- VclContainer* pPage2Frame2;
- VclContainer* pPage2Frame3;
- VclContainer* pPage2Frame4;
- FixedText* pPage2_Titel;
- RadioButton* pPage2_Standard;
- RadioButton* pPage2_Frames;
- RadioButton* pPage2_SingleDocument;
- RadioButton* pPage2_Kiosk;
- RadioButton* pPage2_WebCast;
- FixedImage* pPage2_Standard_FB;
- FixedImage* pPage2_Frames_FB;
- FixedImage* pPage2_Kiosk_FB;
- FixedImage* pPage2_WebCast_FB;
-
- FixedText* pPage2_Titel_Html;
- CheckBox* pPage2_Content;
- CheckBox* pPage2_Notes;
-
- FixedText* pPage2_Titel_WebCast;
- RadioButton* pPage2_ASP;
- RadioButton* pPage2_PERL;
- FixedText* pPage2_URL_txt;
- Edit* pPage2_URL;
- FixedText* pPage2_CGI_txt;
- Edit* pPage2_CGI;
- FixedText* pPage2_Index_txt;
- Edit* pPage2_Index;
- FixedText* pPage2_Titel_Kiosk;
- RadioButton* pPage2_ChgDefault;
- RadioButton* pPage2_ChgAuto;
- FixedText* pPage2_Duration_txt;
- TimeField* pPage2_Duration;
- CheckBox* pPage2_Endless;
+ VclPtr<VclContainer> pPage2;
+ VclPtr<VclContainer> pPage2Frame2;
+ VclPtr<VclContainer> pPage2Frame3;
+ VclPtr<VclContainer> pPage2Frame4;
+ VclPtr<FixedText> pPage2_Titel;
+ VclPtr<RadioButton> pPage2_Standard;
+ VclPtr<RadioButton> pPage2_Frames;
+ VclPtr<RadioButton> pPage2_SingleDocument;
+ VclPtr<RadioButton> pPage2_Kiosk;
+ VclPtr<RadioButton> pPage2_WebCast;
+ VclPtr<FixedImage> pPage2_Standard_FB;
+ VclPtr<FixedImage> pPage2_Frames_FB;
+ VclPtr<FixedImage> pPage2_Kiosk_FB;
+ VclPtr<FixedImage> pPage2_WebCast_FB;
+
+ VclPtr<FixedText> pPage2_Titel_Html;
+ VclPtr<CheckBox> pPage2_Content;
+ VclPtr<CheckBox> pPage2_Notes;
+
+ VclPtr<FixedText> pPage2_Titel_WebCast;
+ VclPtr<RadioButton> pPage2_ASP;
+ VclPtr<RadioButton> pPage2_PERL;
+ VclPtr<FixedText> pPage2_URL_txt;
+ VclPtr<Edit> pPage2_URL;
+ VclPtr<FixedText> pPage2_CGI_txt;
+ VclPtr<Edit> pPage2_CGI;
+ VclPtr<FixedText> pPage2_Index_txt;
+ VclPtr<Edit> pPage2_Index;
+ VclPtr<FixedText> pPage2_Titel_Kiosk;
+ VclPtr<RadioButton> pPage2_ChgDefault;
+ VclPtr<RadioButton> pPage2_ChgAuto;
+ VclPtr<FixedText> pPage2_Duration_txt;
+ VclPtr<TimeField> pPage2_Duration;
+ VclPtr<CheckBox> pPage2_Endless;
// page 3 controls
- VclContainer* pPage3;
- FixedText* pPage3_Titel1;
- RadioButton* pPage3_Png;
- RadioButton* pPage3_Gif;
- RadioButton* pPage3_Jpg;
- FixedText* pPage3_Quality_txt;
- ComboBox* pPage3_Quality;
- FixedText* pPage3_Titel2;
- RadioButton* pPage3_Resolution_1;
- RadioButton* pPage3_Resolution_2;
- RadioButton* pPage3_Resolution_3;
- FixedText* pPage3_Titel3;
- CheckBox* pPage3_SldSound;
- CheckBox* pPage3_HiddenSlides;
+ VclPtr<VclContainer> pPage3;
+ VclPtr<FixedText> pPage3_Titel1;
+ VclPtr<RadioButton> pPage3_Png;
+ VclPtr<RadioButton> pPage3_Gif;
+ VclPtr<RadioButton> pPage3_Jpg;
+ VclPtr<FixedText> pPage3_Quality_txt;
+ VclPtr<ComboBox> pPage3_Quality;
+ VclPtr<FixedText> pPage3_Titel2;
+ VclPtr<RadioButton> pPage3_Resolution_1;
+ VclPtr<RadioButton> pPage3_Resolution_2;
+ VclPtr<RadioButton> pPage3_Resolution_3;
+ VclPtr<FixedText> pPage3_Titel3;
+ VclPtr<CheckBox> pPage3_SldSound;
+ VclPtr<CheckBox> pPage3_HiddenSlides;
// page 4 controls
- VclContainer* pPage4;
- FixedText* pPage4_Titel1;
- FixedText* pPage4_Author_txt;
- Edit* pPage4_Author;
- FixedText* pPage4_Email_txt;
- Edit* pPage4_Email;
- FixedText* pPage4_WWW_txt;
- Edit* pPage4_WWW;
- FixedText* pPage4_Titel2;
- VclMultiLineEdit* pPage4_Misc;
- CheckBox* pPage4_Download;
+ VclPtr<VclContainer> pPage4;
+ VclPtr<FixedText> pPage4_Titel1;
+ VclPtr<FixedText> pPage4_Author_txt;
+ VclPtr<Edit> pPage4_Author;
+ VclPtr<FixedText> pPage4_Email_txt;
+ VclPtr<Edit> pPage4_Email;
+ VclPtr<FixedText> pPage4_WWW_txt;
+ VclPtr<Edit> pPage4_WWW;
+ VclPtr<FixedText> pPage4_Titel2;
+ VclPtr<VclMultiLineEdit> pPage4_Misc;
+ VclPtr<CheckBox> pPage4_Download;
// page 5 controls
- VclContainer* pPage5;
- FixedText* pPage5_Titel;
- CheckBox* pPage5_TextOnly;
- ValueSet* pPage5_Buttons;
+ VclPtr<VclContainer> pPage5;
+ VclPtr<FixedText> pPage5_Titel;
+ VclPtr<CheckBox> pPage5_TextOnly;
+ VclPtr<ValueSet> pPage5_Buttons;
// page 6 controls
- VclContainer* pPage6;
- FixedText* pPage6_Titel;
- RadioButton* pPage6_Default;
- RadioButton* pPage6_User;
- PushButton* pPage6_Back;
- PushButton* pPage6_Text;
- PushButton* pPage6_Link;
- PushButton* pPage6_VLink;
- PushButton* pPage6_ALink;
- RadioButton* pPage6_DocColors;
- SdHtmlAttrPreview* pPage6_Preview;
+ VclPtr<VclContainer> pPage6;
+ VclPtr<FixedText> pPage6_Titel;
+ VclPtr<RadioButton> pPage6_Default;
+ VclPtr<RadioButton> pPage6_User;
+ VclPtr<PushButton> pPage6_Back;
+ VclPtr<PushButton> pPage6_Text;
+ VclPtr<PushButton> pPage6_Link;
+ VclPtr<PushButton> pPage6_VLink;
+ VclPtr<PushButton> pPage6_ALink;
+ VclPtr<RadioButton> pPage6_DocColors;
+ VclPtr<SdHtmlAttrPreview> pPage6_Preview;
boost::scoped_ptr< ButtonSet > mpButtonSet;
// standard controls
- PushButton* pLastPageButton;
- PushButton* pNextPageButton;
- PushButton* pFinishButton;
+ VclPtr<PushButton> pLastPageButton;
+ VclPtr<PushButton> pNextPageButton;
+ VclPtr<PushButton> pFinishButton;
Assistent aAssistentFunc;
@@ -197,6 +197,7 @@ public:
SdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType);
virtual ~SdPublishingDlg();
+ virtual void dispose() SAL_OVERRIDE;
void GetParameterSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rParams );
};
diff --git a/sd/source/ui/inc/sdpreslt.hxx b/sd/source/ui/inc/sdpreslt.hxx
index bef6400329ff..69093c624a8c 100644
--- a/sd/source/ui/inc/sdpreslt.hxx
+++ b/sd/source/ui/inc/sdpreslt.hxx
@@ -41,8 +41,8 @@ public:
::sd::DrawDocShell* pDocShell,
vcl::Window* pWindow,
const SfxItemSet& rInAttrs);
-
virtual ~SdPresLayoutDlg();
+ virtual void dispose() SAL_OVERRIDE;
void GetAttr(SfxItemSet& rOutAttrs);
@@ -51,10 +51,10 @@ public:
private:
::sd::DrawDocShell* mpDocSh;
- ValueSet* m_pVS;
- CheckBox* m_pCbxMasterPage;
- CheckBox* m_pCbxCheckMasters;
- PushButton* m_pBtnLoad;
+ VclPtr<ValueSet> m_pVS;
+ VclPtr<CheckBox> m_pCbxMasterPage;
+ VclPtr<CheckBox> m_pCbxCheckMasters;
+ VclPtr<PushButton> m_pBtnLoad;
const SfxItemSet& mrOutAttrs;
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index bbbfeed10c68..780b44c34368 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -121,7 +121,7 @@ public:
protected:
- vcl::Window* mpParent;
+ VclPtr<vcl::Window> mpParent;
const SdDrawDocument* mpDoc;
SdDrawDocument* mpBookmarkDoc;
SfxMedium* mpMedium;
@@ -131,7 +131,7 @@ protected:
bool mbLinkableSelected;
OUString maDocName;
::sd::DrawDocShellRef mxBookmarkDocShRef; ///< for the loading of bookmarks
- SdNavigatorWin* mpDropNavWin;
+ VclPtr<SdNavigatorWin> mpDropNavWin;
SfxViewFrame* mpFrame;
std::vector<OUString> maTreeItem;
bool mbSaveTreeItemState;
@@ -187,6 +187,7 @@ public:
SdPageObjsTLB( vcl::Window* pParent, const SdResId& rSdResId );
SdPageObjsTLB( vcl::Window* pParent, WinBits nStyle );
virtual ~SdPageObjsTLB();
+ virtual void dispose() SAL_OVERRIDE;
// helper function for GetEntryAltText and GetEntryLongDescription
OUString getAltLongDescText( SvTreeListEntry* pEntry , bool isAltText) const;
diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx
index d249a1579e6a..640c20763b6a 100644
--- a/sd/source/ui/inc/sdxfer.hxx
+++ b/sd/source/ui/inc/sdxfer.hxx
@@ -123,7 +123,7 @@ private:
SdDrawDocument* mpSdDrawDocument;
SdDrawDocument* mpSdDrawDocumentIntern;
SdDrawDocument* mpSourceDoc;
- VirtualDevice* mpVDev;
+ VclPtr<VirtualDevice> mpVDev;
INetBookmark* mpBookmark;
Graphic* mpGraphic;
ImageMap* mpImageMap;
diff --git a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx
index a5d1abef8580..d39b8bcfd028 100644
--- a/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx
+++ b/sd/source/ui/inc/taskpane/SlideSorterCacheDisplay.hxx
@@ -86,7 +86,7 @@ private:
static void AddInstance (const SdDrawDocument* pDocument, SlideSorterCacheDisplay* pControl);
static void RemoveInstance (SlideSorterCacheDisplay* pControl);
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
sal_Int32 mnPageCount;
sal_Int32 mnColumnCount;
sal_Int32 mnRowCount;
diff --git a/sd/source/ui/inc/tbx_ww.hxx b/sd/source/ui/inc/tbx_ww.hxx
index fb19bb3d6a69..9754107f4ee1 100644
--- a/sd/source/ui/inc/tbx_ww.hxx
+++ b/sd/source/ui/inc/tbx_ww.hxx
@@ -35,7 +35,7 @@ public:
virtual ~SdTbxControl() {}
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/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx
index 08abc0173b67..8865c0579141 100644
--- a/sd/source/ui/inc/tpaction.hxx
+++ b/sd/source/ui/inc/tpaction.hxx
@@ -53,21 +53,21 @@ public:
class SdTPAction : public SfxTabPage
{
private:
- ListBox* m_pLbAction;
-
- FixedText* m_pFtTree; // jump destination controls
- SdPageObjsTLB* m_pLbTree;
- SdPageObjsTLB* m_pLbTreeDocument;
- ListBox* m_pLbOLEAction;
-
- VclFrame* m_pFrame;
- Edit* m_pEdtSound;
- Edit* m_pEdtBookmark;
- Edit* m_pEdtDocument;
- Edit* m_pEdtProgram;
- Edit* m_pEdtMacro;
- PushButton* m_pBtnSearch;
- PushButton* m_pBtnSeek;
+ VclPtr<ListBox> m_pLbAction;
+
+ VclPtr<FixedText> m_pFtTree; // jump destination controls
+ VclPtr<SdPageObjsTLB> m_pLbTree;
+ VclPtr<SdPageObjsTLB> m_pLbTreeDocument;
+ VclPtr<ListBox> m_pLbOLEAction;
+
+ VclPtr<VclFrame> m_pFrame;
+ VclPtr<Edit> m_pEdtSound;
+ VclPtr<Edit> m_pEdtBookmark;
+ VclPtr<Edit> m_pEdtDocument;
+ VclPtr<Edit> m_pEdtProgram;
+ VclPtr<Edit> m_pEdtMacro;
+ VclPtr<PushButton> m_pBtnSearch;
+ VclPtr<PushButton> m_pBtnSeek;
const SfxItemSet& rOutAttrs;
const ::sd::View* mpView;
@@ -97,8 +97,9 @@ private:
public:
SdTPAction( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SdTPAction();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet& );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet& );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx
index 5ef18f4c4452..ffb600ea8f3e 100644
--- a/sd/source/ui/inc/tpoption.hxx
+++ b/sd/source/ui/inc/tpoption.hxx
@@ -38,7 +38,7 @@ public:
SdTpOptionsSnap( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SdTpOptionsSnap();
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
@@ -50,16 +50,17 @@ public:
class SdTpOptionsContents : public SfxTabPage
{
private:
- CheckBox* m_pCbxRuler;
- CheckBox* m_pCbxDragStripes;
- CheckBox* m_pCbxHandlesBezier;
- CheckBox* m_pCbxMoveOutline;
+ VclPtr<CheckBox> m_pCbxRuler;
+ VclPtr<CheckBox> m_pCbxDragStripes;
+ VclPtr<CheckBox> m_pCbxHandlesBezier;
+ VclPtr<CheckBox> m_pCbxMoveOutline;
public:
SdTpOptionsContents( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SdTpOptionsContents();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
};
@@ -73,38 +74,38 @@ class SdTpOptionsMisc : public SfxTabPage
friend class SdModule;
private:
- CheckBox *m_pCbxQuickEdit;
- CheckBox *m_pCbxPickThrough;
+ VclPtr<CheckBox> m_pCbxQuickEdit;
+ VclPtr<CheckBox> m_pCbxPickThrough;
- VclFrame *m_pNewDocumentFrame;
- CheckBox *m_pCbxStartWithTemplate;
+ VclPtr<VclFrame> m_pNewDocumentFrame;
+ VclPtr<CheckBox> m_pCbxStartWithTemplate;
- CheckBox *m_pCbxMasterPageCache;
- CheckBox *m_pCbxCopy;
- CheckBox *m_pCbxMarkedHitMovesAlways;
- VclFrame *m_pPresentationFrame;
+ VclPtr<CheckBox> m_pCbxMasterPageCache;
+ VclPtr<CheckBox> m_pCbxCopy;
+ VclPtr<CheckBox> m_pCbxMarkedHitMovesAlways;
+ VclPtr<VclFrame> m_pPresentationFrame;
- ListBox *m_pLbMetric;
- MetricField *m_pMtrFldTabstop;
+ VclPtr<ListBox> m_pLbMetric;
+ VclPtr<MetricField> m_pMtrFldTabstop;
- CheckBox *m_pCbxEnableSdremote;
- CheckBox *m_pCbxEnablePresenterScreen;
- CheckBox *m_pCbxUsePrinterMetrics;
- CheckBox *m_pCbxCompatibility;
+ VclPtr<CheckBox> m_pCbxEnableSdremote;
+ VclPtr<CheckBox> m_pCbxEnablePresenterScreen;
+ VclPtr<CheckBox> m_pCbxUsePrinterMetrics;
+ VclPtr<CheckBox> m_pCbxCompatibility;
//Scale
- VclFrame *m_pScaleFrame;
- ComboBox *m_pCbScale;
- FixedText *m_pNewDocLb;
- FixedText *m_pFiInfo1;
- MetricField *m_pMtrFldOriginalWidth;
- FixedText *m_pWidthLb;
- FixedText *m_pHeightLb;
- FixedText *m_pFiInfo2;
- MetricField *m_pMtrFldOriginalHeight;
- CheckBox *m_pCbxDistrot;
- MetricField *m_pMtrFldInfo1;
- MetricField *m_pMtrFldInfo2;
+ VclPtr<VclFrame> m_pScaleFrame;
+ VclPtr<ComboBox> m_pCbScale;
+ VclPtr<FixedText> m_pNewDocLb;
+ VclPtr<FixedText> m_pFiInfo1;
+ VclPtr<MetricField> m_pMtrFldOriginalWidth;
+ VclPtr<FixedText> m_pWidthLb;
+ VclPtr<FixedText> m_pHeightLb;
+ VclPtr<FixedText> m_pFiInfo2;
+ VclPtr<MetricField> m_pMtrFldOriginalHeight;
+ VclPtr<CheckBox> m_pCbxDistrot;
+ VclPtr<MetricField> m_pMtrFldInfo1;
+ VclPtr<MetricField> m_pMtrFldInfo2;
sal_uInt32 nWidth;
sal_uInt32 nHeight;
@@ -131,8 +132,9 @@ protected:
public:
SdTpOptionsMisc( vcl::Window* pParent, const SfxItemSet& rInAttrs );
virtual ~SdTpOptionsMisc();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
+ static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
diff --git a/sd/source/ui/inc/vectdlg.hxx b/sd/source/ui/inc/vectdlg.hxx
index 153343dae933..fefa8efe82ef 100644
--- a/sd/source/ui/inc/vectdlg.hxx
+++ b/sd/source/ui/inc/vectdlg.hxx
@@ -42,20 +42,20 @@ class DrawDocShell;
class SdVectorizeDlg : public ModalDialog
{
::sd::DrawDocShell * mpDocSh;
- NumericField* m_pNmLayers;
- MetricField* m_pMtReduce;
- FixedText* m_pFtFillHoles;
- MetricField* m_pMtFillHoles;
- CheckBox* m_pCbFillHoles;
+ VclPtr<NumericField> m_pNmLayers;
+ VclPtr<MetricField> m_pMtReduce;
+ VclPtr<FixedText> m_pFtFillHoles;
+ VclPtr<MetricField> m_pMtFillHoles;
+ VclPtr<CheckBox> m_pCbFillHoles;
- GraphCtrl* m_pBmpWin;
+ VclPtr<GraphCtrl> m_pBmpWin;
- GraphCtrl* m_pMtfWin;
+ VclPtr<GraphCtrl> m_pMtfWin;
- ProgressBar* m_pPrgs;
+ VclPtr<ProgressBar> m_pPrgs;
- OKButton* m_pBtnOK;
- PushButton* m_pBtnPreview;
+ VclPtr<OKButton> m_pBtnOK;
+ VclPtr<PushButton> m_pBtnPreview;
Bitmap aBmp;
Bitmap aPreviewBmp;
@@ -82,6 +82,7 @@ public:
SdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell );
virtual ~SdVectorizeDlg();
+ virtual void dispose() SAL_OVERRIDE;
const GDIMetaFile& GetGDIMetaFile() const { return aMtf; }
};
diff --git a/sd/source/ui/presenter/PresenterHelper.cxx b/sd/source/ui/presenter/PresenterHelper.cxx
index 79d9ef48cad2..60b7bcb701de 100644
--- a/sd/source/ui/presenter/PresenterHelper.cxx
+++ b/sd/source/ui/presenter/PresenterHelper.cxx
@@ -79,11 +79,11 @@ Reference<awt::XWindow> SAL_CALL PresenterHelper::createWindow (
vcl::Window* pWindow = NULL;
if (bCreateSystemChildWindow)
{
- pWindow = new WorkWindow(pParentWindow, WB_SYSTEMCHILDWINDOW);
+ pWindow = VclPtr<WorkWindow>::Create(pParentWindow, WB_SYSTEMCHILDWINDOW);
}
else
{
- pWindow = new vcl::Window(pParentWindow);
+ pWindow = VclPtr<vcl::Window>::Create(pParentWindow);
}
Reference<awt::XWindow> xWindow (pWindow->GetComponentInterface(), UNO_QUERY);
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx
index 7fde4a4c5e08..0df3b852583a 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -82,7 +82,7 @@ public:
private:
Reference<rendering::XBitmap> mxBitmap;
cppcanvas::CanvasSharedPtr mpCanvas;
- VirtualDevice* mpOutputDevice;
+ VclPtr<VirtualDevice> mpOutputDevice;
EditEngine* mpEditEngine;
SfxItemPool* mpEditEngineItemPool;
Size maSize;
@@ -242,7 +242,7 @@ PresenterTextView::Implementation::Implementation()
msTotalHeightPropertyName("TotalHeight"),
mxBitmap(),
mpCanvas(),
- mpOutputDevice(new VirtualDevice(*Application::GetDefaultDevice(), 0, 0)),
+ mpOutputDevice(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 0, 0)),
mpEditEngine(NULL),
mpEditEngineItemPool(EditEngine::CreatePool()),
maSize(100,100),
@@ -261,7 +261,7 @@ PresenterTextView::Implementation::~Implementation()
{
delete mpEditEngine;
SfxItemPool::Free(mpEditEngineItemPool);
- delete mpOutputDevice;
+ mpOutputDevice.disposeAndClear();
}
EditEngine * PresenterTextView::Implementation::GetEditEngine()
@@ -453,9 +453,8 @@ Reference<rendering::XBitmap> PresenterTextView::Implementation::GetBitmap()
if ( ! mxBitmap.is())
{
- if (mpOutputDevice != NULL)
- delete mpOutputDevice;
- mpOutputDevice = new VirtualDevice(*Application::GetDefaultDevice(), 0, 0);
+ mpOutputDevice.disposeAndClear();
+ mpOutputDevice = VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 0, 0);
mpOutputDevice->SetMapMode(MAP_PIXEL);
mpOutputDevice->SetOutputSizePixel(maSize, true);
mpOutputDevice->SetLineColor();
diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
index 8e40ef1d0471..1ab67e2a63ef 100644
--- a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
@@ -77,7 +77,7 @@ public:
SortedMasterPageDescriptorList() {}
};
-MasterPagesSelector* AllMasterPagesSelector::Create (
+VclPtr<vcl::Window> AllMasterPagesSelector::Create (
vcl::Window* pParent,
ViewShellBase& rViewShellBase,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
@@ -88,13 +88,14 @@ MasterPagesSelector* AllMasterPagesSelector::Create (
::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
- MasterPagesSelector* pSelector(
+ VclPtr<MasterPagesSelector> pSelector(
new AllMasterPagesSelector (
pParent,
*pDocument,
rViewShellBase,
pContainer,
- rxSidebar));
+ rxSidebar),
+ SAL_NO_ACQUIRE);
pSelector->LateInit();
pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL);
diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx
index 11bcb2640f65..58c958517bd6 100644
--- a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx
@@ -37,7 +37,7 @@ class AllMasterPagesSelector
: public MasterPagesSelector
{
public:
- static MasterPagesSelector* Create (
+ static VclPtr<vcl::Window> Create (
vcl::Window* pParent,
ViewShellBase& rViewShellBase,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
index 5e8bdad96b52..de51f263dbf4 100644
--- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star;
namespace sd { namespace sidebar {
-MasterPagesSelector* CurrentMasterPagesSelector::Create (
+VclPtr<vcl::Window> CurrentMasterPagesSelector::Create (
vcl::Window* pParent,
ViewShellBase& rViewShellBase,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
@@ -53,13 +53,14 @@ MasterPagesSelector* CurrentMasterPagesSelector::Create (
::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
- MasterPagesSelector* pSelector(
+ VclPtr<MasterPagesSelector> pSelector(
new CurrentMasterPagesSelector (
pParent,
*pDocument,
rViewShellBase,
pContainer,
- rxSidebar));
+ rxSidebar),
+ SAL_NO_ACQUIRE);
pSelector->LateInit();
pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT );
@@ -91,6 +92,11 @@ CurrentMasterPagesSelector::CurrentMasterPagesSelector (
CurrentMasterPagesSelector::~CurrentMasterPagesSelector()
{
+ disposeOnce();
+}
+
+void CurrentMasterPagesSelector::dispose()
+{
if (mrDocument.GetDocSh() != NULL)
{
EndListening(*mrDocument.GetDocSh());
@@ -102,6 +108,8 @@ CurrentMasterPagesSelector::~CurrentMasterPagesSelector()
Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
mrBase.GetEventMultiplexer()->RemoveEventListener(aLink);
+
+ MasterPagesSelector::dispose();
}
void CurrentMasterPagesSelector::LateInit()
diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
index e9a3cbe5d7d8..9443b991654c 100644
--- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
@@ -35,7 +35,7 @@ class CurrentMasterPagesSelector
public SfxListener
{
public:
- static MasterPagesSelector* Create (
+ static VclPtr<vcl::Window> Create (
vcl::Window* pParent,
ViewShellBase& rViewShellBase,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
@@ -68,6 +68,7 @@ private:
const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
virtual ~CurrentMasterPagesSelector();
+ virtual void dispose() SAL_OVERRIDE;
virtual void LateInit() SAL_OVERRIDE;
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index 1306ffbb8f13..c304b981bc45 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -194,8 +194,14 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell )
LayoutMenu::~LayoutMenu()
{
+ disposeOnce();
+}
+
+void LayoutMenu::dispose()
+{
SAL_INFO("sd.ui", "destroying LayoutMenu at " << this);
Dispose();
+ ValueSet::dispose();
}
void LayoutMenu::Dispose()
diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx
index 32c5819f9649..94e16a40ccaa 100644
--- a/sd/source/ui/sidebar/LayoutMenu.hxx
+++ b/sd/source/ui/sidebar/LayoutMenu.hxx
@@ -73,6 +73,7 @@ public:
ViewShellBase& rViewShellBase,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
virtual ~LayoutMenu();
+ virtual void dispose() SAL_OVERRIDE;
void Dispose();
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx
index 28d3abde2d9a..f17c15aecaee 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx
@@ -104,11 +104,17 @@ MasterPagesSelector::MasterPagesSelector (
MasterPagesSelector::~MasterPagesSelector()
{
+ disposeOnce();
+}
+
+void MasterPagesSelector::dispose()
+{
Clear();
UpdateLocks(ItemList());
Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
mpContainer->RemoveChangeListener(aChangeListener);
+ PreviewValueSet::dispose();
}
void MasterPagesSelector::LateInit()
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.hxx b/sd/source/ui/sidebar/MasterPagesSelector.hxx
index eab38546d57b..e5121791277c 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx
@@ -63,6 +63,7 @@ public:
const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
virtual ~MasterPagesSelector();
+ virtual void dispose() SAL_OVERRIDE;
virtual void LateInit();
diff --git a/sd/source/ui/sidebar/NavigatorWrapper.cxx b/sd/source/ui/sidebar/NavigatorWrapper.cxx
index 6df0a2e01aa6..376d22b9152a 100644
--- a/sd/source/ui/sidebar/NavigatorWrapper.cxx
+++ b/sd/source/ui/sidebar/NavigatorWrapper.cxx
@@ -33,27 +33,34 @@ NavigatorWrapper::NavigatorWrapper (
SfxBindings* pBindings)
: Control(pParent, 0),
mrViewShellBase(rViewShellBase),
- maNavigator(
+ maNavigator(VclPtr<SdNavigatorWin>::Create(
this,
- NULL,
+ (::sd::NavigatorChildWindow*)NULL,
SdResId(FLT_NAVIGATOR),
pBindings,
- ::boost::bind(&NavigatorWrapper::UpdateNavigator, this))
+ ::boost::bind(&NavigatorWrapper::UpdateNavigator, this)))
{
- maNavigator.SetPosSizePixel(
+ maNavigator->SetPosSizePixel(
Point(0,0),
GetSizePixel());
- maNavigator.SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
- maNavigator.Show();
+ maNavigator->SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
+ maNavigator->Show();
}
NavigatorWrapper::~NavigatorWrapper()
{
+ disposeOnce();
+}
+
+void NavigatorWrapper::dispose()
+{
+ maNavigator.disposeAndClear();
+ Control::dispose();
}
void NavigatorWrapper::Resize()
{
- maNavigator.SetSizePixel(GetSizePixel());
+ maNavigator->SetSizePixel(GetSizePixel());
}
css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth)
@@ -65,12 +72,12 @@ css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth)
void NavigatorWrapper::UpdateNavigator()
{
- maNavigator.InitTreeLB(mrViewShellBase.GetDocument());
+ maNavigator->InitTreeLB(mrViewShellBase.GetDocument());
}
void NavigatorWrapper::GetFocus()
{
- maNavigator.GrabFocus();
+ maNavigator->GrabFocus();
}
} } // end of namespace sd::sidebar
diff --git a/sd/source/ui/sidebar/NavigatorWrapper.hxx b/sd/source/ui/sidebar/NavigatorWrapper.hxx
index 98c95aa72426..49ac6d0ee0f7 100644
--- a/sd/source/ui/sidebar/NavigatorWrapper.hxx
+++ b/sd/source/ui/sidebar/NavigatorWrapper.hxx
@@ -44,8 +44,8 @@ public:
vcl::Window* pParent,
sd::ViewShellBase& rViewShellBase,
SfxBindings* pBindings);
-
virtual ~NavigatorWrapper();
+ virtual void dispose() SAL_OVERRIDE;
// Control
virtual void Resize() SAL_OVERRIDE;
@@ -56,7 +56,7 @@ public:
private:
ViewShellBase& mrViewShellBase;
- SdNavigatorWin maNavigator;
+ VclPtr<SdNavigatorWin> maNavigator;
void UpdateNavigator();
};
diff --git a/sd/source/ui/sidebar/PanelBase.cxx b/sd/source/ui/sidebar/PanelBase.cxx
index f0366b7c329d..c7bcde32e36a 100644
--- a/sd/source/ui/sidebar/PanelBase.cxx
+++ b/sd/source/ui/sidebar/PanelBase.cxx
@@ -38,15 +38,19 @@ PanelBase::PanelBase (
PanelBase::~PanelBase()
{
- OSL_TRACE("deleting wrapped control at %p", mpWrappedControl.get());
- mpWrappedControl.reset();
- OSL_TRACE("deleting PanelBase at %p from parent %p", this, GetParent());
+ disposeOnce();
+}
+
+void PanelBase::dispose()
+{
+ mpWrappedControl.disposeAndClear();
+ Control::dispose();
}
void PanelBase::Dispose()
{
OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %p", mpWrappedControl.get());
- mpWrappedControl.reset();
+ mpWrappedControl.disposeAndClear();
}
css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 /*nWidth*/)
@@ -69,7 +73,7 @@ void PanelBase::Resize()
void PanelBase::SetSidebar (const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
{
mxSidebar = rxSidebar;
- if (mxSidebar.is() && mpWrappedControl!=0)
+ if (mxSidebar.is() && mpWrappedControl!=nullptr)
mxSidebar->requestLayout();
}
diff --git a/sd/source/ui/sidebar/PanelBase.hxx b/sd/source/ui/sidebar/PanelBase.hxx
index dcef4732e521..b0f4fb0cfb5e 100644
--- a/sd/source/ui/sidebar/PanelBase.hxx
+++ b/sd/source/ui/sidebar/PanelBase.hxx
@@ -45,6 +45,7 @@ public:
vcl::Window* pParentWindow,
ViewShellBase& rViewShellBase);
virtual ~PanelBase();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
@@ -58,7 +59,7 @@ public:
virtual void SetSidebar (const css::uno::Reference<css::ui::XSidebar>& rxSidebar) SAL_OVERRIDE;
protected:
- ::boost::scoped_ptr< vcl::Window> mpWrappedControl;
+ VclPtr< vcl::Window> mpWrappedControl;
virtual vcl::Window* CreateWrappedControl (
vcl::Window* pParentWindow,
ViewShellBase& rViewShellBase) = 0;
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx
index f10290af8572..73013aa037a5 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -120,14 +120,14 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
// Create a framework view.
- vcl::Window* pControl = NULL;
+ VclPtr<vcl::Window> pControl;
css::ui::LayoutSize aLayoutSize (-1,-1,-1);
#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t))
if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations))
- pControl = new CustomAnimationPanel(pParentWindow, *pBase, xFrame);
+ pControl = VclPtr<vcl::Window>(new CustomAnimationPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE);
else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts))
- pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar);
+ pControl = VclPtr<vcl::Window>(new LayoutMenu(pParentWindow, *pBase, xSidebar), SAL_NO_ACQUIRE);
else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages))
pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages))
@@ -135,14 +135,14 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages))
pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions))
- pControl = new SlideTransitionPanel(pParentWindow, *pBase, xFrame);
+ pControl = VclPtr<vcl::Window>(new SlideTransitionPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE);
else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign))
- pControl = new TableDesignPanel(pParentWindow, *pBase);
+ pControl = VclPtr<vcl::Window>(new TableDesignPanel(pParentWindow, *pBase), SAL_NO_ACQUIRE);
else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator))
- pControl = new NavigatorWrapper(pParentWindow, *pBase, pBindings);
+ pControl = VclPtr<vcl::Window>(new NavigatorWrapper(pParentWindow, *pBase, pBindings), SAL_NO_ACQUIRE);
#undef EndsWith
- if (pControl == NULL)
+ if (!pControl)
throw lang::IllegalArgumentException();
// Create a wrapper around the control that implements the
diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
index 6266e2e25f61..b31e139e22d6 100644
--- a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
@@ -32,7 +32,7 @@
namespace sd { namespace sidebar {
-MasterPagesSelector* RecentMasterPagesSelector::Create (
+VclPtr<vcl::Window> RecentMasterPagesSelector::Create (
vcl::Window* pParent,
ViewShellBase& rViewShellBase,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
@@ -43,13 +43,14 @@ MasterPagesSelector* RecentMasterPagesSelector::Create (
::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
- MasterPagesSelector* pSelector(
+ VclPtr<MasterPagesSelector> pSelector(
new RecentMasterPagesSelector (
pParent,
*pDocument,
rViewShellBase,
pContainer,
- rxSidebar));
+ rxSidebar),
+ SAL_NO_ACQUIRE);
pSelector->LateInit();
pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT);
@@ -68,8 +69,14 @@ RecentMasterPagesSelector::RecentMasterPagesSelector (
RecentMasterPagesSelector::~RecentMasterPagesSelector()
{
+ disposeOnce();
+}
+
+void RecentMasterPagesSelector::dispose()
+{
RecentlyUsedMasterPages::Instance().RemoveEventListener (
LINK(this,RecentMasterPagesSelector,MasterPageListListener));
+ MasterPagesSelector::dispose();
}
void RecentMasterPagesSelector::LateInit()
diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
index f690c7875674..a7f470317989 100644
--- a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
@@ -30,7 +30,7 @@ class RecentMasterPagesSelector
: public MasterPagesSelector
{
public:
- static MasterPagesSelector* Create (
+ static VclPtr<vcl::Window> Create (
vcl::Window* pParent,
ViewShellBase& rViewShellBase,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
@@ -65,6 +65,7 @@ private:
const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
virtual ~RecentMasterPagesSelector();
+ virtual void dispose() SAL_OVERRIDE;
virtual void LateInit() SAL_OVERRIDE;
};
diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx
index 29c4031dc20d..cb49f89227e5 100644
--- a/sd/source/ui/slideshow/showwin.cxx
+++ b/sd/source/ui/slideshow/showwin.cxx
@@ -79,8 +79,14 @@ ShowWindow::ShowWindow( const ::rtl::Reference< SlideshowImpl >& xController, vc
ShowWindow::~ShowWindow()
{
+ disposeOnce();
+}
+
+void ShowWindow::dispose()
+{
maPauseTimer.Stop();
maMouseTimer.Stop();
+ ::sd::Window::dispose();
}
void ShowWindow::KeyInput(const KeyEvent& rKEvt)
@@ -498,18 +504,18 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly )
if( SLIDE_NO_TIMEOUT != mnPauseTimeout )
{
MapMode aVMap( rMap );
- VirtualDevice aVDev( *this );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( *this );
aVMap.SetOrigin( Point() );
- aVDev.SetMapMode( aVMap );
- aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) );
+ pVDev->SetMapMode( aVMap );
+ pVDev->SetBackground( Wallpaper( Color( COL_BLACK ) ) );
// set font first, to determine real output height
- aVDev.SetFont( aFont );
+ pVDev->SetFont( aFont );
- const Size aVDevSize( aOutSize.Width(), aVDev.GetTextHeight() );
+ const Size aVDevSize( aOutSize.Width(), pVDev->GetTextHeight() );
- if( aVDev.SetOutputSize( aVDevSize ) )
+ if( pVDev->SetOutputSize( aVDevSize ) )
{
// Note: if performance gets an issue here, we can use NumberFormatter directly
SvtSysLocale aSysLocale;
@@ -518,8 +524,8 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly )
aText += " ( ";
aText += aLocaleData.getDuration( ::tools::Time( 0, 0, mnPauseTimeout ) );
aText += " )";
- aVDev.DrawText( Point( aOffset.Width(), 0 ), aText );
- DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, aVDev );
+ pVDev->DrawText( Point( aOffset.Width(), 0 ), aText );
+ DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, *pVDev.get() );
bDrawn = true;
}
}
diff --git a/sd/source/ui/slideshow/showwindow.hxx b/sd/source/ui/slideshow/showwindow.hxx
index 81bfe0a437c3..827dd1054071 100644
--- a/sd/source/ui/slideshow/showwindow.hxx
+++ b/sd/source/ui/slideshow/showwindow.hxx
@@ -51,6 +51,7 @@ class ShowWindow
public:
ShowWindow ( const ::rtl::Reference< ::sd::SlideshowImpl >& xController, vcl::Window* pParent );
virtual ~ShowWindow();
+ virtual void dispose() SAL_OVERRIDE;
bool SetEndMode();
bool SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeoutSec = SLIDE_NO_TIMEOUT, Graphic* pLogo = NULL );
diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx
index d077853dfc65..36ca9d4b5eab 100644
--- a/sd/source/ui/slideshow/slideshow.cxx
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -927,7 +927,7 @@ bool SlideShow::startPreview( const Reference< XDrawPage >& xDrawPage, const Ref
OutputDevice* SlideShow::getShowWindow()
{
- return mxController.is() ? mxController->mpShowWindow : 0;
+ return mxController.is() ? mxController->mpShowWindow.get() : 0;
}
int SlideShow::getAnimationMode()
@@ -1159,7 +1159,7 @@ void SlideShow::StartFullscreenPresentation( )
// will be created. This is done here explicitly so that we can make it
// fullscreen.
const sal_Int32 nDisplay (GetDisplay());
- WorkWindow* pWorkWindow = new FullScreenWorkWindow(this, mpCurrentViewShellBase);
+ VclPtr<WorkWindow> pWorkWindow = VclPtr<FullScreenWorkWindow>::Create(this, mpCurrentViewShellBase);
pWorkWindow->SetBackground(Wallpaper(COL_BLACK));
pWorkWindow->StartPresentationMode( true, mpDoc->getPresentationSettings().mbAlwaysOnTop ? PRESENTATION_HIDEALLAPPS : 0, nDisplay);
// pWorkWindow->ShowFullScreenMode(sal_False, nDisplay);
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 080f5da12cda..1d45a5b3d362 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -705,14 +705,12 @@ void SAL_CALL SlideshowImpl::disposing()
}
if( mpTimeButton )
- {
mpTimeButton->Hide();
- delete mpTimeButton;
- mpTimeButton = 0;
- }
+ mpTimeButton.disposeAndClear();
if( mpShowWindow )
mpShowWindow->Hide();
+ mpShowWindow.disposeAndClear();
if ( mpViewShell )
{
@@ -743,8 +741,7 @@ void SAL_CALL SlideshowImpl::disposing()
if( mpShowWindow )
{
- delete mpShowWindow;
- mpShowWindow = 0;
+ mpShowWindow.clear();
}
setActiveXToolbarsVisible( true );
@@ -805,7 +802,7 @@ bool SlideshowImpl::startPreview(
mpSlideController->insertSlideNumber( nSlideNumber-1 );
mpSlideController->setPreviewNode( xAnimationNode );
- mpShowWindow = new ShowWindow( this, ((pParent == 0) && mpViewShell) ? mpParentWindow : pParent );
+ mpShowWindow = VclPtr<ShowWindow>::Create( this, ((pParent == 0) && mpViewShell) ? mpParentWindow.get() : pParent );
if( mpViewShell )
{
mpViewShell->SetActiveWindow( mpShowWindow );
@@ -857,7 +854,7 @@ bool SlideshowImpl::startPreview(
bRet = startShowImpl( aProperties );
- if( mpShowWindow != 0 && meAnimationMode == ANIMATIONMODE_PREVIEW )
+ if( mpShowWindow != nullptr && meAnimationMode == ANIMATIONMODE_PREVIEW )
mpShowWindow->SetPreviewMode();
}
@@ -882,8 +879,8 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
DBG_ASSERT( !mxShow.is(), "sd::SlideshowImpl::startShow(), called twice!" );
if( mxShow.is() )
return true;
- DBG_ASSERT( mpParentWindow!=NULL, "sd::SlideshowImpl::startShow() called without parent window" );
- if (mpParentWindow == NULL)
+ DBG_ASSERT( mpParentWindow!=nullptr, "sd::SlideshowImpl::startShow() called without parent window" );
+ if (mpParentWindow == nullptr)
return false;
// Autoplay (pps/ppsx)
@@ -970,7 +967,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
// hide child windows
hideChildWindows();
- mpShowWindow = new ShowWindow( this, mpParentWindow );
+ mpShowWindow = VclPtr<ShowWindow>::Create( this, mpParentWindow );
mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible );
if( mpViewShell )
{
@@ -3346,7 +3343,8 @@ void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const
Reference< XWindow > xWindow;
if( rValue >>= xWindow )
{
- mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : 0;
+ mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow )
+ : VclPtr<vcl::Window>();
return;
}
}
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
index d9ddffb8a07a..a85e3ca526d4 100644
--- a/sd/source/ui/slideshow/slideshowimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -92,7 +92,7 @@ struct PresentationSettingsEx : public PresentationSettings
{
bool mbRehearseTimings;
bool mbPreview;
- vcl::Window* mpParentWindow;
+ VclPtr<vcl::Window> mpParentWindow;
css::uno::Reference< css::drawing::XDrawPage > mxStartPage;
css::uno::Reference< css::animations::XAnimationNode > mxAnimationNode;
@@ -332,9 +332,9 @@ private:
SdDrawDocument* mpDoc;
SfxItemSet* mpNewAttr;
- vcl::Window* mpParentWindow;
- ShowWindow* mpShowWindow;
- PushButton* mpTimeButton;
+ VclPtr<vcl::Window> mpParentWindow;
+ VclPtr<ShowWindow> mpShowWindow;
+ VclPtr<PushButton> mpTimeButton;
boost::shared_ptr< AnimationSlideController > mpSlideController;
@@ -347,8 +347,8 @@ private:
OUString maCharBuffer;
Pointer maOldPointer;
Pointer maPencil;
- std::vector< ::sd::Window* > maDrawModeWindows;
- ::sd::Window* mpOldActiveWindow;
+ std::vector< VclPtr<::sd::Window> > maDrawModeWindows;
+ VclPtr<::sd::Window> mpOldActiveWindow;
Link maStarBASICGlobalErrorHdl;
unsigned long mnChildMask;
bool mbGridVisible;
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index aae8a7eec2b7..fcb7f44ecd7f 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -118,7 +118,7 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
mnPaintEntranceCount(0),
mbIsContextMenuOpen(false)
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
OSL_ASSERT(pWindow);
if (pWindow)
{
@@ -502,7 +502,7 @@ void SlideSorterController::PostModelChange()
mbPostModelChangePending = false;
mrModel.Resync();
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
GetCurrentSlideManager()->HandleModelChange();
@@ -541,7 +541,7 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
if (pEvent != NULL)
{
::vcl::Window* pWindow = pEvent->GetWindow();
- SharedSdWindow pActiveWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pActiveWindow (mrSlideSorter.GetContentWindow());
switch (pEvent->GetId())
{
case VCLEVENT_WINDOW_ACTIVATE:
@@ -557,12 +557,12 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
case VCLEVENT_WINDOW_GETFOCUS:
if (pActiveWindow)
- if (pWindow == pActiveWindow.get())
+ if (pWindow == pActiveWindow)
GetFocusManager().ShowFocus(false);
break;
case VCLEVENT_WINDOW_LOSEFOCUS:
- if (pActiveWindow && pWindow == pActiveWindow.get())
+ if (pActiveWindow && pWindow == pActiveWindow)
{
GetFocusManager().HideFocus();
mrView.GetToolTip().Hide();
@@ -584,7 +584,7 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
: ViewShell::OUTPUT_DRAWMODE_COLOR);
if (mrSlideSorter.GetViewShell() != NULL)
mrSlideSorter.GetViewShell()->GetFrameView()->SetDrawMode(nDrawMode);
- if (pActiveWindow != 0)
+ if (pActiveWindow != nullptr)
pActiveWindow->SetDrawMode(nDrawMode);
mrView.HandleDrawModeChange();
@@ -714,7 +714,7 @@ Rectangle SlideSorterController::Rearrange (bool bForce)
else
mbIsForcedRearrangePending = false;
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
if (bForce)
@@ -864,7 +864,7 @@ void SlideSorterController::PageNameHasChanged (int nPageIndex, const OUString&
// Get a pointer to the corresponding accessible object and notify
// that of the name change.
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if ( ! pWindow)
return;
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index d7898c1a3d9f..9d6bdb8d0feb 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -287,11 +287,11 @@ sal_Int32 Clipboard::GetInsertionPosition (::vcl::Window* pWindow)
else if (mrController.GetFocusManager().IsFocusShowing())
{
// Use the focus to determine the insertion position.
- SdInsertPasteDlg aDialog (pWindow);
- if (aDialog.Execute() == RET_OK)
+ ScopedVclPtrInstance< SdInsertPasteDlg > aDialog(pWindow);
+ if (aDialog->Execute() == RET_OK)
{
nInsertPosition = mrController.GetFocusManager().GetFocusedPageIndex();
- if ( ! aDialog.IsInsertBefore())
+ if ( ! aDialog->IsInsertBefore())
nInsertPosition ++;
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
index 3faf316f1dda..1ee52e80f1d6 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
@@ -87,7 +87,7 @@ void DragAndDropContext::UpdatePosition (
// Convert window coordinates into model coordinates (we need the
// window coordinates for auto-scrolling because that remains
// constant while scrolling.)
- SharedSdWindow pWindow (mpTargetSlideSorter->GetContentWindow());
+ sd::Window *pWindow (mpTargetSlideSorter->GetContentWindow());
const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
::boost::shared_ptr<InsertionIndicatorHandler> pInsertionIndicatorHandler (
mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler());
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index 5fcebfb83746..ccf32ce708e5 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -72,12 +72,12 @@ ScrollBarManager::~ScrollBarManager()
void ScrollBarManager::Connect()
{
- if (mpVerticalScrollBar != 0)
+ if (mpVerticalScrollBar != nullptr)
{
mpVerticalScrollBar->SetScrollHdl (
LINK(this, ScrollBarManager, VerticalScrollBarHandler));
}
- if (mpHorizontalScrollBar != 0)
+ if (mpHorizontalScrollBar != nullptr)
{
mpHorizontalScrollBar->SetScrollHdl(
LINK(this, ScrollBarManager, HorizontalScrollBarHandler));
@@ -86,11 +86,11 @@ void ScrollBarManager::Connect()
void ScrollBarManager::Disconnect()
{
- if (mpVerticalScrollBar != 0)
+ if (mpVerticalScrollBar != nullptr)
{
mpVerticalScrollBar->SetScrollHdl (Link());
}
- if (mpHorizontalScrollBar != 0)
+ if (mpHorizontalScrollBar != nullptr)
{
mpHorizontalScrollBar->SetScrollHdl (Link());
}
@@ -117,13 +117,13 @@ Rectangle ScrollBarManager::PlaceScrollBars (
bIsHorizontalScrollBarAllowed,
bIsVerticalScrollBarAllowed));
- if (mpHorizontalScrollBar!=0 && mpHorizontalScrollBar->IsVisible())
+ if (mpHorizontalScrollBar!=nullptr && mpHorizontalScrollBar->IsVisible())
PlaceHorizontalScrollBar (rAvailableArea);
- if (mpVerticalScrollBar!=0 && mpVerticalScrollBar->IsVisible())
+ if (mpVerticalScrollBar!=nullptr && mpVerticalScrollBar->IsVisible())
PlaceVerticalScrollBar (rAvailableArea);
- if (mpScrollBarFiller!=0 && mpScrollBarFiller->IsVisible())
+ if (mpScrollBarFiller!=nullptr && mpScrollBarFiller->IsVisible())
PlaceFiller (rAvailableArea);
return aRemainingSpace;
@@ -177,12 +177,12 @@ void ScrollBarManager::PlaceFiller (const Rectangle& aArea)
void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScrolling)
{
Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
Size aWindowModelSize (pWindow->PixelToLogic(pWindow->GetSizePixel()));
// The horizontal scroll bar is only shown when the window is
// horizontally smaller than the view.
- if (mpHorizontalScrollBar != 0 && mpHorizontalScrollBar->IsVisible())
+ if (mpHorizontalScrollBar != nullptr && mpHorizontalScrollBar->IsVisible())
{
mpHorizontalScrollBar->Show();
mpHorizontalScrollBar->SetRange (
@@ -212,7 +212,7 @@ void ScrollBarManager::UpdateScrollBars (bool bResetThumbPosition, bool bUseScro
}
// The vertical scroll bar is always shown.
- if (mpVerticalScrollBar != 0 && mpVerticalScrollBar->IsVisible())
+ if (mpVerticalScrollBar != nullptr && mpVerticalScrollBar->IsVisible())
{
mpVerticalScrollBar->SetRange (
Range(aModelArea.Top(), aModelArea.Bottom()));
@@ -257,7 +257,7 @@ IMPL_LINK(ScrollBarManager, VerticalScrollBarHandler, ScrollBar*, pScrollBar)
if (pScrollBar!=NULL
&& pScrollBar==mpVerticalScrollBar.get()
&& pScrollBar->IsVisible()
- && mrSlideSorter.GetContentWindow()!=0)
+ && mrSlideSorter.GetContentWindow())
{
double nRelativePosition = double(pScrollBar->GetThumbPos())
/ double(pScrollBar->GetRange().Len());
@@ -273,7 +273,7 @@ IMPL_LINK(ScrollBarManager, HorizontalScrollBarHandler, ScrollBar*, pScrollBar)
if (pScrollBar!=NULL
&& pScrollBar==mpHorizontalScrollBar.get()
&& pScrollBar->IsVisible()
- && mrSlideSorter.GetContentWindow()!=0)
+ && mrSlideSorter.GetContentWindow())
{
double nRelativePosition = double(pScrollBar->GetThumbPos())
/ double(pScrollBar->GetRange().Len());
@@ -291,7 +291,7 @@ void ScrollBarManager::SetWindowOrigin (
mnHorizontalPosition = nHorizontalPosition;
mnVerticalPosition = nVerticalPosition;
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
Size aViewSize (pWindow->GetViewSize());
Point aOrigin (
(long int) (mnHorizontalPosition * aViewSize.Width()),
@@ -431,7 +431,7 @@ void ScrollBarManager::SetTopLeft(const Point& rNewTopLeft)
int ScrollBarManager::GetVerticalScrollBarWidth() const
{
- if (mpVerticalScrollBar != 0 && mpVerticalScrollBar->IsVisible())
+ if (mpVerticalScrollBar != nullptr && mpVerticalScrollBar->IsVisible())
return mpVerticalScrollBar->GetSizePixel().Width();
else
return 0;
@@ -439,7 +439,7 @@ int ScrollBarManager::GetVerticalScrollBarWidth() const
int ScrollBarManager::GetHorizontalScrollBarHeight() const
{
- if (mpHorizontalScrollBar != 0 && mpHorizontalScrollBar->IsVisible())
+ if (mpHorizontalScrollBar != nullptr && mpHorizontalScrollBar->IsVisible())
return mpHorizontalScrollBar->GetSizePixel().Height();
else
return 0;
@@ -447,7 +447,7 @@ int ScrollBarManager::GetHorizontalScrollBarHeight() const
void ScrollBarManager::CalcAutoScrollOffset (const Point& rMouseWindowPosition)
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
int nDx = 0;
int nDy = 0;
@@ -458,7 +458,7 @@ void ScrollBarManager::CalcAutoScrollOffset (const Point& rMouseWindowPosition)
pWindow->LogicToPixel(mrSlideSorter.GetView().GetModelArea()));
if (aWindowSize.Width() > maScrollBorder.Width() * 3
- && mpHorizontalScrollBar != 0
+ && mpHorizontalScrollBar != nullptr
&& mpHorizontalScrollBar->IsVisible())
{
if (rMouseWindowPosition.X() < maScrollBorder.Width()
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 8bef190c0ecf..1483befc1217 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -318,7 +318,7 @@ SelectionFunction::SelectionFunction (
SfxRequest& rRequest)
: FuPoor (
rSlideSorter.GetViewShell(),
- rSlideSorter.GetContentWindow().get(),
+ rSlideSorter.GetContentWindow(),
&rSlideSorter.GetView(),
rSlideSorter.GetModel().GetDocument(),
rRequest),
@@ -1384,7 +1384,7 @@ void MultiSelectionModeHandler::UpdatePosition (
// Convert window coordinates into model coordinates (we need the
// window coordinates for auto-scrolling because that remains
// constant while scrolling.)
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
bool bDoAutoScroll = bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll(
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 17eaee29fd1a..c2be4751a2f8 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -190,7 +190,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_PRESENTATION_DLG:
FuSlideShowDlg::Create (
pShell,
- mrSlideSorter.GetContentWindow().get(),
+ mrSlideSorter.GetContentWindow(),
&mrSlideSorter.GetView(),
pDocument,
rRequest);
@@ -199,7 +199,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_CUSTOMSHOW_DLG:
FuCustomShowDlg::Create (
pShell,
- mrSlideSorter.GetContentWindow().get(),
+ mrSlideSorter.GetContentWindow(),
&mrSlideSorter.GetView(),
pDocument,
rRequest);
@@ -208,7 +208,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_EXPAND_PAGE:
FuExpandPage::Create (
pShell,
- mrSlideSorter.GetContentWindow().get(),
+ mrSlideSorter.GetContentWindow(),
&mrSlideSorter.GetView(),
pDocument,
rRequest);
@@ -217,7 +217,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_SUMMARY_PAGE:
FuSummaryPage::Create (
pShell,
- mrSlideSorter.GetContentWindow().get(),
+ mrSlideSorter.GetContentWindow(),
&mrSlideSorter.GetView(),
pDocument,
rRequest);
@@ -263,7 +263,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
boost::scoped_ptr<VclAbstractDialog> pDlg(pFact ? pFact->CreateSdPhotoAlbumDialog(
- mrSlideSorter.GetContentWindow().get(),
+ mrSlideSorter.GetContentWindow(),
pDocument) : 0);
if (pDlg)
@@ -280,7 +280,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
#ifdef ENABLE_SDREMOTE
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
VclAbstractDialog* pDlg = pFact ?
- pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow().get() ) :
+ pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow() ) :
0;
if (pDlg)
pDlg->Execute();
@@ -904,7 +904,7 @@ void SlotManager::RenameSlide()
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialog creation failed!");
boost::scoped_ptr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(
- mrSlideSorter.GetContentWindow().get(),
+ mrSlideSorter.GetContentWindow(),
aPageName, aDescr));
DBG_ASSERT(aNameDlg, "Dialog creation failed!");
aNameDlg->SetText( aTitle );
diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
index 4a29df00b43e..6ccc8afe539a 100644
--- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
@@ -104,7 +104,7 @@ void VisibleAreaManager::MakeVisible()
if (maVisibleRequests.empty())
return;
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if ( ! pWindow)
return;
const Point aCurrentTopLeft (pWindow->PixelToLogic(Point(0,0)));
@@ -148,7 +148,7 @@ void VisibleAreaManager::MakeVisible()
::boost::optional<Point> VisibleAreaManager::GetRequestedTopLeft() const
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if ( ! pWindow)
return ::boost::optional<Point>();
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
index ca039c316a4f..d62acead1377 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
@@ -25,7 +25,6 @@
#include <tools/link.hxx>
#include <tools/gen.hxx>
#include <vcl/timer.hxx>
-#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
class ScrollBar;
@@ -179,12 +178,12 @@ private:
/** The horizontal scroll bar. Note that is used but not owned by
objects of this class. It is given to the constructor.
*/
- ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
+ VclPtr<ScrollBar> mpHorizontalScrollBar;
/** The vertical scroll bar. Note that is used but not owned by
objects of this class. It is given to the constructor.
*/
- ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<ScrollBar> mpVerticalScrollBar;
/// Relative horizontal position of the visible area in the view.
double mnHorizontalPosition;
@@ -200,7 +199,7 @@ private:
the bottom right corner left by the two scroll bars (when both are
visible).
*/
- ::boost::shared_ptr<ScrollBarBox> mpScrollBarFiller;
+ VclPtr<ScrollBarBox> mpScrollBarFiller;
/** The auto scroll timer is used for keep scrolling the window when the
mouse reaches its border while dragging a selection. When the mouse
@@ -213,7 +212,7 @@ private:
/** The content window is the one whose view port is controlled by the
scroll bars.
*/
- SharedSdWindow mpContentWindow;
+ VclPtr<sd::Window> mpContentWindow;
::boost::function<void()> maAutoScrollFunctor;
diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
index 88402e727395..38b5d4ac08c4 100644
--- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -227,7 +227,7 @@ public:
void Dispose();
private:
view::SlideSorterView& mrView;
- SharedSdWindow mpWindow;
+ VclPtr<sd::Window> mpWindow;
};
ToolTip& GetToolTip() const;
diff --git a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
index eeba70945715..ff2c2a8d60ae 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
@@ -64,7 +64,7 @@ public:
enum Orientation { HORIZONTAL, VERTICAL, GRID };
Layouter (
- const SharedSdWindow& rpWindow,
+ sd::Window *rpWindow,
const ::boost::shared_ptr<Theme>& rpTheme);
~Layouter();
@@ -192,7 +192,7 @@ public:
private:
::boost::scoped_ptr<Implementation> mpImplementation;
- SharedSdWindow mpWindow;
+ VclPtr<sd::Window> mpWindow;
};
/** Collect all values concerning the logical and visual properties of the
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
index 426e36c830fb..a6bb3345b532 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
@@ -48,7 +48,7 @@ public:
PageObjectLayouter(
const Size& rPageObjectWindowSize,
const Size& rPreviewModelSize,
- const SharedSdWindow& rpWindow,
+ sd::Window *pWindow,
const sal_Int32 nPageCount);
~PageObjectLayouter();
@@ -125,7 +125,7 @@ private:
const CoordinateSystem eCoordinateSystem);
private:
- SharedSdWindow mpWindow;
+ VclPtr<sd::Window> mpWindow;
Size maPageObjectSize;
Rectangle maFocusIndicatorBoundingBox;
Rectangle maPageObjectBoundingBox;
diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
index a49035773b2b..ed1dd0f235ef 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorter.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
@@ -71,18 +71,18 @@ private:
::boost::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter(
ViewShell& rViewShell,
- const ::boost::shared_ptr<sd::Window>& rpContentWindow,
- const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
- const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
- const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox)
+ sd::Window* pContentWindow,
+ ScrollBar* pHorizontalScrollBar,
+ ScrollBar* pVerticalScrollBar,
+ ScrollBarBox* pScrollBarBox)
{
::boost::shared_ptr<SlideSorter> pSlideSorter(
new SlideSorter(
rViewShell,
- rpContentWindow,
- rpHorizontalScrollBar,
- rpVerticalScrollBar,
- rpScrollBarBox));
+ pContentWindow,
+ pHorizontalScrollBar,
+ pVerticalScrollBar,
+ pScrollBarBox));
pSlideSorter->Init();
return pSlideSorter;
}
@@ -103,10 +103,10 @@ private:
SlideSorter::SlideSorter (
ViewShell& rViewShell,
- const ::boost::shared_ptr<sd::Window>& rpContentWindow,
- const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
- const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
- const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox)
+ sd::Window* pContentWindow,
+ ScrollBar* pHorizontalScrollBar,
+ ScrollBar* pVerticalScrollBar,
+ ScrollBarBox* pScrollBarBox)
: mbIsValid(false),
mpSlideSorterController(),
mpSlideSorterModel(),
@@ -114,11 +114,11 @@ SlideSorter::SlideSorter (
mxControllerWeak(),
mpViewShell(&rViewShell),
mpViewShellBase(&rViewShell.GetViewShellBase()),
- mpContentWindow(rpContentWindow),
+ mpContentWindow(pContentWindow),
mbOwnesContentWindow(false),
- mpHorizontalScrollBar(rpHorizontalScrollBar),
- mpVerticalScrollBar(rpVerticalScrollBar),
- mpScrollBarBox(rpScrollBarBox),
+ mpHorizontalScrollBar(pHorizontalScrollBar),
+ mpVerticalScrollBar(pVerticalScrollBar),
+ mpScrollBarBox(pScrollBarBox),
mbLayoutPending(true),
mpProperties(new controller::Properties()),
mpTheme(new view::Theme(mpProperties))
@@ -136,11 +136,11 @@ SlideSorter::SlideSorter (
mxControllerWeak(),
mpViewShell(pViewShell),
mpViewShellBase(&rBase),
- mpContentWindow(new ContentWindow(rParentWindow,*this )),
+ mpContentWindow(VclPtr<ContentWindow>::Create(rParentWindow,*this )),
mbOwnesContentWindow(true),
- mpHorizontalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_HSCROLL | WB_DRAG))),
- mpVerticalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_VSCROLL | WB_DRAG))),
- mpScrollBarBox(new ScrollBarBox(&rParentWindow)),
+ mpHorizontalScrollBar(VclPtr<ScrollBar>::Create(&rParentWindow,WinBits(WB_HSCROLL | WB_DRAG))),
+ mpVerticalScrollBar(VclPtr<ScrollBar>::Create(&rParentWindow,WinBits(WB_VSCROLL | WB_DRAG))),
+ mpScrollBarBox(VclPtr<ScrollBarBox>::Create(&rParentWindow)),
mbLayoutPending(true),
mpProperties(new controller::Properties()),
mpTheme(new view::Theme(mpProperties))
@@ -170,7 +170,7 @@ void SlideSorter::Init()
SetupListeners ();
// Initialize the window.
- SharedSdWindow pContentWindow (GetContentWindow());
+ sd::Window *pContentWindow (GetContentWindow());
if (pContentWindow)
{
::vcl::Window* pParentWindow = pContentWindow->GetParent();
@@ -211,18 +211,6 @@ SlideSorter::~SlideSorter()
mpHorizontalScrollBar.reset();
mpVerticalScrollBar.reset();
mpScrollBarBox.reset();
-
- if (mbOwnesContentWindow)
- {
- OSL_ASSERT(mpContentWindow.unique());
- }
- else
- {
- // Assume that outside this class only the owner holds a reference
- // to the content window.
- OSL_ASSERT(mpContentWindow.use_count()==2);
- }
- mpContentWindow.reset();
}
model::SlideSorterModel& SlideSorter::GetModel() const
@@ -253,7 +241,7 @@ void SlideSorter::Paint (const Rectangle& rRepaintArea)
{
GetController().Paint(
rRepaintArea,
- GetContentWindow().get());
+ GetContentWindow());
}
void SlideSorter::SetupControls (::vcl::Window* )
@@ -263,7 +251,7 @@ void SlideSorter::SetupControls (::vcl::Window* )
void SlideSorter::SetupListeners()
{
- SharedSdWindow pWindow (GetContentWindow());
+ sd::Window *pWindow (GetContentWindow());
if (pWindow)
{
::vcl::Window* pParentWindow = pWindow->GetParent();
@@ -292,7 +280,7 @@ void SlideSorter::ReleaseListeners()
{
mpSlideSorterController->GetScrollBarManager().Disconnect();
- SharedSdWindow pWindow (GetContentWindow());
+ sd::Window *pWindow (GetContentWindow());
if (pWindow)
{
pWindow->RemoveEventListener(
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index cbb9c3731875..2f2aa0d73505 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -181,7 +181,7 @@ void SlideSorterViewShell::Initialize()
// the new view shell. (One is created earlier while the construtor
// of the base class is executed. At that time the correct
// accessibility object can not be constructed.)
- SharedSdWindow pWindow (mpSlideSorter->GetContentWindow());
+ sd::Window *pWindow (mpSlideSorter->GetContentWindow());
if (pWindow)
{
pWindow->Hide();
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index d4839971f2cc..33b9643073de 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -131,7 +131,7 @@ TYPEINIT1(SlideSorterView, ::sd::View);
SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
: ::sd::View (
*rSlideSorter.GetModel().GetDocument(),
- rSlideSorter.GetContentWindow().get(),
+ rSlideSorter.GetContentWindow(),
rSlideSorter.GetViewShell()),
mrSlideSorter(rSlideSorter),
mrModel(rSlideSorter.GetModel()),
@@ -216,7 +216,7 @@ sal_Int32 SlideSorterView::GetPageIndexAtPoint (const Point& rWindowPosition) co
{
sal_Int32 nIndex (-1);
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
nIndex = mpLayouter->GetIndexAtPoint(pWindow->PixelToLogic(rWindowPosition), false, false);
@@ -316,7 +316,7 @@ void SlideSorterView::Rearrange()
if (mrModel.GetPageCount() <= 0)
return;
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if ( ! pWindow)
return;
const Size aWindowSize (pWindow->GetSizePixel());
@@ -347,7 +347,7 @@ void SlideSorterView::UpdateOrientation()
else
{
// Get access to the docking window.
- vcl::Window* pWindow = mrSlideSorter.GetContentWindow().get();
+ vcl::Window* pWindow = mrSlideSorter.GetContentWindow();
PaneDockingWindow* pDockingWindow = NULL;
while (pWindow!=NULL && pDockingWindow==NULL)
{
@@ -408,7 +408,7 @@ void SlideSorterView::UpdateOrientation()
void SlideSorterView::Layout ()
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
// Set the model area, i.e. the smallest rectangle that includes all
@@ -450,7 +450,7 @@ void SlideSorterView::InvalidatePageObjectVisibilities()
void SlideSorterView::DeterminePageObjectVisibilities()
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
// Set this flag to true here so that an invalidate during the
@@ -547,7 +547,7 @@ bool SlideSorterView::SetOrientation (const Layouter::Orientation eOrientation)
void SlideSorterView::RequestRepaint()
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
mpLayeredDevice->InvalidateAllLayers(
@@ -566,7 +566,7 @@ void SlideSorterView::RequestRepaint (const model::SharedPageDescriptor& rpDescr
void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
mpLayeredDevice->InvalidateAllLayers(rRepaintBox);
@@ -576,7 +576,7 @@ void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
void SlideSorterView::RequestRepaint (const vcl::Region& rRepaintRegion)
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
mpLayeredDevice->InvalidateAllLayers(rRepaintRegion);
@@ -612,7 +612,7 @@ void SlideSorterView::CompleteRedraw (
mnLockRedrawSmph ? "locked" : "");
#endif
- if (pDevice == NULL || pDevice!=mrSlideSorter.GetContentWindow().get())
+ if (pDevice == NULL || pDevice!=mrSlideSorter.GetContentWindow())
return;
// The parent implementation of CompleteRedraw is called only when
@@ -700,7 +700,7 @@ void SlideSorterView::ConfigurationChanged (
::boost::shared_ptr<cache::PageCache> SlideSorterView::GetPreviewCache()
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow && mpPreviewCache.get() == NULL)
{
mpPreviewCache.reset(
@@ -764,8 +764,8 @@ void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint
void SlideSorterView::UpdatePageUnderMouse ()
{
- ::boost::shared_ptr<ScrollBar> pVScrollBar (mrSlideSorter.GetVerticalScrollBar());
- ::boost::shared_ptr<ScrollBar> pHScrollBar (mrSlideSorter.GetHorizontalScrollBar());
+ VclPtr<ScrollBar> pVScrollBar (mrSlideSorter.GetVerticalScrollBar());
+ VclPtr<ScrollBar> pHScrollBar (mrSlideSorter.GetHorizontalScrollBar());
if ((pVScrollBar && pVScrollBar->IsVisible() && pVScrollBar->IsTracking())
|| (pHScrollBar && pHScrollBar->IsVisible() && pHScrollBar->IsTracking()))
{
@@ -775,7 +775,7 @@ void SlideSorterView::UpdatePageUnderMouse ()
return;
}
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (pWindow && pWindow->IsVisible() && ! pWindow->IsMouseCaptured())
{
const Window::PointerState aPointerState (pWindow->GetPointerState());
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
index 980487e7d4e1..ad3a4a9ae83d 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -40,10 +40,10 @@ class AnimatorAccess
public:
virtual void AddRun (const ::boost::shared_ptr<PageObjectRun>& rRun) = 0;
virtual void RemoveRun (const ::boost::shared_ptr<PageObjectRun>& rRun) = 0;
- virtual model::SlideSorterModel& GetModel() const = 0;
- virtual view::SlideSorterView& GetView() const = 0;
- virtual ::boost::shared_ptr<controller::Animator> GetAnimator() = 0;
- virtual SharedSdWindow GetContentWindow() = 0;
+ virtual model::SlideSorterModel& GetModel (void) const = 0;
+ virtual view::SlideSorterView& GetView (void) const = 0;
+ virtual ::boost::shared_ptr<controller::Animator> GetAnimator (void) = 0;
+ virtual VclPtr<sd::Window> GetContentWindow (void) = 0;
protected:
~AnimatorAccess() {}
@@ -128,7 +128,7 @@ public:
virtual model::SlideSorterModel& GetModel() const SAL_OVERRIDE { return mrModel; }
virtual view::SlideSorterView& GetView() const SAL_OVERRIDE { return mrView; }
virtual ::boost::shared_ptr<controller::Animator> GetAnimator() SAL_OVERRIDE { return mpAnimator; }
- virtual SharedSdWindow GetContentWindow() SAL_OVERRIDE { return mrSlideSorter.GetContentWindow(); }
+ virtual VclPtr<sd::Window> GetContentWindow() SAL_OVERRIDE { return mrSlideSorter.GetContentWindow(); }
private:
model::SlideSorterModel& mrModel;
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
index 2675746f4306..2561c90c667c 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
@@ -134,19 +134,17 @@ void InsertionIndicatorOverlay::Create (
// Create virtual devices for bitmap and mask whose bitmaps later be
// combined to form the BitmapEx of the icon.
- VirtualDevice aContent (
- *mrSlideSorter.GetContentWindow(),
- 0,
- 0);
- aContent.SetOutputSizePixel(aIconSize);
+ ScopedVclPtrInstance<VirtualDevice> pContent(
+ *mrSlideSorter.GetContentWindow(), 0, 0);
+ pContent->SetOutputSizePixel(aIconSize);
- aContent.SetFillColor();
- aContent.SetLineColor(pTheme->GetColor(Theme::Color_PreviewBorder));
- const Point aOffset = PaintRepresentatives(aContent, aPreviewSize, nOffset, rRepresentatives);
+ pContent->SetFillColor();
+ pContent->SetLineColor(pTheme->GetColor(Theme::Color_PreviewBorder));
+ const Point aOffset = PaintRepresentatives(*pContent.get(), aPreviewSize, nOffset, rRepresentatives);
- PaintPageCount(aContent, nSelectionCount, aPreviewSize, aOffset);
+ PaintPageCount(*pContent.get(), nSelectionCount, aPreviewSize, aOffset);
- maIcon = aContent.GetBitmapEx(Point(0,0), aIconSize);
+ maIcon = pContent->GetBitmapEx(Point(0,0), aIconSize);
maIcon.Scale(aIconSize);
}
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
index ffbd7d686c64..65086d7dead4 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -38,10 +38,10 @@ class LayerInvalidator : public ILayerInvalidator
public:
LayerInvalidator (
const ::boost::shared_ptr<LayeredDevice>& rpLayeredDevice,
- const SharedSdWindow& rpTargetWindow,
+ sd::Window *pTargetWindow,
const int nLayer)
: mpLayeredDevice(rpLayeredDevice),
- mpTargetWindow(rpTargetWindow),
+ mpTargetWindow(pTargetWindow),
mnLayer(nLayer)
{
}
@@ -58,7 +58,7 @@ public:
private:
const ::boost::shared_ptr<LayeredDevice> mpLayeredDevice;
- SharedSdWindow mpTargetWindow;
+ VclPtr<sd::Window> mpTargetWindow;
const int mnLayer;
};
@@ -107,7 +107,7 @@ public:
Layer();
~Layer();
- void Initialize (const SharedSdWindow& rpTargetWindow);
+ void Initialize (sd::Window *pTargetWindow);
void InvalidateRectangle (const Rectangle& rInvalidationBox);
void InvalidateRegion (const vcl::Region& rInvalidationRegion);
void Validate (const MapMode& rMapMode);
@@ -121,7 +121,7 @@ public:
void Dispose();
private:
- ::boost::shared_ptr<VirtualDevice> mpLayerDevice;
+ ScopedVclPtr<VirtualDevice> mpLayerDevice;
::std::vector<SharedILayerPainter> maPainters;
vcl::Region maInvalidationRegion;
@@ -159,11 +159,11 @@ private:
//===== LayeredDevice =========================================================
-LayeredDevice::LayeredDevice (const SharedSdWindow& rpTargetWindow)
- : mpTargetWindow(rpTargetWindow),
+LayeredDevice::LayeredDevice (VclPtr<sd::Window> pTargetWindow)
+ : mpTargetWindow(pTargetWindow),
mpLayers(new LayerContainer()),
- mpBackBuffer(new VirtualDevice(*mpTargetWindow)),
- maSavedMapMode(rpTargetWindow->GetMapMode())
+ mpBackBuffer(VclPtr<VirtualDevice>::Create(*mpTargetWindow)),
+ maSavedMapMode(pTargetWindow->GetMapMode())
{
mpBackBuffer->SetOutputSizePixel(mpTargetWindow->GetSizePixel());
}
@@ -379,15 +379,15 @@ Layer::~Layer()
{
}
-void Layer::Initialize (const SharedSdWindow& rpTargetWindow)
+void Layer::Initialize (sd::Window *pTargetWindow)
{
#if 0
- (void)rpTargetWindow;
+ (void)pTargetWindow;
#else
if ( ! mpLayerDevice)
{
- mpLayerDevice.reset(new VirtualDevice(*rpTargetWindow));
- mpLayerDevice->SetOutputSizePixel(rpTargetWindow->GetSizePixel());
+ mpLayerDevice.reset(VclPtr<VirtualDevice>::Create(*pTargetWindow));
+ mpLayerDevice->SetOutputSizePixel(pTargetWindow->GetSizePixel());
}
#endif
}
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
index 4cbbf5b22d59..f614842afe33 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
@@ -45,8 +45,8 @@ class LayeredDevice
{
public:
- LayeredDevice (const SharedSdWindow& rpTargetWindow);
- ~LayeredDevice();
+ LayeredDevice (VclPtr<sd::Window> pTargetWindow);
+ ~LayeredDevice ();
void Invalidate (
const Rectangle& rInvalidationBox,
@@ -72,10 +72,10 @@ public:
void Dispose();
private:
- SharedSdWindow mpTargetWindow;
+ VclPtr<sd::Window> mpTargetWindow;
class LayerContainer;
::boost::scoped_ptr<LayerContainer> mpLayers;
- ::boost::scoped_ptr<VirtualDevice> mpBackBuffer;
+ ScopedVclPtr<VirtualDevice> mpBackBuffer;
MapMode maSavedMapMode;
void RepaintRectangle (const Rectangle& rRepaintRectangle);
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index fd85c1c61b9f..3d68dec61e4e 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -29,7 +29,7 @@ namespace sd { namespace slidesorter { namespace view {
class Layouter::Implementation
{
public:
- SharedSdWindow mpWindow;
+ VclPtr<sd::Window> mpWindow;
sal_Int32 mnRequestedLeftBorder;
sal_Int32 mnRequestedRightBorder;
sal_Int32 mnRequestedTopBorder;
@@ -200,7 +200,7 @@ public:
protected:
Implementation (
- const SharedSdWindow& rpWindow,
+ sd::Window *pWindow,
const ::boost::shared_ptr<view::Theme>& rpTheme);
Implementation (const Implementation& rImplementation);
@@ -271,7 +271,7 @@ class GridImplementation : public Layouter::Implementation
{
public:
GridImplementation (
- const SharedSdWindow& rpWindow,
+ sd::Window *pWindow,
const ::boost::shared_ptr<view::Theme>& rpTheme);
GridImplementation (const Implementation& rImplementation);
@@ -292,10 +292,10 @@ protected:
//===== Layouter ==============================================================
Layouter::Layouter (
- const SharedSdWindow& rpWindow,
+ sd::Window *pWindow,
const ::boost::shared_ptr<Theme>& rpTheme)
- : mpImplementation(new GridImplementation(rpWindow, rpTheme)),
- mpWindow(rpWindow)
+ : mpImplementation(new GridImplementation(pWindow, rpTheme)),
+ mpWindow(pWindow)
{
}
@@ -427,9 +427,9 @@ Layouter::Implementation* Layouter::Implementation::Create (
}
Layouter::Implementation::Implementation (
- const SharedSdWindow& rpWindow,
+ sd::Window *pWindow,
const ::boost::shared_ptr<view::Theme>& rpTheme)
- : mpWindow(rpWindow),
+ : mpWindow(pWindow),
mnRequestedLeftBorder(5),
mnRequestedRightBorder(5),
mnRequestedTopBorder(5),
@@ -1102,9 +1102,9 @@ void VerticalImplementation::CalculateLogicalInsertPosition (
//===== GridImplementation ================================================
GridImplementation::GridImplementation (
- const SharedSdWindow& rpWindow,
+ sd::Window *pWindow,
const ::boost::shared_ptr<view::Theme>& rpTheme)
- : Implementation(rpWindow, rpTheme)
+ : Implementation(pWindow, rpTheme)
{
}
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
index 7a32476deb43..6940830fd94c 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
@@ -38,9 +38,9 @@ const static sal_Int32 gnInfoAreaMinWidth = 26;
PageObjectLayouter::PageObjectLayouter (
const Size& rPageObjectWindowSize,
const Size& rPageSize,
- const SharedSdWindow& rpWindow,
+ sd::Window *pWindow,
const sal_Int32 nPageCount)
- : mpWindow(rpWindow),
+ : mpWindow(pWindow),
maPageObjectSize(rPageObjectWindowSize.Width(), rPageObjectWindowSize.Height()),
maPageObjectBoundingBox(),
maPageNumberAreaBoundingBox(),
@@ -48,7 +48,7 @@ PageObjectLayouter::PageObjectLayouter (
maTransitionEffectBoundingBox(),
maTransitionEffectIcon(IconCache::Instance().GetIcon(BMP_FADE_EFFECT_INDICATOR)),
maCustomAnimationEffectIcon(IconCache::Instance().GetIcon(BMP_CUSTOM_ANIMATION_INDICATOR)),
- mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rpWindow))
+ mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *pWindow))
{
const Size aPageNumberAreaSize (GetPageNumberAreaSize(nPageCount));
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index d5b9d8a92b36..d7f9393d467f 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -160,11 +160,11 @@ Bitmap PageObjectPainter::CreateMarkedPreview (
const BitmapEx& rOverlay,
const OutputDevice* pReferenceDevice) const
{
- ::boost::scoped_ptr<VirtualDevice> pDevice;
+ ScopedVclPtr<VirtualDevice> pDevice;
if (pReferenceDevice != NULL)
- pDevice.reset(new VirtualDevice(*pReferenceDevice));
+ pDevice.reset(VclPtr<VirtualDevice>::Create(*pReferenceDevice));
else
- pDevice.reset(new VirtualDevice());
+ pDevice.reset(VclPtr<VirtualDevice>::Create());
pDevice->SetOutputSizePixel(rSize);
pDevice->DrawBitmap(Point(0,0), rSize, rPreview);
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
index 16ba566729be..97fa698bb7f7 100644
--- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
@@ -37,7 +37,7 @@ ToolTip::ToolTip (SlideSorter& rSlideSorter)
maShowTimer(),
maHiddenTimer()
{
- SharedSdWindow window = rSlideSorter.GetContentWindow();
+ sd::Window *window = rSlideSorter.GetContentWindow();
const HelpSettings& rHelpSettings = window->GetSettings().GetHelpSettings();
maShowTimer.SetTimeout(rHelpSettings.GetTipDelay());
maShowTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
@@ -109,7 +109,7 @@ void ToolTip::DoShow()
return;
}
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow());
if (!msCurrentHelpText.isEmpty() && pWindow)
{
Rectangle aBox (
@@ -124,7 +124,7 @@ void ToolTip::DoShow()
if (aBox.Bottom() >= pWindow->GetSizePixel().Height())
return;
- vcl::Window* pParent (pWindow.get());
+ vcl::Window* pParent (pWindow);
while (pParent!=NULL && pParent->GetParent()!=NULL)
pParent = pParent->GetParent();
const Point aOffset (pWindow->GetWindowExtentsRelative(pParent).TopLeft());
@@ -135,7 +135,7 @@ void ToolTip::DoShow()
// tip at the top of a rectangle that is placed below the preview.
aBox.Move(aOffset.X(), aOffset.Y() + aBox.GetHeight() + 3);
mnHelpWindowHandle = Help::ShowTip(
- pWindow.get(),
+ pWindow,
aBox,
msCurrentHelpText,
QUICKHELP_CENTER | QUICKHELP_TOP);
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
index e4f99d20a654..ffd9a825319c 100644
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
@@ -65,7 +65,7 @@ void ViewCacheContext::NotifyPreviewCreation (
bool ViewCacheContext::IsIdle()
{
- sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow().get()));
+ sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow()));
if (nIdleState == tools::IdleDetection::IDET_IDLE)
return true;
else
diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx
index 8e9f65b1a5c7..7d337d17c159 100644
--- a/sd/source/ui/table/TableDesignPane.cxx
+++ b/sd/source/ui/table/TableDesignPane.cxx
@@ -806,14 +806,14 @@ short TableDesignDialog::Execute()
return RET_CANCEL;
}
-::vcl::Window * createTableDesignPanel( ::vcl::Window* pParent, ViewShellBase& rBase )
+VclPtr<::vcl::Window> createTableDesignPanel( ::vcl::Window* pParent, ViewShellBase& rBase )
{
- return new TableDesignPane( pParent, rBase );
+ return VclPtr<TableDesignPane>::Create( pParent, rBase );
}
void showTableDesignDialog( ::vcl::Window* pParent, ViewShellBase& rBase )
{
- boost::scoped_ptr< TableDesignDialog > xDialog( new TableDesignDialog( pParent, rBase ) );
+ ScopedVclPtrInstance< TableDesignDialog > xDialog( pParent, rBase );
xDialog->Execute();
}
diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx
index 0fb256cc103c..ecf324078546 100644
--- a/sd/source/ui/table/TableDesignPane.hxx
+++ b/sd/source/ui/table/TableDesignPane.hxx
@@ -92,8 +92,8 @@ private:
private:
ViewShellBase& mrBase;
- TableValueSet* m_pValueSet;
- CheckBox* m_aCheckBoxes[CB_COUNT];
+ VclPtr<TableValueSet> m_pValueSet;
+ VclPtr<CheckBox> m_aCheckBoxes[CB_COUNT];
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSelectedTable;
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx
index bff275971dde..c1c4b2185a7b 100644
--- a/sd/source/ui/tools/PreviewRenderer.cxx
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -64,7 +64,7 @@ namespace {
PreviewRenderer::PreviewRenderer (
OutputDevice* pTemplate,
const bool bHasFrame)
- : mpPreviewDevice (new VirtualDevice()),
+ : mpPreviewDevice (VclPtr<VirtualDevice>::Create()),
mpDocShellOfView(NULL),
maFrameColor (svtools::ColorConfig().GetColorValue(svtools::DOCBOUNDARIES).nColor),
mbHasFrame(bHasFrame)
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 7498fca7ff3f..2e00c231b758 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -730,7 +730,7 @@ throw (UnknownPropertyException, PropertyVetoException,
SfxPrinter *pTempPrinter = pDocSh->GetPrinter( true );
if (pTempPrinter)
{
- SfxPrinter *pNewPrinter = new SfxPrinter( pTempPrinter->GetOptions().Clone(), aPrinterName );
+ VclPtr<SfxPrinter> pNewPrinter = VclPtr<SfxPrinter>::Create( pTempPrinter->GetOptions().Clone(), aPrinterName );
pDocSh->SetPrinter( pNewPrinter );
}
}
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 369ae83699d7..3425148d3fc7 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1885,8 +1885,8 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) )
{
- VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
- OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
+ VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >();
if( pOut )
{
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index b49fffc24a82..d3e44fb3561e 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -256,7 +256,7 @@ namespace {
{
public:
PrintInfo (
- const Printer* pPrinter,
+ Printer* pPrinter,
const bool bPrintMarkedOnly)
: mpPrinter(pPrinter),
mnDrawMode(DRAWMODE_DEFAULT),
@@ -269,7 +269,7 @@ namespace {
mbPrintMarkedOnly(bPrintMarkedOnly)
{}
- const Printer* mpPrinter;
+ const VclPtr<Printer> mpPrinter;
sal_uLong mnDrawMode;
OUString msTimeDate;
OUString msPageString;
@@ -1201,8 +1201,9 @@ public:
if (aDev >>= xRenderDevice)
{
VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice);
- OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
- mpPrinter = dynamic_cast<Printer*>(pOut);
+ VclPtr< OutputDevice > pOut = pDevice ? pDevice->GetOutputDevice()
+ : VclPtr< OutputDevice >();
+ mpPrinter = dynamic_cast<Printer*>(pOut.get());
Size aPageSizePixel = mpPrinter ? mpPrinter->GetPaperSizePixel() : Size();
if( aPageSizePixel != maPrinterPageSizePixel )
{
@@ -1300,11 +1301,11 @@ public:
// Show warning that the orientation could not be set.
if (pViewShell)
{
- WarningBox aWarnBox(
+ ScopedVclPtrInstance<WarningBox> aWarnBox(
pViewShell->GetActiveWindow(),
(WinBits)(WB_OK_CANCEL | WB_DEF_CANCEL),
SD_RESSTR(STR_WARN_PRINTFORMAT_FAILURE));
- if (aWarnBox.Execute() != RET_OK)
+ if (aWarnBox->Execute() != RET_OK)
return;
}
}
@@ -1337,7 +1338,7 @@ private:
SfxObjectShellRef mxObjectShell; // destroying mpPrintView
ViewShellBase& mrBase;
bool mbIsDisposed;
- Printer* mpPrinter;
+ VclPtr<Printer> mpPrinter;
Size maPrinterPageSizePixel;
::boost::scoped_ptr<PrintOptions> mpOptions;
::std::vector< ::boost::shared_ptr< ::sd::PrinterPage> > maPrinterPages;
@@ -1422,7 +1423,7 @@ private:
PrintInfo aInfo (mpPrinter, mpOptions->IsPrintMarkedOnly());
- if (aInfo.mpPrinter!=NULL && pShell!=NULL)
+ if (aInfo.mpPrinter!=nullptr && pShell!=NULL)
{
MapMode aMap (aInfo.mpPrinter->GetMapMode());
@@ -1879,7 +1880,7 @@ private:
const PageKind ePageKind,
PrintInfo& rInfo)
{
- OSL_ASSERT(rInfo.mpPrinter != NULL);
+ OSL_ASSERT(rInfo.mpPrinter != nullptr);
// Fill in page kind specific data.
SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc();
diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx
index 989790d0fb42..03ac6c7045bd 100644
--- a/sd/source/ui/view/FormShellManager.cxx
+++ b/sd/source/ui/view/FormShellManager.cxx
@@ -138,7 +138,7 @@ void FormShellManager::RegisterAtCenterPane()
return;
mpMainViewShellWindow = pShell->GetActiveWindow();
- if (mpMainViewShellWindow == NULL)
+ if (mpMainViewShellWindow == nullptr)
return;
// Register at the window to get informed when to move the form
@@ -158,7 +158,7 @@ void FormShellManager::RegisterAtCenterPane()
void FormShellManager::UnregisterAtCenterPane()
{
- if (mpMainViewShellWindow != NULL)
+ if (mpMainViewShellWindow != nullptr)
{
// Unregister from the window.
mpMainViewShellWindow->RemoveEventListener(
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 1a08634b5851..3ec2a1bc92aa 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1068,9 +1068,9 @@ void Outliner::ShowEndOfSearchDialog()
// Show the message in an info box that is modal with respect to the
// whole application.
- MessageDialog aInfoBox(NULL, aString, VCL_MESSAGE_INFO);
+ ScopedVclPtrInstance< MessageDialog > aInfoBox(nullptr, aString, VCL_MESSAGE_INFO);
- ShowModalMessageBox (aInfoBox);
+ ShowModalMessageBox (*aInfoBox.get());
mbWholeDocumentProcessed = true;
}
@@ -1109,12 +1109,10 @@ bool Outliner::ShowWrapArroundDialog()
// Pop up question box that asks the user whether to wrap around.
// The dialog is made modal with respect to the whole application.
- QueryBox aQuestionBox (
- NULL,
- WB_YES_NO | WB_DEF_YES,
- SD_RESSTR(nStringId));
- aQuestionBox.SetImage (QueryBox::GetStandardImage());
- sal_uInt16 nBoxResult = ShowModalMessageBox(aQuestionBox);
+ ScopedVclPtrInstance<QueryBox> aQuestionBox (
+ nullptr, WB_YES_NO | WB_DEF_YES, SD_RESSTR(nStringId));
+ aQuestionBox->SetImage (QueryBox::GetStandardImage());
+ sal_uInt16 nBoxResult = ShowModalMessageBox(*aQuestionBox.get());
bDoWrapArround = (nBoxResult == RET_YES);
}
@@ -1157,9 +1155,9 @@ void Outliner::PrepareSpellCheck()
{
mbError = true;
mbEndOfSearch = true;
- MessageDialog aErrorBox (NULL,
- SD_RESSTR(STR_NOLANGUAGE));
- ShowModalMessageBox (aErrorBox);
+ ScopedVclPtrInstance<MessageDialog> aErrorBox (
+ nullptr, SD_RESSTR(STR_NOLANGUAGE));
+ ShowModalMessageBox (*aErrorBox.get());
}
else if (eState != EE_SPELL_OK)
{
@@ -1376,8 +1374,8 @@ bool Outliner::HandleFailedSearch()
if (HasNoPreviousMatch ())
{
// No match found in the whole presentation. Tell the user.
- InfoBox aInfoBox (NULL, SD_RESSTR(STR_SAR_NOT_FOUND));
- ShowModalMessageBox (aInfoBox);
+ ScopedVclPtrInstance< InfoBox > aInfoBox(nullptr, SD_RESSTR(STR_SAR_NOT_FOUND));
+ ShowModalMessageBox (*aInfoBox.get());
}
else
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index c95dd452142d..1f1adb72fa89 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -139,7 +139,7 @@ public:
the content window.
It does not include the ViewTabBar.
*/
- ::boost::scoped_ptr< vcl::Window> mpViewWindow;
+ VclPtr<vcl::Window> mpViewWindow;
::boost::shared_ptr<ToolBarManager> mpToolBarManager;
::boost::shared_ptr<ViewShellManager> mpViewShellManager;
::boost::shared_ptr<tools::EventMultiplexer> mpEventMultiplexer;
@@ -204,6 +204,7 @@ class FocusForwardingWindow : public vcl::Window
public:
FocusForwardingWindow (vcl::Window& rParentWindow, ViewShellBase& rBase);
virtual ~FocusForwardingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void KeyInput (const KeyEvent& rEvent) SAL_OVERRIDE;
virtual void Command (const CommandEvent& rEvent) SAL_OVERRIDE;
@@ -239,7 +240,7 @@ ViewShellBase::ViewShellBase (
mpDocument (NULL)
{
mpImpl.reset(new Implementation(*this));
- mpImpl->mpViewWindow.reset(new FocusForwardingWindow(_pFrame->GetWindow(),*this));
+ mpImpl->mpViewWindow = VclPtr<FocusForwardingWindow>::Create(_pFrame->GetWindow(),*this);
mpImpl->mpViewWindow->SetBackground(Wallpaper());
_pFrame->GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor());
@@ -532,11 +533,11 @@ sal_uInt16 ViewShellBase::SetPrinter (
bool bScaleAll = false;
if ( bIsAPI )
{
- WarningBox aWarnBox (
+ ScopedVclPtrInstance<WarningBox> aWarnBox (
GetWindow(),
(WinBits)(WB_YES_NO | WB_DEF_YES),
SD_RESSTR(STR_SCALE_OBJS_TO_PAGE));
- bScaleAll = (aWarnBox.Execute() == RET_YES);
+ bScaleAll = (aWarnBox->Execute() == RET_YES);
}
::boost::shared_ptr<DrawViewShell> pDrawViewShell (
@@ -1027,7 +1028,7 @@ ViewShellBase::Implementation::~Implementation()
{
mpController = NULL;
mpViewTabBar = NULL;
- mpViewWindow.reset();
+ mpViewWindow.disposeAndClear();
mpToolBarManager.reset();
}
@@ -1385,7 +1386,13 @@ FocusForwardingWindow::FocusForwardingWindow (
FocusForwardingWindow::~FocusForwardingWindow()
{
+ disposeOnce();
+}
+
+void FocusForwardingWindow::dispose()
+{
SAL_INFO("sd.view", "destroyed FocusForwardingWindow at " << this);
+ vcl::Window::dispose();
}
void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt)
diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx
index f8ca2e57aae2..6fcd11a5f692 100644
--- a/sd/source/ui/view/ViewTabBar.cxx
+++ b/sd/source/ui/view/ViewTabBar.cxx
@@ -82,7 +82,7 @@ ViewTabBar::ViewTabBar (
const Reference<XResourceId>& rxViewTabBarId,
const Reference<frame::XController>& rxController)
: ViewTabBarInterfaceBase(maMutex),
- mpTabControl(new TabBarControl(GetAnchorWindow(rxViewTabBarId,rxController), this)),
+ mpTabControl(VclPtr<TabBarControl>::Create(GetAnchorWindow(rxViewTabBarId,rxController), this)),
mxController(rxController),
maTabBarButtons(),
mpTabPage(NULL),
@@ -167,8 +167,8 @@ void ViewTabBar::disposing()
// Set all references to the one tab page to NULL and delete the page.
for (sal_uInt16 nIndex=0; nIndex<mpTabControl->GetPageCount(); ++nIndex)
mpTabControl->SetTabPage(nIndex, NULL);
- mpTabPage.reset();
- mpTabControl.reset();
+ mpTabPage.disposeAndClear();
+ mpTabControl.disposeAndClear();
}
mxController = NULL;
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index 55f8872bfb69..179529c4645b 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -91,7 +91,7 @@ DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell*
DrawView::~DrawView()
{
- delete mpVDev;
+ mpVDev.disposeAndClear();
}
/**
@@ -459,8 +459,7 @@ void DrawView::CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sd
{
if( mpVDev )
{
- delete mpVDev;
- mpVDev = NULL;
+ mpVDev.disposeAndClear();
}
bool bStandardPaint = true;
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index d275d61076f9..62b0b46b5c1a 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -105,7 +105,7 @@ void DrawViewShell::UIActivating( SfxInPlaceClient* pCli )
ViewShell::UIActivating(pCli);
// Disable own controls
- maTabControl.Disable();
+ maTabControl->Disable();
if (GetLayerTabControl() != NULL)
GetLayerTabControl()->Disable();
}
@@ -113,7 +113,7 @@ void DrawViewShell::UIActivating( SfxInPlaceClient* pCli )
void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
{
// Enable own controls
- maTabControl.Enable();
+ maTabControl->Enable();
if (GetLayerTabControl() != NULL)
GetLayerTabControl()->Enable();
@@ -339,7 +339,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
LayerTabBar* pLayerBar = GetLayerTabControl();
if (pLayerBar != NULL)
pLayerBar->EndEditMode();
- maTabControl.EndEditMode();
+ maTabControl->EndEditMode();
if (mePageKind == PK_HANDOUT)
{
@@ -379,7 +379,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
* PAGEMODE
******************************************************************/
- maTabControl.Clear();
+ maTabControl->Clear();
SdPage* pPage;
sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
@@ -388,7 +388,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
{
pPage = GetDoc()->GetSdPage(i, mePageKind);
OUString aPageName = pPage->GetName();
- maTabControl.InsertPage(i + 1, aPageName);
+ maTabControl->InsertPage(i + 1, aPageName);
if ( pPage->IsSelected() && nActualPageNum == 0 )
{
@@ -396,7 +396,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
}
}
- maTabControl.SetCurPageId(nActualPageNum + 1);
+ maTabControl->SetCurPageId(nActualPageNum + 1);
SwitchPage(nActualPageNum);
}
@@ -414,7 +414,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
}
- maTabControl.Clear();
+ maTabControl->Clear();
sal_uInt16 nActualMasterPageNum = 0;
sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
@@ -426,7 +426,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
if (nPos != -1)
aLayoutName = aLayoutName.copy(0, nPos);
- maTabControl.InsertPage(i + 1, aLayoutName);
+ maTabControl->InsertPage(i + 1, aLayoutName);
if (&(mpActualPage->TRG_GetMasterPage()) == pMaster)
{
@@ -434,7 +434,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
}
}
- maTabControl.SetCurPageId(nActualMasterPageNum + 1);
+ maTabControl->SetCurPageId(nActualMasterPageNum + 1);
SwitchPage(nActualMasterPageNum);
}
@@ -451,11 +451,11 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
if ( ! mbIsLayerModeActive)
{
- maTabControl.Show();
+ maTabControl->Show();
// Set the tab control only for draw pages. For master page
// this has been done already above.
if (meEditMode == EM_PAGE)
- maTabControl.SetCurPageId (nActualPageNum + 1);
+ maTabControl->SetCurPageId (nActualPageNum + 1);
}
ResetActualLayer();
@@ -526,7 +526,7 @@ SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin)
WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER;
sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT;
- pRuler = new Ruler(*this, GetParentWindow(), pWin, nFlags,
+ pRuler = VclPtr<Ruler>::Create(*this, GetParentWindow(), pWin, nFlags,
GetViewFrame()->GetBindings(), aWBits);
pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit());
@@ -590,19 +590,19 @@ void DrawViewShell::SetUIUnit(FieldUnit eUnit)
IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab )
{
const long int nMax = maViewSize.Width() - maScrBarWH.Width()
- - maTabControl.GetPosPixel().X() ;
+ - maTabControl->GetPosPixel().X() ;
- Size aTabSize = maTabControl.GetSizePixel();
+ Size aTabSize = maTabControl->GetSizePixel();
aTabSize.Width() = std::min(pTab->GetSplitSize(), (long)(nMax-1));
- maTabControl.SetSizePixel(aTabSize);
+ maTabControl->SetSizePixel(aTabSize);
if(GetLayerTabControl()) // #i87182#
{
GetLayerTabControl()->SetSizePixel(aTabSize);
}
- Point aPos = maTabControl.GetPosPixel();
+ Point aPos = maTabControl->GetPosPixel();
aPos.X() += aTabSize.Width();
Size aScrSize(nMax - aTabSize.Width(), maScrBarWH.Height());
@@ -618,7 +618,7 @@ SdPage* DrawViewShell::getCurrentPage() const
GetDoc()->GetSdPageCount(mePageKind):
GetDoc()->GetMasterSdPageCount(mePageKind);
- sal_Int32 nCurrentPage = maTabControl.GetCurPageId() - 1;
+ sal_Int32 nCurrentPage = maTabControl->GetCurPageId() - 1;
DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" );
if( (nPageCount < 0) || (nCurrentPage>=nPageCount) )
nCurrentPage = 0; // play safe here
@@ -642,7 +642,7 @@ void DrawViewShell::ResetActualPage()
if (!GetDoc())
return;
- sal_uInt16 nCurrentPage = maTabControl.GetCurPageId() - 1;
+ sal_uInt16 nCurrentPage = maTabControl->GetCurPageId() - 1;
sal_uInt16 nPageCount = (meEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind);
if (nPageCount > 0)
nCurrentPage = std::min((sal_uInt16)(nPageCount - 1), nCurrentPage);
@@ -653,7 +653,7 @@ void DrawViewShell::ResetActualPage()
{
// Update for TabControl
- maTabControl.Clear();
+ maTabControl->Clear();
SdPage* pPage = NULL;
@@ -661,18 +661,18 @@ void DrawViewShell::ResetActualPage()
{
pPage = GetDoc()->GetSdPage(i, mePageKind);
OUString aPageName = pPage->GetName();
- maTabControl.InsertPage(i + 1, aPageName);
+ maTabControl->InsertPage(i + 1, aPageName);
// correct selection recognition of the pages
GetDoc()->SetSelected(pPage, i == nCurrentPage);
}
- maTabControl.SetCurPageId(nCurrentPage + 1);
+ maTabControl->SetCurPageId(nCurrentPage + 1);
}
else // EM_MASTERPAGE
{
SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind);
- maTabControl.Clear();
+ maTabControl->Clear();
sal_uInt16 nActualMasterPageNum = 0;
sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
@@ -683,13 +683,13 @@ void DrawViewShell::ResetActualPage()
sal_Int32 nPos = aLayoutName.indexOf(SD_LT_SEPARATOR);
if (nPos != -1)
aLayoutName = aLayoutName.copy(0, nPos);
- maTabControl.InsertPage(i + 1, aLayoutName);
+ maTabControl->InsertPage(i + 1, aLayoutName);
if (pActualPage == pMaster)
nActualMasterPageNum = i;
}
- maTabControl.SetCurPageId(nActualMasterPageNum + 1);
+ maTabControl->SetCurPageId(nActualMasterPageNum + 1);
SwitchPage(nActualMasterPageNum);
}
@@ -828,7 +828,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
sPageText = sPageText.copy(0, nPos);
if (pPV
&& pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() )
- && sPageText == maTabControl.GetPageText(nSelectedPage+1))
+ && sPageText == maTabControl->GetPageText(nSelectedPage+1))
{
// this slide is already visible
return true;
@@ -850,7 +850,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
SdPage* pCurrentPage = pPV ? dynamic_cast<SdPage*>(pPV->GetPage()) : NULL;
if (pCurrentPage
&& pNewPage == pCurrentPage
- && maTabControl.GetPageText(nSelectedPage+1).equals(pNewPage->GetName()))
+ && maTabControl->GetPageText(nSelectedPage+1).equals(pNewPage->GetName()))
{
// this slide is already visible
return true;
@@ -979,12 +979,12 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
}
}
- maTabControl.SetCurPageId(nSelectedPage+1);
+ maTabControl->SetCurPageId(nSelectedPage+1);
OUString aPageName = mpActualPage->GetName();
- if (maTabControl.GetPageText(nSelectedPage+1) != aPageName)
+ if (maTabControl->GetPageText(nSelectedPage+1) != aPageName)
{
- maTabControl.SetPageText(nSelectedPage+1, aPageName);
+ maTabControl->SetPageText(nSelectedPage+1, aPageName);
}
}
else
@@ -1053,11 +1053,11 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
if (nPos != -1)
aLayoutName = aLayoutName.copy(0, nPos);
- maTabControl.SetCurPageId(nSelectedPage+1);
+ maTabControl->SetCurPageId(nSelectedPage+1);
- if (maTabControl.GetPageText(nSelectedPage+1) != aLayoutName)
+ if (maTabControl->GetPageText(nSelectedPage+1) != aLayoutName)
{
- maTabControl.SetPageText(nSelectedPage+1, aLayoutName);
+ maTabControl->SetPageText(nSelectedPage+1, aLayoutName);
}
if( mePageKind == PK_HANDOUT )
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index c1b2096778ae..9647e52c528f 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -373,7 +373,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
mpDrawView->SdrEndTextEdit();
}
- sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
+ sal_uInt16 nPage = maTabControl->GetCurPageId() - 1;
mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
rReq,
@@ -410,7 +410,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
mpDrawView->SdrEndTextEdit();
}
- sal_uInt16 nPageId = maTabControl.GetCurPageId();
+ sal_uInt16 nPageId = maTabControl->GetCurPageId();
SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE )
? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() )
: GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() );
@@ -456,7 +456,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
mpDrawView->SdrEndTextEdit();
}
- maTabControl.StartEditMode( maTabControl.GetCurPageId() );
+ maTabControl->StartEditMode( maTabControl->GetCurPageId() );
}
Cancel();
@@ -993,10 +993,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP )
{
SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj);
- CompressGraphicsDialog dialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() );
- if ( dialog.Execute() == RET_OK )
+ ScopedVclPtrInstance< CompressGraphicsDialog > dialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() );
+ if ( dialog->Execute() == RET_OK )
{
- SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj();
+ SdrGrafObj* pNewObject = dialog->GetCompressedSdrGrafObj();
SdrPageView* pPageView = mpDrawView->GetSdrPageView();
OUString aUndoString = mpDrawView->GetDescriptionOfMarkedObjects();
aUndoString += " Compress";
@@ -1422,11 +1422,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
|| aLayerName.isEmpty() )
{
// name already exists
- WarningBox aWarningBox (
+ ScopedVclPtrInstance<WarningBox> aWarningBox (
GetParentWindow(),
WinBits( WB_OK ),
SD_RESSTR(STR_WARN_NAME_DUPLICATE));
- aWarningBox.Execute();
+ aWarningBox->Execute();
}
else
bLoop = false;
@@ -1591,11 +1591,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
aLayerName != aOldLayerName) || aLayerName.isEmpty() )
{
// name already exists
- WarningBox aWarningBox (
+ ScopedVclPtrInstance<WarningBox> aWarningBox (
GetParentWindow(),
WinBits( WB_OK ),
SD_RESSTR(STR_WARN_NAME_DUPLICATE));
- aWarningBox.Execute();
+ aWarningBox->Execute();
}
else
bLoop = false;
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 0b82950cfb3d..ac9ecbca1f6a 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -142,7 +142,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
if (! pArgs)
{
- nSelectedPage = maTabControl.GetCurPageId() - 1;
+ nSelectedPage = maTabControl->GetCurPageId() - 1;
}
else if (pArgs->Count () == 2)
{
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index a4bf08bb6afa..9a6b58553aec 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -74,7 +74,7 @@ using namespace ::com::sun::star::drawing;
void DrawViewShell::DeleteActualPage()
{
- sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
+ sal_uInt16 nPage = maTabControl->GetCurPageId() - 1;
mpDrawView->SdrEndTextEdit();
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 9fbdf055e37a..030c676bc3db 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -114,7 +114,7 @@ void DrawViewShell::ArrangeGUIElements()
ViewShell::ArrangeGUIElements ();
- maTabControl.Hide();
+ maTabControl->Hide();
OSL_ASSERT (GetViewShell()!=NULL);
Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
@@ -352,7 +352,7 @@ void DrawViewShell::WriteFrameViewData()
mpFrameView->SetSelectedPage(0);
else
{
- mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
+ mpFrameView->SetSelectedPage( maTabControl->GetCurPageId() - 1 );
}
mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
index 31c9f08a6831..c6bdfed2a8f0 100644
--- a/sd/source/ui/view/drviews6.cxx
+++ b/sd/source/ui/view/drviews6.cxx
@@ -294,9 +294,9 @@ void DrawViewShell::ExecBmpMask( SfxRequest& rReq )
if( pNewObj->IsLinkedGraphic() )
{
- MessageDialog aQueryBox( (vcl::Window*) GetActiveWindow(),"QueryUnlinkImageDialog","modules/sdraw/ui/queryunlinkimagedialog.ui");
+ ScopedVclPtrInstance< MessageDialog > aQueryBox( (vcl::Window*) GetActiveWindow(),"QueryUnlinkImageDialog","modules/sdraw/ui/queryunlinkimagedialog.ui");
- if (RET_YES == aQueryBox.Execute())
+ if (RET_YES == aQueryBox->Execute())
pNewObj->ReleaseGraphicLink();
else
{
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 27a6176313f8..4fbf8d725bf8 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -912,7 +912,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
if( SfxItemState::DEFAULT == rSet.GetItemState( SID_DELETE_PAGE )
|| SfxItemState::DEFAULT == rSet.GetItemState( SID_DELETE_MASTER_PAGE ) )
{
- if (maTabControl.GetPageCount() == 1 ||
+ if (maTabControl->GetPageCount() == 1 ||
meEditMode == EM_MASTERPAGE ||
mePageKind == PK_NOTES ||
mePageKind == PK_HANDOUT ||
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index d224c328122f..7b2137113e9c 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -87,11 +87,11 @@ void DrawViewShell::ExecGallery(SfxRequest& rReq)
Graphic aGraphic( pGalleryItem->GetGraphic() );
// reduce size if necessary
- Window aWindow (GetActiveWindow());
- aWindow.SetMapMode(aGraphic.GetPrefMapMode());
- Size aSizePix = aWindow.LogicToPixel(aGraphic.GetPrefSize());
- aWindow.SetMapMode( MapMode(MAP_100TH_MM) );
- Size aSize = aWindow.PixelToLogic(aSizePix);
+ ScopedVclPtrInstance< Window > aWindow(GetActiveWindow());
+ aWindow->SetMapMode(aGraphic.GetPrefMapMode());
+ Size aSizePix = aWindow->LogicToPixel(aGraphic.GetPrefSize());
+ aWindow->SetMapMode( MapMode(MAP_100TH_MM) );
+ Size aSize = aWindow->PixelToLogic(aSizePix);
// constrain size to page size if necessary
SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage();
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 6b66f374e1ae..34fca249cb20 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -109,7 +109,7 @@ void SAL_CALL ScannerEventListener::disposing( const lang::EventObject& rEventOb
DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, vcl::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument )
: ViewShell (pFrame, pParentWindow, rViewShellBase)
- , maTabControl(this, pParentWindow)
+ , maTabControl(VclPtr<sd::TabControl>::Create(this, pParentWindow))
, mbIsLayerModeActive(false)
, mbIsInSwitchPage(false)
, mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
@@ -191,6 +191,8 @@ DrawViewShell::~DrawViewShell()
mpFrameView->Disconnect();
delete [] mpSlotArray;
+
+ maTabControl.disposeAndClear();
}
/**
@@ -288,7 +290,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind)
GetDoc()->SetMaxObjSize(aSize);
// Split-Handler for TabControls
- maTabControl.SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) );
+ maTabControl->SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) );
/* In order to set the correct EditMode of the FrameView, we select another
one (small trick). */
@@ -702,7 +704,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
// Always show the slide/page number.
OUString aOUString = (nPageCount == nActivePageCount) ? SD_RESSTR(STR_SD_PAGE_COUNT) : SD_RESSTR(STR_SD_PAGE_COUNT_CUSTOM);
- aOUString = aOUString.replaceFirst("%1", OUString::number(maTabControl.GetCurPageId()));
+ aOUString = aOUString.replaceFirst("%1", OUString::number(maTabControl->GetCurPageId()));
aOUString = aOUString.replaceFirst("%2", OUString::number(nPageCount));
if(nPageCount != nActivePageCount)
aOUString = aOUString.replaceFirst("%3", OUString::number(nActivePageCount));
diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx
index c3485e76ca9e..03c5a49e4cdd 100644
--- a/sd/source/ui/view/drviewsb.cxx
+++ b/sd/source/ui/view/drviewsb.cxx
@@ -114,7 +114,7 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const OUString & rName )
if( bSuccess )
{
// user edited page names may be changed by the page so update control
- maTabControl.SetPageText( nPageId, rName );
+ maTabControl->SetPageText( nPageId, rName );
// set document to modified state
GetDoc()->SetChanged( true );
@@ -146,7 +146,7 @@ IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog )
OUString aNewName;
pDialog->GetName( aNewName );
- SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() );
+ SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl->GetCurPageId() - 1, GetPageKind() );
return long(pCurrentPage && ( aNewName == pCurrentPage->GetName() || GetDocSh()->IsNewPageNameValid( aNewName ) ));
}
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 96b7c65adc77..402dbda474f4 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1721,7 +1721,7 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText,
void DrawViewShell::ShowUIControls (bool bVisible)
{
ViewShell::ShowUIControls (bVisible);
- maTabControl.Show (bVisible);
+ maTabControl->Show (bVisible);
}
namespace slideshowhelp
diff --git a/sd/source/ui/view/drviewsi.cxx b/sd/source/ui/view/drviewsi.cxx
index e969c84a3a16..930e9b0305ce 100644
--- a/sd/source/ui/view/drviewsi.cxx
+++ b/sd/source/ui/view/drviewsi.cxx
@@ -164,10 +164,10 @@ void DrawViewShell::AssignFrom3DWindow()
}
else
{
- InfoBox aInfoBox (
+ ScopedVclPtrInstance<InfoBox> aInfoBox (
GetActiveWindow(),
SD_RESSTR(STR_ACTION_NOTPOSSIBLE));
- aInfoBox.Execute();
+ aInfoBox->Execute();
}
// get focus back
diff --git a/sd/source/ui/view/grviewsh.cxx b/sd/source/ui/view/grviewsh.cxx
index 751fb19e92e6..9f17bae6e0a1 100644
--- a/sd/source/ui/view/grviewsh.cxx
+++ b/sd/source/ui/view/grviewsh.cxx
@@ -52,7 +52,7 @@ void GraphicViewShell::ConstructGraphicViewShell()
{
meShellType = ST_DRAW;
- mpLayerTabBar.reset (new LayerTabBar(this, GetParentWindow()));
+ mpLayerTabBar.reset (VclPtr<LayerTabBar>::Create(this, GetParentWindow()));
// #i67363# no layer tabbar in preview mode
if ( !GetObjectShell()->IsPreview() )
diff --git a/sd/source/ui/view/sdruler.cxx b/sd/source/ui/view/sdruler.cxx
index ba5c97e66fb0..12e3a6089834 100644
--- a/sd/source/ui/view/sdruler.cxx
+++ b/sd/source/ui/view/sdruler.cxx
@@ -92,10 +92,17 @@ Ruler::Ruler( DrawViewShell& rViewSh, vcl::Window* pParent, ::sd::Window* pWin,
Ruler::~Ruler()
{
+ disposeOnce();
+}
+
+void Ruler::dispose()
+{
SfxBindings& rBindings = pCtrlItem->GetBindings();
rBindings.EnterRegistrations();
delete pCtrlItem;
rBindings.LeaveRegistrations();
+ pSdWin.clear();
+ SvxRuler::dispose();
}
void Ruler::MouseButtonDown(const MouseEvent& rMEvt)
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index a229e4df2afa..0803ae9d43c1 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -76,7 +76,7 @@ using namespace ::com::sun::star;
struct SdNavigatorDropEvent : public ExecuteDropEvent
{
DropTargetHelper& mrTargetHelper;
- ::sd::Window* mpTargetWindow;
+ VclPtr<::sd::Window> mpTargetWindow;
sal_uInt16 mnPage;
sal_uInt16 mnLayer;
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 2165faaa8355..aea13b4434b4 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -94,12 +94,19 @@ Window::Window(vcl::Window* pParent)
Window::~Window()
{
+ disposeOnce();
+}
+
+void Window::dispose()
+{
if (mpViewShell != NULL)
{
WindowUpdater* pWindowUpdater = mpViewShell->GetWindowUpdater();
if (pWindowUpdater != NULL)
pWindowUpdater->UnregisterWindow (this);
}
+ mpShareWin.clear();
+ vcl::Window::dispose();
}
void Window::SetViewShell (ViewShell* pViewSh)
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index ea5e50cd4ee5..7d0bed8e3cde 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -648,7 +648,7 @@ void ViewShell::SetActiveWindow (::sd::Window* pWin)
}
}
- if (mpActiveWindow != pWin)
+ if (mpActiveWindow.get() != pWin)
mpActiveWindow = pWin;
// The rest of this function is not guarded anymore against calling this
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index c55978711639..a620624fbd7f 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -151,7 +151,7 @@ ViewShell::~ViewShell()
delete mpZoomList;
- mpLayerTabBar.reset();
+ mpLayerTabBar.disposeAndClear();
if (mpImpl->mpSubShellFactory.get() != NULL)
GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(
@@ -163,8 +163,14 @@ ViewShell::~ViewShell()
"sd.ui",
"destroying mpContentWindow at " << mpContentWindow.get()
<< " with parent " << mpContentWindow->GetParent());
- mpContentWindow.reset();
+ mpContentWindow.disposeAndClear();
}
+
+ mpScrollBarBox.disposeAndClear();
+ mpVerticalRuler.disposeAndClear();
+ mpHorizontalRuler.disposeAndClear();
+ mpVerticalScrollBar.disposeAndClear();
+ mpHorizontalScrollBar.disposeAndClear();
}
/**
@@ -204,16 +210,16 @@ void ViewShell::construct()
if ( ! GetDocSh()->IsPreview())
{
// Create scroll bars and the filler between the scroll bars.
- mpHorizontalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_HSCROLL | WB_DRAG)));
+ mpHorizontalScrollBar.reset (VclPtr<ScrollBar>::Create(GetParentWindow(), WinBits(WB_HSCROLL | WB_DRAG)));
mpHorizontalScrollBar->EnableRTL (false);
mpHorizontalScrollBar->SetRange(Range(0, 32000));
mpHorizontalScrollBar->SetScrollHdl(LINK(this, ViewShell, HScrollHdl));
- mpVerticalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG)));
+ mpVerticalScrollBar.reset (VclPtr<ScrollBar>::Create(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG)));
mpVerticalScrollBar->SetRange(Range(0, 32000));
mpVerticalScrollBar->SetScrollHdl(LINK(this, ViewShell, VScrollHdl));
- mpScrollBarBox.reset(new ScrollBarBox(GetParentWindow(), WB_SIZEABLE));
+ mpScrollBarBox.reset(VclPtr<ScrollBarBox>::Create(GetParentWindow(), WB_SIZEABLE));
}
OUString aName( "ViewShell" );
@@ -891,7 +897,7 @@ void ViewShell::Resize()
{
SetupRulers ();
- if (mpParentWindow == NULL)
+ if (mpParentWindow == nullptr)
return;
// Make sure that the new size is not degenerate.
diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx
index 9bcfe6aeed57..dcc6b1120076 100644
--- a/sfx2/inc/inettbc.hxx
+++ b/sfx2/inc/inettbc.hxx
@@ -53,7 +53,7 @@ public:
SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
virtual ~SfxURLToolBoxControl_Impl();
- virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
};
diff --git a/sfx2/inc/srchdlg.hxx b/sfx2/inc/srchdlg.hxx
index 95b7a00c8ada..2b71b76f7d99 100644
--- a/sfx2/inc/srchdlg.hxx
+++ b/sfx2/inc/srchdlg.hxx
@@ -36,12 +36,12 @@ namespace sfx2 {
class SearchDialog : public ModelessDialog
{
private:
- ComboBox* m_pSearchEdit;
- CheckBox* m_pWholeWordsBox;
- CheckBox* m_pMatchCaseBox;
- CheckBox* m_pWrapAroundBox;
- CheckBox* m_pBackwardsBox;
- PushButton* m_pFindBtn;
+ VclPtr<ComboBox> m_pSearchEdit;
+ VclPtr<CheckBox> m_pWholeWordsBox;
+ VclPtr<CheckBox> m_pMatchCaseBox;
+ VclPtr<CheckBox> m_pWrapAroundBox;
+ VclPtr<CheckBox> m_pBackwardsBox;
+ VclPtr<PushButton> m_pFindBtn;
Link m_aFindHdl;
Link m_aCloseHdl;
@@ -59,6 +59,7 @@ private:
public:
SearchDialog( vcl::Window* pWindow, const OUString& rConfigName );
virtual ~SearchDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetFindHdl( const Link& rLink ) { m_aFindHdl = rLink; }
void SetCloseHdl( const Link& rLink ) { m_aCloseHdl = rLink; }
@@ -70,11 +71,11 @@ public:
bool IsWrapAround() const { return ( m_pWrapAroundBox->IsChecked() ); }
bool IsSearchBackwards() const { return ( m_pBackwardsBox->IsChecked() ); }
- void SetFocusOnEdit();
+ void SetFocusOnEdit();
virtual bool Close() SAL_OVERRIDE;
- virtual void Move() SAL_OVERRIDE;
- virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
+ virtual void Move() SAL_OVERRIDE;
+ virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
};
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 582a4b8e935d..47938744425e 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -462,8 +462,8 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq )
bool bNewWin = false;
vcl::Window* pTopWin = GetTopWindow();
- SfxTemplateManagerDlg aTemplDlg;
- int nRet = aTemplDlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateManagerDlg > aTemplDlg;
+ int nRet = aTemplDlg->Execute();
if ( nRet == RET_OK )
{
rReq.Done();
@@ -831,11 +831,11 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
SolarMutexGuard aGuard;
vcl::Window *pWindow = SfxGetpApp()->GetTopWindow();
- MessageDialog aSecurityWarningBox(pWindow,
+ ScopedVclPtrInstance<MessageDialog> aSecurityWarningBox(pWindow,
SfxResId(STR_SECURITY_WARNING_NO_HYPERLINKS),
VCL_MESSAGE_WARNING);
- aSecurityWarningBox.SetText( SfxResId(RID_SECURITY_WARNING_TITLE).toString() );
- aSecurityWarningBox.Execute();
+ aSecurityWarningBox->SetText( SfxResId(RID_SECURITY_WARNING_TITLE).toString() );
+ aSecurityWarningBox->Execute();
return;
}
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index d985a1efdc14..b60da280bf12 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -451,8 +451,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_SHOW_LICENSE:
{
- LicenseDialog aDialog;
- aDialog.Execute();
+ ScopedVclPtrInstance< LicenseDialog > aDialog;
+ aDialog->Execute();
break;
}
@@ -539,16 +539,16 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_TEMPLATE_MANAGER:
{
- SfxTemplateManagerDlg dlg;
- dlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateManagerDlg > dlg;
+ dlg->Execute();
bDone = true;
break;
}
case SID_TEMPLATE_ADDRESSBOKSOURCE:
{
- svt::AddressBookSourceDialog aDialog(GetTopWindow(), ::comphelper::getProcessComponentContext());
- aDialog.Execute();
+ ScopedVclPtrInstance< svt::AddressBookSourceDialog > aDialog(GetTopWindow(), ::comphelper::getProcessComponentContext());
+ aDialog->Execute();
bDone = true;
break;
}
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 2a904ca2421c..e1f2ecd40809 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -160,7 +160,6 @@ SfxChildWindow::SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId)
: pParent(pParentWindow)
, nType(nId)
, eChildAlignment(SfxChildAlignment::NOALIGNMENT)
- , pWindow(0L)
{
pImp = new SfxChildWindow_Impl;
pImp->pFact = 0L;
@@ -199,7 +198,7 @@ void SfxChildWindow::Destroy()
SfxChildWindow::~SfxChildWindow()
{
delete pContext;
- delete pWindow;
+ pWindow.disposeAndClear();
delete pImp;
}
@@ -336,16 +335,16 @@ SfxChildWinInfo SfxChildWindow::GetInfo() const
sal_uIntPtr nMask = WINDOWSTATE_MASK_POS | WINDOWSTATE_MASK_STATE;
if ( pWindow->GetStyle() & WB_SIZEABLE )
nMask |= ( WINDOWSTATE_MASK_WIDTH | WINDOWSTATE_MASK_HEIGHT );
- aInfo.aWinState = static_cast<SystemWindow*>(pWindow)->GetWindowState( nMask );
+ aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask );
}
else if ( pWindow->GetType() == RSC_DOCKINGWINDOW )
{
- if (static_cast<DockingWindow*>(pWindow)->GetFloatingWindow() )
- aInfo.aWinState = static_cast<DockingWindow*>(pWindow)->GetFloatingWindow()->GetWindowState();
+ if (static_cast<DockingWindow*>(pWindow.get())->GetFloatingWindow() )
+ aInfo.aWinState = static_cast<DockingWindow*>(pWindow.get())->GetFloatingWindow()->GetWindowState();
else
{
SfxChildWinInfo aTmpInfo;
- static_cast<SfxDockingWindow*>(pWindow)->FillInfo( aTmpInfo );
+ static_cast<SfxDockingWindow*>(pWindow.get())->FillInfo( aTmpInfo );
aInfo.aExtraString = aTmpInfo.aExtraString;
}
}
@@ -511,14 +510,13 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding
}
SfxChildWindowContext::SfxChildWindowContext( sal_uInt16 nId )
- : pWindow( NULL )
- , nContextId( nId )
+ : nContextId( nId )
{
}
SfxChildWindowContext::~SfxChildWindowContext()
{
- delete pWindow;
+ pWindow.disposeAndClear();
}
FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const
@@ -654,10 +652,10 @@ void SfxChildWindow::Hide()
switch ( pWindow->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pWindow)->Hide();
+ static_cast<DockingWindow*>(pWindow.get())->Hide();
break;
case RSC_TOOLBOX :
- static_cast<ToolBox*>(pWindow)->Hide();
+ static_cast<ToolBox*>(pWindow.get())->Hide();
break;
default:
pWindow->Hide();
@@ -670,10 +668,10 @@ void SfxChildWindow::Show( sal_uInt16 nFlags )
switch ( pWindow->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pWindow)->Show( true, nFlags );
+ static_cast<DockingWindow*>(pWindow.get())->Show( true, nFlags );
break;
case RSC_TOOLBOX :
- static_cast<ToolBox*>(pWindow)->Show( true, nFlags );
+ static_cast<ToolBox*>(pWindow.get())->Show( true, nFlags );
break;
default:
pWindow->Show( true, nFlags );
diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx
index 85fb53b33a9c..5e2a5fddfcc1 100644
--- a/sfx2/source/appl/fileobj.hxx
+++ b/sfx2/source/appl/fileobj.hxx
@@ -35,7 +35,7 @@ class SvFileObject : public sfx2::SvLinkSource
SfxMediumRef xMed;
ImplSVEvent* nPostUserEventId;
SfxMediumRef* pDelMed;
- vcl::Window* pOldParent;
+ VclPtr<vcl::Window> pOldParent;
sal_uInt8 nType;
diff --git a/sfx2/source/appl/helpinterceptor.hxx b/sfx2/source/appl/helpinterceptor.hxx
index e34686e7b40d..a990518bc7a4 100644
--- a/sfx2/source/appl/helpinterceptor.hxx
+++ b/sfx2/source/appl/helpinterceptor.hxx
@@ -28,6 +28,7 @@
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
struct HelpHistoryEntry_Impl
@@ -63,7 +64,7 @@ friend class SfxHelpWindow_Impl;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > m_xListener;
HelpHistoryList_Impl* m_pHistory;
- SfxHelpWindow_Impl* m_pWindow;
+ VclPtr<SfxHelpWindow_Impl> m_pWindow;
sal_uIntPtr m_nCurPos;
OUString m_aCurrentURL;
com::sun::star::uno::Any m_aViewData;
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx
index aa829e21a54f..11aecd90473f 100644
--- a/sfx2/source/appl/impldde.cxx
+++ b/sfx2/source/appl/impldde.cxx
@@ -57,14 +57,16 @@ namespace sfx2
class SvDDELinkEditDialog : public ModalDialog
{
- Edit *m_pEdDdeApp;
- Edit *m_pEdDdeTopic;
- Edit *m_pEdDdeItem;
- OKButton *m_pOKButton;
+ VclPtr<Edit> m_pEdDdeApp;
+ VclPtr<Edit> m_pEdDdeTopic;
+ VclPtr<Edit> m_pEdDdeItem;
+ VclPtr<OKButton> m_pOKButton;
DECL_STATIC_LINK( SvDDELinkEditDialog, EditHdl_Impl, Edit* );
public:
SvDDELinkEditDialog( vcl::Window* pParent, SvBaseLink* );
+ virtual ~SvDDELinkEditDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetCmd() const;
};
@@ -90,6 +92,20 @@ SvDDELinkEditDialog::SvDDELinkEditDialog( vcl::Window* pParent, SvBaseLink* pLin
m_pOKButton->Enable( !sServer.isEmpty() && !sTopic.isEmpty() && !sItem.isEmpty() );
}
+SvDDELinkEditDialog::~SvDDELinkEditDialog()
+{
+ disposeOnce();
+}
+
+void SvDDELinkEditDialog::dispose()
+{
+ m_pEdDdeApp.clear();
+ m_pEdDdeTopic.clear();
+ m_pEdDdeItem.clear();
+ m_pOKButton.clear();
+ ModalDialog::dispose();
+}
+
OUString SvDDELinkEditDialog::GetCmd() const
{
OUString sCmd( m_pEdDdeApp->GetText() ), sRet;
@@ -255,10 +271,10 @@ bool SvDDEObject::Connect( SvBaseLink * pSvLink )
void SvDDEObject::Edit( vcl::Window* pParent, sfx2::SvBaseLink* pBaseLink, const Link& rEndEditHdl )
{
- SvDDELinkEditDialog aDlg( pParent, pBaseLink );
- if ( RET_OK == aDlg.Execute() && rEndEditHdl.IsSet() )
+ ScopedVclPtrInstance< SvDDELinkEditDialog > aDlg(pParent, pBaseLink);
+ if ( RET_OK == aDlg->Execute() && rEndEditHdl.IsSet() )
{
- OUString sCommand = aDlg.GetCmd();
+ OUString sCommand = aDlg->GetCmd();
rEndEditHdl.Call( &sCommand );
}
}
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index d06c54df8e4f..8834962b8762 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -45,8 +45,8 @@ class ImplDdeItem;
struct BaseLink_Impl
{
Link m_aEndEditLink;
- LinkManager* m_pLinkMgr;
- vcl::Window* m_pParentWin;
+ LinkManager* m_pLinkMgr;
+ VclPtr<vcl::Window> m_pParentWin;
FileDialogHelper* m_pFileDlg;
bool m_bIsConnect;
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 7ea881fa76a8..150563429e07 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -33,6 +33,7 @@
#include <sfx2/docfac.hxx>
#include <sfx2/objface.hxx>
#include <sfx2/viewfrm.hxx>
+#include <sfx2/tabdlg.hxx>
#include <svl/intitem.hxx>
#include <sfx2/taskpane.hxx>
#include <tools/diagnose_ex.h>
@@ -331,9 +332,9 @@ ImageList* SfxModule::GetImageList_Impl( bool bBig )
return pImpl->GetImageList( pResMgr, bBig );
}
-SfxTabPage* SfxModule::CreateTabPage( sal_uInt16, vcl::Window*, const SfxItemSet& )
+VclPtr<SfxTabPage> SfxModule::CreateTabPage( sal_uInt16, vcl::Window*, const SfxItemSet& )
{
- return NULL;
+ return VclPtr<SfxTabPage>();
}
SfxModuleArr_Impl& SfxModule::GetModules_Impl()
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 9d92d78820cc..25a45ce97baf 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -303,6 +303,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeContentListBox(vcl::Wi
ContentListBox_Impl::~ContentListBox_Impl()
{
+ disposeOnce();
+}
+
+void ContentListBox_Impl::dispose()
+{
sal_uInt16 nPos = 0;
SvTreeListEntry* pEntry = GetEntry( nPos++ );
while ( pEntry )
@@ -311,6 +316,7 @@ ContentListBox_Impl::~ContentListBox_Impl()
delete static_cast<ContentEntry_Impl*>(pEntry->GetUserData());
pEntry = GetEntry( nPos++ );
}
+ SvTreeListBox::dispose();
}
void ContentListBox_Impl::InitRoot()
@@ -426,6 +432,17 @@ HelpTabPage_Impl::HelpTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Impl
{
}
+HelpTabPage_Impl::~HelpTabPage_Impl()
+{
+ disposeOnce();
+}
+
+void HelpTabPage_Impl::dispose()
+{
+ m_pIdxWin.clear();
+ TabPage::dispose();
+}
+
// class ContentTabPage_Impl ---------------------------------------------
ContentTabPage_Impl::ContentTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin)
: HelpTabPage_Impl(pParent, _pIdxWin, "HelpContentPage",
@@ -437,6 +454,17 @@ ContentTabPage_Impl::ContentTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindo
m_pContentBox->set_height_request(aSize.Height());
}
+ContentTabPage_Impl::~ContentTabPage_Impl()
+{
+ disposeOnce();
+}
+
+void ContentTabPage_Impl::dispose()
+{
+ m_pContentBox.clear();
+ HelpTabPage_Impl::dispose();
+}
+
void ContentTabPage_Impl::ActivatePage()
{
if ( !m_pIdxWin->WasCursorLeftOrRight() )
@@ -545,7 +573,15 @@ IndexTabPage_Impl::IndexTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Im
IndexTabPage_Impl::~IndexTabPage_Impl()
{
+ disposeOnce();
+}
+
+void IndexTabPage_Impl::dispose()
+{
ClearIndex();
+ m_pIndexCB.clear();
+ m_pOpenBtn.clear();
+ HelpTabPage_Impl::dispose();
}
@@ -946,6 +982,11 @@ SearchTabPage_Impl::SearchTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_
SearchTabPage_Impl::~SearchTabPage_Impl()
{
+ disposeOnce();
+}
+
+void SearchTabPage_Impl::dispose()
+{
SvtViewOptions aViewOpt( E_TABPAGE, CONFIGNAME_SEARCHPAGE );
sal_Int32 nChecked = m_pFullWordsCB->IsChecked() ? 1 : 0;
OUString aUserData = OUString::number( nChecked );
@@ -967,6 +1008,14 @@ SearchTabPage_Impl::~SearchTabPage_Impl()
aUserData = comphelper::string::stripEnd(aUserData, ';');
Any aUserItem = makeAny( OUString( aUserData ) );
aViewOpt.SetUserItem( USERITEM_NAME, aUserItem );
+
+ m_pSearchED.clear();
+ m_pSearchBtn.clear();
+ m_pFullWordsCB.clear();
+ m_pScopeCB.clear();
+ m_pResultsLB.clear();
+ m_pOpenBtn.clear();
+ HelpTabPage_Impl::dispose();
}
@@ -1030,8 +1079,8 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl)
if ( aFactories.empty() )
{
- MessageDialog aBox( this, SfxResId( STR_INFO_NOSEARCHRESULTS ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_INFO_NOSEARCHRESULTS ), VCL_MESSAGE_INFO);
+ aBox->Execute();
}
}
return 0;
@@ -1141,6 +1190,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeBookmarksBox(vcl::Wind
BookmarksBox_Impl::~BookmarksBox_Impl()
{
+ disposeOnce();
+}
+
+void BookmarksBox_Impl::dispose()
+{
// save bookmarks to configuration
SvtHistoryOptions aHistOpt;
aHistOpt.Clear( eHELPBOOKMARKS );
@@ -1153,6 +1207,7 @@ BookmarksBox_Impl::~BookmarksBox_Impl()
aHistOpt.AppendItem(eHELPBOOKMARKS, *pURL, sEmpty, aTitle, sEmpty, sEmpty);
delete pURL;
}
+ ListBox::dispose();
}
@@ -1170,15 +1225,15 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction )
sal_Int32 nPos = GetSelectEntryPos();
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- SfxAddHelpBookmarkDialog_Impl aDlg( this, true );
- aDlg.SetTitle( GetEntry( nPos ) );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< SfxAddHelpBookmarkDialog_Impl > aDlg(this, true);
+ aDlg->SetTitle( GetEntry( nPos ) );
+ if ( aDlg->Execute() == RET_OK )
{
OUString* pURL = static_cast<OUString*>(GetEntryData( nPos ));
RemoveEntry( nPos );
OUString aImageURL = IMAGE_URL;
aImageURL += INetURLObject( *pURL ).GetHost();
- nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
+ nPos = InsertEntry( aDlg->GetTitle(), SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
SetEntryData( nPos, new OUString( *pURL ) );
SelectEntryPos( nPos );
delete pURL;
@@ -1271,6 +1326,17 @@ BookmarksTabPage_Impl::BookmarksTabPage_Impl(vcl::Window* pParent, SfxHelpIndexW
}
}
+BookmarksTabPage_Impl::~BookmarksTabPage_Impl()
+{
+ disposeOnce();
+}
+
+void BookmarksTabPage_Impl::dispose()
+{
+ m_pBookmarksBox.clear();
+ m_pBookmarksPB.clear();
+ HelpTabPage_Impl::dispose();
+}
IMPL_LINK_NOARG(BookmarksTabPage_Impl, OpenHdl)
@@ -1416,18 +1482,29 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent)
SfxHelpIndexWindow_Impl::~SfxHelpIndexWindow_Impl()
{
+ disposeOnce();
+}
+
+void SfxHelpIndexWindow_Impl::dispose()
+{
sfx2::RemoveFromTaskPaneList( this );
- DELETEZ( pCPage );
- DELETEZ( pIPage );
- DELETEZ( pSPage );
- DELETEZ( pBPage );
+ pCPage.disposeAndClear();
+ pIPage.disposeAndClear();
+ pSPage.disposeAndClear();
+ pBPage.disposeAndClear();
for ( sal_uInt16 i = 0; i < m_pActiveLB->GetEntryCount(); ++i )
delete static_cast<OUString*>(m_pActiveLB->GetEntryData(i));
SvtViewOptions aViewOpt( E_TABDIALOG, CONFIGNAME_INDEXWIN );
aViewOpt.SetPageID( (sal_Int32)m_pTabCtrl->GetCurPageId() );
+
+ disposeBuilder();
+ m_pActiveLB.clear();
+ m_pTabCtrl.clear();
+ pParentWin.clear();
+ vcl::Window::dispose();
}
@@ -1805,10 +1882,6 @@ TextWin_Impl::TextWin_Impl( vcl::Window* p ) : DockingWindow( p, 0 )
{
}
-TextWin_Impl::~TextWin_Impl()
-{
-}
-
bool TextWin_Impl::Notify( NotifyEvent& rNEvt )
{
if( ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) && rNEvt.GetKeyEvent()->GetKeyCode().GetCode() == KEY_TAB )
@@ -1830,15 +1903,15 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :
Window( pParent, WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL ),
- aToolBox ( this, 0 ),
- aOnStartupCB ( this, SfxResId( RID_HELP_ONSTARTUP_BOX ) ),
+ aToolBox ( VclPtr<ToolBox>::Create(this, 0) ),
+ aOnStartupCB ( VclPtr<CheckBox>::Create(this, SfxResId( RID_HELP_ONSTARTUP_BOX )) ),
aIndexOnImage ( SfxResId( IMG_HELP_TOOLBOX_INDEX_ON ) ),
aIndexOffImage ( SfxResId( IMG_HELP_TOOLBOX_INDEX_OFF ) ),
aIndexOnText ( SfxResId( STR_HELP_BUTTON_INDEX_ON ).toString() ),
aIndexOffText ( SfxResId( STR_HELP_BUTTON_INDEX_OFF ).toString() ),
aOnStartupText ( SfxResId( RID_HELP_ONSTARTUP_TEXT ).toString() ),
pHelpWin ( pParent ),
- pTextWin ( new TextWin_Impl( this ) ),
+ pTextWin ( VclPtr<TextWin_Impl>::Create( this ) ),
pSrchDlg ( NULL ),
nMinPos ( 0 ),
bIsDebug ( false ),
@@ -1847,36 +1920,36 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :
bIsFullWordSearch ( false )
{
- sfx2::AddToTaskPaneList( &aToolBox );
+ sfx2::AddToTaskPaneList( aToolBox.get() );
xFrame = Frame::create( ::comphelper::getProcessComponentContext() );
xFrame->initialize( VCLUnoHelper::GetInterface ( pTextWin ) );
xFrame->setName( "OFFICE_HELP" );
lcl_disableLayoutOfFrame(xFrame);
- aToolBox.SetHelpId( HID_HELP_TOOLBOX );
-
- aToolBox.InsertItem( TBI_INDEX, aIndexOffText );
- aToolBox.SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX );
- aToolBox.InsertSeparator();
- aToolBox.InsertItem( TBI_BACKWARD, SfxResId( STR_HELP_BUTTON_PREV ).toString() );
- aToolBox.SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD );
- aToolBox.InsertItem( TBI_FORWARD, SfxResId( STR_HELP_BUTTON_NEXT ).toString() );
- aToolBox.SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD );
- aToolBox.InsertItem( TBI_START, SfxResId( STR_HELP_BUTTON_START ).toString() );
- aToolBox.SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START );
- aToolBox.InsertSeparator();
- aToolBox.InsertItem( TBI_PRINT, SfxResId( STR_HELP_BUTTON_PRINT ).toString() );
- aToolBox.SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT );
- aToolBox.InsertItem( TBI_BOOKMARKS, SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ).toString() );
- aToolBox.SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS );
- aToolBox.InsertItem( TBI_SEARCHDIALOG, SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ).toString() );
- aToolBox.SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG );
+ aToolBox->SetHelpId( HID_HELP_TOOLBOX );
+
+ aToolBox->InsertItem( TBI_INDEX, aIndexOffText );
+ aToolBox->SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX );
+ aToolBox->InsertSeparator();
+ aToolBox->InsertItem( TBI_BACKWARD, SfxResId( STR_HELP_BUTTON_PREV ).toString() );
+ aToolBox->SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD );
+ aToolBox->InsertItem( TBI_FORWARD, SfxResId( STR_HELP_BUTTON_NEXT ).toString() );
+ aToolBox->SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD );
+ aToolBox->InsertItem( TBI_START, SfxResId( STR_HELP_BUTTON_START ).toString() );
+ aToolBox->SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START );
+ aToolBox->InsertSeparator();
+ aToolBox->InsertItem( TBI_PRINT, SfxResId( STR_HELP_BUTTON_PRINT ).toString() );
+ aToolBox->SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT );
+ aToolBox->InsertItem( TBI_BOOKMARKS, SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ).toString() );
+ aToolBox->SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS );
+ aToolBox->InsertItem( TBI_SEARCHDIALOG, SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ).toString() );
+ aToolBox->SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG );
InitToolBoxImages();
- aToolBox.Show();
+ aToolBox->Show();
InitOnStartupBox( false );
- aOnStartupCB.SetClickHdl( LINK( this, SfxHelpTextWindow_Impl, CheckHdl ) );
+ aOnStartupCB->SetClickHdl( LINK( this, SfxHelpTextWindow_Impl, CheckHdl ) );
aSelectIdle.SetIdleHdl( LINK( this, SfxHelpTextWindow_Impl, SelectHdl ) );
aSelectIdle.SetPriority( SchedulerPriority::LOWEST );
@@ -1887,19 +1960,29 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :
SvtMiscOptions().AddListenerLink( LINK( this, SfxHelpTextWindow_Impl, NotifyHdl ) );
- if ( !aOnStartupCB.GetHelpId().getLength() )
- aOnStartupCB.SetHelpId( HID_HELP_ONSTARTUP_BOX );
+ if ( !aOnStartupCB->GetHelpId().getLength() )
+ aOnStartupCB->SetHelpId( HID_HELP_ONSTARTUP_BOX );
}
SfxHelpTextWindow_Impl::~SfxHelpTextWindow_Impl()
{
- sfx2::RemoveFromTaskPaneList( &aToolBox );
+ disposeOnce();
+}
+
+void SfxHelpTextWindow_Impl::dispose()
+{
+ sfx2::RemoveFromTaskPaneList( aToolBox.get() );
bIsInClose = true;
SvtMiscOptions().RemoveListenerLink( LINK( this, SfxHelpTextWindow_Impl, NotifyHdl ) );
- delete pSrchDlg;
+ pSrchDlg.disposeAndClear();
+ aToolBox.disposeAndClear();
+ aOnStartupCB.disposeAndClear();
+ pHelpWin.clear();
+ pTextWin.disposeAndClear();
+ vcl::Window::dispose();
}
@@ -1928,39 +2011,39 @@ void SfxHelpTextWindow_Impl::InitToolBoxImages()
aIndexOnImage = Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_INDEX_ON : IMG_HELP_TOOLBOX_INDEX_ON ) );
aIndexOffImage = Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_INDEX_OFF : IMG_HELP_TOOLBOX_INDEX_OFF ) );
- aToolBox.SetItemImage( TBI_INDEX, bIsIndexOn ? aIndexOffImage : aIndexOnImage );
+ aToolBox->SetItemImage( TBI_INDEX, bIsIndexOn ? aIndexOffImage : aIndexOnImage );
- aToolBox.SetItemImage( TBI_BACKWARD,
+ aToolBox->SetItemImage( TBI_BACKWARD,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_PREV : IMG_HELP_TOOLBOX_PREV ) )
);
- aToolBox.SetItemImage( TBI_FORWARD,
+ aToolBox->SetItemImage( TBI_FORWARD,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_NEXT : IMG_HELP_TOOLBOX_NEXT ) )
);
- aToolBox.SetItemImage( TBI_START,
+ aToolBox->SetItemImage( TBI_START,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_START : IMG_HELP_TOOLBOX_START ) )
);
- aToolBox.SetItemImage( TBI_PRINT,
+ aToolBox->SetItemImage( TBI_PRINT,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_PRINT : IMG_HELP_TOOLBOX_PRINT ) )
);
- aToolBox.SetItemImage( TBI_BOOKMARKS,
+ aToolBox->SetItemImage( TBI_BOOKMARKS,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_BOOKMARKS : IMG_HELP_TOOLBOX_BOOKMARKS ) )
);
- aToolBox.SetItemImage( TBI_SEARCHDIALOG,
+ aToolBox->SetItemImage( TBI_SEARCHDIALOG,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_SEARCHDIALOG : IMG_HELP_TOOLBOX_SEARCHDIALOG ) )
);
- Size aSize = aToolBox.CalcWindowSizePixel();
+ Size aSize = aToolBox->CalcWindowSizePixel();
aSize.Height() += TOOLBOX_OFFSET;
- aToolBox.SetPosSizePixel( Point( 0, TOOLBOX_OFFSET ), aSize );
+ aToolBox->SetPosSizePixel( Point( 0, TOOLBOX_OFFSET ), aSize );
SvtMiscOptions aMiscOptions;
- if ( aMiscOptions.GetToolboxStyle() != aToolBox.GetOutStyle() )
- aToolBox.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+ if ( aMiscOptions.GetToolboxStyle() != aToolBox->GetOutStyle() )
+ aToolBox->SetOutStyle( aMiscOptions.GetToolboxStyle() );
}
@@ -1998,7 +2081,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
}
if ( bHideBox )
- aOnStartupCB.Hide();
+ aOnStartupCB->Hide();
else
{
// detect module name
@@ -2025,20 +2108,20 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
// set module name in checkbox text
OUString sText( aOnStartupText );
sText = sText.replaceFirst( "%MODULENAME", sModuleName );
- aOnStartupCB.SetText( sText );
+ aOnStartupCB->SetText( sText );
// and show it
- aOnStartupCB.Show();
+ aOnStartupCB->Show();
// set check state
- aOnStartupCB.Check( bHelpAtStartup );
- aOnStartupCB.SaveValue();
+ aOnStartupCB->Check( bHelpAtStartup );
+ aOnStartupCB->SaveValue();
// calculate and set optimal width of the onstartup checkbox
OUString sCBText( "XXX" );
- sCBText += aOnStartupCB.GetText();
- long nTextWidth = aOnStartupCB.GetTextWidth( sCBText );
- Size aSize = aOnStartupCB.GetSizePixel();
+ sCBText += aOnStartupCB->GetText();
+ long nTextWidth = aOnStartupCB->GetTextWidth( sCBText );
+ Size aSize = aOnStartupCB->GetSizePixel();
aSize.Width() = nTextWidth;
- aOnStartupCB.SetSizePixel( aSize );
+ aOnStartupCB->SetSizePixel( aSize );
SetOnStartupBoxPosition();
}
@@ -2046,12 +2129,12 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
{
// set position of the checkbox
Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
- Size aTBSize = aToolBox.GetSizePixel();
- Size aCBSize = aOnStartupCB.GetSizePixel();
- Point aPnt = aToolBox.GetPosPixel();
+ Size aTBSize = aToolBox->GetSizePixel();
+ Size aCBSize = aOnStartupCB->GetSizePixel();
+ Point aPnt = aToolBox->GetPosPixel();
aPnt.X() += aTBSize.Width() + a3Size.Width();
aPnt.Y() += ( ( aTBSize.Height() - aCBSize.Height() ) / 2 );
- aOnStartupCB.SetPosPixel( aPnt );
+ aOnStartupCB->SetPosPixel( aPnt );
nMinPos = aPnt.X();
}
}
@@ -2061,10 +2144,10 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
void SfxHelpTextWindow_Impl::SetOnStartupBoxPosition()
{
- long nX = std::max( GetOutputSizePixel().Width() - aOnStartupCB.GetSizePixel().Width(), nMinPos );
- Point aPos = aOnStartupCB.GetPosPixel();
+ long nX = std::max( GetOutputSizePixel().Width() - aOnStartupCB->GetSizePixel().Width(), nMinPos );
+ Point aPos = aOnStartupCB->GetPosPixel();
aPos.X() = nX;
- aOnStartupCB.SetPosPixel( aPos );
+ aOnStartupCB->SetPosPixel( aPos );
}
@@ -2181,7 +2264,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, NotifyHdl, SvtMiscOptions*, pOptions )
(void)pOptions; // unused variable
InitToolBoxImages();
Resize();
- aToolBox.Invalidate();
+ aToolBox->Invalidate();
return 0;
}
@@ -2254,8 +2337,8 @@ IMPL_LINK( SfxHelpTextWindow_Impl, FindHdl, sfx2::SearchDialog*, pDlg )
else
{
DBG_ASSERT( pSrchDlg, "no search dialog" );
- MessageDialog aBox( pSrchDlg, SfxResId( STR_INFO_NOSEARCHTEXTFOUND ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(pSrchDlg, SfxResId( STR_INFO_NOSEARCHTEXTFOUND ), VCL_MESSAGE_INFO);
+ aBox->Execute();
pSrchDlg->SetFocusOnEdit();
}
}
@@ -2271,11 +2354,9 @@ IMPL_LINK( SfxHelpTextWindow_Impl, FindHdl, sfx2::SearchDialog*, pDlg )
-IMPL_LINK( SfxHelpTextWindow_Impl, CloseHdl, sfx2::SearchDialog*, pDlg )
+IMPL_LINK( SfxHelpTextWindow_Impl, CloseHdl, sfx2::SearchDialog*, /*pDlg*/ )
{
- if ( pDlg )
- delete pSrchDlg;
- pSrchDlg = NULL;
+ pSrchDlg.clear();
return 0;
}
@@ -2308,7 +2389,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, CheckHdl, CheckBox*, pBox )
void SfxHelpTextWindow_Impl::Resize()
{
Size aSize = GetOutputSizePixel();
- long nToolBoxHeight = aToolBox.GetSizePixel().Height() + TOOLBOX_OFFSET;
+ long nToolBoxHeight = aToolBox->GetSizePixel().Height() + TOOLBOX_OFFSET;
aSize.Height() -= nToolBoxHeight;
pTextWin->SetPosSizePixel( Point( 0, nToolBoxHeight ), aSize );
SetOnStartupBoxPosition();
@@ -2325,7 +2406,7 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
const CommandEvent* pCmdEvt = rNEvt.GetCommandEvent();
vcl::Window* pCmdWin = rNEvt.GetWindow();
- if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != &aToolBox )
+ if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != aToolBox.get() )
{
Point aPos;
if ( pCmdEvt->IsMouseEvent() )
@@ -2430,9 +2511,9 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
pHelpWin->CloseWindow();
nDone = true;
}
- else if ( KEY_TAB == nKey && aOnStartupCB.HasChildPathFocus() )
+ else if ( KEY_TAB == nKey && aOnStartupCB->HasChildPathFocus() )
{
- aToolBox.GrabFocus();
+ aToolBox->GrabFocus();
nDone = true;
}
}
@@ -2484,13 +2565,13 @@ void SfxHelpTextWindow_Impl::ToggleIndex( bool bOn )
bIsIndexOn = bOn;
if ( bIsIndexOn )
{
- aToolBox.SetItemImage( TBI_INDEX, aIndexOffImage );
- aToolBox.SetItemText( TBI_INDEX, aIndexOffText );
+ aToolBox->SetItemImage( TBI_INDEX, aIndexOffImage );
+ aToolBox->SetItemText( TBI_INDEX, aIndexOffText );
}
else
{
- aToolBox.SetItemImage( TBI_INDEX, aIndexOnImage );
- aToolBox.SetItemText( TBI_INDEX, aIndexOnText );
+ aToolBox->SetItemImage( TBI_INDEX, aIndexOnImage );
+ aToolBox->SetItemText( TBI_INDEX, aIndexOnText );
}
}
@@ -2587,7 +2668,7 @@ void SfxHelpTextWindow_Impl::DoSearch()
if ( !pSrchDlg )
{
// create the search dialog
- pSrchDlg = new sfx2::SearchDialog( pTextWin, "HelpSearchDialog" );
+ pSrchDlg = VclPtr<sfx2::SearchDialog>::Create( pTextWin, "HelpSearchDialog" );
// set handler
pSrchDlg->SetFindHdl( LINK( this, SfxHelpTextWindow_Impl, FindHdl ) );
pSrchDlg->SetCloseHdl( LINK( this, SfxHelpTextWindow_Impl, CloseHdl ) );
@@ -2974,12 +3055,12 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl(
SetStyle( GetStyle() | WB_DIALOGCONTROL );
pHelpInterceptor->InitWaiter( this );
- pIndexWin = new SfxHelpIndexWindow_Impl( this );
+ pIndexWin = VclPtr<SfxHelpIndexWindow_Impl>::Create( this );
pIndexWin->SetDoubleClickHdl( LINK( this, SfxHelpWindow_Impl, OpenHdl ) );
pIndexWin->SetSelectFactoryHdl( LINK( this, SfxHelpWindow_Impl, SelectFactoryHdl ) );
pIndexWin->SetSizePixel(LogicToPixel(Size(120, 200), MAP_APPFONT));
pIndexWin->Show();
- pTextWin = new SfxHelpTextWindow_Impl( this );
+ pTextWin = VclPtr<SfxHelpTextWindow_Impl>::Create( this );
Reference < XFrames > xFrames = rFrame->getFrames();
xFrames->append( Reference<XFrame>(pTextWin->getFrame(), UNO_QUERY_THROW) );
pTextWin->SetSelectHdl( LINK( this, SfxHelpWindow_Impl, SelectHdl ) );
@@ -2993,13 +3074,16 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl(
SfxHelpWindow_Impl::~SfxHelpWindow_Impl()
{
- SaveConfig();
- vcl::Window* pDel = pIndexWin;
- pIndexWin = NULL;
- delete pDel;
+ disposeOnce();
+}
+void SfxHelpWindow_Impl::dispose()
+{
+ SaveConfig();
+ pIndexWin.disposeAndClear();
pTextWin->CloseFrame();
- delete pTextWin;
+ pTextWin.disposeAndClear();
+ SplitWindow::dispose();
}
bool SfxHelpWindow_Impl::PreNotify( NotifyEvent& rNEvt )
@@ -3127,11 +3211,11 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
if ( aAny >>= aValue )
{
OUString aTitle( aValue );
- SfxAddHelpBookmarkDialog_Impl aDlg( this, false );
- aDlg.SetTitle( aTitle );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< SfxAddHelpBookmarkDialog_Impl > aDlg(this, false);
+ aDlg->SetTitle( aTitle );
+ if ( aDlg->Execute() == RET_OK )
{
- aTitle = aDlg.GetTitle();
+ aTitle = aDlg->GetTitle();
pIndexWin->AddBookmarks( aTitle, aURL );
}
}
@@ -3206,7 +3290,16 @@ SfxAddHelpBookmarkDialog_Impl::SfxAddHelpBookmarkDialog_Impl(vcl::Window* pParen
SetText(get<FixedText>("alttitle")->GetText());
}
+SfxAddHelpBookmarkDialog_Impl::~SfxAddHelpBookmarkDialog_Impl()
+{
+ disposeOnce();
+}
+void SfxAddHelpBookmarkDialog_Impl::dispose()
+{
+ m_pTitleED.clear();
+ ModalDialog::dispose();
+}
void SfxAddHelpBookmarkDialog_Impl::SetTitle( const OUString& rTitle )
{
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index 4ccf236b2049..add82d178f9b 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -60,7 +60,7 @@ private:
public:
ContentListBox_Impl(vcl::Window* pParent, WinBits nStyle);
virtual ~ContentListBox_Impl();
-
+ virtual void dispose() SAL_OVERRIDE;
virtual void RequestingChildren( SvTreeListEntry* pParent ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -76,11 +76,13 @@ class SfxHelpIndexWindow_Impl;
class HelpTabPage_Impl : public TabPage
{
protected:
- SfxHelpIndexWindow_Impl* m_pIdxWin;
+ VclPtr<SfxHelpIndexWindow_Impl> m_pIdxWin;
public:
HelpTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin,
const OString& rID, const OUString& rUIXMLDescription);
+ virtual ~HelpTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() = 0;
};
@@ -90,10 +92,12 @@ public:
class ContentTabPage_Impl : public HelpTabPage_Impl
{
private:
- ContentListBox_Impl* m_pContentBox;
+ VclPtr<ContentListBox_Impl> m_pContentBox;
public:
ContentTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin);
+ virtual ~ContentTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() SAL_OVERRIDE;
@@ -119,8 +123,8 @@ public:
class IndexTabPage_Impl : public HelpTabPage_Impl
{
private:
- IndexBox_Impl* m_pIndexCB;
- PushButton* m_pOpenBtn;
+ VclPtr<IndexBox_Impl> m_pIndexCB;
+ VclPtr<PushButton> m_pOpenBtn;
Idle aFactoryIdle;
Timer aKeywordTimer;
@@ -141,6 +145,7 @@ private:
public:
IndexTabPage_Impl( vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
virtual ~IndexTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() SAL_OVERRIDE;
@@ -195,12 +200,12 @@ public:
class SearchTabPage_Impl : public HelpTabPage_Impl
{
private:
- SearchBox_Impl* m_pSearchED;
- PushButton* m_pSearchBtn;
- CheckBox* m_pFullWordsCB;
- CheckBox* m_pScopeCB;
- SearchResultsBox_Impl* m_pResultsLB;
- PushButton* m_pOpenBtn;
+ VclPtr<SearchBox_Impl> m_pSearchED;
+ VclPtr<PushButton> m_pSearchBtn;
+ VclPtr<CheckBox> m_pFullWordsCB;
+ VclPtr<CheckBox> m_pScopeCB;
+ VclPtr<SearchResultsBox_Impl> m_pResultsLB;
+ VclPtr<PushButton> m_pOpenBtn;
OUString aFactory;
@@ -217,6 +222,7 @@ private:
public:
SearchTabPage_Impl( vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
virtual ~SearchTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() SAL_OVERRIDE;
@@ -242,6 +248,7 @@ private:
public:
BookmarksBox_Impl(vcl::Window* pParent, WinBits nStyle);
virtual ~BookmarksBox_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
@@ -249,13 +256,15 @@ public:
class BookmarksTabPage_Impl : public HelpTabPage_Impl
{
private:
- BookmarksBox_Impl* m_pBookmarksBox;
- PushButton* m_pBookmarksPB;
+ VclPtr<BookmarksBox_Impl> m_pBookmarksBox;
+ VclPtr<PushButton> m_pBookmarksPB;
DECL_LINK(OpenHdl, void *);
public:
BookmarksTabPage_Impl( vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
+ virtual ~BookmarksTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() SAL_OVERRIDE;
@@ -273,8 +282,8 @@ class SfxHelpWindow_Impl;
class SfxHelpIndexWindow_Impl : public vcl::Window, public VclBuilderContainer
{
private:
- ListBox* m_pActiveLB;
- TabControl* m_pTabCtrl;
+ VclPtr<ListBox> m_pActiveLB;
+ VclPtr<TabControl> m_pTabCtrl;
Idle aIdle;
@@ -283,12 +292,12 @@ private:
Link aIndexKeywordLink;
OUString sKeyword;
- SfxHelpWindow_Impl* pParentWin;
+ VclPtr<SfxHelpWindow_Impl> pParentWin;
- ContentTabPage_Impl* pCPage;
- IndexTabPage_Impl* pIPage;
- SearchTabPage_Impl* pSPage;
- BookmarksTabPage_Impl* pBPage;
+ VclPtr<ContentTabPage_Impl> pCPage;
+ VclPtr<IndexTabPage_Impl> pIPage;
+ VclPtr<SearchTabPage_Impl> pSPage;
+ VclPtr<BookmarksTabPage_Impl> pBPage;
long nMinWidth;
bool bWasCursorLeftOrRight;
@@ -312,6 +321,7 @@ private:
public:
SfxHelpIndexWindow_Impl( SfxHelpWindow_Impl* pParent );
virtual ~SfxHelpIndexWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
@@ -343,7 +353,7 @@ ContentTabPage_Impl* SfxHelpIndexWindow_Impl::GetContentPage()
{
if ( !pCPage )
{
- pCPage = new ContentTabPage_Impl( m_pTabCtrl, this );
+ pCPage = VclPtr<ContentTabPage_Impl>::Create( m_pTabCtrl, this );
pCPage->SetOpenHdl( aPageDoubleClickLink );
}
return pCPage;
@@ -352,7 +362,7 @@ IndexTabPage_Impl* SfxHelpIndexWindow_Impl::GetIndexPage()
{
if ( !pIPage )
{
- pIPage = new IndexTabPage_Impl( m_pTabCtrl, this );
+ pIPage = VclPtr<IndexTabPage_Impl>::Create( m_pTabCtrl, this );
pIPage->SetDoubleClickHdl( aPageDoubleClickLink );
pIPage->SetKeywordHdl( aIndexKeywordLink );
}
@@ -363,7 +373,7 @@ SearchTabPage_Impl* SfxHelpIndexWindow_Impl::GetSearchPage()
{
if ( !pSPage )
{
- pSPage = new SearchTabPage_Impl( m_pTabCtrl, this );
+ pSPage = VclPtr<SearchTabPage_Impl>::Create( m_pTabCtrl, this );
pSPage->SetDoubleClickHdl( aPageDoubleClickLink );
}
return pSPage;
@@ -373,7 +383,7 @@ BookmarksTabPage_Impl* SfxHelpIndexWindow_Impl::GetBookmarksPage()
{
if ( !pBPage )
{
- pBPage = new BookmarksTabPage_Impl( m_pTabCtrl, this );
+ pBPage = VclPtr<BookmarksTabPage_Impl>::Create( m_pTabCtrl, this );
pBPage->SetDoubleClickHdl( aPageDoubleClickLink );
}
return pBPage;
@@ -392,7 +402,6 @@ class TextWin_Impl : public DockingWindow
{
public:
TextWin_Impl( vcl::Window* pParent );
- virtual ~TextWin_Impl();
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
@@ -405,8 +414,8 @@ class SfxHelpWindow_Impl;
class SfxHelpTextWindow_Impl : public vcl::Window
{
private:
- ToolBox aToolBox;
- CheckBox aOnStartupCB;
+ VclPtr<ToolBox> aToolBox;
+ VclPtr<CheckBox> aOnStartupCB;
Idle aSelectIdle;
Image aIndexOnImage;
Image aIndexOffImage;
@@ -416,9 +425,9 @@ private:
OUString aOnStartupText;
OUString sCurrentFactory;
- SfxHelpWindow_Impl* pHelpWin;
- vcl::Window* pTextWin;
- sfx2::SearchDialog* pSrchDlg;
+ VclPtr<SfxHelpWindow_Impl> pHelpWin;
+ VclPtr<vcl::Window> pTextWin;
+ VclPtr<sfx2::SearchDialog> pSrchDlg;
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >
@@ -426,12 +435,12 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
xConfiguration;
long nMinPos;
- bool bIsDebug;
- bool bIsIndexOn;
- bool bIsInClose;
- bool bIsFullWordSearch;
+ bool bIsDebug;
+ bool bIsIndexOn;
+ bool bIsInClose;
+ bool bIsFullWordSearch;
- bool HasSelection() const;
+ bool HasSelection() const;
void InitToolBoxImages();
void InitOnStartupBox( bool bOnlyText );
void SetOnStartupBoxPosition();
@@ -451,6 +460,7 @@ private:
public:
SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent );
virtual ~SfxHelpTextWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -460,11 +470,11 @@ public:
inline ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
getFrame() const { return xFrame; }
- inline void SetSelectHdl( const Link& rLink ) { aToolBox.SetSelectHdl( rLink ); }
+ inline void SetSelectHdl( const Link& rLink ) { aToolBox->SetSelectHdl( rLink ); }
void ToggleIndex( bool bOn );
void SelectSearchText( const OUString& rSearchText, bool _bIsFullWordSearch );
void SetPageStyleHeaderOff() const;
- inline ToolBox& GetToolBox() { return aToolBox; }
+ inline ToolBox& GetToolBox() { return *aToolBox.get(); }
void CloseFrame();
void DoSearch();
};
@@ -485,8 +495,8 @@ friend class SfxHelpIndexWindow_Impl;
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
xFrame;
- SfxHelpIndexWindow_Impl* pIndexWin;
- SfxHelpTextWindow_Impl* pTextWin;
+ VclPtr<SfxHelpIndexWindow_Impl> pIndexWin;
+ VclPtr<SfxHelpTextWindow_Impl> pTextWin;
HelpInterceptor_Impl* pHelpInterceptor;
HelpListener_Impl* pHelpListener;
@@ -519,6 +529,7 @@ public:
SfxHelpWindow_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >& rFrame,
vcl::Window* pParent, WinBits nBits );
virtual ~SfxHelpWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -556,9 +567,11 @@ public:
class SfxAddHelpBookmarkDialog_Impl : public ModalDialog
{
private:
- Edit* m_pTitleED;
+ VclPtr<Edit> m_pTitleED;
public:
SfxAddHelpBookmarkDialog_Impl( vcl::Window* pParent, bool bRename = true );
+ virtual ~SfxAddHelpBookmarkDialog_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void SetTitle( const OUString& rTitle );
OUString GetTitle() const { return m_pTitleED->GetText(); }
diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx
index 8c18f4028bf3..4c001886d296 100644
--- a/sfx2/source/appl/opengrf.cxx
+++ b/sfx2/source/appl/opengrf.cxx
@@ -158,8 +158,8 @@ short SvxOpenGraphicDialog::Execute()
// could not load?
if ( nFound == USHRT_MAX )
{
- WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, SfxResId( SvxOpenGrfErr2ResId(nImpRet) ).toString() );
- bQuitLoop = aWarningBox.Execute() != RET_RETRY;
+ ScopedVclPtrInstance< WarningBox > aWarningBox(nullptr, WB_3DLOOK | WB_RETRY_CANCEL, SfxResId( SvxOpenGrfErr2ResId(nImpRet) ).toString());
+ bQuitLoop = aWarningBox->Execute() != RET_RETRY;
}
else
{
diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx
index ecc347eddd27..beb4deed9ec3 100644
--- a/sfx2/source/appl/openuriexternally.cxx
+++ b/sfx2/source/appl/openuriexternally.cxx
@@ -44,10 +44,10 @@ bool sfx2::openUriExternally(
"unexpected IllegalArgumentException: " + e.Message);
}
SolarMutexGuard g;
- MessageDialog eb(
+ ScopedVclPtrInstance<MessageDialog> eb(
SfxGetpApp()->GetTopWindow(), SfxResId(STR_NO_ABS_URI_REF));
- eb.set_primary_text(eb.get_primary_text().replaceFirst("$(ARG1)", uri));
- eb.Execute();
+ eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", uri));
+ eb->Execute();
} catch (css::system::SystemShellExecuteException &) {
if (!handleSystemShellExecuteException) {
throw;
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 247e80e140af..21e56b4c1920 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -402,8 +402,8 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask ,
// create all internal windows and sub frames ...
Reference< ::com::sun::star::awt::XWindow > xParentWindow = xHelpTask->getContainerWindow();
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
- SfxHelpWindow_Impl* pHelpWindow = new SfxHelpWindow_Impl( xHelpTask, pParentWindow, WB_DOCKBORDER );
+ vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ VclPtrInstance<SfxHelpWindow_Impl> pHelpWindow( xHelpTask, pParentWindow, WB_DOCKBORDER );
Reference< ::com::sun::star::awt::XWindow > xHelpWindow = VCLUnoHelper::GetInterface( pHelpWindow );
Reference< XFrame > xHelpContent;
@@ -429,7 +429,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask ,
if (!xHelpContent.is())
{
- delete pHelpWindow;
+ pHelpWindow.disposeAndClear();
return NULL;
}
@@ -605,8 +605,8 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
if ( impl_showOnlineHelp( aHelpURL ) )
return true;
- NoHelpErrorBox aErrBox( const_cast< vcl::Window* >( pWindow ) );
- aErrBox.Execute();
+ ScopedVclPtrInstance< NoHelpErrorBox > aErrBox(const_cast< vcl::Window* >( pWindow ));
+ aErrBox->Execute();
return false;
}
@@ -626,7 +626,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
if (!xHelp.is())
pHelpWindow = impl_createHelp(xHelp, xHelpContent);
else
- pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow()));
+ pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow()).get());
if (!xHelp.is() || !xHelpContent.is() || !pHelpWindow)
return false;
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 7f3920dcc088..d6ec61c5ff3c 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -569,7 +569,7 @@ SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( vcl::Window *pWin, SfxFrame *pFrm, S
n == SFX_SPLITWINDOWS_RIGHT ? SfxChildAlignment::RIGHT :
n == SFX_SPLITWINDOWS_TOP ? SfxChildAlignment::TOP :
SfxChildAlignment::BOTTOM );
- SfxSplitWindow *pSplitWin = new SfxSplitWindow(pWorkWin, eAlign, this, pParent==0 );
+ VclPtr<SfxSplitWindow> pSplitWin = VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, pParent==0 );
pSplit[n] = pSplitWin;
}
@@ -606,7 +606,6 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxBindings& rB, SfxWorkWindow*
m_aTbxTypeName( "private:resource/toolbar/" ),
m_aProgressBarResName( "private:resource/progressbar/progressbar" )
{
- memset(pSplit, 0, sizeof(pSplit));
DBG_ASSERT (pBindings, "No Bindings!");
pBindings->SetWorkWindow_Impl( this );
@@ -633,10 +632,10 @@ SfxWorkWindow::~SfxWorkWindow()
// Delete SplitWindows
for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- SfxSplitWindow *p = pSplit[n];
+ VclPtr<SfxSplitWindow> p = pSplit[n];
if (p->GetWindowCount())
ReleaseChild_Impl(*p);
- delete p;
+ pSplit[n].disposeAndClear();
}
// Delete help structure for Child-Windows
@@ -677,8 +676,8 @@ void SfxWorkWindow::DeleteControllers_Impl()
for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
SfxSplitWindow *p = pSplit[n];
- if (p->GetWindowCount())
- p->Lock();
+ if (p->GetWindowCount())
+ p->Lock();
}
// Delete Child-Windows
@@ -853,7 +852,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
case SfxChildAlignment::LOWESTTOP:
aSize.Width() = aTmp.GetWidth();
if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
- aSize = static_cast<SplitWindow *>(pCli->pWin)->CalcLayoutSizePixel( aSize );
+ aSize = static_cast<SplitWindow *>(pCli->pWin.get())->CalcLayoutSizePixel( aSize );
bAllowHiding = false;
aBorder.Top() += aSize.Height();
aPos = aTmp.TopLeft();
@@ -868,7 +867,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
case SfxChildAlignment::HIGHESTBOTTOM:
aSize.Width() = aTmp.GetWidth();
if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
- aSize = static_cast<SplitWindow *>(pCli->pWin)->CalcLayoutSizePixel( aSize );
+ aSize = static_cast<SplitWindow *>(pCli->pWin.get())->CalcLayoutSizePixel( aSize );
aBorder.Bottom() += aSize.Height();
aPos = aTmp.BottomLeft();
aPos.Y() -= (aSize.Height()-1);
@@ -883,7 +882,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
case SfxChildAlignment::TOOLBOXLEFT:
aSize.Height() = aTmp.GetHeight();
if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
- aSize = static_cast<SplitWindow *>(pCli->pWin)->CalcLayoutSizePixel( aSize );
+ aSize = static_cast<SplitWindow *>(pCli->pWin.get())->CalcLayoutSizePixel( aSize );
bAllowHiding = false;
aBorder.Left() += aSize.Width();
aPos = aTmp.TopLeft();
@@ -898,7 +897,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
case SfxChildAlignment::TOOLBOXRIGHT:
aSize.Height() = aTmp.GetHeight();
if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
- aSize = static_cast<SplitWindow *>(pCli->pWin)->CalcLayoutSizePixel( aSize );
+ aSize = static_cast<SplitWindow *>(pCli->pWin.get())->CalcLayoutSizePixel( aSize );
aBorder.Right() += aSize.Width();
aPos = aTmp.TopRight();
aPos.X() -= (aSize.Width()-1);
@@ -1071,10 +1070,10 @@ void SfxWorkWindow::ShowChildren_Impl()
switch ( pCli->pWin->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pCli->pWin)->Show( true, nFlags );
+ static_cast<DockingWindow*>(pCli->pWin.get())->Show( true, nFlags );
break;
case RSC_SPLITWINDOW :
- static_cast<SplitWindow*>(pCli->pWin)->Show( true, nFlags );
+ static_cast<SplitWindow*>(pCli->pWin.get())->Show( true, nFlags );
break;
default:
pCli->pWin->Show( true, nFlags );
@@ -1088,7 +1087,7 @@ void SfxWorkWindow::ShowChildren_Impl()
switch ( pCli->pWin->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pCli->pWin)->Hide();
+ static_cast<DockingWindow*>(pCli->pWin.get())->Hide();
break;
default:
pCli->pWin->Hide();
@@ -1111,7 +1110,7 @@ void SfxWorkWindow::HideChildren_Impl()
switch ( pChild->pWin->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pChild->pWin)->Hide();
+ static_cast<DockingWindow*>(pChild->pWin.get())->Hide();
break;
default:
pChild->pWin->Hide();
@@ -2534,7 +2533,7 @@ bool SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow *pSplitWin )
{
for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- if ( pSplit[n] != pSplitWin && pSplit[n]->IsAutoHide( true ) )
+ if ( pSplit[n].get() != pSplitWin && pSplit[n]->IsAutoHide( true ) )
return true;
}
return false;
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 9e0f8de67342..6db9950b47e0 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -534,8 +534,8 @@ bool SfxFilterMatcher::IsFilterInstalled_Impl( const SfxFilter* pFilter )
// Here could a re-installation be offered
OUString aText( SfxResId(STR_FILTER_NOT_INSTALLED).toString() );
aText = aText.replaceFirst( "$(FILTER)", pFilter->GetUIName() );
- QueryBox aQuery( NULL, WB_YES_NO | WB_DEF_YES, aText );
- short nRet = aQuery.Execute();
+ ScopedVclPtrInstance< QueryBox > aQuery(nullptr, WB_YES_NO | WB_DEF_YES, aText);
+ short nRet = aQuery->Execute();
if ( nRet == RET_YES )
{
#ifdef DBG_UTIL
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx
index c1fa1624daa5..0be5e36658b7 100644
--- a/sfx2/source/control/ctrlitem.cxx
+++ b/sfx2/source/control/ctrlitem.cxx
@@ -218,16 +218,19 @@ SfxControllerItem::SfxControllerItem( sal_uInt16 nID, SfxBindings &rBindings ):
}
-// unregisteres the item in the bindings
+// unregisters the item in the bindings
SfxControllerItem::~SfxControllerItem()
{
+ dispose();
+}
+
+void SfxControllerItem::dispose()
+{
if ( IsBound() )
pBindings->Release(*this);
}
-
-
void SfxControllerItem::StateChanged
(
sal_uInt16, // <SID> of the triggering slot
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 9b68a0e09908..dc22fddc1910 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -62,10 +62,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRecentDocsView(vcl::Wi
return new RecentDocsView(pParent);
}
-RecentDocsView::~RecentDocsView()
-{
-}
-
bool RecentDocsView::typeMatchesExtension(ApplicationType type, const OUString &rExt)
{
bool bRet = false;
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 51b213d7d7e3..408fccb50059 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -128,29 +128,37 @@ bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem)
TemplateAbstractView::TemplateAbstractView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
: ThumbnailView(pParent,nWinStyle,bDisableTransientChildren),
mnCurRegionId(0),
- maAllButton(this, SfxResId(BTN_ALL_TEMPLATES)),
- maFTName(this, SfxResId(FT_NAME))
+ maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
+ maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
{
- maAllButton.Hide();
- maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON);
- maAllButton.SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
- maFTName.Hide();
+ maAllButton->Hide();
+ maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
+ maAllButton->SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
+ maFTName->Hide();
}
TemplateAbstractView::TemplateAbstractView(vcl::Window *pParent)
: ThumbnailView(pParent),
mnCurRegionId(0),
- maAllButton(this, SfxResId(BTN_ALL_TEMPLATES)),
- maFTName(this, SfxResId(FT_NAME))
+ maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
+ maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
{
- maAllButton.Hide();
- maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON);
- maAllButton.SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
- maFTName.Hide();
+ maAllButton->Hide();
+ maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
+ maAllButton->SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
+ maFTName->Hide();
}
-TemplateAbstractView::~TemplateAbstractView ()
+TemplateAbstractView::~TemplateAbstractView()
{
+ disposeOnce();
+}
+
+void TemplateAbstractView::dispose()
+{
+ maAllButton.disposeAndClear();
+ maFTName.disposeAndClear();
+ ThumbnailView::dispose();
}
void TemplateAbstractView::insertItem(const TemplateItemProperties &rTemplate)
@@ -283,7 +291,7 @@ void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem)
mnCurRegionId = pContainerItem->mnRegionId+1;
maCurRegionName = pContainerItem->maTitle;
- maFTName.SetText(maCurRegionName);
+ maFTName->SetText(maCurRegionName);
showRegion(pItem);
}
else
diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx
index 9e2f83a14378..3c42d29b508c 100644
--- a/sfx2/source/control/templatedefaultview.cxx
+++ b/sfx2/source/control/templatedefaultview.cxx
@@ -28,10 +28,6 @@ TemplateDefaultView::TemplateDefaultView( Window* pParent)
ThumbnailView::setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding );
}
-TemplateDefaultView::~TemplateDefaultView()
-{
-}
-
void TemplateDefaultView::reload()
{
TemplateLocalView::reload();
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index ad14ae841b50..c2e42d9a7eae 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -45,12 +45,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateLocalView(vcl:
TemplateLocalView::~TemplateLocalView()
{
+ disposeOnce();
+}
+
+void TemplateLocalView::dispose()
+{
for (size_t i = 0; i < maRegions.size(); ++i)
delete maRegions[i];
maRegions.clear();
delete mpDocTemplates;
+ TemplateAbstractView::dispose();
}
void TemplateLocalView::Populate ()
@@ -141,8 +147,8 @@ void TemplateLocalView::showRootRegion()
items[i] = pItem;
}
- maAllButton.Show(false);
- maFTName.Show(false);
+ maAllButton->Show(false);
+ maFTName->Show(false);
updateItems(items);
@@ -151,12 +157,12 @@ void TemplateLocalView::showRootRegion()
void TemplateLocalView::showRegion(ThumbnailViewItem *pItem)
{
- mnHeaderHeight = maAllButton.GetSizePixel().getHeight() + maAllButton.GetPosPixel().Y() * 2;
+ mnHeaderHeight = maAllButton->GetSizePixel().getHeight() + maAllButton->GetPosPixel().Y() * 2;
mnCurRegionId = static_cast<TemplateContainerItem*>(pItem)->mnRegionId+1;
maCurRegionName = pItem->maTitle;
- maAllButton.Show(true);
- maFTName.Show(true);
+ maAllButton->Show(true);
+ maFTName->Show(true);
insertItems(reinterpret_cast<TemplateContainerItem*>(pItem)->maTemplates);
@@ -169,7 +175,7 @@ void TemplateLocalView::showRegion(const OUString &rName)
{
if (maRegions[i]->maTitle == rName)
{
- maFTName.SetText(rName);
+ maFTName->SetText(rName);
showRegion(maRegions[i]);
break;
}
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index 0729a6bdf53c..f33407a8e5f8 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -59,10 +59,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateRemoteView(vcl
return new TemplateRemoteView(pParent, WB_VSCROLL, false);
}
-TemplateRemoteView::~TemplateRemoteView ()
-{
-}
-
void TemplateRemoteView::showRootRegion()
{
//TODO:
@@ -86,7 +82,7 @@ bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefres
mnCurRegionId = pItem->mnId;
maCurRegionName = pItem->maTitle;
- maFTName.SetText(maCurRegionName);
+ maFTName->SetText(maCurRegionName);
OUString aURL = pItem->getURL();
diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index fb21ac654812..582dd5ad2c2f 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -22,10 +22,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateSearchView(vcl
return new TemplateSearchView(pParent);
}
-TemplateSearchView::~TemplateSearchView ()
-{
-}
-
void TemplateSearchView::setOpenTemplateHdl(const Link &rLink)
{
maOpenTemplateHdl = rLink;
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index d85561438987..8c6a30e60d0b 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -66,6 +66,11 @@ ThumbnailView::ThumbnailView (vcl::Window *pParent, WinBits nWinStyle, bool bDis
ThumbnailView::~ThumbnailView()
{
+ disposeOnce();
+}
+
+void ThumbnailView::dispose()
+{
com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>
xComponent(GetAccessible(false),
com::sun::star::uno::UNO_QUERY);
@@ -73,11 +78,12 @@ ThumbnailView::~ThumbnailView()
if (xComponent.is())
xComponent->dispose ();
- delete mpScrBar;
+ mpScrBar.disposeAndClear();
delete mpItemAttrs;
delete mpProcessor;
ImplDeleteItems();
+ Control::dispose();
}
void ThumbnailView::MouseMove(const MouseEvent& rMEvt)
@@ -230,7 +236,7 @@ void ThumbnailView::ImplInitScrollBar()
{
if ( !mpScrBar )
{
- mpScrBar = new ScrollBar( this, WB_VSCROLL | WB_DRAG );
+ mpScrBar = VclPtr<ScrollBar>::Create( this, WB_VSCROLL | WB_DRAG );
mpScrBar->SetScrollHdl( LINK( this, ThumbnailView, ImplScrollHdl ) );
}
else
@@ -270,7 +276,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
Size aWinSize = GetOutputSizePixel();
size_t nItemCount = mFilteredItemList.size();
WinBits nStyle = GetStyle();
- ScrollBar* pDelScrBar = NULL;
+ VclPtr<ScrollBar> pDelScrBar;
// consider the scrolling
if ( nStyle & WB_VSCROLL )
@@ -435,7 +441,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
}
// delete ScrollBar
- delete pDelScrBar;
+ pDelScrBar.disposeAndClear();
}
size_t ThumbnailView::ImplGetItem( const Point& rPos ) const
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index c29e797b4c47..598e3034b4e2 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -593,7 +593,7 @@ void ThumbnailViewAcc::ThrowIfDisposed()
}
else
{
- DBG_ASSERT (mpParent!=NULL, "ValueSetAcc not disposed but mpParent == NULL");
+ DBG_ASSERT (mpParent!=nullptr, "ValueSetAcc not disposed but mpParent == NULL");
}
}
diff --git a/sfx2/source/control/thumbnailviewacc.hxx b/sfx2/source/control/thumbnailviewacc.hxx
index f6f8f1a7c090..dbff7e29048d 100644
--- a/sfx2/source/control/thumbnailviewacc.hxx
+++ b/sfx2/source/control/thumbnailviewacc.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <vcl/vclptr.hxx>
#include <vector>
class ThumbnailView;
@@ -121,7 +122,7 @@ public:
private:
::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners;
- ThumbnailView* mpParent;
+ VclPtr<ThumbnailView> mpParent;
bool mbIsTransientChildrenDisabled;
/// The current FOCUSED state.
bool mbIsFocused;
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index 040eb186cce2..c6543906639c 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -53,7 +53,6 @@ class ResizableMultiLineEdit : public VclMultiLineEdit
public:
ResizableMultiLineEdit (vcl::Window* pParent, ThumbnailViewItem* pItem);
- virtual ~ResizableMultiLineEdit ();
void SetInGrabFocus(bool bInGrabFocus) { mbIsInGrabFocus = bInGrabFocus; }
@@ -68,10 +67,6 @@ ResizableMultiLineEdit::ResizableMultiLineEdit (vcl::Window* pParent, ThumbnailV
{
}
-ResizableMultiLineEdit::~ResizableMultiLineEdit ()
-{
-}
-
bool ResizableMultiLineEdit::PreNotify(NotifyEvent& rNEvt)
{
bool nDone = false;
@@ -117,12 +112,12 @@ ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView, sal_uInt16 nId)
, mpTitleED(NULL)
, maTextEditMaxArea()
{
- mpTitleED = new ResizableMultiLineEdit(&rView, this);
+ mpTitleED = VclPtr<ResizableMultiLineEdit>::Create(&rView, this);
}
ThumbnailViewItem::~ThumbnailViewItem()
{
- delete mpTitleED;
+ mpTitleED.disposeAndClear();
if( mpxAcc )
{
static_cast< ThumbnailViewItemAcc* >( mpxAcc->get() )->ParentDestroyed();
@@ -183,9 +178,9 @@ void ThumbnailViewItem::setEditTitle (bool edit, bool bChangeFocus)
{
mpTitleED->SetText(maTitle);
updateTitleEditSize();
- static_cast<ResizableMultiLineEdit*>(mpTitleED)->SetInGrabFocus(true);
+ static_cast<ResizableMultiLineEdit*>(mpTitleED.get())->SetInGrabFocus(true);
mpTitleED->GrabFocus();
- static_cast<ResizableMultiLineEdit*>(mpTitleED)->SetInGrabFocus(false);
+ static_cast<ResizableMultiLineEdit*>(mpTitleED.get())->SetInGrabFocus(false);
}
else if (bChangeFocus)
{
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index 09f59c14de94..7421173023f0 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -68,11 +68,20 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUStrin
SfxAlienWarningDialog::~SfxAlienWarningDialog()
{
+ disposeOnce();
+}
+
+void SfxAlienWarningDialog::dispose()
+{
// save value of "warning off" checkbox, if necessary
SvtSaveOptions aSaveOpt;
bool bChecked = m_pWarningOnBox->IsChecked();
if ( aSaveOpt.IsWarnAlienFormat() != bChecked )
aSaveOpt.SetWarnAlienFormat( bChecked );
+ m_pKeepCurrentBtn.clear();
+ m_pUseDefaultFormatBtn.clear();
+ m_pWarningOnBox.clear();
+ MessageDialog::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx
index e8f49fb42652..f11d9ffac79d 100644
--- a/sfx2/source/dialog/backingcomp.cxx
+++ b/sfx2/source/dialog/backingcomp.cxx
@@ -403,8 +403,8 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
// initialize the component and its parent window
css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow();
- WorkWindow* pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow));
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(m_xWindow);
+ VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get());
+ VclPtr< vcl::Window > pWindow = VCLUnoHelper::GetWindow(m_xWindow);
// disable full screen mode of the frame!
if (pParent && pParent->IsFullScreenMode())
@@ -431,7 +431,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
}
// inform BackingWindow about frame
- BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow );
+ BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow.get());
if( pBack )
pBack->setOwningFrame( m_xFrame );
@@ -719,8 +719,8 @@ void SAL_CALL BackingComp::initialize( /*IN*/ const css::uno::Sequence< css::uno
// create the component window
vcl::Window* pParent = VCLUnoHelper::GetWindow(xParentWindow);
- vcl::Window* pWindow = new BackingWindow(pParent);
- m_xWindow = VCLUnoHelper::GetInterface(pWindow);
+ VclPtr<vcl::Window> pWindow = VclPtr<BackingWindow>::Create(pParent);
+ m_xWindow = VCLUnoHelper::GetInterface(pWindow);
if (!m_xWindow.is())
throw css::uno::RuntimeException(
@@ -800,7 +800,7 @@ void SAL_CALL BackingComp::dispatch( const css::util::URL& aURL, const css::uno:
// Recalculate minimum width
css::uno::Reference< css::awt::XWindow > xParentWindow = m_xFrame->getContainerWindow();
- WorkWindow* pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow));
+ VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get());
if( pParent )
{
pParent->SetMinOutputSizePixel( Size(
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index ad9f98f769c2..103391877907 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -195,11 +195,15 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) :
BackingWindow::~BackingWindow()
{
+ disposeOnce();
+}
+
+void BackingWindow::dispose()
+{
// deregister drag&drop helper
if (mxDropTargetListener.is())
{
- for (std::vector<vcl::Window*>::iterator aI = maDndWindows.begin(),
- aEnd = maDndWindows.end(); aI != aEnd; ++aI)
+ for (auto aI = maDndWindows.begin(), aEnd = maDndWindows.end(); aI != aEnd; ++aI)
{
vcl::Window *pDndWin = *aI;
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
@@ -212,6 +216,29 @@ BackingWindow::~BackingWindow()
}
mxDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >();
}
+ disposeBuilder();
+ mpOpenButton.clear();
+ mpRecentButton.clear();
+ mpTemplateButton.clear();
+ mpCreateLabel.clear();
+ mpWriterAllButton.clear();
+ mpCalcAllButton.clear();
+ mpImpressAllButton.clear();
+ mpDrawAllButton.clear();
+ mpDBAllButton.clear();
+ mpMathAllButton.clear();
+ mpHelpButton.clear();
+ mpExtensionsButton.clear();
+ mpAllButtonsBox.clear();
+ mpButtonsBox.clear();
+ mpSmallButtonsBox.clear();
+ mpThinBox1.clear();
+ mpThinBox2.clear();
+ mpHelpBox.clear();
+ mpExtensionsBox.clear();
+ mpAllRecentThumbnails.clear();
+ mpLocalView.clear();
+ vcl::Window::dispose();
}
void BackingWindow::initControls()
@@ -368,15 +395,15 @@ void BackingWindow::Paint( const Rectangle& )
DrawWallpaper( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ), aBack );
Pop();
- VirtualDevice aDev( *this );
- aDev.EnableRTL( IsRTLEnabled() );
- aDev.SetOutputSizePixel( maStartCentButtons.GetSize() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( *this );
+ pVDev->EnableRTL( IsRTLEnabled() );
+ pVDev->SetOutputSizePixel( maStartCentButtons.GetSize() );
Point aOffset( Point( 0, 0 ) - maStartCentButtons.TopLeft());
- aDev.DrawWallpaper( Rectangle( aOffset, GetOutputSizePixel() ), aBack );
+ pVDev->DrawWallpaper( Rectangle( aOffset, GetOutputSizePixel() ), aBack );
DrawOutDev( maStartCentButtons.TopLeft(), maStartCentButtons.GetSize(),
Point( 0, 0 ), maStartCentButtons.GetSize(),
- aDev );
+ *pVDev.get() );
}
bool BackingWindow::PreNotify( NotifyEvent& rNEvt )
@@ -462,8 +489,7 @@ void BackingWindow::setOwningFrame( const com::sun::star::uno::Reference< com::s
// establish drag&drop mode
mxDropTargetListener.set(new OpenFileDropTargetListener(mxContext, mxFrame));
- for (std::vector<vcl::Window*>::iterator aI = maDndWindows.begin(),
- aEnd = maDndWindows.end(); aI != aEnd; ++aI)
+ for (auto aI = maDndWindows.begin(), aEnd = maDndWindows.end(); aI != aEnd; ++aI)
{
vcl::Window *pDndWin = *aI;
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index aa6e498a281d..a9a07f662e45 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -61,35 +61,35 @@ class BackingWindow
/** helper for drag&drop. */
com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
- PushButton* mpOpenButton;
- PushButton* mpRecentButton;
- MenuButton* mpTemplateButton;
+ VclPtr<PushButton> mpOpenButton;
+ VclPtr<PushButton> mpRecentButton;
+ VclPtr<MenuButton> mpTemplateButton;
- FixedText* mpCreateLabel;
+ VclPtr<FixedText> mpCreateLabel;
- PushButton* mpWriterAllButton;
- PushButton* mpCalcAllButton;
- PushButton* mpImpressAllButton;
- PushButton* mpDrawAllButton;
- PushButton* mpDBAllButton;
- PushButton* mpMathAllButton;
+ VclPtr<PushButton> mpWriterAllButton;
+ VclPtr<PushButton> mpCalcAllButton;
+ VclPtr<PushButton> mpImpressAllButton;
+ VclPtr<PushButton> mpDrawAllButton;
+ VclPtr<PushButton> mpDBAllButton;
+ VclPtr<PushButton> mpMathAllButton;
- PushButton* mpHelpButton;
- PushButton* mpExtensionsButton;
+ VclPtr<PushButton> mpHelpButton;
+ VclPtr<PushButton> mpExtensionsButton;
- VclBox* mpAllButtonsBox;
- VclBox* mpButtonsBox;
- VclBox* mpSmallButtonsBox;
- VclBox* mpThinBox1;
- VclBox* mpThinBox2;
- VclBox* mpHelpBox;
- VclBox* mpExtensionsBox;
+ VclPtr<VclBox> mpAllButtonsBox;
+ VclPtr<VclBox> mpButtonsBox;
+ VclPtr<VclBox> mpSmallButtonsBox;
+ VclPtr<VclBox> mpThinBox1;
+ VclPtr<VclBox> mpThinBox2;
+ VclPtr<VclBox> mpHelpBox;
+ VclPtr<VclBox> mpExtensionsBox;
- RecentDocsView* mpAllRecentThumbnails;
- TemplateDefaultView* mpLocalView;
- bool mbLocalViewInitialized;
+ VclPtr<RecentDocsView> mpAllRecentThumbnails;
+ VclPtr<TemplateDefaultView> mpLocalView;
+ bool mbLocalViewInitialized;
- std::vector<vcl::Window*> maDndWindows;
+ std::vector<VclPtr<vcl::Window> > maDndWindows;
Rectangle maStartCentButtons;
@@ -125,6 +125,7 @@ class BackingWindow
public:
BackingWindow( vcl::Window* pParent );
virtual ~BackingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 566227863f72..285e618b398f 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -45,6 +45,12 @@ using namespace ::com::sun::star::uno;
#define USERITEM_NAME OUString("UserItem")
+SingleTabDlgImpl::SingleTabDlgImpl()
+ : m_pSfxPage(NULL)
+ , m_pLine(NULL)
+ {
+ }
+
class SfxModelessDialog_Impl : public SfxListener
{
public:
@@ -163,15 +169,15 @@ SfxModalDialog::SfxModalDialog(vcl::Window *pParent, const OUString& rID, const
}
SfxModalDialog::~SfxModalDialog()
+{
+ disposeOnce();
+}
-/* [Description]
-
- Destructor; writes the Dialog position in the ini-file.
-*/
-
+void SfxModalDialog::dispose()
{
SetDialogData_Impl();
delete pOutputSet;
+ ModalDialog::dispose();
}
void SfxModalDialog::CreateOutputItemSet( SfxItemPool& rPool )
@@ -355,16 +361,16 @@ bool SfxModelessDialog::Notify( NotifyEvent& rEvt )
SfxModelessDialog::~SfxModelessDialog()
+{
+ disposeOnce();
+}
-/* [Description]
-
- Destructor
-*/
-
+void SfxModelessDialog::dispose()
{
if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
pBindings->SetActiveFrame( NULL );
delete pImp;
+ ModelessDialog::dispose();
}
@@ -505,20 +511,19 @@ bool SfxFloatingWindow::Close()
SfxFloatingWindow::~SfxFloatingWindow()
+{
+ disposeOnce();
+}
-/* [Description]
-
- Destructor
-*/
-
+void SfxFloatingWindow::dispose()
{
- if ( pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
+ if ( pImp && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
pBindings->SetActiveFrame( NULL );
delete pImp;
+ pImp = NULL;
+ FloatingWindow::dispose();
}
-
-
void SfxFloatingWindow::Resize()
/* [Description]
@@ -702,9 +707,18 @@ SfxSingleTabDialog::SfxSingleTabDialog(vcl::Window* pParent, const SfxItemSet* p
SfxSingleTabDialog::~SfxSingleTabDialog()
{
- delete pImpl->m_pSfxPage;
- delete pImpl->m_pLine;
+ disposeOnce();
+}
+
+void SfxSingleTabDialog::dispose()
+{
+ pImpl->m_pSfxPage.disposeAndClear();
+ pImpl->m_pLine.disposeAndClear();
delete pImpl;
+ pOKBtn.clear();
+ pCancelBtn.clear();
+ pHelpBtn.clear();
+ SfxModalDialog::dispose();
}
void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage,
@@ -718,7 +732,7 @@ void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage,
{
SetUniqId(nSettingsId);
- delete pImpl->m_pSfxPage;
+ pImpl->m_pSfxPage.disposeAndClear();
pImpl->m_pSfxPage = pTabPage;
fnGetRanges = pRangesFunc;
diff --git a/sfx2/source/dialog/checkin.cxx b/sfx2/source/dialog/checkin.cxx
index 61d963ef8a5e..e628476df652 100644
--- a/sfx2/source/dialog/checkin.cxx
+++ b/sfx2/source/dialog/checkin.cxx
@@ -20,6 +20,19 @@ SfxCheckinDialog::SfxCheckinDialog( vcl::Window* pParent ) :
m_pOKBtn->SetClickHdl( LINK( this, SfxCheckinDialog, OKHdl ) );
}
+SfxCheckinDialog::~SfxCheckinDialog()
+{
+ disposeOnce();
+}
+
+void SfxCheckinDialog::dispose()
+{
+ m_pCommentED.clear();
+ m_pMajorCB.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
+
OUString SfxCheckinDialog::GetComment( )
{
return m_pCommentED->GetText( );
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 5627c40bfc9a..55261037a376 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -626,11 +626,24 @@ SfxDocumentDescPage::SfxDocumentDescPage( vcl::Window * pParent, const SfxItemSe
m_pCommentEd->set_height_request(m_pCommentEd->GetTextHeight() * 16);
}
-SfxTabPage *SfxDocumentDescPage::Create(vcl::Window *pParent, const SfxItemSet *rItemSet)
+SfxDocumentDescPage::~SfxDocumentDescPage()
{
- return new SfxDocumentDescPage(pParent, *rItemSet);
+ disposeOnce();
}
+void SfxDocumentDescPage::dispose()
+{
+ m_pTitleEd.clear();
+ m_pThemaEd.clear();
+ m_pKeywordsEd.clear();
+ m_pCommentEd.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SfxDocumentDescPage::Create(vcl::Window *pParent, const SfxItemSet *rItemSet)
+{
+ return VclPtr<SfxDocumentDescPage>::Create(pParent, *rItemSet);
+}
bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet)
{
@@ -789,6 +802,32 @@ SfxDocumentPage::SfxDocumentPage(vcl::Window* pParent, const SfxItemSet& rItemSe
m_pSignatureBtn->Disable();
}
+SfxDocumentPage::~SfxDocumentPage()
+{
+ disposeOnce();
+}
+
+void SfxDocumentPage::dispose()
+{
+ m_pBmp.clear();
+ m_pNameED.clear();
+ m_pChangePassBtn.clear();
+ m_pShowTypeFT.clear();
+ m_pFileValEd.clear();
+ m_pShowSizeFT.clear();
+ m_pCreateValFt.clear();
+ m_pChangeValFt.clear();
+ m_pSignedValFt.clear();
+ m_pSignatureBtn.clear();
+ m_pPrintValFt.clear();
+ m_pTimeLogValFt.clear();
+ m_pDocNoValFt.clear();
+ m_pUseUserDataCB.clear();
+ m_pDeleteBtn.clear();
+ m_pTemplFt.clear();
+ m_pTemplValFt.clear();
+ SfxTabPage::dispose();
+}
IMPL_LINK_NOARG(SfxDocumentPage, DeleteHdl)
@@ -901,11 +940,9 @@ void SfxDocumentPage::ImplCheckPasswordState()
m_pChangePassBtn->Disable();
}
-
-
-SfxTabPage* SfxDocumentPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
+VclPtr<SfxTabPage> SfxDocumentPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
- return new SfxDocumentPage( pParent, *rItemSet );
+ return VclPtr<SfxDocumentPage>::Create( pParent, *rItemSet );
}
void SfxDocumentPage::EnableUseUserData()
@@ -1182,33 +1219,47 @@ void SfxDocumentInfoDialog::AddFontTabPage()
CustomPropertiesYesNoButton::CustomPropertiesYesNoButton( vcl::Window* pParent, const ResId& rResId ) :
Control( pParent, rResId ),
- m_aYesButton( this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() ) ),
- m_aNoButton ( this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() ) )
+ m_aYesButton( VclPtr<RadioButton>::Create(this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() )) ),
+ m_aNoButton ( VclPtr<RadioButton>::Create(this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() )) )
{
FreeResource();
Wallpaper aWall( Color( COL_TRANSPARENT ) );
SetBackground( aWall );
SetBorderStyle( WindowBorderStyle::MONO );
CheckNo();
- m_aYesButton.SetBackground( aWall );
- m_aNoButton.SetBackground( aWall );
+ m_aYesButton->SetBackground( aWall );
+ m_aNoButton->SetBackground( aWall );
+}
+
+
+CustomPropertiesYesNoButton::~CustomPropertiesYesNoButton()
+{
+ disposeOnce();
+}
+
+void CustomPropertiesYesNoButton::dispose()
+{
+ m_aYesButton.disposeAndClear();
+ m_aNoButton.disposeAndClear();
+ Control::dispose();
}
class DurationDialog_Impl : public ModalDialog
{
- CheckBox* m_pNegativeCB;
- NumericField* m_pYearNF;
- NumericField* m_pMonthNF;
- NumericField* m_pDayNF;
- NumericField* m_pHourNF;
- NumericField* m_pMinuteNF;
- NumericField* m_pSecondNF;
- NumericField* m_pMSecondNF;
+ VclPtr<CheckBox> m_pNegativeCB;
+ VclPtr<NumericField> m_pYearNF;
+ VclPtr<NumericField> m_pMonthNF;
+ VclPtr<NumericField> m_pDayNF;
+ VclPtr<NumericField> m_pHourNF;
+ VclPtr<NumericField> m_pMinuteNF;
+ VclPtr<NumericField> m_pSecondNF;
+ VclPtr<NumericField> m_pMSecondNF;
public:
DurationDialog_Impl( vcl::Window* pParent, const util::Duration& rDuration );
-
+ virtual ~DurationDialog_Impl();
+ virtual void dispose() SAL_OVERRIDE;
util::Duration GetDuration() const;
};
@@ -1236,6 +1287,24 @@ DurationDialog_Impl::DurationDialog_Impl(vcl::Window* pParent,
m_pMSecondNF->SetValue(rDuration.NanoSeconds);
}
+DurationDialog_Impl::~DurationDialog_Impl()
+{
+ disposeOnce();
+}
+
+void DurationDialog_Impl::dispose()
+{
+ m_pNegativeCB.clear();
+ m_pYearNF.clear();
+ m_pMonthNF.clear();
+ m_pDayNF.clear();
+ m_pHourNF.clear();
+ m_pMinuteNF.clear();
+ m_pSecondNF.clear();
+ m_pMSecondNF.clear();
+ ModalDialog::dispose();
+}
+
util::Duration DurationDialog_Impl::GetDuration() const
{
util::Duration aRet;
@@ -1259,10 +1328,6 @@ CustomPropertiesDurationField::CustomPropertiesDurationField(vcl::Window* pParen
SetDuration( util::Duration(false, 0, 0, 0, 0, 0, 0, 0) );
}
-CustomPropertiesDurationField::~CustomPropertiesDurationField()
-{
-}
-
void CustomPropertiesDurationField::RequestHelp( const HelpEvent& rHEvt )
{
if ( rHEvt.GetMode() & HelpEventMode::QUICK )
@@ -1299,15 +1364,11 @@ CustomPropertiesEditButton::CustomPropertiesEditButton(vcl::Window* pParent, Win
SetClickHdl( LINK( this, CustomPropertiesEditButton, ClickHdl ));
}
-CustomPropertiesEditButton::~CustomPropertiesEditButton()
-{
-}
-
IMPL_LINK_NOARG(CustomPropertiesEditButton, ClickHdl)
{
- boost::scoped_ptr<DurationDialog_Impl> pDurationDlg(new DurationDialog_Impl( this, m_pLine->m_aDurationField.GetDuration() ));
+ VclPtrInstance< DurationDialog_Impl > pDurationDlg( this, m_pLine->m_aDurationField->GetDuration() );
if ( RET_OK == pDurationDlg->Execute() )
- m_pLine->m_aDurationField.SetDuration( pDurationDlg->GetDuration() );
+ m_pLine->m_aDurationField->SetDuration( pDurationDlg->GetDuration() );
return 1;
}
@@ -1316,54 +1377,54 @@ void CustomPropertiesYesNoButton::Resize()
const long nWidth = GetSizePixel().Width();
const long n3Width = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ).Width();
const long nNewWidth = ( nWidth / 2 ) - n3Width - 2;
- Size aSize = m_aYesButton.GetSizePixel();
+ Size aSize = m_aYesButton->GetSizePixel();
const long nDelta = aSize.Width() - nNewWidth;
aSize.Width() = nNewWidth;
- m_aYesButton.SetSizePixel( aSize );
- Point aPos = m_aNoButton.GetPosPixel();
+ m_aYesButton->SetSizePixel( aSize );
+ Point aPos = m_aNoButton->GetPosPixel();
aPos.X() -= nDelta;
- m_aNoButton.SetPosSizePixel( aPos, aSize );
+ m_aNoButton->SetPosSizePixel( aPos, aSize );
}
// struct CustomPropertyLine ---------------------------------------------
CustomPropertyLine::CustomPropertyLine( vcl::Window* pParent ) :
- m_aNameBox ( pParent, SfxResId( SFX_CB_PROPERTY_NAME ) ),
- m_aTypeBox ( pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this ),
- m_aValueEdit ( pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ),
- m_aDateField ( pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ),
- m_aTimeField ( pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ),
+ m_aNameBox ( VclPtr<ComboBox>::Create(pParent, SfxResId( SFX_CB_PROPERTY_NAME )) ),
+ m_aTypeBox ( VclPtr<CustomPropertiesTypeBox>::Create(pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this) ),
+ m_aValueEdit ( VclPtr<CustomPropertiesEdit>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ) ),
+ m_aDateField ( VclPtr<CustomPropertiesDateField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
+ m_aTimeField ( VclPtr<CustomPropertiesTimeField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
m_sDurationFormat( SfxResId( SFX_ST_DURATION_FORMAT ).toString() ),
- m_aDurationField( pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ),
- m_aEditButton ( pParent, WB_TABSTOP, this ),
- m_aYesNoButton ( pParent, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
- m_aRemoveButton ( pParent, 0, this ),
+ m_aDurationField( VclPtr<CustomPropertiesDurationField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ) ),
+ m_aEditButton ( VclPtr<CustomPropertiesEditButton>::Create(pParent, WB_TABSTOP, this) ),
+ m_aYesNoButton ( VclPtr<CustomPropertiesYesNoButton>::Create(pParent, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
+ m_aRemoveButton ( VclPtr<CustomPropertiesRemoveButton>::Create(pParent, 0, this) ),
m_bIsDate ( false ),
m_bIsRemoved ( false ),
m_bTypeLostFocus( false )
{
- m_aTimeField.SetExtFormat( EXTTIMEF_24H_LONG );
- m_aDateField.SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY );
+ m_aTimeField->SetExtFormat( EXTTIMEF_24H_LONG );
+ m_aDateField->SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY );
- m_aRemoveButton.SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE)));
- m_aRemoveButton.SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString());
+ m_aRemoveButton->SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE)));
+ m_aRemoveButton->SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString());
- m_aEditButton.SetText(SfxResId(SFX_ST_EDIT).toString());
+ m_aEditButton->SetText(SfxResId(SFX_ST_EDIT).toString());
}
void CustomPropertyLine::SetRemoved()
{
DBG_ASSERT( !m_bIsRemoved, "CustomPropertyLine::SetRemoved(): line already removed" );
m_bIsRemoved = true;
- m_aNameBox.Hide();
- m_aTypeBox.Hide();
- m_aValueEdit.Hide();
- m_aDateField.Hide();
- m_aTimeField.Hide();
- m_aDurationField.Hide();
- m_aEditButton.Hide();
- m_aYesNoButton.Hide();
- m_aRemoveButton.Hide();
+ m_aNameBox->Hide();
+ m_aTypeBox->Hide();
+ m_aValueEdit->Hide();
+ m_aDateField->Hide();
+ m_aTimeField->Hide();
+ m_aDurationField->Hide();
+ m_aEditButton->Hide();
+ m_aYesNoButton->Hide();
+ m_aRemoveButton->Hide();
}
CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
@@ -1374,27 +1435,27 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
m_pHeaderAccName(pHeaderAccName),
m_pHeaderAccType(pHeaderAccType),
m_pHeaderAccValue(pHeaderAccValue),
- m_aNameBox ( this, SfxResId( SFX_CB_PROPERTY_NAME ) ),
- m_aTypeBox ( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ),
- m_aValueEdit ( this, WB_BORDER|WB_TABSTOP|WB_LEFT ),
- m_aDateField ( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ),
- m_aTimeField ( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ),
- m_aDurationField( this, WB_BORDER|WB_TABSTOP|WB_READONLY ),
- m_aEditButton( this, WB_TABSTOP ),
- m_aYesNoButton ( this, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
- m_aRemoveButton ( this, 0 ),
+ m_aNameBox ( VclPtr<ComboBox>::Create( this, SfxResId( SFX_CB_PROPERTY_NAME ) ) ),
+ m_aTypeBox ( VclPtr<ListBox>::Create( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ) ),
+ m_aValueEdit ( VclPtr<Edit>::Create( this, WB_BORDER|WB_TABSTOP|WB_LEFT ) ),
+ m_aDateField ( VclPtr<DateField>::Create( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
+ m_aTimeField ( VclPtr<TimeField>::Create( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
+ m_aDurationField( VclPtr<Edit>::Create( this, WB_BORDER|WB_TABSTOP|WB_READONLY ) ),
+ m_aEditButton ( VclPtr<PushButton>::Create( this, WB_TABSTOP ) ),
+ m_aYesNoButton ( VclPtr<CustomPropertiesYesNoButton>::Create( this, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
+ m_aRemoveButton ( VclPtr<ImageButton>::Create( this, 0 ) ),
m_nScrollPos (0),
m_pCurrentLine (NULL),
m_aNumberFormatter( ::comphelper::getProcessComponentContext(),
Application::GetSettings().GetLanguageTag().getLanguageType() )
{
- m_aEditButton.SetPosSizePixel(
+ m_aEditButton->SetPosSizePixel(
LogicToPixel(Point(159, 2), MAP_APPFONT),
LogicToPixel(Size(RSC_CD_TEXTBOX_HEIGHT, RSC_CD_TEXTBOX_HEIGHT), MAP_APPFONT));
- m_aRemoveButton.SetSizePixel(LogicToPixel(Size(RSC_CD_PUSHBUTTON_HEIGHT, RSC_CD_PUSHBUTTON_HEIGHT), MAP_APPFONT));
+ m_aRemoveButton->SetSizePixel(LogicToPixel(Size(RSC_CD_PUSHBUTTON_HEIGHT, RSC_CD_PUSHBUTTON_HEIGHT), MAP_APPFONT));
- m_aValueEdit.SetPosSizePixel(
+ m_aValueEdit->SetPosSizePixel(
LogicToPixel(Point(159, 2), MAP_APPFONT),
LogicToPixel(Size(61, RSC_CD_TEXTBOX_HEIGHT), MAP_APPFONT));
@@ -1403,57 +1464,75 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
m_aBoxLoseFocusIdle.SetPriority( SchedulerPriority::LOWEST );
m_aBoxLoseFocusIdle.SetIdleHdl( LINK( this, CustomPropertiesWindow, BoxTimeoutHdl ) );
- m_aNameBox.add_mnemonic_label(m_pHeaderAccName);
- m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText());
- m_aTypeBox.add_mnemonic_label(m_pHeaderAccType);
- m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText());
- m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue);
- m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText());
-
- m_aNameBox.Hide();
- m_aTypeBox.Hide();
- m_aValueEdit.Hide();
- m_aDateField.Hide();
- m_aTimeField.Hide();
- m_aDurationField.Hide();
- m_aEditButton.Hide();
- m_aYesNoButton.Hide();
- m_aRemoveButton.Hide();
+ m_aNameBox->add_mnemonic_label(m_pHeaderAccName);
+ m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText());
+ m_aTypeBox->add_mnemonic_label(m_pHeaderAccType);
+ m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText());
+ m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue);
+ m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText());
+
+ m_aNameBox->Hide();
+ m_aTypeBox->Hide();
+ m_aValueEdit->Hide();
+ m_aDateField->Hide();
+ m_aTimeField->Hide();
+ m_aDurationField->Hide();
+ m_aEditButton->Hide();
+ m_aYesNoButton->Hide();
+ m_aRemoveButton->Hide();
m_nLineHeight =
- ( m_aRemoveButton.GetPosPixel().Y() * 2 ) + m_aRemoveButton.GetSizePixel().Height();
+ ( m_aRemoveButton->GetPosPixel().Y() * 2 ) + m_aRemoveButton->GetSizePixel().Height();
}
CustomPropertiesWindow::~CustomPropertiesWindow()
{
+ disposeOnce();
+}
+
+void CustomPropertiesWindow::dispose()
+{
m_aEditLoseFocusIdle.Stop();
m_aBoxLoseFocusIdle.Stop();
ClearAllLines();
+ m_aNameBox.disposeAndClear();
+ m_aTypeBox.disposeAndClear();
+ m_aValueEdit.disposeAndClear();
+ m_aDateField.disposeAndClear();
+ m_aTimeField.disposeAndClear();
+ m_aDurationField.disposeAndClear();
+ m_aEditButton.disposeAndClear();
+ m_aYesNoButton.disposeAndClear();
+ m_aRemoveButton.disposeAndClear();
+ m_pHeaderAccName.clear();
+ m_pHeaderAccType.clear();
+ m_pHeaderAccValue.clear();
+ vcl::Window::dispose();
}
IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox )
{
long nType = reinterpret_cast<long>( pBox->GetSelectEntryData() );
CustomPropertyLine* pLine = pBox->GetLine();
- pLine->m_aValueEdit.Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER == nType) );
- pLine->m_aDateField.Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME == nType) );
- pLine->m_aTimeField.Show( CUSTOM_TYPE_DATETIME == nType );
- pLine->m_aDurationField.Show( CUSTOM_TYPE_DURATION == nType );
- pLine->m_aEditButton.Show( CUSTOM_TYPE_DURATION == nType );
- pLine->m_aYesNoButton.Show( CUSTOM_TYPE_BOOLEAN == nType );
+ pLine->m_aValueEdit->Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER == nType) );
+ pLine->m_aDateField->Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME == nType) );
+ pLine->m_aTimeField->Show( CUSTOM_TYPE_DATETIME == nType );
+ pLine->m_aDurationField->Show( CUSTOM_TYPE_DURATION == nType );
+ pLine->m_aEditButton->Show( CUSTOM_TYPE_DURATION == nType );
+ pLine->m_aYesNoButton->Show( CUSTOM_TYPE_BOOLEAN == nType );
//adjust positions of date and time controls
if ( nType == CUSTOM_TYPE_DATE )
{
pLine->m_bIsDate = true;
- pLine->m_aDateField.SetSizePixel( pLine->m_aValueEdit.GetSizePixel() );
+ pLine->m_aDateField->SetSizePixel( pLine->m_aValueEdit->GetSizePixel() );
}
else if ( nType == CUSTOM_TYPE_DATETIME)
{
// because m_aDateField and m_aTimeField have the same size for type "DateTime",
// we just rely on m_aTimeField here.
pLine->m_bIsDate = false;
- pLine->m_aDateField.SetSizePixel( pLine->m_aTimeField.GetSizePixel() );
+ pLine->m_aDateField->SetSizePixel( pLine->m_aTimeField->GetSizePixel() );
}
return 0;
@@ -1476,10 +1555,10 @@ IMPL_LINK( CustomPropertiesWindow, RemoveHdl, CustomPropertiesRemoveButton*, pBu
if ( pLine->m_bIsRemoved )
continue;
- vcl::Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit,
- &pLine->m_aDateField, &pLine->m_aTimeField,
- &pLine->m_aDurationField, &pLine->m_aEditButton,
- &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(),
+ pLine->m_aDateField.get(), pLine->m_aTimeField.get(),
+ pLine->m_aDurationField.get(), pLine->m_aEditButton.get(),
+ pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
while ( *pCurrent )
{
@@ -1539,8 +1618,8 @@ bool CustomPropertiesWindow::IsLineValid( CustomPropertyLine* pLine ) const
bool bIsValid = true;
pLine->m_bTypeLostFocus = false;
long nType = reinterpret_cast<long>(
- pLine->m_aTypeBox.GetSelectEntryData() );
- OUString sValue = pLine->m_aValueEdit.GetText();
+ pLine->m_aTypeBox->GetSelectEntryData() );
+ OUString sValue = pLine->m_aValueEdit->GetText();
if ( sValue.isEmpty() )
return true;
@@ -1574,9 +1653,9 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr
pLine->m_bTypeLostFocus = true;
vcl::Window* pParent = GetParent()->GetParent();
if (MessageDialog(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL).Execute() == RET_OK)
- pLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast<void*>(CUSTOM_TYPE_TEXT) ) );
+ pLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast<void*>(CUSTOM_TYPE_TEXT) ) );
else
- pLine->m_aValueEdit.GrabFocus();
+ pLine->m_aValueEdit->GrabFocus();
}
}
@@ -1589,8 +1668,8 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
const long nOffset = 4;
const long nScrollBarWidth = pScrollBar->GetSizePixel().Width();
- const long nButtonWidth = m_aRemoveButton.GetSizePixel().Width() + nScrollBarWidth + nOffset;
- long nTypeWidth = m_aTypeBox.CalcMinimumSize().Width() + ( 2 * nOffset );
+ const long nButtonWidth = m_aRemoveButton->GetSizePixel().Width() + nScrollBarWidth + nOffset;
+ long nTypeWidth = m_aTypeBox->CalcMinimumSize().Width() + ( 2 * nOffset );
long nFullWidth = pHeaderBar->GetSizePixel().Width();
long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2;
pHeaderBar->SetItemSize( HI_NAME, nItemWidth );
@@ -1598,7 +1677,7 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
pHeaderBar->SetItemSize( HI_VALUE, nItemWidth );
pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth );
- vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, &m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(), m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
sal_uInt16 nPos = 0;
while ( *pCurrent )
@@ -1609,7 +1688,7 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
Size aSize(aOrigSize);
Point aPos(aOrigPos);
long nWidth = aRect.GetWidth() - nOffset;
- if ( *pCurrent == &m_aRemoveButton )
+ if ( *pCurrent == m_aRemoveButton.get() )
nWidth -= pScrollBar->GetSizePixel().Width();
aSize.Width() = nWidth;
aPos.X() = aRect.getX() + ( nOffset / 2 );
@@ -1620,23 +1699,23 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
bChanged = true;
}
- if ( *pCurrent == &m_aValueEdit )
+ if ( *pCurrent == m_aValueEdit.get() )
{
Point aDurationPos( aPos );
- m_aDurationField.SetPosPixel( aDurationPos );
+ m_aDurationField->SetPosPixel( aDurationPos );
Size aDurationSize(aSize);
- aDurationSize.Width() -= (m_aEditButton.GetSizePixel().Width() + 3 );
- m_aDurationField.SetSizePixel(aDurationSize);
- aDurationPos.X() = aPos.X() - m_aEditButton.GetSizePixel().Width() + aSize.Width();
- m_aEditButton.SetPosPixel(aDurationPos);
+ aDurationSize.Width() -= (m_aEditButton->GetSizePixel().Width() + 3 );
+ m_aDurationField->SetSizePixel(aDurationSize);
+ aDurationPos.X() = aPos.X() - m_aEditButton->GetSizePixel().Width() + aSize.Width();
+ m_aEditButton->SetPosPixel(aDurationPos);
- m_aYesNoButton.SetPosSizePixel( aPos, aSize );
+ m_aYesNoButton->SetPosSizePixel( aPos, aSize );
aSize.Width() /= 2;
aSize.Width() -= 2;
- m_aDateField.SetPosSizePixel( aPos, aSize );
+ m_aDateField->SetPosSizePixel( aPos, aSize );
aPos.X() += aSize.Width() + 4;
- m_aTimeField.SetPosSizePixel( aPos, aSize );
+ m_aTimeField->SetPosSizePixel( aPos, aSize );
}
pCurrent++;
@@ -1660,10 +1739,10 @@ sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const
void CustomPropertiesWindow::updateLineWidth()
{
- vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit,
- &m_aDateField, &m_aTimeField,
- &m_aDurationField, &m_aEditButton,
- &m_aYesNoButton, &m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(),
+ m_aDateField.get(), m_aTimeField.get(),
+ m_aDurationField.get(), m_aEditButton.get(),
+ m_aYesNoButton.get(), m_aRemoveButton.get(), NULL };
for (std::vector< CustomPropertyLine* >::iterator aI =
m_aCustomPropertiesLines.begin(), aEnd = m_aCustomPropertiesLines.end();
@@ -1672,10 +1751,10 @@ void CustomPropertiesWindow::updateLineWidth()
CustomPropertyLine* pNewLine = *aI;
vcl::Window* pNewWindows[] =
- { &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit,
- &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
- &pNewLine->m_aDurationField, &pNewLine->m_aEditButton,
- &pNewLine->m_aYesNoButton, &pNewLine->m_aRemoveButton, NULL };
+ { pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(),
+ pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(),
+ pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(),
+ pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
vcl::Window** pNewCurrent = pNewWindows;
@@ -1691,38 +1770,38 @@ void CustomPropertiesWindow::updateLineWidth()
// if we have type "Date", we use the full width, not only the half
if (pNewLine->m_bIsDate)
- pNewLine->m_aDateField.SetSizePixel( pNewLine->m_aValueEdit.GetSizePixel() );
+ pNewLine->m_aDateField->SetSizePixel( pNewLine->m_aValueEdit->GetSizePixel() );
}
}
void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
{
CustomPropertyLine* pNewLine = new CustomPropertyLine( this );
- pNewLine->m_aTypeBox.SetSelectHdl( LINK( this, CustomPropertiesWindow, TypeHdl ) );
- pNewLine->m_aRemoveButton.SetClickHdl( LINK( this, CustomPropertiesWindow, RemoveHdl ) );
- pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, EditLoseFocusHdl ) );
+ pNewLine->m_aTypeBox->SetSelectHdl( LINK( this, CustomPropertiesWindow, TypeHdl ) );
+ pNewLine->m_aRemoveButton->SetClickHdl( LINK( this, CustomPropertiesWindow, RemoveHdl ) );
+ pNewLine->m_aValueEdit->SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, EditLoseFocusHdl ) );
//add lose focus handlers of date/time fields
- pNewLine->m_aTypeBox.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, BoxLoseFocusHdl ) );
+ pNewLine->m_aTypeBox->SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, BoxLoseFocusHdl ) );
- pNewLine->m_aNameBox.add_mnemonic_label(m_pHeaderAccName);
- pNewLine->m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText());
- pNewLine->m_aTypeBox.add_mnemonic_label(m_pHeaderAccType);
- pNewLine->m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText());
- pNewLine->m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue);
- pNewLine->m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText());
+ pNewLine->m_aNameBox->add_mnemonic_label(m_pHeaderAccName);
+ pNewLine->m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText());
+ pNewLine->m_aTypeBox->add_mnemonic_label(m_pHeaderAccType);
+ pNewLine->m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText());
+ pNewLine->m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue);
+ pNewLine->m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText());
sal_Int32 nPos = GetVisibleLineCount() * GetLineHeight();
m_aCustomPropertiesLines.push_back( pNewLine );
- vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit,
- &m_aDateField, &m_aTimeField,
- &m_aDurationField, &m_aEditButton,
- &m_aYesNoButton, &m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(),
+ m_aDateField.get(), m_aTimeField.get(),
+ m_aDurationField.get(), m_aEditButton.get(),
+ m_aYesNoButton.get(), m_aRemoveButton.get(), NULL };
vcl::Window* pNewWindows[] =
- { &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit,
- &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
- &pNewLine->m_aDurationField, &pNewLine->m_aEditButton,
- &pNewLine->m_aYesNoButton, &pNewLine->m_aRemoveButton, NULL };
+ { pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(),
+ pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(),
+ pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(),
+ pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
vcl::Window** pNewCurrent = pNewWindows;
while ( *pCurrent )
@@ -1747,7 +1826,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
util::Duration aTmpDuration;
SvtSysLocale aSysLocale;
const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
- pNewLine->m_aNameBox.SetText( sName );
+ pNewLine->m_aNameBox->SetText( sName );
sal_IntPtr nType = CUSTOM_TYPE_UNKNOWN;
OUString sValue;
@@ -1755,7 +1834,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
{
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
m_aNumberFormatter.GetInputLineString( nTmpValue, nIndex, sValue );
- pNewLine->m_aValueEdit.SetText( sValue );
+ pNewLine->m_aValueEdit->SetText( sValue );
nType = CUSTOM_TYPE_NUMBER;
}
else if ( rAny >>= bTmpValue )
@@ -1765,41 +1844,41 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
}
else if ( rAny >>= sTmpValue )
{
- pNewLine->m_aValueEdit.SetText( sTmpValue );
+ pNewLine->m_aValueEdit->SetText( sTmpValue );
nType = CUSTOM_TYPE_TEXT;
}
else if ( rAny >>= aTmpDate )
{
- pNewLine->m_aDateField.SetDate( Date( aTmpDate ) );
+ pNewLine->m_aDateField->SetDate( Date( aTmpDate ) );
nType = CUSTOM_TYPE_DATE;
}
else if ( rAny >>= aTmpDateTime )
{
- pNewLine->m_aDateField.SetDate( Date( aTmpDateTime ) );
- pNewLine->m_aTimeField.SetTime( tools::Time( aTmpDateTime ) );
- pNewLine->m_aTimeField.m_isUTC = aTmpDateTime.IsUTC;
+ pNewLine->m_aDateField->SetDate( Date( aTmpDateTime ) );
+ pNewLine->m_aTimeField->SetTime( tools::Time( aTmpDateTime ) );
+ pNewLine->m_aTimeField->m_isUTC = aTmpDateTime.IsUTC;
nType = CUSTOM_TYPE_DATETIME;
}
else if ( rAny >>= aTmpDateTZ )
{
- pNewLine->m_aDateField.SetDate( Date( aTmpDateTZ.DateInTZ.Day,
+ pNewLine->m_aDateField->SetDate( Date( aTmpDateTZ.DateInTZ.Day,
aTmpDateTZ.DateInTZ.Month, aTmpDateTZ.DateInTZ.Year ) );
- pNewLine->m_aDateField.m_TZ = aTmpDateTZ.Timezone;
+ pNewLine->m_aDateField->m_TZ = aTmpDateTZ.Timezone;
nType = CUSTOM_TYPE_DATE;
}
else if ( rAny >>= aTmpDateTimeTZ )
{
util::DateTime const& rDT(aTmpDateTimeTZ.DateTimeInTZ);
- pNewLine->m_aDateField.SetDate( Date( rDT ) );
- pNewLine->m_aTimeField.SetTime( tools::Time( rDT ) );
- pNewLine->m_aTimeField.m_isUTC = rDT.IsUTC;
- pNewLine->m_aDateField.m_TZ = aTmpDateTimeTZ.Timezone;
+ pNewLine->m_aDateField->SetDate( Date( rDT ) );
+ pNewLine->m_aTimeField->SetTime( tools::Time( rDT ) );
+ pNewLine->m_aTimeField->m_isUTC = rDT.IsUTC;
+ pNewLine->m_aDateField->m_TZ = aTmpDateTimeTZ.Timezone;
nType = CUSTOM_TYPE_DATETIME;
}
else if ( rAny >>= aTmpDuration )
{
nType = CUSTOM_TYPE_DURATION;
- pNewLine->m_aDurationField.SetDuration( aTmpDuration );
+ pNewLine->m_aDurationField->SetDuration( aTmpDuration );
}
if ( nType != CUSTOM_TYPE_UNKNOWN )
@@ -1807,15 +1886,15 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
if ( CUSTOM_TYPE_BOOLEAN == nType )
{
if ( bTmpValue )
- pNewLine->m_aYesNoButton.CheckYes();
+ pNewLine->m_aYesNoButton->CheckYes();
else
- pNewLine->m_aYesNoButton.CheckNo();
+ pNewLine->m_aYesNoButton->CheckNo();
}
- pNewLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast<void*>(nType) ) );
+ pNewLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast<void*>(nType) ) );
}
- TypeHdl( &pNewLine->m_aTypeBox );
- pNewLine->m_aNameBox.GrabFocus();
+ TypeHdl( pNewLine->m_aTypeBox.get() );
+ pNewLine->m_aNameBox->GrabFocus();
}
bool CustomPropertiesWindow::AreAllLinesValid() const
@@ -1861,8 +1940,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
if ( pLine->m_bIsRemoved )
continue;
- vcl::Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField,
- &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(), pLine->m_aDateField.get(), pLine->m_aTimeField.get(),
+ pLine->m_aDurationField.get(), pLine->m_aEditButton.get(), pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
while ( *pCurrent )
{
@@ -1886,39 +1965,39 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
if ( pLine->m_bIsRemoved )
continue;
- OUString sPropertyName = pLine->m_aNameBox.GetText();
+ OUString sPropertyName = pLine->m_aNameBox->GetText();
if ( !sPropertyName.isEmpty() )
{
aPropertiesSeq[i].Name = sPropertyName;
long nType = reinterpret_cast<long>(
- pLine->m_aTypeBox.GetSelectEntryData() );
+ pLine->m_aTypeBox->GetSelectEntryData() );
if ( CUSTOM_TYPE_NUMBER == nType )
{
double nValue = 0;
sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
- IsNumberFormat( pLine->m_aValueEdit.GetText(), nIndex, nValue );
+ IsNumberFormat( pLine->m_aValueEdit->GetText(), nIndex, nValue );
if ( bIsNum )
aPropertiesSeq[i].Value <<= makeAny( nValue );
}
else if ( CUSTOM_TYPE_BOOLEAN == nType )
{
- bool bValue = pLine->m_aYesNoButton.IsYesChecked();
+ bool bValue = pLine->m_aYesNoButton->IsYesChecked();
aPropertiesSeq[i].Value <<= makeAny( bValue );
}
else if ( CUSTOM_TYPE_DATETIME == nType )
{
- Date aTmpDate = pLine->m_aDateField.GetDate();
- tools::Time aTmpTime = pLine->m_aTimeField.GetTime();
+ Date aTmpDate = pLine->m_aDateField->GetDate();
+ tools::Time aTmpTime = pLine->m_aTimeField->GetTime();
util::DateTime const aDateTime(aTmpTime.GetNanoSec(),
aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear(),
- pLine->m_aTimeField.m_isUTC);
- if (pLine->m_aDateField.m_TZ.is_initialized())
+ pLine->m_aTimeField->m_isUTC);
+ if (pLine->m_aDateField->m_TZ.is_initialized())
{
aPropertiesSeq[i].Value <<= util::DateTimeWithTimezone(
- aDateTime, pLine->m_aDateField.m_TZ.get());
+ aDateTime, pLine->m_aDateField->m_TZ.get());
}
else
{
@@ -1927,13 +2006,13 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
}
else if ( CUSTOM_TYPE_DATE == nType )
{
- Date aTmpDate = pLine->m_aDateField.GetDate();
+ Date aTmpDate = pLine->m_aDateField->GetDate();
util::Date const aDate(aTmpDate.GetDay(), aTmpDate.GetMonth(),
aTmpDate.GetYear());
- if (pLine->m_aDateField.m_TZ.is_initialized())
+ if (pLine->m_aDateField->m_TZ.is_initialized())
{
aPropertiesSeq[i].Value <<= util::DateWithTimezone(
- aDate, pLine->m_aDateField.m_TZ.get());
+ aDate, pLine->m_aDateField->m_TZ.get());
}
else
{
@@ -1942,11 +2021,11 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
}
else if ( CUSTOM_TYPE_DURATION == nType )
{
- aPropertiesSeq[i].Value <<= pLine->m_aDurationField.GetDuration();
+ aPropertiesSeq[i].Value <<= pLine->m_aDurationField->GetDuration();
}
else
{
- OUString sValue( pLine->m_aValueEdit.GetText() );
+ OUString sValue( pLine->m_aValueEdit->GetText() );
aPropertiesSeq[i].Value <<= makeAny( sValue );
}
}
@@ -1968,17 +2047,17 @@ CustomPropertiesControl::CustomPropertiesControl(vcl::Window* pParent)
void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder)
{
- m_pVBox = new VclVBox(this);
- m_pHeaderBar = new HeaderBar(m_pVBox, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
- m_pBody = new VclHBox(m_pVBox);
+ m_pVBox = VclPtr<VclVBox>::Create(this);
+ m_pHeaderBar = VclPtr<HeaderBar>::Create(m_pVBox, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
+ m_pBody = VclPtr<VclHBox>::Create(m_pVBox);
FixedText* pName = rBuilder.get<FixedText>("name");
FixedText* pType = rBuilder.get<FixedText>("type");
FixedText* pValue = rBuilder.get<FixedText>("value");
OUString sName = pName->GetText();
OUString sType = pType->GetText();
OUString sValue = pValue->GetText();
- m_pPropertiesWin = new CustomPropertiesWindow(m_pBody, pName, pType, pValue);
- m_pVertScroll = new ScrollBar(m_pBody, WB_VERT);
+ m_pPropertiesWin = VclPtr<CustomPropertiesWindow>::Create(m_pBody, pName, pType, pValue);
+ m_pVertScroll = VclPtr<ScrollBar>::Create(m_pBody, WB_VERT);
set_hexpand(true);
set_vexpand(true);
@@ -2055,11 +2134,17 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeCustomPropertiesContro
CustomPropertiesControl::~CustomPropertiesControl()
{
- delete m_pVertScroll;
- delete m_pPropertiesWin;
- delete m_pBody;
- delete m_pHeaderBar;
- delete m_pVBox;
+ disposeOnce();
+}
+
+void CustomPropertiesControl::dispose()
+{
+ m_pVertScroll.disposeAndClear();
+ m_pPropertiesWin.disposeAndClear();
+ m_pBody.disposeAndClear();
+ m_pHeaderBar.disposeAndClear();
+ m_pVBox.disposeAndClear();
+ vcl::Window::dispose();
}
IMPL_LINK( CustomPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
@@ -2098,6 +2183,17 @@ SfxCustomPropertiesPage::SfxCustomPropertiesPage( vcl::Window* pParent, const Sf
get<PushButton>("add")->SetClickHdl(LINK(this, SfxCustomPropertiesPage, AddHdl));
}
+SfxCustomPropertiesPage::~SfxCustomPropertiesPage()
+{
+ disposeOnce();
+}
+
+void SfxCustomPropertiesPage::dispose()
+{
+ m_pPropertiesCtrl.clear();
+ SfxTabPage::dispose();
+}
+
IMPL_LINK_NOARG(SfxCustomPropertiesPage, AddHdl)
{
Any aAny;
@@ -2175,9 +2271,9 @@ SfxTabPage::sfxpg SfxCustomPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/
return nRet;
}
-SfxTabPage* SfxCustomPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
+VclPtr<SfxTabPage> SfxCustomPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
- return new SfxCustomPropertiesPage( pParent, *rItemSet );
+ return VclPtr<SfxCustomPropertiesPage>::Create( pParent, *rItemSet );
}
CmisValue::CmisValue( vcl::Window* pParent, const OUString& aStr )
@@ -2274,7 +2370,7 @@ CmisPropertiesWindow::CmisPropertiesWindow(SfxTabPage* pParent):
pParent->get(m_pBox, "CmisWindow");
CmisPropertyLine aTemp( m_pBox );
m_nItemHeight = aTemp.getItemHeight();
-};
+}
CmisPropertiesWindow::~CmisPropertiesWindow()
{
@@ -2671,9 +2767,9 @@ SfxTabPage::sfxpg SfxCmisPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ )
return LEAVE_PAGE;
}
-SfxTabPage* SfxCmisPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
+VclPtr<SfxTabPage> SfxCmisPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
- return new SfxCmisPropertiesPage( pParent, *rItemSet );
+ return VclPtr<SfxCmisPropertiesPage>::Create( pParent, *rItemSet );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 7118b2824e74..0ad3e754ca40 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -62,7 +62,7 @@ static const int NUM_OF_DOCKINGWINDOWS = 10;
class SfxTitleDockingWindow : public SfxDockingWindow
{
- vcl::Window* m_pWrappedWindow;
+ VclPtr<vcl::Window> m_pWrappedWindow;
public:
SfxTitleDockingWindow(
@@ -71,8 +71,9 @@ public:
vcl::Window* pParent ,
WinBits nBits);
virtual ~SfxTitleDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
- vcl::Window* GetWrappedWindow() const { return m_pWrappedWindow; }
+ vcl::Window* GetWrappedWindow() const { return m_pWrappedWindow; }
void SetWrappedWindow(vcl::Window* const pWindow);
virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
@@ -129,7 +130,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
const OUString aDockWindowResourceURL( "private:resource/dockingwindow/" );
- SfxTitleDockingWindow* pTitleDockWindow = new SfxTitleDockingWindow( pBindings, this, pParentWnd,
+ VclPtr<SfxTitleDockingWindow> pTitleDockWindow = VclPtr<SfxTitleDockingWindow>::Create( pBindings, this, pParentWnd,
WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
pWindow = pTitleDockWindow;
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
@@ -207,7 +208,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
pWindow->SetOutputSizePixel( Size( 270, 240 ) );
- static_cast<SfxDockingWindow*>( pWindow )->Initialize( pInfo );
+ static_cast<SfxDockingWindow*>( pWindow.get() )->Initialize( pInfo );
SetHideNotDelete( true );
}
@@ -252,7 +253,13 @@ SfxTitleDockingWindow::SfxTitleDockingWindow( SfxBindings* pBind ,
SfxTitleDockingWindow::~SfxTitleDockingWindow()
{
- delete m_pWrappedWindow;
+ disposeOnce();
+}
+
+void SfxTitleDockingWindow::dispose()
+{
+ m_pWrappedWindow.disposeAndClear();
+ SfxDockingWindow::dispose();
}
void SfxTitleDockingWindow::SetWrappedWindow( vcl::Window* const pWindow )
@@ -402,7 +409,7 @@ friend class SfxDockingWindow;
SfxChildAlignment eDockAlignment;
bool bConstructed;
Size aMinSize;
- SfxSplitWindow* pSplitWin;
+ VclPtr<SfxSplitWindow> pSplitWin;
bool bSplitable;
Idle aMoveIdle;
@@ -1267,8 +1274,14 @@ void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const
SfxDockingWindow::~SfxDockingWindow()
{
+ disposeOnce();
+}
+
+void SfxDockingWindow::dispose()
+{
ReleaseChildWindow_Impl();
- delete pImp;
+ delete pImp; pImp = NULL;
+ DockingWindow::dispose();
}
void SfxDockingWindow::ReleaseChildWindow_Impl()
diff --git a/sfx2/source/dialog/documentfontsdialog.cxx b/sfx2/source/dialog/documentfontsdialog.cxx
index c942fd25c059..22b495c3cab3 100644
--- a/sfx2/source/dialog/documentfontsdialog.cxx
+++ b/sfx2/source/dialog/documentfontsdialog.cxx
@@ -23,9 +23,9 @@
using namespace ::com::sun::star;
-SfxTabPage* SfxDocumentFontsPage::Create( vcl::Window* parent, const SfxItemSet* set )
+VclPtr<SfxTabPage> SfxDocumentFontsPage::Create( vcl::Window* parent, const SfxItemSet* set )
{
- return new SfxDocumentFontsPage( parent, *set );
+ return VclPtr<SfxDocumentFontsPage>::Create( parent, *set );
}
SfxDocumentFontsPage::SfxDocumentFontsPage( vcl::Window* parent, const SfxItemSet& set )
@@ -34,6 +34,17 @@ SfxDocumentFontsPage::SfxDocumentFontsPage( vcl::Window* parent, const SfxItemSe
get( embedFontsCheckbox, "embedFonts" );
}
+SfxDocumentFontsPage::~SfxDocumentFontsPage()
+{
+ disposeOnce();
+}
+
+void SfxDocumentFontsPage::dispose()
+{
+ embedFontsCheckbox.clear();
+ SfxTabPage::dispose();
+}
+
void SfxDocumentFontsPage::Reset( const SfxItemSet* )
{
bool bVal = false;
diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx
index 00c2d358d0c5..f07113288a37 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -54,7 +54,7 @@ namespace sfx2
SfxFilterMatcher* mpMatcher;
GraphicFilter* mpGraphicFilter;
FileDialogHelper* mpAntiImpl;
- vcl::Window* mpPreferredParentWindow;
+ VclPtr<vcl::Window> mpPreferredParentWindow;
::std::vector< OUString > mlLastURLs;
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index 6d3924ce5459..2bf43410a487 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -118,8 +118,8 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId,
const OUString& sMessage) :
Window(pParent, 0),
m_sId(sId),
- m_pMessage(new FixedText(this, 0)),
- m_pCloseBtn(new SfxCloseButton(this)),
+ m_pMessage(VclPtr<FixedText>::Create(this, 0)),
+ m_pCloseBtn(VclPtr<SfxCloseButton>::Create(this)),
m_aActionBtns()
{
sal_Int32 nScaleFactor = GetDPIScaleFactor();
@@ -136,9 +136,6 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId,
Resize();
}
-SfxInfoBarWindow::~SfxInfoBarWindow()
-{}
-
void SfxInfoBarWindow::addButton(PushButton* pButton) {
pButton->SetParent(this);
pButton->Show();
@@ -146,6 +143,22 @@ void SfxInfoBarWindow::addButton(PushButton* pButton) {
Resize();
}
+SfxInfoBarWindow::~SfxInfoBarWindow()
+{
+ disposeOnce();
+}
+
+void SfxInfoBarWindow::dispose()
+{
+ for ( auto it = m_aActionBtns.begin( ); it != m_aActionBtns.end( ); ++it )
+ it->disposeAndClear();
+
+ m_pMessage.disposeAndClear();
+ m_pCloseBtn.disposeAndClear();
+ m_aActionBtns.clear( );
+ vcl::Window::dispose();
+}
+
void SfxInfoBarWindow::Paint(const Rectangle& rPaintRect)
{
const ViewInformation2D aNewViewInfos;
@@ -203,12 +216,11 @@ void SfxInfoBarWindow::Resize()
long nX = m_pCloseBtn->GetPosPixel().getX() - 15 * nScaleFactor;
long nButtonGap = 5 * nScaleFactor;
- boost::ptr_vector<PushButton>::iterator it;
- for (it = m_aActionBtns.begin(); it != m_aActionBtns.end(); ++it)
+ for (auto it = m_aActionBtns.begin(); it != m_aActionBtns.end(); ++it)
{
- long nButtonWidth = it->GetSizePixel().getWidth();
+ long nButtonWidth = (*it)->GetSizePixel().getWidth();
nX -= nButtonWidth;
- it->SetPosSizePixel(Point(nX, 5 * nScaleFactor), Size(nButtonWidth, 30 * nScaleFactor));
+ (*it)->SetPosSizePixel(Point(nX, 5 * nScaleFactor), Size(nButtonWidth, 30 * nScaleFactor));
nX -= nButtonGap;
}
@@ -233,13 +245,22 @@ SfxInfoBarContainerWindow::SfxInfoBarContainerWindow(SfxInfoBarContainerChild* p
SfxInfoBarContainerWindow::~SfxInfoBarContainerWindow()
{
+ disposeOnce();
+}
+
+void SfxInfoBarContainerWindow::dispose()
+{
+ for ( auto it = m_pInfoBars.begin( ); it != m_pInfoBars.end( ); ++it )
+ it->disposeAndClear();
+ m_pInfoBars.clear( );
+ Window::dispose();
}
SfxInfoBarWindow* SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sMessage)
{
Size aSize = GetSizePixel();
- SfxInfoBarWindow* pInfoBar = new SfxInfoBarWindow(this, sId, sMessage);
+ VclPtrInstance<SfxInfoBarWindow> pInfoBar(this, sId, sMessage);
pInfoBar->SetPosPixel(Point(0, aSize.getHeight()));
pInfoBar->Show();
m_pInfoBars.push_back(pInfoBar);
@@ -252,32 +273,31 @@ SfxInfoBarWindow* SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId,
SfxInfoBarWindow* SfxInfoBarContainerWindow::getInfoBar(const OUString& sId)
{
- boost::ptr_vector<SfxInfoBarWindow>::iterator it;
- for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+ for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
{
- if (it->getId() == sId)
- return &(*it);
+ if ((*it)->getId() == sId)
+ return it->get();
}
return NULL;
}
void SfxInfoBarContainerWindow::removeInfoBar(SfxInfoBarWindow* pInfoBar)
{
- boost::ptr_vector<SfxInfoBarWindow>::iterator it;
- for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+ for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
{
- if (pInfoBar == &(*it))
+ if (pInfoBar == it->get())
{
m_pInfoBars.erase(it);
break;
}
}
+ pInfoBar->disposeOnce();
long nY = 0;
- for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+ for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
{
- it->SetPosPixel(Point(0, nY));
- nY += it->GetSizePixel().getHeight();
+ (*it)->SetPosPixel(Point(0, nY));
+ nY += (*it)->GetSizePixel().getHeight();
}
Size aSize = GetSizePixel();
@@ -292,13 +312,12 @@ void SfxInfoBarContainerWindow::Resize()
// Only need to change the width of the infobars
long nWidth = GetSizePixel().getWidth();
- boost::ptr_vector<SfxInfoBarWindow>::iterator it;
- for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+ for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
{
- Size aSize = it->GetSizePixel();
+ Size aSize = (*it)->GetSizePixel();
aSize.setWidth(nWidth);
- it->SetSizePixel(aSize);
- it->Resize();
+ (*it)->SetSizePixel(aSize);
+ (*it)->Resize();
}
}
@@ -308,7 +327,7 @@ SfxInfoBarContainerChild::SfxInfoBarContainerChild( vcl::Window* _pParent, sal_u
SfxChildWindow(_pParent, nId),
m_pBindings(pBindings)
{
- pWindow = new SfxInfoBarContainerWindow(this);
+ pWindow = VclPtr<SfxInfoBarContainerWindow>::Create(this);
pWindow->SetPosSizePixel(Point(0, 0), Size(_pParent->GetSizePixel().getWidth(), 0));
pWindow->Show();
diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx
index 6f1ab9288205..faa591d89f6a 100644
--- a/sfx2/source/dialog/inputdlg.cxx
+++ b/sfx2/source/dialog/inputdlg.cxx
@@ -26,6 +26,20 @@ InputDialog::InputDialog(const OUString &rLabelText, vcl::Window *pParent)
m_pCancel->SetClickHdl(LINK(this,InputDialog,ClickHdl));
}
+InputDialog::~InputDialog()
+{
+ disposeOnce();
+}
+
+void InputDialog::dispose()
+{
+ m_pEntry.clear();
+ m_pLabel.clear();
+ m_pOK.clear();
+ m_pCancel.clear();
+ ModalDialog::dispose();
+}
+
OUString InputDialog::getEntryText() const
{
return m_pEntry->GetText();
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 28233e47dcac..b0cdda7e85f9 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -858,8 +858,8 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
SolarMutexGuard aGuard;
vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
- MessageDialog aBox(pParentWindow, "ErrorFindEmailDialog", "sfx/ui/errorfindemaildialog.ui");
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(pParentWindow, "ErrorFindEmailDialog", "sfx/ui/errorfindemaildialog.ui");
+ aBox->Execute();
eResult = SEND_MAIL_CANCELLED;
}
else
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 6ad49be51c67..47c59880a8b3 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -27,6 +27,7 @@
#include <sfx2/styfitem.hxx>
#include <sfx2/styledlg.hxx>
+#include <sfx2/tabdlg.hxx>
#include <sfx2/app.hxx>
#include <sfx2/mgetempl.hxx>
#include <sfx2/objsh.hxx>
@@ -249,19 +250,30 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
SfxManageStyleSheetPage::~SfxManageStyleSheetPage()
+{
+ disposeOnce();
+}
-/* [Description]
-
- Destructor, release of the data
-*/
-
+void SfxManageStyleSheetPage::dispose()
{
m_pNameRw->SetGetFocusHdl( Link() );
m_pNameRw->SetLoseFocusHdl( Link() );
delete pFamilies;
pItem = 0;
pStyle = 0;
-
+ m_pNameRo.clear();
+ m_pNameRw.clear();
+ m_pAutoCB.clear();
+ m_pFollowFt.clear();
+ m_pFollowLb.clear();
+ m_pEditStyleBtn.clear();
+ m_pBaseFt.clear();
+ m_pBaseLb.clear();
+ m_pEditLinkStyleBtn.clear();
+ m_pFilterFt.clear();
+ m_pFilterLb.clear();
+ m_pDescFt.clear();
+ SfxTabPage::dispose();
}
@@ -558,20 +570,10 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ )
-SfxTabPage* SfxManageStyleSheetPage::Create( vcl::Window* pParent,
- const SfxItemSet *rAttrSet )
-
-/* [Description]
-
- Factory for the creation of the page.
-
- [Cross-reference]
-
- <class SfxTabDialog>
-*/
-
+VclPtr<SfxTabPage> SfxManageStyleSheetPage::Create( vcl::Window* pParent,
+ const SfxItemSet *rAttrSet )
{
- return new SfxManageStyleSheetPage( pParent, *rAttrSet );
+ return VclPtr<SfxManageStyleSheetPage>::Create( pParent, *rAttrSet );
}
@@ -634,8 +636,8 @@ SfxTabPage::sfxpg SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet
if (!pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' ')))
{
- MessageDialog aBox( this, SfxResId( STR_TABPAGE_INVALIDNAME ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDNAME ), VCL_MESSAGE_INFO);
+ aBox->Execute();
m_pNameRw->GrabFocus();
m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
return SfxTabPage::KEEP_PAGE;
@@ -651,8 +653,8 @@ SfxTabPage::sfxpg SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet
{
if ( !pStyle->SetFollow( aFollowEntry ) )
{
- MessageDialog aBox( this, SfxResId( STR_TABPAGE_INVALIDSTYLE ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDSTYLE ), VCL_MESSAGE_INFO);
+ aBox->Execute();
m_pFollowLb->GrabFocus();
return SfxTabPage::KEEP_PAGE;
}
@@ -671,8 +673,8 @@ SfxTabPage::sfxpg SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet
{
if ( !pStyle->SetParent( aParentEntry ) )
{
- MessageDialog aBox( this, SfxResId( STR_TABPAGE_INVALIDPARENT ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDPARENT ), VCL_MESSAGE_INFO);
+ aBox->Execute();
m_pBaseLb->GrabFocus();
return SfxTabPage::KEEP_PAGE;
}
diff --git a/sfx2/source/dialog/navigat.cxx b/sfx2/source/dialog/navigat.cxx
index 415c347d4970..98870a6981f1 100644
--- a/sfx2/source/dialog/navigat.cxx
+++ b/sfx2/source/dialog/navigat.cxx
@@ -34,14 +34,14 @@ SfxNavigatorWrapper::SfxNavigatorWrapper( vcl::Window* pParentWnd ,
SfxChildWinInfo* pInfo )
: SfxChildWindow( pParentWnd , nId )
{
- pWindow = new SfxNavigator( pBindings, this, pParentWnd,
+ pWindow = VclPtr<SfxNavigator>::Create( pBindings, this, pParentWnd,
WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
pWindow->SetHelpId ( HID_NAVIGATOR_WINDOW );
pWindow->SetOutputSizePixel( Size( 270, 240 ) );
- static_cast<SfxDockingWindow*>( pWindow )->Initialize( pInfo );
+ static_cast<SfxDockingWindow*>( pWindow.get() )->Initialize( pInfo );
SetHideNotDelete( true );
}
diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index a2f43fb10ab3..d3f26dc748cb 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -41,7 +41,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl )
return 0;
}
- if ( RET_YES == aQueryOverwriteBox.Execute() )
+ if ( RET_YES == aQueryOverwriteBox->Execute() )
EndDialog( RET_OK );
}
else
@@ -59,8 +59,8 @@ IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox )
SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rInPool )
: ModalDialog(pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui")
- , aQueryOverwriteBox(this, SfxResId(STR_QUERY_OVERWRITE),
- VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)
+ , aQueryOverwriteBox(VclPtr<MessageDialog>::Create(this, SfxResId(STR_QUERY_OVERWRITE),
+ VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO))
, rPool(rInPool)
{
get(m_pColBox, "stylename");
@@ -82,6 +82,15 @@ SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rIn
SfxNewStyleDlg::~SfxNewStyleDlg()
{
+ disposeOnce();
+}
+
+void SfxNewStyleDlg::dispose()
+{
+ aQueryOverwriteBox.disposeAndClear();
+ m_pColBox.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx
index 0a168d8305b1..f16288d4a1c7 100644
--- a/sfx2/source/dialog/partwnd.cxx
+++ b/sfx2/source/dialog/partwnd.cxx
@@ -59,16 +59,16 @@ SfxPartChildWnd_Impl::SfxPartChildWnd_Impl
: SfxChildWindow( pParentWnd, nId )
{
// Create Window
- pWindow = new SfxPartDockWnd_Impl( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK );
+ pWindow = VclPtr<SfxPartDockWnd_Impl>::Create( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK );
eChildAlignment = SfxChildAlignment::TOP;
assert(pInfo);
pInfo->nFlags |= SfxChildWindowFlags::FORCEDOCK;
- static_cast<SfxDockingWindow*>(pWindow)->SetFloatingSize( Size( 175, 175 ) );
+ static_cast<SfxDockingWindow*>(pWindow.get())->SetFloatingSize( Size( 175, 175 ) );
pWindow->SetSizePixel( Size( 175, 175 ) );
- static_cast<SfxDockingWindow*>(pWindow)->Initialize( pInfo );
+ static_cast<SfxDockingWindow*>(pWindow.get())->Initialize( pInfo );
SetHideNotDelete( true );
}
@@ -82,7 +82,7 @@ SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl()
// But don't do it, if xFrame already exist. Then dispose() must come from inside ...
// and we need a valid pMgr for further operations ...
- SfxPartDockWnd_Impl* pWin = static_cast<SfxPartDockWnd_Impl*>(pWindow);
+ SfxPartDockWnd_Impl* pWin = static_cast<SfxPartDockWnd_Impl*>(pWindow.get());
if ( pWin && xFrame == pWin->GetBindings().GetActiveFrame() )
pWin->GetBindings().SetActiveFrame( NULL );
@@ -90,7 +90,7 @@ SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl()
bool SfxPartChildWnd_Impl::QueryClose()
{
- return static_cast<SfxPartDockWnd_Impl*>(pWindow)->QueryClose();
+ return static_cast<SfxPartDockWnd_Impl*>(pWindow.get())->QueryClose();
}
@@ -140,12 +140,6 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl
-SfxPartDockWnd_Impl::~SfxPartDockWnd_Impl()
-{
-}
-
-
-
void SfxPartDockWnd_Impl::Resize()
/* [Description]
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index 237f8eb7eb7c..0b6a20278a13 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -71,8 +71,8 @@ IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl)
bConfirmFailed = true;
if ( bConfirmFailed )
{
- MessageDialog aBox(this, SfxResId(STR_ERROR_WRONG_CONFIRM));
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId(STR_ERROR_WRONG_CONFIRM));
+ aBox->Execute();
mpConfirm1ED->SetText( OUString() );
mpConfirm1ED->GrabFocus();
}
@@ -125,7 +125,29 @@ SfxPasswordDialog::SfxPasswordDialog(vcl::Window* pParent, const OUString* pGrou
SetPasswdText();
}
+SfxPasswordDialog::~SfxPasswordDialog()
+{
+ disposeOnce();
+}
+void SfxPasswordDialog::dispose()
+{
+ mpPassword1Box.clear();
+ mpUserFT.clear();
+ mpUserED.clear();
+ mpPassword1FT.clear();
+ mpPassword1ED.clear();
+ mpConfirm1FT.clear();
+ mpConfirm1ED.clear();
+ mpPassword2Box.clear();
+ mpPassword2FT.clear();
+ mpPassword2ED.clear();
+ mpConfirm2FT.clear();
+ mpConfirm2ED.clear();
+ mpMinLengthFT.clear();
+ mpOKBtn.clear();
+ ModalDialog::dispose();
+}
void SfxPasswordDialog::SetPasswdText( )
{
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index 3a3ce1b75720..851509941889 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -87,11 +87,37 @@ SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( vcl::Window* pParent
SfxCommonPrintOptionsTabPage::~SfxCommonPrintOptionsTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SfxCommonPrintOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+void SfxCommonPrintOptionsTabPage::dispose()
{
- return( new SfxCommonPrintOptionsTabPage( pParent, *rAttrSet ) );
+ m_pPrinterOutputRB.clear();
+ m_pPrintFileOutputRB.clear();
+ m_pReduceTransparencyCB.clear();
+ m_pReduceTransparencyAutoRB.clear();
+ m_pReduceTransparencyNoneRB.clear();
+ m_pReduceGradientsCB.clear();
+ m_pReduceGradientsStripesRB.clear();
+ m_pReduceGradientsColorRB.clear();
+ m_pReduceGradientsStepCountNF.clear();
+ m_pReduceBitmapsCB.clear();
+ m_pReduceBitmapsOptimalRB.clear();
+ m_pReduceBitmapsNormalRB.clear();
+ m_pReduceBitmapsResolutionRB.clear();
+ m_pReduceBitmapsResolutionLB.clear();
+ m_pReduceBitmapsTransparencyCB.clear();
+ m_pConvertToGreyscalesCB.clear();
+ m_pPDFCB.clear();
+ m_pPaperSizeCB.clear();
+ m_pPaperOrientationCB.clear();
+ m_pTransparencyCB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SfxCommonPrintOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SfxCommonPrintOptionsTabPage>::Create( pParent, *rAttrSet );
}
vcl::Window* SfxCommonPrintOptionsTabPage::GetParentLabeledBy( const vcl::Window* pWindow ) const
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index d051bb3fa055..742aa883900a 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -131,10 +131,10 @@ SfxRecordingFloatWrapper_Impl::SfxRecordingFloatWrapper_Impl( vcl::Window* pPare
: SfxChildWindow( pParentWnd, nId )
, pBindings( pBind )
{
- pWindow = new SfxRecordingFloat_Impl( pBindings, this, pParentWnd );
+ pWindow = VclPtr<SfxRecordingFloat_Impl>::Create( pBindings, this, pParentWnd );
SetWantsFocus( false );
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- static_cast<SfxFloatingWindow*>(pWindow)->Initialize( pInfo );
+ static_cast<SfxFloatingWindow*>(pWindow.get())->Initialize( pInfo );
}
SfxRecordingFloatWrapper_Impl::~SfxRecordingFloatWrapper_Impl()
@@ -152,9 +152,9 @@ bool SfxRecordingFloatWrapper_Impl::QueryClose()
com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder = pBindings->GetRecorder();
if ( xRecorder.is() && !xRecorder->getRecordedMacro().isEmpty() )
{
- QueryBox aBox( GetWindow(), WB_YES_NO | WB_DEF_NO , SfxResId(STR_MACRO_LOSS).toString() );
- aBox.SetText( SfxResId(STR_CANCEL_RECORDING).toString() );
- bRet = ( aBox.Execute() == RET_YES );
+ ScopedVclPtrInstance< QueryBox > aBox(GetWindow(), WB_YES_NO | WB_DEF_NO , SfxResId(STR_MACRO_LOSS).toString());
+ aBox->SetText( SfxResId(STR_CANCEL_RECORDING).toString() );
+ bRet = ( aBox->Execute() == RET_YES );
}
return bRet;
@@ -200,6 +200,11 @@ SfxRecordingFloat_Impl::SfxRecordingFloat_Impl(
SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl()
{
+ disposeOnce();
+}
+
+void SfxRecordingFloat_Impl::dispose()
+{
try
{
if ( xStopRecTbxCtrl.is() )
@@ -211,6 +216,8 @@ SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl()
catch ( uno::Exception& )
{
}
+ m_pTbx.clear();
+ SfxFloatingWindow::dispose();
}
bool SfxRecordingFloat_Impl::Close()
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index 7fb1d0c4cfb6..e5de1d3c99c5 100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -99,13 +99,13 @@ static bool lcl_GetPassword(
/*out*/OUString &rPassword )
{
bool bRes = false;
- SfxPasswordDialog aPasswdDlg( pParent );
- aPasswdDlg.SetMinLen( 1 );
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(pParent);
+ aPasswdDlg->SetMinLen( 1 );
if (bProtect)
- aPasswdDlg.ShowExtras( SfxShowExtras::CONFIRM );
- if (RET_OK == aPasswdDlg.Execute() && !aPasswdDlg.GetPassword().isEmpty())
+ aPasswdDlg->ShowExtras( SfxShowExtras::CONFIRM );
+ if (RET_OK == aPasswdDlg->Execute() && !aPasswdDlg->GetPassword().isEmpty())
{
- rPassword = aPasswdDlg.GetPassword();
+ rPassword = aPasswdDlg->GetPassword();
bRes = true;
}
return bRes;
@@ -136,10 +136,10 @@ struct SfxSecurityPage_Impl
{
SfxSecurityPage & m_rMyTabPage;
- CheckBox* m_pOpenReadonlyCB;
- CheckBox* m_pRecordChangesCB; // for record changes
- PushButton* m_pProtectPB; // for record changes
- PushButton* m_pUnProtectPB; // for record changes
+ VclPtr<CheckBox> m_pOpenReadonlyCB;
+ VclPtr<CheckBox> m_pRecordChangesCB; // for record changes
+ VclPtr<PushButton> m_pProtectPB; // for record changes
+ VclPtr<PushButton> m_pUnProtectPB; // for record changes
RedliningMode m_eRedlingMode; // for record changes
bool m_bOrigPasswordIsConfirmed;
@@ -335,9 +335,9 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, RecordChangesCBToggleHdl)
bool bAlreadyDone = false;
if (!m_bEndRedliningWarningDone)
{
- WarningBox aBox( m_rMyTabPage.GetParent(), WinBits(WB_YES_NO | WB_DEF_NO),
+ ScopedVclPtrInstance<WarningBox> aBox(m_rMyTabPage.GetParent(), WinBits(WB_YES_NO | WB_DEF_NO),
m_aEndRedliningWarning );
- if (aBox.Execute() != RET_YES)
+ if (aBox->Execute() != RET_YES)
bAlreadyDone = true;
else
m_bEndRedliningWarningDone = true;
@@ -420,9 +420,9 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, ChangeProtectionPBHdl)
}
-SfxTabPage* SfxSecurityPage::Create( vcl::Window * pParent, const SfxItemSet * rItemSet )
+VclPtr<SfxTabPage> SfxSecurityPage::Create( vcl::Window * pParent, const SfxItemSet * rItemSet )
{
- return new SfxSecurityPage( pParent, *rItemSet );
+ return VclPtr<SfxSecurityPage>::Create( pParent, *rItemSet );
}
@@ -433,10 +433,6 @@ SfxSecurityPage::SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& rItemS
}
-SfxSecurityPage::~SfxSecurityPage()
-{
-}
-
bool SfxSecurityPage::FillItemSet( SfxItemSet * rItemSet )
{
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 461feacf5031..a3bcb853134c 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -87,15 +87,16 @@ class SfxEmptySplitWin_Impl : public SplitWindow
*/
friend class SfxSplitWindow;
- SfxSplitWindow* pOwner;
- bool bFadeIn;
- bool bAutoHide;
- bool bSplit;
- bool bEndAutoHide;
- Timer aTimer;
- Point aLastPos;
+ VclPtr<SfxSplitWindow> pOwner;
+ bool bFadeIn;
+ bool bAutoHide;
+ bool bSplit;
+ bool bEndAutoHide;
+ Timer aTimer;
+ Point aLastPos;
sal_uInt16 nState;
+public:
SfxEmptySplitWin_Impl( SfxSplitWindow *pParent )
: SplitWindow( pParent->GetParent(), WinBits( WB_BORDER | WB_3DLOOK ) )
, pOwner( pParent )
@@ -115,8 +116,12 @@ friend class SfxSplitWindow;
}
virtual ~SfxEmptySplitWin_Impl()
+ { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
{
aTimer.Stop();
+ pOwner.clear();
+ SplitWindow::dispose();
}
virtual void MouseMove( const MouseEvent& ) SAL_OVERRIDE;
@@ -232,7 +237,7 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl,
}
SetAlign (eTbxAlign);
- pEmptyWin = new SfxEmptySplitWin_Impl( this );
+ pEmptyWin = VclPtr<SfxEmptySplitWin_Impl>::Create( this );
if ( bPinned )
{
pEmptyWin->bFadeIn = true;
@@ -299,6 +304,11 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl,
SfxSplitWindow::~SfxSplitWindow()
{
+ disposeOnce();
+}
+
+void SfxSplitWindow::dispose()
+{
if ( !pWorkWin->GetParent_Impl() )
SaveConfig_Impl();
@@ -307,10 +317,12 @@ SfxSplitWindow::~SfxSplitWindow()
// Set pOwner to NULL, otherwise try to delete pEmptyWin once more. The
// window that is just being docked is always deleted from the outside.
pEmptyWin->pOwner = NULL;
- delete pEmptyWin;
}
+ pEmptyWin.disposeAndClear();
delete pDockArr;
+ pActive.clear();
+ SplitWindow::dispose();
}
void SfxSplitWindow::SaveConfig_Impl()
diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx
index efc3c78009db..0da322cbbcfb 100644
--- a/sfx2/source/dialog/srchdlg.cxx
+++ b/sfx2/source/dialog/srchdlg.cxx
@@ -62,8 +62,20 @@ SearchDialog::SearchDialog(vcl::Window* pWindow, const OUString& rConfigName)
SearchDialog::~SearchDialog()
{
+ disposeOnce();
+}
+
+void SearchDialog::dispose()
+{
SaveConfig();
m_aCloseHdl.Call( NULL );
+ m_pSearchEdit.clear();
+ m_pWholeWordsBox.clear();
+ m_pMatchCaseBox.clear();
+ m_pWrapAroundBox.clear();
+ m_pBackwardsBox.clear();
+ m_pFindBtn.clear();
+ ModelessDialog::dispose();
}
void SearchDialog::LoadConfig()
diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx
index dc0d5f00d774..1735f1b28371 100644
--- a/sfx2/source/dialog/styledlg.cxx
+++ b/sfx2/source/dialog/styledlg.cxx
@@ -71,6 +71,9 @@ SfxStyleDialog::SfxStyleDialog
SfxStyleDialog::~SfxStyleDialog()
+{
+ disposeOnce();
+}
/* [Description]
@@ -78,9 +81,11 @@ SfxStyleDialog::~SfxStyleDialog()
the Set from Style.
*/
+void SfxStyleDialog::dispose()
{
pExampleSet = 0;
pStyle = 0;
+ SfxTabDialog::dispose();
}
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 9434ab9184ed..af240ce76b44 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -60,7 +60,7 @@ struct Data_Impl
sal_uInt16 nId; // The ID
CreateTabPage fnCreatePage; // Pointer to Factory
GetTabPageRanges fnGetRanges; // Pointer to Ranges-Function
- SfxTabPage* pTabPage; // The TabPage itself
+ VclPtr<SfxTabPage> pTabPage; // The TabPage itself
bool bOnDemand; // Flag: ItemSet onDemand
bool bRefresh; // Flag: Page must be re-initialized
@@ -171,12 +171,14 @@ SfxTabPage::SfxTabPage(vcl::Window *pParent, const OString& rID, const OUString&
}
SfxTabPage::~SfxTabPage()
-/* [Description]
+{
+ disposeOnce();
+}
- Destructor
-*/
+void SfxTabPage::dispose()
{
delete pImpl;
+ TabPage::dispose();
}
bool SfxTabPage::FillItemSet( SfxItemSet* rSet )
@@ -363,6 +365,11 @@ SfxTabDialog::SfxTabDialog
SfxTabDialog::~SfxTabDialog()
{
+ disposeOnce();
+}
+
+void SfxTabDialog::dispose()
+{
SavePosAndId();
for ( SfxTabDlgData_Impl::const_iterator it = pImpl->aData.begin(); it != pImpl->aData.end(); ++it )
@@ -391,7 +398,7 @@ SfxTabDialog::~SfxTabDialog()
if ( pDataObject->bOnDemand )
delete &pDataObject->pTabPage->GetItemSet();
- delete pDataObject->pTabPage;
+ pDataObject->pTabPage.disposeAndClear();
}
delete pDataObject;
}
@@ -403,15 +410,26 @@ SfxTabDialog::~SfxTabDialog()
delete [] pRanges;
if (m_bOwnsBaseFmtBtn)
- delete m_pBaseFmtBtn;
+ m_pBaseFmtBtn.disposeAndClear();
if (m_bOwnsResetBtn)
- delete m_pResetBtn;
+ m_pResetBtn.disposeAndClear();
if (m_bOwnsHelpBtn)
- delete m_pHelpBtn;
+ m_pHelpBtn.disposeAndClear();
if (m_bOwnsCancelBtn)
- delete m_pCancelBtn;
+ m_pCancelBtn.disposeAndClear();
if (m_bOwnsOKBtn)
- delete m_pOKBtn;
+ m_pOKBtn.disposeAndClear();
+ m_pBox.clear();
+ m_pTabCtrl.clear();
+ m_pOKBtn.clear();
+ m_pApplyBtn.clear();
+ m_pUserBtn.clear();
+ m_pCancelBtn.clear();
+ m_pHelpBtn.clear();
+ m_pResetBtn.clear();
+ m_pBaseFmtBtn.clear();
+ m_pActionArea.clear();
+ TabDialog::dispose();
}
void SfxTabDialog::Init_Impl(bool bFmtFlag)
@@ -430,33 +448,33 @@ void SfxTabDialog::Init_Impl(bool bFmtFlag)
assert(m_pActionArea);
m_pOKBtn = m_pUIBuilder->get<PushButton>("ok");
- m_bOwnsOKBtn = m_pOKBtn == NULL;
+ m_bOwnsOKBtn = m_pOKBtn == nullptr;
if (m_bOwnsOKBtn)
- m_pOKBtn = new OKButton(m_pActionArea);
+ m_pOKBtn = VclPtr<OKButton>::Create(m_pActionArea);
m_pApplyBtn = m_pUIBuilder->get<PushButton>("apply");
m_pUserBtn = m_pUIBuilder->get<PushButton>("user");
m_pCancelBtn = m_pUIBuilder->get<CancelButton>("cancel");
- m_bOwnsCancelBtn = m_pCancelBtn == NULL;
+ m_bOwnsCancelBtn = m_pCancelBtn == nullptr;
if (m_bOwnsCancelBtn)
- m_pCancelBtn = new CancelButton(m_pActionArea);
+ m_pCancelBtn = VclPtr<CancelButton>::Create(m_pActionArea);
m_pHelpBtn = m_pUIBuilder->get<HelpButton>("help");
- m_bOwnsHelpBtn = m_pHelpBtn == NULL;
+ m_bOwnsHelpBtn = m_pHelpBtn == nullptr;
if (m_bOwnsHelpBtn)
- m_pHelpBtn = new HelpButton(m_pActionArea);
+ m_pHelpBtn = VclPtr<HelpButton>::Create(m_pActionArea);
m_pResetBtn = m_pUIBuilder->get<PushButton>("reset");
- m_bOwnsResetBtn = m_pResetBtn == NULL;
+ m_bOwnsResetBtn = m_pResetBtn == nullptr;
if (m_bOwnsResetBtn)
- m_pResetBtn = new PushButton(m_pActionArea);
+ m_pResetBtn = VclPtr<PushButton>::Create(m_pActionArea.get());
else
pImpl->bHideResetBtn = !m_pResetBtn->IsVisible();
m_pBaseFmtBtn = m_pUIBuilder->get<PushButton>("standard");
- m_bOwnsBaseFmtBtn = m_pBaseFmtBtn == NULL;
+ m_bOwnsBaseFmtBtn = m_pBaseFmtBtn == nullptr;
if (m_bOwnsBaseFmtBtn)
- m_pBaseFmtBtn = new PushButton(m_pActionArea);
+ m_pBaseFmtBtn = VclPtr<PushButton>::Create(m_pActionArea.get());
m_pOKBtn->SetClickHdl( LINK( this, SfxTabDialog, OkHdl ) );
m_pCancelBtn->SetClickHdl( LINK( this, SfxTabDialog, CancelHdl ) );
@@ -690,7 +708,7 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId )
if ( pDataObject->bOnDemand )
delete &pDataObject->pTabPage->GetItemSet();
- delete pDataObject->pTabPage;
+ pDataObject->pTabPage.disposeAndClear();
}
delete pDataObject;
@@ -1127,7 +1145,7 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
else
pTabPage = (pDataObject->fnCreatePage)
( pTabCtrl, CreateInputItemSet( nId ) );
- DBG_ASSERT( NULL == pDataObject->pTabPage, "create TabPage more than once" );
+ DBG_ASSERT( nullptr == pDataObject->pTabPage, "create TabPage more than once" );
pDataObject->pTabPage = pTabPage;
OUString sConfigId = OStringToOUString(pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8);
@@ -1247,7 +1265,7 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl )
{
Data_Impl* pObj = *it;
- if ( pObj->pTabPage != pPage ) // Do not refresh own Page anymore
+ if ( pObj->pTabPage.get() != pPage ) // Do not refresh own Page anymore
pObj->bRefresh = true;
else
pObj->bRefresh = false;
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index c5273b485fab..a032f1569690 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -202,13 +202,24 @@ namespace sfx2
TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, vcl::Window* i_pParent, WinBits i_nBits )
:TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits )
- ,m_aTaskPane( GetContentWindow(), lcl_getFrame( i_pBindings ) )
- ,m_aPaneController( m_aTaskPane, *this )
+ ,m_aTaskPane( VclPtr<ModuleTaskPane>::Create(GetContentWindow(), lcl_getFrame( i_pBindings )) )
+ ,m_aPaneController( *m_aTaskPane.get(), *this )
{
- m_aTaskPane.Show();
+ m_aTaskPane->Show();
SetText( SfxResId( SID_TASKPANE ).toString() );
}
+ TaskPaneDockingWindow::~TaskPaneDockingWindow()
+ {
+ disposeOnce();
+ }
+
+ void TaskPaneDockingWindow::dispose()
+ {
+ m_aTaskPane.disposeAndClear();
+ TitledDockingWindow::dispose();
+ }
+
void TaskPaneDockingWindow::ActivateToolPanel( const OUString& i_rPanelURL )
{
@@ -219,13 +230,13 @@ namespace sfx2
void TaskPaneDockingWindow::GetFocus()
{
TitledDockingWindow::GetFocus();
- m_aTaskPane.GrabFocus();
+ m_aTaskPane->GrabFocus();
}
void TaskPaneDockingWindow::onLayoutDone()
{
- m_aTaskPane.SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() );
+ m_aTaskPane->SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() );
}
@@ -238,7 +249,7 @@ namespace sfx2
TaskPaneWrapper::TaskPaneWrapper( vcl::Window* i_pParent, sal_uInt16 i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo )
:SfxChildWindow( i_pParent, i_nId )
{
- pWindow = new TaskPaneDockingWindow( i_pBindings, *this, i_pParent,
+ pWindow = VclPtr<TaskPaneDockingWindow>::Create( i_pBindings, *this, i_pParent,
WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
eChildAlignment = SfxChildAlignment::RIGHT;
@@ -507,9 +518,9 @@ namespace sfx2
:m_rAntiImpl( i_rAntiImpl )
,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) )
,m_xFrame( i_rDocumentFrame )
- ,m_aPanelDeck( i_rAntiImpl )
+ ,m_aPanelDeck( new ::svt::ToolPanelDeck(i_rAntiImpl) )
{
- m_aPanelDeck.Show();
+ m_aPanelDeck->Show();
OnResize();
impl_initFromConfiguration();
}
@@ -523,7 +534,7 @@ namespace sfx2
static bool ModuleHasToolPanels( const OUString& i_rModuleIdentifier );
- ::svt::ToolPanelDeck& GetPanelDeck() { return m_aPanelDeck; }
+ ::svt::ToolPanelDeck& GetPanelDeck() { return *m_aPanelDeck.get(); }
::boost::optional< size_t >
GetPanelPos( const OUString& i_rResourceURL );
@@ -540,28 +551,28 @@ namespace sfx2
DECL_LINK( OnActivatePanel, void* );
private:
- ModuleTaskPane& m_rAntiImpl;
- const OUString m_sModuleIdentifier;
- const Reference< XFrame > m_xFrame;
- ::svt::ToolPanelDeck m_aPanelDeck;
+ ModuleTaskPane& m_rAntiImpl;
+ const OUString m_sModuleIdentifier;
+ const Reference< XFrame > m_xFrame;
+ VclPtr<::svt::ToolPanelDeck> m_aPanelDeck;
};
void ModuleTaskPane_Impl::OnResize()
{
- m_aPanelDeck.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() );
+ m_aPanelDeck->SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() );
}
void ModuleTaskPane_Impl::OnGetFocus()
{
- m_aPanelDeck.GrabFocus();
+ m_aPanelDeck->GrabFocus();
}
IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg )
{
- m_aPanelDeck.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) );
+ m_aPanelDeck->ActivatePanel( reinterpret_cast< size_t >( i_pArg ) );
return 1L;
}
@@ -595,8 +606,8 @@ namespace sfx2
::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) );
::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) );
- size_t nPanelPos = m_aPanelDeck.GetPanelCount();
- nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, nPanelPos );
+ size_t nPanelPos = m_aPanelDeck->GetPanelCount();
+ nPanelPos = m_aPanelDeck->InsertPanel( pCustomPanel, nPanelPos );
if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) )
sFirstVisiblePanelResource = *resource;
@@ -637,9 +648,9 @@ namespace sfx2
::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const OUString& i_rResourceURL )
{
::boost::optional< size_t > aPanelPos;
- for ( size_t i = 0; i < m_aPanelDeck.GetPanelCount(); ++i )
+ for ( size_t i = 0; i < m_aPanelDeck->GetPanelCount(); ++i )
{
- const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i ) );
+ const ::svt::PToolPanel pPanel( m_aPanelDeck->GetPanel( i ) );
const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() );
if ( !pCustomPanel )
{
@@ -656,21 +667,20 @@ namespace sfx2
return aPanelPos;
}
-
void ModuleTaskPane_Impl::SetDrawersLayout()
{
- const ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() );
+ const ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() );
const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() );
if ( pDrawerLayouter != NULL )
// already have the proper layout
return;
- m_aPanelDeck.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanelDeck, m_aPanelDeck ) );
+ m_aPanelDeck->SetLayouter( new ::svt::DrawerDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get() ) );
}
void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent )
{
- ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() );
+ ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() );
::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() );
if ( ( pTabLayouter != NULL )
&& ( pTabLayouter->GetTabAlignment() == i_eTabAlignment )
@@ -686,7 +696,7 @@ namespace sfx2
return;
}
- m_aPanelDeck.SetLayouter( new ::svt::TabDeckLayouter( m_aPanelDeck, m_aPanelDeck, i_eTabAlignment, i_eTabContent ) );
+ m_aPanelDeck->SetLayouter( new ::svt::TabDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get(), i_eTabAlignment, i_eTabContent ) );
}
@@ -699,12 +709,11 @@ namespace sfx2
{
}
-
ModuleTaskPane::~ModuleTaskPane()
{
+ disposeOnce();
}
-
bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame )
{
return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) );
diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx
index 1f6f9935aaf8..df195c8efdb2 100644
--- a/sfx2/source/dialog/templateinfodlg.cxx
+++ b/sfx2/source/dialog/templateinfodlg.cxx
@@ -38,7 +38,7 @@ SfxTemplateInfoDlg::SfxTemplateInfoDlg (vcl::Window *pParent)
get(mpBtnClose, "close");
get(mpBox, "box");
get(mpInfoView, "infoDrawingArea");
- mpPreviewView = new vcl::Window(mpBox);
+ mpPreviewView = VclPtr<vcl::Window>::Create(mpBox.get());
Size aSize(LogicToPixel(Size(250, 160), MAP_APPFONT));
mpBox->set_width_request(aSize.Width());
@@ -54,7 +54,17 @@ SfxTemplateInfoDlg::SfxTemplateInfoDlg (vcl::Window *pParent)
SfxTemplateInfoDlg::~SfxTemplateInfoDlg()
{
+ disposeOnce();
+}
+
+void SfxTemplateInfoDlg::dispose()
+{
m_xFrame->dispose();
+ mpBtnClose.clear();
+ mpBox.clear();
+ mpPreviewView.clear();
+ mpInfoView.clear();
+ ModalDialog::dispose();
}
void SfxTemplateInfoDlg::loadDocument(const OUString &rURL)
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 76ab7dbc9fc4..1a922bba75b8 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -355,6 +355,13 @@ SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, vcl::Wi
SfxTemplatePanelControl::~SfxTemplatePanelControl()
{
+ disposeOnce();
+}
+
+void SfxTemplatePanelControl::dispose()
+{
+ pImpl.reset();
+ DockingWindow::dispose();
}
void SfxTemplatePanelControl::DataChanged( const DataChangedEvent& _rDCEvt )
@@ -657,8 +664,8 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl
, xModuleManager(frame::ModuleManager::create(::comphelper::getProcessComponentContext()))
, m_pDeletionWatcher(NULL)
- , aFmtLb(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH)
- , aFilterLb(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
+ , aFmtLb( VclPtr<SfxActionListBox>::Create(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH) )
+ , aFilterLb( VclPtr<ListBox>::Create(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP) )
, nActFamily(0xffff)
, nActFilter(0)
@@ -682,13 +689,13 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl
, m_bWantHierarchical(false)
, bBindingUpdate(true)
{
- aFmtLb.SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString());
- aFmtLb.SetHelpId( HID_TEMPLATE_FMT );
- aFilterLb.SetHelpId( HID_TEMPLATE_FILTER );
- aFmtLb.SetStyle( aFmtLb.GetStyle() | WB_SORT | WB_HIDESELECTION );
- vcl::Font aFont = aFmtLb.GetFont();
+ aFmtLb->SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString());
+ aFmtLb->SetHelpId( HID_TEMPLATE_FMT );
+ aFilterLb->SetHelpId( HID_TEMPLATE_FILTER );
+ aFmtLb->SetStyle( aFmtLb->GetStyle() | WB_SORT | WB_HIDESELECTION );
+ vcl::Font aFont = aFmtLb->GetFont();
aFont.SetWeight( WEIGHT_NORMAL );
- aFmtLb.SetFont( aFont );
+ aFmtLb->SetFont( aFont );
memset(pBoundItems, 0, sizeof(pBoundItems));
memset(pFamilyState, 0, sizeof(pFamilyState));
@@ -850,15 +857,15 @@ void SfxCommonTemplateDialog_Impl::Initialize()
Update_Impl();
- aFilterLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) );
- aFmtLb.SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) );
- aFmtLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) );
- aFmtLb.SetSelectionMode(MULTIPLE_SELECTION);
+ aFilterLb->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) );
+ aFmtLb->SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) );
+ aFmtLb->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) );
+ aFmtLb->SetSelectionMode(MULTIPLE_SELECTION);
- aFilterLb.Show();
+ aFilterLb->Show();
if (!bHierarchical)
- aFmtLb.Show();
+ aFmtLb->Show();
}
SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl()
@@ -876,10 +883,12 @@ SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl()
if ( pStyleSheetPool )
EndListening(*pStyleSheetPool);
pStyleSheetPool = NULL;
- delete pTreeBox;
+ pTreeBox.disposeAndClear();
delete pIdle;
if ( m_pDeletionWatcher )
m_pDeletionWatcher->signal();
+ aFmtLb.disposeAndClear();
+ aFilterLb.disposeAndClear();
}
namespace SfxTemplate
@@ -979,19 +988,19 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr)
bool bSelect = ! rStr.isEmpty();
if ( bSelect )
{
- SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb.FirstVisible();
- while ( pEntry && aFmtLb.GetEntryText( pEntry ) != rStr )
- pEntry = (SvTreeListEntry*)aFmtLb.NextVisible( pEntry );
+ SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb->FirstVisible();
+ while ( pEntry && aFmtLb->GetEntryText( pEntry ) != rStr )
+ pEntry = (SvTreeListEntry*)aFmtLb->NextVisible( pEntry );
if ( !pEntry )
bSelect = false;
else
{
- if (!aFmtLb.IsSelected(pEntry))
+ if (!aFmtLb->IsSelected(pEntry))
{
- aFmtLb.MakeVisible( pEntry );
- aFmtLb.SelectAll(false);
- aFmtLb.Select( pEntry );
- bWaterDisabled = !(pTreeBox || aFmtLb.GetSelectionCount() <= 1);
+ aFmtLb->MakeVisible( pEntry );
+ aFmtLb->SelectAll(false);
+ aFmtLb->Select( pEntry );
+ bWaterDisabled = !(pTreeBox || aFmtLb->GetSelectionCount() <= 1);
FmtSelectHdl( NULL );
}
}
@@ -999,7 +1008,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr)
if ( !bSelect )
{
- aFmtLb.SelectAll( false );
+ aFmtLb->SelectAll( false );
EnableEdit(false);
EnableHide( false );
EnableShow( false );
@@ -1018,9 +1027,9 @@ OUString SfxCommonTemplateDialog_Impl::GetSelectedEntry() const
}
else
{
- SvTreeListEntry* pEntry = aFmtLb.FirstSelected();
+ SvTreeListEntry* pEntry = aFmtLb->FirstSelected();
if ( pEntry )
- aRet = aFmtLb.GetEntryText( pEntry );
+ aRet = aFmtLb->GetEntryText( pEntry );
}
return aRet;
}
@@ -1104,7 +1113,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
bool SfxCommonTemplateDialog_Impl::HasSelectedStyle() const
{
return pTreeBox? pTreeBox->FirstSelected() != 0:
- aFmtLb.GetSelectionCount() != 0;
+ aFmtLb->GetSelectionCount() != 0;
}
// internal: Refresh the display
@@ -1145,24 +1154,24 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
if((nFlags & UPDATE_FAMILY) == UPDATE_FAMILY) // Update view type list (Hierarchical, All, etc.
{
CheckItem(nActFamily, true); // check Button in Toolbox
- aFilterLb.SetUpdateMode(false);
- aFilterLb.Clear();
+ aFilterLb->SetUpdateMode(false);
+ aFilterLb->Clear();
//insert hierarchical at the beginning
- sal_uInt16 nPos = aFilterLb.InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0);
- aFilterLb.SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) );
+ sal_uInt16 nPos = aFilterLb->InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0);
+ aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) );
const SfxStyleFilter& rFilter = pItem->GetFilterList();
for( size_t i = 0; i < rFilter.size(); ++i)
{
sal_uIntPtr nFilterFlags = rFilter[ i ]->nFlags;
- nPos = aFilterLb.InsertEntry( rFilter[ i ]->aName );
- aFilterLb.SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) );
+ nPos = aFilterLb->InsertEntry( rFilter[ i ]->aName );
+ aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) );
}
- if(nActFilter < aFilterLb.GetEntryCount() - 1)
- aFilterLb.SelectEntryPos(nActFilter + 1);
+ if(nActFilter < aFilterLb->GetEntryCount() - 1)
+ aFilterLb->SelectEntryPos(nActFilter + 1);
else
{
nActFilter = 0;
- aFilterLb.SelectEntryPos(1);
+ aFilterLb->SelectEntryPos(1);
SfxFilterTupel* pActT = ( nActFilter < rFilter.size() ) ? rFilter[ nActFilter ] : NULL;
sal_uInt16 nFilterFlags = pActT ? pActT->nFlags : 0;
pStyleSheetPool->SetSearchMask(eFam, nFilterFlags);
@@ -1171,22 +1180,22 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
// if the tree view again, select family hierarchy
if (pTreeBox || m_bWantHierarchical)
{
- aFilterLb.SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString());
+ aFilterLb->SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString());
EnableHierarchical(true);
}
// show maximum 14 entries
- aFilterLb.SetDropDownLineCount( MAX_FILTER_ENTRIES );
- aFilterLb.SetUpdateMode(true);
+ aFilterLb->SetDropDownLineCount( MAX_FILTER_ENTRIES );
+ aFilterLb->SetUpdateMode(true);
}
else
{
- if (nActFilter < aFilterLb.GetEntryCount() - 1)
- aFilterLb.SelectEntryPos(nActFilter + 1);
+ if (nActFilter < aFilterLb->GetEntryCount() - 1)
+ aFilterLb->SelectEntryPos(nActFilter + 1);
else
{
nActFilter = 0;
- aFilterLb.SelectEntryPos(1);
+ aFilterLb->SelectEntryPos(1);
}
}
@@ -1195,7 +1204,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
EnableItem(SID_STYLE_WATERCAN,false);
SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
- SvTreeListEntry* pEntry = aFmtLb.First();
+ SvTreeListEntry* pEntry = aFmtLb->First();
std::vector<OUString> aStrings;
comphelper::string::NaturalStringSorter aSorter(
@@ -1215,27 +1224,27 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
size_t nCount = aStrings.size();
size_t nPos = 0;
while(nPos < nCount && pEntry &&
- aStrings[nPos] == aFmtLb.GetEntryText(pEntry))
+ aStrings[nPos] == aFmtLb->GetEntryText(pEntry))
{
++nPos;
- pEntry = aFmtLb.Next( pEntry );
+ pEntry = aFmtLb->Next( pEntry );
}
if( nPos < nCount || pEntry )
{
// Fills the display box
- aFmtLb.SetUpdateMode(false);
- aFmtLb.Clear();
+ aFmtLb->SetUpdateMode(false);
+ aFmtLb->Clear();
for(nPos = 0; nPos < nCount; ++nPos)
{
- SvTreeListEntry* pTreeListEntry = aFmtLb.InsertEntry(aStrings[nPos], 0, false, nPos);
+ SvTreeListEntry* pTreeListEntry = aFmtLb->InsertEntry(aStrings[nPos], 0, false, nPos);
StyleLBoxString* pStyleLBoxString = new StyleLBoxString(pTreeListEntry, 0, aStrings[nPos], eFam);
pTreeListEntry->ReplaceItem(pStyleLBoxString, 1);
- aFmtLb.GetModel()->InvalidateEntry(pTreeListEntry);
+ aFmtLb->GetModel()->InvalidateEntry(pTreeListEntry);
}
- aFmtLb.Recalc();
- aFmtLb.SetUpdateMode(true);
+ aFmtLb->Recalc();
+ aFmtLb->SetUpdateMode(true);
}
// Selects the current style if any
SfxTemplateItem *pState = pFamilyState[nActFamily-1];
@@ -1262,7 +1271,7 @@ void SfxCommonTemplateDialog_Impl::SetWaterCanState(const SfxBoolItem *pItem)
if(!bWaterDisabled)
//make sure the watercan is only activated when there is (only) one selection
- bWaterDisabled = !(pTreeBox || aFmtLb.GetSelectionCount() <= 1);
+ bWaterDisabled = pTreeBox || aFmtLb->GetSelectionCount() <= 1;
if(pItem && !bWaterDisabled)
{
@@ -1597,7 +1606,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl(
if ( !pItem || aDeleted )
return false;
- if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) )
+ if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) )
{
const SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem);
OSL_ENSURE(pFilterItem, "SfxUINT16Item expected");
@@ -1631,15 +1640,16 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
m_bWantHierarchical = true;
SaveSelection(); // fdo#61429 store "hierarchical"
const OUString aSelectEntry( GetSelectedEntry());
- aFmtLb.Hide();
+ aFmtLb->Hide();
+
+ pTreeBox = VclPtr<StyleTreeListBox_Impl>::Create(
- pTreeBox = new StyleTreeListBox_Impl(
this, WB_HASBUTTONS | WB_HASLINES |
WB_BORDER | WB_TABSTOP | WB_HASLINESATROOT |
WB_HASBUTTONSATROOT | WB_HIDESELECTION | WB_QUICK_SEARCH );
- pTreeBox->SetFont( aFmtLb.GetFont() );
+ pTreeBox->SetFont( aFmtLb->GetFont() );
- pTreeBox->SetPosSizePixel(aFmtLb.GetPosPixel(), aFmtLb.GetSizePixel());
+ pTreeBox->SetPosSizePixel(aFmtLb->GetPosPixel(), aFmtLb->GetSizePixel());
pTreeBox->SetNodeDefaultImages();
pTreeBox->SetSelectHdl(
LINK(this, SfxCommonTemplateDialog_Impl, FmtSelectHdl));
@@ -1655,12 +1665,12 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
}
else
{
- DELETEZ(pTreeBox);
- aFmtLb.Show();
+ pTreeBox.disposeAndClear();
+ aFmtLb->Show();
// If bHierarchical, then the family can have changed
// minus one since hierarchical is inserted at the start
m_bWantHierarchical = false; // before FilterSelect
- FilterSelect(aFilterLb.GetSelectEntryPos() - 1, bHierarchical );
+ FilterSelect(aFilterLb->GetSelectEntryPos() - 1, bHierarchical );
bHierarchical=false;
}
}
@@ -1742,8 +1752,8 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry)
nFilter=pStyleSheetPool->GetSearchMask();
pStyleSheetPool->SetSearchMask( eFam, SFXSTYLEBIT_USERDEF );
- std::unique_ptr<SfxNewStyleDlg> pDlg(new SfxNewStyleDlg(pWindow, *pStyleSheetPool));
- // why? : FloatingWindow must not be parent of a modal dialog
+ ScopedVclPtrInstance< SfxNewStyleDlg > pDlg(pWindow, *pStyleSheetPool);
+ // why? : FloatingWindow must not be parent of a modal dialog
if(RET_OK == pDlg->Execute())
{
pStyleSheetPool->SetSearchMask(eFam, nFilter);
@@ -1847,7 +1857,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, DropHdl, StyleTreeListBox_Impl *, pBox
void SfxCommonTemplateDialog_Impl::NewHdl(void *)
{
OUString aEmpty;
- if ( nActFamily != 0xffff && (pTreeBox || aFmtLb.GetSelectionCount() <= 1))
+ if ( nActFamily != 0xffff && (pTreeBox || aFmtLb->GetSelectionCount() <= 1))
{
vcl::Window* pTmp;
pTmp = Application::GetDefDialogParent();
@@ -1910,7 +1920,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
bool bUsedStyle = false; // one of the selected styles are used in the document?
std::vector<SvTreeListEntry*> aList;
- SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
+ SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();
const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl();
OUString aMsg = SfxResId(STR_DELETE_STYLE_USED).toString();
@@ -1920,7 +1930,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
{
aList.push_back( pEntry );
// check the style is used or not
- const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry));
+ const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry));
SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL );
@@ -1932,7 +1942,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
bUsedStyle = true;
}
- pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
+ pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
}
bool aApproved = false;
@@ -1941,13 +1951,13 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
if ( bUsedStyle )
{
#if defined UNX
- MessageDialog aBox(SfxGetpApp()->GetTopWindow(), aMsg,
+ ScopedVclPtrInstance<MessageDialog> aBox(SfxGetpApp()->GetTopWindow(), aMsg,
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
#else
- MessageDialog aBox(GetWindow(), aMsg,
+ ScopedVclPtrInstance<MessageDialog> aBox(GetWindow(), aMsg,
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
#endif
- aApproved = aBox.Execute() == RET_YES;
+ aApproved = aBox->Execute() == RET_YES;
}
// if there are no used styles selected or the user approved the changes
@@ -1957,7 +1967,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
for (; it != itEnd; ++it)
{
- const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb.GetEntryText(*it));
+ const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb->GetEntryText(*it));
bDontUpdate = true; // To prevent the Treelistbox to shut down while deleting
Execute_Impl( SID_STYLE_DELETE, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
@@ -1978,16 +1988,16 @@ void SfxCommonTemplateDialog_Impl::HideHdl(void *)
{
if ( IsInitialized() && HasSelectedStyle() )
{
- SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
+ SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();
while (pEntry)
{
- OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry);
+ OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry);
Execute_Impl( SID_STYLE_HIDE, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
- pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
+ pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
}
}
}
@@ -1997,16 +2007,16 @@ void SfxCommonTemplateDialog_Impl::ShowHdl(void *)
if ( IsInitialized() && HasSelectedStyle() )
{
- SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
+ SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();
while (pEntry)
{
- OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry);
+ OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry);
Execute_Impl( SID_STYLE_SHOW, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
- pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
+ pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
}
}
}
@@ -2064,7 +2074,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, ApplyHdl, Control *, pControl )
if ( IsInitialized() && 0 != pFamilyState[nActFamily-1] &&
!GetSelectedEntry().isEmpty() )
{
- sal_uInt16 nModifier = aFmtLb.GetModifier();
+ sal_uInt16 nModifier = aFmtLb->GetModifier();
Execute_Impl(SID_STYLE_APPLY,
GetSelectedEntry(), OUString(),
( sal_uInt16 )GetFamilyItem_Impl()->GetFamily(),
@@ -2084,7 +2094,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox
if ( IsInitialized() &&
IsCheckedItem(SID_STYLE_WATERCAN) &&
// only if that region is allowed
- 0 != pFamilyState[nActFamily-1] && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) )
+ 0 != pFamilyState[nActFamily-1] && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) )
{
OUString aEmpty;
Execute_Impl(SID_STYLE_WATERCAN,
@@ -2100,7 +2110,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox
{
SelectStyle( pListBox->GetEntryText( pListBox->GetHdlEntry() ));
#if defined STYLESPREVIEW
- sal_uInt16 nModifier = aFmtLb.GetModifier();
+ sal_uInt16 nModifier = aFmtLb->GetModifier();
if ( mbIgnoreSelect )
{
Execute_Impl(SID_STYLE_END_PREVIEW,
@@ -2155,10 +2165,10 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab
{
if( nId == SID_STYLE_NEW_BY_EXAMPLE )
{
- bNewByExampleDisabled = !(pTreeBox || aFmtLb.GetSelectionCount() <= 1) || !bEnable;
+ bNewByExampleDisabled = !(pTreeBox || aFmtLb->GetSelectionCount() <= 1) || !bEnable;
}
else if( nId == SID_STYLE_UPDATE_BY_EXAMPLE )
- bUpdateByExampleDisabled = !(pTreeBox || aFmtLb.GetSelectionCount() <= 1) || !bEnable;
+ bUpdateByExampleDisabled = !(pTreeBox || aFmtLb->GetSelectionCount() <= 1) || !bEnable;
EnableItem(nId, bEnable);
}
@@ -2186,8 +2196,8 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanel
: SfxCommonTemplateDialog_Impl(pB, pDlgWindow, true)
, m_pFloat(pDlgWindow)
, m_bZoomIn(false)
- , m_aActionTbL(pDlgWindow, this)
- , m_aActionTbR(pDlgWindow, SfxResId(TB_ACTION))
+ , m_aActionTbL(VclPtrInstance<DropToolBox_Impl>(pDlgWindow, this))
+ , m_aActionTbR(VclPtrInstance<ToolBox> (pDlgWindow, SfxResId(TB_ACTION)))
{
pDlgWindow->FreeResource();
Initialize();
@@ -2197,20 +2207,20 @@ void SfxTemplateDialog_Impl::Initialize()
{
SfxCommonTemplateDialog_Impl::Initialize();
- m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
- m_aActionTbR.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect));
- m_aActionTbR.SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick));
- m_aActionTbL.Show();
- m_aActionTbR.Show();
- vcl::Font aFont = aFilterLb.GetFont();
- aFont.SetWeight(WEIGHT_NORMAL);
- aFilterLb.SetFont(aFont);
- m_aActionTbL.SetHelpId(HID_TEMPLDLG_TOOLBOX_LEFT);
+ m_aActionTbL->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
+ m_aActionTbR->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect));
+ m_aActionTbR->SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick));
+ m_aActionTbL->Show();
+ m_aActionTbR->Show();
+ vcl::Font aFont = aFilterLb->GetFont();
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aFilterLb->SetFont( aFont );
+ m_aActionTbL->SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT );
}
void SfxTemplateDialog_Impl::EnableFamilyItem( sal_uInt16 nId, bool bEnable )
{
- m_aActionTbL.EnableItem( nId, bEnable );
+ m_aActionTbL->EnableItem( nId, bEnable );
}
// Insert element into dropdown filter "Frame Styles", "List Styles", etc.
@@ -2226,15 +2236,15 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId,const SfxStyleFamil
case SFX_STYLE_FAMILY_PSEUDO: sHelpId = ".uno:ListStyle"; break;
default: OSL_FAIL("unknown StyleFamily"); break;
}
- m_aActionTbL.InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0);
- m_aActionTbL.SetHelpId( nId, sHelpId );
+ m_aActionTbL->InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0);
+ m_aActionTbL->SetHelpId( nId, sHelpId );
}
void SfxTemplateDialog_Impl::ReplaceUpdateButtonByMenu()
{
- m_aActionTbR.HideItem(SID_STYLE_UPDATE_BY_EXAMPLE);
- m_aActionTbR.SetItemBits(SID_STYLE_NEW_BY_EXAMPLE,
- ToolBoxItemBits::DROPDOWNONLY | m_aActionTbR.GetItemBits( SID_STYLE_NEW_BY_EXAMPLE ));
+ m_aActionTbR->HideItem(SID_STYLE_UPDATE_BY_EXAMPLE);
+ m_aActionTbR->SetItemBits( SID_STYLE_NEW_BY_EXAMPLE,
+ ToolBoxItemBits::DROPDOWNONLY|m_aActionTbR->GetItemBits( SID_STYLE_NEW_BY_EXAMPLE ));
}
void SfxTemplateDialog_Impl::updateFamilyImages()
@@ -2252,18 +2262,18 @@ void SfxTemplateDialog_Impl::updateFamilyImages()
{
const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nLoop );
sal_uInt16 nId = SfxTemplate::SfxFamilyIdToNId( pItem->GetFamily() );
- m_aActionTbL.SetItemImage( nId, pItem->GetImage() );
+ m_aActionTbL->SetItemImage( nId, pItem->GetImage() );
}
}
void SfxTemplateDialog_Impl::updateNonFamilyImages()
{
- m_aActionTbR.SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) );
+ m_aActionTbR->SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) );
}
void SfxTemplateDialog_Impl::ClearFamilyList()
{
- m_aActionTbL.Clear();
+ m_aActionTbL->Clear();
}
void SfxCommonTemplateDialog_Impl::InvalidateBindings()
@@ -2282,6 +2292,9 @@ void SfxCommonTemplateDialog_Impl::InvalidateBindings()
SfxTemplateDialog_Impl::~SfxTemplateDialog_Impl()
{
+ m_pFloat.clear();
+ m_aActionTbL.disposeAndClear();
+ m_aActionTbR.disposeAndClear();
}
void SfxTemplateDialog_Impl::LoadedFamilies()
@@ -2294,7 +2307,7 @@ void SfxTemplateDialog_Impl::LoadedFamilies()
// The size of the Listboxen is adjusted
void SfxTemplateDialog_Impl::Resize()
{
- SfxDockingWindow* pDockingWindow = dynamic_cast<SfxDockingWindow*>(m_pFloat);
+ SfxDockingWindow* pDockingWindow = dynamic_cast<SfxDockingWindow*>(m_pFloat.get());
FloatingWindow *pF = pDockingWindow!=NULL ? pDockingWindow->GetFloatingWindow() : NULL;
if (pF)
{
@@ -2303,30 +2316,30 @@ void SfxTemplateDialog_Impl::Resize()
return;
}
- if (m_pFloat == NULL)
+ if (m_pFloat == nullptr)
return;
Size aDlgSize=m_pFloat->PixelToLogic(m_pFloat->GetOutputSizePixel());
- Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
- Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
+ Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL->CalcWindowSizePixel());
+ Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR->CalcWindowSizePixel());
Size aMinSize = GetMinOutputSizePixel();
- long nListHeight = m_pFloat->PixelToLogic( aFilterLb.GetSizePixel() ).Height();
+ long nListHeight = m_pFloat->PixelToLogic( aFilterLb->GetSizePixel() ).Height();
long nWidth = aDlgSize.Width()- 2 * SFX_TEMPLDLG_HFRAME;
- m_aActionTbL.SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)),
+ m_aActionTbL->SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)),
m_pFloat->LogicToPixel(aSizeATL));
// only change the position of the right toolbox, when the window is wide
// enough
Point aPosATR(aDlgSize.Width()-SFX_TEMPLDLG_HFRAME-aSizeATR.Width(),SFX_TEMPLDLG_VTOPFRAME);
if(aDlgSize.Width() >= aMinSize.Width())
- m_aActionTbR.SetPosPixel(m_pFloat->LogicToPixel(aPosATR));
+ m_aActionTbR->SetPosPixel(m_pFloat->LogicToPixel(aPosATR));
else
- m_aActionTbR.SetPosPixel( m_pFloat->LogicToPixel(
+ m_aActionTbR->SetPosPixel( m_pFloat->LogicToPixel(
Point( SFX_TEMPLDLG_HFRAME + aSizeATL.Width() + SFX_TEMPLDLG_MIDHSPACE,
SFX_TEMPLDLG_VTOPFRAME ) ) );
- m_aActionTbR.SetSizePixel(m_pFloat->LogicToPixel(aSizeATR));
+ m_aActionTbR->SetSizePixel(m_pFloat->LogicToPixel(aSizeATR));
Point aFilterPos(
m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,
@@ -2347,26 +2360,26 @@ void SfxTemplateDialog_Impl::Resize()
// only change the position of the listbox, when the window is high enough
if(aDlgSize.Height() >= aMinSize.Height())
{
- aFilterLb.SetPosPixel(aFilterPos);
- aFmtLb.SetPosPixel( aFmtPos );
+ aFilterLb->SetPosPixel(aFilterPos);
+ aFmtLb->SetPosPixel( aFmtPos );
if(pTreeBox)
pTreeBox->SetPosPixel(aFmtPos);
}
else
aFmtSize.Height() += aFilterSize.Height();
- aFilterLb.SetSizePixel(aFilterSize);
- aFmtLb.SetSizePixel( aFmtSize );
+ aFilterLb->SetSizePixel(aFilterSize);
+ aFmtLb->SetSizePixel( aFmtSize );
if(pTreeBox)
pTreeBox->SetSizePixel(aFmtSize);
}
Size SfxTemplateDialog_Impl::GetMinOutputSizePixel()
{
- if (m_pFloat != NULL)
+ if (m_pFloat != nullptr)
{
- Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
- Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
+ Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL->CalcWindowSizePixel());
+ Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR->CalcWindowSizePixel());
Size aMinSize=Size(
aSizeATL.Width()+aSizeATR.Width()+
2*SFX_TEMPLDLG_HFRAME + SFX_TEMPLDLG_MIDHSPACE,
@@ -2388,7 +2401,7 @@ void SfxTemplateDialog_Impl::EnableItem(sal_uInt16 nMesId, bool bCheck)
//fall-through
case SID_STYLE_NEW_BY_EXAMPLE:
case SID_STYLE_UPDATE_BY_EXAMPLE:
- m_aActionTbR.EnableItem(nMesId,bCheck);
+ m_aActionTbR->EnableItem(nMesId,bCheck);
break;
}
}
@@ -2399,10 +2412,10 @@ void SfxTemplateDialog_Impl::CheckItem(sal_uInt16 nMesId, bool bCheck)
{
case SID_STYLE_WATERCAN :
bIsWater=bCheck;
- m_aActionTbR.CheckItem(SID_STYLE_WATERCAN,bCheck);
+ m_aActionTbR->CheckItem(SID_STYLE_WATERCAN,bCheck);
break;
default:
- m_aActionTbL.CheckItem(nMesId,bCheck); break;
+ m_aActionTbL->CheckItem(nMesId,bCheck); break;
}
}
@@ -2411,9 +2424,9 @@ bool SfxTemplateDialog_Impl::IsCheckedItem(sal_uInt16 nMesId)
switch(nMesId)
{
case SID_STYLE_WATERCAN :
- return m_aActionTbR.GetItemState(SID_STYLE_WATERCAN)==TRISTATE_TRUE;
+ return m_aActionTbR->GetItemState(SID_STYLE_WATERCAN)==TRISTATE_TRUE;
default:
- return m_aActionTbL.GetItemState(nMesId)==TRISTATE_TRUE;
+ return m_aActionTbL->GetItemState(nMesId)==TRISTATE_TRUE;
}
}
@@ -2542,7 +2555,7 @@ void SfxCommonTemplateDialog_Impl::UpdateFamily_Impl()
}
bWaterDisabled = false;
- bCanNew = pTreeBox || aFmtLb.GetSelectionCount() <= 1;
+ bCanNew = pTreeBox || aFmtLb->GetSelectionCount() <= 1;
bTreeDrag = true;
bUpdateByExampleDisabled = false;
@@ -2582,10 +2595,6 @@ DropToolBox_Impl::DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl*
{
}
-DropToolBox_Impl::~DropToolBox_Impl()
-{
-}
-
sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
{
sal_Int8 nReturn = DND_ACTION_NONE;
@@ -2608,7 +2617,7 @@ sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
sal_Int8 DropToolBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
- return rParent.aFmtLb.ExecuteDrop(rEvt);
+ return rParent.aFmtLb->ExecuteDrop(rEvt);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx
index 66aa91b1f218..6b3c98945139 100644
--- a/sfx2/source/dialog/titledockwin.cxx
+++ b/sfx2/source/dialog/titledockwin.cxx
@@ -35,8 +35,8 @@ namespace sfx2
WinBits i_nStyle )
:SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle )
,m_sTitle()
- ,m_aToolbox( this )
- ,m_aContentWindow( this, WB_DIALOGCONTROL )
+ ,m_aToolbox( VclPtr<ToolBox>::Create(this) )
+ ,m_aContentWindow( VclPtr<vcl::Window>::Create(this, WB_DIALOGCONTROL) )
,m_aBorder( 3, 1, 3, 3 )
,m_bLayoutPending( false )
,m_nTitleBarHeight(0)
@@ -48,19 +48,26 @@ namespace sfx2
{
SetBackground( Wallpaper() );
- m_aToolbox.SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) );
- m_aToolbox.SetOutStyle( TOOLBOX_STYLE_FLAT );
- m_aToolbox.SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) );
- m_aToolbox.Show();
+ m_aToolbox->SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) );
+ m_aToolbox->SetOutStyle( TOOLBOX_STYLE_FLAT );
+ m_aToolbox->SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) );
+ m_aToolbox->Show();
impl_resetToolBox();
- m_aContentWindow.Show();
+ m_aContentWindow->Show();
}
TitledDockingWindow::~TitledDockingWindow()
{
+ disposeOnce();
}
+ void TitledDockingWindow::dispose()
+ {
+ m_aToolbox.disposeAndClear();
+ m_aContentWindow.disposeAndClear();
+ SfxDockingWindow::dispose();
+ }
void TitledDockingWindow::SetTitle( const OUString& i_rTitle )
{
@@ -101,16 +108,16 @@ namespace sfx2
{
m_bLayoutPending = false;
- m_aToolbox.ShowItem( 1, !IsFloatingMode() );
+ m_aToolbox->ShowItem( 1, !IsFloatingMode() );
- const Size aToolBoxSize( m_aToolbox.CalcWindowSizePixel() );
+ const Size aToolBoxSize( m_aToolbox->CalcWindowSizePixel() );
Size aWindowSize( GetOutputSizePixel() );
// position the tool box
m_nTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight();
if ( aToolBoxSize.Height() > m_nTitleBarHeight )
m_nTitleBarHeight = aToolBoxSize.Height();
- m_aToolbox.SetPosSizePixel(
+ m_aToolbox->SetPosSizePixel(
Point(
aWindowSize.Width() - aToolBoxSize.Width(),
( m_nTitleBarHeight - aToolBoxSize.Height() ) / 2
@@ -122,7 +129,7 @@ namespace sfx2
if ( m_nTitleBarHeight < aToolBoxSize.Height() )
m_nTitleBarHeight = aToolBoxSize.Height();
aWindowSize.Height() -= m_nTitleBarHeight;
- m_aContentWindow.SetPosSizePixel(
+ m_aContentWindow->SetPosSizePixel(
Point( m_aBorder.Left(), m_nTitleBarHeight + m_aBorder.Top() ),
Size(
aWindowSize.Width() - m_aBorder.Left() - m_aBorder.Right(),
@@ -209,24 +216,24 @@ namespace sfx2
void TitledDockingWindow::impl_resetToolBox()
{
- m_aToolbox.Clear();
+ m_aToolbox->Clear();
// Get the closer bitmap and set it as right most button.
Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) );
- m_aToolbox.InsertItem( 1, aImage );
- m_aToolbox.ShowItem( 1 );
+ m_aToolbox->InsertItem( 1, aImage );
+ m_aToolbox->ShowItem( 1 );
}
sal_uInt16 TitledDockingWindow::impl_addDropDownToolBoxItem( const OUString& i_rItemText, const OString& i_nHelpId, const Link& i_rCallback )
{
// Add the menu before the closer button.
- const sal_uInt16 nItemCount( m_aToolbox.GetItemCount() );
+ const sal_uInt16 nItemCount( m_aToolbox->GetItemCount() );
const sal_uInt16 nItemId( nItemCount + 1 );
- m_aToolbox.InsertItem( nItemId, i_rItemText, ToolBoxItemBits::DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND );
- m_aToolbox.SetHelpId( nItemId, i_nHelpId );
- m_aToolbox.SetClickHdl( i_rCallback );
- m_aToolbox.SetDropdownClickHdl( i_rCallback );
+ m_aToolbox->InsertItem( nItemId, i_rItemText, ToolBoxItemBits::DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND );
+ m_aToolbox->SetHelpId( nItemId, i_nHelpId );
+ m_aToolbox->SetClickHdl( i_rCallback );
+ m_aToolbox->SetDropdownClickHdl( i_rCallback );
// The tool box has likely changed its size. The title bar has to be
// resized.
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index 8da102ca1355..687a6cdd298e 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -213,7 +213,7 @@ SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, bool bIsSaveVersion
pContainer->set_width_request(aControlSize.Width());
pContainer->set_height_request(aControlSize.Height());
- m_pVersionBox = new SfxVersionsTabListBox_Impl(*pContainer, WB_TABSTOP);
+ m_pVersionBox = VclPtr<SfxVersionsTabListBox_Impl>::Create(*pContainer, WB_TABSTOP);
Link aClickLink = LINK( this, SfxVersionDialog, ButtonHdl_Impl );
m_pViewButton->SetClickHdl ( aClickLink );
@@ -329,8 +329,21 @@ void SfxVersionDialog::Init_Impl()
SfxVersionDialog::~SfxVersionDialog()
{
+ disposeOnce();
+}
+
+void SfxVersionDialog::dispose()
+{
delete m_pTable;
- delete m_pVersionBox;
+ m_pVersionBox.disposeAndClear();
+ m_pSaveButton.clear();
+ m_pSaveCheckBox.clear();
+ m_pOpenButton.clear();
+ m_pViewButton.clear();
+ m_pDeleteButton.clear();
+ m_pCompareButton.clear();
+ m_pCmisButton.clear();
+ SfxModalDialog::dispose();
}
void SfxVersionDialog::Open_Impl()
@@ -394,7 +407,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
{
SfxVersionInfo aInfo;
aInfo.aAuthor = SvtUserOptions().GetFullName();
- boost::scoped_ptr<SfxViewVersionDialog_Impl> pDlg(new SfxViewVersionDialog_Impl(this, aInfo, true));
+ VclPtrInstance< SfxViewVersionDialog_Impl > pDlg(this, aInfo, true);
short nRet = pDlg->Execute();
if ( nRet == RET_OK )
{
@@ -426,7 +439,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
else if (pButton == m_pViewButton && pEntry)
{
SfxVersionInfo* pInfo = static_cast<SfxVersionInfo*>(pEntry->GetUserData());
- boost::scoped_ptr<SfxViewVersionDialog_Impl> pDlg(new SfxViewVersionDialog_Impl(this, *pInfo, false));
+ VclPtrInstance<SfxViewVersionDialog_Impl> pDlg(this, *pInfo, false);
pDlg->Execute();
}
else if (pEntry && pButton == m_pCompareButton)
@@ -449,7 +462,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
}
else if (pButton == m_pCmisButton)
{
- boost::scoped_ptr<SfxCmisVersionsDialog> pDlg(new SfxCmisVersionsDialog(pViewFrame, false));
+ VclPtrInstance< SfxCmisVersionsDialog > pDlg(pViewFrame, false);
pDlg->Execute();
}
@@ -493,6 +506,22 @@ SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl(vcl::Window *pParent, SfxVe
}
}
+SfxViewVersionDialog_Impl::~SfxViewVersionDialog_Impl()
+{
+ disposeOnce();
+}
+
+void SfxViewVersionDialog_Impl::dispose()
+{
+ m_pDateTimeText.clear();
+ m_pSavedByText.clear();
+ m_pEdit.clear();
+ m_pOKButton.clear();
+ m_pCancelButton.clear();
+ m_pCloseButton.clear();
+ SfxModalDialog::dispose();
+}
+
IMPL_LINK(SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton)
{
assert(pButton == m_pOKButton);
@@ -519,7 +548,7 @@ SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, bool bIsS
pContainer->set_width_request(aControlSize.Width());
pContainer->set_height_request(aControlSize.Height());
- m_pVersionBox = new SfxVersionsTabListBox_Impl(*pContainer, WB_TABSTOP);
+ m_pVersionBox = VclPtr<SfxVersionsTabListBox_Impl>::Create(*pContainer, WB_TABSTOP);
m_pVersionBox->GrabFocus();
m_pVersionBox->SetStyle( m_pVersionBox->GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN );
@@ -557,8 +586,18 @@ SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, bool bIsS
SfxCmisVersionsDialog::~SfxCmisVersionsDialog()
{
+ disposeOnce();
+}
+
+void SfxCmisVersionsDialog::dispose()
+{
delete m_pTable;
- delete m_pVersionBox;
+ m_pVersionBox.disposeAndClear();
+ m_pOpenButton.clear();
+ m_pViewButton.clear();
+ m_pDeleteButton.clear();
+ m_pCompareButton.clear();
+ SfxModalDialog::dispose();
}
void SfxCmisVersionsDialog::LoadVersions()
diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx
index 63d458f1c955..a6f5ec97b73f 100644
--- a/sfx2/source/doc/QuerySaveDocument.cxx
+++ b/sfx2/source/doc/QuerySaveDocument.cxx
@@ -29,9 +29,9 @@ short ExecuteQuerySaveDocument(vcl::Window* _pParent, const OUString& _rTitle)
return RET_NO;
}
- MessageDialog aQBox(_pParent, "QuerySaveDialog", "sfx/ui/querysavedialog.ui");
- aQBox.set_primary_text(aQBox.get_primary_text().replaceFirst("$(DOC)", _rTitle));
- return aQBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aQBox(_pParent, "QuerySaveDialog", "sfx/ui/querysavedialog.ui");
+ aQBox->set_primary_text(aQBox->get_primary_text().replaceFirst("$(DOC)", _rTitle));
+ return aQBox->Execute();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx
index d114453f1ce3..bd3ba50f01e3 100644
--- a/sfx2/source/doc/docinsert.cxx
+++ b/sfx2/source/doc/docinsert.cxx
@@ -190,12 +190,12 @@ IMPL_LINK_NOARG(DocumentInserter, DialogClosedHdl)
if ( ( aValue >>= bPassWord ) && bPassWord )
{
// ask for the password
- SfxPasswordDialog aPasswordDlg( NULL );
- aPasswordDlg.ShowExtras( SfxShowExtras::CONFIRM );
- short nRet = aPasswordDlg.Execute();
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswordDlg(nullptr);
+ aPasswordDlg->ShowExtras( SfxShowExtras::CONFIRM );
+ short nRet = aPasswordDlg->Execute();
if ( RET_OK == nRet )
{
- OUString aPasswd = aPasswordDlg.GetPassword();
+ OUString aPasswd = aPasswordDlg->GetPassword();
m_pItemSet->Put( SfxStringItem( SID_PASSWORD, aPasswd ) );
}
else
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index b33e4f865f4d..a4d4ef71da69 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -138,7 +138,8 @@ class WaitWindow_Impl : public WorkWindow
public:
WaitWindow_Impl();
- virtual ~WaitWindow_Impl();
+ virtual ~WaitWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
};
@@ -470,8 +471,7 @@ void SfxDocTplService_Impl::init_Impl()
aGuard.clear();
SolarMutexClearableGuard aSolarGuard;
- WaitWindow_Impl* pWin = new WaitWindow_Impl();
-
+ VclPtrInstance< WaitWindow_Impl > pWin;
aSolarGuard.clear();
::osl::ClearableMutexGuard anotherGuard( maMutex );
@@ -480,7 +480,7 @@ void SfxDocTplService_Impl::init_Impl()
anotherGuard.clear();
SolarMutexGuard aSecondSolarGuard;
- delete pWin;
+ pWin.disposeAndClear();
}
else if ( needsUpdate() )
// the UI should be shown only on the first update
@@ -2449,7 +2449,13 @@ WaitWindow_Impl::WaitWindow_Impl()
WaitWindow_Impl::~WaitWindow_Impl()
{
+ disposeOnce();
+}
+
+void WaitWindow_Impl::dispose()
+{
Hide();
+ WorkWindow::dispose();
}
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 9610a8bd222b..a3aef2d2a21a 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -667,9 +667,9 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
{
// notify the user that SaveAs is going to be done
vcl::Window* pWin = SfxStoringHelper::GetModelWindow( m_xModel );
- MessageDialog aMessageBox(pWin, SfxResId(STR_NEW_FILENAME_SAVE),
+ ScopedVclPtrInstance<MessageDialog> aMessageBox(pWin, SfxResId(STR_NEW_FILENAME_SAVE),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL);
- if ( aMessageBox.Execute() == RET_OK )
+ if ( aMessageBox->Execute() == RET_OK )
nResult = STATUS_SAVEAS;
else
nResult = STATUS_NO_ACTION;
@@ -1882,9 +1882,9 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod
return true;
vcl::Window* pWin = SfxStoringHelper::GetModelWindow( xModel );
- SfxAlienWarningDialog aDlg( pWin, aOldUIName, aDefExtension, bDefIsAlien );
+ ScopedVclPtrInstance< SfxAlienWarningDialog > aDlg( pWin, aOldUIName, aDefExtension, bDefIsAlien );
- return aDlg.Execute() == RET_OK;
+ return aDlg->Execute() == RET_OK;
}
vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel )
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index a3dc009a9e38..0564141cb174 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -174,7 +174,7 @@ throw( uno::RuntimeException, std::exception )
{
DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
vcl::Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- IFrameWindow_Impl* pWin = new IFrameWindow_Impl( pParent, maFrmDescr.IsFrameBorderOn() );
+ VclPtr<IFrameWindow_Impl> pWin = VclPtr<IFrameWindow_Impl>::Create( pParent, maFrmDescr.IsFrameBorderOn() );
pWin->SetSizePixel( pParent->GetOutputSizePixel() );
pWin->SetBackground();
pWin->Show();
diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index e62676bca661..1d4f8e6fa858 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -123,19 +123,19 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSfxPreviewWin(vcl::Win
class SfxNewFileDialog_Impl
{
- ListBox* m_pRegionLb;
- ListBox* m_pTemplateLb;
+ VclPtr<ListBox> m_pRegionLb;
+ VclPtr<ListBox> m_pTemplateLb;
- SfxPreviewWin_Impl* m_pPreviewWin;
+ VclPtr<SfxPreviewWin_Impl> m_pPreviewWin;
- CheckBox* m_pTextStyleCB;
- CheckBox* m_pFrameStyleCB;
- CheckBox* m_pPageStyleCB;
- CheckBox* m_pNumStyleCB;
- CheckBox* m_pMergeStyleCB;
- PushButton* m_pLoadFilePB;
+ VclPtr<CheckBox> m_pTextStyleCB;
+ VclPtr<CheckBox> m_pFrameStyleCB;
+ VclPtr<CheckBox> m_pPageStyleCB;
+ VclPtr<CheckBox> m_pNumStyleCB;
+ VclPtr<CheckBox> m_pMergeStyleCB;
+ VclPtr<PushButton> m_pLoadFilePB;
- VclExpander* m_pMoreBt;
+ VclPtr<VclExpander> m_pMoreBt;
Idle aPrevIdle;
OUString aNone;
OUString sLoadTemplate;
@@ -143,7 +143,7 @@ class SfxNewFileDialog_Impl
sal_uInt16 nFlags;
SfxDocumentTemplates aTemplates;
SfxObjectShellLock xDocShell;
- SfxNewFileDialog* pAntiImpl;
+ VclPtr<SfxNewFileDialog> pAntiImpl;
DECL_LINK( Update, void * );
@@ -454,7 +454,13 @@ SfxNewFileDialog::SfxNewFileDialog(vcl::Window *pParent, sal_uInt16 nFlags)
SfxNewFileDialog::~SfxNewFileDialog()
{
+ disposeOnce();
+}
+
+void SfxNewFileDialog::dispose()
+{
delete pImpl;
+ SfxModalDialog::dispose();
}
bool SfxNewFileDialog::IsTemplate() const
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index d2b4d3c8aacd..faf46aa367bd 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -131,11 +131,11 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
std::shared_ptr<GDIMetaFile> xFile(new GDIMetaFile);
- VirtualDevice aDevice;
- aDevice.EnableOutput( false );
+ ScopedVclPtrInstance< VirtualDevice > pDevice;
+ pDevice->EnableOutput( false );
MapMode aMode( this->GetMapUnit() );
- aDevice.SetMapMode( aMode );
+ pDevice->SetMapMode( aMode );
xFile->SetPrefMapMode( aMode );
Size aTmpSize;
@@ -155,7 +155,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
DBG_ASSERT( aTmpSize.Height()*aTmpSize.Width(),
"size of first page is 0, override GetFirstPageSize or set vis-area!" );
- xFile->Record( &aDevice );
+ xFile->Record( pDevice );
LanguageType eLang;
SvtCTLOptions aCTLOptions;
@@ -166,9 +166,9 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
else
eLang = (LanguageType) Application::GetSettings().GetLanguageTag().getLanguageType();
- aDevice.SetDigitLanguage( eLang );
+ pDevice->SetDigitLanguage( eLang );
- const_cast<SfxObjectShell*>(this)->DoDraw( &aDevice, Point(0,0), aTmpSize, JobSetup(), nAspect );
+ const_cast<SfxObjectShell*>(this)->DoDraw( pDevice, Point(0,0), aTmpSize, JobSetup(), nAspect );
xFile->Stop();
@@ -286,13 +286,13 @@ void SfxObjectShell::UpdateTime_Impl(
-SfxDocumentInfoDialog* SfxObjectShell::CreateDocumentInfoDialog
+VclPtr<SfxDocumentInfoDialog> SfxObjectShell::CreateDocumentInfoDialog
(
vcl::Window* pParent,
const SfxItemSet& rSet
)
{
- return new SfxDocumentInfoDialog(pParent, rSet);
+ return VclPtr<SfxDocumentInfoDialog>::Create(pParent, rSet);
}
@@ -471,8 +471,8 @@ void SfxObjectShell::UpdateFromTemplate_Impl( )
{
OUString sMessage( SfxResId(STR_QRYTEMPL_MESSAGE).toString() );
sMessage = sMessage.replaceAll( "$(ARG1)", aTemplName );
- sfx2::QueryTemplateBox aBox( GetDialogParent(), sMessage );
- if ( RET_YES == aBox.Execute() )
+ ScopedVclPtrInstance< sfx2::QueryTemplateBox > aBox(GetDialogParent(), sMessage);
+ if ( RET_YES == aBox->Execute() )
bLoad = true;
}
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 8f10da507570..3711c68b7130 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -335,7 +335,7 @@ void SfxObjectShell::CheckOut( )
}
catch ( const uno::RuntimeException& e )
{
- boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog( &GetFrame()->GetWindow(), e.Message ));
+ ScopedVclPtrInstance< MessageDialog > pErrorBox( &GetFrame()->GetWindow(), e.Message );
pErrorBox->Execute( );
}
}
@@ -353,7 +353,7 @@ void SfxObjectShell::CancelCheckOut( )
}
catch ( const uno::RuntimeException& e )
{
- boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message));
+ ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
pErrorBox->Execute( );
}
}
@@ -364,11 +364,11 @@ void SfxObjectShell::CheckIn( )
{
uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
// Pop up dialog to ask for comment and major
- SfxCheckinDialog checkinDlg( &GetFrame( )->GetWindow( ) );
- if ( checkinDlg.Execute( ) == RET_OK )
+ ScopedVclPtrInstance< SfxCheckinDialog > checkinDlg(&GetFrame( )->GetWindow( ));
+ if ( checkinDlg->Execute( ) == RET_OK )
{
- OUString sComment = checkinDlg.GetComment( );
- bool bMajor = checkinDlg.IsMajor( );
+ OUString sComment = checkinDlg->GetComment( );
+ bool bMajor = checkinDlg->IsMajor( );
xCmisDoc->checkIn( bMajor, sComment );
uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY );
if ( xModifiable.is( ) )
@@ -377,7 +377,7 @@ void SfxObjectShell::CheckIn( )
}
catch ( const uno::RuntimeException& e )
{
- boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message));
+ ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
pErrorBox->Execute( );
}
}
@@ -391,7 +391,7 @@ uno::Sequence< document::CmisVersion > SfxObjectShell::GetCmisVersions( )
}
catch ( const uno::RuntimeException& e )
{
- boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message));
+ ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
pErrorBox->Execute( );
}
return uno::Sequence< document::CmisVersion > ( );
@@ -439,7 +439,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
if ( !IsOwnStorageFormat_Impl( *GetMedium() ) )
return;
- boost::scoped_ptr<SfxVersionDialog> pDlg(new SfxVersionDialog( pFrame, IsSaveVersionOnClose() ));
+ ScopedVclPtrInstance< SfxVersionDialog > pDlg( pFrame, IsSaveVersionOnClose() );
pDlg->Execute();
SetSaveVersionOnClose( pDlg->IsSaveVersionOnClose() );
rReq.Done();
@@ -499,7 +499,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
// creating dialog is done via virtual method; application will
// add its own statistics page
- boost::scoped_ptr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(0, aSet));
+ ScopedVclPtr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(0, aSet));
if ( RET_OK == pDlg->Execute() )
{
SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pDocInfoItem, SfxDocumentInfoItem, SID_DOCINFO, false);
@@ -857,10 +857,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
case SID_DOCTEMPLATE:
{
// save as document templates
- SfxTemplateManagerDlg aDlg;
- aDlg.setDocumentModel(GetModel());
- aDlg.setSaveMode();
- aDlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateManagerDlg > aDlg;
+ aDlg->setDocumentModel(GetModel());
+ aDlg->setSaveMode();
+ aDlg->Execute();
break;
}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index c609495d1462..d181c628cf5d 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3019,8 +3019,8 @@ sal_Int16 SfxObjectShell::QueryHiddenInformation( HiddenWarningFact eFact, vcl::
{
sMessage += "\n";
sMessage += SfxResId(nResId).toString();
- WarningBox aWBox( pParent, WB_YES_NO | WB_DEF_NO, sMessage );
- nRet = aWBox.Execute();
+ ScopedVclPtrInstance< WarningBox > aWBox(pParent, WB_YES_NO | WB_DEF_NO, sMessage);
+ nRet = aWBox->Execute();
}
}
diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx
index ca30f4563093..7c5d7157607a 100644
--- a/sfx2/source/doc/plugin.cxx
+++ b/sfx2/source/doc/plugin.cxx
@@ -152,7 +152,7 @@ throw( uno::RuntimeException, std::exception )
if ( SvtMiscOptions().IsPluginsEnabled() )
{
vcl::Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- PluginWindow_Impl* pWin = new PluginWindow_Impl( pParent );
+ VclPtr<PluginWindow_Impl> pWin = VclPtr<PluginWindow_Impl>::Create( pParent );
pWin->SetSizePixel( pParent->GetOutputSizePixel() );
pWin->SetBackground();
pWin->Show();
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 1d056eb69900..452f41435a54 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -346,7 +346,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
if ( aPrinterName != pPrinter->GetName() )
{
- pPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aPrinterName );
+ pPrinter = VclPtr<SfxPrinter>::Create( pPrinter->GetOptions().Clone(), aPrinterName );
nChangeFlags = SfxPrinterChangeFlags::PRINTER;
}
break;
@@ -477,7 +477,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread
{
private:
/// of course we must know the printer which execute the job
- SfxPrinter* m_pPrinter;
+ VclPtr<SfxPrinter> m_pPrinter;
/// this describes the target location for the printed temp file
OUString m_sTargetURL;
/// it holds the temp file alive, till the print job will finish and remove it from disk automatically if the object die
@@ -504,7 +504,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread
SolarMutexGuard aGuard;
while( m_pPrinter->IsPrinting() )
Application::Yield();
- m_pPrinter = NULL; // don't delete it! It's borrowed only :-)
+ m_pPrinter.clear(); // don't delete it! It's borrowed only :-)
}
/* } SAFE */
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index fee3db0670df..3997e4f5f0e9 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -296,7 +296,12 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
mpLocalView->Show();
}
-SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()
+SfxTemplateManagerDlg::~SfxTemplateManagerDlg()
+{
+ disposeOnce();
+}
+
+void SfxTemplateManagerDlg::dispose()
{
writeSettings();
@@ -316,6 +321,17 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()
mpSearchView->setItemStateHdl(Link());
mpSearchView->setOpenTemplateHdl(Link());
+
+ mpTabControl.clear();
+ mpSearchEdit.clear();
+ mpViewBar.clear();
+ mpActionBar.clear();
+ mpTemplateBar.clear();
+ mpSearchView.clear();
+ mpCurView.clear();
+ mpLocalView.clear();
+ mpRemoteView.clear();
+ ModalDialog::dispose();
}
void SfxTemplateManagerDlg::setSaveMode()
@@ -608,11 +624,11 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu)
}
else if (nMenuId == MNI_REPOSITORY_NEW)
{
- PlaceEditDialog dlg(this);
+ ScopedVclPtrInstance< PlaceEditDialog > dlg(this);
- if (dlg.Execute())
+ if (dlg->Execute())
{
- std::shared_ptr<Place> xPlace = dlg.GetPlace();
+ std::shared_ptr<Place> xPlace = dlg->GetPlace();
if (insertRepository(xPlace->GetName(), xPlace->GetUrl()))
{
@@ -623,7 +639,7 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu)
{
OUString aMsg(SfxResId(STR_MSG_ERROR_REPOSITORY_NAME).toString());
aMsg = aMsg.replaceFirst("$1", xPlace->GetName());
- MessageDialog(this, aMsg).Execute();
+ ScopedVclPtrInstance<MessageDialog>(this, aMsg)->Execute();
}
}
}
@@ -1152,16 +1168,16 @@ void SfxTemplateManagerDlg::OnTemplateProperties ()
{
const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*maSelTemplates.begin());
- SfxTemplateInfoDlg aDlg;
- aDlg.loadDocument(pItem->getPath());
- aDlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateInfoDlg > aDlg;
+ aDlg->loadDocument(pItem->getPath());
+ aDlg->Execute();
}
void SfxTemplateManagerDlg::OnTemplateDelete ()
{
- MessageDialog aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( aQueryDlg.Execute() != RET_YES )
+ if ( aQueryDlg->Execute() != RET_YES )
return;
OUString aTemplateList;
@@ -1230,13 +1246,13 @@ void SfxTemplateManagerDlg::OnTemplateAsDefault ()
void SfxTemplateManagerDlg::OnFolderNew()
{
- InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
- int ret = dlg.Execute();
+ int ret = dlg->Execute();
if (ret)
{
- OUString aName = dlg.getEntryText();
+ OUString aName = dlg->getEntryText();
mpCurView->createRegion(aName);
}
@@ -1244,9 +1260,9 @@ void SfxTemplateManagerDlg::OnFolderNew()
void SfxTemplateManagerDlg::OnFolderDelete()
{
- MessageDialog aQueryDlg(this, SfxResId(STR_QMSG_SEL_FOLDER_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_FOLDER_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( aQueryDlg.Execute() != RET_YES )
+ if ( aQueryDlg->Execute() != RET_YES )
return;
OUString aFolderList;
@@ -1297,17 +1313,17 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
return;
}
- InputDialog aDlg(SfxResId(STR_INPUT_TEMPLATE_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > aDlg(SfxResId(STR_INPUT_TEMPLATE_NEW).toString(),this);
- if (aDlg.Execute())
+ if (aDlg->Execute())
{
- OUString aName = aDlg.getEntryText();
+ OUString aName = aDlg->getEntryText();
if (!aName.isEmpty())
{
OUString aFolderList;
OUString aQMsg(SfxResId(STR_QMSG_TEMPLATE_OVERWRITE).toString());
- MessageDialog aQueryDlg(this, OUString(), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, OUString(), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
if (mpLocalView->isNonRootRegionVisible())
{
@@ -1316,9 +1332,9 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
if (!mpLocalView->isTemplateNameUnique(nRegionItemId,aName))
{
aQMsg = aQMsg.replaceFirst("$1",aName);
- aQueryDlg.set_primary_text(aQMsg.replaceFirst("$2",mpLocalView->getCurRegionName()));
+ aQueryDlg->set_primary_text(aQMsg.replaceFirst("$2",mpLocalView->getCurRegionName()));
- if (aQueryDlg.Execute() == RET_NO)
+ if (aQueryDlg->Execute() == RET_NO)
return;
}
@@ -1335,9 +1351,9 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
if (!mpLocalView->isTemplateNameUnique(pItem->mnId,aName))
{
OUString aDQMsg = aQMsg.replaceFirst("$1",aName);
- aQueryDlg.set_primary_text(aDQMsg.replaceFirst("$2",pItem->maTitle));
+ aQueryDlg->set_primary_text(aDQMsg.replaceFirst("$2",pItem->maTitle));
- if (aQueryDlg.Execute() == RET_NO)
+ if (aQueryDlg->Execute() == RET_NO)
continue;
}
@@ -1403,7 +1419,7 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal)
{
if (bDisplayLocal)
{
- mpCurView = mpLocalView;
+ mpCurView = mpLocalView.get();
mpViewBar->HideItem(VIEWBAR_DELETE);
@@ -1416,7 +1432,7 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal)
}
else
{
- mpCurView = mpRemoteView;
+ mpCurView = mpRemoteView.get();
mpViewBar->ShowItem(VIEWBAR_DELETE);
@@ -1435,13 +1451,13 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId)
if (nMenuId == MNI_MOVE_NEW)
{
- InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
- int ret = dlg.Execute();
+ int ret = dlg->Execute();
if (ret)
{
- OUString aName = dlg.getEntryText();
+ OUString aName = dlg->getEntryText();
if (!aName.isEmpty())
nItemId = mpLocalView->createRegion(aName);
@@ -1483,13 +1499,13 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 nMenuId)
if (nMenuId == MNI_MOVE_NEW)
{
- InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
- int ret = dlg.Execute();
+ int ret = dlg->Execute();
if (ret)
{
- OUString aName = dlg.getEntryText();
+ OUString aName = dlg->getEntryText();
if (!aName.isEmpty())
nItemId = mpLocalView->createRegion(aName);
@@ -1537,13 +1553,13 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId)
if (nMenuId == MNI_MOVE_NEW)
{
- InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
- int ret = dlg.Execute();
+ int ret = dlg->Execute();
if (ret)
{
- OUString aName = dlg.getEntryText();
+ OUString aName = dlg->getEntryText();
if (!aName.isEmpty())
nItemId = mpLocalView->createRegion(aName);
diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx
index 7e812d263a1b..82884a76ccdf 100644
--- a/sfx2/source/inc/alienwarn.hxx
+++ b/sfx2/source/inc/alienwarn.hxx
@@ -25,14 +25,15 @@
class SfxAlienWarningDialog : public MessageDialog
{
private:
- PushButton* m_pKeepCurrentBtn;
- PushButton* m_pUseDefaultFormatBtn;
- CheckBox* m_pWarningOnBox;
+ VclPtr<PushButton> m_pKeepCurrentBtn;
+ VclPtr<PushButton> m_pUseDefaultFormatBtn;
+ VclPtr<CheckBox> m_pWarningOnBox;
public:
SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName,
const OUString& _rDefaultExtension, bool rDefaultIsAlien);
virtual ~SfxAlienWarningDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif // INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX
diff --git a/sfx2/source/inc/documentfontsdialog.hxx b/sfx2/source/inc/documentfontsdialog.hxx
index 360f88713010..1ac6c6ebcbe5 100644
--- a/sfx2/source/inc/documentfontsdialog.hxx
+++ b/sfx2/source/inc/documentfontsdialog.hxx
@@ -31,12 +31,14 @@ class SfxDocumentFontsPage: public SfxTabPage
{
public:
SfxDocumentFontsPage( vcl::Window* parent, const SfxItemSet& set );
- static SfxTabPage* Create( vcl::Window* parent, const SfxItemSet* set );
+ virtual ~SfxDocumentFontsPage();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* parent, const SfxItemSet* set );
protected:
virtual bool FillItemSet( SfxItemSet* set ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* set ) SAL_OVERRIDE;
private:
- CheckBox* embedFontsCheckbox;
+ VclPtr<CheckBox> embedFontsCheckbox;
};
#endif
diff --git a/sfx2/source/inc/inputdlg.hxx b/sfx2/source/inc/inputdlg.hxx
index 29b5c45b9453..41888d44d3c9 100644
--- a/sfx2/source/inc/inputdlg.hxx
+++ b/sfx2/source/inc/inputdlg.hxx
@@ -21,6 +21,8 @@ class InputDialog : public ModalDialog
public:
InputDialog (const OUString &labelText, vcl::Window *pParent = NULL);
OUString getEntryText () const;
+ virtual ~InputDialog();
+ virtual void dispose() SAL_OVERRIDE;
private:
@@ -28,10 +30,10 @@ private:
private:
- Edit *m_pEntry;
- FixedText *m_pLabel;
- PushButton *m_pOK;
- PushButton *m_pCancel;
+ VclPtr<Edit> m_pEntry;
+ VclPtr<FixedText> m_pLabel;
+ VclPtr<PushButton> m_pOK;
+ VclPtr<PushButton> m_pCancel;
};
#endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
diff --git a/sfx2/source/inc/partwnd.hxx b/sfx2/source/inc/partwnd.hxx
index a065593d168d..b81a88fd084c 100644
--- a/sfx2/source/inc/partwnd.hxx
+++ b/sfx2/source/inc/partwnd.hxx
@@ -69,7 +69,6 @@ public:
vcl::Window* pParent,
WinBits nBits );
- virtual ~SfxPartDockWnd_Impl();
bool QueryClose();
virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE;
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > ForgetFrame();
diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx
index 06fc314a2795..50dd7f6dc9fd 100644
--- a/sfx2/source/inc/recfloat.hxx
+++ b/sfx2/source/inc/recfloat.hxx
@@ -39,13 +39,14 @@ public:
class SfxRecordingFloat_Impl : public SfxFloatingWindow
{
- ToolBox* m_pTbx;
+ VclPtr<ToolBox> m_pTbx;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarController > xStopRecTbxCtrl;
public:
SfxRecordingFloat_Impl( SfxBindings* pBindings ,
SfxChildWindow* pChildWin ,
vcl::Window* pParent );
virtual ~SfxRecordingFloat_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
virtual void FillInfo( SfxChildWinInfo& rInfo ) const SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/sfx2/source/inc/splitwin.hxx b/sfx2/source/inc/splitwin.hxx
index 1a332e8e5e58..177bd769c70c 100644
--- a/sfx2/source/inc/splitwin.hxx
+++ b/sfx2/source/inc/splitwin.hxx
@@ -31,9 +31,9 @@ class SfxEmptySplitWin_Impl;
struct SfxDock_Impl
{
sal_uInt16 nType;
- SfxDockingWindow* pWin; // SplitWindow has this window
- bool bNewLine;
- bool bHide; // SplitWindow had this window
+ VclPtr<SfxDockingWindow> pWin; // SplitWindow has this window
+ bool bNewLine;
+ bool bHide; // SplitWindow had this window
long nSize;
};
@@ -49,8 +49,8 @@ private:
SfxDockArr_Impl* pDockArr;
bool bLocked;
bool bPinned;
- SfxEmptySplitWin_Impl* pEmptyWin;
- SfxDockingWindow* pActive;
+ VclPtr<SfxEmptySplitWin_Impl> pEmptyWin;
+ VclPtr<SfxDockingWindow> pActive;
void InsertWindow_Impl( SfxDock_Impl* pDockWin,
const Size& rSize,
@@ -79,6 +79,7 @@ public:
WinBits nBits = WB_BORDER | WB_SIZEABLE | WB_3DLOOK );
virtual ~SfxSplitWindow();
+ virtual void dispose() SAL_OVERRIDE;
void ReleaseWindow_Impl(SfxDockingWindow *pWin, bool bSaveConfig=true);
diff --git a/sfx2/source/inc/templatesearchview.hxx b/sfx2/source/inc/templatesearchview.hxx
index 2845c409fcb6..e49ef3f81813 100644
--- a/sfx2/source/inc/templatesearchview.hxx
+++ b/sfx2/source/inc/templatesearchview.hxx
@@ -18,8 +18,6 @@ public:
TemplateSearchView ( vcl::Window* pParent, WinBits nWinStyle = WB_TABSTOP | WB_VSCROLL);
- virtual ~TemplateSearchView();
-
void setOpenTemplateHdl (const Link &rLink);
void AppendItem(sal_uInt16 nAssocItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx,
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 0cf88b1e7077..249a1f32d827 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -176,7 +176,7 @@ protected:
SfxBindings* pBindings;
SfxTemplateControllerItem* pBoundItems[COUNT_BOUND_FUNC];
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
SfxModule* pModule;
Idle* pIdle;
@@ -184,13 +184,13 @@ protected:
SfxStyleFamilies* pStyleFamilies;
SfxTemplateItem* pFamilyState[MAX_FAMILIES];
SfxStyleSheetBasePool* pStyleSheetPool;
- StyleTreeListBox_Impl* pTreeBox;
+ VclPtr<StyleTreeListBox_Impl> pTreeBox;
SfxObjectShell* pCurObjShell;
css::uno::Reference<css::frame::XModuleManager2> xModuleManager;
DeletionWatcher* m_pDeletionWatcher;
- SfxActionListBox aFmtLb;
- ListBox aFilterLb;
+ VclPtr<SfxActionListBox> aFmtLb;
+ VclPtr<ListBox> aFilterLb;
Size aSize;
sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
@@ -367,7 +367,6 @@ protected:
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
public:
DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl* pTemplateDialog);
- virtual ~DropToolBox_Impl();
};
class SfxTemplateDialog_Impl : public SfxCommonTemplateDialog_Impl
@@ -377,10 +376,10 @@ private:
friend class DropToolBox_Impl;
friend class SfxTemplatePanelControl;
- vcl::Window* m_pFloat;
- bool m_bZoomIn;
- DropToolBox_Impl m_aActionTbL;
- ToolBox m_aActionTbR;
+ VclPtr<vcl::Window> m_pFloat;
+ bool m_bZoomIn;
+ VclPtr<DropToolBox_Impl> m_aActionTbL;
+ VclPtr<ToolBox> m_aActionTbR;
DECL_LINK( ToolBoxLSelect, ToolBox* );
DECL_LINK( ToolBoxRSelect, ToolBox* );
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index 3204e2d479bf..67453efa3a51 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -45,14 +45,14 @@ public:
class SfxVersionTableDtor;
class SfxVersionDialog : public SfxModalDialog
{
- PushButton* m_pSaveButton;
- CheckBox* m_pSaveCheckBox;
- SfxVersionsTabListBox_Impl* m_pVersionBox;
- PushButton* m_pOpenButton;
- PushButton* m_pViewButton;
- PushButton* m_pDeleteButton;
- PushButton* m_pCompareButton;
- PushButton* m_pCmisButton;
+ VclPtr<PushButton> m_pSaveButton;
+ VclPtr<CheckBox> m_pSaveCheckBox;
+ VclPtr<SfxVersionsTabListBox_Impl> m_pVersionBox;
+ VclPtr<PushButton> m_pOpenButton;
+ VclPtr<PushButton> m_pViewButton;
+ VclPtr<PushButton> m_pDeleteButton;
+ VclPtr<PushButton> m_pCompareButton;
+ VclPtr<PushButton> m_pCmisButton;
SfxViewFrame* pViewFrame;
SfxVersionTableDtor* m_pTable;
bool m_bIsSaveVersionOnClose;
@@ -66,32 +66,35 @@ class SfxVersionDialog : public SfxModalDialog
public:
SfxVersionDialog ( SfxViewFrame* pFrame, bool );
virtual ~SfxVersionDialog ();
+ virtual void dispose() SAL_OVERRIDE;
bool IsSaveVersionOnClose() const { return m_bIsSaveVersionOnClose; }
};
class SfxViewVersionDialog_Impl : public SfxModalDialog
{
- FixedText* m_pDateTimeText;
- FixedText* m_pSavedByText;
- VclMultiLineEdit* m_pEdit;
- OKButton* m_pOKButton;
- CancelButton* m_pCancelButton;
- CloseButton* m_pCloseButton;
+ VclPtr<FixedText> m_pDateTimeText;
+ VclPtr<FixedText> m_pSavedByText;
+ VclPtr<VclMultiLineEdit> m_pEdit;
+ VclPtr<OKButton> m_pOKButton;
+ VclPtr<CancelButton> m_pCancelButton;
+ VclPtr<CloseButton> m_pCloseButton;
SfxVersionInfo& m_rInfo;
DECL_LINK(ButtonHdl, Button*);
public:
SfxViewVersionDialog_Impl(vcl::Window *pParent, SfxVersionInfo& rInfo, bool bEdit);
+ virtual ~SfxViewVersionDialog_Impl();
+ virtual void dispose() SAL_OVERRIDE;
};
class SfxCmisVersionsDialog : public SfxModalDialog
{
- SfxVersionsTabListBox_Impl* m_pVersionBox;
- PushButton* m_pOpenButton;
- PushButton* m_pViewButton;
- PushButton* m_pDeleteButton;
- PushButton* m_pCompareButton;
+ VclPtr<SfxVersionsTabListBox_Impl> m_pVersionBox;
+ VclPtr<PushButton> m_pOpenButton;
+ VclPtr<PushButton> m_pViewButton;
+ VclPtr<PushButton> m_pDeleteButton;
+ VclPtr<PushButton> m_pCompareButton;
SfxViewFrame* pViewFrame;
SfxVersionTableDtor* m_pTable;
bool m_bIsSaveVersionOnClose;
@@ -104,6 +107,7 @@ class SfxCmisVersionsDialog : public SfxModalDialog
public:
SfxCmisVersionsDialog ( SfxViewFrame* pFrame, bool );
virtual ~SfxCmisVersionsDialog ();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index 7abf4d37cfb7..7233fe676838 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -96,7 +96,7 @@ namespace o3tl
struct SfxChild_Impl
{
- vcl::Window* pWin;
+ VclPtr<vcl::Window> pWin;
Size aSize;
SfxChildAlignment eAlign;
SfxChildVisibility nVisible;
@@ -222,16 +222,16 @@ protected:
Rectangle aClientArea;
Rectangle aUpperClientArea;
SfxWorkWindow* pParent;
- SfxSplitWindow* pSplit[SFX_SPLITWINDOWS_MAX];
+ VclPtr<SfxSplitWindow> pSplit[SFX_SPLITWINDOWS_MAX];
SfxChildList_Impl aChildren;
SfxChildWindows_Impl aChildWins;
SfxBindings* pBindings;
- vcl::Window* pWorkWin;
+ VclPtr<vcl::Window> pWorkWin;
SfxShell* pConfigShell;
- vcl::Window* pActiveChild;
- sal_uInt16 nUpdateMode;
- sal_uInt16 nChildren;
- sal_uInt16 nOrigMode;
+ VclPtr<vcl::Window> pActiveChild;
+ sal_uInt16 nUpdateMode;
+ sal_uInt16 nChildren;
+ sal_uInt16 nOrigMode;
bool bSorted : 1;
bool bDockingAllowed : 1;
bool bInternalDockingAllowed : 1;
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index 29a5168987f0..81f89fbf3aa3 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -152,13 +152,12 @@ IMPL_STATIC_LINK_NOINSTANCE( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, Execute
}
-vcl::Window* SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* pParent )
{
- SvtURLBox* pURLBox = new SvtURLBox( pParent );
+ VclPtrInstance<SvtURLBox> pURLBox( pParent );
pURLBox->SetOpenHdl( LINK( this, SfxURLToolBoxControl_Impl, OpenHdl ) );
pURLBox->SetSelectHdl( LINK( this, SfxURLToolBoxControl_Impl, SelectHdl ) );
-
- return pURLBox;
+ return pURLBox.get();
}
IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, SelectHdl)
diff --git a/sfx2/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx
index 23e17a671deb..d8a49b3dd148 100644
--- a/sfx2/source/sidebar/ControlFactory.cxx
+++ b/sfx2/source/sidebar/ControlFactory.cxx
@@ -25,14 +25,14 @@
namespace sfx2 { namespace sidebar {
-CheckBox* ControlFactory::CreateMenuButton (vcl::Window* pParentWindow)
+VclPtr<CheckBox> ControlFactory::CreateMenuButton (vcl::Window* pParentWindow)
{
- return new MenuButton(pParentWindow);
+ return VclPtr<CheckBox>(new MenuButton(pParentWindow), SAL_NO_ACQUIRE);
}
-ImageRadioButton* ControlFactory::CreateTabItem (vcl::Window* pParentWindow)
+VclPtr<ImageRadioButton> ControlFactory::CreateTabItem (vcl::Window* pParentWindow)
{
- return new TabItem(pParentWindow);
+ return VclPtr<ImageRadioButton>(new TabItem(pParentWindow), SAL_NO_ACQUIRE);
}
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index 729e2b210164..22dd244e52e0 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -117,8 +117,16 @@ ControllerItem::ControllerItem (
ControllerItem::~ControllerItem()
{
+ dispose();
+}
+
+void ControllerItem::dispose()
+{
if (mxFrameActionListener.is())
mxFrameActionListener->dispose();
+ mxFrameActionListener.clear();
+
+ SfxControllerItem::dispose();
}
void ControllerItem::StateChanged (
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 831c05325d8c..de2066defd74 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -48,11 +48,11 @@ Deck::Deck (
maIcon(),
mnMinimalWidth(0),
maPanels(),
- mpTitleBar(new DeckTitleBar(rDeckDescriptor.msTitle, this, rCloserAction)),
- mpScrollClipWindow(new vcl::Window(this)),
- mpScrollContainer(new ScrollContainerWindow(mpScrollClipWindow.get())),
- mpFiller(new vcl::Window(this)),
- mpVerticalScrollBar(new ScrollBar(this))
+ mpTitleBar(VclPtr<DeckTitleBar>::Create(rDeckDescriptor.msTitle, this, rCloserAction)),
+ mpScrollClipWindow(VclPtr<vcl::Window>::Create(this)),
+ mpScrollContainer(VclPtr<ScrollContainerWindow>::Create(mpScrollClipWindow.get())),
+ mpFiller(VclPtr<vcl::Window>::Create(this)),
+ mpVerticalScrollBar(VclPtr<ScrollBar>::Create(this))
{
SetBackground(Wallpaper());
@@ -75,35 +75,27 @@ Deck::Deck (
Deck::~Deck()
{
- Dispose();
-
- // We have to explicitly trigger the destruction of panels.
- // Otherwise that is done by one of our base class destructors
- // without updating maPanels.
- maPanels.clear();
+ disposeOnce();
}
-void Deck::Dispose()
+void Deck::dispose()
{
SharedPanelContainer aPanels;
aPanels.swap(maPanels);
- for (SharedPanelContainer::iterator
- iPanel(aPanels.begin()),
- iEnd(aPanels.end());
- iPanel!=iEnd;
- ++iPanel)
- {
- if (*iPanel)
- {
- (*iPanel)->Dispose();
- OSL_ASSERT(iPanel->unique());
- iPanel->reset();
- }
- }
- mpTitleBar.reset();
- mpFiller.reset();
- mpVerticalScrollBar.reset();
+ // We have to explicitly trigger the destruction of panels.
+ // Otherwise that is done by one of our base class destructors
+ // without updating maPanels.
+ for (size_t i = 0; i < aPanels.size(); i++)
+ aPanels[i].disposeAndClear();
+
+ mpTitleBar.disposeAndClear();
+ mpFiller.disposeAndClear();
+ mpVerticalScrollBar.disposeAndClear();
+ mpScrollContainer.disposeAndClear();
+ mpScrollClipWindow.disposeAndClear();
+
+ vcl::Window::dispose();
}
DeckTitleBar* Deck::GetTitleBar() const
@@ -210,8 +202,21 @@ bool Deck::ProcessWheelEvent(CommandEvent* pCommandEvent)
return true;
}
-void Deck::SetPanels (const SharedPanelContainer& rPanels)
+/**
+ * This container may contain existing panels that are
+ * being re-used, and new ones too.
+ */
+void Deck::ResetPanels (const SharedPanelContainer& rPanels)
{
+ // First dispose old panels we no longer need.
+ for (size_t i = 0; i < maPanels.size(); i++)
+ {
+ bool bFound = false;
+ for (size_t j = 0; j < rPanels.size(); j++)
+ bFound = bFound || (maPanels[i].get() == rPanels[j].get());
+ if (!bFound) // this one didn't survive.
+ maPanels[i].disposeAndClear();
+ }
maPanels = rPanels;
RequestLayout();
@@ -323,10 +328,6 @@ Deck::ScrollContainerWindow::ScrollContainerWindow (vcl::Window* pParentWindow)
#endif
}
-Deck::ScrollContainerWindow::~ScrollContainerWindow()
-{
-}
-
void Deck::ScrollContainerWindow::Paint (const Rectangle& rUpdateArea)
{
(void)rUpdateArea;
diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx
index ddb5354b21e1..b231b5c9b628 100644
--- a/sfx2/source/sidebar/Deck.hxx
+++ b/sfx2/source/sidebar/Deck.hxx
@@ -47,13 +47,12 @@ public:
vcl::Window* pParentWindow,
const ::boost::function<void()>& rCloserAction);
virtual ~Deck();
-
- void Dispose();
+ virtual void dispose() SAL_OVERRIDE;
const ::rtl::OUString& GetId() const { return msId;}
DeckTitleBar* GetTitleBar() const;
Rectangle GetContentArea() const;
- void SetPanels (const SharedPanelContainer& rPanels);
+ void ResetPanels (const SharedPanelContainer& rPanels);
const SharedPanelContainer& GetPanels() const { return maPanels;}
void RequestLayout();
vcl::Window* GetPanelParentWindow();
@@ -77,7 +76,6 @@ public:
{
public:
ScrollContainerWindow (vcl::Window* pParentWindow);
- virtual ~ScrollContainerWindow();
virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
void SetSeparators (const ::std::vector<sal_Int32>& rSeparators);
private:
@@ -89,11 +87,11 @@ private:
Image maIcon;
sal_Int32 mnMinimalWidth;
SharedPanelContainer maPanels;
- ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
- ::boost::scoped_ptr<vcl::Window> mpScrollClipWindow;
- ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer;
- ::boost::scoped_ptr<vcl::Window> mpFiller;
- ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<DeckTitleBar> mpTitleBar;
+ VclPtr<vcl::Window> mpScrollClipWindow;
+ VclPtr<ScrollContainerWindow> mpScrollContainer;
+ VclPtr<vcl::Window> mpFiller;
+ VclPtr<ScrollBar> mpVerticalScrollBar;
DECL_LINK(HandleVerticalScrollBarChange,void*);
bool ProcessWheelEvent(CommandEvent* pCommandEvent);
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index aae65c611950..110a77fc4cbb 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -43,7 +43,7 @@ namespace {
class LayoutItem
{
public:
- SharedPanel mpPanel;
+ VclPtr<Panel> mpPanel;
css::ui::LayoutSize maLayoutSize;
sal_Int32 mnDistributedHeight;
sal_Int32 mnWeight;
@@ -348,7 +348,7 @@ void GetRequestedSizes (
IterateLayoutItems(iItem,rLayoutItems)
{
ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0));
- if (iItem->mpPanel != 0)
+ if (iItem->mpPanel != nullptr)
{
if (rLayoutItems.size() == 1
&& iItem->mpPanel->IsTitleBarOptional())
diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx
index 9c296b1f3f3d..4e52d1aa57ab 100644
--- a/sfx2/source/sidebar/DeckTitleBar.cxx
+++ b/sfx2/source/sidebar/DeckTitleBar.cxx
@@ -52,10 +52,6 @@ DeckTitleBar::DeckTitleBar (
#endif
}
-DeckTitleBar::~DeckTitleBar()
-{
-}
-
void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)
{
if (mbIsCloserVisible != bIsCloserVisible)
@@ -64,16 +60,16 @@ void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)
if (mbIsCloserVisible)
{
- maToolBox.InsertItem(
+ maToolBox->InsertItem(
mnCloserItemIndex,
Theme::GetImage(Theme::Image_Closer));
- maToolBox.SetQuickHelpText(
+ maToolBox->SetQuickHelpText(
mnCloserItemIndex,
SFX2_RESSTR(SFX_STR_SIDEBAR_CLOSE_DECK));
}
else
- maToolBox.RemoveItem(
- maToolBox.GetItemPos(mnCloserItemIndex));
+ maToolBox->RemoveItem(
+ maToolBox->GetItemPos(mnCloserItemIndex));
}
}
@@ -119,7 +115,7 @@ css::uno::Reference<css::accessibility::XAccessible> DeckTitleBar::CreateAccessi
void DeckTitleBar::DataChanged (const DataChangedEvent& rEvent)
{
- maToolBox.SetItemImage(
+ maToolBox->SetItemImage(
mnCloserItemIndex,
Theme::GetImage(Theme::Image_Closer));
TitleBar::DataChanged(rEvent);
diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/sfx2/source/sidebar/DeckTitleBar.hxx
index d481b2d842d3..871635b42632 100644
--- a/sfx2/source/sidebar/DeckTitleBar.hxx
+++ b/sfx2/source/sidebar/DeckTitleBar.hxx
@@ -33,7 +33,6 @@ public:
const ::rtl::OUString& rsTitle,
vcl::Window* pParentWindow,
const ::boost::function<void()>& rCloserAction);
- virtual ~DeckTitleBar();
void SetCloserVisible (const bool bIsCloserVisible);
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 1dae58556cbd..37fa9940c1ea 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -65,9 +65,9 @@ void FocusManager::Clear()
void FocusManager::ClearPanels()
{
- ::std::vector<Panel*> aPanels;
+ ::std::vector<VclPtr<Panel> > aPanels;
aPanels.swap(maPanels);
- for (::std::vector<Panel*>::iterator iPanel(aPanels.begin()),iEnd(aPanels.end());
+ for (auto iPanel(aPanels.begin()),iEnd(aPanels.end());
iPanel!=iEnd;
++iPanel)
{
@@ -84,9 +84,9 @@ void FocusManager::ClearPanels()
void FocusManager::ClearButtons()
{
- ::std::vector<Button*> aButtons;
+ ::std::vector<VclPtr<Button> > aButtons;
aButtons.swap(maButtons);
- for (::std::vector<Button*>::iterator iButton(aButtons.begin()),iEnd(aButtons.end());
+ for (auto iButton(aButtons.begin()),iEnd(aButtons.end());
iButton!=iEnd;
++iButton)
{
@@ -96,14 +96,14 @@ void FocusManager::ClearButtons()
void FocusManager::SetDeckTitle (DeckTitleBar* pDeckTitleBar)
{
- if (mpDeckTitleBar != NULL)
+ if (mpDeckTitleBar != nullptr)
{
UnregisterWindow(*mpDeckTitleBar);
UnregisterWindow(mpDeckTitleBar->GetToolBox());
}
mpDeckTitleBar = pDeckTitleBar;
- if (mpDeckTitleBar != NULL)
+ if (mpDeckTitleBar != nullptr)
{
RegisterWindow(*mpDeckTitleBar);
RegisterWindow(mpDeckTitleBar->GetToolBox());
@@ -156,7 +156,7 @@ void FocusManager::UnregisterWindow (vcl::Window& rWindow)
FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& rWindow) const
{
// Check the deck title.
- if (mpDeckTitleBar != NULL)
+ if (mpDeckTitleBar != nullptr)
{
if (mpDeckTitleBar == &rWindow)
return FocusLocation(PC_DeckTitle, -1);
@@ -186,7 +186,7 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r
void FocusManager::FocusDeckTitle()
{
- if (mpDeckTitleBar != NULL)
+ if (mpDeckTitleBar != nullptr)
{
if (IsDeckTitleVisible())
{
@@ -207,7 +207,7 @@ void FocusManager::FocusDeckTitle()
bool FocusManager::IsDeckTitleVisible() const
{
- return mpDeckTitleBar != NULL && mpDeckTitleBar->IsVisible();
+ return mpDeckTitleBar != nullptr && mpDeckTitleBar->IsVisible();
}
bool FocusManager::IsPanelTitleVisible (const sal_Int32 nPanelIndex) const
@@ -286,7 +286,7 @@ void FocusManager::ClickButton (const sal_Int32 nButtonIndex)
void FocusManager::RemoveWindow (vcl::Window& rWindow)
{
- ::std::vector<Panel*>::iterator iPanel (::std::find(maPanels.begin(), maPanels.end(), &rWindow));
+ auto iPanel (::std::find(maPanels.begin(), maPanels.end(), &rWindow));
if (iPanel != maPanels.end())
{
UnregisterWindow(rWindow);
@@ -299,7 +299,7 @@ void FocusManager::RemoveWindow (vcl::Window& rWindow)
return;
}
- ::std::vector<Button*>::iterator iButton (::std::find(maButtons.begin(), maButtons.end(), &rWindow));
+ auto iButton (::std::find(maButtons.begin(), maButtons.end(), &rWindow));
if (iButton != maButtons.end())
{
UnregisterWindow(rWindow);
@@ -596,7 +596,7 @@ IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent)
break;
case KEY_TAB:
- if (mpFirstFocusedContentControl!=NULL
+ if (mpFirstFocusedContentControl!=nullptr
&& mpLastFocusedWindow == mpFirstFocusedContentControl)
{
// Move focus back to panel (or deck)
diff --git a/sfx2/source/sidebar/FocusManager.hxx b/sfx2/source/sidebar/FocusManager.hxx
index 4db5fe1ead64..93367bd4ce44 100644
--- a/sfx2/source/sidebar/FocusManager.hxx
+++ b/sfx2/source/sidebar/FocusManager.hxx
@@ -68,13 +68,13 @@ public:
void SetButtons (const ::std::vector<Button*>& rButtons);
private:
- DeckTitleBar* mpDeckTitleBar;
- ::std::vector<Panel*> maPanels;
- ::std::vector<Button*> maButtons;
+ VclPtr<DeckTitleBar> mpDeckTitleBar;
+ ::std::vector<VclPtr<Panel> > maPanels;
+ ::std::vector<VclPtr<Button> > maButtons;
const ::boost::function<void(const Panel&)> maShowPanelFunctor;
bool mbObservingContentControlFocus;
- vcl::Window* mpFirstFocusedContentControl;
- vcl::Window* mpLastFocusedWindow;
+ VclPtr<vcl::Window> mpFirstFocusedContentControl;
+ VclPtr<vcl::Window> mpLastFocusedWindow;
enum PanelComponent
{
diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx
index 8620b30f9b93..c0e131109dc5 100644
--- a/sfx2/source/sidebar/MenuButton.cxx
+++ b/sfx2/source/sidebar/MenuButton.cxx
@@ -39,10 +39,6 @@ MenuButton::MenuButton (vcl::Window* pParentWindow)
#endif
}
-MenuButton::~MenuButton()
-{
-}
-
void MenuButton::Paint (const Rectangle& rUpdateArea)
{
switch(mePaintType)
diff --git a/sfx2/source/sidebar/MenuButton.hxx b/sfx2/source/sidebar/MenuButton.hxx
index 121dd991d4c6..1d09e14d4e9d 100644
--- a/sfx2/source/sidebar/MenuButton.hxx
+++ b/sfx2/source/sidebar/MenuButton.hxx
@@ -28,7 +28,6 @@ class MenuButton
{
public:
MenuButton (vcl::Window* pParentWindow);
- virtual ~MenuButton();
virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void MouseMove (const MouseEvent& rEvent) SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index d72f15e57c22..52c9abc831f7 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -51,7 +51,7 @@ Panel::Panel (
const ::boost::function<Context()>& rContextAccess)
: Window(pParentWindow),
msPanelId(rPanelDescriptor.msId),
- mpTitleBar(new PanelTitleBar(
+ mpTitleBar(VclPtr<PanelTitleBar>::Create(
rPanelDescriptor.msTitle,
pParentWindow,
this)),
@@ -71,10 +71,10 @@ Panel::Panel (
Panel::~Panel()
{
- Dispose();
+ disposeOnce();
}
-void Panel::Dispose()
+void Panel::dispose()
{
mxPanelComponent = NULL;
@@ -91,7 +91,9 @@ void Panel::Dispose()
xComponent->dispose();
}
- mpTitleBar.reset();
+ mpTitleBar.disposeAndClear();
+
+ vcl::Window::dispose();
}
PanelTitleBar* Panel::GetTitleBar() const
diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx
index ad2c78d6e95d..03cd81ca5ec8 100644
--- a/sfx2/source/sidebar/Panel.hxx
+++ b/sfx2/source/sidebar/Panel.hxx
@@ -47,8 +47,7 @@ public:
const ::boost::function<void()>& rDeckLayoutTrigger,
const ::boost::function<Context()>& rContextAccess);
virtual ~Panel();
-
- void Dispose();
+ virtual void dispose() SAL_OVERRIDE;
PanelTitleBar* GetTitleBar() const;
bool IsTitleBarOptional() const { return mbIsTitleBarOptional;}
@@ -67,7 +66,7 @@ public:
private:
const ::rtl::OUString msPanelId;
- ::boost::scoped_ptr<PanelTitleBar> mpTitleBar;
+ VclPtr<PanelTitleBar> mpTitleBar;
const bool mbIsTitleBarOptional;
css::uno::Reference<css::ui::XUIElement> mxElement;
css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
@@ -75,8 +74,7 @@ private:
const ::boost::function<void()> maDeckLayoutTrigger;
const ::boost::function<Context()> maContextAccess;
};
-typedef ::boost::shared_ptr<Panel> SharedPanel;
-typedef ::std::vector<SharedPanel> SharedPanelContainer;
+typedef ::std::vector< VclPtr< Panel > > SharedPanelContainer;
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index b8cf19fbc507..f526c0250055 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -51,7 +51,7 @@ PanelTitleBar::PanelTitleBar (
msMoreOptionsCommand(),
msAccessibleNamePrefix(SFX2_RESSTR(SFX_STR_SIDEBAR_ACCESSIBILITY_PANEL_PREFIX))
{
- OSL_ASSERT(mpPanel != NULL);
+ OSL_ASSERT(mpPanel != nullptr);
#ifdef DEBUG
SetText(OUString("PanelTitleBar"));
@@ -60,6 +60,13 @@ PanelTitleBar::PanelTitleBar (
PanelTitleBar::~PanelTitleBar()
{
+ disposeOnce();
+}
+
+void PanelTitleBar::dispose()
+{
+ mpPanel.clear();
+ TitleBar::dispose();
}
void PanelTitleBar::SetMoreOptionsCommand (
@@ -69,27 +76,27 @@ void PanelTitleBar::SetMoreOptionsCommand (
if ( ! rsCommandName.equals(msMoreOptionsCommand))
{
if (msMoreOptionsCommand.getLength() > 0)
- maToolBox.RemoveItem(maToolBox.GetItemPos(mnMenuItemIndex));
+ maToolBox->RemoveItem(maToolBox->GetItemPos(mnMenuItemIndex));
msMoreOptionsCommand = rsCommandName;
mxFrame = rxFrame;
if (msMoreOptionsCommand.getLength() > 0)
{
- maToolBox.InsertItem(
+ maToolBox->InsertItem(
mnMenuItemIndex,
Theme::GetImage(Theme::Image_PanelMenu));
Reference<frame::XToolbarController> xController (
ControllerFactory::CreateToolBoxController(
- &maToolBox,
+ maToolBox.get(),
mnMenuItemIndex,
msMoreOptionsCommand,
rxFrame,
- VCLUnoHelper::GetInterface(&maToolBox),
+ VCLUnoHelper::GetInterface(maToolBox.get()),
0));
- maToolBox.SetController(mnMenuItemIndex, xController, msMoreOptionsCommand);
- maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT);
- maToolBox.SetQuickHelpText(
+ maToolBox->SetController(mnMenuItemIndex, xController, msMoreOptionsCommand);
+ maToolBox->SetOutStyle(TOOLBOX_STYLE_FLAT);
+ maToolBox->SetQuickHelpText(
mnMenuItemIndex,
SFX2_RESSTR(SFX_STR_SIDEBAR_MORE_OPTIONS));
}
@@ -98,7 +105,7 @@ void PanelTitleBar::SetMoreOptionsCommand (
Rectangle PanelTitleBar::GetTitleArea (const Rectangle& rTitleBarBox)
{
- if (mpPanel != NULL)
+ if (mpPanel != nullptr)
{
Image aImage (mpPanel->IsExpanded()
? Theme::GetImage(Theme::Image_Expand)
@@ -117,7 +124,7 @@ void PanelTitleBar::PaintDecoration (const Rectangle& rTitleBarBox)
{
(void)rTitleBarBox;
- if (mpPanel != NULL)
+ if (mpPanel != nullptr)
{
Image aImage (mpPanel->IsExpanded()
? Theme::GetImage(Theme::Image_Collapse)
@@ -185,7 +192,7 @@ void PanelTitleBar::MouseButtonUp (const MouseEvent& rMouseEvent)
{
if (mbIsLeftButtonDown)
{
- if (mpPanel != NULL)
+ if (mpPanel != nullptr)
{
mpPanel->SetExpanded( ! mpPanel->IsExpanded());
Invalidate();
@@ -198,7 +205,7 @@ void PanelTitleBar::MouseButtonUp (const MouseEvent& rMouseEvent)
void PanelTitleBar::DataChanged (const DataChangedEvent& rEvent)
{
- maToolBox.SetItemImage(
+ maToolBox->SetItemImage(
mnMenuItemIndex,
Theme::GetImage(Theme::Image_PanelMenu));
TitleBar::DataChanged(rEvent);
diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx
index 37effd70726f..ede039f863dd 100644
--- a/sfx2/source/sidebar/PanelTitleBar.hxx
+++ b/sfx2/source/sidebar/PanelTitleBar.hxx
@@ -37,6 +37,7 @@ public:
vcl::Window* pParentWindow,
Panel* pPanel );
virtual ~PanelTitleBar();
+ virtual void dispose() SAL_OVERRIDE;
void SetMoreOptionsCommand (
const ::rtl::OUString& rsCommandName,
@@ -56,7 +57,7 @@ protected:
private:
bool mbIsLeftButtonDown;
- Panel* mpPanel;
+ VclPtr<Panel> mpPanel;
const sal_uInt16 mnMenuItemIndex;
css::uno::Reference<css::frame::XFrame> mxFrame;
::rtl::OUString msMoreOptionsCommand;
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 4d4730d06df4..8587c290e335 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -37,17 +37,17 @@ SidebarChildWindow::SidebarChildWindow (
SfxChildWinInfo* pInfo)
: SfxChildWindow(pParentWindow, nId)
{
- pWindow = new SidebarDockingWindow(
+ pWindow.reset(VclPtr<SidebarDockingWindow>::Create(
pBindings,
*this,
pParentWindow,
- WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
+ WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE));
eChildAlignment = SfxChildAlignment::RIGHT;
pWindow->SetHelpId(HID_SIDEBAR_WINDOW);
pWindow->SetOutputSizePixel(Size(GetDefaultWidth(pWindow), 450));
- SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pWindow);
+ SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pWindow.get());
if (pDockingParent != NULL)
{
if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw" && pInfo->aModule != "simpress")
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 6268a1e2abd0..4392c1b1c979 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -95,7 +95,7 @@ SidebarController::SidebarController (
: SidebarControllerInterfaceBase(m_aMutex),
mpCurrentDeck(),
mpParentWindow(pParentWindow),
- mpTabBar(new TabBar(
+ mpTabBar(VclPtr<TabBar>::Create(
mpParentWindow,
rxFrame,
::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, _1),
@@ -117,8 +117,7 @@ SidebarController::SidebarController (
mxReadOnlyModeDispatch(),
mbIsDocumentReadOnly(false),
mpSplitWindow(NULL),
- mnWidthOnSplitterButtonDown(0),
- mpCloseIndicator()
+ mnWidthOnSplitterButtonDown(0)
{
// Listen for context change events.
css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
@@ -173,6 +172,8 @@ SidebarController* SidebarController::GetSidebarControllerForFrame (
void SAL_CALL SidebarController::disposing()
{
+ mpCloseIndicator.disposeAndClear();
+
SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame));
if (iEntry != maSidebarControllerContainer.end())
maSidebarControllerContainer.erase(iEntry);
@@ -188,13 +189,13 @@ void SAL_CALL SidebarController::disposing()
if (mxReadOnlyModeDispatch.is())
mxReadOnlyModeDispatch->removeStatusListener(this, Tools::GetURL(gsReadOnlyCommandName));
- if (mpSplitWindow != NULL)
+ if (mpSplitWindow != nullptr)
{
mpSplitWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
mpSplitWindow = NULL;
}
- if (mpParentWindow != NULL)
+ if (mpParentWindow != nullptr)
{
mpParentWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
mpParentWindow = NULL;
@@ -202,12 +203,11 @@ void SAL_CALL SidebarController::disposing()
if (mpCurrentDeck)
{
- mpCurrentDeck->Dispose();
- mpCurrentDeck->PrintWindowTree();
- mpCurrentDeck.reset();
+ mpCurrentDeck.disposeAndClear();
+// mpCurrentDeck->PrintWindowTree();
}
- mpTabBar.reset();
+ mpTabBar.disposeAndClear();
Theme::GetPropertySet()->removePropertyChangeListener(
OUString(""),
@@ -292,7 +292,7 @@ void SidebarController::NotifyResize()
{
if (mpTabBar == 0)
{
- OSL_ASSERT(mpTabBar!=0);
+ OSL_ASSERT(mpTabBar!=nullptr);
return;
}
@@ -527,18 +527,13 @@ void SidebarController::SwitchToDeck (
const bool bForceNewDeck ((mnRequestedForceFlags&SwitchFlag_ForceNewDeck)!=0);
const bool bForceNewPanels ((mnRequestedForceFlags&SwitchFlag_ForceNewPanels)!=0);
- mnRequestedForceFlags = SwitchFlag_NoForce;
if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId)
|| bForceNewDeck)
{
// When the deck changes then destroy the deck and all panels
// and create everything new.
- if (mpCurrentDeck)
- {
- mpCurrentDeck->Dispose();
- mpCurrentDeck.reset();
- }
+ mpCurrentDeck.disposeAndClear();
msCurrentDeckId = rDeckDescriptor.msId;
}
@@ -576,7 +571,7 @@ void SidebarController::SwitchToDeck (
if ( ! mpCurrentDeck)
{
mpCurrentDeck.reset(
- new Deck(
+ VclPtr<Deck>::Create(
rDeckDescriptor,
mpParentWindow,
::boost::bind(&SidebarController::RequestCloseDeck, this)));
@@ -597,6 +592,7 @@ void SidebarController::SwitchToDeck (
const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
SharedPanelContainer aNewPanels;
const SharedPanelContainer& rCurrentPanels (mpCurrentDeck->GetPanels());
+
aNewPanels.resize(nNewPanelCount);
sal_Int32 nWriteIndex (0);
bool bHasPanelSetChanged (false);
@@ -612,19 +608,19 @@ void SidebarController::SwitchToDeck (
// Find the corresponding panel among the currently active
// panels.
- SharedPanelContainer::const_iterator iPanel;
- if (bForceNewPanels)
+ SharedPanelContainer::const_iterator iPanel = rCurrentPanels.end();
+
+ if (!bForceNewPanels)
{
- // All panels have to be created in any case. There is no
- // point in searching already existing panels.
iPanel = rCurrentPanels.end();
- }
- else
- {
- iPanel = ::std::find_if(
- rCurrentPanels.begin(),
- rCurrentPanels.end(),
- ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rPanelContexDescriptor.msId)));
+ for (auto a = rCurrentPanels.begin(); a != rCurrentPanels.end(); ++a)
+ {
+ if ((*a)->HasIdPredicate(rPanelContexDescriptor.msId))
+ {
+ iPanel = a;
+ break;
+ }
+ }
}
if (iPanel != rCurrentPanels.end())
{
@@ -643,7 +639,7 @@ void SidebarController::SwitchToDeck (
rContext);
bHasPanelSetChanged = true;
}
- if (aNewPanels[nWriteIndex] != 0)
+ if (aNewPanels[nWriteIndex] != nullptr)
{
// Depending on the context we have to change the command
// for the "more options" dialog.
@@ -659,6 +655,7 @@ void SidebarController::SwitchToDeck (
}
}
+ // mpCurrentPanels - may miss stuff (?)
aNewPanels.resize(nWriteIndex);
// Activate the deck and the new set of panels.
@@ -668,7 +665,7 @@ void SidebarController::SwitchToDeck (
mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(),
mpParentWindow->GetSizePixel().Height());
- mpCurrentDeck->SetPanels(aNewPanels);
+ mpCurrentDeck->ResetPanels(aNewPanels);
mpCurrentDeck->Show();
mpParentWindow->SetText(rDeckDescriptor.msTitle);
@@ -684,7 +681,7 @@ void SidebarController::SwitchToDeck (
UpdateTitleBarIcons();
}
-SharedPanel SidebarController::CreatePanel (
+VclPtr<Panel> SidebarController::CreatePanel (
const OUString& rsPanelId,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
@@ -692,15 +689,15 @@ SharedPanel SidebarController::CreatePanel (
{
const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
if (pPanelDescriptor == NULL)
- return SharedPanel();
+ return NULL;
// Create the panel which is the parent window of the UIElement.
- SharedPanel pPanel (new Panel(
+ VclPtr<Panel> pPanel = VclPtr<Panel>::Create(
*pPanelDescriptor,
pParentWindow,
bIsInitiallyExpanded,
::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
- ::boost::bind(&SidebarController::GetCurrentContext, this)));
+ ::boost::bind(&SidebarController::GetCurrentContext, this));
// Create the XUIElement.
Reference<ui::XUIElement> xUIElement (CreateUIElement(
@@ -715,7 +712,7 @@ SharedPanel SidebarController::CreatePanel (
}
else
{
- pPanel.reset();
+ pPanel.disposeAndClear();
}
return pPanel;
@@ -737,7 +734,7 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
::comphelper::NamedValueCollection aCreationArguments;
aCreationArguments.put("Frame", makeAny(mxFrame));
aCreationArguments.put("ParentWindow", makeAny(rxWindow));
- SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow);
+ SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow.get());
if (pSfxDockingWindow != NULL)
aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
aCreationArguments.put("Theme", Theme::GetPropertySet());
@@ -802,7 +799,7 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
break;
}
}
- else if (pEvent->GetWindow()==mpSplitWindow && mpSplitWindow!=NULL)
+ else if (pEvent->GetWindow()==mpSplitWindow && mpSplitWindow!=nullptr)
{
switch (pEvent->GetId())
{
@@ -1060,7 +1057,7 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
SfxSplitWindow* pSplitWindow = GetSplitWindow();
if (pSplitWindow != NULL)
{
- const sal_uInt16 nId (pSplitWindow->GetItemId(mpParentWindow));
+ const sal_uInt16 nId (pSplitWindow->GetItemId(mpParentWindow.get()));
const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
pSplitWindow->SetItemSizeRange(
nSetId,
@@ -1071,17 +1068,17 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
SfxSplitWindow* SidebarController::GetSplitWindow()
{
- if (mpParentWindow != NULL)
+ if (mpParentWindow != nullptr)
{
SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
if (pSplitWindow != mpSplitWindow)
{
- if (mpSplitWindow != NULL)
+ if (mpSplitWindow != nullptr)
mpSplitWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
mpSplitWindow = pSplitWindow;
- if (mpSplitWindow != NULL)
+ if (mpSplitWindow != nullptr)
mpSplitWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler));
}
return mpSplitWindow;
@@ -1092,7 +1089,7 @@ SfxSplitWindow* SidebarController::GetSplitWindow()
void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag)
{
- if (mpParentWindow == NULL)
+ if (mpParentWindow == nullptr)
return;
if (bCloseAfterDrag)
@@ -1100,7 +1097,7 @@ void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag)
// Make sure that the indicator exists.
if ( ! mpCloseIndicator)
{
- mpCloseIndicator.reset(new FixedImage(mpParentWindow));
+ mpCloseIndicator.reset(VclPtr<FixedImage>::Create(mpParentWindow));
FixedImage* pFixedImage = static_cast<FixedImage*>(mpCloseIndicator.get());
const Image aImage (Theme::GetImage(Theme::Image_CloseIndicator));
pFixedImage->SetImage(aImage);
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 14705d91ca02..5fb8466b1fbc 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -144,9 +144,9 @@ private:
> SidebarControllerContainer;
static SidebarControllerContainer maSidebarControllerContainer;
- ::boost::scoped_ptr<Deck> mpCurrentDeck;
- SidebarDockingWindow* mpParentWindow;
- ::boost::scoped_ptr<TabBar> mpTabBar;
+ VclPtr<Deck> mpCurrentDeck;
+ VclPtr<SidebarDockingWindow> mpParentWindow;
+ VclPtr<TabBar> mpTabBar;
css::uno::Reference<css::frame::XFrame> mxFrame;
Context maCurrentContext;
Context maRequestedContext;
@@ -177,7 +177,7 @@ private:
FocusManager maFocusManager;
css::uno::Reference<css::frame::XDispatch> mxReadOnlyModeDispatch;
bool mbIsDocumentReadOnly;
- SfxSplitWindow* mpSplitWindow;
+ VclPtr<SfxSplitWindow> mpSplitWindow;
/** When the user moves the splitter then we remember the
width at that time.
*/
@@ -186,7 +186,7 @@ private:
to indicate that when the current mouse drag operation ends, the
sidebar will only show the tab bar.
*/
- ::boost::scoped_ptr<vcl::Window> mpCloseIndicator;
+ VclPtr<vcl::Window> mpCloseIndicator;
DECL_LINK(WindowEventHandler, VclWindowEvent*);
/** Make maRequestedContext the current context.
@@ -198,7 +198,7 @@ private:
const ::rtl::OUString& rsImplementationURL,
const bool bWantsCanvas,
const Context& rContext);
- SharedPanel CreatePanel (
+ VclPtr<Panel> CreatePanel (
const ::rtl::OUString& rsPanelId,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index f67240c1a06c..7c9a150aeb79 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -53,7 +53,13 @@ SidebarDockingWindow::SidebarDockingWindow(
SidebarDockingWindow::~SidebarDockingWindow()
{
+ disposeOnce();
+}
+
+void SidebarDockingWindow::dispose()
+{
DoDispose();
+ SfxDockingWindow::dispose();
}
void SidebarDockingWindow::DoDispose()
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx
index 47724b4d3520..fd45c691842d 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.hxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.hxx
@@ -39,6 +39,7 @@ public:
vcl::Window* pParent,
WinBits nBits);
virtual ~SidebarDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index fbe51379f322..a7ec830687dd 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -67,7 +67,7 @@ SidebarPanelBase::SidebarPanelBase (
if (xMultiplexer.is())
xMultiplexer->addContextChangeEventListener(this, mxFrame->getController());
}
- if (mpControl != NULL)
+ if (mpControl != nullptr)
{
mpControl->SetBackground(Theme::GetWallpaper(Theme::Paint_PanelBackground));
mpControl->Show();
@@ -81,11 +81,7 @@ SidebarPanelBase::~SidebarPanelBase()
void SAL_CALL SidebarPanelBase::disposing()
throw (css::uno::RuntimeException)
{
- if (mpControl != NULL)
- {
- delete mpControl;
- mpControl = NULL;
- }
+ mpControl.disposeAndClear();
if (mxFrame.is())
{
@@ -104,7 +100,7 @@ void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
throw (css::uno::RuntimeException, std::exception)
{
IContextChangeReceiver* pContextChangeReceiver
- = dynamic_cast<IContextChangeReceiver*>(mpControl);
+ = dynamic_cast<IContextChangeReceiver*>(mpControl.get());
if (pContextChangeReceiver != NULL)
{
const EnumContext aContext(
@@ -161,7 +157,7 @@ Reference<accessibility::XAccessible> SAL_CALL SidebarPanelBase::createAccessibl
Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow()
throw(css::uno::RuntimeException, std::exception)
{
- if (mpControl != NULL)
+ if (mpControl != nullptr)
return Reference<awt::XWindow>(
mpControl->GetComponentInterface(),
UNO_QUERY);
@@ -176,7 +172,7 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi
return maLayoutSize;
else
{
- ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mpControl);
+ ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mpControl.get());
if (isLayoutEnabled(mpControl))
{
@@ -186,7 +182,7 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi
}
else if (pLayoutableWindow != NULL)
return pLayoutableWindow->GetHeightForWidth(nWidth);
- else if (mpControl != NULL)
+ else if (mpControl != nullptr)
{
const sal_Int32 nHeight (mpControl->GetSizePixel().Height());
return ui::LayoutSize(nHeight,nHeight,nHeight);
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index e1987fd8c9cc..af27f4757f07 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -57,6 +57,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSidebarToolBox(vcl::Wi
SidebarToolBox::~SidebarToolBox()
{
+ disposeOnce();
+}
+
+void SidebarToolBox::dispose()
+{
ControllerContainer aControllers;
aControllers.swap(maControllers);
for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
@@ -76,7 +81,10 @@ SidebarToolBox::~SidebarToolBox()
SetSelectHdl(Link());
SetActivateHdl(Link());
SetDeactivateHdl(Link());
+ mbAreHandlersRegistered = false;
}
+
+ ToolBox::dispose();
}
void SidebarToolBox::InsertItem(const OUString& rCommand,
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 7f63755b5b82..08cbe7f602a6 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -64,6 +64,19 @@ TabBar::TabBar (
TabBar::~TabBar()
{
+ disposeOnce();
+}
+
+void TabBar::dispose()
+{
+ for(ItemContainer::iterator
+ iItem(maItems.begin()), iEnd(maItems.end());
+ iItem!=iEnd;
+ ++iItem)
+ iItem->mpButton.disposeAndClear();
+ maItems.clear();
+ mpMenuButton.disposeAndClear();
+ vcl::Window::dispose();
}
void TabBar::Paint (const Rectangle& rUpdateArea)
@@ -94,7 +107,7 @@ void TabBar::SetDecks (
iItem!=iEnd;
++iItem)
{
- iItem->mpButton.reset();
+ iItem->mpButton.disposeAndClear();
}
maItems.clear();
}
@@ -115,7 +128,8 @@ void TabBar::SetDecks (
Item& rItem (maItems[nIndex++]);
rItem.msDeckId = pDescriptor->msId;
- rItem.mpButton.reset(CreateTabItem(*pDescriptor));
+ rItem.mpButton.disposeAndClear();
+ rItem.mpButton = CreateTabItem(*pDescriptor);
rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
rItem.maDeckActivationFunctor = maDeckActivationFunctor;
rItem.mbIsHiddenByDefault = false;
@@ -176,7 +190,7 @@ void TabBar::Layout()
Theme::GetInteger(Theme::Int_TabItemHeight) * GetDPIScaleFactor());
// Place the menu button and the separator.
- if (mpMenuButton != 0)
+ if (mpMenuButton != nullptr)
{
mpMenuButton->SetPosSizePixel(
Point(nX,nY),
@@ -245,12 +259,11 @@ bool TabBar::Notify (NotifyEvent&)
return false;
}
-RadioButton* TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
+VclPtr<RadioButton> TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
{
- RadioButton* pItem = ControlFactory::CreateTabItem(this);
+ VclPtr<RadioButton> pItem = ControlFactory::CreateTabItem(this);
pItem->SetHelpText(rDeckDescriptor.msHelpText);
pItem->SetQuickHelpText(rDeckDescriptor.msHelpText);
-
return pItem;
}
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index a0c14ab0d4ff..523abb7ba726 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -68,6 +68,7 @@ public:
const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor,
const PopupMenuProvider& rPopupMenuProvider);
virtual ~TabBar();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void DataChanged (const DataChangedEvent& rDataChangedEvent) SAL_OVERRIDE;
@@ -93,12 +94,12 @@ public:
private:
css::uno::Reference<css::frame::XFrame> mxFrame;
- ::boost::scoped_ptr<CheckBox> mpMenuButton;
+ VclPtr<CheckBox> mpMenuButton;
class Item
{
public:
DECL_LINK(HandleClick, Button*);
- ::boost::shared_ptr<RadioButton> mpButton;
+ VclPtr<RadioButton> mpButton;
::rtl::OUString msDeckId;
::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
bool mbIsHidden;
@@ -110,7 +111,7 @@ private:
sal_Int32 mnMenuSeparatorY;
PopupMenuProvider maPopupMenuProvider;
- RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor);
+ VclPtr<RadioButton> CreateTabItem (const DeckDescriptor& rDeckDescriptor);
Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;
void Layout();
void UpdateButtonIcons();
diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx
index 476803bae488..678e1f0e80a8 100644
--- a/sfx2/source/sidebar/TabItem.cxx
+++ b/sfx2/source/sidebar/TabItem.cxx
@@ -42,10 +42,6 @@ TabItem::TabItem (vcl::Window* pParentWindow)
#endif
}
-TabItem::~TabItem()
-{
-}
-
void TabItem::Paint (const Rectangle& rUpdateArea)
{
switch(mePaintType)
diff --git a/sfx2/source/sidebar/TabItem.hxx b/sfx2/source/sidebar/TabItem.hxx
index 33fa016aceb3..818a38bbc402 100644
--- a/sfx2/source/sidebar/TabItem.hxx
+++ b/sfx2/source/sidebar/TabItem.hxx
@@ -34,7 +34,6 @@ class TabItem
{
public:
TabItem (vcl::Window* pParentWindow);
- virtual ~TabItem();
virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void MouseMove (const MouseEvent& rEvent) SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index ff5687336811..f2647b386d6b 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -41,17 +41,24 @@ TitleBar::TitleBar (
vcl::Window* pParentWindow,
const sidebar::Paint& rInitialBackgroundPaint)
: Window(pParentWindow),
- maToolBox(this),
+ maToolBox(VclPtr<SidebarToolBox>::Create(this)),
msTitle(rsTitle),
maIcon()
{
SetBackground(rInitialBackgroundPaint.GetWallpaper());
- maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
+ maToolBox->SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
}
TitleBar::~TitleBar()
{
+ disposeOnce();
+}
+
+void TitleBar::dispose()
+{
+ maToolBox.disposeAndClear();
+ vcl::Window::dispose();
}
void TitleBar::SetTitle (const ::rtl::OUString& rsTitle)
@@ -102,9 +109,9 @@ void TitleBar::setPosSizePixel (
Window::setPosSizePixel(nX,nY,nWidth,nHeight,nFlags);
// Place the toolbox.
- const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth());
- maToolBox.setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE);
- maToolBox.Show();
+ const sal_Int32 nToolBoxWidth (maToolBox->GetItemPosRect(0).GetWidth());
+ maToolBox->setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE);
+ maToolBox->Show();
}
void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
@@ -181,8 +188,8 @@ void TitleBar::PaintFocus (const Rectangle& rFocusBox)
IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox)
{
(void)pToolBox;
- OSL_ASSERT(&maToolBox==pToolBox);
- const sal_uInt16 nItemId (maToolBox.GetHighlightItemId());
+ OSL_ASSERT(maToolBox.get()==pToolBox);
+ const sal_uInt16 nItemId (maToolBox->GetHighlightItemId());
HandleToolBoxItemClick(nItemId);
diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx
index 735eca4e25a3..2bb36264202e 100644
--- a/sfx2/source/sidebar/TitleBar.hxx
+++ b/sfx2/source/sidebar/TitleBar.hxx
@@ -35,6 +35,7 @@ public:
vcl::Window* pParentWindow,
const sidebar::Paint& rInitialBackgroundPaint);
virtual ~TitleBar();
+ virtual void dispose() SAL_OVERRIDE;
void SetTitle (const ::rtl::OUString& rsTitle);
void SetIcon (const Image& rIcon);
@@ -48,11 +49,11 @@ public:
long nHeight,
sal_uInt16 nFlags = WINDOW_POSSIZE_ALL) SAL_OVERRIDE;
- ToolBox& GetToolBox() { return maToolBox;}
- const ToolBox& GetToolBox() const { return maToolBox;}
+ ToolBox& GetToolBox() { return *maToolBox.get();}
+ const ToolBox& GetToolBox() const { return *maToolBox.get();}
protected:
- SidebarToolBox maToolBox;
+ VclPtr<SidebarToolBox> maToolBox;
::rtl::OUString msTitle;
virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx
index da1f7e269818..3ebd81948203 100644
--- a/sfx2/source/statbar/stbitem.cxx
+++ b/sfx2/source/statbar/stbitem.cxx
@@ -442,7 +442,7 @@ void SfxStatusBarControl::StateChanged
*/
{
- DBG_ASSERT( pBar != 0, "setting state to dangling StatusBar" );
+ DBG_ASSERT( pBar != nullptr, "setting state to dangling StatusBar" );
const SfxStringItem* pStr = PTR_CAST( SfxStringItem, pState );
if ( eState == SfxItemState::DEFAULT && pStr )
diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx
index 46708f60a27a..c1842198d206 100644
--- a/sfx2/source/toolbox/imgmgr.cxx
+++ b/sfx2/source/toolbox/imgmgr.cxx
@@ -45,7 +45,7 @@ const sal_uInt32 IMAGELIST_COUNT = 4; // small, small-hi, large, large-hi
struct ToolBoxInf_Impl
{
- ToolBox* pToolBox;
+ VclPtr<ToolBox> pToolBox;
SfxToolboxFlags nFlags;
};
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 0643e78aae18..956651c553d5 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -186,13 +186,13 @@ svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const Reference< X
struct SfxToolBoxControl_Impl
{
- ToolBox* pBox;
+ VclPtr<ToolBox> pBox;
bool bShowString;
SfxTbxCtrlFactory* pFact;
sal_uInt16 nTbxId;
sal_uInt16 nSlotId;
- SfxPopupWindow* mpFloatingWindow;
- SfxPopupWindow* mpPopupWindow;
+ VclPtr<SfxPopupWindow> mpFloatingWindow;
+ VclPtr<SfxPopupWindow> mpPopupWindow;
Reference< XUIElement > mxUIElement;
DECL_LINK( WindowEventListener, VclSimpleEvent* );
@@ -207,10 +207,9 @@ IMPL_LINK( SfxToolBoxControl_Impl, WindowEventListener, VclSimpleEvent*, pEvent
{
vcl::Window* pWindow( static_cast<VclWindowEvent*>(pEvent)->GetWindow() );
if (( pWindow == mpFloatingWindow ) &&
- ( mpPopupWindow != 0 ))
+ ( mpPopupWindow != nullptr ))
{
- delete mpPopupWindow;
- mpPopupWindow = 0;
+ mpPopupWindow.disposeAndClear();
}
}
@@ -275,9 +274,9 @@ void SAL_CALL SfxToolBoxControl::dispose() throw (::com::sun::star::uno::Runtime
// Remove and destroy our item window at our toolbox
SolarMutexGuard aGuard;
- vcl::Window* pWindow = pImpl->pBox->GetItemWindow( pImpl->nTbxId );
+ VclPtr< vcl::Window > pWindow = pImpl->pBox->GetItemWindow( pImpl->nTbxId );
pImpl->pBox->SetItemWindow( pImpl->nTbxId, 0 );
- delete pWindow;
+ pWindow.disposeAndClear();
// Dispose an open sub toolbar. It's possible that we have an open
// sub toolbar while we get disposed. Therefore we have to dispose
@@ -292,11 +291,8 @@ void SAL_CALL SfxToolBoxControl::dispose() throw (::com::sun::star::uno::Runtime
pImpl->mxUIElement = 0;
// Delete my popup windows
- delete pImpl->mpFloatingWindow;
- delete pImpl->mpPopupWindow;
-
- pImpl->mpFloatingWindow = 0;
- pImpl->mpPopupWindow = 0;
+ pImpl->mpFloatingWindow.disposeAndClear();
+ pImpl->mpPopupWindow.disposeAndClear();
}
@@ -866,9 +862,9 @@ IMPL_LINK_NOARG(SfxToolBoxControl, PopupModeEndHdl)
{
// Replace floating window with popup window and destroy
// floating window instance.
- delete pImpl->mpFloatingWindow;
+ pImpl->mpFloatingWindow.disposeAndClear();
pImpl->mpFloatingWindow = pImpl->mpPopupWindow;
- pImpl->mpPopupWindow = 0;
+ pImpl->mpPopupWindow.clear();
// We also need to know when the user tries to use the
// floating window.
pImpl->mpFloatingWindow->AddEventListener( LINK( pImpl, SfxToolBoxControl_Impl, WindowEventListener ));
@@ -877,7 +873,7 @@ IMPL_LINK_NOARG(SfxToolBoxControl, PopupModeEndHdl)
{
// Popup window has been closed by the user. No replacement, instance
// will destroy itself.
- pImpl->mpPopupWindow = 0;
+ pImpl->mpPopupWindow.clear();
}
return 1;
@@ -903,7 +899,7 @@ void SfxToolBoxControl::StateChanged
const SfxPoolItem* pState
)
{
- DBG_ASSERT( pImpl->pBox != 0, "setting state to dangling ToolBox" );
+ DBG_ASSERT( pImpl->pBox != nullptr, "setting state to dangling ToolBox" );
if ( GetId() >= SID_OBJECTMENU0 && GetId() <= SID_OBJECTMENU_LAST )
return;
@@ -981,7 +977,7 @@ SfxPopupWindowType SfxToolBoxControl::GetPopupWindowType() const
-SfxPopupWindow* SfxToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SfxToolBoxControl::CreatePopupWindow()
{
return 0;
}
@@ -993,9 +989,9 @@ SfxPopupWindow* SfxToolBoxControl::CreatePopupWindowCascading()
-vcl::Window* SfxToolBoxControl::CreateItemWindow( vcl::Window * )
+VclPtr<vcl::Window> SfxToolBoxControl::CreateItemWindow( vcl::Window * )
{
- return 0;
+ return VclPtr<vcl::Window>();
}
@@ -1204,6 +1200,11 @@ SfxPopupWindow::SfxPopupWindow(
SfxPopupWindow::~SfxPopupWindow()
{
+ disposeOnce();
+}
+
+void SfxPopupWindow::dispose()
+{
if ( m_xStatusListener.is() )
{
m_xStatusListener->dispose();
@@ -1213,6 +1214,7 @@ SfxPopupWindow::~SfxPopupWindow()
vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
if ( pWindow )
static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->RemoveWindow( this );
+ FloatingWindow::dispose();
}
@@ -1333,7 +1335,7 @@ void SfxPopupWindow::StartCascading()
-SfxPopupWindow* SfxPopupWindow::Clone() const
+VclPtr<SfxPopupWindow> SfxPopupWindow::Clone() const
/* [Description]
@@ -1382,7 +1384,7 @@ void SfxPopupWindow::Delete()
{
if ( m_aDeleteLink.IsSet() )
m_aDeleteLink.Call( this );
- delete this;
+ disposeOnce();
}
@@ -1397,7 +1399,7 @@ SfxRecentFilesToolBoxControl::~SfxRecentFilesToolBoxControl()
{
}
-SfxPopupWindow* SfxRecentFilesToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SfxRecentFilesToolBoxControl::CreatePopupWindow()
{
ToolBox& rBox = GetToolBox();
sal_uInt16 nItemId = GetId();
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 82c03818579b..c830ff577a17 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -93,7 +93,7 @@ void SfxFrame::Construct_Impl()
SfxFrame::~SfxFrame()
{
RemoveTopFrame_Impl( this );
- DELETEZ( pWindow );
+ pWindow.disposeAndClear();
SfxFrameArr_Impl::iterator it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), this );
if ( it != pFramesArr_Impl->end() )
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 037d7ea525ae..390a9c52d241 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -69,7 +69,6 @@ public:
SfxFrame* pFrame;
SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContainerWindow );
- virtual ~SfxFrameWindow_Impl( );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
@@ -86,10 +85,6 @@ SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContaine
{
}
-SfxFrameWindow_Impl::~SfxFrameWindow_Impl( )
-{
-}
-
void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
@@ -309,7 +304,7 @@ SfxFrame::SfxFrame( vcl::Window& i_rContainerWindow, bool i_bHidden )
InsertTopFrame_Impl( this );
pImp->pExternalContainerWindow = &i_rContainerWindow;
- pWindow = new SfxFrameWindow_Impl( this, i_rContainerWindow );
+ pWindow = VclPtr<SfxFrameWindow_Impl>::Create( this, i_rContainerWindow );
// always show pWindow, which is the ComponentWindow of the XFrame we live in
// nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame
@@ -350,7 +345,7 @@ SystemWindow* SfxFrame::GetSystemWindow() const
SystemWindow* SfxFrame::GetTopWindow_Impl() const
{
if ( pImp->pExternalContainerWindow->IsSystemWindow() )
- return static_cast<SystemWindow*>( pImp->pExternalContainerWindow );
+ return static_cast<SystemWindow*>( pImp->pExternalContainerWindow.get() );
else
return NULL;
}
diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx
index 5f1aaae8e4fc..271ef70c1d45 100644
--- a/sfx2/source/view/impframe.hxx
+++ b/sfx2/source/view/impframe.hxx
@@ -41,17 +41,17 @@ public:
SfxViewFrame* pCurrentViewFrame;
SfxFrameDescriptor* pDescr;
sal_uInt16 nLocks;
- bool bClosing : 1;
- bool bPrepClosing : 1;
- bool bInCancelTransfers : 1;
- bool bOwnsBindings : 1;
- bool bReleasingComponent : 1;
- bool bInPlace : 1;
+ bool bClosing : 1;
+ bool bPrepClosing : 1;
+ bool bInCancelTransfers : 1;
+ bool bOwnsBindings : 1;
+ bool bReleasingComponent : 1;
+ bool bInPlace : 1;
SfxFrame* pFrame;
SfxWorkWindow* pWorkWin;
SvBorder aBorder;
// formerly SfxTopFrame
- vcl::Window* pExternalContainerWindow;
+ VclPtr<vcl::Window> pExternalContainerWindow;
bool bHidden;
bool bLockResize;
bool bMenuBarOn;
diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx
index 129d03c5e8ce..0f8bfdc47f85 100644
--- a/sfx2/source/view/impviewframe.hxx
+++ b/sfx2/source/view/impviewframe.hxx
@@ -35,9 +35,9 @@ struct SfxViewFrame_Impl
OUString aActualURL;
SfxFrame& rFrame;
svtools::AsynchronLink* pReloader;
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
SfxViewFrame* pActiveChild;
- vcl::Window* pFocusWin;
+ VclPtr<vcl::Window> pFocusWin;
sal_uInt16 nDocViewNo;
sal_uInt16 nCurViewId;
bool bResizeInToOut:1;
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index e5de62ccd922..ee07c7850f21 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -60,7 +60,7 @@ struct SfxPrintOptDlg_Impl
// class SfxPrinter ------------------------------------------------------
-SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
+VclPtr<SfxPrinter> SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
/* [Description]
@@ -79,7 +79,7 @@ SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
ReadJobSetup( rStream, aFileJobSetup );
// Get printers
- SfxPrinter *pPrinter = new SfxPrinter( pOptions, aFileJobSetup );
+ VclPtr<SfxPrinter> pPrinter = VclPtr<SfxPrinter>::Create( pOptions, aFileJobSetup );
return pPrinter;
}
@@ -166,12 +166,11 @@ SfxPrinter::SfxPrinter( const SfxPrinter& rPrinter ) :
-SfxPrinter* SfxPrinter::Clone() const
+VclPtr<SfxPrinter> SfxPrinter::Clone() const
{
if ( IsDefPrinter() )
{
- SfxPrinter *pNewPrinter;
- pNewPrinter = new SfxPrinter( GetOptions().Clone() );
+ VclPtr<SfxPrinter> pNewPrinter = VclPtr<SfxPrinter>::Create( GetOptions().Clone() );
pNewPrinter->SetJobSetup( GetJobSetup() );
pNewPrinter->SetPrinterProps( this );
pNewPrinter->SetMapMode( GetMapMode() );
@@ -182,15 +181,21 @@ SfxPrinter* SfxPrinter::Clone() const
return pNewPrinter;
}
else
- return new SfxPrinter( *this );
+ return VclPtr<SfxPrinter>::Create( *this );
}
SfxPrinter::~SfxPrinter()
{
+ disposeOnce();
+}
+
+void SfxPrinter::dispose()
+{
delete pOptions;
delete pImpl;
+ Printer::dispose();
}
@@ -215,7 +220,7 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog(vcl::Window *pParent,
VclContainer *pVBox = get_content_area();
// Insert TabPage
- pPage = pViewSh->CreatePrintOptionsPage(pVBox, *pOptions);
+ pPage.reset(pViewSh->CreatePrintOptionsPage(pVBox, *pOptions));
DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" );
if( pPage )
{
@@ -229,9 +234,15 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog(vcl::Window *pParent,
SfxPrintOptionsDialog::~SfxPrintOptionsDialog()
{
+ disposeOnce();
+}
+
+void SfxPrintOptionsDialog::dispose()
+{
delete pDlgImpl;
- delete pPage;
+ pPage.disposeAndClear();
delete pOptions;
+ ModalDialog::dispose();
}
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index e56ac06d7abd..22d283b9553c 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1451,7 +1451,7 @@ void SfxBaseController::ShowInfoBars( )
SfxInfoBarWindow* pInfoBar = pViewFrame->AppendInfoBar( "checkout", SfxResId( STR_NONCHECKEDOUT_DOCUMENT ) );
if (pInfoBar)
{
- PushButton* pBtn = new PushButton( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) );
+ VclPtrInstance<PushButton> pBtn( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) );
pBtn->SetClickHdl( LINK( this, SfxBaseController, CheckOutHandler ) );
pInfoBar->addButton(pBtn);
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 8bccea79f647..cfae5c1232e2 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -495,9 +495,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() )
{
// ::com::sun::star::sdbcx::User offering to open it as a template
- MessageDialog aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
+ ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( RET_YES == aBox.Execute() )
+ if ( RET_YES == aBox->Execute() )
{
SfxApplication* pApp = SfxGetpApp();
SfxAllItemSet aSet( pApp->GetPool() );
@@ -579,9 +579,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( bDo && GetFrame().DocIsModified_Impl() &&
!rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) )
{
- MessageDialog aBox(&GetWindow(), SfxResId(STR_QUERY_LASTVERSION),
+ ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_LASTVERSION),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- bDo = ( RET_YES == aBox.Execute() );
+ bDo = ( RET_YES == aBox->Execute() );
}
if ( bDo )
@@ -756,9 +756,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( bForEdit && SID_EDITDOC == rReq.GetSlot() )
{
// ask user for opening as template
- MessageDialog aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
+ ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( RET_YES == aBox.Execute() )
+ if ( RET_YES == aBox->Execute() )
{
SfxAllItemSet aSet( pApp->GetPool() );
aSet.Put( SfxStringItem( SID_FILE_NAME, pMedium->GetName() ) );
@@ -1369,7 +1369,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
SfxInfoBarWindow* pInfoBar = AppendInfoBar("readonly", SfxResId(STR_READONLY_DOCUMENT));
if (pInfoBar)
{
- PushButton* pBtn = new PushButton( &GetWindow(), SfxResId(BT_READONLY_EDIT));
+ VclPtrInstance<PushButton> pBtn( &GetWindow(), SfxResId(BT_READONLY_EDIT));
pBtn->SetClickHdl(LINK(this, SfxViewFrame, SwitchReadOnlyHandler));
pInfoBar->addButton(pBtn);
}
@@ -1468,7 +1468,7 @@ SfxViewFrame::SfxViewFrame
rFrame.SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE );
Construct_Impl( pObjShell );
- pImp->pWindow = new SfxFrameViewWindow_Impl( this, rFrame.GetWindow() );
+ pImp->pWindow = VclPtr<SfxFrameViewWindow_Impl>::Create( this, rFrame.GetWindow() );
pImp->pWindow->SetSizePixel( rFrame.GetWindow().GetOutputSizePixel() );
rFrame.SetOwnsBindings_Impl( true );
rFrame.CreateWorkWindow_Impl();
@@ -1477,7 +1477,6 @@ SfxViewFrame::SfxViewFrame
SfxViewFrame::~SfxViewFrame()
{
-
SetDowning_Impl();
if ( SfxViewFrame::Current() == this )
@@ -1489,7 +1488,8 @@ SfxViewFrame::~SfxViewFrame()
// The Bindings delete the Frame!
KillDispatcher_Impl();
- delete pImp->pWindow;
+ pImp->pWindow.disposeAndClear();
+ pImp->pFocusWin.clear();
if ( GetFrame().GetCurrentViewFrame() == this )
GetFrame().SetCurrentViewFrame_Impl( NULL );
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 5d46afde66f3..d478a4a847d2 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -59,7 +59,7 @@ class SfxPrinterController : public vcl::PrinterController, public SfxListener
Any maCompleteSelection;
Any maSelection;
Reference< view::XRenderable > mxRenderable;
- mutable Printer* mpLastPrinter;
+ mutable VclPtr<Printer> mpLastPrinter;
mutable Reference<awt::XDevice> mxDevice;
SfxViewShell* mpViewShell;
SfxObjectShell* mpObjectShell;
@@ -74,7 +74,7 @@ class SfxPrinterController : public vcl::PrinterController, public SfxListener
const Any& getSelectionObject() const;
public:
- SfxPrinterController( const std::shared_ptr<Printer>& i_rPrinter,
+ SfxPrinterController( const VclPtr<Printer>& i_rPrinter,
const Any& i_rComplete,
const Any& i_rSelection,
const Any& i_rViewProp,
@@ -94,7 +94,7 @@ public:
virtual void jobFinished( com::sun::star::view::PrintableState ) SAL_OVERRIDE;
};
-SfxPrinterController::SfxPrinterController( const std::shared_ptr<Printer>& i_rPrinter,
+SfxPrinterController::SfxPrinterController( const VclPtr<Printer>& i_rPrinter,
const Any& i_rComplete,
const Any& i_rSelection,
const Any& i_rViewProp,
@@ -204,8 +204,8 @@ const Any& SfxPrinterController::getSelectionObject() const
Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const
{
- std::shared_ptr<Printer> xPrinter(getPrinter());
- if (xPrinter.get() != mpLastPrinter)
+ VclPtr<Printer> xPrinter( getPrinter() );
+ if( xPrinter.get() != mpLastPrinter )
{
mpLastPrinter = xPrinter.get();
VCLXDevice* pXDevice = new VCLXDevice();
@@ -224,8 +224,8 @@ Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const
int SfxPrinterController::getPageCount() const
{
int nPages = 0;
- std::shared_ptr<Printer> xPrinter(getPrinter());
- if (mxRenderable.is() && xPrinter)
+ VclPtr<Printer> xPrinter( getPrinter() );
+ if( mxRenderable.is() && xPrinter )
{
Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() );
try
@@ -244,7 +244,7 @@ int SfxPrinterController::getPageCount() const
Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_nPage ) const
{
- std::shared_ptr<Printer> xPrinter(getPrinter());
+ VclPtr<Printer> xPrinter( getPrinter() );
Sequence< beans::PropertyValue > aResult;
if (mxRenderable.is() && xPrinter)
@@ -269,8 +269,8 @@ Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_
void SfxPrinterController::printPage( int i_nPage ) const
{
- std::shared_ptr<Printer> xPrinter(getPrinter());
- if (mxRenderable.is() && xPrinter)
+ VclPtr<Printer> xPrinter( getPrinter() );
+ if( mxRenderable.is() && xPrinter )
{
Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() );
try
@@ -384,7 +384,7 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
pDocPrt->SetJobSetup( getPrinter()->GetJobSetup() );
else
{
- SfxPrinter* pNewPrt = new SfxPrinter( pDocPrt->GetOptions().Clone(), getPrinter()->GetName() );
+ VclPtr<SfxPrinter> pNewPrt = VclPtr<SfxPrinter>::Create( pDocPrt->GetOptions().Clone(), getPrinter()->GetName() );
pNewPrt->SetJobSetup( getPrinter()->GetJobSetup() );
mpViewShell->SetPrinter( pNewPrt, SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
}
@@ -411,9 +411,9 @@ class SfxDialogExecutor_Impl
{
private:
SfxViewShell* _pViewSh;
- PrinterSetupDialog* _pSetupParent;
+ VclPtr<PrinterSetupDialog> _pSetupParent;
SfxItemSet* _pOptions;
- bool _bHelpDisabled;
+ bool _bHelpDisabled;
DECL_LINK( Execute, void * );
@@ -451,8 +451,8 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute)
return 0;
// Create Dialog
- boost::scoped_ptr<SfxPrintOptionsDialog> pDlg(new SfxPrintOptionsDialog( static_cast<vcl::Window*>(_pSetupParent),
- _pViewSh, _pOptions ));
+ VclPtrInstance<SfxPrintOptionsDialog> pDlg( static_cast<vcl::Window*>(_pSetupParent),
+ _pViewSh, _pOptions );
if ( _bHelpDisabled )
pDlg->DisableHelp();
if ( pDlg->Execute() == RET_OK )
@@ -469,7 +469,7 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute)
Internal method for setting the differences between 'pNewPrinter' to the
current printer. pNewPrinter is either taken over or deleted.
*/
-SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
+SfxPrinter* SfxViewShell::SetPrinter_Impl( VclPtr<SfxPrinter>& pNewPrinter )
{
// get current Printer
SfxPrinter *pDocPrinter = GetPrinter();
@@ -558,7 +558,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
// Keep old changed Printer.
pDocPrinter->SetPrinterProps( pNewPrinter );
- delete pNewPrinter;
+ pNewPrinter.disposeAndClear();
}
if ( SfxPrinterChangeFlags::NONE != nChangedFlags )
@@ -582,7 +582,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr
aSelection <<= GetObjectShell()->GetModel();
Any aComplete( makeAny( GetObjectShell()->GetModel() ) );
Any aViewProp( makeAny( xController ) );
- std::shared_ptr<Printer> aPrt;
+ VclPtr<Printer> aPrt;
const beans::PropertyValue* pVal = rProps.getConstArray();
for( sal_Int32 i = 0; i < rProps.getLength(); i++ )
@@ -591,7 +591,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr
{
OUString aPrinterName;
pVal[i].Value >>= aPrinterName;
- aPrt.reset( new Printer( aPrinterName ) );
+ aPrt.reset( VclPtr<Printer>::Create( aPrinterName ) );
break;
}
}
@@ -637,7 +637,7 @@ Printer* SfxViewShell::GetActivePrinter() const
void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
sal_uInt16 nDialogRet = RET_CANCEL;
- SfxPrinter* pPrinter = 0;
+ VclPtr<SfxPrinter> pPrinter;
bool bSilent = false;
// does the function have been called by the user interface or by an API call
@@ -770,11 +770,11 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
if ( pPrinterItem )
{
// use PrinterName parameter to create a printer
- pPrinter = new SfxPrinter( pDocPrinter->GetOptions().Clone(), ((const SfxStringItem*) pPrinterItem)->GetValue() );
+ pPrinter = VclPtr<SfxPrinter>::Create( pDocPrinter->GetOptions().Clone(), ((const SfxStringItem*) pPrinterItem)->GetValue() );
// if printer is unknown, it can't be used - now printer from document will be used
if ( !pPrinter->IsKnown() )
- DELETEZ(pPrinter);
+ pPrinter.disposeAndClear();
}
if ( SID_PRINTER_NAME == nId )
@@ -816,11 +816,11 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
if ( !bIsAPI )
{
// PrinterDialog needs a temporary printer
- SfxPrinter* pDlgPrinter = pPrinter->Clone();
+ VclPtr<SfxPrinter> pDlgPrinter = pPrinter->Clone();
nDialogRet = 0;
// execute PrinterSetupDialog
- PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() );
+ VclPtrInstance<PrinterSetupDialog> pPrintSetupDlg( GetWindow() );
SfxDialogExecutor_Impl* pExecutor = 0;
if (pImp->m_bHasPrintOptions && HasPrintOptionsPage())
@@ -847,7 +847,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
}
}
- DELETEZ( pPrintSetupDlg );
+ pPrintSetupDlg.disposeAndClear();
delete pExecutor;
// no recording of PrinterSetup except printer name (is printer dependent)
@@ -868,13 +868,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
// forget new printer, it was taken over (as pPrinter) or deleted
pDlgPrinter = NULL;
-
}
else
{
// PrinterDialog is used to transfer information on printing,
// so it will only be deleted here if dialog was cancelled
- DELETEZ( pDlgPrinter );
+ pDlgPrinter.disposeAndClear();
rReq.Ignore();
}
}
@@ -892,13 +891,13 @@ sal_uInt16 SfxViewShell::SetPrinter( SfxPrinter* /*pNewPrinter*/, SfxPrinterChan
return 0;
}
-SfxTabPage* SfxViewShell::CreatePrintOptionsPage
+VclPtr<SfxTabPage> SfxViewShell::CreatePrintOptionsPage
(
vcl::Window* /*pParent*/,
const SfxItemSet& /*rOptions*/
)
{
- return 0;
+ return VclPtr<SfxTabPage>();
}
bool SfxViewShell::HasPrintOptionsPage() const
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 111b09c60619..5cda42ef38dc 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -594,8 +594,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
if ( eResult == SfxMailModel::SEND_MAIL_ERROR )
{
- MessageDialog aBox( SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VCL_MESSAGE_INFO);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VCL_MESSAGE_INFO);
+ aBox->Execute();
rReq.Ignore();
}
else
@@ -614,8 +614,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame, OUString() );
if( eResult == SfxMailModel::SEND_MAIL_ERROR )
{
- MessageDialog aBox( SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VCL_MESSAGE_INFO);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VCL_MESSAGE_INFO);
+ aBox->Execute();
rReq.Ignore();
}
else
@@ -1310,8 +1310,8 @@ bool SfxViewShell::PrepareClose
{
if ( bUI )
{
- MessageDialog aInfoBox( &GetViewFrame()->GetWindow(), SfxResId( STR_CANT_CLOSE ), VCL_MESSAGE_INFO );
- aInfoBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aInfoBox(&GetViewFrame()->GetWindow(), SfxResId( STR_CANT_CLOSE ), VCL_MESSAGE_INFO );
+ aInfoBox->Execute();
}
return false;
diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx
index 34f628cc83a5..15d6e6e3fcb4 100644
--- a/slideshow/source/engine/rehearsetimingsactivity.cxx
+++ b/slideshow/source/engine/rehearsetimingsactivity.cxx
@@ -159,13 +159,13 @@ RehearseTimingsActivity::RehearseTimingsActivity( const SlideShowContext& rConte
maFont.SetColor( COL_BLACK );
// determine sprite size (in pixel):
- VirtualDevice blackHole;
- blackHole.EnableOutput(false);
- blackHole.SetFont( maFont );
- blackHole.SetMapMode( MAP_PIXEL );
+ ScopedVclPtrInstance< VirtualDevice > blackHole;
+ blackHole->EnableOutput(false);
+ blackHole->SetFont( maFont );
+ blackHole->SetMapMode( MAP_PIXEL );
Rectangle rect;
- const FontMetric metric( blackHole.GetFontMetric() );
- blackHole.GetTextBoundRect( rect, OUString("XX:XX:XX") );
+ const FontMetric metric( blackHole->GetFontMetric() );
+ blackHole->GetTextBoundRect( rect, OUString("XX:XX:XX") );
maSpriteSizePixel.setX( rect.getWidth() * 12 / 10 );
maSpriteSizePixel.setY( metric.GetLineHeight() * 11 / 10 );
mnYOffset = (metric.GetAscent() + (metric.GetLineHeight() / 20));
@@ -444,30 +444,30 @@ void RehearseTimingsActivity::paint( cppcanvas::CanvasSharedPtr const & canvas )
// create the MetaFile:
GDIMetaFile metaFile;
- VirtualDevice blackHole;
- metaFile.Record( &blackHole );
+ ScopedVclPtrInstance< VirtualDevice > blackHole;
+ metaFile.Record( blackHole );
metaFile.SetPrefSize( Size( 1, 1 ) );
- blackHole.EnableOutput(false);
- blackHole.SetMapMode( MAP_PIXEL );
- blackHole.SetFont( maFont );
+ blackHole->EnableOutput(false);
+ blackHole->SetMapMode( MAP_PIXEL );
+ blackHole->SetFont( maFont );
Rectangle rect = Rectangle( 0,0,
maSpriteSizePixel.getX(),
maSpriteSizePixel.getY());
if (mbDrawPressed)
{
- blackHole.SetTextColor( COL_BLACK );
- blackHole.SetFillColor( COL_LIGHTGRAY );
- blackHole.SetLineColor( COL_GRAY );
+ blackHole->SetTextColor( COL_BLACK );
+ blackHole->SetFillColor( COL_LIGHTGRAY );
+ blackHole->SetLineColor( COL_GRAY );
}
else
{
- blackHole.SetTextColor( COL_BLACK );
- blackHole.SetFillColor( COL_WHITE );
- blackHole.SetLineColor( COL_GRAY );
+ blackHole->SetTextColor( COL_BLACK );
+ blackHole->SetFillColor( COL_WHITE );
+ blackHole->SetLineColor( COL_GRAY );
}
- blackHole.DrawRect( rect );
- blackHole.GetTextBoundRect( rect, time );
- blackHole.DrawText(
+ blackHole->DrawRect( rect );
+ blackHole->GetTextBoundRect( rect, time );
+ blackHole->DrawText(
Point( (maSpriteSizePixel.getX() - rect.getWidth()) / 2,
mnYOffset ), time );
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx
index f3a52ca300f3..c38a45777a47 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -286,14 +286,14 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
// normalize animations to n bitmaps of same size. An Animation,
// though, can contain bitmaps of varying sizes and different
// update modes)
- VirtualDevice aVDev;
- aVDev.SetOutputSizePixel( aAnimSize );
- aVDev.EnableMapMode( false );
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->SetOutputSizePixel( aAnimSize );
+ pVDev->EnableMapMode( false );
// setup mask VDev (alpha VDev is currently rather slow)
- VirtualDevice aVDevMask;
- aVDevMask.SetOutputSizePixel( aAnimSize );
- aVDevMask.EnableMapMode( false );
+ ScopedVclPtrInstance< VirtualDevice > pVDevMask;
+ pVDevMask->SetOutputSizePixel( aAnimSize );
+ pVDevMask->EnableMapMode( false );
switch( aAnimation.GetCycleMode() )
{
@@ -329,23 +329,23 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
{
case DISPOSE_NOT:
{
- aVDev.DrawBitmapEx(rAnimBmp.aPosPix,
+ pVDev->DrawBitmapEx(rAnimBmp.aPosPix,
rAnimBmp.aBmpEx);
Bitmap aMask = rAnimBmp.aBmpEx.GetMask();
if( aMask.IsEmpty() )
{
const Rectangle aRect(aEmptyPoint,
- aVDevMask.GetOutputSizePixel());
+ pVDevMask->GetOutputSizePixel());
const Wallpaper aWallpaper(COL_BLACK);
- aVDevMask.DrawWallpaper(aRect,
+ pVDevMask->DrawWallpaper(aRect,
aWallpaper);
}
else
{
BitmapEx aTmpMask = BitmapEx(aMask,
aMask);
- aVDevMask.DrawBitmapEx(rAnimBmp.aPosPix,
+ pVDevMask->DrawBitmapEx(rAnimBmp.aPosPix,
aTmpMask );
}
break;
@@ -357,35 +357,35 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
const Bitmap aMask(rAnimBmp.aBmpEx.GetMask());
const Bitmap aContent(rAnimBmp.aBmpEx.GetBitmap());
- aVDevMask.Erase();
- aVDev.DrawBitmap(rAnimBmp.aPosPix, aContent);
+ pVDevMask->Erase();
+ pVDev->DrawBitmap(rAnimBmp.aPosPix, aContent);
if(aMask.IsEmpty())
{
const Rectangle aRect(rAnimBmp.aPosPix, aContent.GetSizePixel());
- aVDevMask.SetFillColor(COL_BLACK);
- aVDevMask.SetLineColor();
- aVDevMask.DrawRect(aRect);
+ pVDevMask->SetFillColor(COL_BLACK);
+ pVDevMask->SetLineColor();
+ pVDevMask->DrawRect(aRect);
}
else
{
- aVDevMask.DrawBitmap(rAnimBmp.aPosPix, aMask);
+ pVDevMask->DrawBitmap(rAnimBmp.aPosPix, aMask);
}
break;
}
case DISPOSE_FULL:
{
- aVDev.DrawBitmapEx(rAnimBmp.aPosPix,
+ pVDev->DrawBitmapEx(rAnimBmp.aPosPix,
rAnimBmp.aBmpEx);
break;
}
case DISPOSE_PREVIOUS :
{
- aVDev.DrawBitmapEx(rAnimBmp.aPosPix,
+ pVDev->DrawBitmapEx(rAnimBmp.aPosPix,
rAnimBmp.aBmpEx);
- aVDevMask.DrawBitmap(rAnimBmp.aPosPix,
+ pVDevMask->DrawBitmap(rAnimBmp.aPosPix,
rAnimBmp.aBmpEx.GetMask());
break;
}
@@ -397,10 +397,10 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
pMtf->AddAction(
new MetaBmpExAction( aEmptyPoint,
BitmapEx(
- aVDev.GetBitmap(
+ pVDev->GetBitmap(
aEmptyPoint,
aAnimSize ),
- aVDevMask.GetBitmap(
+ pVDevMask->GetBitmap(
aEmptyPoint,
aAnimSize ))));
diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index afddec0b6b51..f026b21a8eb2 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -471,20 +471,20 @@ namespace slideshow
#else
if( avmedia::IsModel(rMimeType) )
{
- mpEventHandlerParent.reset(new vcl::Window(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL));
+ mpEventHandlerParent.reset(VclPtr<vcl::Window>::Create(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL));
mpEventHandlerParent->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
Size( aAWTRect.Width, aAWTRect.Height ) );
mpEventHandlerParent->EnablePaint(false);
mpEventHandlerParent->Show();
SystemWindowData aWinData = OpenGLContext::generateWinData(mpEventHandlerParent.get(), false);
- mpMediaWindow.reset(new SystemChildWindow(mpEventHandlerParent.get(), 0, &aWinData));
+ mpMediaWindow.reset(VclPtr<SystemChildWindow>::Create(mpEventHandlerParent.get(), 0, &aWinData));
mpMediaWindow->SetPosSizePixel( Point( 0, 0 ),
Size( aAWTRect.Width, aAWTRect.Height ) );
}
else
#endif
{
- mpMediaWindow.reset( new SystemChildWindow( pWindow, WB_CLIPCHILDREN ) );
+ mpMediaWindow.reset( VclPtr<SystemChildWindow>::Create( pWindow, WB_CLIPCHILDREN ) );
mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
Size( aAWTRect.Width, aAWTRect.Height ) );
}
diff --git a/slideshow/source/engine/shapes/viewmediashape.hxx b/slideshow/source/engine/shapes/viewmediashape.hxx
index a512a96e8c57..1dc8f32aab9e 100644
--- a/slideshow/source/engine/shapes/viewmediashape.hxx
+++ b/slideshow/source/engine/shapes/viewmediashape.hxx
@@ -26,6 +26,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
+#include <vcl/vclptr.hxx>
#include "viewlayer.hxx"
@@ -147,8 +148,8 @@ namespace slideshow
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams,
const OUString& rMimeType );
ViewLayerSharedPtr mpViewLayer;
- ::std::unique_ptr< SystemChildWindow > mpMediaWindow;
- boost::scoped_ptr< ::vcl::Window > mpEventHandlerParent;
+ VclPtr< SystemChildWindow > mpMediaWindow;
+ VclPtr< ::vcl::Window > mpEventHandlerParent;
mutable ::com::sun::star::awt::Point maWindowOffset;
mutable ::basegfx::B2DRectangle maBounds;
diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index 96dcfd61014d..c29d85ca1a87 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -96,7 +96,7 @@ class SmElementsControl : public Control
SmElementList maElementList;
Size maMaxElementDimensions;
bool mbVerticalMode;
- std::unique_ptr<ScrollBar> mxScroll;
+ VclPtr< ScrollBar > mxScroll;
void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
@@ -109,6 +109,7 @@ class SmElementsControl : public Control
public:
SmElementsControl(vcl::Window *pParent);
virtual ~SmElementsControl();
+ virtual void dispose() SAL_OVERRIDE;
void setElementSetId(sal_uInt16 aSetId);
@@ -126,8 +127,8 @@ class SmElementsDockingWindow : public SfxDockingWindow
{
static const sal_uInt16 aCategories[];
- SmElementsControl* mpElementsControl;
- ListBox* mpElementListBox;
+ VclPtr<SmElementsControl> mpElementsControl;
+ VclPtr<ListBox> mpElementListBox;
virtual void Resize() SAL_OVERRIDE;
SmViewShell* GetView();
@@ -141,6 +142,7 @@ public:
SfxChildWindow* pChildWindow,
vcl::Window* pParent );
virtual ~SmElementsDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void EndDocking( const Rectangle& rReactangle, bool bFloatMode) SAL_OVERRIDE;
virtual void ToggleFloatingMode() SAL_OVERRIDE;
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 9c3987bb91fe..8093b9be3d5c 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -52,15 +52,15 @@ void SetFontStyle(const OUString &rStyleName, vcl::Font &rFont);
class SmPrintOptionsTabPage : public SfxTabPage
{
- CheckBox* m_pTitle;
- CheckBox* m_pText;
- CheckBox* m_pFrame;
- RadioButton* m_pSizeNormal;
- RadioButton* m_pSizeScaled;
- RadioButton* m_pSizeZoomed;
- MetricField* m_pZoom;
- CheckBox* m_pNoRightSpaces;
- CheckBox* m_pSaveOnlyUsedSymbols;
+ VclPtr<CheckBox> m_pTitle;
+ VclPtr<CheckBox> m_pText;
+ VclPtr<CheckBox> m_pFrame;
+ VclPtr<RadioButton> m_pSizeNormal;
+ VclPtr<RadioButton> m_pSizeScaled;
+ VclPtr<RadioButton> m_pSizeZoomed;
+ VclPtr<MetricField> m_pZoom;
+ VclPtr<CheckBox> m_pNoRightSpaces;
+ VclPtr<CheckBox> m_pSaveOnlyUsedSymbols;
DECL_LINK(SizeButtonClickHdl, Button *);
@@ -68,9 +68,11 @@ class SmPrintOptionsTabPage : public SfxTabPage
virtual void Reset(const SfxItemSet* rSet) SAL_OVERRIDE;
public:
- static SfxTabPage* Create(vcl::Window *pWindow, const SfxItemSet &rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pWindow, const SfxItemSet &rSet);
SmPrintOptionsTabPage(vcl::Window *pParent, const SfxItemSet &rOptions);
+ virtual ~SmPrintOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
};
/**************************************************************************/
@@ -90,11 +92,11 @@ public:
class SmFontDialog : public ModalDialog
{
- ComboBox* m_pFontBox;
- VclContainer* m_pAttrFrame;
- CheckBox* m_pBoldCheckBox;
- CheckBox* m_pItalicCheckBox;
- SmShowFont* m_pShowFont;
+ VclPtr<ComboBox> m_pFontBox;
+ VclPtr<VclContainer> m_pAttrFrame;
+ VclPtr<CheckBox> m_pBoldCheckBox;
+ VclPtr<CheckBox> m_pItalicCheckBox;
+ VclPtr<SmShowFont> m_pShowFont;
vcl::Font Face;
@@ -108,6 +110,8 @@ class SmFontDialog : public ModalDialog
public:
SmFontDialog(vcl::Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes);
+ virtual ~SmFontDialog();
+ virtual void dispose() SAL_OVERRIDE;
const vcl::Font& GetFont() const { return Face; }
void SetFont(const vcl::Font &rFont);
@@ -117,18 +121,20 @@ public:
class SmFontSizeDialog : public ModalDialog
{
- MetricField* m_pBaseSize;
- MetricField* m_pTextSize;
- MetricField* m_pIndexSize;
- MetricField* m_pFunctionSize;
- MetricField* m_pOperatorSize;
- MetricField* m_pBorderSize;
- PushButton* m_pDefaultButton;
+ VclPtr<MetricField> m_pBaseSize;
+ VclPtr<MetricField> m_pTextSize;
+ VclPtr<MetricField> m_pIndexSize;
+ VclPtr<MetricField> m_pFunctionSize;
+ VclPtr<MetricField> m_pOperatorSize;
+ VclPtr<MetricField> m_pBorderSize;
+ VclPtr<PushButton> m_pDefaultButton;
DECL_LINK(DefaultButtonClickHdl, Button *);
public:
SmFontSizeDialog(vcl::Window *pParent);
+ virtual ~SmFontSizeDialog();
+ virtual void dispose() SAL_OVERRIDE;
void ReadFrom(const SmFormat &rFormat);
void WriteTo (SmFormat &rFormat) const;
@@ -138,17 +144,17 @@ public:
class SmFontTypeDialog : public ModalDialog
{
- SmFontPickListBox* m_pVariableFont;
- SmFontPickListBox* m_pFunctionFont;
- SmFontPickListBox* m_pNumberFont;
- SmFontPickListBox* m_pTextFont;
- SmFontPickListBox* m_pSerifFont;
- SmFontPickListBox* m_pSansFont;
- SmFontPickListBox* m_pFixedFont;
- MenuButton* m_pMenuButton;
- PushButton* m_pDefaultButton;
-
- OutputDevice *pFontListDev;
+ VclPtr<SmFontPickListBox> m_pVariableFont;
+ VclPtr<SmFontPickListBox> m_pFunctionFont;
+ VclPtr<SmFontPickListBox> m_pNumberFont;
+ VclPtr<SmFontPickListBox> m_pTextFont;
+ VclPtr<SmFontPickListBox> m_pSerifFont;
+ VclPtr<SmFontPickListBox> m_pSansFont;
+ VclPtr<SmFontPickListBox> m_pFixedFont;
+ VclPtr<MenuButton> m_pMenuButton;
+ VclPtr<PushButton> m_pDefaultButton;
+
+ VclPtr<OutputDevice> pFontListDev;
DECL_LINK(MenuSelectHdl, Menu *);
DECL_LINK(DefaultButtonClickHdl, Button *);
@@ -156,6 +162,8 @@ class SmFontTypeDialog : public ModalDialog
public:
SmFontTypeDialog(vcl::Window *pParent, OutputDevice *pFntListDevice);
+ virtual ~SmFontTypeDialog();
+ virtual void dispose() SAL_OVERRIDE;
void ReadFrom(const SmFormat &rFormat);
void WriteTo (SmFormat &rFormat) const;
@@ -194,19 +202,19 @@ public:
class SmDistanceDialog : public ModalDialog
{
- VclFrame* m_pFrame;
- FixedText* m_pFixedText1;
- MetricField* m_pMetricField1;
- FixedText* m_pFixedText2;
- MetricField* m_pMetricField2;
- FixedText* m_pFixedText3;
- MetricField* m_pMetricField3;
- CheckBox* m_pCheckBox1;
- FixedText* m_pFixedText4;
- MetricField* m_pMetricField4;
- MenuButton* m_pMenuButton;
- PushButton* m_pDefaultButton;
- FixedImage* m_pBitmap;
+ VclPtr<VclFrame> m_pFrame;
+ VclPtr<FixedText> m_pFixedText1;
+ VclPtr<MetricField> m_pMetricField1;
+ VclPtr<FixedText> m_pFixedText2;
+ VclPtr<MetricField> m_pMetricField2;
+ VclPtr<FixedText> m_pFixedText3;
+ VclPtr<MetricField> m_pMetricField3;
+ VclPtr<CheckBox> m_pCheckBox1;
+ VclPtr<FixedText> m_pFixedText4;
+ VclPtr<MetricField> m_pMetricField4;
+ VclPtr<MenuButton> m_pMenuButton;
+ VclPtr<PushButton> m_pDefaultButton;
+ VclPtr<FixedImage> m_pBitmap;
SmCategoryDesc *Categories[NOCATEGORIES];
sal_uInt16 nActiveCategory;
@@ -224,6 +232,7 @@ class SmDistanceDialog : public ModalDialog
public:
SmDistanceDialog(vcl::Window *pParent);
virtual ~SmDistanceDialog();
+ virtual void dispose() SAL_OVERRIDE;
void ReadFrom(const SmFormat &rFormat);
void WriteTo (SmFormat &rFormat) /*const*/;
@@ -238,15 +247,17 @@ public:
class SmAlignDialog : public ModalDialog
{
- RadioButton* m_pLeft;
- RadioButton* m_pCenter;
- RadioButton* m_pRight;
- PushButton* m_pDefaultButton;
+ VclPtr<RadioButton> m_pLeft;
+ VclPtr<RadioButton> m_pCenter;
+ VclPtr<RadioButton> m_pRight;
+ VclPtr<PushButton> m_pDefaultButton;
DECL_LINK(DefaultButtonClickHdl, Button *);
public:
SmAlignDialog(vcl::Window *pParent);
+ virtual ~SmAlignDialog();
+ virtual void dispose() SAL_OVERRIDE;
void ReadFrom(const SmFormat &rFormat);
void WriteTo (SmFormat &rFormat) const;
@@ -256,7 +267,7 @@ public:
class SmShowSymbolSetWindow : public Control
{
- ScrollBar* m_pVScrollBar;
+ VclPtr<ScrollBar> m_pVScrollBar;
SymbolPtrVec_t aSymbolSet;
Link aSelectHdlLink;
Link aDblClickHdlLink;
@@ -277,6 +288,8 @@ class SmShowSymbolSetWindow : public Control
DECL_LINK( ScrollHdl, ScrollBar* );
public:
SmShowSymbolSetWindow(vcl::Window *pParent, WinBits nStyle);
+ virtual ~SmShowSymbolSetWindow();
+ virtual void dispose() SAL_OVERRIDE;
void setScrollbar(ScrollBar *pVScrollBar);
void calccols();
void SelectSymbol(sal_uInt16 nSymbol);
@@ -288,19 +301,21 @@ public:
class SmShowSymbolSet : public VclHBox
{
- SmShowSymbolSetWindow aSymbolWindow;
- ScrollBar aVScrollBar;
+ VclPtr<SmShowSymbolSetWindow> aSymbolWindow;
+ VclPtr<ScrollBar> aVScrollBar;
public:
SmShowSymbolSet(vcl::Window *pParent);
+ virtual ~SmShowSymbolSet();
+ virtual void dispose() SAL_OVERRIDE;
- void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet) { aSymbolWindow.SetSymbolSet(rSymbolSet); }
+ void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet) { aSymbolWindow->SetSymbolSet(rSymbolSet); }
- void SelectSymbol(sal_uInt16 nSymbol) { aSymbolWindow.SelectSymbol(nSymbol); }
- sal_uInt16 GetSelectSymbol() const { return aSymbolWindow.GetSelectSymbol(); }
+ void SelectSymbol(sal_uInt16 nSymbol) { aSymbolWindow->SelectSymbol(nSymbol); }
+ sal_uInt16 GetSelectSymbol() const { return aSymbolWindow->GetSelectSymbol(); }
- void SetSelectHdl(const Link& rLink) { aSymbolWindow.SetSelectHdl(rLink); }
- void SetDblClickHdl(const Link& rLink) { aSymbolWindow.SetDblClickHdl(rLink); }
+ void SetSelectHdl(const Link& rLink) { aSymbolWindow->SetSelectHdl(rLink); }
+ void SetDblClickHdl(const Link& rLink) { aSymbolWindow->SetDblClickHdl(rLink); }
};
@@ -331,12 +346,12 @@ class SmSymDefineDialog;
class SmSymbolDialog : public ModalDialog
{
- ListBox* m_pSymbolSets;
- SmShowSymbolSet* m_pSymbolSetDisplay;
- FixedText* m_pSymbolName;
- SmShowSymbol* m_pSymbolDisplay;
- PushButton* m_pGetBtn;
- PushButton* m_pEditBtn;
+ VclPtr<ListBox> m_pSymbolSets;
+ VclPtr<SmShowSymbolSet> m_pSymbolSetDisplay;
+ VclPtr<FixedText> m_pSymbolName;
+ VclPtr<SmShowSymbol> m_pSymbolDisplay;
+ VclPtr<PushButton> m_pGetBtn;
+ VclPtr<PushButton> m_pEditBtn;
SmViewShell &rViewSh;
SmSymbolManager &rSymbolMgr;
@@ -344,7 +359,7 @@ class SmSymbolDialog : public ModalDialog
OUString aSymbolSetName;
SymbolPtrVec_t aSymbolSet;
- OutputDevice *pFontListDev;
+ VclPtr<OutputDevice> pFontListDev;
DECL_LINK(SymbolSetChangeHdl, void*);
DECL_LINK(SymbolChangeHdl, void*);
@@ -362,6 +377,8 @@ class SmSymbolDialog : public ModalDialog
public:
SmSymbolDialog(vcl::Window * pParent, OutputDevice *pFntListDevice,
SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell);
+ virtual ~SmSymbolDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool SelectSymbolSet(const OUString &rSymbolSetName);
void SelectSymbol(sal_uInt16 nSymbolPos);
@@ -389,23 +406,23 @@ public:
class SmSymDefineDialog : public ModalDialog
{
- ComboBox* pOldSymbols;
- ComboBox* pOldSymbolSets;
- SvxShowCharSet* pCharsetDisplay;
- ComboBox* pSymbols;
- ComboBox* pSymbolSets;
- ListBox* pFonts;
- ListBox* pFontsSubsetLB;
- FontStyleBox* pStyles;
- FixedText* pOldSymbolName;
- SmShowChar* pOldSymbolDisplay;
- FixedText* pOldSymbolSetName;
- FixedText* pSymbolName;
- SmShowChar* pSymbolDisplay;
- FixedText* pSymbolSetName;
- PushButton* pAddBtn;
- PushButton* pChangeBtn;
- PushButton* pDeleteBtn;
+ VclPtr<ComboBox> pOldSymbols;
+ VclPtr<ComboBox> pOldSymbolSets;
+ VclPtr<SvxShowCharSet> pCharsetDisplay;
+ VclPtr<ComboBox> pSymbols;
+ VclPtr<ComboBox> pSymbolSets;
+ VclPtr<ListBox> pFonts;
+ VclPtr<ListBox> pFontsSubsetLB;
+ VclPtr<FontStyleBox> pStyles;
+ VclPtr<FixedText> pOldSymbolName;
+ VclPtr<SmShowChar> pOldSymbolDisplay;
+ VclPtr<FixedText> pOldSymbolSetName;
+ VclPtr<FixedText> pSymbolName;
+ VclPtr<SmShowChar> pSymbolDisplay;
+ VclPtr<FixedText> pSymbolSetName;
+ VclPtr<PushButton> pAddBtn;
+ VclPtr<PushButton> pChangeBtn;
+ VclPtr<PushButton> pDeleteBtn;
SmSymbolManager aSymbolMgrCopy,
&rSymbolMgr;
@@ -455,6 +472,7 @@ class SmSymDefineDialog : public ModalDialog
public:
SmSymDefineDialog(vcl::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr);
virtual ~SmSymDefineDialog();
+ virtual void dispose() SAL_OVERRIDE;
using OutputDevice::SetFont;
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index f439b135c26c..f12060490778 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -69,13 +69,13 @@ class EditEngine;
class SmPrinterAccess
{
- Printer* pPrinter;
- OutputDevice* pRefDev;
+ VclPtr<Printer> pPrinter;
+ VclPtr<OutputDevice> pRefDev;
public:
SmPrinterAccess( SmDocShell &rDocShell );
~SmPrinterAccess();
- Printer* GetPrinter() { return pPrinter; }
- OutputDevice* GetRefDev() { return pRefDev; }
+ Printer* GetPrinter() { return pPrinter.get(); }
+ OutputDevice* GetRefDev() { return pRefDev.get(); }
};
@@ -98,8 +98,8 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
SmNode *pTree;
SfxItemPool *pEditEngineItemPool;
EditEngine *pEditEngine;
- SfxPrinter *pPrinter; //q.v. comment to SmPrinter Access!
- Printer *pTmpPrinter; //ditto
+ VclPtr<SfxPrinter> pPrinter; //q.v. comment to SmPrinter Access!
+ VclPtr<Printer> pTmpPrinter; //ditto
sal_uInt16 nModifyCount;
bool bIsFormulaArranged;
SmCursor *pCursor;
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index dfb24e945c4f..17cea6de1857 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -55,9 +55,9 @@ class SmEditWindow : public vcl::Window, public DropTargetHelper
SmCmdBoxWindow &rCmdBox;
std::unique_ptr<EditView> pEditView;
- std::unique_ptr<ScrollBar> pHScrollBar;
- std::unique_ptr<ScrollBar> pVScrollBar;
- std::unique_ptr<ScrollBarBox> pScrollBox;
+ VclPtr<ScrollBar> pHScrollBar,
+ pVScrollBar;
+ VclPtr<ScrollBarBox> pScrollBox;
Idle aModifyIdle,
aCursorMoveIdle;
ESelection aOldSelection;
@@ -92,6 +92,7 @@ class SmEditWindow : public vcl::Window, public DropTargetHelper
public:
SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin );
virtual ~SmEditWindow();
+ virtual void dispose() SAL_OVERRIDE;
SmDocShell * GetDoc();
SmViewShell * GetView();
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx
index e324fe8fb15f..4b1c61c4e72c 100644
--- a/starmath/inc/smmod.hxx
+++ b/starmath/inc/smmod.hxx
@@ -91,7 +91,7 @@ class SmModule : public SfxModule, utl::ConfigurationListener
std::unique_ptr<SmConfig> mpConfig;
std::unique_ptr<SmLocalizedSymbolData> mpLocSymbolData;
std::unique_ptr<SvtSysLocale> mpSysLocale;
- std::unique_ptr<VirtualDevice> mpVirtualDev;
+ VclPtr<VirtualDevice> mpVirtualDev;
void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
@@ -125,7 +125,7 @@ public:
//virtual methods for options dialog
virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
- virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
+ virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
};
#define SM_MOD() ( *reinterpret_cast<SmModule**>(GetAppData(SHL_SM)) )
diff --git a/starmath/inc/toolbox.hxx b/starmath/inc/toolbox.hxx
index 472fe602c1a2..1af665e78954 100644
--- a/starmath/inc/toolbox.hxx
+++ b/starmath/inc/toolbox.hxx
@@ -32,7 +32,7 @@ class SmToolBoxWindow : public SfxFloatingWindow
{
protected:
- ToolBox* m_pToolBoxCat;
+ VclPtr<ToolBox> m_pToolBoxCat;
sal_uInt16 m_nUnbinopsId;
sal_uInt16 m_nRelationsId;
sal_uInt16 m_nSetoperationsId;
@@ -42,8 +42,8 @@ protected:
sal_uInt16 m_nBracketsId;
sal_uInt16 m_nFormatId;
sal_uInt16 m_nMiscId;
- ToolBox *pToolBoxCmd;
- ToolBox *vToolBoxCategories[NUM_TBX_CATEGORIES];
+ VclPtr<ToolBox> pToolBoxCmd;
+ VclPtr<ToolBox> vToolBoxCategories[NUM_TBX_CATEGORIES];
ImageList *aImageLists [NUM_TBX_CATEGORIES + 1]; /* regular */
sal_uInt16 nActiveCategoryRID;
@@ -65,6 +65,7 @@ public:
SfxChildWindow *pChildWindow,
Window *pParent);
virtual ~SmToolBoxWindow();
+ virtual void dispose() SAL_OVERRIDE;
// Window
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 85bfbdb52194..52f6c1e1df37 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -95,6 +95,7 @@ private:
public:
SmGraphicWindow(SmViewShell* pShell);
virtual ~SmGraphicWindow();
+ virtual void dispose() SAL_OVERRIDE;
// Window
virtual void MouseButtonDown(const MouseEvent &rMEvt) SAL_OVERRIDE;
@@ -159,7 +160,7 @@ public:
class SmCmdBoxWindow : public SfxDockingWindow
{
- SmEditWindow aEdit;
+ VclPtr<SmEditWindow> aEdit;
SmEditController aController;
bool bExiting;
@@ -187,10 +188,11 @@ public:
Window *pParent);
virtual ~SmCmdBoxWindow ();
+ virtual void dispose() SAL_OVERRIDE;
void AdjustPosition();
- SmEditWindow& GetEditWindow() { return aEdit; }
+ SmEditWindow& GetEditWindow() { return *aEdit.get(); }
SmViewShell *GetView();
};
@@ -214,7 +216,7 @@ public:
SmEditWindow& GetEditWindow()
{
- return static_cast<SmCmdBoxWindow *>(pWindow)->GetEditWindow();
+ return static_cast<SmCmdBoxWindow *>(pWindow.get())->GetEditWindow();
}
};
@@ -231,7 +233,7 @@ class SmViewShell: public SfxViewShell
std::unique_ptr<SmViewShell_Impl> pImpl;
- SmGraphicWindow aGraphic;
+ VclPtr<SmGraphicWindow> aGraphic;
SmGraphicController aGraphicController;
OUString aStatusText;
@@ -268,8 +270,8 @@ protected:
void InsertFrom(SfxMedium &rMedium);
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;
virtual void Deactivate(bool IsMDIActivate) SAL_OVERRIDE;
virtual void Activate(bool IsMDIActivate) SAL_OVERRIDE;
virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize) SAL_OVERRIDE;
@@ -290,8 +292,8 @@ public:
}
SmEditWindow * GetEditWindow();
- SmGraphicWindow & GetGraphicWindow() { return aGraphic; }
- const SmGraphicWindow & GetGraphicWindow() const { return aGraphic; }
+ SmGraphicWindow & GetGraphicWindow() { return *aGraphic.get(); }
+ const SmGraphicWindow & GetGraphicWindow() const { return *aGraphic.get(); }
void SetStatusText(const OUString& rText);
diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx
index adbab3b5c091..bf5bb2edcdaa 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -149,7 +149,7 @@ public:
}
private:
SmCaretLine line;
- OutputDevice *pDev;
+ VclPtr<OutputDevice> pDev;
SmCaretPos pos;
protected:
/** Default method for computing lines for pNodes */
diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
index 5189fc223aa5..2b105cbca164 100644
--- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx
+++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
@@ -519,12 +519,12 @@ void Test::testBinomInBinHor()
pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmCursor aCursor(pTree, xDocShRef);
- VirtualDevice aOutputDevice;
+ ScopedVclPtrInstance< VirtualDevice > pOutputDevice;
// move forward (more than) enough places to be at the end
int i;
for (i = 0; i < 8; ++i)
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
// tack +d on the end, which will put the binom into an SmBinHorNode
aCursor.InsertElement(PlusElement);
@@ -547,18 +547,18 @@ void Test::testBinVerInUnary()
pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmCursor aCursor(pTree, xDocShRef);
- VirtualDevice aOutputDevice;
+ ScopedVclPtrInstance< VirtualDevice > pOutputDevice;
// move forward (more than) enough places to be at the end
int i;
for (i = 0; i < 3; ++i)
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
// select the operand
- aCursor.Move(&aOutputDevice, MoveLeft, false);
+ aCursor.Move(pOutputDevice, MoveLeft, false);
// set up a fraction
aCursor.InsertFraction();
- aCursor.Move(&aOutputDevice, MoveDown);
+ aCursor.Move(pOutputDevice, MoveDown);
aCursor.InsertText("2");
sExpected += " - { 1 over 2 } ";
@@ -576,7 +576,7 @@ void Test::testBinHorInSubSup()
pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmCursor aCursor(pTree, xDocShRef);
- VirtualDevice aOutputDevice;
+ ScopedVclPtrInstance< VirtualDevice > pOutputDevice;
// Insert an RSup expression with a BinHor for the exponent
aCursor.InsertText("a");
@@ -586,7 +586,7 @@ void Test::testBinHorInSubSup()
aCursor.InsertText("c");
// Move to the end and add d to the expression
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
aCursor.InsertElement(PlusElement);
aCursor.InsertText("d");
@@ -604,30 +604,30 @@ void Test::testUnaryInMixedNumberAsNumerator()
pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
SmCursor aCursor(pTree, xDocShRef);
- VirtualDevice aOutputDevice;
+ ScopedVclPtrInstance< VirtualDevice > pOutputDevice;
// move forward (more than) enough places to be at the end
for (size_t i = 0; i < 3; ++i)
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
// Select the whole Unary Horizontal Node
- aCursor.Move(&aOutputDevice, MoveLeft, false);
- aCursor.Move(&aOutputDevice, MoveLeft, false);
+ aCursor.Move(pOutputDevice, MoveLeft, false);
+ aCursor.Move(pOutputDevice, MoveLeft, false);
// Set up a fraction
aCursor.InsertFraction();
- aCursor.Move(&aOutputDevice, MoveDown);
+ aCursor.Move(pOutputDevice, MoveDown);
aCursor.InsertText("2");
// Move left and turn this into a mixed number
// (bad form, but this could happen right?)
- aCursor.Move(&aOutputDevice, MoveLeft);
- aCursor.Move(&aOutputDevice, MoveLeft);
+ aCursor.Move(pOutputDevice, MoveLeft);
+ aCursor.Move(pOutputDevice, MoveLeft);
aCursor.InsertText("2");
// move forward (more than) enough places to be at the end
for (size_t i = 0; i < 8; ++i)
- aCursor.Move(&aOutputDevice, MoveRight);
+ aCursor.Move(pOutputDevice, MoveRight);
// add 4 to the end
aCursor.InsertElement(PlusElement);
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 4be2fd77ac50..5de607ce30b3 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -57,8 +57,8 @@ public:
private:
SfxBindings m_aBindings;
std::unique_ptr<SfxDispatcher> m_pDispatcher;
- std::unique_ptr<SmCmdBoxWindow> m_pSmCmdBoxWindow;
- std::unique_ptr<SmEditWindow> m_pEditWindow;
+ VclPtr<SmCmdBoxWindow> m_pSmCmdBoxWindow;
+ VclPtr<SmEditWindow> m_pEditWindow;
SmDocShellRef m_xDocShRef;
SmViewShell *m_pViewShell;
};
@@ -87,17 +87,17 @@ void Test::setUp()
m_pDispatcher.reset(new SfxDispatcher(pViewFrame));
m_aBindings.SetDispatcher(m_pDispatcher.get());
m_aBindings.EnterRegistrations();
- m_pSmCmdBoxWindow.reset(new SmCmdBoxWindow(&m_aBindings, NULL, NULL));
+ m_pSmCmdBoxWindow.reset(VclPtr<SmCmdBoxWindow>::Create(&m_aBindings, nullptr, nullptr));
m_aBindings.LeaveRegistrations();
- m_pEditWindow.reset(new SmEditWindow(*m_pSmCmdBoxWindow));
+ m_pEditWindow = VclPtr<SmEditWindow>::Create(*m_pSmCmdBoxWindow);
m_pViewShell = m_pEditWindow->GetView();
CPPUNIT_ASSERT_MESSAGE("Should have a SmViewShell", m_pViewShell);
}
void Test::tearDown()
{
- m_pEditWindow.reset();
- m_pSmCmdBoxWindow.reset();
+ m_pEditWindow.disposeAndClear();
+ m_pSmCmdBoxWindow.disposeAndClear();
m_pDispatcher.reset();
m_xDocShRef->DoClose();
m_xDocShRef.Clear();
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 12eb670136a1..4a5118a5b789 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -224,7 +224,7 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
, maCurrentSetId(0)
, mpCurrentElement(NULL)
, mbVerticalMode(true)
- , mxScroll(new ScrollBar(this, WB_VERT))
+ , mxScroll(VclPtr<ScrollBar>::Create(this, WB_VERT))
{
SetMapMode( MapMode(MAP_100TH_MM) );
SetDrawMode( DRAWMODE_DEFAULT );
@@ -239,7 +239,14 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
SmElementsControl::~SmElementsControl()
{
+ disposeOnce();
+}
+
+void SmElementsControl::dispose()
+{
mpDocShell->DoClose();
+ mxScroll.disposeAndClear();
+ Control::dispose();
}
void SmElementsControl::setVerticalMode(bool bVerticalMode)
@@ -646,7 +653,7 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf
SfxDockingWindow(pInputBindings, pChildWindow, pParent, "DockingElements",
"modules/smath/ui/dockingelements.ui")
{
- mpElementsControl = new SmElementsControl(get<vcl::Window>("box"));
+ mpElementsControl = VclPtr<SmElementsControl>::Create(get<vcl::Window>("box"));
mpElementsControl->set_hexpand(true);
mpElementsControl->set_vexpand(true);
mpElementsControl->Show();
@@ -672,7 +679,14 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf
SmElementsDockingWindow::~SmElementsDockingWindow ()
{
- delete mpElementsControl;
+ disposeOnce();
+}
+
+void SmElementsDockingWindow::dispose()
+{
+ mpElementsControl.disposeAndClear();
+ mpElementListBox.clear();
+ SfxDockingWindow::dispose();
}
void SmElementsDockingWindow::ToggleFloatingMode()
@@ -755,8 +769,8 @@ SmElementsDockingWindowWrapper::SmElementsDockingWindowWrapper(
SfxBindings *pBindings, SfxChildWinInfo *pInfo) :
SfxChildWindow(pParentWindow, nId)
{
- SmElementsDockingWindow* pDialog = new SmElementsDockingWindow(pBindings, this, pParentWindow);
- pWindow = pDialog;
+ VclPtrInstance<SmElementsDockingWindow> pDialog(pBindings, this, pParentWindow);
+ pWindow.reset(pDialog);
pDialog->setDeferredProperties();
pDialog->SetPosSizePixel(Point(0, 0), Size(300, 0));
pDialog->Show();
diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx
index ddac5836432f..b626064647b4 100644
--- a/starmath/source/accessibility.hxx
+++ b/starmath/source/accessibility.hxx
@@ -70,7 +70,7 @@ class SmGraphicAccessible :
/// client id in the AccessibleEventNotifier queue
sal_uInt32 nClientId;
- SmGraphicWindow *pWin;
+ VclPtr<SmGraphicWindow> pWin;
SmGraphicAccessible( const SmGraphicAccessible & ) SAL_DELETED_FUNCTION;
SmGraphicAccessible & operator = ( const SmGraphicAccessible & ) SAL_DELETED_FUNCTION;
@@ -316,7 +316,7 @@ class SmEditAccessible :
{
OUString aAccName;
::accessibility::AccessibleTextHelper *pTextHelper;
- SmEditWindow *pWin;
+ VclPtr<SmEditWindow> pWin;
SmEditAccessible( const SmEditAccessible & ) SAL_DELETED_FUNCTION;
SmEditAccessible & operator = ( const SmEditAccessible & ) SAL_DELETED_FUNCTION;
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index b942d2bc6adc..a78f528978ef 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -177,6 +177,25 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(vcl::Window *pParent, const SfxItem
Reset(&rOptions);
}
+SmPrintOptionsTabPage::~SmPrintOptionsTabPage()
+{
+ disposeOnce();
+}
+
+void SmPrintOptionsTabPage::dispose()
+{
+ m_pTitle.clear();
+ m_pText.clear();
+ m_pFrame.clear();
+ m_pSizeNormal.clear();
+ m_pSizeScaled.clear();
+ m_pSizeZoomed.clear();
+ m_pZoom.clear();
+ m_pNoRightSpaces.clear();
+ m_pSaveOnlyUsedSymbols.clear();
+ SfxTabPage::dispose();
+}
+
bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet)
{
@@ -220,9 +239,9 @@ void SmPrintOptionsTabPage::Reset(const SfxItemSet* rSet)
}
-SfxTabPage* SmPrintOptionsTabPage::Create(vcl::Window* pWindow, const SfxItemSet& rSet)
+VclPtr<SfxTabPage> SmPrintOptionsTabPage::Create(vcl::Window* pWindow, const SfxItemSet& rSet)
{
- return (new SmPrintOptionsTabPage(pWindow, rSet));
+ return VclPtr<SmPrintOptionsTabPage>::Create(pWindow, rSet).get();
}
/**************************************************************************/
@@ -366,6 +385,21 @@ SmFontDialog::SmFontDialog(vcl::Window * pParent, OutputDevice *pFntListDevice,
}
}
+SmFontDialog::~SmFontDialog()
+{
+ disposeOnce();
+}
+
+void SmFontDialog::dispose()
+{
+ m_pFontBox.clear();
+ m_pAttrFrame.clear();
+ m_pBoldCheckBox.clear();
+ m_pItalicCheckBox.clear();
+ m_pShowFont.clear();
+ ModalDialog::dispose();
+}
+
namespace
{
void getColors(vcl::Window &rRef, ColorData &rBgCol, ColorData &rTxtCol)
@@ -441,6 +475,23 @@ SmFontSizeDialog::SmFontSizeDialog(vcl::Window * pParent)
m_pDefaultButton->SetClickHdl(LINK(this, SmFontSizeDialog, DefaultButtonClickHdl));
}
+SmFontSizeDialog::~SmFontSizeDialog()
+{
+ disposeOnce();
+}
+
+void SmFontSizeDialog::dispose()
+{
+ m_pBaseSize.clear();
+ m_pTextSize.clear();
+ m_pIndexSize.clear();
+ m_pFunctionSize.clear();
+ m_pOperatorSize.clear();
+ m_pBorderSize.clear();
+ m_pDefaultButton.clear();
+ ModalDialog::dispose();
+}
+
void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat)
{
@@ -496,7 +547,7 @@ IMPL_LINK( SmFontTypeDialog, MenuSelectHdl, Menu *, pMenu )
if (pActiveListBox)
{
- std::unique_ptr<SmFontDialog> pFontDialog(new SmFontDialog(this, pFontListDev, bHideCheckboxes));
+ ScopedVclPtrInstance<SmFontDialog> pFontDialog(this, pFontListDev, bHideCheckboxes);
pActiveListBox->WriteTo(*pFontDialog);
if (pFontDialog->Execute() == RET_OK)
@@ -538,6 +589,25 @@ SmFontTypeDialog::SmFontTypeDialog(vcl::Window * pParent, OutputDevice *pFntList
m_pMenuButton->GetPopupMenu()->SetSelectHdl(LINK(this, SmFontTypeDialog, MenuSelectHdl));
}
+SmFontTypeDialog::~SmFontTypeDialog()
+{
+ disposeOnce();
+}
+
+void SmFontTypeDialog::dispose()
+{
+ m_pVariableFont.clear();
+ m_pFunctionFont.clear();
+ m_pNumberFont.clear();
+ m_pTextFont.clear();
+ m_pSerifFont.clear();
+ m_pSansFont.clear();
+ m_pFixedFont.clear();
+ m_pMenuButton.clear();
+ m_pDefaultButton.clear();
+ ModalDialog::dispose();
+}
+
void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat)
{
SmModule *pp = SM_MOD();
@@ -891,8 +961,27 @@ SmDistanceDialog::SmDistanceDialog(vcl::Window *pParent)
SmDistanceDialog::~SmDistanceDialog()
{
+ disposeOnce();
+}
+
+void SmDistanceDialog::dispose()
+{
for (int i = 0; i < NOCATEGORIES; i++)
DELETEZ(Categories[i]);
+ m_pFrame.clear();
+ m_pFixedText1.clear();
+ m_pMetricField1.clear();
+ m_pFixedText2.clear();
+ m_pMetricField2.clear();
+ m_pFixedText3.clear();
+ m_pMetricField3.clear();
+ m_pCheckBox1.clear();
+ m_pFixedText4.clear();
+ m_pMetricField4.clear();
+ m_pMenuButton.clear();
+ m_pDefaultButton.clear();
+ m_pBitmap.clear();
+ ModalDialog::dispose();
}
void SmDistanceDialog::DataChanged( const DataChangedEvent &rEvt )
@@ -995,6 +1084,19 @@ SmAlignDialog::SmAlignDialog(vcl::Window * pParent)
m_pDefaultButton->SetClickHdl(LINK(this, SmAlignDialog, DefaultButtonClickHdl));
}
+SmAlignDialog::~SmAlignDialog()
+{
+ disposeOnce();
+}
+
+void SmAlignDialog::dispose()
+{
+ m_pLeft.clear();
+ m_pCenter.clear();
+ m_pRight.clear();
+ m_pDefaultButton.clear();
+ ModalDialog::dispose();
+}
void SmAlignDialog::ReadFrom(const SmFormat &rFormat)
{
@@ -1054,6 +1156,17 @@ SmShowSymbolSetWindow::SmShowSymbolSetWindow(vcl::Window *pParent, WinBits nStyl
SetTextColor( aTxtColor );
}
+SmShowSymbolSetWindow::~SmShowSymbolSetWindow()
+{
+ disposeOnce();
+}
+
+void SmShowSymbolSetWindow::dispose()
+{
+ m_pVScrollBar.clear();
+ Control::dispose();
+}
+
Point SmShowSymbolSetWindow::OffsetPoint(const Point &rPoint) const
{
return Point(rPoint.X() + nXOffset, rPoint.Y() + nYOffset);
@@ -1181,14 +1294,26 @@ void SmShowSymbolSetWindow::setScrollbar(ScrollBar *pVScrollBar)
SmShowSymbolSet::SmShowSymbolSet(vcl::Window *pParent)
: VclHBox(pParent, false, 6)
- , aSymbolWindow(this, WB_TABSTOP)
- , aVScrollBar(this, WinBits(WB_VSCROLL))
+ , aSymbolWindow(VclPtr<SmShowSymbolSetWindow>::Create(this, WB_TABSTOP))
+ , aVScrollBar(VclPtr<ScrollBar>::Create(this, WinBits(WB_VSCROLL)))
+{
+ aSymbolWindow->set_hexpand(true);
+ aSymbolWindow->set_vexpand(true);
+ aSymbolWindow->setScrollbar(aVScrollBar.get());
+ aSymbolWindow->calccols();
+ aSymbolWindow->Show();
+}
+
+SmShowSymbolSet::~SmShowSymbolSet()
+{
+ disposeOnce();
+}
+
+void SmShowSymbolSet::dispose()
{
- aSymbolWindow.set_hexpand(true);
- aSymbolWindow.set_vexpand(true);
- aSymbolWindow.setScrollbar(&aVScrollBar);
- aSymbolWindow.calccols();
- aSymbolWindow.Show();
+ aSymbolWindow.disposeAndClear();
+ aVScrollBar.disposeAndClear();
+ VclHBox::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSmShowSymbolSet(vcl::Window *pParent, VclBuilder::stringmap &)
@@ -1379,7 +1504,7 @@ IMPL_LINK_NOARG( SmSymbolDialog, SymbolChangeHdl )
IMPL_LINK_NOARG(SmSymbolDialog, EditClickHdl)
{
- std::unique_ptr<SmSymDefineDialog> pDialog(new SmSymDefineDialog(this, pFontListDev, rSymbolMgr));
+ ScopedVclPtrInstance<SmSymDefineDialog> pDialog(this, pFontListDev, rSymbolMgr);
// set current symbol and SymbolSet for the new dialog
const OUString aSymSetName (m_pSymbolSets->GetSelectEntry()),
@@ -1483,6 +1608,21 @@ SmSymbolDialog::SmSymbolDialog(vcl::Window *pParent, OutputDevice *pFntListDevic
m_pGetBtn->SetClickHdl(LINK(this, SmSymbolDialog, GetClickHdl));
}
+SmSymbolDialog::~SmSymbolDialog()
+{
+ disposeOnce();
+}
+
+void SmSymbolDialog::dispose()
+{
+ m_pSymbolSets.clear();
+ m_pSymbolSetDisplay.clear();
+ m_pSymbolName.clear();
+ m_pSymbolDisplay.clear();
+ m_pGetBtn.clear();
+ m_pEditBtn.clear();
+ ModalDialog::dispose();
+}
void SmSymbolDialog::InitColor_Impl()
{
@@ -2032,6 +2172,31 @@ SmSymDefineDialog::SmSymDefineDialog(vcl::Window * pParent,
SmSymDefineDialog::~SmSymDefineDialog()
{
+ disposeOnce();
+}
+
+void SmSymDefineDialog::dispose()
+{
+ pSubsetMap.reset();
+ pOrigSymbol.reset();
+ pOldSymbols.clear();
+ pOldSymbolSets.clear();
+ pCharsetDisplay.clear();
+ pSymbols.clear();
+ pSymbolSets.clear();
+ pFonts.clear();
+ pFontsSubsetLB.clear();
+ pStyles.clear();
+ pOldSymbolName.clear();
+ pOldSymbolDisplay.clear();
+ pOldSymbolSetName.clear();
+ pSymbolName.clear();
+ pSymbolDisplay.clear();
+ pSymbolSetName.clear();
+ pAddBtn.clear();
+ pChangeBtn.clear();
+ pDeleteBtn.clear();
+ ModalDialog::dispose();
}
void SmSymDefineDialog::InitColor_Impl()
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 73e4fa47f2d5..c96cd46c8173 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -531,7 +531,7 @@ SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
}
}
}
- if ( 0 != (pRefDev = rDocShell.GetRefDev()) && pPrinter != pRefDev )
+ if ( !!(pRefDev = rDocShell.GetRefDev()) && pPrinter.get() != pRefDev.get() )
{
pRefDev->Push( PushFlags::MAPMODE );
if ( SfxObjectCreateMode::EMBEDDED == rDocShell.GetCreateMode() )
@@ -595,7 +595,7 @@ Printer* SmDocShell::GetPrt()
SmModule *pp = SM_MOD();
pp->GetConfig()->ConfigToItemSet(*pOptions);
- pPrinter = new SfxPrinter(pOptions);
+ pPrinter = VclPtr<SfxPrinter>::Create(pOptions);
pPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
}
return pPrinter;
@@ -616,7 +616,7 @@ OutputDevice* SmDocShell::GetRefDev()
void SmDocShell::SetPrinter( SfxPrinter *pNew )
{
- delete pPrinter;
+ pPrinter.disposeAndClear();
pPrinter = pNew; //Transfer ownership
pPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
SetFormulaArranged(false);
@@ -693,7 +693,7 @@ SmDocShell::~SmDocShell()
delete pEditEngine;
SfxItemPool::Free(pEditEngineItemPool);
delete pTree;
- delete pPrinter;
+ pPrinter.disposeAndClear();
}
bool SmDocShell::ConvertFrom(SfxMedium &rMedium)
@@ -989,7 +989,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
pDev = &SM_MOD()->GetDefaultVirtualDev();
OSL_ENSURE (pDev, "device for font list missing" );
- std::unique_ptr<SmFontTypeDialog> xFontTypeDialog(new SmFontTypeDialog( NULL, pDev ));
+ VclPtrInstance< SmFontTypeDialog > xFontTypeDialog( nullptr, pDev );
SmFormat aOldFormat = GetFormat();
xFontTypeDialog->ReadFrom( aOldFormat );
@@ -1011,7 +1011,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_FONTSIZE:
{
- std::unique_ptr<SmFontSizeDialog> xFontSizeDialog(new SmFontSizeDialog(NULL));
+ VclPtrInstance< SmFontSizeDialog > xFontSizeDialog(nullptr);
SmFormat aOldFormat = GetFormat();
xFontSizeDialog->ReadFrom( aOldFormat );
@@ -1034,7 +1034,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_DISTANCE:
{
- std::unique_ptr<SmDistanceDialog> xDistanceDialog(new SmDistanceDialog(NULL));
+ VclPtrInstance< SmDistanceDialog > xDistanceDialog(nullptr);
SmFormat aOldFormat = GetFormat();
xDistanceDialog->ReadFrom( aOldFormat );
@@ -1057,7 +1057,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_ALIGN:
{
- std::unique_ptr<SmAlignDialog> xAlignDialog(new SmAlignDialog(NULL));
+ VclPtrInstance< SmAlignDialog > xAlignDialog(nullptr);
SmFormat aOldFormat = GetFormat();
xAlignDialog->ReadFrom( aOldFormat );
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 34d4ecd29e0e..fa9ebaa138f9 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -95,7 +95,7 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) :
SetMapMode(MAP_PIXEL);
// Even RTL languages don't use RTL for math
- rCmdBox.GetEditWindow().EnableRTL( false );
+ EnableRTL( false );
ApplyColorConfigValues( SM_MOD()->GetColorConfig() );
@@ -119,6 +119,11 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) :
SmEditWindow::~SmEditWindow()
{
+ disposeOnce();
+}
+
+void SmEditWindow::dispose()
+{
aModifyIdle.Stop();
StartCursorMove();
@@ -127,9 +132,13 @@ SmEditWindow::~SmEditWindow()
// must be done before EditView (and thus EditEngine) is no longer
// available for those classes.
if (pAccessible)
+ {
pAccessible->ClearWin(); // make Accessible defunctional
+ pAccessible = NULL;
+ xAccessible.clear();
+ }
// Note: memory for pAccessible will be freed when the reference
- // xAccessible is released.
+ // xAccessible is released. FIXME: horribly redundant lifecycle ! ...
if (pEditView)
{
@@ -139,7 +148,14 @@ SmEditWindow::~SmEditWindow()
pEditEngine->SetStatusEventHdl( Link() );
pEditEngine->RemoveView( pEditView.get() );
}
+ pEditView.reset();
}
+
+ pHScrollBar.disposeAndClear();
+ pVScrollBar.disposeAndClear();
+ pScrollBox.disposeAndClear();
+
+ vcl::Window::dispose();
}
void SmEditWindow::StartCursorMove()
@@ -534,11 +550,11 @@ void SmEditWindow::CreateEditView()
pEditEngine->InsertView( pEditView.get() );
if (!pVScrollBar)
- pVScrollBar.reset(new ScrollBar(this, WinBits(WB_VSCROLL)));
+ pVScrollBar = VclPtr<ScrollBar>::Create(this, WinBits(WB_VSCROLL));
if (!pHScrollBar)
- pHScrollBar.reset(new ScrollBar(this, WinBits(WB_HSCROLL)));
+ pHScrollBar = VclPtr<ScrollBar>::Create(this, WinBits(WB_HSCROLL));
if (!pScrollBox)
- pScrollBox.reset(new ScrollBarBox(this));
+ pScrollBox = VclPtr<ScrollBarBox>::Create(this);
pVScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
pHScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
pVScrollBar->EnableDrag( true );
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 4c0e5e104f5d..ab09940a38ae 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -174,6 +174,7 @@ SmModule::~SmModule()
{
if (mpColorConfig)
mpColorConfig->RemoveListener(this);
+ mpVirtualDev.disposeAndClear();
}
void SmModule::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg )
@@ -241,7 +242,7 @@ VirtualDevice &SmModule::GetDefaultVirtualDev()
{
if (!mpVirtualDev)
{
- mpVirtualDev.reset(new VirtualDevice);
+ mpVirtualDev.reset( VclPtr<VirtualDevice>::Create() );
mpVirtualDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
}
return *mpVirtualDev;
@@ -287,9 +288,9 @@ void SmModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
GetConfig()->ItemSetToConfig(rSet);
}
}
-SfxTabPage* SmModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
+VclPtr<SfxTabPage> SmModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
{
- SfxTabPage* pRet = 0;
+ VclPtr<SfxTabPage> pRet;
if(nId == SID_SM_TP_PRINTOPTIONS)
pRet = SmPrintOptionsTabPage::Create( pParent, rSet );
return pRet;
diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx
index d6ff88adbab8..26a1fbe7db23 100644
--- a/starmath/source/toolbox.cxx
+++ b/starmath/source/toolbox.cxx
@@ -127,7 +127,7 @@ SmToolBoxWindow::SmToolBoxWindow(SfxBindings *pTmpBindings,
sal_uInt16 i;
for (i = 0; i < NUM_TBX_CATEGORIES; ++i)
{
- ToolBox *pBox = new ToolBox(get<vcl::Window>("box"), SmResId( TOOLBOX_CAT_A + i ));
+ VclPtrInstance<ToolBox> pBox(get<vcl::Window>("box"), SmResId( TOOLBOX_CAT_A + i ));
vToolBoxCategories[i] = pBox;
pBox->SetSelectHdl(LINK(this, SmToolBoxWindow, CmdSelectHdl));
}
@@ -139,14 +139,24 @@ SmToolBoxWindow::SmToolBoxWindow(SfxBindings *pTmpBindings,
SmToolBoxWindow::~SmToolBoxWindow()
{
+ disposeOnce();
+}
+
+void SmToolBoxWindow::dispose()
+{
int i;
for (i = 0; i < NUM_TBX_CATEGORIES; ++i)
- {
- ToolBox *pBox = vToolBoxCategories[i];
- delete pBox;
- }
+ vToolBoxCategories[i].disposeAndClear();
+
+ pToolBoxCmd = 0;
for (i = 0; i < NUM_TBX_CATEGORIES + 1; ++i)
+ {
delete aImageLists[i];
+ aImageLists[i] = 0;
+ }
+ m_pToolBoxCat.clear();
+ pToolBoxCmd.clear();
+ SfxFloatingWindow::dispose();
}
SmViewShell * SmToolBoxWindow::GetView()
@@ -351,8 +361,8 @@ SmToolBoxWrapper::SmToolBoxWrapper(vcl::Window *pParentWindow,
{
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- pWindow = new SmToolBoxWindow(pBindings, this, pParentWindow);
- static_cast<SfxFloatingWindow *>(pWindow)->Initialize(pInfo);
+ pWindow.reset(VclPtr<SmToolBoxWindow>::Create(pBindings, this, pParentWindow));
+ static_cast<SfxFloatingWindow *>(pWindow.get())->Initialize(pInfo);
}
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index f4bfcab8b8a9..74edb409a8a5 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -604,11 +604,11 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
{
if ( !sPrinterName.isEmpty() )
{
- SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
+ VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
if (pNewPrinter->IsKnown())
pDocSh->SetPrinter ( pNewPrinter );
else
- delete pNewPrinter;
+ pNewPrinter.disposeAndClear();
}
}
else
@@ -639,7 +639,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange );
SmModule *pp = SM_MOD();
pp->GetConfig()->ConfigToItemSet(*pItemSet);
- SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+ VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, pItemSet );
pDocSh->SetPrinter( pPrinter );
}
@@ -1020,8 +1020,8 @@ void SAL_CALL SmModel::render(
if (xRenderDevice.is())
{
VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
- OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
-
+ VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice()
+ : VclPtr< OutputDevice >();
if (!pOut)
throw RuntimeException();
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 4b22180b6ac3..e3b5f6f64df2 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -119,11 +119,17 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
SmGraphicWindow::~SmGraphicWindow()
{
+ disposeOnce();
+}
+
+void SmGraphicWindow::dispose()
+{
if (pAccessible)
pAccessible->ClearWin(); // make Accessible defunctional
// Note: memory for pAccessible will be freed when the reference
// xAccessible is released.
CaretBlinkStop();
+ ScrollableWindow::dispose();
}
void SmGraphicWindow::StateChanged( StateChangedType eType )
@@ -706,8 +712,8 @@ void SmEditController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const
SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWindow,
vcl::Window *pParent) :
SfxDockingWindow(pBindings_, pChildWindow, pParent, WB_MOVEABLE|WB_CLOSEABLE|WB_SIZEABLE|WB_DOCKABLE),
- aEdit (*this),
- aController (aEdit, SID_TEXT, *pBindings_),
+ aEdit (VclPtr<SmEditWindow>::Create(*this)),
+ aController (*(aEdit.get()), SID_TEXT, *pBindings_),
bExiting (false)
{
SetHelpId( HID_SMA_COMMAND_WIN );
@@ -722,8 +728,15 @@ SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWi
SmCmdBoxWindow::~SmCmdBoxWindow ()
{
+ disposeOnce();
+}
+
+void SmCmdBoxWindow::dispose()
+{
aInitialFocusTimer.Stop();
bExiting = true;
+ aEdit.disposeAndClear();
+ SfxDockingWindow::dispose();
}
SmViewShell * SmCmdBoxWindow::GetView()
@@ -744,7 +757,7 @@ void SmCmdBoxWindow::Resize()
DecorationView aView(this);
aRect = aView.DrawFrame( aRect, FRAME_DRAW_IN | FRAME_DRAW_NODRAW );
- aEdit.SetPosSizePixel(aRect.TopLeft(), aRect.GetSize());
+ aEdit->SetPosSizePixel(aRect.TopLeft(), aRect.GetSize());
SfxDockingWindow::Resize();
Invalidate();
}
@@ -824,7 +837,7 @@ IMPL_LINK( SmCmdBoxWindow, InitialFocusTimerHdl, Timer *, EMPTYARG /*pTimer*/ )
{
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( comphelper::getProcessComponentContext() );
- aEdit.GrabFocus();
+ aEdit->GrabFocus();
bool bInPlace = GetView()->GetViewFrame()->GetFrame().IsInPlace();
uno::Reference< frame::XFrame > xFrame( GetBindings().GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface());
@@ -876,7 +889,7 @@ void SmCmdBoxWindow::ToggleFloatingMode()
void SmCmdBoxWindow::GetFocus()
{
if (!bExiting)
- aEdit.GrabFocus();
+ aEdit->GrabFocus();
}
/**************************************************************************/
@@ -889,11 +902,11 @@ SmCmdBoxWrapper::SmCmdBoxWrapper(vcl::Window *pParentWindow, sal_uInt16 nId,
SfxChildWinInfo *pInfo) :
SfxChildWindow(pParentWindow, nId)
{
- pWindow = new SmCmdBoxWindow(pBindings, this, pParentWindow);
+ pWindow.reset(VclPtr<SmCmdBoxWindow>::Create(pBindings, this, pParentWindow));
// make window docked to the bottom initially (after first start)
eChildAlignment = SfxChildAlignment::BOTTOM;
- static_cast<SfxDockingWindow *>(pWindow)->Initialize(pInfo);
+ static_cast<SfxDockingWindow *>(pWindow.get())->Initialize(pInfo);
}
@@ -936,7 +949,7 @@ SFX_IMPL_NAMED_VIEWFACTORY(SmViewShell, "Default")
void SmViewShell::AdjustPosSizePixel(const Point &rPos, const Size &rSize)
{
- aGraphic.SetPosSizePixel(rPos, rSize);
+ aGraphic->SetPosSizePixel(rPos, rSize);
}
@@ -1338,8 +1351,8 @@ bool SmViewShell::HasPrintOptionsPage() const
return true;
}
-SfxTabPage* SmViewShell::CreatePrintOptionsPage(vcl::Window *pParent,
- const SfxItemSet &rOptions)
+VclPtr<SfxTabPage> SmViewShell::CreatePrintOptionsPage(vcl::Window *pParent,
+ const SfxItemSet &rOptions)
{
return SmPrintOptionsTabPage::Create(pParent, rOptions);
}
@@ -1508,16 +1521,16 @@ void SmViewShell::Execute(SfxRequest& rReq)
break;
case SID_ZOOM_OPTIMAL:
- aGraphic.ZoomToFitInWindow();
+ aGraphic->ZoomToFitInWindow();
break;
case SID_ZOOMIN:
- aGraphic.SetZoom(aGraphic.GetZoom() + 25);
+ aGraphic->SetZoom(aGraphic->GetZoom() + 25);
break;
case SID_ZOOMOUT:
- SAL_WARN_IF( aGraphic.GetZoom() < 25, "starmath", "incorrect sal_uInt16 argument" );
- aGraphic.SetZoom(aGraphic.GetZoom() - 25);
+ SAL_WARN_IF( aGraphic->GetZoom() < 25, "starmath", "incorrect sal_uInt16 argument" );
+ aGraphic->SetZoom(aGraphic->GetZoom() - 25);
break;
case SID_COPYOBJECT:
@@ -1730,7 +1743,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
if ( !pSet )
{
SfxItemSet aSet( GetDoc()->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM);
- aSet.Put( SvxZoomItem( SvxZoomType::PERCENT, aGraphic.GetZoom()));
+ aSet.Put( SvxZoomItem( SvxZoomType::PERCENT, aGraphic->GetZoom()));
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
@@ -1747,11 +1760,11 @@ void SmViewShell::Execute(SfxRequest& rReq)
switch( rZoom.GetType() )
{
case SvxZoomType::PERCENT:
- aGraphic.SetZoom((sal_uInt16)rZoom.GetValue ());
+ aGraphic->SetZoom((sal_uInt16)rZoom.GetValue ());
break;
case SvxZoomType::OPTIMAL:
- aGraphic.ZoomToFitInWindow();
+ aGraphic->ZoomToFitInWindow();
break;
case SvxZoomType::PAGEWIDTH:
@@ -1766,7 +1779,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap));
sal_uInt16 nZ = (sal_uInt16) std::min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()),
(long)Fraction(OutputSize.Height() * 100L, GraphicSize.Height()));
- aGraphic.SetZoom (nZ);
+ aGraphic->SetZoom (nZ);
break;
}
default:
@@ -1785,7 +1798,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
if ( pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem ) )
{
const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue();
- aGraphic.SetZoom( nCurrentZoom );
+ aGraphic->SetZoom( nCurrentZoom );
}
}
break;
@@ -1858,7 +1871,7 @@ void SmViewShell::GetState(SfxItemSet &rSet)
break;
case SID_ATTR_ZOOM:
- rSet.Put(SvxZoomItem( SvxZoomType::PERCENT, aGraphic.GetZoom()));
+ rSet.Put(SvxZoomItem( SvxZoomType::PERCENT, aGraphic->GetZoom()));
/* no break here */
case SID_ZOOMIN:
case SID_ZOOMOUT:
@@ -1869,7 +1882,7 @@ void SmViewShell::GetState(SfxItemSet &rSet)
case SID_ATTR_ZOOMSLIDER :
{
- const sal_uInt16 nCurrentZoom = aGraphic.GetZoom();
+ const sal_uInt16 nCurrentZoom = aGraphic->GetZoom();
SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM );
aZoomSliderItem.AddSnappingPoint( 100 );
rSet.Put( aZoomSliderItem );
@@ -1927,13 +1940,13 @@ void SmViewShell::GetState(SfxItemSet &rSet)
SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *)
: SfxViewShell(pFrame_, SfxViewShellFlags::HAS_PRINTOPTIONS | SfxViewShellFlags::CAN_PRINT)
, pImpl(new SmViewShell_Impl)
- , aGraphic(this)
- , aGraphicController(aGraphic, SID_GAPHIC_SM, pFrame_->GetBindings())
+ , aGraphic(VclPtr<SmGraphicWindow>::Create(this))
+ , aGraphicController(*aGraphic.get(), SID_GAPHIC_SM, pFrame_->GetBindings())
, bPasteState(false)
, bInsertIntoEditWindow(false)
{
SetStatusText(OUString());
- SetWindow(&aGraphic);
+ SetWindow(aGraphic.get());
SfxShell::SetName(OUString("SmView"));
SfxShell::SetUndoManager( &GetDoc()->GetEditEngine().GetUndoManager() );
SetHelpId( HID_SMA_VIEWSHELL_DOCUMENT );
@@ -1948,6 +1961,7 @@ SmViewShell::~SmViewShell()
SmEditWindow *pEditWin = GetEditWindow();
if (pEditWin)
pEditWin->DeleteEditView( *this );
+ aGraphic.disposeAndClear();
}
void SmViewShell::Deactivate( bool bIsMDIActivate )
diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx
index c12e7449a725..b4b75782e17c 100644
--- a/svtools/inc/roadmap.hxx
+++ b/svtools/inc/roadmap.hxx
@@ -58,6 +58,7 @@ namespace svt
public:
ORoadmap( vcl::Window* _pParent, WinBits _nWinStyle = 0 );
virtual ~ORoadmap( );
+ virtual void dispose() SAL_OVERRIDE;
void SetRoadmapBitmap( const BitmapEx& maBitmap, bool _bInvalidate = true );
diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx
index e4b7cbf26cea..22242efc5304 100644
--- a/svtools/inc/table/tablecontrol.hxx
+++ b/svtools/inc/table/tablecontrol.hxx
@@ -64,6 +64,7 @@ namespace svt { namespace table
public:
TableControl( vcl::Window* _pParent, WinBits _nStyle );
virtual ~TableControl();
+ virtual void dispose() SAL_OVERRIDE;
/// sets a new table model
void SetModel( PTableModel _pModel );
diff --git a/svtools/inc/vclxaccessibleheaderbar.hxx b/svtools/inc/vclxaccessibleheaderbar.hxx
index ff750f9b6aee..4fcfd9e99536 100644
--- a/svtools/inc/vclxaccessibleheaderbar.hxx
+++ b/svtools/inc/vclxaccessibleheaderbar.hxx
@@ -36,7 +36,7 @@ class VCLXAccessibleHeaderBar : public VCLXAccessibleComponent
{
public:
- HeaderBar* m_pHeadBar;
+ VclPtr<HeaderBar> m_pHeadBar;
virtual ~VCLXAccessibleHeaderBar();
virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
diff --git a/svtools/inc/vclxaccessibleheaderbaritem.hxx b/svtools/inc/vclxaccessibleheaderbaritem.hxx
index 301036cb04b5..727c2e7a8177 100644
--- a/svtools/inc/vclxaccessibleheaderbaritem.hxx
+++ b/svtools/inc/vclxaccessibleheaderbaritem.hxx
@@ -25,6 +25,7 @@
#include <cppuhelper/implbase2.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
@@ -53,7 +54,7 @@ class VCLXAccessibleHeaderBarItem : public AccessibleExtendedComponentHelper_
{
private:
VCLExternalSolarLock* m_pExternalLock;
- HeaderBar* m_pHeadBar;
+ VclPtr<HeaderBar> m_pHeadBar;
sal_Int32 m_nIndexInParent;
protected:
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 4f87dfd563d5..04664e5e4b4a 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -36,7 +36,7 @@
#define SCROLL_FLAGS (SCROLL_CLIP | SCROLL_NOCHILDREN)
-#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin))
+#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin.get()))
using namespace com::sun::star::accessibility::AccessibleEventId;
using namespace com::sun::star::accessibility::AccessibleTableModelChangeType;
@@ -58,8 +58,6 @@ namespace
}
}
-
-
void BrowseBox::ConstructImpl( BrowserMode nMode )
{
OSL_TRACE( "BrowseBox: %p->ConstructImpl", this );
@@ -68,7 +66,7 @@ void BrowseBox::ConstructImpl( BrowserMode nMode )
pDataWin = 0;
pVScroll = 0;
- pDataWin = new BrowserDataWin( this );
+ pDataWin = VclPtr<BrowserDataWin>::Create( this ).get();
pCols = new BrowserColumns;
m_pImpl.reset( new ::svt::BrowseBoxImpl() );
@@ -101,9 +99,9 @@ void BrowseBox::ConstructImpl( BrowserMode nMode )
nControlAreaWidth = USHRT_MAX;
uRow.nSel = BROWSER_ENDOFSELECTION;
- aHScroll.SetLineSize(1);
- aHScroll.SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
- aHScroll.SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
+ aHScroll->SetLineSize(1);
+ aHScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
+ aHScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
pDataWin->Show();
SetMode( nMode );
@@ -119,7 +117,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode )
:Control( pParent, nBits | WB_3DLOOK )
,DragSourceHelper( this )
,DropTargetHelper( this )
- ,aHScroll( this, WinBits( WB_HSCROLL ) )
+ ,aHScroll( VclPtr<ScrollBar>::Create(this, WinBits( WB_HSCROLL )) )
{
ConstructImpl( nMode );
}
@@ -130,7 +128,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode
:Control( pParent, rId )
,DragSourceHelper( this )
,DropTargetHelper( this )
- ,aHScroll( this, WinBits(WB_HSCROLL) )
+ ,aHScroll( VclPtr<ScrollBar>::Create(this, WinBits(WB_HSCROLL)) )
{
ConstructImpl(nMode);
}
@@ -138,6 +136,11 @@ BrowseBox::BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode
BrowseBox::~BrowseBox()
{
+ disposeOnce();
+}
+
+void BrowseBox::dispose()
+{
OSL_TRACE( "BrowseBox: %p~", this );
if ( m_pImpl->m_pAccessible )
@@ -148,10 +151,11 @@ BrowseBox::~BrowseBox()
}
Hide();
- delete getDataWindow()->pHeaderBar;
- delete getDataWindow()->pCornerWin;
- delete pDataWin;
- delete pVScroll;
+ getDataWindow()->pHeaderBar.disposeAndClear();
+ getDataWindow()->pCornerWin.disposeAndClear();
+ pDataWin.disposeAndClear();
+ pVScroll.disposeAndClear();
+ aHScroll.disposeAndClear();
// free columns-space
for ( size_t i = 0, n = pCols->size(); i < n; ++i )
@@ -161,6 +165,7 @@ BrowseBox::~BrowseBox()
delete pColSel;
if ( bMultiSelection )
delete uRow.pSel;
+ Control::dispose();
}
@@ -589,7 +594,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
nMaxWidth -= getDataWindow()->bAutoSizeLastCol
? GetFieldRect(nItemId).Left()
: GetFrozenWidth();
- if ( static_cast<BrowserDataWin*>(pDataWin )->bAutoSizeLastCol || nWidth > (sal_uLong)nMaxWidth )
+ if ( static_cast<BrowserDataWin*>( pDataWin.get() )->bAutoSizeLastCol || nWidth > (sal_uLong)nMaxWidth )
{
nWidth = nMaxWidth > 16 ? nMaxWidth : nOldWidth;
nWidth = QueryColumnResize( nItemId, nWidth );
@@ -645,7 +650,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
getDataWindow()->Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS );
Rectangle aInvRect( nX, 0, nX + std::max( nWidth, (sal_uLong)nOldWidth ), USHRT_MAX );
Control::Invalidate( aInvRect, INVALIDATE_NOCHILDREN );
- static_cast<BrowserDataWin*>( pDataWin )->Invalidate( aInvRect );
+ static_cast<BrowserDataWin*>( pDataWin.get() )->Invalidate( aInvRect );
}
else
{
@@ -774,7 +779,6 @@ void BrowseBox::RemoveColumn( sal_uInt16 nItemId )
void BrowseBox::RemoveColumns()
{
-
size_t nOldCount = pCols->size();
// remove all columns
@@ -917,7 +921,7 @@ long BrowseBox::ScrollColumns( long nCols )
{
// update internal value and scrollbar
++nFirstCol;
- aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+ aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
if ( !bScrollable )
{
@@ -963,7 +967,7 @@ long BrowseBox::ScrollColumns( long nCols )
else if ( nCols == -1 )
{
--nFirstCol;
- aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+ aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
if ( !bScrollable )
{
@@ -1003,7 +1007,7 @@ long BrowseBox::ScrollColumns( long nCols )
}
nFirstCol = nFirstCol + (sal_uInt16)nCols;
- aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+ aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
}
// adjust external headerbar, if necessary
@@ -1141,7 +1145,7 @@ void BrowseBox::Clear()
// nFirstCol may not be reset, else the scrolling code will become confused.
// nFirstCol may only be changed when adding or deleting columns
// nFirstCol = 0; -> wrong!
- aHScroll.SetThumbPos( 0 );
+ aHScroll->SetThumbPos( 0 );
pVScroll->SetThumbPos( 0 );
Invalidate();
@@ -2213,9 +2217,9 @@ Rectangle BrowseBox::GetControlArea() const
{
return Rectangle(
- Point( 0, GetOutputSizePixel().Height() - aHScroll.GetSizePixel().Height() ),
- Size( GetOutputSizePixel().Width() - aHScroll.GetSizePixel().Width(),
- aHScroll.GetSizePixel().Height() ) );
+ Point( 0, GetOutputSizePixel().Height() - aHScroll->GetSizePixel().Height() ),
+ Size( GetOutputSizePixel().Width() - aHScroll->GetSizePixel().Width(),
+ aHScroll->GetSizePixel().Height() ) );
}
@@ -2238,7 +2242,7 @@ void BrowseBox::SetMode( BrowserMode nMode )
getDataWindow()->bNoVScroll = false;
if ( getDataWindow()->bNoHScroll )
- aHScroll.Hide();
+ aHScroll->Hide();
nControlAreaWidth = USHRT_MAX;
@@ -2249,7 +2253,7 @@ void BrowseBox::SetMode( BrowserMode nMode )
MultiSelection *pOldRowSel = bMultiSelection ? uRow.pSel : 0;
MultiSelection *pOldColSel = pColSel;
- delete pVScroll;
+ pVScroll.disposeAndClear();
bThumbDragging = ( nMode & BrowserMode::THUMBDRAGGING ) == BrowserMode::THUMBDRAGGING;
bMultiSelection = ( nMode & BrowserMode::MULTISELECTION ) == BrowserMode::MULTISELECTION;
@@ -2276,10 +2280,11 @@ void BrowseBox::SetMode( BrowserMode nMode )
WinBits nVScrollWinBits =
WB_VSCROLL | ( ( nMode & BrowserMode::THUMBDRAGGING ) ? WB_DRAG : 0 );
- pVScroll = ( nMode & BrowserMode::TRACKING_TIPS ) == BrowserMode::TRACKING_TIPS
- ? new BrowserScrollBar( this, nVScrollWinBits,
- static_cast<BrowserDataWin*>( pDataWin ) )
- : new ScrollBar( this, nVScrollWinBits );
+ pVScroll = VclPtr<ScrollBar>(
+ ( nMode & BrowserMode::TRACKING_TIPS ) == BrowserMode::TRACKING_TIPS
+ ? VclPtr<BrowserScrollBar>::Create( this, nVScrollWinBits,
+ static_cast<BrowserDataWin*>( pDataWin.get() ) )
+ : VclPtr<ScrollBar>::Create( this, nVScrollWinBits ));
pVScroll->SetLineSize( 1 );
pVScroll->SetPageSize(1);
pVScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
@@ -2299,11 +2304,9 @@ void BrowseBox::SetMode( BrowserMode nMode )
}
else
{
- DELETEZ(getDataWindow()->pHeaderBar);
+ getDataWindow()->pHeaderBar.disposeAndClear();
}
-
-
if ( bColumnCursor )
{
pColSel = pOldColSel ? pOldColSel : new MultiSelection;
@@ -2391,18 +2394,18 @@ long BrowseBox::GetDataRowHeight() const
-BrowserHeader* BrowseBox::CreateHeaderBar( BrowseBox* pParent )
+VclPtr<BrowserHeader> BrowseBox::CreateHeaderBar( BrowseBox* pParent )
{
- BrowserHeader* pNewBar = new BrowserHeader( pParent );
+ VclPtr<BrowserHeader> pNewBar = VclPtr<BrowserHeader>::Create( pParent );
pNewBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
return pNewBar;
}
void BrowseBox::SetHeaderBar( BrowserHeader* pHeaderBar )
{
- delete static_cast<BrowserDataWin*>(pDataWin)->pHeaderBar;
- static_cast<BrowserDataWin*>( pDataWin )->pHeaderBar = pHeaderBar;
- static_cast<BrowserDataWin*>( pDataWin )->pHeaderBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
+ static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar.disposeAndClear();
+ static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar = pHeaderBar;
+ static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
}
long BrowseBox::GetTitleHeight() const
@@ -2410,7 +2413,7 @@ long BrowseBox::GetTitleHeight() const
long nHeight;
// ask the header bar for the text height (if possible), as the header bar's font is adjusted with
// our (and the header's) zoom factor
- HeaderBar* pHeaderBar = static_cast<BrowserDataWin*>( pDataWin )->pHeaderBar;
+ HeaderBar* pHeaderBar = static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar;
if ( pHeaderBar )
nHeight = pHeaderBar->GetTextHeight();
else
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 2b2afb754054..e371f5c993fe 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -30,7 +30,7 @@
using namespace ::com::sun::star::datatransfer;
-#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin))
+#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin.get()))
@@ -43,7 +43,7 @@ void BrowseBox::StartDrag( sal_Int8 /* _nAction */, const Point& /* _rPosPixel *
sal_Int8 BrowseBox::AcceptDrop( const AcceptDropEvent& _rEvt )
{
- BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin);
+ BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin.get());
AcceptDropEvent aTransformed( _rEvt );
aTransformed.maPosPixel = pDataWindow->ScreenToOutputPixel( OutputToScreenPixel( _rEvt.maPosPixel ) );
return pDataWindow->AcceptDrop( aTransformed );
@@ -53,7 +53,7 @@ sal_Int8 BrowseBox::AcceptDrop( const AcceptDropEvent& _rEvt )
sal_Int8 BrowseBox::ExecuteDrop( const ExecuteDropEvent& _rEvt )
{
- BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin);
+ BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin.get());
ExecuteDropEvent aTransformed( _rEvt );
aTransformed.maPosPixel = pDataWindow->ScreenToOutputPixel( OutputToScreenPixel( _rEvt.maPosPixel ) );
return pDataWindow->ExecuteDrop( aTransformed );
@@ -79,8 +79,8 @@ sal_Int8 BrowseBox::ExecuteDrop( const BrowserExecuteDropEvent& )
void* BrowseBox::implGetDataFlavors() const
{
- if (static_cast<BrowserDataWin*>(pDataWin)->bCallingDropCallback)
- return &static_cast<BrowserDataWin*>(pDataWin)->GetDataFlavorExVector();
+ if (static_cast<BrowserDataWin*>(pDataWin.get())->bCallingDropCallback)
+ return &static_cast<BrowserDataWin*>(pDataWin.get())->GetDataFlavorExVector();
return &GetDataFlavorExVector();
}
@@ -88,8 +88,8 @@ void* BrowseBox::implGetDataFlavors() const
bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat )
{
- if ( static_cast< BrowserDataWin* >( pDataWin )->bCallingDropCallback )
- return static_cast< BrowserDataWin* >( pDataWin )->IsDropFormatSupported( _nFormat );
+ if ( static_cast< BrowserDataWin* >( pDataWin.get() )->bCallingDropCallback )
+ return static_cast< BrowserDataWin* >( pDataWin.get() )->IsDropFormatSupported( _nFormat );
return DropTargetHelper::IsDropFormatSupported( _nFormat );
}
@@ -105,8 +105,8 @@ bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat ) const
bool BrowseBox::IsDropFormatSupported( const DataFlavor& _rFlavor )
{
- if ( static_cast< BrowserDataWin* >( pDataWin )->bCallingDropCallback )
- return static_cast< BrowserDataWin* >( pDataWin )->IsDropFormatSupported( _rFlavor );
+ if ( static_cast< BrowserDataWin* >( pDataWin.get() )->bCallingDropCallback )
+ return static_cast< BrowserDataWin* >( pDataWin.get() )->IsDropFormatSupported( _rFlavor );
return DropTargetHelper::IsDropFormatSupported( _rFlavor );
}
@@ -139,7 +139,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar;
if ( pHeaderBar )
pHeaderBar->EnableRTL( IsRTLEnabled() );
- aHScroll.EnableRTL( IsRTLEnabled() );
+ aHScroll->EnableRTL( IsRTLEnabled() );
if( pVScroll )
pVScroll->EnableRTL( IsRTLEnabled() );
Resize();
@@ -189,7 +189,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
// do we have a handle column?
bool bHandleCol = !pCols->empty() && (0 == (*pCols)[ 0 ]->GetId());
// do we have a header bar?
- bool bHeaderBar = (NULL != static_cast<BrowserDataWin&>(GetDataWindow()).pHeaderBar);
+ bool bHeaderBar = (NULL != static_cast<BrowserDataWin&>(GetDataWindow()).pHeaderBar.get());
if ( nTitleLines
&& ( !bHeaderBar
@@ -407,9 +407,9 @@ void BrowseBox::DrawCursor()
{
// on these platforms, the StarView focus works correctly
if ( bReallyHide )
- static_cast<Control*>(pDataWin)->HideFocus();
+ static_cast<Control*>(pDataWin.get())->HideFocus();
else
- static_cast<Control*>(pDataWin)->ShowFocus( aCursor );
+ static_cast<Control*>(pDataWin.get())->ShowFocus( aCursor );
}
else
{
@@ -561,13 +561,13 @@ void BrowseBox::Resize()
// did we need a horizontal scroll bar or is there a Control Area?
if ( !getDataWindow()->bNoHScroll &&
( ( pCols->size() - FrozenColCount() ) > 1 ) )
- aHScroll.Show();
+ aHScroll->Show();
else
- aHScroll.Hide();
+ aHScroll->Hide();
// calculate the size of the data window
long nDataHeight = GetOutputSizePixel().Height() - GetTitleHeight();
- if ( aHScroll.IsVisible() || ( nControlAreaWidth != USHRT_MAX ) )
+ if ( aHScroll->IsVisible() || ( nControlAreaWidth != USHRT_MAX ) )
nDataHeight -= nSBSize;
long nDataWidth = GetOutputSizePixel().Width();
@@ -623,13 +623,13 @@ void BrowseBox::Paint( const Rectangle& rRect )
BrowserColumn *pFirstCol = (*pCols)[ 0 ];
bool bHandleCol = pFirstCol && pFirstCol->GetId() == 0;
- bool bHeaderBar = getDataWindow()->pHeaderBar != NULL;
+ bool bHeaderBar = getDataWindow()->pHeaderBar.get() != NULL;
// draw delimitational lines
if ( !getDataWindow()->bNoHScroll )
- DrawLine( Point( 0, aHScroll.GetPosPixel().Y() ),
+ DrawLine( Point( 0, aHScroll->GetPosPixel().Y() ),
Point( GetOutputSizePixel().Width(),
- aHScroll.GetPosPixel().Y() ) );
+ aHScroll->GetPosPixel().Y() ) );
if ( nTitleLines )
{
@@ -1119,7 +1119,7 @@ void BrowseBox::UpdateScrollbars()
return;
// protect against recursion
- BrowserDataWin *pBDW = static_cast<BrowserDataWin*>( pDataWin );
+ BrowserDataWin *pBDW = static_cast<BrowserDataWin*>( pDataWin.get() );
if ( pBDW->bInUpdateScrollbars )
{
pBDW->bHadRecursion = true;
@@ -1169,15 +1169,15 @@ void BrowseBox::UpdateScrollbars()
: !getDataWindow()->bNoHScroll;
if ( !bNeedsHScroll )
{
- if ( aHScroll.IsVisible() )
+ if ( aHScroll->IsVisible() )
{
- aHScroll.Hide();
+ aHScroll->Hide();
}
aDataWinSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight();
if ( nControlAreaWidth != USHRT_MAX )
aDataWinSize.Height() -= nCornerSize;
}
- else if ( !aHScroll.IsVisible() )
+ else if ( !aHScroll->IsVisible() )
{
Size aNewSize( aDataWinSize );
aNewSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight() - nCornerSize;
@@ -1189,7 +1189,7 @@ void BrowseBox::UpdateScrollbars()
? 0
: nControlAreaWidth;
- aHScroll.SetPosSizePixel(
+ aHScroll->SetPosSizePixel(
Point( nHScrX, GetOutputSizePixel().Height() - nCornerSize ),
Size( aDataWinSize.Width() - nHScrX, nCornerSize ) );
@@ -1202,10 +1202,10 @@ void BrowseBox::UpdateScrollbars()
: (short)( nLastCol - nFirstCol );
short nRange = std::max( nScrollCols, (short)0 );
- aHScroll.SetVisibleSize( nVisibleHSize );
- aHScroll.SetRange( Range( 0, nRange ));
- if ( bNeedsHScroll && !aHScroll.IsVisible() )
- aHScroll.Show();
+ aHScroll->SetVisibleSize( nVisibleHSize );
+ aHScroll->SetRange( Range( 0, nRange ));
+ if ( bNeedsHScroll && !aHScroll->IsVisible() )
+ aHScroll->Show();
// adjust position and height of vertical scrollbar
pVScroll->SetPageSize( nMaxRows );
@@ -1237,12 +1237,12 @@ void BrowseBox::UpdateScrollbars()
// needs corner-window?
// (do that AFTER positioning BOTH scrollbars)
sal_uLong nActualCorderWidth = 0;
- if (aHScroll.IsVisible() && pVScroll && pVScroll->IsVisible() )
+ if (aHScroll->IsVisible() && pVScroll && pVScroll->IsVisible() )
{
// if we have both scrollbars, the corner window fills the point of intersection of these two
nActualCorderWidth = nCornerSize;
}
- else if ( !aHScroll.IsVisible() && ( nControlAreaWidth != USHRT_MAX ) )
+ else if ( !aHScroll->IsVisible() && ( nControlAreaWidth != USHRT_MAX ) )
{
// if we have no horizontal scrollbar, but a control area, we need the corner window to
// fill the space between the control are and the right border
@@ -1251,14 +1251,14 @@ void BrowseBox::UpdateScrollbars()
if ( nActualCorderWidth )
{
if ( !getDataWindow()->pCornerWin )
- getDataWindow()->pCornerWin = new ScrollBarBox( this, 0 );
+ getDataWindow()->pCornerWin = VclPtr<ScrollBarBox>::Create( this, 0 );
getDataWindow()->pCornerWin->SetPosSizePixel(
- Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll.GetPosPixel().Y() ),
+ Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll->GetPosPixel().Y() ),
Size( nActualCorderWidth, nCornerSize ) );
getDataWindow()->pCornerWin->Show();
}
else
- DELETEZ( getDataWindow()->pCornerWin );
+ getDataWindow()->pCornerWin.disposeAndClear();
// scroll headerbar, if necessary
if ( getDataWindow()->pHeaderBar )
@@ -1371,8 +1371,8 @@ IMPL_LINK(BrowseBox,ScrollHdl,ScrollBar*,pBar)
return 0;
}
- if ( pBar == &aHScroll )
- ScrollColumns( aHScroll.GetDelta() );
+ if ( pBar == aHScroll.get() )
+ ScrollColumns( aHScroll->GetDelta() );
if ( pBar == pVScroll )
ScrollRows( pVScroll->GetDelta() );
@@ -1539,7 +1539,7 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt )
bResizing = false;
}
else
- MouseButtonUp( BrowserMouseEvent( static_cast<BrowserDataWin*>(pDataWin),
+ MouseButtonUp( BrowserMouseEvent( static_cast<BrowserDataWin*>(pDataWin.get()),
MouseEvent( Point( rEvt.GetPosPixel().X(),
rEvt.GetPosPixel().Y() - pDataWin->GetPosPixel().Y() ),
rEvt.GetClicks(), rEvt.GetMode(), rEvt.GetButtons(),
@@ -2050,7 +2050,7 @@ Rectangle BrowseBox::calcTableRect(bool _bOnScreen)
long nY = aRowBar.Top() - aRect.Top();
Size aSize(aRect.GetSize());
- return Rectangle(aRowBar.TopRight(), Size(aSize.A() - nX, aSize.B() - nY - aHScroll.GetSizePixel().Height()) );
+ return Rectangle(aRowBar.TopRight(), Size(aSize.A() - nX, aSize.B() - nY - aHScroll->GetSizePixel().Height()) );
}
Rectangle BrowseBox::GetFieldRectPixelAbs( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen )
diff --git a/svtools/source/brwbox/brwhead.cxx b/svtools/source/brwbox/brwhead.cxx
index e3758a98c177..0c723a31e32a 100644
--- a/svtools/source/brwbox/brwhead.cxx
+++ b/svtools/source/brwbox/brwhead.cxx
@@ -36,6 +36,18 @@ BrowserHeader::BrowserHeader( BrowseBox* pParent, WinBits nWinBits )
}
+BrowserHeader::~BrowserHeader()
+{
+ disposeOnce();
+}
+
+void BrowserHeader::dispose()
+{
+ _pBrowseBox.clear();
+ HeaderBar::dispose();
+}
+
+
void BrowserHeader::Command( const CommandEvent& rCEvt )
{
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index e56ef6b70de6..41635c240e57 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -227,11 +227,20 @@ BrowserDataWin::BrowserDataWin( BrowseBox* pParent )
BrowserDataWin::~BrowserDataWin()
{
+ disposeOnce();
+}
+
+void BrowserDataWin::dispose()
+{
bInDtor = true;
for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i )
delete aInvalidRegion[ i ];
aInvalidRegion.clear();
+ pHeaderBar.clear();
+ pEventWin.clear();
+ pCornerWin.clear();
+ Control::dispose();
}
@@ -408,7 +417,7 @@ void BrowserDataWin::Command( const CommandEvent& rEvt )
if ( ( (rEvt.GetCommand() == COMMAND_WHEEL) ||
(rEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
(rEvt.GetCommand() == COMMAND_AUTOSCROLL) ) &&
- ( HandleScrollCommand( rEvt, &pBox->aHScroll, pBox->pVScroll ) ) )
+ ( HandleScrollCommand( rEvt, pBox->aHScroll.get(), pBox->pVScroll ) ) )
return;
Point aEventPos( rEvt.GetMousePosPixel() );
@@ -721,7 +730,16 @@ void BrowserDataWin::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags )
Window::Invalidate( rRect, nFlags );
}
+BrowserScrollBar::~BrowserScrollBar()
+{
+ disposeOnce();
+}
+void BrowserScrollBar::dispose()
+{
+ _pDataWin.clear();
+ ScrollBar::dispose();
+}
void BrowserScrollBar::Tracking( const TrackingEvent& rTEvt )
{
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index 4195d0a2ccf6..ed739fbf1b76 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -103,9 +103,9 @@ class BrowserDataWin
,public DropTargetHelper
{
public:
- BrowserHeader* pHeaderBar; // only for BrowserMode::HEADERBAR_NEW
- vcl::Window* pEventWin; // Window of forwarded events
- ScrollBarBox* pCornerWin; // Window in the corner btw the ScrollBars
+ VclPtr<BrowserHeader> pHeaderBar; // only for BrowserMode::HEADERBAR_NEW
+ VclPtr<vcl::Window> pEventWin; // Window of forwarded events
+ VclPtr<ScrollBarBox> pCornerWin; // Window in the corner btw the ScrollBars
bool bInDtor;
AutoTimer aMouseTimer; // recalls MouseMove on dragging out
MouseEvent aRepeatEvt; // a MouseEvent to repeat
@@ -137,7 +137,8 @@ public:
public:
BrowserDataWin( BrowseBox* pParent );
- virtual ~BrowserDataWin();
+ virtual ~BrowserDataWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
@@ -196,7 +197,7 @@ class BrowserScrollBar: public ScrollBar
{
sal_uLong _nTip;
sal_uLong _nLastPos;
- BrowserDataWin* _pDataWin;
+ VclPtr<BrowserDataWin> _pDataWin;
public:
BrowserScrollBar( vcl::Window* pParent, WinBits nStyle,
@@ -206,6 +207,8 @@ public:
_nLastPos( ULONG_MAX ),
_pDataWin( pDataWin )
{}
+ virtual ~BrowserScrollBar();
+ virtual void dispose() SAL_OVERRIDE;
//ScrollBar( vcl::Window* pParent, const ResId& rResId );
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index c4bedd3c27bf..111f6c878aae 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -238,7 +238,7 @@ namespace svt
EnableChildTransparentMode();
- pBox = new TriStateBox(this,WB_CENTER|WB_VCENTER);
+ pBox = VclPtr<TriStateBox>::Create(this,WB_CENTER|WB_VCENTER);
pBox->SetLegacyNoTextAlign( true );
pBox->EnableChildTransparentMode();
pBox->SetPaintTransparent( true );
@@ -249,7 +249,13 @@ namespace svt
CheckBoxControl::~CheckBoxControl()
{
- delete pBox;
+ disposeOnce();
+ }
+
+ void CheckBoxControl::dispose()
+ {
+ pBox.disposeAndClear();
+ Control::dispose();
}
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 7c13d24fa146..c95369f2521c 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -127,7 +127,7 @@ namespace svt
ImplInitSettings(true, true, true);
- pCheckBoxPaint = new CheckBoxControl(&GetDataWindow());
+ pCheckBoxPaint = VclPtr<CheckBoxControl>::Create(&GetDataWindow());
pCheckBoxPaint->SetPaintTransparent( true );
pCheckBoxPaint->SetBackground();
}
@@ -183,6 +183,11 @@ namespace svt
EditBrowseBox::~EditBrowseBox()
{
+ disposeOnce();
+ }
+
+ void EditBrowseBox::dispose()
+ {
if (nStartEvent)
Application::RemoveUserEvent(nStartEvent);
if (nEndEvent)
@@ -190,8 +195,10 @@ namespace svt
if (nCellModifiedEvent)
Application::RemoveUserEvent(nCellModifiedEvent);
- delete pCheckBoxPaint;
-
+ pCheckBoxPaint.disposeAndClear();
+ m_pFocusWhileRequest.clear();
+ pHeader.clear();
+ BrowseBox::dispose();
}
@@ -203,7 +210,7 @@ namespace svt
}
- BrowserHeader* EditBrowseBox::CreateHeaderBar(BrowseBox* pParent)
+ VclPtr<BrowserHeader> EditBrowseBox::CreateHeaderBar(BrowseBox* pParent)
{
pHeader = imp_CreateHeaderBar(pParent);
if (!IsUpdateMode())
@@ -212,9 +219,9 @@ namespace svt
}
- BrowserHeader* EditBrowseBox::imp_CreateHeaderBar(BrowseBox* pParent)
+ VclPtr<BrowserHeader> EditBrowseBox::imp_CreateHeaderBar(BrowseBox* pParent)
{
- return new EditBrowserHeader(pParent);
+ return VclPtr<EditBrowserHeader>::Create(pParent);
}
@@ -251,7 +258,7 @@ namespace svt
if (IsEditing())
{
EnableAndShow();
- if (!aController->GetWindow().HasFocus() && (m_pFocusWhileRequest == Application::GetFocusWindow()))
+ if (!aController->GetWindow().HasFocus() && (m_pFocusWhileRequest.get() == Application::GetFocusWindow()))
aController->GetWindow().GrabFocus();
}
return 0;
diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx
index b5adc8962ec4..8efa8de2847f 100644
--- a/svtools/source/contnr/DocumentInfoPreview.cxx
+++ b/svtools/source/contnr/DocumentInfoPreview.cxx
@@ -44,16 +44,26 @@
namespace svtools {
ODocumentInfoPreview::ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits):
- Window(pParent, WB_DIALOGCONTROL), m_pEditWin(this, nBits),
+ Window(pParent, WB_DIALOGCONTROL),
+ m_pEditWin( VclPtr<ExtMultiLineEdit>::Create(this, nBits) ),
m_xInfoTable(new SvtDocInfoTable_Impl),
m_aLanguageTag(SvtPathOptions().GetLanguageTag()) // detect application language
{
- m_pEditWin.SetLeftMargin(10);
- m_pEditWin.Show();
- m_pEditWin.EnableCursor(false);
+ m_pEditWin->SetLeftMargin(10);
+ m_pEditWin->Show();
+ m_pEditWin->EnableCursor(false);
}
-ODocumentInfoPreview::~ODocumentInfoPreview() {}
+ODocumentInfoPreview::~ODocumentInfoPreview()
+{
+ disposeOnce();
+}
+
+void ODocumentInfoPreview::dispose()
+{
+ m_pEditWin.disposeAndClear();
+ Window::dispose();
+}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeODocumentInfoPreview(vcl::Window *pParent, VclBuilder::stringmap&)
{
@@ -61,11 +71,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeODocumentInfoPreview(v
}
void ODocumentInfoPreview::Resize() {
- m_pEditWin.SetPosSizePixel(Point(0, 0), GetOutputSize());
+ m_pEditWin->SetPosSizePixel(Point(0, 0), GetOutputSize());
}
void ODocumentInfoPreview::clear() {
- m_pEditWin.SetText(OUString());
+ m_pEditWin->SetText(OUString());
}
void ODocumentInfoPreview::fill(
@@ -74,7 +84,7 @@ void ODocumentInfoPreview::fill(
{
assert(xDocProps.is());
- m_pEditWin.SetAutoScroll(false);
+ m_pEditWin->SetAutoScroll(false);
insertNonempty(DI_TITLE, xDocProps->getTitle());
insertNonempty(DI_FROM, xDocProps->getAuthor());
@@ -126,22 +136,22 @@ void ODocumentInfoPreview::fill(
}
}
- m_pEditWin.SetSelection(Selection(0, 0));
- m_pEditWin.SetAutoScroll(true);
+ m_pEditWin->SetSelection(Selection(0, 0));
+ m_pEditWin->SetAutoScroll(true);
}
void ODocumentInfoPreview::insertEntry(
OUString const & title, OUString const & value)
{
- if (!m_pEditWin.GetText().isEmpty()) {
- m_pEditWin.InsertText(OUString("\n\n"));
+ if (!m_pEditWin->GetText().isEmpty()) {
+ m_pEditWin->InsertText(OUString("\n\n"));
}
OUString caption(title + ":\n");
- m_pEditWin.InsertText(caption);
- m_pEditWin.SetAttrib(
- TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin.GetParagraphCount() - 2,
+ m_pEditWin->InsertText(caption);
+ m_pEditWin->SetAttrib(
+ TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin->GetParagraphCount() - 2,
0, caption.getLength() - 1);
- m_pEditWin.InsertText(value);
+ m_pEditWin->InsertText(value);
}
void ODocumentInfoPreview::insertNonempty(long id, OUString const & value)
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 70471b08ea5d..15ae1fe660ae 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -182,7 +182,7 @@ private:
Reference< XCommandEnvironment > mxCmdEnv;
::osl::Mutex maMutex;
- HeaderBar* mpHeaderBar;
+ VclPtr<HeaderBar> mpHeaderBar;
SvtFileView_Impl* mpParent;
Timer maResetQuickSearch;
OUString maQuickSearchText;
@@ -206,7 +206,8 @@ protected:
public:
ViewTabListBox_Impl( vcl::Window* pParentWin, SvtFileView_Impl* pParent, FileViewFlags nFlags );
- virtual ~ViewTabListBox_Impl();
+ virtual ~ViewTabListBox_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
@@ -419,7 +420,7 @@ class SvtFileView_Impl :public ::svt::IEnumerationResultHandler
,public ITimeoutHandler
{
protected:
- SvtFileView* mpAntiImpl;
+ VclPtr<SvtFileView> mpAntiImpl;
Link m_aSelectHandler;
::rtl::Reference< ::svt::FileViewContentEnumerator >
@@ -437,7 +438,7 @@ public:
::std::vector< SortingData_Impl* > maContent;
::osl::Mutex maMutex;
- ViewTabListBox_Impl* mpView;
+ VclPtr<ViewTabListBox_Impl> mpView;
NameTranslator_Impl* mpNameTrans;
sal_uInt16 mnSortColumn;
bool mbAscending : 1;
@@ -596,7 +597,7 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
mbShowHeader ( !(nFlags & FileViewFlags::SHOW_NONE) )
{
Size aBoxSize = pParentWin->GetSizePixel();
- mpHeaderBar = new HeaderBar( pParentWin, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ mpHeaderBar = VclPtr<HeaderBar>::Create( pParentWin, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), mpHeaderBar->CalcWindowSizePixel() );
HeaderBarItemBits nBits = ( HeaderBarItemBits::LEFT | HeaderBarItemBits::VCENTER | HeaderBarItemBits::CLICKABLE );
@@ -648,9 +649,15 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
ViewTabListBox_Impl::~ViewTabListBox_Impl()
{
+ disposeOnce();
+}
+
+void ViewTabListBox_Impl::dispose()
+{
maResetQuickSearch.Stop();
- delete mpHeaderBar;
+ mpHeaderBar.disposeAndClear();
+ SvHeaderTabListBox::dispose();
}
@@ -886,16 +893,16 @@ void ViewTabListBox_Impl::DeleteEntries()
if ( eResult != svtools::QUERYDELETE_ALL )
{
INetURLObject aObj( aURL );
- svtools::QueryDeleteDlg_Impl aDlg( NULL, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) );
+ ScopedVclPtrInstance< svtools::QueryDeleteDlg_Impl > aDlg(nullptr, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) );
if ( sDialogPosition.getLength() )
- aDlg.SetWindowState( sDialogPosition );
+ aDlg->SetWindowState( sDialogPosition );
if ( GetSelectionCount() > 1 )
- aDlg.EnableAllButton();
+ aDlg->EnableAllButton();
- eResult = aDlg.Execute();
+ eResult = aDlg->Execute();
- sDialogPosition = aDlg.GetWindowState( );
+ sDialogPosition = aDlg->GetWindowState( );
}
if ( ( eResult == svtools::QUERYDELETE_ALL ) ||
@@ -1103,10 +1110,16 @@ SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits,
SvtFileView::~SvtFileView()
{
+ disposeOnce();
+}
+
+void SvtFileView::dispose()
+{
// use temp pointer to prevent access of deleted member (GetFocus())
SvtFileView_Impl* pTemp = mpImp;
mpImp = NULL;
delete pTemp;
+ Control::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvtFileView(vcl::Window *pParent,
@@ -1582,7 +1595,7 @@ SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommand
{
maAllFilter = "*.*";
- mpView = new ViewTabListBox_Impl( mpAntiImpl, this, nFlags );
+ mpView = VclPtr<ViewTabListBox_Impl>::Create( mpAntiImpl, this, nFlags );
mpView->EnableCellFocus();
}
@@ -1590,11 +1603,7 @@ SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommand
SvtFileView_Impl::~SvtFileView_Impl()
{
Clear();
-
- // use temp pointer to prevent access of deleted member (GetFocus())
- ViewTabListBox_Impl* pTemp = mpView;
- mpView = NULL;
- delete pTemp;
+ mpView.disposeAndClear();
}
@@ -2335,6 +2344,17 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& r
set_secondary_text(get_secondary_text().replaceFirst("%s", rName));
}
+QueryDeleteDlg_Impl::~QueryDeleteDlg_Impl()
+{
+ disposeOnce();
+}
+
+void QueryDeleteDlg_Impl::dispose()
+{
+ m_pAllButton.clear();
+ MessageDialog::dispose();
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index b1dcdf86ede6..6b79474b158b 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -24,6 +24,7 @@
#include <vcl/scrbar.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
+#include <vcl/vclptr.hxx>
#include <vcl/seleng.hxx>
#include <tools/debug.hxx>
#include "svtaccessiblefactory.hxx"
@@ -160,9 +161,9 @@ class SvxIconChoiceCtrl_Impl
bool bChooseWithCursor;
EntryList_Impl aEntries;
- ScrollBar aVerSBar;
- ScrollBar aHorSBar;
- ScrollBarBox aScrBarBox;
+ VclPtr<ScrollBar> aVerSBar;
+ VclPtr<ScrollBar> aHorSBar;
+ VclPtr<ScrollBarBox> aScrBarBox;
Rectangle aCurSelectionRect;
std::vector<Rectangle*> aSelectedRectList;
Idle aEditIdle; // for editing in place
@@ -178,14 +179,14 @@ class SvxIconChoiceCtrl_Impl
Point aDDLastRectPos;
Point aDDPaintOffs;
Point aDDStartPos;
- SvtIconChoiceCtrl* pView;
+ VclPtr<SvtIconChoiceCtrl> pView;
IcnCursor_Impl* pImpCursor;
IcnGridMap_Impl* pGridMap;
long nMaxVirtWidth; // max. width aVirtOutputSize for ALIGN_TOP
long nMaxVirtHeight; // max. height aVirtOutputSize for ALIGN_LEFT
SvxIconChoiceCtrlEntryList_impl* pZOrderList;
SvxIconChoiceCtrlColumnInfoMap* pColumns;
- IcnViewEdit_Impl* pEdit;
+ VclPtr<IcnViewEdit_Impl> pEdit;
WinBits nWinBits;
long nMaxBoundHeight; // height of highest BoundRects
sal_uInt16 nFlags;
@@ -199,10 +200,10 @@ class SvxIconChoiceCtrl_Impl
SvxIconChoiceCtrlEntry* pPrevDropTarget;
SvxIconChoiceCtrlEntry* pHdlEntry;
SvxIconChoiceCtrlEntry* pDDRefEntry;
- VirtualDevice* pDDDev;
- VirtualDevice* pDDBufDev;
- VirtualDevice* pDDTempDev;
- VirtualDevice* pEntryPaintDev;
+ VclPtr<VirtualDevice> pDDDev;
+ VclPtr<VirtualDevice> pDDBufDev;
+ VclPtr<VirtualDevice> pDDTempDev;
+ VclPtr<VirtualDevice> pEntryPaintDev;
SvxIconChoiceCtrlEntry* pAnchor; // for selection
LocalFocus aFocus; // Data for focusrect
::svt::AccessibleFactoryAccess aAccFactory;
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index ce0e0f1bb285..f978dcd2fbbe 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -77,7 +77,8 @@ public:
const OUString& rData,
const Link& rNotifyEditEnd );
- virtual ~IcnViewEdit_Impl();
+ virtual ~IcnViewEdit_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
bool EditingCanceled() const { return bCanceled; }
@@ -90,9 +91,9 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
WinBits nWinStyle
) :
aEntries( this ),
- aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ),
- aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ),
- aScrBarBox( pCurView ),
+ aVerSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_VSCROLL) ),
+ aHorSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_HSCROLL) ),
+ aScrBarBox( VclPtr<ScrollBarBox>::Create(pCurView) ),
aImageSize( 32, 32 ),
pColumns( 0 )
{
@@ -127,14 +128,14 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
pImpCursor = new IcnCursor_Impl( this );
pGridMap = new IcnGridMap_Impl( this );
- aVerSBar.SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) );
- aHorSBar.SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) );
+ aVerSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) );
+ aHorSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) );
Link aEndScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, EndScrollHdl ) );
- aVerSBar.SetEndScrollHdl( aEndScrollHdl );
- aHorSBar.SetEndScrollHdl( aEndScrollHdl );
+ aVerSBar->SetEndScrollHdl( aEndScrollHdl );
+ aHorSBar->SetEndScrollHdl( aEndScrollHdl );
- nHorSBarHeight = aHorSBar.GetSizePixel().Height();
- nVerSBarWidth = aVerSBar.GetSizePixel().Width();
+ nHorSBarHeight = aHorSBar->GetSizePixel().Height();
+ nVerSBarWidth = aVerSBar->GetSizePixel().Width();
aEditIdle.SetPriority( SchedulerPriority::LOWEST );
aEditIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,EditTimeoutHdl));
@@ -156,19 +157,22 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl()
{
pCurEditedEntry = 0;
- DELETEZ(pEdit);
+ pEdit.disposeAndClear();
Clear();
StopEditTimer();
CancelUserEvents();
delete pZOrderList;
delete pImpCursor;
delete pGridMap;
- delete pDDDev;
- delete pDDBufDev;
- delete pDDTempDev;
- delete pEntryPaintDev;
+ pDDDev.disposeAndClear();
+ pDDBufDev.disposeAndClear();
+ pDDTempDev.disposeAndClear();
+ pEntryPaintDev.disposeAndClear();
ClearSelectedRectList();
ClearColumnList();
+ aVerSBar.disposeAndClear();
+ aHorSBar.disposeAndClear();
+ aScrBarBox.disposeAndClear();
}
void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor )
@@ -257,10 +261,10 @@ IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, EndScrollHdl)
void SvxIconChoiceCtrl_Impl::FontModified()
{
StopEditTimer();
- DELETEZ(pDDDev);
- DELETEZ(pDDBufDev);
- DELETEZ(pDDTempDev);
- DELETEZ(pEntryPaintDev);
+ pDDDev.disposeAndClear();
+ pDDBufDev.disposeAndClear();
+ pDDTempDev.disposeAndClear();
+ pEntryPaintDev.disposeAndClear();
SetDefaultTextSize();
ShowCursor( false );
ShowCursor( true );
@@ -499,11 +503,11 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect )
Range aRange;
aVirtOutputSize.Width() += nWidthOffs;
aRange.Max() = aVirtOutputSize.Width();
- aHorSBar.SetRange( aRange );
+ aHorSBar->SetRange( aRange );
aVirtOutputSize.Height() += nHeightOffs;
aRange.Max() = aVirtOutputSize.Height();
- aVerSBar.SetRange( aRange );
+ aVerSBar->SetRange( aRange );
pImpCursor->Clear();
pGridMap->OutputSizeChanged();
@@ -749,9 +753,9 @@ void SvxIconChoiceCtrl_Impl::RepaintEntries( SvxIconViewFlags nEntryFlagsMask )
void SvxIconChoiceCtrl_Impl::InitScrollBarBox()
{
- aScrBarBox.SetSizePixel( Size(nVerSBarWidth-1, nHorSBarHeight-1) );
+ aScrBarBox->SetSizePixel( Size(nVerSBarWidth-1, nHorSBarHeight-1) );
Size aSize( pView->GetOutputSizePixel() );
- aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1));
+ aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1));
}
bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt)
@@ -1251,8 +1255,8 @@ void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeig
Point aPos( 0, nRealHeight );
aPos.Y() -= nHorSBarHeight;
- if( aHorSBar.GetPosPixel() != aPos )
- aHorSBar.SetPosPixel( aPos );
+ if( aHorSBar->GetPosPixel() != aPos )
+ aHorSBar->SetPosPixel( aPos );
// vertical scrollbar
aPos.X() = nRealWidth; aPos.Y() = 0;
@@ -1260,8 +1264,8 @@ void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeig
aPos.X()++;
aPos.Y()--;
- if( aVerSBar.GetPosPixel() != aPos )
- aVerSBar.SetPosPixel( aPos );
+ if( aVerSBar->GetPosPixel() != aPos )
+ aVerSBar->SetPosPixel( aPos );
}
void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
@@ -1340,27 +1344,27 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
}
// size vertical scrollbar
- long nThumb = aVerSBar.GetThumbPos();
+ long nThumb = aVerSBar->GetThumbPos();
Size aSize( nVerSBarWidth, nRealHeight );
aSize.Height() += 2;
- if( aSize != aVerSBar.GetSizePixel() )
- aVerSBar.SetSizePixel( aSize );
- aVerSBar.SetVisibleSize( nVisibleHeight );
- aVerSBar.SetPageSize( GetScrollBarPageSize( nVisibleHeight ));
+ if( aSize != aVerSBar->GetSizePixel() )
+ aVerSBar->SetSizePixel( aSize );
+ aVerSBar->SetVisibleSize( nVisibleHeight );
+ aVerSBar->SetPageSize( GetScrollBarPageSize( nVisibleHeight ));
if( nResult & 0x0001 )
{
- aVerSBar.SetThumbPos( nThumb );
- aVerSBar.Show();
+ aVerSBar->SetThumbPos( nThumb );
+ aVerSBar->Show();
}
else
{
- aVerSBar.SetThumbPos( 0 );
- aVerSBar.Hide();
+ aVerSBar->SetThumbPos( 0 );
+ aVerSBar->Hide();
}
// size horizontal scrollbar
- nThumb = aHorSBar.GetThumbPos();
+ nThumb = aHorSBar->GetThumbPos();
aSize.Width() = nRealWidth;
aSize.Height() = nHorSBarHeight;
aSize.Width()++;
@@ -1369,19 +1373,19 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
aSize.Width()++;
nRealWidth++;
}
- if( aSize != aHorSBar.GetSizePixel() )
- aHorSBar.SetSizePixel( aSize );
- aHorSBar.SetVisibleSize( nVisibleWidth );
- aHorSBar.SetPageSize( GetScrollBarPageSize(nVisibleWidth ));
+ if( aSize != aHorSBar->GetSizePixel() )
+ aHorSBar->SetSizePixel( aSize );
+ aHorSBar->SetVisibleSize( nVisibleWidth );
+ aHorSBar->SetPageSize( GetScrollBarPageSize(nVisibleWidth ));
if( nResult & 0x0002 )
{
- aHorSBar.SetThumbPos( nThumb );
- aHorSBar.Show();
+ aHorSBar->SetThumbPos( nThumb );
+ aHorSBar->Show();
}
else
{
- aHorSBar.SetThumbPos( 0 );
- aHorSBar.Hide();
+ aHorSBar->SetThumbPos( 0 );
+ aHorSBar->Hide();
}
aOutputSize.Width() = nRealWidth;
@@ -1390,9 +1394,9 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
aOutputSize.Height() = nRealHeight;
if( (nResult & (0x0001|0x0002)) == (0x0001|0x0002) )
- aScrBarBox.Show();
+ aScrBarBox->Show();
else
- aScrBarBox.Hide();
+ aScrBarBox->Hide();
}
void SvxIconChoiceCtrl_Impl::Resize()
@@ -1420,7 +1424,7 @@ void SvxIconChoiceCtrl_Impl::Resize()
bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
{
- if( !pZOrderList || !aHorSBar.IsVisible() )
+ if( !pZOrderList || !aHorSBar->IsVisible() )
return false;
const MapMode& rMapMode = pView->GetMapMode();
Point aOrigin( rMapMode.GetOrigin() );
@@ -1438,18 +1442,18 @@ bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
if( nRight > nMostRight )
nMostRight = nRight;
}
- aHorSBar.Hide();
+ aHorSBar->Hide();
aOutputSize.Height() += nHorSBarHeight;
aVirtOutputSize.Width() = nMostRight;
- aHorSBar.SetThumbPos( 0 );
+ aHorSBar->SetThumbPos( 0 );
Range aRange;
aRange.Max() = nMostRight - 1;
- aHorSBar.SetRange( aRange );
- if( aVerSBar.IsVisible() )
+ aHorSBar->SetRange( aRange );
+ if( aVerSBar->IsVisible() )
{
- Size aSize( aVerSBar.GetSizePixel());
+ Size aSize( aVerSBar->GetSizePixel());
aSize.Height() += nHorSBarHeight;
- aVerSBar.SetSizePixel( aSize );
+ aVerSBar->SetSizePixel( aSize );
}
return true;
}
@@ -1458,7 +1462,7 @@ bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar()
{
- if( !pZOrderList || !aVerSBar.IsVisible() )
+ if( !pZOrderList || !aVerSBar->IsVisible() )
return false;
const MapMode& rMapMode = pView->GetMapMode();
Point aOrigin( rMapMode.GetOrigin() );
@@ -1476,18 +1480,18 @@ bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar()
if( nBottom > nDeepest )
nDeepest = nBottom;
}
- aVerSBar.Hide();
+ aVerSBar->Hide();
aOutputSize.Width() += nVerSBarWidth;
aVirtOutputSize.Height() = nDeepest;
- aVerSBar.SetThumbPos( 0 );
+ aVerSBar->SetThumbPos( 0 );
Range aRange;
aRange.Max() = nDeepest - 1;
- aVerSBar.SetRange( aRange );
- if( aHorSBar.IsVisible() )
+ aVerSBar->SetRange( aRange );
+ if( aHorSBar->IsVisible() )
{
- Size aSize( aHorSBar.GetSizePixel());
+ Size aSize( aHorSBar->GetSizePixel());
aSize.Width() += nVerSBarWidth;
- aHorSBar.SetSizePixel( aSize );
+ aHorSBar->SetSizePixel( aSize );
}
return true;
}
@@ -1501,10 +1505,10 @@ void SvxIconChoiceCtrl_Impl::CheckScrollBars()
CheckVerScrollBar();
if( CheckHorScrollBar() )
CheckVerScrollBar();
- if( aVerSBar.IsVisible() && aHorSBar.IsVisible() )
- aScrBarBox.Show();
+ if( aVerSBar->IsVisible() && aHorSBar->IsVisible() )
+ aScrBarBox->Show();
else
- aScrBarBox.Hide();
+ aScrBarBox->Hide();
}
@@ -1680,7 +1684,7 @@ void SvxIconChoiceCtrl_Impl::PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* pEntr
{
if( !pEntryPaintDev )
{
- pEntryPaintDev = new VirtualDevice( *pView );
+ pEntryPaintDev = VclPtr<VirtualDevice>::Create( *pView );
pEntryPaintDev->SetFont( pView->GetFont() );
pEntryPaintDev->SetLineColor();
//pEntryPaintDev->SetBackground( pView->GetBackground() );
@@ -1779,7 +1783,7 @@ void SvxIconChoiceCtrl_Impl::PaintEntry( SvxIconChoiceCtrlEntry* pEntry, const P
}
bool bResetClipRegion = false;
- if( !pView->IsClipRegion() && (aVerSBar.IsVisible() || aHorSBar.IsVisible()) )
+ if( !pView->IsClipRegion() && (aVerSBar->IsVisible() || aHorSBar->IsVisible()) )
{
Rectangle aOutputArea( GetOutputRect() );
if( aOutputArea.IsOver(aTextRect) || aOutputArea.IsOver(aBmpRect) )
@@ -2080,8 +2084,8 @@ long SvxIconChoiceCtrl_Impl::CalcBoundingHeight( SvxIconChoiceCtrlEntry* pEntry
if( nHeight > nMaxBoundHeight )
{
const_cast<SvxIconChoiceCtrl_Impl*>(this)->nMaxBoundHeight = nHeight;
- const_cast<SvxIconChoiceCtrl_Impl*>(this)->aHorSBar.SetLineSize( GetScrollBarLineSize() );
- const_cast<SvxIconChoiceCtrl_Impl*>(this)->aVerSBar.SetLineSize( GetScrollBarLineSize() );
+ const_cast<SvxIconChoiceCtrl_Impl*>(this)->aHorSBar->SetLineSize( GetScrollBarLineSize() );
+ const_cast<SvxIconChoiceCtrl_Impl*>(this)->aVerSBar->SetLineSize( GetScrollBarLineSize() );
}
return nHeight;
}
@@ -2421,16 +2425,16 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const Rectangle& rRect, bool bScrBar,
else
pView->Invalidate(INVALIDATE_NOCHILDREN);
- if( aHorSBar.IsVisible() || aVerSBar.IsVisible() )
+ if( aHorSBar->IsVisible() || aVerSBar->IsVisible() )
{
if( !bScrBar )
{
aOrigin *= -1;
// correct thumbs
- if(aHorSBar.IsVisible() && aHorSBar.GetThumbPos() != aOrigin.X())
- aHorSBar.SetThumbPos( aOrigin.X() );
- if(aVerSBar.IsVisible() && aVerSBar.GetThumbPos() != aOrigin.Y())
- aVerSBar.SetThumbPos( aOrigin.Y() );
+ if(aHorSBar->IsVisible() && aHorSBar->GetThumbPos() != aOrigin.X())
+ aHorSBar->SetThumbPos( aOrigin.X() );
+ if(aVerSBar->IsVisible() && aVerSBar->GetThumbPos() != aOrigin.Y())
+ aVerSBar->SetThumbPos( aOrigin.Y() );
}
}
@@ -3123,7 +3127,7 @@ void SvxIconChoiceCtrl_Impl::EditEntry( SvxIconChoiceCtrlEntry* pEntry )
return;
StopEntryEditing( true );
- DELETEZ(pEdit);
+ pEdit.disposeAndClear();
SetNoSelection();
pCurEditedEntry = pEntry;
@@ -3134,7 +3138,8 @@ void SvxIconChoiceCtrl_Impl::EditEntry( SvxIconChoiceCtrlEntry* pEntry )
aPos = pView->GetPixelPos( aPos );
aRect.SetPos( aPos );
pView->HideFocus();
- pEdit = new IcnViewEdit_Impl(
+ pEdit = VclPtr<IcnViewEdit_Impl>::Create(
+
pView,
aRect.TopLeft(),
aRect.GetSize(),
@@ -3275,11 +3280,17 @@ IcnViewEdit_Impl::IcnViewEdit_Impl( SvtIconChoiceCtrl* pParent, const Point& rPo
IcnViewEdit_Impl::~IcnViewEdit_Impl()
{
+ disposeOnce();
+}
+
+void IcnViewEdit_Impl::dispose()
+{
if( !bAlreadyInCallback )
{
Application::RemoveAccel( &aAccReturn );
Application::RemoveAccel( &aAccEscape );
}
+ MultiLineEdit::dispose();
}
void IcnViewEdit_Impl::CallCallBackHdl_Impl()
@@ -3392,16 +3403,16 @@ void SvxIconChoiceCtrl_Impl::InitSettings()
if( nScrBarSize != nHorSBarHeight || nScrBarSize != nVerSBarWidth )
{
nHorSBarHeight = nScrBarSize;
- Size aSize( aHorSBar.GetSizePixel() );
+ Size aSize( aHorSBar->GetSizePixel() );
aSize.Height() = nScrBarSize;
- aHorSBar.Hide();
- aHorSBar.SetSizePixel( aSize );
+ aHorSBar->Hide();
+ aHorSBar->SetSizePixel( aSize );
nVerSBarWidth = nScrBarSize;
- aSize = aVerSBar.GetSizePixel();
+ aSize = aVerSBar->GetSizePixel();
aSize.Width() = nScrBarSize;
- aVerSBar.Hide();
- aVerSBar.SetSizePixel( aSize );
+ aVerSBar->Hide();
+ aVerSBar->SetSizePixel( aSize );
Size aOSize( pView->Control::GetOutputSizePixel() );
PositionScrollBars( aOSize.Width(), aOSize.Height() );
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index 38f2d5ad82d2..6ed9becbdb4b 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -88,8 +88,18 @@ SvtIconChoiceCtrl::SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle )
SvtIconChoiceCtrl::~SvtIconChoiceCtrl()
{
- _pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
- delete _pImp;
+ disposeOnce();
+}
+
+void SvtIconChoiceCtrl::dispose()
+{
+ if (_pImp)
+ {
+ _pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
+ delete _pImp;
+ _pImp = NULL;
+ }
+ Control::dispose();
}
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const OUString& rText, const Image& rImage, sal_uLong nPos, const Point* pPos, SvxIconViewFlags nFlags )
@@ -206,7 +216,8 @@ void SvtIconChoiceCtrl::GetFocus()
void SvtIconChoiceCtrl::LoseFocus()
{
- _pImp->LoseFocus();
+ if (_pImp)
+ _pImp->LoseFocus();
Control::LoseFocus();
}
@@ -257,12 +268,12 @@ void SvtIconChoiceCtrl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIc
sal_uLong SvtIconChoiceCtrl::GetEntryCount() const
{
- return _pImp->GetEntryCount();
+ return _pImp ? _pImp->GetEntryCount() : 0;
}
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( sal_uLong nPos ) const
{
- return _pImp->GetEntry( nPos );
+ return _pImp ? _pImp->GetEntry( nPos ) : NULL;
}
void SvtIconChoiceCtrl::CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics )
@@ -272,7 +283,7 @@ void SvtIconChoiceCtrl::CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetSelectedEntry( sal_uLong& rPos ) const
{
- return _pImp->GetFirstSelectedEntry( rPos );
+ return _pImp ? _pImp->GetFirstSelectedEntry( rPos ) : NULL;
}
void SvtIconChoiceCtrl::ClickIcon()
diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx
index 36e0bb5479e6..f1504b35b233 100644
--- a/svtools/source/contnr/simptabl.cxx
+++ b/svtools/source/contnr/simptabl.cxx
@@ -31,6 +31,17 @@ SvSimpleTableContainer::SvSimpleTableContainer(vcl::Window* pParent, WinBits nBi
{
}
+SvSimpleTableContainer::~SvSimpleTableContainer()
+{
+ disposeOnce();
+}
+
+void SvSimpleTableContainer::dispose()
+{
+ m_pTable.clear();
+ Control::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvSimpleTableContainer(vcl::Window *pParent,
VclBuilder::stringmap &)
{
@@ -81,7 +92,7 @@ void SvSimpleTableContainer::GetFocus()
SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits):
SvHeaderTabListBox(&rParent, nBits | WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP),
m_rParentTableContainer(rParent),
- aHeaderBar(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP),
+ aHeaderBar(VclPtr<HeaderBar>::Create(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP)),
nHeaderItemId(1),
bPaintFlag(true),
aCollator(*(IntlWrapper( Application::GetSettings().GetLanguageTag() ).getCaseCollator()))
@@ -92,39 +103,46 @@ SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits):
nSortCol = 0xFFFF;
nOldPos = 0;
- aHeaderBar.SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl));
- aHeaderBar.SetDragHdl(LINK( this, SvSimpleTable, DragHdl));
- aHeaderBar.SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl));
- aHeaderBar.SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick));
- aHeaderBar.SetDoubleClickHdl(LINK( this, SvSimpleTable, HeaderBarDblClick));
+ aHeaderBar->SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl));
+ aHeaderBar->SetDragHdl(LINK( this, SvSimpleTable, DragHdl));
+ aHeaderBar->SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl));
+ aHeaderBar->SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick));
+ aHeaderBar->SetDoubleClickHdl(LINK( this, SvSimpleTable, HeaderBarDblClick));
EnableCellFocus();
DisableTransientChildren();
- InitHeaderBar( &aHeaderBar );
+ InitHeaderBar( aHeaderBar );
UpdateViewSize();
- aHeaderBar.Show();
+ aHeaderBar->Show();
SvHeaderTabListBox::Show();
}
SvSimpleTable::~SvSimpleTable()
{
+ disposeOnce();
+}
+
+void SvSimpleTable::dispose()
+{
m_rParentTableContainer.SetTable(NULL);
+ aHeaderBar.disposeAndClear();
+ SvHeaderTabListBox::dispose();
}
void SvSimpleTable::UpdateViewSize()
{
Size theWinSize=m_rParentTableContainer.GetOutputSizePixel();
- Size HbSize=aHeaderBar.GetSizePixel();
+ Size HbSize=aHeaderBar->GetSizePixel();
HbSize.Width()=theWinSize.Width();
theWinSize.Height()-=HbSize.Height();
Point thePos(0,0);
- aHeaderBar.SetPosPixel(thePos);
- aHeaderBar.SetSizePixel(HbSize);
+ aHeaderBar->SetPosPixel(thePos);
+ aHeaderBar->SetSizePixel(HbSize);
thePos.Y()+=HbSize.Height();
SvHeaderTabListBox::SetPosPixel(thePos);
@@ -137,9 +155,9 @@ void SvSimpleTable::NotifyScrolled()
long nOffset=-GetXOffset();
if(nOldPos!=nOffset)
{
- aHeaderBar.SetOffset(nOffset);
- aHeaderBar.Invalidate();
- aHeaderBar.Update();
+ aHeaderBar->SetOffset(nOffset);
+ aHeaderBar->Invalidate();
+ aHeaderBar->Update();
nOldPos=nOffset;
}
SvHeaderTabListBox::NotifyScrolled();
@@ -152,18 +170,18 @@ void SvSimpleTable::SetTabs()
sal_uInt16 nPrivTabCount = TabCount();
if ( nPrivTabCount )
{
- if ( nPrivTabCount > aHeaderBar.GetItemCount() )
- nPrivTabCount = aHeaderBar.GetItemCount();
+ if ( nPrivTabCount > aHeaderBar->GetItemCount() )
+ nPrivTabCount = aHeaderBar->GetItemCount();
sal_uInt16 i, nPos = 0;
for ( i = 1; i < nPrivTabCount; ++i )
{
sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
- aHeaderBar.SetItemSize( i, nNewSize );
+ aHeaderBar->SetItemSize( i, nNewSize );
nPos = (sal_uInt16)GetTab(i);
}
- aHeaderBar.SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry
+ aHeaderBar->SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry
}
}
@@ -181,19 +199,19 @@ void SvSimpleTable::Paint( const Rectangle& rRect )
long nOffset=-GetXOffset();
nOldPos=nOffset;
- aHeaderBar.SetOffset(nOffset);
- aHeaderBar.Invalidate();
+ aHeaderBar->SetOffset(nOffset);
+ aHeaderBar->Invalidate();
if(nPrivTabCount && bPaintFlag)
{
- if(nPrivTabCount>aHeaderBar.GetItemCount())
- nPrivTabCount=aHeaderBar.GetItemCount();
+ if(nPrivTabCount>aHeaderBar->GetItemCount())
+ nPrivTabCount=aHeaderBar->GetItemCount();
sal_uInt16 nPos = 0;
for(sal_uInt16 i=1;i<nPrivTabCount;i++)
{
sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
- aHeaderBar.SetItemSize( i, nNewSize );
+ aHeaderBar->SetItemSize( i, nNewSize );
nPos= static_cast< sal_uInt16 >( GetTab(i) );
}
}
@@ -206,7 +224,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
sal_Int32 nEnd = rText.indexOf( '\t' );
if( nEnd == -1 )
{
- aHeaderBar.InsertItem(nHeaderItemId++, rText, 0, nBits, nCol);
+ aHeaderBar->InsertItem(nHeaderItemId++, rText, 0, nBits, nCol);
}
else
{
@@ -214,7 +232,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
do
{
OUString aString = rText.getToken(0, '\t', nIndex);
- aHeaderBar.InsertItem(nHeaderItemId++, aString, 0, nBits, nCol);
+ aHeaderBar->InsertItem(nHeaderItemId++, aString, 0, nBits, nCol);
}
while ( nIndex >= 0 );
}
@@ -223,7 +241,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
void SvSimpleTable::ClearHeader()
{
- aHeaderBar.Clear();
+ aHeaderBar->Clear();
}
void SvSimpleTable::ShowTable()
@@ -258,25 +276,25 @@ bool SvSimpleTable::IsEnabled() const
sal_uInt16 SvSimpleTable::GetSelectedCol()
{
- return (aHeaderBar.GetCurItemId()-1);
+ return (aHeaderBar->GetCurItemId()-1);
}
void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir)
{
if(nSortCol!=0xFFFF)
- aHeaderBar.SetItemBits(nSortCol+1,HeaderBarItemBits::STDSTYLE);
+ aHeaderBar->SetItemBits(nSortCol+1,HeaderBarItemBits::STDSTYLE);
if (nCol != 0xFFFF)
{
if(bDir || nSortCol != nCol)
{
- aHeaderBar.SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::DOWNARROW);
+ aHeaderBar->SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::DOWNARROW);
GetModel()->SetSortMode(SortAscending);
bDir = true;
}
else
{
- aHeaderBar.SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::UPARROW);
+ aHeaderBar->SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::UPARROW);
GetModel()->SetSortMode(SortDescending);
}
@@ -302,9 +320,9 @@ void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir)
void SvSimpleTable::HBarClick()
{
- sal_uInt16 nId=aHeaderBar.GetCurItemId();
+ sal_uInt16 nId=aHeaderBar->GetCurItemId();
- if (aHeaderBar.GetItemBits(nId) & HeaderBarItemBits::CLICKABLE)
+ if (aHeaderBar->GetItemBits(nId) & HeaderBarItemBits::CLICKABLE)
{
if(nId==nSortCol+1)
{
@@ -326,24 +344,24 @@ void SvSimpleTable::HBarDblClick()
void SvSimpleTable::HBarStartDrag()
{
- if(!aHeaderBar.IsItemMode())
+ if(!aHeaderBar->IsItemMode())
{
Rectangle aSizeRect(Point(0,0),
SvHeaderTabListBox::GetOutputSizePixel());
- aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
- aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+ aSizeRect.Left()=-GetXOffset()+aHeaderBar->GetDragPos();
+ aSizeRect.Right()=-GetXOffset()+aHeaderBar->GetDragPos();
ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
}
}
void SvSimpleTable::HBarDrag()
{
HideTracking();
- if(!aHeaderBar.IsItemMode())
+ if(!aHeaderBar->IsItemMode())
{
Rectangle aSizeRect(Point(0,0),
SvHeaderTabListBox::GetOutputSizePixel());
- aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
- aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+ aSizeRect.Left()=-GetXOffset()+aHeaderBar->GetDragPos();
+ aSizeRect.Right()=-GetXOffset()+aHeaderBar->GetDragPos();
ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
}
}
@@ -354,14 +372,14 @@ void SvSimpleTable::HBarEndDrag()
if(nPrivTabCount)
{
- if(nPrivTabCount>aHeaderBar.GetItemCount())
- nPrivTabCount=aHeaderBar.GetItemCount();
+ if(nPrivTabCount>aHeaderBar->GetItemCount())
+ nPrivTabCount=aHeaderBar->GetItemCount();
sal_uInt16 nPos=0;
sal_uInt16 nNewSize=0;
for(sal_uInt16 i=1;i<nPrivTabCount;i++)
{
- nNewSize = static_cast< sal_uInt16 >( aHeaderBar.GetItemSize(i) ) + nPos;
+ nNewSize = static_cast< sal_uInt16 >( aHeaderBar->GetItemSize(i) ) + nPos;
SetTab( i, nNewSize, MAP_PIXEL );
nPos = nNewSize;
}
@@ -381,7 +399,7 @@ void SvSimpleTable::Command( const CommandEvent& rCEvt )
IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarStartDrag();
}
@@ -390,7 +408,7 @@ IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr)
IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarDrag();
}
@@ -399,7 +417,7 @@ IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr)
IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarEndDrag();
}
@@ -408,7 +426,7 @@ IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr)
IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarClick();
}
@@ -417,7 +435,7 @@ IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr)
IMPL_LINK( SvSimpleTable, HeaderBarDblClick, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarDblClick();
}
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 1b0f9e801948..78b68095bf59 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -47,9 +47,9 @@ Image* SvImpLBox::s_pDefExpanded = NULL;
sal_Int32 SvImpLBox::s_nImageRefCount = 0;
SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinStyle)
- : aVerSBar(pLBView, WB_DRAG | WB_VSCROLL)
- , aHorSBar(pLBView, WB_DRAG | WB_HSCROLL)
- , aScrBarBox(pLBView)
+ : aVerSBar(VclPtr<ScrollBar>::Create(pLBView, WB_DRAG | WB_VSCROLL))
+ , aHorSBar(VclPtr<ScrollBar>::Create(pLBView, WB_DRAG | WB_HSCROLL))
+ , aScrBarBox(VclPtr<ScrollBarBox>::Create(pLBView))
, aOutputSize(0, 0)
, aSelEng(pLBView, (FunctionSet*)0)
, aFctSet(this, &aSelEng, pLBView)
@@ -67,18 +67,18 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinS
SetSelectionMode( SINGLE_SELECTION );
SetDragDropMode( DragDropMode::NONE );
- aVerSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) );
- aHorSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) );
- aHorSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
- aVerSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
- aVerSBar.SetRange( Range(0,0) );
- aVerSBar.Hide();
- aHorSBar.SetRange( Range(0,0) );
- aHorSBar.SetPageSize( 24 ); // pixels
- aHorSBar.SetLineSize( 8 ); // pixels
+ aVerSBar->SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) );
+ aHorSBar->SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) );
+ aHorSBar->SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
+ aVerSBar->SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
+ aVerSBar->SetRange( Range(0,0) );
+ aVerSBar->Hide();
+ aHorSBar->SetRange( Range(0,0) );
+ aHorSBar->SetPageSize( 24 ); // pixels
+ aHorSBar->SetLineSize( 8 ); // pixels
- nHorSBarHeight = (short)aHorSBar.GetSizePixel().Height();
- nVerSBarWidth = (short)aVerSBar.GetSizePixel().Width();
+ nHorSBarHeight = (short)aHorSBar->GetSizePixel().Height();
+ nVerSBarWidth = (short)aVerSBar->GetSizePixel().Width();
pStartEntry = 0;
pCursor = 0;
@@ -124,6 +124,9 @@ SvImpLBox::~SvImpLBox()
DELETEZ(s_pDefCollapsed);
DELETEZ(s_pDefExpanded);
}
+ aVerSBar.disposeAndClear();
+ aHorSBar.disposeAndClear();
+ aScrBarBox.disposeAndClear();
}
void SvImpLBox::UpdateStringSorter()
@@ -268,25 +271,25 @@ void SvImpLBox::Clear()
pView->HideFocus();
pCursor = 0;
}
- aVerSBar.Hide();
- aVerSBar.SetThumbPos( 0 );
+ aVerSBar->Hide();
+ aVerSBar->SetThumbPos( 0 );
Range aRange( 0, 0 );
- aVerSBar.SetRange( aRange );
+ aVerSBar->SetRange( aRange );
aOutputSize = pView->Control::GetOutputSizePixel();
nFlags &= ~(F_VER_SBARSIZE_WITH_HBAR | F_HOR_SBARSIZE_WITH_VBAR );
- aHorSBar.Hide();
- aHorSBar.SetThumbPos( 0 );
+ aHorSBar->Hide();
+ aHorSBar->SetThumbPos( 0 );
MapMode aMapMode( pView->GetMapMode());
aMapMode.SetOrigin( Point(0,0) );
pView->Control::SetMapMode( aMapMode );
- aHorSBar.SetRange( aRange );
- aHorSBar.SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight));
+ aHorSBar->SetRange( aRange );
+ aHorSBar->SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight));
pView->SetClipRegion();
if( GetUpdateMode() )
pView->Invalidate( GetVisibleArea() );
nFlags |= F_FILLING;
- if( !aHorSBar.IsVisible() && !aVerSBar.IsVisible() )
- aScrBarBox.Hide();
+ if( !aHorSBar->IsVisible() && !aVerSBar->IsVisible() )
+ aScrBarBox->Hide();
aContextBmpWidthVector.clear();
@@ -301,7 +304,7 @@ IMPL_LINK_NOARG_INLINE_START(SvImpLBox, EndScrollHdl)
{
if( nFlags & F_ENDSCROLL_SET_VIS_SIZE )
{
- aVerSBar.SetVisibleSize( nNextVerVisSize );
+ aVerSBar->SetVisibleSize( nNextVerVisSize );
nFlags &= ~F_ENDSCROLL_SET_VIS_SIZE;
}
EndScroll();
@@ -470,16 +473,16 @@ void SvImpLBox::PageUp( sal_uInt16 nDelta )
void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
{
- if( !aVerSBar.IsVisible() )
+ if( !aVerSBar->IsVisible() )
return;
long nDelta;
if( bPageUp )
- nDelta = aVerSBar.GetPageSize();
+ nDelta = aVerSBar->GetPageSize();
else
nDelta = 1;
- long nThumbPos = aVerSBar.GetThumbPos();
+ long nThumbPos = aVerSBar->GetThumbPos();
if( nThumbPos < nDelta )
nDelta = nThumbPos;
@@ -491,7 +494,7 @@ void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
if( bNotifyScroll )
BeginScroll();
- aVerSBar.SetThumbPos( nThumbPos - nDelta );
+ aVerSBar->SetThumbPos( nThumbPos - nDelta );
if( bPageUp )
PageUp( (short)nDelta );
else
@@ -504,18 +507,18 @@ void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
void SvImpLBox::KeyDown( bool bPageDown, bool bNotifyScroll )
{
- if( !aVerSBar.IsVisible() )
+ if( !aVerSBar->IsVisible() )
return;
long nDelta;
if( bPageDown )
- nDelta = aVerSBar.GetPageSize();
+ nDelta = aVerSBar->GetPageSize();
else
nDelta = 1;
- long nThumbPos = aVerSBar.GetThumbPos();
- long nVisibleSize = aVerSBar.GetVisibleSize();
- long nRange = aVerSBar.GetRange().Len();
+ long nThumbPos = aVerSBar->GetThumbPos();
+ long nVisibleSize = aVerSBar->GetVisibleSize();
+ long nRange = aVerSBar->GetRange().Len();
long nTmp = nThumbPos+nVisibleSize;
while( (nDelta > 0) && (nTmp+nDelta) >= nRange )
@@ -528,7 +531,7 @@ void SvImpLBox::KeyDown( bool bPageDown, bool bNotifyScroll )
if( bNotifyScroll )
BeginScroll();
- aVerSBar.SetThumbPos( nThumbPos+nDelta );
+ aVerSBar->SetThumbPos( nThumbPos+nDelta );
if( bPageDown )
PageDown( (short)nDelta );
else
@@ -709,7 +712,7 @@ void SvImpLBox::UpdateAll(
{
if( bUpdateVerScrollBar )
FindMostRight(0);
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
SyncVerThumb();
FillView();
ShowVerSBar();
@@ -748,7 +751,7 @@ void SvImpLBox::KeyLeftRight( long nDelta )
ShowCursor( false );
// neuen Origin berechnen
- long nPos = aHorSBar.GetThumbPos();
+ long nPos = aHorSBar->GetThumbPos();
Point aOrigin( -nPos, 0 );
MapMode aMapMode( pView->GetMapMode() );
@@ -899,7 +902,7 @@ void SvImpLBox::Paint( const Rectangle& rRect )
{
ShowCursor( false );
pStartEntry = pView->First();
- aVerSBar.SetThumbPos( 0 );
+ aVerSBar->SetThumbPos( 0 );
StopUserEvent();
ShowCursor( true );
nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpLBox,MyUserEvent), reinterpret_cast<void*>(1));
@@ -1003,7 +1006,7 @@ void SvImpLBox::MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop )
pStartEntry = pEntry;
ShowCursor( false );
FillView();
- aVerSBar.SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) );
+ aVerSBar->SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) );
ShowCursor( true );
pView->Invalidate();
}
@@ -1030,7 +1033,7 @@ void SvImpLBox::ScrollToAbsPos( long nPos )
{
pStartEntry = pEntry;
ShowCursor( false );
- aVerSBar.SetThumbPos( nPos );
+ aVerSBar->SetThumbPos( nPos );
ShowCursor( true );
if (GetUpdateMode())
pView->Invalidate();
@@ -1168,12 +1171,12 @@ void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask )
aVerSize.Height() += 2 * nOverlap;
Point aVerPos( rSize.Width() - aVerSize.Width() + nOverlap, -nOverlap );
- aVerSBar.SetPosSizePixel( aVerPos, aVerSize );
+ aVerSBar->SetPosSizePixel( aVerPos, aVerSize );
aHorSize.Width() += 2 * nOverlap;
Point aHorPos( -nOverlap, rSize.Height() - aHorSize.Height() + nOverlap );
- aHorSBar.SetPosSizePixel( aHorPos, aHorSize );
+ aHorSBar->SetPosSizePixel( aHorPos, aHorSize );
if( nMask & 0x0001 )
rSize.Width() = aVerPos.X();
@@ -1181,9 +1184,9 @@ void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask )
rSize.Height() = aHorPos.Y();
if( (nMask & (0x0001|0x0002)) == (0x0001|0x0002) )
- aScrBarBox.Show();
+ aScrBarBox->Show();
else
- aScrBarBox.Hide();
+ aScrBarBox->Hide();
}
// nResult: Bit0 == VerSBar Bit1 == HorSBar
@@ -1259,12 +1262,12 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
// vertical scrollbar
long nTemp = (long)nVisibleCount;
nTemp--;
- if( nTemp != aVerSBar.GetVisibleSize() )
+ if( nTemp != aVerSBar->GetVisibleSize() )
{
if( !bInVScrollHdl )
{
- aVerSBar.SetPageSize( nTemp - 1 );
- aVerSBar.SetVisibleSize( nTemp );
+ aVerSBar->SetPageSize( nTemp - 1 );
+ aVerSBar->SetVisibleSize( nTemp );
}
else
{
@@ -1274,14 +1277,14 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
}
// horizontal scrollbar
- nTemp = aHorSBar.GetThumbPos();
- aHorSBar.SetVisibleSize( aOSize.Width() );
- long nNewThumbPos = aHorSBar.GetThumbPos();
- Range aRange( aHorSBar.GetRange() );
+ nTemp = aHorSBar->GetThumbPos();
+ aHorSBar->SetVisibleSize( aOSize.Width() );
+ long nNewThumbPos = aHorSBar->GetThumbPos();
+ Range aRange( aHorSBar->GetRange() );
if( aRange.Max() < nMostRight+25 )
{
aRange.Max() = nMostRight+25;
- aHorSBar.SetRange( aRange );
+ aHorSBar->SetRange( aRange );
}
if( nTemp != nNewThumbPos )
@@ -1297,15 +1300,15 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
}
if( nResult & 0x0001 )
- aVerSBar.Show();
+ aVerSBar->Show();
else
- aVerSBar.Hide();
+ aVerSBar->Hide();
if( nResult & 0x0002 )
- aHorSBar.Show();
+ aHorSBar->Show();
else
{
- aHorSBar.Hide();
+ aHorSBar->Hide();
}
rSize = aOSize;
return nResult;
@@ -1313,9 +1316,9 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
void SvImpLBox::InitScrollBarBox()
{
- aScrBarBox.SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) );
+ aScrBarBox->SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) );
Size aSize( pView->Control::GetOutputSizePixel() );
- aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight));
+ aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight));
}
void SvImpLBox::Resize()
@@ -1333,10 +1336,10 @@ void SvImpLBox::Resize()
}
// HACK, as in floating and docked windows the scrollbars might not be drawn
// correctly/not be drawn at all after resizing!
- if( aHorSBar.IsVisible())
- aHorSBar.Invalidate();
- if( aVerSBar.IsVisible())
- aVerSBar.Invalidate();
+ if( aHorSBar->IsVisible())
+ aHorSBar->Invalidate();
+ if( aVerSBar->IsVisible())
+ aVerSBar->Invalidate();
nFlags &= (~(F_IN_RESIZE | F_PAINTED));
}
@@ -1345,7 +1348,7 @@ void SvImpLBox::FillView()
if( !pStartEntry )
{
sal_uInt16 nVisibleViewCount = (sal_uInt16)(pView->GetVisibleCount());
- sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar.GetThumbPos();
+ sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar->GetThumbPos();
if( nTempThumb >= nVisibleViewCount )
nTempThumb = nVisibleViewCount - 1;
pStartEntry = pView->GetEntryAtVisPos(nTempThumb);
@@ -1374,7 +1377,7 @@ void SvImpLBox::FillView()
}
if( bFound )
{
- aVerSBar.SetThumbPos( nThumb );
+ aVerSBar->SetThumbPos( nThumb );
ShowCursor( true ); // recalculate focus rectangle
pView->Invalidate();
}
@@ -1393,17 +1396,17 @@ void SvImpLBox::ShowVerSBar()
nVis = pView->GetVisibleCount();
if( bVerBar || (nVisibleCount && nVis > (sal_uLong)(nVisibleCount-1)) )
{
- if( !aVerSBar.IsVisible() )
+ if( !aVerSBar->IsVisible() )
{
pView->nFocusWidth = -1;
AdjustScrollBars( aOutputSize );
if( GetUpdateMode() )
- aVerSBar.Update();
+ aVerSBar->Update();
}
}
else
{
- if( aVerSBar.IsVisible() )
+ if( aVerSBar->IsVisible() )
{
pView->nFocusWidth = -1;
AdjustScrollBars( aOutputSize );
@@ -1416,20 +1419,20 @@ void SvImpLBox::ShowVerSBar()
nMaxRight = nMaxRight + aPos.X() - 1;
if( nMaxRight < nMostRight )
{
- if( !aHorSBar.IsVisible() )
+ if( !aHorSBar->IsVisible() )
{
pView->nFocusWidth = -1;
AdjustScrollBars( aOutputSize );
if( GetUpdateMode() )
- aHorSBar.Update();
+ aHorSBar->Update();
}
else
{
- Range aRange( aHorSBar.GetRange() );
+ Range aRange( aHorSBar->GetRange() );
if( aRange.Max() < nMostRight+25 )
{
aRange.Max() = nMostRight+25;
- aHorSBar.SetRange( aRange );
+ aHorSBar->SetRange( aRange );
}
else
{
@@ -1440,7 +1443,7 @@ void SvImpLBox::ShowVerSBar()
}
else
{
- if( aHorSBar.IsVisible() )
+ if( aHorSBar->IsVisible() )
{
pView->nFocusWidth = -1;
AdjustScrollBars( aOutputSize );
@@ -1454,10 +1457,10 @@ void SvImpLBox::SyncVerThumb()
if( pStartEntry )
{
long nEntryPos = pView->GetVisiblePos( pStartEntry );
- aVerSBar.SetThumbPos( nEntryPos );
+ aVerSBar->SetThumbPos( nEntryPos );
}
else
- aVerSBar.SetThumbPos( 0 );
+ aVerSBar->SetThumbPos( 0 );
}
bool SvImpLBox::IsEntryInView( SvTreeListEntry* pEntry ) const
@@ -1522,7 +1525,7 @@ void SvImpLBox::EntryExpanded( SvTreeListEntry* pEntry )
InvalidateEntriesFrom( nY );
FindMostRight( pEntry, 0 );
}
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
// if we expanded before the thumb, the thumb's position has to be
// corrected
SyncVerThumb();
@@ -1545,10 +1548,10 @@ void SvImpLBox::EntryCollapsed( SvTreeListEntry* pEntry )
if( pStartEntry )
{
- long nOldThumbPos = aVerSBar.GetThumbPos();
+ long nOldThumbPos = aVerSBar->GetThumbPos();
sal_uLong nVisList = pView->GetVisibleCount();
- aVerSBar.SetRange( Range(0, nVisList-1) );
- long nNewThumbPos = aVerSBar.GetThumbPos();
+ aVerSBar->SetRange( Range(0, nVisList-1) );
+ long nNewThumbPos = aVerSBar->GetThumbPos();
if( nNewThumbPos != nOldThumbPos )
{
pStartEntry = pView->First();
@@ -1708,7 +1711,7 @@ void SvImpLBox::RemovingEntry( SvTreeListEntry* pEntry )
// drawn correctly (in this case they're deleted)
if( pStartEntry && (pStartEntry != pOldStartEntry || pEntry == (SvTreeListEntry*)pView->GetModel()->Last()) )
{
- aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry ));
+ aVerSBar->SetThumbPos( pView->GetVisiblePos( pStartEntry ));
pView->Invalidate( GetVisibleArea() );
}
else
@@ -1735,11 +1738,11 @@ void SvImpLBox::EntryRemoved()
{
if( nFlags & F_REMOVED_RECALC_MOST_RIGHT )
FindMostRight(0);
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
FillView();
if( pStartEntry )
// if something above the thumb was deleted
- aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry) );
+ aVerSBar->SetThumbPos( pView->GetVisiblePos( pStartEntry) );
ShowVerSBar();
if( pCursor && pView->HasFocus() && !pView->IsSelected(pCursor) )
@@ -1804,7 +1807,7 @@ void SvImpLBox::EntryMoved( SvTreeListEntry* pEntry )
// #i97346#
pStartEntry = pView->First();
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1));
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1));
sal_uInt16 nFirstPos = (sal_uInt16)pTree->GetAbsPos( pStartEntry );
sal_uInt16 nNewPos = (sal_uInt16)pTree->GetAbsPos( pEntry );
FindMostRight(0);
@@ -1876,7 +1879,7 @@ void SvImpLBox::EntryInserted( SvTreeListEntry* pEntry )
pView->Invalidate();
SetMostRight( pEntry );
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1));
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1));
SyncVerThumb(); // if something was inserted before the thumb
ShowVerSBar();
ShowCursor( true );
@@ -2153,7 +2156,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
bool bKeyUsed = true;
- sal_uInt16 nDelta = (sal_uInt16)aVerSBar.GetPageSize();
+ sal_uInt16 nDelta = (sal_uInt16)aVerSBar->GetPageSize();
sal_uInt16 aCode = rKeyCode.GetCode();
bool bShift = rKeyCode.IsShift();
@@ -2251,12 +2254,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
}
else if( nWindowStyle & WB_HSCROLL )
{
- long nThumb = aHorSBar.GetThumbPos();
- nThumb += aHorSBar.GetLineSize();
- long nOldThumb = aHorSBar.GetThumbPos();
- aHorSBar.SetThumbPos( nThumb );
+ long nThumb = aHorSBar->GetThumbPos();
+ nThumb += aHorSBar->GetLineSize();
+ long nOldThumb = aHorSBar->GetThumbPos();
+ aHorSBar->SetThumbPos( nThumb );
nThumb = nOldThumb;
- nThumb -= aHorSBar.GetThumbPos();
+ nThumb -= aHorSBar->GetThumbPos();
nThumb *= -1;
if( nThumb )
{
@@ -2282,12 +2285,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
}
else if ( nWindowStyle & WB_HSCROLL )
{
- long nThumb = aHorSBar.GetThumbPos();
- nThumb -= aHorSBar.GetLineSize();
- long nOldThumb = aHorSBar.GetThumbPos();
- aHorSBar.SetThumbPos( nThumb );
+ long nThumb = aHorSBar->GetThumbPos();
+ nThumb -= aHorSBar->GetLineSize();
+ long nOldThumb = aHorSBar->GetThumbPos();
+ aHorSBar->SetThumbPos( nThumb );
nThumb = nOldThumb;
- nThumb -= aHorSBar.GetThumbPos();
+ nThumb -= aHorSBar->GetThumbPos();
if( nThumb )
{
KeyLeftRight( -nThumb );
@@ -2979,7 +2982,7 @@ void SvImpLBox::Command( const CommandEvent& rCEvt )
// scroll mouse event?
if( ( ( nCommand == COMMAND_WHEEL ) || ( nCommand == COMMAND_STARTAUTOSCROLL ) || ( nCommand == COMMAND_AUTOSCROLL ) )
- && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) )
+ && pView->HandleScrollCommand( rCEvt, aHorSBar.get(), aVerSBar.get() ) )
return;
if( bContextMenuHandling && nCommand == COMMAND_CONTEXTMENU )
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index 67f18c210efa..e44f25c2c566 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -110,12 +110,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvTabListBox(vcl::Wind
SvTabListBox::~SvTabListBox()
{
+ disposeOnce();
+}
+
+void SvTabListBox::dispose()
+{
// delete array
delete [] pTabList;
#ifdef DBG_UTIL
pTabList = 0;
nTabCount = 0;
#endif
+ SvTreeListBox::dispose();
}
void SvTabListBox::SetTabs(const long* pTabs, MapUnit eMapUnit)
@@ -497,7 +503,7 @@ namespace svt
{
struct SvHeaderTabListBoxImpl
{
- HeaderBar* m_pHeaderBar;
+ VclPtr<HeaderBar> m_pHeaderBar;
AccessibleFactoryAccess m_aFactoryAccess;
SvHeaderTabListBoxImpl() : m_pHeaderBar( NULL ) { }
@@ -520,7 +526,13 @@ SvHeaderTabListBox::SvHeaderTabListBox( vcl::Window* pParent, WinBits nWinStyle
SvHeaderTabListBox::~SvHeaderTabListBox()
{
+ disposeOnce();
+}
+
+void SvHeaderTabListBox::dispose()
+{
delete m_pImpl;
+ SvTabListBox::dispose();
}
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 3f7ab3f7fa00..ab4028684ee9 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -131,9 +131,9 @@ SvInplaceEdit2::SvInplaceEdit2
{
if( bMulti )
- pEdit = new MyMultiEdit_Impl( pParent, this );
+ pEdit = VclPtr<MyMultiEdit_Impl>::Create( pParent, this );
else
- pEdit = new MyEdit_Impl( pParent, this );
+ pEdit = VclPtr<MyEdit_Impl>::Create( pParent, this );
vcl::Font aFont( pParent->GetFont() );
aFont.SetTransparent( false );
@@ -166,7 +166,7 @@ SvInplaceEdit2::~SvInplaceEdit2()
Application::RemoveAccel( &aAccReturn );
Application::RemoveAccel( &aAccEscape );
}
- delete pEdit;
+ pEdit.disposeAndClear();
}
OUString SvInplaceEdit2::GetSavedValue() const
@@ -1539,29 +1539,49 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry )
SvTreeListBox::~SvTreeListBox()
{
+ disposeOnce();
+}
- pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
- delete pImp;
- delete mpImpl->m_pLink;
- ClearTabList();
-
- delete pEdCtrl;
- pEdCtrl = 0;
- pModel->RemoveView( this );
- if ( pModel->GetRefCount() == 0 )
+void SvTreeListBox::dispose()
+{
+ if( pImp )
{
- pModel->Clear();
- delete pModel;
- pModel = NULL;
+ pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
+ delete pImp;
+ pImp = NULL;
}
+ if( mpImpl )
+ {
+ delete mpImpl->m_pLink;
+ mpImpl->m_pLink = NULL;
+
+ ClearTabList();
- SvTreeListBox::RemoveBoxFromDDList_Impl( *this );
+ delete pEdCtrl;
+ pEdCtrl = NULL;
- if( this == pDDSource )
- pDDSource = 0;
- if( this == pDDTarget )
- pDDTarget = 0;
- delete mpImpl;
+ if( pModel )
+ {
+ pModel->RemoveView( this );
+ if ( pModel->GetRefCount() == 0 )
+ {
+ pModel->Clear();
+ delete pModel;
+ pModel = NULL;
+ }
+ }
+
+ SvTreeListBox::RemoveBoxFromDDList_Impl( *this );
+
+ if( this == pDDSource )
+ pDDSource = 0;
+ if( this == pDDTarget )
+ pDDTarget = 0;
+ delete mpImpl;
+ mpImpl = NULL;
+ }
+
+ Control::dispose();
}
void SvTreeListBox::SetExtendedWinBits( ExtendedWinBits _nBits )
@@ -2197,12 +2217,11 @@ void SvTreeListBox::GetFocus()
void SvTreeListBox::LoseFocus()
{
- //If there is no item in the tree, delete visual focus.
- if( !First())
- {
+ // If there is no item in the tree, delete visual focus.
+ if ( !First() )
Invalidate();
- }
- pImp->LoseFocus();
+ if ( pImp )
+ pImp->LoseFocus();
Control::LoseFocus();
}
@@ -2234,17 +2253,17 @@ void SvTreeListBox::ShowTargetEmphasis( SvTreeListEntry* pEntry, bool /*bShow*/
void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
{
- if( !nDeltaEntries || !pImp->aVerSBar.IsVisible() )
+ if( !nDeltaEntries || !pImp->aVerSBar->IsVisible() )
return;
- long nThumb = pImp->aVerSBar.GetThumbPos();
- long nMax = pImp->aVerSBar.GetRange().Max();
+ long nThumb = pImp->aVerSBar->GetThumbPos();
+ long nMax = pImp->aVerSBar->GetRange().Max();
if( nDeltaEntries < 0 )
{
// move window up
nDeltaEntries *= -1;
- long nVis = pImp->aVerSBar.GetVisibleSize();
+ long nVis = pImp->aVerSBar->GetVisibleSize();
long nTemp = nThumb + nVis;
if( nDeltaEntries > (nMax - nTemp) )
nDeltaEntries = (short)(nMax - nTemp);
@@ -3495,6 +3514,8 @@ void SvTreeListBox::NotifyScrolled()
void SvTreeListBox::Invalidate( sal_uInt16 nInvalidateFlags )
{
+ if (!pImp)
+ return;
if( nFocusWidth == -1 )
// to make sure that the control doesn't show the wrong focus rectangle
// after painting
@@ -3666,12 +3687,12 @@ void SvTreeListBox::EndSelection()
ScrollBar *SvTreeListBox::GetVScroll()
{
- return &((SvTreeListBox*)this)->pImp->aVerSBar;
+ return pImp->aVerSBar.get();
}
ScrollBar *SvTreeListBox::GetHScroll()
{
- return &((SvTreeListBox*)this)->pImp->aHorSBar;
+ return pImp->aHorSBar.get();
}
void SvTreeListBox::EnableAsyncDrag( bool b )
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index 1d02dc34ab09..89566f37844f 100644
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -257,6 +257,11 @@ Calendar::Calendar( vcl::Window* pParent, WinBits nWinStyle ) :
Calendar::~Calendar()
{
+ disposeOnce();
+}
+
+void Calendar::dispose()
+{
delete mpStandardColor;
delete mpSaturdayColor;
delete mpSundayColor;
@@ -264,6 +269,7 @@ Calendar::~Calendar()
delete mpSelectTable;
delete mpOldSelectTable;
delete mpRestoreSelectTable;
+ Control::dispose();
}
@@ -2183,14 +2189,15 @@ Size Calendar::CalcWindowSizePixel( long nCalcMonthPerLine,
class ImplCFieldFloatWin : public FloatingWindow
{
private:
- Calendar* mpCalendar;
- PushButton* mpTodayBtn;
- PushButton* mpNoneBtn;
- FixedLine* mpFixedLine;
+ VclPtr<Calendar> mpCalendar;
+ VclPtr<PushButton> mpTodayBtn;
+ VclPtr<PushButton> mpNoneBtn;
+ VclPtr<FixedLine> mpFixedLine;
public:
ImplCFieldFloatWin( vcl::Window* pParent );
- virtual ~ImplCFieldFloatWin();
+ virtual ~ImplCFieldFloatWin();
+ virtual void dispose() SAL_OVERRIDE;
void SetCalendar( Calendar* pCalendar )
{ mpCalendar = pCalendar; }
@@ -2217,9 +2224,16 @@ ImplCFieldFloatWin::ImplCFieldFloatWin( vcl::Window* pParent ) :
ImplCFieldFloatWin::~ImplCFieldFloatWin()
{
- delete mpTodayBtn;
- delete mpNoneBtn;
- delete mpFixedLine;
+ disposeOnce();
+}
+
+void ImplCFieldFloatWin::dispose()
+{
+ mpTodayBtn.disposeAndClear();
+ mpNoneBtn.disposeAndClear();
+ mpFixedLine.disposeAndClear();
+ mpCalendar.clear();
+ FloatingWindow::dispose();
}
@@ -2230,7 +2244,7 @@ PushButton* ImplCFieldFloatWin::EnableTodayBtn( bool bEnable )
{
if ( !mpTodayBtn )
{
- mpTodayBtn = new PushButton( this, WB_NOPOINTERFOCUS );
+ mpTodayBtn = VclPtr<PushButton>::Create( this, WB_NOPOINTERFOCUS );
OUString aTodayText(SVT_RESSTR(STR_SVT_CALENDAR_TODAY));
mpTodayBtn->SetText( aTodayText );
Size aSize;
@@ -2244,11 +2258,7 @@ PushButton* ImplCFieldFloatWin::EnableTodayBtn( bool bEnable )
}
else
{
- if ( mpTodayBtn )
- {
- delete mpTodayBtn;
- mpTodayBtn = NULL;
- }
+ mpTodayBtn.disposeAndClear();
}
return mpTodayBtn;
@@ -2262,7 +2272,7 @@ PushButton* ImplCFieldFloatWin::EnableNoneBtn( bool bEnable )
{
if ( !mpNoneBtn )
{
- mpNoneBtn = new PushButton( this, WB_NOPOINTERFOCUS );
+ mpNoneBtn = VclPtr<PushButton>::Create( this, WB_NOPOINTERFOCUS );
OUString aNoneText(SVT_RESSTR(STR_SVT_CALENDAR_NONE));
mpNoneBtn->SetText( aNoneText );
Size aSize;
@@ -2276,11 +2286,7 @@ PushButton* ImplCFieldFloatWin::EnableNoneBtn( bool bEnable )
}
else
{
- if ( mpNoneBtn )
- {
- delete mpNoneBtn;
- mpNoneBtn = NULL;
- }
+ mpNoneBtn.disposeAndClear();
}
return mpNoneBtn;
@@ -2333,7 +2339,7 @@ void ImplCFieldFloatWin::ArrangeButtons()
{
if ( !mpFixedLine )
{
- mpFixedLine = new FixedLine( this );
+ mpFixedLine = VclPtr<FixedLine>::Create( this );
mpFixedLine->Show();
}
long nLineWidth = aOutSize.Width()-(CALFIELD_BORDERLINE_X*2);
@@ -2344,11 +2350,7 @@ void ImplCFieldFloatWin::ArrangeButtons()
}
else
{
- if ( mpFixedLine )
- {
- delete mpFixedLine;
- mpFixedLine = NULL;
- }
+ mpFixedLine.disposeAndClear();
}
}
@@ -2381,11 +2383,16 @@ CalendarField::CalendarField(vcl::Window* pParent, WinBits nWinStyle)
CalendarField::~CalendarField()
{
- if ( mpFloatWin )
- {
- delete mpCalendar;
- delete mpFloatWin;
- }
+ disposeOnce();
+}
+
+void CalendarField::dispose()
+{
+ mpCalendar.disposeAndClear();
+ mpFloatWin.disposeAndClear();
+ mpTodayBtn.clear();
+ mpNoneBtn.clear();
+ DateField::dispose();
}
@@ -2510,9 +2517,9 @@ bool CalendarField::ShowDropDown( bool bShow )
-Calendar* CalendarField::CreateCalendar( vcl::Window* pParent )
+VclPtr<Calendar> CalendarField::CreateCalendar( vcl::Window* pParent )
{
- return new Calendar( pParent, mnCalendarStyle | WB_TABSTOP );
+ return VclPtr<Calendar>::Create( pParent, mnCalendarStyle | WB_TABSTOP );
}
@@ -2521,7 +2528,7 @@ Calendar* CalendarField::GetCalendar()
{
if ( !mpFloatWin )
{
- mpFloatWin = new ImplCFieldFloatWin( this );
+ mpFloatWin = VclPtr<ImplCFieldFloatWin>::Create( this );
mpFloatWin->SetPopupModeEndHdl( LINK( this, CalendarField, ImplPopupModeEndHdl ) );
mpCalendar = CreateCalendar( mpFloatWin );
mpCalendar->SetPosPixel( Point() );
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index c9d035f1cfa7..8e397e4de9cc 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -118,8 +118,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorListBox(vcl::Wind
ColorListBox::~ColorListBox()
{
- ImplDestroyColorEntries();
- delete pColorList;
+ disposeOnce();
+}
+
+void ColorListBox::dispose()
+{
+ if ( pColorList )
+ {
+ ImplDestroyColorEntries();
+ delete pColorList;
+ pColorList = NULL;
+ }
+ ListBox::dispose();
}
sal_Int32 ColorListBox::InsertEntry( const OUString& rStr, sal_Int32 nPos )
@@ -660,8 +670,8 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance,
}
// Linien malen
- aSize = aVirDev.PixelToLogic( aSize );
- long nPix = aVirDev.PixelToLogic( Size( 0, 1 ) ).Height();
+ aSize = aVirDev->PixelToLogic( aSize );
+ long nPix = aVirDev->PixelToLogic( Size( 0, 1 ) ).Height();
sal_uInt32 n1 = nLine1;
sal_uInt32 n2 = nLine2;
long nDist = nDistance;
@@ -680,24 +690,24 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance,
// negative width should not be drawn
if ( aSize.Width() > 0 )
{
- Size aVirSize = aVirDev.LogicToPixel( aSize );
- if ( aVirDev.GetOutputSizePixel() != aVirSize )
- aVirDev.SetOutputSizePixel( aVirSize );
- aVirDev.SetFillColor( aColorDist );
- aVirDev.DrawRect( Rectangle( Point(), aSize ) );
+ Size aVirSize = aVirDev->LogicToPixel( aSize );
+ if ( aVirDev->GetOutputSizePixel() != aVirSize )
+ aVirDev->SetOutputSizePixel( aVirSize );
+ aVirDev->SetFillColor( aColorDist );
+ aVirDev->DrawRect( Rectangle( Point(), aSize ) );
- aVirDev.SetFillColor( aColor1 );
+ aVirDev->SetFillColor( aColor1 );
double y1 = double( n1 ) / 2;
- svtools::DrawLine( aVirDev, basegfx::B2DPoint( 0, y1 ), basegfx::B2DPoint( aSize.Width( ), y1 ), n1, nStyle );
+ svtools::DrawLine( *aVirDev.get(), basegfx::B2DPoint( 0, y1 ), basegfx::B2DPoint( aSize.Width( ), y1 ), n1, nStyle );
if ( n2 )
{
double y2 = n1 + nDist + double( n2 ) / 2;
- aVirDev.SetFillColor( aColor2 );
- svtools::DrawLine( aVirDev, basegfx::B2DPoint( 0, y2 ), basegfx::B2DPoint( aSize.Width(), y2 ), n2, table::BorderLineStyle::SOLID );
+ aVirDev->SetFillColor( aColor2 );
+ svtools::DrawLine( *aVirDev.get(), basegfx::B2DPoint( 0, y2 ), basegfx::B2DPoint( aSize.Width(), y2 ), n2, table::BorderLineStyle::SOLID );
}
- rBmp = aVirDev.GetBitmap( Point(), Size( aSize.Width(), n1+nDist+n2 ) );
+ rBmp = aVirDev->GetBitmap( Point(), Size( aSize.Width(), n1+nDist+n2 ) );
}
}
@@ -709,8 +719,8 @@ void LineListBox::ImplInit()
eUnit = FUNIT_POINT;
eSourceUnit = FUNIT_POINT;
- aVirDev.SetLineColor();
- aVirDev.SetMapMode( MapMode( MAP_TWIP ) );
+ aVirDev->SetLineColor();
+ aVirDev->SetMapMode( MapMode( MAP_TWIP ) );
UpdatePaintLineColor();
}
@@ -719,6 +729,7 @@ LineListBox::LineListBox( vcl::Window* pParent, WinBits nWinStyle ) :
ListBox( pParent, nWinStyle ),
m_nWidth( 5 ),
m_sNone( ),
+ aVirDev( new VirtualDevice ),
aColor( COL_BLACK ),
maPaintCol( COL_BLACK )
{
@@ -739,6 +750,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineListBox(vcl::Windo
LineListBox::~LineListBox()
{
+ disposeOnce();
+}
+
+void LineListBox::dispose()
+{
for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) {
if ( (*pLineList)[ i ] ) {
delete (*pLineList)[ i ];
@@ -746,6 +762,7 @@ LineListBox::~LineListBox()
}
pLineList->clear();
delete pLineList;
+ ListBox::dispose();
}
sal_Int32 LineListBox::GetStylePos( sal_Int32 nListPos, long nWidth )
@@ -936,8 +953,17 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontNameBox(vcl::Windo
FontNameBox::~FontNameBox()
{
- SaveMRUEntries (maFontMRUEntriesFile);
- ImplDestroyFontList();
+ disposeOnce();
+}
+
+void FontNameBox::dispose()
+{
+ if (mpFontList)
+ {
+ SaveMRUEntries (maFontMRUEntriesFile);
+ ImplDestroyFontList();
+ }
+ ComboBox::dispose();
}
void FontNameBox::SaveMRUEntries( const OUString& aFontMRUEntriesFile, sal_Unicode cSep ) const
@@ -999,6 +1025,7 @@ void FontNameBox::InitFontMRUEntriesFile()
void FontNameBox::ImplDestroyFontList()
{
delete mpFontList;
+ mpFontList = NULL;
}
void FontNameBox::Fill( const FontList* pList )
@@ -1312,10 +1339,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontStyleBox(vcl::Wind
return pListBox;
}
-FontStyleBox::~FontStyleBox()
-{
-}
-
void FontStyleBox::Select()
{
// keep text over fill operation
@@ -1512,10 +1535,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontSizeBox(vcl::Windo
return pListBox;
}
-FontSizeBox::~FontSizeBox()
-{
-}
-
void FontSizeBox::ImplInit()
{
EnableAutocomplete( false );
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index b9f987ae975f..b8d32ec1cc23 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -74,7 +74,7 @@ class ImplFontListFontInfo : public vcl::FontInfo
friend class FontList;
private:
- OutputDevice* mpDevice;
+ VclPtr<OutputDevice> mpDevice;
ImplFontListFontInfo* mpNext;
public:
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index 7326b3d4aa50..33b5423eb952 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -36,17 +36,17 @@ using namespace ::com::sun::star::ui;
FileControl::FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode nFlags ) :
Window( pParent, nStyle|WB_DIALOGCONTROL ),
- maEdit( this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP ),
- maButton( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ),
+ maEdit( VclPtr<Edit>::Create(this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP) ),
+ maButton( VclPtr<PushButton>::Create( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ) ),
maButtonText( SVT_RESSTR(STR_FILECTRL_BUTTONTEXT) ),
mnFlags( nFlags ),
mnInternalFlags( FileControlMode_Internal::ORIGINALBUTTONTEXT )
{
- maButton.SetClickHdl( LINK( this, FileControl, ButtonHdl ) );
+ maButton->SetClickHdl( LINK( this, FileControl, ButtonHdl ) );
mbOpenDlg = true;
- maButton.Show();
- maEdit.Show();
+ maButton->Show();
+ maEdit->Show();
SetCompoundControl( true );
@@ -59,17 +59,17 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
{
if ( !( nStyle & WB_NOTABSTOP ) )
{
- maEdit.SetStyle( (maEdit.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
- maButton.SetStyle( (maButton.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
+ maEdit->SetStyle( (maEdit->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
+ maButton->SetStyle( (maButton->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
}
else
{
- maEdit.SetStyle( (maEdit.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
- maButton.SetStyle( (maButton.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
+ maEdit->SetStyle( (maEdit->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
+ maButton->SetStyle( (maButton->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
}
const WinBits nAlignmentStyle = ( WB_TOP | WB_VCENTER | WB_BOTTOM );
- maEdit.SetStyle( ( maEdit.GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
+ maEdit->SetStyle( ( maEdit->GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
if ( !(nStyle & WB_NOGROUP) )
nStyle |= WB_GROUP;
@@ -86,13 +86,19 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
FileControl::~FileControl()
{
+ disposeOnce();
}
-
+void FileControl::dispose()
+{
+ maEdit.disposeAndClear();
+ maButton.disposeAndClear();
+ Window::dispose();
+}
void FileControl::SetText( const OUString& rStr )
{
- maEdit.SetText( rStr );
+ maEdit->SetText( rStr );
if ( mnFlags & FileControlMode::RESIZEBUTTONBYPATHLEN )
Resize();
}
@@ -101,7 +107,7 @@ void FileControl::SetText( const OUString& rStr )
OUString FileControl::GetText() const
{
- return maEdit.GetText();
+ return maEdit->GetText();
}
@@ -110,8 +116,8 @@ void FileControl::StateChanged( StateChangedType nType )
{
if ( nType == StateChangedType::ENABLE )
{
- maEdit.Enable( IsEnabled() );
- maButton.Enable( IsEnabled() );
+ maEdit->Enable( IsEnabled() );
+ maButton->Enable( IsEnabled() );
}
else if ( nType == StateChangedType::ZOOM )
{
@@ -155,25 +161,25 @@ void FileControl::Resize()
mnInternalFlags |= FileControlMode_Internal::INRESIZE;//InResize = sal_True
Size aOutSz = GetOutputSizePixel();
- long nButtonTextWidth = maButton.GetTextWidth( maButtonText );
+ long nButtonTextWidth = maButton->GetTextWidth( maButtonText );
if ( !(mnInternalFlags & FileControlMode_Internal::ORIGINALBUTTONTEXT) ||
( nButtonTextWidth < aOutSz.Width()/3 &&
( !( mnFlags & FileControlMode::RESIZEBUTTONBYPATHLEN ) ||
- ( maEdit.GetTextWidth( maEdit.GetText() )
+ ( maEdit->GetTextWidth( maEdit->GetText() )
<= aOutSz.Width() - nButtonTextWidth - ButtonBorder ) ) ) )
{
- maButton.SetText( maButtonText );
+ maButton->SetText( maButtonText );
}
else
{
OUString aSmallText( "..." );
- maButton.SetText( aSmallText );
- nButtonTextWidth = maButton.GetTextWidth( aSmallText );
+ maButton->SetText( aSmallText );
+ nButtonTextWidth = maButton->GetTextWidth( aSmallText );
}
long nButtonWidth = nButtonTextWidth+ButtonBorder;
- maEdit.setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() );
- maButton.setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() );
+ maEdit->setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() );
+ maButton->setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() );
mnInternalFlags &= ~FileControlMode_Internal::INRESIZE; //InResize = sal_False
}
@@ -191,7 +197,7 @@ IMPL_LINK_NOARG(FileControl, ButtonHdl)
void FileControl::GetFocus()
{
- maEdit.GrabFocus();
+ maEdit->GrabFocus();
}
@@ -237,7 +243,7 @@ void FileControl::ImplBrowseFile( )
if ( aObj.GetProtocol() == INetProtocol::File )
aNewText = aObj.PathToFileName();
SetText( aNewText );
- maEdit.GetModifyHdl().Call( &maEdit );
+ maEdit->GetModifyHdl().Call( &maEdit );
}
}
}
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index b332942119e2..a6202529274b 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -334,10 +334,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFormattedField(vcl::Wi
return new FormattedField(pParent, nWinBits);
}
-FormattedField::~FormattedField()
-{
-}
-
void FormattedField::SetText(const OUString& rStr)
{
@@ -1026,7 +1022,13 @@ void FormattedField::UseInputStringForFormatting( bool bUseInputStr /* = true */
DoubleNumericField::~DoubleNumericField()
{
+ disposeOnce();
+}
+
+void DoubleNumericField::dispose()
+{
delete m_pNumberValidator;
+ FormattedField::dispose();
}
void DoubleNumericField::FormatChanged(FORMAT_CHANGE_TYPE nWhat)
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx
index 79393103dc4f..311003eeb5f2 100644
--- a/svtools/source/control/headbar.cxx
+++ b/svtools/source/control/headbar.cxx
@@ -114,15 +114,20 @@ HeaderBar::HeaderBar( vcl::Window* pParent, WinBits nWinStyle ) :
HeaderBar::~HeaderBar()
{
- // Alle Items loeschen
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
- delete (*mpItemList)[ i ];
- }
- mpItemList->clear();
- delete mpItemList;
+ disposeOnce();
}
-
+void HeaderBar::dispose()
+{
+ if (mpItemList)
+ {
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
+ delete (*mpItemList)[ i ];
+ delete mpItemList;
+ mpItemList = NULL;
+ }
+ Window::dispose();
+}
void HeaderBar::ImplInitSettings( bool bFont,
bool bForeground, bool bBackground )
diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx
index e54d7e1bdddf..fa826230e2ec 100644
--- a/svtools/source/control/hyperlabel.cxx
+++ b/svtools/source/control/hyperlabel.cxx
@@ -155,7 +155,13 @@ namespace svt
HyperLabel::~HyperLabel( )
{
+ disposeOnce();
+ }
+
+ void HyperLabel::dispose()
+ {
delete m_pImpl;
+ FixedText::dispose();
}
void HyperLabel::SetInteractive( bool _bInteractive )
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index f75c82c98d9a..370a1f97eaab 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -91,13 +91,13 @@ class SvtMatchContext_Impl: public salhelper::Thread
{
static ::osl::Mutex* pDirMutex;
- std::vector<OUString> aPickList;
- std::vector<OUString> aCompletions;
- std::vector<OUString> aURLs;
+ std::vector<OUString> aPickList;
+ std::vector<OUString> aCompletions;
+ std::vector<OUString> aURLs;
svtools::AsynchronLink aLink;
OUString aBaseURL;
OUString aText;
- SvtURLBox* pBox;
+ VclPtr<SvtURLBox> pBox;
bool bOnlyDirectories;
bool bNoSelection;
@@ -906,6 +906,11 @@ void SvtURLBox::Init(bool bSetDefaultHelpID)
SvtURLBox::~SvtURLBox()
{
+ disposeOnce();
+}
+
+void SvtURLBox::dispose()
+{
if( pCtx.is() )
{
pCtx->Stop();
@@ -913,6 +918,7 @@ SvtURLBox::~SvtURLBox()
}
delete pImp;
+ ComboBox::dispose();
}
void SvtURLBox::UpdatePickList( )
diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx
index dcd6d6b497c6..3d15ae367178 100644
--- a/svtools/source/control/roadmap.cxx
+++ b/svtools/source/control/roadmap.cxx
@@ -45,20 +45,18 @@ namespace svt
{
public:
IDLabel( vcl::Window* _pParent, WinBits _nWinStyle = 0 );
- virtual ~IDLabel( );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
};
class RoadmapItem : public RoadmapTypes
{
private:
- IDLabel* mpID;
- HyperLabel* mpDescription;
+ VclPtr<IDLabel> mpID;
+ VclPtr<HyperLabel> mpDescription;
const Size m_aItemPlayground;
public:
RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground );
- ~RoadmapItem( );
void SetID( sal_Int16 _ID );
sal_Int16 GetID() const;
@@ -204,6 +202,11 @@ namespace svt
ORoadmap::~ORoadmap( )
{
+ disposeOnce();
+ }
+
+ void ORoadmap::dispose()
+ {
HL_Vector aItemsCopy = m_pImpl->getHyperLabels();
m_pImpl->getHyperLabels().clear();
for ( HL_Vector::iterator i = aItemsCopy.begin(); i != aItemsCopy.end(); ++i )
@@ -214,6 +217,7 @@ namespace svt
delete m_pImpl->InCompleteHyperLabel;
delete m_pImpl;
m_pImpl = NULL;
+ Control::dispose();
}
@@ -677,10 +681,10 @@ namespace svt
RoadmapItem::RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground )
:m_aItemPlayground( _rItemPlayground )
{
- mpID = new IDLabel( &_rParent, WB_WORDBREAK );
+ mpID = VclPtr<IDLabel>::Create( &_rParent, WB_WORDBREAK );
mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
mpID->Show();
- mpDescription = new HyperLabel( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
+ mpDescription = VclPtr<HyperLabel>::Create( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
mpDescription->Show();
}
@@ -823,19 +827,6 @@ namespace svt
}
- RoadmapItem::~RoadmapItem( )
- {
- {
- boost::scoped_ptr<Control> xTakeOnership(mpID);
- mpID = NULL;
- }
- {
- boost::scoped_ptr<Control> xTakeOnership(mpDescription);
- mpDescription = NULL;
- }
- }
-
-
void RoadmapItem::SetClickHdl( const Link& rLink )
{
if ( mpDescription )
@@ -850,11 +841,6 @@ namespace svt
}
- IDLabel::~IDLabel( )
- {
- }
-
-
void IDLabel::DataChanged( const DataChangedEvent& rDCEvt )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index d65875ce26f9..c675606ee557 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -289,7 +289,7 @@ void Ruler::ImplInit( WinBits nWinBits )
Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) :
Window( pParent, nWinStyle & WB_3DLOOK ),
- maVirDev( *this ),
+ maVirDev( VclPtr<VirtualDevice>::Create(*this) ),
maMapMode( MAP_100TH_MM ),
mpSaveData(new ImplRulerData),
mpData(NULL),
@@ -325,12 +325,23 @@ Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) :
Ruler::~Ruler()
{
+ disposeOnce();
+}
+
+void Ruler::dispose()
+{
if ( mnUpdateEvtId )
Application::RemoveUserEvent( mnUpdateEvtId );
delete mpSaveData;
+ mpSaveData = NULL;
delete mpDragData;
+ mpDragData = NULL;
if( pAccContext )
+ {
pAccContext->release();
+ pAccContext = NULL;
+ }
+ Window::dispose();
}
void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 )
@@ -350,9 +361,9 @@ void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 )
}
if ( mnWinStyle & WB_HORZ )
- maVirDev.DrawLine( Point( nX1, nY1 ), Point( nX2, nY2 ) );
+ maVirDev->DrawLine( Point( nX1, nY1 ), Point( nX2, nY2 ) );
else
- maVirDev.DrawLine( Point( nY1, nX1 ), Point( nY2, nX2 ) );
+ maVirDev->DrawLine( Point( nY1, nX1 ), Point( nY2, nX2 ) );
}
void Ruler::ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 )
@@ -372,15 +383,15 @@ void Ruler::ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 )
}
if ( mnWinStyle & WB_HORZ )
- maVirDev.DrawRect( Rectangle( nX1, nY1, nX2, nY2 ) );
+ maVirDev->DrawRect( Rectangle( nX1, nY1, nX2, nY2 ) );
else
- maVirDev.DrawRect( Rectangle( nY1, nX1, nY2, nX2 ) );
+ maVirDev->DrawRect( Rectangle( nY1, nX1, nY2, nX2 ) );
}
void Ruler::ImplVDrawText( long nX, long nY, const OUString& rText, long nMin, long nMax )
{
Rectangle aRect;
- maVirDev.GetTextBoundRect( aRect, rText );
+ maVirDev->GetTextBoundRect( aRect, rText );
long nShiftX = ( aRect.GetWidth() / 2 ) + aRect.Left();
long nShiftY = ( aRect.GetHeight() / 2 ) + aRect.Top();
@@ -388,9 +399,9 @@ void Ruler::ImplVDrawText( long nX, long nY, const OUString& rText, long nMin, l
if ( (nX > -RULER_CLIP) && (nX < mnVirWidth + RULER_CLIP) && ( nX < nMax - nShiftX ) && ( nX > nMin + nShiftX ) )
{
if ( mnWinStyle & WB_HORZ )
- maVirDev.DrawText( Point( nX - nShiftX, nY - nShiftY ), rText );
+ maVirDev->DrawText( Point( nX - nShiftX, nY - nShiftY ), rText );
else
- maVirDev.DrawText( Point( nY - nShiftX, nX - nShiftY ), rText );
+ maVirDev->DrawText( Point( nY - nShiftX, nX - nShiftY ), rText );
}
}
@@ -478,7 +489,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
double nAcceptanceDelta = 0.0001;
- Size aPixSize = maVirDev.LogicToPixel( Size( nTick4, nTick4 ), maMapMode );
+ Size aPixSize = maVirDev->LogicToPixel( Size( nTick4, nTick4 ), maMapMode );
if ( mnUnitIndex == RULER_UNIT_CHAR )
{
@@ -510,11 +521,11 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
aFont.SetOrientation( 2700 );
else
aFont.SetOrientation( 900 );
- maVirDev.SetFont( aFont );
+ maVirDev->SetFont( aFont );
nTickWidth = aPixSize.Height();
}
- long nMaxWidth = maVirDev.PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width();
+ long nMaxWidth = maVirDev->PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width();
if ( nMaxWidth < 0 )
nMaxWidth = -nMaxWidth;
@@ -558,7 +569,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
}
nTick4 = nOrgTick4 * nMulti;
- aPixSize = maVirDev.LogicToPixel( Size( nTick4, nTick4 ), maMapMode );
+ aPixSize = maVirDev->LogicToPixel( Size( nTick4, nTick4 ), maMapMode );
if ( mnWinStyle & WB_HORZ )
nTickWidth = aPixSize.Width();
else
@@ -568,7 +579,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
}
else
{
- maVirDev.SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
+ maVirDev->SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
}
if ( !bNoTicks )
@@ -585,11 +596,11 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
Size nTickGapSize;
- nTickGapSize = maVirDev.LogicToPixel( Size( nTickCount, nTickCount ), maMapMode );
+ nTickGapSize = maVirDev->LogicToPixel( Size( nTickCount, nTickCount ), maMapMode );
long nTickGap1 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
- nTickGapSize = maVirDev.LogicToPixel( Size( nTick2, nTick2 ), maMapMode );
+ nTickGapSize = maVirDev->LogicToPixel( Size( nTick2, nTick2 ), maMapMode );
long nTickGap2 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
- nTickGapSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
+ nTickGapSize = maVirDev->LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
long nTickGap3 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
while ( ((nStart - n) >= nMin) || ((nStart + n) <= nMax) )
@@ -609,7 +620,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
}
else
{
- aPixSize = maVirDev.LogicToPixel( Size( nTick, nTick ), maMapMode );
+ aPixSize = maVirDev->LogicToPixel( Size( nTick, nTick ), maMapMode );
if ( mnWinStyle & WB_HORZ )
n = aPixSize.Width();
@@ -709,20 +720,20 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
{
if ( (n2-n1) > 3 )
{
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( rStyleSettings.GetFaceColor() );
+ maVirDev->SetLineColor();
+ maVirDev->SetFillColor( rStyleSettings.GetFaceColor() );
ImplVDrawRect( n1, nVirTop, n2, nVirBottom );
- maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetLightColor() );
ImplVDrawLine( n1 + 1, nVirTop, n1 + 1, nVirBottom );
ImplVDrawLine( n1, nVirTop, n2, nVirTop );
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
ImplVDrawLine( n1, nVirTop, n1, nVirBottom );
ImplVDrawLine( n1, nVirBottom, n2, nVirBottom );
ImplVDrawLine( n2 - 1, nVirTop, n2 - 1, nVirBottom );
- maVirDev.SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
ImplVDrawLine( n2, nVirTop, n2, nVirBottom );
if ( mpData->pBorders[i].nStyle & RULER_BORDER_VARIABLE )
@@ -735,7 +746,7 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
long nTemp4 = nTemp2 + RULER_VAR_SIZE - 1;
long nTempY = nTemp2;
- maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetLightColor() );
while ( nTempY <= nTemp4 )
{
ImplVDrawLine( nTemp1, nTempY, nTemp3, nTempY );
@@ -743,7 +754,7 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
}
nTempY = nTemp2 + 1;
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
while ( nTempY <= nTemp4 )
{
ImplVDrawLine( nTemp1, nTempY, nTemp3, nTempY );
@@ -756,10 +767,10 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
{
if ( n2-n1 > RULER_VAR_SIZE+10 )
{
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
ImplVDrawLine( n1 + 4, nVirTop + 3, n1 + 4, nVirBottom - 3 );
ImplVDrawLine( n2 - 5, nVirTop + 3, n2 - 5, nVirBottom - 3 );
- maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetLightColor() );
ImplVDrawLine( n1 + 5, nVirTop + 3, n1 + 5, nVirBottom - 3 );
ImplVDrawLine( n2 - 4, nVirTop + 3, n2 - 4, nVirBottom - 3 );
}
@@ -768,7 +779,7 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
else
{
n = n1 + ((n2 - n1) / 2);
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
if ( mpData->pBorders[i].nStyle & RULER_BORDER_SNAP )
ImplVDrawLine( n, nVirTop, n, nVirBottom );
@@ -778,8 +789,8 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
{
ImplVDrawLine( n - 1, nVirTop, n - 1, nVirBottom );
ImplVDrawLine( n + 1, nVirTop, n + 1, nVirBottom );
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ maVirDev->SetLineColor();
+ maVirDev->SetFillColor( rStyleSettings.GetWindowColor() );
ImplVDrawRect( n, nVirTop, n, nVirBottom );
}
}
@@ -794,9 +805,9 @@ void Ruler::ImplDrawIndent( const Polygon& rPoly, sal_uInt16 nStyle, bool bIsHit
if ( nStyle & RULER_STYLE_INVISIBLE )
return;
- maVirDev.SetLineColor( rStyleSettings.GetDarkShadowColor() );
- maVirDev.SetFillColor( bIsHit ? rStyleSettings.GetDarkShadowColor() : rStyleSettings.GetWorkspaceColor() );
- maVirDev.DrawPolygon( rPoly );
+ maVirDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ maVirDev->SetFillColor( bIsHit ? rStyleSettings.GetDarkShadowColor() : rStyleSettings.GetWorkspaceColor() );
+ maVirDev->DrawPolygon( rPoly );
}
void Ruler::ImplDrawIndents( long nMin, long nMax, long nVirTop, long nVirBottom )
@@ -823,7 +834,7 @@ void Ruler::ImplDrawIndents( long nMin, long nMax, long nVirTop, long nVirBottom
if (nIndentStyle == RULER_INDENT_BORDER)
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
ImplVDrawLine( n, nVirTop + 1, n, nVirBottom - 1 );
}
else if ( nIndentStyle == RULER_INDENT_BOTTOM )
@@ -1027,7 +1038,7 @@ void Ruler::ImplDrawTabs( long nMin, long nMax, long nVirTop, long nVirBottom )
aPosition += +mpData->nNullVirOff;
long nTopBottom = (GetStyle() & WB_RIGHT_ALIGNED) ? nVirTop : nVirBottom;
if (nMin <= aPosition && aPosition <= nMax)
- ImplDrawTab( &maVirDev, Point( aPosition, nTopBottom ), mpData->pTabs[i].nStyle );
+ ImplDrawTab( maVirDev.get(), Point( aPosition, nTopBottom ), mpData->pTabs[i].nStyle );
}
}
@@ -1082,16 +1093,16 @@ void Ruler::ImplInitSettings( bool bFont, bool bForeground, bool bBackground )
SetBackground( aColor );
}
- maVirDev.SetSettings( GetSettings() );
- maVirDev.SetBackground( GetBackground() );
+ maVirDev->SetSettings( GetSettings() );
+ maVirDev->SetBackground( GetBackground() );
vcl::Font aFont = GetFont();
if ( mnWinStyle & WB_VERT )
aFont.SetOrientation( 900 );
- maVirDev.SetFont( aFont );
- maVirDev.SetTextColor( GetTextColor() );
- maVirDev.SetTextFillColor( GetTextFillColor() );
+ maVirDev->SetFont( aFont );
+ maVirDev->SetTextColor( GetTextColor() );
+ maVirDev->SetTextFillColor( GetTextFillColor() );
}
void Ruler::ImplCalc()
@@ -1189,10 +1200,10 @@ void Ruler::ImplFormat()
aVirDevSize.Height() = mnVirWidth;
aVirDevSize.Width() = mnVirHeight;
}
- if ( aVirDevSize != maVirDev.GetOutputSizePixel() )
- maVirDev.SetOutputSizePixel( aVirDevSize, true );
+ if ( aVirDevSize != maVirDev->GetOutputSizePixel() )
+ maVirDev->SetOutputSizePixel( aVirDevSize, true );
else
- maVirDev.Erase();
+ maVirDev->Erase();
// calculate margins
if ( !(mpData->nMargin1Style & RULER_STYLE_INVISIBLE) )
@@ -1233,7 +1244,7 @@ void Ruler::ImplFormat()
}
// top/bottom border
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
ImplVDrawLine( nVirLeft, nVirTop + 1, nM1, nVirTop + 1 ); //top left line
ImplVDrawLine( nM2, nVirTop + 1, nP2 - 1, nVirTop + 1 ); //top right line
@@ -1241,18 +1252,18 @@ void Ruler::ImplFormat()
nVirBottom--;
// draw margin1, margin2 and in-between
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( rStyleSettings.GetDialogColor() );
+ maVirDev->SetLineColor();
+ maVirDev->SetFillColor( rStyleSettings.GetDialogColor() );
if ( nM1 > nVirLeft )
ImplVDrawRect( nP1, nVirTop+1, nM1, nVirBottom ); //left gray rectangle
if ( nM2 < nP2 )
ImplVDrawRect( nM2, nVirTop+1, nP2, nVirBottom ); //right gray rectangle
if ( nM2-nM1 > 0 )
{
- maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ maVirDev->SetFillColor( rStyleSettings.GetWindowColor() );
ImplVDrawRect( nM1 + 1, nVirTop, nM2 - 1, nVirBottom ); //center rectangle
}
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
if ( nM1 > nVirLeft )
{
ImplVDrawLine( nM1, nVirTop + 1, nM1, nVirBottom ); //right line of the left rectangle
@@ -1363,7 +1374,7 @@ void Ruler::ImplDraw()
{
// output the ruler to the virtual device
Point aOffPos;
- Size aVirDevSize = maVirDev.GetOutputSizePixel();
+ Size aVirDevSize = maVirDev->GetOutputSizePixel();
if ( mnWinStyle & WB_HORZ )
{
@@ -1378,7 +1389,7 @@ void Ruler::ImplDraw()
aOffPos.X() = RULER_OFF;
aOffPos.Y() = mnVirOff;
}
- DrawOutDev( aOffPos, aVirDevSize, Point(), aVirDevSize, maVirDev );
+ DrawOutDev( aOffPos, aVirDevSize, Point(), aVirDevSize, *maVirDev.get() );
// redraw positionlines
ImplInvertLines( true );
diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx
index 44dbf55d8dea..9bac31091e9a 100644
--- a/svtools/source/control/scrwin.cxx
+++ b/svtools/source/control/scrwin.cxx
@@ -30,10 +30,10 @@ void ScrollableWindow::ImpInitialize( ScrollableWindowFlags nFlags )
bScrolling = false;
// set the handlers for the scrollbars
- aVScroll.SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
- aHScroll.SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
- aVScroll.SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
- aHScroll.SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
+ aVScroll->SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
+ aHScroll->SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
+ aVScroll->SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
+ aHScroll->SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
nColumnPixW = nLinePixH = GetSettings().GetStyleSettings().GetScrollBarSize();
}
@@ -43,14 +43,27 @@ void ScrollableWindow::ImpInitialize( ScrollableWindowFlags nFlags )
ScrollableWindow::ScrollableWindow( vcl::Window* pParent, WinBits nBits,
ScrollableWindowFlags nFlags ) :
Window( pParent, WinBits(nBits|WB_CLIPCHILDREN) ),
- aVScroll( this, WinBits(WB_VSCROLL | WB_DRAG) ),
- aHScroll( this, WinBits(WB_HSCROLL | WB_DRAG) ),
- aCornerWin( this )
+ aVScroll( VclPtr<ScrollBar>::Create(this, WinBits(WB_VSCROLL | WB_DRAG)) ),
+ aHScroll( VclPtr<ScrollBar>::Create(this, WinBits(WB_HSCROLL | WB_DRAG)) ),
+ aCornerWin( VclPtr<ScrollBarBox>::Create(this) )
{
ImpInitialize( nFlags );
}
+ScrollableWindow::~ScrollableWindow()
+{
+ disposeOnce();
+}
+
+void ScrollableWindow::dispose()
+{
+ aVScroll.disposeAndClear();
+ aHScroll.disposeAndClear();
+ aCornerWin.disposeAndClear();
+ Window::dispose();
+}
+
void ScrollableWindow::Command( const CommandEvent& rCEvt )
{
@@ -60,12 +73,12 @@ void ScrollableWindow::Command( const CommandEvent& rCEvt )
{
ScrollBar* pHScrBar;
ScrollBar* pVScrBar;
- if ( aHScroll.IsVisible() )
- pHScrBar = &aHScroll;
+ if ( aHScroll->IsVisible() )
+ pHScrBar = aHScroll.get();
else
pHScrBar = NULL;
- if ( aVScroll.IsVisible() )
- pVScrBar = &aVScroll;
+ if ( aVScroll->IsVisible() )
+ pVScrBar = aVScroll.get();
else
pVScrBar = NULL;
if ( HandleScrollCommand( rCEvt, pHScrBar, pVScrBar ) )
@@ -96,9 +109,9 @@ Size ScrollableWindow::GetOutputSizePixel() const
Size aSz( Window::GetOutputSizePixel() );
long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize();
- if ( aHScroll.IsVisible() )
+ if ( aHScroll->IsVisible() )
aSz.Height() -= nTmp;
- if ( aVScroll.IsVisible() )
+ if ( aVScroll->IsVisible() )
aSz.Width() -= nTmp;
return aSz;
}
@@ -112,12 +125,12 @@ IMPL_LINK( ScrollableWindow, EndScrollHdl, ScrollBar *, pScroll )
bScrolling = true;
// get the delta in logic coordinates
- Size aDelta( PixelToLogic( Size( aHScroll.GetDelta(), aVScroll.GetDelta() ) ) );
+ Size aDelta( PixelToLogic( Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) );
// scroll the window, if this is not already done
if ( !bHandleDragging )
{
- if ( pScroll == &aHScroll )
+ if ( pScroll == aHScroll.get() )
Scroll( aDelta.Width(), 0 );
else
Scroll( 0, aDelta.Height() );
@@ -140,8 +153,8 @@ IMPL_LINK( ScrollableWindow, ScrollHdl, ScrollBar *, pScroll )
{
// get the delta in logic coordinates
Size aDelta( PixelToLogic(
- Size( aHScroll.GetDelta(), aVScroll.GetDelta() ) ) );
- if ( pScroll == &aHScroll )
+ Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) );
+ if ( pScroll == aHScroll.get() )
Scroll( aDelta.Width(), 0 );
else
Scroll( 0, aDelta.Height() );
@@ -219,9 +232,9 @@ void ScrollableWindow::Resize()
? (aOutPixSz.Height()-aTotPixSz.Height()) / 2
: 0 ) );
}
- if ( bHVisible && !aHScroll.IsVisible() )
+ if ( bHVisible && !aHScroll->IsVisible() )
aPixOffset.X() = 0;
- if ( bVVisible && !aVScroll.IsVisible() )
+ if ( bVVisible && !aVScroll->IsVisible() )
aPixOffset.Y() = 0;
// select the shifted map-mode
@@ -235,41 +248,41 @@ void ScrollableWindow::Resize()
}
// show or hide scrollbars
- aVScroll.Show( bVVisible );
- aHScroll.Show( bHVisible );
+ aVScroll->Show( bVVisible );
+ aHScroll->Show( bHVisible );
// disable painting in the corner between the scrollbars
if ( bVVisible && bHVisible )
{
- aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()),
+ aCornerWin->SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()),
Size(nScrSize, nScrSize) );
- aCornerWin.Show();
+ aCornerWin->Show();
}
else
- aCornerWin.Hide();
+ aCornerWin->Hide();
// resize scrollbars and set their ranges
if ( bHVisible )
{
- aHScroll.SetPosSizePixel(
+ aHScroll->SetPosSizePixel(
Point( 0, aOutPixSz.Height() ),
Size( aOutPixSz.Width(), nScrSize ) );
- aHScroll.SetRange( Range( 0, aTotPixSz.Width() ) );
- aHScroll.SetPageSize( aOutPixSz.Width() );
- aHScroll.SetVisibleSize( aOutPixSz.Width() );
- aHScroll.SetLineSize( nColumnPixW );
- aHScroll.SetThumbPos( -aPixOffset.X() );
+ aHScroll->SetRange( Range( 0, aTotPixSz.Width() ) );
+ aHScroll->SetPageSize( aOutPixSz.Width() );
+ aHScroll->SetVisibleSize( aOutPixSz.Width() );
+ aHScroll->SetLineSize( nColumnPixW );
+ aHScroll->SetThumbPos( -aPixOffset.X() );
}
if ( bVVisible )
{
- aVScroll.SetPosSizePixel(
+ aVScroll->SetPosSizePixel(
Point( aOutPixSz.Width(), 0 ),
Size( nScrSize,aOutPixSz.Height() ) );
- aVScroll.SetRange( Range( 0, aTotPixSz.Height() ) );
- aVScroll.SetPageSize( aOutPixSz.Height() );
- aVScroll.SetVisibleSize( aOutPixSz.Height() );
- aVScroll.SetLineSize( nLinePixH );
- aVScroll.SetThumbPos( -aPixOffset.Y() );
+ aVScroll->SetRange( Range( 0, aTotPixSz.Height() ) );
+ aVScroll->SetPageSize( aOutPixSz.Height() );
+ aVScroll->SetVisibleSize( aOutPixSz.Height() );
+ aVScroll->SetLineSize( nLinePixH );
+ aVScroll->SetThumbPos( -aPixOffset.Y() );
}
}
@@ -366,9 +379,9 @@ void ScrollableWindow::Scroll( long nDeltaX, long nDeltaY, sal_uInt16 )
if ( !bScrolling )
{
if ( nDeltaX )
- aHScroll.SetThumbPos( -aPixOffset.X() );
+ aHScroll->SetThumbPos( -aPixOffset.X() );
if ( nDeltaY )
- aVScroll.SetThumbPos( -aPixOffset.Y() );
+ aVScroll->SetThumbPos( -aPixOffset.Y() );
}
}
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 45807d372c26..10cb8c3b8467 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -159,6 +159,7 @@ public:
private:
void ImplTrack( const Point& rScreenPos );
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
@@ -176,6 +177,11 @@ ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle )
SetSizePixel(Size(7 * nScaleFactor, 0));
}
+void ImplTabSizer::dispose()
+{
+ vcl::Window::dispose();
+}
+
void ImplTabSizer::ImplTrack( const Point& rScreenPos )
{
TabBar* pParent = GetParent();
@@ -328,25 +334,17 @@ IMPL_LINK_NOARG(TabBarEdit, ImplEndTimerHdl)
struct TabBar_Impl
{
- std::unique_ptr<ImplTabSizer> mpSizer;
- std::unique_ptr<ImplTabButton> mpFirstButton;
- std::unique_ptr<ImplTabButton> mpPrevButton;
- std::unique_ptr<ImplTabButton> mpNextButton;
- std::unique_ptr<ImplTabButton> mpLastButton;
- std::unique_ptr<TabBarEdit> mpEdit;
- ImplTabBarList mpItemList;
+ ScopedVclPtr<ImplTabSizer> mpSizer;
+ ScopedVclPtr<ImplTabButton> mpFirstButton;
+ ScopedVclPtr<ImplTabButton> mpPrevButton;
+ ScopedVclPtr<ImplTabButton> mpNextButton;
+ ScopedVclPtr<ImplTabButton> mpLastButton;
+ ScopedVclPtr<TabBarEdit> mpEdit;
+ ImplTabBarList mpItemList;
svt::AccessibleFactoryAccess maAccessibleFactory;
- TabBar_Impl()
- : mpSizer()
- , mpFirstButton()
- , mpPrevButton()
- , mpNextButton()
- , mpLastButton()
- , mpEdit()
- , mpItemList()
- {}
+ TabBar_Impl() {}
~TabBar_Impl()
{
@@ -372,7 +370,14 @@ TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) :
TabBar::~TabBar()
{
+ disposeOnce();
+}
+
+void TabBar::dispose()
+{
EndEditMode( true );
+ mpImpl.reset();
+ Window::dispose();
}
const sal_uInt16 TabBar::APPEND = ::std::numeric_limits<sal_uInt16>::max();
@@ -650,14 +655,12 @@ void TabBar::ImplInitControls()
{
if (!mpImpl->mpSizer)
{
- mpImpl->mpSizer.reset(new ImplTabSizer( this, mnWinStyle & (WB_DRAG | WB_3DLOOK)));
+ mpImpl->mpSizer.reset(VclPtr<ImplTabSizer>::Create( this, mnWinStyle & (WB_DRAG | WB_3DLOOK)));
}
mpImpl->mpSizer->Show();
}
else
- {
- mpImpl->mpSizer.reset();
- }
+ mpImpl->mpSizer.disposeAndClear();
Link aLink = LINK( this, TabBar, ImplClickHdl );
@@ -665,7 +668,7 @@ void TabBar::ImplInitControls()
{
if (!mpImpl->mpPrevButton)
{
- mpImpl->mpPrevButton.reset(new ImplTabButton(this, WB_REPEAT));
+ mpImpl->mpPrevButton.reset(VclPtr<ImplTabButton>::Create(this, WB_REPEAT));
mpImpl->mpPrevButton->SetClickHdl(aLink);
}
mpImpl->mpPrevButton->SetSymbol(mbMirrored ? SymbolType::NEXT : SymbolType::PREV);
@@ -673,7 +676,7 @@ void TabBar::ImplInitControls()
if (!mpImpl->mpNextButton)
{
- mpImpl->mpNextButton.reset(new ImplTabButton(this, WB_REPEAT));
+ mpImpl->mpNextButton.reset(VclPtr<ImplTabButton>::Create(this, WB_REPEAT));
mpImpl->mpNextButton->SetClickHdl(aLink);
}
mpImpl->mpNextButton->SetSymbol(mbMirrored ? SymbolType::PREV : SymbolType::NEXT);
@@ -681,15 +684,15 @@ void TabBar::ImplInitControls()
}
else
{
- mpImpl->mpPrevButton.reset();
- mpImpl->mpNextButton.reset();
+ mpImpl->mpPrevButton.disposeAndClear();
+ mpImpl->mpNextButton.disposeAndClear();
}
if ( mnWinStyle & WB_SCROLL )
{
if (!mpImpl->mpFirstButton)
{
- mpImpl->mpFirstButton.reset(new ImplTabButton(this));
+ mpImpl->mpFirstButton.reset(VclPtr<ImplTabButton>::Create(this));
mpImpl->mpFirstButton->SetClickHdl(aLink);
}
mpImpl->mpFirstButton->SetSymbol(mbMirrored ? SymbolType::LAST : SymbolType::FIRST);
@@ -697,7 +700,7 @@ void TabBar::ImplInitControls()
if (!mpImpl->mpLastButton)
{
- mpImpl->mpLastButton.reset(new ImplTabButton(this));
+ mpImpl->mpLastButton.reset(VclPtr<ImplTabButton>::Create(this));
mpImpl->mpLastButton->SetClickHdl(aLink);
}
mpImpl->mpLastButton->SetSymbol(mbMirrored ? SymbolType::FIRST : SymbolType::LAST);
@@ -705,8 +708,8 @@ void TabBar::ImplInitControls()
}
else
{
- mpImpl->mpFirstButton.reset();
- mpImpl->mpLastButton.reset();
+ mpImpl->mpFirstButton.disposeAndClear();
+ mpImpl->mpLastButton.disposeAndClear();
}
mbHasInsertTab = (mnWinStyle & WB_INSERTTAB);
@@ -2176,7 +2179,7 @@ bool TabBar::StartEditMode( sal_uInt16 nPageId )
ImplFormat();
Update();
- mpImpl->mpEdit.reset(new TabBarEdit(this, WB_CENTER));
+ mpImpl->mpEdit.reset(VclPtr<TabBarEdit>::Create(this, WB_CENTER));
Rectangle aRect = GetPageRect( mnEditId );
long nX = aRect.Left();
long nWidth = aRect.GetWidth();
@@ -2262,7 +2265,8 @@ void TabBar::EndEditMode( bool bCancel )
else
{
// close edit and call end hdl
- mpImpl->mpEdit.reset();
+ mpImpl->mpEdit.disposeAndClear();
+
EndRenaming();
mnEditId = 0;
}
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 1896c2b28b71..af6805cb22e9 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -129,7 +129,7 @@ ToolbarMenuEntry::~ToolbarMenuEntry()
xComponent->dispose();
mxAccContext.clear();
}
- delete mpControl;
+ mpControl.disposeAndClear();
}
@@ -292,7 +292,7 @@ Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( Control* pControl
for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
{
ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
- if( pEntry && (pEntry->mpControl == pControl) )
+ if( pEntry && (pEntry->mpControl.get() == pControl) )
{
return pEntry->getAccessibleChild( childIndex );
}
@@ -393,7 +393,7 @@ void ToolbarMenu_Impl::notifyHighlightedEntry()
{
sal_Int32 nChildIndex = 0;
// todo: if other controls than ValueSet are allowed, addapt this code
- ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl );
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl.get() );
if( pValueSet )
nChildIndex = static_cast< sal_Int32 >( pValueSet->GetItemPos( pValueSet->GetSelectItemId() ) );
@@ -459,6 +459,11 @@ void ToolbarMenu::implInit(const Reference< XFrame >& rFrame)
ToolbarMenu::~ToolbarMenu()
{
+ disposeOnce();
+}
+
+void ToolbarMenu::dispose()
+{
vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
if ( pWindow )
static_cast<SystemWindow*>(pWindow)->GetTaskPaneList()->RemoveWindow( this );
@@ -478,6 +483,7 @@ ToolbarMenu::~ToolbarMenu()
}
delete mpImpl;
+ DockingWindow::dispose();
}
@@ -815,9 +821,9 @@ void ToolbarMenu::appendSeparator()
/** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */
-ValueSet* ToolbarMenu::createEmptyValueSetControl()
+VclPtr<ValueSet> ToolbarMenu::createEmptyValueSetControl()
{
- ValueSet* pSet = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
+ VclPtr<ValueSet> pSet = VclPtr<ValueSet>::Create( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
pSet->EnableFullItemMode( false );
pSet->SetColor( GetControlBackground() );
pSet->SetHighlightHdl( LINK( this, ToolbarMenu, HighlightHdl ) );
@@ -868,7 +874,7 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight )
{
if( !bHighlight )
{
- ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl );
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl.get() );
if( pValueSet )
{
pValueSet->SetNoSelection();
@@ -1571,7 +1577,7 @@ public:
virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
- ToolbarMenu* mpMenu;
+ VclPtr<ToolbarMenu> mpMenu;
};
@@ -1588,7 +1594,7 @@ ToolbarMenuStatusListener::ToolbarMenuStatusListener(
void SAL_CALL ToolbarMenuStatusListener::dispose() throw (::com::sun::star::uno::RuntimeException, std::exception)
{
- mpMenu = 0;
+ mpMenu.clear();
svt::FrameStatusListener::dispose();
}
diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx
index b54ad29c264a..0a688a37c717 100644
--- a/svtools/source/control/toolbarmenuimp.hxx
+++ b/svtools/source/control/toolbarmenuimp.hxx
@@ -76,7 +76,7 @@ public:
OUString maText;
Image maImage;
- Control* mpControl;
+ VclPtr<Control> mpControl;
Rectangle maRect;
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > mxAccContext;
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 341b2b47fbb9..c6aa67b65e20 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -755,7 +755,7 @@ void ValueSetAcc::ThrowIfDisposed()
}
else
{
- DBG_ASSERT (mpParent!=NULL, "ValueSetAcc not disposed but mpParent == NULL");
+ DBG_ASSERT (mpParent!=nullptr, "ValueSetAcc not disposed but mpParent == NULL");
}
}
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index 732079e78d18..567613d7de92 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -148,7 +148,7 @@ public:
private:
::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners;
- ValueSet* mpParent;
+ VclPtr<ValueSet> mpParent;
bool mbIsTransientChildrenDisabled;
/// The current FOCUSED state.
bool mbIsFocused;
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 67d28733fb80..ca07369dc0c3 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -89,14 +89,14 @@ void ValueSet::ImplInit()
mbHasVisibleItems = false;
// #106446#, #106601# force mirroring of virtual device
- maVirDev.EnableRTL( GetParent()->IsRTLEnabled() );
+ maVirDev->EnableRTL( GetParent()->IsRTLEnabled() );
ImplInitSettings( true, true, true );
}
ValueSet::ValueSet( vcl::Window* pParent, WinBits nWinStyle, bool bDisableTransientChildren ) :
Control( pParent, nWinStyle ),
- maVirDev( *this ),
+ maVirDev( VclPtr<VirtualDevice>::Create(*this) ),
maColor( COL_TRANSPARENT )
{
ImplInit();
@@ -116,7 +116,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeValueSet(vcl::Window *
ValueSet::ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTransientChildren ) :
Control( pParent, rResId ),
- maVirDev( *this ),
+ maVirDev( VclPtr<VirtualDevice>::Create(*this) ),
maColor( COL_TRANSPARENT )
{
ImplInit();
@@ -125,11 +125,18 @@ ValueSet::ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTran
ValueSet::~ValueSet()
{
+ disposeOnce();
+}
+
+void ValueSet::dispose()
+{
Reference<XComponent> xComponent(GetAccessible(false), UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
ImplDeleteItems();
+ mxScrollBar.disposeAndClear();
+ Control::dispose();
}
void ValueSet::ImplDeleteItems()
@@ -199,7 +206,7 @@ void ValueSet::ImplInitScrollBar()
{
if ( !mxScrollBar.get() )
{
- mxScrollBar.reset(new ScrollBar( this, WB_VSCROLL | WB_DRAG ));
+ mxScrollBar.reset(VclPtr<ScrollBar>::Create( this, WB_VSCROLL | WB_DRAG ));
mxScrollBar->SetScrollHdl( LINK( this, ValueSet, ImplScrollHdl ) );
}
else
@@ -232,7 +239,7 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
}
else
{
- DecorationView aView( &maVirDev );
+ DecorationView aView( maVirDev.get() );
aRect = aView.DrawFrame( aRect, mnFrameStyle );
}
}
@@ -246,11 +253,11 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
if ( pItem == mpNoneItem.get() )
{
- maVirDev.SetFont( GetFont() );
- maVirDev.SetTextColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor() );
- maVirDev.SetTextFillColor();
- maVirDev.SetFillColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuColor() : rStyleSettings.GetWindowColor() );
- maVirDev.DrawRect( aRect );
+ maVirDev->SetFont( GetFont() );
+ maVirDev->SetTextColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor() );
+ maVirDev->SetTextFillColor();
+ maVirDev->SetFillColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuColor() : rStyleSettings.GetWindowColor() );
+ maVirDev->DrawRect( aRect );
Point aTxtPos( aRect.Left() + 2, aRect.Top() );
long nTxtWidth = GetTextWidth( pItem->maText );
if ( nStyle & WB_RADIOSEL )
@@ -260,33 +267,33 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
}
if ( (aTxtPos.X()+nTxtWidth) > aRect.Right() )
{
- maVirDev.SetClipRegion( vcl::Region( aRect ) );
- maVirDev.DrawText( aTxtPos, pItem->maText );
- maVirDev.SetClipRegion();
+ maVirDev->SetClipRegion( vcl::Region( aRect ) );
+ maVirDev->DrawText( aTxtPos, pItem->maText );
+ maVirDev->SetClipRegion();
}
else
- maVirDev.DrawText( aTxtPos, pItem->maText );
+ maVirDev->DrawText( aTxtPos, pItem->maText );
}
else if ( pItem->meType == VALUESETITEM_COLOR )
{
- maVirDev.SetFillColor( pItem->maColor );
- maVirDev.DrawRect( aRect );
+ maVirDev->SetFillColor( pItem->maColor );
+ maVirDev->DrawRect( aRect );
}
else
{
if ( IsColor() )
- maVirDev.SetFillColor( maColor );
+ maVirDev->SetFillColor( maColor );
else if ( nStyle & WB_MENUSTYLEVALUESET )
- maVirDev.SetFillColor( rStyleSettings.GetMenuColor() );
+ maVirDev->SetFillColor( rStyleSettings.GetMenuColor() );
else if ( IsEnabled() )
- maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ maVirDev->SetFillColor( rStyleSettings.GetWindowColor() );
else
- maVirDev.SetFillColor( rStyleSettings.GetFaceColor() );
- maVirDev.DrawRect( aRect );
+ maVirDev->SetFillColor( rStyleSettings.GetFaceColor() );
+ maVirDev->DrawRect( aRect );
if ( pItem->meType == VALUESETITEM_USERDRAW )
{
- UserDrawEvent aUDEvt( &maVirDev, aRect, pItem->mnId );
+ UserDrawEvent aUDEvt( maVirDev.get(), aRect, pItem->mnId );
UserDraw( aUDEvt );
}
else
@@ -304,12 +311,12 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
if ( aImageSize.Width() > aRectSize.Width() ||
aImageSize.Height() > aRectSize.Height() )
{
- maVirDev.SetClipRegion( vcl::Region( aRect ) );
- maVirDev.DrawImage( aPos, pItem->maImage, nImageStyle);
- maVirDev.SetClipRegion();
+ maVirDev->SetClipRegion( vcl::Region( aRect ) );
+ maVirDev->DrawImage( aPos, pItem->maImage, nImageStyle);
+ maVirDev->SetClipRegion();
}
else
- maVirDev.DrawImage( aPos, pItem->maImage, nImageStyle );
+ maVirDev->DrawImage( aPos, pItem->maImage, nImageStyle );
}
}
@@ -324,7 +331,7 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
if(!aBlendFrame.IsEmpty())
{
- maVirDev.DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
+ maVirDev->DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
}
}
}
@@ -344,18 +351,15 @@ void ValueSet::Format()
long nOff;
long nNoneHeight;
long nNoneSpace;
- std::unique_ptr<ScrollBar> xDeletedScrollBar;
+ VclPtr<ScrollBar> xDeletedScrollBar;
// consider the scrolling
if ( nStyle & WB_VSCROLL )
ImplInitScrollBar();
else
{
- if ( mxScrollBar.get() )
- {
- // delete ScrollBar not until later, to prevent recursive calls
- xDeletedScrollBar.swap(mxScrollBar);
- }
+ xDeletedScrollBar = mxScrollBar;
+ mxScrollBar.clear();
}
// calculate item offset
@@ -486,9 +490,9 @@ void ValueSet::Format()
}
// Init VirDev
- maVirDev.SetSettings( GetSettings() );
- maVirDev.SetBackground( GetBackground() );
- maVirDev.SetOutputSizePixel( aWinSize, true );
+ maVirDev->SetSettings( GetSettings() );
+ maVirDev->SetBackground( GetBackground() );
+ maVirDev->SetOutputSizePixel( aWinSize, true );
// nothing is changed in case of too small items
if ( (mnItemWidth <= 0) ||
@@ -561,7 +565,7 @@ void ValueSet::Format()
}
// calculate and draw items
- maVirDev.SetLineColor();
+ maVirDev->SetLineColor();
long x = nStartX;
long y = nStartY;
@@ -668,6 +672,8 @@ void ValueSet::Format()
// waiting for the next since the formatting is finished
mbFormat = false;
+
+ xDeletedScrollBar.disposeAndClear();
}
void ValueSet::ImplDrawItemText(const OUString& rText)
@@ -901,7 +907,7 @@ void ValueSet::ImplHideSelect( sal_uInt16 nItemId )
HideFocus();
const Point aPos = aRect.TopLeft();
const Size aSize = aRect.GetSize();
- DrawOutDev( aPos, aSize, aPos, aSize, maVirDev );
+ DrawOutDev( aPos, aSize, aPos, aSize, *maVirDev.get() );
}
void ValueSet::ImplHighlightItem( sal_uInt16 nItemId, bool bIsSelection )
@@ -931,7 +937,7 @@ void ValueSet::ImplDraw()
HideFocus();
Point aDefPos;
- Size aSize = maVirDev.GetOutputSizePixel();
+ Size aSize = maVirDev->GetOutputSizePixel();
if ( mxScrollBar.get() && mxScrollBar->IsVisible() )
{
@@ -940,17 +946,17 @@ void ValueSet::ImplDraw()
Point aTempPos( 0, aScrPos.Y() );
Size aTempSize( aSize.Width(), aScrPos.Y() );
- DrawOutDev( aDefPos, aTempSize, aDefPos, aTempSize, maVirDev );
+ DrawOutDev( aDefPos, aTempSize, aDefPos, aTempSize, *maVirDev.get() );
aTempSize.Width() = aScrPos.X() - 1;
aTempSize.Height() = aScrSize.Height();
- DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, maVirDev );
+ DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, *maVirDev.get() );
aTempPos.Y() = aScrPos.Y() + aScrSize.Height();
aTempSize.Width() = aSize.Width();
aTempSize.Height() = aSize.Height() - aTempPos.Y();
- DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, maVirDev );
+ DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, *maVirDev.get() );
}
else
- DrawOutDev( aDefPos, aSize, aDefPos, aSize, maVirDev );
+ DrawOutDev( aDefPos, aSize, aDefPos, aSize, *maVirDev.get() );
// draw parting line to the Namefield
if ( GetStyle() & WB_NAMEFIELD )
@@ -1416,7 +1422,7 @@ void ValueSet::Paint( const Rectangle& )
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
SetLineColor();
SetFillColor( rStyleSettings.GetFaceColor() );
- long nOffY = maVirDev.GetOutputSizePixel().Height();
+ long nOffY = maVirDev->GetOutputSizePixel().Height();
Size aWinSize = GetOutputSizePixel();
DrawRect( Rectangle( Point( 0, nOffY ), Point( aWinSize.Width(), aWinSize.Height() ) ) );
}
diff --git a/svtools/source/control/vclxaccessibleheaderbar.cxx b/svtools/source/control/vclxaccessibleheaderbar.cxx
index 19a1e55540a8..7c928370ff4a 100644
--- a/svtools/source/control/vclxaccessibleheaderbar.cxx
+++ b/svtools/source/control/vclxaccessibleheaderbar.cxx
@@ -56,11 +56,10 @@ VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar( VCLXWindow* pVCLWindow )
:VCLXAccessibleComponent( pVCLWindow )
,m_pHeadBar(NULL)
{
- m_pHeadBar = static_cast< HeaderBar* >( GetWindow() );
+ m_pHeadBar = GetAs< HeaderBar >();
}
-
VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar()
{
}
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
index f6a76fa1ab79..7d4267bdf530 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -81,6 +81,18 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla
PlaceEditDialog::~PlaceEditDialog()
{
+ disposeOnce();
+}
+
+void PlaceEditDialog::dispose()
+{
+ m_pEDServerName.clear();
+ m_pLBServerType.clear();
+ m_pEDUsername.clear();
+ m_pBTOk.clear();
+ m_pBTCancel.clear();
+ m_pBTDelete.clear();
+ ModalDialog::dispose();
}
OUString PlaceEditDialog::GetServerUrl()
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 419b2b9efcc3..40a61577d89e 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -449,8 +449,8 @@ void AssignmentPersistentData::ImplCommit()
struct AddressBookSourceDialogData
{
- FixedText* pFieldLabels[FIELD_PAIRS_VISIBLE * 2];
- ListBox* pFields[FIELD_PAIRS_VISIBLE * 2];
+ VclPtr<FixedText> pFieldLabels[FIELD_PAIRS_VISIBLE * 2];
+ VclPtr<ListBox> pFields[FIELD_PAIRS_VISIBLE * 2];
/// when working transient, we need the data source
Reference< XDataSource >
@@ -733,7 +733,17 @@ void AssignmentPersistentData::ImplCommit()
AddressBookSourceDialog::~AddressBookSourceDialog()
{
+ disposeOnce();
+ }
+
+ void AddressBookSourceDialog::dispose()
+ {
delete m_pImpl;
+ m_pDatasource.clear();
+ m_pAdministrateDatasources.clear();
+ m_pTable.clear();
+ m_pFieldScroller.clear();
+ ModalDialog::dispose();
}
@@ -931,34 +941,34 @@ void AssignmentPersistentData::ImplCommit()
std::vector<OUString>::iterator aInitialSelection = m_pImpl->aFieldAssignments.begin() + m_pImpl->nFieldScrollPos;
- ListBox** pListbox = m_pImpl->pFields;
OUString sSaveSelection;
- for (sal_Int32 i=0; i<FIELD_CONTROLS_VISIBLE; ++i, ++pListbox, ++aInitialSelection)
+ for (sal_Int32 i=0; i<FIELD_CONTROLS_VISIBLE; ++i, ++aInitialSelection)
{
- sSaveSelection = (*pListbox)->GetSelectEntry();
+ VclPtr<ListBox>& pListbox = m_pImpl->pFields[i];
+ sSaveSelection = pListbox->GetSelectEntry();
- (*pListbox)->Clear();
+ pListbox->Clear();
// the one entry for "no selection"
- (*pListbox)->InsertEntry(m_sNoFieldSelection, 0);
+ pListbox->InsertEntry(m_sNoFieldSelection, 0);
// as it's entry data, set the index of the list box in our array
- (*pListbox)->SetEntryData(0, reinterpret_cast<void*>(i));
+ pListbox->SetEntryData(0, reinterpret_cast<void*>(i));
// the field names
for (pColumnNames = aColumnNames.getConstArray(); pColumnNames != pEnd; ++pColumnNames)
- (*pListbox)->InsertEntry(*pColumnNames);
+ pListbox->InsertEntry(*pColumnNames);
if (!aInitialSelection->isEmpty() && (aColumnNameSet.end() != aColumnNameSet.find(*aInitialSelection)))
// we can select the entry as specified in our field assignment array
- (*pListbox)->SelectEntry(*aInitialSelection);
+ pListbox->SelectEntry(*aInitialSelection);
else
// try to restore the selection
if (aColumnNameSet.end() != aColumnNameSet.find(sSaveSelection))
// the old selection is a valid column name
- (*pListbox)->SelectEntry(sSaveSelection);
+ pListbox->SelectEntry(sSaveSelection);
else
// select the <none> entry
- (*pListbox)->SelectEntryPos(0);
+ pListbox->SelectEntryPos(0);
}
// adjust m_pImpl->aFieldAssignments
@@ -999,14 +1009,14 @@ void AssignmentPersistentData::ImplCommit()
// loop through our field control rows and do some adjustments
// for the new texts
- FixedText** pLeftLabelControl = m_pImpl->pFieldLabels;
- FixedText** pRightLabelControl = pLeftLabelControl + 1;
+ VclPtr<FixedText>* pLeftLabelControl = m_pImpl->pFieldLabels;
+ VclPtr<FixedText>* pRightLabelControl = pLeftLabelControl + 1;
StringArray::const_iterator pLeftColumnLabel = m_pImpl->aFieldLabels.begin() + 2 * _nPos;
StringArray::const_iterator pRightColumnLabel = pLeftColumnLabel + 1;
// for the focus movement and the selection scroll
- ListBox** pLeftListControl = m_pImpl->pFields;
- ListBox** pRightListControl = pLeftListControl + 1;
+ VclPtr<ListBox>* pLeftListControl = m_pImpl->pFields;
+ VclPtr<ListBox>* pRightListControl = pLeftListControl + 1;
// for the focus movement
sal_Int32 nOldFocusRow = -1;
diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx
index 232aaf42e9b8..96ad7da2c80b 100644
--- a/svtools/source/dialogs/colrdlg.cxx
+++ b/svtools/source/dialogs/colrdlg.cxx
@@ -29,6 +29,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <svtools/colrdlg.hxx>
+#include <vcl/window.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx
index 72cff7fc2657..90b44eb856f3 100644
--- a/svtools/source/dialogs/prnsetup.cxx
+++ b/svtools/source/dialogs/prnsetup.cxx
@@ -53,8 +53,9 @@ void ImplFreePrnDlgListBox( ListBox* pBox, bool bClear )
Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn,
- Printer* pPrinter, Printer* pTempPrinter )
+ Printer* pPrinter, Printer* pTempPrinterIn )
{
+ VclPtr<Printer> pTempPrinter( pTempPrinterIn );
if ( pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
{
const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), true );
@@ -64,17 +65,17 @@ Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn,
{
if ( (pPrinter->GetName() == pInfo->GetPrinterName()) &&
(pPrinter->GetDriverName() == pInfo->GetDriver()) )
- pTempPrinter = new Printer( pPrinter->GetJobSetup() );
+ pTempPrinter = VclPtr<Printer>::Create( pPrinter->GetJobSetup() );
else
- pTempPrinter = new Printer( *pInfo );
+ pTempPrinter = VclPtr<Printer>::Create( *pInfo );
}
else
{
if ( (pTempPrinter->GetName() != pInfo->GetPrinterName()) ||
(pTempPrinter->GetDriverName() != pInfo->GetDriver()) )
{
- delete pTempPrinter;
- pTempPrinter = new Printer( *pInfo );
+ pTempPrinter.disposeAndClear();
+ pTempPrinter = VclPtr<Printer>::Create( *pInfo );
}
}
@@ -91,8 +92,9 @@ Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn,
-Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinter )
+Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinterIn )
{
+ VclPtr<Printer> pTempPrinter( pTempPrinterIn );
OUString aPrnName;
if ( pTempPrinter )
aPrnName = pTempPrinter->GetName();
@@ -101,8 +103,7 @@ Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinter )
if ( ! Printer::GetQueueInfo( aPrnName, false ) )
{
- if ( pTempPrinter )
- delete pTempPrinter;
+ pTempPrinter.disposeAndClear();
pTempPrinter = new Printer;
}
@@ -245,11 +246,23 @@ PrinterSetupDialog::PrinterSetupDialog(vcl::Window* pParent)
PrinterSetupDialog::~PrinterSetupDialog()
{
- ImplFreePrnDlgListBox(m_pLbName, false);
- delete mpTempPrinter;
+ disposeOnce();
}
-
+void PrinterSetupDialog::dispose()
+{
+ ImplFreePrnDlgListBox(m_pLbName, false);
+ m_pLbName.clear();
+ m_pBtnProperties.clear();
+ m_pBtnOptions.clear();
+ m_pFiStatus.clear();
+ m_pFiType.clear();
+ m_pFiLocation.clear();
+ m_pFiComment.clear();
+ mpTempPrinter.disposeAndClear();
+ mpPrinter.clear();
+ ModalDialog::dispose();
+}
void PrinterSetupDialog::SetOptionsHdl( const Link& rLink )
{
@@ -293,7 +306,7 @@ IMPL_LINK_NOARG(PrinterSetupDialog, ImplStatusHdl)
IMPL_LINK_NOARG(PrinterSetupDialog, ImplPropertiesHdl)
{
if ( !mpTempPrinter )
- mpTempPrinter = new Printer( mpPrinter->GetJobSetup() );
+ mpTempPrinter = VclPtr<Printer>::Create( mpPrinter->GetJobSetup() );
mpTempPrinter->Setup( this );
return 0;
diff --git a/svtools/source/dialogs/restartdialog.cxx b/svtools/source/dialogs/restartdialog.cxx
index d116d9b1bfc2..1e99d16c3d36 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -47,14 +47,21 @@ public:
btnYes_->SetClickHdl(LINK(this, RestartDialog, hdlYes));
btnNo_->SetClickHdl(LINK(this, RestartDialog, hdlNo));
}
-
+ virtual ~RestartDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ reason_.clear();
+ btnYes_.clear();
+ btnNo_.clear();
+ ModalDialog::dispose();
+ }
private:
DECL_LINK(hdlYes, void *);
DECL_LINK(hdlNo, void *);
- vcl::Window * reason_;
- PushButton * btnYes_;
- PushButton * btnNo_;
+ VclPtr<vcl::Window> reason_;
+ VclPtr<PushButton> btnYes_;
+ VclPtr<PushButton> btnNo_;
};
IMPL_LINK_NOARG(RestartDialog, hdlYes) {
diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx
index aa9fb5c0843d..71d751fdf455 100644
--- a/svtools/source/dialogs/roadmapwizard.cxx
+++ b/svtools/source/dialogs/roadmapwizard.cxx
@@ -55,7 +55,7 @@ namespace svt
struct RoadmapWizardImpl : public RoadmapWizardTypes
{
- ORoadmap* pRoadmap;
+ ScopedVclPtr<ORoadmap> pRoadmap;
Paths aPaths;
PathId nActivePath;
StateDescriptions aStateDescriptors;
@@ -69,11 +69,6 @@ namespace svt
{
}
- ~RoadmapWizardImpl()
- {
- delete pRoadmap;
- }
-
/// returns the index of the current state in given path, or -1
static sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, const WizardPath& _rPath );
/// returns the index of the current state in the path with the given id, or -1
@@ -137,7 +132,7 @@ namespace svt
SetLeftAlignedButtonCount( 1 );
SetEmptyViewMargin();
- m_pImpl->pRoadmap = new ORoadmap( this, WB_TABSTOP );
+ m_pImpl->pRoadmap.reset( VclPtr<ORoadmap>::Create( this, WB_TABSTOP ) );
m_pImpl->pRoadmap->SetText( SVT_RESSTR( STR_WIZDLG_ROADMAP_TITLE ) );
m_pImpl->pRoadmap->SetPosPixel( Point( 0, 0 ) );
m_pImpl->pRoadmap->SetItemSelectHdl( LINK( this, RoadmapWizard, OnRoadmapItemSelected ) );
@@ -154,7 +149,13 @@ namespace svt
RoadmapWizard::~RoadmapWizard()
{
+ disposeOnce();
+ }
+
+ void RoadmapWizard::dispose()
+ {
delete m_pImpl;
+ OWizardMachine::dispose();
}
@@ -531,9 +532,9 @@ namespace svt
}
- TabPage* RoadmapWizard::createPage( WizardState _nState )
+ VclPtr<TabPage> RoadmapWizard::createPage( WizardState _nState )
{
- TabPage* pPage( NULL );
+ VclPtr<TabPage> pPage;
StateDescriptions::const_iterator pos = m_pImpl->aStateDescriptors.find( _nState );
OSL_ENSURE( pos != m_pImpl->aStateDescriptors.end(),
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index 6cc223397b54..8864376ed343 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -49,7 +49,13 @@ namespace svt
OWizardPage::~OWizardPage()
{
+ disposeOnce();
+ }
+
+ void OWizardPage::dispose()
+ {
delete m_pImpl;
+ TabPage::dispose();
}
void OWizardPage::initializePage()
@@ -133,7 +139,7 @@ namespace svt
// the help button
if (_nButtonFlags & WZB_HELP)
{
- m_pHelp= new HelpButton(this, WB_TABSTOP);
+ m_pHelp= VclPtr<HelpButton>::Create(this, WB_TABSTOP);
m_pHelp->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pHelp->Show();
AddButton( m_pHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X);
@@ -142,7 +148,7 @@ namespace svt
// the previous button
if (_nButtonFlags & WZB_PREVIOUS)
{
- m_pPrevPage = new PushButton(this, WB_TABSTOP);
+ m_pPrevPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
m_pPrevPage->SetHelpId( HID_WIZARD_PREVIOUS );
m_pPrevPage->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pPrevPage->SetText(SVT_RESSTR(STR_WIZDLG_PREVIOUS));
@@ -159,7 +165,7 @@ namespace svt
// the next button
if (_nButtonFlags & WZB_NEXT)
{
- m_pNextPage = new PushButton(this, WB_TABSTOP);
+ m_pNextPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
m_pNextPage->SetHelpId( HID_WIZARD_NEXT );
m_pNextPage->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pNextPage->SetText(OUString(SVT_RESSTR(STR_WIZDLG_NEXT)));
@@ -173,7 +179,7 @@ namespace svt
// the finish button
if (_nButtonFlags & WZB_FINISH)
{
- m_pFinish = new OKButton(this, WB_TABSTOP);
+ m_pFinish = VclPtr<OKButton>::Create(this, WB_TABSTOP);
m_pFinish->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pFinish->SetText(SVT_RESSTR(STR_WIZDLG_FINISH));
m_pFinish->Show();
@@ -185,7 +191,7 @@ namespace svt
// the cancel button
if (_nButtonFlags & WZB_CANCEL)
{
- m_pCancel = new CancelButton(this, WB_TABSTOP);
+ m_pCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP);
m_pCancel->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pCancel->Show();
@@ -196,16 +202,22 @@ namespace svt
OWizardMachine::~OWizardMachine()
{
- delete m_pFinish;
- delete m_pCancel;
- delete m_pNextPage;
- delete m_pPrevPage;
- delete m_pHelp;
+ disposeOnce();
+ }
+
+ void OWizardMachine::dispose()
+ {
+ m_pFinish.disposeAndClear();
+ m_pCancel.disposeAndClear();
+ m_pNextPage.disposeAndClear();
+ m_pPrevPage.disposeAndClear();
+ m_pHelp.disposeAndClear();
for (WizardState i=0; i<m_pImpl->nFirstUnknownPage; ++i)
- delete GetPage(i);
+ GetPage(i)->disposeOnce();
delete m_pImpl;
+ WizardDialog::dispose();
}
diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx
index 5c42e0c6f93e..0d0acc4e5242 100644
--- a/svtools/source/dialogs/wizdlg.cxx
+++ b/svtools/source/dialogs/wizdlg.cxx
@@ -34,7 +34,7 @@
struct ImplWizPageData
{
ImplWizPageData* mpNext;
- TabPage* mpPage;
+ VclPtr<TabPage> mpPage;
};
@@ -42,7 +42,7 @@ struct ImplWizPageData
struct ImplWizButtonData
{
ImplWizButtonData* mpNext;
- Button* mpButton;
+ VclPtr<Button> mpButton;
long mnOffset;
};
@@ -363,6 +363,11 @@ WizardDialog::WizardDialog( vcl::Window* pParent, const OUString& rID, const OUS
WizardDialog::~WizardDialog()
{
+ disposeOnce();
+}
+
+void WizardDialog::dispose()
+{
maWizardLayoutIdle.Stop();
// Remove all buttons
@@ -372,6 +377,12 @@ WizardDialog::~WizardDialog()
// Remove all pages
while ( mpFirstPage )
RemovePage( mpFirstPage->mpPage );
+
+ mpCurTabPage.clear();
+ mpPrevBtn.clear();
+ mpNextBtn.clear();
+ mpViewWindow.clear();
+ ModalDialog::dispose();
}
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx
index 8b8bbb6228fa..3d2c97701204 100644
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ b/svtools/source/edit/editsyntaxhighlighter.cxx
@@ -36,10 +36,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeMultiLineEditSyntaxHig
return new MultiLineEditSyntaxHighlight(pParent);
}
-MultiLineEditSyntaxHighlight::~MultiLineEditSyntaxHighlight()
-{
-}
-
void MultiLineEditSyntaxHighlight::SetText(const OUString& rNewText)
{
MultiLineEdit::SetText(rNewText);
diff --git a/svtools/source/edit/svmedit2.cxx b/svtools/source/edit/svmedit2.cxx
index 9bb4c5f85478..4024cccdc9d5 100644
--- a/svtools/source/edit/svmedit2.cxx
+++ b/svtools/source/edit/svmedit2.cxx
@@ -22,13 +22,7 @@
#include <vcl/xtextedt.hxx>
ExtMultiLineEdit::ExtMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle ) :
-
MultiLineEdit( pParent, nWinStyle )
-
-{
-}
-
-ExtMultiLineEdit::~ExtMultiLineEdit()
{
}
diff --git a/svtools/source/filter/GraphicExportOptionsDialog.cxx b/svtools/source/filter/GraphicExportOptionsDialog.cxx
index 20e2ed7fc28d..8277304d537c 100644
--- a/svtools/source/filter/GraphicExportOptionsDialog.cxx
+++ b/svtools/source/filter/GraphicExportOptionsDialog.cxx
@@ -44,7 +44,17 @@ GraphicExportOptionsDialog::GraphicExportOptionsDialog(vcl::Window* pWindow, con
}
GraphicExportOptionsDialog::~GraphicExportOptionsDialog()
-{}
+{
+ disposeOnce();
+}
+
+void GraphicExportOptionsDialog::dispose()
+{
+ mpWidth.clear();
+ mpHeight.clear();
+ mpResolution.clear();
+ ModalDialog::dispose();
+}
void GraphicExportOptionsDialog::initialize()
{
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index ce1f4ff454e3..9d16cc0758e7 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -979,8 +979,47 @@ void ExportDialog::updateControls()
ExportDialog::~ExportDialog()
{
+ disposeOnce();
+}
+
+void ExportDialog::dispose()
+{
delete mpFilterOptionsItem;
delete mpOptionsItem;
+ mpMfSizeX.clear();
+ mpLbSizeX.clear();
+ mpMfSizeY.clear();
+ mpFtResolution.clear();
+ mpNfResolution.clear();
+ mpLbResolution.clear();
+ mpColorDepth.clear();
+ mpLbColorDepth.clear();
+ mpJPGQuality.clear();
+ mpPNGCompression.clear();
+ mpSbCompression.clear();
+ mpNfCompression.clear();
+ mpMode.clear();
+ mpCbInterlaced.clear();
+ mpBMPCompression.clear();
+ mpCbRLEEncoding.clear();
+ mpDrawingObjects.clear();
+ mpCbSaveTransparency.clear();
+ mpEncoding.clear();
+ mpRbBinary.clear();
+ mpRbText.clear();
+ mpEPSGrid.clear();
+ mpCbEPSPreviewTIFF.clear();
+ mpCbEPSPreviewEPSI.clear();
+ mpRbEPSLevel1.clear();
+ mpRbEPSLevel2.clear();
+ mpRbEPSColorFormat1.clear();
+ mpRbEPSColorFormat2.clear();
+ mpRbEPSCompressionLZW.clear();
+ mpRbEPSCompressionNone.clear();
+ mpInfo.clear();
+ mpFtEstimatedSize.clear();
+ mpBtnOK.clear();
+ ModalDialog::dispose();
}
diff --git a/svtools/source/filter/exportdialog.hxx b/svtools/source/filter/exportdialog.hxx
index 3cc1cd6968b4..4df7cdc0f5a3 100644
--- a/svtools/source/filter/exportdialog.hxx
+++ b/svtools/source/filter/exportdialog.hxx
@@ -53,49 +53,49 @@ private:
const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >&
mxSourceDocument;
- NumericField* mpMfSizeX;
- ListBox* mpLbSizeX;
- NumericField* mpMfSizeY;
- FixedText* mpFtResolution;
- NumericField* mpNfResolution;
- ListBox* mpLbResolution;
+ VclPtr<NumericField> mpMfSizeX;
+ VclPtr<ListBox> mpLbSizeX;
+ VclPtr<NumericField> mpMfSizeY;
+ VclPtr<FixedText> mpFtResolution;
+ VclPtr<NumericField> mpNfResolution;
+ VclPtr<ListBox> mpLbResolution;
- VclContainer* mpColorDepth;
- ListBox* mpLbColorDepth;
+ VclPtr<VclContainer> mpColorDepth;
+ VclPtr<ListBox> mpLbColorDepth;
- VclContainer* mpJPGQuality;
- VclContainer* mpPNGCompression;
+ VclPtr<VclContainer> mpJPGQuality;
+ VclPtr<VclContainer> mpPNGCompression;
- ScrollBar* mpSbCompression;
- NumericField* mpNfCompression;
+ VclPtr<ScrollBar> mpSbCompression;
+ VclPtr<NumericField> mpNfCompression;
- VclContainer* mpMode;
- CheckBox* mpCbInterlaced;
+ VclPtr<VclContainer> mpMode;
+ VclPtr<CheckBox> mpCbInterlaced;
- VclContainer* mpBMPCompression;
- CheckBox* mpCbRLEEncoding;
+ VclPtr<VclContainer> mpBMPCompression;
+ VclPtr<CheckBox> mpCbRLEEncoding;
- VclContainer* mpDrawingObjects;
- CheckBox* mpCbSaveTransparency;
+ VclPtr<VclContainer> mpDrawingObjects;
+ VclPtr<CheckBox> mpCbSaveTransparency;
- VclContainer* mpEncoding;
- RadioButton* mpRbBinary;
- RadioButton* mpRbText;
+ VclPtr<VclContainer> mpEncoding;
+ VclPtr<RadioButton> mpRbBinary;
+ VclPtr<RadioButton> mpRbText;
- VclContainer* mpEPSGrid;
- CheckBox* mpCbEPSPreviewTIFF;
- CheckBox* mpCbEPSPreviewEPSI;
- RadioButton* mpRbEPSLevel1;
- RadioButton* mpRbEPSLevel2;
- RadioButton* mpRbEPSColorFormat1;
- RadioButton* mpRbEPSColorFormat2;
- RadioButton* mpRbEPSCompressionLZW;
- RadioButton* mpRbEPSCompressionNone;
+ VclPtr<VclContainer> mpEPSGrid;
+ VclPtr<CheckBox> mpCbEPSPreviewTIFF;
+ VclPtr<CheckBox> mpCbEPSPreviewEPSI;
+ VclPtr<RadioButton> mpRbEPSLevel1;
+ VclPtr<RadioButton> mpRbEPSLevel2;
+ VclPtr<RadioButton> mpRbEPSColorFormat1;
+ VclPtr<RadioButton> mpRbEPSColorFormat2;
+ VclPtr<RadioButton> mpRbEPSCompressionLZW;
+ VclPtr<RadioButton> mpRbEPSCompressionNone;
- VclContainer* mpInfo;
- FixedText* mpFtEstimatedSize;
+ VclPtr<VclContainer> mpInfo;
+ VclPtr<FixedText> mpFtEstimatedSize;
- OKButton* mpBtnOK;
+ VclPtr<OKButton> mpBtnOK;
OUString msEstimatedSizePix1;
OUString msEstimatedSizePix2;
@@ -127,9 +127,9 @@ private:
com::sun::star::awt::Size
maSize; // for vector graphics it always contains the logical size in 1/100mm
- bool mbIsPixelFormat;
- bool mbExportSelection;
- bool mbPreserveAspectRatio;
+ bool mbIsPixelFormat;
+ bool mbExportSelection;
+ bool mbPreserveAspectRatio;
sal_Int32 mnInitialResolutionUnit;
@@ -179,6 +179,7 @@ public:
const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument,
bool bExportSelection, bool bIsExportVectorFormat );
virtual ~ExportDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 06f0397c5b4e..46b48091fb9f 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -1894,19 +1894,19 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c
// First combine very small bitmaps into a larger tile
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
const int nNumTilesInCacheX( (nTileCacheSize1D + rSizePixel.Width()-1) / rSizePixel.Width() );
const int nNumTilesInCacheY( (nTileCacheSize1D + rSizePixel.Height()-1) / rSizePixel.Height() );
- aVDev.SetOutputSizePixel( Size( nNumTilesInCacheX*rSizePixel.Width(),
+ aVDev->SetOutputSizePixel( Size( nNumTilesInCacheX*rSizePixel.Width(),
nNumTilesInCacheY*rSizePixel.Height() ) );
- aVDev.SetMapMode( aMapMode );
+ aVDev->SetMapMode( aMapMode );
// draw bitmap content
- if( ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX,
+ if( ImplRenderTempTile( *aVDev.get(), SubdivisionExponent, nNumTilesInCacheX,
nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) )
{
- BitmapEx aTileBitmap( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) );
+ BitmapEx aTileBitmap( aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ) );
// draw alpha content, if any
if( IsTransparent() )
@@ -1918,16 +1918,16 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c
else
aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetMask() );
- if( aAlphaGraphic.ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX,
+ if( aAlphaGraphic.ImplRenderTempTile( *aVDev.get(), SubdivisionExponent, nNumTilesInCacheX,
nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) )
{
// Combine bitmap and alpha/mask
if( GetGraphic().IsAlpha() )
aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(),
- AlphaMask( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) ) );
+ AlphaMask( aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ) ) );
else
aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(),
- aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ).CreateMask( Color(COL_WHITE) ) );
+ aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ).CreateMask( Color(COL_WHITE) ) );
}
}
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 1229ba122c4c..9e7283ca42b4 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -634,7 +634,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
}
else if ( ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) && nImageResolution )
{
- VirtualDevice aDummyVDev;
+ ScopedVclPtrInstance< VirtualDevice > aDummyVDev;
GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() );
Size aMtfSize( OutputDevice::LogicToLogic( aMtf.GetPrefSize(), aMtf.GetPrefMapMode(), MAP_100TH_MM ) );
if ( aMtfSize.Width() && aMtfSize.Height() )
@@ -642,8 +642,8 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
MapMode aNewMapMode( MAP_100TH_MM );
aNewMapMode.SetScaleX( static_cast< double >( aLogicalSize.Width ) / static_cast< double >( aMtfSize.Width() ) );
aNewMapMode.SetScaleY( static_cast< double >( aLogicalSize.Height ) / static_cast< double >( aMtfSize.Height() ) );
- aDummyVDev.EnableOutput( false );
- aDummyVDev.SetMapMode( aNewMapMode );
+ aDummyVDev->EnableOutput( false );
+ aDummyVDev->SetMapMode( aNewMapMode );
for( size_t i = 0, nObjCount = aMtf.GetActionSize(); i < nObjCount; i++ )
{
@@ -653,18 +653,18 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
// only optimizing common bitmap actions:
case( META_MAPMODE_ACTION ):
{
- const_cast< MetaAction* >( pAction )->Execute( &aDummyVDev );
+ const_cast< MetaAction* >( pAction )->Execute( aDummyVDev.get() );
break;
}
case( META_PUSH_ACTION ):
{
const MetaPushAction* pA = static_cast<const MetaPushAction*>(pAction);
- aDummyVDev.Push( pA->GetFlags() );
+ aDummyVDev->Push( pA->GetFlags() );
break;
}
case( META_POP_ACTION ):
{
- aDummyVDev.Pop();
+ aDummyVDev->Pop();
break;
}
case( META_BMPSCALE_ACTION ):
@@ -688,8 +688,8 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
aSize = pScaleAction->GetSize();
}
::Graphic aGraphic( aBmpEx );
- const Size aSize100thmm( aDummyVDev.LogicToPixel( aSize ) );
- Size aSize100thmm2( aDummyVDev.PixelToLogic( aSize100thmm, MAP_100TH_MM ) );
+ const Size aSize100thmm( aDummyVDev->LogicToPixel( aSize ) );
+ Size aSize100thmm2( aDummyVDev->PixelToLogic( aSize100thmm, MAP_100TH_MM ) );
ImplApplyBitmapResolution( aGraphic, nImageResolution,
aGraphic.GetSizePixel(), awt::Size( aSize100thmm2.Width(), aSize100thmm2.Height() ) );
diff --git a/svtools/source/hatchwindow/hatchwindow.cxx b/svtools/source/hatchwindow/hatchwindow.cxx
index dc1828d08642..3ca665552db0 100644
--- a/svtools/source/hatchwindow/hatchwindow.cxx
+++ b/svtools/source/hatchwindow/hatchwindow.cxx
@@ -55,7 +55,7 @@ void VCLXHatchWindow::initializeWindow( const uno::Reference< awt::XWindowPeer >
if ( !pParent )
throw lang::IllegalArgumentException(); // TODO
- pHatchWindow = new SvResizeWindow( pParent, this );
+ pHatchWindow = VclPtr<SvResizeWindow>::Create( pParent, this );
pHatchWindow->setPosSizePixel( aBounds.X, aBounds.Y, aBounds.Width, aBounds.Height );
aHatchBorderSize = aSize;
pHatchWindow->SetHatchBorderPixel( Size( aSize.Width, aSize.Height ) );
@@ -188,7 +188,7 @@ void SAL_CALL VCLXHatchWindow::setController( const uno::Reference< embed::XHatc
void SAL_CALL VCLXHatchWindow::dispose()
throw (uno::RuntimeException, std::exception)
{
- pHatchWindow = 0;
+ pHatchWindow.clear();
VCLXWindow::dispose();
}
diff --git a/svtools/source/inc/hatchwindow.hxx b/svtools/source/inc/hatchwindow.hxx
index b08e13ee0e14..1fb06de64531 100644
--- a/svtools/source/inc/hatchwindow.hxx
+++ b/svtools/source/inc/hatchwindow.hxx
@@ -31,7 +31,7 @@ class VCLXHatchWindow : public ::com::sun::star::embed::XHatchWindow,
{
::com::sun::star::uno::Reference< ::com::sun::star::embed::XHatchWindowController > m_xController;
::com::sun::star::awt::Size aHatchBorderSize;
- SvResizeWindow* pHatchWindow;
+ VclPtr<SvResizeWindow> pHatchWindow;
public:
VCLXHatchWindow();
diff --git a/svtools/source/inc/renderer.hxx b/svtools/source/inc/renderer.hxx
index b50088d2e737..ca3417b640f4 100644
--- a/svtools/source/inc/renderer.hxx
+++ b/svtools/source/inc/renderer.hxx
@@ -70,7 +70,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxDevice;
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
Rectangle maDestRect;
::com::sun::star::uno::Any maRenderData;
};
diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx
index b2802168ba29..4f0c79f5e3db 100644
--- a/svtools/source/inc/svimpbox.hxx
+++ b/svtools/source/inc/svimpbox.hxx
@@ -47,7 +47,7 @@ class ImpLBSelEng : public FunctionSet
{
SvImpLBox* pImp;
SelectionEngine* pSelEng;
- SvTreeListBox* pView;
+ VclPtr<SvTreeListBox> pView;
public:
ImpLBSelEng( SvImpLBox* pImp, SelectionEngine* pSelEng,
@@ -86,7 +86,7 @@ class SvImpLBox
friend class ImpLBSelEng;
friend class SvTreeListBox;
private:
- SvTreeListBox* pView;
+ VclPtr<SvTreeListBox> pView;
SvTreeList* pTree;
SvTreeListEntry* pCursor;
SvTreeListEntry* pStartEntry;
@@ -96,9 +96,9 @@ private:
SvTreeListEntry* pActiveEntry;
SvLBoxTab* pActiveTab;
- ScrollBar aVerSBar;
- ScrollBar aHorSBar;
- ScrollBarBox aScrBarBox;
+ VclPtr<ScrollBar> aVerSBar;
+ VclPtr<ScrollBar> aHorSBar;
+ VclPtr<ScrollBarBox> aScrBarBox;
::svt::AccessibleFactoryAccess
m_aFactoryAccess;
@@ -329,7 +329,7 @@ public:
void SetUpdateMode( bool bMode );
bool GetUpdateMode() const { return bUpdateMode; }
Rectangle GetClipRegionRect() const;
- bool HasHorScrollBar() const { return aHorSBar.IsVisible(); }
+ bool HasHorScrollBar() const { return aHorSBar->IsVisible(); }
void ShowFocusRect( const SvTreeListEntry* pEntry );
void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx
index 1bb9e736fddb..a96624ebc5dc 100644
--- a/svtools/source/inc/unoiface.hxx
+++ b/svtools/source/inc/unoiface.hxx
@@ -124,7 +124,7 @@ public:
VCLXFileControl();
virtual ~VCLXFileControl();
- void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
+ virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -176,8 +176,6 @@ protected:
sal_Int32 nKeyToSetDelayed;
- FormattedField* GetFormattedField() const { return static_cast<FormattedField*>(GetWindow()); }
-
public:
SVTXFormattedField();
virtual ~SVTXFormattedField();
@@ -210,7 +208,7 @@ protected:
void NotifyTextListeners();
::com::sun::star::uno::Any convertEffectiveValue(const ::com::sun::star::uno::Any& rValue);
- virtual void SetWindow(vcl::Window* _pWindow) SAL_OVERRIDE;
+ virtual void SetWindow( const VclPtr< vcl::Window > &_pWindow) SAL_OVERRIDE;
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) SAL_OVERRIDE { return ImplGetPropertyIds( aIds ); }
@@ -250,8 +248,7 @@ private:
static RMItemData GetRMItemData( const ::com::sun::star::container::ContainerEvent& _rEvent );
protected:
- ::svt::ORoadmap* GetRoadmap() const;
- void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
virtual ~SVTXRoadmap();
diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx
index 15e797d18dfe..e380fb1972cf 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -122,9 +122,9 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
// No suitable JRE found
SolarMutexGuard aSolarGuard;
m_bJavaNotFound_Handled = true;
- MessageDialog aWarningBox(NULL, SvtResId(STR_WARNING_JAVANOTFOUND), VCL_MESSAGE_WARNING);
- aWarningBox.SetText(SvtResId(STR_WARNING_JAVANOTFOUND_TITLE));
- nResult = aWarningBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_JAVANOTFOUND), VCL_MESSAGE_WARNING);
+ aWarningBox->SetText(SvtResId(STR_WARNING_JAVANOTFOUND_TITLE));
+ nResult = aWarningBox->Execute();
}
else
{
@@ -139,12 +139,12 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
SolarMutexGuard aSolarGuard;
m_bInvalidSettings_Handled = true;
#ifdef MACOSX
- MessageDialog aWarningBox(NULL, SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC), VCL_MESSAGE_WARNING);
+ ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC), VCL_MESSAGE_WARNING);
#else
- MessageDialog aWarningBox(NULL, SvtResId(STR_WARNING_INVALIDJAVASETTINGS), VCL_MESSAGE_WARNING);
+ ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_INVALIDJAVASETTINGS), VCL_MESSAGE_WARNING);
#endif
- aWarningBox.SetText(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE));
- nResult = aWarningBox.Execute();
+ aWarningBox->SetText(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE));
+ nResult = aWarningBox->Execute();
}
else
{
@@ -158,9 +158,9 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
SolarMutexGuard aSolarGuard;
m_bJavaDisabled_Handled = true;
// Java disabled. Give user a chance to enable Java inside Office.
- MessageDialog aQueryBox(NULL, "JavaDisabledDialog",
- "svt/ui/javadisableddialog.ui");
- nResult = aQueryBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aQueryBox(nullptr , "JavaDisabledDialog",
+ "svt/ui/javadisableddialog.ui");
+ nResult = aQueryBox->Execute();
if ( nResult == RET_YES )
{
jfw_setEnabled(sal_True);
@@ -182,12 +182,12 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
SolarMutexGuard aSolarGuard;
m_bVMCreationFailure_Handled = true;
#ifdef MACOSX
- MessageDialog aErrorBox(NULL, SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC));
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC));
#else
- MessageDialog aErrorBox(NULL, SvtResId(STR_ERROR_JVMCREATIONFAILED));
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SvtResId(STR_ERROR_JVMCREATIONFAILED));
#endif
- aErrorBox.SetText(SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE));
- nResult = aErrorBox.Execute();
+ aErrorBox->SetText(SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE));
+ nResult = aErrorBox->Execute();
}
else
{
diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx
index 987e841d01ce..b381c43d4bd7 100644
--- a/svtools/source/misc/dialogcontrolling.cxx
+++ b/svtools/source/misc/dialogcontrolling.cxx
@@ -50,7 +50,7 @@ namespace svt
struct DialogController_Data
{
vcl::Window& rInstigator;
- ::std::vector< vcl::Window* > aConcernedWindows;
+ ::std::vector< VclPtr<vcl::Window> > aConcernedWindows;
PWindowEventFilter pEventFilter;
PWindowOperator pOperator;
@@ -111,7 +111,7 @@ namespace svt
void DialogController::impl_updateAll( const VclWindowEvent& _rTriggerEvent )
{
- for ( ::std::vector< vcl::Window* >::iterator loop = m_pImpl->aConcernedWindows.begin();
+ for ( auto loop = m_pImpl->aConcernedWindows.begin();
loop != m_pImpl->aConcernedWindows.end();
++loop
)
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 05d8b3a75bb6..fa8cf14fed01 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -89,23 +89,23 @@ static sal_uInt16 aWndFunc(
aErr = aErr.replaceAll("$(ACTION)", aAction);
aErr = aErr.replaceAll("$(ERROR)", rErr);
- boost::scoped_ptr<MessBox> pBox;
+ VclPtr<MessBox> pBox;
switch ( nFlags & 0xf000 )
{
case ERRCODE_MSG_ERROR:
- pBox.reset(new ErrorBox(pWin, eBits, aErr));
+ pBox.reset(VclPtr<ErrorBox>::Create(pWin, eBits, aErr));
break;
case ERRCODE_MSG_WARNING:
- pBox.reset(new WarningBox(pWin, eBits, aErr));
+ pBox.reset(VclPtr<WarningBox>::Create(pWin, eBits, aErr));
break;
case ERRCODE_MSG_INFO:
- pBox.reset(new InfoBox(pWin, aErr));
+ pBox.reset(VclPtr<InfoBox>::Create(pWin, aErr));
break;
case ERRCODE_MSG_QUERY:
- pBox.reset(new QueryBox(pWin, eBits, aErr));
+ pBox.reset(VclPtr<QueryBox>::Create(pWin, eBits, aErr));
break;
default:
diff --git a/svtools/source/misc/sampletext.cxx b/svtools/source/misc/sampletext.cxx
index 40f5d7d45121..63d8c9a9346f 100644
--- a/svtools/source/misc/sampletext.cxx
+++ b/svtools/source/misc/sampletext.cxx
@@ -1623,12 +1623,12 @@ OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const vcl::Font &r
{
OUString sRet(makeRepresentativeTextForLanguage(rFont.GetLanguage()));
- VirtualDevice aDevice;
- if (sRet.isEmpty() || (-1 != aDevice.HasGlyphs(rFont, sRet)))
+ ScopedVclPtrInstance< VirtualDevice > aDevice;
+ if (sRet.isEmpty() || (-1 != aDevice->HasGlyphs(rFont, sRet)))
{
- aDevice.SetFont(rFont);
+ aDevice->SetFont(rFont);
vcl::FontCapabilities aFontCapabilities;
- if (aDevice.GetFontCapabilities(aFontCapabilities))
+ if (aDevice->GetFontCapabilities(aFontCapabilities))
{
#if OSL_DEBUG_LEVEL > 2
lcl_dump_unicode_coverage(aFontCapabilities.maUnicodeRange);
@@ -1655,7 +1655,7 @@ OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const vcl::Font &r
UScriptCode eScript = getScript(aFontCapabilities);
if (nScriptType == com::sun::star::i18n::ScriptType::ASIAN)
- eScript = attemptToDisambiguateHan(eScript, aDevice);
+ eScript = attemptToDisambiguateHan(eScript, *aDevice.get());
sRet = makeRepresentativeTextForScript(eScript);
}
@@ -1665,10 +1665,10 @@ OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const vcl::Font &r
if (nScriptType == com::sun::star::i18n::ScriptType::COMPLEX)
{
sRet = makeRepresentativeTextForScript(USCRIPT_HEBREW);
- if (-1 != aDevice.HasGlyphs(rFont, sRet))
+ if (-1 != aDevice->HasGlyphs(rFont, sRet))
{
sRet = makeMinimalTextForScript(USCRIPT_HEBREW);
- if (-1 != aDevice.HasGlyphs(rFont, sRet))
+ if (-1 != aDevice->HasGlyphs(rFont, sRet))
sRet = makeRepresentativeTextForScript(USCRIPT_ARABIC);
}
}
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index e350a2237c12..d4b98433de3b 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -86,17 +86,17 @@ namespace svt { namespace table
Point const aBitmapPos( 0, 0 );
Size const aBitmapSize( nSortIndicatorWidth, nSortIndicatorHeight );
- VirtualDevice aDevice( i_device, 0, 0 );
- aDevice.SetOutputSizePixel( aBitmapSize );
+ ScopedVclPtrInstance< VirtualDevice > aDevice( i_device, 0, 0 );
+ aDevice->SetOutputSizePixel( aBitmapSize );
- DecorationView aDecoView( &aDevice );
+ DecorationView aDecoView( aDevice.get() );
aDecoView.DrawSymbol(
Rectangle( aBitmapPos, aBitmapSize ),
i_sortAscending ? SymbolType::SPIN_UP : SymbolType::SPIN_DOWN,
i_style.GetActiveColor()
);
- rBitmap = aDevice.GetBitmapEx( aBitmapPos, aBitmapSize );
+ rBitmap = aDevice->GetBitmapEx( aBitmapPos, aBitmapSize );
m_lastHeaderHeight = i_headerHeight;
m_lastArrowColor = i_style.GetActiveColor();
}
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 7ed486a90b48..5c887c36d83d 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -64,11 +64,17 @@ namespace svt { namespace table
TableControl::~TableControl()
{
+ disposeOnce();
+ }
+
+ void TableControl::dispose()
+ {
CallEventListeners( VCLEVENT_OBJECT_DYING );
m_pImpl->setModel( PTableModel() );
m_pImpl->disposeAccessible();
m_pImpl.reset();
+ Control::dispose();
}
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 2d2bf0166586..1565914154b6 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -242,7 +242,7 @@ namespace svt { namespace table
,m_nLeftColumn ( 0 )
,m_nTopRow ( 0 )
,m_nCursorHidden ( 1 )
- ,m_pDataWindow ( new TableDataWindow( *this ) )
+ ,m_pDataWindow ( VclPtr<TableDataWindow>::Create( *this ) )
,m_pVScroll ( NULL )
,m_pHScroll ( NULL )
,m_pScrollCorner ( NULL )
@@ -261,10 +261,10 @@ namespace svt { namespace table
TableControl_Impl::~TableControl_Impl()
{
-
- DELETEZ( m_pVScroll );
- DELETEZ( m_pHScroll );
- DELETEZ( m_pScrollCorner );
+ m_pVScroll.disposeAndClear();
+ m_pHScroll.disposeAndClear();
+ m_pScrollCorner.disposeAndClear();
+ m_pDataWindow.disposeAndClear();
DELETEZ( m_pTableFunctionSet );
DELETEZ( m_pSelEngine );
}
@@ -632,24 +632,25 @@ namespace svt { namespace table
}
- bool lcl_updateScrollbar( vcl::Window& _rParent, ScrollBar*& _rpBar,
+ bool lcl_updateScrollbar( vcl::Window& _rParent, VclPtr<ScrollBar>& _rpBar,
bool const i_needBar, long _nVisibleUnits,
long _nPosition, long _nLineSize, long _nRange,
bool _bHorizontal, const Link& _rScrollHandler )
{
// do we currently have the scrollbar?
- bool bHaveBar = _rpBar != NULL;
+ bool bHaveBar = _rpBar != nullptr;
// do we need to correct the scrollbar visibility?
if ( bHaveBar && !i_needBar )
{
if ( _rpBar->IsTracking() )
_rpBar->EndTracking();
- DELETEZ( _rpBar );
+ _rpBar.disposeAndClear();
}
else if ( !bHaveBar && i_needBar )
{
- _rpBar = new ScrollBar(
+ _rpBar = VclPtr<ScrollBar>::Create(
+
&_rParent,
WB_DRAG | ( _bHorizontal ? WB_HSCROLL : WB_VSCROLL )
);
@@ -1162,15 +1163,15 @@ namespace svt { namespace table
}
// the corner window connecting the two scrollbars in the lower right corner
- bool bHaveScrollCorner = NULL != m_pScrollCorner;
- bool bNeedScrollCorner = ( NULL != m_pHScroll ) && ( NULL != m_pVScroll );
+ bool bHaveScrollCorner = nullptr != m_pScrollCorner;
+ bool bNeedScrollCorner = ( nullptr != m_pHScroll ) && ( nullptr != m_pVScroll );
if ( bHaveScrollCorner && !bNeedScrollCorner )
{
- DELETEZ( m_pScrollCorner );
+ m_pScrollCorner.disposeAndClear();
}
else if ( !bHaveScrollCorner && bNeedScrollCorner )
{
- m_pScrollCorner = new ScrollBarBox( &m_rAntiImpl );
+ m_pScrollCorner = VclPtr<ScrollBarBox>::Create( &m_rAntiImpl );
m_pScrollCorner->SetSizePixel( Size( nScrollbarMetrics, nScrollbarMetrics ) );
m_pScrollCorner->SetPosPixel( Point( i_dataCellPlayground.Right() + 1, i_dataCellPlayground.Bottom() + 1 ) );
m_pScrollCorner->Show();
@@ -2111,7 +2112,7 @@ namespace svt { namespace table
}
// update the position at the vertical scrollbar
- if ( m_pVScroll != NULL )
+ if ( m_pVScroll != nullptr )
m_pVScroll->SetThumbPos( m_nTopRow );
}
@@ -2189,7 +2190,7 @@ namespace svt { namespace table
}
// update the position at the horizontal scrollbar
- if ( m_pHScroll != NULL )
+ if ( m_pHScroll != nullptr )
m_pHScroll->SetThumbPos( m_nLeftColumn );
}
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 5fef6fdd4062..4a587c8e3af8 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -122,13 +122,12 @@ namespace svt { namespace table
The window's upper left corner is at position (0,0), relative to the
table control, which is the direct parent of the data window.
*/
- ::boost::scoped_ptr< TableDataWindow >
- m_pDataWindow;
+ VclPtr<TableDataWindow> m_pDataWindow;
/// the vertical scrollbar, if any
- ScrollBar* m_pVScroll;
+ VclPtr<ScrollBar> m_pVScroll;
/// the horizontal scrollbar, if any
- ScrollBar* m_pHScroll;
- ScrollBarBox* m_pScrollCorner;
+ VclPtr<ScrollBar> m_pHScroll;
+ VclPtr<ScrollBarBox> m_pScrollCorner;
//selection engine - for determining selection range, e.g. single, multiple
SelectionEngine* m_pSelEngine;
//vector which contains the selected rows
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index cddaf452732c..2b819033d610 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -51,7 +51,13 @@ namespace svt { namespace table
TableDataWindow::~TableDataWindow()
{
+ disposeOnce();
+ }
+
+ void TableDataWindow::dispose()
+ {
impl_hideTipWindow();
+ Window::dispose();
}
void TableDataWindow::Paint( const Rectangle& rUpdateRect )
diff --git a/svtools/source/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx
index 13e1f1fcb0a7..d5ce17192b11 100644
--- a/svtools/source/table/tabledatawindow.hxx
+++ b/svtools/source/table/tabledatawindow.hxx
@@ -49,6 +49,7 @@ namespace svt { namespace table
public:
TableDataWindow( TableControl_Impl& _rTableControl );
virtual ~TableDataWindow();
+ virtual void dispose() SAL_OVERRIDE;
inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
inline const Link& GetSelectHdl() const { return m_aSelectHdl; }
diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx
index b2e692c1bd55..c044105d38e1 100644
--- a/svtools/source/toolpanel/drawerlayouter.cxx
+++ b/svtools/source/toolpanel/drawerlayouter.cxx
@@ -132,7 +132,7 @@ namespace svt
{
ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL );
- const PToolPanelDrawer pDrawer( m_aDrawers[ i_nChildIndex ] );
+ VclPtr<ToolPanelDrawer> pDrawer( m_aDrawers[ i_nChildIndex ] );
Reference< XAccessible > xItemAccessible = pDrawer->GetAccessible( false );
if ( !xItemAccessible.is() )
@@ -151,7 +151,7 @@ namespace svt
{
OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" );
- PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ) );
+ VclPtrInstance<ToolPanelDrawer> pDrawer( m_rParentWindow, i_pPanel->GetDisplayName() );
pDrawer->SetHelpId( i_pPanel->GetHelpID() );
// proper Z-Order
if ( i_nPosition == 0 )
@@ -160,8 +160,8 @@ namespace svt
}
else
{
- const PToolPanelDrawer pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] );
- pDrawer->SetZOrder( pFirstDrawer.get(), WINDOW_ZORDER_BEHIND );
+ ToolPanelDrawer* pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] );
+ pDrawer->SetZOrder( pFirstDrawer, WINDOW_ZORDER_BEHIND );
}
pDrawer->Show();
@@ -213,10 +213,7 @@ namespace svt
size_t DrawerDeckLayouter::impl_getPanelPositionFromWindow( const vcl::Window* i_pDrawerWindow ) const
{
- for ( ::std::vector< PToolPanelDrawer >::const_iterator drawerPos = m_aDrawers.begin();
- drawerPos != m_aDrawers.end();
- ++drawerPos
- )
+ for ( auto drawerPos = m_aDrawers.begin(); drawerPos != m_aDrawers.end(); ++drawerPos )
{
if ( drawerPos->get() == i_pDrawerWindow )
return drawerPos - m_aDrawers.begin();
@@ -229,7 +226,6 @@ namespace svt
{
OSL_PRECOND( i_nPosition < m_aDrawers.size(), "DrawerDeckLayouter::impl_removeDrawer: invalid panel position!" );
m_aDrawers[ i_nPosition ]->RemoveEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) );
- OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "DrawerDeckLayouter::impl_removeDrawer: somebody else is still holding a reference!" );
m_aDrawers.erase( m_aDrawers.begin() + i_nPosition );
}
diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx
index ef19414cc407..58b59e903cfa 100644
--- a/svtools/source/toolpanel/paneltabbar.cxx
+++ b/svtools/source/toolpanel/paneltabbar.cxx
@@ -378,8 +378,8 @@ namespace svt
void UpdateScrollButtons()
{
- m_aScrollBack.Enable( m_nScrollPosition > 0 );
- m_aScrollForward.Enable( m_nScrollPosition < m_aItems.size() - 1 );
+ m_aScrollBack->Enable( m_nScrollPosition > 0 );
+ m_aScrollForward->Enable( m_nScrollPosition < m_aItems.size() - 1 );
}
void Relayout();
@@ -415,7 +415,7 @@ namespace svt
TabAlignment m_eTabAlignment;
IToolPanelDeck& m_rPanelDeck;
- VirtualDevice m_aRenderDevice;
+ ScopedVclPtr<VirtualDevice> m_aRenderDevice;
PTabBarRenderer m_pRenderer;
::boost::optional< size_t > m_aHoveredItem;
@@ -425,8 +425,8 @@ namespace svt
ItemDescriptors m_aItems;
bool m_bItemsDirty;
- PushButton m_aScrollBack;
- PushButton m_aScrollForward;
+ VclPtr<PushButton> m_aScrollBack;
+ VclPtr<PushButton> m_aScrollForward;
size_t m_nScrollPosition;
};
@@ -499,45 +499,45 @@ namespace svt
,m_aNormalizer()
,m_eTabAlignment( i_eAlignment )
,m_rPanelDeck( i_rPanelDeck )
- ,m_aRenderDevice( i_rTabBar )
+ ,m_aRenderDevice( VclPtr<VirtualDevice>::Create(i_rTabBar) )
,m_pRenderer()
,m_aHoveredItem()
,m_aFocusedItem()
,m_bMouseButtonDown( false )
,m_aItems()
,m_bItemsDirty( true )
- ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON )
- ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON )
+ ,m_aScrollBack( VclPtr<PushButton>::Create(&i_rTabBar, WB_BEVELBUTTON) )
+ ,m_aScrollForward( VclPtr<PushButton>::Create(&i_rTabBar, WB_BEVELBUTTON) )
,m_nScrollPosition( 0 )
{
#ifdef WNT
- if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) )
+ if ( m_aRenderDevice->IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) )
// this mode requires the NWF framework to be able to render those items onto a virtual
// device. For some frameworks (some GTK themes, in particular), this is known to fail.
// So, be on the safe side for the moment.
- m_pRenderer.reset( new NWFTabItemRenderer( m_aRenderDevice ) );
+ m_pRenderer.reset( new NWFTabItemRenderer( *m_aRenderDevice.get() ) );
else
#endif
- if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
- m_pRenderer.reset( new NWFToolboxItemRenderer( m_aRenderDevice ) );
+ if ( m_aRenderDevice->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
+ m_pRenderer.reset( new NWFToolboxItemRenderer( *m_aRenderDevice.get() ) );
else
- m_pRenderer.reset( new VCLItemRenderer( m_aRenderDevice ) );
+ m_pRenderer.reset( new VCLItemRenderer( *m_aRenderDevice.get() ) );
- m_aRenderDevice.SetLineColor();
+ m_aRenderDevice->SetLineColor();
m_rPanelDeck.AddListener( *this );
- m_aScrollBack.SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT );
- m_aScrollBack.Show();
- m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
- m_aScrollBack.SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() );
- m_aScrollBack.SetAccessibleName( m_aScrollBack.GetAccessibleDescription() );
-
- m_aScrollForward.SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT );
- m_aScrollForward.Show();
- m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
- m_aScrollForward.SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() );
- m_aScrollForward.SetAccessibleName( m_aScrollForward.GetAccessibleDescription() );
+ m_aScrollBack->SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT );
+ m_aScrollBack->Show();
+ m_aScrollBack->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
+ m_aScrollBack->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() );
+ m_aScrollBack->SetAccessibleName( m_aScrollBack->GetAccessibleDescription() );
+
+ m_aScrollForward->SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT );
+ m_aScrollForward->Show();
+ m_aScrollForward->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
+ m_aScrollForward->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() );
+ m_aScrollForward->SetAccessibleName( m_aScrollForward->GetAccessibleDescription() );
}
@@ -710,7 +710,7 @@ namespace svt
void PanelTabBar_Impl::CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const
{
- BitmapEx aBitmap( m_aRenderDevice.GetBitmapEx(
+ BitmapEx aBitmap( m_aRenderDevice->GetBitmapEx(
i_rLogicalRect.TopLeft(),
Size(
i_rLogicalRect.GetSize().Width(),
@@ -833,31 +833,31 @@ namespace svt
const Size aLogicalOutputSize( m_aNormalizer.getReferenceSize() );
// forward actual output size to our render device
- m_aRenderDevice.SetOutputSizePixel( aLogicalOutputSize );
+ m_aRenderDevice->SetOutputSizePixel( aLogicalOutputSize );
// re-calculate the size of the scroll buttons and of the items
m_aGeometry.relayout( aLogicalOutputSize, m_aItems );
if ( m_aGeometry.getButtonBackRect().IsEmpty() )
{
- m_aScrollBack.Hide();
+ m_aScrollBack->Hide();
}
else
{
const Rectangle aButtonBack( m_aNormalizer.getTransformed( m_aGeometry.getButtonBackRect(), m_eTabAlignment ) );
- m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() );
- m_aScrollBack.Show();
+ m_aScrollBack->SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() );
+ m_aScrollBack->Show();
}
if ( m_aGeometry.getButtonForwardRect().IsEmpty() )
{
- m_aScrollForward.Hide();
+ m_aScrollForward->Hide();
}
else
{
const Rectangle aButtonForward( m_aNormalizer.getTransformed( m_aGeometry.getButtonForwardRect(), m_eTabAlignment ) );
- m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() );
- m_aScrollForward.Show();
+ m_aScrollForward->SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() );
+ m_aScrollForward->Show();
}
UpdateScrollButtons();
@@ -921,13 +921,13 @@ namespace svt
IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton )
{
- if ( i_pButton == &m_aScrollBack )
+ if ( i_pButton == m_aScrollBack.get() )
{
OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" );
--m_nScrollPosition;
m_rTabBar.Invalidate();
}
- else if ( i_pButton == &m_aScrollForward )
+ else if ( i_pButton == m_aScrollForward.get() )
{
OSL_ENSURE( m_nScrollPosition < m_aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" );
++m_nScrollPosition;
@@ -996,11 +996,15 @@ namespace svt
DBG_CHECK( *m_pImpl );
}
-
PanelTabBar::~PanelTabBar()
{
+ disposeOnce();
}
+ void PanelTabBar::dispose()
+ {
+ Control::dispose();
+ }
TabItemContent PanelTabBar::GetTabItemContent() const
{
@@ -1046,10 +1050,10 @@ namespace svt
// background
const Rectangle aNormalizedPaintArea( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) );
- m_pImpl->m_aRenderDevice.Push( PushFlags::CLIPREGION );
- m_pImpl->m_aRenderDevice.SetClipRegion(vcl::Region(aNormalizedPaintArea));
+ m_pImpl->m_aRenderDevice->Push( PushFlags::CLIPREGION );
+ m_pImpl->m_aRenderDevice->SetClipRegion(vcl::Region(aNormalizedPaintArea));
m_pImpl->m_pRenderer->renderBackground();
- m_pImpl->m_aRenderDevice.Pop();
+ m_pImpl->m_aRenderDevice->Pop();
m_pImpl->CopyFromRenderDevice( aNormalizedPaintArea );
// ensure the items really paint into their own playground only
@@ -1314,7 +1318,7 @@ namespace svt
PushButton& PanelTabBar::GetScrollButton( const bool i_bForward )
{
- return i_bForward ? m_pImpl->m_aScrollForward : m_pImpl->m_aScrollBack;
+ return i_bForward ? *m_pImpl->m_aScrollForward.get() : *m_pImpl->m_aScrollBack.get();
}
diff --git a/svtools/source/toolpanel/paneltabbarpeer.cxx b/svtools/source/toolpanel/paneltabbarpeer.cxx
index 3a0c473732b1..4fd01f993999 100644
--- a/svtools/source/toolpanel/paneltabbarpeer.cxx
+++ b/svtools/source/toolpanel/paneltabbarpeer.cxx
@@ -64,7 +64,7 @@ namespace svt
Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext()
{
SolarMutexGuard aSolarGuard;
- if ( m_pTabBar == NULL )
+ if ( m_pTabBar == nullptr )
throw DisposedException( OUString(), *this );
@@ -80,7 +80,7 @@ namespace svt
{
{
SolarMutexGuard aSolarGuard;
- m_pTabBar = NULL;
+ m_pTabBar.clear();
}
VCLXWindow::dispose();
}
diff --git a/svtools/source/toolpanel/paneltabbarpeer.hxx b/svtools/source/toolpanel/paneltabbarpeer.hxx
index 2c9601010208..9e0bc6709524 100644
--- a/svtools/source/toolpanel/paneltabbarpeer.hxx
+++ b/svtools/source/toolpanel/paneltabbarpeer.hxx
@@ -49,7 +49,7 @@ namespace svt
private:
AccessibleFactoryAccess m_aAccessibleFactory;
- PanelTabBar* m_pTabBar;
+ VclPtr<PanelTabBar> m_pTabBar;
};
diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx
index 39a0874d824a..5c83f285bc99 100644
--- a/svtools/source/toolpanel/tablayouter.cxx
+++ b/svtools/source/toolpanel/tablayouter.cxx
@@ -41,14 +41,14 @@ namespace svt
{
TabAlignment eAlignment;
IToolPanelDeck& rPanels;
- ::std::unique_ptr< PanelTabBar > pTabBar;
+ VclPtr< PanelTabBar > pTabBar;
AccessibleFactoryAccess aAccessibleFactory;
TabDeckLayouter_Data( vcl::Window& i_rParent, IToolPanelDeck& i_rPanels,
const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
:eAlignment( i_eAlignment )
,rPanels( i_rPanels )
- ,pTabBar( new PanelTabBar( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
+ ,pTabBar( VclPtr<PanelTabBar>::Create( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
{
pTabBar->Show();
}
diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx
index af00abb8c204..8544ab104b0c 100644
--- a/svtools/source/toolpanel/toolpaneldeck.cxx
+++ b/svtools/source/toolpanel/toolpaneldeck.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <tools/diagnose_ex.h>
+#include <vcl/vclptr.hxx>
#include <boost/optional.hpp>
@@ -68,15 +69,15 @@ namespace svt
public:
ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck )
:m_rDeck( i_rDeck )
- ,m_aPanelAnchor( &i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL )
+ ,m_aPanelAnchor( VclPtr<vcl::Window>::Create(&i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL) )
,m_aPanels()
,m_pDummyPanel( new DummyPanel )
,m_pLayouter()
,m_bInDtor( false )
{
m_aPanels.AddListener( *this );
- m_aPanelAnchor.Show();
- m_aPanelAnchor.SetAccessibleRole( AccessibleRole::PANEL );
+ m_aPanelAnchor->Show();
+ m_aPanelAnchor->SetAccessibleRole( AccessibleRole::PANEL );
}
virtual ~ToolPanelDeck_Impl()
@@ -87,7 +88,7 @@ namespace svt
PDeckLayouter GetLayouter() const { return m_pLayouter; }
void SetLayouter( const PDeckLayouter& i_pNewLayouter );
- vcl::Window& GetPanelWindowAnchor() { return m_aPanelAnchor; }
+ vcl::Window& GetPanelWindowAnchor() { return *m_aPanelAnchor.get(); }
bool IsDead() const { return m_bInDtor; }
@@ -130,7 +131,7 @@ namespace svt
private:
ToolPanelDeck& m_rDeck;
- vcl::Window m_aPanelAnchor;
+ VclPtr<vcl::Window> m_aPanelAnchor;
ToolPanelCollection m_aPanels;
PToolPanel m_pDummyPanel;
PanelDeckListeners m_aListeners;
@@ -210,11 +211,11 @@ namespace svt
{
aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground );
}
- m_aPanelAnchor.SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() );
+ m_aPanelAnchor->SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() );
// position the active panel
const PToolPanel pActive( GetActiveOrDummyPanel_Impl() );
- pActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
+ pActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() );
}
@@ -261,7 +262,7 @@ namespace svt
case ACTION_TOGGLE_FOCUS:
{
PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() );
- if ( !m_aPanelAnchor.HasChildPathFocus() )
+ if ( !m_aPanelAnchor->HasChildPathFocus() )
pActivePanel->GrabFocus();
else
GetLayouter()->SetFocusToPanelSelector();
@@ -313,11 +314,11 @@ namespace svt
// position and show the new panel
const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) );
- pNewActive->Activate( m_aPanelAnchor );
+ pNewActive->Activate( *m_aPanelAnchor.get() );
pNewActive->GrabFocus();
// resize the panel (cannot guarantee it has ever been resized before
- pNewActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
+ pNewActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() );
// multiplex to our own listeners
m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive );
@@ -353,6 +354,11 @@ namespace svt
ToolPanelDeck::~ToolPanelDeck()
{
+ disposeOnce();
+ }
+
+ void ToolPanelDeck::dispose()
+ {
m_pImpl->NotifyDying();
GetLayouter()->Destroy();
@@ -362,6 +368,7 @@ namespace svt
PToolPanel pPanel( GetPanel( i ) );
pPanel->Dispose();
}
+ Control::dispose();
}
diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.cxx b/svtools/source/toolpanel/toolpaneldeckpeer.cxx
index 333fa43c10d0..76f15af12ca3 100644
--- a/svtools/source/toolpanel/toolpaneldeckpeer.cxx
+++ b/svtools/source/toolpanel/toolpaneldeckpeer.cxx
@@ -64,7 +64,7 @@ namespace svt
Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext()
{
SolarMutexGuard aSolarGuard;
- if ( m_pDeck == NULL )
+ if ( m_pDeck == nullptr )
throw DisposedException( OUString(), *this );
vcl::Window* pAccessibleParent( m_pDeck->GetAccessibleParentWindow() );
@@ -78,7 +78,7 @@ namespace svt
{
{
SolarMutexGuard aSolarGuard;
- m_pDeck = NULL;
+ m_pDeck.clear();
}
VCLXWindow::dispose();
}
diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.hxx b/svtools/source/toolpanel/toolpaneldeckpeer.hxx
index daa177000128..2ced30f50c4b 100644
--- a/svtools/source/toolpanel/toolpaneldeckpeer.hxx
+++ b/svtools/source/toolpanel/toolpaneldeckpeer.hxx
@@ -49,7 +49,7 @@ namespace svt
private:
AccessibleFactoryAccess m_aAccessibleFactory;
- ToolPanelDeck* m_pDeck;
+ VclPtr<ToolPanelDeck> m_pDeck;
};
diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx
index d74545593d1c..60b9d06cd2c0 100644
--- a/svtools/source/toolpanel/toolpaneldrawer.cxx
+++ b/svtools/source/toolpanel/toolpaneldrawer.cxx
@@ -56,11 +56,6 @@ namespace svt
}
- DrawerVisualization::~DrawerVisualization()
- {
- }
-
-
void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox )
{
Window::Paint( i_rBoundingBox );
@@ -73,8 +68,8 @@ namespace svt
ToolPanelDrawer::ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle )
:Window( &i_rParent, WB_TABSTOP )
- ,m_pPaintDevice( new VirtualDevice( *this ) )
- ,m_aVisualization( *this )
+ ,m_pPaintDevice( VclPtr<VirtualDevice>::Create( *this ) )
+ ,m_aVisualization( VclPtr<DrawerVisualization>::Create(*this) )
,m_bFocused( false )
,m_bExpanded( false )
{
@@ -88,15 +83,20 @@ namespace svt
SetAccessibleName( i_rTitle );
SetAccessibleDescription( i_rTitle );
- m_aVisualization.SetAccessibleName( i_rTitle );
- m_aVisualization.SetAccessibleDescription( i_rTitle );
+ m_aVisualization->SetAccessibleName( i_rTitle );
+ m_aVisualization->SetAccessibleDescription( i_rTitle );
}
-
ToolPanelDrawer::~ToolPanelDrawer()
{
+ disposeOnce();
}
+ void ToolPanelDrawer::dispose()
+ {
+ m_aVisualization.disposeAndClear();
+ vcl::Window::dispose();
+ }
long ToolPanelDrawer::GetPreferredHeightPixel() const
{
@@ -123,7 +123,7 @@ namespace svt
aFocusBox.Left() += 2;
impl_paintFocusIndicator( aFocusBox );
- m_aVisualization.DrawOutDev(
+ m_aVisualization->DrawOutDev(
Point(), GetOutputSizePixel(),
Point(), GetOutputSizePixel(),
*m_pPaintDevice
@@ -239,7 +239,7 @@ namespace svt
void ToolPanelDrawer::Resize()
{
Window::Resize();
- m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() );
+ m_aVisualization->SetPosSizePixel( Point(), GetOutputSizePixel() );
}
@@ -261,7 +261,7 @@ namespace svt
if ( !( i_rEvent.GetFlags() & AllSettingsFlags::STYLE ) )
break;
SetSettings( Application::GetSettings() );
- m_pPaintDevice.reset( new VirtualDevice( *this ) );
+ m_pPaintDevice.reset( VclPtr<VirtualDevice>::Create( *this ) );
// fall through.
diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx
index 3a815345e2b6..b13a12e34629 100644
--- a/svtools/source/toolpanel/toolpaneldrawer.hxx
+++ b/svtools/source/toolpanel/toolpaneldrawer.hxx
@@ -22,6 +22,7 @@
#include <vcl/window.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/vclptr.hxx>
namespace svt
@@ -45,7 +46,6 @@ namespace svt
{
public:
DrawerVisualization( ToolPanelDrawer& i_rParent );
- virtual ~DrawerVisualization();
protected:
// Window overridables
@@ -64,6 +64,7 @@ namespace svt
public:
ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle );
virtual ~ToolPanelDrawer();
+ virtual void dispose() SAL_OVERRIDE;
long GetPreferredHeightPixel() const;
void SetExpanded( const bool i_bExpanded );
@@ -96,8 +97,8 @@ namespace svt
using Window::Paint;
private:
- ::std::unique_ptr< VirtualDevice > m_pPaintDevice;
- DrawerVisualization m_aVisualization;
+ ScopedVclPtr< VirtualDevice > m_pPaintDevice;
+ VclPtr<DrawerVisualization> m_aVisualization;
bool m_bFocused;
bool m_bExpanded;
};
diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
index 5f7af7987e0f..8e83866a6b9a 100644
--- a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
+++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
@@ -97,7 +97,7 @@ namespace svt
i_rStateSet.AddState( AccessibleStateType::EXPANDABLE );
i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
- const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) );
+ VclPtr< ToolPanelDrawer > pDrawer = GetAsDynamic< ToolPanelDrawer > ();
ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" );
if ( pDrawer->IsExpanded() )
i_rStateSet.AddState( AccessibleStateType::EXPANDED );
diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx
index 1a9a8645ba50..d21a3baefa6f 100644
--- a/svtools/source/uno/addrtempuno.cxx
+++ b/svtools/source/uno/addrtempuno.cxx
@@ -71,7 +71,7 @@ namespace {
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void implInitialize(const com::sun::star::uno::Any& _rValue) SAL_OVERRIDE;
@@ -134,7 +134,7 @@ namespace {
if ( _nExecutionResult )
if ( m_pDialog )
- static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases );
+ static_cast< AddressBookSourceDialog* >( m_pDialog.get() )->getFieldMapping( m_aAliases );
}
void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments) throw(Exception, RuntimeException, std::exception)
@@ -212,12 +212,12 @@ namespace {
}
- Dialog* OAddressBookSourceDialogUno::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> OAddressBookSourceDialogUno::createDialog(vcl::Window* _pParent)
{
if ( m_xDataSource.is() && !m_sTable.isEmpty() )
- return new AddressBookSourceDialog(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases );
+ return VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases );
else
- return new AddressBookSourceDialog( _pParent, m_aContext );
+ return VclPtr<AddressBookSourceDialog>::Create( _pParent, m_aContext );
}
}
diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx
index 1c78816e63af..04e6203477a4 100644
--- a/svtools/source/uno/generictoolboxcontroller.cxx
+++ b/svtools/source/uno/generictoolboxcontroller.cxx
@@ -74,11 +74,9 @@ void SAL_CALL GenericToolboxController::dispose()
throw ( RuntimeException, std::exception )
{
SolarMutexGuard aSolarMutexGuard;
-
- svt::ToolboxController::dispose();
-
- m_pToolbox = 0;
+ m_pToolbox.clear();
m_nID = 0;
+ svt::ToolboxController::dispose();
}
void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ )
diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx
index b0186d2c8dc0..4b7f82f3d753 100644
--- a/svtools/source/uno/genericunodialog.cxx
+++ b/svtools/source/uno/genericunodialog.cxx
@@ -178,7 +178,7 @@ bool OGenericUnoDialog::impl_ensureDialog_lck()
// the title
OUString sTitle = m_sTitle;
- Dialog* pDialog = createDialog( pParent );
+ VclPtr<Dialog> pDialog = createDialog( pParent );
OSL_ENSURE( pDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!" );
if ( !pDialog )
return false;
@@ -313,8 +313,7 @@ void SAL_CALL OGenericUnoDialog::initialize( const Sequence< Any >& aArguments )
void OGenericUnoDialog::destroyDialog()
{
- delete m_pDialog;
- m_pDialog = NULL;
+ m_pDialog.disposeAndClear();
}
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index aa6277a81c07..82f61e3b9e49 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -47,8 +47,8 @@ public:
DECL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, vcl::Window* );
private:
- vcl::Window* mpPopupWindow;
- ToolBox* mpToolBox;
+ VclPtr<vcl::Window> mpPopupWindow;
+ VclPtr<ToolBox> mpToolBox;
};
PopupWindowControllerImpl::PopupWindowControllerImpl()
@@ -99,7 +99,7 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve
mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, (void*)mpPopupWindow );
mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 );
- svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow );
+ svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow.get() );
if( pToolbarMenu )
pToolbarMenu->highlightFirstEntry();
break;
@@ -126,7 +126,7 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve
IMPL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, vcl::Window*, pWindow )
{
(void)*pThis;
- delete pWindow;
+ pWindow->disposeOnce();
return 0;
}
@@ -216,7 +216,7 @@ void SAL_CALL PopupWindowController::doubleClick() throw (RuntimeException, std:
Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() throw (RuntimeException, std::exception)
{
- ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ VclPtr< ToolBox > pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if( pToolBox )
{
vcl::Window* pItemWindow = pToolBox->GetItemWindow( pToolBox->GetDownItemId() );
diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx
index 766b02128e9f..88f10265e99e 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -517,7 +517,7 @@ void StatusbarController::bindListener()
if ( m_xParentWindow.is() )
{
- StatusBar* pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ));
+ VclPtr< StatusBar > pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ).get() );
if ( pStatusBar && pStatusBar->GetType() == WINDOW_STATUSBAR )
aRect = pStatusBar->GetItemRect( m_nID );
}
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 6fec3022a7fb..b1fb0a2e0cbd 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -89,7 +89,7 @@ SVTXGridControl::~SVTXGridControl()
}
-void SVTXGridControl::SetWindow( vcl::Window* pWindow )
+void SVTXGridControl::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
SVTXGridControl_Base::SetWindow( pWindow );
impl_checkTableModelInit();
@@ -114,8 +114,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y)
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getRowAtPoint: no control (anymore)!", -1 );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getRowAtPoint: no control (anymore)!", -1 );
TableCell const tableCell = pTable->getTableControlInterface().hitTest( Point( x, y ) );
return ( tableCell.nRow >= 0 ) ? tableCell.nRow : -1;
@@ -126,8 +126,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getColumnAtPoint: no control (anymore)!", -1 );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getColumnAtPoint: no control (anymore)!", -1 );
TableCell const tableCell = pTable->getTableControlInterface().hitTest( Point( x, y ) );
return ( tableCell.nColumn >= 0 ) ? tableCell.nColumn : -1;
@@ -138,8 +138,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentColumn( ) throw (RuntimeException
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentColumn: no control (anymore)!", -1 );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getCurrentColumn: no control (anymore)!", -1 );
sal_Int32 const nColumn = pTable->GetCurrentColumn();
return ( nColumn >= 0 ) ? nColumn : -1;
@@ -150,8 +150,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentRow( ) throw (RuntimeException, s
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!", -1 );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getCurrentRow: no control (anymore)!", -1 );
sal_Int32 const nRow = pTable->GetCurrentRow();
return ( nRow >= 0 ) ? nRow : -1;
@@ -162,8 +162,8 @@ void SAL_CALL SVTXGridControl::goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!" );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::getCurrentRow: no control (anymore)!" );
impl_checkColumnIndex_throw( *pTable, i_columnIndex );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
@@ -188,8 +188,8 @@ void SVTXGridControl::setProperty( const OUString& PropertyName, const Any& aVal
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::setProperty: no control (anymore)!" );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::setProperty: no control (anymore)!" );
switch( GetPropertyId( PropertyName ) )
{
@@ -438,7 +438,7 @@ void SVTXGridControl::impl_checkTableModelInit()
{
if ( !m_bTableModelInitCompleted && m_xTableModel->hasColumnModel() && m_xTableModel->hasDataModel() )
{
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
if ( pTable )
{
pTable->SetModel( PTableModel( m_xTableModel ) );
@@ -472,8 +472,8 @@ Any SVTXGridControl::getProperty( const OUString& PropertyName ) throw(RuntimeEx
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getProperty: no control (anymore)!", Any() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getProperty: no control (anymore)!", Any() );
Any aPropertyValue;
@@ -625,7 +625,7 @@ void SAL_CALL SVTXGridControl::dataChanged( const GridDataEvent& i_event ) throw
// if the data model is sortable, a dataChanged event is also fired in case the sort order changed.
// So, just in case, invalidate the column header area, too.
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::dataChanged: no control (anymore)!" );
pTable->getTableControlInterface().invalidate( TableAreaColumnHeaders );
}
@@ -636,7 +636,7 @@ void SAL_CALL SVTXGridControl::rowHeadingChanged( const GridDataEvent& i_event )
SolarMutexGuard aGuard;
OSL_UNUSED( i_event );
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::rowHeadingChanged: no control (anymore)!" );
// TODO: we could do better than this - invalidate the header area only
@@ -686,7 +686,7 @@ void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (Runtim
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectRow: no control (anymore)!" );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
@@ -699,7 +699,7 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (RuntimeException, std::exc
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectAllRows: no control (anymore)!" );
pTable->SelectAllRows( true );
@@ -710,7 +710,7 @@ void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (Runt
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectRow: no control (anymore)!" );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
@@ -723,7 +723,7 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (RuntimeException, std::e
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectAllRows: no control (anymore)!" );
pTable->SelectAllRows( false );
@@ -734,7 +734,7 @@ Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelectedRows() throw (Runti
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelectedRows: no control (anymore)!", Sequence< sal_Int32 >() );
sal_Int32 selectionCount = pTable->GetSelectedRowCount();
@@ -749,7 +749,7 @@ sal_Bool SAL_CALL SVTXGridControl::hasSelectedRows() throw (RuntimeException, st
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::hasSelectedRows: no control (anymore)!", sal_True );
return pTable->GetSelectedRowCount() > 0;
@@ -760,7 +760,7 @@ sal_Bool SAL_CALL SVTXGridControl::isRowSelected( ::sal_Int32 index ) throw (Run
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::isRowSelected: no control (anymore)!", sal_False );
return pTable->IsRowSelected( index );
@@ -782,7 +782,7 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
Reference< XWindow > xKeepAlive( this );
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" );
bool handled = false;
@@ -870,7 +870,7 @@ void SVTXGridControl::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno:
void SVTXGridControl::ImplCallItemListeners()
{
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ImplCallItemListeners: no control (anymore)!" );
if ( m_aSelectionListeners.getLength() )
@@ -891,8 +891,8 @@ void SVTXGridControl::impl_updateColumnsFromModel_nothrow()
{
Reference< XGridColumnModel > const xColumnModel( m_xTableModel->getColumnModel() );
ENSURE_OR_RETURN_VOID( xColumnModel.is(), "no model!" );
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN_VOID( pTable != NULL, "no table!" );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN_VOID( pTable, "no table!" );
try
{
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index f533a19eaead..eae8f131b22c 100644
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -106,7 +106,7 @@ public:
protected:
// VCLXWindow
- virtual void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
+ virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
private:
void impl_updateColumnsFromModel_nothrow();
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index d8bdc68bb902..86ed9a7ccdf4 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -785,7 +785,7 @@ bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox )
if( (m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) )
return m_nToolBoxId;
- ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if( (m_nToolBoxId == SAL_MAX_UINT16) && pToolBox )
{
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 00efbd5d4ac2..e1d132694a13 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -86,6 +86,7 @@ class UnoTreeListBoxImpl : public SvTreeListBox
public:
UnoTreeListBoxImpl( TreeControlPeer* pPeer, vcl::Window* pParent, WinBits nWinStyle );
virtual ~UnoTreeListBoxImpl();
+ virtual void dispose() SAL_OVERRIDE;
sal_uInt32 insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,sal_uLong nPos=TREELIST_APPEND );
@@ -206,7 +207,7 @@ UnoTreeListEntry* TreeControlPeer::getEntry( const Reference< XTreeNode >& xNode
vcl::Window* TreeControlPeer::createVclControl( vcl::Window* pParent, sal_Int64 nWinStyle )
{
- mpTreeImpl = new UnoTreeListBoxImpl( this, pParent, nWinStyle );
+ mpTreeImpl = VclPtr<UnoTreeListBoxImpl>::Create( this, pParent, nWinStyle );
return mpTreeImpl;
}
@@ -222,7 +223,7 @@ void TreeControlPeer::disposeControl()
-void TreeControlPeer::SetWindow( vcl::Window* pWindow )
+void TreeControlPeer::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
VCLXWindow::SetWindow( pWindow );
}
@@ -1490,8 +1491,14 @@ UnoTreeListBoxImpl::UnoTreeListBoxImpl( TreeControlPeer* pPeer, vcl::Window* pPa
UnoTreeListBoxImpl::~UnoTreeListBoxImpl()
{
+ disposeOnce();
+}
+
+void UnoTreeListBoxImpl::dispose()
+{
if( mxPeer.is() )
mxPeer->disposeControl();
+ SvTreeListBox::dispose();
}
diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx
index 870a34fcbc7c..d1cb56441348 100644
--- a/svtools/source/uno/treecontrolpeer.hxx
+++ b/svtools/source/uno/treecontrolpeer.hxx
@@ -58,7 +58,7 @@ public:
vcl::Window* createVclControl( vcl::Window* pParent, sal_Int64 nWinStyle );
// VCLXWindow
- virtual void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
+ virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
// ::com::sun::star::view::XSelectionSupplier
virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -159,7 +159,7 @@ private:
TreeExpansionListenerMultiplexer maTreeExpansionListeners;
TreeEditListenerMultiplexer maTreeEditListeners;
bool mbIsRootDisplayed;
- UnoTreeListBoxImpl* mpTreeImpl;
+ VclPtr<UnoTreeListBoxImpl> mpTreeImpl;
sal_Int32 mnEditLock;
OUString msDefaultCollapsedGraphicURL;
OUString msDefaultExpandedGraphicURL;
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 1bda41b744fc..32746ba9d765 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -68,7 +68,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
{
if ( pParent )
{
- pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB);
+ pWindow = VclPtr<MultiLineEdit>::Create( pParent, nWinBits|WB_IGNORETAB);
static_cast< MultiLineEdit* >( pWindow )->DisableSelectionOnFocus();
*ppNewComp = new VCLXMultiLineEdit;
}
@@ -82,7 +82,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
{
if ( pParent )
{
- pWindow = new FileControl( pParent, nWinBits );
+ pWindow = VclPtr<FileControl>::Create( pParent, nWinBits );
*ppNewComp = new VCLXFileControl;
}
else
@@ -93,22 +93,22 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
}
else if (aServiceName.equalsIgnoreAsciiCase("FormattedField") )
{
- pWindow = new FormattedField( pParent, nWinBits );
+ pWindow = VclPtr<FormattedField>::Create( pParent, nWinBits );
*ppNewComp = new SVTXFormattedField;
}
else if (aServiceName.equalsIgnoreAsciiCase("NumericField") )
{
- pWindow = new DoubleNumericField( pParent, nWinBits );
+ pWindow = VclPtr<DoubleNumericField>::Create( pParent, nWinBits );
*ppNewComp = new SVTXNumericField;
}
else if (aServiceName.equalsIgnoreAsciiCase("LongCurrencyField") )
{
- pWindow = new DoubleCurrencyField( pParent, nWinBits );
+ pWindow = VclPtr<DoubleCurrencyField>::Create( pParent, nWinBits );
*ppNewComp = new SVTXCurrencyField;
}
else if (aServiceName.equalsIgnoreAsciiCase("datefield") )
{
- pWindow = new CalendarField( pParent, nWinBits);
+ pWindow = VclPtr<CalendarField>::Create( pParent, nWinBits);
static_cast<CalendarField*>(pWindow)->EnableToday();
static_cast<CalendarField*>(pWindow)->EnableNone();
static_cast<CalendarField*>(pWindow)->EnableEmptyFieldValue( true );
@@ -125,7 +125,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
{
if ( pParent )
{
- pWindow = new ProgressBar( pParent, nWinBits );
+ pWindow = VclPtr<ProgressBar>::Create( pParent, nWinBits );
*ppNewComp = new VCLXProgressBar;
}
else
@@ -144,7 +144,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
{
if ( pParent )
{
- pWindow = new FixedHyperlink( pParent, nWinBits );
+ pWindow = VclPtr<FixedHyperlink>::Create( pParent, nWinBits );
*ppNewComp = new VCLXFixedHyperlink;
}
else
@@ -216,7 +216,7 @@ void VCLXMultiLineEdit::setText( const OUString& aText ) throw(::com::sun::star:
{
SolarMutexGuard aGuard;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
pEdit->SetText( aText );
@@ -233,7 +233,7 @@ void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel
{
SolarMutexGuard aGuard;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
setSelection( rSel );
@@ -246,7 +246,7 @@ OUString VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeExcept
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aText = pEdit->GetText( meLineEndType );
return aText;
@@ -257,7 +257,7 @@ OUString VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::Runti
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit)
aText = pMultiLineEdit->GetSelected( meLineEndType );
return aText;
@@ -268,7 +268,7 @@ void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aS
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
pMultiLineEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
@@ -280,7 +280,7 @@ void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aS
SolarMutexGuard aGuard;
::com::sun::star::awt::Selection aSel;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
aSel.Min = pMultiLineEdit->GetSelection().Min();
@@ -293,7 +293,7 @@ sal_Bool VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeExc
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
return ( pMultiLineEdit && !pMultiLineEdit->IsReadOnly() && pMultiLineEdit->IsEnabled() ) ? sal_True : sal_False;
}
@@ -301,7 +301,7 @@ void VCLXMultiLineEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
pMultiLineEdit->SetReadOnly( !bEditable );
}
@@ -310,7 +310,7 @@ void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
pMultiLineEdit->SetMaxTextLen( nLen );
}
@@ -319,7 +319,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
return pMultiLineEdit ? (sal_Int16)pMultiLineEdit->GetMaxTextLen() : (sal_Int16)0;
}
@@ -328,7 +328,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aText = pEdit->GetTextLines( meLineEndType );
return aText;
@@ -339,7 +339,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcMinimumSize());
return aSz;
@@ -355,7 +355,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz = rNewSize;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcAdjustedSize( VCLSize(rNewSize )));
return aSz;
@@ -366,7 +366,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcBlockSize( nCols, nLines ));
return aSz;
@@ -377,7 +377,7 @@ void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines
SolarMutexGuard aGuard;
nCols = nLines = 0;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
sal_uInt16 nC, nL;
@@ -413,7 +413,7 @@ void VCLXMultiLineEdit::setProperty( const OUString& PropertyName, const ::com::
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -470,7 +470,7 @@ void VCLXMultiLineEdit::setProperty( const OUString& PropertyName, const ::com::
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -543,7 +543,7 @@ VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
VCLXFileControl::~VCLXFileControl()
{
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
pControl->GetEdit().SetModifyHdl( Link() );
}
@@ -568,7 +568,7 @@ void SAL_CALL VCLXFileControl::setProperty( const OUString& PropertyName, const
{
SolarMutexGuard aGuard;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -591,13 +591,13 @@ void SAL_CALL VCLXFileControl::setProperty( const OUString& PropertyName, const
}
}
-void VCLXFileControl::SetWindow( vcl::Window* pWindow )
+void VCLXFileControl::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
- FileControl* pPrevFileControl = dynamic_cast<FileControl*>( GetWindow() );
+ VclPtr< FileControl > pPrevFileControl = GetAsDynamic< FileControl >();
if ( pPrevFileControl )
pPrevFileControl->GetEdit().SetModifyHdl( Link() );
- FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow );
+ FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow.get() );
if ( pNewFileControl )
pNewFileControl->GetEdit().SetModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
@@ -633,7 +633,7 @@ void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel,
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
{
pFileControl->GetEdit().SetSelection( Selection( rSel.Min, rSel.Max ) );
@@ -657,7 +657,7 @@ OUString VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::Runtime
SolarMutexGuard aGuard;
OUString aText;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl)
aText = pFileControl->GetEdit().GetSelected();
return aText;
@@ -668,7 +668,7 @@ void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSel
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetSelection( Selection( aSelection.Min, aSelection.Max ) );
}
@@ -678,7 +678,7 @@ void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSel
SolarMutexGuard aGuard;
::com::sun::star::awt::Selection aSel;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
{
aSel.Min = pFileControl->GetEdit().GetSelection().Min();
@@ -691,7 +691,7 @@ sal_Bool VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
return ( pFileControl && !pFileControl->GetEdit().IsReadOnly() && pFileControl->GetEdit().IsEnabled() ) ? sal_True : sal_False;
}
@@ -699,7 +699,7 @@ void VCLXFileControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetReadOnly( !bEditable );
}
@@ -708,7 +708,7 @@ void VCLXFileControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetMaxTextLen( nLen );
}
@@ -717,7 +717,7 @@ sal_Int16 VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeE
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
return pFileControl ? pFileControl->GetEdit().GetMaxTextLen() : 0;
}
@@ -736,7 +736,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
Size aTmpSize = pControl->GetEdit().CalcMinimumSize();
@@ -758,7 +758,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz =rNewSize;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
::com::sun::star::awt::Size aMinSz = getMinimumSize();
@@ -773,7 +773,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
aSz = AWTSize(pControl->GetEdit().CalcSize( nCols ));
@@ -788,7 +788,7 @@ void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines )
nCols = 0;
nLines = 1;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
nCols = pControl->GetEdit().GetMaxVisChars();
}
@@ -825,11 +825,11 @@ SVTXFormattedField::~SVTXFormattedField()
}
-void SVTXFormattedField::SetWindow( vcl::Window* _pWindow )
+void SVTXFormattedField::SetWindow( const VclPtr< vcl::Window > &_pWindow )
{
VCLXSpinField::SetWindow(_pWindow);
- if (GetFormattedField())
- GetFormattedField()->SetAutoColor(true);
+ if (GetAs< FormattedField >())
+ GetAs< FormattedField >()->SetAutoColor(true);
}
@@ -837,7 +837,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -964,7 +964,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
::com::sun::star::uno::Any aReturn;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1034,7 +1034,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
{
::com::sun::star::uno::Any aReturn;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return aReturn;
@@ -1092,7 +1092,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1121,7 +1121,7 @@ void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
::com::sun::star::uno::Any SVTXFormattedField::GetMinValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || !pField->HasMinValue())
return ::com::sun::star::uno::Any();
@@ -1133,7 +1133,7 @@ void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1161,7 +1161,7 @@ void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
::com::sun::star::uno::Any SVTXFormattedField::GetMaxValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || !pField->HasMaxValue())
return ::com::sun::star::uno::Any();
@@ -1173,7 +1173,7 @@ void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1206,7 +1206,7 @@ void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValu
::com::sun::star::uno::Any SVTXFormattedField::GetDefaultValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || pField->IsEmptyFieldEnabled())
return ::com::sun::star::uno::Any();
@@ -1221,7 +1221,7 @@ void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValu
bool SVTXFormattedField::GetTreatAsNumber()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
return pField->TreatingAsNumber();
@@ -1231,7 +1231,7 @@ bool SVTXFormattedField::GetTreatAsNumber()
void SVTXFormattedField::SetTreatAsNumber(bool bSet)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
pField->TreatAsNumber(bSet);
}
@@ -1239,7 +1239,7 @@ void SVTXFormattedField::SetTreatAsNumber(bool bSet)
::com::sun::star::uno::Any SVTXFormattedField::GetValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return ::com::sun::star::uno::Any();
@@ -1261,7 +1261,7 @@ void SVTXFormattedField::SetTreatAsNumber(bool bSet)
void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1297,7 +1297,7 @@ void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
SvNumberFormatsSupplierObj* pNew = NULL;
if (!xSupplier.is())
@@ -1339,14 +1339,14 @@ void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Referen
sal_Int32 SVTXFormattedField::getFormatKey() const
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetFormatKey() : 0;
}
void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
{
if (pField->GetFormatter())
@@ -1401,19 +1401,12 @@ void SVTXFormattedField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
// class SVTXRoadmap
-
using namespace svt;
-::svt::ORoadmap* SVTXRoadmap::GetRoadmap() const
-{
- return static_cast<svt::ORoadmap*>(GetWindow());
-}
-
SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this )
{
}
-
SVTXRoadmap::~SVTXRoadmap()
{
}
@@ -1425,7 +1418,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VCLEVENT_ROADMAP_ITEMSELECTED:
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_Int16 CurItemID = pField->GetCurrentRoadmapItemID();
@@ -1447,7 +1440,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRoadmapItem;
@@ -1521,7 +1514,7 @@ RMItemData SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::Contai
void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
RMItemData CurItemData = GetRMItemData( _rEvent );
@@ -1534,7 +1527,7 @@ void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerE
void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_Int32 DelIndex = 0;
@@ -1546,7 +1539,7 @@ void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEv
void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
RMItemData CurItemData = GetRMItemData( _rEvent );
@@ -1563,7 +1556,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1620,7 +1613,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::uno::Any aReturn;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1646,7 +1639,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
void SVTXRoadmap::ImplSetNewImage()
{
OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" );
- ::svt::ORoadmap* pButton = static_cast< ::svt::ORoadmap* >( GetWindow() );
+ VclPtr< ::svt::ORoadmap > pButton = GetAs< ::svt::ORoadmap >();
pButton->SetRoadmapBitmap( GetImage().GetBitmapEx() );
}
@@ -1692,7 +1685,7 @@ void SVTXNumericField::setValue( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetValue( Value );
}
@@ -1701,7 +1694,7 @@ double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1709,7 +1702,7 @@ void SVTXNumericField::setMin( double Value ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMinValue( Value );
}
@@ -1718,7 +1711,7 @@ double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1726,7 +1719,7 @@ void SVTXNumericField::setMax( double Value ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMaxValue( Value );
}
@@ -1735,7 +1728,7 @@ double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1743,7 +1736,7 @@ void SVTXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinFirst( Value );
}
@@ -1752,7 +1745,7 @@ double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1760,7 +1753,7 @@ void SVTXNumericField::setLast( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinLast( Value );
}
@@ -1769,7 +1762,7 @@ double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1777,7 +1770,7 @@ void SVTXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinSize( Value );
}
@@ -1786,7 +1779,7 @@ double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1794,7 +1787,7 @@ void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::sta
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetDecimalDigits( Value );
}
@@ -1803,7 +1796,7 @@ sal_Int16 SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetDecimalDigits() : 0;
}
@@ -1811,7 +1804,7 @@ void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::sta
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetStrictFormat( bStrict );
}
@@ -1820,7 +1813,7 @@ sal_Bool SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::Runtime
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->IsStrictFormat() : sal_False;
}
@@ -1858,7 +1851,7 @@ void SVTXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetValue( Value );
}
@@ -1867,7 +1860,7 @@ double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1875,7 +1868,7 @@ void SVTXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMinValue( Value );
}
@@ -1884,7 +1877,7 @@ double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1892,7 +1885,7 @@ void SVTXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMaxValue( Value );
}
@@ -1901,7 +1894,7 @@ double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1909,7 +1902,7 @@ void SVTXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinFirst( Value );
}
@@ -1918,7 +1911,7 @@ double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1926,7 +1919,7 @@ void SVTXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinLast( Value );
}
@@ -1935,7 +1928,7 @@ double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1943,7 +1936,7 @@ void SVTXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinSize( Value );
}
@@ -1952,7 +1945,7 @@ double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeExce
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1960,7 +1953,7 @@ void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::st
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetDecimalDigits( Value );
}
@@ -1969,7 +1962,7 @@ sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetDecimalDigits() : 0;
}
@@ -1977,7 +1970,7 @@ void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::st
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetStrictFormat( bStrict );
}
@@ -1986,7 +1979,7 @@ sal_Bool SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->IsStrictFormat() : sal_False;
}
@@ -1994,7 +1987,7 @@ void SVTXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
{
SolarMutexGuard aGuard;
- DoubleCurrencyField* pField = static_cast<DoubleCurrencyField*>(GetFormattedField());
+ VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2029,7 +2022,7 @@ void SVTXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
::com::sun::star::uno::Any aReturn;
- DoubleCurrencyField* pField = static_cast<DoubleCurrencyField*>(GetFormattedField());
+ VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2079,7 +2072,7 @@ VCLXProgressBar::~VCLXProgressBar()
void VCLXProgressBar::ImplUpdateValue()
{
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_Int32 nVal;
@@ -2210,7 +2203,7 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const ::com::su
{
SolarMutexGuard aGuard;
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2269,7 +2262,7 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const ::com::su
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2327,7 +2320,7 @@ void SAL_CALL SVTXDateField::setProperty( const OUString& PropertyName, const ::
VCLXDateField::setProperty( PropertyName, Value );
// some properties need to be forwarded to the sub edit, too
- Edit* pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow() )->GetSubEdit() : NULL;
+ VclPtr< Edit > pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow().get() )->GetSubEdit() : NULL;
if ( !pSubEdit )
return;
diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx
index b0998a583420..3980085246df 100644
--- a/svtools/source/uno/wizard/unowizard.cxx
+++ b/svtools/source/uno/wizard/unowizard.cxx
@@ -136,7 +136,7 @@ namespace {
virtual ~Wizard();
protected:
- virtual Dialog* createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
virtual void destroyDialog() SAL_OVERRIDE;
private:
@@ -268,12 +268,12 @@ namespace {
}
- Dialog* Wizard::createDialog( vcl::Window* i_pParent )
+ VclPtr<Dialog> Wizard::createDialog( vcl::Window* i_pParent )
{
- WizardShell* pDialog( new WizardShell( i_pParent, m_xController, m_aWizardSteps ) );
+ VclPtrInstance<WizardShell> pDialog( i_pParent, m_xController, m_aWizardSteps );
pDialog->SetHelpId( lcl_getHelpId( m_sHelpURL ) );
pDialog->setTitleBase( m_sTitle );
- return pDialog;
+ return pDialog.get();
}
@@ -359,7 +359,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" );
pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable );
@@ -371,7 +371,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" );
pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) );
@@ -383,7 +383,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" );
return pWizardImpl->travelNext();
@@ -395,7 +395,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" );
return pWizardImpl->travelPrevious();
@@ -407,7 +407,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" );
if ( !pWizardImpl->knowsPage( i_PageID ) )
@@ -425,7 +425,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" );
pWizardImpl->updateTravelUI();
@@ -437,7 +437,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" );
return pWizardImpl->advanceTo( i_PageId );
@@ -449,7 +449,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" );
return pWizardImpl->goBackTo( i_PageId );
@@ -461,7 +461,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() );
return pWizardImpl->getCurrentWizardPage();
@@ -476,7 +476,7 @@ namespace {
if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) )
throw NoSuchElementException( OUString(), *this );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" );
pWizardImpl->activatePath( i_PathIndex, i_Final );
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
index d10db321ee60..b3504d9d5f55 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -90,11 +90,6 @@ namespace svt { namespace uno
}
- WizardShell::~WizardShell()
- {
- }
-
-
short WizardShell::Execute()
{
ActivatePage();
@@ -187,17 +182,17 @@ namespace svt { namespace uno
}
- TabPage* WizardShell::createPage( WizardState i_nState )
+ VclPtr<TabPage> WizardShell::createPage( WizardState i_nState )
{
ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", NULL );
::boost::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) );
- TabPage* pPage = pController->getTabPage();
- OSL_ENSURE( pPage != NULL, "WizardShell::createPage: illegal tab page!" );
- if ( pPage == NULL )
+ VclPtr<TabPage> pPage = pController->getTabPage();
+ OSL_ENSURE( pPage, "WizardShell::createPage: illegal tab page!" );
+ if ( !pPage )
{
// fallback for ill-behaved clients: empty page
- pPage = new TabPage( this, 0 );
+ pPage = VclPtr<TabPage>::Create( this, 0 );
pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MAP_APPFONT ) );
}
@@ -205,7 +200,6 @@ namespace svt { namespace uno
return pPage;
}
-
IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const
{
return impl_getController( i_pCurrentPage ).get();
diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
index 4d2e3e8f0315..68650dd067cf 100644
--- a/svtools/source/uno/wizard/wizardshell.hxx
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -48,13 +48,12 @@ namespace svt { namespace uno
const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths
);
- virtual ~WizardShell();
// Dialog overridables
virtual short Execute() SAL_OVERRIDE;
// OWizardMachine overridables
- virtual TabPage* createPage( WizardState i_nState ) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage( WizardState i_nState ) SAL_OVERRIDE;
virtual void enterState( WizardState i_nState ) SAL_OVERRIDE;
virtual bool leaveState( WizardState i_nState ) SAL_OVERRIDE;
virtual OUString getStateDisplayName( WizardState i_nState ) const SAL_OVERRIDE;
@@ -118,7 +117,7 @@ namespace svt { namespace uno
using WizardShell_Base::activatePath;
private:
- typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap;
+ typedef ::std::map< VclPtr<TabPage>, PWizardPageController > Page2ControllerMap;
const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
const sal_Int16 m_nFirstPageID;
diff --git a/svx/inc/GalleryControl.hxx b/svx/inc/GalleryControl.hxx
index f85af689ce4a..a807b05dbea8 100644
--- a/svx/inc/GalleryControl.hxx
+++ b/svx/inc/GalleryControl.hxx
@@ -43,15 +43,14 @@ public:
GalleryControl (
SfxBindings* pBindings,
vcl::Window* pParentWindow);
- virtual ~GalleryControl();
bool GalleryKeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow);
private:
Gallery* mpGallery;
- ::boost::scoped_ptr<GallerySplitter> mpSplitter;
- ::boost::scoped_ptr<GalleryBrowser1> mpBrowser1;
- ::boost::scoped_ptr<GalleryBrowser2> mpBrowser2;
+ VclPtr<GallerySplitter> mpSplitter;
+ VclPtr<GalleryBrowser1> mpBrowser1;
+ VclPtr<GalleryBrowser2> mpBrowser2;
Size maLastSize;
bool mbIsInitialResize;
@@ -64,6 +63,8 @@ private:
protected:
void ThemeSelectionHasChanged();
+ virtual ~GalleryControl();
+ virtual void dispose() SAL_OVERRIDE;
};
} } // end of namespace svx::sidebar
diff --git a/svx/inc/extrusiondepthdialog.hxx b/svx/inc/extrusiondepthdialog.hxx
index 46362d7ff4c5..48b932e44e18 100644
--- a/svx/inc/extrusiondepthdialog.hxx
+++ b/svx/inc/extrusiondepthdialog.hxx
@@ -31,10 +31,12 @@ namespace svx {
class ExtrusionDepthDialog : public ModalDialog
{
- MetricField* m_pMtrDepth;
+ VclPtr<MetricField> m_pMtrDepth;
public:
ExtrusionDepthDialog( vcl::Window* pParent, double fDepth, FieldUnit eDefaultUnit );
+ virtual ~ExtrusionDepthDialog();
+ virtual void dispose() SAL_OVERRIDE;
double getDepth() const;
};
diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
index f65943b0316d..ec53f5236498 100644
--- a/svx/inc/galbrws2.hxx
+++ b/svx/inc/galbrws2.hxx
@@ -80,7 +80,6 @@ private:
public:
GalleryToolBox( GalleryBrowser2* pParent );
- virtual ~GalleryToolBox();
};
@@ -110,14 +109,14 @@ private:
SvtMiscOptions maMiscOptions;
Gallery* mpGallery;
GalleryTheme* mpCurTheme;
- GalleryIconView* mpIconView;
- GalleryListView* mpListView;
- GalleryPreview* mpPreview;
- GalleryToolBox maViewBox;
- FixedLine maSeparator;
- FixedText maInfoBar;
+ VclPtr<GalleryIconView> mpIconView;
+ VclPtr<GalleryListView> mpListView;
+ VclPtr<GalleryPreview> mpPreview;
+ VclPtr<GalleryToolBox> maViewBox;
+ VclPtr<FixedLine> maSeparator;
+ VclPtr<FixedText> maInfoBar;
Point maDragStartPos;
- sal_uIntPtr mnCurActionPos;
+ sal_uIntPtr mnCurActionPos;
GalleryBrowserMode meMode;
GalleryBrowserMode meLastMode;
@@ -154,6 +153,7 @@ public:
GalleryBrowser2(vcl::Window* pParent, Gallery* pGallery);
virtual ~GalleryBrowser2();
+ virtual void dispose() SAL_OVERRIDE;
void SelectTheme( const OUString& rThemeName );
diff --git a/svx/inc/sdr/overlay/overlaymanagerbuffered.hxx b/svx/inc/sdr/overlay/overlaymanagerbuffered.hxx
index 4063d521fd27..05db3120343f 100644
--- a/svx/inc/sdr/overlay/overlaymanagerbuffered.hxx
+++ b/svx/inc/sdr/overlay/overlaymanagerbuffered.hxx
@@ -36,11 +36,11 @@ namespace sdr
protected:
// The VirtualDevice for draw window content buffering, this
// is the view content without overlay
- VirtualDevice maBufferDevice;
+ ScopedVclPtr<VirtualDevice> mpBufferDevice;
// #i73602# The VirtualDevice for OverlayPaint buffering. This
// is an extra device to avoid flickering of overlay paints
- VirtualDevice maOutputBufferDevice;
+ ScopedVclPtr<VirtualDevice> mpOutputBufferDevice;
// Idle for buffering
Idle maBufferIdle;
diff --git a/svx/inc/svdibrow.hxx b/svx/inc/svdibrow.hxx
index 2e44db53db50..7ce191073b55 100644
--- a/svx/inc/svdibrow.hxx
+++ b/svx/inc/svdibrow.hxx
@@ -34,7 +34,7 @@ class _SdrItemBrowserControl: public BrowseBox
friend class ImpItemEdit;
std::vector<ImpItemListRow*> aList;
long nAktPaintRow;
- Edit* pEditControl;
+ VclPtr<Edit> pEditControl;
OUString aWNamMerk;
Link aEntryChangedHdl;
Link aSetDirtyHdl;
@@ -69,6 +69,7 @@ protected:
public:
_SdrItemBrowserControl(vcl::Window* pParent, WinBits nBits=WB_3DLOOK|WB_BORDER|WB_TABSTOP);
virtual ~_SdrItemBrowserControl();
+ virtual void dispose() SAL_OVERRIDE;
void Clear();
void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL);
sal_uIntPtr GetCurrentPos() const;
@@ -99,16 +100,16 @@ public:
#define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
class _SdrItemBrowserWindow: public FloatingWindow {
- _SdrItemBrowserControl aBrowse;
+ VclPtr<_SdrItemBrowserControl> aBrowse;
public:
_SdrItemBrowserWindow(vcl::Window* pParent, WinBits nBits=WB_STDSIZEABLEDOCKWIN);
virtual ~_SdrItemBrowserWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
- void Clear() { aBrowse.Clear(); }
- void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL) { aBrowse.SetAttributes(pAttr,p2ndSet); }
- const _SdrItemBrowserControl& GetBrowserControl() const { return aBrowse; }
- _SdrItemBrowserControl& GetBrowserControl() { return aBrowse; }
+ void Clear() { aBrowse->Clear(); }
+ void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL) { aBrowse->SetAttributes(pAttr,p2ndSet); }
+ _SdrItemBrowserControl *GetBrowserControl() { return aBrowse.get(); }
};
class SdrView;
diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index a7657eedeeaf..8aa95e1e99f0 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -47,7 +47,6 @@ public:
FindTextFieldControl( vcl::Window* pParent, WinBits nStyle,
css::uno::Reference< css::frame::XFrame >& xFrame,
const css::uno::Reference< css::uno::XComponentContext >& xContext );
- virtual ~FindTextFieldControl();
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -119,7 +118,7 @@ public:
private:
- FindTextFieldControl* m_pFindTextFieldControl;
+ VclPtr<FindTextFieldControl> m_pFindTextFieldControl;
sal_uInt16 m_nDownSearchId; // item position of findbar
sal_uInt16 m_nUpSearchId; // item position of findbar
@@ -221,7 +220,7 @@ public:
virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
private:
- CheckBox* m_pMatchCaseControl;
+ VclPtr<CheckBox> m_pMatchCaseControl;
};
class FindAllToolboxController : public svt::ToolboxController,
diff --git a/svx/source/accessibility/AccessibleShapeTreeInfo.cxx b/svx/source/accessibility/AccessibleShapeTreeInfo.cxx
index 5b8d23ad447e..416dfa63a273 100644
--- a/svx/source/accessibility/AccessibleShapeTreeInfo.cxx
+++ b/svx/source/accessibility/AccessibleShapeTreeInfo.cxx
@@ -19,6 +19,7 @@
#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <vcl/window.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index a00131c50183..85164cb10923 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -76,7 +76,7 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
mnClientId( 0 ),
mbDisposed( false )
{
- if (mpControl != NULL)
+ if (mpControl != nullptr)
{
mpModel = mpControl->GetSdrModel();
if (mpModel != NULL)
@@ -478,7 +478,7 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::grabFocus() throw( RuntimeException
{
::SolarMutexGuard aGuard;
- if( NULL == mpControl )
+ if( nullptr == mpControl )
throw DisposedException();
mpControl->GrabFocus();
@@ -729,7 +729,7 @@ Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBoxOnScreen() throw( Runtime
{
::SolarMutexGuard aGuard;
- if( NULL == mpControl )
+ if( nullptr == mpControl )
throw DisposedException();
return Rectangle(
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 7332449b75b2..7e033863237f 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -165,9 +165,9 @@ void CalculateHorizontalScalingFactor( const SdrObject* pCustomShape,
aFont.SetOrientation( 0 );
// initializing virtual device
- VirtualDevice aVirDev( 1 );
- aVirDev.SetMapMode( MAP_100TH_MM );
- aVirDev.SetFont( aFont );
+ ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 );
+ pVirDev->SetMapMode( MAP_100TH_MM );
+ pVirDev->SetFont( aFont );
if ( nOutlinesCount2d & 1 )
bSingleLineMode = true;
@@ -187,7 +187,7 @@ void CalculateHorizontalScalingFactor( const SdrObject* pCustomShape,
std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
while( aParagraphIter != aParagraphIEnd )
{
- double fTextWidth = aVirDev.GetTextWidth( aParagraphIter->aString );
+ double fTextWidth = pVirDev->GetTextWidth( aParagraphIter->aString );
if ( fTextWidth > 0.0 )
{
double fScale = fWidth / fTextWidth;
@@ -259,12 +259,12 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
aFont.SetWeight( rWeightItem.GetWeight() );
// initializing virtual device
- VirtualDevice aVirDev( 1 );
- aVirDev.SetMapMode( MAP_100TH_MM );
- aVirDev.SetFont( aFont );
- aVirDev.EnableRTL( true );
+ ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 );
+ pVirDev->SetMapMode( MAP_100TH_MM );
+ pVirDev->SetFont( aFont );
+ pVirDev->EnableRTL( true );
if ( aParagraphIter->nFrameDirection == FRMDIR_HORI_RIGHT_TOP )
- aVirDev.SetLayoutMode( TEXT_LAYOUT_BIDI_RTL );
+ pVirDev->SetLayoutMode( TEXT_LAYOUT_BIDI_RTL );
const SvxCharScaleWidthItem& rCharScaleWidthItem = static_cast<const SvxCharScaleWidthItem&>(pCustomShape->GetMergedItem( EE_CHAR_FONTWIDTH ));
sal_uInt16 nCharScaleWidth = rCharScaleWidthItem.GetValue();
@@ -282,9 +282,9 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
{
FWCharacterData aCharacterData;
OUString aCharText( (sal_Unicode)rText[ i ] );
- if ( aVirDev.GetTextOutlines( aCharacterData.vOutlines, aCharText, 0, 0, -1, true, nWidth, pDXArry ) )
+ if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, aCharText, 0, 0, -1, true, nWidth, pDXArry ) )
{
- sal_Int32 nTextWidth = aVirDev.GetTextWidth( aCharText);
+ sal_Int32 nTextWidth = pVirDev->GetTextWidth( aCharText);
std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterData.vOutlines.begin();
std::vector< tools::PolyPolygon >::iterator aOutlineIEnd = aCharacterData.vOutlines.end();
if ( aOutlineIter == aOutlineIEnd )
@@ -334,13 +334,13 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
if ( ( nCharScaleWidth != 100 ) && nCharScaleWidth )
{ // applying character spacing
pDXArry = new long[ rText.getLength() ];
- aVirDev.GetTextArray( rText, pDXArry);
- FontMetric aFontMetric( aVirDev.GetFontMetric() );
+ pVirDev->GetTextArray( rText, pDXArry);
+ FontMetric aFontMetric( pVirDev->GetFontMetric() );
aFont.SetWidth( (sal_Int32)( (double)aFontMetric.GetWidth() * ( (double)100 / (double)nCharScaleWidth ) ) );
- aVirDev.SetFont( aFont );
+ pVirDev->SetFont( aFont );
}
FWCharacterData aCharacterData;
- if ( aVirDev.GetTextOutlines( aCharacterData.vOutlines, rText, 0, 0, -1, true, nWidth, pDXArry ) )
+ if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, rText, 0, 0, -1, true, nWidth, pDXArry ) )
{
aParagraphIter->vCharacters.push_back( aCharacterData );
}
diff --git a/svx/source/customshapes/tbxcustomshapes.cxx b/svx/source/customshapes/tbxcustomshapes.cxx
index b287aac60a5a..f80af1e9a548 100644
--- a/svx/source/customshapes/tbxcustomshapes.cxx
+++ b/svx/source/customshapes/tbxcustomshapes.cxx
@@ -103,7 +103,7 @@ SfxPopupWindowType SvxTbxCtlCustomShapes::GetPopupWindowType() const
// Here is the window created
// The location of the Toolbox is queried through GetToolBox()
// rItemRect are the screen coordinates
-SfxPopupWindow* SvxTbxCtlCustomShapes::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxTbxCtlCustomShapes::CreatePopupWindow()
{
createAndPositionSubToolBar( m_aSubTbxResName );
return NULL;
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index bda7ae2b1c01..8588f9862428 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -84,13 +84,13 @@ public:
class MaskSet : public ValueSet
{
- SvxBmpMask* pSvxBmpMask;
-
+ VclPtr<SvxBmpMask> pSvxBmpMask;
public:
MaskSet(SvxBmpMask* pMask, vcl::Window* pParent);
-
- virtual void Select() SAL_OVERRIDE;
+ virtual ~MaskSet() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { pSvxBmpMask.clear(); ValueSet::dispose(); }
+ virtual void Select() SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE
@@ -160,7 +160,7 @@ void MaskSet::onEditColor()
class MaskData
{
- SvxBmpMask* pMask;
+ VclPtr<SvxBmpMask> pMask;
bool bIsReady;
bool bExecState;
SfxBindings& rBindings;
@@ -361,7 +361,7 @@ SvxBmpMaskChildWindow::SvxBmpMaskChildWindow(vcl::Window* pParent_, sal_uInt16 n
SfxChildWinInfo* pInfo)
: SfxChildWindow(pParent_, nId)
{
- SvxBmpMask* pDlg = new SvxBmpMask(pBindings, this, pParent_);
+ VclPtr<SvxBmpMask> pDlg = VclPtr<SvxBmpMask>::Create(pBindings, this, pParent_);
pWindow = pDlg;
@@ -381,35 +381,35 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window*
m_pTbxPipette->SetItemBits(m_pTbxPipette->GetItemId(0),
ToolBoxItemBits::AUTOCHECK);
get(m_pBtnExec, "replace");
- m_pCtlPipette = new ColorWindow(get<Window>("toolgrid"));
+ m_pCtlPipette = VclPtr<ColorWindow>::Create(get<Window>("toolgrid"));
m_pCtlPipette->Show();
m_pCtlPipette->set_grid_left_attach(1);
m_pCtlPipette->set_grid_top_attach(0);
m_pCtlPipette->set_hexpand(true);
get(m_pCbx1, "cbx1");
Window *pGrid = get<Window>("colorgrid");
- m_pQSet1 = new MaskSet(this, pGrid);
+ m_pQSet1 = VclPtr<MaskSet>::Create(this, pGrid);
m_pQSet1->set_grid_left_attach(1);
m_pQSet1->set_grid_top_attach(1);
m_pQSet1->Show();
get(m_pSp1, "tol1");
get(m_pLbColor1, "color1");
get(m_pCbx2, "cbx2");
- m_pQSet2 = new MaskSet(this, pGrid);
+ m_pQSet2 = VclPtr<MaskSet>::Create(this, pGrid);
m_pQSet2->set_grid_left_attach(1);
m_pQSet2->set_grid_top_attach(2);
m_pQSet2->Show();
get(m_pSp2, "tol2");
get(m_pLbColor2, "color2");
get(m_pCbx3, "cbx3");
- m_pQSet3 = new MaskSet(this, pGrid);
+ m_pQSet3 = VclPtr<MaskSet>::Create(this, pGrid);
m_pQSet3->set_grid_left_attach(1);
m_pQSet3->set_grid_top_attach(3);
m_pQSet3->Show();
get(m_pSp3, "tol3");
get(m_pLbColor3, "color3");
get(m_pCbx4, "cbx4");
- m_pQSet4 = new MaskSet(this, pGrid);
+ m_pQSet4 = VclPtr<MaskSet>::Create(this, pGrid);
m_pQSet4->set_grid_left_attach(1);
m_pQSet4->set_grid_top_attach(4);
m_pQSet4->Show();
@@ -483,12 +483,34 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window*
SvxBmpMask::~SvxBmpMask()
{
- delete m_pQSet1;
- delete m_pQSet2;
- delete m_pQSet3;
- delete m_pQSet4;
- delete m_pCtlPipette;
+ disposeOnce();
+}
+
+void SvxBmpMask::dispose()
+{
+ m_pQSet1.disposeAndClear();
+ m_pQSet2.disposeAndClear();
+ m_pQSet3.disposeAndClear();
+ m_pQSet4.disposeAndClear();
+ m_pCtlPipette.disposeAndClear();
delete pData;
+ m_pTbxPipette.clear();
+ m_pBtnExec.clear();
+ m_pCbx1.clear();
+ m_pSp1.clear();
+ m_pLbColor1.clear();
+ m_pCbx2.clear();
+ m_pSp2.clear();
+ m_pLbColor2.clear();
+ m_pCbx3.clear();
+ m_pSp3.clear();
+ m_pLbColor3.clear();
+ m_pCbx4.clear();
+ m_pSp4.clear();
+ m_pLbColor4.clear();
+ m_pCbxTrans.clear();
+ m_pLbColorTrans.clear();
+ SfxDockingWindow::dispose();
}
/** is called by a MaskSet when it is selected */
@@ -982,22 +1004,22 @@ Animation SvxBmpMask::ImpReplaceTransparency( const Animation& rAnim, const Colo
GDIMetaFile SvxBmpMask::ImpReplaceTransparency( const GDIMetaFile& rMtf, const Color& rColor )
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
GDIMetaFile aMtf;
const MapMode& rPrefMap = rMtf.GetPrefMapMode();
const Size& rPrefSize = rMtf.GetPrefSize();
const size_t nActionCount = rMtf.GetActionSize();
- aVDev.EnableOutput( false );
- aMtf.Record( &aVDev );
+ pVDev->EnableOutput( false );
+ aMtf.Record( pVDev );
aMtf.SetPrefSize( rPrefSize );
aMtf.SetPrefMapMode( rPrefMap );
- aVDev.SetLineColor( rColor );
- aVDev.SetFillColor( rColor );
+ pVDev->SetLineColor( rColor );
+ pVDev->SetFillColor( rColor );
// retrieve one action at the time; first
// set the whole area to the replacement color.
- aVDev.DrawRect( Rectangle( rPrefMap.GetOrigin(), rPrefSize ) );
+ pVDev->DrawRect( Rectangle( rPrefMap.GetOrigin(), rPrefSize ) );
for ( size_t i = 0; i < nActionCount; i++ )
{
MetaAction* pAct = rMtf.GetAction( i );
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index a189d195496c..1d4799c7cc07 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -67,7 +67,7 @@ SvxContourDlgChildWindow::SvxContourDlgChildWindow( vcl::Window* _pParent, sal_u
SfxBindings* pBindings, SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId )
{
- SvxSuperContourDlg* pDlg = new SvxSuperContourDlg(pBindings, this, _pParent);
+ VclPtr<SvxSuperContourDlg> pDlg = VclPtr<SvxSuperContourDlg>::Create(pBindings, this, _pParent);
pWindow = pDlg;
if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN )
@@ -88,6 +88,18 @@ SvxContourDlg::SvxContourDlg(SfxBindings* _pBindings, SfxChildWindow* pCW,
SvxContourDlg::~SvxContourDlg()
{
+ disposeOnce();
+}
+
+void SvxContourDlg::dispose()
+{
+ pSuperClass.clear();
+ SfxFloatingWindow::dispose();
+}
+
+void SvxContourDlg::SetSuperClass( SvxSuperContourDlg& rSuperClass )
+{
+ pSuperClass = &rSuperClass;
}
tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
@@ -101,16 +113,16 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
{
if( rGraphic.IsAnimated() )
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
MapMode aTransMap;
const Animation aAnim( rGraphic.GetAnimation() );
const Size& rSizePix = aAnim.GetDisplaySizePixel();
const sal_uInt16 nCount = aAnim.Count();
- if ( aVDev.SetOutputSizePixel( rSizePix ) )
+ if ( pVDev->SetOutputSizePixel( rSizePix ) )
{
- aVDev.SetLineColor( Color( COL_BLACK ) );
- aVDev.SetFillColor( Color( COL_BLACK ) );
+ pVDev->SetLineColor( Color( COL_BLACK ) );
+ pVDev->SetFillColor( Color( COL_BLACK ) );
for( sal_uInt16 i = 0; i < nCount; i++ )
{
@@ -119,13 +131,13 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
// Push Polygon output to the right place; this is the
// offset of the sub-image within the total animation
aTransMap.SetOrigin( Point( rStepBmp.aPosPix.X(), rStepBmp.aPosPix.Y() ) );
- aVDev.SetMapMode( aTransMap );
- aVDev.DrawPolyPolygon( CreateAutoContour( rStepBmp.aBmpEx, pRect, nFlags ) );
+ pVDev->SetMapMode( aTransMap );
+ pVDev->DrawPolyPolygon( CreateAutoContour( rStepBmp.aBmpEx, pRect, nFlags ) );
}
aTransMap.SetOrigin( Point() );
- aVDev.SetMapMode( aTransMap );
- aBmp = aVDev.GetBitmap( Point(), rSizePix );
+ pVDev->SetMapMode( aTransMap );
+ aBmp = pVDev->GetBitmap( Point(), rSizePix );
aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
}
}
@@ -140,8 +152,8 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
else if( rGraphic.GetType() != GRAPHIC_NONE )
{
const Graphic aTmpGrf( rGraphic.GetGDIMetaFile().GetMonochromeMtf( Color( COL_BLACK ) ) );
- VirtualDevice aVDev;
- Size aSizePix( aVDev.LogicToPixel( aTmpGrf.GetPrefSize(), aTmpGrf.GetPrefMapMode() ) );
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ Size aSizePix( pVDev->LogicToPixel( aTmpGrf.GetPrefSize(), aTmpGrf.GetPrefMapMode() ) );
if( aSizePix.Width() && aSizePix.Height() && ( aSizePix.Width() > 512 || aSizePix.Height() > 512 ) )
{
@@ -153,11 +165,11 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
aSizePix.Height() = FRound( ( aSizePix.Width() = 512 ) / fWH );
}
- if( aVDev.SetOutputSizePixel( aSizePix ) )
+ if( pVDev->SetOutputSizePixel( aSizePix ) )
{
const Point aPt;
- aTmpGrf.Draw( &aVDev, aPt, aSizePix );
- aBmp = aVDev.GetBitmap( aPt, aSizePix );
+ aTmpGrf.Draw( pVDev, aPt, aSizePix );
+ aBmp = pVDev->GetBitmap( aPt, aSizePix );
}
nContourFlags |= XOUTBMP_CONTOUR_EDGEDETECT;
@@ -211,7 +223,7 @@ SvxSuperContourDlg::SvxSuperContourDlg(SfxBindings *_pBindings, SfxChildWindow *
{
get(m_pTbx1, "toolbar");
get(m_pMtfTolerance, "spinbutton");
- m_pContourWnd = new ContourWindow(get<vcl::Window>("container"), WB_BORDER);
+ m_pContourWnd = VclPtr<ContourWindow>::Create(get<vcl::Window>("container"), WB_BORDER);
m_pContourWnd->set_hexpand(true);
m_pContourWnd->set_vexpand(true);
m_pContourWnd->Show();
@@ -282,9 +294,18 @@ SvxSuperContourDlg::SvxSuperContourDlg(SfxBindings *_pBindings, SfxChildWindow *
SvxSuperContourDlg::~SvxSuperContourDlg()
{
+ disposeOnce();
+}
+
+void SvxSuperContourDlg::dispose()
+{
SvtMiscOptions aMiscOptions;
aMiscOptions.RemoveListenerLink( LINK(this, SvxSuperContourDlg, MiscHdl) );
- delete m_pContourWnd;
+ m_pContourWnd.disposeAndClear();
+ m_pTbx1.clear();
+ m_pMtfTolerance.clear();
+ m_pStbStatus.clear();
+ SvxContourDlg::dispose();
}
bool SvxSuperContourDlg::Close()
@@ -293,8 +314,8 @@ bool SvxSuperContourDlg::Close()
if (m_pTbx1->IsItemEnabled(mnApplyId))
{
- MessageDialog aQBox( this,"QuerySaveContourChangesDialog","svx/ui/querysavecontchangesdialog.ui");
- const long nRet = aQBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aQBox( this,"QuerySaveContourChangesDialog","svx/ui/querysavecontchangesdialog.ui");
+ const long nRet = aQBox->Execute();
if ( nRet == RET_YES )
{
@@ -425,9 +446,9 @@ IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx )
{
if (m_pTbx1->IsItemChecked(mnWorkSpaceId))
{
- MessageDialog aQBox( this,"QueryDeleteContourDialog","svx/ui/querydeletecontourdialog.ui");
+ ScopedVclPtrInstance< MessageDialog > aQBox( this,"QueryDeleteContourDialog","svx/ui/querydeletecontourdialog.ui" );
- if ( !m_pContourWnd->IsContourChanged() || ( aQBox.Execute() == RET_YES ) )
+ if ( !m_pContourWnd->IsContourChanged() || ( aQBox->Execute() == RET_YES ) )
m_pContourWnd->SetWorkplaceMode( true );
else
m_pTbx1->CheckItem(mnWorkSpaceId, false);
@@ -499,10 +520,9 @@ IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx )
m_pStbStatus->Invalidate();
else if ( bGraphicLinked )
{
- MessageDialog aQBox(this, "QueryUnlinkGraphicsDialog",
- "svx/ui/queryunlinkgraphicsdialog.ui");
-
- if (aQBox.Execute() != RET_YES)
+ ScopedVclPtrInstance<MessageDialog> aQBox(this, "QueryUnlinkGraphicsDialog",
+ "svx/ui/queryunlinkgraphicsdialog.ui");
+ if (aQBox->Execute() != RET_YES)
{
bPipette = false;
m_pTbx1->CheckItem(mnPipetteId, bPipette);
@@ -693,7 +713,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow*, pWnd )
if( !!aMask )
{
- MessageDialog aQBox( this,"QueryNewContourDialog","svx/ui/querynewcontourdialog.ui");
+ ScopedVclPtrInstance< MessageDialog > aQBox( this,"QueryNewContourDialog","svx/ui/querynewcontourdialog.ui" );
bool bNewContour;
aRedoGraphic = Graphic();
@@ -701,7 +721,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow*, pWnd )
aGraphic = Graphic( BitmapEx( aBmp, aMask ) );
nGrfChanged++;
- bNewContour = ( aQBox.Execute() == RET_YES );
+ bNewContour = ( aQBox->Execute() == RET_YES );
pWnd->SetGraphic( aGraphic, bNewContour );
if( bNewContour )
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 3cbd7eda07c3..9071e536139a 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -56,7 +56,7 @@ sal_uInt32& SvxShowCharSet::getSelectedChar()
SvxShowCharSet::SvxShowCharSet(vcl::Window* pParent)
: Control(pParent, WB_TABSTOP | WB_BORDER)
, m_pAccessible(NULL)
- , aVscrollSB( this, WB_VERT)
+ , aVscrollSB( VclPtr<ScrollBar>::Create(this, WB_VERT) )
{
init();
InitSettings( true, true );
@@ -69,8 +69,8 @@ void SvxShowCharSet::init()
m_nYGap = 0;
SetStyle( GetStyle() | WB_CLIPCHILDREN );
- aVscrollSB.SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) );
- aVscrollSB.EnableDrag( true );
+ aVscrollSB->SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) );
+ aVscrollSB->EnableDrag( true );
// other settings like aVscroll depend on selected font => see SetFont
bDrag = false;
@@ -190,7 +190,7 @@ void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
void SvxShowCharSet::Command( const CommandEvent& rCEvt )
{
- if( !HandleScrollCommand( rCEvt, 0, &aVscrollSB ) )
+ if( !HandleScrollCommand( rCEvt, 0, aVscrollSB.get() ) )
Control::Command( rCEvt );
}
@@ -213,8 +213,8 @@ sal_uInt16 SvxShowCharSet::GetColumnPos(sal_uInt16 _nPos)
int SvxShowCharSet::FirstInView() const
{
int nIndex = 0;
- if( aVscrollSB.IsVisible() )
- nIndex += aVscrollSB.GetThumbPos() * COLUMN_COUNT;
+ if( aVscrollSB->IsVisible() )
+ nIndex += aVscrollSB->GetThumbPos() * COLUMN_COUNT;
return nIndex;
}
@@ -365,8 +365,8 @@ void SvxShowCharSet::DrawChars_Impl( int n1, int n2 )
return;
Size aOutputSize = GetOutputSizePixel();
- if (aVscrollSB.IsVisible())
- aOutputSize.Width() -= aVscrollSB.GetOptimalSize().Width();
+ if (aVscrollSB->IsVisible())
+ aOutputSize.Width() -= aVscrollSB->GetOptimalSize().Width();
int i;
for ( i = 1; i < COLUMN_COUNT; ++i )
@@ -513,7 +513,7 @@ void SvxShowCharSet::SetFont( const vcl::Font& rFont )
getSelectedChar() = mpFontCharMap->GetCharFromIndex( nSelectedIndex );
Size aSize = GetOutputSizePixel();
- long nSBWidth = aVscrollSB.GetOptimalSize().Width();
+ long nSBWidth = aVscrollSB->GetOptimalSize().Width();
aSize.Width() -= nSBWidth;
vcl::Font aFont = rFont;
@@ -528,18 +528,18 @@ void SvxShowCharSet::SetFont( const vcl::Font& rFont )
nX = aSize.Width() / COLUMN_COUNT;
nY = aSize.Height() / ROW_COUNT;
- aVscrollSB.setPosSizePixel( aSize.Width(), 0, nSBWidth, aSize.Height() );
- aVscrollSB.SetRangeMin( 0 );
+ aVscrollSB->setPosSizePixel( aSize.Width(), 0, nSBWidth, aSize.Height() );
+ aVscrollSB->SetRangeMin( 0 );
int nLastRow = (mpFontCharMap->GetCharCount() - 1 + COLUMN_COUNT) / COLUMN_COUNT;
- aVscrollSB.SetRangeMax( nLastRow );
- aVscrollSB.SetPageSize( ROW_COUNT-1 );
- aVscrollSB.SetVisibleSize( ROW_COUNT );
+ aVscrollSB->SetRangeMax( nLastRow );
+ aVscrollSB->SetPageSize( ROW_COUNT-1 );
+ aVscrollSB->SetVisibleSize( ROW_COUNT );
// restore last selected unicode
int nMapIndex = mpFontCharMap->GetIndexFromChar( getSelectedChar() );
SelectIndex( nMapIndex );
- aVscrollSB.Show();
+ aVscrollSB->Show();
// rearrange CharSet element in sync with nX- and nY-multiples
Size aDrawSize(nX * COLUMN_COUNT, nY * ROW_COUNT);
@@ -559,7 +559,7 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
sal_uInt32 cPrev = mpFontCharMap->GetPrevChar( getSelectedChar() );
int nMapIndex = mpFontCharMap->GetIndexFromChar( cPrev );
int nNewPos = nMapIndex / COLUMN_COUNT;
- aVscrollSB.SetThumbPos( nNewPos );
+ aVscrollSB->SetThumbPos( nNewPos );
nSelectedIndex = bFocus ? nMapIndex+1 : -1;
Invalidate();
Update();
@@ -567,9 +567,9 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
else if( nNewIndex < FirstInView() )
{
// need to scroll up to see selected item
- int nOldPos = aVscrollSB.GetThumbPos();
+ int nOldPos = aVscrollSB->GetThumbPos();
int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT;
- aVscrollSB.SetThumbPos( nOldPos - nDelta );
+ aVscrollSB->SetThumbPos( nOldPos - nDelta );
nSelectedIndex = nNewIndex;
Invalidate();
if( nDelta )
@@ -578,15 +578,15 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
else if( nNewIndex > LastInView() )
{
// need to scroll down to see selected item
- int nOldPos = aVscrollSB.GetThumbPos();
+ int nOldPos = aVscrollSB->GetThumbPos();
int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT;
- aVscrollSB.SetThumbPos( nOldPos + nDelta );
+ aVscrollSB->SetThumbPos( nOldPos + nDelta );
if( nNewIndex < mpFontCharMap->GetCharCount() )
{
nSelectedIndex = nNewIndex;
Invalidate();
}
- if( nOldPos != aVscrollSB.GetThumbPos() )
+ if( nOldPos != aVscrollSB->GetThumbPos() )
{
Invalidate();
Update();
@@ -603,8 +603,8 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
Point aOldPixel = MapIndexToPixel( nSelectedIndex );
aOldPixel.Move( +1, +1);
Size aOutputSize = GetOutputSizePixel();
- if (aVscrollSB.IsVisible())
- aOutputSize.Width() -= aVscrollSB.GetOptimalSize().Width();
+ if (aVscrollSB->IsVisible())
+ aOutputSize.Width() -= aVscrollSB->GetOptimalSize().Width();
DrawRect( getGridRectangle(aOldPixel, aOutputSize) );
SetLineColor( aLineCol );
SetFillColor( aFillCol );
@@ -655,7 +655,7 @@ void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew, bool bFocus )
if( !bFocus )
{
// move selected item to top row if not in focus
- aVscrollSB.SetThumbPos( nMapIndex / COLUMN_COUNT );
+ aVscrollSB->SetThumbPos( nMapIndex / COLUMN_COUNT );
Invalidate();
}
}
@@ -691,8 +691,15 @@ IMPL_LINK_NOARG(SvxShowCharSet, VscrollHdl)
SvxShowCharSet::~SvxShowCharSet()
{
+ disposeOnce();
+}
+
+void SvxShowCharSet::dispose()
+{
if ( m_pAccessible )
ReleaseAccessible();
+ aVscrollSB.disposeAndClear();
+ Control::dispose();
}
void SvxShowCharSet::ReleaseAccessible()
diff --git a/svx/source/dialog/checklbx.cxx b/svx/source/dialog/checklbx.cxx
index e7f3542e9887..d767d4707285 100644
--- a/svx/source/dialog/checklbx.cxx
+++ b/svx/source/dialog/checklbx.cxx
@@ -50,7 +50,13 @@ void SvxCheckListBox::SetNormalStaticImage(const Image& rNormalStaticImage)
SvxCheckListBox::~SvxCheckListBox()
{
+ disposeOnce();
+}
+
+void SvxCheckListBox::dispose()
+{
delete pCheckButton;
+ SvTreeListBox::dispose();
}
void SvxCheckListBox::Init_Impl()
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index f69b5545f216..53fc5635c587 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -63,6 +63,31 @@ CompressGraphicsDialog::CompressGraphicsDialog( vcl::Window* pParent, Graphic& r
Initialize();
}
+CompressGraphicsDialog::~CompressGraphicsDialog()
+{
+ disposeOnce();
+}
+
+void CompressGraphicsDialog::dispose()
+{
+ m_pLabelGraphicType.clear();
+ m_pFixedText2.clear();
+ m_pFixedText3.clear();
+ m_pFixedText5.clear();
+ m_pFixedText6.clear();
+ m_pReduceResolutionCB.clear();
+ m_pMFNewWidth.clear();
+ m_pMFNewHeight.clear();
+ m_pResolutionLB.clear();
+ m_pLosslessRB.clear();
+ m_pJpegCompRB.clear();
+ m_pCompressionMF.clear();
+ m_pQualityMF.clear();
+ m_pBtnCalculate.clear();
+ m_pInterpolationCombo.clear();
+ ModalDialog::dispose();
+}
+
void CompressGraphicsDialog::Initialize()
{
get(m_pLabelGraphicType, "label-graphic-type");
@@ -103,10 +128,6 @@ void CompressGraphicsDialog::Initialize()
Update();
}
-CompressGraphicsDialog::~CompressGraphicsDialog()
-{
-}
-
void CompressGraphicsDialog::Update()
{
GfxLinkType aLinkType = m_aGraphic.GetLink().GetType();
@@ -150,7 +171,7 @@ void CompressGraphicsDialog::Update()
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
sal_Unicode cSeparator = rLocaleWrapper.getNumDecimalSep()[0];
- VirtualDevice* pDummyVDev = new VirtualDevice();
+ VclPtr<VirtualDevice> pDummyVDev = VclPtr<VirtualDevice>::Create();
pDummyVDev->EnableOutput( false );
pDummyVDev->SetMapMode( m_aGraphic.GetPrefMapMode() );
diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx
index 6cb31753ab37..3db87d5b7564 100644
--- a/svx/source/dialog/connctrl.cxx
+++ b/svx/source/dialog/connctrl.cxx
@@ -57,7 +57,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxXConnectionPreview(
SvxXConnectionPreview::~SvxXConnectionPreview()
{
+ disposeOnce();
+}
+
+void SvxXConnectionPreview::dispose()
+{
delete pObjList;
+ Control::dispose();
}
void SvxXConnectionPreview::Resize()
diff --git a/svx/source/dialog/contimp.hxx b/svx/source/dialog/contimp.hxx
index c667544cbd46..68c78423c9e6 100644
--- a/svx/source/dialog/contimp.hxx
+++ b/svx/source/dialog/contimp.hxx
@@ -57,10 +57,10 @@ class SvxSuperContourDlg : public SvxContourDlg
void* pUpdateEditingObject;
void* pCheckObj;
SvxContourDlgItem aContourItem;
- ToolBox* m_pTbx1;
- MetricField* m_pMtfTolerance;
- ContourWindow* m_pContourWnd;
- StatusBar* m_pStbStatus;
+ VclPtr<ToolBox> m_pTbx1;
+ VclPtr<MetricField> m_pMtfTolerance;
+ VclPtr<ContourWindow> m_pContourWnd;
+ VclPtr<StatusBar> m_pStbStatus;
sal_uIntPtr nGrfChanged;
bool bExecState;
bool bUpdateGraphicLinked;
@@ -99,6 +99,7 @@ public:
SvxSuperContourDlg(SfxBindings *pBindings, SfxChildWindow *pCW,
vcl::Window* pParent);
virtual ~SvxSuperContourDlg();
+ virtual void dispose() SAL_OVERRIDE;
void SetExecState( bool bEnable );
diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx
index cea52c2aa502..8b4fded5ab8b 100644
--- a/svx/source/dialog/contwnd.cxx
+++ b/svx/source/dialog/contwnd.cxx
@@ -43,10 +43,6 @@ ContourWindow::ContourWindow( vcl::Window* pParent, WinBits nBits ) :
SetWinStyle( WB_SDRMODE );
}
-ContourWindow::~ContourWindow()
-{
-}
-
void ContourWindow::SetPolyPolygon( const tools::PolyPolygon& rPolyPoly )
{
SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
diff --git a/svx/source/dialog/contwnd.hxx b/svx/source/dialog/contwnd.hxx
index 2bbf9a6f2feb..e96118c8527c 100644
--- a/svx/source/dialog/contwnd.hxx
+++ b/svx/source/dialog/contwnd.hxx
@@ -50,7 +50,6 @@ protected:
public:
ContourWindow(vcl::Window* pParent, WinBits nBits);
- virtual ~ContourWindow();
void SetPolyPolygon( const tools::PolyPolygon& rPolyPoly );
const tools::PolyPolygon& GetPolyPolygon();
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 5406ba14804d..40973ace77b5 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -112,7 +112,14 @@ SvxRedlinTable::SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits)
SvxRedlinTable::~SvxRedlinTable()
{
+ disposeOnce();
+}
+
+void SvxRedlinTable::dispose()
+{
delete pCommentSearcher;
+ pCommentSearcher = NULL;
+ SvSimpleTable::dispose();
}
sal_Int32 SvxRedlinTable::ColCompare(SvTreeListEntry* pLeft,SvTreeListEntry* pRight)
@@ -378,7 +385,7 @@ SvxTPView::SvxTPView(vcl::Window *pParent, VclBuilderContainer *pTopLevel)
aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
pTable->set_width_request(aControlSize.Width());
pTable->set_height_request(aControlSize.Height());
- m_pViewData = new SvxRedlinTable(*pTable, 0);
+ m_pViewData = VclPtr<SvxRedlinTable>::Create(*pTable, 0);
Link aLink=LINK( this, SvxTPView, PbClickHdl);
@@ -411,7 +418,18 @@ void SvxTPView::DeactivatePage()
SvxTPView::~SvxTPView()
{
- delete m_pViewData;
+ disposeOnce();
+}
+
+void SvxTPView::dispose()
+{
+ m_pViewData.disposeAndClear();
+ m_pAccept.clear();
+ m_pReject.clear();
+ m_pAcceptAll.clear();
+ m_pRejectAll.clear();
+ m_pUndo.clear();
+ TabPage::dispose();
}
void SvxTPView::InsertWriterHeader()
@@ -584,6 +602,35 @@ SvxTPFilter::SvxTPFilter( vcl::Window * pParent)
bModified=false;
}
+SvxTPFilter::~SvxTPFilter()
+{
+ disposeOnce();
+}
+
+void SvxTPFilter::dispose()
+{
+ pRedlinTable.clear();
+ m_pCbDate.clear();
+ m_pLbDate.clear();
+ m_pDfDate.clear();
+ m_pTfDate.clear();
+ m_pIbClock.clear();
+ m_pFtDate2.clear();
+ m_pDfDate2.clear();
+ m_pTfDate2.clear();
+ m_pIbClock2.clear();
+ m_pCbAuthor.clear();
+ m_pLbAuthor.clear();
+ m_pCbRange.clear();
+ m_pEdRange.clear();
+ m_pBtnRange.clear();
+ m_pCbAction.clear();
+ m_pLbAction.clear();
+ m_pCbComment.clear();
+ m_pEdComment.clear();
+ TabPage::dispose();
+}
+
void SvxTPFilter::SetRedlinTable(SvxRedlinTable* pTable)
{
pRedlinTable=pTable;
@@ -950,7 +997,7 @@ void SvxTPFilter::DeactivatePage()
{
if(bModified)
{
- if(pRedlinTable!=NULL)
+ if(pRedlinTable!=nullptr)
{
pRedlinTable->SetFilterDate(IsDate());
pRedlinTable->SetDateTimeMode(GetDateMode());
@@ -1003,7 +1050,7 @@ IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF)
if(m_pDfDate->GetText().isEmpty())
m_pDfDate->SetDate(aDate);
- if(pRedlinTable!=NULL)
+ if(pRedlinTable!=nullptr)
pRedlinTable->SetFirstDate(m_pDfDate->GetDate());
}
else if (m_pDfDate2==pTF)
@@ -1011,7 +1058,7 @@ IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF)
if(m_pDfDate2->GetText().isEmpty())
m_pDfDate2->SetDate(aDate);
- if(pRedlinTable!=NULL)
+ if(pRedlinTable!=nullptr)
pRedlinTable->SetLastDate(m_pDfDate2->GetDate());
}
else if (m_pTfDate==pTF)
@@ -1019,7 +1066,7 @@ IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF)
if(m_pTfDate->GetText().isEmpty())
m_pTfDate->SetTime(aTime);
- if(pRedlinTable!=NULL)
+ if(pRedlinTable!=nullptr)
pRedlinTable->SetFirstTime(m_pTfDate->GetTime());
}
else if (m_pTfDate2==pTF)
@@ -1027,7 +1074,7 @@ IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF)
if(m_pTfDate2->GetText().isEmpty())
m_pTfDate2->SetTime(aTime);
- if(pRedlinTable!=NULL)
+ if(pRedlinTable!=nullptr)
pRedlinTable->SetLastTime(m_pTfDate2->GetTime());
}
@@ -1049,8 +1096,8 @@ SvxAcceptChgCtr::SvxAcceptChgCtr(vcl::Window* pParent, VclBuilderContainer* pTop
{
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "svx/ui/redlinecontrol.ui", "RedlineControl");
- pTPFilter = new SvxTPFilter(this);
- pTPView = new SvxTPView(this, pTopLevel);
+ pTPFilter = VclPtr<SvxTPFilter>::Create(this);
+ pTPView = VclPtr<SvxTPView>::Create(this, pTopLevel);
m_nViewPageId = GetPageId("view");
m_nFilterPageId = GetPageId("filter");
@@ -1066,8 +1113,15 @@ SvxAcceptChgCtr::SvxAcceptChgCtr(vcl::Window* pParent, VclBuilderContainer* pTop
SvxAcceptChgCtr::~SvxAcceptChgCtr()
{
- delete pTPView;
- delete pTPFilter;
+ disposeOnce();
+}
+
+void SvxAcceptChgCtr::dispose()
+{
+ disposeBuilder();
+ pTPView.disposeAndClear();
+ pTPFilter.disposeAndClear();
+ TabControl::dispose();
}
void SvxAcceptChgCtr::ShowFilterPage()
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index 55016d24cc10..0735098c3cae 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -220,9 +220,9 @@ void DialControlBmp::DrawBackground()
DialControl::DialControl_Impl::DialControl_Impl ( vcl::Window& rParent ) :
- mxBmpEnabled(new DialControlBmp(rParent)),
- mxBmpDisabled(new DialControlBmp(rParent)),
- mxBmpBuffered(new DialControlBmp(rParent)),
+ mxBmpEnabled(VclPtr<DialControlBmp>::Create(rParent)),
+ mxBmpDisabled(VclPtr<DialControlBmp>::Create(rParent)),
+ mxBmpBuffered(VclPtr<DialControlBmp>::Create(rParent)),
mpLinkField( 0 ),
mnLinkedFieldValueMultiplyer( 0 ),
mnAngle( 0 ),
@@ -267,10 +267,6 @@ DialControl::DialControl( vcl::Window* pParent, WinBits nBits ) :
Init( GetOutputSizePixel() );
}
-DialControl::~DialControl()
-{
-}
-
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeDialControl(vcl::Window *pParent, VclBuilder::stringmap &)
{
return new DialControl(pParent, WB_TABSTOP);
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index ce4358124f81..fb4923ebd747 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -69,8 +69,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvx3DPreviewControl(vc
Svx3DPreviewControl::~Svx3DPreviewControl()
{
+ disposeOnce();
+}
+
+void Svx3DPreviewControl::dispose()
+{
delete mp3DView;
delete mpModel;
+ Control::dispose();
}
void Svx3DPreviewControl::Construct()
@@ -272,12 +278,6 @@ Svx3DLightControl::Svx3DLightControl(vcl::Window* pParent, WinBits nStyle)
Construct2();
}
-Svx3DLightControl::~Svx3DLightControl()
-{
- // SdrObjects like mpExpansionObject and mpLampBottomObject/mpLampShaftObject get deleted
- // with deletion of the DrawingLayer and model
-}
-
void Svx3DLightControl::Construct2()
{
{
@@ -948,10 +948,10 @@ basegfx::B3DVector Svx3DLightControl::GetLightDirection(sal_uInt32 nNum) const
SvxLightCtl3D::SvxLightCtl3D( vcl::Window* pParent)
: Control(pParent, WB_BORDER | WB_TABSTOP),
- maLightControl(this, 0),
- maHorScroller(this, WB_HORZ | WB_DRAG),
- maVerScroller(this, WB_VERT | WB_DRAG),
- maSwitcher(this, 0)
+ maLightControl(VclPtr<Svx3DLightControl>::Create(this, 0)),
+ maHorScroller(VclPtr<ScrollBar>::Create(this, WB_HORZ | WB_DRAG)),
+ maVerScroller(VclPtr<ScrollBar>::Create(this, WB_VERT | WB_DRAG)),
+ maSwitcher(VclPtr<PushButton>::Create(this, 0))
{
// init members
Init();
@@ -970,33 +970,33 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxLightCtl3D(vcl::Win
void SvxLightCtl3D::Init()
{
// #i58240# set HelpIDs for scrollbars and switcher
- maHorScroller.SetHelpId(HID_CTRL3D_HSCROLL);
- maVerScroller.SetHelpId(HID_CTRL3D_VSCROLL);
- maSwitcher.SetHelpId(HID_CTRL3D_SWITCHER);
- maSwitcher.SetAccessibleName(SVX_RESSTR(STR_SWITCH));
+ maHorScroller->SetHelpId(HID_CTRL3D_HSCROLL);
+ maVerScroller->SetHelpId(HID_CTRL3D_VSCROLL);
+ maSwitcher->SetHelpId(HID_CTRL3D_SWITCHER);
+ maSwitcher->SetAccessibleName(SVX_RESSTR(STR_SWITCH));
// Light preview
- maLightControl.Show();
- maLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
- maLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
+ maLightControl->Show();
+ maLightControl->SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
+ maLightControl->SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
// Horiz Scrollbar
- maHorScroller.Show();
- maHorScroller.SetRange(Range(0, 36000));
- maHorScroller.SetLineSize(100);
- maHorScroller.SetPageSize(1000);
- maHorScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+ maHorScroller->Show();
+ maHorScroller->SetRange(Range(0, 36000));
+ maHorScroller->SetLineSize(100);
+ maHorScroller->SetPageSize(1000);
+ maHorScroller->SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
// Vert Scrollbar
- maVerScroller.Show();
- maVerScroller.SetRange(Range(0, 18000));
- maVerScroller.SetLineSize(100);
- maVerScroller.SetPageSize(1000);
- maVerScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+ maVerScroller->Show();
+ maVerScroller->SetRange(Range(0, 18000));
+ maVerScroller->SetLineSize(100);
+ maVerScroller->SetPageSize(1000);
+ maVerScroller->SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
// Switch Button
- maSwitcher.Show();
- maSwitcher.SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
+ maSwitcher->Show();
+ maSwitcher->SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
// check selection
CheckSelection();
@@ -1007,6 +1007,16 @@ void SvxLightCtl3D::Init()
SvxLightCtl3D::~SvxLightCtl3D()
{
+ disposeOnce();
+}
+
+void SvxLightCtl3D::dispose()
+{
+ maLightControl.disposeAndClear();
+ maHorScroller.disposeAndClear();
+ maVerScroller.disposeAndClear();
+ maSwitcher.disposeAndClear();
+ Control::dispose();
}
void SvxLightCtl3D::Resize()
@@ -1022,43 +1032,43 @@ void SvxLightCtl3D::NewLayout()
{
// Layout members
const Size aSize(GetOutputSizePixel());
- const sal_Int32 nScrollSize(maHorScroller.GetSizePixel().Height());
+ const sal_Int32 nScrollSize(maHorScroller->GetSizePixel().Height());
// Preview control
Point aPoint(0, 0);
Size aDestSize(aSize.Width() - nScrollSize, aSize.Height() - nScrollSize);
- maLightControl.SetPosSizePixel(aPoint, aDestSize);
+ maLightControl->SetPosSizePixel(aPoint, aDestSize);
// hor scrollbar
aPoint.Y() = aSize.Height() - nScrollSize;
aDestSize.Height() = nScrollSize;
- maHorScroller.SetPosSizePixel(aPoint, aDestSize);
+ maHorScroller->SetPosSizePixel(aPoint, aDestSize);
// vert scrollbar
aPoint.X() = aSize.Width() - nScrollSize;
aPoint.Y() = 0;
aDestSize.Width() = nScrollSize;
aDestSize.Height() = aSize.Height() - nScrollSize;
- maVerScroller.SetPosSizePixel(aPoint, aDestSize);
+ maVerScroller->SetPosSizePixel(aPoint, aDestSize);
// button
aPoint.Y() = aSize.Height() - nScrollSize;
aDestSize.Height() = nScrollSize;
- maSwitcher.SetPosSizePixel(aPoint, aDestSize);
+ maSwitcher->SetPosSizePixel(aPoint, aDestSize);
}
void SvxLightCtl3D::CheckSelection()
{
- const bool bSelectionValid(maLightControl.IsSelectionValid() || maLightControl.IsGeometrySelected());
- maHorScroller.Enable(bSelectionValid);
- maVerScroller.Enable(bSelectionValid);
+ const bool bSelectionValid(maLightControl->IsSelectionValid() || maLightControl->IsGeometrySelected());
+ maHorScroller->Enable(bSelectionValid);
+ maVerScroller->Enable(bSelectionValid);
if(bSelectionValid)
{
double fHor(0.0), fVer(0.0);
- maLightControl.GetPosition(fHor, fVer);
- maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
- maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+ maLightControl->GetPosition(fHor, fVer);
+ maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
}
}
@@ -1066,7 +1076,7 @@ void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
{
double fHor(0.0), fVer(0.0);
- maLightControl.GetPosition(fHor, fVer);
+ maLightControl->GetPosition(fHor, fVer);
fHor += fDeltaHor;
fVer += fDeltaVer;
@@ -1076,9 +1086,9 @@ void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
if ( fVer < -90.0 )
return;
- maLightControl.SetPosition(fHor, fVer);
- maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
- maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+ maLightControl->SetPosition(fHor, fVer);
+ maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
if(maUserInteractiveChangeCallback.IsSet())
{
@@ -1124,9 +1134,9 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
}
case KEY_PAGEUP:
{
- sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+ sal_Int32 nLight(maLightControl->GetSelectedLight() - 1);
- while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
+ while((nLight >= 0) && !maLightControl->GetLightOnOff(nLight))
{
nLight--;
}
@@ -1135,7 +1145,7 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
{
nLight = 7;
- while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
+ while((nLight >= 0) && !maLightControl->GetLightOnOff(nLight))
{
nLight--;
}
@@ -1143,7 +1153,7 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
if(nLight >= 0)
{
- maLightControl.SelectLight(nLight);
+ maLightControl->SelectLight(nLight);
CheckSelection();
if(maUserSelectionChangeCallback.IsSet())
@@ -1156,9 +1166,9 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
}
case KEY_PAGEDOWN:
{
- sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+ sal_Int32 nLight(maLightControl->GetSelectedLight() - 1);
- while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
+ while(nLight <= 7 && !maLightControl->GetLightOnOff(nLight))
{
nLight++;
}
@@ -1167,7 +1177,7 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
{
nLight = 0;
- while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
+ while(nLight <= 7 && !maLightControl->GetLightOnOff(nLight))
{
nLight++;
}
@@ -1175,7 +1185,7 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
if(nLight <= 7)
{
- maLightControl.SelectLight(nLight);
+ maLightControl->SelectLight(nLight);
CheckSelection();
if(maUserSelectionChangeCallback.IsSet())
@@ -1202,16 +1212,16 @@ void SvxLightCtl3D::GetFocus()
{
CheckSelection();
- Size aFocusSize = maLightControl.GetOutputSizePixel();
+ Size aFocusSize = maLightControl->GetOutputSizePixel();
aFocusSize.Width() -= 4;
aFocusSize.Height() -= 4;
Rectangle aFocusRect( Point( 2, 2 ), aFocusSize );
- aFocusRect = maLightControl.PixelToLogic( aFocusRect );
+ aFocusRect = maLightControl->PixelToLogic( aFocusRect );
- maLightControl.ShowFocus( aFocusRect );
+ maLightControl->ShowFocus( aFocusRect );
}
}
@@ -1219,15 +1229,15 @@ void SvxLightCtl3D::LoseFocus()
{
Control::LoseFocus();
- maLightControl.HideFocus();
+ maLightControl->HideFocus();
}
IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove)
{
- const sal_Int32 nHor(maHorScroller.GetThumbPos());
- const sal_Int32 nVer(maVerScroller.GetThumbPos());
+ const sal_Int32 nHor(maHorScroller->GetThumbPos());
+ const sal_Int32 nVer(maVerScroller->GetThumbPos());
- maLightControl.SetPosition(
+ maLightControl->SetPosition(
((double)nHor) / 100.0,
((double)((18000 - nVer) - 9000)) / 100.0);
@@ -1257,9 +1267,9 @@ IMPL_LINK_NOARG(SvxLightCtl3D, InternalInteractiveChange)
{
double fHor(0.0), fVer(0.0);
- maLightControl.GetPosition(fHor, fVer);
- maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
- maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+ maLightControl->GetPosition(fHor, fVer);
+ maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
if(maUserInteractiveChangeCallback.IsSet())
{
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 7ced4eaf2856..5ab4213297ce 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -106,10 +106,16 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxRectCtl(vcl::Window
SvxRectCtl::~SvxRectCtl()
{
+ disposeOnce();
+}
+
+void SvxRectCtl::dispose()
+{
delete pBitmap;
if( pAccContext )
pAccContext->release();
+ Control::dispose();
}
@@ -841,7 +847,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPixelCtl(vcl::Windo
SvxPixelCtl::~SvxPixelCtl( )
{
+ disposeOnce();
+}
+
+void SvxPixelCtl::dispose()
+{
delete []pPixel;
+ Control::dispose();
}
// Changes the foreground or Background color
@@ -1427,8 +1439,8 @@ namespace
{
if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0)
{
- VirtualDevice aVirtualDevice;
- aVirtualDevice.SetOutputSizePixel(rSize);
+ ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
+ pVirtualDevice->SetOutputSizePixel(rSize);
if(rBitmapEx.IsTransparent())
{
@@ -1441,19 +1453,19 @@ namespace
static const Color aW(COL_WHITE);
static const Color aG(0xef, 0xef, 0xef);
- aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG);
+ pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG);
}
else
{
- aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
- aVirtualDevice.Erase();
+ pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
+ pVirtualDevice->Erase();
}
}
if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height())
{
rBitmapEx.Scale(rSize, BMP_SCALE_DEFAULT);
- aVirtualDevice.DrawBitmapEx(Point(0, 0), rBitmapEx);
+ pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx);
}
else
{
@@ -1463,14 +1475,14 @@ namespace
{
for(sal_Int32 x(0); x < rSize.Width(); x += aBitmapSize.Width())
{
- aVirtualDevice.DrawBitmapEx(
+ pVirtualDevice->DrawBitmapEx(
Point(x, y),
rBitmapEx);
}
}
}
- rBitmapEx = aVirtualDevice.GetBitmap(Point(0, 0), rSize);
+ rBitmapEx = pVirtualDevice->GetBitmap(Point(0, 0), rSize);
}
}
} // end of anonymous namespace
@@ -1594,10 +1606,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineLB(vcl::Window *pP
return pListBox;
}
-LineLB::~LineLB()
-{
-}
-
void LineLB::setAddStandardFields(bool bNew)
{
if(getAddStandardFields() != bNew)
@@ -1696,17 +1704,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineEndLB(vcl::Window
return pListBox;
}
-LineEndLB::~LineEndLB()
-{
-}
-
void LineEndLB::Fill( const XLineEndListRef &pList, bool bStart )
{
if( !pList.is() )
return;
long nCount = pList->Count();
- VirtualDevice aVD;
+ ScopedVclPtrInstance< VirtualDevice > pVD;
SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
@@ -1716,10 +1720,10 @@ void LineEndLB::Fill( const XLineEndListRef &pList, bool bStart )
if( !aBitmap.IsEmpty() )
{
Size aBmpSize( aBitmap.GetSizePixel() );
- aVD.SetOutputSizePixel( aBmpSize, false );
- aVD.DrawBitmap( Point(), aBitmap );
+ pVD->SetOutputSizePixel( aBmpSize, false );
+ pVD->DrawBitmap( Point(), aBitmap );
InsertEntry( pEntry->GetName(),
- Image(aVD.GetBitmap(
+ Image(pVD->GetBitmap(
(bStart) ? Point() : Point(aBmpSize.Width() / 2, 0),
Size(aBmpSize.Width() / 2, aBmpSize.Height()))));
//delete pBitmap;
@@ -1736,14 +1740,14 @@ void LineEndLB::Append( const XLineEndEntry& rEntry, const Bitmap& rBitmap, bool
{
if(!rBitmap.IsEmpty())
{
- VirtualDevice aVD;
+ ScopedVclPtrInstance< VirtualDevice > pVD;
const Size aBmpSize(rBitmap.GetSizePixel());
- aVD.SetOutputSizePixel(aBmpSize, false);
- aVD.DrawBitmap(Point(), rBitmap);
+ pVD->SetOutputSizePixel(aBmpSize, false);
+ pVD->DrawBitmap(Point(), rBitmap);
InsertEntry(
rEntry.GetName(),
- Image(aVD.GetBitmap(
+ Image(pVD->GetBitmap(
(bStart) ? Point() : Point(aBmpSize.Width() / 2, 0),
Size(aBmpSize.Width() / 2, aBmpSize.Height()))));
}
@@ -1761,14 +1765,14 @@ void LineEndLB::Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const Bitma
if(!rBitmap.IsEmpty())
{
- VirtualDevice aVD;
+ ScopedVclPtrInstance< VirtualDevice > pVD;
const Size aBmpSize(rBitmap.GetSizePixel());
- aVD.SetOutputSizePixel(aBmpSize, false);
- aVD.DrawBitmap(Point(), rBitmap);
+ pVD->SetOutputSizePixel(aBmpSize, false);
+ pVD->DrawBitmap(Point(), rBitmap);
InsertEntry(
rEntry.GetName(),
- Image(aVD.GetBitmap(
+ Image(pVD->GetBitmap(
(bStart) ? Point() : Point(aBmpSize.Width() / 2, 0),
Size(aBmpSize.Width() / 2, aBmpSize.Height()))),
nPos);
@@ -1820,7 +1824,7 @@ void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground)
SvxPreviewBase::SvxPreviewBase(vcl::Window* pParent)
: Control(pParent, WB_BORDER)
, mpModel(new SdrModel())
- , mpBufferDevice(new VirtualDevice(*this))
+ , mpBufferDevice(VclPtr<VirtualDevice>::Create(*this))
{
// Draw the control's border as a flat thin black line.
SetBorderStyle(WindowBorderStyle::MONO);
@@ -1833,8 +1837,14 @@ SvxPreviewBase::SvxPreviewBase(vcl::Window* pParent)
SvxPreviewBase::~SvxPreviewBase()
{
+ disposeOnce();
+}
+
+void SvxPreviewBase::dispose()
+{
delete mpModel;
- delete mpBufferDevice;
+ mpBufferDevice.disposeAndClear();
+ Control::dispose();
}
void SvxPreviewBase::LocalPrePaint()
@@ -1988,12 +1998,18 @@ Size SvxXLinePreview::GetOptimalSize() const
SvxXLinePreview::~SvxXLinePreview()
{
+ disposeOnce();
+}
+
+void SvxXLinePreview::dispose()
+{
SdrObject *pFoo = mpLineObjA;
SdrObject::Free( pFoo );
pFoo = mpLineObjB;
SdrObject::Free( pFoo );
pFoo = mpLineObjC;
SdrObject::Free( pFoo );
+ SvxPreviewBase::dispose();
}
@@ -2094,7 +2110,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxXRectPreview(vcl::W
SvxXRectPreview::~SvxXRectPreview()
{
+ disposeOnce();
+}
+
+void SvxXRectPreview::dispose()
+{
SdrObject::Free(mpRectangleObject);
+ SvxPreviewBase::dispose();
}
void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet)
@@ -2149,8 +2171,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxXShadowPreview (vcl
SvxXShadowPreview::~SvxXShadowPreview()
{
+ disposeOnce();
+}
+
+void SvxXShadowPreview::dispose()
+{
SdrObject::Free(mpRectangleObject);
SdrObject::Free(mpRectangleShadow);
+ SvxPreviewBase::dispose();
}
void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet)
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index b0a0653429d0..b7b32b35f6cf 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -539,15 +539,21 @@ PluginProgressWindow::PluginProgressWindow( vcl::Window*
PluginProgressWindow::~PluginProgressWindow()
{
+ disposeOnce();
+}
+
+void PluginProgressWindow::dispose()
+{
if (m_xProgress.is())
m_xProgress->dispose();
+ vcl::Window::dispose();
}
PluginProgress::PluginProgress( vcl::Window* pParent,
const css::uno::Reference< css::uno::XComponentContext >& xContext )
{
- m_pPlugProgressWindow = new PluginProgressWindow(pParent, static_cast< css::lang::XComponent* >(this));
+ m_pPlugProgressWindow = VclPtr<PluginProgressWindow>::Create(pParent, static_cast< css::lang::XComponent* >(this));
css::uno::Reference< css::awt::XWindow > xProgressWindow = VCLUnoHelper::GetInterface(m_pPlugProgressWindow);
m_xProgressFactory = css::task::StatusIndicatorFactory::createWithWindow(xContext, xProgressWindow, sal_False/*DisableReschedule*/, sal_True/*AllowParentShow*/);
m_xProgress = m_xProgressFactory->createStatusIndicator();
@@ -660,10 +666,23 @@ SaveDialog::SaveDialog(vcl::Window* pParent, RecoveryCore* pCore)
}
}
+SaveDialog::~SaveDialog()
+{
+ disposeOnce();
+}
+
+void SaveDialog::dispose()
+{
+ m_pTitleFT.clear();
+ m_pFileListLB.clear();
+ m_pOkBtn.clear();
+ Dialog::dispose();
+}
+
IMPL_LINK_NOARG(SaveDialog, OKButtonHdl)
{
// start crash-save with progress
- boost::scoped_ptr<SaveProgressDialog> pProgress(new SaveProgressDialog(this, m_pCore));
+ ScopedVclPtrInstance< SaveProgressDialog > pProgress(this, m_pCore);
short nResult = pProgress->Execute();
pProgress.reset();
@@ -690,6 +709,17 @@ SaveProgressDialog::SaveProgressDialog(vcl::Window* pParent, RecoveryCore* pCore
m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
}
+SaveProgressDialog::~SaveProgressDialog()
+{
+ disposeOnce();
+}
+
+void SaveProgressDialog::dispose()
+{
+ m_pProgrParent.clear();
+ ModalDialog::dispose();
+}
+
short SaveProgressDialog::Execute()
{
::SolarMutexGuard aLock;
@@ -808,10 +838,6 @@ RecovDocList::RecovDocList(SvSimpleTableContainer& rParent, ResMgr &rResMgr)
{
}
-RecovDocList::~RecovDocList()
-{
-}
-
void RecovDocList::InitEntry(SvTreeListEntry* pEntry,
const OUString& rText,
const Image& rImage1,
@@ -829,8 +855,8 @@ void RecovDocList::InitEntry(SvTreeListEntry* pEntry,
short impl_askUserForWizardCancel(vcl::Window* pParent, sal_Int16 nRes)
{
- MessageDialog aQuery(pParent, SVX_RES(nRes), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if (aQuery.Execute() == RET_YES)
+ ScopedVclPtrInstance< MessageDialog > aQuery(pParent, SVX_RES(nRes), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if (aQuery->Execute() == RET_YES)
return DLG_RET_OK;
else
return DLG_RET_CANCEL;
@@ -858,7 +884,7 @@ RecoveryDialog::RecoveryDialog(vcl::Window* pParent, RecoveryCore* pCore)
Size aSize(LogicToPixel(Size(RECOV_CONTROLWIDTH, RECOV_FILELISTHEIGHT), MAP_APPFONT));
pFileListLBContainer->set_width_request(aSize.Width());
pFileListLBContainer->set_height_request(aSize.Height());
- m_pFileListLB = new RecovDocList(*pFileListLBContainer, DIALOG_MGR());
+ m_pFileListLB = VclPtr<RecovDocList>::Create(*pFileListLBContainer, DIALOG_MGR());
static long nTabs[] = { 2, 0, 40*RECOV_CONTROLWIDTH/100 };
m_pFileListLB->SetTabs( &nTabs[0] );
@@ -901,7 +927,18 @@ RecoveryDialog::RecoveryDialog(vcl::Window* pParent, RecoveryCore* pCore)
RecoveryDialog::~RecoveryDialog()
{
- delete m_pFileListLB;
+ disposeOnce();
+}
+
+void RecoveryDialog::dispose()
+{
+ m_pFileListLB.disposeAndClear();
+ m_pTitleFT.clear();
+ m_pDescrFT.clear();
+ m_pProgrParent.clear();
+ m_pNextBtn.clear();
+ m_pCancelBtn.clear();
+ Dialog::dispose();
}
short RecoveryDialog::execute()
@@ -951,7 +988,7 @@ short RecoveryDialog::execute()
// failed recovery documents. They must be saved to
// a user selected directrory.
short nRet = DLG_RET_UNKNOWN;
- boost::scoped_ptr<BrokenRecoveryDialog> pBrokenRecoveryDialog(new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted));
+ ScopedVclPtrInstance< BrokenRecoveryDialog > pBrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted);
OUString sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default dir
if (pBrokenRecoveryDialog->isExecutionNeeded())
{
@@ -1020,7 +1057,7 @@ short RecoveryDialog::execute()
// If no temp files exists or user decided to ignore it ...
// we have to remove all recovery/session data anyway!
short nRet = DLG_RET_UNKNOWN;
- boost::scoped_ptr<BrokenRecoveryDialog> pBrokenRecoveryDialog(new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted));
+ ScopedVclPtrInstance< BrokenRecoveryDialog > pBrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted);
OUString sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default save location
// dialog itself checks if there is a need to copy files for this mode.
@@ -1231,9 +1268,19 @@ BrokenRecoveryDialog::BrokenRecoveryDialog(vcl::Window* pParent ,
impl_refresh();
}
-
BrokenRecoveryDialog::~BrokenRecoveryDialog()
{
+ disposeOnce();
+}
+
+void BrokenRecoveryDialog::dispose()
+{
+ m_pFileListLB.clear();
+ m_pSaveDirED.clear();
+ m_pSaveDirBtn.clear();
+ m_pOkBtn.clear();
+ m_pCancelBtn.clear();
+ ModalDialog::dispose();
}
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 4b0b3920d59d..feb6a20466fc 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -128,8 +128,8 @@ class FontPrevWin_Impl
friend class SvxFontPrevWindow;
SvxFont aFont;
- Printer* pPrinter;
- bool bDelPrinter;
+ VclPtr<Printer> pPrinter;
+ bool bDelPrinter;
Reference < XBreakIterator > xBreak;
std::vector<sal_uIntPtr> aTextWidth;
@@ -183,7 +183,7 @@ public:
delete pColor;
delete pBackColor;
if( bDelPrinter )
- delete pPrinter;
+ pPrinter.disposeAndClear();
}
void CheckScript();
@@ -502,7 +502,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFontPrevWindow(vcl:
SvxFontPrevWindow::~SvxFontPrevWindow()
{
+ disposeOnce();
+}
+
+void SvxFontPrevWindow::dispose()
+{
delete pImpl;
+ vcl::Window::dispose();
}
diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx
index 27a067725c45..7e3f5d4bb831 100644
--- a/svx/source/dialog/fontwork.cxx
+++ b/svx/source/dialog/fontwork.cxx
@@ -163,8 +163,8 @@ SvxFontWorkChildWindow::SvxFontWorkChildWindow
SfxChildWindow( _pParent, nId )
{
- SvxFontWorkDialog* pDlg = new SvxFontWorkDialog(pBindings, this, _pParent);
- pWindow = pDlg;
+ VclPtrInstance<SvxFontWorkDialog> pDlg(pBindings, this, _pParent);
+ pWindow = pDlg.get();
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
@@ -288,8 +288,26 @@ SvxFontWorkDialog::SvxFontWorkDialog(SfxBindings *pBindinx,
SvxFontWorkDialog::~SvxFontWorkDialog()
{
+ disposeOnce();
+}
+
+void SvxFontWorkDialog::dispose()
+{
for (sal_uInt16 i = 0; i < CONTROLLER_COUNT; i++)
DELETEZ(pCtrlItems[i]);
+ m_pTbxStyle.clear();
+ m_pTbxAdjust.clear();
+ m_pFbDistance.clear();
+ m_pMtrFldDistance.clear();
+ m_pFbTextStart.clear();
+ m_pMtrFldTextStart.clear();
+ m_pTbxShadow.clear();
+ m_pFbShadowX.clear();
+ m_pMtrFldShadowX.clear();
+ m_pFbShadowY.clear();
+ m_pMtrFldShadowY.clear();
+ m_pShadowColorLB.clear();
+ SfxDockingWindow::dispose();
}
SfxChildAlignment SvxFontWorkDialog::CheckAlignment( SfxChildAlignment eActAlign,
diff --git a/svx/source/dialog/frmdirlbox.cxx b/svx/source/dialog/frmdirlbox.cxx
index de7ff69ddd1f..5c2465df0811 100644
--- a/svx/source/dialog/frmdirlbox.cxx
+++ b/svx/source/dialog/frmdirlbox.cxx
@@ -44,10 +44,6 @@ FrameDirectionListBox::FrameDirectionListBox( vcl::Window* pParent, WinBits nBit
{
}
-FrameDirectionListBox::~FrameDirectionListBox()
-{
-}
-
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFrameDirectionListBox(vcl::Window *pParent, VclBuilder::stringmap &)
{
FrameDirectionListBox* pListBox = new FrameDirectionListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK|WB_TABSTOP);
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index 911a09a1919a..5897a876200f 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -209,6 +209,7 @@ FrameBorderType FrameBorder::GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const
FrameSelectorImpl::FrameSelectorImpl( FrameSelector& rFrameSel ) :
Resource( SVX_RES( RID_SVXSTR_BORDER_CONTROL ) ),
mrFrameSel( rFrameSel ),
+ mpVirDev( VclPtr<VirtualDevice>::Create() ),
maILArrows( 16 ),
maLeft( FRAMEBORDER_LEFT ),
maRight( FRAMEBORDER_RIGHT ),
@@ -269,6 +270,7 @@ FrameSelectorImpl::FrameSelectorImpl( FrameSelector& rFrameSel ) :
}
FrameSelectorImpl::~FrameSelectorImpl()
+
{
if( mpAccess )
mpAccess->Invalidate();
@@ -345,7 +347,7 @@ void FrameSelectorImpl::InitGlobalGeometry()
/* The final size of the usable area. */
mnCtrlSize = 2 * nBetwBordersSize + nFixedSize;
- maVirDev.SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) );
+ mpVirDev->SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) );
/* Center the virtual device in the control. */
maVirDevPos = Point( (aCtrlSize.Width() - mnCtrlSize) / 2, (aCtrlSize.Height() - mnCtrlSize) / 2 );
@@ -517,14 +519,14 @@ FrameBorder& FrameSelectorImpl::GetBorderAccess( FrameBorderType eBorder )
void FrameSelectorImpl::DrawBackground()
{
// clear the area
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( maBackCol );
- maVirDev.DrawRect( Rectangle( Point( 0, 0 ), maVirDev.GetOutputSizePixel() ) );
+ mpVirDev->SetLineColor();
+ mpVirDev->SetFillColor( maBackCol );
+ mpVirDev->DrawRect( Rectangle( Point( 0, 0 ), mpVirDev->GetOutputSizePixel() ) );
// draw the inner gray (or whatever color) rectangle
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( maMarkCol );
- maVirDev.DrawRect( Rectangle(
+ mpVirDev->SetLineColor();
+ mpVirDev->SetFillColor( maMarkCol );
+ mpVirDev->DrawRect( Rectangle(
mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
// draw the white space for enabled frame borders
@@ -532,9 +534,9 @@ void FrameSelectorImpl::DrawBackground()
for( FrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
(*aIt)->MergeFocusToPolyPolygon( aPPoly );
aPPoly.Optimize( PolyOptimizeFlags::CLOSE );
- maVirDev.SetLineColor( maBackCol );
- maVirDev.SetFillColor( maBackCol );
- maVirDev.DrawPolyPolygon( aPPoly );
+ mpVirDev->SetLineColor( maBackCol );
+ mpVirDev->SetFillColor( maBackCol );
+ mpVirDev->DrawPolyPolygon( aPPoly );
}
void FrameSelectorImpl::DrawArrows( const FrameBorder& rBorder )
@@ -587,8 +589,8 @@ void FrameSelectorImpl::DrawArrows( const FrameBorder& rBorder )
// Arrow or marker? Do not draw arrows into disabled control.
sal_uInt16 nSelectAdd = (mrFrameSel.IsEnabled() && rBorder.IsSelected()) ? 0 : 8;
- maVirDev.DrawImage( aPos1, maILArrows.GetImage( nImgId1 + nSelectAdd ) );
- maVirDev.DrawImage( aPos2, maILArrows.GetImage( nImgId2 + nSelectAdd ) );
+ mpVirDev->DrawImage( aPos1, maILArrows.GetImage( nImgId1 + nSelectAdd ) );
+ mpVirDev->DrawImage( aPos2, maILArrows.GetImage( nImgId2 + nSelectAdd ) );
}
void FrameSelectorImpl::DrawAllArrows()
@@ -656,7 +658,7 @@ void FrameSelectorImpl::DrawAllFrameBorders()
maArray.SetCellStyleDiag( nCol, nRow, maTLBR.GetUIStyle(), maBLTR.GetUIStyle() );
// Let the helper array draw itself
- maArray.DrawArray( maVirDev );
+ maArray.DrawArray( *mpVirDev.get() );
}
void FrameSelectorImpl::DrawVirtualDevice()
@@ -671,7 +673,7 @@ void FrameSelectorImpl::CopyVirDevToControl()
{
if( mbFullRepaint )
DrawVirtualDevice();
- mrFrameSel.DrawBitmap( maVirDevPos, maVirDev.GetBitmap( Point( 0, 0 ), maVirDev.GetOutputSizePixel() ) );
+ mrFrameSel.DrawBitmap( maVirDevPos, mpVirDev->GetBitmap( Point( 0, 0 ), mpVirDev->GetOutputSizePixel() ) );
}
void FrameSelectorImpl::DrawAllTrackingRects()
@@ -685,7 +687,7 @@ void FrameSelectorImpl::DrawAllTrackingRects()
}
else
// no frame border selected -> draw tracking rectangle around entire control
- aPPoly.Insert( Polygon( Rectangle( maVirDevPos, maVirDev.GetOutputSizePixel() ) ) );
+ aPPoly.Insert( Polygon( Rectangle( maVirDevPos, mpVirDev->GetOutputSizePixel() ) ) );
aPPoly.Optimize( PolyOptimizeFlags::CLOSE );
for( sal_uInt16 nIdx = 0, nCount = aPPoly.Count(); nIdx < nCount; ++nIdx )
@@ -789,13 +791,14 @@ FrameSelector::FrameSelector(vcl::Window* pParent)
EnableRTL( false ); // #107808# don't mirror the mouse handling
}
-extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFrameSelector(vcl::Window *pParent, VclBuilder::stringmap &)
+FrameSelector::~FrameSelector()
{
- return new FrameSelector(pParent);
+ disposeOnce();
}
-FrameSelector::~FrameSelector()
+extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFrameSelector(vcl::Window *pParent, VclBuilder::stringmap &)
{
+ return new FrameSelector(pParent);
}
void FrameSelector::Initialize( FrameSelFlags nFlags )
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 2cbee8804493..236f046a8c69 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -84,6 +84,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeGraphCtrl(vcl::Window
GraphCtrl::~GraphCtrl()
{
+ disposeOnce();
+}
+
+void GraphCtrl::dispose()
+{
if( mpAccContext )
{
mpAccContext->disposing();
@@ -92,6 +97,7 @@ GraphCtrl::~GraphCtrl()
delete pView;
delete pModel;
delete pUserCall;
+ Control::dispose();
}
void GraphCtrl::SetWinStyle( WinBits nWinBits )
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 54974addc7f2..9802a4427311 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -115,16 +115,16 @@ namespace svx {
}
}
-SfxTabPage* SvxHeaderPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxHeaderPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxHeaderPage( pParent, *rSet );
+ return VclPtr<SvxHeaderPage>::Create( pParent, *rSet );
}
-SfxTabPage* SvxFooterPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> SvxFooterPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
{
- return new SvxFooterPage( pParent, *rSet );
+ return VclPtr<SvxFooterPage>::Create( pParent, *rSet );
}
@@ -203,7 +203,29 @@ SvxHFPage::SvxHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 n
SvxHFPage::~SvxHFPage()
{
+ disposeOnce();
+}
+
+void SvxHFPage::dispose()
+{
delete pBBSet;
+ m_pPageLbl.clear();
+ m_pTurnOnBox.clear();
+ m_pCntSharedBox.clear();
+ m_pCntSharedFirstBox.clear();
+ m_pLMLbl.clear();
+ m_pLMEdit.clear();
+ m_pRMLbl.clear();
+ m_pRMEdit.clear();
+ m_pDistFT.clear();
+ m_pDistEdit.clear();
+ m_pDynSpacingCB.clear();
+ m_pHeightFT.clear();
+ m_pHeightEdit.clear();
+ m_pHeightDynBtn.clear();
+ m_pBspWin.clear();
+ m_pBackgroundBtn.clear();
+ SfxTabPage::dispose();
}
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 76470da30158..1d606ce45a72 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -95,8 +95,8 @@ SvxIMapDlgChildWindow::SvxIMapDlgChildWindow( vcl::Window* _pParent, sal_uInt16
SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId )
{
- pWindow = new SvxIMapDlg( pBindings, this, _pParent );
- SvxIMapDlg* pDlg = static_cast<SvxIMapDlg*>(pWindow);
+ pWindow = VclPtr<SvxIMapDlg>::Create( pBindings, this, _pParent );
+ SvxIMapDlg* pDlg = static_cast<SvxIMapDlg*>(pWindow.get());
if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN )
pDlg->RollUp();
@@ -168,7 +168,7 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window
get(m_pStbStatus, "statusbar");
VclVBox* _pContainer = get<VclVBox>("container");
- pIMapWnd = new IMapWindow( _pContainer, WB_BORDER, _pBindings->GetActiveFrame() );
+ pIMapWnd = VclPtr<IMapWindow>::Create( _pContainer, WB_BORDER, _pBindings->GetActiveFrame() );
pIMapWnd->set_hexpand(true);
pIMapWnd->set_vexpand(true);
pIMapWnd->Show();
@@ -217,9 +217,23 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window
SvxIMapDlg::~SvxIMapDlg()
{
+ disposeOnce();
+}
+
+void SvxIMapDlg::dispose()
+{
// Delete URL-List
- delete pIMapWnd;
+ pIMapWnd.disposeAndClear();
delete pOwnData;
+ m_pTbxIMapDlg1.clear();
+ m_pFtURL.clear();
+ m_pURLBox.clear();
+ m_pFtText.clear();
+ m_pEdtText.clear();
+ m_pFtTarget.clear();
+ m_pCbbTarget.clear();
+ m_pStbStatus.clear();
+ SfxModelessDialog::dispose();
}
bool SvxIMapDlg::Close()
@@ -228,8 +242,8 @@ bool SvxIMapDlg::Close()
if ( m_pTbxIMapDlg1->IsItemEnabled( mnApplyId ) )
{
- MessageDialog aQBox( this,"QueryModifyImageMapChangesDialog","svx/ui/querymodifyimagemapchangesdialog.ui");
- const long nRet = aQBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aQBox(this,"QueryModifyImageMapChangesDialog","svx/ui/querymodifyimagemapchangesdialog.ui");
+ const long nRet = aQBox->Execute();
if( nRet == RET_YES )
{
@@ -242,8 +256,8 @@ bool SvxIMapDlg::Close()
}
else if( pIMapWnd->IsChanged() )
{
- MessageDialog aQBox( this,"QuerySaveImageMapChangesDialog","svx/ui/querysaveimagemapchangesdialog.ui");
- const long nRet = aQBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aQBox(this,"QuerySaveImageMapChangesDialog","svx/ui/querysaveimagemapchangesdialog.ui");
+ const long nRet = aQBox->Execute();
if( nRet == RET_YES )
bRet = DoSave();
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 941519e30853..1b7fed9b042f 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -72,8 +72,14 @@ IMapWindow::IMapWindow( vcl::Window* pParent, WinBits nBits, const Reference< XF
IMapWindow::~IMapWindow()
{
+ disposeOnce();
+}
+
+void IMapWindow::dispose()
+{
SfxItemPool::Free(pIMapPool);
delete[] pItemInfo;
+ GraphCtrl::dispose();
}
Size IMapWindow::GetOptimalSize() const
diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx
index 26b266de8998..4209190be843 100644
--- a/svx/source/dialog/imapwnd.hxx
+++ b/svx/source/dialog/imapwnd.hxx
@@ -134,6 +134,7 @@ public:
IMapWindow( vcl::Window* pParent, WinBits nBits, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame );
virtual ~IMapWindow();
+ virtual void dispose() SAL_OVERRIDE;
bool ReplaceActualIMapInfo( const NotifyInfo& rNewInfo );
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index 950a11af2a71..f9527185afd8 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -499,11 +499,6 @@ SvxLanguageBox::SvxLanguageBox( vcl::Window* pParent, WinBits nBits, bool bCheck
ImplLanguageBoxBaseInit();
}
-SvxLanguageBox::~SvxLanguageBox()
-{
-}
-
-
SvxLanguageComboBox::SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits, bool bCheck )
: ComboBox( pParent, nBits )
, SvxLanguageBoxBase( bCheck )
@@ -520,11 +515,6 @@ SvxLanguageComboBox::SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits, b
SetModifyHdl( LINK( this, SvxLanguageComboBox, EditModifyHdl ) );
}
-SvxLanguageComboBox::~SvxLanguageComboBox()
-{
-}
-
-
sal_Int32 SvxLanguageBox::ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked )
{
return InsertEntry( rEntry, (bChecked ? m_aCheckedImage : m_aNotCheckedImage), nPos );
diff --git a/svx/source/dialog/linkwarn.cxx b/svx/source/dialog/linkwarn.cxx
index 9015d1ae119c..26879f23f7fe 100644
--- a/svx/source/dialog/linkwarn.cxx
+++ b/svx/source/dialog/linkwarn.cxx
@@ -43,11 +43,18 @@ SvxLinkWarningDialog::SvxLinkWarningDialog( vcl::Window* pParent, const OUString
SvxLinkWarningDialog::~SvxLinkWarningDialog()
{
+ disposeOnce();
+}
+
+void SvxLinkWarningDialog::dispose()
+{
// save value of "warning off" checkbox, if necessary
SvtMiscOptions aMiscOpt;
bool bChecked = m_pWarningOnBox->IsChecked();
if ( aMiscOpt.ShowLinkWarningDialog() != bChecked )
aMiscOpt.SetShowLinkWarningDialog( bChecked );
+ m_pWarningOnBox.clear();
+ MessageDialog::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx
index 109955906a00..e2ed6e0a1016 100644
--- a/svx/source/dialog/measctrl.cxx
+++ b/svx/source/dialog/measctrl.cxx
@@ -78,6 +78,11 @@ Size SvxXMeasurePreview::GetOptimalSize() const
SvxXMeasurePreview::~SvxXMeasurePreview()
{
+ disposeOnce();
+}
+
+void SvxXMeasurePreview::dispose()
+{
// No one is deleting the MeasureObj? This is not only an error but also
// a memory leak (!). Main problem is that this object is still listening to
// a StyleSheet of the model which was set. Thus, if You want to keep the obnject,
@@ -86,6 +91,7 @@ SvxXMeasurePreview::~SvxXMeasurePreview()
delete pMeasureObj;
delete pModel;
+ Control::dispose();
}
void SvxXMeasurePreview::Paint( const Rectangle& )
diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx
index 8455400d2a0c..c82ac45ded8e 100644
--- a/svx/source/dialog/optgrid.cxx
+++ b/svx/source/dialog/optgrid.cxx
@@ -171,11 +171,38 @@ SvxGridTabPage::SvxGridTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet
LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) );
}
+SvxGridTabPage::~SvxGridTabPage()
+{
+ disposeOnce();
+}
+
+void SvxGridTabPage::dispose()
+{
+ pCbxUseGridsnap.clear();
+ pCbxGridVisible.clear();
+ pMtrFldDrawX.clear();
+ pMtrFldDrawY.clear();
+ pNumFldDivisionX.clear();
+ pNumFldDivisionY.clear();
+ pCbxSynchronize.clear();
+ pSnapFrames.clear();
+ pCbxSnapHelplines.clear();
+ pCbxSnapBorder.clear();
+ pCbxSnapFrame.clear();
+ pCbxSnapPoints.clear();
+ pMtrFldSnapArea.clear();
+ pCbxOrtho.clear();
+ pCbxBigOrtho.clear();
+ pCbxRotate.clear();
+ pMtrFldAngle.clear();
+ pMtrFldBezAngle.clear();
+ SfxTabPage::dispose();
+}
-SfxTabPage* SvxGridTabPage::Create( vcl::Window* pParent, const SfxItemSet& rAttrSet )
+VclPtr<SfxTabPage> SvxGridTabPage::Create( vcl::Window* pParent, const SfxItemSet& rAttrSet )
{
- return new SvxGridTabPage( pParent, rAttrSet );
+ return VclPtr<SvxGridTabPage>::Create( pParent, rAttrSet );
}
diff --git a/svx/source/dialog/orienthelper.cxx b/svx/source/dialog/orienthelper.cxx
index b1b61e9ed1a0..89ecc71dfed8 100644
--- a/svx/source/dialog/orienthelper.cxx
+++ b/svx/source/dialog/orienthelper.cxx
@@ -31,7 +31,7 @@ namespace svx {
struct OrientationHelper_Impl
{
- typedef std::pair< vcl::Window*, TriState > WindowPair;
+ typedef std::pair< VclPtr<vcl::Window>, TriState > WindowPair;
typedef std::vector< WindowPair > WindowVec;
DialControl& mrCtrlDial;
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index 08a7e9cbf740..d1e4c5c04232 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -90,8 +90,14 @@ SvxPageWindow::SvxPageWindow(vcl::Window* pParent)
SvxPageWindow::~SvxPageWindow()
{
+ disposeOnce();
+}
+
+void SvxPageWindow::dispose()
+{
delete pHdBorder;
delete pFtBorder;
+ vcl::Window::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPageWindow(vcl::Window *pParent, VclBuilder::stringmap &)
diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx
index c794ebb309b5..25b01d703dfa 100644
--- a/svx/source/dialog/passwd.cxx
+++ b/svx/source/dialog/passwd.cxx
@@ -97,13 +97,21 @@ SvxPasswordDialog::SvxPasswordDialog(vcl::Window* pParent, bool bAllowEmptyPassw
}
}
-
-
SvxPasswordDialog::~SvxPasswordDialog()
{
+ disposeOnce();
}
-
+void SvxPasswordDialog::dispose()
+{
+ m_pOldFL.clear();
+ m_pOldPasswdFT.clear();
+ m_pOldPasswdED.clear();
+ m_pNewPasswdED.clear();
+ m_pRepeatPasswdED.clear();
+ m_pOKBtn.clear();
+ SfxModalDialog::dispose();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/prtqry.cxx b/svx/source/dialog/prtqry.cxx
index d14872f65be4..9a6d750f9774 100644
--- a/svx/source/dialog/prtqry.cxx
+++ b/svx/source/dialog/prtqry.cxx
@@ -37,9 +37,4 @@ SvxPrtQryBox::SvxPrtQryBox(vcl::Window* pParent) :
SetButtonHelpText( RET_OK, OUString() );
}
-SvxPrtQryBox::~SvxPrtQryBox()
-{
-}
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
index e85409be5e4a..29d0ae7c9e39 100644
--- a/svx/source/dialog/rubydialog.cxx
+++ b/svx/source/dialog/rubydialog.cxx
@@ -64,7 +64,7 @@ SvxRubyChildWindow::SvxRubyChildWindow( vcl::Window* _pParent, sal_uInt16 nId,
SfxBindings* pBindings, SfxChildWinInfo* pInfo) :
SfxChildWindow(_pParent, nId)
{
- SvxRubyDialog* pDlg = new SvxRubyDialog(pBindings, this, _pParent);
+ VclPtr<SvxRubyDialog> pDlg = VclPtr<SvxRubyDialog>::Create(pBindings, this, _pParent);
pWindow = pDlg;
if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN )
@@ -263,9 +263,37 @@ SvxRubyDialog::SvxRubyDialog(SfxBindings *pBind, SfxChildWindow *pCW,
SvxRubyDialog::~SvxRubyDialog()
{
+ disposeOnce();
+}
+
+void SvxRubyDialog::dispose()
+{
ClearCharStyleList();
EventObject aEvent;
xImpl->disposing(aEvent);
+ m_pLeftFT.clear();
+ m_pRightFT.clear();
+ m_pLeft1ED.clear();
+ m_pRight1ED.clear();
+ m_pLeft2ED.clear();
+ m_pRight2ED.clear();
+ m_pLeft3ED.clear();
+ m_pRight3ED.clear();
+ m_pLeft4ED.clear();
+ m_pRight4ED.clear();
+ for (int i=0; i<7; i++)
+ aEditArr[i].clear();
+ m_pScrolledWindow.clear();
+ m_pScrollSB.clear();
+ m_pAdjustLB.clear();
+ m_pPositionLB.clear();
+ m_pCharStyleFT.clear();
+ m_pCharStyleLB.clear();
+ m_pStylistPB.clear();
+ m_pPreviewWin.clear();
+ m_pApplyPB.clear();
+ m_pClosePB.clear();
+ SfxModelessDialog::dispose();
}
void SvxRubyDialog::ClearCharStyleList()
@@ -760,6 +788,17 @@ RubyPreview::RubyPreview(vcl::Window *pParent)
SetBorderStyle( WindowBorderStyle::MONO );
}
+RubyPreview::~RubyPreview()
+{
+ disposeOnce();
+}
+
+void RubyPreview::dispose()
+{
+ m_pParentDlg.clear();
+ vcl::Window::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRubyPreview(vcl::Window *pParent, VclBuilder::stringmap &)
{
return new RubyPreview(pParent);
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 4e945af0d366..7f022235614a 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -345,6 +345,11 @@ SvxSearchDialog::SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWi
SvxSearchDialog::~SvxSearchDialog()
{
+ disposeOnce();
+}
+
+void SvxSearchDialog::dispose()
+{
Hide();
rBindings.EnterRegistrations();
@@ -359,6 +364,49 @@ SvxSearchDialog::~SvxSearchDialog()
delete pImpl;
delete pSearchList;
delete pReplaceList;
+ mpDocWin.clear();
+ m_pSearchFrame.clear();
+ m_pSearchLB.clear();
+ m_pSearchTmplLB.clear();
+ m_pSearchAttrText.clear();
+ m_pSearchLabel.clear();
+ m_pReplaceFrame.clear();
+ m_pReplaceLB.clear();
+ m_pReplaceTmplLB.clear();
+ m_pReplaceAttrText.clear();
+ m_pSearchBtn.clear();
+ m_pSearchAllBtn.clear();
+ m_pReplaceBtn.clear();
+ m_pReplaceAllBtn.clear();
+ m_pComponentFrame.clear();
+ m_pSearchComponent1PB.clear();
+ m_pSearchComponent2PB.clear();
+ m_pMatchCaseCB.clear();
+ m_pWordBtn.clear();
+ m_pCloseBtn.clear();
+ m_pIgnoreDiacritics.clear();
+ m_pIgnoreKashida.clear();
+ m_pSelectionBtn.clear();
+ m_pBackwardsBtn.clear();
+ m_pRegExpBtn.clear();
+ m_pSimilarityBox.clear();
+ m_pSimilarityBtn.clear();
+ m_pLayoutBtn.clear();
+ m_pNotesBtn.clear();
+ m_pJapMatchFullHalfWidthCB.clear();
+ m_pJapOptionsCB.clear();
+ m_pJapOptionsBtn.clear();
+ m_pAttributeBtn.clear();
+ m_pFormatBtn.clear();
+ m_pNoFormatBtn.clear();
+ m_pCalcGrid.clear();
+ m_pCalcSearchInFT.clear();
+ m_pCalcSearchInLB.clear();
+ m_pCalcSearchDirFT.clear();
+ m_pRowsBtn.clear();
+ m_pColumnsBtn.clear();
+ m_pAllSheetsCB.clear();
+ SfxModelessDialog::dispose();
}
void SvxSearchDialog::Construct_Impl()
@@ -2222,7 +2270,7 @@ SvxSearchDialogWrapper::SvxSearchDialogWrapper( vcl::Window* _pParent, sal_uInt1
: SfxChildWindow( _pParent, nId )
, dialog (new SvxSearchDialog (_pParent, this, *pBindings))
{
- pWindow = dialog;
+ pWindow = dialog.get();
dialog->Initialize( pInfo );
pBindings->Update( SID_SEARCH_ITEM );
@@ -2260,7 +2308,7 @@ static vcl::Window* lcl_GetSearchLabelWindow()
return 0;
css::uno::Reference< css::awt::XWindow > xWindow(
xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW);
- ToolBox* pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) );
+ VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow).get() );
for (size_t i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i)
if (pToolBox->GetItemCommand(i) == ".uno:SearchLabel")
return pToolBox->GetItemWindow(i);
diff --git a/svx/source/dialog/stddlg.cxx b/svx/source/dialog/stddlg.cxx
index d06e5245f306..9ae4ca27098f 100644
--- a/svx/source/dialog/stddlg.cxx
+++ b/svx/source/dialog/stddlg.cxx
@@ -35,8 +35,4 @@ SvxStandardDialog::SvxStandardDialog(vcl::Window *pParent, const OUString& rID,
{
}
-SvxStandardDialog::~SvxStandardDialog()
-{
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index 3b6ad3f66f21..65d12c962e88 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -179,7 +179,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
{
// The lines are only one time in the virtual device, only the outline
// page is currently done
- pVDev = new VirtualDevice(*pDev);
+ pVDev = VclPtr<VirtualDevice>::Create(*pDev);
pVDev->SetMapMode(pDev->GetMapMode());
pVDev->EnableRTL( IsRTLEnabled() );
pVDev->SetOutputSize( aRectSize );
@@ -423,7 +423,13 @@ void SvxNumValueSet::init(sal_uInt16 nType)
SvxNumValueSet::~SvxNumValueSet()
{
- delete pVDev;
+ disposeOnce();
+}
+
+void SvxNumValueSet::dispose()
+{
+ pVDev.disposeAndClear();
+ ValueSet::dispose();
}
void SvxNumValueSet::SetNumberingSettings(
@@ -487,8 +493,14 @@ void SvxBmpNumValueSet::init()
SvxBmpNumValueSet::~SvxBmpNumValueSet()
{
+ disposeOnce();
+}
+
+void SvxBmpNumValueSet::dispose()
+{
GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
aFormatIdle.Stop();
+ SvxNumValueSet::dispose();
}
void SvxBmpNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 9c8146dd2ba8..7eed4e891f07 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -341,6 +341,11 @@ SvxRuler::SvxRuler(
SvxRuler::~SvxRuler()
{
+ disposeOnce();
+}
+
+void SvxRuler::dispose()
+{
/* Destructor ruler; release internal buffer */
REMOVE_DEBUG_WINDOW
if(bListening)
@@ -348,11 +353,18 @@ SvxRuler::~SvxRuler()
pBindings->EnterRegistrations();
- for(sal_uInt16 i = 0; i < CTRL_ITEM_COUNT && pCtrlItem[i]; ++i)
- delete pCtrlItem[i];
- delete[] pCtrlItem;
+ if (pCtrlItem)
+ {
+ for(sal_uInt16 i = 0; i < CTRL_ITEM_COUNT && pCtrlItem[i]; ++i)
+ delete pCtrlItem[i];
+ delete[] pCtrlItem;
+ pCtrlItem = NULL;
+ }
pBindings->LeaveRegistrations();
+
+ pEditWin.clear();
+ Ruler::dispose();
}
long SvxRuler::MakePositionSticky(long aPosition, long aPointOfReference, bool aSnapToFrameMargin) const
@@ -3455,23 +3467,23 @@ void SvxRuler::Command( const CommandEvent& rCommandEvent )
{
PopupMenu aMenu;
aMenu.SetSelectHdl(LINK(this, SvxRuler, TabMenuSelect));
- VirtualDevice aDev;
+ ScopedVclPtrInstance< VirtualDevice > pDev;
const Size aSz(ruler_tab_svx.width + 2, ruler_tab_svx.height + 2);
- aDev.SetOutputSize(aSz);
- aDev.SetBackground(Wallpaper(Color(COL_WHITE)));
- Color aFillColor(aDev.GetSettings().GetStyleSettings().GetShadowColor());
+ pDev->SetOutputSize(aSz);
+ pDev->SetBackground(Wallpaper(Color(COL_WHITE)));
+ Color aFillColor(pDev->GetSettings().GetStyleSettings().GetShadowColor());
const Point aPt(aSz.Width() / 2, aSz.Height() / 2);
for ( sal_uInt16 i = RULER_TAB_LEFT; i < RULER_TAB_DEFAULT; ++i )
{
sal_uInt16 nStyle = bRTL ? i|RULER_TAB_RTL : i;
nStyle |= static_cast<sal_uInt16>(bHorz ? WB_HORZ : WB_VERT);
- DrawTab(&aDev, aFillColor, aPt, nStyle);
+ DrawTab(pDev, aFillColor, aPt, nStyle);
aMenu.InsertItem(i + 1,
ResId(RID_SVXSTR_RULER_START + i, DIALOG_MGR()).toString(),
- Image(aDev.GetBitmap(Point(), aSz), Color(COL_WHITE)));
+ Image(pDev->GetBitmap(Point(), aSz), Color(COL_WHITE)));
aMenu.CheckItem(i + 1, i == mpTabs[mxRulerImpl->nIdx + TAB_GAP].nStyle);
- aDev.SetOutputSize(aSz); // delete device
+ pDev->SetOutputSize(aSz); // delete device
}
aMenu.Execute( this, rCommandEvent.GetMousePosPixel() );
}
diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx
index 35ab86b85636..964899b8c45a 100644
--- a/svx/source/dialog/swframeexample.cxx
+++ b/svx/source/dialog/swframeexample.cxx
@@ -62,10 +62,6 @@ Size SvxSwFrameExample::GetOptimalSize() const
return LogicToPixel(Size(52, 86), MapMode(MAP_APPFONT));
}
-SvxSwFrameExample::~SvxSwFrameExample()
-{
-}
-
void SvxSwFrameExample::InitColors_Impl()
{
const StyleSettings& rSettings = GetSettings().GetStyleSettings();
diff --git a/svx/source/dialog/txencbox.cxx b/svx/source/dialog/txencbox.cxx
index f9cf52f232be..bc16ac104620 100644
--- a/svx/source/dialog/txencbox.cxx
+++ b/svx/source/dialog/txencbox.cxx
@@ -59,7 +59,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxTextEncodingBox(vcl
SvxTextEncodingBox::~SvxTextEncodingBox()
{
+ disposeOnce();
+}
+
+void SvxTextEncodingBox::dispose()
+{
delete m_pEncTable;
+ ListBox::dispose();
}
diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx
index 6a9bd08ab0d8..0b84e42d68f6 100644
--- a/svx/source/engine3d/float3d.cxx
+++ b/svx/source/engine3d/float3d.cxx
@@ -325,8 +325,13 @@ Svx3DWin::Svx3DWin(SfxBindings* pInBindings, SfxChildWindow *pCW, vcl::Window* p
Svx3DWin::~Svx3DWin()
{
+ disposeOnce();
+}
+
+void Svx3DWin::dispose()
+{
delete p3DView;
- delete pVDev;
+ pVDev.disposeAndClear();
delete pModel;
delete pControllerItem;
@@ -336,6 +341,16 @@ Svx3DWin::~Svx3DWin()
delete mpRemember2DAttributes;
delete mpImpl;
+
+ m_pBtnGeo.clear();
+ m_pBtnRepresentation.clear();
+ m_pBtnLight.clear();
+ m_pBtnTexture.clear();
+ m_pBtnMaterial.clear();
+ m_pBtnUpdate.clear();
+ m_pBtnAssign.clear();
+
+ SfxDockingWindow::dispose();
}
@@ -2270,7 +2285,7 @@ IMPL_LINK( Svx3DWin, ClickViewTypeHdl, void *, pBtn )
m_pBtnLight->Check( eViewType == VIEWTYPE_LIGHT );
m_pBtnTexture->Check( eViewType == VIEWTYPE_TEXTURE );
m_pBtnMaterial->Check( eViewType == VIEWTYPE_MATERIAL );
- }
+ }
return 0L;
}
@@ -2901,7 +2916,7 @@ Svx3DChildWindow::Svx3DChildWindow( vcl::Window* _pParent,
SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId )
{
- Svx3DWin* pWin = new Svx3DWin( pBindings, this, _pParent );
+ VclPtr<Svx3DWin> pWin = VclPtr<Svx3DWin>::Create( pBindings, this, _pParent );
pWindow = pWin;
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index cb489b02451d..0d90129f74d8 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -135,7 +135,14 @@ FmGridHeader::FmGridHeader( BrowseBox* pParent, WinBits nWinBits)
FmGridHeader::~FmGridHeader()
{
+ disposeOnce();
+}
+
+void FmGridHeader::dispose()
+{
delete m_pImpl;
+ m_pImpl = NULL;
+ svt::EditBrowserHeader::dispose();
}
sal_uInt16 FmGridHeader::GetModelColumnPos(sal_uInt16 nId) const
@@ -1412,10 +1419,10 @@ void FmGridControl::inserted(const ::com::sun::star::lang::EventObject& /*rEvent
}
-BrowserHeader* FmGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
+VclPtr<BrowserHeader> FmGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
{
DBG_ASSERT( pParent == this, "FmGridControl::imp_CreateHeaderBar: parent?" );
- return new FmGridHeader( pParent );
+ return VclPtr<FmGridHeader>::Create( pParent );
}
void FmGridControl::markColumn(sal_uInt16 nId)
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 8bb336fa22cf..341b4f652012 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1056,9 +1056,9 @@ FmXGridPeer::FmXGridPeer(const Reference< XComponentContext >& _rxContext)
}
-FmGridControl* FmXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
+VclPtr<FmGridControl> FmXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
{
- return new FmGridControl(m_xContext, pParent, this, nStyle);
+ return VclPtr<FmGridControl>::Create(m_xContext, pParent, this, nStyle);
}
@@ -1228,7 +1228,7 @@ Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType
Reference< XIndexContainer > xColumns = getColumns();
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
sal_Int32 nColumns = pGrid->GetViewColCount();
DbGridColumns aColumns = pGrid->GetColumns();
@@ -1282,7 +1282,7 @@ Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType
Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type& xType ) throw(RuntimeException, std::exception)
{
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
DBG_ASSERT(pGrid && pGrid->IsOpen(), "FmXGridPeer::queryFieldData : have no valid grid window !");
if (!pGrid || !pGrid->IsOpen())
return Sequence< Any>();
@@ -1375,7 +1375,7 @@ void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt) throw( RuntimeE
// this should not be (deadlock) critical, as by definition, every component should release
// any own mutexes before notifying
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (!pGrid)
return;
@@ -1495,7 +1495,7 @@ void FmXGridPeer::removeUpdateListener(const Reference< XUpdateListener >& l) th
sal_Bool FmXGridPeer::commit() throw( RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (!m_xCursor.is() || !pGrid)
return sal_True;
@@ -1518,7 +1518,7 @@ sal_Bool FmXGridPeer::commit() throw( RuntimeException, std::exception )
void FmXGridPeer::cursorMoved(const EventObject& _rEvent) throw( RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
// we are not interested in move to insert row only in the resetted event
// which is fired after positioning an the insert row
if (pGrid && pGrid->IsOpen() && !::comphelper::getBOOL(Reference< XPropertySet > (_rEvent.Source, UNO_QUERY)->getPropertyValue(FM_PROP_ISNEW)))
@@ -1528,7 +1528,7 @@ void FmXGridPeer::cursorMoved(const EventObject& _rEvent) throw( RuntimeExceptio
void FmXGridPeer::rowChanged(const EventObject& _rEvent) throw( RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (pGrid && pGrid->IsOpen())
{
if (m_xCursor->rowUpdated() && !pGrid->IsCurrentAppending())
@@ -1631,7 +1631,7 @@ void FmXGridPeer::setColumns(const Reference< XIndexContainer >& Columns) throw(
{
SolarMutexGuard aGuard;
- FmGridControl* pGrid = static_cast< FmGridControl* >( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (m_xColumns.is())
{
@@ -1714,7 +1714,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) throw( RuntimeExcep
{
SolarMutexGuard aGuard;
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
// Handle Column beruecksichtigen
if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount()))
return;
@@ -1747,7 +1747,7 @@ void FmXGridPeer::elementReplaced(const ContainerEvent& evt) throw( RuntimeExcep
{
SolarMutexGuard aGuard;
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
// Handle Column beruecksichtigen
if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove())
@@ -1802,7 +1802,7 @@ void FmXGridPeer::elementRemoved(const ContainerEvent& evt) throw( RuntimeExcept
{
SolarMutexGuard aGuard;
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
// Handle Column beruecksichtigen
if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount()))
@@ -1819,7 +1819,7 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value) t
{
SolarMutexGuard aGuard;
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
bool bVoid = !Value.hasValue();
@@ -2033,7 +2033,7 @@ Any FmXGridPeer::getProperty( const OUString& _rPropertyName ) throw( RuntimeExc
Any aProp;
if (GetWindow())
{
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
vcl::Window* pDataWindow = &pGrid->GetDataWindow();
if ( _rPropertyName == FM_PROP_NAME )
@@ -2169,7 +2169,7 @@ void FmXGridPeer::stopCursorListening()
void FmXGridPeer::updateGrid(const Reference< XRowSet >& _rxCursor)
{
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (pGrid)
pGrid->setDataSource(_rxCursor);
}
@@ -2183,7 +2183,7 @@ Reference< XRowSet > FmXGridPeer::getRowSet() throw( RuntimeException, std::exc
void FmXGridPeer::setRowSet(const Reference< XRowSet >& _rDatabaseCursor) throw( RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (!pGrid || !m_xColumns.is() || !m_xColumns->getCount())
return;
// unregister all listeners
@@ -2232,14 +2232,14 @@ void SAL_CALL FmXGridPeer::removeGridControlListener( const Reference< XGridCont
sal_Int16 FmXGridPeer::getCurrentColumnPosition() throw( RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
return pGrid ? pGrid->GetViewColumnPos(pGrid->GetCurColumnId()) : -1;
}
void FmXGridPeer::setCurrentColumnPosition(sal_Int16 nPos) throw( RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (pGrid)
pGrid->GoToColumnId(pGrid->GetColumnIdFromViewPos(nPos));
}
@@ -2249,7 +2249,7 @@ void FmXGridPeer::selectionChanged(const EventObject& evt) throw( RuntimeExcepti
{
SolarMutexGuard aGuard;
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (pGrid)
{
Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(evt.Source, UNO_QUERY);
@@ -2317,7 +2317,7 @@ Reference< XEnumeration > FmXGridPeer::createEnumeration() throw( RuntimeExcept
sal_Int32 FmXGridPeer::getCount() throw( RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (pGrid)
return pGrid->GetViewColCount();
else
@@ -2327,7 +2327,7 @@ sal_Int32 FmXGridPeer::getCount() throw( RuntimeException, std::exception )
Any FmXGridPeer::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (_nIndex < 0 ||
_nIndex >= getCount() || !pGrid)
throw IndexOutOfBoundsException();
@@ -2360,7 +2360,7 @@ void FmXGridPeer::setMode(const OUString& Mode) throw( NoSupportException, Runti
m_aMode = Mode;
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if ( Mode == "FilterMode" )
pGrid->SetFilterMode(true);
else
@@ -2406,7 +2406,7 @@ sal_Bool FmXGridPeer::supportsMode(const OUString& Mode) throw( RuntimeException
void FmXGridPeer::columnVisible(DbGridColumn* pColumn)
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
sal_Int32 _nIndex = pGrid->GetModelColumnPos(pColumn->GetId());
Reference< ::com::sun::star::awt::XControl > xControl(pColumn->GetCell());
@@ -2421,7 +2421,7 @@ void FmXGridPeer::columnVisible(DbGridColumn* pColumn)
void FmXGridPeer::columnHidden(DbGridColumn* pColumn)
{
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
sal_Int32 _nIndex = pGrid->GetModelColumnPos(pColumn->GetId());
Reference< ::com::sun::star::awt::XControl > xControl(pColumn->GetCell());
@@ -2436,7 +2436,7 @@ void FmXGridPeer::columnHidden(DbGridColumn* pColumn)
void FmXGridPeer::draw( sal_Int32 x, sal_Int32 y ) throw( RuntimeException, std::exception )
{
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
EditBrowseBoxFlags nOldFlags = pGrid->GetBrowserFlags();
pGrid->SetBrowserFlags(nOldFlags | EditBrowseBoxFlags::NO_HANDLE_COLUMN_CONTENT);
@@ -2576,7 +2576,7 @@ void FmXGridPeer::statusChanged(const ::com::sun::star::frame::FeatureStateEvent
{
DBG_ASSERT(m_pDispatchers[i] == Event.Source, "FmXGridPeer::statusChanged : the event source is a little bit suspect !");
m_pStateCache[i] = Event.IsEnabled;
- FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() );
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (*pSlots != SID_FM_RECORD_UNDO)
pGrid->GetNavigationBar().InvalidateState(*pSlots);
break;
@@ -2598,8 +2598,7 @@ sal_Bool SAL_CALL FmXGridPeer::select( const Any& _rSelection ) throw (IllegalAr
if ( !( _rSelection >>= aBookmarks ) )
throw IllegalArgumentException();
- FmGridControl* pVclControl = static_cast<FmGridControl*>(GetWindow());
- return pVclControl->selectBookmarks(aBookmarks);
+ return GetAs< FmGridControl >()->selectBookmarks(aBookmarks);
// TODO:
// speaking strictly, we would have to adjust our model, as our ColumnSelection may have changed.
@@ -2612,7 +2611,7 @@ sal_Bool SAL_CALL FmXGridPeer::select( const Any& _rSelection ) throw (IllegalAr
Any SAL_CALL FmXGridPeer::getSelection( ) throw (RuntimeException, std::exception)
{
- FmGridControl* pVclControl = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pVclControl = GetAs< FmGridControl >();
Sequence< Any > aSelectionBookmarks = pVclControl->getSelectionBookmarks();
return makeAny(aSelectionBookmarks);
}
@@ -2634,7 +2633,7 @@ void FmXGridPeer::resetted(const EventObject& rEvent) throw( RuntimeException, s
{
if (m_xColumns == rEvent.Source)
{ // my model was reset -> refresh the grid content
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (!pGrid)
return;
SolarMutexGuard aGuard;
@@ -2644,7 +2643,7 @@ void FmXGridPeer::resetted(const EventObject& rEvent) throw( RuntimeException, s
else if (m_xCursor == rEvent.Source)
{
SolarMutexGuard aGuard;
- FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow());
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
if (pGrid && pGrid->IsOpen())
pGrid->positioned(rEvent);
}
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index ca3e34fc4ae0..07dca8d9beca 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -644,11 +644,10 @@ DbCellControl::~DbCellControl()
lcl_clearBroadCaster(m_pModelChangeBroadcaster);
lcl_clearBroadCaster(m_pFieldChangeBroadcaster);
- delete m_pWindow;
- delete m_pPainter;
+ m_pWindow.disposeAndClear();
+ m_pPainter.disposeAndClear();
}
-
void DbCellControl::implValuePropertyChanged( )
{
OSL_ENSURE( !isValuePropertyLocked(),
@@ -838,7 +837,7 @@ void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxMode
DBG_ASSERT( _rxModel.is(), "DbCellControl::implAdjustReadOnly: invalid model!" );
if ( m_pWindow && _rxModel.is() )
{
- Edit* pEditWindow = dynamic_cast< Edit* >( m_pWindow );
+ Edit* pEditWindow = dynamic_cast< Edit* >( m_pWindow.get() );
if ( pEditWindow )
{
bool bReadOnly = m_rColumn.IsReadOnly();
@@ -846,7 +845,7 @@ void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxMode
{
_rxModel->getPropertyValue( i_bReadOnly ? OUString(FM_PROP_READONLY) : OUString(FM_PROP_ISREADONLY)) >>= bReadOnly;
}
- static_cast< Edit* >( m_pWindow )->SetReadOnly( bReadOnly );
+ static_cast< Edit* >( m_pWindow.get() )->SetReadOnly( bReadOnly );
}
}
}
@@ -1125,19 +1124,19 @@ void DbTextField::Init( vcl::Window& rParent, const Reference< XRowSet >& xCurso
m_bIsSimpleEdit = !bIsMultiLine;
if ( bIsMultiLine )
{
- m_pWindow = new MultiLineTextCell( &rParent, nStyle );
- m_pEdit = new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pWindow ) );
+ m_pWindow = VclPtr<MultiLineTextCell>::Create( &rParent, nStyle );
+ m_pEdit = new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pWindow.get() ) );
- m_pPainter = new MultiLineTextCell( &rParent, nStyle );
- m_pPainterImplementation = new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pPainter ) );
+ m_pPainter = VclPtr<MultiLineTextCell>::Create( &rParent, nStyle );
+ m_pPainterImplementation = new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pPainter.get() ) );
}
else
{
- m_pWindow = new Edit( &rParent, nStyle );
- m_pEdit = new EditImplementation( *static_cast< Edit* >( m_pWindow ) );
+ m_pWindow = VclPtr<Edit>::Create( &rParent, nStyle );
+ m_pEdit = new EditImplementation( *static_cast< Edit* >( m_pWindow.get() ) );
- m_pPainter = new Edit( &rParent, nStyle );
- m_pPainterImplementation = new EditImplementation( *static_cast< Edit* >( m_pPainter ) );
+ m_pPainter = VclPtr<Edit>::Create( &rParent, nStyle );
+ m_pPainterImplementation = new EditImplementation( *static_cast< Edit* >( m_pPainter.get() ) );
}
if ( WB_LEFT == nStyle )
@@ -1258,17 +1257,17 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
switch (nAlignment)
{
case ::com::sun::star::awt::TextAlign::RIGHT:
- m_pWindow = new FormattedField( &rParent, WB_RIGHT );
- m_pPainter = new FormattedField( &rParent, WB_RIGHT );
+ m_pWindow = VclPtr<FormattedField>::Create( &rParent, WB_RIGHT );
+ m_pPainter = VclPtr<FormattedField>::Create( &rParent, WB_RIGHT );
break;
case ::com::sun::star::awt::TextAlign::CENTER:
- m_pWindow = new FormattedField( &rParent, WB_CENTER );
- m_pPainter = new FormattedField( &rParent, WB_CENTER );
+ m_pWindow = VclPtr<FormattedField>::Create( &rParent, WB_CENTER );
+ m_pPainter = VclPtr<FormattedField>::Create( &rParent, WB_CENTER );
break;
default:
- m_pWindow = new FormattedField( &rParent, WB_LEFT );
- m_pPainter = new FormattedField( &rParent, WB_LEFT );
+ m_pWindow = VclPtr<FormattedField>::Create( &rParent, WB_LEFT );
+ m_pPainter = VclPtr<FormattedField>::Create( &rParent, WB_LEFT );
// Alles nur damit die Selektion bei Focuserhalt von rechts nach links geht
AllSettings aSettings = m_pWindow->GetSettings();
@@ -1281,8 +1280,8 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
implAdjustGenericFieldSetting( xUnoModel );
- static_cast< FormattedField* >( m_pWindow )->SetStrictFormat( false );
- static_cast< FormattedField* >( m_pPainter )->SetStrictFormat( false );
+ static_cast< FormattedField* >( m_pWindow.get() )->SetStrictFormat( false );
+ static_cast< FormattedField* >( m_pPainter.get() )->SetStrictFormat( false );
// wenn man _irgendeine_ Formatierung zulaesst, kann man da sowieso keine Eingabe-Ueberpruefung
// machen (das FormattedField unterstuetzt das sowieso nicht, nur abgeleitete Klassen)
@@ -1350,7 +1349,7 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
// einen Standard-Formatter ...
if (pFormatterUsed == NULL)
{
- pFormatterUsed = static_cast<FormattedField*>(m_pWindow)->StandardFormatter();
+ pFormatterUsed = static_cast<FormattedField*>(m_pWindow.get())->StandardFormatter();
DBG_ASSERT(pFormatterUsed != NULL, "DbFormattedField::Init : no standard formatter given by the numeric field !");
}
// ... und einen Standard-Key
@@ -1359,14 +1358,14 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
m_nKeyType = comphelper::getNumberFormatType(m_xSupplier->getNumberFormats(), nFormatKey);
- static_cast<FormattedField*>(m_pWindow)->SetFormatter(pFormatterUsed);
- static_cast<FormattedField*>(m_pPainter)->SetFormatter(pFormatterUsed);
+ static_cast<FormattedField*>(m_pWindow.get())->SetFormatter(pFormatterUsed);
+ static_cast<FormattedField*>(m_pPainter.get())->SetFormatter(pFormatterUsed);
- static_cast<FormattedField*>(m_pWindow)->SetFormatKey(nFormatKey);
- static_cast<FormattedField*>(m_pPainter)->SetFormatKey(nFormatKey);
+ static_cast<FormattedField*>(m_pWindow.get())->SetFormatKey(nFormatKey);
+ static_cast<FormattedField*>(m_pPainter.get())->SetFormatKey(nFormatKey);
- static_cast<FormattedField*>(m_pWindow)->TreatAsNumber(m_rColumn.IsNumeric());
- static_cast<FormattedField*>(m_pPainter)->TreatAsNumber(m_rColumn.IsNumeric());
+ static_cast<FormattedField*>(m_pWindow.get())->TreatAsNumber(m_rColumn.IsNumeric());
+ static_cast<FormattedField*>(m_pPainter.get())->TreatAsNumber(m_rColumn.IsNumeric());
// Min- und Max-Werte
if (m_rColumn.IsNumeric())
@@ -1379,15 +1378,15 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
{
DBG_ASSERT(aMin.getValueType().getTypeClass() == TypeClass_DOUBLE, "DbFormattedField::Init : the model has an invalid min value !");
double dMin = ::comphelper::getDouble(aMin);
- static_cast<FormattedField*>(m_pWindow)->SetMinValue(dMin);
- static_cast<FormattedField*>(m_pPainter)->SetMinValue(dMin);
+ static_cast<FormattedField*>(m_pWindow.get())->SetMinValue(dMin);
+ static_cast<FormattedField*>(m_pPainter.get())->SetMinValue(dMin);
bClearMin = false;
}
}
if (bClearMin)
{
- static_cast<FormattedField*>(m_pWindow)->ClearMinValue();
- static_cast<FormattedField*>(m_pPainter)->ClearMinValue();
+ static_cast<FormattedField*>(m_pWindow.get())->ClearMinValue();
+ static_cast<FormattedField*>(m_pPainter.get())->ClearMinValue();
}
bool bClearMax = true;
if (::comphelper::hasProperty(FM_PROP_EFFECTIVE_MAX, xUnoModel))
@@ -1397,15 +1396,15 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
{
DBG_ASSERT(aMin.getValueType().getTypeClass() == TypeClass_DOUBLE, "DbFormattedField::Init : the model has an invalid max value !");
double dMin = ::comphelper::getDouble(aMin);
- static_cast<FormattedField*>(m_pWindow)->SetMaxValue(dMin);
- static_cast<FormattedField*>(m_pPainter)->SetMaxValue(dMin);
+ static_cast<FormattedField*>(m_pWindow.get())->SetMaxValue(dMin);
+ static_cast<FormattedField*>(m_pPainter.get())->SetMaxValue(dMin);
bClearMax = false;
}
}
if (bClearMax)
{
- static_cast<FormattedField*>(m_pWindow)->ClearMaxValue();
- static_cast<FormattedField*>(m_pPainter)->ClearMaxValue();
+ static_cast<FormattedField*>(m_pWindow.get())->ClearMaxValue();
+ static_cast<FormattedField*>(m_pPainter.get())->ClearMaxValue();
}
}
@@ -1418,16 +1417,16 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
case TypeClass_DOUBLE:
if (m_rColumn.IsNumeric())
{
- static_cast<FormattedField*>(m_pWindow)->SetDefaultValue(::comphelper::getDouble(aDefault));
- static_cast<FormattedField*>(m_pPainter)->SetDefaultValue(::comphelper::getDouble(aDefault));
+ static_cast<FormattedField*>(m_pWindow.get())->SetDefaultValue(::comphelper::getDouble(aDefault));
+ static_cast<FormattedField*>(m_pPainter.get())->SetDefaultValue(::comphelper::getDouble(aDefault));
}
else
{
OUString sConverted;
Color* pDummy;
pFormatterUsed->GetOutputString(::comphelper::getDouble(aDefault), 0, sConverted, &pDummy);
- static_cast<FormattedField*>(m_pWindow)->SetDefaultText(sConverted);
- static_cast<FormattedField*>(m_pPainter)->SetDefaultText(sConverted);
+ static_cast<FormattedField*>(m_pWindow.get())->SetDefaultText(sConverted);
+ static_cast<FormattedField*>(m_pPainter.get())->SetDefaultText(sConverted);
}
break;
case TypeClass_STRING:
@@ -1439,14 +1438,14 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
sal_uInt32 nTestFormat(0);
if (pFormatterUsed->IsNumberFormat(sDefault, nTestFormat, dVal))
{
- static_cast<FormattedField*>(m_pWindow)->SetDefaultValue(dVal);
- static_cast<FormattedField*>(m_pPainter)->SetDefaultValue(dVal);
+ static_cast<FormattedField*>(m_pWindow.get())->SetDefaultValue(dVal);
+ static_cast<FormattedField*>(m_pPainter.get())->SetDefaultValue(dVal);
}
}
else
{
- static_cast<FormattedField*>(m_pWindow)->SetDefaultText(sDefault);
- static_cast<FormattedField*>(m_pPainter)->SetDefaultText(sDefault);
+ static_cast<FormattedField*>(m_pWindow.get())->SetDefaultText(sDefault);
+ static_cast<FormattedField*>(m_pPainter.get())->SetDefaultText(sDefault);
}
}
break;
@@ -1461,7 +1460,7 @@ void DbFormattedField::Init( vcl::Window& rParent, const Reference< XRowSet >& x
CellControllerRef DbFormattedField::CreateController() const
{
- return new ::svt::FormattedFieldCellController( static_cast< FormattedField* >( m_pWindow ) );
+ return new ::svt::FormattedFieldCellController( static_cast< FormattedField* >( m_pWindow.get() ) );
}
@@ -1474,9 +1473,9 @@ void DbFormattedField::_propertyChanged( const PropertyChangeEvent& _rEvent ) th
DBG_ASSERT(m_pWindow && m_pPainter, "DbFormattedField::_propertyChanged : where are my windows ?");
if (m_pWindow)
- static_cast< FormattedField* >( m_pWindow )->SetFormatKey( nNewKey );
+ static_cast< FormattedField* >( m_pWindow.get() )->SetFormatKey( nNewKey );
if (m_pPainter)
- static_cast< FormattedField* >( m_pPainter )->SetFormatKey( nNewKey );
+ static_cast< FormattedField* >( m_pPainter.get() )->SetFormatKey( nNewKey );
}
else
{
@@ -1508,7 +1507,7 @@ OUString DbFormattedField::GetFormatText(const Reference< ::com::sun::star::sdb:
double dValue = getValue( _rxField, m_rColumn.GetParent().getNullDate() );
if (_rxField->wasNull())
return aText;
- static_cast<FormattedField*>(m_pPainter)->SetValue(dValue);
+ static_cast<FormattedField*>(m_pPainter.get())->SetValue(dValue);
}
else
{
@@ -1517,7 +1516,7 @@ OUString DbFormattedField::GetFormatText(const Reference< ::com::sun::star::sdb:
aText = _rxField->getString();
if (_rxField->wasNull())
return aText;
- static_cast<FormattedField*>(m_pPainter)->SetTextFormatted(aText);
+ static_cast<FormattedField*>(m_pPainter.get())->SetTextFormatted(aText);
}
}
catch( const Exception& )
@@ -1527,7 +1526,7 @@ OUString DbFormattedField::GetFormatText(const Reference< ::com::sun::star::sdb:
aText = m_pPainter->GetText();
if (ppColor != NULL)
- *ppColor = static_cast<FormattedField*>(m_pPainter)->GetLastOutputColor();
+ *ppColor = static_cast<FormattedField*>(m_pPainter.get())->GetLastOutputColor();
return aText;
}
@@ -1537,7 +1536,7 @@ void DbFormattedField::UpdateFromField(const Reference< ::com::sun::star::sdb::X
{
try
{
- FormattedField* pFormattedWindow = static_cast<FormattedField*>(m_pWindow);
+ FormattedField* pFormattedWindow = static_cast<FormattedField*>(m_pWindow.get());
if (!_rxField.is())
{ // NULL-Wert -> leerer Text
m_pWindow->SetText(OUString());
@@ -1576,7 +1575,7 @@ void DbFormattedField::updateFromModel( Reference< XPropertySet > _rxModel )
{
OSL_ENSURE( _rxModel.is() && m_pWindow, "DbFormattedField::updateFromModel: invalid call!" );
- FormattedField* pFormattedWindow = static_cast< FormattedField* >( m_pWindow );
+ FormattedField* pFormattedWindow = static_cast< FormattedField* >( m_pWindow.get() );
OUString sText;
Any aValue = _rxModel->getPropertyValue( FM_PROP_EFFECTIVE_VALUE );
@@ -1597,7 +1596,7 @@ void DbFormattedField::updateFromModel( Reference< XPropertySet > _rxModel )
bool DbFormattedField::commitControl()
{
Any aNewVal;
- FormattedField& rField = *static_cast<FormattedField*>(m_pWindow);
+ FormattedField& rField = *static_cast<FormattedField*>(m_pWindow.get());
DBG_ASSERT(&rField == m_pWindow, "DbFormattedField::commitControl : can't work with a window other than my own !");
if (m_rColumn.IsNumeric())
{
@@ -1638,8 +1637,8 @@ void DbCheckBox::Init( vcl::Window& rParent, const Reference< XRowSet >& xCursor
{
setTransparent( true );
- m_pWindow = new CheckBoxControl( &rParent );
- m_pPainter = new CheckBoxControl( &rParent );
+ m_pWindow = VclPtr<CheckBoxControl>::Create( &rParent );
+ m_pPainter = VclPtr<CheckBoxControl>::Create( &rParent );
m_pWindow->SetPaintTransparent( true );
m_pPainter->SetPaintTransparent( true );
@@ -1658,8 +1657,8 @@ void DbCheckBox::Init( vcl::Window& rParent, const Reference< XRowSet >& xCursor
bool bTristate = true;
OSL_VERIFY( xModel->getPropertyValue( FM_PROP_TRISTATE ) >>= bTristate );
- static_cast< CheckBoxControl* >( m_pWindow )->GetBox().EnableTriState( bTristate );
- static_cast< CheckBoxControl* >( m_pPainter )->GetBox().EnableTriState( bTristate );
+ static_cast< CheckBoxControl* >( m_pWindow.get() )->GetBox().EnableTriState( bTristate );
+ static_cast< CheckBoxControl* >( m_pPainter.get() )->GetBox().EnableTriState( bTristate );
}
catch( const Exception& )
{
@@ -1672,7 +1671,7 @@ void DbCheckBox::Init( vcl::Window& rParent, const Reference< XRowSet >& xCursor
CellControllerRef DbCheckBox::CreateController() const
{
- return new CheckBoxCellController(static_cast<CheckBoxControl*>(m_pWindow));
+ return new CheckBoxCellController(static_cast<CheckBoxControl*>(m_pWindow.get()));
}
static void lcl_setCheckBoxState( const Reference< ::com::sun::star::sdb::XColumn >& _rxField,
@@ -1698,7 +1697,7 @@ static void lcl_setCheckBoxState( const Reference< ::com::sun::star::sdb::XCol
void DbCheckBox::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/)
{
- lcl_setCheckBoxState( _rxField, static_cast<CheckBoxControl*>(m_pWindow) );
+ lcl_setCheckBoxState( _rxField, static_cast<CheckBoxControl*>(m_pWindow.get()) );
}
@@ -1706,7 +1705,7 @@ void DbCheckBox::PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect,
const Reference< ::com::sun::star::sdb::XColumn >& _rxField,
const Reference< XNumberFormatter >& xFormatter)
{
- lcl_setCheckBoxState( _rxField, static_cast<CheckBoxControl*>(m_pPainter) );
+ lcl_setCheckBoxState( _rxField, static_cast<CheckBoxControl*>(m_pPainter.get()) );
DbCellControl::PaintFieldToCell( rDev, rRect, _rxField, xFormatter );
}
@@ -1717,14 +1716,14 @@ void DbCheckBox::updateFromModel( Reference< XPropertySet > _rxModel )
sal_Int16 nState = TRISTATE_INDET;
_rxModel->getPropertyValue( FM_PROP_STATE ) >>= nState;
- static_cast< CheckBoxControl* >( m_pWindow )->GetBox().SetState( static_cast< TriState >( nState ) );
+ static_cast< CheckBoxControl* >( m_pWindow.get() )->GetBox().SetState( static_cast< TriState >( nState ) );
}
bool DbCheckBox::commitControl()
{
m_rColumn.getModel()->setPropertyValue( FM_PROP_STATE,
- makeAny( (sal_Int16)( static_cast< CheckBoxControl* >( m_pWindow )->GetBox().GetState() ) ) );
+ makeAny( (sal_Int16)( static_cast< CheckBoxControl* >( m_pWindow.get() )->GetBox().GetState() ) ) );
return true;
}
@@ -1760,10 +1759,10 @@ void DbPatternField::implAdjustGenericFieldSetting( const Reference< XPropertySe
OString aAsciiEditMask(OUStringToOString(aEditMask, RTL_TEXTENCODING_ASCII_US));
- static_cast< PatternField* >( m_pWindow )->SetMask( aAsciiEditMask, aLitMask );
- static_cast< PatternField* >( m_pPainter )->SetMask( aAsciiEditMask, aLitMask );
- static_cast< PatternField* >( m_pWindow )->SetStrictFormat( bStrict );
- static_cast< PatternField* >( m_pPainter )->SetStrictFormat( bStrict );
+ static_cast< PatternField* >( m_pWindow.get() )->SetMask( aAsciiEditMask, aLitMask );
+ static_cast< PatternField* >( m_pPainter.get() )->SetMask( aAsciiEditMask, aLitMask );
+ static_cast< PatternField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
+ static_cast< PatternField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
}
}
@@ -1772,8 +1771,8 @@ void DbPatternField::Init( vcl::Window& rParent, const Reference< XRowSet >& xCu
{
m_rColumn.SetAlignmentFromModel(-1);
- m_pWindow = new PatternField( &rParent, 0 );
- m_pPainter= new PatternField( &rParent, 0 );
+ m_pWindow = VclPtr<PatternField>::Create( &rParent, 0 );
+ m_pPainter= VclPtr<PatternField>::Create( &rParent, 0 );
Reference< XPropertySet > xModel( m_rColumn.getModel() );
implAdjustGenericFieldSetting( xModel );
@@ -1784,14 +1783,14 @@ void DbPatternField::Init( vcl::Window& rParent, const Reference< XRowSet >& xCu
CellControllerRef DbPatternField::CreateController() const
{
- return new SpinCellController( static_cast< PatternField* >( m_pWindow ) );
+ return new SpinCellController( static_cast< PatternField* >( m_pWindow.get() ) );
}
OUString DbPatternField::impl_formatText( const OUString& _rText )
{
m_pPainter->SetText( _rText );
- static_cast< PatternField* >( m_pPainter )->ReformatAll();
+ static_cast< PatternField* >( m_pPainter.get() )->ReformatAll();
return m_pPainter->GetText();
}
@@ -1821,8 +1820,8 @@ OUString DbPatternField::GetFormatText(const Reference< ::com::sun::star::sdb::X
void DbPatternField::UpdateFromField( const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& _rxFormatter )
{
- static_cast< Edit* >( m_pWindow )->SetText( GetFormatText( _rxField, _rxFormatter ) );
- static_cast< Edit* >( m_pWindow )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+ static_cast< Edit* >( m_pWindow.get() )->SetText( GetFormatText( _rxField, _rxFormatter ) );
+ static_cast< Edit* >( m_pWindow.get() )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
}
@@ -1833,8 +1832,8 @@ void DbPatternField::updateFromModel( Reference< XPropertySet > _rxModel )
OUString sText;
_rxModel->getPropertyValue( FM_PROP_TEXT ) >>= sText;
- static_cast< Edit* >( m_pWindow )->SetText( impl_formatText( sText ) );
- static_cast< Edit* >( m_pWindow )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+ static_cast< Edit* >( m_pWindow.get() )->SetText( impl_formatText( sText ) );
+ static_cast< Edit* >( m_pWindow.get() )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
}
@@ -1876,7 +1875,7 @@ void DbSpinField::Init( vcl::Window& _rParent, const Reference< XRowSet >& _rxCu
CellControllerRef DbSpinField::CreateController() const
{
- return new SpinCellController( static_cast< SpinField* >( m_pWindow ) );
+ return new SpinCellController( static_cast< SpinField* >( m_pWindow.get() ) );
}
DbNumericField::DbNumericField( DbGridColumn& _rColumn )
@@ -1904,14 +1903,14 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe
sal_Int16 nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) );
bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) );
- static_cast< DoubleNumericField* >( m_pWindow )->SetMinValue(nMin);
- static_cast< DoubleNumericField* >( m_pWindow )->SetMaxValue(nMax);
- static_cast< DoubleNumericField* >( m_pWindow )->SetSpinSize(nStep);
- static_cast< DoubleNumericField* >( m_pWindow )->SetStrictFormat(bStrict);
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetMinValue(nMin);
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetMaxValue(nMax);
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetSpinSize(nStep);
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetStrictFormat(bStrict);
- static_cast< DoubleNumericField* >( m_pPainter )->SetMinValue(nMin);
- static_cast< DoubleNumericField* >( m_pPainter )->SetMaxValue(nMax);
- static_cast< DoubleNumericField* >( m_pPainter )->SetStrictFormat(bStrict);
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetMinValue(nMin);
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetMaxValue(nMax);
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetStrictFormat(bStrict);
// dem Field und dem Painter einen Formatter spendieren
@@ -1930,25 +1929,25 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe
}
if ( NULL == pFormatterUsed )
{ // der Cursor fuehrte nicht zum Erfolg -> Standard
- pFormatterUsed = static_cast< DoubleNumericField* >( m_pWindow )->StandardFormatter();
+ pFormatterUsed = static_cast< DoubleNumericField* >( m_pWindow.get() )->StandardFormatter();
DBG_ASSERT( pFormatterUsed != NULL, "DbNumericField::implAdjustGenericFieldSetting: no standard formatter given by the numeric field !" );
}
- static_cast< DoubleNumericField* >( m_pWindow )->SetFormatter( pFormatterUsed );
- static_cast< DoubleNumericField* >( m_pPainter )->SetFormatter( pFormatterUsed );
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetFormatter( pFormatterUsed );
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetFormatter( pFormatterUsed );
// und dann ein Format generieren, dass die gewuenschten Nachkommastellen usw. hat
LanguageType aAppLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType();
OUString sFormatString = pFormatterUsed->GenerateFormat(0, aAppLanguage, bThousand, false, nScale);
- static_cast< DoubleNumericField* >( m_pWindow )->SetFormat( sFormatString, aAppLanguage );
- static_cast< DoubleNumericField* >( m_pPainter )->SetFormat( sFormatString, aAppLanguage );
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetFormat( sFormatString, aAppLanguage );
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetFormat( sFormatString, aAppLanguage );
}
}
-SpinField* DbNumericField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
+VclPtr<SpinField> DbNumericField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
{
- return new DoubleNumericField( _pParent, _nFieldStyle );
+ return VclPtr<DoubleNumericField>::Create( _pParent, _nFieldStyle );
}
namespace
@@ -1997,7 +1996,7 @@ void DbNumericField::updateFromModel( Reference< XPropertySet > _rxModel )
double dValue = 0;
if ( _rxModel->getPropertyValue( FM_PROP_VALUE ) >>= dValue )
- static_cast< DoubleNumericField* >( m_pWindow )->SetValue( dValue );
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetValue( dValue );
else
m_pWindow->SetText( OUString() );
}
@@ -2010,7 +2009,7 @@ bool DbNumericField::commitControl()
if (!aText.isEmpty()) // not empty
{
- double fValue = static_cast<DoubleNumericField*>(m_pWindow)->GetValue();
+ double fValue = static_cast<DoubleNumericField*>(m_pWindow.get())->GetValue();
aVal <<= (double)fValue;
}
m_rColumn.getModel()->setPropertyValue(FM_PROP_VALUE, aVal);
@@ -2052,31 +2051,31 @@ void DbCurrencyField::implAdjustGenericFieldSetting( const Reference< XPropertyS
nMin *= nMul;
nMax *= nMul;
- static_cast< LongCurrencyField* >( m_pWindow )->SetUseThousandSep( bThousand );
- static_cast< LongCurrencyField* >( m_pWindow )->SetDecimalDigits( m_nScale );
- static_cast< LongCurrencyField* >( m_pWindow )->SetCurrencySymbol( aStr );
- static_cast< LongCurrencyField* >( m_pWindow )->SetFirst( nMin );
- static_cast< LongCurrencyField* >( m_pWindow )->SetLast( nMax );
- static_cast< LongCurrencyField* >( m_pWindow )->SetMin( nMin );
- static_cast< LongCurrencyField* >( m_pWindow )->SetMax( nMax );
- static_cast< LongCurrencyField* >( m_pWindow )->SetSpinSize( nStep );
- static_cast< LongCurrencyField* >( m_pWindow )->SetStrictFormat( bStrict );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetUseThousandSep( bThousand );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetDecimalDigits( m_nScale );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetCurrencySymbol( aStr );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetFirst( nMin );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetLast( nMax );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetMin( nMin );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetMax( nMax );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetSpinSize( nStep );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
- static_cast< LongCurrencyField* >( m_pPainter )->SetUseThousandSep( bThousand );
- static_cast< LongCurrencyField* >( m_pPainter )->SetDecimalDigits( m_nScale );
- static_cast< LongCurrencyField* >( m_pPainter )->SetCurrencySymbol( aStr );
- static_cast< LongCurrencyField* >( m_pPainter )->SetFirst( nMin );
- static_cast< LongCurrencyField* >( m_pPainter )->SetLast( nMax );
- static_cast< LongCurrencyField* >( m_pPainter )->SetMin( nMin );
- static_cast< LongCurrencyField* >( m_pPainter )->SetMax( nMax );
- static_cast< LongCurrencyField* >( m_pPainter )->SetStrictFormat( bStrict );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetUseThousandSep( bThousand );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetDecimalDigits( m_nScale );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetCurrencySymbol( aStr );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetFirst( nMin );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetLast( nMax );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetMin( nMin );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetMax( nMax );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
}
}
-SpinField* DbCurrencyField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
+VclPtr<SpinField> DbCurrencyField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
{
- return new LongCurrencyField( _pParent, _nFieldStyle );
+ return VclPtr<LongCurrencyField>::Create( _pParent, _nFieldStyle );
}
@@ -2145,7 +2144,7 @@ void DbCurrencyField::updateFromModel( Reference< XPropertySet > _rxModel )
dValue = ::rtl::math::round(dValue, 0);
}
- static_cast< LongCurrencyField* >( m_pWindow )->SetValue( dValue );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetValue( dValue );
}
else
m_pWindow->SetText( OUString() );
@@ -2158,7 +2157,7 @@ bool DbCurrencyField::commitControl()
Any aVal;
if (!aText.isEmpty()) // not empty
{
- double fValue = static_cast<LongCurrencyField*>(m_pWindow)->GetValue();
+ double fValue = static_cast<LongCurrencyField*>(m_pWindow.get())->GetValue();
if (m_nScale)
{
fValue /= ::rtl::math::pow10Exp(1.0, m_nScale);
@@ -2180,7 +2179,7 @@ DbDateField::DbDateField( DbGridColumn& _rColumn )
}
-SpinField* DbDateField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& _rxModel )
+VclPtr<SpinField> DbDateField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& _rxModel )
{
// check if there is a DropDown property set to TRUE
bool bDropDown = !hasProperty( FM_PROP_DROPDOWN, _rxModel )
@@ -2188,7 +2187,7 @@ SpinField* DbDateField::createField( vcl::Window* _pParent, WinBits _nFieldStyle
if ( bDropDown )
_nFieldStyle |= WB_DROPDOWN;
- CalendarField* pField = new CalendarField( _pParent, _nFieldStyle );
+ VclPtr<CalendarField> pField = VclPtr<CalendarField>::Create( _pParent, _nFieldStyle );
pField->EnableToday();
pField->EnableNone();
@@ -2215,21 +2214,21 @@ void DbDateField::implAdjustGenericFieldSetting( const Reference< XPropertySet >
{
bool bShowDateCentury = getBOOL( aCentury );
- static_cast<DateField*>( m_pWindow )->SetShowDateCentury( bShowDateCentury );
- static_cast<DateField*>( m_pPainter )->SetShowDateCentury( bShowDateCentury );
+ static_cast<DateField*>( m_pWindow.get() )->SetShowDateCentury( bShowDateCentury );
+ static_cast<DateField*>( m_pPainter.get() )->SetShowDateCentury( bShowDateCentury );
}
- static_cast< DateField* >( m_pWindow )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
- static_cast< DateField* >( m_pWindow )->SetMin( aMin );
- static_cast< DateField* >( m_pWindow )->SetMax( aMax );
- static_cast< DateField* >( m_pWindow )->SetStrictFormat( bStrict );
- static_cast< DateField* >( m_pWindow )->EnableEmptyFieldValue( true );
+ static_cast< DateField* >( m_pWindow.get() )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
+ static_cast< DateField* >( m_pWindow.get() )->SetMin( aMin );
+ static_cast< DateField* >( m_pWindow.get() )->SetMax( aMax );
+ static_cast< DateField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
+ static_cast< DateField* >( m_pWindow.get() )->EnableEmptyFieldValue( true );
- static_cast< DateField* >( m_pPainter )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
- static_cast< DateField* >( m_pPainter )->SetMin( aMin );
- static_cast< DateField* >( m_pPainter )->SetMax( aMax );
- static_cast< DateField* >( m_pPainter )->SetStrictFormat( bStrict );
- static_cast< DateField* >( m_pPainter )->EnableEmptyFieldValue( true );
+ static_cast< DateField* >( m_pPainter.get() )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
+ static_cast< DateField* >( m_pPainter.get() )->SetMin( aMin );
+ static_cast< DateField* >( m_pPainter.get() )->SetMax( aMax );
+ static_cast< DateField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
+ static_cast< DateField* >( m_pPainter.get() )->EnableEmptyFieldValue( true );
}
}
@@ -2263,13 +2262,13 @@ namespace
OUString DbDateField::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< ::com::sun::star::util::XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
{
- return lcl_setFormattedDate_nothrow(dynamic_cast<DateField&>(*m_pPainter), _rxField);
+ return lcl_setFormattedDate_nothrow(dynamic_cast<DateField&>(*m_pPainter.get()), _rxField);
}
void DbDateField::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/)
{
- lcl_setFormattedDate_nothrow(dynamic_cast<DateField&>(*m_pWindow), _rxField);
+ lcl_setFormattedDate_nothrow(dynamic_cast<DateField&>(*m_pWindow.get()), _rxField);
}
@@ -2279,9 +2278,9 @@ void DbDateField::updateFromModel( Reference< XPropertySet > _rxModel )
util::Date aDate;
if ( _rxModel->getPropertyValue( FM_PROP_DATE ) >>= aDate )
- static_cast< DateField* >( m_pWindow )->SetDate( ::Date( aDate ) );
+ static_cast< DateField* >( m_pWindow.get() )->SetDate( ::Date( aDate ) );
else
- static_cast< DateField* >( m_pWindow )->SetText( OUString() );
+ static_cast< DateField* >( m_pWindow.get() )->SetText( OUString() );
}
@@ -2290,7 +2289,7 @@ bool DbDateField::commitControl()
OUString aText(m_pWindow->GetText());
Any aVal;
if (!aText.isEmpty())
- aVal <<= static_cast<DateField*>(m_pWindow)->GetDate().GetUNODate();
+ aVal <<= static_cast<DateField*>(m_pWindow.get())->GetDate().GetUNODate();
else
aVal.clear();
@@ -2308,9 +2307,9 @@ DbTimeField::DbTimeField( DbGridColumn& _rColumn )
}
-SpinField* DbTimeField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
+VclPtr<SpinField> DbTimeField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
{
- return new TimeField( _pParent, _nFieldStyle );
+ return VclPtr<TimeField>::Create( _pParent, _nFieldStyle );
}
@@ -2327,17 +2326,17 @@ void DbTimeField::implAdjustGenericFieldSetting( const Reference< XPropertySet >
OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_TIMEMAX ) >>= aMax );
bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
- static_cast< TimeField* >( m_pWindow )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
- static_cast< TimeField* >( m_pWindow )->SetMin( aMin );
- static_cast< TimeField* >( m_pWindow )->SetMax( aMax );
- static_cast< TimeField* >( m_pWindow )->SetStrictFormat( bStrict );
- static_cast< TimeField* >( m_pWindow )->EnableEmptyFieldValue( true );
+ static_cast< TimeField* >( m_pWindow.get() )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
+ static_cast< TimeField* >( m_pWindow.get() )->SetMin( aMin );
+ static_cast< TimeField* >( m_pWindow.get() )->SetMax( aMax );
+ static_cast< TimeField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
+ static_cast< TimeField* >( m_pWindow.get() )->EnableEmptyFieldValue( true );
- static_cast< TimeField* >( m_pPainter )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
- static_cast< TimeField* >( m_pPainter )->SetMin( aMin );
- static_cast< TimeField* >( m_pPainter )->SetMax( aMax );
- static_cast< TimeField* >( m_pPainter )->SetStrictFormat( bStrict );
- static_cast< TimeField* >( m_pPainter )->EnableEmptyFieldValue( true );
+ static_cast< TimeField* >( m_pPainter.get() )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
+ static_cast< TimeField* >( m_pPainter.get() )->SetMin( aMin );
+ static_cast< TimeField* >( m_pPainter.get() )->SetMax( aMax );
+ static_cast< TimeField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
+ static_cast< TimeField* >( m_pPainter.get() )->EnableEmptyFieldValue( true );
}
}
@@ -2371,13 +2370,13 @@ namespace
OUString DbTimeField::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< ::com::sun::star::util::XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
{
- return lcl_setFormattedTime_nothrow( *static_cast< TimeField* >( m_pPainter ), _rxField );
+ return lcl_setFormattedTime_nothrow( *static_cast< TimeField* >( m_pPainter.get() ), _rxField );
}
void DbTimeField::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/)
{
- lcl_setFormattedTime_nothrow( *static_cast< TimeField* >( m_pWindow ), _rxField );
+ lcl_setFormattedTime_nothrow( *static_cast< TimeField* >( m_pWindow.get() ), _rxField );
}
@@ -2387,9 +2386,9 @@ void DbTimeField::updateFromModel( Reference< XPropertySet > _rxModel )
util::Time aTime;
if ( _rxModel->getPropertyValue( FM_PROP_TIME ) >>= aTime )
- static_cast< TimeField* >( m_pWindow )->SetTime( ::tools::Time( aTime ) );
+ static_cast< TimeField* >( m_pWindow.get() )->SetTime( ::tools::Time( aTime ) );
else
- static_cast< TimeField* >( m_pWindow )->SetText( OUString() );
+ static_cast< TimeField* >( m_pWindow.get() )->SetText( OUString() );
}
@@ -2398,7 +2397,7 @@ bool DbTimeField::commitControl()
OUString aText(m_pWindow->GetText());
Any aVal;
if (!aText.isEmpty())
- aVal <<= static_cast<TimeField*>(m_pWindow)->GetTime().GetUNOTime();
+ aVal <<= static_cast<TimeField*>(m_pWindow.get())->GetTime().GetUNOTime();
else
aVal.clear();
@@ -2431,7 +2430,7 @@ void DbComboBox::_propertyChanged( const PropertyChangeEvent& _rEvent ) throw( R
void DbComboBox::SetList(const Any& rItems)
{
- ComboBoxControl* pField = static_cast<ComboBoxControl*>(m_pWindow);
+ ComboBoxControl* pField = static_cast<ComboBoxControl*>(m_pWindow.get());
pField->Clear();
::comphelper::StringSequence aTest;
@@ -2455,7 +2454,7 @@ void DbComboBox::implAdjustGenericFieldSetting( const Reference< XPropertySet >&
if ( m_pWindow && _rxModel.is() )
{
sal_Int16 nLines = getINT16( _rxModel->getPropertyValue( FM_PROP_LINECOUNT ) );
- static_cast< ComboBoxControl* >( m_pWindow )->SetDropDownLineCount( nLines );
+ static_cast< ComboBoxControl* >( m_pWindow.get() )->SetDropDownLineCount( nLines );
}
}
@@ -2464,7 +2463,7 @@ void DbComboBox::Init( vcl::Window& rParent, const Reference< XRowSet >& xCursor
{
m_rColumn.SetAlignmentFromModel(::com::sun::star::awt::TextAlign::LEFT);
- m_pWindow = new ComboBoxControl( &rParent );
+ m_pWindow = VclPtr<ComboBoxControl>::Create( &rParent );
// selection von rechts nach links
AllSettings aSettings = m_pWindow->GetSettings();
@@ -2485,7 +2484,7 @@ void DbComboBox::Init( vcl::Window& rParent, const Reference< XRowSet >& xCursor
CellControllerRef DbComboBox::CreateController() const
{
- return new ComboBoxCellController(static_cast<ComboBoxControl*>(m_pWindow));
+ return new ComboBoxCellController(static_cast<ComboBoxControl*>(m_pWindow.get()));
}
@@ -2511,8 +2510,8 @@ void DbComboBox::updateFromModel( Reference< XPropertySet > _rxModel )
OUString sText;
_rxModel->getPropertyValue( FM_PROP_TEXT ) >>= sText;
- static_cast< ComboBox* >( m_pWindow )->SetText( sText );
- static_cast< ComboBox* >( m_pWindow )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+ static_cast< ComboBox* >( m_pWindow.get() )->SetText( sText );
+ static_cast< ComboBox* >( m_pWindow.get() )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
}
@@ -2550,7 +2549,7 @@ void DbListBox::_propertyChanged( const ::com::sun::star::beans::PropertyChangeE
void DbListBox::SetList(const Any& rItems)
{
- ListBoxControl* pField = static_cast<ListBoxControl*>(m_pWindow);
+ ListBoxControl* pField = static_cast<ListBoxControl*>(m_pWindow.get());
pField->Clear();
m_bBound = false;
@@ -2579,7 +2578,7 @@ void DbListBox::Init( vcl::Window& rParent, const Reference< XRowSet >& xCursor)
{
m_rColumn.SetAlignment(::com::sun::star::awt::TextAlign::LEFT);
- m_pWindow = new ListBoxControl( &rParent );
+ m_pWindow = VclPtr<ListBoxControl>::Create( &rParent );
// some initial properties
Reference< XPropertySet > xModel( m_rColumn.getModel() );
@@ -2597,14 +2596,14 @@ void DbListBox::implAdjustGenericFieldSetting( const Reference< XPropertySet >&
if ( m_pWindow && _rxModel.is() )
{
sal_Int16 nLines = getINT16( _rxModel->getPropertyValue( FM_PROP_LINECOUNT ) );
- static_cast< ListBoxControl* >( m_pWindow )->SetDropDownLineCount( nLines );
+ static_cast< ListBoxControl* >( m_pWindow.get() )->SetDropDownLineCount( nLines );
}
}
CellControllerRef DbListBox::CreateController() const
{
- return new ListBoxCellController(static_cast<ListBoxControl*>(m_pWindow));
+ return new ListBoxCellController(static_cast<ListBoxControl*>(m_pWindow.get()));
}
@@ -2620,7 +2619,7 @@ OUString DbListBox::GetFormatText(const Reference< ::com::sun::star::sdb::XColum
{
Sequence< sal_Int16 > aPosSeq = ::comphelper::findValue( m_aValueList, sText, true );
if ( aPosSeq.getLength() )
- sText = static_cast<ListBox*>(m_pWindow)->GetEntry(aPosSeq.getConstArray()[0]);
+ sText = static_cast<ListBox*>(m_pWindow.get())->GetEntry(aPosSeq.getConstArray()[0]);
else
sText.clear();
}
@@ -2638,9 +2637,9 @@ void DbListBox::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn
{
OUString sFormattedText( GetFormatText( _rxField, xFormatter ) );
if (!sFormattedText.isEmpty())
- static_cast< ListBox* >( m_pWindow )->SelectEntry( sFormattedText );
+ static_cast< ListBox* >( m_pWindow.get() )->SelectEntry( sFormattedText );
else
- static_cast< ListBox* >( m_pWindow )->SetNoSelection();
+ static_cast< ListBox* >( m_pWindow.get() )->SetNoSelection();
}
@@ -2655,7 +2654,7 @@ void DbListBox::updateFromModel( Reference< XPropertySet > _rxModel )
if ( aSelection.getLength() > 0 )
nSelection = aSelection[ 0 ];
- ListBox* pListBox = static_cast< ListBox* >( m_pWindow );
+ ListBox* pListBox = static_cast< ListBox* >( m_pWindow.get() );
if ( ( nSelection >= 0 ) && ( nSelection < pListBox->GetEntryCount() ) )
pListBox->SelectEntryPos( nSelection );
@@ -2668,10 +2667,10 @@ bool DbListBox::commitControl()
{
Any aVal;
Sequence<sal_Int16> aSelectSeq;
- if (static_cast<ListBox*>(m_pWindow)->GetSelectEntryCount())
+ if (static_cast<ListBox*>(m_pWindow.get())->GetSelectEntryCount())
{
aSelectSeq.realloc(1);
- *(sal_Int16 *)aSelectSeq.getArray() = (sal_Int16)static_cast<ListBox*>(m_pWindow)->GetSelectEntryPos();
+ *(sal_Int16 *)aSelectSeq.getArray() = (sal_Int16)static_cast<ListBox*>(m_pWindow.get())->GetSelectEntryPos();
}
aVal <<= aSelectSeq;
m_rColumn.getModel()->setPropertyValue(FM_PROP_SELECT_SEQ, aVal);
@@ -2694,7 +2693,7 @@ DbFilterField::DbFilterField(const Reference< XComponentContext >& rxContext,DbG
DbFilterField::~DbFilterField()
{
if (m_nControlClass == ::com::sun::star::form::FormComponentType::CHECKBOX)
- static_cast<CheckBoxControl*>(m_pWindow)->SetClickHdl( Link() );
+ static_cast<CheckBoxControl*>(m_pWindow.get())->SetClickHdl( Link() );
}
@@ -2708,7 +2707,7 @@ void DbFilterField::PaintCell(OutputDevice& rDev, const Rectangle& rRect)
DbCellControl::PaintCell( rDev, rRect );
break;
case FormComponentType::LISTBOX:
- rDev.DrawText(rRect, static_cast<ListBox*>(m_pWindow)->GetSelectEntry(), nStyle);
+ rDev.DrawText(rRect, static_cast<ListBox*>(m_pWindow.get())->GetSelectEntry(), nStyle);
break;
default:
rDev.DrawText(rRect, m_aText, nStyle);
@@ -2726,13 +2725,13 @@ void DbFilterField::SetList(const Any& rItems, bool bComboBox)
{
if (bComboBox)
{
- ComboBox* pField = static_cast<ComboBox*>(m_pWindow);
+ ComboBox* pField = static_cast<ComboBox*>(m_pWindow.get());
for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
pField->InsertEntry(*pStrings, LISTBOX_APPEND);
}
else
{
- ListBox* pField = static_cast<ListBox*>(m_pWindow);
+ ListBox* pField = static_cast<ListBox*>(m_pWindow.get());
for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
pField->InsertEntry(*pStrings, LISTBOX_APPEND);
@@ -2748,25 +2747,25 @@ void DbFilterField::CreateControl(vcl::Window* pParent, const Reference< ::com::
switch (m_nControlClass)
{
case ::com::sun::star::form::FormComponentType::CHECKBOX:
- m_pWindow = new CheckBoxControl(pParent);
+ m_pWindow = VclPtr<CheckBoxControl>::Create(pParent);
m_pWindow->SetPaintTransparent( true );
- static_cast<CheckBoxControl*>(m_pWindow)->SetClickHdl( LINK( this, DbFilterField, OnClick ) );
+ static_cast<CheckBoxControl*>(m_pWindow.get())->SetClickHdl( LINK( this, DbFilterField, OnClick ) );
- m_pPainter = new CheckBoxControl(pParent);
+ m_pPainter = VclPtr<CheckBoxControl>::Create(pParent);
m_pPainter->SetPaintTransparent( true );
m_pPainter->SetBackground();
break;
case ::com::sun::star::form::FormComponentType::LISTBOX:
{
- m_pWindow = new ListBoxControl(pParent);
+ m_pWindow = VclPtr<ListBoxControl>::Create(pParent);
sal_Int16 nLines = ::comphelper::getINT16(xModel->getPropertyValue(FM_PROP_LINECOUNT));
Any aItems = xModel->getPropertyValue(FM_PROP_STRINGITEMLIST);
SetList(aItems, m_nControlClass == ::com::sun::star::form::FormComponentType::COMBOBOX);
- static_cast<ListBox*>(m_pWindow)->SetDropDownLineCount(nLines);
+ static_cast<ListBox*>(m_pWindow.get())->SetDropDownLineCount(nLines);
} break;
case ::com::sun::star::form::FormComponentType::COMBOBOX:
{
- m_pWindow = new ComboBoxControl(pParent);
+ m_pWindow = VclPtr<ComboBoxControl>::Create(pParent);
AllSettings aSettings = m_pWindow->GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
@@ -2780,15 +2779,15 @@ void DbFilterField::CreateControl(vcl::Window* pParent, const Reference< ::com::
sal_Int16 nLines = ::comphelper::getINT16(xModel->getPropertyValue(FM_PROP_LINECOUNT));
Any aItems = xModel->getPropertyValue(FM_PROP_STRINGITEMLIST);
SetList(aItems, m_nControlClass == ::com::sun::star::form::FormComponentType::COMBOBOX);
- static_cast<ComboBox*>(m_pWindow)->SetDropDownLineCount(nLines);
+ static_cast<ComboBox*>(m_pWindow.get())->SetDropDownLineCount(nLines);
}
else
- static_cast<ComboBox*>(m_pWindow)->SetDropDownLineCount(5);
+ static_cast<ComboBox*>(m_pWindow.get())->SetDropDownLineCount(5);
} break;
default:
{
- m_pWindow = new Edit(pParent, WB_LEFT);
+ m_pWindow = VclPtr<Edit>::Create(pParent, WB_LEFT);
AllSettings aSettings = m_pWindow->GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
aStyleSettings.SetSelectionOptions(
@@ -2833,7 +2832,7 @@ void DbFilterField::Init( vcl::Window& rParent, const Reference< XRowSet >& xCur
DbCellControl::Init( rParent, xCursor );
// filter cells are never readonly
- Edit* pAsEdit = dynamic_cast< Edit* >( m_pWindow );
+ Edit* pAsEdit = dynamic_cast< Edit* >( m_pWindow.get() );
if ( pAsEdit )
pAsEdit->SetReadOnly( false );
}
@@ -2845,19 +2844,19 @@ CellControllerRef DbFilterField::CreateController() const
switch (m_nControlClass)
{
case ::com::sun::star::form::FormComponentType::CHECKBOX:
- xController = new CheckBoxCellController(static_cast<CheckBoxControl*>(m_pWindow));
+ xController = new CheckBoxCellController(static_cast<CheckBoxControl*>(m_pWindow.get()));
break;
case ::com::sun::star::form::FormComponentType::LISTBOX:
- xController = new ListBoxCellController(static_cast<ListBoxControl*>(m_pWindow));
+ xController = new ListBoxCellController(static_cast<ListBoxControl*>(m_pWindow.get()));
break;
case ::com::sun::star::form::FormComponentType::COMBOBOX:
- xController = new ComboBoxCellController(static_cast<ComboBoxControl*>(m_pWindow));
+ xController = new ComboBoxCellController(static_cast<ComboBoxControl*>(m_pWindow.get()));
break;
default:
if (m_bFilterList)
- xController = new ComboBoxCellController(static_cast<ComboBoxControl*>(m_pWindow));
+ xController = new ComboBoxCellController(static_cast<ComboBoxControl*>(m_pWindow.get()));
else
- xController = new EditCellController(static_cast<Edit*>(m_pWindow));
+ xController = new EditCellController(static_cast<Edit*>(m_pWindow.get()));
}
return xController;
}
@@ -2883,9 +2882,9 @@ bool DbFilterField::commitControl()
return true;
case ::com::sun::star::form::FormComponentType::LISTBOX:
aText.clear();
- if (static_cast<ListBox*>(m_pWindow)->GetSelectEntryCount())
+ if (static_cast<ListBox*>(m_pWindow.get())->GetSelectEntryCount())
{
- sal_Int16 nPos = (sal_Int16)static_cast<ListBox*>(m_pWindow)->GetSelectEntryPos();
+ sal_Int16 nPos = (sal_Int16)static_cast<ListBox*>(m_pWindow.get())->GetSelectEntryPos();
if ( ( nPos >= 0 ) && ( nPos < m_aValueList.getLength() ) )
aText = m_aValueList.getConstArray()[nPos];
}
@@ -2966,16 +2965,16 @@ void DbFilterField::SetText(const OUString& rText)
else
eState = TRISTATE_INDET;
- static_cast<CheckBoxControl*>(m_pWindow)->GetBox().SetState(eState);
- static_cast<CheckBoxControl*>(m_pPainter)->GetBox().SetState(eState);
+ static_cast<CheckBoxControl*>(m_pWindow.get())->GetBox().SetState(eState);
+ static_cast<CheckBoxControl*>(m_pPainter.get())->GetBox().SetState(eState);
} break;
case ::com::sun::star::form::FormComponentType::LISTBOX:
{
Sequence<sal_Int16> aPosSeq = ::comphelper::findValue(m_aValueList, m_aText, true);
if (aPosSeq.getLength())
- static_cast<ListBox*>(m_pWindow)->SelectEntryPos(aPosSeq.getConstArray()[0], true);
+ static_cast<ListBox*>(m_pWindow.get())->SelectEntryPos(aPosSeq.getConstArray()[0], true);
else
- static_cast<ListBox*>(m_pWindow)->SetNoSelection();
+ static_cast<ListBox*>(m_pWindow.get())->SetNoSelection();
} break;
default:
m_pWindow->SetText(m_aText);
@@ -3098,7 +3097,7 @@ void DbFilterField::Update()
// filling the entries for the combobox
for (::std::vector< OUString >::const_iterator iter = aStringList.begin();
iter != aStringList.end(); ++iter)
- static_cast<ComboBox*>(m_pWindow)->InsertEntry(*iter, LISTBOX_APPEND);
+ static_cast<ComboBox*>(m_pWindow.get())->InsertEntry(*iter, LISTBOX_APPEND);
}
}
}
@@ -3118,7 +3117,7 @@ void DbFilterField::UpdateFromField(const Reference< XColumn >& /*_rxField*/, co
IMPL_LINK_NOARG(DbFilterField, OnClick)
{
- TriState eState = static_cast<CheckBoxControl*>(m_pWindow)->GetBox().GetState();
+ TriState eState = static_cast<CheckBoxControl*>(m_pWindow.get())->GetBox().GetState();
OUString aText;
switch (eState)
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 4ac024586375..f8fb4b43dc79 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -87,7 +87,7 @@ using namespace com::sun::star::accessibility;
class RowSetEventListener : public ::cppu::WeakImplHelper1<XRowsChangeListener>
{
- DbGridControl* m_pControl;
+ VclPtr<DbGridControl> m_pControl;
public:
RowSetEventListener(DbGridControl* i_pControl) : m_pControl(i_pControl)
{
@@ -249,10 +249,10 @@ bool CompareBookmark(const Any& aLeft, const Any& aRight)
class FmXGridSourcePropListener : public ::comphelper::OPropertyChangeListener
{
- DbGridControl* m_pParent;
+ VclPtr<DbGridControl> m_pParent;
// a DbGridControl has no mutex, so we use our own as the base class expects one
- osl::Mutex m_aMutex;
+ osl::Mutex m_aMutex;
sal_Int16 m_nSuspended;
public:
@@ -332,72 +332,92 @@ void DbGridControl::NavigationBar::PositionDataSource(sal_Int32 nRecord)
DbGridControl::NavigationBar::NavigationBar(vcl::Window* pParent, WinBits nStyle)
:Control(pParent, nStyle)
- ,m_aRecordText(this, WB_VCENTER)
- ,m_aAbsolute(this, WB_CENTER | WB_VCENTER)
- ,m_aRecordOf(this, WB_VCENTER)
- ,m_aRecordCount(this, WB_VCENTER)
- ,m_aFirstBtn(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS)
- ,m_aPrevBtn(this, WB_REPEAT|WB_RECTSTYLE|WB_NOPOINTERFOCUS)
- ,m_aNextBtn(this, WB_REPEAT|WB_RECTSTYLE|WB_NOPOINTERFOCUS)
- ,m_aLastBtn(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS)
- ,m_aNewBtn(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS)
+ ,m_aRecordText(VclPtr<FixedText>::Create(this, WB_VCENTER))
+ ,m_aAbsolute(VclPtr<DbGridControl::NavigationBar::AbsolutePos>::Create(this, WB_CENTER | WB_VCENTER))
+ ,m_aRecordOf(VclPtr<FixedText>::Create(this, WB_VCENTER))
+ ,m_aRecordCount(VclPtr<FixedText>::Create(this, WB_VCENTER))
+ ,m_aFirstBtn(VclPtr<ImageButton>::Create(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS))
+ ,m_aPrevBtn(VclPtr<ImageButton>::Create(this, WB_REPEAT|WB_RECTSTYLE|WB_NOPOINTERFOCUS))
+ ,m_aNextBtn(VclPtr<ImageButton>::Create(this, WB_REPEAT|WB_RECTSTYLE|WB_NOPOINTERFOCUS))
+ ,m_aLastBtn(VclPtr<ImageButton>::Create(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS))
+ ,m_aNewBtn(VclPtr<ImageButton>::Create(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS))
,m_nDefaultWidth(0)
,m_nCurrentPos(-1)
,m_bPositioning(false)
{
- m_aFirstBtn.SetSymbol(SymbolType::FIRST);
- m_aPrevBtn.SetSymbol(SymbolType::PREV);
- m_aNextBtn.SetSymbol(SymbolType::NEXT);
- m_aLastBtn.SetSymbol(SymbolType::LAST);
- m_aNewBtn.SetModeImage(static_cast<DbGridControl*>(pParent)->GetImage(DbGridControl_Base::NEW));
+ m_aFirstBtn->SetSymbol(SymbolType::FIRST);
+ m_aPrevBtn->SetSymbol(SymbolType::PREV);
+ m_aNextBtn->SetSymbol(SymbolType::NEXT);
+ m_aLastBtn->SetSymbol(SymbolType::LAST);
+ m_aNewBtn->SetModeImage(static_cast<DbGridControl*>(pParent)->GetImage(DbGridControl_Base::NEW));
- m_aFirstBtn.SetHelpId(HID_GRID_TRAVEL_FIRST);
- m_aPrevBtn.SetHelpId(HID_GRID_TRAVEL_PREV);
- m_aNextBtn.SetHelpId(HID_GRID_TRAVEL_NEXT);
- m_aLastBtn.SetHelpId(HID_GRID_TRAVEL_LAST);
- m_aNewBtn.SetHelpId(HID_GRID_TRAVEL_NEW);
- m_aAbsolute.SetHelpId(HID_GRID_TRAVEL_ABSOLUTE);
- m_aRecordCount.SetHelpId(HID_GRID_NUMBEROFRECORDS);
+ m_aFirstBtn->SetHelpId(HID_GRID_TRAVEL_FIRST);
+ m_aPrevBtn->SetHelpId(HID_GRID_TRAVEL_PREV);
+ m_aNextBtn->SetHelpId(HID_GRID_TRAVEL_NEXT);
+ m_aLastBtn->SetHelpId(HID_GRID_TRAVEL_LAST);
+ m_aNewBtn->SetHelpId(HID_GRID_TRAVEL_NEW);
+ m_aAbsolute->SetHelpId(HID_GRID_TRAVEL_ABSOLUTE);
+ m_aRecordCount->SetHelpId(HID_GRID_NUMBEROFRECORDS);
// Handler fuer Buttons einrichten
- m_aFirstBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
- m_aPrevBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
- m_aNextBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
- m_aLastBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
- m_aNewBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aFirstBtn->SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aPrevBtn->SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aNextBtn->SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aLastBtn->SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aNewBtn->SetClickHdl(LINK(this,NavigationBar,OnClick));
- m_aRecordText.SetText(SVX_RESSTR(RID_STR_REC_TEXT));
- m_aRecordOf.SetText(SVX_RESSTR(RID_STR_REC_FROM_TEXT));
- m_aRecordCount.SetText(OUString('?'));
+ m_aRecordText->SetText(SVX_RESSTR(RID_STR_REC_TEXT));
+ m_aRecordOf->SetText(SVX_RESSTR(RID_STR_REC_FROM_TEXT));
+ m_aRecordCount->SetText(OUString('?'));
m_nDefaultWidth = ArrangeControls();
- m_aFirstBtn.Disable();
- m_aPrevBtn.Disable();
- m_aNextBtn.Disable();
- m_aLastBtn.Disable();
- m_aNewBtn.Disable();
- m_aRecordText.Disable();
- m_aRecordOf.Disable();
- m_aRecordCount.Disable();
- m_aAbsolute.Disable();
-
- AllSettings aSettings = m_aNextBtn.GetSettings();
+ m_aFirstBtn->Disable();
+ m_aPrevBtn->Disable();
+ m_aNextBtn->Disable();
+ m_aLastBtn->Disable();
+ m_aNewBtn->Disable();
+ m_aRecordText->Disable();
+ m_aRecordOf->Disable();
+ m_aRecordCount->Disable();
+ m_aAbsolute->Disable();
+
+ AllSettings aSettings = m_aNextBtn->GetSettings();
MouseSettings aMouseSettings = aSettings.GetMouseSettings();
aMouseSettings.SetButtonRepeat(aMouseSettings.GetButtonRepeat() / 4);
aSettings.SetMouseSettings(aMouseSettings);
- m_aNextBtn.SetSettings(aSettings, true);
- m_aPrevBtn.SetSettings(aSettings, true);
+ m_aNextBtn->SetSettings(aSettings, true);
+ m_aPrevBtn->SetSettings(aSettings, true);
- m_aFirstBtn.Show();
- m_aPrevBtn.Show();
- m_aNextBtn.Show();
- m_aLastBtn.Show();
- m_aNewBtn.Show();
- m_aRecordText.Show();
- m_aRecordOf.Show();
- m_aRecordCount.Show();
- m_aAbsolute.Show();
+ m_aFirstBtn->Show();
+ m_aPrevBtn->Show();
+ m_aNextBtn->Show();
+ m_aLastBtn->Show();
+ m_aNewBtn->Show();
+ m_aRecordText->Show();
+ m_aRecordOf->Show();
+ m_aRecordCount->Show();
+ m_aAbsolute->Show();
+}
+
+
+DbGridControl::NavigationBar::~NavigationBar()
+{
+ disposeOnce();
+}
+
+void DbGridControl::NavigationBar::dispose()
+{
+ m_aRecordText.disposeAndClear();
+ m_aAbsolute.disposeAndClear();
+ m_aRecordOf.disposeAndClear();
+ m_aRecordCount.disposeAndClear();
+ m_aFirstBtn.disposeAndClear();
+ m_aPrevBtn.disposeAndClear();
+ m_aNextBtn.disposeAndClear();
+ m_aLastBtn.disposeAndClear();
+ m_aNewBtn.disposeAndClear();
+ Control::dispose();
}
namespace
@@ -422,56 +442,56 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls()
sal_uInt16 nY = 0;
// Is the font of this edit larger than the field?
- if (m_aAbsolute.GetTextHeight() > nH)
+ if (m_aAbsolute->GetTextHeight() > nH)
{
- vcl::Font aApplFont (m_aAbsolute.GetFont());
- const Size pointAbsoluteSize(m_aAbsolute.PixelToLogic( Size( 0, nH - 2 ), MapMode(MAP_POINT) ));
+ vcl::Font aApplFont (m_aAbsolute->GetFont());
+ const Size pointAbsoluteSize(m_aAbsolute->PixelToLogic( Size( 0, nH - 2 ), MapMode(MAP_POINT) ));
aApplFont.SetSize( pointAbsoluteSize );
- m_aAbsolute.SetControlFont( aApplFont );
+ m_aAbsolute->SetControlFont( aApplFont );
aApplFont.SetTransparent( true );
- m_aRecordText.SetControlFont( aApplFont );
- m_aRecordOf.SetControlFont( aApplFont );
- m_aRecordCount.SetControlFont( aApplFont );
+ m_aRecordText->SetControlFont( aApplFont );
+ m_aRecordOf->SetControlFont( aApplFont );
+ m_aRecordCount->SetControlFont( aApplFont );
}
// set size and position of the control
- OUString aText = m_aRecordText.GetText();
- long nTextWidth = m_aRecordText.GetTextWidth(aText);
- m_aRecordText.SetPosPixel(Point(nX,nY));
- m_aRecordText.SetSizePixel(Size(nTextWidth,nH));
+ OUString aText = m_aRecordText->GetText();
+ long nTextWidth = m_aRecordText->GetTextWidth(aText);
+ m_aRecordText->SetPosPixel(Point(nX,nY));
+ m_aRecordText->SetSizePixel(Size(nTextWidth,nH));
nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
// count an extra hairspace (U+200A) left and right
- const OUString sevenDigits(m_aAbsolute.CreateFieldText(6000000));
+ const OUString sevenDigits(m_aAbsolute->CreateFieldText(6000000));
const OUString hairSpace(static_cast<sal_Unicode>(0x200A));
OUString textPattern(hairSpace);
textPattern += sevenDigits;
textPattern += hairSpace;
- nTextWidth = m_aAbsolute.GetTextWidth( textPattern );
- m_aAbsolute.SetPosPixel(Point(nX,nY));
- m_aAbsolute.SetSizePixel(Size(nTextWidth, nH));
+ nTextWidth = m_aAbsolute->GetTextWidth( textPattern );
+ m_aAbsolute->SetPosPixel(Point(nX,nY));
+ m_aAbsolute->SetSizePixel(Size(nTextWidth, nH));
nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
- aText = m_aRecordOf.GetText();
- nTextWidth = m_aRecordOf.GetTextWidth(aText);
- m_aRecordOf.SetPosPixel(Point(nX,nY));
- m_aRecordOf.SetSizePixel(Size(nTextWidth,nH));
+ aText = m_aRecordOf->GetText();
+ nTextWidth = m_aRecordOf->GetTextWidth(aText);
+ m_aRecordOf->SetPosPixel(Point(nX,nY));
+ m_aRecordOf->SetSizePixel(Size(nTextWidth,nH));
nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
textPattern = sevenDigits + " * (" + sevenDigits + ")";
- nTextWidth = m_aRecordCount.GetTextWidth( textPattern );
- m_aRecordCount.SetPosPixel(Point(nX,nY));
- m_aRecordCount.SetSizePixel(Size(nTextWidth,nH));
+ nTextWidth = m_aRecordCount->GetTextWidth( textPattern );
+ m_aRecordCount->SetPosPixel(Point(nX,nY));
+ m_aRecordCount->SetSizePixel(Size(nTextWidth,nH));
nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
Point aButtonPos(nX,nY);
const Size aButtonSize(nH,nH);
- SetPosAndSize(m_aFirstBtn, aButtonPos, aButtonSize);
- SetPosAndSize(m_aPrevBtn, aButtonPos, aButtonSize);
- SetPosAndSize(m_aNextBtn, aButtonPos, aButtonSize);
- SetPosAndSize(m_aLastBtn, aButtonPos, aButtonSize);
- SetPosAndSize(m_aNewBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aFirstBtn.get(), aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aPrevBtn.get(), aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aNextBtn.get(), aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aLastBtn.get(), aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aNewBtn.get(), aButtonPos, aButtonSize);
nX = sal::static_int_cast< sal_uInt16 >(aButtonPos.X() + 1);
@@ -485,15 +505,15 @@ IMPL_LINK(DbGridControl::NavigationBar, OnClick, Button *, pButton )
if (pParent->m_aMasterSlotExecutor.IsSet())
{
long lResult = 0;
- if (pButton == &m_aFirstBtn)
+ if (pButton == m_aFirstBtn.get())
lResult = pParent->m_aMasterSlotExecutor.Call(reinterpret_cast<void*>(RECORD_FIRST));
- else if( pButton == &m_aPrevBtn )
+ else if( pButton == m_aPrevBtn.get() )
lResult = pParent->m_aMasterSlotExecutor.Call(reinterpret_cast<void*>(RECORD_PREV));
- else if( pButton == &m_aNextBtn )
+ else if( pButton == m_aNextBtn.get() )
lResult = pParent->m_aMasterSlotExecutor.Call(reinterpret_cast<void*>(RECORD_NEXT));
- else if( pButton == &m_aLastBtn )
+ else if( pButton == m_aLastBtn.get() )
lResult = pParent->m_aMasterSlotExecutor.Call(reinterpret_cast<void*>(RECORD_LAST));
- else if( pButton == &m_aNewBtn )
+ else if( pButton == m_aNewBtn.get() )
lResult = pParent->m_aMasterSlotExecutor.Call(reinterpret_cast<void*>(RECORD_NEW));
if (lResult)
@@ -501,15 +521,15 @@ IMPL_LINK(DbGridControl::NavigationBar, OnClick, Button *, pButton )
return 0;
}
- if (pButton == &m_aFirstBtn)
+ if (pButton == m_aFirstBtn.get())
pParent->MoveToFirst();
- else if( pButton == &m_aPrevBtn )
+ else if( pButton == m_aPrevBtn.get() )
pParent->MoveToPrev();
- else if( pButton == &m_aNextBtn )
+ else if( pButton == m_aNextBtn.get() )
pParent->MoveToNext();
- else if( pButton == &m_aLastBtn )
+ else if( pButton == m_aLastBtn.get() )
pParent->MoveToLast();
- else if( pButton == &m_aNewBtn )
+ else if( pButton == m_aNewBtn.get() )
pParent->AppendNew();
return 0;
}
@@ -606,60 +626,60 @@ void DbGridControl::NavigationBar::SetState(sal_uInt16 nWhich)
switch (nWhich)
{
case NavigationBar::RECORD_FIRST:
- pWnd = &m_aFirstBtn;
+ pWnd = m_aFirstBtn.get();
break;
case NavigationBar::RECORD_PREV:
- pWnd = &m_aPrevBtn;
+ pWnd = m_aPrevBtn.get();
break;
case NavigationBar::RECORD_NEXT:
- pWnd = &m_aNextBtn;
+ pWnd = m_aNextBtn.get();
break;
case NavigationBar::RECORD_LAST:
- pWnd = &m_aLastBtn;
+ pWnd = m_aLastBtn.get();
break;
case NavigationBar::RECORD_NEW:
- pWnd = &m_aNewBtn;
+ pWnd = m_aNewBtn.get();
break;
case NavigationBar::RECORD_ABSOLUTE:
- pWnd = &m_aAbsolute;
+ pWnd = m_aAbsolute.get();
if (bAvailable)
{
if (pParent->m_nTotalCount >= 0)
{
if (pParent->IsCurrentAppending())
- m_aAbsolute.SetMax(pParent->m_nTotalCount + 1);
+ m_aAbsolute->SetMax(pParent->m_nTotalCount + 1);
else
- m_aAbsolute.SetMax(pParent->m_nTotalCount);
+ m_aAbsolute->SetMax(pParent->m_nTotalCount);
}
else
- m_aAbsolute.SetMax(LONG_MAX);
+ m_aAbsolute->SetMax(LONG_MAX);
- m_aAbsolute.SetValue(m_nCurrentPos + 1);
+ m_aAbsolute->SetValue(m_nCurrentPos + 1);
}
else
- m_aAbsolute.SetText(OUString());
+ m_aAbsolute->SetText(OUString());
break;
case NavigationBar::RECORD_TEXT:
- pWnd = &m_aRecordText;
+ pWnd = m_aRecordText.get();
break;
case NavigationBar::RECORD_OF:
- pWnd = &m_aRecordOf;
+ pWnd = m_aRecordOf.get();
break;
case NavigationBar::RECORD_COUNT:
{
- pWnd = &m_aRecordCount;
+ pWnd = m_aRecordCount.get();
OUString aText;
if (bAvailable)
{
if (pParent->GetOptions() & DbGridControl::OPT_INSERT)
{
if (pParent->IsCurrentAppending() && !pParent->IsModified())
- aText = m_aAbsolute.CreateFieldText(pParent->GetRowCount());
+ aText = m_aAbsolute->CreateFieldText(pParent->GetRowCount());
else
- aText = m_aAbsolute.CreateFieldText(pParent->GetRowCount() - 1);
+ aText = m_aAbsolute->CreateFieldText(pParent->GetRowCount() - 1);
}
else
- aText = m_aAbsolute.CreateFieldText(pParent->GetRowCount());
+ aText = m_aAbsolute->CreateFieldText(pParent->GetRowCount());
if(!pParent->m_bRecordCountFinal)
aText += " *";
}
@@ -671,7 +691,7 @@ void DbGridControl::NavigationBar::SetState(sal_uInt16 nWhich)
{
OUString aExtendedInfo(aText);
aExtendedInfo += " (";
- aExtendedInfo += m_aAbsolute.CreateFieldText(pParent->GetSelectRowCount());
+ aExtendedInfo += m_aAbsolute->CreateFieldText(pParent->GetSelectRowCount());
aExtendedInfo += ")";
pWnd->SetText(aExtendedInfo);
}
@@ -699,8 +719,8 @@ void DbGridControl::NavigationBar::Resize()
void DbGridControl::NavigationBar::Paint(const Rectangle& rRect)
{
Control::Paint(rRect);
- Point aAbsolutePos = m_aAbsolute.GetPosPixel();
- Size aAbsoluteSize = m_aAbsolute.GetSizePixel();
+ Point aAbsolutePos = m_aAbsolute->GetPosPixel();
+ Size aAbsoluteSize = m_aAbsolute->GetSizePixel();
DrawLine(Point(aAbsolutePos.X() - 1, 0 ),
Point(aAbsolutePos.X() - 1, aAbsolutePos.Y() + aAbsoluteSize.Height()));
@@ -713,15 +733,15 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
{
Control::StateChanged( nType );
- vcl::Window* pWindows[] = { &m_aRecordText,
- &m_aAbsolute,
- &m_aRecordOf,
- &m_aRecordCount,
- &m_aFirstBtn,
- &m_aPrevBtn,
- &m_aNextBtn,
- &m_aLastBtn,
- &m_aNewBtn
+ vcl::Window* pWindows[] = { m_aRecordText.get(),
+ m_aAbsolute.get(),
+ m_aRecordOf.get(),
+ m_aRecordCount.get(),
+ m_aFirstBtn.get(),
+ m_aPrevBtn.get(),
+ m_aNextBtn.get(),
+ m_aLastBtn.get(),
+ m_aNewBtn.get()
};
switch ( nType )
@@ -867,7 +887,7 @@ DbGridControl::DbGridControl(
WinBits nBits)
:DbGridControl_Base(pParent, EditBrowseBoxFlags::NONE, nBits, DEFAULT_BROWSE_MODE )
,m_xContext(_rxContext)
- ,m_aBar(this)
+ ,m_aBar(VclPtr<DbGridControl::NavigationBar>::Create(this))
,m_nAsynAdjustEvent(0)
,m_pDataSourcePropMultiplexer(NULL)
,m_pDataSourcePropListener(NULL)
@@ -902,8 +922,8 @@ DbGridControl::DbGridControl(
{
OUString sName(SVX_RESSTR(RID_STR_NAVIGATIONBAR));
- m_aBar.SetAccessibleName(sName);
- m_aBar.Show();
+ m_aBar->SetAccessibleName(sName);
+ m_aBar->Show();
ImplInitWindow( InitAll );
}
@@ -930,9 +950,15 @@ void DbGridControl::Init()
DbGridControl::~DbGridControl()
{
- RemoveColumns();
+ disposeOnce();
+}
+void DbGridControl::dispose()
+{
+ if (!IsDisposed())
{
+ RemoveColumns();
+
m_bWantDestruction = true;
osl::MutexGuard aGuard(m_aDestructionSafety);
if (m_pFieldListeners)
@@ -958,8 +984,13 @@ DbGridControl::~DbGridControl()
m_xRowSetListener.clear();
delete m_pDataCursor;
+ m_pDataCursor = NULL;
delete m_pSeekCursor;
+ m_pSeekCursor = NULL;
+
+ m_aBar.disposeAndClear();
+ DbGridControl_Base::dispose();
}
void DbGridControl::StateChanged( StateChangedType nType )
@@ -1016,7 +1047,7 @@ void DbGridControl::Select()
DbGridControl_Base::Select();
// as the selected rows may have changed, update the according display in our navigation bar
- m_aBar.InvalidateState(NavigationBar::RECORD_COUNT);
+ m_aBar->InvalidateState(NavigationBar::RECORD_COUNT);
if (m_pGridListener)
m_pGridListener->selectionChanged();
@@ -1035,7 +1066,7 @@ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat )
{
if ( m_bNavigationBar )
{
- m_aBar.EnableRTL( IsRTLEnabled() );
+ m_aBar->EnableRTL( IsRTLEnabled() );
}
}
@@ -1043,13 +1074,13 @@ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat )
{
if ( m_bNavigationBar )
{
- vcl::Font aFont = m_aBar.GetSettings().GetStyleSettings().GetFieldFont();
+ vcl::Font aFont = m_aBar->GetSettings().GetStyleSettings().GetFieldFont();
if ( IsControlFont() )
- m_aBar.SetControlFont( GetControlFont() );
+ m_aBar->SetControlFont( GetControlFont() );
else
- m_aBar.SetControlFont();
+ m_aBar->SetControlFont();
- m_aBar.SetZoom( GetZoom() );
+ m_aBar->SetZoom( GetZoom() );
}
}
@@ -1108,7 +1139,7 @@ void DbGridControl::RemoveRows()
// reset number of sentences to zero in the browser
DbGridControl_Base::RemoveRows();
- m_aBar.InvalidateAll(m_nCurrentPos, true);
+ m_aBar->InvalidateAll(m_nCurrentPos, true);
}
void DbGridControl::ArrangeControls(sal_uInt16& nX, sal_uInt16 nY)
@@ -1116,9 +1147,9 @@ void DbGridControl::ArrangeControls(sal_uInt16& nX, sal_uInt16 nY)
// positioning of the controls
if (m_bNavigationBar)
{
- nX = m_aBar.GetDefaultWidth();
+ nX = m_aBar->GetDefaultWidth();
Rectangle aRect(GetControlArea());
- m_aBar.SetPosSizePixel(Point(0,nY + 1), Size(nX, aRect.GetSize().Height() - 1));
+ m_aBar->SetPosSizePixel(Point(0,nY + 1), Size(nX, aRect.GetSize().Height() - 1));
}
}
@@ -1176,9 +1207,9 @@ void DbGridControl::EnableNavigationBar(bool bEnable)
if (bEnable)
{
- m_aBar.Show();
- m_aBar.Enable();
- m_aBar.InvalidateAll(m_nCurrentPos, true);
+ m_aBar->Show();
+ m_aBar->Enable();
+ m_aBar->InvalidateAll(m_nCurrentPos, true);
if ( adjustModeForScrollbars( m_nMode, m_bNavigationBar, m_bHideScrollbars ) )
SetMode( m_nMode );
@@ -1192,8 +1223,8 @@ void DbGridControl::EnableNavigationBar(bool bEnable)
}
else
{
- m_aBar.Hide();
- m_aBar.Disable();
+ m_aBar->Hide();
+ m_aBar->Disable();
if ( adjustModeForScrollbars( m_nMode, m_bNavigationBar, m_bHideScrollbars ) )
SetMode( m_nMode );
@@ -1559,7 +1590,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt
if (!IsResizing() && GetRowCount())
RecalcRows(GetTopRow(), GetVisibleRows(), true);
- m_aBar.InvalidateAll(m_nCurrentPos, true);
+ m_aBar->InvalidateAll(m_nCurrentPos, true);
SetUpdateMode(true);
// start listening on the seek cursor
@@ -1845,7 +1876,7 @@ void DbGridControl::RowInserted(long nRow, long nNumRows, bool bDoPaint, bool bK
m_nTotalCount += nNumRows;
DbGridControl_Base::RowInserted(nRow, nNumRows, bDoPaint, bKeepSelection);
- m_aBar.InvalidateState(NavigationBar::RECORD_COUNT);
+ m_aBar->InvalidateState(NavigationBar::RECORD_COUNT);
}
}
@@ -1864,7 +1895,7 @@ void DbGridControl::RowRemoved(long nRow, long nNumRows, bool bDoPaint)
m_nTotalCount -= nNumRows;
DbGridControl_Base::RowRemoved(nRow, nNumRows, bDoPaint);
- m_aBar.InvalidateState(NavigationBar::RECORD_COUNT);
+ m_aBar->InvalidateState(NavigationBar::RECORD_COUNT);
}
}
@@ -1915,7 +1946,7 @@ void DbGridControl::AdjustRows()
GoToRowColumnId(nNewPos, GetColumnId(GetCurColumnId()));
if (!IsResizing() && GetRowCount())
RecalcRows(GetTopRow(), GetVisibleRows(), true);
- m_aBar.InvalidateAll(m_nCurrentPos, true);
+ m_aBar->InvalidateAll(m_nCurrentPos, true);
}
else // too few
RowInserted(GetRowCount(), -nDelta, true);
@@ -1928,7 +1959,7 @@ void DbGridControl::AdjustRows()
else
m_nTotalCount = GetRowCount();
}
- m_aBar.InvalidateState(NavigationBar::RECORD_COUNT);
+ m_aBar->InvalidateState(NavigationBar::RECORD_COUNT);
}
DbGridControl_Base::RowStatus DbGridControl::GetRowStatus(long nRow) const
@@ -2095,7 +2126,7 @@ void DbGridControl::CursorMoved()
}
DbGridControl_Base::CursorMoved();
- m_aBar.InvalidateAll(m_nCurrentPos);
+ m_aBar->InvalidateAll(m_nCurrentPos);
// select the new column when they moved
if ( IsDesignMode() && GetSelectedColumnCount() > 0 && GetCurColumnId() )
@@ -2202,7 +2233,7 @@ void DbGridControl::AdjustDataSource(bool bFull)
// if the data cursor was moved from outside, this section is voided
SetNoSelection();
- m_aBar.InvalidateAll(m_nCurrentPos, m_xCurrentRow.Is());
+ m_aBar->InvalidateAll(m_nCurrentPos, m_xCurrentRow.Is());
}
sal_Int32 DbGridControl::AlignSeekCursor()
@@ -2495,7 +2526,7 @@ void DbGridControl::MoveToPosition(sal_uInt32 nPos)
}
}
DbGridControl_Base::GoToRow(nPos);
- m_aBar.InvalidateAll(m_nCurrentPos);
+ m_aBar->InvalidateAll(m_nCurrentPos);
}
void DbGridControl::AppendNew()
@@ -2550,7 +2581,7 @@ void DbGridControl::SetDesignMode(bool bMode)
GetDataWindow().SetMouseTransparent(bMode);
SetMouseTransparent(bMode);
- m_aBar.InvalidateAll(m_nCurrentPos, true);
+ m_aBar->InvalidateAll(m_nCurrentPos, true);
}
}
@@ -2685,7 +2716,7 @@ void DbGridControl::DataSourcePropertyChanged(const PropertyChangeEvent& evt) th
{
RowInserted(GetRowCount(), 1, true);
InvalidateStatusCell(m_nCurrentPos);
- m_aBar.InvalidateAll(m_nCurrentPos);
+ m_aBar->InvalidateAll(m_nCurrentPos);
}
}
else
@@ -2697,7 +2728,7 @@ void DbGridControl::DataSourcePropertyChanged(const PropertyChangeEvent& evt) th
{
RowRemoved(GetRowCount() - 1, 1, true);
InvalidateStatusCell(m_nCurrentPos);
- m_aBar.InvalidateAll(m_nCurrentPos);
+ m_aBar->InvalidateAll(m_nCurrentPos);
}
}
}
@@ -2906,7 +2937,7 @@ void DbGridControl::CellModified()
// increment RowCount
RowInserted(GetRowCount(), 1, true);
InvalidateStatusCell(m_nCurrentPos);
- m_aBar.InvalidateAll(m_nCurrentPos);
+ m_aBar->InvalidateAll(m_nCurrentPos);
}
}
else if (m_xCurrentRow->GetStatus() != GRS_MODIFIED)
@@ -2989,7 +3020,7 @@ void DbGridControl::Undo()
{ // maybe we already removed it (in resetCurrentRow, called if the above moveToInsertRow
// caused our data source form to be reset - which should be the usual case ....)
RowRemoved(GetRowCount() - 1, 1, true);
- m_aBar.InvalidateAll(m_nCurrentPos);
+ m_aBar->InvalidateAll(m_nCurrentPos);
}
RowModified(m_nCurrentPos);
@@ -3016,7 +3047,7 @@ void DbGridControl::resetCurrentRow()
if (m_nCurrentPos == GetRowCount() - 2)
{
RowRemoved(GetRowCount() - 1, 1, true);
- m_aBar.InvalidateAll(m_nCurrentPos);
+ m_aBar->InvalidateAll(m_nCurrentPos);
}
}
}
@@ -3183,7 +3214,7 @@ bool DbGridControl::SaveRow()
bool DbGridControl::PreNotify(NotifyEvent& rEvt)
{
// do not handle events of the Navbar
- if (m_aBar.IsWindowOrChild(rEvt.GetWindow()))
+ if (m_aBar->IsWindowOrChild(rEvt.GetWindow()))
return BrowseBox::PreNotify(rEvt);
switch (rEvt.GetType())
@@ -3600,7 +3631,7 @@ Reference<XAccessible > DbGridControl::CreateAccessibleControl( sal_Int32 _nInde
Reference<XAccessible > xRet;
if ( _nIndex == DbGridControl_Base::GetAccessibleControlCount() )
{
- xRet = m_aBar.GetAccessible();
+ xRet = m_aBar->GetAccessible();
}
else
xRet = DbGridControl_Base::CreateAccessibleControl( _nIndex );
diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx
index 8e32e9ce7cb4..b7069a27b317 100644
--- a/svx/source/form/databaselocationinput.cxx
+++ b/svx/source/form/databaselocationinput.cxx
@@ -128,8 +128,8 @@ namespace svx
{
if ( ::utl::UCBContentHelper::Exists( sURL ) )
{
- QueryBox aBox( m_rLocationInput.GetSystemWindow(), WB_YES_NO, SVX_RESSTR(RID_STR_ALREADYEXISTOVERWRITE) );
- if ( aBox.Execute() != RET_YES )
+ ScopedVclPtrInstance< QueryBox > aBox( m_rLocationInput.GetSystemWindow(), WB_YES_NO, SVX_RESSTR(RID_STR_ALREADYEXISTOVERWRITE) );
+ if ( aBox->Execute() != RET_YES )
return false;
}
}
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 6c63be19590a..75e63f556b4d 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -142,7 +142,14 @@ namespace svxform
DataTreeListBox::~DataTreeListBox()
{
+ disposeOnce();
+ }
+
+ void DataTreeListBox::dispose()
+ {
DeleteAndClear();
+ m_pXFormsPage.clear();
+ SvTreeListBox::dispose();
}
sal_Int8 DataTreeListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
@@ -370,6 +377,15 @@ namespace svxform
XFormsPage::~XFormsPage()
{
+ disposeOnce();
+ }
+
+ void XFormsPage::dispose()
+ {
+ m_pToolBox.clear();
+ m_pItemList.clear();
+ m_pNaviWin.clear();
+ TabPage::dispose();
}
IMPL_LINK_NOARG(XFormsPage, TbxSelectHdl)
@@ -467,12 +483,12 @@ namespace svxform
DBG_ASSERT( xModel.is(), "XFormsPage::DoToolBoxAction(): Action without model" );
if ( DGTSubmission == m_eGroup )
{
- AddSubmissionDialog aDlg( this, NULL, m_xUIHelper );
- if ( aDlg.Execute() == RET_OK && aDlg.GetNewSubmission().is() )
+ ScopedVclPtrInstance< AddSubmissionDialog > aDlg( this, nullptr, m_xUIHelper );
+ if ( aDlg->Execute() == RET_OK && aDlg->GetNewSubmission().is() )
{
try
{
- Reference< css::xforms::XSubmission > xNewSubmission = aDlg.GetNewSubmission();
+ Reference< css::xforms::XSubmission > xNewSubmission = aDlg->GetNewSubmission();
Reference< XSet > xSubmissions( xModel->getSubmissions(), UNO_QUERY );
xSubmissions->insert( makeAny( xNewSubmission ) );
Reference< XPropertySet > xNewPropSet( xNewSubmission, UNO_QUERY );
@@ -499,8 +515,8 @@ namespace svxform
{
if ( !m_sInstanceURL.isEmpty() )
{
- LinkedInstanceWarningBox aMsgBox( this );
- if ( aMsgBox.Execute() != RET_OK )
+ ScopedVclPtrInstance< LinkedInstanceWarningBox > aMsgBox( this );
+ if ( aMsgBox->Execute() != RET_OK )
return bHandled;
}
@@ -594,10 +610,10 @@ namespace svxform
}
}
- AddDataItemDialog aDlg( this, pNode, m_xUIHelper );
- aDlg.SetText( SVX_RESSTR( nResId ) );
- aDlg.InitText( eType );
- short nReturn = aDlg.Execute();
+ ScopedVclPtrInstance< AddDataItemDialog > aDlg( this, pNode, m_xUIHelper );
+ aDlg->SetText( SVX_RESSTR( nResId ) );
+ aDlg->InitText( eType );
+ short nReturn = aDlg->Execute();
if ( DGTInstance == m_eGroup )
{
if ( RET_OK == nReturn )
@@ -662,12 +678,12 @@ namespace svxform
{
if ( DGTInstance == m_eGroup && !m_sInstanceURL.isEmpty() )
{
- LinkedInstanceWarningBox aMsgBox( this );
- if ( aMsgBox.Execute() != RET_OK )
+ ScopedVclPtrInstance< LinkedInstanceWarningBox > aMsgBox( this );
+ if ( aMsgBox->Execute() != RET_OK )
return bHandled;
}
- AddDataItemDialog aDlg( this, pNode, m_xUIHelper );
+ ScopedVclPtrInstance< AddDataItemDialog > aDlg( this, pNode, m_xUIHelper );
DataItemType eType = DITElement;
sal_uInt16 nResId = RID_STR_DATANAV_EDIT_ELEMENT;
if ( pNode && pNode->m_xNode.is() )
@@ -691,9 +707,9 @@ namespace svxform
nResId = RID_STR_DATANAV_EDIT_BINDING;
eType = DITBinding;
}
- aDlg.SetText( SVX_RESSTR( nResId ) );
- aDlg.InitText( eType );
- if ( aDlg.Execute() == RET_OK )
+ aDlg->SetText( SVX_RESSTR( nResId ) );
+ aDlg->InitText( eType );
+ if ( aDlg->Execute() == RET_OK )
{
// Set the new name
OUString sNewName;
@@ -733,9 +749,9 @@ namespace svxform
}
else
{
- AddSubmissionDialog aDlg( this, pNode, m_xUIHelper );
- aDlg.SetText( SVX_RESSTR( RID_STR_DATANAV_EDIT_SUBMISSION ) );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< AddSubmissionDialog > aDlg( this, pNode, m_xUIHelper );
+ aDlg->SetText( SVX_RESSTR( RID_STR_DATANAV_EDIT_SUBMISSION ) );
+ if ( aDlg->Execute() == RET_OK )
{
EditEntry( pNode->m_xPropSet );
bIsDocModified = true;
@@ -748,8 +764,8 @@ namespace svxform
bHandled = true;
if ( DGTInstance == m_eGroup && !m_sInstanceURL.isEmpty() )
{
- LinkedInstanceWarningBox aMsgBox( this );
- if ( aMsgBox.Execute() != RET_OK )
+ ScopedVclPtrInstance< LinkedInstanceWarningBox > aMsgBox( this );
+ if ( aMsgBox->Execute() != RET_OK )
return bHandled;
}
bIsDocModified = RemoveEntry();
@@ -940,12 +956,12 @@ namespace svxform
bool bIsElement = ( eChildType == css::xml::dom::NodeType_ELEMENT_NODE );
sal_uInt16 nResId = bIsElement ? RID_STR_QRY_REMOVE_ELEMENT : RID_STR_QRY_REMOVE_ATTRIBUTE;
OUString sVar = bIsElement ? OUString(ELEMENTNAME) : OUString(ATTRIBUTENAME);
- MessageDialog aQBox(this, SVX_RES(nResId), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- OUString sMessText = aQBox.get_primary_text();
+ ScopedVclPtrInstance< MessageDialog > aQBox(this, SVX_RES(nResId), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ OUString sMessText = aQBox->get_primary_text();
sMessText = sMessText.replaceFirst(
sVar, m_xUIHelper->getNodeDisplayName( pNode->m_xNode, sal_False ) );
- aQBox.set_primary_text(sMessText);
- if ( aQBox.Execute() == RET_YES )
+ aQBox->set_primary_text(sMessText);
+ if ( aQBox->Execute() == RET_YES )
{
SvTreeListEntry* pParent = m_pItemList->GetParent( pEntry );
DBG_ASSERT( pParent, "XFormsPage::RemoveEntry(): no parent entry" );
@@ -982,12 +998,12 @@ namespace svxform
{
SAL_WARN( "svx.form", "XFormsPage::RemoveEntry(): exception caught" );
}
- MessageDialog aQBox(this, SVX_RES(nResId),
- VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- OUString sMessText = aQBox.get_primary_text();
+ ScopedVclPtrInstance<MessageDialog> aQBox(this, SVX_RES(nResId),
+ VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ OUString sMessText = aQBox->get_primary_text();
sMessText = sMessText.replaceFirst( sSearch, sName);
- aQBox.set_primary_text(sMessText);
- if ( aQBox.Execute() == RET_YES )
+ aQBox->set_primary_text(sMessText);
+ if ( aQBox->Execute() == RET_YES )
{
try
{
@@ -1405,24 +1421,37 @@ namespace svxform
DataNavigatorWindow::~DataNavigatorWindow()
{
+ disposeOnce();
+ }
+
+ void DataNavigatorWindow::dispose()
+ {
SvtViewOptions aViewOpt( E_TABDIALOG, CFGNAME_DATANAVIGATOR );
aViewOpt.SetPageID( static_cast< sal_Int32 >( m_pTabCtrl->GetCurPageId() ) );
Any aAny;
aAny <<= m_bShowDetails;
aViewOpt.SetUserItem(CFGNAME_SHOWDETAILS,aAny);
- delete m_pInstPage;
- delete m_pSubmissionPage;
- delete m_pBindingPage;
+ m_pInstPage.disposeAndClear();
+ m_pSubmissionPage.disposeAndClear();
+ m_pBindingPage.disposeAndClear();
sal_Int32 i, nCount = m_aPageList.size();
for ( i = 0; i < nCount; ++i )
- delete m_aPageList[i];
+ m_aPageList[i].disposeAndClear();
+ m_aPageList.clear();
+
Reference< XFrameActionListener > xListener(
static_cast< XFrameActionListener* >( m_xDataListener.get() ), UNO_QUERY );
m_xFrame->removeFrameActionListener( xListener );
RemoveBroadcaster();
m_xDataListener.clear();
+ disposeBuilder();
+ m_pModelsBox.clear();
+ m_pModelBtn.clear();
+ m_pTabCtrl.clear();
+ m_pInstanceBtn.clear();
+ vcl::Window::dispose();
}
@@ -1467,22 +1496,22 @@ namespace svxform
OString sIdent(pBtn->GetCurItemIdent());
if (sIdent == "modelsadd")
{
- AddModelDialog aDlg( this, false );
+ ScopedVclPtrInstance< AddModelDialog > aDlg( this, false );
bool bShowDialog = true;
while ( bShowDialog )
{
bShowDialog = false;
- if ( aDlg.Execute() == RET_OK )
+ if ( aDlg->Execute() == RET_OK )
{
- OUString sNewName = aDlg.GetName();
- bool bDocumentData = aDlg.GetModifyDoc();
+ OUString sNewName = aDlg->GetName();
+ bool bDocumentData = aDlg->GetModifyDoc();
if ( m_pModelsBox->GetEntryPos( sNewName ) != LISTBOX_ENTRY_NOTFOUND )
{
// error: model name already exists
- MessageDialog aErrBox( this, SVX_RES( RID_STR_DOUBLE_MODELNAME ) );
- aErrBox.set_primary_text(aErrBox.get_primary_text().replaceFirst(MSG_VARIABLE, sNewName));
- aErrBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrBox( this, SVX_RES( RID_STR_DOUBLE_MODELNAME ) );
+ aErrBox->set_primary_text(aErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sNewName));
+ aErrBox->Execute();
bShowDialog = true;
}
else
@@ -1513,8 +1542,8 @@ namespace svxform
}
else if (sIdent == "modelsedit")
{
- AddModelDialog aDlg( this, true );
- aDlg.SetName( sSelectedModel );
+ ScopedVclPtrInstance< AddModelDialog > aDlg( this, true );
+ aDlg->SetName( sSelectedModel );
bool bDocumentData( false );
try
@@ -1531,13 +1560,13 @@ namespace svxform
{
DBG_UNHANDLED_EXCEPTION();
}
- aDlg.SetModifyDoc( bDocumentData );
+ aDlg->SetModifyDoc( bDocumentData );
- if ( aDlg.Execute() == RET_OK )
+ if ( aDlg->Execute() == RET_OK )
{
- if ( aDlg.GetModifyDoc() != bool( bDocumentData ) )
+ if ( aDlg->GetModifyDoc() != bool( bDocumentData ) )
{
- bDocumentData = aDlg.GetModifyDoc();
+ bDocumentData = aDlg->GetModifyDoc();
try
{
Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY_THROW );
@@ -1554,7 +1583,7 @@ namespace svxform
}
}
- OUString sNewName = aDlg.GetName();
+ OUString sNewName = aDlg->GetName();
if ( !sNewName.isEmpty() && ( sNewName != sSelectedModel ) )
{
try
@@ -1575,12 +1604,12 @@ namespace svxform
}
else if (sIdent == "modelsremove")
{
- MessageDialog aQBox(this, SVX_RES( RID_STR_QRY_REMOVE_MODEL),
+ ScopedVclPtrInstance<MessageDialog> aQBox(this, SVX_RES( RID_STR_QRY_REMOVE_MODEL),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- OUString sText = aQBox.get_primary_text();
+ OUString sText = aQBox->get_primary_text();
sText = sText.replaceFirst( MODELNAME, sSelectedModel );
- aQBox.set_primary_text(sText);
- if ( aQBox.Execute() == RET_YES )
+ aQBox->set_primary_text(sText);
+ if ( aQBox->Execute() == RET_YES )
{
try
{
@@ -1608,13 +1637,13 @@ namespace svxform
OString sIdent(pBtn->GetCurItemIdent());
if (sIdent == "instancesadd")
{
- AddInstanceDialog aDlg( this, false );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< AddInstanceDialog > aDlg( this, false );
+ if ( aDlg->Execute() == RET_OK )
{
sal_uInt16 nInst = GetNewPageId();
- OUString sName = aDlg.GetName();
- OUString sURL = aDlg.GetURL();
- bool bLinkOnce = aDlg.IsLinkInstance();
+ OUString sName = aDlg->GetName();
+ OUString sURL = aDlg->GetURL();
+ bool bLinkOnce = aDlg->IsLinkInstance();
try
{
Reference< css::xml::dom::XDocument > xNewInst =
@@ -1640,16 +1669,16 @@ namespace svxform
XFormsPage* pPage = GetCurrentPage( nId );
if ( pPage )
{
- AddInstanceDialog aDlg( this, true );
- aDlg.SetName( pPage->GetInstanceName() );
- aDlg.SetURL( pPage->GetInstanceURL() );
- aDlg.SetLinkInstance( pPage->GetLinkOnce() );
- OUString sOldName = aDlg.GetName();
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< AddInstanceDialog > aDlg( this, true );
+ aDlg->SetName( pPage->GetInstanceName() );
+ aDlg->SetURL( pPage->GetInstanceURL() );
+ aDlg->SetLinkInstance( pPage->GetLinkOnce() );
+ OUString sOldName = aDlg->GetName();
+ if ( aDlg->Execute() == RET_OK )
{
- OUString sNewName = aDlg.GetName();
- OUString sURL = aDlg.GetURL();
- bool bLinkOnce = aDlg.IsLinkInstance();
+ OUString sNewName = aDlg->GetName();
+ OUString sURL = aDlg->GetURL();
+ bool bLinkOnce = aDlg->IsLinkInstance();
try
{
xUIHelper->renameInstance( sOldName,
@@ -1672,16 +1701,16 @@ namespace svxform
else if (sIdent == "instancesremove")
{
sal_uInt16 nId = 0;
- XFormsPage* pPage = GetCurrentPage( nId );
+ VclPtr<XFormsPage> pPage = GetCurrentPage( nId );
if ( pPage )
{
OUString sInstName = pPage->GetInstanceName();
- MessageDialog aQBox(this, SVX_RES(RID_STR_QRY_REMOVE_INSTANCE),
- VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- OUString sMessText = aQBox.get_primary_text();
+ ScopedVclPtrInstance<MessageDialog> aQBox(this, SVX_RES(RID_STR_QRY_REMOVE_INSTANCE),
+ VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ OUString sMessText = aQBox->get_primary_text();
sMessText = sMessText.replaceFirst( INSTANCENAME, sInstName );
- aQBox.set_primary_text(sMessText);
- if ( aQBox.Execute() == RET_YES )
+ aQBox->set_primary_text(sMessText);
+ if ( aQBox->Execute() == RET_YES )
{
bool bDoRemove = false;
if (IsAdditionalPage(nId))
@@ -1692,13 +1721,13 @@ namespace svxform
if ( aFoundPage != aPageListEnd )
{
m_aPageList.erase( aFoundPage );
- delete pPage;
+ pPage.disposeAndClear() ;
bDoRemove = true;
}
}
else
{
- DELETEZ( m_pInstPage );
+ m_pInstPage.disposeAndClear();
bDoRemove = true;
}
@@ -1802,19 +1831,19 @@ namespace svxform
if (sName == "submissions")
{
if ( !m_pSubmissionPage )
- m_pSubmissionPage = new XFormsPage(m_pTabCtrl, this, DGTSubmission);
+ m_pSubmissionPage = VclPtr<XFormsPage>::Create(m_pTabCtrl, this, DGTSubmission);
pPage = m_pSubmissionPage;
}
else if (sName == "bindings")
{
if ( !m_pBindingPage )
- m_pBindingPage = new XFormsPage(m_pTabCtrl, this, DGTBinding);
+ m_pBindingPage = VclPtr<XFormsPage>::Create(m_pTabCtrl, this, DGTBinding);
pPage = m_pBindingPage;
}
else if (sName == "instance")
{
if ( !m_pInstPage )
- m_pInstPage = new XFormsPage(m_pTabCtrl, this, DGTInstance);
+ m_pInstPage = VclPtr<XFormsPage>::Create(m_pTabCtrl, this, DGTInstance);
pPage = m_pInstPage;
}
else
@@ -1826,7 +1855,7 @@ namespace svxform
pPage = m_aPageList[nPos];
else
{
- pPage = new XFormsPage(m_pTabCtrl, this, DGTInstance);
+ pPage = VclPtr<XFormsPage>::Create(m_pTabCtrl, this, DGTInstance);
m_aPageList.push_back( pPage );
}
}
@@ -1984,10 +2013,10 @@ namespace svxform
sal_Int32 i, nCount = m_aPageList.size();
for ( i = 0; i < nCount; ++i )
{
- XFormsPage* pPage = m_aPageList[i];
+ VclPtr<XFormsPage> pPage = m_aPageList[i];
pPage->ClearModel();
if ( bClearPages )
- delete pPage;
+ pPage.disposeAndClear();
}
if ( bClearPages )
@@ -2131,24 +2160,30 @@ namespace svxform
WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_ROLLABLE|WB_3DLOOK|WB_DOCKABLE) ),
SfxControllerItem( SID_FM_DATANAVIGATOR_CONTROL, *_pBindings ),
- m_aDataWin( this, _pBindings )
+ m_aDataWin( VclPtr<DataNavigatorWindow>::Create(this, _pBindings) )
{
SetText( SVX_RES( RID_STR_DATANAVIGATOR ) );
- Size aSize = m_aDataWin.GetOutputSizePixel();
+ Size aSize = m_aDataWin->GetOutputSizePixel();
Size aLogSize = PixelToLogic( aSize, MAP_APPFONT );
SfxDockingWindow::SetFloatingSize( aLogSize );
- m_aDataWin.Show();
+ m_aDataWin->Show();
}
DataNavigator::~DataNavigator()
{
+ disposeOnce();
}
+ void DataNavigator::dispose()
+ {
+ m_aDataWin.disposeAndClear();
+ SfxDockingWindow::dispose();
+ }
void DataNavigator::StateChanged( sal_uInt16 , SfxItemState , const SfxPoolItem* )
{
@@ -2203,7 +2238,7 @@ namespace svxform
Point aExplPos = LogicToPixel( Point(1,1), MAP_APPFONT );
Size aExplSize = LogicToPixel( aLogExplSize, MAP_APPFONT );
- m_aDataWin.SetPosSizePixel( aExplPos, aExplSize );
+ m_aDataWin->SetPosSizePixel( aExplPos, aExplSize );
}
@@ -2221,10 +2256,10 @@ namespace svxform
SfxChildWindow( _pParent, _nId )
{
- pWindow = new DataNavigator( _pBindings, this, _pParent );
+ pWindow = VclPtr<DataNavigator>::Create( _pBindings, this, _pParent );
eChildAlignment = SfxChildAlignment::RIGHT;
pWindow->SetSizePixel( Size( 250, 400 ) );
- static_cast<SfxDockingWindow*>(pWindow)->Initialize( _pInfo );
+ static_cast<SfxDockingWindow*>(pWindow.get())->Initialize( _pInfo );
}
AddDataItemDialog::AddDataItemDialog(vcl::Window* pParent, ItemNode* _pNode,
@@ -2269,6 +2304,11 @@ namespace svxform
AddDataItemDialog::~AddDataItemDialog()
{
+ disposeOnce();
+ }
+
+ void AddDataItemDialog::dispose()
+ {
if ( m_xTempBinding.is() )
{
Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
@@ -2291,6 +2331,27 @@ namespace svxform
// remove binding, if it does not convey 'useful' information
m_xUIHelper->removeBindingIfUseless( m_xBinding );
}
+ m_pItemFrame.clear();
+ m_pNameFT.clear();
+ m_pNameED.clear();
+ m_pDefaultFT.clear();
+ m_pDefaultED.clear();
+ m_pDefaultBtn.clear();
+ m_pSettingsFrame.clear();
+ m_pDataTypeFT.clear();
+ m_pDataTypeLB.clear();
+ m_pRequiredCB.clear();
+ m_pRequiredBtn.clear();
+ m_pRelevantCB.clear();
+ m_pRelevantBtn.clear();
+ m_pConstraintCB.clear();
+ m_pConstraintBtn.clear();
+ m_pReadonlyCB.clear();
+ m_pReadonlyBtn.clear();
+ m_pCalculateCB.clear();
+ m_pCalculateBtn.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
}
@@ -2344,7 +2405,7 @@ namespace svxform
sPropName = PN_READONLY_EXPR;
else if (m_pCalculateBtn == pBtn)
sPropName = PN_CALCULATE_EXPR;
- AddConditionDialog aDlg( this, sPropName, m_xTempBinding );
+ ScopedVclPtrInstance< AddConditionDialog > aDlg(this, sPropName, m_xTempBinding);
bool bIsDefBtn = ( m_pDefaultBtn == pBtn );
OUString sCondition;
if ( bIsDefBtn )
@@ -2356,11 +2417,11 @@ namespace svxform
sTemp = TRUE_VALUE;
sCondition = sTemp;
}
- aDlg.SetCondition( sCondition );
+ aDlg->SetCondition( sCondition );
- if ( aDlg.Execute() == RET_OK )
+ if ( aDlg->Execute() == RET_OK )
{
- OUString sNewCondition = aDlg.GetCondition();
+ OUString sNewCondition = aDlg->GetCondition();
if ( bIsDefBtn )
m_pDefaultED->SetText( sNewCondition );
else
@@ -2418,9 +2479,9 @@ namespace svxform
( bIsHandleBinding && sNewName.isEmpty() ) )
{
// Error and don't close the dialog
- MessageDialog aErrBox( this, SVX_RES( RID_STR_INVALID_XMLNAME ) );
- aErrBox.set_primary_text(aErrBox.get_primary_text().replaceFirst(MSG_VARIABLE, sNewName));
- aErrBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrBox( this, SVX_RES( RID_STR_INVALID_XMLNAME ) );
+ aErrBox->set_primary_text(aErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sNewName));
+ aErrBox->Execute();
return 0;
}
@@ -2759,6 +2820,19 @@ namespace svxform
ResultHdl( &m_aResultIdle );
}
+ AddConditionDialog::~AddConditionDialog()
+ {
+ disposeOnce();
+ }
+
+ void AddConditionDialog::dispose()
+ {
+ m_pConditionED.clear();
+ m_pResultWin.clear();
+ m_pEditNamespacesBtn.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+ }
IMPL_LINK_NOARG(AddConditionDialog, EditHdl)
{
@@ -2771,8 +2845,8 @@ namespace svxform
{
SAL_WARN( "svx.form", "AddDataItemDialog::EditHdl(): exception caught" );
}
- NamespaceItemDialog aDlg( this, xNameContnr );
- aDlg.Execute();
+ ScopedVclPtrInstance< NamespaceItemDialog > aDlg( this, xNameContnr );
+ aDlg->Execute();
try
{
m_xBinding->setPropertyValue( PN_BINDING_NAMESPACES, makeAny( xNameContnr ) );
@@ -2848,7 +2922,7 @@ namespace svxform
aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
pNamespacesListContainer->set_width_request(aControlSize.Width());
pNamespacesListContainer->set_height_request(aControlSize.Height());
- m_pNamespacesList = new SvSimpleTable(*pNamespacesListContainer, 0);
+ m_pNamespacesList = VclPtr<SvSimpleTable>::Create(*pNamespacesListContainer, 0);
static long aStaticTabs[]= { 3, 0, 35, 200 };
m_pNamespacesList->SvSimpleTable::SetTabs( aStaticTabs );
@@ -2872,7 +2946,18 @@ namespace svxform
NamespaceItemDialog::~NamespaceItemDialog()
{
- delete m_pNamespacesList;
+ disposeOnce();
+ }
+
+ void NamespaceItemDialog::dispose()
+ {
+ m_pNamespacesList.disposeAndClear();
+ m_pAddNamespaceBtn.clear();
+ m_pEditNamespaceBtn.clear();
+ m_pDeleteNamespaceBtn.clear();
+ m_pOKBtn.clear();
+ m_pConditionDlg.clear();
+ ModalDialog::dispose();
}
@@ -2890,32 +2975,32 @@ namespace svxform
{
if ( m_pAddNamespaceBtn == pBtn )
{
- ManageNamespaceDialog aDlg( this, m_pConditionDlg, false );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< ManageNamespaceDialog > aDlg(this, m_pConditionDlg, false);
+ if ( aDlg->Execute() == RET_OK )
{
- OUString sEntry = aDlg.GetPrefix();
+ OUString sEntry = aDlg->GetPrefix();
sEntry += "\t";
- sEntry += aDlg.GetURL();
+ sEntry += aDlg->GetURL();
m_pNamespacesList->InsertEntry( sEntry );
}
}
else if ( m_pEditNamespaceBtn == pBtn )
{
- ManageNamespaceDialog aDlg( this, m_pConditionDlg, true );
+ ScopedVclPtrInstance< ManageNamespaceDialog > aDlg( this, m_pConditionDlg, true );
SvTreeListEntry* pEntry = m_pNamespacesList->FirstSelected();
DBG_ASSERT( pEntry, "NamespaceItemDialog::ClickHdl(): no entry" );
OUString sPrefix( SvTabListBox::GetEntryText( pEntry, 0 ) );
- aDlg.SetNamespace(
+ aDlg->SetNamespace(
sPrefix,
SvTabListBox::GetEntryText( pEntry, 1 ) );
- if ( aDlg.Execute() == RET_OK )
+ if ( aDlg->Execute() == RET_OK )
{
// if a prefix was changed, mark the old prefix as 'removed'
- if( sPrefix != aDlg.GetPrefix() )
+ if( sPrefix != aDlg->GetPrefix() )
m_aRemovedList.push_back( sPrefix );
- m_pNamespacesList->SetEntryText( aDlg.GetPrefix(), pEntry, 0 );
- m_pNamespacesList->SetEntryText( aDlg.GetURL(), pEntry, 1 );
+ m_pNamespacesList->SetEntryText( aDlg->GetPrefix(), pEntry, 0 );
+ m_pNamespacesList->SetEntryText( aDlg->GetURL(), pEntry, 1 );
}
}
else if ( m_pDeleteNamespaceBtn == pBtn )
@@ -3013,6 +3098,19 @@ namespace svxform
m_pOKBtn->SetClickHdl( LINK( this, ManageNamespaceDialog, OKHdl ) );
}
+ ManageNamespaceDialog::~ManageNamespaceDialog()
+ {
+ disposeOnce();
+ }
+
+ void ManageNamespaceDialog::dispose()
+ {
+ m_pOKBtn.clear();
+ m_pPrefixED.clear();
+ m_pUrlED.clear();
+ m_pConditionDlg.clear();
+ ModalDialog::dispose();
+ }
IMPL_LINK_NOARG(ManageNamespaceDialog, OKHdl)
{
@@ -3022,9 +3120,9 @@ namespace svxform
{
if ( !m_pConditionDlg->GetUIHelper()->isValidPrefixName( sPrefix ) )
{
- MessageDialog aErrBox( this, SVX_RES( RID_STR_INVALID_XMLPREFIX ) );
- aErrBox.set_primary_text(aErrBox.get_primary_text().replaceFirst(MSG_VARIABLE, sPrefix));
- aErrBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrBox(this, SVX_RES( RID_STR_INVALID_XMLPREFIX ) );
+ aErrBox->set_primary_text(aErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sPrefix));
+ aErrBox->Execute();
return 0;
}
}
@@ -3063,18 +3161,32 @@ namespace svxform
AddSubmissionDialog::~AddSubmissionDialog()
{
+ disposeOnce();
+ }
+
+ void AddSubmissionDialog::dispose()
+ {
// #i38991# if we have added a binding, we need to remove it as well.
if( m_xCreatedBinding.is() && m_xUIHelper.is() )
m_xUIHelper->removeBindingIfUseless( m_xCreatedBinding );
+ m_pNameED.clear();
+ m_pActionED.clear();
+ m_pMethodLB.clear();
+ m_pRefED.clear();
+ m_pRefBtn.clear();
+ m_pBindLB.clear();
+ m_pReplaceLB.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
}
IMPL_LINK_NOARG(AddSubmissionDialog, RefHdl)
{
- AddConditionDialog aDlg( this, PN_BINDING_EXPR, m_xTempBinding );
- aDlg.SetCondition( m_pRefED->GetText() );
- if ( aDlg.Execute() == RET_OK )
- m_pRefED->SetText( aDlg.GetCondition() );
+ ScopedVclPtrInstance< AddConditionDialog > aDlg(this, PN_BINDING_EXPR, m_xTempBinding );
+ aDlg->SetCondition( m_pRefED->GetText() );
+ if ( aDlg->Execute() == RET_OK )
+ m_pRefED->SetText( aDlg->GetCondition() );
return 0;
}
@@ -3085,9 +3197,9 @@ namespace svxform
OUString sName(m_pNameED->GetText());
if(sName.isEmpty()) {
- MessageDialog aErrorBox(this,SVX_RES(RID_STR_EMPTY_SUBMISSIONNAME));
- aErrorBox.set_primary_text( Application::GetDisplayName() );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(this,SVX_RES(RID_STR_EMPTY_SUBMISSIONNAME));
+ aErrorBox->set_primary_text( Application::GetDisplayName() );
+ aErrorBox->Execute();
return 0;
}
@@ -3266,6 +3378,18 @@ namespace svxform
SetText(get<FixedText>("alttitle")->GetText());
}
+ AddModelDialog::~AddModelDialog()
+ {
+ disposeOnce();
+ }
+
+ void AddModelDialog::dispose()
+ {
+ m_pNameED.clear();
+ m_pModifyCB.clear();
+ ModalDialog::dispose();
+ }
+
AddInstanceDialog::AddInstanceDialog(vcl::Window* pParent, bool _bEdit)
: ModalDialog(pParent, "AddInstanceDialog" , "svx/ui/addinstancedialog.ui")
{
@@ -3285,6 +3409,20 @@ namespace svxform
m_sAllFilterName = ResId(STR_FILTERNAME_ALL, *ResMgr::CreateResMgr("fps_office")).toString();
}
+ AddInstanceDialog::~AddInstanceDialog()
+ {
+ disposeOnce();
+ }
+
+ void AddInstanceDialog::dispose()
+ {
+ m_pNameED.clear();
+ m_pURLFT.clear();
+ m_pURLED.clear();
+ m_pFilePickerBtn.clear();
+ m_pLinkInstanceCB.clear();
+ ModalDialog::dispose();
+ }
IMPL_LINK_NOARG(AddInstanceDialog, FilePickerHdl)
{
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 2a39c1e54fba..3d76bfdcb10d 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1149,8 +1149,14 @@ FmFilterNavigator::FmFilterNavigator( vcl::Window* pParent )
FmFilterNavigator::~FmFilterNavigator()
{
+ disposeOnce();
+}
+
+void FmFilterNavigator::dispose()
+{
EndListening( *m_pModel );
delete m_pModel;
+ SvTreeListBox::dispose();
}
@@ -1851,7 +1857,7 @@ FmFilterNavigatorWin::FmFilterNavigatorWin( SfxBindings* _pBindings, SfxChildWin
{
SetHelpId( HID_FILTER_NAVIGATOR_WIN );
- m_pNavigator = new FmFilterNavigator( this );
+ m_pNavigator = VclPtr<FmFilterNavigator>::Create( this );
m_pNavigator->Show();
SetText( SVX_RES(RID_STR_FILTER_NAVIGATOR) );
SfxDockingWindow::SetFloatingSize( Size(200,200) );
@@ -1860,7 +1866,13 @@ FmFilterNavigatorWin::FmFilterNavigatorWin( SfxBindings* _pBindings, SfxChildWin
FmFilterNavigatorWin::~FmFilterNavigatorWin()
{
- delete m_pNavigator;
+ disposeOnce();
+}
+
+void FmFilterNavigatorWin::dispose()
+{
+ m_pNavigator.disposeAndClear();
+ SfxDockingWindow::dispose();
}
@@ -1981,9 +1993,9 @@ FmFilterNavigatorWinMgr::FmFilterNavigatorWinMgr( vcl::Window *_pParent, sal_uIn
SfxBindings *_pBindings, SfxChildWinInfo* _pInfo )
:SfxChildWindow( _pParent, _nId )
{
- pWindow = new FmFilterNavigatorWin( _pBindings, this, _pParent );
+ pWindow = VclPtr<FmFilterNavigatorWin>::Create( _pBindings, this, _pParent );
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- static_cast<SfxDockingWindow*>(pWindow)->Initialize( _pInfo );
+ static_cast<SfxDockingWindow*>(pWindow.get())->Initialize( _pInfo );
}
diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx
index 57def61a0037..4b291c573975 100644
--- a/svx/source/form/fmPropBrw.cxx
+++ b/svx/source/form/fmPropBrw.cxx
@@ -83,13 +83,12 @@ FmPropBrwMgr::FmPropBrwMgr( vcl::Window* _pParent, sal_uInt16 _nId,
SfxBindings* _pBindings, SfxChildWinInfo* _pInfo)
:SfxChildWindow(_pParent, _nId)
{
- pWindow = new FmPropBrw( ::comphelper::getProcessComponentContext(), _pBindings, this, _pParent, _pInfo );
+ pWindow = VclPtr<FmPropBrw>::Create( ::comphelper::getProcessComponentContext(), _pBindings, this, _pParent, _pInfo );
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- static_cast<SfxFloatingWindow*>(pWindow)->Initialize( _pInfo );
+ static_cast<SfxFloatingWindow*>(pWindow.get())->Initialize( _pInfo );
}
-
const long STD_WIN_SIZE_X = 300;
const long STD_WIN_SIZE_Y = 350;
@@ -207,7 +206,7 @@ FmPropBrw::FmPropBrw( const Reference< XComponentContext >& _xORB, SfxBindings*
// responsibility for this window (as soon as we initialize a frame with a window, the frame
// is responsible for its life time, but |this| is controlled by the belonging SfxChildWindow)
// #i34249#
- vcl::Window* pContainerWindow = new vcl::Window( this );
+ VclPtr<vcl::Window> pContainerWindow = VclPtr<vcl::Window>::Create( this );
pContainerWindow->Show();
m_xFrameContainerWindow = VCLUnoHelper::GetInterface ( pContainerWindow );
@@ -253,6 +252,11 @@ void FmPropBrw::Resize()
FmPropBrw::~FmPropBrw()
{
+ disposeOnce();
+}
+
+void FmPropBrw::dispose()
+{
if (m_xBrowserController.is())
implDetachController();
try
@@ -275,6 +279,7 @@ FmPropBrw::~FmPropBrw()
{
DBG_UNHANDLED_EXCEPTION();
}
+ SfxFloatingWindow::dispose();
}
diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx
index 4a7a53bd89a9..44c636aeef96 100644
--- a/svx/source/form/fmexpl.cxx
+++ b/svx/source/form/fmexpl.cxx
@@ -505,7 +505,7 @@ namespace svxform
{
SetHelpId( HID_FORM_NAVIGATOR_WIN );
- m_pNavigatorTree = new NavigatorTree( this );
+ m_pNavigatorTree = VclPtr<NavigatorTree>::Create( this );
m_pNavigatorTree->Show();
SetText( SVX_RES(RID_STR_FMEXPLORER) );
SfxDockingWindow::SetFloatingSize( Size(200,200) );
@@ -514,7 +514,13 @@ namespace svxform
NavigatorFrame::~NavigatorFrame()
{
- delete m_pNavigatorTree;
+ disposeOnce();
+ }
+
+ void NavigatorFrame::dispose()
+ {
+ m_pNavigatorTree.disposeAndClear();
+ SfxDockingWindow::dispose();
}
@@ -607,9 +613,9 @@ namespace svxform
SfxBindings* _pBindings, SfxChildWinInfo* _pInfo )
:SfxChildWindow( _pParent, _nId )
{
- pWindow = new NavigatorFrame( _pBindings, this, _pParent );
+ pWindow = VclPtr<NavigatorFrame>::Create( _pBindings, this, _pParent );
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- static_cast<SfxDockingWindow*>(pWindow)->Initialize( _pInfo );
+ static_cast<SfxDockingWindow*>(pWindow.get())->Initialize( _pInfo );
}
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index 043c84eec0c9..0ce45b66c130 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -112,7 +112,7 @@ void FmFormObj::impl_checkRefDevice_nothrow( bool _force )
return;
OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL;
- if ( ( m_pLastKnownRefDevice == pCurrentRefDevice ) && !_force )
+ if ( ( m_pLastKnownRefDevice.get() == pCurrentRefDevice ) && !_force )
return;
Reference< XControlModel > xControlModel( GetUnoControlModel() );
@@ -120,7 +120,7 @@ void FmFormObj::impl_checkRefDevice_nothrow( bool _force )
return;
m_pLastKnownRefDevice = pCurrentRefDevice;
- if ( m_pLastKnownRefDevice == NULL )
+ if ( !m_pLastKnownRefDevice )
return;
try
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 9d2b7c278081..7a7f73817718 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -269,9 +269,10 @@ bool FmFormShell::PrepareClose(bool bUI)
if ( bModified && bUI )
{
- MessageDialog aQry(NULL, "SaveModifiedDialog",
- "svx/ui/savemodifieddialog.ui");
- switch (aQry.Execute())
+ ScopedVclPtrInstance<MessageDialog> aQry(
+ nullptr, "SaveModifiedDialog",
+ "svx/ui/savemodifieddialog.ui");
+ switch (aQry->Execute())
{
case RET_NO:
bModified = false;
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index 43dccd894b63..44493395bb0f 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -655,9 +655,11 @@ namespace svx
fillFeatureDispatchers( m_xActiveControl, pDialogSlots, aAdditionalFestures );
transferFeatureStatesToItemSet( aAdditionalFestures, *xCurrentItems, true );
- boost::scoped_ptr<SfxTabDialog> xDialog ( _eSet == eCharAttribs
- ? static_cast< SfxTabDialog* >( new TextControlCharAttribDialog( NULL, *xCurrentItems, *pFontList ) )
- : static_cast< SfxTabDialog* >( new TextControlParaAttribDialog( NULL, *xCurrentItems ) ) );
+ VclPtr<SfxTabDialog> xDialog;
+ if ( _eSet == eCharAttribs)
+ xDialog = VclPtr<TextControlCharAttribDialog>::Create( nullptr, *xCurrentItems, *pFontList );
+ else
+ xDialog = VclPtr<TextControlParaAttribDialog>::Create( nullptr, *xCurrentItems );
if ( RET_OK == xDialog->Execute() )
{
const SfxItemSet& rModifiedItems = *xDialog->GetOutputItemSet();
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 4bbda320c8e7..b82b82bb1288 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -162,6 +162,11 @@ namespace svxform
NavigatorTree::~NavigatorTree()
{
+ disposeOnce();
+ }
+
+ void NavigatorTree::dispose()
+ {
if( nEditEvent )
Application::RemoveUserEvent( nEditEvent );
@@ -172,6 +177,7 @@ namespace svxform
EndListening( *m_pNavModel );
Clear();
delete m_pNavModel;
+ SvTreeListBox::dispose();
}
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index 6ef3e8537f21..acf428e32f9d 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -113,9 +113,15 @@ FmFieldWinListBox::FmFieldWinListBox( FmFieldWin* pParent )
SetHighlightRange( );
}
-
FmFieldWinListBox::~FmFieldWinListBox()
{
+ disposeOnce();
+}
+
+void FmFieldWinListBox::dispose()
+{
+ pTabWin.clear();
+ SvTreeListBox::dispose();
}
@@ -183,7 +189,7 @@ FmFieldWin::FmFieldWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Wind
SetHelpId( HID_FIELD_SEL_WIN );
SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
- pListBox = new FmFieldWinListBox( this );
+ pListBox = VclPtr<FmFieldWinListBox>::Create( this );
pListBox->Show();
UpdateContent(NULL);
SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
@@ -192,14 +198,20 @@ FmFieldWin::FmFieldWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Wind
FmFieldWin::~FmFieldWin()
{
+ disposeOnce();
+}
+
+void FmFieldWin::dispose()
+{
if (m_pChangeListener)
{
m_pChangeListener->dispose();
m_pChangeListener->release();
// delete m_pChangeListener;
}
- delete pListBox;
+ pListBox.disposeAndClear();
delete pData;
+ SfxFloatingWindow::dispose();
}
@@ -411,10 +423,10 @@ FmFieldWinMgr::FmFieldWinMgr(vcl::Window* _pParent, sal_uInt16 _nId,
SfxBindings* _pBindings, SfxChildWinInfo* _pInfo)
:SfxChildWindow(_pParent, _nId)
{
- pWindow = new FmFieldWin(_pBindings, this, _pParent);
+ pWindow = VclPtr<FmFieldWin>::Create(_pBindings, this, _pParent);
SetHideNotDelete(true);
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- static_cast<SfxFloatingWindow*>(pWindow)->Initialize( _pInfo );
+ static_cast<SfxFloatingWindow*>(pWindow.get())->Initialize( _pInfo );
}
diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx
index 3c3e8f72eabb..64baa4f85f89 100644
--- a/svx/source/form/tbxform.cxx
+++ b/svx/source/form/tbxform.cxx
@@ -59,11 +59,6 @@ SvxFmAbsRecWin::SvxFmAbsRecWin( vcl::Window* _pParent, SfxToolBoxControl* _pCont
}
-SvxFmAbsRecWin::~SvxFmAbsRecWin()
-{
-}
-
-
void SvxFmAbsRecWin::FirePosition( bool _bForce )
{
if ( _bForce || IsValueChangedFromSaved() )
@@ -202,7 +197,7 @@ SfxPopupWindowType SvxFmTbxCtlConfig::GetPopupWindowType() const
}
-SfxPopupWindow* SvxFmTbxCtlConfig::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxFmTbxCtlConfig::CreatePopupWindow()
{
if ( GetSlotId() == SID_FM_CONFIG )
{
@@ -275,11 +270,11 @@ void SvxFmTbxCtlAbsRec::StateChanged( sal_uInt16 nSID, SfxItemState eState, cons
}
-vcl::Window* SvxFmTbxCtlAbsRec::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SvxFmTbxCtlAbsRec::CreateItemWindow( vcl::Window* pParent )
{
- SvxFmAbsRecWin* pWin = new SvxFmAbsRecWin( pParent, this );
+ VclPtrInstance<SvxFmAbsRecWin> pWin( pParent, this );
pWin->SetUniqueId( UID_ABSOLUTE_RECORD_WINDOW );
- return pWin;
+ return pWin.get();
}
SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecText, SfxBoolItem );
@@ -295,10 +290,10 @@ SvxFmTbxCtlRecText::~SvxFmTbxCtlRecText()
}
-vcl::Window* SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pParent )
{
OUString aText(SVX_RESSTR(RID_STR_REC_TEXT));
- FixedText* pFixedText = new FixedText( pParent );
+ VclPtrInstance<FixedText> pFixedText( pParent );
Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
pFixedText->SetText( aText );
aSize.Width() += 6;
@@ -321,16 +316,16 @@ SvxFmTbxCtlRecFromText::~SvxFmTbxCtlRecFromText()
}
-vcl::Window* SvxFmTbxCtlRecFromText::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SvxFmTbxCtlRecFromText::CreateItemWindow( vcl::Window* pParent )
{
OUString aText(SVX_RESSTR(RID_STR_REC_FROM_TEXT));
- FixedText* pFixedText = new FixedText( pParent, WB_CENTER );
+ VclPtrInstance<FixedText> pFixedText( pParent, WB_CENTER );
Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
aSize.Width() += 12;
pFixedText->SetText( aText );
pFixedText->SetSizePixel( aSize );
pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
- return pFixedText;
+ return pFixedText.get();
}
SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecTotal, SfxStringItem );
@@ -348,9 +343,9 @@ SvxFmTbxCtlRecTotal::~SvxFmTbxCtlRecTotal()
}
-vcl::Window* SvxFmTbxCtlRecTotal::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SvxFmTbxCtlRecTotal::CreateItemWindow( vcl::Window* pParent )
{
- pFixedText = new FixedText( pParent );
+ pFixedText.reset(VclPtr<FixedText>::Create( pParent ));
OUString aSample("123456");
Size aSize( pFixedText->GetTextWidth( aSample ), pFixedText->GetTextHeight( ) );
aSize.Width() += 12;
diff --git a/svx/source/form/xfm_addcondition.cxx b/svx/source/form/xfm_addcondition.cxx
index 58e3fe5849c4..6b4bdb5bfd72 100644
--- a/svx/source/form/xfm_addcondition.cxx
+++ b/svx/source/form/xfm_addcondition.cxx
@@ -145,12 +145,12 @@ namespace svxform
}
- Dialog* OAddConditionDialog::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> OAddConditionDialog::createDialog(vcl::Window* _pParent)
{
if ( !m_xBinding.is() || m_sFacetName.isEmpty() )
throw RuntimeException( OUString(), *this );
- return new AddConditionDialog( _pParent, m_sFacetName, m_xBinding );
+ return VclPtr<AddConditionDialog>::Create( _pParent, m_sFacetName, m_xBinding );
}
@@ -158,7 +158,7 @@ namespace svxform
{
OAddConditionDialogBase::executedDialog( _nExecutionResult );
if ( _nExecutionResult == RET_OK )
- m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog )->GetCondition();
+ m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog.get() )->GetCondition();
}
diff --git a/svx/source/gallery2/GalleryControl.cxx b/svx/source/gallery2/GalleryControl.cxx
index 69474d0eb144..ff694bdd7a28 100644
--- a/svx/source/gallery2/GalleryControl.cxx
+++ b/svx/source/gallery2/GalleryControl.cxx
@@ -40,16 +40,18 @@ GalleryControl::GalleryControl (
vcl::Window* pParentWindow)
: Window(pParentWindow, WB_SIZEABLE|WB_MOVEABLE|WB_CLOSEABLE|WB_HIDE),
mpGallery (Gallery::GetGalleryInstance()),
- mpSplitter(new GallerySplitter(
+ mpSplitter(VclPtr<GallerySplitter>::Create(
+
this,
WB_HSCROLL,
::boost::bind(&GalleryControl::InitSettings, this))),
- mpBrowser1(new GalleryBrowser1(
+ mpBrowser1(VclPtr<GalleryBrowser1>::Create(
+
this,
mpGallery,
::boost::bind(&GalleryControl::GalleryKeyInput,this,_1,_2),
::boost::bind(&GalleryControl::ThemeSelectionHasChanged, this))),
- mpBrowser2(new GalleryBrowser2(this, mpGallery)),
+ mpBrowser2(VclPtr<GalleryBrowser2>::Create(this, mpGallery)),
maLastSize(GetOutputSizePixel()),
mbIsInitialResize(true)
{
@@ -67,6 +69,15 @@ GalleryControl::GalleryControl (
GalleryControl::~GalleryControl()
{
+ disposeOnce();
+}
+
+void GalleryControl::dispose()
+{
+ mpSplitter.disposeAndClear();
+ mpBrowser1.disposeAndClear();
+ mpBrowser2.disposeAndClear();
+ vcl::Window::dispose();
}
void GalleryControl::InitSettings()
@@ -181,19 +192,19 @@ bool GalleryControl::GalleryKeyInput( const KeyEvent& rKEvt, vcl::Window* )
if( mpBrowser1->mpThemes->HasChildPathFocus( true ) )
mpBrowser2->GetViewWindow()->GrabFocus();
else if( mpBrowser2->GetViewWindow()->HasFocus() )
- mpBrowser2->maViewBox.GrabFocus();
- else if( mpBrowser2->maViewBox.HasFocus() )
- mpBrowser1->maNewTheme.GrabFocus();
+ mpBrowser2->maViewBox->GrabFocus();
+ else if( mpBrowser2->maViewBox->HasFocus() )
+ mpBrowser1->maNewTheme->GrabFocus();
else
mpBrowser1->mpThemes->GrabFocus();
}
else
{
if( mpBrowser1->mpThemes->HasChildPathFocus( true ) )
- mpBrowser1->maNewTheme.GrabFocus();
- else if( mpBrowser1->maNewTheme.HasFocus() )
- mpBrowser2->maViewBox.GrabFocus();
- else if( mpBrowser2->maViewBox.HasFocus() )
+ mpBrowser1->maNewTheme->GrabFocus();
+ else if( mpBrowser1->maNewTheme->HasFocus() )
+ mpBrowser2->maViewBox->GrabFocus();
+ else if( mpBrowser2->maViewBox->HasFocus() )
mpBrowser2->GetViewWindow()->GrabFocus();
else
mpBrowser1->mpThemes->GrabFocus();
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 7d33453facd8..48cbfc6338cd 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -51,10 +51,6 @@ GalleryButton::GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits ) :
{
}
-GalleryButton::~GalleryButton()
-{
-}
-
void GalleryButton::KeyInput( const KeyEvent& rKEvt )
{
if( !static_cast< GalleryBrowser1* >( GetParent() )->KeyInput( rKEvt, this ) )
@@ -69,10 +65,6 @@ GalleryThemeListBox::GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWin
InitSettings();
}
-GalleryThemeListBox::~GalleryThemeListBox()
-{
-}
-
void GalleryThemeListBox::InitSettings()
{
SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
@@ -119,8 +111,8 @@ GalleryBrowser1::GalleryBrowser1(
const ::boost::function<void()>& rThemeSlectionHandler)
:
Control ( pParent, WB_TABSTOP ),
- maNewTheme ( this, WB_3DLOOK ),
- mpThemes ( new GalleryThemeListBox( this, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_HSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_SORT ) ),
+ maNewTheme ( VclPtr<GalleryButton>::Create(this, WB_3DLOOK) ),
+ mpThemes ( VclPtr<GalleryThemeListBox>::Create( this, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_HSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_SORT ) ),
mpGallery ( pGallery ),
mpExchangeData ( new ExchangeData ),
mpThemePropsDlgItemSet( NULL ),
@@ -132,13 +124,13 @@ GalleryBrowser1::GalleryBrowser1(
{
StartListening( *mpGallery );
- maNewTheme.SetHelpId( HID_GALLERY_NEWTHEME );
- maNewTheme.SetText( GAL_RESSTR(RID_SVXSTR_GALLERY_CREATETHEME));
- maNewTheme.SetClickHdl( LINK( this, GalleryBrowser1, ClickNewThemeHdl ) );
+ maNewTheme->SetHelpId( HID_GALLERY_NEWTHEME );
+ maNewTheme->SetText( GAL_RESSTR(RID_SVXSTR_GALLERY_CREATETHEME));
+ maNewTheme->SetClickHdl( LINK( this, GalleryBrowser1, ClickNewThemeHdl ) );
// disable creation of new themes if a writable directory is not available
if( mpGallery->GetUserURL().GetProtocol() == INetProtocol::NotValid )
- maNewTheme.Disable();
+ maNewTheme->Disable();
mpThemes->SetHelpId( HID_GALLERY_THEMELIST );
mpThemes->SetSelectHdl( LINK( this, GalleryBrowser1, SelectThemeHdl ) );
@@ -148,17 +140,23 @@ GalleryBrowser1::GalleryBrowser1(
ImplInsertThemeEntry( mpGallery->GetThemeInfo( i ) );
ImplAdjustControls();
- maNewTheme.Show( true );
+ maNewTheme->Show( true );
mpThemes->Show( true );
}
GalleryBrowser1::~GalleryBrowser1()
{
+ disposeOnce();
+}
+
+void GalleryBrowser1::dispose()
+{
EndListening( *mpGallery );
- delete mpThemes;
- mpThemes = NULL;
+ mpThemes.disposeAndClear();
delete mpExchangeData;
mpExchangeData = NULL;
+ maNewTheme.disposeAndClear();
+ Control::dispose();
}
sal_uIntPtr GalleryBrowser1::ImplInsertThemeEntry( const GalleryThemeEntry* pEntry )
@@ -190,7 +188,7 @@ void GalleryBrowser1::ImplAdjustControls()
const long nNewThemeHeight = LogicToPixel( Size( 0, 14 ), MAP_APPFONT ).Height();
const long nStartY = nNewThemeHeight + 4;
- maNewTheme.SetPosSizePixel( Point(),
+ maNewTheme->SetPosSizePixel( Point(),
Size( aOutSize.Width(), nNewThemeHeight ) );
mpThemes->SetPosSizePixel( Point( 0, nStartY ),
diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx
index 33fd25eb3b35..562b2fab7110 100644
--- a/svx/source/gallery2/galbrws1.hxx
+++ b/svx/source/gallery2/galbrws1.hxx
@@ -41,7 +41,6 @@ private:
public:
GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits );
- virtual ~GalleryButton();
};
// - GalleryThemeListBox -
@@ -58,7 +57,6 @@ protected:
public:
GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits );
- virtual ~GalleryThemeListBox();
};
// - GalleryBrowser1 -
@@ -82,8 +80,8 @@ class GalleryBrowser1 : public Control, SfxListener
private:
- GalleryButton maNewTheme;
- GalleryThemeListBox* mpThemes;
+ VclPtr<GalleryButton> maNewTheme;
+ VclPtr<GalleryThemeListBox> mpThemes;
Gallery* mpGallery;
ExchangeData* mpExchangeData;
SfxItemSet* mpThemePropsDlgItemSet;
@@ -127,6 +125,7 @@ public:
const ::boost::function<sal_Bool(const KeyEvent&,Window*)>& rKeyInputHandler,
const ::boost::function<void()>& rThemeSlectionHandler);
virtual ~GalleryBrowser1();
+ virtual void dispose() SAL_OVERRIDE;
void SelectTheme( const OUString& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); }
void SelectTheme( sal_uIntPtr nThemePos ) { mpThemes->SelectEntryPos( (sal_uInt16) nThemePos ); SelectThemeHdl( NULL ); }
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 71bf2ec14aa9..4fadfb888cce 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -110,10 +110,10 @@ class GalleryThemePopup : public ::cppu::WeakImplHelper1< css::frame::XStatusLis
private:
const GalleryTheme* mpTheme;
sal_uIntPtr mnObjectPos;
- bool mbPreview;
+ bool mbPreview;
PopupMenu maPopupMenu;
PopupMenu maBackgroundPopup;
- GalleryBrowser2* mpBrowser;
+ VclPtr<GalleryBrowser2> mpBrowser;
typedef std::map< int, CommandInfo > CommandInfoMap;
CommandInfoMap m_aCommandInfo;
@@ -403,10 +403,6 @@ GalleryToolBox::GalleryToolBox( GalleryBrowser2* pParent ) :
{
}
-GalleryToolBox::~GalleryToolBox()
-{
-}
-
void GalleryToolBox::KeyInput( const KeyEvent& rKEvt )
{
if( !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) )
@@ -418,12 +414,12 @@ GalleryBrowser2::GalleryBrowser2( vcl::Window* pParent, Gallery* pGallery ) :
Control ( pParent, WB_TABSTOP ),
mpGallery ( pGallery ),
mpCurTheme ( NULL ),
- mpIconView ( new GalleryIconView( this, NULL ) ),
- mpListView ( new GalleryListView( this, NULL ) ),
- mpPreview ( new GalleryPreview(this) ),
- maViewBox ( this ),
- maSeparator ( this, WB_VERT ),
- maInfoBar ( this, WB_LEFT | WB_VCENTER ),
+ mpIconView ( VclPtr<GalleryIconView>::Create( this, nullptr ) ),
+ mpListView ( VclPtr<GalleryListView>::Create( this, nullptr ) ),
+ mpPreview ( VclPtr<GalleryPreview>::Create(this) ),
+ maViewBox ( VclPtr<GalleryToolBox>::Create(this) ),
+ maSeparator ( VclPtr<FixedLine>::Create(this, WB_VERT) ),
+ maInfoBar ( VclPtr<FixedText>::Create(this, WB_LEFT | WB_VCENTER) ),
mnCurActionPos ( 0xffffffff ),
meMode ( GALLERYBROWSERMODE_NONE ),
meLastMode ( GALLERYBROWSERMODE_NONE )
@@ -438,29 +434,29 @@ GalleryBrowser2::GalleryBrowser2( vcl::Window* pParent, Gallery* pGallery ) :
Image aDummyImage;
const Link aSelectHdl( LINK( this, GalleryBrowser2, SelectObjectHdl ) );
- vcl::Font aInfoFont( maInfoBar.GetControlFont() );
+ vcl::Font aInfoFont( maInfoBar->GetControlFont() );
maMiscOptions.AddListenerLink( LINK( this, GalleryBrowser2, MiscHdl ) );
- maViewBox.InsertItem( TBX_ID_ICON, aDummyImage );
- maViewBox.SetItemBits( TBX_ID_ICON, ToolBoxItemBits::RADIOCHECK | ToolBoxItemBits::AUTOCHECK );
- maViewBox.SetHelpId( TBX_ID_ICON, HID_GALLERY_ICONVIEW );
- maViewBox.SetQuickHelpText( TBX_ID_ICON, GAL_RESSTR(RID_SVXSTR_GALLERY_ICONVIEW) );
+ maViewBox->InsertItem( TBX_ID_ICON, aDummyImage );
+ maViewBox->SetItemBits( TBX_ID_ICON, ToolBoxItemBits::RADIOCHECK | ToolBoxItemBits::AUTOCHECK );
+ maViewBox->SetHelpId( TBX_ID_ICON, HID_GALLERY_ICONVIEW );
+ maViewBox->SetQuickHelpText( TBX_ID_ICON, GAL_RESSTR(RID_SVXSTR_GALLERY_ICONVIEW) );
- maViewBox.InsertItem( TBX_ID_LIST, aDummyImage );
- maViewBox.SetItemBits( TBX_ID_LIST, ToolBoxItemBits::RADIOCHECK | ToolBoxItemBits::AUTOCHECK );
- maViewBox.SetHelpId( TBX_ID_LIST, HID_GALLERY_LISTVIEW );
- maViewBox.SetQuickHelpText( TBX_ID_LIST, GAL_RESSTR(RID_SVXSTR_GALLERY_LISTVIEW) );
+ maViewBox->InsertItem( TBX_ID_LIST, aDummyImage );
+ maViewBox->SetItemBits( TBX_ID_LIST, ToolBoxItemBits::RADIOCHECK | ToolBoxItemBits::AUTOCHECK );
+ maViewBox->SetHelpId( TBX_ID_LIST, HID_GALLERY_LISTVIEW );
+ maViewBox->SetQuickHelpText( TBX_ID_LIST, GAL_RESSTR(RID_SVXSTR_GALLERY_LISTVIEW) );
MiscHdl( NULL );
- maViewBox.SetSelectHdl( LINK( this, GalleryBrowser2, SelectTbxHdl ) );
- maViewBox.Show();
+ maViewBox->SetSelectHdl( LINK( this, GalleryBrowser2, SelectTbxHdl ) );
+ maViewBox->Show();
mpIconView->SetAccessibleName(SVX_RESSTR(RID_SVXSTR_GALLERY_THEMEITEMS));
mpListView->SetAccessibleName(SVX_RESSTR(RID_SVXSTR_GALLERY_THEMEITEMS));
- maInfoBar.Show();
- maSeparator.Show();
+ maInfoBar->Show();
+ maSeparator->Show();
mpIconView->SetSelectHdl( aSelectHdl );
mpListView->SetSelectHdl( aSelectHdl );
@@ -469,40 +465,48 @@ GalleryBrowser2::GalleryBrowser2( vcl::Window* pParent, Gallery* pGallery ) :
SetMode( ( GALLERYBROWSERMODE_PREVIEW != GalleryBrowser2::meInitMode ) ? GalleryBrowser2::meInitMode : GALLERYBROWSERMODE_ICON );
- if(maInfoBar.GetText().isEmpty())
+ if(maInfoBar->GetText().isEmpty())
mpIconView->SetAccessibleRelationLabeledBy(mpIconView);
else
- mpIconView->SetAccessibleRelationLabeledBy(&maInfoBar);
+ mpIconView->SetAccessibleRelationLabeledBy(maInfoBar.get());
mpIconView->SetAccessibleRelationMemberOf(mpIconView);
}
GalleryBrowser2::~GalleryBrowser2()
{
+ disposeOnce();
+}
+
+void GalleryBrowser2::dispose()
+{
maMiscOptions.RemoveListenerLink( LINK( this, GalleryBrowser2, MiscHdl ) );
- delete mpPreview;
- delete mpListView;
- delete mpIconView;
+ mpPreview.disposeAndClear();
+ mpListView.disposeAndClear();
+ mpIconView.disposeAndClear();
if( mpCurTheme )
mpGallery->ReleaseTheme( mpCurTheme, *this );
-
+ maSeparator.disposeAndClear();
+ maInfoBar.disposeAndClear();
+ maViewBox.disposeAndClear();
+ Control::dispose();
}
void GalleryBrowser2::InitSettings()
{
- vcl::Font aInfoFont( maInfoBar.GetControlFont() );
+ vcl::Font aInfoFont( maInfoBar->GetControlFont() );
aInfoFont.SetWeight( WEIGHT_BOLD );
aInfoFont.SetColor( GALLERY_FG_COLOR );
- maInfoBar.SetControlFont( aInfoFont );
+ maInfoBar->SetControlFont( aInfoFont );
- maInfoBar.SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
- maInfoBar.SetControlBackground( GALLERY_DLG_COLOR );
+ maInfoBar->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+ maInfoBar->SetControlBackground( GALLERY_DLG_COLOR );
- maSeparator.SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
- maSeparator.SetControlBackground( GALLERY_BG_COLOR );
- maSeparator.SetControlForeground( GALLERY_FG_COLOR );
+ maSeparator->SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
+ maSeparator->SetControlBackground( GALLERY_BG_COLOR );
+ maSeparator->SetControlForeground( GALLERY_FG_COLOR );
}
void GalleryBrowser2::DataChanged( const DataChangedEvent& rDCEvt )
@@ -522,14 +526,14 @@ void GalleryBrowser2::Resize()
mpPreview->Hide();
const Size aOutSize( GetOutputSizePixel() );
- const Size aBoxSize( maViewBox.GetOutputSizePixel() );
+ const Size aBoxSize( maViewBox->GetOutputSizePixel() );
const long nOffset = 2, nSepWidth = 2;
const long nInfoBarX = aBoxSize.Width() + ( nOffset * 3 ) + nSepWidth;
const Point aPt( 0, aBoxSize.Height() + 3 );
const Size aSz( aOutSize.Width(), aOutSize.Height() - aPt.Y() );
- maSeparator.SetPosSizePixel( Point( aBoxSize.Width() + nOffset, 0 ), Size( nSepWidth, aBoxSize.Height() ) );
- maInfoBar.SetPosSizePixel( Point( nInfoBarX, 0 ), Size( aOutSize.Width() - nInfoBarX, aBoxSize.Height() ) );
+ maSeparator->SetPosSizePixel( Point( aBoxSize.Width() + nOffset, 0 ), Size( nSepWidth, aBoxSize.Height() ) );
+ maInfoBar->SetPosSizePixel( Point( nInfoBarX, 0 ), Size( aOutSize.Width() - nInfoBarX, aBoxSize.Height() ) );
mpIconView->SetPosSizePixel( aPt, aSz );
mpListView->SetPosSizePixel( aPt, aSz );
@@ -661,7 +665,7 @@ bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow )
if (pParentControl != NULL)
bRet = pParentControl->GalleryKeyInput(rKEvt, pWindow);
- if( !bRet && !maViewBox.HasFocus() && nItemId && mpCurTheme )
+ if( !bRet && !maViewBox->HasFocus() && nItemId && mpCurTheme )
{
sal_uInt16 nExecuteId = 0;
INetURLObject aURL;
@@ -736,18 +740,18 @@ bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow )
void GalleryBrowser2::SelectTheme( const OUString& rThemeName )
{
- delete mpIconView, mpIconView = NULL;
- delete mpListView, mpListView = NULL;
- delete mpPreview, mpPreview = NULL;
+ mpIconView.disposeAndClear();
+ mpListView.disposeAndClear();
+ mpPreview.disposeAndClear();
if( mpCurTheme )
mpGallery->ReleaseTheme( mpCurTheme, *this );
mpCurTheme = mpGallery->AcquireTheme( rThemeName, *this );
- mpIconView = new GalleryIconView( this, mpCurTheme );
- mpListView = new GalleryListView( this, mpCurTheme );
- mpPreview = new GalleryPreview( this, WB_TABSTOP | WB_BORDER, mpCurTheme );
+ mpIconView = VclPtr<GalleryIconView>::Create( this, mpCurTheme );
+ mpListView = VclPtr<GalleryListView>::Create( this, mpCurTheme );
+ mpPreview = VclPtr<GalleryPreview>::Create( this, WB_TABSTOP | WB_BORDER, mpCurTheme );
mpIconView->SetAccessibleName(SVX_RESSTR(RID_SVXSTR_GALLERY_THEMEITEMS));
mpListView->SetAccessibleName(SVX_RESSTR(RID_SVXSTR_GALLERY_THEMEITEMS));
@@ -764,14 +768,14 @@ void GalleryBrowser2::SelectTheme( const OUString& rThemeName )
Resize();
ImplUpdateViews( 1 );
- maViewBox.EnableItem( TBX_ID_ICON, true );
- maViewBox.EnableItem( TBX_ID_LIST, true );
- maViewBox.CheckItem( ( GALLERYBROWSERMODE_ICON == GetMode() ) ? TBX_ID_ICON : TBX_ID_LIST, true );
+ maViewBox->EnableItem( TBX_ID_ICON, true );
+ maViewBox->EnableItem( TBX_ID_LIST, true );
+ maViewBox->CheckItem( ( GALLERYBROWSERMODE_ICON == GetMode() ) ? TBX_ID_ICON : TBX_ID_LIST, true );
- if(maInfoBar.GetText().isEmpty())
+ if(maInfoBar->GetText().isEmpty())
mpIconView->SetAccessibleRelationLabeledBy(mpIconView);
else
- mpIconView->SetAccessibleRelationLabeledBy(&maInfoBar);
+ mpIconView->SetAccessibleRelationLabeledBy(maInfoBar.get());
mpIconView->SetAccessibleRelationMemberOf(mpIconView);
}
@@ -793,11 +797,11 @@ void GalleryBrowser2::SetMode( GalleryBrowserMode eMode )
mpIconView->Show();
- maViewBox.EnableItem( TBX_ID_ICON, true );
- maViewBox.EnableItem( TBX_ID_LIST, true );
+ maViewBox->EnableItem( TBX_ID_ICON, true );
+ maViewBox->EnableItem( TBX_ID_LIST, true );
- maViewBox.CheckItem( TBX_ID_ICON, true );
- maViewBox.CheckItem( TBX_ID_LIST, false );
+ maViewBox->CheckItem( TBX_ID_ICON, true );
+ maViewBox->CheckItem( TBX_ID_LIST, false );
}
break;
@@ -811,11 +815,11 @@ void GalleryBrowser2::SetMode( GalleryBrowserMode eMode )
mpListView->Show();
- maViewBox.EnableItem( TBX_ID_ICON, true );
- maViewBox.EnableItem( TBX_ID_LIST, true );
+ maViewBox->EnableItem( TBX_ID_ICON, true );
+ maViewBox->EnableItem( TBX_ID_LIST, true );
- maViewBox.CheckItem( TBX_ID_ICON, false );
- maViewBox.CheckItem( TBX_ID_LIST, true );
+ maViewBox->CheckItem( TBX_ID_ICON, false );
+ maViewBox->CheckItem( TBX_ID_LIST, true );
}
break;
@@ -841,8 +845,8 @@ void GalleryBrowser2::SetMode( GalleryBrowserMode eMode )
if( mpCurTheme && mpCurTheme->GetObjectKind( nPos ) == SGA_OBJ_SOUND )
GalleryPreview::PreviewMedia( mpCurTheme->GetObjectURL( nPos ) );
- maViewBox.EnableItem( TBX_ID_ICON, false );
- maViewBox.EnableItem( TBX_ID_LIST, false );
+ maViewBox->EnableItem( TBX_ID_ICON, false );
+ maViewBox->EnableItem( TBX_ID_LIST, false );
}
}
break;
@@ -957,7 +961,7 @@ void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId )
void GalleryBrowser2::ImplUpdateInfoBar()
{
if( mpCurTheme )
- maInfoBar.SetText( mpCurTheme->GetName() );
+ maInfoBar->SetText( mpCurTheme->GetName() );
}
sal_uIntPtr GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos )
@@ -1337,7 +1341,7 @@ IMPL_LINK( GalleryBrowser2, SelectTbxHdl, ToolBox*, pBox )
IMPL_LINK_NOARG(GalleryBrowser2, MiscHdl)
{
- maViewBox.SetOutStyle( maMiscOptions.GetToolboxStyle() );
+ maViewBox->SetOutStyle( maMiscOptions.GetToolboxStyle() );
BitmapEx aIconBmpEx = BitmapEx( Image( GAL_RES( RID_SVXIMG_GALLERY_VIEW_ICON ) ).GetBitmapEx() );
BitmapEx aListBmpEx = BitmapEx( Image( GAL_RES( RID_SVXIMG_GALLERY_VIEW_LIST ) ).GetBitmapEx() );
@@ -1350,9 +1354,9 @@ IMPL_LINK_NOARG(GalleryBrowser2, MiscHdl)
aListBmpEx.Scale( aLargeSize );
}
- maViewBox.SetItemImage(TBX_ID_ICON, Image(aIconBmpEx));
- maViewBox.SetItemImage(TBX_ID_LIST, Image(aListBmpEx));
- maViewBox.SetSizePixel( maViewBox.CalcWindowSizePixel() );
+ maViewBox->SetItemImage(TBX_ID_ICON, Image(aIconBmpEx));
+ maViewBox->SetItemImage(TBX_ID_LIST, Image(aListBmpEx));
+ maViewBox->SetSizePixel( maViewBox->CalcWindowSizePixel() );
Resize();
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index f2ead34d10fd..3b21ddf2f796 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -288,10 +288,6 @@ GalleryIconView::GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme
SetItemHeight( S_THUMB + 6 );
}
-GalleryIconView::~GalleryIconView()
-{
-}
-
void GalleryIconView::InitSettings()
{
SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
@@ -431,10 +427,6 @@ GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme
InsertDataColumn( GALLERY_BRWBOX_TITLE, GAL_RESSTR(RID_SVXSTR_GALLERY_TITLE), 256 );
}
-GalleryListView::~GalleryListView()
-{
-}
-
void GalleryListView::InitSettings()
{
SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index 35a35efbd16a..873bbdab54c8 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -484,8 +484,8 @@ bool SgaObjectSvDraw::CreateThumb( const FmFormModel& rModel )
if(aObjRect.GetWidth() && aObjRect.GetHeight())
{
- VirtualDevice aVDev;
- FmFormView aView(const_cast< FmFormModel* >(&rModel), &aVDev);
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ FmFormView aView(const_cast< FmFormModel* >(&rModel), pVDev);
aView.ShowSdrPage(const_cast< FmFormPage* >(pPage));
aView.MarkAllObj();
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index b3e2c39d477a..263af9ffeebb 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -808,9 +808,9 @@ bool GalleryTheme::GetGraphic( sal_uIntPtr nPos, Graphic& rGraphic, bool bProgre
bRet = true;
else
{
- VirtualDevice aVDev;
- aVDev.SetMapMode( MapMode( MAP_100TH_MM ) );
- FmFormView aView( aModel.GetModel(), &aVDev );
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->SetMapMode( MapMode( MAP_100TH_MM ) );
+ FmFormView aView( aModel.GetModel(), pVDev );
aView.hideMarkHandles();
aView.ShowSdrPage(aView.GetModel()->GetPage(0));
diff --git a/svx/source/inc/AccessibleFrameSelector.hxx b/svx/source/inc/AccessibleFrameSelector.hxx
index 62cf8cf486fc..f1a5c9140052 100644
--- a/svx/source/inc/AccessibleFrameSelector.hxx
+++ b/svx/source/inc/AccessibleFrameSelector.hxx
@@ -34,6 +34,7 @@
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/accessibleeventnotifier.hxx>
#include <svx/framebordertype.hxx>
+#include <vcl/vclptr.hxx>
class VclSimpleEvent;
class VclWindowEvent;
@@ -109,7 +110,7 @@ private:
void IsValid() throw (::com::sun::star::uno::RuntimeException);
void RemoveFrameSelEventListener();
- FrameSelector* mpFrameSel;
+ VclPtr<FrameSelector> mpFrameSel;
::osl::Mutex maFocusMutex;
::osl::Mutex maPropertyMutex;
diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx b/svx/source/inc/GraphCtlAccessibleContext.hxx
index 03248840e3e1..f2aa23c9f2df 100644
--- a/svx/source/inc/GraphCtlAccessibleContext.hxx
+++ b/svx/source/inc/GraphCtlAccessibleContext.hxx
@@ -225,7 +225,7 @@ private:
typedef ::std::map< const SdrObject*, ::accessibility::AccessibleShape*, SdrObjectCompareLess > ShapesMapType;
ShapesMapType mxShapes;
- GraphCtrl* mpControl;
+ VclPtr<GraphCtrl> mpControl;
SdrModel* mpModel;
SdrPage* mpPage;
diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx
index cc964f8b6155..1c09cfcd1ffd 100644
--- a/svx/source/inc/charmapacc.hxx
+++ b/svx/source/inc/charmapacc.hxx
@@ -40,7 +40,7 @@ namespace svx
class SvxShowCharSetVirtualAcc : public ::comphelper::OAccessibleComponentHelper,
public OAccessibleHelper_Base_2
{
- SvxShowCharSet* mpParent; // the vcl control
+ VclPtr<SvxShowCharSet> mpParent; // the vcl control
SvxShowCharSetAcc* m_pTable; // the table, which holds the characters shown by the vcl control
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAcc; // the ref to the table
protected:
diff --git a/svx/source/inc/datalistener.hxx b/svx/source/inc/datalistener.hxx
index 875a7d5bd1e1..32132b24d2ae 100644
--- a/svx/source/inc/datalistener.hxx
+++ b/svx/source/inc/datalistener.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/frame/XFrameActionListener.hpp>
#include <com/sun/star/xml/dom/events/XEventListener.hpp>
+#include <vcl/vclptr.hxx>
namespace svxform
@@ -39,7 +40,7 @@ namespace svxform
class DataListener : public DataListener_t
{
private:
- DataNavigatorWindow* m_pNaviWin;
+ VclPtr<DataNavigatorWindow> m_pNaviWin;
public:
DataListener( DataNavigatorWindow* pNaviWin );
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index 12f26b28d610..00b2efb57ea9 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -115,7 +115,7 @@ namespace svxform
class DataTreeListBox : public SvTreeListBox
{
private:
- XFormsPage* m_pXFormsPage;
+ VclPtr<XFormsPage> m_pXFormsPage;
DataGroupType m_eGroup;
sal_uInt16 m_nAddId;
sal_uInt16 m_nAddElementId;
@@ -129,6 +129,7 @@ namespace svxform
public:
DataTreeListBox( vcl::Window* pParent, WinBits nBits );
virtual ~DataTreeListBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE;
virtual void ExcecuteContextMenuAction( sal_uInt16 _nSelectedPopupEntry ) SAL_OVERRIDE;
@@ -249,8 +250,8 @@ namespace svxform
MethodString m_aMethodString;
ReplaceString m_aReplaceString;
- ToolBox *m_pToolBox;
- DataTreeListBox *m_pItemList;
+ VclPtr<ToolBox> m_pToolBox;
+ VclPtr<DataTreeListBox> m_pItemList;
sal_uInt16 m_nAddId;
sal_uInt16 m_nAddElementId;
sal_uInt16 m_nAddAttributeId;
@@ -259,7 +260,7 @@ namespace svxform
XFormsUIHelper1_ref m_xUIHelper;
- DataNavigatorWindow* m_pNaviWin;
+ VclPtr<DataNavigatorWindow> m_pNaviWin;
bool m_bHasModel;
DataGroupType m_eGroup;
ImageList m_TbxImageList;
@@ -289,6 +290,7 @@ namespace svxform
public:
XFormsPage( vcl::Window* pParent, DataNavigatorWindow* _pNaviWin, DataGroupType _eGroup );
virtual ~XFormsPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
@@ -319,20 +321,20 @@ namespace svxform
- typedef std::vector< XFormsPage* > PageList;
+ typedef std::vector< VclPtr<XFormsPage> > PageList;
typedef ::rtl::Reference < DataListener > DataListener_ref;
class DataNavigatorWindow : public vcl::Window, public VclBuilderContainer
{
private:
- ListBox* m_pModelsBox;
- MenuButton* m_pModelBtn;
- TabControl* m_pTabCtrl;
- MenuButton* m_pInstanceBtn;
+ VclPtr<ListBox> m_pModelsBox;
+ VclPtr<MenuButton> m_pModelBtn;
+ VclPtr<TabControl> m_pTabCtrl;
+ VclPtr<MenuButton> m_pInstanceBtn;
- XFormsPage* m_pInstPage;
- XFormsPage* m_pSubmissionPage;
- XFormsPage* m_pBindingPage;
+ VclPtr<XFormsPage> m_pInstPage;
+ VclPtr<XFormsPage> m_pSubmissionPage;
+ VclPtr<XFormsPage> m_pBindingPage;
sal_Int32 m_nLastSelectedPos;
bool m_bShowDetails;
@@ -372,6 +374,7 @@ namespace svxform
public:
DataNavigatorWindow( vcl::Window* pParent, SfxBindings* pBindings );
virtual ~DataNavigatorWindow();
+ virtual void dispose() SAL_OVERRIDE;
static void SetDocModified();
void NotifyChanges( bool _bLoadAll = false );
@@ -388,11 +391,11 @@ namespace svxform
class DataNavigator : public SfxDockingWindow, public SfxControllerItem
{
private:
- DataNavigatorWindow m_aDataWin;
+ VclPtr<DataNavigatorWindow> m_aDataWin;
protected:
virtual void Resize() SAL_OVERRIDE;
- virtual bool Close() SAL_OVERRIDE;
+ virtual bool Close() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual Size CalcDockingSize( SfxChildAlignment ) SAL_OVERRIDE;
virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ) SAL_OVERRIDE;
@@ -400,6 +403,7 @@ namespace svxform
public:
DataNavigator( SfxBindings* pBindings, SfxChildWindow* pMgr, vcl::Window* pParent );
virtual ~DataNavigator();
+ virtual void dispose() SAL_OVERRIDE;
using Window::Update;
using SfxDockingWindow::StateChanged;
@@ -422,30 +426,30 @@ namespace svxform
{
private:
- VclFrame* m_pItemFrame;
- FixedText* m_pNameFT;
- Edit* m_pNameED;
- FixedText* m_pDefaultFT;
- Edit* m_pDefaultED;
- PushButton* m_pDefaultBtn;
+ VclPtr<VclFrame> m_pItemFrame;
+ VclPtr<FixedText> m_pNameFT;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<FixedText> m_pDefaultFT;
+ VclPtr<Edit> m_pDefaultED;
+ VclPtr<PushButton> m_pDefaultBtn;
- VclFrame* m_pSettingsFrame;
+ VclPtr<VclFrame> m_pSettingsFrame;
- FixedText* m_pDataTypeFT;
- ListBox* m_pDataTypeLB;
+ VclPtr<FixedText> m_pDataTypeFT;
+ VclPtr<ListBox> m_pDataTypeLB;
- CheckBox* m_pRequiredCB;
- PushButton* m_pRequiredBtn;
- CheckBox* m_pRelevantCB;
- PushButton* m_pRelevantBtn;
- CheckBox* m_pConstraintCB;
- PushButton* m_pConstraintBtn;
- CheckBox* m_pReadonlyCB;
- PushButton* m_pReadonlyBtn;
- CheckBox* m_pCalculateCB;
- PushButton* m_pCalculateBtn;
+ VclPtr<CheckBox> m_pRequiredCB;
+ VclPtr<PushButton> m_pRequiredBtn;
+ VclPtr<CheckBox> m_pRelevantCB;
+ VclPtr<PushButton> m_pRelevantBtn;
+ VclPtr<CheckBox> m_pConstraintCB;
+ VclPtr<PushButton> m_pConstraintBtn;
+ VclPtr<CheckBox> m_pReadonlyCB;
+ VclPtr<PushButton> m_pReadonlyBtn;
+ VclPtr<CheckBox> m_pCalculateCB;
+ VclPtr<PushButton> m_pCalculateBtn;
- OKButton* m_pOKBtn;
+ VclPtr<OKButton> m_pOKBtn;
XFormsUIHelper1_ref m_xUIHelper;
XPropertySet_ref m_xBinding;
@@ -470,6 +474,7 @@ namespace svxform
AddDataItemDialog(
vcl::Window* pParent, ItemNode* _pNode, const XFormsUIHelper1_ref& _rUIHelper );
virtual ~AddDataItemDialog();
+ virtual void dispose() SAL_OVERRIDE;
void InitText( DataItemType _eType );
};
@@ -478,13 +483,13 @@ namespace svxform
class AddConditionDialog : public ModalDialog
{
private:
- VclMultiLineEdit* m_pConditionED;
- VclMultiLineEdit* m_pResultWin;
- PushButton* m_pEditNamespacesBtn;
- OKButton* m_pOKBtn;
+ VclPtr<VclMultiLineEdit> m_pConditionED;
+ VclPtr<VclMultiLineEdit> m_pResultWin;
+ VclPtr<PushButton> m_pEditNamespacesBtn;
+ VclPtr<OKButton> m_pOKBtn;
Idle m_aResultIdle;
- OUString m_sPropertyName;
+ OUString m_sPropertyName;
XFormsUIHelper1_ref m_xUIHelper;
XPropertySet_ref m_xBinding;
@@ -497,6 +502,8 @@ namespace svxform
public:
AddConditionDialog(vcl::Window* pParent,
const OUString& _rPropertyName, const XPropertySet_ref& _rBinding);
+ virtual ~AddConditionDialog();
+ virtual void dispose() SAL_OVERRIDE;
XFormsUIHelper1_ref GetUIHelper() const { return m_xUIHelper; }
OUString GetCondition() const { return m_pConditionED->GetText(); }
@@ -513,13 +520,13 @@ namespace svxform
private:
typedef std::vector< OUString > PrefixList;
- SvSimpleTable* m_pNamespacesList;
- PushButton* m_pAddNamespaceBtn;
- PushButton* m_pEditNamespaceBtn;
- PushButton* m_pDeleteNamespaceBtn;
- OKButton* m_pOKBtn;
+ VclPtr<SvSimpleTable> m_pNamespacesList;
+ VclPtr<PushButton> m_pAddNamespaceBtn;
+ VclPtr<PushButton> m_pEditNamespaceBtn;
+ VclPtr<PushButton> m_pDeleteNamespaceBtn;
+ VclPtr<OKButton> m_pOKBtn;
- AddConditionDialog* m_pConditionDlg;
+ VclPtr<AddConditionDialog> m_pConditionDlg;
PrefixList m_aRemovedList;
XNameContainer_ref& m_rNamespaces;
@@ -533,22 +540,25 @@ namespace svxform
public:
NamespaceItemDialog( AddConditionDialog* pParent, XNameContainer_ref& _rContainer );
virtual ~NamespaceItemDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
class ManageNamespaceDialog : public ModalDialog
{
private:
- Edit* m_pPrefixED;
- Edit* m_pUrlED;
- OKButton* m_pOKBtn;
+ VclPtr<Edit> m_pPrefixED;
+ VclPtr<Edit> m_pUrlED;
+ VclPtr<OKButton> m_pOKBtn;
- AddConditionDialog* m_pConditionDlg;
+ VclPtr<AddConditionDialog> m_pConditionDlg;
DECL_LINK(OKHdl, void *);
public:
ManageNamespaceDialog(vcl::Window* pParent, AddConditionDialog* _pCondDlg, bool bIsEdit);
+ virtual ~ManageNamespaceDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetNamespace(const OUString& _rPrefix, const OUString& _rURL)
{
@@ -566,15 +576,15 @@ namespace svxform
MethodString m_aMethodString;
ReplaceString m_aReplaceString;
- Edit* m_pNameED;
- Edit* m_pActionED;
- ListBox* m_pMethodLB;
- Edit* m_pRefED;
- PushButton* m_pRefBtn;
- ListBox* m_pBindLB;
- ListBox* m_pReplaceLB;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<Edit> m_pActionED;
+ VclPtr<ListBox> m_pMethodLB;
+ VclPtr<Edit> m_pRefED;
+ VclPtr<PushButton> m_pRefBtn;
+ VclPtr<ListBox> m_pBindLB;
+ VclPtr<ListBox> m_pReplaceLB;
- OKButton* m_pOKBtn;
+ VclPtr<OKButton> m_pOKBtn;
ItemNode* m_pItemNode;
@@ -593,6 +603,7 @@ namespace svxform
AddSubmissionDialog( vcl::Window* pParent, ItemNode* _pNode,
const XFormsUIHelper1_ref& _rUIHelper );
virtual ~AddSubmissionDialog();
+ virtual void dispose() SAL_OVERRIDE;
inline const XSubmission_ref& GetNewSubmission() const { return m_xNewSubmission; }
};
@@ -601,11 +612,13 @@ namespace svxform
class AddModelDialog : public ModalDialog
{
private:
- Edit* m_pNameED;
- CheckBox* m_pModifyCB;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<CheckBox> m_pModifyCB;
public:
AddModelDialog( vcl::Window* pParent, bool _bEdit );
+ virtual ~AddModelDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetName() const { return m_pNameED->GetText(); }
void SetName( const OUString& _rName ) { m_pNameED->SetText( _rName );}
@@ -618,11 +631,11 @@ namespace svxform
class AddInstanceDialog : public ModalDialog
{
private:
- Edit* m_pNameED;
- FixedText* m_pURLFT;
- SvtURLBox* m_pURLED;
- PushButton* m_pFilePickerBtn;
- CheckBox* m_pLinkInstanceCB;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<FixedText> m_pURLFT;
+ VclPtr<SvtURLBox> m_pURLED;
+ VclPtr<PushButton> m_pFilePickerBtn;
+ VclPtr<CheckBox> m_pLinkInstanceCB;
OUString m_sAllFilterName;
@@ -630,6 +643,8 @@ namespace svxform
public:
AddInstanceDialog( vcl::Window* pParent, bool _bEdit );
+ virtual ~AddInstanceDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetRenameMode()
{
diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx
index 4241576df3ad..326260e42f52 100644
--- a/svx/source/inc/docrecovery.hxx
+++ b/svx/source/inc/docrecovery.hxx
@@ -306,6 +306,7 @@ class PluginProgressWindow : public vcl::Window
PluginProgressWindow( vcl::Window* pParent ,
const css::uno::Reference< css::lang::XComponent >& xProgress);
virtual ~PluginProgressWindow();
+ virtual void dispose() SAL_OVERRIDE;
};
class PluginProgress : public ::cppu::WeakImplHelper2< css::task::XStatusIndicator ,
@@ -318,7 +319,7 @@ class PluginProgress : public ::cppu::WeakImplHelper2< css::task::XStatusIndicat
css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
- PluginProgressWindow* m_pPlugProgressWindow;
+ VclPtr<PluginProgressWindow> m_pPlugProgressWindow;
// native interface
@@ -369,9 +370,9 @@ class SaveDialog : public Dialog
{
// member
private:
- FixedText* m_pTitleFT;
- ListBox* m_pFileListLB;
- OKButton* m_pOkBtn;
+ VclPtr<FixedText> m_pTitleFT;
+ VclPtr<ListBox> m_pFileListLB;
+ VclPtr<OKButton> m_pOkBtn;
RecoveryCore* m_pCore;
// interface
@@ -392,6 +393,8 @@ class SaveDialog : public Dialog
which should be shown inside this dialog.
*/
SaveDialog(vcl::Window* pParent, RecoveryCore* pCore);
+ virtual ~SaveDialog();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK(OKButtonHdl, void*);
};
@@ -401,7 +404,7 @@ class SaveProgressDialog : public ModalDialog
{
// member
private:
- vcl::Window* m_pProgrParent;
+ VclPtr<vcl::Window> m_pProgrParent;
// @short TODO
RecoveryCore* m_pCore;
@@ -425,6 +428,8 @@ class SaveProgressDialog : public ModalDialog
*/
SaveProgressDialog(vcl::Window* pParent,
RecoveryCore* pCore );
+ virtual ~SaveProgressDialog();
+ virtual void dispose() SAL_OVERRIDE;
/** @short start the emergency save operation. */
virtual short Execute() SAL_OVERRIDE;
@@ -479,10 +484,6 @@ class RecovDocList : public SvSimpleTable
RecovDocList(SvSimpleTableContainer& rParent, ResMgr& rResMgr);
/** @short TODO */
- virtual ~RecovDocList();
-
-
- /** @short TODO */
virtual void InitEntry(SvTreeListEntry* pEntry,
const OUString& rText,
const Image& rImage1,
@@ -496,12 +497,12 @@ class RecoveryDialog : public Dialog
{
// member
private:
- FixedText* m_pTitleFT;
- FixedText* m_pDescrFT;
- vcl::Window* m_pProgrParent;
- RecovDocList* m_pFileListLB;
- PushButton* m_pNextBtn;
- PushButton* m_pCancelBtn;
+ VclPtr<FixedText> m_pTitleFT;
+ VclPtr<FixedText> m_pDescrFT;
+ VclPtr<vcl::Window> m_pProgrParent;
+ VclPtr<RecovDocList> m_pFileListLB;
+ VclPtr<PushButton> m_pNextBtn;
+ VclPtr<PushButton> m_pCancelBtn;
OUString m_aTitleRecoveryInProgress;
OUString m_aRecoveryOnlyFinish;
OUString m_aRecoveryOnlyFinishDescr;
@@ -530,6 +531,7 @@ class RecoveryDialog : public Dialog
RecoveryCore* pCore );
virtual ~RecoveryDialog();
+ virtual void dispose() SAL_OVERRIDE;
// IRecoveryUpdateListener
virtual void updateItems() SAL_OVERRIDE;
@@ -556,11 +558,11 @@ class BrokenRecoveryDialog : public ModalDialog
// member
private:
- ListBox *m_pFileListLB;
- Edit *m_pSaveDirED;
- PushButton *m_pSaveDirBtn;
- PushButton *m_pOkBtn;
- CancelButton *m_pCancelBtn;
+ VclPtr<ListBox> m_pFileListLB;
+ VclPtr<Edit> m_pSaveDirED;
+ VclPtr<PushButton> m_pSaveDirBtn;
+ VclPtr<PushButton> m_pOkBtn;
+ VclPtr<CancelButton> m_pCancelBtn;
OUString m_sSavePath;
RecoveryCore* m_pCore;
@@ -576,10 +578,8 @@ class BrokenRecoveryDialog : public ModalDialog
BrokenRecoveryDialog(vcl::Window* pParent ,
RecoveryCore* pCore ,
bool bBeforeRecovery);
-
-
- /** @short TODO */
virtual ~BrokenRecoveryDialog();
+ virtual void dispose() SAL_OVERRIDE;
/** @short TODO */
diff --git a/svx/source/inc/filtnav.hxx b/svx/source/inc/filtnav.hxx
index 4778c79991d0..947aad93b902 100644
--- a/svx/source/inc/filtnav.hxx
+++ b/svx/source/inc/filtnav.hxx
@@ -254,6 +254,7 @@ class FmFilterNavigator : public SvTreeListBox, public SfxListener
public:
FmFilterNavigator( vcl::Window* pParent );
virtual ~FmFilterNavigator();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateContent(
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & xControllers,
@@ -315,7 +316,7 @@ private:
class FmFilterNavigatorWin : public SfxDockingWindow, public SfxControllerItem
{
private:
- FmFilterNavigator* m_pNavigator;
+ VclPtr<FmFilterNavigator> m_pNavigator;
protected:
virtual void Resize() SAL_OVERRIDE;
@@ -327,6 +328,7 @@ public:
FmFilterNavigatorWin( SfxBindings *pBindings, SfxChildWindow *pMgr,
vcl::Window* pParent );
virtual ~FmFilterNavigatorWin();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateContent( FmFormShell* pFormShell );
void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
diff --git a/svx/source/inc/fmPropBrw.hxx b/svx/source/inc/fmPropBrw.hxx
index a092468415e0..fdd9d6726fd8 100644
--- a/svx/source/inc/fmPropBrw.hxx
+++ b/svx/source/inc/fmPropBrw.hxx
@@ -83,6 +83,7 @@ public:
const SfxChildWinInfo* _pInfo
);
virtual ~FmPropBrw();
+ virtual void dispose() SAL_OVERRIDE;
using SfxFloatingWindow::StateChanged;
diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx
index 5f77950826de..09ab923081c5 100644
--- a/svx/source/inc/fmexch.hxx
+++ b/svx/source/inc/fmexch.hxx
@@ -28,15 +28,12 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/form/XForms.hpp>
#include <tools/link.hxx>
-
+#include <vcl/window.hxx>
#include <svx/svxdllapi.h>
class SvTreeListEntry;
-
-
class SvTreeListBox;
-
namespace svxform
{
@@ -98,7 +95,7 @@ namespace svxform
class SVX_DLLPUBLIC OLocalExchangeHelper
{
protected:
- vcl::Window* m_pDragSource;
+ VclPtr<vcl::Window> m_pDragSource;
OLocalExchange* m_pTransferable;
public:
diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx
index e24df64a3c50..0e6f0b1696d2 100644
--- a/svx/source/inc/fmexpl.hxx
+++ b/svx/source/inc/fmexpl.hxx
@@ -501,6 +501,7 @@ namespace svxform
public:
NavigatorTree(vcl::Window* pParent );
virtual ~NavigatorTree();
+ virtual void dispose() SAL_OVERRIDE;
void Clear();
void UpdateContent( FmFormShell* pFormShell );
@@ -555,7 +556,7 @@ namespace svxform
class NavigatorFrame : public SfxDockingWindow, public SfxControllerItem
{
private:
- ::svxform::NavigatorTree* m_pNavigatorTree;
+ VclPtr<::svxform::NavigatorTree> m_pNavigatorTree;
protected:
virtual void Resize() SAL_OVERRIDE;
@@ -570,6 +571,7 @@ namespace svxform
NavigatorFrame( SfxBindings *pBindings, SfxChildWindow *pMgr,
vcl::Window* pParent );
virtual ~NavigatorFrame();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateContent( FmFormShell* pFormShell );
void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx
index 01ff874296c6..38ff2b6906be 100644
--- a/svx/source/inc/fmobj.hxx
+++ b/svx/source/inc/fmobj.hxx
@@ -42,7 +42,7 @@ class SVX_DLLPUBLIC FmFormObj: public SdrUnoObj
::com::sun::star::uno::Reference< ::com::sun::star::form::XForms > m_xEnvironmentHistory;
sal_Int32 m_nPos;
- OutputDevice* m_pLastKnownRefDevice;
+ VclPtr<OutputDevice> m_pLastKnownRefDevice;
// the last ref device we know, as set at the model
// only to be used for comparison with the current ref device!
diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx
index bc725c197426..31a6adc3f444 100644
--- a/svx/source/inc/fmvwimp.hxx
+++ b/svx/source/inc/fmvwimp.hxx
@@ -45,6 +45,7 @@
#include <cppuhelper/implbase3.hxx>
#include <comphelper/uno3.hxx>
#include <rtl/ref.hxx>
+#include <vcl/vclptr.hxx>
class SdrPageWindow;
@@ -93,7 +94,7 @@ class FormViewPageWindowAdapter : public FormViewPageWindowAdapter_Base
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer;
css::uno::Reference<css::uno::XComponentContext> m_xContext;
FmXFormView* m_pViewImpl;
- vcl::Window* m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
protected:
virtual ~FormViewPageWindowAdapter();
diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx
index 702b2c4b2326..51d94e1f861b 100644
--- a/svx/source/inc/frmselimpl.hxx
+++ b/svx/source/inc/frmselimpl.hxx
@@ -97,7 +97,7 @@ struct FrameSelectorImpl : public Resource
typedef std::vector< XAccessibleRef > XAccessibleRefVec;
FrameSelector& mrFrameSel; /// The control itself.
- VirtualDevice maVirDev; /// For all buffered drawing operations.
+ ScopedVclPtr<VirtualDevice> mpVirDev; /// For all buffered drawing operations.
ImageList maILArrows; /// Arrows in current system colors.
Color maBackCol; /// Background color.
Color maArrowCol; /// Selection arrow color.
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index 7b57851c3fff..bd379ce49d40 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -217,8 +217,8 @@ private:
protected:
DbGridColumn& m_rColumn;
- vcl::Window* m_pPainter;
- vcl::Window* m_pWindow;
+ VclPtr<vcl::Window> m_pPainter;
+ VclPtr<vcl::Window> m_pWindow;
protected:
// attribute access
@@ -565,7 +565,7 @@ public:
virtual ::svt::CellControllerRef CreateController() const SAL_OVERRIDE;
protected:
- virtual SpinField* createField(
+ virtual VclPtr<SpinField> createField(
vcl::Window* _pParent,
WinBits _nFieldStyle,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
@@ -587,7 +587,7 @@ protected:
virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ) SAL_OVERRIDE;
// DbSpinField
- virtual SpinField* createField(
+ virtual VclPtr<SpinField> createField(
vcl::Window* _pParent,
WinBits _nFieldStyle,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
@@ -612,7 +612,7 @@ protected:
virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ) SAL_OVERRIDE;
// DbSpinField
- virtual SpinField* createField(
+ virtual VclPtr<SpinField> createField(
vcl::Window* _pParent,
WinBits _nFieldStyle,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
@@ -641,7 +641,7 @@ protected:
virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ) SAL_OVERRIDE;
// DbSpinField
- virtual SpinField* createField(
+ virtual VclPtr<SpinField> createField(
vcl::Window* _pParent,
WinBits _nFieldStyle,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
@@ -666,7 +666,7 @@ protected:
virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ) SAL_OVERRIDE;
// DbSpinField
- virtual SpinField* createField(
+ virtual VclPtr<SpinField> createField(
vcl::Window* _pParent,
WinBits _nFieldStyle,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
@@ -949,8 +949,8 @@ class FmXCheckBoxCell : public FmXDataCell,
{
::cppu::OInterfaceContainerHelper m_aItemListeners;
::cppu::OInterfaceContainerHelper m_aActionListeners;
- OUString m_aActionCommand;
- CheckBox* m_pBox;
+ OUString m_aActionCommand;
+ VclPtr<CheckBox> m_pBox;
protected:
virtual ~FmXCheckBoxCell();
@@ -994,7 +994,7 @@ class FmXListBoxCell :public FmXTextCell
{
::cppu::OInterfaceContainerHelper m_aItemListeners,
m_aActionListeners;
- ListBox* m_pBox;
+ VclPtr<ListBox> m_pBox;
protected:
virtual ~FmXListBoxCell();
@@ -1049,7 +1049,7 @@ class FmXComboBoxCell :public FmXTextCell
private:
::cppu::OInterfaceContainerHelper m_aItemListeners,
m_aActionListeners;
- ComboBox* m_pComboBox;
+ VclPtr<ComboBox> m_pComboBox;
protected:
virtual ~FmXComboBoxCell();
diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx
index 772400605850..6f9407d88835 100644
--- a/svx/source/inc/svxrectctaccessiblecontext.hxx
+++ b/svx/source/inc/svxrectctaccessiblecontext.hxx
@@ -46,6 +46,7 @@
#include <cppuhelper/implbase7.hxx>
#include <comphelper/servicehelper.hxx>
#include <svx/rectenum.hxx>
+#include <vcl/vclptr.hxx>
namespace com { namespace sun { namespace star { namespace awt {
struct Point;
@@ -266,7 +267,7 @@ private:
mxParent;
/// pointer to internal representation
- SvxRectCtl* mpRepr;
+ VclPtr<SvxRectCtl> mpRepr;
/// array for all possible children
SvxRectCtlChildAccessibleContext** mpChildren;
diff --git a/svx/source/inc/tabwin.hxx b/svx/source/inc/tabwin.hxx
index c059544ea0db..d973a04fe9db 100644
--- a/svx/source/inc/tabwin.hxx
+++ b/svx/source/inc/tabwin.hxx
@@ -35,7 +35,7 @@ class FmFieldWin;
class FmFieldWinListBox
:public SvTreeListBox
{
- FmFieldWin* pTabWin;
+ VclPtr<FmFieldWin> pTabWin;
protected:
// virtual void Command( const CommandEvent& rEvt );
@@ -43,6 +43,7 @@ protected:
public:
FmFieldWinListBox( FmFieldWin* pParent );
virtual ~FmFieldWinListBox();
+ virtual void dispose() SAL_OVERRIDE;
sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
@@ -72,7 +73,7 @@ class FmFieldWin :public SfxFloatingWindow
,public ::comphelper::OPropertyChangeListener
{
::osl::Mutex m_aMutex;
- FmFieldWinListBox* pListBox;
+ VclPtr<FmFieldWinListBox> pListBox;
FmFieldWinData* pData;
::dbtools::SharedConnection
m_aConnection;
@@ -87,6 +88,7 @@ public:
SfxChildWindow *pMgr, vcl::Window* pParent);
virtual ~FmFieldWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx
index e9290a08ac49..cc2ad675712e 100644
--- a/svx/source/inc/tbxform.hxx
+++ b/svx/source/inc/tbxform.hxx
@@ -32,7 +32,6 @@ class SvxFmAbsRecWin : public NumericField
// for invalidating our content whe losing the focus
public:
SvxFmAbsRecWin( vcl::Window* _pParent, SfxToolBoxControl* _pController );
- virtual ~SvxFmAbsRecWin();
virtual void KeyInput( const KeyEvent& rKeyEvt ) SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
@@ -59,7 +58,7 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
@@ -72,7 +71,7 @@ public:
SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxFmTbxCtlAbsRec();
- virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -87,7 +86,7 @@ public:
SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxFmTbxCtlRecText();
- virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
};
@@ -99,13 +98,13 @@ public:
SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxFmTbxCtlRecFromText();
- virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
};
class SvxFmTbxCtlRecTotal : public SfxToolBoxControl
{
- FixedText* pFixedText;
+ VclPtr<FixedText> pFixedText;
public:
SFX_DECL_TOOLBOX_CONTROL();
@@ -113,7 +112,7 @@ public:
SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxFmTbxCtlRecTotal();
- virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
};
diff --git a/svx/source/inc/xfm_addcondition.hxx b/svx/source/inc/xfm_addcondition.hxx
index b55a0f3f9a03..c3a4db2cae87 100644
--- a/svx/source/inc/xfm_addcondition.hxx
+++ b/svx/source/inc/xfm_addcondition.hxx
@@ -67,7 +67,7 @@ namespace svxform
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void executedDialog(sal_Int16 _nExecutionResult) SAL_OVERRIDE;
};
diff --git a/svx/source/mnuctrls/clipboardctl.cxx b/svx/source/mnuctrls/clipboardctl.cxx
index e0ec2724c305..6d183d81ded1 100644
--- a/svx/source/mnuctrls/clipboardctl.cxx
+++ b/svx/source/mnuctrls/clipboardctl.cxx
@@ -61,7 +61,7 @@ SvxClipBoardControl::~SvxClipBoardControl()
}
-SfxPopupWindow* SvxClipBoardControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxClipBoardControl::CreatePopupWindow()
{
const SvxClipboardFmtItem* pFmtItem = PTR_CAST( SvxClipboardFmtItem, pClipboardFmtItem );
if ( pFmtItem )
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index c59fdb2eafa2..d40f8a41763a 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -521,7 +521,7 @@ namespace sdr { namespace contact {
Reference< XContainer > m_xContainer;
/// the output device for which the control was created
- const OutputDevice* m_pOutputDeviceForWindow;
+ VclPtr<OutputDevice> m_pOutputDeviceForWindow;
/// flag indicating whether the control is currently visible
bool m_bControlIsVisible;
@@ -1038,7 +1038,7 @@ namespace sdr { namespace contact {
if ( m_aControl.is() )
{
- if ( m_pOutputDeviceForWindow == &_rDevice )
+ if ( m_pOutputDeviceForWindow.get() == &_rDevice )
return true;
// Somebody requested a control for a new device, which means either of
@@ -1062,7 +1062,7 @@ namespace sdr { namespace contact {
if ( !createControlForDevice( _rPageView, _rDevice, *pUnoObject, _rInitialViewTransformation, m_aZoomLevelNormalization, aControl ) )
return false;
- m_pOutputDeviceForWindow = &_rDevice;
+ m_pOutputDeviceForWindow = const_cast< OutputDevice * >( &_rDevice );
m_aControl = aControl;
m_xContainer.set(_rPageView.getControlContainer( _rDevice ), css::uno::UNO_QUERY);
DBG_ASSERT( ( m_xContainer.is() // either have a XControlContainer
diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 518db4aab118..58814b1efe48 100644
--- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -38,46 +38,46 @@ namespace sdr
{
void OverlayManagerBuffered::ImpPrepareBufferDevice()
{
- // compare size of maBufferDevice with size of visible area
- if(maBufferDevice.GetOutputSizePixel() != getOutputDevice().GetOutputSizePixel())
+ // compare size of mpBufferDevice with size of visible area
+ if(mpBufferDevice->GetOutputSizePixel() != getOutputDevice().GetOutputSizePixel())
{
// set new buffer size, copy as much content as possible (use bool parameter for vcl).
// Newly uncovered regions will be repainted.
- maBufferDevice.SetOutputSizePixel(getOutputDevice().GetOutputSizePixel(), false);
+ mpBufferDevice->SetOutputSizePixel(getOutputDevice().GetOutputSizePixel(), false);
}
// compare the MapModes for zoom/scroll changes
- if(maBufferDevice.GetMapMode() != getOutputDevice().GetMapMode())
+ if(mpBufferDevice->GetMapMode() != getOutputDevice().GetMapMode())
{
const bool bZoomed(
- maBufferDevice.GetMapMode().GetScaleX() != getOutputDevice().GetMapMode().GetScaleX()
- || maBufferDevice.GetMapMode().GetScaleY() != getOutputDevice().GetMapMode().GetScaleY());
+ mpBufferDevice->GetMapMode().GetScaleX() != getOutputDevice().GetMapMode().GetScaleX()
+ || mpBufferDevice->GetMapMode().GetScaleY() != getOutputDevice().GetMapMode().GetScaleY());
if(!bZoomed)
{
- const Point& rOriginOld = maBufferDevice.GetMapMode().GetOrigin();
+ const Point& rOriginOld = mpBufferDevice->GetMapMode().GetOrigin();
const Point& rOriginNew = getOutputDevice().GetMapMode().GetOrigin();
const bool bScrolled(rOriginOld != rOriginNew);
if(bScrolled)
{
// get pixel bounds
- const Point aOriginOldPixel(maBufferDevice.LogicToPixel(rOriginOld));
- const Point aOriginNewPixel(maBufferDevice.LogicToPixel(rOriginNew));
- const Size aOutputSizePixel(maBufferDevice.GetOutputSizePixel());
+ const Point aOriginOldPixel(mpBufferDevice->LogicToPixel(rOriginOld));
+ const Point aOriginNewPixel(mpBufferDevice->LogicToPixel(rOriginNew));
+ const Size aOutputSizePixel(mpBufferDevice->GetOutputSizePixel());
// remember and switch off MapMode
- const bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled());
- maBufferDevice.EnableMapMode(false);
+ const bool bMapModeWasEnabled(mpBufferDevice->IsMapModeEnabled());
+ mpBufferDevice->EnableMapMode(false);
// scroll internally buffered stuff
const Point aDestinationOffsetPixel(aOriginNewPixel - aOriginOldPixel);
- maBufferDevice.DrawOutDev(
+ mpBufferDevice->DrawOutDev(
aDestinationOffsetPixel, aOutputSizePixel, // destination
Point(), aOutputSizePixel); // source
// restore MapMode
- maBufferDevice.EnableMapMode(bMapModeWasEnabled);
+ mpBufferDevice->EnableMapMode(bMapModeWasEnabled);
// scroll remembered region, too.
if(!maBufferRememberedRangePixel.isEmpty())
@@ -91,13 +91,13 @@ namespace sdr
}
// copy new MapMode
- maBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
+ mpBufferDevice->SetMapMode(getOutputDevice().GetMapMode());
}
// #i29186#
- maBufferDevice.SetDrawMode(getOutputDevice().GetDrawMode());
- maBufferDevice.SetSettings(getOutputDevice().GetSettings());
- maBufferDevice.SetAntialiasing(getOutputDevice().GetAntialiasing());
+ mpBufferDevice->SetDrawMode(getOutputDevice().GetDrawMode());
+ mpBufferDevice->SetSettings(getOutputDevice().GetSettings());
+ mpBufferDevice->SetAntialiasing(getOutputDevice().GetAntialiasing());
}
void OverlayManagerBuffered::ImpRestoreBackground() const
@@ -114,9 +114,9 @@ namespace sdr
{
// MapModes off
const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
- const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
+ const bool bMapModeWasEnabledSource(mpBufferDevice->IsMapModeEnabled());
getOutputDevice().EnableMapMode(false);
- const_cast<OverlayManagerBuffered*>(this)->maBufferDevice.EnableMapMode(false);
+ const_cast<OverlayManagerBuffered*>(this)->mpBufferDevice->EnableMapMode(false);
// local region
RectangleVector aRectangles;
@@ -143,12 +143,12 @@ namespace sdr
getOutputDevice().DrawOutDev(
aTopLeft, aSize, // destination
aTopLeft, aSize, // source
- maBufferDevice);
+ *mpBufferDevice.get());
}
// restore MapModes
getOutputDevice().EnableMapMode(bMapModeWasEnabledDest);
- const_cast<OverlayManagerBuffered*>(this)->maBufferDevice.EnableMapMode(bMapModeWasEnabledSource);
+ const_cast<OverlayManagerBuffered*>(this)->mpBufferDevice->EnableMapMode(bMapModeWasEnabledSource);
}
void OverlayManagerBuffered::ImpSaveBackground(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice)
@@ -176,14 +176,14 @@ namespace sdr
}
// also limit to buffer size
- const Rectangle aBufferDeviceRectanglePixel(Point(), maBufferDevice.GetOutputSizePixel());
+ const Rectangle aBufferDeviceRectanglePixel(Point(), mpBufferDevice->GetOutputSizePixel());
aRegion.Intersect(aBufferDeviceRectanglePixel);
// MapModes off
const bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled());
- const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
+ const bool bMapModeWasEnabledSource(mpBufferDevice->IsMapModeEnabled());
rSource.EnableMapMode(false);
- maBufferDevice.EnableMapMode(false);
+ mpBufferDevice->EnableMapMode(false);
// prepare to iterate over the rectangles from the region in pixels
RectangleVector aRectangles;
@@ -195,7 +195,7 @@ namespace sdr
const Point aTopLeft(aRectIter->TopLeft());
const Size aSize(aRectIter->GetSize());
- maBufferDevice.DrawOutDev(
+ mpBufferDevice->DrawOutDev(
aTopLeft, aSize, // destination
aTopLeft, aSize, // source
rSource);
@@ -203,7 +203,7 @@ namespace sdr
// restore MapModes
rSource.EnableMapMode(bMapModeWasEnabledDest);
- maBufferDevice.EnableMapMode(bMapModeWasEnabledSource);
+ mpBufferDevice->EnableMapMode(bMapModeWasEnabledSource);
}
IMPL_LINK(OverlayManagerBuffered, ImpBufferTimerHandler, AutoTimer*, /*pTimer*/)
@@ -241,20 +241,20 @@ namespace sdr
if(DoRefreshWithPreRendering())
{
- // #i73602# ensure valid and sized maOutputBufferDevice
- const Size aDestinationSizePixel(maBufferDevice.GetOutputSizePixel());
- const Size aOutputBufferSizePixel(maOutputBufferDevice.GetOutputSizePixel());
+ // #i73602# ensure valid and sized mpOutputBufferDevice
+ const Size aDestinationSizePixel(mpBufferDevice->GetOutputSizePixel());
+ const Size aOutputBufferSizePixel(mpOutputBufferDevice->GetOutputSizePixel());
if(aDestinationSizePixel != aOutputBufferSizePixel)
{
- maOutputBufferDevice.SetOutputSizePixel(aDestinationSizePixel);
+ mpOutputBufferDevice->SetOutputSizePixel(aDestinationSizePixel);
}
- maOutputBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
- maOutputBufferDevice.EnableMapMode(false);
- maOutputBufferDevice.SetDrawMode(maBufferDevice.GetDrawMode());
- maOutputBufferDevice.SetSettings(maBufferDevice.GetSettings());
- maOutputBufferDevice.SetAntialiasing(maBufferDevice.GetAntialiasing());
+ mpOutputBufferDevice->SetMapMode(getOutputDevice().GetMapMode());
+ mpOutputBufferDevice->EnableMapMode(false);
+ mpOutputBufferDevice->SetDrawMode(mpBufferDevice->GetDrawMode());
+ mpOutputBufferDevice->SetSettings(mpBufferDevice->GetSettings());
+ mpOutputBufferDevice->SetAntialiasing(mpBufferDevice->GetAntialiasing());
// calculate sizes
Rectangle aRegionRectanglePixel(
@@ -289,23 +289,23 @@ namespace sdr
const Size aSize(aRegionRectanglePixel.GetSize());
{
- const bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled());
- maBufferDevice.EnableMapMode(false);
+ const bool bMapModeWasEnabledDest(mpBufferDevice->IsMapModeEnabled());
+ mpBufferDevice->EnableMapMode(false);
- maOutputBufferDevice.DrawOutDev(
+ mpOutputBufferDevice->DrawOutDev(
aTopLeft, aSize, // destination
aTopLeft, aSize, // source
- maBufferDevice);
+ *mpBufferDevice.get());
// restore MapModes
- maBufferDevice.EnableMapMode(bMapModeWasEnabledDest);
+ mpBufferDevice->EnableMapMode(bMapModeWasEnabledDest);
}
// paint overlay content for remembered region, use
// method from base class directly
- maOutputBufferDevice.EnableMapMode(true);
- OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, maOutputBufferDevice);
- maOutputBufferDevice.EnableMapMode(false);
+ mpOutputBufferDevice->EnableMapMode(true);
+ OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, *mpOutputBufferDevice.get());
+ mpOutputBufferDevice->EnableMapMode(false);
// copy to output
{
@@ -315,7 +315,7 @@ namespace sdr
getOutputDevice().DrawOutDev(
aTopLeft, aSize, // destination
aTopLeft, aSize, // source
- maOutputBufferDevice);
+ *mpOutputBufferDevice.get());
// debug
/*getOutputDevice().SetLineColor(COL_RED);
@@ -381,6 +381,8 @@ namespace sdr
const SdrModel* pModel,
bool bRefreshWithPreRendering)
: OverlayManager(rOutputDevice, pModel),
+ mpBufferDevice(VclPtr<VirtualDevice>::Create()),
+ mpOutputBufferDevice(VclPtr<VirtualDevice>::Create()),
mbRefreshWithPreRendering(bRefreshWithPreRendering)
{
// Init timer
@@ -432,7 +434,7 @@ namespace sdr
void OverlayManagerBuffered::copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize)
{
// scroll local buffered area
- maBufferDevice.CopyArea(rDestPt, rSrcPt, rSrcSize);
+ mpBufferDevice->CopyArea(rDestPt, rSrcPt, rSrcSize);
}
void OverlayManagerBuffered::restoreBackground(const vcl::Region& rRegion) const
diff --git a/svx/source/sidebar/EmptyPanel.cxx b/svx/source/sidebar/EmptyPanel.cxx
index 784949a7ea3a..c39eb4ba2355 100644
--- a/svx/source/sidebar/EmptyPanel.cxx
+++ b/svx/source/sidebar/EmptyPanel.cxx
@@ -28,10 +28,10 @@ namespace svx { namespace sidebar {
EmptyPanel::EmptyPanel (vcl::Window* pParent)
: Control(pParent, SVX_RES(RID_SIDEBAR_EMPTY_PANEL)),
- maMessageControl(this, SVX_RES(FT_MESSAGE))
+ maMessageControl(VclPtr<FixedText>::Create(this, SVX_RES(FT_MESSAGE)))
{
- maMessageControl.setPosSizePixel(5,5, 250,15);
- maMessageControl.SetStyle(WB_WORDBREAK);// | WB_NOMNEMONICS);
+ maMessageControl->setPosSizePixel(5,5, 250,15);
+ maMessageControl->SetStyle(WB_WORDBREAK);// | WB_NOMNEMONICS);
//maMessageControl.GetStyle()
// & ~(WB_NOMULTILINE | WB_PATHELLIPSIS)
// | WB_WORDBREAK | WB_NOMNEMONICS);
@@ -39,7 +39,7 @@ EmptyPanel::EmptyPanel (vcl::Window* pParent)
SetBackground(Wallpaper());
- maMessageControl.Show();
+ maMessageControl->Show();
Show();
}
@@ -48,15 +48,20 @@ EmptyPanel::EmptyPanel (vcl::Window* pParent)
EmptyPanel::~EmptyPanel()
{
+ disposeOnce();
}
-
+void EmptyPanel::dispose()
+{
+ maMessageControl.disposeAndClear();
+ Control::dispose();
+}
void EmptyPanel::Resize()
{
const Size aSize (GetSizePixel());
- maMessageControl.SetSizePixel(aSize);
+ maMessageControl->SetSizePixel(aSize);
}
diff --git a/svx/source/sidebar/EmptyPanel.hxx b/svx/source/sidebar/EmptyPanel.hxx
index 1242d13ce8b8..36e0c7b1d9e9 100644
--- a/svx/source/sidebar/EmptyPanel.hxx
+++ b/svx/source/sidebar/EmptyPanel.hxx
@@ -36,11 +36,12 @@ class EmptyPanel
public:
EmptyPanel (vcl::Window* pParent);
virtual ~EmptyPanel();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
private:
- FixedText maMessageControl;
+ VclPtr<FixedText> maMessageControl;
};
} } // end of namespace ::svx::sidebar
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index ecc22dc7a6fc..bab0a12df7be 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -137,7 +137,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
"PanelFactory::createUIElement called without SfxBindings",
NULL);
- vcl::Window* pControl = NULL;
+ VclPtr<vcl::Window> pControl;
ui::LayoutSize aLayoutSize (-1,-1,-1);
if (rsResourceURL.endsWith("/TextPropertyPanel"))
@@ -166,25 +166,25 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
}
else if (rsResourceURL.endsWith("/InsertPropertyPanel"))
{
- pControl = new InsertPropertyPanel(pParentWindow, xFrame);
+ pControl.reset(VclPtr<InsertPropertyPanel>::Create(pParentWindow, xFrame));
}
else if (rsResourceURL.endsWith("/GalleryPanel"))
{
- pControl = new GalleryControl(pBindings, pParentWindow);
+ pControl.reset(VclPtr<GalleryControl>::Create(pBindings, pParentWindow));
aLayoutSize = ui::LayoutSize(300,-1,400);
}
else if (rsResourceURL.endsWith("/StyleListPanel"))
{
- pControl = new SfxTemplatePanelControl(pBindings, pParentWindow);
+ pControl.reset(VclPtr<SfxTemplatePanelControl>::Create(pBindings, pParentWindow));
aLayoutSize = ui::LayoutSize(0,-1,-1);
}
else if (rsResourceURL.endsWith("/EmptyPanel"))
{
- pControl = new EmptyPanel(pParentWindow);
+ pControl.reset(VclPtr<EmptyPanel>::Create(pParentWindow));
aLayoutSize = ui::LayoutSize(20,-1, 50);
}
- if (pControl != NULL)
+ if (pControl)
{
return sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index 829fd3b8afad..9a1f11fffa54 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -26,8 +26,15 @@ PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUStrin
PanelLayout::~PanelLayout()
{
+ disposeOnce();
+}
+
+void PanelLayout::dispose()
+{
m_bInClose = true;
m_aPanelLayoutIdle.Stop();
+ disposeBuilder();
+ Control::dispose();
}
Size PanelLayout::GetOptimalSize() const
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index ab4a4ff4e516..6e2294b56e1d 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -113,12 +113,35 @@ AreaPropertyPanel::AreaPropertyPanel(
}
-
AreaPropertyPanel::~AreaPropertyPanel()
{
+ disposeOnce();
}
-
+void AreaPropertyPanel::dispose()
+{
+ mpColorTextFT.clear();
+ mpLbFillType.clear();
+ mpLbFillAttr.clear();
+ mpToolBoxColor.clear();
+ mpTrspTextFT.clear();
+ mpLBTransType.clear();
+ mpMTRTransparent.clear();
+ mpBTNGradient.clear();
+
+ maStyleControl.dispose();
+ maColorControl.dispose();
+ maGradientControl.dispose();
+ maHatchControl.dispose();
+ maBitmapControl.dispose();
+ maGradientListControl.dispose();
+ maHatchListControl.dispose();
+ maBitmapListControl.dispose();
+ maFillTransparenceController.dispose();
+ maFillFloatTransparenceController.dispose();
+
+ PanelLayout::dispose();
+}
void AreaPropertyPanel::Initialize()
{
@@ -482,9 +505,9 @@ IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox )
}
-PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent)
+VclPtr<PopupControl> AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent)
{
- return new AreaTransparencyGradientControl(pParent, *this);
+ return VclPtrInstance<AreaTransparencyGradientControl>(pParent, *this);
}
@@ -504,7 +527,7 @@ void AreaPropertyPanel::SetupIcons()
-AreaPropertyPanel* AreaPropertyPanel::Create (
+VclPtr<vcl::Window> AreaPropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
@@ -516,10 +539,10 @@ AreaPropertyPanel* AreaPropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to AreaPropertyPanel::Create", NULL, 2);
- return new AreaPropertyPanel(
- pParent,
- rxFrame,
- pBindings);
+ return VclPtr<AreaPropertyPanel>::Create(
+ pParent,
+ rxFrame,
+ pBindings);
}
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx
index 544b91b7b7cf..14af720d76bd 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.hxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -35,6 +35,7 @@
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
#include <vcl/fixed.hxx>
+#include <vcl/vclptr.hxx>
#include <svl/intitem.hxx>
#include <com/sun/star/ui/XUIElement.hpp>
#include <boost/scoped_ptr.hpp>
@@ -53,7 +54,10 @@ class AreaPropertyPanel
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static AreaPropertyPanel* Create(
+ virtual ~AreaPropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
@@ -80,6 +84,12 @@ public:
void SetGradient (const XGradient& rGradient);
sal_Int32 GetSelectedTransparencyTypeIndex() const;
+ // constructor/destuctor
+ AreaPropertyPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings);
+
private:
sal_uInt16 meLastXFS;
@@ -96,14 +106,14 @@ private:
XGradient maGradientRect;
//ui controls
- FixedText* mpColorTextFT;
- SvxFillTypeBox* mpLbFillType;
- SvxFillAttrBox* mpLbFillAttr;
- ToolBox* mpToolBoxColor; // for new color picker
- FixedText* mpTrspTextFT;
- ListBox* mpLBTransType;
- MetricField* mpMTRTransparent;
- ToolBox* mpBTNGradient;
+ VclPtr<FixedText> mpColorTextFT;
+ VclPtr<SvxFillTypeBox> mpLbFillType;
+ VclPtr<SvxFillAttrBox> mpLbFillAttr;
+ VclPtr<ToolBox> mpToolBoxColor; // for new color picker
+ VclPtr<FixedText> mpTrspTextFT;
+ VclPtr<ListBox> mpLBTransType;
+ VclPtr<MetricField> mpMTRTransparent;
+ VclPtr<ToolBox> mpBTNGradient;
::boost::scoped_ptr< XFillStyleItem > mpStyleItem;
::boost::scoped_ptr< XFillColorItem > mpColorItem;
@@ -143,16 +153,9 @@ private:
DECL_LINK(ModifyTransparentHdl_Impl, void*);
// for transparency gradient
- PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent);
+ VclPtr<PopupControl> CreateTransparencyGradientControl (PopupContainer* pParent);
DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );
- // constructor/destuctor
- AreaPropertyPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings);
- virtual ~AreaPropertyPanel();
-
static void SetupIcons();
void Initialize();
void Update();
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
index 61bd9f120243..9d31ad746ade 100644
--- a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
+++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
@@ -56,60 +56,78 @@ AreaTransparencyGradientControl::AreaTransparencyGradientControl (
vcl::Window* pParent,
AreaPropertyPanel& rPanel)
: PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)),
- maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)),
- maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)),
- maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)),
- maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)),
- maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)),
- maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)),
- maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)),
- maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)),
- maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)),
- maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)),
- maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)),
- maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)),
- maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)),
- maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)),
+ maFtTrgrCenterX(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_CENTER_X))),
+ maMtrTrgrCenterX(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_CENTER_X))),
+ maFtTrgrCenterY(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_CENTER_Y))),
+ maMtrTrgrCenterY(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_CENTER_Y))),
+ maFtTrgrAngle(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_ANGLE))),
+ maMtrTrgrAngle(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_ANGLE))),
+ maBtnLeft45(VclPtr<ToolBox>::Create(this, SVX_RES(BTN_LEFT_SECOND))),
+ maBtnRight45(VclPtr<ToolBox>::Create(this, SVX_RES(BTN_RIGHT_FIRST))),
+ maFtTrgrStartValue(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_START_VALUE))),
+ maMtrTrgrStartValue(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_START_VALUE))),
+ maFtTrgrEndValue(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_END_VALUE))),
+ maMtrTrgrEndValue(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_END_VALUE))),
+ maFtTrgrBorder(VclPtr<FixedText>::Create(this, SVX_RES(FT_TRGR_BORDER))),
+ maMtrTrgrBorder(VclPtr<MetricField>::Create(this, SVX_RES(MTR_TRGR_BORDER))),
maRotLeft( SVX_RES(IMG_ROT_LEFT)),
maRotRight( SVX_RES(IMG_ROT_RIGHT)),
mrAreaPropertyPanel(rPanel),
mpBindings(NULL)
{
Link aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl);
- maMtrTrgrCenterX.SetModifyHdl( aLink );
- maMtrTrgrCenterY.SetModifyHdl( aLink );
- maMtrTrgrAngle.SetModifyHdl( aLink );
- maMtrTrgrBorder.SetModifyHdl( aLink );
- maMtrTrgrStartValue.SetModifyHdl( aLink );
- maMtrTrgrEndValue.SetModifyHdl( aLink );
+ maMtrTrgrCenterX->SetModifyHdl( aLink );
+ maMtrTrgrCenterY->SetModifyHdl( aLink );
+ maMtrTrgrAngle->SetModifyHdl( aLink );
+ maMtrTrgrBorder->SetModifyHdl( aLink );
+ maMtrTrgrStartValue->SetModifyHdl( aLink );
+ maMtrTrgrEndValue->SetModifyHdl( aLink );
aLink = LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl);
- maBtnLeft45.SetSelectHdl( aLink );
+ maBtnLeft45->SetSelectHdl( aLink );
aLink = LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl);
- maBtnRight45.SetSelectHdl( aLink );
- maBtnLeft45.SetItemImage(1,maRotLeft);
- Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
- maBtnLeft45.SetOutputSizePixel( aTbxSize );
- maBtnLeft45.SetQuickHelpText(1, SVX_RESSTR(STR_HELP_LEFT)); //acc wj
-
- maBtnRight45.SetItemImage(1,maRotRight);
- aTbxSize = maBtnRight45.CalcWindowSizePixel();
- maBtnRight45.SetOutputSizePixel( aTbxSize );
- maBtnRight45.SetQuickHelpText(1, SVX_RESSTR(STR_HELP_RIGHT)); //acc wj
-
- maBtnLeft45.SetBackground(Wallpaper());
- maBtnLeft45.SetPaintTransparent(true);
- maBtnRight45.SetBackground(Wallpaper());
- maBtnRight45.SetPaintTransparent(true);
+ maBtnRight45->SetSelectHdl( aLink );
+ maBtnLeft45->SetItemImage(1,maRotLeft);
+ Size aTbxSize = maBtnLeft45->CalcWindowSizePixel();
+ maBtnLeft45->SetOutputSizePixel( aTbxSize );
+ maBtnLeft45->SetQuickHelpText(1, SVX_RESSTR(STR_HELP_LEFT)); //acc wj
+
+ maBtnRight45->SetItemImage(1,maRotRight);
+ aTbxSize = maBtnRight45->CalcWindowSizePixel();
+ maBtnRight45->SetOutputSizePixel( aTbxSize );
+ maBtnRight45->SetQuickHelpText(1, SVX_RESSTR(STR_HELP_RIGHT)); //acc wj
+
+ maBtnLeft45->SetBackground(Wallpaper());
+ maBtnLeft45->SetPaintTransparent(true);
+ maBtnRight45->SetBackground(Wallpaper());
+ maBtnRight45->SetPaintTransparent(true);
FreeResource();
mpBindings = mrAreaPropertyPanel.GetBindings();
}
-
-
AreaTransparencyGradientControl::~AreaTransparencyGradientControl()
{
+ disposeOnce();
+}
+
+void AreaTransparencyGradientControl::dispose()
+{
+ maFtTrgrCenterX.disposeAndClear();
+ maMtrTrgrCenterX.disposeAndClear();
+ maFtTrgrCenterY.disposeAndClear();
+ maMtrTrgrCenterY.disposeAndClear();
+ maFtTrgrAngle.disposeAndClear();
+ maMtrTrgrAngle.disposeAndClear();
+ maBtnLeft45.disposeAndClear();
+ maBtnRight45.disposeAndClear();
+ maFtTrgrStartValue.disposeAndClear();
+ maMtrTrgrStartValue.disposeAndClear();
+ maFtTrgrEndValue.disposeAndClear();
+ maMtrTrgrEndValue.disposeAndClear();
+ maFtTrgrBorder.disposeAndClear();
+ maMtrTrgrBorder.disposeAndClear();
+ PopupControl::dispose();
}
void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem)
@@ -123,60 +141,60 @@ void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGra
aSize2 = LogicToPixel( aSize2, MapMode(MAP_APPFONT) );
long aPosY = 0;
Point aPointAngle;
- Size aSizeAngle = maMtrTrgrAngle.GetSizePixel();
- Size aTbxSize = maBtnLeft45.CalcWindowSizePixel();
+ Size aSizeAngle = maMtrTrgrAngle->GetSizePixel();
+ Size aTbxSize = maBtnLeft45->CalcWindowSizePixel();
switch(eXGS)
{
case css::awt::GradientStyle_LINEAR:
case css::awt::GradientStyle_AXIAL:
- maFtTrgrCenterX.Hide();
- maMtrTrgrCenterX.Hide();
- maFtTrgrCenterY.Hide();
- maMtrTrgrCenterY.Hide();
- maFtTrgrAngle.Show();
- maFtTrgrAngle.SetPosPixel(APOS1_1);
- maMtrTrgrAngle.Show();
- maMtrTrgrAngle.SetPosPixel(APOS2_1);
- maFtTrgrStartValue.SetPosPixel(APOS1_3);
- maMtrTrgrStartValue.SetPosPixel(APOS1_4);
- maFtTrgrEndValue.SetPosPixel(APOS2_3);
- maMtrTrgrEndValue.SetPosPixel(APOS2_4);
- maFtTrgrBorder.SetPosPixel(APOS1_5);
- maMtrTrgrBorder.SetPosPixel(APOS1_6);
-
- maBtnLeft45.Show();
- maBtnRight45.Show();
-
- aPointAngle = maMtrTrgrAngle.GetPosPixel();
+ maFtTrgrCenterX->Hide();
+ maMtrTrgrCenterX->Hide();
+ maFtTrgrCenterY->Hide();
+ maMtrTrgrCenterY->Hide();
+ maFtTrgrAngle->Show();
+ maFtTrgrAngle->SetPosPixel(APOS1_1);
+ maMtrTrgrAngle->Show();
+ maMtrTrgrAngle->SetPosPixel(APOS2_1);
+ maFtTrgrStartValue->SetPosPixel(APOS1_3);
+ maMtrTrgrStartValue->SetPosPixel(APOS1_4);
+ maFtTrgrEndValue->SetPosPixel(APOS2_3);
+ maMtrTrgrEndValue->SetPosPixel(APOS2_4);
+ maFtTrgrBorder->SetPosPixel(APOS1_5);
+ maMtrTrgrBorder->SetPosPixel(APOS1_6);
+
+ maBtnLeft45->Show();
+ maBtnRight45->Show();
+
+ aPointAngle = maMtrTrgrAngle->GetPosPixel();
aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
- maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY));
- maBtnRight45.SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY));
+ maBtnLeft45->SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY));
+ maBtnRight45->SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY));
SetSizePixel(aSize2);
break;
case css::awt::GradientStyle_RADIAL:
- maFtTrgrCenterX.Show();
- maFtTrgrCenterX.SetPosPixel(APOS1_1);
- maMtrTrgrCenterX.Show();
- maMtrTrgrCenterX.SetPosPixel(APOS2_1);
- maFtTrgrCenterY.Show();
- maFtTrgrCenterY.SetPosPixel(APOS1_2);
- maMtrTrgrCenterY.Show();
- maMtrTrgrCenterY.SetPosPixel(APOS2_2);
- maFtTrgrAngle.Hide();
- maMtrTrgrAngle.Hide();
- maFtTrgrStartValue.SetPosPixel(APOS1_3);
- maMtrTrgrStartValue.SetPosPixel(APOS1_4);
- maFtTrgrEndValue.SetPosPixel(APOS2_3);
- maMtrTrgrEndValue.SetPosPixel(APOS2_4);
- maFtTrgrBorder.SetPosPixel(APOS1_5);
- maMtrTrgrBorder.SetPosPixel(APOS1_6);
-
- maBtnLeft45.Hide();
- maBtnRight45.Hide();
+ maFtTrgrCenterX->Show();
+ maFtTrgrCenterX->SetPosPixel(APOS1_1);
+ maMtrTrgrCenterX->Show();
+ maMtrTrgrCenterX->SetPosPixel(APOS2_1);
+ maFtTrgrCenterY->Show();
+ maFtTrgrCenterY->SetPosPixel(APOS1_2);
+ maMtrTrgrCenterY->Show();
+ maMtrTrgrCenterY->SetPosPixel(APOS2_2);
+ maFtTrgrAngle->Hide();
+ maMtrTrgrAngle->Hide();
+ maFtTrgrStartValue->SetPosPixel(APOS1_3);
+ maMtrTrgrStartValue->SetPosPixel(APOS1_4);
+ maFtTrgrEndValue->SetPosPixel(APOS2_3);
+ maMtrTrgrEndValue->SetPosPixel(APOS2_4);
+ maFtTrgrBorder->SetPosPixel(APOS1_5);
+ maMtrTrgrBorder->SetPosPixel(APOS1_6);
+
+ maBtnLeft45->Hide();
+ maBtnRight45->Hide();
SetSizePixel(aSize2);
@@ -185,34 +203,34 @@ void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGra
case css::awt::GradientStyle_ELLIPTICAL:
case css::awt::GradientStyle_SQUARE:
case css::awt::GradientStyle_RECT:
- maFtTrgrCenterX.Show();
- maFtTrgrCenterX.SetPosPixel(APOS1_1);
- maMtrTrgrCenterX.Show();
- maMtrTrgrCenterX.SetPosPixel(APOS2_1);
- maFtTrgrCenterY.Show();
- maFtTrgrCenterY.SetPosPixel(APOS1_2);
- maMtrTrgrCenterY.Show();
- maMtrTrgrCenterY.SetPosPixel(APOS2_2);
- maFtTrgrAngle.Show();
- maFtTrgrAngle.SetPosPixel(APOS1_3);
- maMtrTrgrAngle.Show();
- maMtrTrgrAngle.SetPosPixel(APOS1_4);
-
- maFtTrgrStartValue.SetPosPixel(APOS1_5);
- maMtrTrgrStartValue.SetPosPixel(APOS1_6);
- maFtTrgrEndValue.SetPosPixel(APOS2_5);
- maMtrTrgrEndValue.SetPosPixel(APOS2_6);
- maFtTrgrBorder.SetPosPixel(APOS1_7);
- maMtrTrgrBorder.SetPosPixel(APOS1_8);
-
- maBtnLeft45.Show();
- maBtnRight45.Show();
-
- aPointAngle = maMtrTrgrAngle.GetPosPixel();
+ maFtTrgrCenterX->Show();
+ maFtTrgrCenterX->SetPosPixel(APOS1_1);
+ maMtrTrgrCenterX->Show();
+ maMtrTrgrCenterX->SetPosPixel(APOS2_1);
+ maFtTrgrCenterY->Show();
+ maFtTrgrCenterY->SetPosPixel(APOS1_2);
+ maMtrTrgrCenterY->Show();
+ maMtrTrgrCenterY->SetPosPixel(APOS2_2);
+ maFtTrgrAngle->Show();
+ maFtTrgrAngle->SetPosPixel(APOS1_3);
+ maMtrTrgrAngle->Show();
+ maMtrTrgrAngle->SetPosPixel(APOS1_4);
+
+ maFtTrgrStartValue->SetPosPixel(APOS1_5);
+ maMtrTrgrStartValue->SetPosPixel(APOS1_6);
+ maFtTrgrEndValue->SetPosPixel(APOS2_5);
+ maMtrTrgrEndValue->SetPosPixel(APOS2_6);
+ maFtTrgrBorder->SetPosPixel(APOS1_7);
+ maMtrTrgrBorder->SetPosPixel(APOS1_8);
+
+ maBtnLeft45->Show();
+ maBtnRight45->Show();
+
+ aPointAngle = maMtrTrgrAngle->GetPosPixel();
aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight();
- maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY));
- maBtnRight45.SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY));
+ maBtnLeft45->SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY));
+ maBtnRight45->SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY));
SetSizePixel(aSize);
@@ -247,12 +265,12 @@ void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGr
{
aGradient = rGradient;
}
- maMtrTrgrCenterX.SetValue(aGradient.GetXOffset());
- maMtrTrgrCenterY.SetValue(aGradient.GetYOffset());
- maMtrTrgrAngle.SetValue(aGradient.GetAngle() / 10);
- maMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255));
- maMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255));
- maMtrTrgrBorder.SetValue(aGradient.GetBorder());
+ maMtrTrgrCenterX->SetValue(aGradient.GetXOffset());
+ maMtrTrgrCenterY->SetValue(aGradient.GetYOffset());
+ maMtrTrgrAngle->SetValue(aGradient.GetAngle() / 10);
+ maMtrTrgrStartValue->SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255));
+ maMtrTrgrEndValue->SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255));
+ maMtrTrgrBorder->SetValue(aGradient.GetBorder());
}
@@ -261,21 +279,21 @@ void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGr
void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol )
{
//Added
- sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle.GetValue();
+ sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle->GetValue();
while(aMtrValue<0)
aMtrValue += 360;
sal_uInt16 nVal = aMtrValue/360;
nVal = aMtrValue - nVal*360;
- maMtrTrgrAngle.SetValue(nVal);
+ maMtrTrgrAngle->SetValue(nVal);
//End of new code
XGradient aTmpGradient(
Color(nStartCol, nStartCol, nStartCol),
Color(nEndCol, nEndCol, nEndCol),
(css::awt::GradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2),
- (sal_uInt16)maMtrTrgrAngle.GetValue() * 10,
- (sal_uInt16)maMtrTrgrCenterX.GetValue(),
- (sal_uInt16)maMtrTrgrCenterY.GetValue(),
- (sal_uInt16)maMtrTrgrBorder.GetValue(),
+ (sal_uInt16)maMtrTrgrAngle->GetValue() * 10,
+ (sal_uInt16)maMtrTrgrCenterX->GetValue(),
+ (sal_uInt16)maMtrTrgrCenterY->GetValue(),
+ (sal_uInt16)maMtrTrgrBorder->GetValue(),
100, 100);
mrAreaPropertyPanel.SetGradient(aTmpGradient);
@@ -292,8 +310,8 @@ void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, s
IMPL_LINK_NOARG(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl)
{
- sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
- sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
+ sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
+ sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
ExecuteValueModify( nStartCol, nEndCol );
return 0L;
}
@@ -303,13 +321,13 @@ IMPL_LINK_NOARG(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl)
IMPL_LINK_NOARG(AreaTransparencyGradientControl, Left_Click45_Impl)
{
- sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
- sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
- sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
+ sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
+ sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
+ sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle->GetValue();
if(aTemp>=315)
aTemp -= 360;
aTemp += 45;
- maMtrTrgrAngle.SetValue(aTemp);
+ maMtrTrgrAngle->SetValue(aTemp);
ExecuteValueModify( nStartCol, nEndCol );
return 0L;
}
@@ -319,13 +337,13 @@ IMPL_LINK_NOARG(AreaTransparencyGradientControl, Left_Click45_Impl)
IMPL_LINK_NOARG(AreaTransparencyGradientControl, Right_Click45_Impl)
{
- sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100);
- sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100);
- sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue();
+ sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100);
+ sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100);
+ sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle->GetValue();
if(aTemp<45)
aTemp += 360;
aTemp -= 45;
- maMtrTrgrAngle.SetValue(aTemp);
+ maMtrTrgrAngle->SetValue(aTemp);
ExecuteValueModify( nStartCol, nEndCol );
return 0L;
}
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
index 3486508cb133..eb8cfc37285d 100644
--- a/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
+++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
@@ -42,6 +42,7 @@ public:
vcl::Window* pParent,
AreaPropertyPanel& rPanel);
virtual ~AreaTransparencyGradientControl();
+ virtual void dispose() SAL_OVERRIDE;
void Rearrange(XFillFloatTransparenceItem* pGradientItem);
void InitStatus(XFillFloatTransparenceItem* pGradientItem);
@@ -49,20 +50,20 @@ public:
void SetControlState_Impl(css::awt::GradientStyle eXGS);
private:
- FixedText maFtTrgrCenterX;
- MetricField maMtrTrgrCenterX;
- FixedText maFtTrgrCenterY;
- MetricField maMtrTrgrCenterY;
- FixedText maFtTrgrAngle;
- MetricField maMtrTrgrAngle;
- ToolBox maBtnLeft45;
- ToolBox maBtnRight45;
- FixedText maFtTrgrStartValue;
- MetricField maMtrTrgrStartValue;
- FixedText maFtTrgrEndValue;
- MetricField maMtrTrgrEndValue;
- FixedText maFtTrgrBorder;
- MetricField maMtrTrgrBorder;
+ VclPtr<FixedText> maFtTrgrCenterX;
+ VclPtr<MetricField> maMtrTrgrCenterX;
+ VclPtr<FixedText> maFtTrgrCenterY;
+ VclPtr<MetricField> maMtrTrgrCenterY;
+ VclPtr<FixedText> maFtTrgrAngle;
+ VclPtr<MetricField> maMtrTrgrAngle;
+ VclPtr<ToolBox> maBtnLeft45;
+ VclPtr<ToolBox> maBtnRight45;
+ VclPtr<FixedText> maFtTrgrStartValue;
+ VclPtr<MetricField> maMtrTrgrStartValue;
+ VclPtr<FixedText> maFtTrgrEndValue;
+ VclPtr<MetricField> maMtrTrgrEndValue;
+ VclPtr<FixedText> maFtTrgrBorder;
+ VclPtr<MetricField> maMtrTrgrBorder;
Image maRotLeft;
Image maRotRight;
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
index 55caa6c2feba..6b8a3d11d68d 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
@@ -66,12 +66,33 @@ GraphicPropertyPanel::GraphicPropertyPanel(
Initialize();
}
-
-
GraphicPropertyPanel::~GraphicPropertyPanel()
{
+ disposeOnce();
}
+void GraphicPropertyPanel::dispose()
+{
+ mpMtrBrightness.clear();
+ mpMtrContrast.clear();
+ mpLBColorMode.clear();
+ mpMtrTrans.clear();
+ mpMtrRed.clear();
+ mpMtrGreen.clear();
+ mpMtrBlue.clear();
+ mpMtrGamma.clear();
+
+ maBrightControl.dispose();
+ maContrastControl.dispose();
+ maTransparenceControl.dispose();
+ maRedControl.dispose();
+ maGreenControl.dispose();
+ maBlueControl.dispose();
+ maGammaControl.dispose();
+ maModeControl.dispose();
+
+ PanelLayout::dispose();
+}
void GraphicPropertyPanel::Initialize()
@@ -221,7 +242,7 @@ void GraphicPropertyPanel::SetupIcons()
-GraphicPropertyPanel* GraphicPropertyPanel::Create (
+VclPtr<vcl::Window> GraphicPropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
@@ -233,10 +254,10 @@ GraphicPropertyPanel* GraphicPropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to GraphicPropertyPanel::Create", NULL, 2);
- return new GraphicPropertyPanel(
- pParent,
- rxFrame,
- pBindings);
+ return VclPtr<GraphicPropertyPanel>::Create(
+ pParent,
+ rxFrame,
+ pBindings);
}
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
index 33e0010b46f1..83024d3f028e 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
@@ -39,7 +39,10 @@ class GraphicPropertyPanel
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static GraphicPropertyPanel* Create(
+ virtual ~GraphicPropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
@@ -55,16 +58,22 @@ public:
SfxBindings* GetBindings() { return mpBindings;}
+ // constructor/destuctor
+ GraphicPropertyPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings);
+
private:
//ui controls
- MetricField* mpMtrBrightness;
- MetricField* mpMtrContrast;
- ListBox* mpLBColorMode;
- MetricField* mpMtrTrans;
- MetricField* mpMtrRed;
- MetricField* mpMtrGreen;
- MetricField* mpMtrBlue;
- MetricField* mpMtrGamma;
+ VclPtr<MetricField> mpMtrBrightness;
+ VclPtr<MetricField> mpMtrContrast;
+ VclPtr<ListBox> mpLBColorMode;
+ VclPtr<MetricField> mpMtrTrans;
+ VclPtr<MetricField> mpMtrRed;
+ VclPtr<MetricField> mpMtrGreen;
+ VclPtr<MetricField> mpMtrBlue;
+ VclPtr<MetricField> mpMtrGamma;
::sfx2::sidebar::ControllerItem maBrightControl;
::sfx2::sidebar::ControllerItem maContrastControl;
@@ -93,13 +102,6 @@ private:
DECL_LINK( BlueHdl, void*);
DECL_LINK( GammaHdl, void*);
- // constructor/destuctor
- GraphicPropertyPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings);
- virtual ~GraphicPropertyPanel();
-
static void SetupIcons();
void Initialize();
};
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.cxx b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
index cbf133f32eca..590759bd7568 100644
--- a/svx/source/sidebar/insert/InsertPropertyPanel.cxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.cxx
@@ -72,16 +72,21 @@ InsertPropertyPanel::InsertPropertyPanel (
pTopWindow->AddChildEventListener(LINK(this, InsertPropertyPanel, WindowEventListener));
}
-
-
-
InsertPropertyPanel::~InsertPropertyPanel()
{
+ disposeOnce();
+}
+
+void InsertPropertyPanel::dispose()
+{
// Remove window child listener.
vcl::Window* pTopWindow = this;
while (pTopWindow->GetParent() != NULL)
pTopWindow = pTopWindow->GetParent();
pTopWindow->RemoveChildEventListener(LINK(this, InsertPropertyPanel, WindowEventListener));
+ mpStandardShapesToolBox.clear();
+ mpCustomShapesToolBox.clear();
+ PanelLayout::dispose();
}
@@ -118,13 +123,13 @@ IMPL_LINK(InsertPropertyPanel, WindowEventListener, VclSimpleEvent*, pEvent)
if (nId == 0)
return 1;
- SidebarToolBox* pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpStandardShapesToolBox);
+ SidebarToolBox* pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpStandardShapesToolBox.get());
if (pSidebarToolBox == NULL)
return 1;
sal_uInt16 nItemId (pSidebarToolBox->GetItemIdForSubToolbarName(aURL.Path));
if (nItemId == 0)
{
- pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpCustomShapesToolBox);
+ pSidebarToolBox = dynamic_cast<SidebarToolBox*>(mpCustomShapesToolBox.get());
if (pSidebarToolBox == NULL)
return 1;
nItemId = pSidebarToolBox->GetItemIdForSubToolbarName(aURL.Path);
diff --git a/svx/source/sidebar/insert/InsertPropertyPanel.hxx b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
index bef58fd1919c..2539695313bf 100644
--- a/svx/source/sidebar/insert/InsertPropertyPanel.hxx
+++ b/svx/source/sidebar/insert/InsertPropertyPanel.hxx
@@ -42,10 +42,11 @@ public:
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
virtual ~InsertPropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
private:
- ToolBox* mpStandardShapesToolBox;
- ToolBox* mpCustomShapesToolBox;
+ VclPtr<ToolBox> mpStandardShapesToolBox;
+ VclPtr<ToolBox> mpCustomShapesToolBox;
const css::uno::Reference<css::frame::XFrame> mxFrame;
DECL_LINK(WindowEventListener, VclSimpleEvent*);
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index 02d7f3389aec..004fef29dc0b 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -194,6 +194,37 @@ LinePropertyPanel::LinePropertyPanel(
LinePropertyPanel::~LinePropertyPanel()
{
+ disposeOnce();
+}
+
+void LinePropertyPanel::dispose()
+{
+ mpFTWidth.clear();
+ mpTBWidth.clear();
+ mpFTStyle.clear();
+ mpLBStyle.clear();
+ mpFTTrancparency.clear();
+ mpMFTransparent.clear();
+ mpFTArrow.clear();
+ mpLBStart.clear();
+ mpLBEnd.clear();
+ mpFTEdgeStyle.clear();
+ mpLBEdgeStyle.clear();
+ mpFTCapStyle.clear();
+ mpLBCapStyle.clear();
+
+ maStyleControl.dispose();
+ maDashControl.dispose();
+ maWidthControl.dispose();
+ maStartControl.dispose();
+ maEndControl.dispose();
+ maLineEndListControl.dispose();
+ maLineStyleListControl.dispose();
+ maTransControl.dispose();
+ maEdgeStyle.dispose();
+ maCapStyle.dispose();
+
+ PanelLayout::dispose();
}
void LinePropertyPanel::Initialize()
@@ -267,7 +298,7 @@ void LinePropertyPanel::SetupIcons()
}
}
-LinePropertyPanel* LinePropertyPanel::Create (
+VclPtr<vcl::Window> LinePropertyPanel::Create (
vcl::Window* pParent,
const uno::Reference<frame::XFrame>& rxFrame,
SfxBindings* pBindings)
@@ -279,7 +310,7 @@ LinePropertyPanel* LinePropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to LinePropertyPanel::Create", NULL, 2);
- return new LinePropertyPanel(pParent, rxFrame, pBindings);
+ return VclPtr<LinePropertyPanel>::Create(pParent, rxFrame, pBindings);
}
void LinePropertyPanel::DataChanged(const DataChangedEvent& /*rEvent*/)
@@ -750,9 +781,9 @@ IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG )
return 0L;
}
-PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
+VclPtr<PopupControl> LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
{
- return new LineWidthControl(pParent, *this);
+ return VclPtrInstance<LineWidthControl>(pParent, *this);
}
void LinePropertyPanel::EndLineWidthPopupMode()
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx
index 2d6a2898b7aa..33a9b7675abe 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -60,7 +60,10 @@ class LinePropertyPanel : public PanelLayout,
public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static LinePropertyPanel* Create(
+ virtual ~LinePropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
@@ -82,21 +85,27 @@ public:
void EndLineWidthPopupMode();
+ // constructor/destuctor
+ LinePropertyPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings);
+
private:
//ui controls
- FixedText* mpFTWidth;
- ToolBox* mpTBWidth;
- FixedText* mpFTStyle;
- ListBox* mpLBStyle;
- FixedText* mpFTTrancparency;
- MetricField* mpMFTransparent;
- FixedText* mpFTArrow;
- ListBox* mpLBStart;
- ListBox* mpLBEnd;
- FixedText* mpFTEdgeStyle;
- ListBox* mpLBEdgeStyle;
- FixedText* mpFTCapStyle;
- ListBox* mpLBCapStyle;
+ VclPtr<FixedText> mpFTWidth;
+ VclPtr<ToolBox> mpTBWidth;
+ VclPtr<FixedText> mpFTStyle;
+ VclPtr<ListBox> mpLBStyle;
+ VclPtr<FixedText> mpFTTrancparency;
+ VclPtr<MetricField> mpMFTransparent;
+ VclPtr<FixedText> mpFTArrow;
+ VclPtr<ListBox> mpLBStart;
+ VclPtr<ListBox> mpLBEnd;
+ VclPtr<FixedText> mpFTEdgeStyle;
+ VclPtr<ListBox> mpLBEdgeStyle;
+ VclPtr<FixedText> mpFTCapStyle;
+ VclPtr<ListBox> mpLBCapStyle;
//ControllerItem
sfx2::sidebar::ControllerItem maStyleControl;
@@ -152,14 +161,7 @@ private:
DECL_LINK(ChangeEdgeStyleHdl, void *);
DECL_LINK(ChangeCapStyleHdl, void *);
- // constructor/destuctor
- LinePropertyPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings);
- virtual ~LinePropertyPanel();
-
- PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
+ VclPtr<PopupControl> CreateLineWidthPopupControl (PopupContainer* pParent);
};
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/line/LineWidthControl.cxx b/svx/source/sidebar/line/LineWidthControl.cxx
index 98fb8d2e9b1f..fd986ee94f54 100644
--- a/svx/source/sidebar/line/LineWidthControl.cxx
+++ b/svx/source/sidebar/line/LineWidthControl.cxx
@@ -41,10 +41,10 @@ LineWidthControl::LineWidthControl (
: svx::sidebar::PopupControl(pParent,SVX_RES(RID_POPUPPANEL_LINEPAGE_WIDTH)),
mrLinePropertyPanel(rPanel),
mpBindings(NULL),
- maVSWidth( this, SVX_RES(VS_WIDTH)),
- maFTCus( this, SVX_RES(FT_CUSTOME)),
- maFTWidth( this, SVX_RES(FT_LINE_WIDTH)),
- maMFWidth( this, SVX_RES(MF_WIDTH)),
+ maVSWidth(VclPtr<LineWidthValueSet>::Create(this, SVX_RES(VS_WIDTH))),
+ maFTCus( VclPtr<FixedText>::Create(this, SVX_RES(FT_CUSTOME))),
+ maFTWidth( VclPtr<FixedText>::Create(this, SVX_RES(FT_LINE_WIDTH))),
+ maMFWidth( VclPtr<MetricField>::Create(this, SVX_RES(MF_WIDTH))),
meMapUnit(SFX_MAPUNIT_TWIP),
rStr(NULL),
mstrPT(SVX_RESSTR(STR_PT)),
@@ -61,12 +61,19 @@ LineWidthControl::LineWidthControl (
mpBindings = mrLinePropertyPanel.GetBindings();
}
-
-
-
LineWidthControl::~LineWidthControl()
{
+ disposeOnce();
+}
+
+void LineWidthControl::dispose()
+{
delete[] rStr;
+ maVSWidth.disposeAndClear();
+ maFTCus.disposeAndClear();
+ maFTWidth.disposeAndClear();
+ maMFWidth.disposeAndClear();
+ svx::sidebar::PopupControl::dispose();
}
@@ -104,33 +111,33 @@ void LineWidthControl::Paint(const Rectangle& rect)
void LineWidthControl::Initialize()
{
- maVSWidth.SetStyle( maVSWidth.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD |
+ maVSWidth->SetStyle( maVSWidth->GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD |
//for high contrast wj
if(GetSettings().GetStyleSettings().GetHighContrastMode())
{
- maVSWidth.SetColor(GetSettings().GetStyleSettings().GetMenuColor());
+ maVSWidth->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
// maBorder.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
- maFTWidth.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+ maFTWidth->SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
}
else
{
- maVSWidth.SetColor(COL_WHITE);
+ maVSWidth->SetColor(COL_WHITE);
// maBorder.SetBackground(Wallpaper(COL_WHITE));
- maFTWidth.SetBackground(Wallpaper(COL_WHITE));
+ maFTWidth->SetBackground(Wallpaper(COL_WHITE));
}
- sal_Int64 nFirst= maMFWidth.Denormalize( maMFWidth.GetFirst( FUNIT_TWIP ) );
- sal_Int64 nLast = maMFWidth.Denormalize( maMFWidth.GetLast( FUNIT_TWIP ) );
- sal_Int64 nMin = maMFWidth.Denormalize( maMFWidth.GetMin( FUNIT_TWIP ) );
- sal_Int64 nMax = maMFWidth.Denormalize( maMFWidth.GetMax( FUNIT_TWIP ) );
- maMFWidth.SetSpinSize( 10 );
- maMFWidth.SetUnit( FUNIT_POINT );
- if( maMFWidth.GetDecimalDigits() > 1 )
- maMFWidth.SetDecimalDigits( 1 );
- maMFWidth.SetFirst( maMFWidth.Normalize( nFirst ), FUNIT_TWIP );
- maMFWidth.SetLast( maMFWidth.Normalize( nLast ), FUNIT_TWIP );
- maMFWidth.SetMin( maMFWidth.Normalize( nMin ), FUNIT_TWIP );
- maMFWidth.SetMax( maMFWidth.Normalize( nMax ), FUNIT_TWIP );
+ sal_Int64 nFirst= maMFWidth->Denormalize( maMFWidth->GetFirst( FUNIT_TWIP ) );
+ sal_Int64 nLast = maMFWidth->Denormalize( maMFWidth->GetLast( FUNIT_TWIP ) );
+ sal_Int64 nMin = maMFWidth->Denormalize( maMFWidth->GetMin( FUNIT_TWIP ) );
+ sal_Int64 nMax = maMFWidth->Denormalize( maMFWidth->GetMax( FUNIT_TWIP ) );
+ maMFWidth->SetSpinSize( 10 );
+ maMFWidth->SetUnit( FUNIT_POINT );
+ if( maMFWidth->GetDecimalDigits() > 1 )
+ maMFWidth->SetDecimalDigits( 1 );
+ maMFWidth->SetFirst( maMFWidth->Normalize( nFirst ), FUNIT_TWIP );
+ maMFWidth->SetLast( maMFWidth->Normalize( nLast ), FUNIT_TWIP );
+ maMFWidth->SetMin( maMFWidth->Normalize( nMin ), FUNIT_TWIP );
+ maMFWidth->SetMax( maMFWidth->Normalize( nMax ), FUNIT_TWIP );
rStr = new OUString[9];
//modify,
@@ -157,28 +164,28 @@ void LineWidthControl::Initialize()
for(sal_uInt16 i = 1 ; i <= 9 ; i++)
{
- maVSWidth.InsertItem(i);
- maVSWidth.SetItemText(i, rStr[i-1]);
+ maVSWidth->InsertItem(i);
+ maVSWidth->SetItemText(i, rStr[i-1]);
}
- maVSWidth.SetUnit(rStr);
- maVSWidth.SetItemData(1, reinterpret_cast<void*>(5));
- maVSWidth.SetItemData(2, reinterpret_cast<void*>(8));
- maVSWidth.SetItemData(3, reinterpret_cast<void*>(10));
- maVSWidth.SetItemData(4, reinterpret_cast<void*>(15));
- maVSWidth.SetItemData(5, reinterpret_cast<void*>(23));
- maVSWidth.SetItemData(6, reinterpret_cast<void*>(30));
- maVSWidth.SetItemData(7, reinterpret_cast<void*>(45));
- maVSWidth.SetItemData(8, reinterpret_cast<void*>(60));
- maVSWidth.SetImage(maIMGCusGray);
-
- maVSWidth.SetSelItem(0);
+ maVSWidth->SetUnit(rStr);
+ maVSWidth->SetItemData(1, reinterpret_cast<void*>(5));
+ maVSWidth->SetItemData(2, reinterpret_cast<void*>(8));
+ maVSWidth->SetItemData(3, reinterpret_cast<void*>(10));
+ maVSWidth->SetItemData(4, reinterpret_cast<void*>(15));
+ maVSWidth->SetItemData(5, reinterpret_cast<void*>(23));
+ maVSWidth->SetItemData(6, reinterpret_cast<void*>(30));
+ maVSWidth->SetItemData(7, reinterpret_cast<void*>(45));
+ maVSWidth->SetItemData(8, reinterpret_cast<void*>(60));
+ maVSWidth->SetImage(maIMGCusGray);
+
+ maVSWidth->SetSelItem(0);
Link aLink = LINK( this, LineWidthControl, VSSelectHdl ) ;
- maVSWidth.SetSelectHdl(aLink);
+ maVSWidth->SetSelectHdl(aLink);
aLink = LINK(this, LineWidthControl, MFModifyHdl);
- maMFWidth.SetModifyHdl(aLink);
+ maMFWidth->SetModifyHdl(aLink);
- maVSWidth.StartSelection();
- maVSWidth.Show();
+ maVSWidth->StartSelection();
+ maVSWidth->Show();
}
@@ -187,9 +194,9 @@ void LineWidthControl::Initialize()
void LineWidthControl::GetFocus()
{
if(!mbVSFocus)
- maMFWidth.GrabFocus();
+ maMFWidth->GrabFocus();
else
- maVSWidth.GrabFocus();
+ maVSWidth->GrabFocus();
}
@@ -198,7 +205,7 @@ void LineWidthControl::GetFocus()
void LineWidthControl::SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit)
{
mbVSFocus = true;
- maVSWidth.SetSelItem(0);
+ maVSWidth->SetSelItem(0);
mbCloseByEdit = false;
meMapUnit = eMapUnit;
SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE );
@@ -212,54 +219,54 @@ void LineWidthControl::SetWidthSelect( long lValue, bool bValuable, SfxMapUnit e
OUString aWinData( aTmp );
mnCustomWidth = aWinData.toInt32();
mbCustom = true;
- maVSWidth.SetImage(maIMGCus);
- maVSWidth.SetCusEnable(true);
+ maVSWidth->SetImage(maIMGCus);
+ maVSWidth->SetCusEnable(true);
OUString aStrTip( OUString::number( (double)mnCustomWidth / 10));
aStrTip += mstrPT;
- maVSWidth.SetItemText(9, aStrTip);
+ maVSWidth->SetItemText(9, aStrTip);
}
else
{
mbCustom = false;
- maVSWidth.SetImage(maIMGCusGray);
- maVSWidth.SetCusEnable(false);
+ maVSWidth->SetImage(maIMGCusGray);
+ maVSWidth->SetCusEnable(false);
//modify
//String aStrTip(String(SVX_RES(STR_WIDTH_LAST_CUSTOM)));
- //maVSWidth.SetItemText(9, aStrTip);
- maVSWidth.SetItemText(9, rStr[8]);
+ //maVSWidth->SetItemText(9, aStrTip);
+ maVSWidth->SetItemText(9, rStr[8]);
}
if(bValuable)
{
sal_Int64 nVal = OutputDevice::LogicToLogic( lValue, (MapUnit)eMapUnit, MAP_100TH_MM );
- nVal = maMFWidth.Normalize( nVal );
- maMFWidth.SetValue( nVal, FUNIT_100TH_MM );
+ nVal = maMFWidth->Normalize( nVal );
+ maMFWidth->SetValue( nVal, FUNIT_100TH_MM );
}
else
{
- maMFWidth.SetText( "" );
+ maMFWidth->SetText( "" );
}
MapUnit eOrgUnit = (MapUnit)eMapUnit;
MapUnit ePntUnit( MAP_TWIP );
lValue = LogicToLogic( lValue , eOrgUnit, ePntUnit );
- OUString strCurrValue = maMFWidth.GetText();
+ OUString strCurrValue = maMFWidth->GetText();
sal_uInt16 i = 0;
for(; i < 8; i++)
if(strCurrValue == rStr[i])
{
- maVSWidth.SetSelItem(i+1);
+ maVSWidth->SetSelItem(i+1);
break;
}
if (i>=8)
{
mbVSFocus = false;
- maVSWidth.SetSelItem(0);
+ maVSWidth->SetSelItem(0);
}
- maVSWidth.Format();
- maVSWidth.StartSelection();
+ maVSWidth->Format();
+ maVSWidth->StartSelection();
}
@@ -269,11 +276,11 @@ IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl)
{
if(pControl == &maVSWidth)
{
- sal_uInt16 iPos = maVSWidth.GetSelectItemId();
+ sal_uInt16 iPos = maVSWidth->GetSelectItemId();
if(iPos >= 1 && iPos <= 8)
{
- sal_IntPtr nVal = LogicToLogic(reinterpret_cast<sal_IntPtr>(maVSWidth.GetItemData( iPos )), MAP_POINT, (MapUnit)meMapUnit);
- nVal = maMFWidth.Denormalize(nVal);
+ sal_IntPtr nVal = LogicToLogic(reinterpret_cast<sal_IntPtr>(maVSWidth->GetItemData( iPos )), MAP_POINT, (MapUnit)meMapUnit);
+ nVal = maMFWidth->Denormalize(nVal);
XLineWidthItem aWidthItem( nVal );
mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SfxCallMode::RECORD, &aWidthItem, 0L);
mrLinePropertyPanel.SetWidthIcon(iPos);
@@ -287,7 +294,7 @@ IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl)
if(mbCustom)
{
long nVal = LogicToLogic(mnCustomWidth , MAP_POINT, (MapUnit)meMapUnit);
- nVal = maMFWidth.Denormalize(nVal);
+ nVal = maMFWidth->Denormalize(nVal);
XLineWidthItem aWidthItem( nVal );
mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SfxCallMode::RECORD, &aWidthItem, 0L);
mrLinePropertyPanel.SetWidth(nVal);
@@ -296,10 +303,10 @@ IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl)
}
else
{
- maVSWidth.SetNoSelection(); //add , set no selection and keep the last select item
- maVSWidth.Format();
+ maVSWidth->SetNoSelection(); //add , set no selection and keep the last select item
+ maVSWidth->Format();
Invalidate();
- maVSWidth.StartSelection();
+ maVSWidth->StartSelection();
}
//modify end
}
@@ -316,16 +323,16 @@ IMPL_LINK(LineWidthControl, MFModifyHdl, void *, pControl)
{
if(pControl == &maMFWidth)
{
- if(maVSWidth.GetSelItem())
+ if(maVSWidth->GetSelItem())
{
- maVSWidth.SetSelItem(0);
- maVSWidth.Format();
+ maVSWidth->SetSelItem(0);
+ maVSWidth->Format();
Invalidate();
- maVSWidth.StartSelection();
+ maVSWidth->StartSelection();
}
- long nTmp = static_cast<long>(maMFWidth.GetValue());
+ long nTmp = static_cast<long>(maMFWidth->GetValue());
long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)meMapUnit );
- sal_Int32 nNewWidth = (short)maMFWidth.Denormalize( nVal );
+ sal_Int32 nNewWidth = (short)maMFWidth->Denormalize( nVal );
XLineWidthItem aWidthItem(nNewWidth);
mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SfxCallMode::RECORD, &aWidthItem, 0L);
diff --git a/svx/source/sidebar/line/LineWidthControl.hxx b/svx/source/sidebar/line/LineWidthControl.hxx
index 4afa1e595c88..5af26026e92a 100644
--- a/svx/source/sidebar/line/LineWidthControl.hxx
+++ b/svx/source/sidebar/line/LineWidthControl.hxx
@@ -38,6 +38,7 @@ class LineWidthControl
public:
LineWidthControl (vcl::Window* pParent, LinePropertyPanel& rPanel);
virtual ~LineWidthControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void Paint(const Rectangle& rect) SAL_OVERRIDE;
@@ -47,12 +48,12 @@ public:
long GetTmpCustomWidth() { return mnTmpCustomWidth;}
private:
- LinePropertyPanel& mrLinePropertyPanel;
+ LinePropertyPanel& mrLinePropertyPanel;
SfxBindings* mpBindings;
- LineWidthValueSet maVSWidth;
- FixedText maFTCus;
- FixedText maFTWidth;
- MetricField maMFWidth;
+ VclPtr<LineWidthValueSet> maVSWidth;
+ VclPtr<FixedText> maFTCus;
+ VclPtr<FixedText> maFTWidth;
+ VclPtr<MetricField> maMFWidth;
SfxMapUnit meMapUnit;
OUString* rStr;
OUString mstrPT;
diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx b/svx/source/sidebar/line/LineWidthValueSet.cxx
index fb17d25cc84d..532a11cdd9c5 100644
--- a/svx/source/sidebar/line/LineWidthValueSet.cxx
+++ b/svx/source/sidebar/line/LineWidthValueSet.cxx
@@ -41,12 +41,15 @@ LineWidthValueSet::LineWidthValueSet (
LineWidthValueSet::~LineWidthValueSet()
{
- delete pVDev;
- delete[] strUnit;
+ disposeOnce();
}
-
-
+void LineWidthValueSet::dispose()
+{
+ pVDev.disposeAndClear();
+ delete[] strUnit;
+ ValueSet::dispose();
+}
void LineWidthValueSet::SetUnit(OUString* str)
{
diff --git a/svx/source/sidebar/line/LineWidthValueSet.hxx b/svx/source/sidebar/line/LineWidthValueSet.hxx
index 4fe20e46208f..7cb02031a272 100644
--- a/svx/source/sidebar/line/LineWidthValueSet.hxx
+++ b/svx/source/sidebar/line/LineWidthValueSet.hxx
@@ -30,6 +30,7 @@ class LineWidthValueSet
public:
LineWidthValueSet (vcl::Window* pParent, const ResId& rResId);
virtual ~LineWidthValueSet();
+ virtual void dispose() SAL_OVERRIDE;
void SetUnit(OUString* str);
void SetSelItem(sal_uInt16 nSel);
@@ -40,7 +41,7 @@ public:
virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
protected:
- VirtualDevice* pVDev;
+ VclPtr<VirtualDevice> pVDev;
sal_uInt16 nSelItem;
OUString* strUnit;
Image imgCus;
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
index 136e2c349964..29f93b25ddc2 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -62,7 +62,7 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId)
mpLineDistAtPercentBox = get<MetricField>("percent_box");
mpLineDistAtMetricBox = get<MetricField>("metric_box");
- mpActLineDistFld = mpLineDistAtPercentBox;
+ mpActLineDistFld = mpLineDistAtPercentBox.get();
meLNSpaceUnit = SFX_MAPUNIT_100TH_MM;
@@ -94,6 +94,21 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId)
ParaLineSpacingControl::~ParaLineSpacingControl()
{
+ disposeOnce();
+}
+
+void ParaLineSpacingControl::dispose()
+{
+ mpActLineDistFld.clear();
+ mpSpacing1Button.clear();
+ mpSpacing115Button.clear();
+ mpSpacing15Button.clear();
+ mpSpacing2Button.clear();
+ mpLineDist.clear();
+ mpLineDistLabel.clear();
+ mpLineDistAtPercentBox.clear();
+ mpLineDistAtMetricBox.clear();
+ SfxPopupWindow::dispose();
}
void ParaLineSpacingControl::Initialize()
@@ -245,7 +260,7 @@ void ParaLineSpacingControl::UpdateMetricFields()
case LLINESPACE_DURCH:
mpLineDistAtPercentBox->Hide();
- mpActLineDistFld = mpLineDistAtMetricBox;
+ mpActLineDistFld = mpLineDistAtMetricBox.get();
mpLineDistAtMetricBox->SetMin(0);
if (mpLineDistAtMetricBox->GetText().isEmpty())
@@ -259,7 +274,7 @@ void ParaLineSpacingControl::UpdateMetricFields()
case LLINESPACE_MIN:
mpLineDistAtPercentBox->Hide();
- mpActLineDistFld = mpLineDistAtMetricBox;
+ mpActLineDistFld = mpLineDistAtMetricBox.get();
mpLineDistAtMetricBox->SetMin(0);
if (mpLineDistAtMetricBox->GetText().isEmpty())
@@ -273,7 +288,7 @@ void ParaLineSpacingControl::UpdateMetricFields()
case LLINESPACE_PROP:
mpLineDistAtMetricBox->Hide();
- mpActLineDistFld = mpLineDistAtPercentBox;
+ mpActLineDistFld = mpLineDistAtPercentBox.get();
if (mpLineDistAtPercentBox->GetText().isEmpty())
mpLineDistAtPercentBox->SetValue(mpLineDistAtPercentBox->Normalize(100), FUNIT_TWIP);
@@ -286,7 +301,7 @@ void ParaLineSpacingControl::UpdateMetricFields()
case LLINESPACE_FIX:
mpLineDistAtPercentBox->Hide();
- mpActLineDistFld = mpLineDistAtMetricBox;
+ mpActLineDistFld = mpLineDistAtMetricBox.get();
sal_Int64 nTemp = mpLineDistAtMetricBox->GetValue();
mpLineDistAtMetricBox->SetMin(mpLineDistAtMetricBox->Normalize(MIN_FIXED_DISTANCE), FUNIT_TWIP);
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
index a14df2c9d575..cd2422ef2bf1 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
@@ -31,22 +31,23 @@ class ParaLineSpacingControl : public SfxPopupWindow
public:
ParaLineSpacingControl(sal_uInt16 nId);
virtual ~ParaLineSpacingControl();
+ virtual void dispose() SAL_OVERRIDE;
private:
SfxMapUnit meLNSpaceUnit;
- Edit* mpActLineDistFld;
+ VclPtr<Edit> mpActLineDistFld;
- PushButton* mpSpacing1Button;
- PushButton* mpSpacing115Button;
- PushButton* mpSpacing15Button;
- PushButton* mpSpacing2Button;
+ VclPtr<PushButton> mpSpacing1Button;
+ VclPtr<PushButton> mpSpacing115Button;
+ VclPtr<PushButton> mpSpacing15Button;
+ VclPtr<PushButton> mpSpacing2Button;
- ListBox* mpLineDist;
+ VclPtr<ListBox> mpLineDist;
- FixedText* mpLineDistLabel;
- MetricField* mpLineDistAtPercentBox;
- MetricField* mpLineDistAtMetricBox;
+ VclPtr<FixedText> mpLineDistLabel;
+ VclPtr<MetricField> mpLineDistAtPercentBox;
+ VclPtr<MetricField> mpLineDistAtMetricBox;
private:
/// Setup the widgets with values from the document.
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
index 5b1329178b9a..4041ef6a887a 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
@@ -42,9 +42,9 @@ SfxPopupWindowType ParaLineSpacingPopup::GetPopupWindowType() const
return SfxPopupWindowType::ONTIMEOUT;
}
-SfxPopupWindow* ParaLineSpacingPopup::CreatePopupWindow()
+VclPtr<SfxPopupWindow> ParaLineSpacingPopup::CreatePopupWindow()
{
- ParaLineSpacingControl* pControl = new ParaLineSpacingControl(GetSlotId());
+ VclPtr<ParaLineSpacingControl> pControl = VclPtr<ParaLineSpacingControl>::Create(GetSlotId());
pControl->StartPopupMode(&GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE);
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index b78e985ed94a..db3241acfc04 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -55,7 +55,7 @@ namespace svx {namespace sidebar {
#define MAX_SC_SD 116220200
#define NEGA_MAXVALUE -10000000
-ParaPropertyPanel* ParaPropertyPanel::Create (
+VclPtr<vcl::Window> ParaPropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -68,11 +68,11 @@ ParaPropertyPanel* ParaPropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to ParaPropertyPanel::Create", NULL, 2);
- return new ParaPropertyPanel(
- pParent,
- rxFrame,
- pBindings,
- rxSidebar);
+ return VclPtr<ParaPropertyPanel>::Create(
+ pParent,
+ rxFrame,
+ pBindings,
+ rxSidebar);
}
void ParaPropertyPanel::HandleContextChange (
@@ -191,10 +191,6 @@ void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
(void)rEvent;
}
-ParaPropertyPanel::~ParaPropertyPanel()
-{
-}
-
void ParaPropertyPanel::ReSize(bool /* bSize */)
{
if (mxSidebar.is())
@@ -750,6 +746,35 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
m_aMetricCtl.RequestUpdate();
}
+ParaPropertyPanel::~ParaPropertyPanel()
+{
+ disposeOnce();
+}
+
+void ParaPropertyPanel::dispose()
+{
+ mpTBxVertAlign.clear();
+ mpTBxNumBullet.clear();
+ mpTBxBackColor.clear();
+ mpTopDist.clear();
+ mpBottomDist.clear();
+ mpTbxIndent_IncDec.clear();
+ mpTbxProDemote.clear();
+ mpLeftIndent.clear();
+ mpRightIndent.clear();
+ mpFLineIndent.clear();
+
+ maLRSpaceControl.dispose();
+ maULSpaceControl.dispose();
+ maOutLineLeftControl.dispose();
+ maOutLineRightControl.dispose();
+ maDecIndentControl.dispose();
+ maIncIndentControl.dispose();
+ m_aMetricCtl.dispose();
+
+ PanelLayout::dispose();
+}
+
} } // end of namespace svx::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
index b7f46b82b6a2..2a0ac3b0165c 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -43,7 +43,10 @@ class ParaPropertyPanel
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static ParaPropertyPanel* Create (
+ virtual ~ParaPropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<vcl::Window> Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -63,21 +66,27 @@ public:
static FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
+ ParaPropertyPanel (
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings,
+ const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
+
private:
// UI controls
//Alignment
- ToolBox* mpTBxVertAlign;
+ VclPtr<ToolBox> mpTBxVertAlign;
//NumBullet&Backcolor
- ToolBox* mpTBxNumBullet;
- ToolBox* mpTBxBackColor;
+ VclPtr<ToolBox> mpTBxNumBullet;
+ VclPtr<ToolBox> mpTBxBackColor;
//Paragraph spacing
- SvxRelativeField* mpTopDist;
- SvxRelativeField* mpBottomDist;
- ToolBox* mpTbxIndent_IncDec;
- ToolBox* mpTbxProDemote;
- SvxRelativeField* mpLeftIndent;
- SvxRelativeField* mpRightIndent;
- SvxRelativeField* mpFLineIndent;
+ VclPtr<SvxRelativeField> mpTopDist;
+ VclPtr<SvxRelativeField> mpBottomDist;
+ VclPtr<ToolBox> mpTbxIndent_IncDec;
+ VclPtr<ToolBox> mpTbxProDemote;
+ VclPtr<SvxRelativeField> mpLeftIndent;
+ VclPtr<SvxRelativeField> mpRightIndent;
+ VclPtr<SvxRelativeField> mpFLineIndent;
// Resources
Image maSpace3;
@@ -108,13 +117,6 @@ private:
SfxBindings* mpBindings;
css::uno::Reference<css::ui::XSidebar> mxSidebar;
- ParaPropertyPanel (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings,
- const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
- virtual ~ParaPropertyPanel();
-
DECL_LINK(ModifyIndentHdl_Impl, void*);
DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index b9c3c3cd5b6f..1c459d47d1ba 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -115,12 +115,46 @@ PosSizePropertyPanel::PosSizePropertyPanel(
mpBindings->Update( SID_ATTR_METRIC );
}
-
-
PosSizePropertyPanel::~PosSizePropertyPanel()
{
+ disposeOnce();
+}
+
+void PosSizePropertyPanel::dispose()
+{
+ mpFtPosX.clear();
+ mpMtrPosX.clear();
+ mpFtPosY.clear();
+ mpMtrPosY.clear();
+ mpFtWidth.clear();
+ mpMtrWidth.clear();
+ mpFtHeight.clear();
+ mpMtrHeight.clear();
+ mpCbxScale.clear();
+ mpFtAngle.clear();
+ mpMtrAngle.clear();
+ mpDial.clear();
+ mpFtFlip.clear();
+ mpFlipTbx.clear();
+
+ maTransfPosXControl.dispose();
+ maTransfPosYControl.dispose();
+ maTransfWidthControl.dispose();
+ maTransfHeightControl.dispose();
+
+ maSvxAngleControl.dispose();
+ maRotXControl.dispose();
+ maRotYControl.dispose();
+ maProPosControl.dispose();
+ maProSizeControl.dispose();
+ maAutoWidthControl.dispose();
+ maAutoHeightControl.dispose();
+ m_aMetricCtl.dispose();
+
+ PanelLayout::dispose();
}
+
namespace
{
bool hasText(const SdrView& rSdrView)
@@ -213,7 +247,7 @@ void PosSizePropertyPanel::SetupIcons()
-PosSizePropertyPanel* PosSizePropertyPanel::Create (
+VclPtr<vcl::Window> PosSizePropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -226,11 +260,11 @@ PosSizePropertyPanel* PosSizePropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to PosSizePropertyPanel::Create", NULL, 2);
- return new PosSizePropertyPanel(
- pParent,
- rxFrame,
- pBindings,
- rxSidebar);
+ return VclPtr<PosSizePropertyPanel>::Create(
+ pParent,
+ rxFrame,
+ pBindings,
+ rxSidebar);
}
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index efa51e7a09c2..1225ce07694a 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -50,7 +50,10 @@ class PosSizePropertyPanel
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static PosSizePropertyPanel* Create(
+ virtual ~PosSizePropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -70,30 +73,37 @@ public:
SfxBindings* GetBindings() { return mpBindings;}
+ // constructor/destuctor
+ PosSizePropertyPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings,
+ const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
+
private:
//Position
- FixedText* mpFtPosX;
- MetricField* mpMtrPosX;
- FixedText* mpFtPosY;
- MetricField* mpMtrPosY;
+ VclPtr<FixedText> mpFtPosX;
+ VclPtr<MetricField> mpMtrPosX;
+ VclPtr<FixedText> mpFtPosY;
+ VclPtr<MetricField> mpMtrPosY;
// size
- FixedText* mpFtWidth;
- MetricField* mpMtrWidth;
- FixedText* mpFtHeight;
- MetricField* mpMtrHeight;
- CheckBox* mpCbxScale;
+ VclPtr<FixedText> mpFtWidth;
+ VclPtr<MetricField> mpMtrWidth;
+ VclPtr<FixedText> mpFtHeight;
+ VclPtr<MetricField> mpMtrHeight;
+ VclPtr<CheckBox> mpCbxScale;
//rotation
- FixedText* mpFtAngle;
- MetricBox* mpMtrAngle;
+ VclPtr<FixedText> mpFtAngle;
+ VclPtr<MetricBox> mpMtrAngle;
//rotation control
- SidebarDialControl* mpDial;
+ VclPtr<SidebarDialControl> mpDial;
//flip
- FixedText* mpFtFlip;
- ToolBox* mpFlipTbx;
+ VclPtr<FixedText> mpFtFlip;
+ VclPtr<ToolBox> mpFlipTbx;
// Internal variables
basegfx::B2DRange maRect;
@@ -154,14 +164,6 @@ private:
void executePosY();
void executeSize();
- // constructor/destuctor
- PosSizePropertyPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings,
- const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
- virtual ~PosSizePropertyPanel();
-
void MetricState( SfxItemState eState, const SfxPoolItem* pState );
static FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
void DisableControls();
diff --git a/svx/source/sidebar/possize/SidebarDialControl.cxx b/svx/source/sidebar/possize/SidebarDialControl.cxx
index dc30100751e6..df10da6ed4ec 100644
--- a/svx/source/sidebar/possize/SidebarDialControl.cxx
+++ b/svx/source/sidebar/possize/SidebarDialControl.cxx
@@ -35,10 +35,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSidebarDialControl(vcl
return new SidebarDialControl(pParent, WB_TABSTOP);
}
-SidebarDialControl::~SidebarDialControl()
-{
-}
-
Size SidebarDialControl::GetOptimalSize() const
{
return LogicToPixel(Size(10, 10), MAP_APPFONT);
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index 3a798f22fece..bd1489431c3c 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -36,13 +36,13 @@ TextCharacterSpacingControl::TextCharacterSpacingControl (
: PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_SPACING))
, mrTextPropertyPanel(rPanel)
, mpBindings(pBindings)
-, maVSSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING))
-, maLastCus (this, SVX_RES(FT_LASTCUSTOM))
+, maVSSpacing (VclPtr<ValueSetWithTextControl>::Create(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING)))
+, maLastCus (VclPtr<FixedText>::Create(this, SVX_RES(FT_LASTCUSTOM)))
//, maBorder (this, SVX_RES(CT_BORDER))
-, maFTSpacing (this, SVX_RES(FT_SPACING))
-, maLBKerning (this, SVX_RES(LB_KERNING))
-, maFTBy (this, SVX_RES(FT_BY))
-, maEditKerning (this, SVX_RES(ED_KERNING))
+, maFTSpacing (VclPtr<FixedText>::Create(this, SVX_RES(FT_SPACING)))
+, maLBKerning (VclPtr<ListBox>::Create(this, SVX_RES(LB_KERNING)))
+, maFTBy (VclPtr<FixedText>::Create(this, SVX_RES(FT_BY)))
+, maEditKerning (VclPtr<MetricField>::Create(this, SVX_RES(ED_KERNING)))
, mpImg (NULL)
, mpImgSel (NULL)
@@ -65,36 +65,49 @@ TextCharacterSpacingControl::TextCharacterSpacingControl (
initial();
FreeResource();
Link aLink = LINK(this, TextCharacterSpacingControl, KerningSelectHdl);
- maLBKerning.SetSelectHdl(aLink);
+ maLBKerning->SetSelectHdl(aLink);
aLink =LINK(this, TextCharacterSpacingControl, KerningModifyHdl);
- maEditKerning.SetModifyHdl(aLink);
+ maEditKerning->SetModifyHdl(aLink);
}
+
TextCharacterSpacingControl::~TextCharacterSpacingControl()
{
+ disposeOnce();
+}
+
+void TextCharacterSpacingControl::dispose()
+{
delete[] mpImg;
delete[] mpImgSel;
delete[] mpStr;
delete[] mpStrTip;
+ maVSSpacing.disposeAndClear();
+ maLastCus.disposeAndClear();
+ maFTSpacing.disposeAndClear();
+ maLBKerning.disposeAndClear();
+ maFTBy.disposeAndClear();
+ maEditKerning.disposeAndClear();
+ svx::sidebar::PopupControl::dispose();
}
void TextCharacterSpacingControl::initial()
{
- maVSSpacing.SetStyle( maVSSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );
+ maVSSpacing->SetStyle( maVSSpacing->GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );
{
- maVSSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+ maVSSpacing->SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
GetSettings().GetStyleSettings().GetMenuColor():
sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
- maVSSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+ maVSSpacing->SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
GetSettings().GetStyleSettings().GetMenuColor():
sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
- maVSSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+ maVSSpacing->SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
GetSettings().GetStyleSettings().GetMenuColor():
sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
- maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+ maFTSpacing->SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
GetSettings().GetStyleSettings().GetMenuColor():
sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
- maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+ maFTBy->SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
GetSettings().GetStyleSettings().GetMenuColor():
sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
}
@@ -128,21 +141,21 @@ void TextCharacterSpacingControl::initial()
mpStrTip[4] = SVX_RESSTR(STR_VERY_LOOSE_TIP);
for (int i=0;i<5;i++)
- maVSSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]);
+ maVSSpacing->AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]);
- maVSSpacing.AddItem( maImgCus, 0, maStrCus, 0 );
+ maVSSpacing->AddItem( maImgCus, 0, maStrCus, 0 );
- maVSSpacing.SetNoSelection();
+ maVSSpacing->SetNoSelection();
Link aLink = LINK(this, TextCharacterSpacingControl,VSSelHdl );
- maVSSpacing.SetSelectHdl(aLink);
- maVSSpacing.StartSelection();
- maVSSpacing.Show();
+ maVSSpacing->SetSelectHdl(aLink);
+ maVSSpacing->StartSelection();
+ maVSSpacing->Show();
}
void TextCharacterSpacingControl::Rearrange(bool bLBAvailable,bool bAvailable, long nKerning)
{
mbVS = true;
- maVSSpacing.SetNoSelection();
+ maVSSpacing->SetNoSelection();
SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
if ( aWinOpt.Exists() )
{
@@ -164,131 +177,131 @@ void TextCharacterSpacingControl::Rearrange(bool bLBAvailable,bool bAvailable, l
if( !mnLastCus )
{
- maVSSpacing.ReplaceItemImages(6, maImgCusGrey,0);
+ maVSSpacing->ReplaceItemImages(6, maImgCusGrey,0);
}
else
{
//set custom tips
- maVSSpacing.ReplaceItemImages(6, maImgCus,0);
+ maVSSpacing->ReplaceItemImages(6, maImgCus,0);
if(mnCustomKern > 0)
{
OUString aStrTip( maStrCusE); //LAST CUSTOM no tip defect //add
aStrTip += OUString::number( (double)mnCustomKern / 10);
aStrTip += " " + maStrUnit; // modify
- maVSSpacing.SetItemText(6,aStrTip);
+ maVSSpacing->SetItemText(6,aStrTip);
}
else if(mnCustomKern < 0)
{
OUString aStrTip(maStrCusC) ; //LAST CUSTOM no tip defect //add
aStrTip += OUString::number( (double)-mnCustomKern / 10);
aStrTip += " " + maStrUnit; // modify
- maVSSpacing.SetItemText( 6, aStrTip );
+ maVSSpacing->SetItemText( 6, aStrTip );
}
else
{
OUString aStrTip(maStrCusN) ; //LAST CUSTOM no tip defect //add
- maVSSpacing.SetItemText( 6, aStrTip );
+ maVSSpacing->SetItemText( 6, aStrTip );
}
}
if(bLBAvailable && bAvailable)
{
- maLBKerning.Enable();
- maFTSpacing.Enable();
+ maLBKerning->Enable();
+ maFTSpacing->Enable();
SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
MapUnit eOrgUnit = (MapUnit)eUnit;
MapUnit ePntUnit( MAP_POINT );
- long nBig = maEditKerning.Normalize(nKerning);
+ long nBig = maEditKerning->Normalize(nKerning);
nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit );
if ( nKerning > 0 )
{
- maFTBy.Enable();
- maEditKerning.Enable();
- maEditKerning.SetMax( 9999 );
- maEditKerning.SetLast( 9999 );
- maEditKerning.SetValue( nKerning );
- maLBKerning.SelectEntryPos( SIDEBAR_SPACE_EXPAND );
+ maFTBy->Enable();
+ maEditKerning->Enable();
+ maEditKerning->SetMax( 9999 );
+ maEditKerning->SetLast( 9999 );
+ maEditKerning->SetValue( nKerning );
+ maLBKerning->SelectEntryPos( SIDEBAR_SPACE_EXPAND );
if(nKerning == 30)
{
- maVSSpacing.SelectItem(4);
+ maVSSpacing->SelectItem(4);
}
else if(nKerning == 60)
{
- maVSSpacing.SelectItem(5);
+ maVSSpacing->SelectItem(5);
}
else
{
- maVSSpacing.SetNoSelection();
- maVSSpacing.SelectItem(0);
+ maVSSpacing->SetNoSelection();
+ maVSSpacing->SelectItem(0);
mbVS = false;
}
}
else if ( nKerning < 0 )
{
- maFTBy.Enable();
- maEditKerning.Enable();
- maEditKerning.SetValue( -nKerning );
- maLBKerning.SelectEntryPos( SIDEBAR_SPACE_CONDENSED );
+ maFTBy->Enable();
+ maEditKerning->Enable();
+ maEditKerning->SetValue( -nKerning );
+ maLBKerning->SelectEntryPos( SIDEBAR_SPACE_CONDENSED );
long nMax = mrTextPropertyPanel.GetSelFontSize()/6;
- maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_POINT );
- maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) );
+ maEditKerning->SetMax( maEditKerning->Normalize( nMax ), FUNIT_POINT );
+ maEditKerning->SetLast( maEditKerning->GetMax( maEditKerning->GetUnit() ) );
if( nKerning == -30 )
{
- maVSSpacing.SelectItem(1);
+ maVSSpacing->SelectItem(1);
}
else if( nKerning == -15 )
{
- maVSSpacing.SelectItem(2);
+ maVSSpacing->SelectItem(2);
}
else
{
- maVSSpacing.SetNoSelection();
- maVSSpacing.SelectItem(0);
+ maVSSpacing->SetNoSelection();
+ maVSSpacing->SelectItem(0);
mbVS = false;
}
}
else
{
- maVSSpacing.SelectItem(3);
- maLBKerning.SelectEntryPos( SIDEBAR_SPACE_NORMAL );
- maFTBy.Disable();
- maEditKerning.Disable();
- maEditKerning.SetValue( 0 );
- maEditKerning.SetMax( 9999 );
- maEditKerning.SetLast( 9999 );
+ maVSSpacing->SelectItem(3);
+ maLBKerning->SelectEntryPos( SIDEBAR_SPACE_NORMAL );
+ maFTBy->Disable();
+ maEditKerning->Disable();
+ maEditKerning->SetValue( 0 );
+ maEditKerning->SetMax( 9999 );
+ maEditKerning->SetLast( 9999 );
}
}
else if(bLBAvailable && !bAvailable)
{
//modified
- maVSSpacing.SetNoSelection();
- maVSSpacing.SelectItem(0);
+ maVSSpacing->SetNoSelection();
+ maVSSpacing->SelectItem(0);
mbVS = false;
- maLBKerning.Enable();
- maFTSpacing.Enable();
- maLBKerning.SetNoSelection();
- maEditKerning.SetText(OUString());
- maEditKerning.Disable();
- maFTBy.Disable();
+ maLBKerning->Enable();
+ maFTSpacing->Enable();
+ maLBKerning->SetNoSelection();
+ maEditKerning->SetText(OUString());
+ maEditKerning->Disable();
+ maFTBy->Disable();
}
else
{
- maVSSpacing.SetNoSelection();
- maVSSpacing.SelectItem(0);
+ maVSSpacing->SetNoSelection();
+ maVSSpacing->SelectItem(0);
mbVS = false;
- maEditKerning.SetText(OUString());
- maLBKerning.SetNoSelection();
- maLBKerning.Disable();
- maFTSpacing.Disable();
- maEditKerning.Disable();
- maFTBy.Disable();
+ maEditKerning->SetText(OUString());
+ maLBKerning->SetNoSelection();
+ maLBKerning->Disable();
+ maFTSpacing->Disable();
+ maEditKerning->Disable();
+ maFTBy->Disable();
}
GetFocus();
- maVSSpacing.Format();
- maVSSpacing.StartSelection();
+ maVSSpacing->Format();
+ maVSSpacing->StartSelection();
}
IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
{
@@ -296,14 +309,14 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
if(pControl == &maVSSpacing)
{
- sal_uInt16 iPos = maVSSpacing.GetSelectItemId();
+ sal_uInt16 iPos = maVSSpacing->GetSelectItemId();
short nKern = 0;
SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
long nVal = 0;
if(iPos == 1)
{
nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit);
- nKern = (short)maEditKerning.Denormalize(nVal);
+ nKern = (short)maEditKerning->Denormalize(nVal);
SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
@@ -311,7 +324,7 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
else if(iPos == 2)
{
nVal = LogicToLogic(15, MAP_POINT, (MapUnit)eUnit);
- nKern = (short)maEditKerning.Denormalize(nVal);
+ nKern = (short)maEditKerning->Denormalize(nVal);
SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
@@ -325,7 +338,7 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
else if(iPos == 4)
{
nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit);
- nKern = (short)maEditKerning.Denormalize(nVal);
+ nKern = (short)maEditKerning->Denormalize(nVal);
SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
@@ -333,7 +346,7 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
else if(iPos == 5)
{
nVal = LogicToLogic(60, MAP_POINT, (MapUnit)eUnit);
- nKern = (short)maEditKerning.Denormalize(nVal);
+ nKern = (short)maEditKerning->Denormalize(nVal);
SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
@@ -344,17 +357,17 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
if(mbCusEnable)
{
nVal = LogicToLogic(mnCustomKern, MAP_POINT, (MapUnit)eUnit);
- nKern = (short)maEditKerning.Denormalize(nVal);
+ nKern = (short)maEditKerning->Denormalize(nVal);
SvxKerningItem aKernItem(nKern , SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
}
else
{
- maVSSpacing.SetNoSelection(); //add , set no selection and keep the last select item
- maVSSpacing.Format();
+ maVSSpacing->SetNoSelection(); //add , set no selection and keep the last select item
+ maVSSpacing->Format();
Invalidate();
- maVSSpacing.StartSelection();
+ maVSSpacing->StartSelection();
}
//modify end
}
@@ -370,67 +383,67 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
IMPL_LINK(TextCharacterSpacingControl, KerningSelectHdl, ListBox*, EMPTYARG)
{
- if ( maLBKerning.GetSelectEntryPos() > 0 )
+ if ( maLBKerning->GetSelectEntryPos() > 0 )
{
- maFTBy.Enable();
- maEditKerning.Enable();
+ maFTBy->Enable();
+ maEditKerning->Enable();
}
else
{
- maEditKerning.SetValue( 0 );
- maFTBy.Disable();
- maEditKerning.Disable();
+ maEditKerning->SetValue( 0 );
+ maFTBy->Disable();
+ maEditKerning->Disable();
}
- if ( maVSSpacing.GetSelectItemId() > 0 )
+ if ( maVSSpacing->GetSelectItemId() > 0 )
{
- maVSSpacing.SetNoSelection();
- maVSSpacing.SelectItem(0);
- maVSSpacing.Format();
+ maVSSpacing->SetNoSelection();
+ maVSSpacing->SelectItem(0);
+ maVSSpacing->Format();
Invalidate();
- maVSSpacing.StartSelection();
+ maVSSpacing->StartSelection();
}
KerningModifyHdl( NULL );
return 0;
}
IMPL_LINK(TextCharacterSpacingControl, KerningModifyHdl, MetricField*, EMPTYARG)
{
- if ( maVSSpacing.GetSelectItemId() > 0 )
+ if ( maVSSpacing->GetSelectItemId() > 0 )
{
- maVSSpacing.SetNoSelection();
- maVSSpacing.SelectItem(0);
- maVSSpacing.Format();
+ maVSSpacing->SetNoSelection();
+ maVSSpacing->SelectItem(0);
+ maVSSpacing->Format();
Invalidate();
- maVSSpacing.StartSelection();
+ maVSSpacing->StartSelection();
}
- sal_uInt16 nPos = maLBKerning.GetSelectEntryPos();
+ sal_uInt16 nPos = maLBKerning->GetSelectEntryPos();
short nKern = 0;
SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
mnLastCus = SPACING_CLOSE_BY_CUS_EDIT;
if ( nPos == SIDEBAR_SPACE_EXPAND || nPos == SIDEBAR_SPACE_CONDENSED )
{
- long nTmp = static_cast<long>(maEditKerning.GetValue());
+ long nTmp = static_cast<long>(maEditKerning->GetValue());
if ( nPos == SIDEBAR_SPACE_CONDENSED )
{
long nMax = mrTextPropertyPanel.GetSelFontSize()/6;
- maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_TWIP );
- maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) );
- if(nTmp > maEditKerning.GetMax())
- nTmp = maEditKerning.GetMax();
+ maEditKerning->SetMax( maEditKerning->Normalize( nMax ), FUNIT_TWIP );
+ maEditKerning->SetLast( maEditKerning->GetMax( maEditKerning->GetUnit() ) );
+ if(nTmp > maEditKerning->GetMax())
+ nTmp = maEditKerning->GetMax();
mnCustomKern = -nTmp;
long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
- nKern = (short)maEditKerning.Denormalize( nVal );
+ nKern = (short)maEditKerning->Denormalize( nVal );
nKern *= - 1;
}
else
{
- maEditKerning.SetMax( 9999 );
- maEditKerning.SetLast( 9999 );
- if(nTmp > maEditKerning.GetMax(FUNIT_TWIP))
- nTmp = maEditKerning.GetMax(FUNIT_TWIP);
+ maEditKerning->SetMax( 9999 );
+ maEditKerning->SetLast( 9999 );
+ if(nTmp > maEditKerning->GetMax(FUNIT_TWIP))
+ nTmp = maEditKerning->GetMax(FUNIT_TWIP);
mnCustomKern = nTmp;
long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
- nKern = (short)maEditKerning.Denormalize( nVal );
+ nKern = (short)maEditKerning->Denormalize( nVal );
}
}
else
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
index b96dd8945d1a..7d5289f8d52f 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
@@ -45,6 +45,7 @@ public:
svx::sidebar::TextPropertyPanel& rPanel,
SfxBindings* pBindings);
virtual ~TextCharacterSpacingControl();
+ virtual void dispose() SAL_OVERRIDE;
void Rearrange(bool bLBAvailable,bool bAvailable, long nKerning);
//virtual void Paint(const Rectangle& rect);
@@ -57,14 +58,14 @@ private:
svx::sidebar::TextPropertyPanel& mrTextPropertyPanel;
SfxBindings* mpBindings;
- ValueSetWithTextControl maVSSpacing;
+ VclPtr<ValueSetWithTextControl> maVSSpacing;
- FixedText maLastCus;
+ VclPtr<FixedText> maLastCus;
- FixedText maFTSpacing;
- ListBox maLBKerning;
- FixedText maFTBy;
- MetricField maEditKerning;
+ VclPtr<FixedText> maFTSpacing;
+ VclPtr<ListBox> maLBKerning;
+ VclPtr<FixedText> maFTBy;
+ VclPtr<MetricField> maEditKerning;
Image* mpImg;
Image* mpImgSel;
diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
index 1137cdb41aaa..e063245d9007 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
@@ -25,7 +25,7 @@ namespace svx { namespace sidebar {
TextCharacterSpacingPopup::TextCharacterSpacingPopup (
vcl::Window* pParent,
- const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+ const ::boost::function<VclPtr<PopupControl>(PopupContainer*)>& rControlCreator)
: Popup(
pParent,
rControlCreator,
diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
index 9a55c0faa8d4..b93e4fc52b15 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
@@ -31,7 +31,7 @@ class TextCharacterSpacingPopup
public :
TextCharacterSpacingPopup (
vcl::Window* pParent,
- const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+ const ::boost::function<VclPtr<PopupControl>(PopupContainer*)>& rControlCreator);
virtual ~TextCharacterSpacingPopup();
void Rearrange (bool bLBAvailable,bool bAvailable, long nKerning);
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index b069099feb56..b6d9e09a803b 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -43,14 +43,14 @@ const char UNO_UNDERLINE[] = ".uno:Underline";
namespace svx { namespace sidebar {
-PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
+VclPtr<PopupControl> TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
{
- return new TextCharacterSpacingControl(pParent, *this, mpBindings);
+ return VclPtrInstance<TextCharacterSpacingControl>(pParent, *this, mpBindings);
}
-PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
+VclPtr<PopupControl> TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
{
- return new TextUnderlineControl(pParent, *this, mpBindings);
+ return VclPtrInstance<TextUnderlineControl>(pParent, *this, mpBindings);
}
long TextPropertyPanel::GetSelFontSize()
@@ -62,7 +62,7 @@ long TextPropertyPanel::GetSelFontSize()
return nH;
}
-TextPropertyPanel* TextPropertyPanel::Create (
+VclPtr<vcl::Window> TextPropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -75,11 +75,11 @@ TextPropertyPanel* TextPropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to TextPropertyPanel::Create", NULL, 2);
- return new TextPropertyPanel(
- pParent,
- rxFrame,
- pBindings,
- rContext);
+ return VclPtr<TextPropertyPanel>::Create(
+ pParent,
+ rxFrame,
+ pBindings,
+ rContext);
}
@@ -116,6 +116,22 @@ TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Ref
TextPropertyPanel::~TextPropertyPanel()
{
+ disposeOnce();
+}
+
+void TextPropertyPanel::dispose()
+{
+ mpToolBoxFont.clear();
+ mpToolBoxIncDec.clear();
+ mpToolBoxSpacing.clear();
+ mpToolBoxFontColorSw.clear();
+ mpToolBoxFontColor.clear();
+
+ maFontSizeControl.dispose();
+ maUnderlineControl.dispose();
+ maSpacingControl.dispose();
+
+ PanelLayout::dispose();
}
void TextPropertyPanel::HandleContextChange (
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index 7d7a229ddcfc..583300dc4b70 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -46,7 +46,10 @@ class TextPropertyPanel
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static TextPropertyPanel* Create (
+ virtual ~TextPropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<vcl::Window> Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -71,13 +74,19 @@ public:
const SfxPoolItem* pState,
const bool bIsEnabled) SAL_OVERRIDE;
+ TextPropertyPanel (
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings,
+ const ::sfx2::sidebar::EnumContext& rContext);
+
private:
//ui controls
- ToolBox* mpToolBoxFont;
- ToolBox* mpToolBoxIncDec;
- ToolBox* mpToolBoxSpacing;
- ToolBox* mpToolBoxFontColorSw;
- ToolBox* mpToolBoxFontColor;
+ VclPtr<ToolBox> mpToolBoxFont;
+ VclPtr<ToolBox> mpToolBoxIncDec;
+ VclPtr<ToolBox> mpToolBoxSpacing;
+ VclPtr<ToolBox> mpToolBoxFontColorSw;
+ VclPtr<ToolBox> mpToolBoxFontColor;
//control items
::sfx2::sidebar::ControllerItem maFontSizeControl;
@@ -97,16 +106,8 @@ private:
::sfx2::sidebar::EnumContext maContext;
SfxBindings* mpBindings;
- TextPropertyPanel (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- SfxBindings* pBindings,
- const ::sfx2::sidebar::EnumContext& rContext);
- virtual ~TextPropertyPanel();
-
-
- PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
- PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
+ VclPtr<PopupControl> CreateCharacterSpacingControl (PopupContainer* pParent);
+ VclPtr<PopupControl> CreateUnderlinePopupControl (PopupContainer* pParent);
DECL_LINK(SpacingClickHdl, ToolBox*);
DECL_LINK(UnderlineClickHdl, ToolBox* );
diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx
index 61f94f8b48a0..a0eae0efb4b2 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.cxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -35,8 +35,8 @@ TextUnderlineControl::TextUnderlineControl (
: svx::sidebar::PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_UNDERLINE))
, mrTextPropertyPanel(rPanel)
, mpBindings(pBindings)
-, maVSUnderline( this, SVX_RES(VS_UNDERLINE))
-, maPBOptions (this, SVX_RES(PB_OPTIONS) )
+, maVSUnderline(VclPtr<ValueSet>::Create(this, SVX_RES(VS_UNDERLINE)))
+, maPBOptions (VclPtr<PushButton>::Create(this, SVX_RES(PB_OPTIONS)))
, maIMGSingle (SVX_RES(IMG_SINGLE))
, maIMGDouble (SVX_RES(IMG_DOUBLE))
@@ -65,138 +65,150 @@ TextUnderlineControl::TextUnderlineControl (
FreeResource();
}
+TextUnderlineControl::~TextUnderlineControl()
+{
+ disposeOnce();
+}
+
+void TextUnderlineControl::dispose()
+{
+ maVSUnderline.disposeAndClear();
+ maPBOptions.disposeAndClear();
+ svx::sidebar::PopupControl::dispose();
+}
+
void TextUnderlineControl::initial()
{
- maVSUnderline.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
- GetSettings().GetStyleSettings().GetMenuColor():
+ maVSUnderline->SetColor(GetSettings().GetStyleSettings().GetHighContrastMode() ?
+ GetSettings().GetStyleSettings().GetMenuColor() :
sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
- maVSUnderline.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
- GetSettings().GetStyleSettings().GetMenuColor():
+ maVSUnderline->SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode() ?
+ GetSettings().GetStyleSettings().GetMenuColor() :
sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
Link aLink = LINK( this, TextUnderlineControl, PBClickHdl ) ;
- maPBOptions.SetClickHdl(aLink);
+ maPBOptions->SetClickHdl(aLink);
- maVSUnderline.SetStyle( maVSUnderline.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );
+ maVSUnderline->SetStyle( maVSUnderline->GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );
// 'none' item
- maVSUnderline.SetStyle( maVSUnderline.GetStyle()| WB_NONEFIELD | WB_MENUSTYLEVALUESET );
- maVSUnderline.SetText( SVX_RESSTR(STR_WITHOUT) );
+ maVSUnderline->SetStyle( maVSUnderline->GetStyle()| WB_NONEFIELD | WB_MENUSTYLEVALUESET );
+ maVSUnderline->SetText( SVX_RESSTR(STR_WITHOUT) );
- maVSUnderline.InsertItem(1, maIMGSingle, SVX_RESSTR(STR_SINGLE));
- maVSUnderline.SetItemData(1, reinterpret_cast<void*>(UNDERLINE_SINGLE));
+ maVSUnderline->InsertItem(1, maIMGSingle, SVX_RESSTR(STR_SINGLE));
+ maVSUnderline->SetItemData(1, reinterpret_cast<void*>(UNDERLINE_SINGLE));
- maVSUnderline.InsertItem(2, maIMGDouble, SVX_RESSTR(STR_DOUBLE));
- maVSUnderline.SetItemData(2, reinterpret_cast<void*>(UNDERLINE_DOUBLE));
+ maVSUnderline->InsertItem(2, maIMGDouble, SVX_RESSTR(STR_DOUBLE));
+ maVSUnderline->SetItemData(2, reinterpret_cast<void*>(UNDERLINE_DOUBLE));
- maVSUnderline.InsertItem(3, maIMGBold, SVX_RESSTR(STR_BOLD));
- maVSUnderline.SetItemData(3, reinterpret_cast<void*>(UNDERLINE_BOLD));
+ maVSUnderline->InsertItem(3, maIMGBold, SVX_RESSTR(STR_BOLD));
+ maVSUnderline->SetItemData(3, reinterpret_cast<void*>(UNDERLINE_BOLD));
- maVSUnderline.InsertItem(4, maIMGDot, SVX_RESSTR(STR_DOT));
- maVSUnderline.SetItemData(4, reinterpret_cast<void*>(UNDERLINE_DOTTED));
+ maVSUnderline->InsertItem(4, maIMGDot, SVX_RESSTR(STR_DOT));
+ maVSUnderline->SetItemData(4, reinterpret_cast<void*>(UNDERLINE_DOTTED));
- maVSUnderline.InsertItem(5, maIMGDotBold, SVX_RESSTR(STR_DOT_BOLD));
- maVSUnderline.SetItemData(5, reinterpret_cast<void*>(UNDERLINE_BOLDDOTTED));
+ maVSUnderline->InsertItem(5, maIMGDotBold, SVX_RESSTR(STR_DOT_BOLD));
+ maVSUnderline->SetItemData(5, reinterpret_cast<void*>(UNDERLINE_BOLDDOTTED));
- maVSUnderline.InsertItem(6, maIMGDash, SVX_RESSTR(STR_DASH));
- maVSUnderline.SetItemData(6, reinterpret_cast<void*>(UNDERLINE_DASH));
+ maVSUnderline->InsertItem(6, maIMGDash, SVX_RESSTR(STR_DASH));
+ maVSUnderline->SetItemData(6, reinterpret_cast<void*>(UNDERLINE_DASH));
- maVSUnderline.InsertItem(7, maIMGDashLong, SVX_RESSTR(STR_DASH_LONG));
- maVSUnderline.SetItemData(7, reinterpret_cast<void*>(UNDERLINE_LONGDASH));
+ maVSUnderline->InsertItem(7, maIMGDashLong, SVX_RESSTR(STR_DASH_LONG));
+ maVSUnderline->SetItemData(7, reinterpret_cast<void*>(UNDERLINE_LONGDASH));
- maVSUnderline.InsertItem(8, maIMGDashDot, SVX_RESSTR(STR_DASH_DOT));
- maVSUnderline.SetItemData(8, reinterpret_cast<void*>(UNDERLINE_DASHDOT));
+ maVSUnderline->InsertItem(8, maIMGDashDot, SVX_RESSTR(STR_DASH_DOT));
+ maVSUnderline->SetItemData(8, reinterpret_cast<void*>(UNDERLINE_DASHDOT));
- maVSUnderline.InsertItem(9, maIMGDashDotDot, SVX_RESSTR(STR_DASH_DOT_DOT));
- maVSUnderline.SetItemData(9, reinterpret_cast<void*>(UNDERLINE_DASHDOTDOT));
+ maVSUnderline->InsertItem(9, maIMGDashDotDot, SVX_RESSTR(STR_DASH_DOT_DOT));
+ maVSUnderline->SetItemData(9, reinterpret_cast<void*>(UNDERLINE_DASHDOTDOT));
- maVSUnderline.InsertItem(10, maIMGWave, SVX_RESSTR(STR_WAVE));
- maVSUnderline.SetItemData(10, reinterpret_cast<void*>(UNDERLINE_WAVE));
+ maVSUnderline->InsertItem(10, maIMGWave, SVX_RESSTR(STR_WAVE));
+ maVSUnderline->SetItemData(10, reinterpret_cast<void*>(UNDERLINE_WAVE));
- maVSUnderline.SetColCount( 1 );
+ maVSUnderline->SetColCount( 1 );
aLink = LINK( this, TextUnderlineControl, VSSelectHdl ) ;
- maVSUnderline.SetSelectHdl(aLink);
+ maVSUnderline->SetSelectHdl(aLink);
- maVSUnderline.StartSelection();
- maVSUnderline.Show();
+ maVSUnderline->StartSelection();
+ maVSUnderline->Show();
}
void TextUnderlineControl::Rearrange(FontUnderline eLine)
{
- maVSUnderline.SetItemImage(1, maIMGSingle);
- maVSUnderline.SetItemImage(2, maIMGDouble );
- maVSUnderline.SetItemImage(3, maIMGBold);
- maVSUnderline.SetItemImage(4, maIMGDot);
- maVSUnderline.SetItemImage(5, maIMGDotBold);
- maVSUnderline.SetItemImage(6, maIMGDash);
- maVSUnderline.SetItemImage(7, maIMGDashLong);
- maVSUnderline.SetItemImage(8, maIMGDashDot);
- maVSUnderline.SetItemImage(9, maIMGDashDotDot);
- maVSUnderline.SetItemImage(10, maIMGWave);
+ maVSUnderline->SetItemImage(1, maIMGSingle);
+ maVSUnderline->SetItemImage(2, maIMGDouble );
+ maVSUnderline->SetItemImage(3, maIMGBold);
+ maVSUnderline->SetItemImage(4, maIMGDot);
+ maVSUnderline->SetItemImage(5, maIMGDotBold);
+ maVSUnderline->SetItemImage(6, maIMGDash);
+ maVSUnderline->SetItemImage(7, maIMGDashLong);
+ maVSUnderline->SetItemImage(8, maIMGDashDot);
+ maVSUnderline->SetItemImage(9, maIMGDashDotDot);
+ maVSUnderline->SetItemImage(10, maIMGWave);
switch(eLine)
{
case UNDERLINE_SINGLE:
- maVSUnderline.SetItemImage(1, maIMGSingleSel);
- maVSUnderline.SelectItem(1);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(1, maIMGSingleSel);
+ maVSUnderline->SelectItem(1);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_DOUBLE:
- maVSUnderline.SetItemImage(2, maIMGDoubleSel);
- maVSUnderline.SelectItem(2);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(2, maIMGDoubleSel);
+ maVSUnderline->SelectItem(2);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_BOLD:
- maVSUnderline.SetItemImage(3, maIMGBoldSel);
- maVSUnderline.SelectItem(3);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(3, maIMGBoldSel);
+ maVSUnderline->SelectItem(3);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_DOTTED:
- maVSUnderline.SetItemImage(4, maIMGDotSel);
- maVSUnderline.SelectItem(4);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(4, maIMGDotSel);
+ maVSUnderline->SelectItem(4);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_BOLDDOTTED:
- maVSUnderline.SetItemImage(5, maIMGDotBoldSel);
- maVSUnderline.SelectItem(5);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(5, maIMGDotBoldSel);
+ maVSUnderline->SelectItem(5);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_DASH:
- maVSUnderline.SetItemImage(6, maIMGDashSel);
- maVSUnderline.SelectItem(6);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(6, maIMGDashSel);
+ maVSUnderline->SelectItem(6);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_LONGDASH:
- maVSUnderline.SetItemImage(7, maIMGDashLongSel);
- maVSUnderline.SelectItem(7);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(7, maIMGDashLongSel);
+ maVSUnderline->SelectItem(7);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_DASHDOT:
- maVSUnderline.SetItemImage(8, maIMGDashDotSel);
- maVSUnderline.SelectItem(8);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(8, maIMGDashDotSel);
+ maVSUnderline->SelectItem(8);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_DASHDOTDOT:
- maVSUnderline.SetItemImage(9, maIMGDashDotDotSel);
- maVSUnderline.SelectItem(9);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(9, maIMGDashDotDotSel);
+ maVSUnderline->SelectItem(9);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_WAVE:
- maVSUnderline.SetItemImage(10, maIMGWaveSel);
- maVSUnderline.SelectItem(10);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SetItemImage(10, maIMGWaveSel);
+ maVSUnderline->SelectItem(10);
+ maVSUnderline->GrabFocus();
break;
case UNDERLINE_NONE:
- maVSUnderline.SelectItem(0);
- maVSUnderline.GrabFocus();
+ maVSUnderline->SelectItem(0);
+ maVSUnderline->GrabFocus();
break;
default:
- maVSUnderline.SelectItem(1);
- maVSUnderline.SetNoSelection();
- maPBOptions.GrabFocus();
+ maVSUnderline->SelectItem(1);
+ maVSUnderline->SetNoSelection();
+ maPBOptions->GrabFocus();
}
- maVSUnderline.StartSelection();
+ maVSUnderline->StartSelection();
}
@@ -204,10 +216,10 @@ IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl)
{
if ( pControl == &maVSUnderline )
{
- const sal_uInt16 iPos = maVSUnderline.GetSelectItemId();
+ const sal_uInt16 iPos = maVSUnderline->GetSelectItemId();
const FontUnderline eUnderline = ( iPos == 0 )
? UNDERLINE_NONE
- : static_cast<FontUnderline>(reinterpret_cast<sal_uInt64>(maVSUnderline.GetItemData( iPos )));
+ : static_cast<FontUnderline>(reinterpret_cast<sal_uInt64>(maVSUnderline->GetItemData( iPos )));
SvxUnderlineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE);
@@ -220,7 +232,7 @@ IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl)
IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn)
{
- if(pPBtn == &maPBOptions)
+ if(pPBtn == maPBOptions.get())
{
if (mpBindings)
{
diff --git a/svx/source/sidebar/text/TextUnderlineControl.hxx b/svx/source/sidebar/text/TextUnderlineControl.hxx
index 5e32256c3364..441e15798eda 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.hxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.hxx
@@ -36,13 +36,15 @@ public:
vcl::Window* pParent,
svx::sidebar::TextPropertyPanel& rPanel,
SfxBindings* pBindings);
+ virtual ~TextUnderlineControl();
+ virtual void dispose() SAL_OVERRIDE;
void Rearrange(FontUnderline eLine);
private:
svx::sidebar::TextPropertyPanel& mrTextPropertyPanel;
SfxBindings* mpBindings;
- ValueSet maVSUnderline;
- PushButton maPBOptions;
+ VclPtr<ValueSet> maVSUnderline;
+ VclPtr<PushButton> maPBOptions;
Image maIMGSingle;
Image maIMGDouble;
diff --git a/svx/source/sidebar/tools/Popup.cxx b/svx/source/sidebar/tools/Popup.cxx
index 8647fb398b16..c1a04c3bc177 100644
--- a/svx/source/sidebar/tools/Popup.cxx
+++ b/svx/source/sidebar/tools/Popup.cxx
@@ -36,7 +36,7 @@ Popup::Popup (
msAccessibleName(rsAccessibleName),
mxContainer()
{
- OSL_ASSERT(mpParent!=NULL);
+ OSL_ASSERT(mpParent!=nullptr);
OSL_ASSERT(maControlCreator);
}
@@ -94,8 +94,8 @@ void Popup::SetPopupModeEndHandler (const ::boost::function<void()>& rCallback)
void Popup::ProvideContainerAndControl()
{
if ( ! (mxContainer && mxControl)
- && mpParent!=NULL
- && maControlCreator)
+ && mpParent != nullptr
+ && maControlCreator)
{
CreateContainerAndControl();
}
@@ -103,7 +103,7 @@ void Popup::ProvideContainerAndControl()
void Popup::CreateContainerAndControl()
{
- mxContainer.reset(new PopupContainer(mpParent));
+ mxContainer.reset(VclPtr<PopupContainer>::Create(mpParent));
mxContainer->SetAccessibleName(msAccessibleName);
mxContainer->SetPopupModeEndHdl(LINK(this, Popup, PopupModeEndHandler));
mxContainer->SetBorderStyle(mxContainer->GetBorderStyle() | WindowBorderStyle::MENU);
diff --git a/svx/source/sidebar/tools/PopupContainer.cxx b/svx/source/sidebar/tools/PopupContainer.cxx
index 675e80fbabf1..efb478dfa764 100644
--- a/svx/source/sidebar/tools/PopupContainer.cxx
+++ b/svx/source/sidebar/tools/PopupContainer.cxx
@@ -27,16 +27,11 @@ PopupContainer::PopupContainer (vcl::Window* pParent)
{
}
-
-
-
PopupContainer::~PopupContainer()
{
+ disposeOnce();
}
-
-
-
bool PopupContainer::Notify (NotifyEvent& rEvent)
{
if (rEvent.GetType() == MouseNotifyEvent::LOSEFOCUS)
diff --git a/svx/source/sidebar/tools/PopupControl.cxx b/svx/source/sidebar/tools/PopupControl.cxx
index 48a908b4938f..660798090a72 100644
--- a/svx/source/sidebar/tools/PopupControl.cxx
+++ b/svx/source/sidebar/tools/PopupControl.cxx
@@ -35,16 +35,6 @@ PopupControl::PopupControl (
SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground));
}
-
-
-
-PopupControl::~PopupControl()
-{
-}
-
-
-
-
void PopupControl::Paint (const Rectangle& rBox)
{
Control::Paint(rBox);
diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
index 3927029ad371..d6d96b6f4dbc 100644
--- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
+++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
@@ -41,12 +41,6 @@ ValueSetWithTextControl::ValueSetWithTextControl(
SetColCount( 1 );
}
-
-ValueSetWithTextControl::~ValueSetWithTextControl()
-{
-}
-
-
void ValueSetWithTextControl::AddItem(
const Image& rItemImage,
const Image* pSelectedItemImage,
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index 8692c53bdfae..0440ba195faf 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -33,8 +33,8 @@
//sibling after that is going to fail hard
class CandidateMgr
{
- std::vector<vcl::Window*> m_aCandidates;
- std::set<vcl::Window*> m_aDeletedCandidates;
+ std::vector<VclPtr<vcl::Window> > m_aCandidates;
+ std::set<VclPtr<vcl::Window> > m_aDeletedCandidates;
DECL_LINK(WindowEventListener, VclSimpleEvent*);
public:
void PaintTransparentChildren(vcl::Window & rWindow, Rectangle const& rPixelRect);
@@ -58,10 +58,9 @@ IMPL_LINK(CandidateMgr, WindowEventListener, VclSimpleEvent*, pEvent)
CandidateMgr::~CandidateMgr()
{
- for (std::vector<vcl::Window*>::iterator aI = m_aCandidates.begin();
- aI != m_aCandidates.end(); ++aI)
+ for (auto aI = m_aCandidates.begin(); aI != m_aCandidates.end(); ++aI)
{
- vcl::Window* pCandidate = *aI;
+ VclPtr<vcl::Window> pCandidate = *aI;
if (m_aDeletedCandidates.find(pCandidate) != m_aDeletedCandidates.end())
continue;
pCandidate->RemoveEventListener(LINK(this, CandidateMgr, WindowEventListener));
@@ -97,8 +96,7 @@ void CandidateMgr::PaintTransparentChildren(vcl::Window & rWindow, Rectangle con
pCandidate = pCandidate->GetWindow( WINDOW_NEXT );
}
- for (std::vector<vcl::Window*>::iterator aI = m_aCandidates.begin();
- aI != m_aCandidates.end(); ++aI)
+ for (auto aI = m_aCandidates.begin(); aI != m_aCandidates.end(); ++aI)
{
pCandidate = *aI;
if (m_aDeletedCandidates.find(pCandidate) != m_aDeletedCandidates.end())
@@ -115,31 +113,33 @@ void CandidateMgr::PaintTransparentChildren(vcl::Window & rWindow, Rectangle con
}
SdrPreRenderDevice::SdrPreRenderDevice(OutputDevice& rOriginal)
-: mrOutputDevice(rOriginal)
+: mrOutputDevice(rOriginal),
+ mpPreRenderDevice(VclPtr<VirtualDevice>::Create())
{
}
SdrPreRenderDevice::~SdrPreRenderDevice()
{
+ mpPreRenderDevice.disposeAndClear();
}
void SdrPreRenderDevice::PreparePreRenderDevice()
{
- // compare size of maPreRenderDevice with size of visible area
- if(maPreRenderDevice.GetOutputSizePixel() != mrOutputDevice.GetOutputSizePixel())
+ // compare size of mpPreRenderDevice with size of visible area
+ if(mpPreRenderDevice->GetOutputSizePixel() != mrOutputDevice.GetOutputSizePixel())
{
- maPreRenderDevice.SetOutputSizePixel(mrOutputDevice.GetOutputSizePixel());
+ mpPreRenderDevice->SetOutputSizePixel(mrOutputDevice.GetOutputSizePixel());
}
// Also compare the MapModes for zoom/scroll changes
- if(maPreRenderDevice.GetMapMode() != mrOutputDevice.GetMapMode())
+ if(mpPreRenderDevice->GetMapMode() != mrOutputDevice.GetMapMode())
{
- maPreRenderDevice.SetMapMode(mrOutputDevice.GetMapMode());
+ mpPreRenderDevice->SetMapMode(mrOutputDevice.GetMapMode());
}
// #i29186#
- maPreRenderDevice.SetDrawMode(mrOutputDevice.GetDrawMode());
- maPreRenderDevice.SetSettings(mrOutputDevice.GetSettings());
+ mpPreRenderDevice->SetDrawMode(mrOutputDevice.GetDrawMode());
+ mpPreRenderDevice->SetSettings(mrOutputDevice.GetSettings());
}
void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegion)
@@ -151,9 +151,9 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
// MapModes off
bool bMapModeWasEnabledDest(mrOutputDevice.IsMapModeEnabled());
- bool bMapModeWasEnabledSource(maPreRenderDevice.IsMapModeEnabled());
+ bool bMapModeWasEnabledSource(mpPreRenderDevice->IsMapModeEnabled());
mrOutputDevice.EnableMapMode(false);
- maPreRenderDevice.EnableMapMode(false);
+ mpPreRenderDevice->EnableMapMode(false);
RectangleVector aRectangles;
aRegionPixel.GetRegionRectangles(aRectangles);
@@ -167,7 +167,7 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
mrOutputDevice.DrawOutDev(
aTopLeft, aSize,
aTopLeft, aSize,
- maPreRenderDevice);
+ *mpPreRenderDevice.get());
#ifdef DBG_UTIL
// #i74769#
@@ -188,7 +188,7 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
}
mrOutputDevice.EnableMapMode(bMapModeWasEnabledDest);
- maPreRenderDevice.EnableMapMode(bMapModeWasEnabledSource);
+ mpPreRenderDevice->EnableMapMode(bMapModeWasEnabledSource);
}
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 7923c7aac6d1..0d4ee090e7d6 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -722,7 +722,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
pTextEditOutlinerView->ShowCursor();
pTextEditOutliner->SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl));
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
pTextEditOutliner->ClearModifyFlag();
@@ -1202,7 +1202,7 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
ImpMakeTextCursorAreaVisible();
return true;
@@ -1218,7 +1218,7 @@ bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin)
if (!bPostIt) {
Point aPt(rMEvt.GetPosPixel());
if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
- else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
+ else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt);
bPostIt=IsTextEditHit(aPt,nHitTolLog);
}
if (bPostIt) {
@@ -1236,7 +1236,7 @@ bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin)
if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) {
if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
ImpMakeTextCursorAreaVisible();
return true;
@@ -1253,7 +1253,7 @@ bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin)
if (!bPostIt) {
Point aPt(rMEvt.GetPosPixel());
if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
- else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
+ else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt);
bPostIt=IsTextEditHit(aPt,nHitTolLog);
}
if (bPostIt) {
@@ -1267,7 +1267,7 @@ bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin)
rMEvt.GetButtons(),rMEvt.GetModifier());
if (pTextEditOutlinerView->MouseButtonUp(aMEvt)) {
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
ImpMakeTextCursorAreaVisible();
return true;
@@ -1305,7 +1305,7 @@ bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin)
rMEvt.GetButtons(),rMEvt.GetModifier());
if (pTextEditOutlinerView->MouseMove(aMEvt) && bSelMode) {
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
ImpMakeTextCursorAreaVisible();
return true;
@@ -1325,7 +1325,7 @@ bool SdrObjEditView::Command(const CommandEvent& rCEvt, vcl::Window* pWin)
if (!bPostIt && rCEvt.IsMouseEvent()) {
Point aPt(rCEvt.GetMousePosPixel());
if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
- else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
+ else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt);
bPostIt=IsTextEditHit(aPt,nHitTolLog);
}
if (bPostIt) {
@@ -1342,7 +1342,7 @@ bool SdrObjEditView::Command(const CommandEvent& rCEvt, vcl::Window* pWin)
pTextEditOutlinerView->Command(aCEvt);
if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
ImpMakeTextCursorAreaVisible();
return true;
@@ -1392,7 +1392,7 @@ bool SdrObjEditView::ImpIsTextEditAllSelected() const
void SdrObjEditView::ImpMakeTextCursorAreaVisible()
{
- if (pTextEditOutlinerView!=NULL && pTextEditWin!=NULL) {
+ if (pTextEditOutlinerView!=nullptr && pTextEditWin!=nullptr) {
vcl::Cursor* pCsr=pTextEditWin->GetCursor();
if (pCsr!=NULL) {
Size aSiz(pCsr->GetSize());
@@ -1613,7 +1613,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
pTextEditOutlinerView->SetAttribs(rSet);
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL)
+ if (pItemBrowser!=nullptr)
pItemBrowser->SetDirty();
#endif
@@ -1733,7 +1733,7 @@ void SdrObjEditView::ImpMacroUp(const Point& rUpPos)
aHitRec.nTol=nMacroTol;
aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
aHitRec.pPageView=pMacroPV;
- aHitRec.pOut=pMacroWin;
+ aHitRec.pOut=pMacroWin.get();
pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
bMacroDown=false;
}
@@ -1750,7 +1750,7 @@ void SdrObjEditView::ImpMacroDown(const Point& rDownPos)
aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
aHitRec.pPageView=pMacroPV;
aHitRec.bDown=true;
- aHitRec.pOut=pMacroWin;
+ aHitRec.pOut=pMacroWin.get();
pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
bMacroDown=true;
}
@@ -1766,7 +1766,7 @@ void SdrObjEditView::MovMacroObj(const Point& rPnt)
aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
aHitRec.pPageView=pMacroPV;
aHitRec.bDown=bMacroDown;
- aHitRec.pOut=pMacroWin;
+ aHitRec.pOut=pMacroWin.get();
bool bDown=pMacroObj->IsMacroHit(aHitRec);
if (bDown) ImpMacroDown(rPnt);
else ImpMacroUp(rPnt);
@@ -1794,7 +1794,7 @@ bool SdrObjEditView::EndMacroObj()
aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
aHitRec.pPageView=pMacroPV;
aHitRec.bDown=true;
- aHitRec.pOut=pMacroWin;
+ aHitRec.pOut=pMacroWin.get();
bool bRet=pMacroObj->DoMacro(aHitRec);
pMacroObj=NULL;
pMacroPV=NULL;
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index d15f9c0c5a25..0a6974e72084 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -78,7 +78,7 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(
SdrLayerID nLay,
const Rectangle& rRect)
: maTmpList(),
- maVD(),
+ mpVD(VclPtr<VirtualDevice>::Create()),
maScaleRect(rRect),
mnMapScalingOfs(0),
mpLineAttr(0),
@@ -105,10 +105,10 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(
mbLastObjWasLine(false),
maClip()
{
- maVD.EnableOutput(false);
- maVD.SetLineColor();
- maVD.SetFillColor();
- maOldLineColor.SetRed( maVD.GetLineColor().GetRed() + 1 );
+ mpVD->EnableOutput(false);
+ mpVD->SetLineColor();
+ mpVD->SetFillColor();
+ maOldLineColor.SetRed( mpVD->GetLineColor().GetRed() + 1 );
mpLineAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_LINE_FIRST, XATTR_LINE_LAST, 0, 0);
mpFillAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0);
mpTextAttr = new SfxItemSet(rModel.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END, 0, 0);
@@ -340,12 +340,12 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr
mpLineAttr->Put(XLineWidthItem(0));
}
- maOldLineColor = maVD.GetLineColor();
+ maOldLineColor = mpVD->GetLineColor();
- if(maVD.IsLineColor())
+ if(mpVD->IsLineColor())
{
mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_SOLID));
- mpLineAttr->Put(XLineColorItem(OUString(), maVD.GetLineColor()));
+ mpLineAttr->Put(XLineColorItem(OUString(), mpVD->GetLineColor()));
}
else
{
@@ -390,10 +390,10 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr
if(bFill)
{
- if(maVD.IsFillColor())
+ if(mpVD->IsFillColor())
{
mpFillAttr->Put(XFillStyleItem(drawing::FillStyle_SOLID));
- mpFillAttr->Put(XFillColorItem(OUString(), maVD.GetFillColor()));
+ mpFillAttr->Put(XFillColorItem(OUString(), mpVD->GetFillColor()));
}
else
{
@@ -407,7 +407,7 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr
if(bText && mbFntDirty)
{
- vcl::Font aFnt(maVD.GetFont());
+ vcl::Font aFnt(mpVD->GetFont());
const sal_uInt32 nHeight(FRound(aFnt.GetSize().Height() * mfScaleY));
mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) );
@@ -429,7 +429,7 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr
mpTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM));
mpTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE));
- mpTextAttr->Put(SvxColorItem(maVD.GetTextColor(), EE_CHAR_COLOR));
+ mpTextAttr->Put(SvxColorItem(mpVD->GetTextColor(), EE_CHAR_COLOR));
//... svxfont textitem svditext
mbFntDirty = false;
}
@@ -779,7 +779,7 @@ bool ImpSdrGDIMetaFileImport::CheckLastLineMerge(const basegfx::B2DPolygon& rSrc
}
// #i73407# reformulation to use new B2DPolygon classes
- if(mbLastObjWasLine && (maOldLineColor == maVD.GetLineColor()) && rSrcPoly.count())
+ if(mbLastObjWasLine && (maOldLineColor == mpVD->GetLineColor()) && rSrcPoly.count())
{
SdrObject* pTmpObj = maTmpList.size() ? maTmpList[maTmpList.size() - 1] : 0;
SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj);
@@ -871,9 +871,9 @@ bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPo
void ImpSdrGDIMetaFileImport::checkClip()
{
- if(maVD.IsClipRegion())
+ if(mpVD->IsClipRegion())
{
- maClip = maVD.GetClipRegion().GetAsB2DPolyPolygon();
+ maClip = mpVD->GetClipRegion().GetAsB2DPolyPolygon();
if(isClip())
{
@@ -984,12 +984,12 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rSt
{
// calc text box size, add 5% to make it fit safely
- FontMetric aFontMetric( maVD.GetFontMetric() );
- vcl::Font aFnt( maVD.GetFont() );
+ FontMetric aFontMetric( mpVD->GetFontMetric() );
+ vcl::Font aFnt( mpVD->GetFont() );
FontAlign eAlg( aFnt.GetAlign() );
- sal_Int32 nTextWidth = (sal_Int32)( maVD.GetTextWidth( rStr ) * mfScaleX );
- sal_Int32 nTextHeight = (sal_Int32)( maVD.GetTextHeight() * mfScaleY );
+ sal_Int32 nTextWidth = (sal_Int32)( mpVD->GetTextWidth( rStr ) * mfScaleX );
+ sal_Int32 nTextHeight = (sal_Int32)( mpVD->GetTextHeight() * mfScaleY );
Point aPos( FRound(rPos.X() * mfScaleX + maOfs.X()), FRound(rPos.Y() * mfScaleY + maOfs.Y()) );
Size aSize( nTextWidth, nTextHeight );
@@ -1168,13 +1168,13 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct )
void ImpSdrGDIMetaFileImport::DoAction(MetaLineColorAction& rAct)
{
- rAct.Execute(&maVD);
+ rAct.Execute(mpVD);
}
void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct)
{
MapScaling();
- rAct.Execute(&maVD);
+ rAct.Execute(mpVD);
mbLastObjWasPolyWithoutLine = false;
mbLastObjWasLine = false;
}
@@ -1182,7 +1182,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct)
void ImpSdrGDIMetaFileImport::MapScaling()
{
const size_t nCount(maTmpList.size());
- const MapMode& rMap = maVD.GetMapMode();
+ const MapMode& rMap = mpVD->GetMapMode();
Point aMapOrg( rMap.GetOrigin() );
bool bMov2(aMapOrg.X() != 0 || aMapOrg.Y() != 0);
@@ -1276,7 +1276,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaTextRectAction& rAct)
{
GDIMetaFile aTemp;
- maVD.AddTextRectActions(rAct.GetRect(), rAct.GetText(), rAct.GetStyle(), aTemp);
+ mpVD->AddTextRectActions(rAct.GetRect(), rAct.GetText(), rAct.GetStyle(), aTemp);
DoLoopActions(aTemp, 0, 0);
}
@@ -1558,12 +1558,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction& rAct)
else
{
// gradient transparence
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
- aVDev.SetOutputSizePixel(aBitmapEx.GetBitmap().GetSizePixel());
- aVDev.DrawGradient(Rectangle(Point(0, 0), aVDev.GetOutputSizePixel()), rGradient);
+ pVDev->SetOutputSizePixel(aBitmapEx.GetBitmap().GetSizePixel());
+ pVDev->DrawGradient(Rectangle(Point(0, 0), pVDev->GetOutputSizePixel()), rGradient);
- aNewMask = AlphaMask(aVDev.GetBitmap(Point(0, 0), aVDev.GetOutputSizePixel()));
+ aNewMask = AlphaMask(pVDev->GetBitmap(Point(0, 0), pVDev->GetOutputSizePixel()));
bHasNewMask = true;
}
diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx
index 33435955f93e..c7c32f4619e2 100644
--- a/svx/source/svdraw/svdfmtf.hxx
+++ b/svx/source/svdraw/svdfmtf.hxx
@@ -45,7 +45,7 @@ class ImpSdrGDIMetaFileImport
{
protected:
::std::vector< SdrObject* > maTmpList;
- VirtualDevice maVD;
+ ScopedVclPtr<VirtualDevice> mpVD;
Rectangle maScaleRect;
size_t mnMapScalingOfs; // from here on, not edited with MapScaling
SfxItemSet* mpLineAttr;
@@ -106,18 +106,18 @@ protected:
void DoAction(MetaHatchAction & rAct);
void DoAction(MetaLineColorAction & rAct);
void DoAction(MetaMapModeAction & rAct);
- void DoAction(MetaFillColorAction & rAct) { rAct.Execute(&maVD); }
- void DoAction(MetaTextColorAction & rAct) { rAct.Execute(&maVD); }
- void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(&maVD); }
- void DoAction(MetaFontAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; }
- void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; }
- void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(&maVD); checkClip(); }
- void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(&maVD); }
- void DoAction(MetaPushAction & rAct) { rAct.Execute(&maVD); checkClip(); }
- void DoAction(MetaPopAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; checkClip(); }
- void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&maVD); checkClip(); }
- void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); }
- void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); }
+ void DoAction(MetaFillColorAction & rAct) { rAct.Execute(mpVD); }
+ void DoAction(MetaTextColorAction & rAct) { rAct.Execute(mpVD); }
+ void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(mpVD); }
+ void DoAction(MetaFontAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
+ void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
+ void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(mpVD); checkClip(); }
+ void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(mpVD); }
+ void DoAction(MetaPushAction & rAct) { rAct.Execute(mpVD); checkClip(); }
+ void DoAction(MetaPopAction & rAct) { rAct.Execute(mpVD); mbFntDirty = true; checkClip(); }
+ void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(mpVD); checkClip(); }
+ void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(mpVD); checkClip(); }
+ void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(mpVD); checkClip(); }
// #i125211# The MetaCommentAction needs to advance (if used), thus
// give current metafile and index which may be changed
@@ -134,14 +134,14 @@ protected:
static void DoAction(MetaWallpaperAction& rAct);
void DoAction(MetaTransparentAction& rAct);
static void DoAction(MetaEPSAction& rAct);
- void DoAction(MetaRefPointAction& rAct) { rAct.Execute(&maVD); }
- void DoAction(MetaTextLineColorAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; }
+ void DoAction(MetaRefPointAction& rAct) { rAct.Execute(mpVD); }
+ void DoAction(MetaTextLineColorAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
static void DoAction(MetaTextLineAction& rAct);
void DoAction(MetaFloatTransparentAction& rAct);
void DoAction(MetaGradientExAction& rAct);
- void DoAction(MetaLayoutModeAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; }
- void DoAction(MetaTextLanguageAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; }
- void DoAction(MetaOverlineColorAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; }
+ void DoAction(MetaLayoutModeAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
+ void DoAction(MetaTextLanguageAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
+ void DoAction(MetaOverlineColorAction& rAct) { rAct.Execute(mpVD); mbFntDirty = true; }
void ImportText(const Point& rPos, const OUString& rStr, const MetaAction& rAct);
void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false);
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index d816c0ede1c6..cddf3dfa9954 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -162,22 +162,18 @@ bool ImpItemListRow::operator==(const ImpItemListRow& rEntry) const
class ImpItemEdit: public Edit
{
- _SdrItemBrowserControl* pBrowse;
+ VclPtr<_SdrItemBrowserControl> pBrowse;
public:
ImpItemEdit(vcl::Window* pParent, _SdrItemBrowserControl* pBrowse_, WinBits nBits=0)
: Edit(pParent, nBits),
pBrowse(pBrowse_)
{}
-
- virtual ~ImpItemEdit();
+ virtual ~ImpItemEdit() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { pBrowse.clear(); Edit::dispose(); }
virtual void KeyInput(const KeyEvent& rEvt) SAL_OVERRIDE;
};
-ImpItemEdit::~ImpItemEdit()
-{
-}
-
void ImpItemEdit::KeyInput(const KeyEvent& rKEvt)
{
_SdrItemBrowserControl* pBrowseMerk = pBrowse;
@@ -217,11 +213,17 @@ _SdrItemBrowserControl::_SdrItemBrowserControl(vcl::Window* pParent, WinBits nBi
_SdrItemBrowserControl::~_SdrItemBrowserControl()
{
- delete pEditControl;
+ disposeOnce();
+}
+
+void _SdrItemBrowserControl::dispose()
+{
+ pEditControl.disposeAndClear();
delete pAktChangeEntry;
Clear();
+ BrowseBox::dispose();
}
void _SdrItemBrowserControl::ImpCtor()
@@ -493,7 +495,7 @@ bool _SdrItemBrowserControl::BegChangeEntry(sal_uIntPtr nPos)
ImpItemListRow* pEntry=ImpGetEntry(nPos);
if (pEntry!=NULL && !pEntry->bComment) {
SetMode(MYBROWSEMODE & BrowserMode(~BrowserMode::KEEPHIGHLIGHT));
- pEditControl=new ImpItemEdit(&GetDataWindow(),this,0);
+ pEditControl=VclPtr<ImpItemEdit>::Create(&GetDataWindow(),this,0);
Rectangle aRect(GetFieldRectPixel(nPos, ITEMBROWSER_VALUECOL_ID, false));
aRect.Left()+=2; // little offset for the Edit, so it's exact to the pixel
aRect.Right()--;
@@ -528,10 +530,9 @@ bool _SdrItemBrowserControl::BegChangeEntry(sal_uIntPtr nPos)
bool _SdrItemBrowserControl::EndChangeEntry()
{
bool bRet = false;
- if (pEditControl!=NULL) {
+ if (pEditControl!=nullptr) {
aEntryChangedHdl.Call(this);
- delete pEditControl;
- pEditControl=NULL;
+ pEditControl.disposeAndClear();
delete pAktChangeEntry;
pAktChangeEntry=NULL;
vcl::Window* pParent=GetParent();
@@ -544,9 +545,8 @@ bool _SdrItemBrowserControl::EndChangeEntry()
void _SdrItemBrowserControl::BrkChangeEntry()
{
- if (pEditControl!=NULL) {
- delete pEditControl;
- pEditControl=NULL;
+ if (pEditControl!=nullptr) {
+ pEditControl.disposeAndClear();
delete pAktChangeEntry;
pAktChangeEntry=NULL;
vcl::Window* pParent=GetParent();
@@ -1046,25 +1046,32 @@ void _SdrItemBrowserControl::SetAttributes(const SfxItemSet* pSet, const SfxItem
_SdrItemBrowserWindow::_SdrItemBrowserWindow(vcl::Window* pParent, WinBits nBits):
FloatingWindow(pParent,nBits),
- aBrowse(this)
+ aBrowse(VclPtr<_SdrItemBrowserControl>::Create(this))
{
- SetOutputSizePixel(aBrowse.GetSizePixel());
+ SetOutputSizePixel(aBrowse->GetSizePixel());
SetText(OUString("Joe's ItemBrowser"));
- aBrowse.Show();
+ aBrowse->Show();
}
_SdrItemBrowserWindow::~_SdrItemBrowserWindow()
{
+ disposeOnce();
+}
+
+void _SdrItemBrowserWindow::dispose()
+{
+ aBrowse.disposeAndClear();
+ FloatingWindow::dispose();
}
void _SdrItemBrowserWindow::Resize()
{
- aBrowse.SetSizePixel(GetOutputSizePixel());
+ aBrowse->SetSizePixel(GetOutputSizePixel());
}
void _SdrItemBrowserWindow::GetFocus()
{
- aBrowse.GrabFocus();
+ aBrowse->GrabFocus();
}
// - SdrItemBrowser -
@@ -1075,8 +1082,8 @@ SdrItemBrowser::SdrItemBrowser(SdrView& rView):
bDirty(false)
{
aIdle.SetIdleHdl(LINK(this,SdrItemBrowser,IdleHdl));
- GetBrowserControl().SetEntryChangedHdl(LINK(this,SdrItemBrowser,ChangedHdl));
- GetBrowserControl().SetSetDirtyHdl(LINK(this,SdrItemBrowser,SetDirtyHdl));
+ GetBrowserControl()->SetEntryChangedHdl(LINK(this,SdrItemBrowser,ChangedHdl));
+ GetBrowserControl()->SetSetDirtyHdl(LINK(this,SdrItemBrowser,SetDirtyHdl));
SetDirty();
}
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 1bb16bc1873d..a747bc69889a 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -2090,7 +2090,7 @@ void SdrMarkView::MarkListHasChanged()
bMarkedObjRectDirty=true;
bMarkedPointsRectsDirty=true;
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
bool bOneEdgeMarked=false;
if (GetMarkedObjectCount()==1) {
diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx
index 81668a5d3926..1dd73677e74c 100644
--- a/svx/source/svdraw/svdmrkv1.cxx
+++ b/svx/source/svdraw/svdmrkv1.cxx
@@ -475,7 +475,7 @@ bool SdrMarkView::PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16
if (!IsGluePointEditMode()) return false;
bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
bool bNext=(nOptions & SDRSEARCH_NEXT) !=0;
- OutputDevice* pOut=const_cast<OutputDevice*>(pActualOutDev);
+ OutputDevice* pOut=const_cast<OutputDevice*>(pActualOutDev.get());
if (pOut==NULL) pOut=GetFirstOutputDevice();
if (pOut==NULL) return false;
SortMarkedObjects();
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 9253a46b652d..9e1f49112780 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -1026,14 +1026,14 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const
if(isEmbeddedSvg() && GetModel())
{
- VirtualDevice aOut;
+ ScopedVclPtrInstance< VirtualDevice > pOut;
const Rectangle aBoundRect(GetCurrentBoundRect());
const MapMode aMap(GetModel()->GetScaleUnit(), Point(), GetModel()->GetScaleFraction(), GetModel()->GetScaleFraction());
- aOut.EnableOutput(false);
- aOut.SetMapMode(aMap);
- aRetval.Record(&aOut);
- SingleObjectPainter(aOut);
+ pOut->EnableOutput(false);
+ pOut->SetMapMode(aMap);
+ aRetval.Record(pOut);
+ SingleObjectPainter(*pOut.get());
aRetval.Stop();
aRetval.WindStart();
aRetval.Move(-aBoundRect.Left(), -aBoundRect.Top());
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 1cde6ffdc7af..43c1aa31c855 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1877,12 +1877,12 @@ GDIMetaFile* SdrTextObj::GetTextScrollMetaFileAndRectangle(
// create the MetaFile
pRetval = new GDIMetaFile;
- VirtualDevice aBlackHole;
- aBlackHole.EnableOutput(false);
- pRetval->Record(&aBlackHole);
+ ScopedVclPtrInstance< VirtualDevice > pBlackHole;
+ pBlackHole->EnableOutput(false);
+ pRetval->Record(pBlackHole);
Point aPaintPos = aPaintRect.TopLeft();
- rOutliner.Draw(&aBlackHole, aPaintPos);
+ rOutliner.Draw(pBlackHole, aPaintPos);
pRetval->Stop();
pRetval->WindStart();
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index aa96a6c58eff..59c0fbb36d8a 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -235,10 +235,7 @@ SdrPaintView::~SdrPaintView()
ClearPageView();
#ifdef DBG_UTIL
- if(pItemBrowser)
- {
- delete pItemBrowser;
- }
+ pItemBrowser.disposeAndClear();
#endif
// delete existing SdrPaintWindows
@@ -409,7 +406,7 @@ sal_uInt16 SdrPaintView::ImpGetHitTolLogic(short nHitTol, const OutputDevice* pO
void SdrPaintView::TheresNewMapMode()
{
- if (pActualOutDev!=NULL) {
+ if (pActualOutDev) {
nHitTolLog=(sal_uInt16)pActualOutDev->PixelToLogic(Size(nHitTolPix,0)).Width();
nMinMovLog=(sal_uInt16)pActualOutDev->PixelToLogic(Size(nMinMovPix,0)).Width();
}
@@ -417,7 +414,7 @@ void SdrPaintView::TheresNewMapMode()
void SdrPaintView::SetActualWin(const OutputDevice* pWin)
{
- pActualOutDev=pWin;
+ pActualOutDev = const_cast<OutputDevice *>(pWin);
TheresNewMapMode();
}
@@ -474,7 +471,7 @@ void SdrPaintView::AddWindowToPaintView(OutputDevice* pNewWin)
}
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL)
+ if (pItemBrowser!=nullptr)
pItemBrowser->ForceParent();
#endif
}
@@ -496,7 +493,7 @@ void SdrPaintView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
}
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL)
+ if (pItemBrowser!=nullptr)
pItemBrowser->ForceParent();
#endif
}
@@ -1061,7 +1058,7 @@ void SdrPaintView::SetDefaultAttr(const SfxItemSet& rAttr, bool bReplaceAll)
else aDefaultAttr.Put(rAttr,false); // if FALSE, regard InvalidItems as "holes," not as Default
SetNotPersistDefaultAttr(rAttr,bReplaceAll);
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
}
@@ -1084,7 +1081,7 @@ void SdrPaintView::SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRe
}
}
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
}
@@ -1127,16 +1124,15 @@ bool SdrPaintView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHar
void SdrPaintView::ShowItemBrowser(bool bShow)
{
if (bShow) {
- if (pItemBrowser==NULL) {
- pItemBrowser=new SdrItemBrowser(*static_cast<SdrView*>(this));
+ if (pItemBrowser==nullptr) {
+ pItemBrowser=VclPtr<SdrItemBrowser>::Create(*static_cast<SdrView*>(this));
}
pItemBrowser->Show();
pItemBrowser->GrabFocus();
} else {
- if (pItemBrowser!=NULL) {
+ if (pItemBrowser!=nullptr) {
pItemBrowser->Hide();
- delete pItemBrowser;
- pItemBrowser=NULL;
+ pItemBrowser.disposeAndClear();
}
}
}
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index 8e517c5ba9c0..476b4be808e4 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -634,17 +634,17 @@ FrPair GetInchOrMM(MapUnit eU)
case MAP_MM : return FrPair( 1,1);
case MAP_CM : return FrPair( 1,10);
case MAP_PIXEL : {
- VirtualDevice aVD;
- aVD.SetMapMode(MapMode(MAP_100TH_MM));
- Point aP(aVD.PixelToLogic(Point(64,64))); // 64 pixels for more accuracy
+ ScopedVclPtrInstance< VirtualDevice > pVD;
+ pVD->SetMapMode(MapMode(MAP_100TH_MM));
+ Point aP(pVD->PixelToLogic(Point(64,64))); // 64 pixels for more accuracy
return FrPair(6400,aP.X(),6400,aP.Y());
}
case MAP_APPFONT: case MAP_SYSFONT: {
- VirtualDevice aVD;
- aVD.SetMapMode(MapMode(eU));
- Point aP(aVD.LogicToPixel(Point(32,32))); // 32 units for more accuracy
- aVD.SetMapMode(MapMode(MAP_100TH_MM));
- aP=aVD.PixelToLogic(aP);
+ ScopedVclPtrInstance< VirtualDevice > pVD;
+ pVD->SetMapMode(MapMode(eU));
+ Point aP(pVD->LogicToPixel(Point(32,32))); // 32 units for more accuracy
+ pVD->SetMapMode(MapMode(MAP_100TH_MM));
+ aP=pVD->PixelToLogic(aP);
return FrPair(3200,aP.X(),3200,aP.Y());
}
default: break;
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 89589ba4e1bc..e2dd8d4dc3f1 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -488,7 +488,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
// we currently don't account for ticker text
if(pActualOutDev && pActualOutDev->GetOutDevType() == OUTDEV_WINDOW)
{
- OutlinerView aOLV(pOutliner, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev)));
+ OutlinerView aOLV(pOutliner, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get())));
const EditView& aEV=aOLV.GetEditView();
const SvxFieldItem* pItem=aEV.GetField(aTemporaryTextRelativePosition);
if (pItem!=NULL) {
@@ -822,7 +822,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
if (eHit==SDRHIT_TEXTEDIT)
{
bool bRet2(pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType() &&
- SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev)), false, (SdrOutliner*)0L));
+ SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get())), false, (SdrOutliner*)0L));
if(bRet2)
{
@@ -906,7 +906,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
} else bRet=BegCreateObj(aLogicPos);
} break;
case SDREVENT_BEGMACROOBJ: {
- bRet=BegMacroObj(aLogicPos,nHitTolLog,rVEvt.pObj,rVEvt.pPV,const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev)));
+ bRet=BegMacroObj(aLogicPos,nHitTolLog,rVEvt.pObj,rVEvt.pPV,const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get())));
} break;
case SDREVENT_BEGTEXTEDIT: {
if (!IsObjMarked(rVEvt.pObj)) {
@@ -915,7 +915,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
}
bRet = pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType()&&
- SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev)), false, (SdrOutliner*)0L);
+ SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get())), false, (SdrOutliner*)0L);
if(bRet)
{
@@ -927,8 +927,8 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
} break;
default: break;
} // switch
- if (bRet && pActualOutDev!=NULL && pActualOutDev->GetOutDevType()==OUTDEV_WINDOW) {
- vcl::Window* pWin=const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev));
+ if (bRet && pActualOutDev && pActualOutDev->GetOutDevType()==OUTDEV_WINDOW) {
+ vcl::Window* pWin=const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get()));
// left mouse button pressed?
bool bLeftDown=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseDown;
// left mouse button released?
@@ -970,7 +970,7 @@ Pointer SdrView::GetPreferredPointer(const Point& rMousePos, const OutputDevice*
aHitRec.nTol=nMacroTol;
aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
aHitRec.pPageView=pMacroPV;
- aHitRec.pOut=pMacroWin;
+ aHitRec.pOut=pMacroWin.get();
aHitRec.bDown=bMacroDown;
return pMacroObj->GetMacroPointer(aHitRec);
}
@@ -1362,7 +1362,7 @@ void SdrView::MarkAll()
if (IsTextEdit()) {
GetTextEditOutlinerView()->SetSelection(ESelection(0,0,EE_PARA_ALL,EE_TEXTPOS_ALL));
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
} else if (IsGluePointEditMode()) MarkAllGluePoints();
else if (HasMarkablePoints()) MarkAllPoints();
@@ -1377,7 +1377,7 @@ void SdrView::UnmarkAll()
eSel.nStartPos=eSel.nEndPos;
GetTextEditOutlinerView()->SetSelection(eSel);
#ifdef DBG_UTIL
- if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+ if (pItemBrowser!=nullptr) pItemBrowser->SetDirty();
#endif
} else if (HasMarkedGluePoints()) UnmarkAllGluePoints();
else if (HasMarkedPoints()) UnmarkAllPoints(); // Marked, not Markable!
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 194231e8f365..a033fd8c7eb8 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -553,16 +553,16 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co
if( !aMtf.GetActionSize() )
{
- VirtualDevice aOut;
+ ScopedVclPtrInstance< VirtualDevice > pOut;
const Size aDummySize(2, 2);
- aOut.SetOutputSizePixel(aDummySize);
- aOut.EnableOutput(false);
- aOut.SetMapMode(aMap);
+ pOut->SetOutputSizePixel(aDummySize);
+ pOut->EnableOutput(false);
+ pOut->SetMapMode(aMap);
aMtf.Clear();
- aMtf.Record(&aOut);
+ aMtf.Record(pOut);
- DrawMarkedObj(aOut);
+ DrawMarkedObj(*pOut.get());
aMtf.Stop();
aMtf.WindStart();
@@ -640,7 +640,7 @@ Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject*
// if graphic could not be retrieved => go the hard way and create a MetaFile
if( ( GRAPHIC_NONE == aRet.GetType() ) || ( GRAPHIC_DEFAULT == aRet.GetType() ) )
{
- VirtualDevice aOut;
+ ScopedVclPtrInstance< VirtualDevice > pOut;
GDIMetaFile aMtf;
const Rectangle aBoundRect( pObj->GetCurrentBoundRect() );
const MapMode aMap( pModel->GetScaleUnit(),
@@ -648,10 +648,10 @@ Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject*
pModel->GetScaleFraction(),
pModel->GetScaleFraction() );
- aOut.EnableOutput( false );
- aOut.SetMapMode( aMap );
- aMtf.Record( &aOut );
- pObj->SingleObjectPainter( aOut );
+ pOut->EnableOutput( false );
+ pOut->SetMapMode( aMap );
+ aMtf.Record( pOut );
+ pObj->SingleObjectPainter( *pOut.get() );
aMtf.Stop();
aMtf.WindStart();
diff --git a/svx/source/tbxctrls/SvxColorChildWindow.cxx b/svx/source/tbxctrls/SvxColorChildWindow.cxx
index a541eb2bdf83..a4ad23f3fedc 100644
--- a/svx/source/tbxctrls/SvxColorChildWindow.cxx
+++ b/svx/source/tbxctrls/SvxColorChildWindow.cxx
@@ -33,8 +33,9 @@ SvxColorChildWindow::SvxColorChildWindow( vcl::Window* _pParent,
SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId )
{
- SvxColorDockingWindow* pWin = new SvxColorDockingWindow( pBindings, this,
+ VclPtr<SvxColorDockingWindow> pWin = VclPtr<SvxColorDockingWindow>::Create( pBindings, this,
_pParent );
+
pWindow = pWin;
eChildAlignment = SfxChildAlignment::BOTTOM;
diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx
index bc47a66ec219..68ab4fe1c114 100644
--- a/svx/source/tbxctrls/bulletsnumbering.cxx
+++ b/svx/source/tbxctrls/bulletsnumbering.cxx
@@ -40,13 +40,15 @@ class NumberingPopup : public svtools::ToolbarMenu
{
bool mbBulletItem;
NumberingToolBoxControl& mrController;
- SvxNumValueSet* mpValueSet;
+ VclPtr<SvxNumValueSet> mpValueSet;
DECL_LINK( VSSelectHdl, void * );
public:
NumberingPopup( NumberingToolBoxControl& rController,
const css::uno::Reference< css::frame::XFrame >& rFrame,
vcl::Window* pParent, bool bBulletItem );
+ virtual ~NumberingPopup();
+ virtual void dispose() SAL_OVERRIDE;
virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent )
throw ( css::uno::RuntimeException ) SAL_OVERRIDE;
@@ -58,7 +60,7 @@ class NumberingToolBoxControl : public svt::PopupWindowController
public:
NumberingToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
bool IsInImpressDraw();
// XStatusListener
@@ -87,7 +89,7 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
mrController( rController )
{
WinBits nBits = WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT;
- mpValueSet = new SvxNumValueSet( this, nBits );
+ mpValueSet = VclPtr<SvxNumValueSet>::Create( this, nBits );
mpValueSet->init( mbBulletItem ? NUM_PAGETYPE_BULLET : NUM_PAGETYPE_SINGLENUM );
if ( !mbBulletItem )
@@ -133,6 +135,17 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
AddStatusListener( ".uno:CurrentNumListType" );
}
+NumberingPopup::~NumberingPopup()
+{
+ disposeOnce();
+}
+
+void NumberingPopup::dispose()
+{
+ mpValueSet.clear();
+ ToolbarMenu::dispose();
+}
+
void NumberingPopup::statusChanged( const css::frame::FeatureStateEvent& rEvent )
throw ( css::uno::RuntimeException )
{
@@ -191,9 +204,9 @@ NumberingToolBoxControl::NumberingToolBoxControl( const css::uno::Reference< css
{
}
-vcl::Window* NumberingToolBoxControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> NumberingToolBoxControl::createPopupWindow( vcl::Window* pParent )
{
- return new NumberingPopup( *this, m_xFrame, pParent, mbBulletItem );
+ return VclPtr<NumberingPopup>::Create( *this, m_xFrame, pParent, mbBulletItem );
}
bool NumberingToolBoxControl::IsInImpressDraw()
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 6cfecdfc246f..5cdf8b7a10fe 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -37,13 +37,13 @@ class SvxColorWindow_Impl : public SfxPopupWindow
private:
const sal_uInt16 theSlotId;
- SvxColorValueSet* mpColorSet;
- SvxColorValueSet* mpRecentColorSet;
+ VclPtr<SvxColorValueSet> mpColorSet;
+ VclPtr<SvxColorValueSet> mpRecentColorSet;
- ListBox* mpPaletteListBox;
- PushButton* mpButtonAutoColor;
- PushButton* mpButtonPicker;
- FixedLine* mpAutomaticSeparator;
+ VclPtr<ListBox> mpPaletteListBox;
+ VclPtr<PushButton> mpButtonAutoColor;
+ VclPtr<PushButton> mpButtonPicker;
+ VclPtr<FixedLine> mpAutomaticSeparator;
OUString maCommand;
Link maSelectedLink;
@@ -68,12 +68,13 @@ public:
const OUString& rWndTitle,
vcl::Window* pParentWindow);
virtual ~SvxColorWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void StartSelection();
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
- virtual SfxPopupWindow* Clone() const SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
void SetSelectedHdl( const Link& rLink ) { maSelectedLink = rLink; }
};
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index 8febde00992b..23c743ca9d4e 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -186,7 +186,7 @@ SvxColorDockingWindow::SvxColorDockingWindow
SfxDockingWindow( _pBindings, pCW, _pParent, WB_MOVEABLE|WB_CLOSEABLE|WB_SIZEABLE|WB_DOCKABLE ),
pColorList (),
- aColorSet ( this ),
+ aColorSet ( VclPtr<SvxColorValueSet_docking>::Create(this) ),
nLeftSlot ( SID_ATTR_FILL_COLOR ),
nRightSlot ( SID_ATTR_LINE_COLOR ),
nCols ( 20 ),
@@ -197,9 +197,9 @@ SvxColorDockingWindow::SvxColorDockingWindow
SetSizePixel(LogicToPixel(Size(150, 22), MapMode(MAP_APPFONT)));
SetHelpId(HID_CTRL_COLOR);
- aColorSet.SetSelectHdl( LINK( this, SvxColorDockingWindow, SelectHdl ) );
- aColorSet.SetHelpId(HID_COLOR_CTL_COLORS);
- aColorSet.SetPosSizePixel(LogicToPixel(Point(2, 2), MapMode(MAP_APPFONT)),
+ aColorSet->SetSelectHdl( LINK( this, SvxColorDockingWindow, SelectHdl ) );
+ aColorSet->SetHelpId(HID_COLOR_CTL_COLORS);
+ aColorSet->SetPosSizePixel(LogicToPixel(Point(2, 2), MapMode(MAP_APPFONT)),
LogicToPixel(Size(146, 18), MapMode(MAP_APPFONT)));
// Get the model from the view shell. Using SfxObjectShell::Current()
@@ -230,21 +230,28 @@ SvxColorDockingWindow::SvxColorDockingWindow
}
}
- aItemSize = aColorSet.CalcItemSizePixel(Size(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength()));
+ aItemSize = aColorSet->CalcItemSizePixel(Size(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength()));
aItemSize.Width() = aItemSize.Width() + SvxColorValueSet::getEntryEdgeLength();
aItemSize.Width() /= 2;
aItemSize.Height() = aItemSize.Height() + SvxColorValueSet::getEntryEdgeLength();
aItemSize.Height() /= 2;
SetSize();
- aColorSet.Show();
+ aColorSet->Show();
if (_pBindings != NULL)
StartListening( *_pBindings, true );
}
SvxColorDockingWindow::~SvxColorDockingWindow()
{
+ disposeOnce();
+}
+
+void SvxColorDockingWindow::dispose()
+{
EndListening( GetBindings() );
+ aColorSet.disposeAndClear();
+ SfxDockingWindow::dispose();
}
void SvxColorDockingWindow::Notify( SfxBroadcaster& , const SfxHint& rHint )
@@ -264,25 +271,25 @@ void SvxColorDockingWindow::FillValueSet()
if( pColorList.is() )
{
nCount = pColorList->Count();
- aColorSet.Clear();
+ aColorSet->Clear();
// create the first entry for 'invisible/none'
const Size aColorSize(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength());
long nPtX = aColorSize.Width() - 1;
long nPtY = aColorSize.Height() - 1;
- VirtualDevice aVD;
+ ScopedVclPtrInstance< VirtualDevice > pVD;
- aVD.SetOutputSizePixel( aColorSize );
- aVD.SetLineColor( Color( COL_BLACK ) );
- aVD.SetBackground( Wallpaper( Color( COL_WHITE ) ) );
- aVD.DrawLine( Point(), Point( nPtX, nPtY ) );
- aVD.DrawLine( Point( 0, nPtY ), Point( nPtX, 0 ) );
+ pVD->SetOutputSizePixel( aColorSize );
+ pVD->SetLineColor( Color( COL_BLACK ) );
+ pVD->SetBackground( Wallpaper( Color( COL_WHITE ) ) );
+ pVD->DrawLine( Point(), Point( nPtX, nPtY ) );
+ pVD->DrawLine( Point( 0, nPtY ), Point( nPtX, 0 ) );
- Bitmap aBmp( aVD.GetBitmap( Point(), aColorSize ) );
+ Bitmap aBmp( pVD->GetBitmap( Point(), aColorSize ) );
- aColorSet.InsertItem( (sal_uInt16)1, Image(aBmp), SVX_RESSTR( RID_SVXSTR_INVISIBLE ) );
+ aColorSet->InsertItem( (sal_uInt16)1, Image(aBmp), SVX_RESSTR( RID_SVXSTR_INVISIBLE ) );
- aColorSet.addEntriesForXColorList(*pColorList, 2);
+ aColorSet->addEntriesForXColorList(*pColorList, 2);
}
}
@@ -300,31 +307,31 @@ void SvxColorDockingWindow::SetSize()
nLines++;
// Scrollbar setzen/entfernen
- WinBits nBits = aColorSet.GetStyle();
+ WinBits nBits = aColorSet->GetStyle();
if ( static_cast<long>(nLines) * nCols >= nCount )
nBits &= ~WB_VSCROLL;
else
nBits |= WB_VSCROLL;
- aColorSet.SetStyle( nBits );
+ aColorSet->SetStyle( nBits );
// ScrollBar ?
- long nScrollWidth = aColorSet.GetScrollWidth();
+ long nScrollWidth = aColorSet->GetScrollWidth();
if( nScrollWidth > 0 )
{
// Spalten mit ScrollBar berechnen
nCols = (sal_uInt16) ( ( aSize.Width() - nScrollWidth ) / aItemSize.Width() );
}
- aColorSet.SetColCount( nCols );
+ aColorSet->SetColCount( nCols );
if( IsFloatingMode() )
- aColorSet.SetLineCount( nLines );
+ aColorSet->SetLineCount( nLines );
else
{
- aColorSet.SetLineCount( 0 ); // sonst wird LineHeight ignoriert
- aColorSet.SetItemHeight( aItemSize.Height() );
+ aColorSet->SetLineCount( 0 ); // sonst wird LineHeight ignoriert
+ aColorSet->SetItemHeight( aItemSize.Height() );
}
- aColorSet.SetPosSizePixel( Point( 2, 2 ), aSize );
+ aColorSet->SetPosSizePixel( Point( 2, 2 ), aSize );
}
bool SvxColorDockingWindow::Close()
@@ -339,11 +346,11 @@ bool SvxColorDockingWindow::Close()
IMPL_LINK_NOARG(SvxColorDockingWindow, SelectHdl)
{
SfxDispatcher* pDispatcher = GetBindings().GetDispatcher();
- sal_uInt16 nPos = aColorSet.GetSelectItemId();
- Color aColor( aColorSet.GetItemColor( nPos ) );
- OUString aStr( aColorSet.GetItemText( nPos ) );
+ sal_uInt16 nPos = aColorSet->GetSelectItemId();
+ Color aColor( aColorSet->GetItemColor( nPos ) );
+ OUString aStr( aColorSet->GetItemText( nPos ) );
- if (aColorSet.IsLeftButton())
+ if (aColorSet->IsLeftButton())
{
if ( nLeftSlot == SID_ATTR_FILL_COLOR )
{
@@ -444,15 +451,15 @@ void SvxColorDockingWindow::Resizing( Size& rNewSize )
nLines = 1;
// Scrollbar setzen/entfernen
- WinBits nBits = aColorSet.GetStyle();
+ WinBits nBits = aColorSet->GetStyle();
if ( static_cast<long>(nLines) * nCols >= nCount )
nBits &= ~WB_VSCROLL;
else
nBits |= WB_VSCROLL;
- aColorSet.SetStyle( nBits );
+ aColorSet->SetStyle( nBits );
// ScrollBar ?
- long nScrollWidth = aColorSet.GetScrollWidth();
+ long nScrollWidth = aColorSet->GetScrollWidth();
if( nScrollWidth > 0 )
{
// Spalten mit ScrollBar berechnen
@@ -489,7 +496,7 @@ void SvxColorDockingWindow::GetFocus()
SfxDockingWindow::GetFocus();
// Grab the focus to the color value set so that it can be controlled
// with the keyboard.
- aColorSet.GrabFocus();
+ aColorSet->GrabFocus();
}
bool SvxColorDockingWindow::Notify( NotifyEvent& rNEvt )
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx
index cafd700302df..b9d988ae37b1 100644
--- a/svx/source/tbxctrls/extrusioncontrols.cxx
+++ b/svx/source/tbxctrls/extrusioncontrols.cxx
@@ -104,6 +104,17 @@ ExtrusionDirectionWindow::ExtrusionDirectionWindow(
AddStatusListener( msExtrusionProjection );
}
+ExtrusionDirectionWindow::~ExtrusionDirectionWindow()
+{
+ disposeOnce();
+}
+
+void ExtrusionDirectionWindow::dispose()
+{
+ mpDirectionSet.clear();
+ ToolbarMenu::dispose();
+}
+
void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt )
{
ToolbarMenu::DataChanged( rDCEvt );
@@ -233,9 +244,9 @@ ExtrusionDirectionControl::ExtrusionDirectionControl(
-vcl::Window* ExtrusionDirectionControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> ExtrusionDirectionControl::createPopupWindow( vcl::Window* pParent )
{
- return new ExtrusionDirectionWindow( *this, m_xFrame, pParent );
+ return VclPtr<ExtrusionDirectionWindow>::Create( *this, m_xFrame, pParent );
}
// XInitialization
@@ -298,6 +309,17 @@ ExtrusionDepthDialog::ExtrusionDepthDialog( vcl::Window* pParent, double fDepth,
m_pMtrDepth->SetValue( (int) fDepth * 100, FUNIT_100TH_MM );
}
+ExtrusionDepthDialog::~ExtrusionDepthDialog()
+{
+ disposeOnce();
+}
+
+void ExtrusionDepthDialog::dispose()
+{
+ m_pMtrDepth.clear();
+ ModalDialog::dispose();
+}
+
double ExtrusionDepthDialog::getDepth() const
{
return (double)( m_pMtrDepth->GetValue( FUNIT_100TH_MM ) ) / 100.0;
@@ -468,9 +490,9 @@ ExtrusionDepthController::ExtrusionDepthController(
-vcl::Window* ExtrusionDepthController::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> ExtrusionDepthController::createPopupWindow( vcl::Window* pParent )
{
- return new ExtrusionDepthWindow( *this, m_xFrame, pParent );
+ return VclPtr<ExtrusionDepthWindow>::Create( *this, m_xFrame, pParent );
}
// XInitialization
@@ -578,6 +600,17 @@ ExtrusionLightingWindow::ExtrusionLightingWindow(svt::ToolboxController& rContro
AddStatusListener( msExtrusionLightingIntensity );
}
+ExtrusionLightingWindow::~ExtrusionLightingWindow()
+{
+ disposeOnce();
+}
+
+void ExtrusionLightingWindow::dispose()
+{
+ mpLightingSet.clear();
+ ToolbarMenu::dispose();
+}
+
void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled )
{
mnLevel = nLevel;
@@ -724,9 +757,9 @@ ExtrusionLightingControl::ExtrusionLightingControl(
-vcl::Window* ExtrusionLightingControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> ExtrusionLightingControl::createPopupWindow( vcl::Window* pParent )
{
- return new ExtrusionLightingWindow( *this, m_xFrame, pParent );
+ return VclPtr<ExtrusionLightingWindow>::Create( *this, m_xFrame, pParent );
}
// XInitialization
@@ -870,9 +903,9 @@ ExtrusionSurfaceControl::ExtrusionSurfaceControl(
-vcl::Window* ExtrusionSurfaceControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> ExtrusionSurfaceControl::createPopupWindow( vcl::Window* pParent )
{
- return new ExtrusionSurfaceWindow( *this, m_xFrame, pParent );
+ return VclPtr<ExtrusionSurfaceWindow>::Create( *this, m_xFrame, pParent );
}
// XInitialization
diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx
index 4371153b00ea..d94de5301b87 100644
--- a/svx/source/tbxctrls/extrusioncontrols.hxx
+++ b/svx/source/tbxctrls/extrusioncontrols.hxx
@@ -41,13 +41,15 @@ class ExtrusionDirectionWindow : public svtools::ToolbarMenu
{
public:
ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, vcl::Window* pParentWindow );
+ virtual ~ExtrusionDirectionWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
private:
svt::ToolboxController& mrController;
- ValueSet* mpDirectionSet;
+ VclPtr<ValueSet> mpDirectionSet;
Image maImgDirection[9];
Image maImgPerspective;
@@ -71,7 +73,7 @@ class ExtrusionDirectionControl : public svt::PopupWindowController
public:
ExtrusionDirectionControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -118,7 +120,7 @@ class ExtrusionDepthController : public svt::PopupWindowController
public:
ExtrusionDepthController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -137,7 +139,7 @@ class ExtrusionLightingWindow : public svtools::ToolbarMenu
{
private:
svt::ToolboxController& mrController;
- ValueSet* mpLightingSet;
+ VclPtr<ValueSet> mpLightingSet;
Image maImgLightingOff[9];
Image maImgLightingOn[9];
@@ -161,6 +163,8 @@ private:
DECL_LINK( SelectHdl, void * );
public:
ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, vcl::Window* pParentWindow );
+ virtual ~ExtrusionLightingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
@@ -173,7 +177,7 @@ class ExtrusionLightingControl : public svt::PopupWindowController
public:
ExtrusionLightingControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -217,7 +221,7 @@ class ExtrusionSurfaceControl : public svt::PopupWindowController
public:
ExtrusionSurfaceControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index c889e98f6fbf..4386b780ae4e 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -502,11 +502,11 @@ void SvxFillToolBoxControl::Update(const SfxPoolItem* pState)
}
}
-vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent)
+VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent)
{
if(GetSlotId() == SID_ATTR_FILL_STYLE)
{
- mpFillControl = new FillControl(pParent);
+ mpFillControl.reset(VclPtr<FillControl>::Create(pParent));
// Thus the FillControl is known by SvxFillToolBoxControl
// (and in order to remain compatible)
mpFillControl->SetData(this);
@@ -528,15 +528,15 @@ vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent)
mpStyleItem = new XFillStyleItem(drawing::FillStyle_SOLID);
}
- return mpFillControl;
+ return mpFillControl.get();
}
- return NULL;
+ return VclPtr<vcl::Window>();
}
FillControl::FillControl(vcl::Window* pParent,WinBits nStyle)
: Window(pParent,nStyle | WB_DIALOGCONTROL),
- mpLbFillType(new SvxFillTypeBox(this)),
- mpLbFillAttr(new SvxFillAttrBox(this)),
+ mpLbFillType(VclPtr<SvxFillTypeBox>::Create(this)),
+ mpLbFillAttr(VclPtr<SvxFillAttrBox>::Create(this)),
maLogicalFillSize(40,80),
maLogicalAttrSize(50,80),
mnLastFillTypeControlSelectEntryPos(mpLbFillType->GetSelectEntryPos()),
@@ -562,8 +562,14 @@ FillControl::FillControl(vcl::Window* pParent,WinBits nStyle)
FillControl::~FillControl()
{
- delete mpLbFillType;
- delete mpLbFillAttr;
+ disposeOnce();
+}
+
+void FillControl::dispose()
+{
+ mpLbFillType.disposeAndClear();
+ mpLbFillAttr.disposeAndClear();
+ vcl::Window::dispose();
}
void FillControl::InitializeFillStyleAccordingToGivenFillType(drawing::FillStyle aFillStyle)
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index c4df8a50e66a..2cd3fa3ed24e 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -94,12 +94,17 @@ FontWorkGalleryDialog::FontWorkGalleryDialog( SdrView* pSdrView, vcl::Window* pP
fillFavorites( GALLERY_THEME_FONTWORK );
}
-
FontWorkGalleryDialog::~FontWorkGalleryDialog()
{
+ disposeOnce();
}
-
+void FontWorkGalleryDialog::dispose()
+{
+ mpCtlFavorites.clear();
+ mpOKButton.clear();
+ ModalDialog::dispose();
+}
void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId)
{
@@ -119,7 +124,7 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId)
if (GalleryExplorer::GetSdrObj(nThemeId, nModelPos, pModel, &aThumb) && !!aThumb)
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
const Point aNull(0, 0);
if (GetDPIScaleFactor() > 1)
@@ -127,7 +132,7 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId)
const Size aSize(aThumb.GetSizePixel());
- aVDev.SetOutputSizePixel(aSize);
+ pVDev->SetOutputSizePixel(aSize);
if(rStyleSettings.GetPreviewUsesCheckeredBackground())
{
@@ -135,16 +140,16 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId)
static const Color aW(COL_WHITE);
static const Color aG(0xef, 0xef, 0xef);
- aVDev.DrawCheckered(aNull, aSize, nLen, aW, aG);
+ pVDev->DrawCheckered(aNull, aSize, nLen, aW, aG);
}
else
{
- aVDev.SetBackground(rStyleSettings.GetFieldColor());
- aVDev.Erase();
+ pVDev->SetBackground(rStyleSettings.GetFieldColor());
+ pVDev->Erase();
}
- aVDev.DrawBitmapEx(aNull, aThumb);
- maFavoritesHorizontal.push_back(aVDev.GetBitmap(aNull, aSize));
+ pVDev->DrawBitmapEx(aNull, aThumb);
+ maFavoritesHorizontal.push_back(pVDev->GetBitmap(aNull, aSize));
}
}
@@ -278,7 +283,7 @@ SfxPopupWindowType FontWorkShapeTypeControl::GetPopupWindowType() const
-SfxPopupWindow* FontWorkShapeTypeControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> FontWorkShapeTypeControl::CreatePopupWindow()
{
OUString aSubTbxResName( "private:resource/toolbar/fontworkshapetype" );
createAndPositionSubToolBar( aSubTbxResName );
@@ -391,7 +396,7 @@ class FontworkAlignmentControl : public svt::PopupWindowController
public:
FontworkAlignmentControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -414,9 +419,9 @@ FontworkAlignmentControl::FontworkAlignmentControl( const Reference< XComponentC
-vcl::Window* FontworkAlignmentControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> FontworkAlignmentControl::createPopupWindow( vcl::Window* pParent )
{
- return new FontworkAlignmentWindow( *this, m_xFrame, pParent );
+ return VclPtr<FontworkAlignmentWindow>::Create( *this, m_xFrame, pParent );
}
// XInitialization
@@ -631,7 +636,7 @@ class FontworkCharacterSpacingControl : public svt::PopupWindowController
public:
FontworkCharacterSpacingControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
- virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -652,9 +657,9 @@ FontworkCharacterSpacingControl::FontworkCharacterSpacingControl( const Referenc
-vcl::Window* FontworkCharacterSpacingControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> FontworkCharacterSpacingControl::createPopupWindow( vcl::Window* pParent )
{
- return new FontworkCharacterSpacingWindow( *this, m_xFrame, pParent );
+ return VclPtr<FontworkCharacterSpacingWindow>::Create( *this, m_xFrame, pParent );
}
// XInitialization
@@ -714,6 +719,17 @@ FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( vcl::Window* pPa
m_pMtrScale->SetValue( nScale );
}
+FontworkCharacterSpacingDialog::~FontworkCharacterSpacingDialog()
+{
+ disposeOnce();
+}
+
+void FontworkCharacterSpacingDialog::dispose()
+{
+ m_pMtrScale.clear();
+ ModalDialog::dispose();
+}
+
sal_Int32 FontworkCharacterSpacingDialog::getScale() const
{
return (sal_Int32)m_pMtrScale->GetValue();
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index b6aa20047168..5cc2a78736a2 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -98,9 +98,7 @@ protected:
virtual void Modify() SAL_OVERRIDE;
public:
-
ImplGrafMetricField( vcl::Window* pParent, const OUString& aCmd, const Reference< XFrame >& rFrame );
- virtual ~ImplGrafMetricField();
void Update( const SfxPoolItem* pItem );
};
@@ -143,10 +141,6 @@ ImplGrafMetricField::ImplGrafMetricField( vcl::Window* pParent, const OUString&
maIdle.SetIdleHdl( LINK( this, ImplGrafMetricField, ImplModifyHdl ) );
}
-ImplGrafMetricField::~ImplGrafMetricField()
-{
-}
-
void ImplGrafMetricField::Modify()
{
maIdle.Start();
@@ -243,8 +237,8 @@ class ImplGrafControl : public Control
{
using Window::Update;
private:
- FixedImage maImage;
- ImplGrafMetricField maField;
+ VclPtr<FixedImage> maImage;
+ VclPtr<ImplGrafMetricField> maField;
protected:
@@ -254,9 +248,10 @@ public:
ImplGrafControl( vcl::Window* pParent, const OUString& rCmd, const Reference< XFrame >& rFrame );
virtual ~ImplGrafControl();
+ virtual void dispose() SAL_OVERRIDE;
- void Update( const SfxPoolItem* pItem ) { maField.Update( pItem ); }
- void SetText( const OUString& rStr ) SAL_OVERRIDE { maField.SetText( rStr ); }
+ void Update( const SfxPoolItem* pItem ) { maField->Update( pItem ); }
+ void SetText( const OUString& rStr ) SAL_OVERRIDE { maField->SetText( rStr ); }
};
ImplGrafControl::ImplGrafControl(
@@ -264,20 +259,20 @@ ImplGrafControl::ImplGrafControl(
const OUString& rCmd,
const Reference< XFrame >& rFrame
) : Control( pParent, WB_TABSTOP )
- , maImage( this )
- , maField( this, rCmd, rFrame )
+ , maImage( VclPtr<FixedImage>::Create(this) )
+ , maField( VclPtr<ImplGrafMetricField>::Create(this, rCmd, rFrame) )
{
ResId aResId( ImplGetRID( rCmd ), DIALOG_MGR() ) ;
Image aImage( aResId );
Size aImgSize( aImage.GetSizePixel() );
- Size aFldSize( maField.GetSizePixel() );
+ Size aFldSize( maField->GetSizePixel() );
long nFldY, nImgY;
- maImage.SetImage( aImage );
- maImage.SetSizePixel( aImgSize );
+ maImage->SetImage( aImage );
+ maImage->SetSizePixel( aImgSize );
// we want to see the backbround of the toolbox, not of the FixedImage or Control
- maImage.SetBackground( Wallpaper( COL_TRANSPARENT ) );
+ maImage->SetBackground( Wallpaper( COL_TRANSPARENT ) );
SetBackground( Wallpaper( COL_TRANSPARENT ) );
if( aImgSize.Height() > aFldSize.Height() )
@@ -286,26 +281,34 @@ ImplGrafControl::ImplGrafControl(
nFldY = 0, nImgY = ( aFldSize.Height() - aImgSize.Height() ) >> 1;
long nOffset = SYMBOL_TO_FIELD_OFFSET / 2;
- maImage.SetPosPixel( Point( nOffset, nImgY ) );
- maField.SetPosPixel( Point( aImgSize.Width() + SYMBOL_TO_FIELD_OFFSET, nFldY ) );
+ maImage->SetPosPixel( Point( nOffset, nImgY ) );
+ maField->SetPosPixel( Point( aImgSize.Width() + SYMBOL_TO_FIELD_OFFSET, nFldY ) );
SetSizePixel( Size( aImgSize.Width() + aFldSize.Width() + SYMBOL_TO_FIELD_OFFSET + nOffset,
std::max( aImgSize.Height(), aFldSize.Height() ) ) );
SetBackground( Wallpaper() ); // transparent background
- maImage.Show();
+ maImage->Show();
- maField.SetHelpId( OUStringToOString( rCmd, RTL_TEXTENCODING_UTF8 ) );
- maField.Show();
+ maField->SetHelpId( OUStringToOString( rCmd, RTL_TEXTENCODING_UTF8 ) );
+ maField->Show();
}
ImplGrafControl::~ImplGrafControl()
{
+ disposeOnce();
+}
+
+void ImplGrafControl::dispose()
+{
+ maImage.disposeAndClear();
+ maField.disposeAndClear();
+ Control::dispose();
}
void ImplGrafControl::GetFocus()
{
- maField.GrabFocus();
+ maField->GrabFocus();
}
class ImplGrafModeControl : public ListBox
@@ -321,9 +324,7 @@ private:
static void ImplReleaseFocus();
public:
-
ImplGrafModeControl( vcl::Window* pParent, const Reference< XFrame >& rFrame );
- virtual ~ImplGrafModeControl();
void Update( const SfxPoolItem* pItem );
};
@@ -343,10 +344,6 @@ ImplGrafModeControl::ImplGrafModeControl( vcl::Window* pParent, const Reference<
Show();
}
-ImplGrafModeControl::~ImplGrafModeControl()
-{
-}
-
void ImplGrafModeControl::Select()
{
if ( !IsTravelSelect() )
@@ -449,7 +446,7 @@ SfxPopupWindowType SvxGrafFilterToolBoxControl::GetPopupWindowType() const
return SfxPopupWindowType::ONCLICK;
}
-SfxPopupWindow* SvxGrafFilterToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxGrafFilterToolBoxControl::CreatePopupWindow()
{
OUString aSubTbxResName( "private:resource/toolbar/graffilterbar" );
createAndPositionSubToolBar( aSubTbxResName );
@@ -490,9 +487,9 @@ void SvxGrafToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const
}
}
-vcl::Window* SvxGrafToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxGrafToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- return( new ImplGrafControl( pParent, m_aCommandURL, m_xFrame ) );
+ return VclPtr<ImplGrafControl>::Create( pParent, m_aCommandURL, m_xFrame ).get();
}
SFX_IMPL_TOOLBOX_CONTROL( SvxGrafRedToolBoxControl, SfxInt16Item );
@@ -577,9 +574,9 @@ void SvxGrafModeToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, c
}
}
-vcl::Window* SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- return( new ImplGrafModeControl( pParent, m_xFrame ) );
+ return VclPtr<ImplGrafModeControl>::Create( pParent, m_xFrame ).get();
}
void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
@@ -735,7 +732,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
aCropDlgAttr.Put( SdrGrafCropItem( aLTSize.Width(), aLTSize.Height(),
aRBSize.Width(), aRBSize.Height() ) );
- SfxSingleTabDialog aCropDialog(
+ ScopedVclPtrInstance<SfxSingleTabDialog> aCropDialog(
SfxViewShell::Current() ? SfxViewShell::Current()->GetWindow() : NULL,
aCropDlgAttr);
const OUString aCropStr(SVX_RESSTR(RID_SVXSTR_GRAFCROP));
@@ -744,14 +741,14 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
assert(pFact && "Dialog creation failed!");
::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_GRFCROP );
assert(fnCreatePage && "Dialog creation failed!");
- SfxTabPage* pTabPage = (*fnCreatePage)( aCropDialog.get_content_area(), &aCropDlgAttr );
+ SfxTabPage* pTabPage = (*fnCreatePage)( aCropDialog->get_content_area(), &aCropDlgAttr );
pTabPage->SetText( aCropStr );
- aCropDialog.SetTabPage( pTabPage );
+ aCropDialog->SetTabPage( pTabPage );
- if( aCropDialog.Execute() == RET_OK )
+ if( aCropDialog->Execute() == RET_OK )
{
- const SfxItemSet* pOutAttr = aCropDialog.GetOutputItemSet();
+ const SfxItemSet* pOutAttr = aCropDialog->GetOutputItemSet();
if( pOutAttr )
{
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 449cb7f951dc..09008172a790 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -69,12 +69,6 @@ SvxLineBox::SvxLineBox( vcl::Window* pParent, const Reference< XFrame >& rFrame,
-SvxLineBox::~SvxLineBox()
-{
-}
-
-
-
IMPL_LINK_NOARG(SvxLineBox, DelayHdl_Impl)
{
if ( GetEntryCount() == 0 )
@@ -278,12 +272,6 @@ SvxMetricField::SvxMetricField(
-SvxMetricField::~SvxMetricField()
-{
-}
-
-
-
void SvxMetricField::Update( const XLineWidthItem* pItem )
{
if ( pItem )
@@ -432,12 +420,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFillTypeBox(vcl::Wi
-SvxFillTypeBox::~SvxFillTypeBox()
-{
-}
-
-
-
bool SvxFillTypeBox::PreNotify( NotifyEvent& rNEvt )
{
MouseNotifyEvent nType = rNEvt.GetType();
@@ -519,12 +501,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFillAttrBox(vcl::Wi
-SvxFillAttrBox::~SvxFillAttrBox()
-{
-}
-
-
-
bool SvxFillAttrBox::PreNotify( NotifyEvent& rNEvt )
{
MouseNotifyEvent nType = rNEvt.GetType();
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index c9c98d285986..a5ec5ebd8159 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -45,7 +45,7 @@ SFX_IMPL_TOOLBOX_CONTROL(SvxColumnsToolBoxControl,SfxUInt16Item);
class TableWindow : public SfxPopupWindow
{
private:
- PushButton aTableButton;
+ VclPtr<PushButton> aTableButton;
::Color aLineColor;
::Color aFillColor;
::Color aHighlightFillColor;
@@ -79,13 +79,14 @@ public:
ToolBox& rParentTbx,
const Reference< XFrame >& rFrame );
virtual ~TableWindow();
+ virtual void dispose() SAL_OVERRIDE;
void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle& ) SAL_OVERRIDE;
virtual void PopupModeEnd() SAL_OVERRIDE;
- virtual SfxPopupWindow* Clone() const SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
private:
void Update( long nNewCol, long nNewLine );
@@ -109,7 +110,7 @@ IMPL_LINK_NOARG(TableWindow, SelectHdl)
TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUString& rText,
ToolBox& rParentTbx, const Reference< XFrame >& rFrame )
: SfxPopupWindow( nSlotId, rFrame, WinBits( WB_STDPOPUP ) )
- , aTableButton( this )
+ , aTableButton( VclPtr<PushButton>::Create(this) )
, nCol( 0 )
, nLine( 0 )
, bInitialKeyInput(false)
@@ -143,11 +144,11 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUStri
SetText( rText );
- aTableButton.SetPosSizePixel( Point( mnTablePosX, mnTableHeight + 5 ),
+ aTableButton->SetPosSizePixel( Point( mnTablePosX, mnTableHeight + 5 ),
Size( mnTableWidth - mnTablePosX, 24 ) );
- aTableButton.SetText( SVX_RESSTR( RID_SVXSTR_MORE ) );
- aTableButton.SetClickHdl( LINK( this, TableWindow, SelectHdl ) );
- aTableButton.Show();
+ aTableButton->SetText( SVX_RESSTR( RID_SVXSTR_MORE ) );
+ aTableButton->SetClickHdl( LINK( this, TableWindow, SelectHdl ) );
+ aTableButton->Show();
SetOutputSizePixel( Size( mnTableWidth + 3, mnTableHeight + 33 ) );
}
@@ -156,13 +157,18 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUStri
TableWindow::~TableWindow()
{
+ disposeOnce();
}
+void TableWindow::dispose()
+{
+ aTableButton.disposeAndClear();
+ SfxPopupWindow::dispose();
+}
-
-SfxPopupWindow* TableWindow::Clone() const
+VclPtr<SfxPopupWindow> TableWindow::Clone() const
{
- return new TableWindow( GetId(), maCommand, GetText(), rTbx, mxFrame );
+ return VclPtr<TableWindow>::Create( GetId(), maCommand, GetText(), rTbx, mxFrame );
}
@@ -424,7 +430,7 @@ public:
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle& ) SAL_OVERRIDE;
virtual void PopupModeEnd() SAL_OVERRIDE;
- virtual SfxPopupWindow* Clone() const SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
};
@@ -466,9 +472,9 @@ ColumnsWindow::ColumnsWindow( sal_uInt16 nId, const OUString& rCmd, const OUStri
-SfxPopupWindow* ColumnsWindow::Clone() const
+VclPtr<SfxPopupWindow> ColumnsWindow::Clone() const
{
- return new ColumnsWindow( GetId(), maCommand, GetText(), rTbx, mxFrame );
+ return VclPtr<ColumnsWindow>::Create( GetId(), maCommand, GetText(), rTbx, mxFrame );
}
@@ -722,12 +728,12 @@ SfxPopupWindowType SvxTableToolBoxControl::GetPopupWindowType() const
-SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxTableToolBoxControl::CreatePopupWindow()
{
if ( bEnabled )
{
ToolBox& rTbx = GetToolBox();
- TableWindow* pWin = new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), rTbx, m_xFrame );
+ VclPtr<TableWindow> pWin = VclPtr<TableWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), rTbx, m_xFrame );
pWin->StartPopupMode( &rTbx, FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE );
SetPopupWindow( pWin );
return pWin;
@@ -740,7 +746,7 @@ SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow()
SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindowCascading()
{
if ( bEnabled )
- return new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
+ return VclPtr<TableWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
return 0;
}
@@ -787,12 +793,12 @@ SfxPopupWindowType SvxColumnsToolBoxControl::GetPopupWindowType() const
-SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxColumnsToolBoxControl::CreatePopupWindow()
{
ColumnsWindow* pWin = 0;
if(bEnabled)
{
- pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
+ pWin = VclPtr<ColumnsWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
pWin->StartPopupMode( &GetToolBox(),
FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE );
SetPopupWindow( pWin );
@@ -807,7 +813,7 @@ SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindowCascading()
ColumnsWindow* pWin = 0;
if(bEnabled)
{
- pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
+ pWin = VclPtr<ColumnsWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
}
return pWin;
}
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index f65d68ff4daf..a517946bff0e 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -54,17 +54,19 @@ class SvxPopupWindowListBox: public SfxPopupWindow
{
using FloatingWindow::StateChanged;
- ListBox * m_pListBox;
+ VclPtr<ListBox> m_pListBox;
ToolBox & rToolBox;
bool bUserSel;
- sal_uInt16 nTbxId;
- OUString maCommandURL;
+ sal_uInt16 nTbxId;
+ OUString maCommandURL;
public:
SvxPopupWindowListBox( sal_uInt16 nSlotId, const OUString& rCommandURL, sal_uInt16 nTbxId, ToolBox& rTbx );
+ virtual ~SvxPopupWindowListBox();
+ virtual void dispose() SAL_OVERRIDE;
// SfxPopupWindow
- virtual SfxPopupWindow * Clone() const SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
virtual void PopupModeEnd() SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -96,9 +98,20 @@ SvxPopupWindowListBox::SvxPopupWindowListBox(sal_uInt16 nSlotId, const OUString&
AddStatusListener( rCommandURL );
}
-SfxPopupWindow* SvxPopupWindowListBox::Clone() const
+SvxPopupWindowListBox::~SvxPopupWindowListBox()
{
- return new SvxPopupWindowListBox( GetId(), maCommandURL, nTbxId, rToolBox );
+ disposeOnce();
+}
+
+void SvxPopupWindowListBox::dispose()
+{
+ m_pListBox.clear();
+ SfxPopupWindow::dispose();
+}
+
+VclPtr<SfxPopupWindow> SvxPopupWindowListBox::Clone() const
+{
+ return VclPtr<SvxPopupWindowListBox>::Create( GetId(), maCommandURL, nTbxId, rToolBox );
}
void SvxPopupWindowListBox::PopupModeEnd()
@@ -140,11 +153,9 @@ SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBo
SvxListBoxControl::~SvxListBoxControl()
-{
-}
-
+{}
-SfxPopupWindow* SvxListBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxListBoxControl::CreatePopupWindow()
{
OSL_FAIL( "not implemented" );
return 0;
@@ -270,7 +281,7 @@ void SvxUndoRedoControl::StateChanged(
}
}
-SfxPopupWindow* SvxUndoRedoControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxUndoRedoControl::CreatePopupWindow()
{
DBG_ASSERT(( SID_UNDO == GetSlotId() || SID_REDO == GetSlotId() ), "mismatching ids" );
@@ -281,7 +292,7 @@ SfxPopupWindow* SvxUndoRedoControl::CreatePopupWindow()
ToolBox& rBox = GetToolBox();
- pPopupWin = new SvxPopupWindowListBox( GetSlotId(), m_aCommandURL, GetId(), rBox );
+ pPopupWin = VclPtr<SvxPopupWindowListBox>::Create( GetSlotId(), m_aCommandURL, GetId(), rBox );
pPopupWin->SetPopupModeEndHdl( LINK( this, SvxUndoRedoControl,
PopupModeEndHdl ) );
ListBox &rListBox = pPopupWin->GetListBox();
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 836fad360479..5f303bc76b98 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -183,9 +183,9 @@ void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState )
-vcl::Window* SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- return new SvxLineBox( pParent, m_xFrame );
+ return VclPtr<SvxLineBox>::Create( pParent, m_xFrame ).get();
}
SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl(
@@ -244,9 +244,9 @@ void SvxLineWidthToolBoxControl::StateChanged(
-vcl::Window* SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- return( new SvxMetricField( pParent, m_xFrame ) );
+ return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get();
}
SvxLineEndWindow::SvxLineEndWindow(
@@ -256,7 +256,7 @@ SvxLineEndWindow::SvxLineEndWindow(
SfxPopupWindow( nSlotId,
rFrame,
WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
- aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
+ aLineEndSet ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ),
nCols ( 2 ),
nLines ( 12 ),
nLineEndWidth ( 400 ),
@@ -277,7 +277,7 @@ SvxLineEndWindow::SvxLineEndWindow(
rFrame,
pParentWindow,
WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
- aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
+ aLineEndSet ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) )),
nCols ( 2 ),
nLines ( 12 ),
nLineEndWidth ( 400 ),
@@ -294,7 +294,7 @@ void SvxLineEndWindow::implInit()
SfxObjectShell* pDocSh = SfxObjectShell::Current();
SetHelpId( HID_POPUP_LINEEND );
- aLineEndSet.SetHelpId( HID_POPUP_LINEEND_CTRL );
+ aLineEndSet->SetHelpId( HID_POPUP_LINEEND_CTRL );
if ( pDocSh )
{
@@ -308,8 +308,8 @@ void SvxLineEndWindow::implInit()
}
DBG_ASSERT( pLineEndList.is(), "LineEndList not found" );
- aLineEndSet.SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
- aLineEndSet.SetColCount( nCols );
+ aLineEndSet->SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
+ aLineEndSet->SetColCount( nCols );
// ValueSet fill with entries of LineEndList
FillValueSet();
@@ -317,27 +317,32 @@ void SvxLineEndWindow::implInit()
AddStatusListener( OUString( ".uno:LineEndListState" ));
//ChangeHelpId( HID_POPUP_LINEENDSTYLE );
- aLineEndSet.Show();
+ aLineEndSet->Show();
}
-SfxPopupWindow* SvxLineEndWindow::Clone() const
+VclPtr<SfxPopupWindow> SvxLineEndWindow::Clone() const
{
- return new SvxLineEndWindow( GetId(), mxFrame, GetText() );
+ return VclPtr<SvxLineEndWindow>::Create( GetId(), mxFrame, GetText() );
}
SvxLineEndWindow::~SvxLineEndWindow()
{
+ disposeOnce();
}
-
+void SvxLineEndWindow::dispose()
+{
+ aLineEndSet.disposeAndClear();
+ SfxPopupWindow::dispose();
+}
IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl)
{
boost::scoped_ptr<XLineEndItem> pLineEndItem;
boost::scoped_ptr<XLineStartItem> pLineStartItem;
- sal_uInt16 nId = aLineEndSet.GetSelectItemId();
+ sal_uInt16 nId = aLineEndSet->GetSelectItemId();
if( nId == 1 )
{
@@ -380,7 +385,7 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl)
/* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
This instance may be deleted in the meantime (i.e. when a dialog is opened
while in Dispatch()), accessing members will crash in this case. */
- aLineEndSet.SetNoSelection();
+ aLineEndSet->SetNoSelection();
SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
OUString( ".uno:LineEndStyle" ),
@@ -396,7 +401,7 @@ void SvxLineEndWindow::FillValueSet()
if( pLineEndList.is() )
{
XLineEndEntry* pEntry = NULL;
- VirtualDevice aVD;
+ ScopedVclPtrInstance< VirtualDevice > pVD;
long nCount = pLineEndList->Count();
@@ -409,14 +414,14 @@ void SvxLineEndWindow::FillValueSet()
OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
aBmpSize = aBmp.GetSizePixel();
- aVD.SetOutputSizePixel( aBmpSize, false );
+ pVD->SetOutputSizePixel( aBmpSize, false );
aBmpSize.Width() = aBmpSize.Width() / 2;
Point aPt0( 0, 0 );
Point aPt1( aBmpSize.Width(), 0 );
- aVD.DrawBitmap( Point(), aBmp );
- aLineEndSet.InsertItem(1, Image(aVD.GetBitmap(aPt0, aBmpSize)), pEntry->GetName());
- aLineEndSet.InsertItem(2, Image(aVD.GetBitmap(aPt1, aBmpSize)), pEntry->GetName());
+ pVD->DrawBitmap( Point(), aBmp );
+ aLineEndSet->InsertItem(1, Image(pVD->GetBitmap(aPt0, aBmpSize)), pEntry->GetName());
+ aLineEndSet->InsertItem(2, Image(pVD->GetBitmap(aPt1, aBmpSize)), pEntry->GetName());
delete pLineEndList->Remove( nCount );
@@ -427,14 +432,14 @@ void SvxLineEndWindow::FillValueSet()
aBmp = pLineEndList->GetUiBitmap( i );
OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
- aVD.DrawBitmap( aPt0, aBmp );
- aLineEndSet.InsertItem((sal_uInt16)((i+1L)*2L+1L),
- Image(aVD.GetBitmap(aPt0, aBmpSize)), pEntry->GetName());
- aLineEndSet.InsertItem((sal_uInt16)((i+2L)*2L),
- Image(aVD.GetBitmap(aPt1, aBmpSize)), pEntry->GetName());
+ pVD->DrawBitmap( aPt0, aBmp );
+ aLineEndSet->InsertItem((sal_uInt16)((i+1L)*2L+1L),
+ Image(pVD->GetBitmap(aPt0, aBmpSize)), pEntry->GetName());
+ aLineEndSet->InsertItem((sal_uInt16)((i+2L)*2L),
+ Image(pVD->GetBitmap(aPt1, aBmpSize)), pEntry->GetName());
}
nLines = std::min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES );
- aLineEndSet.SetLineCount( nLines );
+ aLineEndSet->SetLineCount( nLines );
SetSize();
}
@@ -451,15 +456,15 @@ void SvxLineEndWindow::Resize()
mbInResize = true;
if ( !IsRollUp() )
{
- aLineEndSet.SetColCount( nCols );
- aLineEndSet.SetLineCount( nLines );
+ aLineEndSet->SetColCount( nCols );
+ aLineEndSet->SetLineCount( nLines );
SetSize();
Size aSize = GetOutputSizePixel();
aSize.Width() -= 4;
aSize.Height() -= 4;
- aLineEndSet.SetPosSizePixel( Point( 2, 2 ), aSize );
+ aLineEndSet->SetPosSizePixel( Point( 2, 2 ), aSize );
}
//SfxPopupWindow::Resize();
mbInResize = false;
@@ -474,10 +479,10 @@ void SvxLineEndWindow::Resizing( Size& rNewSize )
aBitmapSize.Width() += 6;
aBitmapSize.Height() += 6;
- Size aItemSize = aLineEndSet.CalcItemSizePixel( aBitmapSize ); // -> Member
+ Size aItemSize = aLineEndSet->CalcItemSizePixel( aBitmapSize ); // -> Member
//Size aOldSize = GetOutputSizePixel(); // for width
- sal_uInt16 nItemCount = aLineEndSet.GetItemCount(); // -> Member
+ sal_uInt16 nItemCount = aLineEndSet->GetItemCount(); // -> Member
// identify columns
long nItemW = aItemSize.Width();
@@ -517,7 +522,7 @@ void SvxLineEndWindow::Resizing( Size& rNewSize )
void SvxLineEndWindow::StartSelection()
{
- aLineEndSet.StartSelection();
+ aLineEndSet->StartSelection();
}
@@ -540,7 +545,7 @@ void SvxLineEndWindow::StateChanged(
pLineEndList = static_cast<const SvxLineEndListItem*>(pState)->GetLineEndList();
DBG_ASSERT( pLineEndList.is(), "LineEndList not found" );
- aLineEndSet.Clear();
+ aLineEndSet->Clear();
FillValueSet();
Size aSize = GetOutputSizePixel();
@@ -569,23 +574,23 @@ void SvxLineEndWindow::SetSize()
//if( !bPopupMode )
if( !IsInPopupMode() )
{
- sal_uInt16 nItemCount = aLineEndSet.GetItemCount(); // -> Member
+ sal_uInt16 nItemCount = aLineEndSet->GetItemCount(); // -> Member
sal_uInt16 nMaxLines = nItemCount / nCols; // -> Member ?
if( nItemCount % nCols )
nMaxLines++;
- WinBits nBits = aLineEndSet.GetStyle();
+ WinBits nBits = aLineEndSet->GetStyle();
if ( nLines == nMaxLines )
nBits &= ~WB_VSCROLL;
else
nBits |= WB_VSCROLL;
- aLineEndSet.SetStyle( nBits );
+ aLineEndSet->SetStyle( nBits );
}
Size aSize( aBmpSize );
aSize.Width() += 6;
aSize.Height() += 6;
- aSize = aLineEndSet.CalcWindowSizePixel( aSize );
+ aSize = aLineEndSet->CalcWindowSizePixel( aSize );
aSize.Width() += 4;
aSize.Height() += 4;
SetOutputSizePixel( aSize );
@@ -599,7 +604,7 @@ void SvxLineEndWindow::GetFocus()
SfxPopupWindow::GetFocus();
// Grab the focus to the line ends value set so that it can be controlled
// with the keyboard.
- aLineEndSet.GrabFocus();
+ aLineEndSet->GrabFocus();
}
SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) :
@@ -624,10 +629,10 @@ SfxPopupWindowType SvxLineEndToolBoxControl::GetPopupWindowType() const
-SfxPopupWindow* SvxLineEndToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxLineEndToolBoxControl::CreatePopupWindow()
{
SvxLineEndWindow* pLineEndWin =
- new SvxLineEndWindow( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) );
+ VclPtr<SvxLineEndWindow>::Create( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) );
pLineEndWin->StartPopupMode( &GetToolBox(),
FLOATWIN_POPUPMODE_GRABFOCUS |
FLOATWIN_POPUPMODE_ALLOWTEAROFF |
diff --git a/svx/source/tbxctrls/subtoolboxcontrol.cxx b/svx/source/tbxctrls/subtoolboxcontrol.cxx
index c04c79b0de14..606debaaa292 100644
--- a/svx/source/tbxctrls/subtoolboxcontrol.cxx
+++ b/svx/source/tbxctrls/subtoolboxcontrol.cxx
@@ -37,7 +37,7 @@ SvxSubToolBoxControl::~SvxSubToolBoxControl()
{
}
-SfxPopupWindow* SvxSubToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxSubToolBoxControl::CreatePopupWindow()
{
const sal_Char* pResource = 0;
switch( GetSlotId() )
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 35ef96793827..94dd822d5b1c 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -120,6 +120,7 @@ public:
SvxStyleBox_Impl( vcl::Window* pParent, const OUString& rCommand, SfxStyleFamily eFamily, const Reference< XDispatchProvider >& rDispatchProvider,
const Reference< XFrame >& _xFrame,const OUString& rClearFormatKey, const OUString& rMoreKey, bool bInSpecialMode );
virtual ~SvxStyleBox_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void SetFamily( SfxStyleFamily eNewFamily );
bool IsVisible() const { return bVisible; }
@@ -154,7 +155,7 @@ private:
OUString aMoreKey;
OUString sDefaultStyle;
bool bInSpecialMode;
- MenuButton* m_pButtons[MAX_STYLES_ENTRIES];
+ VclPtr<MenuButton> m_pButtons[MAX_STYLES_ENTRIES];
PopupMenu m_aMenu;
void ReleaseFocus();
@@ -203,6 +204,7 @@ public:
, WinBits nStyle = WB_SORT
);
virtual ~SvxFontNameBox_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void FillList();
void Update( const SvxFontItem* pFontItem );
@@ -241,9 +243,9 @@ class SvxFrameWindow_Impl : public SfxPopupWindow
using FloatingWindow::StateChanged;
private:
- SvxFrmValueSet_Impl aFrameSet;
- ImageList aImgList;
- bool bParagraphMode;
+ VclPtr<SvxFrmValueSet_Impl> aFrameSet;
+ ImageList aImgList;
+ bool bParagraphMode;
DECL_LINK( SelectHdl, void * );
@@ -256,18 +258,20 @@ protected:
public:
SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow );
virtual ~SvxFrameWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
+
void StartSelection();
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
- virtual SfxPopupWindow* Clone() const SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
};
class SvxLineWindow_Impl : public SfxPopupWindow
{
private:
- LineListBox m_aLineStyleLb;
+ VclPtr<LineListBox> m_aLineStyleLb;
bool m_bIsWriter;
DECL_LINK( SelectHdl, void * );
@@ -280,8 +284,9 @@ protected:
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
public:
SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow );
-
- virtual SfxPopupWindow* Clone() const SAL_OVERRIDE;
+ virtual ~SvxLineWindow_Impl() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_aLineStyleLb.disposeAndClear(); SfxPopupWindow::dispose(); }
+ virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
};
class SvxStyleToolBoxControl;
@@ -336,8 +341,16 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent,
SvxStyleBox_Impl::~SvxStyleBox_Impl()
{
+ disposeOnce();
+}
+
+void SvxStyleBox_Impl::dispose()
+{
for(int i = 0; i < MAX_STYLES_ENTRIES; i++)
- delete m_pButtons[i];
+ {
+ m_pButtons[i].disposeAndClear();
+ }
+ ComboBox::dispose();
}
void SvxStyleBox_Impl::ReleaseFocus()
@@ -731,9 +744,9 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp
unsigned int nId = (rRect.getY() / rRect.GetSize().Height());
if(nId < MAX_STYLES_ENTRIES)
{
- if(m_pButtons[nId] == NULL)
+ if(m_pButtons[nId] == nullptr)
{
- m_pButtons[nId] = new MenuButton(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS);
+ m_pButtons[nId] = VclPtr<MenuButton>::Create(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS);
m_pButtons[nId]->SetSizePixel(Size(BUTTON_WIDTH, rRect.GetSize().Height()));
m_pButtons[nId]->SetPopupMenu(&m_aMenu);
}
@@ -918,7 +931,13 @@ SvxFontNameBox_Impl::SvxFontNameBox_Impl( vcl::Window* pParent, const Reference<
SvxFontNameBox_Impl::~SvxFontNameBox_Impl()
{
+ disposeOnce();
+}
+
+void SvxFontNameBox_Impl::dispose()
+{
GetSubEdit()->RemoveEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont ));
+ FontNameBox::dispose();
}
void SvxFontNameBox_Impl::FillList()
@@ -1287,6 +1306,18 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
SvxColorWindow_Impl::~SvxColorWindow_Impl()
{
+ disposeOnce();
+}
+
+void SvxColorWindow_Impl::dispose()
+{
+ mpColorSet.clear();
+ mpRecentColorSet.clear();
+ mpPaletteListBox.clear();
+ mpButtonAutoColor.clear();
+ mpButtonPicker.clear();
+ mpAutomaticSeparator.clear();
+ SfxPopupWindow::dispose();
}
void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt )
@@ -1294,9 +1325,9 @@ void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt )
mpColorSet->KeyInput(rKEvt);
}
-SfxPopupWindow* SvxColorWindow_Impl::Clone() const
+VclPtr<SfxPopupWindow> SvxColorWindow_Impl::Clone() const
{
- return new SvxColorWindow_Impl( maCommand, mrPaletteManager, mrBorderColorStatus, theSlotId, GetFrame(), GetText(), GetParent() );
+ return VclPtr<SvxColorWindow_Impl>::Create( maCommand, mrPaletteManager, mrBorderColorStatus, theSlotId, GetFrame(), GetText(), GetParent() );
}
IMPL_LINK(SvxColorWindow_Impl, SelectHdl, SvxColorValueSet*, pColorSet)
@@ -1506,7 +1537,7 @@ Color BorderColorStatus::GetColor()
SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) :
SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
- aFrameSet ( this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
+ aFrameSet ( VclPtr<SvxFrmValueSet_Impl>::Create(this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ),
bParagraphMode(false)
{
BindListener();
@@ -1536,43 +1567,50 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFram
sal_uInt16 i = 0;
for ( i=1; i<9; i++ )
- aFrameSet.InsertItem( i, aImgList.GetImage(i) );
+ aFrameSet->InsertItem( i, aImgList.GetImage(i) );
//bParagraphMode should have been set in StateChanged
if ( !bParagraphMode )
for ( i = 9; i < 13; i++ )
- aFrameSet.InsertItem( i, aImgList.GetImage(i) );
+ aFrameSet->InsertItem( i, aImgList.GetImage(i) );
- aFrameSet.SetColCount( 4 );
- aFrameSet.SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) );
+ aFrameSet->SetColCount( 4 );
+ aFrameSet->SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) );
- lcl_CalcSizeValueSet( *this, aFrameSet, Size( 20 * pParentWindow->GetDPIScaleFactor(), 20 * pParentWindow->GetDPIScaleFactor() ));
+ lcl_CalcSizeValueSet( *this, *aFrameSet.get(), Size( 20 * pParentWindow->GetDPIScaleFactor(), 20 * pParentWindow->GetDPIScaleFactor() ));
SetHelpId( HID_POPUP_FRAME );
SetText( SVX_RESSTR(RID_SVXSTR_FRAME) );
- aFrameSet.SetAccessibleName( SVX_RESSTR(RID_SVXSTR_FRAME) );
- aFrameSet.Show();
+ aFrameSet->SetAccessibleName( SVX_RESSTR(RID_SVXSTR_FRAME) );
+ aFrameSet->Show();
}
SvxFrameWindow_Impl::~SvxFrameWindow_Impl()
{
+ disposeOnce();
+}
+
+void SvxFrameWindow_Impl::dispose()
+{
UnbindListener();
+ aFrameSet.disposeAndClear();
+ SfxPopupWindow::dispose();
}
-SfxPopupWindow* SvxFrameWindow_Impl::Clone() const
+VclPtr<SfxPopupWindow> SvxFrameWindow_Impl::Clone() const
{
//! HACK: How do I get the Paragraph mode?
- return new SvxFrameWindow_Impl( GetId(), GetFrame(), GetParent() );
+ return VclPtr<SvxFrameWindow_Impl>::Create( GetId(), GetFrame(), GetParent() );
}
vcl::Window* SvxFrameWindow_Impl::GetPreferredKeyInputWindow()
{
- return &aFrameSet;
+ return aFrameSet.get();
}
void SvxFrameWindow_Impl::GetFocus()
{
- aFrameSet.GrabFocus();
+ aFrameSet->GrabFocus();
}
void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
@@ -1583,10 +1621,10 @@ void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
{
aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) );
- sal_uInt16 nNumOfItems = aFrameSet.GetItemCount();
+ sal_uInt16 nNumOfItems = aFrameSet->GetItemCount();
for( sal_uInt16 i = 1 ; i <= nNumOfItems ; ++i )
- aFrameSet.SetItemImage( i, aImgList.GetImage( i ) );
+ aFrameSet->SetItemImage( i, aImgList.GetImage( i ) );
}
}
@@ -1611,8 +1649,8 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
*pRight = 0,
*pTop = 0,
*pBottom = 0;
- sal_uInt16 nSel = aFrameSet.GetSelectItemId();
- sal_uInt16 nModifier = aFrameSet.GetModifier();
+ sal_uInt16 nSel = aFrameSet->GetSelectItemId();
+ sal_uInt16 nModifier = aFrameSet->GetModifier();
sal_uInt8 nValidFlags = 0;
theDefLine.GuessLinesWidths(theDefLine.GetBorderLineStyle(),
@@ -1706,7 +1744,7 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
/* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
This instance may be deleted in the meantime (i.e. when a dialog is opened
while in Dispatch()), accessing members will crash in this case. */
- aFrameSet.SetNoSelection();
+ aFrameSet->SetNoSelection();
SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
OUString( ".uno:SetBorderStyle" ),
@@ -1717,7 +1755,7 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
void SvxFrameWindow_Impl::Resize()
{
const Size aSize(this->GetOutputSizePixel());
- aFrameSet.SetPosSizePixel(Point(2,2), Size(aSize.Width() - 4, aSize.Height() - 4));
+ aFrameSet->SetPosSizePixel(Point(2,2), Size(aSize.Width() - 4, aSize.Height() - 4));
}
void SvxFrameWindow_Impl::StateChanged(
@@ -1731,27 +1769,27 @@ void SvxFrameWindow_Impl::StateChanged(
{
bParagraphMode = pItem->GetValue();
//initial calls mustn't insert or remove elements
- if(aFrameSet.GetItemCount())
+ if(aFrameSet->GetItemCount())
{
- bool bTableMode = ( aFrameSet.GetItemCount() == 12 );
+ bool bTableMode = ( aFrameSet->GetItemCount() == 12 );
bool bResize = false;
if ( bTableMode && bParagraphMode )
{
for ( sal_uInt16 i = 9; i < 13; i++ )
- aFrameSet.RemoveItem(i);
+ aFrameSet->RemoveItem(i);
bResize = true;
}
else if ( !bTableMode && !bParagraphMode )
{
for ( sal_uInt16 i = 9; i < 13; i++ )
- aFrameSet.InsertItem( i, aImgList.GetImage(i) );
+ aFrameSet->InsertItem( i, aImgList.GetImage(i) );
bResize = true;
}
if ( bResize )
{
- lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 ));
+ lcl_CalcSizeValueSet( *this, *aFrameSet.get(), Size( 20, 20 ));
}
}
}
@@ -1761,7 +1799,7 @@ void SvxFrameWindow_Impl::StateChanged(
void SvxFrameWindow_Impl::StartSelection()
{
- aFrameSet.StartSelection();
+ aFrameSet->StartSelection();
}
bool SvxFrameWindow_Impl::Close()
@@ -1777,7 +1815,7 @@ static Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) :
SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION | WB_AUTOSIZE ) ),
- m_aLineStyleLb( this )
+ m_aLineStyleLb( VclPtr<LineListBox>::Create(this) )
{
try
{
@@ -1788,59 +1826,59 @@ SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame
{
}
- m_aLineStyleLb.setPosSizePixel( 2, 2, 110, 140 );
+ m_aLineStyleLb->setPosSizePixel( 2, 2, 110, 140 );
SetOutputSizePixel( Size( 114, 144 ) );
- m_aLineStyleLb.SetSourceUnit( FUNIT_TWIP );
- m_aLineStyleLb.SetNone( SVX_RESSTR(RID_SVXSTR_NONE) );
+ m_aLineStyleLb->SetSourceUnit( FUNIT_TWIP );
+ m_aLineStyleLb->SetNone( SVX_RESSTR(RID_SVXSTR_NONE) );
using namespace table::BorderLineStyle;
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED );
// Double lines
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP );
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP );
// Engraved / Embossed
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15,
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15,
&SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor,
&lcl_mediumColor );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15,
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15,
&SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor,
&lcl_mediumColor );
// Inset / Outset
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10,
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10,
&SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
- m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10,
+ m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10,
&SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
- m_aLineStyleLb.SetWidth( 20 ); // 1pt by default
+ m_aLineStyleLb->SetWidth( 20 ); // 1pt by default
- m_aLineStyleLb.SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) );
+ m_aLineStyleLb->SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) );
SetHelpId( HID_POPUP_LINE );
SetText( SVX_RESSTR(RID_SVXSTR_FRAME_STYLE) );
- m_aLineStyleLb.Show();
+ m_aLineStyleLb->Show();
}
-SfxPopupWindow* SvxLineWindow_Impl::Clone() const
+VclPtr<SfxPopupWindow> SvxLineWindow_Impl::Clone() const
{
- return new SvxLineWindow_Impl( GetId(), GetFrame(), GetParent() );
+ return VclPtr<SvxLineWindow_Impl>::Create( GetId(), GetFrame(), GetParent() );
}
IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl)
{
SvxLineItem aLineItem( SID_FRAME_LINESTYLE );
- SvxBorderStyle nStyle = SvxBorderStyle( m_aLineStyleLb.GetSelectEntryStyle() );
+ SvxBorderStyle nStyle = SvxBorderStyle( m_aLineStyleLb->GetSelectEntryStyle() );
- if ( m_aLineStyleLb.GetSelectEntryPos( ) > 0 )
+ if ( m_aLineStyleLb->GetSelectEntryPos( ) > 0 )
{
SvxBorderLine aTmp;
aTmp.SetBorderLineStyle( nStyle );
@@ -1867,7 +1905,7 @@ IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl)
void SvxLineWindow_Impl::Resize()
{
- m_aLineStyleLb.Resize();
+ m_aLineStyleLb->Resize();
}
bool SvxLineWindow_Impl::Close()
@@ -1877,12 +1915,12 @@ bool SvxLineWindow_Impl::Close()
vcl::Window* SvxLineWindow_Impl::GetPreferredKeyInputWindow()
{
- return &m_aLineStyleLb;
+ return m_aLineStyleLb.get();
}
void SvxLineWindow_Impl::GetFocus()
{
- m_aLineStyleLb.GrabFocus();
+ m_aLineStyleLb->GrabFocus();
}
void SvxLineWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
@@ -2342,21 +2380,19 @@ void SvxStyleToolBoxControl::SetFamilyState( sal_uInt16 nIdx,
IMPL_LINK_NOARG(SvxStyleToolBoxControl, VisibilityNotification)
{
-
- sal_uInt16 i;
-
// Call ReBind() && UnBind() according to visibility
SvxStyleBox_Impl* pBox = static_cast<SvxStyleBox_Impl*>( GetToolBox().GetItemWindow( GetId() ));
- if ( pBox->IsVisible() && !isBound() )
+
+ if ( pBox && pBox->IsVisible() && !isBound() )
{
- for ( i=0; i<MAX_FAMILIES; i++ )
+ for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
pBoundItems [i]->ReBind();
bindListener();
}
- else if ( !pBox->IsVisible() && isBound() )
+ else if ( (!pBox || !pBox->IsVisible()) && isBound() )
{
- for ( i=0; i<MAX_FAMILIES; i++ )
+ for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
pBoundItems[i]->UnBind();
unbindListener();
}
@@ -2403,22 +2439,22 @@ void SvxStyleToolBoxControl::StateChanged(
Update();
}
-vcl::Window* SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- SvxStyleBox_Impl* pBox = new SvxStyleBox_Impl( pParent,
- OUString( ".uno:StyleApply" ),
- SFX_STYLE_FAMILY_PARA,
- Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
- m_xFrame,
- pImpl->aClearForm,
- pImpl->aMore,
- pImpl->bSpecModeWriter || pImpl->bSpecModeCalc );
+ VclPtrInstance<SvxStyleBox_Impl> pBox( pParent,
+ OUString( ".uno:StyleApply" ),
+ SFX_STYLE_FAMILY_PARA,
+ Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
+ m_xFrame,
+ pImpl->aClearForm,
+ pImpl->aMore,
+ pImpl->bSpecModeWriter || pImpl->bSpecModeCalc );
if( !pImpl->aDefaultStyles.empty())
pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] );
// Set visibility listener to bind/unbind controller
pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification ));
- return pBox;
+ return pBox.get();
}
SvxFontNameToolBoxControl::SvxFontNameToolBoxControl(
@@ -2463,12 +2499,12 @@ void SvxFontNameToolBoxControl::StateChanged(
rTbx.EnableItem( nId, SfxItemState::DISABLED != eState );
}
-vcl::Window* SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
- SvxFontNameBox_Impl* pBox = new SvxFontNameBox_Impl( pParent,
- Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
- m_xFrame,0);
- return pBox;
+ VclPtrInstance<SvxFontNameBox_Impl> pBox( pParent,
+ Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
+ m_xFrame,0);
+ return pBox.get();
}
/* Note:
@@ -2557,10 +2593,11 @@ SfxPopupWindowType SvxColorToolBoxControl::GetPopupWindowType() const
return SfxPopupWindowType::ONTIMEOUT;
}
-SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow()
{
SvxColorWindow_Impl* pColorWin =
- new SvxColorWindow_Impl(
+ VclPtr<SvxColorWindow_Impl>::Create(
+
m_aCommandURL,
mPaletteManager,
maBorderColorStatus,
@@ -2735,9 +2772,9 @@ SfxPopupWindowType SvxFrameToolBoxControl::GetPopupWindowType() const
return SfxPopupWindowType::ONCLICK;
}
-SfxPopupWindow* SvxFrameToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxFrameToolBoxControl::CreatePopupWindow()
{
- SvxFrameWindow_Impl* pFrameWin = new SvxFrameWindow_Impl(
+ VclPtr<SvxFrameWindow_Impl> pFrameWin = VclPtr<SvxFrameWindow_Impl>::Create(
GetSlotId(), m_xFrame, &GetToolBox() );
pFrameWin->StartPopupMode( &GetToolBox(),
@@ -2777,9 +2814,9 @@ SfxPopupWindowType SvxFrameLineStyleToolBoxControl::GetPopupWindowType() const
return SfxPopupWindowType::ONCLICK;
}
-SfxPopupWindow* SvxFrameLineStyleToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxFrameLineStyleToolBoxControl::CreatePopupWindow()
{
- SvxLineWindow_Impl* pLineWin = new SvxLineWindow_Impl( GetSlotId(), m_xFrame, &GetToolBox() );
+ VclPtr<SvxLineWindow_Impl> pLineWin = VclPtr<SvxLineWindow_Impl>::Create( GetSlotId(), m_xFrame, &GetToolBox() );
pLineWin->StartPopupMode( &GetToolBox(),
FLOATWIN_POPUPMODE_GRABFOCUS |
FLOATWIN_POPUPMODE_ALLOWTEAROFF |
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index 0344ed8f9837..eb25ce945b3f 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -78,7 +78,7 @@ class FontHeightToolBoxControl : public svt::ToolboxController,
using svt::ToolboxController::dispatchCommand;
private:
- SvxFontSizeBox_Impl* m_pBox;
+ VclPtr<SvxFontSizeBox_Impl> m_pBox;
::com::sun::star::awt::FontDescriptor m_aCurrentFont;
};
@@ -334,8 +334,7 @@ throw (uno::RuntimeException, std::exception)
svt::ToolboxController::dispose();
SolarMutexGuard aSolarMutexGuard;
- delete m_pBox;
- m_pBox = 0;
+ m_pBox.disposeAndClear();
}
// XStatusListener
@@ -401,7 +400,8 @@ uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWind
if ( pParent )
{
SolarMutexGuard aSolarMutexGuard;
- m_pBox = new SvxFontSizeBox_Impl(
+ m_pBox = VclPtr<SvxFontSizeBox_Impl>::Create(
+
pParent,
uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
m_xFrame,
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 618469133efc..a5f8b17e8352 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -139,10 +139,6 @@ FindTextFieldControl::FindTextFieldControl( vcl::Window* pParent, WinBits nStyle
EnableAutocomplete(true, true);
}
-FindTextFieldControl::~FindTextFieldControl()
-{
-}
-
void FindTextFieldControl::Remember_Impl(const OUString& rStr)
{
sal_uInt16 nCount = GetEntryCount();
@@ -419,8 +415,7 @@ void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeExce
if (m_pFindTextFieldControl != nullptr) {
SearchToolbarControllersManager::createControllersManager()
.saveSearchHistory(m_pFindTextFieldControl);
- delete m_pFindTextFieldControl;
- m_pFindTextFieldControl = 0;
+ m_pFindTextFieldControl.disposeAndClear();
}
}
@@ -462,7 +457,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::cre
if ( pParent )
{
ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
- m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xContext );
+ m_pFindTextFieldControl = VclPtr<FindTextFieldControl>::Create( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xContext );
Size aSize(250, m_pFindTextFieldControl->GetTextHeight() + 200);
m_pFindTextFieldControl->SetSizePixel( aSize );
@@ -665,8 +660,7 @@ void SAL_CALL MatchCaseToolboxController::dispose() throw ( css::uno::RuntimeExc
svt::ToolboxController::dispose();
- delete m_pMatchCaseControl;
- m_pMatchCaseControl = 0;
+ m_pMatchCaseControl.disposeAndClear();
}
// XInitialization
@@ -686,7 +680,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::cr
if ( pParent )
{
ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
- m_pMatchCaseControl = new CheckBox( pToolbar, 0 );
+ m_pMatchCaseControl = VclPtr<CheckBox>::Create( pToolbar, 0 );
m_pMatchCaseControl->SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_MATCHCASE ) );
Size aSize( m_pMatchCaseControl->GetOptimalSize() );
m_pMatchCaseControl->SetSizePixel( aSize );
@@ -954,7 +948,7 @@ void SAL_CALL SearchLabelToolboxController::statusChanged( const css::frame::Fea
css::uno::Reference< css::awt::XWindow > SAL_CALL SearchLabelToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception )
{
- vcl::Window *pSL= new FixedText(VCLUnoHelper::GetWindow( Parent ));
+ VclPtr<vcl::Window> pSL = VclPtr<FixedText>::Create(VCLUnoHelper::GetWindow( Parent ));
pSL->SetSizePixel(Size(250, 25));
return VCLUnoHelper::GetInterface(pSL);
}
diff --git a/svx/source/tbxctrls/tbxalign.cxx b/svx/source/tbxctrls/tbxalign.cxx
index 41571ee9699a..a4fdb266a15f 100644
--- a/svx/source/tbxctrls/tbxalign.cxx
+++ b/svx/source/tbxctrls/tbxalign.cxx
@@ -61,7 +61,7 @@ SfxPopupWindowType SvxTbxCtlAlign::GetPopupWindowType() const
* rItemRect sind die Screen-Koordinaten
*/
-SfxPopupWindow* SvxTbxCtlAlign::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxTbxCtlAlign::CreatePopupWindow()
{
SolarMutexGuard aGuard;
if ( GetSlotId() == SID_OBJECT_ALIGN )
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
index 70fbe737279d..912b8d8fa357 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -583,11 +583,11 @@ void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rB
double fDepth = static_cast<const SvxDoubleItem*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
FieldUnit eUnit = (FieldUnit)static_cast<const SfxUInt16Item*>(rReq.GetArgs()->GetItem(SID_ATTR_METRIC))->GetValue();
- ExtrusionDepthDialog aDlg( 0L, fDepth, eUnit );
- sal_uInt16 nRet = aDlg.Execute();
+ ScopedVclPtrInstance< ExtrusionDepthDialog > aDlg(nullptr, fDepth, eUnit);
+ sal_uInt16 nRet = aDlg->Execute();
if( nRet != 0 )
{
- fDepth = aDlg.getDepth();
+ fDepth = aDlg->getDepth();
SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH );
SfxPoolItem* aItems[] = { &aItem, 0 };
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index 9177eb8db70a..72b2661cfd73 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -432,8 +432,8 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBi
{
case SID_FONTWORK_GALLERY_FLOATER:
{
- FontWorkGalleryDialog aDlg( pSdrView, ImpGetViewWin(pSdrView), nSID );
- aDlg.Execute();
+ ScopedVclPtrInstance< FontWorkGalleryDialog > aDlg( pSdrView, ImpGetViewWin(pSdrView), nSID );
+ aDlg->Execute();
}
break;
@@ -491,11 +491,11 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBi
if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) )
{
sal_Int32 nCharSpacing = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue();
- FontworkCharacterSpacingDialog aDlg( 0L, nCharSpacing );
- sal_uInt16 nRet = aDlg.Execute();
+ ScopedVclPtrInstance< FontworkCharacterSpacingDialog > aDlg( nullptr, nCharSpacing );
+ sal_uInt16 nRet = aDlg->Execute();
if( nRet != 0 )
{
- SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale() );
+ SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg->getScale() );
SfxPoolItem* aItems[] = { &aItem, 0 };
rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, (const SfxPoolItem**)aItems );
}
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index bfb4240d74e4..6993716536d7 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -60,6 +60,19 @@ DictionaryList::DictionaryList(SvSimpleTableContainer& rParent, WinBits nBits)
{
}
+DictionaryList::~DictionaryList()
+{
+ disposeOnce();
+}
+
+void DictionaryList::dispose()
+{
+ m_pED_Term.clear();
+ m_pED_Mapping.clear();
+ m_pLB_Property.clear();
+ SvSimpleTable::dispose();
+}
+
OUString DictionaryList::getPropertyTypeName( sal_Int16 nConversionPropertyType ) const
{
if(!m_pLB_Property || !m_pLB_Property->GetEntryCount())
@@ -449,10 +462,10 @@ ChineseDictionaryDialog::ChineseDictionaryDialog( vcl::Window* pParent )
get(mpToSimplifiedContainer, "tradtosimpleview");
mpToSimplifiedContainer->set_height_request(mpToSimplifiedContainer->GetTextHeight() * 8);
- m_pCT_DictionaryToSimplified = new DictionaryList(*mpToSimplifiedContainer, 0);
+ m_pCT_DictionaryToSimplified = VclPtr<DictionaryList>::Create(*mpToSimplifiedContainer, 0);
get(mpToTraditionalContainer, "simpletotradview");
mpToTraditionalContainer->set_height_request(mpToTraditionalContainer->GetTextHeight() * 8);
- m_pCT_DictionaryToTraditional = new DictionaryList(*mpToTraditionalContainer, 0);
+ m_pCT_DictionaryToTraditional = VclPtr<DictionaryList>::Create(*mpToTraditionalContainer, 0);
SvtLinguConfig aLngCfg;
bool bValue;
@@ -542,9 +555,29 @@ ChineseDictionaryDialog::ChineseDictionaryDialog( vcl::Window* pParent )
ChineseDictionaryDialog::~ChineseDictionaryDialog()
{
+ disposeOnce();
+}
+
+void ChineseDictionaryDialog::dispose()
+{
m_xContext=0;
- delete m_pCT_DictionaryToSimplified;
- delete m_pCT_DictionaryToTraditional;
+ m_pCT_DictionaryToSimplified.disposeAndClear();
+ m_pCT_DictionaryToTraditional.disposeAndClear();
+ m_pRB_To_Simplified.clear();
+ m_pRB_To_Traditional.clear();
+ m_pCB_Reverse.clear();
+ m_pFT_Term.clear();
+ m_pED_Term.clear();
+ m_pFT_Mapping.clear();
+ m_pED_Mapping.clear();
+ m_pFT_Property.clear();
+ m_pLB_Property.clear();
+ mpToSimplifiedContainer.clear();
+ mpToTraditionalContainer.clear();
+ m_pPB_Add.clear();
+ m_pPB_Modify.clear();
+ m_pPB_Delete.clear();
+ ModalDialog::dispose();
}
void ChineseDictionaryDialog::setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ )
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
index 97cef0a2ff33..50498b4d5d91 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
@@ -61,6 +61,8 @@ class DictionaryList : public SvSimpleTable
{
public:
DictionaryList(SvSimpleTableContainer& rParent, WinBits nBits);
+ virtual ~DictionaryList();
+ virtual void dispose() SAL_OVERRIDE;
void init(const css::uno::Reference< css::linguistic2::XConversionDictionary>& xDictionary,
vcl::Window *pED_Term, vcl::Window *pED_Mapping, ListBox *pLB_Property,
@@ -99,9 +101,9 @@ public:
css::uno::Reference<css::linguistic2::XConversionDictionary> m_xDictionary;
private:
- vcl::Window* m_pED_Term;
- vcl::Window* m_pED_Mapping;
- ListBox* m_pLB_Property;
+ VclPtr<vcl::Window> m_pED_Term;
+ VclPtr<vcl::Window> m_pED_Mapping;
+ VclPtr<ListBox> m_pLB_Property;
std::vector< DictionaryEntry* > m_aToBeDeleted;
@@ -113,6 +115,7 @@ class ChineseDictionaryDialog : public ModalDialog
public:
ChineseDictionaryDialog( vcl::Window* pParent );
virtual ~ChineseDictionaryDialog();
+ virtual void dispose() SAL_OVERRIDE;
//this method should be called once before calling execute
void setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
@@ -146,28 +149,28 @@ private:
private:
sal_Int32 m_nTextConversionOptions; //i18n::TextConversionOption
- RadioButton* m_pRB_To_Simplified;
- RadioButton* m_pRB_To_Traditional;
+ VclPtr<RadioButton> m_pRB_To_Simplified;
+ VclPtr<RadioButton> m_pRB_To_Traditional;
- CheckBox* m_pCB_Reverse;
+ VclPtr<CheckBox> m_pCB_Reverse;
- FixedText* m_pFT_Term;
- Edit* m_pED_Term;
+ VclPtr<FixedText> m_pFT_Term;
+ VclPtr<Edit> m_pED_Term;
- FixedText* m_pFT_Mapping;
- Edit* m_pED_Mapping;
+ VclPtr<FixedText> m_pFT_Mapping;
+ VclPtr<Edit> m_pED_Mapping;
- FixedText* m_pFT_Property;
- ListBox* m_pLB_Property;
+ VclPtr<FixedText> m_pFT_Property;
+ VclPtr<ListBox> m_pLB_Property;
- SvSimpleTableContainer* mpToSimplifiedContainer;
- DictionaryList* m_pCT_DictionaryToSimplified;
- SvSimpleTableContainer* mpToTraditionalContainer;
- DictionaryList* m_pCT_DictionaryToTraditional;
+ VclPtr<SvSimpleTableContainer> mpToSimplifiedContainer;
+ VclPtr<DictionaryList> m_pCT_DictionaryToSimplified;
+ VclPtr<SvSimpleTableContainer> mpToTraditionalContainer;
+ VclPtr<DictionaryList> m_pCT_DictionaryToTraditional;
- PushButton* m_pPB_Add;
- PushButton* m_pPB_Modify;
- PushButton* m_pPB_Delete;
+ VclPtr<PushButton> m_pPB_Add;
+ VclPtr<PushButton> m_pPB_Modify;
+ VclPtr<PushButton> m_pPB_Delete;
css::uno::Reference<css::uno::XComponentContext> m_xContext;
};
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
index 0de8dbbf73cf..58f8a1faddad 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -58,8 +58,7 @@ void ChineseTranslation_UnoDialog::impl_DeleteDialog()
{
if(m_pDialog->IsInExecute())
m_pDialog->EndDialog(RET_CANCEL);
- delete m_pDialog;
- m_pDialog = 0;
+ m_pDialog.disposeAndClear();
}
}
@@ -137,7 +136,7 @@ sal_Int16 SAL_CALL ChineseTranslation_UnoDialog::execute() throw(uno::RuntimeExc
pParent = pImplementation->GetWindow();
}
uno::Reference< XComponent > xComp( this );
- m_pDialog = new ChineseTranslationDialog( pParent );
+ m_pDialog = VclPtr<ChineseTranslationDialog>::Create( pParent );
}
if( !m_pDialog )
return nRet;
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
index 5349c555c332..9c39681f77f8 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase5.hxx>
+#include <vcl/vclptr.hxx>
namespace textconversiondlgs
@@ -121,7 +122,7 @@ private:
com::sun::star::uno::Reference<
com::sun::star::awt::XWindow > m_xParentWindow;
- ChineseTranslationDialog* m_pDialog;
+ VclPtr<ChineseTranslationDialog> m_pDialog;
bool m_bDisposed; ///Dispose call ready.
bool m_bInDispose;///In dispose call
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
index 8dec51d66809..faa63755f7b2 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
@@ -63,12 +63,23 @@ ChineseTranslationDialog::ChineseTranslationDialog( vcl::Window* pParent )
ChineseTranslationDialog::~ChineseTranslationDialog()
{
+ disposeOnce();
+}
+
+void ChineseTranslationDialog::dispose()
+{
if(m_pDictionaryDialog)
{
if(m_pDictionaryDialog->IsInExecute())
m_pDictionaryDialog->EndDialog();
- delete m_pDictionaryDialog;
}
+ m_pDictionaryDialog.disposeAndClear();
+ m_pRB_To_Simplified.clear();
+ m_pRB_To_Traditional.clear();
+ m_pCB_Translate_Commonterms.clear();
+ m_pPB_Editterms.clear();
+ m_pBP_OK.clear();
+ ModalDialog::dispose();
}
void ChineseTranslationDialog::getSettings( bool& rbDirectionToSimplified
@@ -96,7 +107,7 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, DictionaryHdl)
{
if( !m_pDictionaryDialog )
{
- m_pDictionaryDialog = new ChineseDictionaryDialog(this);
+ m_pDictionaryDialog = VclPtr<ChineseDictionaryDialog>::Create(this);
}
if( m_pDictionaryDialog )
{
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
index 5e1f0909d9f2..0ec0bf32f2be 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
@@ -39,6 +39,7 @@ class ChineseTranslationDialog : public ModalDialog
public:
ChineseTranslationDialog( vcl::Window* pParent );
virtual ~ChineseTranslationDialog();
+ virtual void dispose() SAL_OVERRIDE;
void getSettings( bool& rbDirectionToSimplified
, bool& rbTranslateCommonTerms ) const;
@@ -50,15 +51,15 @@ private:
void impl_UpdateVariantsCheckBox();
private:
- RadioButton* m_pRB_To_Simplified;
- RadioButton* m_pRB_To_Traditional;
+ VclPtr<RadioButton> m_pRB_To_Simplified;
+ VclPtr<RadioButton> m_pRB_To_Traditional;
- CheckBox* m_pCB_Translate_Commonterms;
- PushButton* m_pPB_Editterms;
+ VclPtr<CheckBox> m_pCB_Translate_Commonterms;
+ VclPtr<PushButton> m_pPB_Editterms;
- OKButton* m_pBP_OK;
+ VclPtr<OKButton> m_pBP_OK;
- ChineseDictionaryDialog* m_pDictionaryDialog;
+ VclPtr<ChineseDictionaryDialog> m_pDictionaryDialog;
};
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index cc58203958b8..afe0c725d8c5 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -160,7 +160,7 @@ namespace {
virtual sal_Bool SAL_CALL supportsMimeType( const OUString& MimeTypeName ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual Sequence< OUString > SAL_CALL getSupportedMimeTypeNames( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
- VirtualDevice* CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const;
+ VclPtr<VirtualDevice> CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const;
DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
@@ -395,9 +395,9 @@ IMPL_LINK(GraphicExporter, CalcFieldValueHdl, EditFieldInfo*, pInfo)
@return the returned VirtualDevice is owned by the caller
*/
-VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const
+VclPtr<VirtualDevice> GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const
{
- VirtualDevice* pVDev = new VirtualDevice();
+ VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
MapMode aMM( MAP_100TH_MM );
Point aPoint( 0, 0 );
@@ -624,7 +624,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
if( !pPage )
return false;
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY );
SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL);
@@ -704,15 +704,15 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
boost::scoped_ptr< SdrView > pLocalView;
if( PTR_CAST( FmFormModel, mpDoc ) )
{
- pLocalView.reset( new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ) );
+ pLocalView.reset( new FmFormView( PTR_CAST( FmFormModel, mpDoc ), aVDev ) );
}
else
{
- pLocalView.reset( new SdrView( mpDoc, &aVDev ) );
+ pLocalView.reset( new SdrView( mpDoc, aVDev ) );
}
- boost::scoped_ptr<VirtualDevice> pVDev(CreatePageVDev( pPage, nWidthPix, nHeightPix ));
+ ScopedVclPtr<VirtualDevice> pVDev(CreatePageVDev( pPage, nWidthPix, nHeightPix ));
if( pVDev )
{
@@ -726,22 +726,22 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
{
GDIMetaFile aMtf;
- aVDev.SetMapMode( aMap );
+ aVDev->SetMapMode( aMap );
if( rSettings.mbUseHighContrast )
- aVDev.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
- aVDev.EnableOutput( false );
- aMtf.Record( &aVDev );
+ aVDev->SetDrawMode( aVDev->GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
+ aVDev->EnableOutput( false );
+ aMtf.Record( aVDev );
Size aNewSize;
// create a view
boost::scoped_ptr< SdrView > pView;
if( PTR_CAST( FmFormModel, mpDoc ) )
{
- pView.reset(new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ));
+ pView.reset(new FmFormView( PTR_CAST( FmFormModel, mpDoc ), aVDev ));
}
else
{
- pView.reset(new SdrView( mpDoc, &aVDev ));
+ pView.reset(new SdrView( mpDoc, aVDev ));
}
pView->SetBordVisible( false );
@@ -754,17 +754,17 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
const Rectangle aClipRect( aNewOrg, aNewSize );
MapMode aVMap( aMap );
- aVDev.Push();
+ aVDev->Push();
aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
- aVDev.SetRelativeMapMode( aVMap );
- aVDev.IntersectClipRegion( aClipRect );
+ aVDev->SetRelativeMapMode( aVMap );
+ aVDev->IntersectClipRegion( aClipRect );
// Use new StandardCheckVisisbilityRedirector
ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
- pView->CompleteRedraw(&aVDev, vcl::Region(Rectangle(aNewOrg, aNewSize)), &aRedirector);
+ pView->CompleteRedraw(aVDev, vcl::Region(Rectangle(aNewOrg, aNewSize)), &aRedirector);
- aVDev.Pop();
+ aVDev->Pop();
aMtf.Stop();
aMtf.WindStart();
@@ -907,7 +907,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
if( !bSingleGraphic )
{
// create a metafile for all shapes
- VirtualDevice aOut;
+ ScopedVclPtrInstance< VirtualDevice > aOut;
// calculate bound rect for all shapes
Rectangle aBound;
@@ -927,18 +927,18 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
}
}
- aOut.EnableOutput( false );
- aOut.SetMapMode( aMap );
+ aOut->EnableOutput( false );
+ aOut->SetMapMode( aMap );
if( rSettings.mbUseHighContrast )
- aOut.SetDrawMode( aOut.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
+ aOut->SetDrawMode( aOut->GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
GDIMetaFile aMtf;
aMtf.Clear();
- aMtf.Record( &aOut );
+ aMtf.Record( aOut );
MapMode aOutMap( aMap );
aOutMap.SetOrigin( Point( -aBound.TopLeft().X(), -aBound.TopLeft().Y() ) );
- aOut.SetRelativeMapMode( aOutMap );
+ aOut->SetRelativeMapMode( aOutMap );
sdr::contact::DisplayInfo aDisplayInfo;
@@ -956,7 +956,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
{
// more effective way to paint a vector of SdrObjects. Hand over the processed page
// to have it in the
- sdr::contact::ObjectContactOfObjListPainter aMultiObjectPainter(aOut, aShapes, mpCurrentPage);
+ sdr::contact::ObjectContactOfObjListPainter aMultiObjectPainter(*aOut.get(), aShapes, mpCurrentPage);
ImplExportCheckVisisbilityRedirector aCheckVisibilityRedirector(mpCurrentPage);
aMultiObjectPainter.SetViewObjectContactRedirector(&aCheckVisibilityRedirector);
@@ -966,7 +966,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
aMtf.Stop();
aMtf.WindStart();
- const Size aExtSize( aOut.PixelToLogic( Size( 0, 0 ) ) );
+ const Size aExtSize( aOut->PixelToLogic( Size( 0, 0 ) ) );
Size aBoundSize( aBound.GetWidth() + ( aExtSize.Width() ),
aBound.GetHeight() + ( aExtSize.Height() ) );
diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx
index 74515045415c..693cae055133 100644
--- a/svx/source/unodraw/recoveryui.cxx
+++ b/svx/source/unodraw/recoveryui.cxx
@@ -67,7 +67,7 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo
css::uno::Reference< css::uno::XComponentContext > m_xContext;
/** @short TODO */
- vcl::Window* m_pParentWindow;
+ VclPtr<vcl::Window> m_pParentWindow;
/** @short TODO */
RecoveryUI::EJob m_eJob;
@@ -245,7 +245,7 @@ bool RecoveryUI::impl_doEmergencySave()
css::uno::Reference< css::frame::XStatusListener > xCore(pCore);
// create dialog for this operation and bind it to the used core service
- boost::scoped_ptr<Dialog> xDialog(new svxdr::SaveDialog(m_pParentWindow, pCore));
+ VclPtrInstance<svxdr::SaveDialog> xDialog(m_pParentWindow, pCore);
// start the dialog
short nRet = xDialog->Execute();
@@ -260,7 +260,7 @@ void RecoveryUI::impl_doRecovery()
// create all needed dialogs for this operation
// and bind it to the used core service
- boost::scoped_ptr<Dialog> xDialog(new svxdr::RecoveryDialog(m_pParentWindow, pCore));
+ VclPtrInstance<svxdr::RecoveryDialog> xDialog(m_pParentWindow, pCore);
// start the dialog
xDialog->Execute();
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 6924b90d4343..1c37eabbb299 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -670,13 +670,13 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
if( !mpObj.is() || mpModel == NULL || !mpObj->IsInserted() || NULL == mpObj->GetPage() )
return aAny;
- VirtualDevice aVDev;
- aVDev.SetMapMode(MapMode(MAP_100TH_MM));
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->SetMapMode(MapMode(MAP_100TH_MM));
SdrModel* pModel = mpObj->GetModel();
SdrPage* pPage = mpObj->GetPage();
- boost::scoped_ptr<E3dView> pView(new E3dView( pModel, &aVDev ));
+ boost::scoped_ptr<E3dView> pView(new E3dView( pModel, pVDev.get() ));
pView->hideMarkHandles();
SdrPageView* pPageView = pView->ShowSdrPage(pPage);
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index c87bdc10d943..0cc0b43c5f9e 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -88,7 +88,7 @@ private:
SdrObject* mpObject;
SdrText* mpText;
SdrView* mpView;
- const vcl::Window* mpWindow;
+ VclPtr<const vcl::Window> mpWindow;
SdrModel* mpModel;
SdrOutliner* mpOutliner;
SvxOutlinerForwarder* mpTextForwarder;
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 1f39734d3dff..d03b43b19af3 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -250,27 +250,27 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
{
if( pMtfSize_100TH_MM && ( rGraphic.GetType() != GRAPHIC_BITMAP ) )
{
- VirtualDevice aVDev;
- const Size aSize( aVDev.LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ const Size aSize( pVDev->LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );
- if( aVDev.SetOutputSizePixel( aSize ) )
+ if( pVDev->SetOutputSizePixel( aSize ) )
{
- const Wallpaper aWallpaper( aVDev.GetBackground() );
+ const Wallpaper aWallpaper( pVDev->GetBackground() );
const Point aPt;
- aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) );
- aVDev.Erase();
- rGraphic.Draw( &aVDev, aPt, aSize );
+ pVDev->SetBackground( Wallpaper( Color( COL_BLACK ) ) );
+ pVDev->Erase();
+ rGraphic.Draw( pVDev.get(), aPt, aSize );
- const Bitmap aBitmap( aVDev.GetBitmap( aPt, aSize ) );
+ const Bitmap aBitmap( pVDev->GetBitmap( aPt, aSize ) );
- aVDev.SetBackground( aWallpaper );
- aVDev.Erase();
- rGraphic.Draw( &aVDev, aPt, aSize );
+ pVDev->SetBackground( aWallpaper );
+ pVDev->Erase();
+ rGraphic.Draw( pVDev.get(), aPt, aSize );
- aVDev.SetRasterOp( ROP_XOR );
- aVDev.DrawBitmap( aPt, aSize, aBitmap );
- aGraphic = BitmapEx( aBitmap, aVDev.GetBitmap( aPt, aSize ) );
+ pVDev->SetRasterOp( ROP_XOR );
+ pVDev->DrawBitmap( aPt, aSize, aBitmap );
+ aGraphic = BitmapEx( aBitmap, pVDev->GetBitmap( aPt, aSize ) );
}
else
aGraphic = rGraphic.GetBitmapEx();
@@ -283,13 +283,13 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
{
if( pMtfSize_100TH_MM && ( rGraphic.GetType() != GRAPHIC_BITMAP ) )
{
- VirtualDevice aVDev;
- const Size aSize( aVDev.LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ const Size aSize( pVDev->LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );
- if( aVDev.SetOutputSizePixel( aSize ) )
+ if( pVDev->SetOutputSizePixel( aSize ) )
{
- rGraphic.Draw( &aVDev, Point(), aSize );
- aGraphic = aVDev.GetBitmap( Point(), aSize );
+ rGraphic.Draw( pVDev.get(), Point(), aSize );
+ aGraphic = pVDev->GetBitmap( Point(), aSize );
}
else
aGraphic = rGraphic.GetBitmap();
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index a016e03581c3..acbb94fff80d 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -140,7 +140,7 @@ const GraphicObject& XOBitmap::GetGraphicObject() const
void XOBitmap::Bitmap2Array()
{
- VirtualDevice aVD;
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
bool bPixelColor = false;
const Bitmap aBitmap( GetBitmap() );
const sal_uInt16 nLines = 8; // type dependent
@@ -148,23 +148,23 @@ void XOBitmap::Bitmap2Array()
if( !pPixelArray )
pPixelArray = new sal_uInt16[ nLines * nLines ];
- aVD.SetOutputSizePixel( aBitmap.GetSizePixel() );
- aVD.DrawBitmap( Point(), aBitmap );
- aPixelColor = aBckgrColor = aVD.GetPixel( Point() );
+ pVDev->SetOutputSizePixel( aBitmap.GetSizePixel() );
+ pVDev->DrawBitmap( Point(), aBitmap );
+ aPixelColor = aBckgrColor = pVDev->GetPixel( Point() );
// create array and determine foreground and background color
for( sal_uInt16 i = 0; i < nLines; i++ )
{
for( sal_uInt16 j = 0; j < nLines; j++ )
{
- if ( aVD.GetPixel( Point( j, i ) ) == aBckgrColor )
+ if ( pVDev->GetPixel( Point( j, i ) ) == aBckgrColor )
*( pPixelArray + j + i * nLines ) = 0;
else
{
*( pPixelArray + j + i * nLines ) = 1;
if( !bPixelColor )
{
- aPixelColor = aVD.GetPixel( Point( j, i ) );
+ aPixelColor = pVDev->GetPixel( Point( j, i ) );
bPixelColor = true;
}
}
@@ -175,13 +175,13 @@ void XOBitmap::Bitmap2Array()
/// convert array, fore- and background color into a bitmap
void XOBitmap::Array2Bitmap()
{
- VirtualDevice aVD;
- sal_uInt16 nLines = 8; // type dependent
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ sal_uInt16 nLines = 8; // type dependent
if( !pPixelArray )
return;
- aVD.SetOutputSizePixel( Size( nLines, nLines ) );
+ pVDev->SetOutputSizePixel( Size( nLines, nLines ) );
// create bitmap
for( sal_uInt16 i = 0; i < nLines; i++ )
@@ -189,13 +189,13 @@ void XOBitmap::Array2Bitmap()
for( sal_uInt16 j = 0; j < nLines; j++ )
{
if( *( pPixelArray + j + i * nLines ) == 0 )
- aVD.DrawPixel( Point( j, i ), aBckgrColor );
+ pVDev->DrawPixel( Point( j, i ), aBckgrColor );
else
- aVD.DrawPixel( Point( j, i ), aPixelColor );
+ pVDev->DrawPixel( Point( j, i ), aPixelColor );
}
}
- aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
+ aGraphicObject = GraphicObject( pVDev->GetBitmap( Point(), Size( nLines, nLines ) ) );
bGraphicDirty = false;
}
diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx
index 6d4ec14fec5c..4bfe888cca34 100644
--- a/svx/source/xoutdev/xtabdash.cxx
+++ b/svx/source/xoutdev/xtabdash.cxx
@@ -135,11 +135,11 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
aStrokeAttribute));
// prepare VirtualDevice
- VirtualDevice aVirtualDevice;
+ ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
- aVirtualDevice.SetOutputSizePixel(aSize);
- aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+ pVirtualDevice->SetOutputSizePixel(aSize);
+ pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
@@ -150,17 +150,17 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
static const Color aW(COL_WHITE);
static const Color aG(0xef, 0xef, 0xef);
- aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG);
+ pVirtualDevice->DrawCheckered(aNull, aSize, nLen, aW, aG);
}
else
{
- aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
- aVirtualDevice.Erase();
+ pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
+ pVirtualDevice->Erase();
}
// create processor and draw primitives
boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
- aVirtualDevice,
+ *pVirtualDevice.get(),
aNewViewInformation2D));
if(pProcessor2D)
@@ -172,7 +172,7 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
}
// get result bitmap and scale
- Bitmap aRetval(aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()));
+ Bitmap aRetval(pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel()));
if(1 != nFactor)
{
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index f25a215fd29f..16983e5c9882 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -181,17 +181,17 @@ Bitmap XGradientList::CreateBitmapForUI( long nIndex )
aBlack));
// prepare VirtualDevice
- VirtualDevice aVirtualDevice;
+ ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
- aVirtualDevice.SetOutputSizePixel(rSize);
- aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+ pVirtualDevice->SetOutputSizePixel(rSize);
+ pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
// create processor and draw primitives
boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
- aVirtualDevice,
+ *pVirtualDevice.get(),
aNewViewInformation2D));
if(pProcessor2D)
@@ -206,7 +206,7 @@ Bitmap XGradientList::CreateBitmapForUI( long nIndex )
}
// get result bitmap and scale
- aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
+ aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel());
}
return aRetval;
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
index ba73c5c7c8b4..30c05a273c70 100644
--- a/svx/source/xoutdev/xtabhtch.cxx
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -142,11 +142,11 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex )
aBlack));
// prepare VirtualDevice
- VirtualDevice aVirtualDevice;
+ ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
- aVirtualDevice.SetOutputSizePixel(rSize);
- aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+ pVirtualDevice->SetOutputSizePixel(rSize);
+ pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
@@ -156,17 +156,17 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex )
static const sal_uInt32 nLen(8);
static const Color aW(COL_WHITE);
static const Color aG(0xef, 0xef, 0xef);
- aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG);
+ pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG);
}
else
{
- aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
- aVirtualDevice.Erase();
+ pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
+ pVirtualDevice->Erase();
}
// create processor and draw primitives
boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
- aVirtualDevice,
+ *pVirtualDevice.get(),
aNewViewInformation2D));
if(pProcessor2D)
@@ -180,7 +180,7 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex )
}
// get result bitmap and scale
- aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
+ aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel());
}
return aRetval;
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx
index cd4dae3f091b..70bfe2ffb513 100644
--- a/svx/source/xoutdev/xtablend.cxx
+++ b/svx/source/xoutdev/xtablend.cxx
@@ -125,11 +125,11 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
aLineStartEndAttribute));
// prepare VirtualDevice
- VirtualDevice aVirtualDevice;
+ ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
- aVirtualDevice.SetOutputSizePixel(aSize);
- aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+ pVirtualDevice->SetOutputSizePixel(aSize);
+ pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
@@ -139,17 +139,17 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
static const sal_uInt32 nLen(8);
static const Color aW(COL_WHITE);
static const Color aG(0xef, 0xef, 0xef);
- aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG);
+ pVirtualDevice->DrawCheckered(aNull, aSize, nLen, aW, aG);
}
else
{
- aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
- aVirtualDevice.Erase();
+ pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
+ pVirtualDevice->Erase();
}
// create processor and draw primitives
boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
- aVirtualDevice,
+ *pVirtualDevice.get(),
aNewViewInformation2D));
if(pProcessor2D)
@@ -161,7 +161,7 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
}
// get result bitmap and scale
- aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
+ aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel());
}
return aRetval;
diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx
index 89bb27ef5e1c..a0fbabb66600 100644
--- a/svx/workben/msview/msview.cxx
+++ b/svx/workben/msview/msview.cxx
@@ -902,7 +902,7 @@ MSViewerWorkWindow::MSViewerWorkWindow() :
mpListBox[nPane]->SetExpandingHdl( LINK( this, MSViewerWorkWindow, implExpandingHdl ) );
mpListBox[nPane]->SetCollapsingHdl( LINK( this, MSViewerWorkWindow, implCollapsingHdl ) );
- mpEdit[nPane] = new MultiLineEdit(this, WB_3DLOOK | WB_BORDER | WB_LEFT | WB_TOP | WB_READONLY | WB_HSCROLL | WB_VSCROLL );
+ mpEdit[nPane] = VclPtr<MultiLineEdit>::Create(this, WB_3DLOOK | WB_BORDER | WB_LEFT | WB_TOP | WB_READONLY | WB_HSCROLL | WB_VSCROLL );
mpEdit[nPane]->SetReadOnly( TRUE );
mpEdit[nPane]->SetReadOnly( TRUE );
mpEdit[nPane]->SetControlFont( aFont );
diff --git a/svx/workben/pixelctl.cxx b/svx/workben/pixelctl.cxx
index 09cb0201c6b1..591e0011f9a9 100644
--- a/svx/workben/pixelctl.cxx
+++ b/svx/workben/pixelctl.cxx
@@ -79,11 +79,12 @@ SAL_IMPLEMENT_MAIN()
class MyWin : public WorkWindow
{
- SvxPixelCtl maPixelCtl;
+ VclPtr<SvxPixelCtl> maPixelCtl;
public:
MyWin( vcl::Window* pParent, WinBits nWinStyle );
-
+ virtual ~MyWin() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -97,20 +98,26 @@ public:
void Main()
{
- MyWin aMainWin( NULL, WB_STDWORK );
- aMainWin.SetText( OUString( "SvxPixelCtl" ) );
- aMainWin.Show();
+ ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_STDWORK );
+ aMainWin->SetText( OUString( "SvxPixelCtl" ) );
+ aMainWin->Show();
Application::Execute();
}
MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
WorkWindow( pParent, nWinStyle ),
- maPixelCtl( this )
+ maPixelCtl( VclPtr<SvxPixelCtl>::Create(this) )
{
- maPixelCtl.SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) );
- maPixelCtl.Show();
+ maPixelCtl->SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) );
+ maPixelCtl->Show();
+
+}
+void MyWin::dispose()
+{
+ maPixelCtl.disposeAndClear();
+ WorkWindow::dispose();
}
bool MyWin::Close()
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 97eaa42cf668..e18e91e99d94 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -37,6 +37,7 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
SwSidebarItem& rSidebarItem,
SwFmtFld* aField );
virtual ~SwAnnotationWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual void UpdateData() SAL_OVERRIDE;
virtual void SetPostItText() SAL_OVERRIDE;
@@ -55,7 +56,7 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
virtual bool IsProtected() SAL_OVERRIDE;
protected:
- virtual MenuButton* CreateMenuButton() SAL_OVERRIDE;
+ virtual VclPtr<MenuButton> CreateMenuButton() SAL_OVERRIDE;
private:
virtual SvxLanguageItem GetLanguage() SAL_OVERRIDE;
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 345151076569..81251741bea4 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <SidebarWindowsTypes.hxx>
#include <svl/lstner.hxx>
+#include <vcl/vclptr.hxx>
class OutputDevice;
class SwWrtShell;
@@ -140,12 +141,12 @@ class SwPostItMgr: public SfxListener
private:
SwView* mpView;
SwWrtShell* mpWrtShell;
- SwEditWin* mpEditWin;
+ VclPtr<SwEditWin> mpEditWin;
std::list< SwSidebarItem*> mvPostItFlds;
std::vector<SwPostItPageItem*> mPages;
ImplSVEvent * mnEventId;
bool mbWaitingForCalcRects;
- sw::sidebarwindows::SwSidebarWin* mpActivePostIt;
+ VclPtr<sw::sidebarwindows::SwSidebarWin> mpActivePostIt;
bool mbLayout;
long mbLayoutHeight;
bool mbLayouting;
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
index 03ac80de5bd4..e660b9bcc7c4 100644
--- a/sw/inc/SidebarWin.hxx
+++ b/sw/inc/SidebarWin.hxx
@@ -66,6 +66,7 @@ class SwSidebarWin : public vcl::Window
SwPostItBits aBits,
SwSidebarItem& rSidebarItem );
virtual ~SwSidebarWin();
+ virtual void dispose() SAL_OVERRIDE;
void SetSize( const Size& rNewSize );
void SetPosSizePixelRect( long nX,
@@ -183,7 +184,7 @@ class SwSidebarWin : public vcl::Window
virtual void LoseFocus() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect) SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
- virtual MenuButton* CreateMenuButton() = 0;
+ virtual VclPtr<MenuButton> CreateMenuButton() = 0;
void SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
SfxItemSet DefaultItem();
@@ -210,11 +211,11 @@ class SwSidebarWin : public vcl::Window
OutlinerView* mpOutlinerView;
Outliner* mpOutliner;
- sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
- ScrollBar* mpVScrollbar;
- Edit* mpMetadataAuthor;
- Edit* mpMetadataDate;
- MenuButton* mpMenuButton;
+ VclPtr<sw::sidebarwindows::SidebarTxtControl> mpSidebarTxtControl;
+ VclPtr<ScrollBar> mpVScrollbar;
+ VclPtr<Edit> mpMetadataAuthor;
+ VclPtr<Edit> mpMetadataDate;
+ VclPtr<MenuButton> mpMenuButton;
sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
sw::sidebarwindows::ShadowOverlayObject* mpShadow;
diff --git a/sw/inc/colwd.hxx b/sw/inc/colwd.hxx
index 448e07efaca6..1e466c477f4f 100644
--- a/sw/inc/colwd.hxx
+++ b/sw/inc/colwd.hxx
@@ -28,8 +28,8 @@ class SwTableFUNC;
class SwTableWidthDlg : public SvxStandardDialog
{
- NumericField* m_pColNF;
- MetricField* m_pWidthMF;
+ VclPtr<NumericField> m_pColNF;
+ VclPtr<MetricField> m_pWidthMF;
SwTableFUNC &rFnc;
protected:
@@ -38,6 +38,8 @@ protected:
public:
SwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rFnc );
+ virtual ~SwTableWidthDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 50bfdf3e7e40..facd5d020eb6 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -110,7 +110,7 @@ class SW_DLLPUBLIC SwDocShell
SAL_OVERRIDE;
/// Make DocInfo known to the Doc.
- SAL_DLLPRIVATE virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
+ SAL_DLLPRIVATE virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(
vcl::Window *pParent, const SfxItemSet &) SAL_OVERRIDE;
/// OLE-stuff
SAL_DLLPRIVATE virtual void Draw( OutputDevice*, const JobSetup&, sal_uInt16) SAL_OVERRIDE;
diff --git a/sw/inc/hhcwrp.hxx b/sw/inc/hhcwrp.hxx
index 138c72c25427..43c1e326f53c 100644
--- a/sw/inc/hhcwrp.hxx
+++ b/sw/inc/hhcwrp.hxx
@@ -30,7 +30,7 @@ class SwPaM;
class SW_DLLPUBLIC SwHHCWrapper : public editeng::HangulHanjaConversion
{
SwView * m_pView;
- vcl::Window* m_pWin;
+ VclPtr<vcl::Window> m_pWin;
SwWrtShell &m_rWrtShell;
SwConversionArgs *m_pConvArgs; /**< object for arguments (and results) needed
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 3e659452fe7c..92a5744bbb7f 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_SW_INC_HINTS_HXX
#include <swatrset.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
class SwFmt;
@@ -132,13 +133,13 @@ public:
class SwRefMarkFldUpdate : public SwMsgPoolItem
{
public:
- const OutputDevice* pOut; ///< pointer to the current output device
+ VclPtr<OutputDevice> pOut; ///< pointer to the current output device
/** Is sent if reference marks should be updated.
To get the page/chapter number, the frame has to be asked. For that we need
the current OutputDevice.
*/
- SwRefMarkFldUpdate( const OutputDevice* );
+ SwRefMarkFldUpdate( OutputDevice* );
};
/** SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index 80b26ac520e6..e8fa575ae36c 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -89,7 +89,7 @@ namespace SwPostItHelper
class SwSidebarItem
{
public:
- sw::sidebarwindows::SwSidebarWin* pPostIt;
+ VclPtr<sw::sidebarwindows::SwSidebarWin> pPostIt;
bool bShow;
bool bFocus;
@@ -114,7 +114,7 @@ public:
virtual bool UseElement() = 0;
virtual const SwFmtFld& GetFmtFld() const = 0;
virtual const SfxBroadcaster* GetBroadCaster() const = 0;
- virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
+ virtual VclPtr<sw::sidebarwindows::SwSidebarWin> GetSidebarWindow( SwEditWin& rEditWin,
WinBits nBits,
SwPostItMgr& aMgr,
SwPostItBits aBits) = 0;
@@ -146,7 +146,7 @@ public:
{
return dynamic_cast<const SfxBroadcaster *> (&mrFmtFld);
}
- virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow(
+ virtual VclPtr<sw::sidebarwindows::SwSidebarWin> GetSidebarWindow(
SwEditWin& rEditWin,
WinBits nBits,
SwPostItMgr& aMgr,
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index 11e1945d77dd..6c5e6f3efae7 100644
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -172,7 +172,7 @@ public:
class SwPrintUIOptions : public vcl::PrinterOptionsHelper
{
- OutputDevice* m_pLast;
+ VclPtr< OutputDevice > m_pLast;
const SwPrintData & m_rDefaultPrintData;
public:
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index dfcc4b189a30..f016ac3cdfca 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -219,7 +219,7 @@ public:
// Virtual methods for options dialog.
virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
- virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
+ virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
// Pool is created here and set at SfxShell.
void InitAttrPool();
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 01b308311287..610d9633f4d7 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -125,12 +125,12 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell>
SwRect maInvalidRect;
SfxViewShell *mpSfxViewShell;
- SwViewShellImp *mpImp; // Core-internals of SwViewShell.
- // The pointer is never 0.
+ SwViewShellImp *mpImp; // Core-internals of SwViewShell.
+ // The pointer is never 0.
- ::vcl::Window *mpWin; ///< = 0 during printing or pdf export
- OutputDevice *mpOut; ///< Window, Printer, VirtDev, ...
- OutputDevice* mpTmpRef; // Temporariy reference device. Is used
+ VclPtr<::vcl::Window> mpWin; ///< = 0 during printing or pdf export
+ VclPtr<OutputDevice> mpOut; ///< Window, Printer, VirtDev, ...
+ VclPtr<OutputDevice> mpTmpRef; // Temporariy reference device. Is used
// during (printer depending) prospect
// and page preview printing
// (because a scaling has to be set at
@@ -161,7 +161,7 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell>
bool mbInConstructor:1;
SdrPaintWindow* mpTargetPaintWindow;
- OutputDevice* mpBufferedOut;
+ VclPtr<OutputDevice> mpBufferedOut;
SwRootFrmPtr mpLayout;
@@ -236,7 +236,7 @@ public:
// #i72754# set of Pre/PostPaints with lock counter and initial target OutDev
protected:
std::stack<vcl::Region> mPrePostPaintRegions; // acts also as a lock counter (empty == not locked)
- OutputDevice* mpPrePostOutDev;
+ VclPtr<OutputDevice> mpPrePostOutDev;
MapMode maPrePostMapMode;
public:
void PrePaint();
diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx
new file mode 100644
index 000000000000..af67aee607d8
--- /dev/null
+++ b/sw/qa/tiledrendering/tiledrendering.cxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <osl/file.hxx>
+#include <vcl/builder.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/help.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/vclmain.hxx>
+#include <vcl/field.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/virdev.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::sfx2;
+
+class TiledRenderingApp : public Application
+{
+private:
+ uno::Reference<uno::XComponentContext> xContext;
+ uno::Reference<lang::XMultiComponentFactory> xFactory;
+ uno::Reference<lang::XMultiServiceFactory> xSFactory;
+ uno::Reference<uno::XInterface> xDesktop;
+ uno::Reference<frame::XComponentLoader> xLoader;
+ uno::Reference<lang::XComponent> xComponent;
+public:
+ virtual void Init() SAL_OVERRIDE;
+ virtual int Main() SAL_OVERRIDE;
+ void Open(OUString & aFileUrl);
+};
+
+class TiledRenderingDialog: public ModalDialog
+{
+private:
+ TiledRenderingApp *mpApp;
+ VclPtr<NumericField> mpContextWidth;
+ VclPtr<NumericField> mpContextHeight;
+ VclPtr<NumericField> mpTilePosX;
+ VclPtr<NumericField> mpTilePosY;
+ VclPtr<NumericField> mpTileWidth;
+ VclPtr<NumericField> mpTileHeight;
+ VclPtr<FixedImage> mpImage;
+
+public:
+ TiledRenderingDialog(TiledRenderingApp * app) :
+ ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui"),
+ mpApp(app)
+ {
+ VclPtr<PushButton> renderButton;
+ get(renderButton, "buttonRenderTile");
+ renderButton->SetClickHdl( LINK( this, TiledRenderingDialog, RenderHdl));
+
+ VclPtr<PushButton> chooseDocumentButton;
+ get(chooseDocumentButton, "buttonChooseDocument");
+ chooseDocumentButton->SetClickHdl( LINK( this, TiledRenderingDialog, ChooseDocumentHdl));
+
+ SetStyle(GetStyle()|WB_CLOSEABLE);
+
+ get(mpContextWidth, "spinContextWidth");
+ get(mpContextHeight, "spinContextHeight");
+ get(mpTilePosX, "spinTilePosX");
+ get(mpTilePosY, "spinTilePosY");
+ get(mpTileWidth, "spinTileWidth");
+ get(mpTileHeight, "spinTileHeight");
+ get(mpImage, "imageTile");
+ }
+
+ virtual ~TiledRenderingDialog()
+ {
+ disposeOnce();
+ }
+
+ virtual void dispose() SAL_OVERRIDE
+ {
+ mpContextWidth.clear();
+ mpContextHeight.clear();
+ mpTilePosX.clear();
+ mpTilePosY.clear();
+ mpTileWidth.clear();
+ mpTileHeight.clear();
+ mpImage.clear();
+ ModalDialog::dispose();
+ }
+
+ DECL_LINK ( RenderHdl, Button * );
+ DECL_LINK ( ChooseDocumentHdl, Button * );
+};
+
+IMPL_LINK ( TiledRenderingDialog, RenderHdl, Button *, EMPTYARG )
+{
+ int contextWidth = mpContextWidth->GetValue();
+ int contextHeight = mpContextHeight->GetValue();
+ int tilePosX = mpTilePosX->GetValue();
+ int tilePosY = mpTilePosY->GetValue();
+ long tileWidth = mpTileWidth->GetValue();
+ long tileHeight = mpTileHeight->GetValue();
+
+ // do the same thing we are doing in touch_lo_draw_tile()
+ SwWrtShell *pViewShell = GetActiveWrtShell();
+
+ if (pViewShell)
+ {
+ // TODO create a VirtualDevice based on SystemGraphicsData instead so
+ // that we get direct rendering; something like:
+ //
+ // SystemGraphicsData aData;
+ // [setup the aData]
+ // VirtualDevice pDevice(&aData, [color depth]);
+ ScopedVclPtrInstance< VirtualDevice > pDevice;
+
+ // paint to it
+ pViewShell->PaintTile(*pDevice.get(), contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight);
+
+ // copy the pDevice content to mpImage
+ Bitmap aBitmap(pDevice->GetBitmap(pDevice->PixelToLogic(Point(0,0)), pDevice->PixelToLogic(Size(contextWidth, contextHeight))));
+ mpImage->SetImage(Image(aBitmap));
+
+ // update the dialog size
+ setOptimalLayoutSize();
+ }
+
+ return 1;
+}
+
+IMPL_LINK ( TiledRenderingDialog, ChooseDocumentHdl, Button *, EMPTYARG )
+{
+ FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+ if( aDlgHelper.Execute() == ERRCODE_NONE )
+ {
+ OUString aFileUrl =xFP->getFiles().getConstArray()[0];
+ mpApp->Open(aFileUrl);
+ }
+ return 1;
+}
+
+void TiledRenderingApp::Open(OUString & aFileUrl)
+{
+ static const char TARGET[] = "_default";
+ static const Sequence<beans::PropertyValue> PROPS (0);
+ if(xComponent.get())
+ {
+ xComponent->dispose();
+ xComponent.clear();
+ }
+ xComponent.set(xLoader->loadComponentFromURL(aFileUrl, TARGET, 0, PROPS));
+}
+
+void TiledRenderingApp::Init()
+{
+ xContext.set(cppu::defaultBootstrap_InitialComponentContext());
+ xFactory.set(xContext->getServiceManager());
+ xSFactory.set(uno::Reference<lang::XMultiServiceFactory> (xFactory, uno::UNO_QUERY_THROW));
+ comphelper::setProcessServiceFactory(xSFactory);
+
+ // Create UCB (for backwards compatibility, in case some code still uses
+ // plain createInstance w/o args directly to obtain an instance):
+ ::ucb::UniversalContentBroker::create(comphelper::getProcessComponentContext() );
+
+ xDesktop.set(xFactory->createInstanceWithContext(OUString("com.sun.star.frame.Desktop"), xContext));
+ xLoader.set(frame::Desktop::create(xContext));
+}
+
+int TiledRenderingApp::Main()
+{
+ if(GetCommandLineParamCount()>0)
+ {
+ OUString aFileUrl;
+ osl::File::getFileURLFromSystemPath(GetCommandLineParam(0), aFileUrl);
+ Open(aFileUrl);
+ }
+ Help::EnableQuickHelp();
+ try
+ {
+ ScopedVclPtrInstance< TiledRenderingDialog > pDialog(this);
+ pDialog->Execute();
+ }
+ catch (const uno::Exception &e)
+ {
+ fprintf(stderr, "fatal error: %s\n", OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr());
+ }
+ return EXIT_SUCCESS;
+}
+
+void vclmain::createApplication()
+{
+ static TiledRenderingApp aApp;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx
index 1fae89e7db8e..c31d2945c329 100644
--- a/sw/source/core/access/accdoc.hxx
+++ b/sw/source/core/access/accdoc.hxx
@@ -36,7 +36,7 @@ class SwAccessibleDocumentBase : public SwAccessibleContext
::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible> mxParent;
- vcl::Window* mpChildWin; // protected by solar mutext
+ VclPtr<vcl::Window> mpChildWin; // protected by solar mutext
using SwAccessibleFrame::SetVisArea;
diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx
index 04e0bbc43ce7..c6c40fa28088 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -212,7 +212,7 @@ bool SwAccessibleChild::IsValid() const
{
return mpFrm != 0 ||
mpDrawObj != 0 ||
- mpWindow != 0;
+ mpWindow != nullptr;
}
bool SwAccessibleChild::IsVisibleChildrenOnly() const
diff --git a/sw/source/core/access/accfrmobj.hxx b/sw/source/core/access/accfrmobj.hxx
index bfd188f79ad1..31a489e43640 100644
--- a/sw/source/core/access/accfrmobj.hxx
+++ b/sw/source/core/access/accfrmobj.hxx
@@ -20,6 +20,7 @@
#ifndef INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJ_HXX
#define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJ_HXX
+#include <vcl/vclptr.hxx>
class SwAccessibleMap;
class SwFrm;
@@ -71,7 +72,7 @@ class SwAccessibleChild
private:
const SwFrm* mpFrm;
const SdrObject* mpDrawObj;
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
void Init( const SdrObject* pDrawObj );
void Init( const SwFrm* pFrm );
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index d0bdabdaca10..c1e79806fdd2 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -49,7 +49,7 @@ SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW )
{
}
-SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
+SwRefMarkFldUpdate::SwRefMarkFldUpdate( OutputDevice* pOutput )
: SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
pOut( pOutput )
{
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx
index f2f751779ff9..6da2747e8689 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -55,8 +55,8 @@ DocumentDeviceManager::DocumentDeviceManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwd
SfxPrinter* DocumentDeviceManager::getPrinter(/*[in]*/ bool bCreate ) const
{
SfxPrinter* pRet = 0;
- if ( !bCreate || mpPrt )
- pRet = mpPrt;
+ if ( !bCreate || mpPrt )
+ pRet = mpPrt;
else
pRet = &CreatePrinter_();
@@ -65,10 +65,11 @@ SfxPrinter* DocumentDeviceManager::getPrinter(/*[in]*/ bool bCreate ) const
void DocumentDeviceManager::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged )
{
- if ( pP != mpPrt )
+ assert ( !pP || !pP->isDisposed() );
+ if ( pP != mpPrt )
{
if ( bDeleteOld )
- delete mpPrt;
+ mpPrt.disposeAndClear();
mpPrt = pP;
// our printer should always use TWIP. Don't rely on this being set in SwViewShell::InitPrt, there
@@ -78,7 +79,7 @@ void DocumentDeviceManager::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDe
{
MapMode aMapMode( mpPrt->GetMapMode() );
aMapMode.SetMapUnit( MAP_TWIP );
- mpPrt->SetMapMode( aMapMode );
+ mpPrt->SetMapMode( aMapMode );
}
if ( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() && !m_rDoc.GetDocumentSettingManager().get( DocumentSettingId::USE_VIRTUAL_DEVICE ) )
@@ -100,15 +101,19 @@ VirtualDevice* DocumentDeviceManager::getVirtualDevice(/*[in]*/ bool bCreate ) c
else
pRet = &CreateVirtualDevice_();
+ assert ( !pRet || !pRet->isDisposed() );
+
return pRet;
}
void DocumentDeviceManager::setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOld, /*[in]*/ bool )
{
- if ( mpVirDev != pVd )
+ assert ( !pVd->isDisposed() );
+
+ if ( mpVirDev.get() != pVd )
{
if ( bDeleteOld )
- delete mpVirDev;
+ mpVirDev.disposeAndClear();
mpVirDev = pVd;
if ( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() && m_rDoc.GetDocumentSettingManager().get( DocumentSettingId::USE_VIRTUAL_DEVICE ) )
@@ -133,6 +138,8 @@ OutputDevice* DocumentDeviceManager::getReferenceDevice(/*[in]*/ bool bCreate )
pRet = getVirtualDevice( bCreate );
}
+ assert ( !pRet || !pRet->isDisposed() );
+
return pRet;
}
@@ -193,7 +200,7 @@ void DocumentDeviceManager::setJobsetup(/*[in]*/ const JobSetup &rJobSetup )
}
}
else
- delete mpPrt, mpPrt = 0;
+ mpPrt.disposeAndClear();
}
if( !mpPrt )
@@ -205,7 +212,7 @@ void DocumentDeviceManager::setJobsetup(/*[in]*/ const JobSetup &rJobSetup )
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- SfxPrinter *p = new SfxPrinter( pSet, rJobSetup );
+ VclPtr<SfxPrinter> p = VclPtr<SfxPrinter>::Create( pSet, rJobSetup );
if ( bCheckPageDescs )
setPrinter( p, true, true );
else
@@ -247,16 +254,16 @@ void DocumentDeviceManager::setPrintData(/*[in]*/ const SwPrintData& rPrtData )
DocumentDeviceManager::~DocumentDeviceManager()
{
delete mpPrtData;
- delete mpVirDev;
- DELETEZ( mpPrt );
+ mpVirDev.disposeAndClear();
+ mpPrt.disposeAndClear();
}
VirtualDevice& DocumentDeviceManager::CreateVirtualDevice_() const
{
#ifdef IOS
- VirtualDevice* pNewVir = new VirtualDevice( 8 );
+ VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create( 8 );
#else
- VirtualDevice* pNewVir = new VirtualDevice( 1 );
+ VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create( 1 );
#endif
pNewVir->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
@@ -290,9 +297,9 @@ SfxPrinter& DocumentDeviceManager::CreatePrinter_() const
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- SfxPrinter* pNewPrt = new SfxPrinter( pSet );
+ VclPtr<SfxPrinter> pNewPrt = VclPtr<SfxPrinter>::Create( pSet );
const_cast<DocumentDeviceManager*>(this)->setPrinter( pNewPrt, true, true );
- return *mpPrt;
+ return *mpPrt.get();
}
void DocumentDeviceManager::PrtDataChanged()
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 398a4ee13e78..38918b0320c0 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -2665,8 +2665,8 @@ void DocumentRedlineManager::checkRedlining(RedlineMode_t& _rReadlineMode)
if ( pParent && !mbReadlineChecked && rRedlineTbl.size() > MAX_REDLINE_COUNT
&& !((_rReadlineMode & nsRedlineMode_t::REDLINE_SHOW_DELETE) == nsRedlineMode_t::REDLINE_SHOW_DELETE) )
{
- MessageDialog aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui");
- sal_uInt16 nResult = aQuery.Execute();
+ ScopedVclPtrInstance< MessageDialog > aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui");
+ sal_uInt16 nResult = aQuery->Execute();
mbReadlineChecked = true;
if ( nResult == RET_YES )
{
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index b4eb8602a74d..ec6a2f3c7855 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -439,7 +439,7 @@ namespace
private:
bool mbMapModeRestored;
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
};
}
// <--
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index fdce8999502c..6a8f53eea98e 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -143,13 +143,13 @@ bool SwAnnotationItem::UseElement()
return mrFmtFld.IsFldInDoc();
}
-sw::sidebarwindows::SwSidebarWin* SwAnnotationItem::GetSidebarWindow(
+VclPtr<sw::sidebarwindows::SwSidebarWin> SwAnnotationItem::GetSidebarWindow(
SwEditWin& rEditWin,
WinBits nBits,
SwPostItMgr& aMgr,
SwPostItBits aBits)
{
- return new sw::annotation::SwAnnotationWin( rEditWin, nBits,
+ return VclPtr<sw::annotation::SwAnnotationWin>::Create( rEditWin, nBits,
aMgr, aBits,
*this,
&mrFmtFld );
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 0e36a90abc63..3ed004c9a617 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1239,16 +1239,16 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFmt, Graphic& rGrf ) co
Point aPt;
GetGrfSize( aSz );
- VirtualDevice aVirtDev;
- aVirtDev.EnableOutput( false );
+ ScopedVclPtrInstance< VirtualDevice > pVirtDev;
+ pVirtDev->EnableOutput( false );
MapMode aTmp( GetWin()->GetMapMode() );
aTmp.SetOrigin( aPt );
- aVirtDev.SetMapMode( aTmp );
+ pVirtDev->SetMapMode( aTmp );
GDIMetaFile aMtf;
- aMtf.Record( &aVirtDev );
- aGrf.Draw( &aVirtDev, aPt, aSz );
+ aMtf.Record( pVirtDev.get() );
+ aGrf.Draw( pVirtDev, aPt, aSz );
aMtf.Stop();
aMtf.SetPrefMapMode( aTmp );
aMtf.SetPrefSize( aSz );
@@ -1266,14 +1266,14 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFmt, Graphic& rGrf ) co
// Otherwise it could happen that for vector graphics
// many MB's of memory are allocated.
const Size aSz( FindFlyFrm()->Prt().SSize() );
- VirtualDevice aVirtDev( *GetWin() );
+ ScopedVclPtrInstance< VirtualDevice > pVirtDev(*GetWin());
MapMode aTmp( MAP_TWIP );
- aVirtDev.SetMapMode( aTmp );
- if( aVirtDev.SetOutputSize( aSz ) )
+ pVirtDev->SetMapMode( aTmp );
+ if( pVirtDev->SetOutputSize( aSz ) )
{
- aGrf.Draw( &aVirtDev, Point(), aSz );
- rGrf = aVirtDev.GetBitmap( Point(), aSz );
+ aGrf.Draw( pVirtDev.get(), Point(), aSz );
+ rGrf = pVirtDev->GetBitmap( Point(), aSz );
}
else
{
diff --git a/sw/source/core/inc/DocumentDeviceManager.hxx b/sw/source/core/inc/DocumentDeviceManager.hxx
index 1440b63897b6..f388b4d8d273 100644
--- a/sw/source/core/inc/DocumentDeviceManager.hxx
+++ b/sw/source/core/inc/DocumentDeviceManager.hxx
@@ -22,7 +22,7 @@
#include <IDocumentDeviceAccess.hxx>
#include <boost/utility.hpp>
#include <sal/types.h>
-
+#include <vcl/vclptr.hxx>
class SwDoc;
class SfxPrinter;
@@ -72,8 +72,8 @@ private:
invalidations and notifications. */
SwDoc& m_rDoc;
- SfxPrinter* mpPrt;
- VirtualDevice* mpVirDev;
+ VclPtr<SfxPrinter> mpPrt;
+ VclPtr<VirtualDevice> mpVirDev;
SwPrintData* mpPrtData;
};
diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx
index fee34b12737e..a601ce4aa20c 100644
--- a/sw/source/core/inc/drawfont.hxx
+++ b/sw/source/core/inc/drawfont.hxx
@@ -22,9 +22,10 @@
#include <tools/solar.h>
#include <osl/diagnose.h>
+#include <vcl/vclptr.hxx>
+#include <vcl/outdev.hxx>
class SwTxtFrm;
-class OutputDevice;
class SwViewShell;
class SwScriptInfo;
class Point;
@@ -41,7 +42,7 @@ class SwUnderlineFont;
class SwDrawTextInfo
{
const SwTxtFrm* pFrm;
- OutputDevice* pOut;
+ VclPtr<OutputDevice> pOut;
SwViewShell const * pSh;
const SwScriptInfo* pScriptInfo;
Point m_aPos;
diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx
index dfc4c7c2aa34..6755965d0f91 100644
--- a/sw/source/core/inc/fntcache.hxx
+++ b/sw/source/core/inc/fntcache.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SW_SOURCE_CORE_INC_FNTCACHE_HXX
#include <vcl/font.hxx>
+#include <vcl/vclptr.hxx>
#include <tools/mempool.hxx>
#include "swtypes.hxx"
#include "swcache.hxx"
@@ -63,7 +64,7 @@ class SwFntObj : public SwCacheObj
vcl::Font aFont;
vcl::Font *pScrFont;
vcl::Font *pPrtFont;
- OutputDevice* pPrinter;
+ VclPtr<OutputDevice> pPrinter;
sal_uInt16 nGuessedLeading;
sal_uInt16 nExtLeading;
sal_uInt16 nScrAscent;
@@ -77,7 +78,7 @@ class SwFntObj : public SwCacheObj
static long nPixWidth;
static MapMode *pPixMap;
- static OutputDevice *pPixOut;
+ static VclPtr<OutputDevice> pPixOut;
void calcLinePos(SwDrawTextInfo& rInf, Point& aStart, Point& aEnd, sal_Int32 nStart,
sal_Int32 nWrLen, sal_Int32 nCnt, const bool bSwitchH2V, const bool bSwitchL2R,
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index f352675fb9b9..78588cfcfb3c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -241,7 +241,7 @@ struct SwPaintProperties {
// Only repaint the Fly content as well as the background of the Fly content if
// a metafile is taken of the Fly.
bool bSFlyMetafile;
- OutputDevice *pSFlyMetafileOut;
+ VclPtr<OutputDevice> pSFlyMetafileOut;
SwViewShell *pSGlobalShell;
// Retouch for transparent Flys is done by the background of the Flys.
@@ -1248,7 +1248,7 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh )
}
const OutputDevice *pOut = gProp.bSFlyMetafile ?
- gProp.pSFlyMetafileOut : pSh->GetOut();
+ gProp.pSFlyMetafileOut.get() : pSh->GetOut();
// Hold original rectangle in pixel
const Rectangle aOrgPxRect = pOut->LogicToPixel( rRect.SVRect() );
@@ -7660,21 +7660,21 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pFirst);
OutputDevice *pOld = pSh->GetOut();
- VirtualDevice aDev( *pOld );
- aDev.EnableOutput( false );
+ ScopedVclPtrInstance< VirtualDevice > pDev( *pOld );
+ pDev->EnableOutput( false );
GDIMetaFile aMet;
MapMode aMap( pOld->GetMapMode().GetMapUnit() );
- aDev.SetMapMode( aMap );
+ pDev->SetMapMode( aMap );
aMet.SetPrefMapMode( aMap );
::SwCalcPixStatics( pSh->GetOut() );
aMet.SetPrefSize( pFly->Frm().SSize() );
- aMet.Record( &aDev );
- aDev.SetLineColor();
- aDev.SetFillColor();
- aDev.SetFont( pOld->GetFont() );
+ aMet.Record( pDev.get() );
+ pDev->SetLineColor();
+ pDev->SetFillColor();
+ pDev->SetFont( pOld->GetFont() );
//Enlarge the rectangle if needed, so the border is painted too.
SwRect aOut( pFly->Frm() );
@@ -7691,7 +7691,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
vcl::Window *pWin = pSh->GetWin();
sal_uInt16 nZoom = pSh->GetViewOptions()->GetZoom();
- ::SetOutDevAndWin( pSh, &aDev, 0, 100 );
+ ::SetOutDevAndWin( pSh, pDev, 0, 100 );
gProp.bSFlyMetafile = true;
gProp.pSFlyMetafileOut = pWin;
@@ -7709,15 +7709,15 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
pImp->PaintLayer( pIDDMA->GetHellId(), 0, aOut, &aPageBackgrdColor,
pFlyPage->IsRightToLeft(),
&aSwRedirector );
- gProp.pSLines->PaintLines( &aDev, gProp );
+ gProp.pSLines->PaintLines( pDev, gProp );
if ( pFly->IsFlyInCntFrm() )
pFly->Paint( aOut );
- gProp.pSLines->PaintLines( &aDev, gProp );
+ gProp.pSLines->PaintLines( pDev, gProp );
// OD 30.08.2002 #102450# - add 3rd parameter
pImp->PaintLayer( pIDDMA->GetHeavenId(), 0, aOut, &aPageBackgrdColor,
pFlyPage->IsRightToLeft(),
&aSwRedirector );
- gProp.pSLines->PaintLines( &aDev, gProp );
+ gProp.pSLines->PaintLines( pDev, gProp );
DELETEZ( gProp.pSLines );
gProp.pSFlyOnlyDraw = 0;
diff --git a/sw/source/core/layout/virtoutp.cxx b/sw/source/core/layout/virtoutp.cxx
index 78e5cfef4b23..d8ea404f17fd 100644
--- a/sw/source/core/layout/virtoutp.cxx
+++ b/sw/source/core/layout/virtoutp.cxx
@@ -119,7 +119,7 @@ bool SwLayVout::DoesFit( const Size &rNew )
return true;
if( !pVirDev )
{
- pVirDev = new VirtualDevice();
+ pVirDev = VclPtr<VirtualDevice>::Create();
pVirDev->SetLineColor();
if( pOut )
{
@@ -133,8 +133,7 @@ bool SwLayVout::DoesFit( const Size &rNew )
aSize.Width() = rNew.Width();
if( !pVirDev->SetOutputSizePixel( aSize ) )
{
- delete pVirDev;
- pVirDev = NULL;
+ pVirDev.disposeAndClear();
aSize.Width() = 0;
return false;
}
diff --git a/sw/source/core/layout/virtoutp.hxx b/sw/source/core/layout/virtoutp.hxx
index f3b007375bd1..ea44b5be2b9f 100644
--- a/sw/source/core/layout/virtoutp.hxx
+++ b/sw/source/core/layout/virtoutp.hxx
@@ -32,8 +32,8 @@ class SwLayVout
friend void _FrmFinit(); //deletes Vout
private:
SwViewShell* pSh;
- OutputDevice* pOut;
- VirtualDevice* pVirDev;
+ VclPtr<OutputDevice> pOut;
+ VclPtr<VirtualDevice> pVirDev;
SwRect aRect;
SwRect aOrgRect;
Size aSize;
@@ -43,7 +43,7 @@ private:
public:
SwLayVout() : pSh(0), pOut(0), pVirDev(0), aSize(0, VIRTUALHEIGHT), nCount(0) {}
- ~SwLayVout() { delete pVirDev; }
+ ~SwLayVout() { pVirDev.disposeAndClear(); }
/// OD 27.09.2002 #103636# - change 2nd parameter <rRect> - no longer <const>
void Enter( SwViewShell *pShell, SwRect &rRect, bool bOn );
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index c9dabd6825b1..3354df5e45e4 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -156,8 +156,8 @@ protected:
SwViewShell *m_pVsh;
// m_pOut is the output device, m_pRef is the device used for formatting
- OutputDevice* m_pOut;
- OutputDevice* m_pRef;
+ VclPtr<OutputDevice> m_pOut;
+ VclPtr<OutputDevice> m_pRef;
// performance hack - this is only used by SwTxtFormatInfo but
// because it's not even possible to dynamic_cast these things
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 38dc69ed5887..b85e351b0a82 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -109,7 +109,7 @@ SwTxtAttr *SwAttrIter::GetAttr( const sal_Int32 nPosition ) const
bool SwAttrIter::SeekAndChgAttrIter( const sal_Int32 nNewPos, OutputDevice* pOut )
{
bool bChg = nStartIndex && nNewPos == nPos ? pFnt->IsFntChg() : Seek( nNewPos );
- if ( pLastOut != pOut )
+ if ( pLastOut.get() != pOut )
{
pLastOut = pOut;
pFnt->SetFntChg( true );
@@ -174,7 +174,7 @@ bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFo
}
bool bChg = pFnt->IsFntChg();
- if ( pLastOut != pOut )
+ if ( pLastOut.get() != pOut )
{
pLastOut = pOut;
pFnt->SetFntChg( true );
@@ -338,7 +338,7 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const
class SwMinMaxArgs
{
public:
- OutputDevice* pOut;
+ VclPtr<OutputDevice> pOut;
SwViewShell const * pSh;
sal_uLong &rMin;
sal_uLong &rMax;
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index 81aa9fd489ba..7fb9ada2e7ad 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -47,7 +47,7 @@ protected:
SwScriptInfo* pScriptInfo;
private:
- OutputDevice *pLastOut;
+ VclPtr<OutputDevice> pLastOut;
short nChgCnt;
SwRedlineItr *pRedln;
size_t nStartIndex;
diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx
index 85890254dfbc..2008fefcff30 100644
--- a/sw/source/core/text/itrtxt.hxx
+++ b/sw/source/core/text/itrtxt.hxx
@@ -305,7 +305,7 @@ public:
class SwHookOut
{
SwTxtSizeInfo* pInf;
- OutputDevice* pOut;
+ VclPtr<OutputDevice> pOut;
bool bOnWin;
public:
SwHookOut( SwTxtSizeInfo& rInfo );
diff --git a/sw/source/core/text/txtpaint.hxx b/sw/source/core/text/txtpaint.hxx
index c14c6560cf81..607d6c5cf3a1 100644
--- a/sw/source/core/text/txtpaint.hxx
+++ b/sw/source/core/text/txtpaint.hxx
@@ -29,7 +29,7 @@ class SwSaveClip
const bool bOn;
bool bChg;
protected:
- OutputDevice* pOut;
+ VclPtr<OutputDevice> pOut;
void _ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm,
bool bEnlargeRect );
public:
@@ -60,7 +60,7 @@ inline SwSaveClip::~SwSaveClip()
class SwDbgOut
{
protected:
- OutputDevice* pOut;
+ VclPtr<OutputDevice> pOut;
public:
inline SwDbgOut( OutputDevice* pOutDev, const bool bOn = true );
};
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 77894fa20d62..e4726abcb48d 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -67,7 +67,7 @@ Color *pWaveCol = 0;
long SwFntObj::nPixWidth;
MapMode* SwFntObj::pPixMap = NULL;
-OutputDevice* SwFntObj::pPixOut = NULL;
+VclPtr<OutputDevice> SwFntObj::pPixOut;
namespace
{
@@ -1401,7 +1401,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if ( pPrinter )
{
// pTmpFont has already been set as current font for rInf.GetOut()
- if ( pPrinter != rInf.GetpOut() || pTmpFont != pPrtFont )
+ if ( pPrinter.get() != rInf.GetpOut() || pTmpFont != pPrtFont )
{
if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) )
pPrinter->SetFont( *pPrtFont );
@@ -1886,7 +1886,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
// This is the part used e.g., for cursor travelling
// See condition for DrawText or DrawTextArray (bDirectPrint)
- if ( pPrinter && pPrinter != rInf.GetpOut() )
+ if ( pPrinter && pPrinter.get() != rInf.GetpOut() )
{
if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) )
pPrinter->SetFont(*pPrtFont);
@@ -2247,7 +2247,7 @@ SwFntAccess::SwFntAccess( const void* &rMagic,
( !pFntObj->pPrinter || pFntObj->pPrinter == pOut ) ) )
pFntObj = pFntCache->Next( pFntObj );
- if( pFntObj && pFntObj->pPrinter != pOut )
+ if( pFntObj && pFntObj->pPrinter.get() != pOut )
{
// found one without printer, let's see if there is one with
// the same printer as well
@@ -2272,7 +2272,7 @@ SwFntAccess::SwFntAccess( const void* &rMagic,
else // Font has been found, so we lock it.
{
pFntObj->Lock();
- if (pFntObj->pPrinter != pOut) // if no printer is known by now
+ if (pFntObj->pPrinter.get() != pOut) // if no printer is known by now
{
OSL_ENSURE( !pFntObj->pPrinter, "SwFntAccess: Printer Changed" );
pFntObj->CreatePrtFont( *pOut );
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index 337816cbc030..076e8933c039 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -158,7 +158,6 @@ SwPrintUIOptions::SwPrintUIOptions(
bool bHasSelection,
bool bHasPostIts,
const SwPrintData &rDefaultPrintData ) :
- m_pLast( NULL ),
m_rDefaultPrintData( rDefaultPrintData )
{
ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) );
@@ -471,13 +470,14 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< bea
uno::Any aVal( getValue( "RenderDevice" ) );
aVal >>= xRenderDevice;
- OutputDevice* pOut = 0;
+ VclPtr< OutputDevice > pOut;
if (xRenderDevice.is())
{
VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
- pOut = pDevice ? pDevice->GetOutputDevice() : 0;
+ if (pDevice)
+ pOut = pDevice->GetOutputDevice();
}
- bChanged = bChanged || (pOut != m_pLast);
+ bChanged = bChanged || (pOut.get() != m_pLast.get());
if( pOut )
m_pLast = pOut;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 1ed7fa0f8278..27c72a10ee0f 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -322,7 +322,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
pRegion->Compress();
- VirtualDevice *pVout = 0;
+ VclPtr<VirtualDevice> pVout;
while ( !pRegion->empty() )
{
SwRect aRect( pRegion->back() );
@@ -333,7 +333,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
{
//create virtual device and set.
if ( !pVout )
- pVout = new VirtualDevice( *GetOut() );
+ pVout = VclPtr<VirtualDevice>::Create( *GetOut() );
MapMode aMapMode( GetOut()->GetMapMode() );
pVout->SetMapMode( aMapMode );
@@ -375,7 +375,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
aMapMode.SetOrigin( aOrigin );
pVout->SetMapMode( aMapMode );
- mpOut = pVout;
+ mpOut = pVout.get();
if ( bPaintsFromSystem )
PaintDesktop( aRect );
pCurrentLayout->Paint( aRect );
@@ -411,7 +411,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
lcl_PaintTransparentFormControls(*this, aRect); // i#107365
}
- delete pVout;
+ pVout.disposeAndClear();
delete pRegion;
Imp()->DelRegion();
}
@@ -464,7 +464,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() )
{
//Refresh with virtual device to avoid flickering.
- VirtualDevice *pVout = new VirtualDevice( *mpOut );
+ VclPtrInstance<VirtualDevice> pVout( *mpOut );
pVout->SetMapMode( mpOut->GetMapMode() );
Size aSize( VisArea().SSize() );
aSize.Width() += 20;
@@ -483,7 +483,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
DLPrePaint2(aRepaintRegion);
OutputDevice *pOld = mpOut;
- mpOut = pVout;
+ mpOut = pVout.get();
Paint( VisArea().SVRect() );
mpOut = pOld;
mpOut->DrawOutDev( VisArea().Pos(), aSize,
@@ -500,7 +500,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
GetWin()->EnablePaint( true );
GetWin()->Invalidate( INVALIDATE_CHILDREN );
}
- delete pVout;
+ pVout.disposeAndClear();
}
else
{
@@ -1207,7 +1207,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect
//create virtual device and set.
const Size aPixSz = GetWin()->PixelToLogic(Size(1,1));
- VirtualDevice *pVout = new VirtualDevice( *GetWin() );
+ VclPtrInstance<VirtualDevice> pVout( *GetWin() );
pVout->SetLineColor( GetWin()->GetLineColor() );
pVout->SetFillColor( GetWin()->GetFillColor() );
MapMode aMapMode( GetWin()->GetMapMode() );
@@ -1239,7 +1239,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect
aMapMode.SetOrigin( aPt );
pVout->SetMapMode( aMapMode );
OutputDevice *pOld = mpOut;
- mpOut = pVout;
+ mpOut = pVout.get();
{
// #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the
@@ -1384,14 +1384,14 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect
--mnLockPaint;
}
}
- delete pVout;
+ pVout.disposeAndClear();
GetWin()->Update();
if ( !Imp()->bStopSmooth )
--mnLockPaint;
SetFirstVisPageInvalid();
return true;
}
- delete pVout;
+ pVout.disposeAndClear();
}
#endif
@@ -2262,7 +2262,7 @@ SwViewShell::CreateAccessiblePreview()
void SwViewShell::InvalidateAccessibleFocus()
{
- if( Imp()->IsAccessible() )
+ if( Imp() && Imp()->IsAccessible() )
Imp()->GetAccessibleMap().InvalidateFocus();
}
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index c47190894897..096265b5f3ef 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -372,7 +372,7 @@ SwViewShell::~SwViewShell()
}
}
- delete mpTmpRef;
+ mpTmpRef.disposeAndClear();
delete mpAccOptions;
}
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 80ba9ce1666d..4bc1c06207c6 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -331,7 +331,7 @@ SwDoc * SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt)
//! Make a copy of it since it gets destroyed with the temporary document
//! used for PDF export
if (pPrt)
- pPrtDoc->getIDocumentDeviceAccess().setPrinter( new SfxPrinter(*pPrt), true, true );
+ pPrtDoc->getIDocumentDeviceAccess().setPrinter( VclPtr<SfxPrinter>::Create(*pPrt), true, true );
const SfxItemPool& rPool = GetAttrPool();
for( sal_uInt16 nWh = POOLATTR_BEGIN; nWh < POOLATTR_END; ++nWh )
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 355ef9bda016..77bd84f96805 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -726,9 +726,9 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd,
{
case GRAPHIC_BITMAP: // Bitmap -> play in Metafile
{
- VirtualDevice aVirt;
- aMeta.Record(&aVirt);
- aVirt.DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() );
+ ScopedVclPtrInstance< VirtualDevice > pVirt;
+ aMeta.Record(pVirt.get());
+ pVirt->DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() );
aMeta.Stop();
aMeta.WindStart();
aMeta.SetPrefMapMode( rGrf.GetPrefMapMode());
@@ -854,9 +854,9 @@ void SwWW8WrGrf::WriteGrfForBullet(SvStream& rStrm, const Graphic &rGrf, sal_uIn
{
case GRAPHIC_BITMAP: // Bitmap -> in Metafile abspielen
{
- VirtualDevice aVirt;
- aMeta.Record(&aVirt);
- aVirt.DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() );
+ ScopedVclPtrInstance< VirtualDevice > pVirt;
+ aMeta.Record(pVirt.get());
+ pVirt->DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() );
aMeta.Stop();
aMeta.WindStart();
aMeta.SetPrefMapMode( rGrf.GetPrefMapMode());
diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx
index a7616885ad21..d0dea5ffafbc 100644
--- a/sw/source/ui/chrdlg/break.cxx
+++ b/sw/source/ui/chrdlg/break.cxx
@@ -173,6 +173,23 @@ SwBreakDlg::SwBreakDlg( vcl::Window *pParent, SwWrtShell &rS )
m_pPageNumEdit->SetText(OUString());
}
+SwBreakDlg::~SwBreakDlg()
+{
+ disposeOnce();
+}
+
+void SwBreakDlg::dispose()
+{
+ m_pLineBtn.clear();
+ m_pColumnBtn.clear();
+ m_pPageBtn.clear();
+ m_pPageCollText.clear();
+ m_pPageCollBox.clear();
+ m_pPageNumBox.clear();
+ m_pPageNumEdit.clear();
+ SvxStandardDialog::dispose();
+}
+
void SwBreakDlg::CheckEnable()
{
bool bEnable = true;
@@ -206,8 +223,4 @@ void SwBreakDlg::CheckEnable()
m_pPageNumEdit->Enable(bEnable);
}
-SwBreakDlg::~SwBreakDlg()
-{
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index 7ef726f89087..9e461fc14622 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -185,7 +185,23 @@ SwCharURLPage::SwCharURLPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
SwCharURLPage::~SwCharURLPage()
{
+ disposeOnce();
+}
+
+void SwCharURLPage::dispose()
+{
delete pINetItem;
+ m_pURLED.clear();
+ m_pTextFT.clear();
+ m_pTextED.clear();
+ m_pNameED.clear();
+ m_pTargetFrmLB.clear();
+ m_pURLPB.clear();
+ m_pEventPB.clear();
+ m_pVisitedLB.clear();
+ m_pNotVisitedLB.clear();
+ m_pCharStyleContainer.clear();
+ SfxTabPage::dispose();
}
void SwCharURLPage::Reset(const SfxItemSet* rSet)
@@ -279,10 +295,10 @@ bool SwCharURLPage::FillItemSet(SfxItemSet* rSet)
return bModified;
}
-SfxTabPage* SwCharURLPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwCharURLPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SwCharURLPage( pParent, *rAttrSet ) );
+ return VclPtr<SwCharURLPage>::Create( pParent, *rAttrSet );
}
IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl)
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index 20b8e9b3f01b..cd402d033ad0 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -62,7 +62,7 @@ const sal_uInt16 SwDropCapsPage::aPageRg[] = {
class SwDropCapsPict : public Control
{
- SwDropCapsPage* mpPage;
+ VclPtr<SwDropCapsPage> mpPage;
OUString maText;
OUString maScriptText;
Color maBackColor;
@@ -72,7 +72,7 @@ class SwDropCapsPict : public Control
long mnLineH;
long mnTextH;
sal_uInt16 mnDistance;
- Printer* mpPrinter;
+ VclPtr<Printer> mpPrinter;
bool mbDelPrinter;
/// The _ScriptInfo structure holds information on where we change from one
/// script to another.
@@ -117,6 +117,7 @@ public:
void SetDropCapsPage(SwDropCapsPage* pPage) { mpPage = pPage; }
virtual ~SwDropCapsPict();
+ virtual void dispose() SAL_OVERRIDE;
void UpdatePaintSettings(); // also invalidates control!
@@ -202,8 +203,15 @@ static void calcFontHeightAnyAscent( OutputDevice* _pWin, vcl::Font& _rFont, lon
SwDropCapsPict::~SwDropCapsPict()
{
+ disposeOnce();
+}
+
+void SwDropCapsPict::dispose()
+{
if( mbDelPrinter )
- delete mpPrinter;
+ mpPrinter.disposeAndClear();
+ mpPage.clear();
+ Control::dispose();
}
/// Get the details of the first script change.
@@ -512,7 +520,7 @@ void SwDropCapsPict::_InitPrinter()
SwDropCapsDlg::SwDropCapsDlg(vcl::Window *pParent, const SfxItemSet &rSet )
: SfxSingleTabDialog(pParent, rSet)
{
- SwDropCapsPage* pNewPage = static_cast<SwDropCapsPage*>( SwDropCapsPage::Create(get_content_area(), &rSet));
+ VclPtr<SwDropCapsPage> pNewPage( static_cast<SwDropCapsPage*>( SwDropCapsPage::Create(get_content_area(), &rSet).get() ) );
pNewPage->SetFormat(false);
SetTabPage(pNewPage);
}
@@ -568,6 +576,25 @@ SwDropCapsPage::SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet)
SwDropCapsPage::~SwDropCapsPage()
{
+ disposeOnce();
+}
+
+void SwDropCapsPage::dispose()
+{
+ m_pDropCapsBox.clear();
+ m_pWholeWordCB.clear();
+ m_pSwitchText.clear();
+ m_pDropCapsField.clear();
+ m_pLinesText.clear();
+ m_pLinesField.clear();
+ m_pDistanceText.clear();
+ m_pDistanceField.clear();
+ m_pTextText.clear();
+ m_pTextEdit.clear();
+ m_pTemplateText.clear();
+ m_pTemplateBox.clear();
+ m_pPict.clear();
+ SfxTabPage::dispose();
}
SfxTabPage::sfxpg SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet)
@@ -578,10 +605,10 @@ SfxTabPage::sfxpg SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet)
return LEAVE_PAGE;
}
-SfxTabPage* SwDropCapsPage::Create(vcl::Window *pParent,
- const SfxItemSet *rSet)
+VclPtr<SfxTabPage> SwDropCapsPage::Create(vcl::Window *pParent,
+ const SfxItemSet *rSet)
{
- return new SwDropCapsPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwDropCapsPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
bool SwDropCapsPage::FillItemSet(SfxItemSet *rSet)
diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx
index 29429aa16da0..659ad559640e 100644
--- a/sw/source/ui/chrdlg/numpara.cxx
+++ b/sw/source/ui/chrdlg/numpara.cxx
@@ -101,15 +101,36 @@ SwParagraphNumTabPage::SwParagraphNumTabPage(vcl::Window* pParent, const SfxItem
SwParagraphNumTabPage::~SwParagraphNumTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SwParagraphNumTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rSet )
+void SwParagraphNumTabPage::dispose()
{
- return new SwParagraphNumTabPage(pParent, *rSet);
+ m_pOutlineStartBX.clear();
+ m_pOutlineLvLB.clear();
+ m_pNumberStyleBX.clear();
+ m_pNumberStyleLB.clear();
+ m_pEditNumStyleBtn.clear();
+ m_pNewStartCB.clear();
+ m_pNewStartBX.clear();
+ m_pNewStartNumberCB.clear();
+ m_pNewStartNF.clear();
+ m_pCountParaFram.clear();
+ m_pCountParaCB.clear();
+ m_pRestartParaCountCB.clear();
+ m_pRestartBX.clear();
+ m_pRestartNF.clear();
+ SfxTabPage::dispose();
}
-bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet )
+VclPtr<SfxTabPage> SwParagraphNumTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rSet )
+{
+ return VclPtr<SfxTabPage>( new SwParagraphNumTabPage(pParent, *rSet),
+ SAL_NO_ACQUIRE );
+}
+
+bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet )
{
if( m_pOutlineLvLB->IsValueChangedFromSaved())
{
diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx
index b5fb89873386..3757b44f846b 100644
--- a/sw/source/ui/chrdlg/swuiccoll.cxx
+++ b/sw/source/ui/chrdlg/swuiccoll.cxx
@@ -124,9 +124,25 @@ SwCondCollPage::SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet)
SwCondCollPage::~SwCondCollPage()
{
+ disposeOnce();
+}
+
+void SwCondCollPage::dispose()
+{
for(sal_Int32 i = 0; i < m_pFilterLB->GetEntryCount(); ++i)
delete static_cast<sal_uInt16*>(m_pFilterLB->GetEntryData(i));
+ m_pConditionCB.clear();
+ m_pContextFT.clear();
+ m_pUsedFT.clear();
+ m_pTbLinks.clear();
+ m_pStyleFT.clear();
+ m_pStyleLB.clear();
+ m_pFilterLB.clear();
+ m_pRemovePB.clear();
+ m_pAssignPB.clear();
+
+ SfxTabPage::dispose();
}
SfxTabPage::sfxpg SwCondCollPage::DeactivatePage(SfxItemSet * _pSet)
@@ -137,9 +153,10 @@ SfxTabPage::sfxpg SwCondCollPage::DeactivatePage(SfxItemSet * _pSet)
return LEAVE_PAGE;
}
-SfxTabPage* SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+VclPtr<SfxTabPage> SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
{
- return new SwCondCollPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwCondCollPage(pParent, *rSet),
+ SAL_NO_ACQUIRE);
}
bool SwCondCollPage::FillItemSet(SfxItemSet *rSet)
diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx
index 37da1bffff9a..13464804fa21 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -45,16 +45,16 @@ using namespace ::com::sun::star::beans;
class SwTestAccountSettingsDialog : public SfxModalDialog
{
- VclMultiLineEdit* m_pErrorsED;
+ VclPtr<VclMultiLineEdit> m_pErrorsED;
- PushButton* m_pStopPB;
+ VclPtr<PushButton> m_pStopPB;
- FixedText* m_pEstablish;
- FixedText* m_pFind;
- FixedText* m_pResult1;
- FixedText* m_pResult2;
- FixedImage* m_pImage1;
- FixedImage* m_pImage2;
+ VclPtr<FixedText> m_pEstablish;
+ VclPtr<FixedText> m_pFind;
+ VclPtr<FixedText> m_pResult1;
+ VclPtr<FixedText> m_pResult2;
+ VclPtr<FixedImage> m_pImage1;
+ VclPtr<FixedImage> m_pImage2;
Image m_aCompletedImg;
Image m_aFailedImg;
@@ -62,7 +62,7 @@ class SwTestAccountSettingsDialog : public SfxModalDialog
OUString m_sFailed;
OUString m_sErrorServer;
- SwMailConfigPage* m_pParent;
+ VclPtr<SwMailConfigPage> m_pParent;
bool m_bStop;
@@ -71,35 +71,37 @@ class SwTestAccountSettingsDialog : public SfxModalDialog
DECL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*);
public:
SwTestAccountSettingsDialog(SwMailConfigPage* pParent);
+ virtual ~SwTestAccountSettingsDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
class SwAuthenticationSettingsDialog : public SfxModalDialog
{
- CheckBox* m_pAuthenticationCB;
-
- RadioButton* m_pSeparateAuthenticationRB;
- RadioButton* m_pSMTPAfterPOPRB;
-
- FixedText* m_pOutgoingServerFT;
- FixedText* m_pUserNameFT;
- Edit* m_pUserNameED;
- FixedText* m_pOutPasswordFT;
- Edit* m_pOutPasswordED;
-
- FixedText* m_pIncomingServerFT;
- FixedText* m_pServerFT;
- Edit* m_pServerED;
- FixedText* m_pPortFT;
- NumericField* m_pPortNF;
- FixedText* m_pProtocolFT;
- RadioButton* m_pPOP3RB;
- RadioButton* m_pIMAPRB;
- FixedText* m_pInUsernameFT;
- Edit* m_pInUsernameED;
- FixedText* m_pInPasswordFT;
- Edit* m_pInPasswordED;
-
- OKButton* m_pOKPB;
+ VclPtr<CheckBox> m_pAuthenticationCB;
+
+ VclPtr<RadioButton> m_pSeparateAuthenticationRB;
+ VclPtr<RadioButton> m_pSMTPAfterPOPRB;
+
+ VclPtr<FixedText> m_pOutgoingServerFT;
+ VclPtr<FixedText> m_pUserNameFT;
+ VclPtr<Edit> m_pUserNameED;
+ VclPtr<FixedText> m_pOutPasswordFT;
+ VclPtr<Edit> m_pOutPasswordED;
+
+ VclPtr<FixedText> m_pIncomingServerFT;
+ VclPtr<FixedText> m_pServerFT;
+ VclPtr<Edit> m_pServerED;
+ VclPtr<FixedText> m_pPortFT;
+ VclPtr<NumericField> m_pPortNF;
+ VclPtr<FixedText> m_pProtocolFT;
+ VclPtr<RadioButton> m_pPOP3RB;
+ VclPtr<RadioButton> m_pIMAPRB;
+ VclPtr<FixedText> m_pInUsernameFT;
+ VclPtr<Edit> m_pInUsernameED;
+ VclPtr<FixedText> m_pInPasswordFT;
+ VclPtr<Edit> m_pInPasswordED;
+
+ VclPtr<OKButton> m_pOKPB;
SwMailMergeConfigItem& rConfigItem;
@@ -110,6 +112,7 @@ class SwAuthenticationSettingsDialog : public SfxModalDialog
public:
SwAuthenticationSettingsDialog(SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem);
virtual ~SwAuthenticationSettingsDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
SwMailConfigPage::SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet ) :
@@ -135,12 +138,28 @@ SwMailConfigPage::SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet
SwMailConfigPage::~SwMailConfigPage()
{
+ disposeOnce();
+}
+
+void SwMailConfigPage::dispose()
+{
delete m_pConfigItem;
+ m_pDisplayNameED.clear();
+ m_pAddressED.clear();
+ m_pReplyToCB.clear();
+ m_pReplyToFT.clear();
+ m_pReplyToED.clear();
+ m_pServerED.clear();
+ m_pPortNF.clear();
+ m_pSecureCB.clear();
+ m_pServerAuthenticationPB.clear();
+ m_pTestPB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SwMailConfigPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwMailConfigPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
{
- return new SwMailConfigPage(pParent, *rAttrSet);
+ return VclPtr<SwMailConfigPage>::Create(pParent, *rAttrSet);
}
bool SwMailConfigPage::FillItemSet( SfxItemSet* /*rSet*/ )
@@ -198,8 +217,8 @@ IMPL_LINK(SwMailConfigPage, ReplyToHdl, CheckBox*, pBox)
IMPL_LINK_NOARG(SwMailConfigPage, AuthenticationHdl)
{
- SwAuthenticationSettingsDialog aDlg(this, *m_pConfigItem);
- aDlg.Execute();
+ ScopedVclPtrInstance< SwAuthenticationSettingsDialog > aDlg(this, *m_pConfigItem);
+ aDlg->Execute();
return 0;
}
@@ -238,6 +257,25 @@ SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pPare
Application::PostUserEvent( STATIC_LINK( this, SwTestAccountSettingsDialog, TestHdl ), this );
}
+SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog()
+{
+ disposeOnce();
+}
+
+void SwTestAccountSettingsDialog::dispose()
+{
+ m_pErrorsED.clear();
+ m_pStopPB.clear();
+ m_pEstablish.clear();
+ m_pFind.clear();
+ m_pResult1.clear();
+ m_pResult2.clear();
+ m_pImage1.clear();
+ m_pImage2.clear();
+ m_pParent.clear();
+ SfxModalDialog::dispose();
+}
+
IMPL_LINK_NOARG(SwTestAccountSettingsDialog, StopHdl)
{
m_bStop = true;
@@ -414,6 +452,33 @@ SwAuthenticationSettingsDialog::SwAuthenticationSettingsDialog(
SwAuthenticationSettingsDialog::~SwAuthenticationSettingsDialog()
{
+ disposeOnce();
+}
+
+void SwAuthenticationSettingsDialog::dispose()
+{
+ m_pAuthenticationCB.clear();
+ m_pSeparateAuthenticationRB.clear();
+ m_pSMTPAfterPOPRB.clear();
+ m_pOutgoingServerFT.clear();
+ m_pUserNameFT.clear();
+ m_pUserNameED.clear();
+ m_pOutPasswordFT.clear();
+ m_pOutPasswordED.clear();
+ m_pIncomingServerFT.clear();
+ m_pServerFT.clear();
+ m_pServerED.clear();
+ m_pPortFT.clear();
+ m_pPortNF.clear();
+ m_pProtocolFT.clear();
+ m_pPOP3RB.clear();
+ m_pIMAPRB.clear();
+ m_pInUsernameFT.clear();
+ m_pInUsernameED.clear();
+ m_pInPasswordFT.clear();
+ m_pInPasswordED.clear();
+ m_pOKPB.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK_NOARG(SwAuthenticationSettingsDialog, OKHdl_Impl)
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index daa523e1b87f..f60ab8839d86 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -128,7 +128,17 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt
SwCompatibilityOptPage::~SwCompatibilityOptPage()
{
+ disposeOnce();
+}
+
+void SwCompatibilityOptPage::dispose()
+{
delete m_pImpl;
+ m_pMain.clear();
+ m_pFormattingLB.clear();
+ m_pOptionsLB.clear();
+ m_pDefaultPB.clear();
+ SfxTabPage::dispose();
}
sal_uLong convertBools2Ulong_Impl
@@ -309,9 +319,9 @@ IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl)
IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl)
{
- MessageDialog aQuery(this, "QueryDefaultCompatDialog",
- "modules/swriter/ui/querydefaultcompatdialog.ui");
- if (aQuery.Execute() == RET_YES)
+ ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDefaultCompatDialog",
+ "modules/swriter/ui/querydefaultcompatdialog.ui");
+ if (aQuery->Execute() == RET_YES)
{
for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin();
pItem != m_pImpl->m_aList.end(); ++pItem )
@@ -400,9 +410,9 @@ void SwCompatibilityOptPage::WriteOptions()
pItem->m_bExpandWordSpace );
}
-SfxTabPage* SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
- return new SwCompatibilityOptPage( pParent, *rAttrSet );
+ return VclPtr<SwCompatibilityOptPage>::Create( pParent, *rAttrSet );
}
bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* )
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 05adb529f089..0ce66ad8b874 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -125,10 +125,34 @@ SwLoadOptPage::SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet)
m_pShowStandardizedPageCount->SetClickHdl(aLink);
}
-SfxTabPage* SwLoadOptPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+SwLoadOptPage::~SwLoadOptPage()
{
- return new SwLoadOptPage(pParent, *rAttrSet );
+ disposeOnce();
+}
+
+void SwLoadOptPage::dispose()
+{
+ m_pAlwaysRB.clear();
+ m_pRequestRB.clear();
+ m_pNeverRB.clear();
+ m_pAutoUpdateFields.clear();
+ m_pAutoUpdateCharts.clear();
+ m_pMetricLB.clear();
+ m_pTabFT.clear();
+ m_pTabMF.clear();
+ m_pUseSquaredPageMode.clear();
+ m_pUseCharUnit.clear();
+ m_pWordCountED.clear();
+ m_pShowStandardizedPageCount.clear();
+ m_pStandardizedPageSizeNF.clear();
+ SfxTabPage::dispose();
+}
+
+
+VclPtr<SfxTabPage> SwLoadOptPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SwLoadOptPage>::Create(pParent, *rAttrSet );
}
IMPL_LINK_NOARG(SwLoadOptPage, StandardizedPageCountCheckHdl)
@@ -517,17 +541,41 @@ SwCaptionOptPage::SwCaptionOptPage( vcl::Window* pParent, const SfxItemSet& rSet
SwCaptionOptPage::~SwCaptionOptPage()
{
+ disposeOnce();
+}
+
+void SwCaptionOptPage::dispose()
+{
DelUserData();
delete pMgr;
+ m_pCheckLB.clear();
+ m_pLbCaptionOrder.clear();
+ m_pPreview.clear();
+ m_pSettingsGroup.clear();
+ m_pCategoryBox.clear();
+ m_pFormatText.clear();
+ m_pFormatBox.clear();
+ m_pNumberingSeparatorFT.clear();
+ m_pNumberingSeparatorED.clear();
+ m_pTextText.clear();
+ m_pTextEdit.clear();
+ m_pPosBox.clear();
+ m_pNumCapt.clear();
+ m_pLbLevel.clear();
+ m_pEdDelim.clear();
+ m_pCategory.clear();
+ m_pCharStyleLB.clear();
+ m_pApplyBorderCB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SwCaptionOptPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwCaptionOptPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return new SwCaptionOptPage(pParent, *rAttrSet );
+ return VclPtr<SwCaptionOptPage>::Create( pParent, *rAttrSet );
}
-bool SwCaptionOptPage::FillItemSet( SfxItemSet* )
+bool SwCaptionOptPage::FillItemSet( SfxItemSet* )
{
bool bRet = false;
SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 28533ce50e0f..8a595b87285f 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -156,12 +156,38 @@ SwContentOptPage::SwContentOptPage( vcl::Window* pParent,
SwContentOptPage::~SwContentOptPage()
{
+ disposeOnce();
}
-SfxTabPage* SwContentOptPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+void SwContentOptPage::dispose()
{
- return new SwContentOptPage(pParent, *rAttrSet);
+ m_pCrossCB.clear();
+ m_pHScrollBox.clear();
+ m_pVScrollBox.clear();
+ m_pAnyRulerCB.clear();
+ m_pHRulerCBox.clear();
+ m_pHMetric.clear();
+ m_pVRulerCBox.clear();
+ m_pVRulerRightCBox.clear();
+ m_pVMetric.clear();
+ m_pSmoothCBox.clear();
+ m_pGrfCB.clear();
+ m_pTblCB.clear();
+ m_pDrwCB.clear();
+ m_pFldNameCB.clear();
+ m_pPostItCB.clear();
+ m_pSettingsFrame.clear();
+ m_pSettingsLabel.clear();
+ m_pMetricLabel.clear();
+ m_pMetricLB.clear();
+ SfxTabPage::dispose();
+}
+
+
+VclPtr<SfxTabPage> SwContentOptPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
+{
+ return VclPtr<SwContentOptPage>::Create(pParent, *rAttrSet);
}
static void lcl_SelectMetricLB(ListBox* rMetric, sal_uInt16 nSID, const SfxItemSet& rSet)
@@ -352,6 +378,36 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(vcl::Window* pParent,
m_pProspectCB_RTL->Show(aCTLOptions.IsCTLFontEnabled());
}
+SwAddPrinterTabPage::~SwAddPrinterTabPage()
+{
+ disposeOnce();
+}
+
+void SwAddPrinterTabPage::dispose()
+{
+ m_pGrfCB.clear();
+ m_pCtrlFldCB.clear();
+ m_pBackgroundCB.clear();
+ m_pBlackFontCB.clear();
+ m_pPrintHiddenTextCB.clear();
+ m_pPrintTextPlaceholderCB.clear();
+ m_pPagesFrame.clear();
+ m_pLeftPageCB.clear();
+ m_pRightPageCB.clear();
+ m_pProspectCB.clear();
+ m_pProspectCB_RTL.clear();
+ m_pCommentsFrame.clear();
+ m_pNoRB.clear();
+ m_pOnlyRB.clear();
+ m_pEndRB.clear();
+ m_pEndPageRB.clear();
+ m_pInMarginsRB.clear();
+ m_pPrintEmptyPagesCB.clear();
+ m_pPaperFromSetupCB.clear();
+ m_pFaxLB.clear();
+ SfxTabPage::dispose();
+}
+
void SwAddPrinterTabPage::SetPreview(bool bPrev)
{
bPreview = bPrev;
@@ -359,10 +415,11 @@ void SwAddPrinterTabPage::SetPreview(bool bPrev)
m_pPagesFrame->Enable(!bPreview);
}
-SfxTabPage* SwAddPrinterTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwAddPrinterTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SwAddPrinterTabPage( pParent, *rAttrSet ) );
+ return VclPtr<SfxTabPage>(new SwAddPrinterTabPage( pParent, *rAttrSet ),
+ SAL_NO_ACQUIRE);
}
bool SwAddPrinterTabPage::FillItemSet( SfxItemSet* rCoreSet )
@@ -573,17 +630,35 @@ SwStdFontTabPage::SwStdFontTabPage( vcl::Window* pParent,
SwStdFontTabPage::~SwStdFontTabPage()
{
- delete pFontList;
- if (bDeletePrinter)
- {
- delete pPrt;
- }
+ disposeOnce();
}
-SfxTabPage* SwStdFontTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+void SwStdFontTabPage::dispose()
{
- return new SwStdFontTabPage(pParent, *rAttrSet);
+ delete pFontList;
+ if (bDeletePrinter)
+ pPrt.disposeAndClear();
+ pLabelFT.clear();
+ pStandardBox.clear();
+ pStandardHeightLB.clear();
+ pTitleBox.clear();
+ pTitleHeightLB.clear();
+ pListBox.clear();
+ pListHeightLB.clear();
+ pLabelBox.clear();
+ pLabelHeightLB.clear();
+ pIdxBox.clear();
+ pIndexHeightLB.clear();
+ pDocOnlyCB.clear();
+ pStandardPB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwStdFontTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SfxTabPage>(new SwStdFontTabPage(pParent, *rAttrSet),
+ SAL_NO_ACQUIRE);
}
static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
@@ -758,7 +833,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
if (bDeletePrinter)
{
- delete pPrt;
+ pPrt.disposeAndClear();
}
if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_PRINTER, false, &pItem))
@@ -771,7 +846,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- pPrt = new SfxPrinter(pPrinterSet);
+ pPrt = VclPtr<SfxPrinter>::Create(pPrinterSet);
}
delete pFontList;
pFontList = new FontList( pPrt );
@@ -1082,12 +1157,33 @@ SwTableOptionsTabPage::SwTableOptionsTabPage( vcl::Window* pParent, const SfxIte
SwTableOptionsTabPage::~SwTableOptionsTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SwTableOptionsTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+void SwTableOptionsTabPage::dispose()
{
- return new SwTableOptionsTabPage(pParent, *rAttrSet );
+ pHeaderCB.clear();
+ pRepeatHeaderCB.clear();
+ pDontSplitCB.clear();
+ pBorderCB.clear();
+ pNumFormattingCB.clear();
+ pNumFmtFormattingCB.clear();
+ pNumAlignmentCB.clear();
+ pRowMoveMF.clear();
+ pColMoveMF.clear();
+ pRowInsertMF.clear();
+ pColInsertMF.clear();
+ pFixRB.clear();
+ pFixPropRB.clear();
+ pVarRB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwTableOptionsTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SfxTabPage>( new SwTableOptionsTabPage(pParent, *rAttrSet ),
+ SAL_NO_ACQUIRE );
}
bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* )
@@ -1318,11 +1414,36 @@ SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( vcl::Window* pParent,
SwShdwCrsrOptionsTabPage::~SwShdwCrsrOptionsTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SwShdwCrsrOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+void SwShdwCrsrOptionsTabPage::dispose()
{
- return new SwShdwCrsrOptionsTabPage( pParent, *rSet );
+ m_pParaCB.clear();
+ m_pSHyphCB.clear();
+ m_pSpacesCB.clear();
+ m_pHSpacesCB.clear();
+ m_pTabCB.clear();
+ m_pBreakCB.clear();
+ m_pCharHiddenCB.clear();
+ m_pFldHiddenCB.clear();
+ m_pFldHiddenParaCB.clear();
+ m_pDirectCursorFrame.clear();
+ m_pOnOffCB.clear();
+ m_pFillMarginRB.clear();
+ m_pFillIndentRB.clear();
+ m_pFillTabRB.clear();
+ m_pFillSpaceRB.clear();
+ m_pCursorProtFrame.clear();
+ m_pCrsrInProtCB.clear();
+ m_pIgnoreProtCB.clear();
+ m_pMathBaselineAlignmentCB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwShdwCrsrOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
+{
+ return VclPtr<SfxTabPage>(new SwShdwCrsrOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE);
}
void SwShdwCrsrOptionsTabPage::PageCreated( const SfxAllItemSet& aSet )
@@ -1659,7 +1780,7 @@ namespace
}
SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent,
- const SfxItemSet& rSet )
+ const SfxItemSet& rSet )
: SfxTabPage(pParent, "OptRedLinePage",
"modules/swriter/ui/optredlinepage.ui" , &rSet)
, sNone(SW_RESSTR(SW_STR_NONE))
@@ -1731,11 +1852,29 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent,
SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SwRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
+void SwRedlineOptionsTabPage::dispose()
{
- return new SwRedlineOptionsTabPage( pParent, *rSet );
+ pInsertLB.clear();
+ pInsertColorLB.clear();
+ pInsertedPreviewWN.clear();
+ pDeletedLB.clear();
+ pDeletedColorLB.clear();
+ pDeletedPreviewWN.clear();
+ pChangedLB.clear();
+ pChangedColorLB.clear();
+ pChangedPreviewWN.clear();
+ pMarkPosLB.clear();
+ pMarkColorLB.clear();
+ pMarkPreviewWN.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
+{
+ return VclPtr<SfxTabPage>( new SwRedlineOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE );
}
bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* )
@@ -2232,11 +2371,24 @@ SwCompareOptionsTabPage::SwCompareOptionsTabPage( vcl::Window* pParent, const S
SwCompareOptionsTabPage::~SwCompareOptionsTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SwCompareOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+void SwCompareOptionsTabPage::dispose()
{
- return new SwCompareOptionsTabPage( pParent, *rAttrSet );
+ m_pAutoRB.clear();
+ m_pWordRB.clear();
+ m_pCharRB.clear();
+ m_pRsidCB.clear();
+ m_pIgnoreCB.clear();
+ m_pLenNF.clear();
+ m_pStoreRsidCB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwCompareOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SfxTabPage>(new SwCompareOptionsTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE);
}
bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* )
@@ -2367,10 +2519,30 @@ SwTestTabPage::SwTestTabPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
}
-SfxTabPage* SwTestTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+SwTestTabPage::~SwTestTabPage()
+{
+ disposeOnce();
+}
+
+void SwTestTabPage::dispose()
+{
+ m_pTest1CBox.clear();
+ m_pTest2CBox.clear();
+ m_pTest3CBox.clear();
+ m_pTest4CBox.clear();
+ m_pTest5CBox.clear();
+ m_pTest6CBox.clear();
+ m_pTest7CBox.clear();
+ m_pTest8CBox.clear();
+ m_pTest9CBox.clear();
+ m_pTest10CBox.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwTestTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return new SwTestTabPage(pParent, *rAttrSet);
+ return VclPtr<SwTestTabPage>::Create(pParent, *rAttrSet);
}
bool SwTestTabPage::FillItemSet( SfxItemSet* rCoreSet )
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 63bcbca4c579..e69a4ead6fb0 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -199,7 +199,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent)
Size aSize = pHeaderTreeContainer->LogicToPixel(Size(182 , 102), MAP_APPFONT);
pHeaderTreeContainer->set_width_request(aSize.Width());
pHeaderTreeContainer->set_height_request(aSize.Height());
- m_pListLB = new SwAddrSourceLB(*pHeaderTreeContainer);
+ m_pListLB = VclPtr<SwAddrSourceLB>::Create(*pHeaderTreeContainer);
m_pListLB->InsertHeaderEntry(m_sName + "\t" + m_sTable);
m_pListLB->setColSizes();
@@ -265,6 +265,11 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent)
SwAddressListDialog::~SwAddressListDialog()
{
+ disposeOnce();
+}
+
+void SwAddressListDialog::dispose()
+{
SvTreeListEntry* pEntry = m_pListLB->First();
while(pEntry)
{
@@ -272,7 +277,16 @@ SwAddressListDialog::~SwAddressListDialog()
delete pUserData;
pEntry = m_pListLB->Next( pEntry );
}
- delete m_pListLB;
+ m_pListLB.disposeAndClear();
+ m_pAddressPage.clear();
+ m_pDescriptionFI.clear();
+ m_pLoadListPB.clear();
+ m_pCreateListPB.clear();
+ m_pFilterPB.clear();
+ m_pEditPB.clear();
+ m_pTablePB.clear();
+ m_pOK.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl)
@@ -344,8 +358,9 @@ IMPL_LINK_NOARG(SwAddressListDialog, LoadHdl_Impl)
IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton)
{
OUString sInputURL;
- boost::scoped_ptr<SwCreateAddressListDialog> pDlg(
- new SwCreateAddressListDialog(
+ VclPtr<SwCreateAddressListDialog> pDlg(
+ VclPtr<SwCreateAddressListDialog>::Create(
+
pButton,
sInputURL,
m_pAddressPage->GetWizard()->GetConfigItem()));
@@ -443,8 +458,9 @@ IMPL_LINK(SwAddressListDialog, EditHdl_Impl, PushButton*, pButton)
pUserData->xColumnsSupplier.clear();
pUserData->xConnection.clear();
// will automatically close if it was the las reference
- boost::scoped_ptr<SwCreateAddressListDialog> pDlg(
- new SwCreateAddressListDialog(
+ VclPtr<SwCreateAddressListDialog> pDlg(
+ VclPtr<SwCreateAddressListDialog>::Create(
+
pButton,
pUserData->sURL,
m_pAddressPage->GetWizard()->GetConfigItem()));
@@ -562,7 +578,7 @@ void SwAddressListDialog::DetectTablesAndQueries(
if(nTables > 1 && bWidthDialog)
{
//now call the table select dialog - if more than one table exists
- boost::scoped_ptr<SwSelectDBTableDialog> pDlg(new SwSelectDBTableDialog(this, pUserData->xConnection));
+ VclPtrInstance<SwSelectDBTableDialog> pDlg(this, pUserData->xConnection);
const OUString sTable = SvTabListBox::GetEntryText(pSelect, ITEMID_TABLE - 1);
if(!sTable.isEmpty())
pDlg->SetSelectedTable(sTable, pUserData->nCommandType == CommandType::TABLE);
diff --git a/sw/source/ui/dbui/addresslistdialog.hxx b/sw/source/ui/dbui/addresslistdialog.hxx
index 50812efef486..708876448579 100644
--- a/sw/source/ui/dbui/addresslistdialog.hxx
+++ b/sw/source/ui/dbui/addresslistdialog.hxx
@@ -46,17 +46,17 @@ class SwAddrSourceLB;
class SwAddressListDialog : public SfxModalDialog
{
- FixedText* m_pDescriptionFI;
+ VclPtr<FixedText> m_pDescriptionFI;
- SwAddrSourceLB* m_pListLB;
+ VclPtr<SwAddrSourceLB> m_pListLB;
- PushButton* m_pLoadListPB;
- PushButton* m_pCreateListPB;
- PushButton* m_pFilterPB;
- PushButton* m_pEditPB;
- PushButton* m_pTablePB;
+ VclPtr<PushButton> m_pLoadListPB;
+ VclPtr<PushButton> m_pCreateListPB;
+ VclPtr<PushButton> m_pFilterPB;
+ VclPtr<PushButton> m_pEditPB;
+ VclPtr<PushButton> m_pTablePB;
- OKButton* m_pOK;
+ VclPtr<OKButton> m_pOK;
OUString m_sName;
OUString m_sTable;
@@ -66,7 +66,7 @@ class SwAddressListDialog : public SfxModalDialog
bool m_bInSelectHdl;
- SwMailMergeAddressBlockPage* m_pAddressPage;
+ VclPtr<SwMailMergeAddressBlockPage> m_pAddressPage;
::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext> m_xDBContext;
@@ -87,6 +87,7 @@ class SwAddressListDialog : public SfxModalDialog
public:
SwAddressListDialog(SwMailMergeAddressBlockPage* pParent);
virtual ~SwAddressListDialog();
+ virtual void dispose() SAL_OVERRIDE;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>
GetSource();
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx
index 347ce0a4a5dc..1d8a63103802 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.cxx
@@ -46,11 +46,11 @@ using namespace ::com::sun::star::ui::dialogs;
class SwAddressControl_Impl : public Control
{
- ScrollBar *m_pScrollBar;
- Window *m_pWindow;
+ VclPtr<ScrollBar> m_pScrollBar;
+ VclPtr<Window> m_pWindow;
- ::std::vector<FixedText*> m_aFixedTexts;
- ::std::vector<Edit*> m_aEdits;
+ ::std::vector<VclPtr<FixedText> > m_aFixedTexts;
+ ::std::vector<VclPtr<Edit> > m_aEdits;
SwCSVData* m_pData;
Size m_aWinOutputSize;
@@ -74,6 +74,7 @@ class SwAddressControl_Impl : public Control
public:
SwAddressControl_Impl(vcl::Window* pParent , WinBits nBits );
virtual ~SwAddressControl_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void SetData(SwCSVData& rDBData);
@@ -85,8 +86,8 @@ public:
SwAddressControl_Impl::SwAddressControl_Impl(vcl::Window* pParent, WinBits nBits ) :
Control(pParent, nBits),
- m_pScrollBar(new ScrollBar(this)),
- m_pWindow(new vcl::Window(this, WB_DIALOGCONTROL)),
+ m_pScrollBar(VclPtr<ScrollBar>::Create(this)),
+ m_pWindow(VclPtr<vcl::Window>::Create(this, WB_DIALOGCONTROL)),
m_pData(0),
m_nLineHeight(0),
m_nCurrentDataSet(0),
@@ -113,14 +114,20 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressControlImpl(v
SwAddressControl_Impl::~SwAddressControl_Impl()
{
- ::std::vector<FixedText*>::iterator aTextIter;
- for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter)
- delete *aTextIter;
- ::std::vector<Edit*>::iterator aEditIter;
- for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter)
- delete *aEditIter;
- delete m_pScrollBar;
- delete m_pWindow;
+ disposeOnce();
+}
+
+void SwAddressControl_Impl::dispose()
+{
+ for(auto aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter)
+ aTextIter->disposeAndClear();
+ m_aFixedTexts.clear();
+ for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter)
+ aEditIter->disposeAndClear();
+ m_aEdits.clear();
+ m_pScrollBar.clear();
+ m_pWindow.clear();
+ Control::dispose();
}
void SwAddressControl_Impl::SetData(SwCSVData& rDBData)
@@ -129,13 +136,11 @@ void SwAddressControl_Impl::SetData(SwCSVData& rDBData)
//when the address data is updated then remove the controls an build again
if(m_aFixedTexts.size())
{
- ::std::vector<FixedText*>::iterator aTextIter;
- for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter)
- delete *aTextIter;
- ::std::vector<Edit*>::iterator aEditIter;
- for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter)
- delete *aEditIter;
+ for(auto aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter)
+ aTextIter->disposeAndClear();
m_aFixedTexts.clear();
+ for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter)
+ aEditIter->disposeAndClear();
m_aEdits.clear();
m_bNoDataSet = true;
}
@@ -176,8 +181,8 @@ void SwAddressControl_Impl::SetData(SwCSVData& rDBData)
aHeaderIter != m_pData->aDBColumnHeaders.end();
++aHeaderIter, nEDYPos += m_nLineHeight, nFTYPos += m_nLineHeight, nLines++)
{
- FixedText* pNewFT = new FixedText(m_pWindow, WB_RIGHT);
- Edit* pNewED = new Edit(m_pWindow, WB_BORDER);
+ VclPtr<FixedText> pNewFT = VclPtr<FixedText>::Create(m_pWindow, WB_RIGHT);
+ VclPtr<Edit> pNewED = VclPtr<Edit>::Create(m_pWindow, WB_BORDER);
//set nLines a position identifier - used in the ModifyHdl
pNewED->SetData(reinterpret_cast<void*>(nLines));
pNewED->SetGetFocusHdl(aFocusLink);
@@ -244,9 +249,8 @@ void SwAddressControl_Impl::SetCurrentDataSet(sal_uInt32 nSet)
OSL_ENSURE(m_pData->aDBData.size() > m_nCurrentDataSet, "wrong data set index");
if(m_pData->aDBData.size() > m_nCurrentDataSet)
{
- ::std::vector<Edit*>::iterator aEditIter;
sal_uInt32 nIndex = 0;
- for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter, ++nIndex)
+ for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter, ++nIndex)
{
OSL_ENSURE(nIndex < m_pData->aDBData[m_nCurrentDataSet].size(),
"number of columns doesn't match number of Edits");
@@ -380,8 +384,7 @@ void SwAddressControl_Impl::Resize()
{
long nNewEditSize = aSize.Width() - (*m_aEdits.begin())->GetPosPixel().X() - nScrollBarWidth - 6;
- ::std::vector<Edit*>::iterator aEditIter;
- for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter)
+ for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter)
{
(*aEditIter)->SetSizePixel(Size(nNewEditSize, (*aEditIter)->GetSizePixel().Height()));
}
@@ -495,8 +498,25 @@ SwCreateAddressListDialog::SwCreateAddressListDialog(
SwCreateAddressListDialog::~SwCreateAddressListDialog()
{
+ disposeOnce();
+}
+
+void SwCreateAddressListDialog::dispose()
+{
delete m_pCSVData;
- delete m_pFindDlg;
+ m_pAddressControl.clear();
+ m_pNewPB.clear();
+ m_pDeletePB.clear();
+ m_pFindPB.clear();
+ m_pCustomizePB.clear();
+ m_pStartPB.clear();
+ m_pPrevPB.clear();
+ m_pSetNoNF.clear();
+ m_pNextPB.clear();
+ m_pEndPB.clear();
+ m_pOK.clear();
+ m_pFindDlg.disposeAndClear();
+ SfxModalDialog::dispose();
}
IMPL_LINK_NOARG(SwCreateAddressListDialog, NewHdl_Impl)
@@ -541,7 +561,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, FindHdl_Impl)
{
if(!m_pFindDlg)
{
- m_pFindDlg = new SwFindEntryDialog(this);
+ m_pFindDlg = VclPtr<SwFindEntryDialog>::Create(this);
ListBox& rColumnBox = m_pFindDlg->GetFieldsListBox();
::std::vector< OUString >::iterator aHeaderIter;
for(aHeaderIter = m_pCSVData->aDBColumnHeaders.begin();
@@ -558,7 +578,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, FindHdl_Impl)
IMPL_LINK(SwCreateAddressListDialog, CustomizeHdl_Impl, PushButton*, pButton)
{
- boost::scoped_ptr<SwCustomizeAddressListDialog> pDlg(new SwCustomizeAddressListDialog(pButton, *m_pCSVData));
+ VclPtrInstance< SwCustomizeAddressListDialog > pDlg(pButton, *m_pCSVData);
if(RET_OK == pDlg->Execute())
{
delete m_pCSVData;
@@ -751,6 +771,23 @@ SwFindEntryDialog::SwFindEntryDialog(SwCreateAddressListDialog* pParent)
m_pCancel->SetClickHdl(LINK(this, SwFindEntryDialog, CloseHdl_Impl));
}
+SwFindEntryDialog::~SwFindEntryDialog()
+{
+ disposeOnce();
+}
+
+void SwFindEntryDialog::dispose()
+{
+ m_pFindED.clear();
+ m_pFindOnlyCB.clear();
+ m_pFindOnlyLB.clear();
+ m_pFindPB.clear();
+ m_pCancel.clear();
+ m_pParent.clear();
+ ModelessDialog::dispose();
+}
+
+
IMPL_LINK_NOARG(SwFindEntryDialog, FindHdl_Impl)
{
sal_Int32 nColumn = -1;
diff --git a/sw/source/ui/dbui/createaddresslistdialog.hxx b/sw/source/ui/dbui/createaddresslistdialog.hxx
index 393c5a79b71e..ac6ed41cfab2 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.hxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.hxx
@@ -40,27 +40,27 @@ struct SwCSVData
class SwFindEntryDialog;
class SwCreateAddressListDialog : public SfxModalDialog
{
- SwAddressControl_Impl* m_pAddressControl;
+ VclPtr<SwAddressControl_Impl> m_pAddressControl;
- PushButton *m_pNewPB;
- PushButton *m_pDeletePB;
- PushButton *m_pFindPB;
- PushButton *m_pCustomizePB;
+ VclPtr<PushButton> m_pNewPB;
+ VclPtr<PushButton> m_pDeletePB;
+ VclPtr<PushButton> m_pFindPB;
+ VclPtr<PushButton> m_pCustomizePB;
- PushButton *m_pStartPB;
- PushButton *m_pPrevPB;
- NumericField *m_pSetNoNF;
- PushButton *m_pNextPB;
- PushButton *m_pEndPB;
+ VclPtr<PushButton> m_pStartPB;
+ VclPtr<PushButton> m_pPrevPB;
+ VclPtr<NumericField> m_pSetNoNF;
+ VclPtr<PushButton> m_pNextPB;
+ VclPtr<PushButton> m_pEndPB;
- OKButton *m_pOK;
+ VclPtr<OKButton> m_pOK;
OUString m_sAddressListFilterName;
OUString m_sURL;
SwCSVData* m_pCSVData;
- SwFindEntryDialog* m_pFindDlg;
+ VclPtr<SwFindEntryDialog> m_pFindDlg;
DECL_LINK(NewHdl_Impl, void *);
DECL_LINK(DeleteHdl_Impl, void *);
@@ -76,6 +76,7 @@ public:
SwCreateAddressListDialog(
vcl::Window* pParent, const OUString& rURL, SwMailMergeConfigItem& rConfig);
virtual ~SwCreateAddressListDialog();
+ virtual void dispose() SAL_OVERRIDE;
const OUString& GetURL() const { return m_sURL; }
void Find( const OUString& rSearch, sal_Int32 nColumn);
@@ -83,14 +84,14 @@ public:
class SwFindEntryDialog : public ModelessDialog
{
- Edit* m_pFindED;
- CheckBox* m_pFindOnlyCB;
- ListBox* m_pFindOnlyLB;
+ VclPtr<Edit> m_pFindED;
+ VclPtr<CheckBox> m_pFindOnlyCB;
+ VclPtr<ListBox> m_pFindOnlyLB;
- PushButton* m_pFindPB;
- CancelButton* m_pCancel;
+ VclPtr<PushButton> m_pFindPB;
+ VclPtr<CancelButton> m_pCancel;
- SwCreateAddressListDialog* m_pParent;
+ VclPtr<SwCreateAddressListDialog> m_pParent;
DECL_LINK(FindHdl_Impl, void *);
DECL_LINK(FindEnableHdl_Impl, void *);
@@ -98,6 +99,8 @@ class SwFindEntryDialog : public ModelessDialog
public:
SwFindEntryDialog(SwCreateAddressListDialog* pParent);
+ virtual ~SwFindEntryDialog();
+ virtual void dispose() SAL_OVERRIDE;
ListBox& GetFieldsListBox()
{
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
index c812fcd37a1a..7ade01841ee4 100644
--- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
@@ -24,7 +24,6 @@
#include <vcl/msgbox.hxx>
#include <dbui.hrc>
#include <helpid.h>
-#include <boost/scoped_ptr.hpp>
SwCustomizeAddressListDialog::SwCustomizeAddressListDialog(
vcl::Window* pParent, const SwCSVData& rOldData)
@@ -61,8 +60,21 @@ SwCustomizeAddressListDialog::SwCustomizeAddressListDialog(
SwCustomizeAddressListDialog::~SwCustomizeAddressListDialog()
{
+ disposeOnce();
}
+void SwCustomizeAddressListDialog::dispose()
+{
+ m_pFieldsLB.clear();
+ m_pAddPB.clear();
+ m_pDeletePB.clear();
+ m_pRenamePB.clear();
+ m_pUpPB.clear();
+ m_pDownPB.clear();
+ SfxModalDialog::dispose();
+}
+
+
IMPL_LINK_NOARG(SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl)
{
UpdateButtons();
@@ -76,11 +88,11 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton)
if(nPos == LISTBOX_ENTRY_NOTFOUND)
nPos = 0;
- boost::scoped_ptr<SwAddRenameEntryDialog> pDlg;
+ ScopedVclPtr<SwAddRenameEntryDialog> pDlg;
if (bRename)
- pDlg.reset(new SwRenameEntryDialog(pButton, m_pNewData->aDBColumnHeaders));
+ pDlg.reset(VclPtr<SwRenameEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders));
else
- pDlg.reset(new SwAddEntryDialog(pButton, m_pNewData->aDBColumnHeaders));
+ pDlg.reset(VclPtr<SwAddEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders));
if(bRename)
{
OUString aTemp = m_pFieldsLB->GetEntry(nPos);
@@ -111,7 +123,6 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton)
m_pFieldsLB->InsertEntry(sNew, nPos);
m_pFieldsLB->SelectEntryPos(nPos);
}
- pDlg.reset();
UpdateButtons();
return 0;
}
@@ -184,6 +195,18 @@ SwAddRenameEntryDialog::SwAddRenameEntryDialog(
ModifyHdl_Impl(m_pFieldNameED);
}
+SwAddRenameEntryDialog::~SwAddRenameEntryDialog()
+{
+ disposeOnce();
+}
+
+void SwAddRenameEntryDialog::dispose()
+{
+ m_pFieldNameED.clear();
+ m_pOK.clear();
+ SfxModalDialog::dispose();
+}
+
IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, Edit*, pEdit)
{
OUString sEntry = pEdit->GetText();
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
index e0592085047f..e943f657b3f3 100644
--- a/sw/source/ui/dbui/customizeaddresslistdialog.hxx
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
@@ -29,14 +29,14 @@ struct SwCSVData;
class SwCustomizeAddressListDialog : public SfxModalDialog
{
- ListBox* m_pFieldsLB;
+ VclPtr<ListBox> m_pFieldsLB;
- PushButton* m_pAddPB;
- PushButton* m_pDeletePB;
- PushButton* m_pRenamePB;
+ VclPtr<PushButton> m_pAddPB;
+ VclPtr<PushButton> m_pDeletePB;
+ VclPtr<PushButton> m_pRenamePB;
- PushButton* m_pUpPB;
- PushButton* m_pDownPB;
+ VclPtr<PushButton> m_pUpPB;
+ VclPtr<PushButton> m_pDownPB;
SwCSVData* m_pNewData;
@@ -49,20 +49,24 @@ class SwCustomizeAddressListDialog : public SfxModalDialog
public:
SwCustomizeAddressListDialog(vcl::Window* pParent, const SwCSVData& rOldData);
virtual ~SwCustomizeAddressListDialog();
+ virtual void dispose() SAL_OVERRIDE;
SwCSVData* GetNewData() { return m_pNewData;}
};
class SwAddRenameEntryDialog : public SfxModalDialog
{
- Edit* m_pFieldNameED;
- OKButton* m_pOK;
+ VclPtr<Edit> m_pFieldNameED;
+ VclPtr<OKButton> m_pOK;
const std::vector< OUString >& m_rCSVHeader;
DECL_LINK(ModifyHdl_Impl, Edit*);
protected:
SwAddRenameEntryDialog(vcl::Window* pParent, const OUString& rID,
const OUString& rUIXMLDescription, const std::vector< OUString >& rCSVHeader);
+ virtual ~SwAddRenameEntryDialog();
+ virtual void dispose() SAL_OVERRIDE;
+
public:
void SetFieldName(const OUString& rName) {m_pFieldNameED->SetText(rName);}
OUString GetFieldName() const {return m_pFieldNameED->GetText();};
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 29aa77145fdb..43c1e656c188 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -413,10 +413,41 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
SwInsertDBColAutoPilot::~SwInsertDBColAutoPilot()
{
+ disposeOnce();
+}
+
+void SwInsertDBColAutoPilot::dispose()
+{
delete pTblSet;
delete pRep;
delete pTAutoFmt;
+ m_pRbAsTable.clear();
+ m_pRbAsField.clear();
+ m_pRbAsText.clear();
+ m_pHeadFrame.clear();
+ m_pLbTblDbColumn.clear();
+ m_pLbTxtDbColumn.clear();
+ m_pFormatFrame.clear();
+ m_pRbDbFmtFromDb.clear();
+ m_pRbDbFmtFromUsr.clear();
+ m_pLbDbFmtFromUsr.clear();
+ m_pIbDbcolToEdit.clear();
+ m_pEdDbText.clear();
+ m_pFtDbParaColl.clear();
+ m_pLbDbParaColl.clear();
+ m_pIbDbcolAllTo.clear();
+ m_pIbDbcolOneTo.clear();
+ m_pIbDbcolOneFrom.clear();
+ m_pIbDbcolAllFrom.clear();
+ m_pFtTableCol.clear();
+ m_pLbTableCol.clear();
+ m_pCbTableHeadon.clear();
+ m_pRbHeadlColnms.clear();
+ m_pRbHeadlEmpty.clear();
+ m_pPbTblFormat.clear();
+ m_pPbTblAutofmt.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, Button*, pButton )
@@ -768,9 +799,9 @@ IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox )
ListBox* pGetBox = pBox == m_pLbDbFmtFromUsr
? ( m_pRbAsTable->IsChecked()
? ( 0 == m_pLbTableCol->GetEntryData( 0 )
- ? m_pLbTblDbColumn
- : m_pLbTableCol )
- : m_pLbTxtDbColumn )
+ ? m_pLbTblDbColumn.get()
+ : m_pLbTableCol.get() )
+ : m_pLbTxtDbColumn.get() )
: pBox;
SwInsDBColumn aSrch( pGetBox->GetSelectEntry(), 0 );
@@ -818,7 +849,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox )
// to know later on, what ListBox was the "active", a Flag
// is remembered in the 1st entry
- void* pPtr = pBox == m_pLbTableCol ? m_pLbTableCol : 0;
+ void* pPtr = pBox == m_pLbTableCol ? m_pLbTableCol.get() : 0;
m_pLbTableCol->SetEntryData( 0, pPtr );
}
return 0;
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx
index 4eb019abf21e..fd9e2eb34f5c 100644
--- a/sw/source/ui/dbui/dbtablepreviewdialog.cxx
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx
@@ -81,11 +81,19 @@ SwDBTablePreviewDialog::SwDBTablePreviewDialog(vcl::Window* pParent, uno::Sequen
SwDBTablePreviewDialog::~SwDBTablePreviewDialog()
{
+ disposeOnce();
+}
+
+void SwDBTablePreviewDialog::dispose()
+{
if(m_xFrame.is())
{
m_xFrame->setComponent(NULL, NULL);
m_xFrame->dispose();
}
+ m_pDescriptionFI.clear();
+ m_pBeamerWIN.clear();
+ SfxModalDialog::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.hxx b/sw/source/ui/dbui/dbtablepreviewdialog.hxx
index e99b7f457525..bae176de7b74 100644
--- a/sw/source/ui/dbui/dbtablepreviewdialog.hxx
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.hxx
@@ -31,14 +31,15 @@ namespace com{ namespace sun{ namespace star{
class SwDBTablePreviewDialog : public SfxModalDialog
{
- FixedText* m_pDescriptionFI;
- vcl::Window* m_pBeamerWIN;
+ VclPtr<FixedText> m_pDescriptionFI;
+ VclPtr<vcl::Window> m_pBeamerWIN;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame2 > m_xFrame;
public:
SwDBTablePreviewDialog(vcl::Window* pParent,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rValues );
virtual ~SwDBTablePreviewDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx
index 9a577c41edb1..068b08ffd54f 100644
--- a/sw/source/ui/dbui/mailmergewizard.cxx
+++ b/sw/source/ui/dbui/mailmergewizard.cxx
@@ -101,19 +101,19 @@ SwMailMergeWizard::~SwMailMergeWizard()
{
}
-OWizardPage* SwMailMergeWizard::createPage(WizardState _nState)
+VclPtr<TabPage> SwMailMergeWizard::createPage(WizardState _nState)
{
- OWizardPage* pRet = 0;
+ VclPtr<OWizardPage> pRet;
switch(_nState)
{
- case MM_DOCUMENTSELECTPAGE : pRet = new SwMailMergeDocSelectPage(this); break;
- case MM_OUTPUTTYPETPAGE : pRet = new SwMailMergeOutputTypePage(this); break;
- case MM_ADDRESSBLOCKPAGE : pRet = new SwMailMergeAddressBlockPage(this); break;
- case MM_GREETINGSPAGE : pRet = new SwMailMergeGreetingsPage(this); break;
- case MM_LAYOUTPAGE : pRet = new SwMailMergeLayoutPage(this); break;
- case MM_PREPAREMERGEPAGE : pRet = new SwMailMergePrepareMergePage(this); break;
- case MM_MERGEPAGE : pRet = new SwMailMergeMergePage(this); break;
- case MM_OUTPUTPAGE : pRet = new SwMailMergeOutputPage(this); break;
+ case MM_DOCUMENTSELECTPAGE : pRet = VclPtr<SwMailMergeDocSelectPage>::Create(this); break;
+ case MM_OUTPUTTYPETPAGE : pRet = VclPtr<SwMailMergeOutputTypePage>::Create(this); break;
+ case MM_ADDRESSBLOCKPAGE : pRet = VclPtr<SwMailMergeAddressBlockPage>::Create(this); break;
+ case MM_GREETINGSPAGE : pRet = VclPtr<SwMailMergeGreetingsPage>::Create(this); break;
+ case MM_LAYOUTPAGE : pRet = VclPtr<SwMailMergeLayoutPage>::Create(this); break;
+ case MM_PREPAREMERGEPAGE : pRet = VclPtr<SwMailMergePrepareMergePage>::Create(this); break;
+ case MM_MERGEPAGE : pRet = VclPtr<SwMailMergeMergePage>::Create(this); break;
+ case MM_OUTPUTPAGE : pRet = VclPtr<SwMailMergeOutputPage>::Create(this); break;
}
OSL_ENSURE(pRet, "no page created in ::createPage");
return pRet;
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 44d7ff52b384..37a06cc86276 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -93,6 +93,32 @@ SwMailMergeAddressBlockPage::SwMailMergeAddressBlockPage( SwMailMergeWizard* _pP
m_pNextSetIB->SetClickHdl(aLink);
}
+SwMailMergeAddressBlockPage::~SwMailMergeAddressBlockPage()
+{
+ disposeOnce();
+}
+
+void SwMailMergeAddressBlockPage::dispose()
+{
+ m_pAddressListPB.clear();
+ m_pCurrentAddressFI.clear();
+ m_pStep2.clear();
+ m_pStep3.clear();
+ m_pStep4.clear();
+ m_pSettingsFI.clear();
+ m_pAddressCB.clear();
+ m_pSettingsWIN.clear();
+ m_pSettingsPB.clear();
+ m_pHideEmptyParagraphsCB.clear();
+ m_pAssignPB.clear();
+ m_pPreviewWIN.clear();
+ m_pDocumentIndexFI.clear();
+ m_pPrevSetIB.clear();
+ m_pNextSetIB.clear();
+ m_pWizard.clear();
+ svt::OWizardPage::dispose();
+}
+
bool SwMailMergeAddressBlockPage::canAdvance() const
{
return m_pWizard->GetConfigItem().GetResultSet().is();
@@ -137,7 +163,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl)
{
try
{
- boost::scoped_ptr<SwAddressListDialog> xAddrDialog(new SwAddressListDialog(this));
+ VclPtrInstance< SwAddressListDialog > xAddrDialog(this);
if(RET_OK == xAddrDialog->Execute())
{
SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
@@ -163,8 +189,8 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl)
IMPL_LINK(SwMailMergeAddressBlockPage, SettingsHdl_Impl, PushButton*, pButton)
{
- boost::scoped_ptr<SwSelectAddressBlockDialog> pDlg(
- new SwSelectAddressBlockDialog(pButton, m_pWizard->GetConfigItem()));
+ VclPtr<SwSelectAddressBlockDialog> pDlg(
+ VclPtr<SwSelectAddressBlockDialog>::Create(pButton, m_pWizard->GetConfigItem()));
SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
pDlg->SetAddressBlocks(rConfig.GetAddressBlocks(), m_pSettingsWIN->GetSelectedAddress());
pDlg->SetSettings(rConfig.IsIncludeCountry(), rConfig.GetExcludeCountry());
@@ -193,8 +219,8 @@ IMPL_LINK(SwMailMergeAddressBlockPage, AssignHdl_Impl, PushButton*, pButton)
SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
const sal_uInt16 nSel = m_pSettingsWIN->GetSelectedAddress();
const uno::Sequence< OUString> aBlocks = rConfigItem.GetAddressBlocks();
- boost::scoped_ptr<SwAssignFieldsDialog> pDlg(
- new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), aBlocks[nSel], true));
+ VclPtr<SwAssignFieldsDialog> pDlg(
+ VclPtr<SwAssignFieldsDialog>::Create(pButton, m_pWizard->GetConfigItem(), aBlocks[nSel], true));
if(RET_OK == pDlg->Execute())
{
//preview update
@@ -330,6 +356,20 @@ SwSelectAddressBlockDialog::SwSelectAddressBlockDialog(
SwSelectAddressBlockDialog::~SwSelectAddressBlockDialog()
{
+ disposeOnce();
+}
+
+void SwSelectAddressBlockDialog::dispose()
+{
+ m_pPreview.clear();
+ m_pNewPB.clear();
+ m_pCustomizePB.clear();
+ m_pDeletePB.clear();
+ m_pNeverRB.clear();
+ m_pAlwaysRB.clear();
+ m_pDependentRB.clear();
+ m_pCountryED.clear();
+ SfxModalDialog::dispose();
}
void SwSelectAddressBlockDialog::SetAddressBlocks(const uno::Sequence< OUString>& rBlocks,
@@ -413,8 +453,8 @@ IMPL_LINK(SwSelectAddressBlockDialog, NewCustomizeHdl_Impl, PushButton*, pButton
SwCustomizeAddressBlockDialog::DialogType nType = bCustomize ?
SwCustomizeAddressBlockDialog::ADDRESSBLOCK_EDIT :
SwCustomizeAddressBlockDialog::ADDRESSBLOCK_NEW;
- boost::scoped_ptr<SwCustomizeAddressBlockDialog> pDlg(
- new SwCustomizeAddressBlockDialog(pButton,m_rConfig,nType));
+ VclPtr<SwCustomizeAddressBlockDialog> pDlg(
+ VclPtr<SwCustomizeAddressBlockDialog>::Create(pButton,m_rConfig,nType));
if(bCustomize)
{
pDlg->SetAddress(m_aAddressBlocks[m_pPreview->GetSelectedAddress()]);
@@ -533,6 +573,26 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog(
SwCustomizeAddressBlockDialog::~SwCustomizeAddressBlockDialog()
{
+ disposeOnce();
+}
+
+void SwCustomizeAddressBlockDialog::dispose()
+{
+ m_pAddressElementsFT.clear();
+ m_pAddressElementsLB.clear();
+ m_pInsertFieldIB.clear();
+ m_pRemoveFieldIB.clear();
+ m_pDragFT.clear();
+ m_pDragED.clear();
+ m_pUpIB.clear();
+ m_pLeftIB.clear();
+ m_pRightIB.clear();
+ m_pDownIB.clear();
+ m_pFieldFT.clear();
+ m_pFieldCB.clear();
+ m_pPreviewWIN.clear();
+ m_pOK.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, OKHdl_Impl)
@@ -746,13 +806,13 @@ OUString SwCustomizeAddressBlockDialog::GetAddress()
class SwAssignFieldsControl : public Control
{
friend class SwAssignFieldsDialog;
- ScrollBar m_aVScroll;
- HeaderBar m_aHeaderHB;
- Window m_aWindow;
+ VclPtr<ScrollBar> m_aVScroll;
+ VclPtr<HeaderBar> m_aHeaderHB;
+ VclPtr<Window> m_aWindow;
- ::std::vector<FixedText*> m_aFieldNames;
- ::std::vector<ListBox*> m_aMatches;
- ::std::vector<FixedText*> m_aPreviews;
+ ::std::vector<VclPtr<FixedText> > m_aFieldNames;
+ ::std::vector<VclPtr<ListBox> > m_aMatches;
+ ::std::vector<VclPtr<FixedText> > m_aPreviews;
SwMailMergeConfigItem* m_rConfigItem;
@@ -773,6 +833,7 @@ class SwAssignFieldsControl : public Control
public:
SwAssignFieldsControl(vcl::Window* pParent, WinBits nBits);
virtual ~SwAssignFieldsControl();
+ virtual void dispose() SAL_OVERRIDE;
void Init(SwMailMergeConfigItem& rConfigItem);
void SetModifyHdl(const Link& rModifyHdl)
@@ -791,23 +852,23 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAssignFieldsControl(
SwAssignFieldsControl::SwAssignFieldsControl(vcl::Window* pParent, WinBits nBits) :
Control(pParent, nBits | WB_DIALOGCONTROL | WB_TABSTOP | WB_DIALOGCONTROL),
- m_aVScroll(this),
- m_aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
- m_aWindow(this, WB_BORDER | WB_DIALOGCONTROL),
+ m_aVScroll(VclPtr<ScrollBar>::Create(this)),
+ m_aHeaderHB(VclPtr<HeaderBar>::Create(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER)),
+ m_aWindow(VclPtr<vcl::Window>::Create(this, WB_BORDER | WB_DIALOGCONTROL)),
m_rConfigItem(NULL),
m_nLBStartTopPos(0),
m_nYOffset(0),
m_nFirstYPos(0)
{
- long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height();
+ long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height();
Size aOutputSize(GetOutputSize());
- m_aVScroll.Show();
- m_aHeaderHB.SetSizePixel(
+ m_aVScroll->Show();
+ m_aHeaderHB->SetSizePixel(
Size(aOutputSize.Width(), nHBHeight));
- m_aHeaderHB.Show();
- m_aWindow.SetPosPixel(Point( 0, nHBHeight) );
- m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
- m_aWindow.Show();
+ m_aHeaderHB->Show();
+ m_aWindow->SetPosPixel(Point( 0, nHBHeight) );
+ m_aWindow->SetSizePixel(Size(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
+ m_aWindow->Show();
}
Size SwAssignFieldsControl::GetOptimalSize() const
@@ -819,7 +880,7 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem)
{
m_rConfigItem = &rConfigItem;
Size aOutputSize(GetOutputSize());
- long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height();
+ long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height();
//get the name of the default headers
const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders();
@@ -845,9 +906,9 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem)
for(sal_uInt32 i = 0; i < rHeaders.Count(); ++i)
{
const OUString rHeader = rHeaders.GetString( i );
- FixedText* pNewText = new FixedText(&m_aWindow, WB_VCENTER);
+ VclPtr<FixedText> pNewText = VclPtr<FixedText>::Create(m_aWindow.get(), WB_VCENTER);
pNewText->SetText("<" + rHeader + ">");
- ListBox* pNewLB = new ListBox(&m_aWindow, WB_DROPDOWN | WB_VCENTER | WB_TABSTOP);
+ VclPtr<ListBox> pNewLB = VclPtr<ListBox>::Create(m_aWindow.get(), WB_DROPDOWN | WB_VCENTER | WB_TABSTOP);
pNewText->set_mnemonic_widget(pNewLB);
pNewLB->InsertEntry(SW_RESSTR(SW_STR_NONE));
pNewLB->SelectEntryPos(0);
@@ -861,7 +922,7 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem)
for(sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
pNewLB->InsertEntry(pFields[nField]);
- FixedText* pNewPreview = new FixedText(&m_aWindow, WB_VCENTER);
+ VclPtr<FixedText> pNewPreview = VclPtr<FixedText>::Create(m_aWindow.get(), WB_VCENTER);
pNewText->SetSizePixel(Size(nControlWidth - 6, nControlHeight));
pNewLB->SetSizePixel(Size(nControlWidth - 6, nControlHeight));
pNewPreview->SetSizePixel(Size(aOutputSize.Width() - 2 * nControlWidth, nControlHeight));
@@ -911,26 +972,38 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem)
pNewPreview->Show();
pNewPreview->SetPosPixel(Point(2 * nControlWidth + 6, nMove));
}
- m_aVScroll.SetRange(Range(0, rHeaders.Count()));
- m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset);
- m_aVScroll.EnableDrag();
- m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize());
- m_aVScroll.SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl));
+ m_aVScroll->SetRange(Range(0, rHeaders.Count()));
+ m_aVScroll->SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset);
+ m_aVScroll->EnableDrag();
+ m_aVScroll->SetVisibleSize(m_aVScroll->GetPageSize());
+ m_aVScroll->SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl));
- m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight));
- m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
+ m_aVScroll->SetPosPixel(Point(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), nHBHeight));
+ m_aVScroll->SetSizePixel(Size(m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
}
SwAssignFieldsControl::~SwAssignFieldsControl()
{
- ::std::vector<FixedText*>::iterator aFIIter;
- for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter)
- delete *aFIIter;
- ::std::vector<ListBox*>::iterator aLBIter;
- for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter)
- delete *aLBIter;
- for(aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter)
- delete *aFIIter;
+ disposeOnce();
+}
+
+void SwAssignFieldsControl::dispose()
+{
+ for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter)
+ aFIIter->disposeAndClear();
+ for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter)
+ aLBIter->disposeAndClear();
+ for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter)
+ aFIIter->disposeAndClear();
+
+ m_aFieldNames.clear();
+ m_aMatches.clear();
+ m_aPreviews.clear();
+
+ m_aVScroll.disposeAndClear();
+ m_aHeaderHB.disposeAndClear();
+ m_aWindow.disposeAndClear();
+ Control::dispose();
}
void SwAssignFieldsControl::Resize()
@@ -938,22 +1011,22 @@ void SwAssignFieldsControl::Resize()
Window::Resize();
Size aOutputSize = GetOutputSize();
- long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height();
+ long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height();
- m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
+ m_aWindow->SetSizePixel(Size(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
- m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight));
- m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
+ m_aVScroll->SetPosPixel(Point(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), nHBHeight));
+ m_aVScroll->SetSizePixel(Size(m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
if(m_nYOffset)
- m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset);
- m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize());
- m_aVScroll.DoScroll(0);
+ m_aVScroll->SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset);
+ m_aVScroll->SetVisibleSize(m_aVScroll->GetPageSize());
+ m_aVScroll->DoScroll(0);
sal_Int32 nColWidth = aOutputSize.Width() / 3;
- m_aHeaderHB.SetSizePixel(Size(aOutputSize.Width(), nHBHeight));
- m_aHeaderHB.SetItemSize(1, nColWidth);
- m_aHeaderHB.SetItemSize(2, nColWidth);
- m_aHeaderHB.SetItemSize(3, nColWidth);
+ m_aHeaderHB->SetSizePixel(Size(aOutputSize.Width(), nHBHeight));
+ m_aHeaderHB->SetItemSize(1, nColWidth);
+ m_aHeaderHB->SetItemSize(2, nColWidth);
+ m_aHeaderHB->SetItemSize(3, nColWidth);
if (m_aFieldNames.empty() || m_aMatches.empty())
return;
@@ -961,16 +1034,14 @@ void SwAssignFieldsControl::Resize()
long nControlHeight = std::max(m_aFieldNames[0]->get_preferred_size().Height(),
m_aMatches[0]->get_preferred_size().Height());
- ::std::vector<FixedText*>::iterator aFIIter;
- for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter)
+ for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter)
(*aFIIter)->SetSizePixel(Size(nColWidth - 6, nControlHeight));
- ::std::vector<ListBox*>::iterator aLBIter;
- for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter)
+ for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter)
{
long nPosY = (*aLBIter)->GetPosPixel().Y();
(*aLBIter)->SetPosSizePixel(Point(nColWidth, nPosY), Size(nColWidth - 6, nControlHeight));
}
- for(aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter)
+ for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter)
{
long nPosY = (*aFIIter)->GetPosPixel().Y();
(*aFIIter)->SetPosSizePixel(Point(2 * nColWidth + 6, nPosY), Size(nColWidth, nControlHeight));
@@ -988,7 +1059,7 @@ void SwAssignFieldsControl::Command( const CommandEvent& rCEvt )
const CommandWheelData* pWheelData = rCEvt.GetWheelData();
if(pWheelData && !pWheelData->IsHorz() && CommandWheelMode::ZOOM != pWheelData->GetMode())
{
- HandleScrollCommand( rCEvt, 0, &m_aVScroll );
+ HandleScrollCommand( rCEvt, 0, m_aVScroll.get() );
}
}
break;
@@ -1014,15 +1085,15 @@ bool SwAssignFieldsControl::PreNotify( NotifyEvent& rNEvt )
void SwAssignFieldsControl::MakeVisible( sal_Int32 nIndex )
{
- long nThumb = m_aVScroll.GetThumbPos();
- long nPage = m_aVScroll.GetPageSize();
+ long nThumb = m_aVScroll->GetThumbPos();
+ long nPage = m_aVScroll->GetPageSize();
if(nThumb > nIndex)
- m_aVScroll.SetThumbPos( nIndex );
+ m_aVScroll->SetThumbPos( nIndex );
else if( (nThumb + nPage) < nIndex)
- m_aVScroll.SetThumbPos( nIndex - nPage );
+ m_aVScroll->SetThumbPos( nIndex - nPage );
else
return;
- ScrollHdl_Impl( &m_aVScroll );
+ ScrollHdl_Impl( m_aVScroll.get() );
}
IMPL_LINK(SwAssignFieldsControl, ScrollHdl_Impl, ScrollBar*, pScroll)
@@ -1035,14 +1106,11 @@ IMPL_LINK(SwAssignFieldsControl, ScrollHdl_Impl, ScrollBar*, pScroll)
long nMove = m_nFirstYPos - (*m_aMatches.begin())->GetPosPixel().Y() - (nThumb * m_nYOffset);
SetUpdateMode(false);
- long nIndex;
- ::std::vector<FixedText*>::iterator aFIIter;
- for(nIndex = 0, aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter, ++nIndex)
+ for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter)
lcl_Move(*aFIIter, nMove);
- ::std::vector<ListBox*>::iterator aLBIter;
- for(nIndex = 0, aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex)
+ for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter)
lcl_Move(*aLBIter, nMove);
- for(nIndex = 0, aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter, ++nIndex)
+ for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter)
lcl_Move(*aFIIter, nMove);
SetUpdateMode(true);
@@ -1071,9 +1139,8 @@ IMPL_LINK(SwAssignFieldsControl, MatchHdl_Impl, ListBox*, pBox)
}
}
}
- ::std::vector<ListBox*>::iterator aLBIter;
sal_Int32 nIndex = 0;
- for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex)
+ for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex)
{
if(*aLBIter == pBox)
{
@@ -1090,8 +1157,7 @@ IMPL_LINK(SwAssignFieldsControl, GotFocusHdl_Impl, ListBox*, pBox)
if(0 != (GETFOCUS_TAB & pBox->GetGetFocusFlags()))
{
sal_Int32 nIndex = 0;
- ::std::vector<ListBox*>::iterator aLBIter;
- for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex)
+ for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex)
{
if(*aLBIter == pBox)
{
@@ -1132,13 +1198,13 @@ SwAssignFieldsDialog::SwAssignFieldsDialog(
sAddressElement = SW_RESSTR(ST_SALUTATIONELEMENT);
}
- Size aOutputSize(m_pFieldsControl->m_aHeaderHB.GetSizePixel());
+ Size aOutputSize(m_pFieldsControl->m_aHeaderHB->GetSizePixel());
sal_Int32 nFirstWidth;
sal_Int32 nSecondWidth = nFirstWidth = aOutputSize.Width() / 3;
const HeaderBarItemBits nHeadBits = HeaderBarItemBits::VCENTER | HeaderBarItemBits::FIXED| HeaderBarItemBits::FIXEDPOS;
- m_pFieldsControl->m_aHeaderHB.InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HeaderBarItemBits::LEFT);
- m_pFieldsControl->m_aHeaderHB.InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT);
- m_pFieldsControl->m_aHeaderHB.InsertItem( 3, sPreview,
+ m_pFieldsControl->m_aHeaderHB->InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HeaderBarItemBits::LEFT);
+ m_pFieldsControl->m_aHeaderHB->InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT);
+ m_pFieldsControl->m_aHeaderHB->InsertItem( 3, sPreview,
aOutputSize.Width() - nFirstWidth - nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT);
m_pFieldsControl->SetModifyHdl(LINK(this, SwAssignFieldsDialog, AssignmentModifyHdl_Impl ));
@@ -1150,6 +1216,17 @@ SwAssignFieldsDialog::SwAssignFieldsDialog(
SwAssignFieldsDialog::~SwAssignFieldsDialog()
{
+ disposeOnce();
+}
+
+void SwAssignFieldsDialog::dispose()
+{
+ m_pMatchingFI.clear();
+ m_pFieldsControl.clear();
+ m_pPreviewFI.clear();
+ m_pPreviewWIN.clear();
+ m_pOK.clear();
+ SfxModalDialog::dispose();
}
uno::Sequence< OUString > SwAssignFieldsDialog::CreateAssignments()
@@ -1157,9 +1234,8 @@ uno::Sequence< OUString > SwAssignFieldsDialog::CreateAssignments()
uno::Sequence< OUString > aAssignments(
m_rConfigItem.GetDefaultAddressHeaders().Count());
OUString* pAssignments = aAssignments.getArray();
- ::std::vector<ListBox*>::iterator aLBIter;
sal_Int32 nIndex = 0;
- for(aLBIter = m_pFieldsControl->m_aMatches.begin();
+ for(auto aLBIter = m_pFieldsControl->m_aMatches.begin();
aLBIter != m_pFieldsControl->m_aMatches.end();
++aLBIter, ++nIndex)
{
@@ -1202,6 +1278,18 @@ DDListBox::DDListBox(vcl::Window* pParent, WinBits nStyle)
}
+DDListBox::~DDListBox()
+{
+ disposeOnce();
+}
+
+void DDListBox::dispose()
+{
+ m_pParentDialog.clear();
+ SvTreeListBox::dispose();
+}
+
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeDDListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap)
{
WinBits nWinStyle = WB_TABSTOP;
@@ -1246,6 +1334,19 @@ AddressMultiLineEdit::AddressMultiLineEdit(vcl::Window* pParent, WinBits nBits)
EnableFocusSelectionHide(false);
}
+AddressMultiLineEdit::~AddressMultiLineEdit()
+{
+ disposeOnce();
+}
+
+void AddressMultiLineEdit::dispose()
+{
+ EndListening(*GetTextEngine());
+ m_pParentDialog.clear();
+ VclMultiLineEdit::dispose();
+}
+
+
Size AddressMultiLineEdit::GetOptimalSize() const
{
return LogicToPixel(Size(160, 60), MAP_APPFONT);
@@ -1265,11 +1366,6 @@ void AddressMultiLineEdit::SetAddressDialog(SwCustomizeAddressBlockDialog *pPare
m_pParentDialog = pParent;
}
-AddressMultiLineEdit::~AddressMultiLineEdit()
-{
- EndListening(*GetTextEngine());
-}
-
void AddressMultiLineEdit::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
{
if (m_aSelectionLink.IsSet() && dynamic_cast<const TextHint*>(&rHint))
diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx
index 6824bed6f897..2f93a750f1b1 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.hxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.hxx
@@ -37,31 +37,31 @@ class SwMailMergeConfigItem;
class SwMailMergeAddressBlockPage : public svt::OWizardPage
{
- PushButton* m_pAddressListPB;
- FixedText* m_pCurrentAddressFI;
+ VclPtr<PushButton> m_pAddressListPB;
+ VclPtr<FixedText> m_pCurrentAddressFI;
- VclContainer* m_pStep2;
- VclContainer* m_pStep3;
- VclContainer* m_pStep4;
+ VclPtr<VclContainer> m_pStep2;
+ VclPtr<VclContainer> m_pStep3;
+ VclPtr<VclContainer> m_pStep4;
- FixedText* m_pSettingsFI;
- CheckBox* m_pAddressCB;
- SwAddressPreview* m_pSettingsWIN;
- PushButton* m_pSettingsPB;
- CheckBox* m_pHideEmptyParagraphsCB;
+ VclPtr<FixedText> m_pSettingsFI;
+ VclPtr<CheckBox> m_pAddressCB;
+ VclPtr<SwAddressPreview> m_pSettingsWIN;
+ VclPtr<PushButton> m_pSettingsPB;
+ VclPtr<CheckBox> m_pHideEmptyParagraphsCB;
- PushButton* m_pAssignPB;
+ VclPtr<PushButton> m_pAssignPB;
- SwAddressPreview* m_pPreviewWIN;
- FixedText* m_pDocumentIndexFI;
- PushButton* m_pPrevSetIB;
- PushButton* m_pNextSetIB;
+ VclPtr<SwAddressPreview> m_pPreviewWIN;
+ VclPtr<FixedText> m_pDocumentIndexFI;
+ VclPtr<PushButton> m_pPrevSetIB;
+ VclPtr<PushButton> m_pNextSetIB;
OUString m_sDocument;
OUString m_sCurrentAddress;
OUString m_sChangeAddress;
- SwMailMergeWizard* m_pWizard;
+ VclPtr<SwMailMergeWizard> m_pWizard;
DECL_LINK(AddressListHdl_Impl, void *);
DECL_LINK(SettingsHdl_Impl, PushButton*);
@@ -79,20 +79,22 @@ class SwMailMergeAddressBlockPage : public svt::OWizardPage
public:
SwMailMergeAddressBlockPage(SwMailMergeWizard* _pParent);
+ virtual ~SwMailMergeAddressBlockPage();
+ virtual void dispose() SAL_OVERRIDE;
SwMailMergeWizard* GetWizard() { return m_pWizard; }
};
class SwSelectAddressBlockDialog : public SfxModalDialog
{
- SwAddressPreview* m_pPreview;
- PushButton* m_pNewPB;
- PushButton* m_pCustomizePB;
- PushButton* m_pDeletePB;
+ VclPtr<SwAddressPreview> m_pPreview;
+ VclPtr<PushButton> m_pNewPB;
+ VclPtr<PushButton> m_pCustomizePB;
+ VclPtr<PushButton> m_pDeletePB;
- RadioButton* m_pNeverRB;
- RadioButton* m_pAlwaysRB;
- RadioButton* m_pDependentRB;
- Edit* m_pCountryED;
+ VclPtr<RadioButton> m_pNeverRB;
+ VclPtr<RadioButton> m_pAlwaysRB;
+ VclPtr<RadioButton> m_pDependentRB;
+ VclPtr<Edit> m_pCountryED;
com::sun::star::uno::Sequence< OUString> m_aAddressBlocks;
SwMailMergeConfigItem& m_rConfig;
@@ -106,6 +108,7 @@ class SwSelectAddressBlockDialog : public SfxModalDialog
public:
SwSelectAddressBlockDialog(vcl::Window* pParent, SwMailMergeConfigItem& rConfig);
virtual ~SwSelectAddressBlockDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetAddressBlocks(const com::sun::star::uno::Sequence< OUString>& rBlocks,
sal_uInt16 nSelected);
@@ -119,9 +122,11 @@ public:
class SwCustomizeAddressBlockDialog;
class DDListBox : public SvTreeListBox
{
- SwCustomizeAddressBlockDialog* m_pParentDialog;
+ VclPtr<SwCustomizeAddressBlockDialog> m_pParentDialog;
public:
DDListBox(vcl::Window* pParent, const WinBits nStyle);
+ virtual ~DDListBox();
+ virtual void dispose() SAL_OVERRIDE;
void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent);
@@ -136,7 +141,7 @@ public:
class AddressMultiLineEdit : public VclMultiLineEdit, public SfxListener
{
Link m_aSelectionLink;
- SwCustomizeAddressBlockDialog* m_pParentDialog;
+ VclPtr<SwCustomizeAddressBlockDialog> m_pParentDialog;
using VclMultiLineEdit::Notify;
@@ -147,6 +152,7 @@ protected:
public:
AddressMultiLineEdit(vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER);
virtual ~AddressMultiLineEdit();
+ virtual void dispose() SAL_OVERRIDE;
void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent);
@@ -183,26 +189,26 @@ public:
GREETING_MALE
};
private:
- FixedText* m_pAddressElementsFT;
- DDListBox* m_pAddressElementsLB;
+ VclPtr<FixedText> m_pAddressElementsFT;
+ VclPtr<DDListBox> m_pAddressElementsLB;
- PushButton* m_pInsertFieldIB;
- PushButton* m_pRemoveFieldIB;
+ VclPtr<PushButton> m_pInsertFieldIB;
+ VclPtr<PushButton> m_pRemoveFieldIB;
- FixedText* m_pDragFT;
- AddressMultiLineEdit* m_pDragED;
- PushButton* m_pUpIB;
- PushButton* m_pLeftIB;
- PushButton* m_pRightIB;
- PushButton* m_pDownIB;
+ VclPtr<FixedText> m_pDragFT;
+ VclPtr<AddressMultiLineEdit> m_pDragED;
+ VclPtr<PushButton> m_pUpIB;
+ VclPtr<PushButton> m_pLeftIB;
+ VclPtr<PushButton> m_pRightIB;
+ VclPtr<PushButton> m_pDownIB;
- FixedText* m_pFieldFT;
- ComboBox* m_pFieldCB;
+ VclPtr<FixedText> m_pFieldFT;
+ VclPtr<ComboBox> m_pFieldCB;
TextFilter m_aTextFilter;
- SwAddressPreview* m_pPreviewWIN;
+ VclPtr<SwAddressPreview> m_pPreviewWIN;
- OKButton* m_pOK;
+ VclPtr<OKButton> m_pOK;
::std::vector<OUString> m_aSalutations;
::std::vector<OUString> m_aPunctuations;
@@ -228,6 +234,7 @@ private:
public:
SwCustomizeAddressBlockDialog(vcl::Window* pParent, SwMailMergeConfigItem& rConfig, DialogType);
virtual ~SwCustomizeAddressBlockDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetAddress(const OUString& rAddress);
OUString GetAddress();
@@ -236,14 +243,13 @@ public:
class SwAssignFieldsControl;
class SwAssignFieldsDialog : public SfxModalDialog
{
- FixedText *m_pMatchingFI;
- SwAssignFieldsControl *m_pFieldsControl;
+ VclPtr<FixedText> m_pMatchingFI;
+ VclPtr<SwAssignFieldsControl> m_pFieldsControl;
- FixedText *m_pPreviewFI;
- SwAddressPreview *m_pPreviewWIN;
+ VclPtr<FixedText> m_pPreviewFI;
+ VclPtr<SwAddressPreview> m_pPreviewWIN;
-
- OKButton *m_pOK;
+ VclPtr<OKButton> m_pOK;
OUString m_sNone;
OUString m_rPreviewString;
@@ -260,6 +266,7 @@ public:
const OUString& rPreview,
bool bIsAddressBlock);
virtual ~SwAssignFieldsDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx
index 85440c6a4833..50fe45c17446 100644
--- a/sw/source/ui/dbui/mmdocselectpage.cxx
+++ b/sw/source/ui/dbui/mmdocselectpage.cxx
@@ -92,6 +92,21 @@ SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(SwMailMergeWizard* pParent)
SwMailMergeDocSelectPage::~SwMailMergeDocSelectPage()
{
+ disposeOnce();
+}
+
+void SwMailMergeDocSelectPage::dispose()
+{
+ m_pCurrentDocRB.clear();
+ m_pNewDocRB.clear();
+ m_pLoadDocRB.clear();
+ m_pLoadTemplateRB.clear();
+ m_pRecentDocRB.clear();
+ m_pBrowseDocPB.clear();
+ m_pBrowseTemplatePB.clear();
+ m_pRecentDocLB.clear();
+ m_pWizard.clear();
+ svt::OWizardPage::dispose();
}
IMPL_LINK(SwMailMergeDocSelectPage, DocSelectHdl, RadioButton*, pButton)
@@ -111,7 +126,7 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, PushButton*, pButton)
if(bTemplate)
{
m_pLoadTemplateRB->Check();
- boost::scoped_ptr<SfxNewFileDialog> pNewFileDlg(new SfxNewFileDialog(this, 0));
+ VclPtrInstance< SfxNewFileDialog > pNewFileDlg(this, 0);
sal_uInt16 nRet = pNewFileDlg->Execute();
if(RET_TEMPLATE_LOAD == nRet)
bTemplate = false;
diff --git a/sw/source/ui/dbui/mmdocselectpage.hxx b/sw/source/ui/dbui/mmdocselectpage.hxx
index b2e241270faf..931fc4dbfce4 100644
--- a/sw/source/ui/dbui/mmdocselectpage.hxx
+++ b/sw/source/ui/dbui/mmdocselectpage.hxx
@@ -28,21 +28,21 @@ class SwMailMergeWizard;
class SwMailMergeDocSelectPage : public svt::OWizardPage
{
- RadioButton* m_pCurrentDocRB;
- RadioButton* m_pNewDocRB;
- RadioButton* m_pLoadDocRB;
- RadioButton* m_pLoadTemplateRB;
- RadioButton* m_pRecentDocRB;
+ VclPtr<RadioButton> m_pCurrentDocRB;
+ VclPtr<RadioButton> m_pNewDocRB;
+ VclPtr<RadioButton> m_pLoadDocRB;
+ VclPtr<RadioButton> m_pLoadTemplateRB;
+ VclPtr<RadioButton> m_pRecentDocRB;
- PushButton* m_pBrowseDocPB;
- PushButton* m_pBrowseTemplatePB;
+ VclPtr<PushButton> m_pBrowseDocPB;
+ VclPtr<PushButton> m_pBrowseTemplatePB;
- ListBox* m_pRecentDocLB;
+ VclPtr<ListBox> m_pRecentDocLB;
OUString m_sLoadFileName;
OUString m_sLoadTemplateName;
- SwMailMergeWizard* m_pWizard;
+ VclPtr<SwMailMergeWizard> m_pWizard;
DECL_LINK(DocSelectHdl, RadioButton*);
DECL_LINK(FileSelectHdl, PushButton*);
@@ -52,6 +52,7 @@ class SwMailMergeDocSelectPage : public svt::OWizardPage
public:
SwMailMergeDocSelectPage( SwMailMergeWizard* _pParent);
virtual ~SwMailMergeDocSelectPage();
+ virtual void dispose() SAL_OVERRIDE;
};
diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx
index 7355613e3ad2..717b1e1be2a3 100644
--- a/sw/source/ui/dbui/mmgreetingspage.cxx
+++ b/sw/source/ui/dbui/mmgreetingspage.cxx
@@ -106,8 +106,8 @@ IMPL_LINK_NOARG(SwGreetingsHandler, IndividualHdl_Impl)
IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, PushButton*, pButton)
{
- boost::scoped_ptr<SwCustomizeAddressBlockDialog> pDlg(
- new SwCustomizeAddressBlockDialog(pButton, m_pWizard->GetConfigItem(),
+ VclPtr<SwCustomizeAddressBlockDialog> pDlg(
+ VclPtr<SwCustomizeAddressBlockDialog>::Create(pButton, m_pWizard->GetConfigItem(),
pButton == m_pMalePB ?
SwCustomizeAddressBlockDialog::GREETING_MALE :
SwCustomizeAddressBlockDialog::GREETING_FEMALE ));
@@ -133,8 +133,8 @@ void SwGreetingsHandler::UpdatePreview()
IMPL_LINK(SwMailMergeGreetingsPage, AssignHdl_Impl, PushButton*, pButton)
{
const OUString sPreview(m_pFemaleLB->GetSelectEntry() + "\n" + m_pMaleLB->GetSelectEntry());
- boost::scoped_ptr<SwAssignFieldsDialog> pDlg(
- new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), sPreview, false));
+ VclPtr<SwAssignFieldsDialog> pDlg(
+ VclPtr<SwAssignFieldsDialog>::Create(pButton, m_pWizard->GetConfigItem(), sPreview, false));
if(RET_OK == pDlg->Execute())
{
UpdatePreview();
@@ -292,6 +292,18 @@ SwMailMergeGreetingsPage::SwMailMergeGreetingsPage(SwMailMergeWizard* _pParent)
SwMailMergeGreetingsPage::~SwMailMergeGreetingsPage()
{
+ disposeOnce();
+}
+
+void SwMailMergeGreetingsPage::dispose()
+{
+ m_pPreviewFI.clear();
+ m_pPreviewWIN.clear();
+ m_pAssignPB.clear();
+ m_pDocumentIndexFI.clear();
+ m_pPrevSetIB.clear();
+ m_pNextSetIB.clear();
+ svt::OWizardPage::dispose();
}
void SwMailMergeGreetingsPage::ActivatePage()
@@ -472,6 +484,15 @@ SwMailBodyDialog::SwMailBodyDialog(vcl::Window* pParent, SwMailMergeWizard* _pWi
SwMailBodyDialog::~SwMailBodyDialog()
{
+ disposeOnce();
+}
+
+void SwMailBodyDialog::dispose()
+{
+ m_pBodyFT.clear();
+ m_pBodyMLE.clear();
+ m_pOK.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK(SwMailBodyDialog, ContainsHdl_Impl, CheckBox*, pBox)
diff --git a/sw/source/ui/dbui/mmgreetingspage.hxx b/sw/source/ui/dbui/mmgreetingspage.hxx
index d74b54224df9..d351191b6121 100644
--- a/sw/source/ui/dbui/mmgreetingspage.hxx
+++ b/sw/source/ui/dbui/mmgreetingspage.hxx
@@ -33,30 +33,30 @@ class SwMailMergeWizard;
class SwGreetingsHandler
{
protected:
- CheckBox* m_pGreetingLineCB;
+ VclPtr<CheckBox> m_pGreetingLineCB;
- CheckBox* m_pPersonalizedCB;
+ VclPtr<CheckBox> m_pPersonalizedCB;
- FixedText* m_pFemaleFT;
- ListBox* m_pFemaleLB;
- PushButton* m_pFemalePB;
+ VclPtr<FixedText> m_pFemaleFT;
+ VclPtr<ListBox> m_pFemaleLB;
+ VclPtr<PushButton> m_pFemalePB;
- FixedText* m_pMaleFT;
- ListBox* m_pMaleLB;
- PushButton* m_pMalePB;
+ VclPtr<FixedText> m_pMaleFT;
+ VclPtr<ListBox> m_pMaleLB;
+ VclPtr<PushButton> m_pMalePB;
- FixedText* m_pFemaleFI;
- FixedText* m_pFemaleColumnFT;
- ListBox* m_pFemaleColumnLB;
- FixedText* m_pFemaleFieldFT;
- ComboBox* m_pFemaleFieldCB;
+ VclPtr<FixedText> m_pFemaleFI;
+ VclPtr<FixedText> m_pFemaleColumnFT;
+ VclPtr<ListBox> m_pFemaleColumnLB;
+ VclPtr<FixedText> m_pFemaleFieldFT;
+ VclPtr<ComboBox> m_pFemaleFieldCB;
- FixedText* m_pNeutralFT;
- ComboBox* m_pNeutralCB;
+ VclPtr<FixedText> m_pNeutralFT;
+ VclPtr<ComboBox> m_pNeutralCB;
bool m_bIsTabPage;
- SwMailMergeWizard* m_pWizard;
+ VclPtr<SwMailMergeWizard> m_pWizard;
~SwGreetingsHandler() {}
@@ -70,12 +70,12 @@ protected:
class SwMailMergeGreetingsPage : public svt::OWizardPage,
public SwGreetingsHandler
{
- FixedText* m_pPreviewFI;
- SwAddressPreview* m_pPreviewWIN;
- PushButton* m_pAssignPB;
- FixedText* m_pDocumentIndexFI;
- PushButton* m_pPrevSetIB;
- PushButton* m_pNextSetIB;
+ VclPtr<FixedText> m_pPreviewFI;
+ VclPtr<SwAddressPreview> m_pPreviewWIN;
+ VclPtr<PushButton> m_pAssignPB;
+ VclPtr<FixedText> m_pDocumentIndexFI;
+ VclPtr<PushButton> m_pPrevSetIB;
+ VclPtr<PushButton> m_pNextSetIB;
OUString m_sDocument;
@@ -90,21 +90,23 @@ class SwMailMergeGreetingsPage : public svt::OWizardPage,
public:
SwMailMergeGreetingsPage( SwMailMergeWizard* _pParent);
virtual ~SwMailMergeGreetingsPage();
+ virtual void dispose() SAL_OVERRIDE;
};
class SwMailBodyDialog : public SfxModalDialog, public SwGreetingsHandler
{
- FixedText *m_pBodyFT;
- VclMultiLineEdit *m_pBodyMLE;
+ VclPtr<FixedText> m_pBodyFT;
+ VclPtr<VclMultiLineEdit> m_pBodyMLE;
- OKButton *m_pOK;
+ VclPtr<OKButton> m_pOK;
DECL_LINK(ContainsHdl_Impl, CheckBox*);
DECL_LINK(OKHdl, void *);
public:
SwMailBodyDialog(vcl::Window* pParent, SwMailMergeWizard* pWizard);
virtual ~SwMailBodyDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetBody(const OUString& rBody ) {m_pBodyMLE->SetText(rBody);}
OUString GetBody() const {return m_pBodyMLE->GetText();}
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index a89ed65b32c5..e00f986e5ef0 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -155,9 +155,25 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
SwMailMergeLayoutPage::~SwMailMergeLayoutPage()
{
+ disposeOnce();
+}
+
+void SwMailMergeLayoutPage::dispose()
+{
delete m_pExampleFrame;
File::remove( m_sExampleURL );
-
+ m_pPosition.clear();
+ m_pAlignToBodyCB.clear();
+ m_pLeftFT.clear();
+ m_pLeftMF.clear();
+ m_pTopMF.clear();
+ m_pGreetingLine.clear();
+ m_pUpPB.clear();
+ m_pDownPB.clear();
+ m_pExampleContainerWIN.clear();
+ m_pZoomLB.clear();
+ m_pWizard.clear();
+ svt::OWizardPage::dispose();
}
void SwMailMergeLayoutPage::ActivatePage()
diff --git a/sw/source/ui/dbui/mmlayoutpage.hxx b/sw/source/ui/dbui/mmlayoutpage.hxx
index c770705dccc5..5b9f9a8c3cc1 100644
--- a/sw/source/ui/dbui/mmlayoutpage.hxx
+++ b/sw/source/ui/dbui/mmlayoutpage.hxx
@@ -38,20 +38,20 @@ namespace com{ namespace sun{ namespace star{ namespace beans{ class XPropertySe
class SwMailMergeLayoutPage : public svt::OWizardPage
{
- VclContainer* m_pPosition;
+ VclPtr<VclContainer> m_pPosition;
- CheckBox* m_pAlignToBodyCB;
- FixedText* m_pLeftFT;
- MetricField* m_pLeftMF;
- MetricField* m_pTopMF;
+ VclPtr<CheckBox> m_pAlignToBodyCB;
+ VclPtr<FixedText> m_pLeftFT;
+ VclPtr<MetricField> m_pLeftMF;
+ VclPtr<MetricField> m_pTopMF;
- VclContainer* m_pGreetingLine;
- PushButton* m_pUpPB;
- PushButton* m_pDownPB;
+ VclPtr<VclContainer> m_pGreetingLine;
+ VclPtr<PushButton> m_pUpPB;
+ VclPtr<PushButton> m_pDownPB;
- vcl::Window* m_pExampleContainerWIN;
+ VclPtr<vcl::Window> m_pExampleContainerWIN;
- ListBox* m_pZoomLB;
+ VclPtr<ListBox> m_pZoomLB;
SwOneExampleFrame* m_pExampleFrame;
SwWrtShell* m_pExampleWrtShell;
@@ -61,7 +61,7 @@ class SwMailMergeLayoutPage : public svt::OWizardPage
bool m_bIsGreetingInserted;
- SwMailMergeWizard* m_pWizard;
+ VclPtr<SwMailMergeWizard> m_pWizard;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xViewProperties;
@@ -84,6 +84,7 @@ class SwMailMergeLayoutPage : public svt::OWizardPage
public:
SwMailMergeLayoutPage( SwMailMergeWizard* _pParent);
virtual ~SwMailMergeLayoutPage();
+ virtual void dispose() SAL_OVERRIDE;
static SwFrmFmt* InsertAddressAndGreeting(SwView* pView,
SwMailMergeConfigItem& rConfigItem,
diff --git a/sw/source/ui/dbui/mmmergepage.cxx b/sw/source/ui/dbui/mmmergepage.cxx
index f0fbebcaf046..98233636a574 100644
--- a/sw/source/ui/dbui/mmmergepage.cxx
+++ b/sw/source/ui/dbui/mmmergepage.cxx
@@ -50,6 +50,25 @@ SwMailMergeMergePage::SwMailMergeMergePage(SwMailMergeWizard* _pParent)
}
+SwMailMergeMergePage::~SwMailMergeMergePage()
+{
+ disposeOnce();
+}
+
+void SwMailMergeMergePage::dispose()
+{
+ m_pEditFI.clear();
+ m_pEditPB.clear();
+ m_pFindED.clear();
+ m_pFindPB.clear();
+ m_pWholeWordsCB.clear();
+ m_pBackwardsCB.clear();
+ m_pMatchCaseCB.clear();
+ m_pWizard.clear();
+ svt::OWizardPage::dispose();
+}
+
+
IMPL_LINK_NOARG(SwMailMergeMergePage, EditDocumentHdl_Impl)
{
m_pWizard->SetRestartPage(MM_MERGEPAGE);
diff --git a/sw/source/ui/dbui/mmmergepage.hxx b/sw/source/ui/dbui/mmmergepage.hxx
index b415586acc7d..2ff8187eff10 100644
--- a/sw/source/ui/dbui/mmmergepage.hxx
+++ b/sw/source/ui/dbui/mmmergepage.hxx
@@ -29,17 +29,17 @@ class SwMailMergeWizard;
class SwMailMergeMergePage : public svt::OWizardPage
{
- FixedText* m_pEditFI;
- PushButton* m_pEditPB;
+ VclPtr<FixedText> m_pEditFI;
+ VclPtr<PushButton> m_pEditPB;
- ReturnActionEdit* m_pFindED;
- PushButton* m_pFindPB;
+ VclPtr<ReturnActionEdit> m_pFindED;
+ VclPtr<PushButton> m_pFindPB;
- CheckBox* m_pWholeWordsCB;
- CheckBox* m_pBackwardsCB;
- CheckBox* m_pMatchCaseCB;
+ VclPtr<CheckBox> m_pWholeWordsCB;
+ VclPtr<CheckBox> m_pBackwardsCB;
+ VclPtr<CheckBox> m_pMatchCaseCB;
- SwMailMergeWizard* m_pWizard;
+ VclPtr<SwMailMergeWizard> m_pWizard;
DECL_LINK(EditDocumentHdl_Impl, void *);
DECL_LINK(FindHdl_Impl, void *);
@@ -47,6 +47,8 @@ class SwMailMergeMergePage : public svt::OWizardPage
public:
SwMailMergeMergePage( SwMailMergeWizard* _pParent);
+ virtual ~SwMailMergeMergePage();
+ virtual void dispose() SAL_OVERRIDE;
};
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 586303caa0e1..6c92c26f8b8c 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -194,8 +194,8 @@ IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, Edit*, pEdit)
class SwCopyToDialog : public SfxModalDialog
{
- Edit* m_pCCED;
- Edit* m_pBCCED;
+ VclPtr<Edit> m_pCCED;
+ VclPtr<Edit> m_pBCCED;
public:
SwCopyToDialog(vcl::Window* pParent)
@@ -205,6 +205,13 @@ public:
get(m_pCCED, "cc");
get(m_pBCCED, "bcc");
}
+ virtual ~SwCopyToDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ m_pCCED.clear();
+ m_pBCCED.clear();
+ SfxModalDialog::dispose();
+ }
OUString GetCC() {return m_pCCED->GetText();}
void SetCC(const OUString& rSet) {m_pCCED->SetText(rSet);}
@@ -300,7 +307,44 @@ SwMailMergeOutputPage::SwMailMergeOutputPage(SwMailMergeWizard* _pParent)
SwMailMergeOutputPage::~SwMailMergeOutputPage()
{
- delete m_pTempPrinter;
+ disposeOnce();
+}
+
+void SwMailMergeOutputPage::dispose()
+{
+ m_pTempPrinter.disposeAndClear();
+ m_pSaveStartDocRB.clear();
+ m_pSaveMergedDocRB.clear();
+ m_pPrintRB.clear();
+ m_pSendMailRB.clear();
+ m_pSeparator.clear();
+ m_pSaveStartDocPB.clear();
+ m_pSaveAsOneRB.clear();
+ m_pSaveIndividualRB.clear();
+ m_pPrintAllRB.clear();
+ m_pSendAllRB.clear();
+ m_pFromRB.clear();
+ m_pFromNF.clear();
+ m_pToFT.clear();
+ m_pToNF.clear();
+ m_pSaveNowPB.clear();
+ m_pPrinterFT.clear();
+ m_pPrinterLB.clear();
+ m_pPrinterSettingsPB.clear();
+ m_pPrintNowPB.clear();
+ m_pMailToFT.clear();
+ m_pMailToLB.clear();
+ m_pCopyToPB.clear();
+ m_pSubjectFT.clear();
+ m_pSubjectED.clear();
+ m_pSendAsFT.clear();
+ m_pSendAsLB.clear();
+ m_pAttachmentGroup.clear();
+ m_pAttachmentED.clear();
+ m_pSendAsPB.clear();
+ m_pSendDocumentsPB.clear();
+ m_pWizard.clear();
+ svt::OWizardPage::dispose();
}
void SwMailMergeOutputPage::ActivatePage()
@@ -479,7 +523,7 @@ IMPL_LINK(SwMailMergeOutputPage, OutputTypeHdl_Impl, RadioButton*, pButton)
SendTypeHdl_Impl(m_pSendAsLB);
}
}
- m_pFromRB->GetClickHdl().Call(m_pFromRB->IsChecked() ? m_pFromRB : 0);
+ m_pFromRB->GetClickHdl().Call(m_pFromRB->IsChecked() ? m_pFromRB.get() : 0);
SetUpdateMode(false);
return 0;
@@ -496,7 +540,7 @@ IMPL_LINK(SwMailMergeOutputPage, DocumentSelectionHdl_Impl, RadioButton*, pButto
IMPL_LINK(SwMailMergeOutputPage, CopyToHdl_Impl, PushButton*, pButton)
{
- boost::scoped_ptr<SwCopyToDialog> pDlg(new SwCopyToDialog(pButton));
+ ScopedVclPtrInstance< SwCopyToDialog > pDlg(pButton);
pDlg->SetCC(m_sCC );
pDlg->SetBCC(m_sBCC);
if(RET_OK == pDlg->Execute())
@@ -689,12 +733,12 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
}
SwView* pSourceView = rConfigItem.GetSourceView();
- PrintMonitor aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE);
- aSaveMonitor.m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22));
- aSaveMonitor.SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl));
- aSaveMonitor.m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) );
+ ScopedVclPtrInstance< PrintMonitor > aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE);
+ aSaveMonitor->m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22));
+ aSaveMonitor->SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl));
+ aSaveMonitor->m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) );
m_bCancelSaving = false;
- aSaveMonitor.Show();
+ aSaveMonitor->Show();
m_pWizard->enableButtons(WZB_CANCEL, false);
for(sal_uInt32 nDoc = nBegin; nDoc < nEnd && !m_bCancelSaving; ++nDoc)
@@ -707,7 +751,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
sPath += "." + sExtension;
}
OUString sStat = OUString(SW_RES(STR_STATSTR_LETTER)) + " " + OUString::number( nDoc );
- aSaveMonitor.m_pPrintInfo->SetText(sStat);
+ aSaveMonitor->m_pPrintInfo->SetText(sStat);
//now extract a document from the target document
// the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here
@@ -755,9 +799,9 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
if(bFailed)
{
- SwSaveWarningBox_Impl aWarning( pButton, sOutPath );
- if(RET_OK == aWarning.Execute())
- sOutPath = aWarning.GetFileName();
+ ScopedVclPtrInstance< SwSaveWarningBox_Impl > aWarning( pButton, sOutPath );
+ if(RET_OK == aWarning->Execute())
+ sOutPath = aWarning->GetFileName();
else
{
xTempDocShell->DoClose();
@@ -794,23 +838,23 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox)
if ((pDocumentPrinter->GetName() == pInfo->GetPrinterName()) &&
(pDocumentPrinter->GetDriverName() == pInfo->GetDriver()))
{
- m_pTempPrinter = new Printer(pDocumentPrinter->GetJobSetup());
+ m_pTempPrinter = VclPtr<Printer>::Create(pDocumentPrinter->GetJobSetup());
}
else
- m_pTempPrinter = new Printer( *pInfo );
+ m_pTempPrinter = VclPtr<Printer>::Create( *pInfo );
}
else
{
if( (m_pTempPrinter->GetName() != pInfo->GetPrinterName()) ||
(m_pTempPrinter->GetDriverName() != pInfo->GetDriver()) )
{
- delete m_pTempPrinter;
- m_pTempPrinter = new Printer( *pInfo );
+ m_pTempPrinter.disposeAndClear();
+ m_pTempPrinter = VclPtr<Printer>::Create( *pInfo );
}
}
}
else if( ! m_pTempPrinter )
- m_pTempPrinter = new Printer();
+ m_pTempPrinter = VclPtr<Printer>::Create();
m_pPrinterSettingsPB->Enable( m_pTempPrinter->HasSupport( SUPPORT_SETUPDIALOG ) );
}
@@ -916,7 +960,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendTypeHdl_Impl, ListBox*, pBox)
IMPL_LINK(SwMailMergeOutputPage, SendAsHdl_Impl, PushButton*, pButton)
{
- SwMailBodyDialog* pDlg = new SwMailBodyDialog(pButton, m_pWizard);
+ VclPtr<SwMailBodyDialog> pDlg = VclPtr<SwMailBodyDialog>::Create(pButton, m_pWizard);
pDlg->SetBody(m_sBody);
if(RET_OK == pDlg->Execute())
{
@@ -939,12 +983,12 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton)
if(rConfigItem.GetMailServer().isEmpty() ||
!SwMailMergeHelper::CheckMailAddress(rConfigItem.GetMailAddress()) )
{
- QueryBox aQuery(pButton, WB_YES_NO_CANCEL, m_sConfigureMail);
- sal_uInt16 nRet = aQuery.Execute();
+ ScopedVclPtrInstance< QueryBox > aQuery(pButton, WB_YES_NO_CANCEL, m_sConfigureMail);
+ sal_uInt16 nRet = aQuery->Execute();
if(RET_YES == nRet )
{
SfxAllItemSet aSet(pTargetView->GetPool());
- boost::scoped_ptr<SwMailConfigDlg> pDlg(new SwMailConfigDlg(pButton, aSet));
+ ScopedVclPtrInstance< SwMailConfigDlg > pDlg(pButton, aSet);
nRet = pDlg->Execute();
}
@@ -1033,26 +1077,26 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton)
if(m_pSubjectED->GetText().isEmpty())
{
- SwSendQueryBox_Impl aQuery(pButton, "SubjectDialog",
- "modules/swriter/ui/subjectdialog.ui");
- aQuery.SetIsEmptyTextAllowed(true);
- aQuery.SetValue(m_sNoSubjectST);
- if(RET_OK == aQuery.Execute())
+ ScopedVclPtrInstance<SwSendQueryBox_Impl> aQuery(pButton, "SubjectDialog",
+ "modules/swriter/ui/subjectdialog.ui");
+ aQuery->SetIsEmptyTextAllowed(true);
+ aQuery->SetValue(m_sNoSubjectST);
+ if(RET_OK == aQuery->Execute())
{
- if(aQuery.GetValue() != m_sNoSubjectST)
- m_pSubjectED->SetText(aQuery.GetValue());
+ if(aQuery->GetValue() != m_sNoSubjectST)
+ m_pSubjectED->SetText(aQuery->GetValue());
}
else
return 0;
}
if(!bAsBody && m_pAttachmentED->GetText().isEmpty())
{
- SwSendQueryBox_Impl aQuery(pButton, "AttachNameDialog",
- "modules/swriter/ui/attachnamedialog.ui");
- aQuery.SetIsEmptyTextAllowed(false);
- if(RET_OK == aQuery.Execute())
+ ScopedVclPtrInstance<SwSendQueryBox_Impl> aQuery(pButton, "AttachNameDialog",
+ "modules/swriter/ui/attachnamedialog.ui");
+ aQuery->SetIsEmptyTextAllowed(false);
+ if(RET_OK == aQuery->Execute())
{
- OUString sAttach(aQuery.GetValue());
+ OUString sAttach(aQuery->GetValue());
sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.');
if (2 > nTokenCount)
{
@@ -1101,7 +1145,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton)
xStore->storeToURL( sTargetTempURL, aValues );
//create the send dialog
- SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem );
+ VclPtr<SwSendMailDialog> pDlg = VclPtr<SwSendMailDialog>::Create( pButton, rConfigItem );
pDlg->SetDocumentCount( nEnd );
pDlg->ShowDialog();
//help to force painting the dialog
diff --git a/sw/source/ui/dbui/mmoutputpage.hxx b/sw/source/ui/dbui/mmoutputpage.hxx
index a31ddeaa3564..470a72e04689 100644
--- a/sw/source/ui/dbui/mmoutputpage.hxx
+++ b/sw/source/ui/dbui/mmoutputpage.hxx
@@ -45,42 +45,42 @@ namespace com{ namespace sun{ namespace star{
class SwMailMergeOutputPage : public svt::OWizardPage
{
- RadioButton* m_pSaveStartDocRB;
- RadioButton* m_pSaveMergedDocRB;
- RadioButton* m_pPrintRB;
- RadioButton* m_pSendMailRB;
+ VclPtr<RadioButton> m_pSaveStartDocRB;
+ VclPtr<RadioButton> m_pSaveMergedDocRB;
+ VclPtr<RadioButton> m_pPrintRB;
+ VclPtr<RadioButton> m_pSendMailRB;
- VclFrame* m_pSeparator;
+ VclPtr<VclFrame> m_pSeparator;
- PushButton* m_pSaveStartDocPB;
+ VclPtr<PushButton> m_pSaveStartDocPB;
- RadioButton* m_pSaveAsOneRB;
- RadioButton* m_pSaveIndividualRB;
- RadioButton* m_pPrintAllRB; //has to be here for tab control reasons
- RadioButton* m_pSendAllRB; //has to be here for tab control reasons
+ VclPtr<RadioButton> m_pSaveAsOneRB;
+ VclPtr<RadioButton> m_pSaveIndividualRB;
+ VclPtr<RadioButton> m_pPrintAllRB; //has to be here for tab control reasons
+ VclPtr<RadioButton> m_pSendAllRB; //has to be here for tab control reasons
//this group is used in save and print
- RadioButton* m_pFromRB;
- NumericField* m_pFromNF;
- FixedText* m_pToFT;
- NumericField* m_pToNF;
- PushButton* m_pSaveNowPB;
-
- FixedText* m_pPrinterFT;
- ListBox* m_pPrinterLB;
- PushButton* m_pPrinterSettingsPB;
- PushButton* m_pPrintNowPB;
-
- FixedText* m_pMailToFT;
- ListBox* m_pMailToLB;
- PushButton* m_pCopyToPB;
- FixedText* m_pSubjectFT;
- Edit* m_pSubjectED;
- FixedText* m_pSendAsFT;
- ListBox* m_pSendAsLB;
- VclContainer* m_pAttachmentGroup;
- Edit* m_pAttachmentED;
- PushButton* m_pSendAsPB;
- PushButton* m_pSendDocumentsPB;
+ VclPtr<RadioButton> m_pFromRB;
+ VclPtr<NumericField> m_pFromNF;
+ VclPtr<FixedText> m_pToFT;
+ VclPtr<NumericField> m_pToNF;
+ VclPtr<PushButton> m_pSaveNowPB;
+
+ VclPtr<FixedText> m_pPrinterFT;
+ VclPtr<ListBox> m_pPrinterLB;
+ VclPtr<PushButton> m_pPrinterSettingsPB;
+ VclPtr<PushButton> m_pPrintNowPB;
+
+ VclPtr<FixedText> m_pMailToFT;
+ VclPtr<ListBox> m_pMailToLB;
+ VclPtr<PushButton> m_pCopyToPB;
+ VclPtr<FixedText> m_pSubjectFT;
+ VclPtr<Edit> m_pSubjectED;
+ VclPtr<FixedText> m_pSendAsFT;
+ VclPtr<ListBox> m_pSendAsLB;
+ VclPtr<VclContainer> m_pAttachmentGroup;
+ VclPtr<Edit> m_pAttachmentED;
+ VclPtr<PushButton> m_pSendAsPB;
+ VclPtr<PushButton> m_pSendDocumentsPB;
//some FixedLine labels
OUString m_sSaveStartST;
@@ -97,10 +97,10 @@ class SwMailMergeOutputPage : public svt::OWizardPage
bool m_bCancelSaving;
- SwMailMergeWizard* m_pWizard;
+ VclPtr<SwMailMergeWizard> m_pWizard;
//some dialog data
- Printer* m_pTempPrinter;
+ VclPtr<Printer> m_pTempPrinter;
OUString m_sCC;
OUString m_sBCC;
@@ -126,6 +126,7 @@ protected:
public:
SwMailMergeOutputPage( SwMailMergeWizard* _pParent);
virtual ~SwMailMergeOutputPage();
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -146,17 +147,17 @@ struct SwSendMailDialog_Impl;
class SwMailMergeConfigItem;
class SwSendMailDialog : public ModelessDialog //SfxModalDialog
{
- FixedText *m_pTransferStatus;
- FixedText *m_pPaused;
- ProgressBar *m_pProgressBar;
- FixedText *m_pErrorStatus;
+ VclPtr<FixedText> m_pTransferStatus;
+ VclPtr<FixedText> m_pPaused;
+ VclPtr<ProgressBar> m_pProgressBar;
+ VclPtr<FixedText> m_pErrorStatus;
- SvSimpleTableContainer *m_pContainer;
- HeaderBar *m_pStatusHB;
- SvSimpleTable *m_pStatus;
+ VclPtr<SvSimpleTableContainer> m_pContainer;
+ VclPtr<HeaderBar> m_pStatusHB;
+ VclPtr<SvSimpleTable> m_pStatus;
- PushButton *m_pStop;
- PushButton *m_pClose;
+ VclPtr<PushButton> m_pStop;
+ VclPtr<PushButton> m_pClose;
OUString m_sContinue;
OUString m_sStop;
@@ -192,6 +193,7 @@ class SwSendMailDialog : public ModelessDialog //SfxModalDialog
public:
SwSendMailDialog( vcl::Window* pParent, SwMailMergeConfigItem& );
virtual ~SwSendMailDialog();
+ virtual void dispose() SAL_OVERRIDE;
void AddDocument( SwMailDescriptor& rDesc );
void SetDocumentCount( sal_Int32 nAllDocuments );
diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx
index a1dc8affad88..e15e757421e7 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.cxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -48,6 +48,22 @@ SwMailMergeOutputTypePage::SwMailMergeOutputTypePage(SwMailMergeWizard* pParent)
}
+SwMailMergeOutputTypePage::~SwMailMergeOutputTypePage()
+{
+ disposeOnce();
+}
+
+void SwMailMergeOutputTypePage::dispose()
+{
+ m_pLetterRB.clear();
+ m_pMailRB.clear();
+ m_pLetterHint.clear();
+ m_pMailHint.clear();
+ m_pWizard.clear();
+ svt::OWizardPage::dispose();
+}
+
+
IMPL_LINK_NOARG(SwMailMergeOutputTypePage, TypeHdl_Impl)
{
bool bLetter = m_pLetterRB->IsChecked();
@@ -123,7 +139,7 @@ const SwMailDescriptor* SwSendMailDialog_Impl::GetNextDescriptor()
using namespace ::com::sun::star;
class SwMailDispatcherListener_Impl : public IMailDispatcherListener
{
- SwSendMailDialog* m_pSendMailDialog;
+ VclPtr<SwSendMailDialog> m_pSendMailDialog;
public:
SwMailDispatcherListener_Impl(SwSendMailDialog& rParentDlg);
@@ -208,9 +224,15 @@ void SwMailDispatcherListener_Impl::DeleteAttachments( uno::Reference< mail::XMa
class SwSendWarningBox_Impl : public MessageDialog
{
- VclMultiLineEdit *m_pDetailED;
+ VclPtr<VclMultiLineEdit> m_pDetailED;
public:
SwSendWarningBox_Impl(vcl::Window* pParent, const OUString& rDetails);
+ virtual ~SwSendWarningBox_Impl() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ m_pDetailED.clear();
+ MessageDialog::dispose();
+ }
};
SwSendWarningBox_Impl::SwSendWarningBox_Impl(vcl::Window* pParent, const OUString& rDetails)
@@ -253,7 +275,7 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, SwMailMergeConfigItem&
Size aSize = m_pContainer->LogicToPixel(Size(226, 80), MAP_APPFONT);
m_pContainer->set_width_request(aSize.Width());
m_pContainer->set_height_request(aSize.Height());
- m_pStatus = new SvSimpleTable(*m_pContainer);
+ m_pStatus = VclPtr<SvSimpleTable>::Create(*m_pContainer);
m_pStatusHB = &(m_pStatus->GetTheHeaderBar());
m_nStatusHeight = m_pContainer->get_height_request();
@@ -283,6 +305,11 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, SwMailMergeConfigItem&
SwSendMailDialog::~SwSendMailDialog()
{
+ disposeOnce();
+}
+
+void SwSendMailDialog::dispose()
+{
if(m_pImpl->xMailDispatcher.is())
{
try
@@ -306,8 +333,17 @@ SwSendMailDialog::~SwSendMailDialog()
{
}
}
- delete m_pStatus;
delete m_pImpl;
+ m_pStatus.disposeAndClear();
+ m_pTransferStatus.clear();
+ m_pPaused.clear();
+ m_pProgressBar.clear();
+ m_pErrorStatus.clear();
+ m_pContainer.clear();
+ m_pStatusHB.clear();
+ m_pStop.clear();
+ m_pClose.clear();
+ ModelessDialog::dispose();
}
void SwSendMailDialog::AddDocument( SwMailDescriptor& rDesc )
@@ -375,7 +411,7 @@ IMPL_STATIC_LINK( SwSendMailDialog, RemoveThis, Timer*, pTimer )
(!pThis->m_pImpl->xMailDispatcher.is() ||
!pThis->m_pImpl->xMailDispatcher->isRunning()))
{
- delete pThis;
+ pThis->disposeOnce();
}
else
{
@@ -546,7 +582,7 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> xMessag
if (pError)
{
- boost::scoped_ptr<SwSendWarningBox_Impl> pDlg(new SwSendWarningBox_Impl(0, *pError));
+ VclPtrInstance< SwSendWarningBox_Impl > pDlg(nullptr, *pError);
pDlg->Execute();
}
}
diff --git a/sw/source/ui/dbui/mmoutputtypepage.hxx b/sw/source/ui/dbui/mmoutputtypepage.hxx
index 81769f2b6863..9c967c05f7fb 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.hxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.hxx
@@ -27,18 +27,20 @@ class SwMailMergeWizard;
class SwMailMergeOutputTypePage : public svt::OWizardPage
{
- RadioButton* m_pLetterRB;
- RadioButton* m_pMailRB;
+ VclPtr<RadioButton> m_pLetterRB;
+ VclPtr<RadioButton> m_pMailRB;
- FixedText* m_pLetterHint;
- FixedText* m_pMailHint;
+ VclPtr<FixedText> m_pLetterHint;
+ VclPtr<FixedText> m_pMailHint;
- SwMailMergeWizard* m_pWizard;
+ VclPtr<SwMailMergeWizard> m_pWizard;
DECL_LINK(TypeHdl_Impl, void *);
public:
SwMailMergeOutputTypePage( SwMailMergeWizard* _pParent);
+ virtual ~SwMailMergeOutputTypePage();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/ui/dbui/mmpreparemergepage.cxx b/sw/source/ui/dbui/mmpreparemergepage.cxx
index 272ae0f6cb8e..702b26b156b1 100644
--- a/sw/source/ui/dbui/mmpreparemergepage.cxx
+++ b/sw/source/ui/dbui/mmpreparemergepage.cxx
@@ -58,6 +58,24 @@ SwMailMergePrepareMergePage::SwMailMergePrepareMergePage( SwMailMergeWizard* _pP
aMoveLink.Call(m_pRecordED);
}
+SwMailMergePrepareMergePage::~SwMailMergePrepareMergePage()
+{
+ disposeOnce();
+}
+
+void SwMailMergePrepareMergePage::dispose()
+{
+ m_pFirstPB.clear();
+ m_pPrevPB.clear();
+ m_pRecordED.clear();
+ m_pNextPB.clear();
+ m_pLastPB.clear();
+ m_pExcludeCB.clear();
+ m_pEditPB.clear();
+ m_pWizard.clear();
+ svt::OWizardPage::dispose();
+}
+
IMPL_LINK_NOARG(SwMailMergePrepareMergePage, EditDocumentHdl_Impl)
{
m_pWizard->SetRestartPage(MM_PREPAREMERGEPAGE);
diff --git a/sw/source/ui/dbui/mmpreparemergepage.hxx b/sw/source/ui/dbui/mmpreparemergepage.hxx
index bdaef54ae3ff..8bfdfbe94158 100644
--- a/sw/source/ui/dbui/mmpreparemergepage.hxx
+++ b/sw/source/ui/dbui/mmpreparemergepage.hxx
@@ -29,16 +29,16 @@ class SwMailMergeWizard;
class SwMailMergePrepareMergePage : public svt::OWizardPage
{
- PushButton* m_pFirstPB;
- PushButton* m_pPrevPB;
- NumericField* m_pRecordED;
- PushButton* m_pNextPB;
- PushButton* m_pLastPB;
- CheckBox* m_pExcludeCB;
+ VclPtr<PushButton> m_pFirstPB;
+ VclPtr<PushButton> m_pPrevPB;
+ VclPtr<NumericField> m_pRecordED;
+ VclPtr<PushButton> m_pNextPB;
+ VclPtr<PushButton> m_pLastPB;
+ VclPtr<CheckBox> m_pExcludeCB;
- PushButton* m_pEditPB;
+ VclPtr<PushButton> m_pEditPB;
- SwMailMergeWizard* m_pWizard;
+ VclPtr<SwMailMergeWizard> m_pWizard;
DECL_LINK(EditDocumentHdl_Impl, void *);
DECL_LINK(ExcludeHdl_Impl, CheckBox*);
@@ -49,6 +49,8 @@ class SwMailMergePrepareMergePage : public svt::OWizardPage
public:
SwMailMergePrepareMergePage( SwMailMergeWizard* _pParent);
+ virtual ~SwMailMergePrepareMergePage();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx
index 1386638a4e20..1db947e9f3d4 100644
--- a/sw/source/ui/dbui/selectdbtabledialog.cxx
+++ b/sw/source/ui/dbui/selectdbtabledialog.cxx
@@ -105,7 +105,7 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(vcl::Window* pParent,
Size aSize = pHeaderTreeContainer->LogicToPixel(Size(238 , 50), MAP_APPFONT);
pHeaderTreeContainer->set_width_request(aSize.Width());
pHeaderTreeContainer->set_height_request(aSize.Height());
- m_pTable = new SwAddressTable(*pHeaderTreeContainer);
+ m_pTable = VclPtr<SwAddressTable>::Create(*pHeaderTreeContainer);
long aStaticTabs[]= { 2, 0, 0 };
m_pTable->SetTabs( aStaticTabs );
m_pTable->InsertHeaderItem(1, m_sName, HeaderBarItemBits::LEFT | HeaderBarItemBits::VCENTER);
@@ -147,7 +147,14 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(vcl::Window* pParent,
SwSelectDBTableDialog::~SwSelectDBTableDialog()
{
- delete m_pTable;
+ disposeOnce();
+}
+
+void SwSelectDBTableDialog::dispose()
+{
+ m_pTable.disposeAndClear();
+ m_pPreviewPB.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton)
@@ -180,7 +187,7 @@ IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton)
pProperties[4].Name = "ShowTreeViewButton";
pProperties[4].Value <<= sal_False;
- boost::scoped_ptr<SwDBTablePreviewDialog> pDlg(new SwDBTablePreviewDialog(pButton, aProperties));
+ VclPtrInstance< SwDBTablePreviewDialog > pDlg(pButton, aProperties);
pDlg->Execute();
}
diff --git a/sw/source/ui/dbui/selectdbtabledialog.hxx b/sw/source/ui/dbui/selectdbtabledialog.hxx
index 729675e831b9..b02b74b2cb72 100644
--- a/sw/source/ui/dbui/selectdbtabledialog.hxx
+++ b/sw/source/ui/dbui/selectdbtabledialog.hxx
@@ -35,8 +35,8 @@ class SwAddressTable;
class SwSelectDBTableDialog : public SfxModalDialog
{
- SwAddressTable* m_pTable;
- PushButton* m_pPreviewPB;
+ VclPtr<SwAddressTable> m_pTable;
+ VclPtr<PushButton> m_pPreviewPB;
OUString m_sName;
OUString m_sType;
@@ -50,6 +50,7 @@ public:
SwSelectDBTableDialog(vcl::Window* pParent,
const css::uno::Reference<css::sdbc::XConnection>& xConnection);
virtual ~SwSelectDBTableDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetSelectedTable(bool& bIsTable);
void SetSelectedTable(const OUString& rTable, bool bIsTable);
diff --git a/sw/source/ui/dialog/abstract.cxx b/sw/source/ui/dialog/abstract.cxx
index f33577268b82..a5de42b69a6c 100644
--- a/sw/source/ui/dialog/abstract.cxx
+++ b/sw/source/ui/dialog/abstract.cxx
@@ -31,6 +31,18 @@ SwInsertAbstractDlg::SwInsertAbstractDlg(vcl::Window* pParent)
get(m_pParaNF, "paras");
}
+SwInsertAbstractDlg::~SwInsertAbstractDlg()
+{
+ disposeOnce();
+}
+
+void SwInsertAbstractDlg::dispose()
+{
+ m_pLevelNF.clear();
+ m_pParaNF.clear();
+ SfxModalDialog::dispose();
+}
+
sal_uInt8 SwInsertAbstractDlg::GetLevel() const
{
return static_cast<sal_uInt8>(m_pLevelNF->GetValue() - 1);
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index 93c3c7793e6e..68409fd8e9ec 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -174,14 +174,14 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh,
{
bool bDelPrinter = false;
- SfxPrinter* pPrt = pDoc ? pDoc->getIDocumentDeviceAccess().getPrinter(false) : 0;
+ VclPtr<SfxPrinter> pPrt = pDoc ? pDoc->getIDocumentDeviceAccess().getPrinter(false) : 0;
if( !pPrt )
{
SfxItemSet* pSet = new SfxItemSet( rDocSh.GetPool(),
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- pPrt = new SfxPrinter( pSet );
+ pPrt = VclPtr<SfxPrinter>::Create( pSet );
bDelPrinter = true;
}
@@ -211,7 +211,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh,
m_pFontLB->SelectEntry( aOpt.GetFontName() );
if( bDelPrinter )
- delete pPrt;
+ pPrt.disposeAndClear();
}
}
@@ -242,8 +242,23 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh,
SwAsciiFilterDlg::~SwAsciiFilterDlg()
{
+ disposeOnce();
}
+void SwAsciiFilterDlg::dispose()
+{
+ m_pCharSetLB.clear();
+ m_pFontFT.clear();
+ m_pFontLB.clear();
+ m_pLanguageFT.clear();
+ m_pLanguageLB.clear();
+ m_pCRLF_RB.clear();
+ m_pCR_RB.clear();
+ m_pLF_RB.clear();
+ SfxModalDialog::dispose();
+}
+
+
void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions )
{
sal_uLong nCCode = m_pCharSetLB->GetSelectTextEncoding();
diff --git a/sw/source/ui/dialog/docstdlg.cxx b/sw/source/ui/dialog/docstdlg.cxx
index 48ae2aa587d1..de1d3d6abcd8 100644
--- a/sw/source/ui/dialog/docstdlg.cxx
+++ b/sw/source/ui/dialog/docstdlg.cxx
@@ -36,9 +36,9 @@
#include <unotools/localedatawrapper.hxx>
#include <vcl/settings.hxx>
-SfxTabPage * SwDocStatPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+VclPtr<SfxTabPage> SwDocStatPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
{
- return new SwDocStatPage(pParent, *rSet);
+ return VclPtr<SwDocStatPage>::Create(pParent, *rSet);
}
SwDocStatPage::SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet)
@@ -73,8 +73,25 @@ SwDocStatPage::SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet)
}
- SwDocStatPage::~SwDocStatPage()
+SwDocStatPage::~SwDocStatPage()
{
+ disposeOnce();
+}
+
+void SwDocStatPage::dispose()
+{
+ m_pPageNo.clear();
+ m_pTableNo.clear();
+ m_pGrfNo.clear();
+ m_pOLENo.clear();
+ m_pParaNo.clear();
+ m_pWordNo.clear();
+ m_pCharNo.clear();
+ m_pCharExclSpacesNo.clear();
+ m_pLineLbl.clear();
+ m_pLineNo.clear();
+ m_pUpdatePB.clear();
+ SfxTabPage::dispose();
}
// Description: fill ItemSet when changed
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index a64cb0820089..ebc76da20d73 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -595,7 +595,7 @@ void AbstractSwWordCountFloatDlg_Impl::SetCounts(const SwDocStat &rCurrCnt, cons
AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl()
{
- delete pDlg;
+ pDlg.disposeAndClear();
}
void AbstractMailMergeWizard_Impl::StartExecuteModal( const Link& rEndDialogHdl )
@@ -643,7 +643,7 @@ sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const
AbstractSwInsertAbstractDlg * SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg(vcl::Window* pParent)
{
- SwInsertAbstractDlg* pDlg = new SwInsertAbstractDlg( pParent);
+ VclPtr<SwInsertAbstractDlg> pDlg = VclPtr<SwInsertAbstractDlg>::Create( pParent);
return new AbstractSwInsertAbstractDlg_Impl(pDlg);
}
@@ -657,16 +657,16 @@ SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSfxDialog( vcl::Window* p
switch ( nResId )
{
case RC_DLG_ADDR :
- pDlg = new SwAddrDlg( pParent, rSet );
+ pDlg = VclPtr<SwAddrDlg>::Create( pParent, rSet );
break;
case DLG_SWDROPCAPS :
- pDlg = new SwDropCapsDlg( pParent, rSet );
+ pDlg = VclPtr<SwDropCapsDlg>::Create( pParent, rSet );
break;
case RC_SWDLG_BACKGROUND :
- pDlg = new SwBackgroundDlg( pParent, rSet );
+ pDlg = VclPtr<SwBackgroundDlg>::Create( pParent, rSet );
break;
case RC_DLG_SWNUMFMTDLG :
- pDlg = new SwNumFmtDlg( pParent, rSet );
+ pDlg = VclPtr<SwNumFmtDlg>::Create( pParent, rSet );
break;
default:
break;
@@ -681,7 +681,7 @@ AbstractSwAsciiFilterDlg* SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg(
SwDocShell& rDocSh,
SvStream* pStream )
{
- SwAsciiFilterDlg* pDlg = new SwAsciiFilterDlg( pParent, rDocSh, pStream );
+ VclPtr<SwAsciiFilterDlg> pDlg = VclPtr<SwAsciiFilterDlg>::Create( pParent, rDocSh, pStream );
return new AbstractSwAsciiFilterDlg_Impl( pDlg );
}
@@ -694,7 +694,7 @@ VclAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( vcl:
switch ( nResId )
{
case DLG_INSERT_BOOKMARK :
- pDlg = new SwInsertBookmarkDlg( pParent, rSh, rReq );
+ pDlg = VclPtr<SwInsertBookmarkDlg>::Create( pParent, rSh, rReq );
break;
default:
@@ -709,44 +709,43 @@ VclAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( vcl:
AbstractSwBreakDlg * SwAbstractDialogFactory_Impl::CreateSwBreakDlg(vcl::Window *pParent,
SwWrtShell &rSh)
{
- SwBreakDlg* pDlg = new SwBreakDlg(pParent, rSh);
+ VclPtr<SwBreakDlg> pDlg = VclPtr<SwBreakDlg>::Create(pParent, rSh);
return new AbstractSwBreakDlg_Impl(pDlg);
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwChangeDBDlg(SwView& rVw)
{
- Dialog* pDlg = new SwChangeDBDlg(rVw);
+ VclPtr<Dialog> pDlg = VclPtr<SwChangeDBDlg>::Create(rVw);
return new VclAbstractDialog_Impl(pDlg);
}
SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwCharDlg(vcl::Window* pParent, SwView& pVw,
const SfxItemSet& rCoreSet, sal_uInt8 nDialogMode, const OUString* pFmtStr)
{
-
- SfxTabDialog* pDlg = new SwCharDlg(pParent, pVw, rCoreSet, nDialogMode, pFmtStr);
+ VclPtr<SfxTabDialog> pDlg = VclPtr<SwCharDlg>::Create(pParent, pVw, rCoreSet, nDialogMode, pFmtStr);
return new AbstractTabDialog_Impl(pDlg);
}
AbstractSwConvertTableDlg* SwAbstractDialogFactory_Impl::CreateSwConvertTableDlg(SwView& rView, bool bToTable)
{
- SwConvertTableDlg* pDlg = new SwConvertTableDlg(rView, bToTable);
+ VclPtr<SwConvertTableDlg> pDlg = VclPtr<SwConvertTableDlg>::Create(rView, bToTable);
return new AbstractSwConvertTableDlg_Impl(pDlg);
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV,int nResId)
{
- Dialog* pDlg=NULL;
+ VclPtr<Dialog> pDlg;
switch ( nResId )
{
case DLG_CAPTION :
- pDlg = new SwCaptionDialog( pParent, rV );
+ pDlg = VclPtr<SwCaptionDialog>::Create( pParent, rV );
break;
default:
break;
}
- if ( pDlg )
+ if ( pDlg.get() )
return new VclAbstractDialog_Impl( pDlg );
return 0;
}
@@ -756,20 +755,20 @@ AbstractSwInsertDBColAutoPilot* SwAbstractDialogFactory_Impl::CreateSwInsertDBCo
uno::Reference<sdbcx::XColumnsSupplier> xColSupp,
const SwDBData& rData)
{
- SwInsertDBColAutoPilot* pDlg = new SwInsertDBColAutoPilot( rView, rxSource, xColSupp, rData );
+ VclPtr<SwInsertDBColAutoPilot> pDlg = VclPtr<SwInsertDBColAutoPilot>::Create( rView, rxSource, xColSupp, rData );
return new AbstractSwInsertDBColAutoPilot_Impl( pDlg );
}
SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh)
{
- SfxTabDialog* pDlg = new SwFootNoteOptionDlg( pParent, rSh );
+ VclPtr<SfxTabDialog> pDlg = VclPtr<SwFootNoteOptionDlg>::Create( pParent, rSh );
return new AbstractTabDialog_Impl( pDlg );
}
AbstractDropDownFieldDialog * SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(vcl::Window *pParent,
SwWrtShell &rSh, SwField* pField, bool bNextButton)
{
- sw::DropDownFieldDialog* pDlg = new sw::DropDownFieldDialog(pParent, rSh, pField, bNextButton);
+ VclPtr<sw::DropDownFieldDialog> pDlg = VclPtr<sw::DropDownFieldDialog>::Create(pParent, rSh, pField, bNextButton);
return new AbstractDropDownFieldDialog_Impl( pDlg );
}
@@ -777,14 +776,14 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwEnvDlg ( vcl::Window
SwWrtShell* pWrtSh, Printer* pPrt,
bool bInsert )
{
- SfxTabDialog* pDlg = new SwEnvDlg( pParent, rSet, pWrtSh,pPrt, bInsert );
+ VclPtr<SfxTabDialog> pDlg = VclPtr<SwEnvDlg>::Create( pParent, rSet, pWrtSh,pPrt, bInsert );
return new AbstractTabDialog_Impl( pDlg );
}
AbstractSwLabDlg* SwAbstractDialogFactory_Impl::CreateSwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet,
SwDBManager* pDBManager, bool bLabel)
{
- SwLabDlg* pDlg = new SwLabDlg(pParent, rSet, pDBManager, bLabel);
+ VclPtr<SwLabDlg> pDlg = VclPtr<SwLabDlg>::Create(pParent, rSet, pDBManager, bLabel);
return new AbstractSwLabDlg_Impl(pDlg);
}
@@ -800,120 +799,120 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwParaDlg ( vcl::Windo
bool bDraw ,
const OString& sDefPage)
{
- SfxTabDialog* pDlg = new SwParaDlg( pParent, rVw, rCoreSet,nDialogMode, pCollName, bDraw, sDefPage );
+ VclPtr<SfxTabDialog> pDlg = VclPtr<SwParaDlg>::Create( pParent, rVw, rCoreSet,nDialogMode, pCollName, bDraw, sDefPage );
return new AbstractTabDialog_Impl( pDlg );
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclAbstractDialog ( vcl::Window *pParent, SwWrtShell &rSh, int nResId )
{
- Dialog* pDlg=NULL;
+ VclPtr<Dialog> pDlg;
switch ( nResId )
{
case DLG_ROW_HEIGHT :
- pDlg = new SwTableHeightDlg( pParent, rSh);
+ pDlg = VclPtr<SwTableHeightDlg>::Create( pParent, rSh);
break;
case DLG_SORTING :
- pDlg = new SwSortDlg( pParent, rSh);
+ pDlg = VclPtr<SwSortDlg>::Create( pParent, rSh);
break;
case DLG_COLUMN :
- pDlg = new SwColumnDlg( pParent, rSh );
+ pDlg = VclPtr<SwColumnDlg>::Create( pParent, rSh );
break;
case DLG_EDIT_AUTHMARK :
- pDlg = new SwAuthMarkModalDlg( pParent, rSh );
+ pDlg = VclPtr<SwAuthMarkModalDlg>::Create( pParent, rSh );
break;
default:
break;
}
- if ( pDlg )
+ if ( pDlg.get() )
return new VclAbstractDialog_Impl( pDlg );
return 0;
}
AbstractSplitTableDialog * SwAbstractDialogFactory_Impl::CreateSplitTblDialog ( vcl::Window *pParent, SwWrtShell &rSh )
{
- return new AbstractSplitTableDialog_Impl( new SwSplitTblDlg( pParent, rSh) );
+ return new AbstractSplitTableDialog_Impl( VclPtr<SwSplitTblDlg>::Create( pParent, rSh) );
}
AbstractSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShortName)
{
- SwSelGlossaryDlg* pDlg = new SwSelGlossaryDlg(pParent, rShortName);
+ VclPtr<SwSelGlossaryDlg> pDlg = VclPtr<SwSelGlossaryDlg>::Create(pParent, rShortName);
return new AbstractSwSelGlossaryDlg_Impl(pDlg);
}
AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg(vcl::Window* pParent,
SwWrtShell* pShell, bool bSetAutoFmt, const SwTableAutoFmt* pSelFmt)
{
- SwAutoFormatDlg* pDlg = new SwAutoFormatDlg(pParent, pShell, bSetAutoFmt, pSelFmt);
+ VclPtr<SwAutoFormatDlg> pDlg = VclPtr<SwAutoFormatDlg>::Create(pParent, pShell, bSetAutoFmt, pSelFmt);
return new AbstractSwAutoFormatDlg_Impl(pDlg);
}
SfxAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg(vcl::Window* pParent, SfxItemSet& rSet, sal_uInt16 nType, int nResId )
{
- SfxModalDialog* pDlg=NULL;
+ VclPtr<SfxModalDialog> pDlg;
switch ( nResId )
{
case RC_DLG_SWBORDERDLG :
- pDlg = new SwBorderDlg( pParent, rSet, nType );
+ pDlg = VclPtr<SwBorderDlg>::Create( pParent, rSet, nType );
break;
default:
break;
}
- if ( pDlg )
+ if ( pDlg.get() )
return new SwAbstractSfxDialog_Impl( pDlg );
return 0;
}
SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( vcl::Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, bool bDrawMode, int nResId )
{
- SfxModalDialog* pDlg=NULL;
+ VclPtr<SfxModalDialog> pDlg;
switch ( nResId )
{
case RC_DLG_SWWRAPDLG :
- pDlg = new SwWrapDlg( pParent, rSet, pSh, bDrawMode );
+ pDlg = VclPtr<SwWrapDlg>::Create( pParent, rSet, pSh, bDrawMode );
break;
default:
break;
}
- if ( pDlg )
+ if ( pDlg.get() )
return new SwAbstractSfxDialog_Impl( pDlg );
return 0;
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rFnc)
{
- Dialog* pDlg = new SwTableWidthDlg(pParent, rFnc);
+ VclPtr<Dialog> pDlg = VclPtr<SwTableWidthDlg>::Create(pParent, rFnc);
return new VclAbstractDialog_Impl( pDlg );
}
SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTableTabDlg(vcl::Window* pParent, SfxItemPool& Pool,
const SfxItemSet* pItemSet, SwWrtShell* pSh)
{
- SfxTabDialog* pDlg = new SwTableTabDlg(pParent, Pool, pItemSet, pSh);
+ VclPtr<SfxTabDialog> pDlg = VclPtr<SwTableTabDlg>::Create(pParent, Pool, pItemSet, pSh);
return new AbstractTabDialog_Impl(pDlg);
}
AbstractSwFldDlg * SwAbstractDialogFactory_Impl::CreateSwFldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pParent)
{
- SwFldDlg* pDlg = new SwFldDlg(pB, pCW, pParent);
+ VclPtr<SwFldDlg> pDlg = VclPtr<SwFldDlg>::Create(pB, pCW, pParent);
return new AbstractSwFldDlg_Impl(pDlg);
}
SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( SwView& rVw, int nResId )
{
- SfxModalDialog* pDlg=NULL;
+ VclPtr<SfxModalDialog> pDlg;
switch ( nResId )
{
case RC_DLG_SWFLDEDITDLG :
- pDlg = new SwFldEditDlg( rVw );
+ pDlg = VclPtr<SwFldEditDlg>::Create( rVw );
break;
default:
break;
}
- if ( pDlg )
+ if ( pDlg.get() )
return new SwAbstractSfxDialog_Impl( pDlg );
return 0;
}
@@ -922,19 +921,19 @@ AbstractSwRenameXNamedDlg * SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDl
::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed,
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess)
{
- SwRenameXNamedDlg* pDlg = new SwRenameXNamedDlg( pParent,xNamed, xNameAccess);
+ VclPtr<SwRenameXNamedDlg> pDlg = VclPtr<SwRenameXNamedDlg>::Create( pParent,xNamed, xNameAccess);
return new AbstractSwRenameXNamedDlg_Impl( pDlg );
}
AbstractSwModalRedlineAcceptDlg * SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg(vcl::Window *pParent)
{
- SwModalRedlineAcceptDlg* pDlg = new SwModalRedlineAcceptDlg( pParent );
+ VclPtr<SwModalRedlineAcceptDlg> pDlg = VclPtr<SwModalRedlineAcceptDlg>::Create( pParent );
return new AbstractSwModalRedlineAcceptDlg_Impl( pDlg );
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateTblMergeDialog(vcl::Window* pParent, bool& rWithPrev)
{
- Dialog* pDlg = new SwMergeTblDlg( pParent, rWithPrev );
+ VclPtr<Dialog> pDlg = VclPtr<SwMergeTblDlg>::Create( pParent, rWithPrev );
return new VclAbstractDialog_Impl( pDlg );
}
@@ -946,7 +945,7 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateFrmTabDialog(const OUS
const OString& sDefPage,
const OUString* pFmtStr )
{
- SfxTabDialog* pDlg = new SwFrmDlg(pFrame, pParent, rCoreSet, bNewFrm, rDialogType, bFmt, sDefPage, pFmtStr);
+ VclPtr<SfxTabDialog> pDlg = VclPtr<SwFrmDlg>::Create(pFrame, pParent, rCoreSet, bNewFrm, rDialogType, bFmt, sDefPage, pFmtStr);
return new AbstractTabDialog_Impl(pDlg);
}
@@ -958,7 +957,7 @@ SfxAbstractApplyTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog(
SwWrtShell* pActShell,
bool bNew )
{
- SfxTabDialog* pDlg = new SwTemplateDlg( pParent, rBase, nRegion, sPage, pActShell, bNew );
+ VclPtr<SfxTabDialog> pDlg = VclPtr<SwTemplateDlg>::Create( pParent, rBase, nRegion, sPage, pActShell, bNew );
return new AbstractApplyTabDialog_Impl( pDlg );
}
@@ -966,46 +965,46 @@ AbstractGlossaryDlg* SwAbstractDialogFactory_Impl::CreateGlossaryDlg(SfxViewFram
SwGlossaryHdl* pGlosHdl,
SwWrtShell *pWrtShell)
{
- SwGlossaryDlg* pDlg = new SwGlossaryDlg(pViewFrame, pGlosHdl, pWrtShell);
+ VclPtr<SwGlossaryDlg> pDlg = VclPtr<SwGlossaryDlg>::Create(pViewFrame, pGlosHdl, pWrtShell);
return new AbstractGlossaryDlg_Impl( pDlg );
}
AbstractFldInputDlg* SwAbstractDialogFactory_Impl::CreateFldInputDlg(vcl::Window *pParent,
SwWrtShell &rSh, SwField* pField, bool bNextButton)
{
- SwFldInputDlg* pDlg = new SwFldInputDlg( pParent, rSh, pField, bNextButton );
+ VclPtr<SwFldInputDlg> pDlg = VclPtr<SwFldInputDlg>::Create( pParent, rSh, pField, bNextButton );
return new AbstractFldInputDlg_Impl( pDlg );
}
AbstractInsFootNoteDlg* SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg(
vcl::Window * pParent, SwWrtShell &rSh, bool bEd )
{
- SwInsFootNoteDlg* pDlg = new SwInsFootNoteDlg(pParent, rSh, bEd);
+ VclPtr<SwInsFootNoteDlg> pDlg = VclPtr<SwInsFootNoteDlg>::Create(pParent, rSh, bEd);
return new AbstractInsFootNoteDlg_Impl( pDlg );
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateTitlePageDlg ( vcl::Window *pParent )
{
- Dialog* pDlg = new SwTitlePageDlg( pParent );
+ VclPtr<Dialog> pDlg = VclPtr<SwTitlePageDlg>::Create( pParent );
return new VclAbstractDialog_Impl( pDlg );
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclSwViewDialog(SwView& rView)
{
- Dialog* pDlg = new SwLineNumberingDlg( &rView );
+ VclPtr<Dialog> pDlg = VclPtr<SwLineNumberingDlg>::Create( &rView );
return new VclAbstractDialog_Impl( pDlg );
}
AbstractInsTableDlg * SwAbstractDialogFactory_Impl::CreateInsTableDlg(SwView& rView)
{
- SwInsTableDlg* pDlg = new SwInsTableDlg(rView);
+ VclPtr<SwInsTableDlg> pDlg = VclPtr<SwInsTableDlg>::Create(rView);
return new AbstractInsTableDlg_Impl( pDlg );
}
AbstractJavaEditDialog * SwAbstractDialogFactory_Impl::CreateJavaEditDialog(
vcl::Window* pParent, SwWrtShell* pWrtSh)
{
- SwJavaEditDialog* pDlg = new SwJavaEditDialog(pParent, pWrtSh);
+ VclPtr<SwJavaEditDialog> pDlg = VclPtr<SwJavaEditDialog>::Create(pParent, pWrtSh);
return new AbstractJavaEditDialog_Impl( pDlg );
}
@@ -1017,35 +1016,35 @@ AbstractMailMergeDlg * SwAbstractDialogFactory_Impl::CreateMailMergeDlg( int nRe
const uno::Reference< sdbc::XConnection>& xConnection,
uno::Sequence< uno::Any >* pSelection )
{
- SwMailMergeDlg* pDlg=NULL;
+ VclPtr<SwMailMergeDlg> pDlg;
switch ( nResId )
{
case DLG_MAILMERGE :
- pDlg = new SwMailMergeDlg( pParent, rSh, rSourceName, rTblName, nCommandType, xConnection, pSelection );
+ pDlg = VclPtr<SwMailMergeDlg>::Create( pParent, rSh, rSourceName, rTblName, nCommandType, xConnection, pSelection );
break;
default:
break;
}
- if ( pDlg )
+ if ( pDlg.get() )
return new AbstractMailMergeDlg_Impl( pDlg );
return 0;
}
AbstractMailMergeCreateFromDlg * SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg(vcl::Window* pParent)
{
- SwMailMergeCreateFromDlg* pDlg = new SwMailMergeCreateFromDlg(pParent);
+ VclPtr<SwMailMergeCreateFromDlg> pDlg = VclPtr<SwMailMergeCreateFromDlg>::Create(pParent);
return new AbstractMailMergeCreateFromDlg_Impl(pDlg);
}
AbstractMailMergeFieldConnectionsDlg * SwAbstractDialogFactory_Impl::CreateMailMergeFieldConnectionsDlg(vcl::Window* pParent)
{
- SwMailMergeFieldConnectionsDlg* pDlg = new SwMailMergeFieldConnectionsDlg( pParent );
+ VclPtr<SwMailMergeFieldConnectionsDlg> pDlg = VclPtr<SwMailMergeFieldConnectionsDlg>::Create( pParent );
return new AbstractMailMergeFieldConnectionsDlg_Impl( pDlg );
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXMarkDlg(vcl::Window* pParent, SwTOXMgr &rTOXMgr)
{
- Dialog* pDlg = new SwMultiTOXMarkDlg(pParent, rTOXMgr);
+ VclPtr<Dialog> pDlg = VclPtr<SwMultiTOXMarkDlg>::Create(pParent, rTOXMgr);
return new VclAbstractDialog_Impl(pDlg);
}
@@ -1054,20 +1053,20 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTabDialog( int nResI
const SfxItemSet* pSwItemSet,
SwWrtShell & rWrtSh )
{
- SfxTabDialog* pDlg=NULL;
+ VclPtr<SfxTabDialog> pDlg;
switch ( nResId )
{
case DLG_SVXTEST_NUM_BULLET :
- pDlg = new SwSvxNumBulletTabDialog( pParent, pSwItemSet, rWrtSh );
+ pDlg = VclPtr<SwSvxNumBulletTabDialog>::Create( pParent, pSwItemSet, rWrtSh );
break;
case DLG_TAB_OUTLINE :
- pDlg = new SwOutlineTabDialog( pParent, pSwItemSet, rWrtSh );
+ pDlg = VclPtr<SwOutlineTabDialog>::Create( pParent, pSwItemSet, rWrtSh );
break;
default:
break;
}
- if ( pDlg )
+ if ( pDlg.get() )
return new AbstractTabDialog_Impl( pDlg );
return 0;
}
@@ -1078,20 +1077,20 @@ AbstractMultiTOXTabDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXTabDialo
SwTOXBase* pCurTOX, sal_uInt16 nToxType,
bool bGlobal)
{
- SwMultiTOXTabDialog* pDlg = new SwMultiTOXTabDialog( pParent, rSet, rShell, pCurTOX, nToxType, bGlobal );
+ VclPtr<SwMultiTOXTabDialog> pDlg = VclPtr<SwMultiTOXTabDialog>::Create( pParent, rSet, rShell, pCurTOX, nToxType, bGlobal );
return new AbstractMultiTOXTabDialog_Impl( pDlg );
}
AbstractEditRegionDlg * SwAbstractDialogFactory_Impl::CreateEditRegionDlg(vcl::Window* pParent, SwWrtShell& rWrtSh)
{
- SwEditRegionDlg* pDlg = new SwEditRegionDlg( pParent, rWrtSh );
+ VclPtr<SwEditRegionDlg> pDlg = VclPtr<SwEditRegionDlg>::Create( pParent, rWrtSh );
return new AbstractEditRegionDlg_Impl( pDlg );
}
AbstractInsertSectionTabDialog * SwAbstractDialogFactory_Impl::CreateInsertSectionTabDialog(
vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh)
{
- SwInsertSectionTabDialog* pDlg = new SwInsertSectionTabDialog(pParent, rSet, rSh);
+ VclPtr<SwInsertSectionTabDialog> pDlg = VclPtr<SwInsertSectionTabDialog>::Create(pParent, rSet, rSh);
return new AbstractInsertSectionTabDialog_Impl(pDlg);
}
@@ -1102,7 +1101,7 @@ AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateIndexMarkFloatDlg(
SfxChildWinInfo* pInfo,
bool bNew )
{
- SwIndexMarkFloatDlg* pDlg = new SwIndexMarkFloatDlg(pBindings, pChild, pParent, pInfo, bNew);
+ VclPtr<SwIndexMarkFloatDlg> pDlg = VclPtr<SwIndexMarkFloatDlg>::Create(pBindings, pChild, pParent, pInfo, bNew);
return new AbstractIndexMarkFloatDlg_Impl(pDlg);
}
@@ -1113,7 +1112,7 @@ AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDlg(
SfxChildWinInfo* pInfo,
bool bNew)
{
- SwAuthMarkFloatDlg* pDlg = new SwAuthMarkFloatDlg( pBindings, pChild, pParent, pInfo, bNew );
+ VclPtr<SwAuthMarkFloatDlg> pDlg = VclPtr<SwAuthMarkFloatDlg>::Create( pBindings, pChild, pParent, pInfo, bNew );
return new AbstractAuthMarkFloatDlg_Impl( pDlg );
}
@@ -1123,21 +1122,21 @@ AbstractSwWordCountFloatDlg * SwAbstractDialogFactory_Impl::CreateSwWordCountDia
vcl::Window *pParent,
SfxChildWinInfo* pInfo)
{
- SwWordCountFloatDlg* pDlg = new SwWordCountFloatDlg( pBindings, pChild, pParent, pInfo );
+ VclPtr<SwWordCountFloatDlg> pDlg = VclPtr<SwWordCountFloatDlg>::Create( pBindings, pChild, pParent, pInfo );
return new AbstractSwWordCountFloatDlg_Impl( pDlg );
}
VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg(
vcl::Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark )
{
- Dialog* pDlg = new SwIndexMarkModalDlg( pParent, rSh, pCurTOXMark );
+ VclPtr<Dialog> pDlg = VclPtr<SwIndexMarkModalDlg>::Create( pParent, rSh, pCurTOXMark );
return new VclAbstractDialog_Impl( pDlg );
}
AbstractMailMergeWizard* SwAbstractDialogFactory_Impl::CreateMailMergeWizard(
SwView& rView, SwMailMergeConfigItem& rConfigItem)
{
- return new AbstractMailMergeWizard_Impl( new SwMailMergeWizard(rView, rConfigItem));
+ return new AbstractMailMergeWizard_Impl( VclPtr<SwMailMergeWizard>::Create(rView, rConfigItem));
}
GlossaryGetCurrGroup SwAbstractDialogFactory_Impl::GetGlossaryCurrGroupFunc()
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 9e6ff470c404..4ec9fa68ad33 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -48,7 +48,7 @@ class DropDownFieldDialog;
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
protected: \
- DialogClass* pDlg; \
+ ScopedVclPtr<DialogClass> pDlg; \
public: \
Class( DialogClass* p) \
: pDlg(p) \
@@ -59,7 +59,6 @@ public: \
#define IMPL_ABSTDLG_BASE(Class) \
Class::~Class() \
{ \
- delete pDlg; \
} \
short Class::Execute() \
{ \
@@ -350,7 +349,7 @@ class AbstractAuthMarkFloatDlg_Impl : public AbstractMarkFloatDlg
class SwMailMergeWizard;
class AbstractMailMergeWizard_Impl : public AbstractMailMergeWizard
{
- SwMailMergeWizard* pDlg;
+ VclPtr<SwMailMergeWizard> pDlg;
Link aEndDlgHdl;
DECL_LINK( EndDialogHdl, SwMailMergeWizard* );
diff --git a/sw/source/ui/dialog/swmessdialog.cxx b/sw/source/ui/dialog/swmessdialog.cxx
index 2e085f464686..79aba4459af6 100644
--- a/sw/source/ui/dialog/swmessdialog.cxx
+++ b/sw/source/ui/dialog/swmessdialog.cxx
@@ -30,4 +30,19 @@ SwMessageAndEditDialog::SwMessageAndEditDialog(vcl::Window* pParent, const OUStr
get(m_pEdit, "edit");
}
+SwMessageAndEditDialog::~SwMessageAndEditDialog()
+{
+ disposeOnce();
+}
+
+void SwMessageAndEditDialog::dispose()
+{
+ m_pOKPB.clear();
+ m_pImageIM.clear();
+ m_pPrimaryMessage.clear();
+ m_pSecondaryMessage.clear();
+ m_pEdit.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx
index f90812fa4681..dbbac541e03a 100644
--- a/sw/source/ui/dialog/swuiexp.cxx
+++ b/sw/source/ui/dialog/swuiexp.cxx
@@ -18,7 +18,32 @@
*/
#include "swdlgfact.hxx"
+
+#include "abstract.hxx"
+#include "ascfldlg.hxx"
+#include "break.hxx"
+#include "convert.hxx"
#include "dialmgr.hxx"
+#include "dbinsdlg.hxx"
+#include "DropDownFieldDialog.hxx"
+#include "fldtdlg.hxx"
+#include "glossary.hxx"
+#include "inpdlg.hxx"
+#include "insfnote.hxx"
+#include "instable.hxx"
+#include "javaedit.hxx"
+#include "label.hxx"
+#include "mailmrge.hxx"
+#include "mailmergewizard.hxx"
+#include "regionsw.hxx"
+#include "selglos.hxx"
+#include "splittbl.hxx"
+#include "tautofmt.hxx"
+#include "swmodalredlineacceptdlg.hxx"
+#include "swrenamexnameddlg.hxx"
+#include "swuiidxmrk.hxx"
+#include "swuicnttab.hxx"
+#include "wordcountdialog.hxx"
#include <swuiexp.hxx>
namespace swui
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index a0b3ac501966..41fbe2b8d3b9 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -404,11 +404,11 @@ bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox)
if (!pRepr->GetTempPasswd().getLength()
&& pRepr->GetSectionData().GetPassword().getLength())
{
- SfxPasswordDialog aPasswdDlg(this);
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this);
bRet = false;
- if (aPasswdDlg.Execute())
+ if (aPasswdDlg->Execute())
{
- const OUString sNewPasswd( aPasswdDlg.GetPassword() );
+ const OUString sNewPasswd( aPasswdDlg->GetPassword() );
::com::sun::star::uno::Sequence <sal_Int8 > aNewPasswd;
SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
if (SvPasswordHelper::CompareHashPassword(
@@ -516,6 +516,11 @@ sal_uInt16 SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt )
SwEditRegionDlg::~SwEditRegionDlg( )
{
+ disposeOnce();
+}
+
+void SwEditRegionDlg::dispose()
+{
SvTreeListEntry* pEntry = m_pTree->First();
while( pEntry )
{
@@ -524,6 +529,29 @@ SwEditRegionDlg::~SwEditRegionDlg( )
}
delete m_pDocInserter;
+ m_pCurName.clear();
+ m_pTree.clear();
+ m_pFileCB.clear();
+ m_pDDECB.clear();
+ m_pDDEFrame.clear();
+ m_pFileNameFT.clear();
+ m_pDDECommandFT.clear();
+ m_pFileNameED.clear();
+ m_pFilePB.clear();
+ m_pSubRegionFT.clear();
+ m_pSubRegionED.clear();
+ m_pProtectCB.clear();
+ m_pPasswdCB.clear();
+ m_pPasswdPB.clear();
+ m_pHideCB.clear();
+ m_pConditionFT.clear();
+ m_pConditionED.clear();
+ m_pEditInReadonlyCB.clear();
+ m_pOK.clear();
+ m_pOptionsPB.clear();
+ m_pDismiss.clear();
+ m_pOldDefDlgParent.clear();
+ SfxModalDialog::dispose();
}
void SwEditRegionDlg::SelectSection(const OUString& rSectionName)
@@ -1053,10 +1081,10 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl)
aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth));
aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
- SwSectionPropertyTabDialog aTabDlg(this, aSet, rSh);
- if(RET_OK == aTabDlg.Execute())
+ ScopedVclPtrInstance< SwSectionPropertyTabDialog > aTabDlg(this, aSet, rSh);
+ if(RET_OK == aTabDlg->Execute())
{
- const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
+ const SfxItemSet* pOutSet = aTabDlg->GetOutputItemSet();
if( pOutSet && pOutSet->Count() )
{
const SfxPoolItem *pColItem, *pBrushItem,
@@ -1232,12 +1260,12 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox )
{
if(!pRepr->GetTempPasswd().getLength() || bChange)
{
- SfxPasswordDialog aPasswdDlg(this);
- aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
- if(RET_OK == aPasswdDlg.Execute())
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this);
+ aPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM);
+ if(RET_OK == aPasswdDlg->Execute())
{
- const OUString sNewPasswd( aPasswdDlg.GetPassword() );
- if( aPasswdDlg.GetConfirm() == sNewPasswd )
+ const OUString sNewPasswd( aPasswdDlg->GetPassword() );
+ if( aPasswdDlg->GetConfirm() == sNewPasswd )
{
SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd );
}
@@ -1533,7 +1561,30 @@ SwInsertSectionTabPage::SwInsertSectionTabPage(
SwInsertSectionTabPage::~SwInsertSectionTabPage()
{
+ disposeOnce();
+}
+
+void SwInsertSectionTabPage::dispose()
+{
delete m_pDocInserter;
+ m_pCurName.clear();
+ m_pFileCB.clear();
+ m_pDDECB.clear();
+ m_pDDECommandFT.clear();
+ m_pFileNameFT.clear();
+ m_pFileNameED.clear();
+ m_pFilePB.clear();
+ m_pSubRegionFT.clear();
+ m_pSubRegionED.clear();
+ m_pProtectCB.clear();
+ m_pPasswdCB.clear();
+ m_pPasswdPB.clear();
+ m_pHideCB.clear();
+ m_pConditionFT.clear();
+ m_pConditionED.clear();
+ m_pEditInReadonlyCB.clear();
+ m_pOldDefDlgParent.clear();
+ SfxTabPage::dispose();
}
void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh)
@@ -1635,10 +1686,10 @@ void SwInsertSectionTabPage::Reset( const SfxItemSet* )
{
}
-SfxTabPage* SwInsertSectionTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwInsertSectionTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SwInsertSectionTabPage(pParent, *rAttrSet);
+ return VclPtr<SwInsertSectionTabPage>::Create(pParent, *rAttrSet);
}
IMPL_LINK( SwInsertSectionTabPage, ChangeHideHdl, CheckBox *, pBox )
@@ -1670,12 +1721,12 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton )
{
if(!m_aNewPasswd.getLength() || bChange)
{
- SfxPasswordDialog aPasswdDlg(this);
- aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
- if(RET_OK == aPasswdDlg.Execute())
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this);
+ aPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM);
+ if(RET_OK == aPasswdDlg->Execute())
{
- const OUString sNewPasswd( aPasswdDlg.GetPassword() );
- if( aPasswdDlg.GetConfirm() == sNewPasswd )
+ const OUString sNewPasswd( aPasswdDlg->GetPassword() );
+ if( aPasswdDlg->GetConfirm() == sNewPasswd )
{
SvPasswordHelper::GetHashPassword( m_aNewPasswd, sNewPasswd );
}
@@ -1835,6 +1886,32 @@ SwSectionFtnEndTabPage::SwSectionFtnEndTabPage( vcl::Window *pParent,
SwSectionFtnEndTabPage::~SwSectionFtnEndTabPage()
{
+ disposeOnce();
+}
+
+void SwSectionFtnEndTabPage::dispose()
+{
+ pFtnNtAtTextEndCB.clear();
+ pFtnNtNumCB.clear();
+ pFtnOffsetLbl.clear();
+ pFtnOffsetFld.clear();
+ pFtnNtNumFmtCB.clear();
+ pFtnPrefixFT.clear();
+ pFtnPrefixED.clear();
+ pFtnNumViewBox.clear();
+ pFtnSuffixFT.clear();
+ pFtnSuffixED.clear();
+ pEndNtAtTextEndCB.clear();
+ pEndNtNumCB.clear();
+ pEndOffsetLbl.clear();
+ pEndOffsetFld.clear();
+ pEndNtNumFmtCB.clear();
+ pEndPrefixFT.clear();
+ pEndPrefixED.clear();
+ pEndNumViewBox.clear();
+ pEndSuffixFT.clear();
+ pEndSuffixED.clear();
+ SfxTabPage::dispose();
}
bool SwSectionFtnEndTabPage::FillItemSet( SfxItemSet* rSet )
@@ -1975,10 +2052,10 @@ void SwSectionFtnEndTabPage::Reset( const SfxItemSet* rSet )
RES_END_AT_TXTEND, false )));
}
-SfxTabPage* SwSectionFtnEndTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwSectionFtnEndTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SwSectionFtnEndTabPage(pParent, *rAttrSet);
+ return VclPtr<SwSectionFtnEndTabPage>::Create(pParent, *rAttrSet);
}
IMPL_LINK( SwSectionFtnEndTabPage, FootEndHdl, CheckBox *, pBox )
@@ -2096,6 +2173,15 @@ SwSectionIndentTabPage::SwSectionIndentTabPage(vcl::Window *pParent, const SfxIt
SwSectionIndentTabPage::~SwSectionIndentTabPage()
{
+ disposeOnce();
+}
+
+void SwSectionIndentTabPage::dispose()
+{
+ m_pBeforeMF.clear();
+ m_pAfterMF.clear();
+ m_pPreviewWin.clear();
+ SfxTabPage::dispose();
}
bool SwSectionIndentTabPage::FillItemSet( SfxItemSet* rSet)
@@ -2137,9 +2223,9 @@ void SwSectionIndentTabPage::Reset( const SfxItemSet* rSet)
IndentModifyHdl(0);
}
-SfxTabPage* SwSectionIndentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwSectionIndentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
{
- return new SwSectionIndentTabPage(pParent, *rAttrSet);
+ return VclPtr<SwSectionIndentTabPage>::Create(pParent, *rAttrSet);
}
void SwSectionIndentTabPage::SetWrtShell(SwWrtShell& rSh)
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index 2a7392eee793..471309e2e92b 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -46,7 +46,26 @@ IMPL_LINK_NOARG(SwWordCountFloatDlg, CloseHdl)
SwWordCountFloatDlg::~SwWordCountFloatDlg()
{
+ disposeOnce();
+}
+
+void SwWordCountFloatDlg::dispose()
+{
SwViewShell::SetCareWin( 0 );
+ m_pCurrentWordFT.clear();
+ m_pCurrentCharacterFT.clear();
+ m_pCurrentCharacterExcludingSpacesFT.clear();
+ m_pCurrentCjkcharsFT.clear();
+ m_pCurrentStandardizedPagesFT.clear();
+ m_pDocWordFT.clear();
+ m_pDocCharacterFT.clear();
+ m_pDocCharacterExcludingSpacesFT.clear();
+ m_pDocCjkcharsFT.clear();
+ m_pDocStandardizedPagesFT.clear();
+ m_pCjkcharsLabelFT.clear();
+ m_pStandardizedPagesLabelFT.clear();
+ m_pClosePB.clear();
+ SfxModelessDialog::dispose();
}
namespace
diff --git a/sw/source/ui/dochdl/selglos.cxx b/sw/source/ui/dochdl/selglos.cxx
index 5cdc698f750d..2cde14cea56d 100644
--- a/sw/source/ui/dochdl/selglos.cxx
+++ b/sw/source/ui/dochdl/selglos.cxx
@@ -35,6 +35,17 @@ SwSelGlossaryDlg::SwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShort
m_pGlosBox->SetDoubleClickHdl(LINK(this, SwSelGlossaryDlg, DoubleClickHdl));
}
+SwSelGlossaryDlg::~SwSelGlossaryDlg()
+{
+ disposeOnce();
+}
+
+void SwSelGlossaryDlg::dispose()
+{
+ m_pGlosBox.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK(SwSelGlossaryDlg, DoubleClickHdl, ListBox*, /*pBox*/)
{
EndDialog(RET_OK);
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 2e9ea372b3e7..0fa73fb0171d 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -197,6 +197,27 @@ SwEnvFmtPage::SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet)
}
+SwEnvFmtPage::~SwEnvFmtPage()
+{
+ disposeOnce();
+}
+
+void SwEnvFmtPage::dispose()
+{
+ m_pAddrLeftField.clear();
+ m_pAddrTopField.clear();
+ m_pAddrEditButton.clear();
+ m_pSendLeftField.clear();
+ m_pSendTopField.clear();
+ m_pSendEditButton.clear();
+ m_pSizeFormatBox.clear();
+ m_pSizeWidthField.clear();
+ m_pSizeHeightField.clear();
+ m_pPreview.clear();
+ SfxTabPage::dispose();
+}
+
+
IMPL_LINK_INLINE_START( SwEnvFmtPage, ModifyHdl, Edit *, pEdit )
{
long lWVal = static_cast< long >(GetFldVal(*m_pSizeWidthField ));
@@ -298,7 +319,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
::PrepareBoxInfo( aTmpSet, *pSh );
const OUString sFmtStr = pColl->GetName();
- boost::scoped_ptr<SwParaDlg> pDlg(new SwParaDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr));
+ VclPtrInstance< SwParaDlg > pDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr);
if ( pDlg->Execute() == RET_OK )
{
@@ -440,9 +461,9 @@ void SwEnvFmtPage::SetMinMax()
m_pSizeHeightField->Reformat();
}
-SfxTabPage* SwEnvFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SwEnvFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SwEnvFmtPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwEnvFmtPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwEnvFmtPage::ActivatePage(const SfxItemSet& rSet)
diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx
index 73cb44d3647d..744f576dd9c7 100644
--- a/sw/source/ui/envelp/envfmt.hxx
+++ b/sw/source/ui/envelp/envfmt.hxx
@@ -30,21 +30,19 @@ class SwTxtFmtColl;
class SwEnvFmtPage : public SfxTabPage
{
- MetricField* m_pAddrLeftField;
- MetricField* m_pAddrTopField;
- MenuButton* m_pAddrEditButton;
- MetricField* m_pSendLeftField;
- MetricField* m_pSendTopField;
- MenuButton* m_pSendEditButton;
- ListBox* m_pSizeFormatBox;
- MetricField* m_pSizeWidthField;
- MetricField* m_pSizeHeightField;
- SwEnvPreview* m_pPreview;
+ VclPtr<MetricField> m_pAddrLeftField;
+ VclPtr<MetricField> m_pAddrTopField;
+ VclPtr<MenuButton> m_pAddrEditButton;
+ VclPtr<MetricField> m_pSendLeftField;
+ VclPtr<MetricField> m_pSendTopField;
+ VclPtr<MenuButton> m_pSendEditButton;
+ VclPtr<ListBox> m_pSizeFormatBox;
+ VclPtr<MetricField> m_pSizeWidthField;
+ VclPtr<MetricField> m_pSizeHeightField;
+ VclPtr<SwEnvPreview> m_pPreview;
std::vector<sal_uInt16> aIDs;
- SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet);
-
DECL_LINK( ModifyHdl, Edit * );
DECL_LINK( EditHdl, MenuButton * );
DECL_LINK(FormatHdl, void *);
@@ -59,8 +57,11 @@ class SwEnvFmtPage : public SfxTabPage
using TabPage::DeactivatePage;
public:
+ SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~SwEnvFmtPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx
index 575d865fb74f..d0fcedae9073 100644
--- a/sw/source/ui/envelp/envlop1.cxx
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -153,8 +153,14 @@ SwEnvDlg::SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet,
SwEnvDlg::~SwEnvDlg()
{
+ disposeOnce();
+}
+
+void SwEnvDlg::dispose()
+{
delete pAddresseeSet;
delete pSenderSet;
+ SfxTabDialog::dispose();
}
void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
@@ -229,6 +235,20 @@ SwEnvPage::SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet)
SwEnvPage::~SwEnvPage()
{
+ disposeOnce();
+}
+
+void SwEnvPage::dispose()
+{
+ m_pAddrEdit.clear();
+ m_pDatabaseLB.clear();
+ m_pTableLB.clear();
+ m_pDBFieldLB.clear();
+ m_pInsertBT.clear();
+ m_pSenderBox.clear();
+ m_pSenderEdit.clear();
+ m_pPreview.clear();
+ SfxTabPage::dispose();
}
IMPL_LINK( SwEnvPage, DatabaseHdl, ListBox *, pListBox )
@@ -303,9 +323,9 @@ void SwEnvPage::InitDatabaseBox()
}
}
-SfxTabPage* SwEnvPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SwEnvPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SwEnvPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwEnvPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwEnvPage::ActivatePage(const SfxItemSet& rSet)
diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx
index 309ccc356e27..10b3a0d323de 100644
--- a/sw/source/ui/envelp/envprt.cxx
+++ b/sw/source/ui/envelp/envprt.cxx
@@ -67,6 +67,23 @@ SwEnvPrtPage::SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet)
m_aIds[ENV_VER_RGHT] = m_pAlignBox->GetItemId("vertright");
}
+SwEnvPrtPage::~SwEnvPrtPage()
+{
+ disposeOnce();
+}
+
+void SwEnvPrtPage::dispose()
+{
+ m_pAlignBox.clear();
+ m_pTopButton.clear();
+ m_pBottomButton.clear();
+ m_pRightField.clear();
+ m_pDownField.clear();
+ m_pPrinterInfo.clear();
+ m_pPrtSetup.clear();
+ SfxTabPage::dispose();
+}
+
IMPL_LINK_NOARG(SwEnvPrtPage, ClickHdl)
{
if (m_pBottomButton->IsChecked())
@@ -99,7 +116,7 @@ IMPL_LINK( SwEnvPrtPage, ButtonHdl, Button *, pBtn )
// Call printer setup
if (pPrt)
{
- boost::scoped_ptr<PrinterSetupDialog> pDlg(new PrinterSetupDialog(this));
+ VclPtrInstance< PrinterSetupDialog > pDlg(this);
pDlg->SetPrinter(pPrt);
pDlg->Execute();
pDlg.reset();
@@ -127,9 +144,9 @@ IMPL_LINK_NOARG(SwEnvPrtPage, AlignHdl)
return 0;
}
-SfxTabPage* SwEnvPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SwEnvPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SwEnvPrtPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwEnvPrtPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwEnvPrtPage::ActivatePage(const SfxItemSet&)
diff --git a/sw/source/ui/envelp/envprt.hxx b/sw/source/ui/envelp/envprt.hxx
index 2c947d53c3a1..a71c96b3a9e6 100644
--- a/sw/source/ui/envelp/envprt.hxx
+++ b/sw/source/ui/envelp/envprt.hxx
@@ -35,19 +35,17 @@ class SwEnvDlg;
class SwEnvPrtPage : public SfxTabPage
{
- ToolBox* m_pAlignBox;
- RadioButton* m_pTopButton;
- RadioButton* m_pBottomButton;
- MetricField* m_pRightField;
- MetricField* m_pDownField;
- FixedText* m_pPrinterInfo;
- PushButton* m_pPrtSetup;
+ VclPtr<ToolBox> m_pAlignBox;
+ VclPtr<RadioButton> m_pTopButton;
+ VclPtr<RadioButton> m_pBottomButton;
+ VclPtr<MetricField> m_pRightField;
+ VclPtr<MetricField> m_pDownField;
+ VclPtr<FixedText> m_pPrinterInfo;
+ VclPtr<PushButton> m_pPrtSetup;
sal_uInt16 m_aIds[ENV_VER_RGHT-ENV_HOR_LEFT+1];
- Printer* pPrt;
-
- SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ VclPtr<Printer> pPrt;
DECL_LINK(ClickHdl, void *);
DECL_LINK(AlignHdl, void *);
@@ -59,8 +57,11 @@ class SwEnvPrtPage : public SfxTabPage
using TabPage::DeactivatePage;
public:
+ SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~SwEnvPrtPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 426816ec8e3c..8cf472141a12 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -170,7 +170,14 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet,
SwLabDlg::~SwLabDlg()
{
+ disposeOnce();
+}
+
+void SwLabDlg::dispose()
+{
delete pRecs;
+ pPrtPage.clear();
+ SfxTabDialog::dispose();
}
void SwLabDlg::GetLabItem(SwLabItem &rItem)
@@ -286,6 +293,29 @@ SwLabPage::SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet)
m_pMakeBox->GetSelectHdl().Call(m_pMakeBox);
}
+SwLabPage::~SwLabPage()
+{
+ disposeOnce();
+}
+
+void SwLabPage::dispose()
+{
+ m_pAddressFrame.clear();
+ m_pAddrBox.clear();
+ m_pWritingEdit.clear();
+ m_pDatabaseLB.clear();
+ m_pTableLB.clear();
+ m_pInsertBT.clear();
+ m_pDBFieldLB.clear();
+ m_pContButton.clear();
+ m_pSheetButton.clear();
+ m_pMakeBox.clear();
+ m_pTypeBox.clear();
+ m_pHiddenSortTypeBox.clear();
+ m_pFormatInfo.clear();
+ SfxTabPage::dispose();
+}
+
void SwLabPage::SetToBusinessCard()
{
SetHelpId(HID_BUSINESS_FMT_PAGE);
@@ -406,24 +436,24 @@ IMPL_LINK_NOARG_INLINE_END(SwLabPage, TypeHdl)
void SwLabPage::DisplayFormat()
{
- MetricField aField(this, WinBits(0));
+ ScopedVclPtrInstance< MetricField > aField(this, WinBits(0));
FieldUnit aMetric = ::GetDfltMetric(false);
- SetMetric(aField, aMetric);
- aField.SetDecimalDigits(2);
- aField.SetMin (0);
- aField.SetMax (LONG_MAX);
+ SetMetric(*aField.get(), aMetric);
+ aField->SetDecimalDigits(2);
+ aField->SetMin (0);
+ aField->SetMax (LONG_MAX);
SwLabRec* pRec = GetSelectedEntryPos();
aItem.aLstType = pRec->aType;
- SETFLDVAL(aField, pRec->lWidth);
- aField.Reformat();
- const OUString aWString = aField.GetText();
+ SETFLDVAL(*aField.get(), pRec->lWidth);
+ aField->Reformat();
+ const OUString aWString = aField->GetText();
- SETFLDVAL(aField, pRec->lHeight);
- aField.Reformat();
+ SETFLDVAL(*aField.get(), pRec->lHeight);
+ aField->Reformat();
OUString aText = pRec->aType + ": " + aWString +
- " x " + aField.GetText() +
+ " x " + aField->GetText() +
" (" + OUString::number( pRec->nCols ) +
" x " + OUString::number( pRec->nRows ) + ")";
m_pFormatInfo->SetText(aText);
@@ -458,9 +488,9 @@ void SwLabPage::InitDatabaseBox()
}
}
-SfxTabPage* SwLabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SwLabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SwLabPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwLabPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwLabPage::ActivatePage(const SfxItemSet& rSet)
@@ -586,17 +616,26 @@ SwVisitingCardPage::SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& r
SwVisitingCardPage::~SwVisitingCardPage()
{
+ disposeOnce();
+}
+
+void SwVisitingCardPage::dispose()
+{
for(sal_Int32 i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); ++i)
delete static_cast<OUString*>(m_pAutoTextGroupLB->GetEntryData( i ));
m_xAutoText = 0;
ClearUserData();
delete pExampleFrame;
+ m_pAutoTextLB.clear();
+ m_pAutoTextGroupLB.clear();
+ m_pExampleWIN.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SwVisitingCardPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwVisitingCardPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet)
@@ -727,9 +766,37 @@ SwPrivateDataPage::SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSe
SetExchangeSupport();
}
-SfxTabPage* SwPrivateDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+SwPrivateDataPage::~SwPrivateDataPage()
{
- return new SwPrivateDataPage(pParent, *rSet);
+ disposeOnce();
+}
+
+void SwPrivateDataPage::dispose()
+{
+ m_pFirstNameED.clear();
+ m_pNameED.clear();
+ m_pShortCutED.clear();
+ m_pFirstName2ED.clear();
+ m_pName2ED.clear();
+ m_pShortCut2ED.clear();
+ m_pStreetED.clear();
+ m_pZipED.clear();
+ m_pCityED.clear();
+ m_pCountryED.clear();
+ m_pStateED.clear();
+ m_pTitleED.clear();
+ m_pProfessionED.clear();
+ m_pPhoneED.clear();
+ m_pMobilePhoneED.clear();
+ m_pFaxED.clear();
+ m_pHomePageED.clear();
+ m_pMailED.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwPrivateDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+{
+ return VclPtr<SfxTabPage>(new SwPrivateDataPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet)
@@ -815,9 +882,34 @@ SwBusinessDataPage::SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& r
SetExchangeSupport();
}
-SfxTabPage* SwBusinessDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+SwBusinessDataPage::~SwBusinessDataPage()
+{
+ disposeOnce();
+}
+
+void SwBusinessDataPage::dispose()
+{
+ m_pCompanyED.clear();
+ m_pCompanyExtED.clear();
+ m_pSloganED.clear();
+ m_pStreetED.clear();
+ m_pZipED.clear();
+ m_pCityED.clear();
+ m_pCountryED.clear();
+ m_pStateED.clear();
+ m_pPositionED.clear();
+ m_pPhoneED.clear();
+ m_pMobilePhoneED.clear();
+ m_pFaxED.clear();
+ m_pHomePageED.clear();
+ m_pMailED.clear();
+ SfxTabPage::dispose();
+}
+
+
+VclPtr<SfxTabPage> SwBusinessDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SwBusinessDataPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwBusinessDataPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet)
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index 9e9a216f5848..646da3d044b4 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -353,8 +353,29 @@ SwLabFmtPage::SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet)
SwLabFmtPage::~SwLabFmtPage()
{
+ disposeOnce();
}
+void SwLabFmtPage::dispose()
+{
+ m_pMakeFI.clear();
+ m_pTypeFI.clear();
+ m_pPreview.clear();
+ m_pHDistField.clear();
+ m_pVDistField.clear();
+ m_pWidthField.clear();
+ m_pHeightField.clear();
+ m_pLeftField.clear();
+ m_pUpperField.clear();
+ m_pColsField.clear();
+ m_pRowsField.clear();
+ m_pPWidthField.clear();
+ m_pPHeightField.clear();
+ m_pSavePB.clear();
+ SfxTabPage::dispose();
+}
+
+
// Modify-handler of MetricFields. start preview timer
IMPL_LINK_NOARG_INLINE_START(SwLabFmtPage, ModifyHdl)
{
@@ -464,9 +485,9 @@ void SwLabFmtPage::ChangeMinMax()
m_pPHeightField->Reformat();
}
-SfxTabPage* SwLabFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SwLabFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SwLabFmtPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwLabFmtPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwLabFmtPage::ActivatePage(const SfxItemSet& rSet)
@@ -558,7 +579,7 @@ IMPL_LINK_NOARG(SwLabFmtPage, SaveHdl)
aRec.lPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
aRec.lPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
aRec.bCont = aItem.bCont;
- boost::scoped_ptr<SwSaveLabelDlg> pSaveDlg(new SwSaveLabelDlg(this, aRec));
+ ScopedVclPtrInstance< SwSaveLabelDlg > pSaveDlg(this, aRec);
pSaveDlg->SetLabel(aItem.aLstMake, aItem.aLstType);
pSaveDlg->Execute();
if(pSaveDlg->GetLabel(aItem))
@@ -600,6 +621,20 @@ SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec)
}
}
+SwSaveLabelDlg::~SwSaveLabelDlg()
+{
+ disposeOnce();
+}
+
+void SwSaveLabelDlg::dispose()
+{
+ m_pMakeCB.clear();
+ m_pTypeED.clear();
+ m_pOKPB.clear();
+ pLabPage.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl)
{
SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig();
@@ -614,15 +649,15 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl)
return 0;
}
- MessageDialog aQuery(this, "QuerySaveLabelDialog",
- "modules/swriter/ui/querysavelabeldialog.ui");
+ ScopedVclPtrInstance<MessageDialog> aQuery(this, "QuerySaveLabelDialog",
+ "modules/swriter/ui/querysavelabeldialog.ui");
- aQuery.set_primary_text(aQuery.get_primary_text().
+ aQuery->set_primary_text(aQuery->get_primary_text().
replaceAll("%1", sMake).replaceAll("%2", sType));
- aQuery.set_secondary_text(aQuery.get_secondary_text().
+ aQuery->set_secondary_text(aQuery->get_secondary_text().
replaceAll("%1", sMake).replaceAll("%2", sType));
- if (RET_YES != aQuery.Execute())
+ if (RET_YES != aQuery->Execute())
return 0;
}
rLabRec.aType = sType;
diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx
index a50d525ebcce..d35833a7122b 100644
--- a/sw/source/ui/envelp/labfmt.hxx
+++ b/sw/source/ui/envelp/labfmt.hxx
@@ -69,29 +69,26 @@ public:
class SwLabFmtPage : public SfxTabPage
{
- FixedText* m_pMakeFI;
- FixedText* m_pTypeFI;
- SwLabPreview* m_pPreview;
- MetricField* m_pHDistField;
- MetricField* m_pVDistField;
- MetricField* m_pWidthField;
- MetricField* m_pHeightField;
- MetricField* m_pLeftField;
- MetricField* m_pUpperField;
- NumericField* m_pColsField;
- NumericField* m_pRowsField;
- MetricField* m_pPWidthField;
- MetricField* m_pPHeightField;
- PushButton* m_pSavePB;
+ VclPtr<FixedText> m_pMakeFI;
+ VclPtr<FixedText> m_pTypeFI;
+ VclPtr<SwLabPreview> m_pPreview;
+ VclPtr<MetricField> m_pHDistField;
+ VclPtr<MetricField> m_pVDistField;
+ VclPtr<MetricField> m_pWidthField;
+ VclPtr<MetricField> m_pHeightField;
+ VclPtr<MetricField> m_pLeftField;
+ VclPtr<MetricField> m_pUpperField;
+ VclPtr<NumericField> m_pColsField;
+ VclPtr<NumericField> m_pRowsField;
+ VclPtr<MetricField> m_pPWidthField;
+ VclPtr<MetricField> m_pPHeightField;
+ VclPtr<PushButton> m_pSavePB;
Idle aPreviewIdle;
bool bModified;
SwLabItem aItem;
- SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet);
- virtual ~SwLabFmtPage();
-
DECL_LINK(ModifyHdl, void *);
DECL_LINK(PreviewHdl, void *);
DECL_LINK( LoseFocusHdl, Control * );
@@ -103,8 +100,11 @@ class SwLabFmtPage : public SfxTabPage
using TabPage::DeactivatePage;
public:
+ SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~SwLabFmtPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
@@ -117,12 +117,12 @@ public:
class SwSaveLabelDlg : public ModalDialog
{
- ComboBox* m_pMakeCB;
- Edit* m_pTypeED;
- OKButton* m_pOKPB;
+ VclPtr<ComboBox> m_pMakeCB;
+ VclPtr<Edit> m_pTypeED;
+ VclPtr<OKButton> m_pOKPB;
bool bSuccess;
- SwLabFmtPage* pLabPage;
+ VclPtr<SwLabFmtPage> pLabPage;
SwLabRec& rLabRec;
DECL_LINK(OkHdl, void *);
@@ -130,6 +130,8 @@ class SwSaveLabelDlg : public ModalDialog
public:
SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec);
+ virtual ~SwSaveLabelDlg();
+ virtual void dispose() SAL_OVERRIDE;
void SetLabel(const OUString& rMake, const OUString& rType)
{
diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx
index 5574fce5de49..9443dfcb9622 100644
--- a/sw/source/ui/envelp/labprt.cxx
+++ b/sw/source/ui/envelp/labprt.cxx
@@ -62,7 +62,22 @@ SwLabPrtPage::SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet)
SwLabPrtPage::~SwLabPrtPage()
{
- delete pPrinter;
+ disposeOnce();
+}
+
+void SwLabPrtPage::dispose()
+{
+ pPrinter.disposeAndClear();
+ m_pPageButton.clear();
+ m_pSingleButton.clear();
+ m_pSingleGrid.clear();
+ m_pPrinterFrame.clear();
+ m_pColField.clear();
+ m_pRowField.clear();
+ m_pSynchronCB.clear();
+ m_pPrinterInfo.clear();
+ m_pPrtSetup.clear();
+ SfxTabPage::dispose();
}
IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton )
@@ -73,7 +88,7 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton )
if (!pPrinter)
pPrinter = new Printer;
- boost::scoped_ptr<PrinterSetupDialog> pDlg(new PrinterSetupDialog(this));
+ VclPtrInstance< PrinterSetupDialog > pDlg(this);
pDlg->SetPrinter(pPrinter);
pDlg->Execute();
pDlg.reset();
@@ -93,9 +108,9 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton )
return 0;
}
-SfxTabPage* SwLabPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
+VclPtr<SfxTabPage> SwLabPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
{
- return new SwLabPrtPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>(new SwLabPrtPage( pParent, *rSet ), SAL_NO_ACQUIRE);
}
void SwLabPrtPage::ActivatePage( const SfxItemSet& rSet )
diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx
index c011687f6cd7..45b5decffb5e 100644
--- a/sw/source/ui/envelp/labprt.hxx
+++ b/sw/source/ui/envelp/labprt.hxx
@@ -31,21 +31,18 @@ class SwLabItem;
class SwLabPrtPage : public SfxTabPage
{
- Printer* pPrinter; // for the shaft setting - unfortunately
+ VclPtr<Printer> pPrinter; // for the shaft setting - unfortunately
- RadioButton* m_pPageButton;
- RadioButton* m_pSingleButton;
- VclContainer* m_pSingleGrid;
- VclContainer* m_pPrinterFrame;
- NumericField* m_pColField;
- NumericField* m_pRowField;
- CheckBox* m_pSynchronCB;
+ VclPtr<RadioButton> m_pPageButton;
+ VclPtr<RadioButton> m_pSingleButton;
+ VclPtr<VclContainer> m_pSingleGrid;
+ VclPtr<VclContainer> m_pPrinterFrame;
+ VclPtr<NumericField> m_pColField;
+ VclPtr<NumericField> m_pRowField;
+ VclPtr<CheckBox> m_pSynchronCB;
- FixedText* m_pPrinterInfo;
- PushButton* m_pPrtSetup;
-
- SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet);
- virtual ~SwLabPrtPage();
+ VclPtr<FixedText> m_pPrinterInfo;
+ VclPtr<PushButton> m_pPrtSetup;
DECL_LINK( CountHdl, Button * );
@@ -55,8 +52,11 @@ class SwLabPrtPage : public SfxTabPage
using TabPage::DeactivatePage;
public:
+ SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~SwLabPrtPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index dac471ea8bc3..25397c3f66ef 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -389,6 +389,11 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
SwMailMergeDlg::~SwMailMergeDlg()
{
+ disposeOnce();
+}
+
+void SwMailMergeDlg::dispose()
+{
if(m_xFrame.is())
{
m_xFrame->setComponent(NULL, NULL);
@@ -401,6 +406,39 @@ SwMailMergeDlg::~SwMailMergeDlg()
delete pData;
}
delete pImpl;
+ m_pBeamerWin.clear();
+ m_pAllRB.clear();
+ m_pMarkedRB.clear();
+ m_pFromRB.clear();
+ m_pFromNF.clear();
+ m_pToNF.clear();
+ m_pPrinterRB.clear();
+ m_pMailingRB.clear();
+ m_pFileRB.clear();
+ m_pSingleJobsCB.clear();
+ m_pSaveMergedDocumentFT.clear();
+ m_pSaveSingleDocRB.clear();
+ m_pSaveIndividualRB.clear();
+ m_pGenerateFromDataBaseCB.clear();
+ m_pColumnFT.clear();
+ m_pColumnLB.clear();
+ m_pPathFT.clear();
+ m_pPathED.clear();
+ m_pPathPB.clear();
+ m_pFilterFT.clear();
+ m_pFilterLB.clear();
+ m_pAddressFldLB.clear();
+ m_pSubjectFT.clear();
+ m_pSubjectED.clear();
+ m_pFormatFT.clear();
+ m_pAttachFT.clear();
+ m_pAttachED.clear();
+ m_pAttachPB.clear();
+ m_pFormatHtmlCB.clear();
+ m_pFormatRtfCB.clear();
+ m_pFormatSwCB.clear();
+ m_pOkBTN.clear();
+ SvxStandardDialog::dispose();
}
void SwMailMergeDlg::Apply()
@@ -633,6 +671,17 @@ SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(vcl::Window* pParent)
get(m_pThisDocRB, "document");
}
+SwMailMergeCreateFromDlg::~SwMailMergeCreateFromDlg()
+{
+ disposeOnce();
+}
+
+void SwMailMergeCreateFromDlg::dispose()
+{
+ m_pThisDocRB.clear();
+ ModalDialog::dispose();
+}
+
SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(vcl::Window* pParent)
: ModalDialog(pParent, "MergeConnectDialog",
"modules/swriter/ui/mergeconnectdialog.ui")
@@ -640,4 +689,15 @@ SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(vcl::Window* pPar
get(m_pUseExistingRB, "existing");
}
+SwMailMergeFieldConnectionsDlg::~SwMailMergeFieldConnectionsDlg()
+{
+ disposeOnce();
+}
+
+void SwMailMergeFieldConnectionsDlg::dispose()
+{
+ m_pUseExistingRB.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx
index 0aa045936d7e..d69af8dd5ee1 100644
--- a/sw/source/ui/envelp/swuilabimp.hxx
+++ b/sw/source/ui/envelp/swuilabimp.hxx
@@ -29,26 +29,24 @@ class SwLabPage : public SfxTabPage
OUString sActDBName;
SwLabItem aItem;
- VclContainer* m_pAddressFrame;
-
- CheckBox* m_pAddrBox;
- VclMultiLineEdit* m_pWritingEdit;
- ListBox* m_pDatabaseLB;
- ListBox* m_pTableLB;
- PushButton* m_pInsertBT;
- ListBox* m_pDBFieldLB;
-
- RadioButton* m_pContButton;
- RadioButton* m_pSheetButton;
- ListBox* m_pMakeBox;
- ListBox* m_pTypeBox;
- ListBox* m_pHiddenSortTypeBox;
- FixedText* m_pFormatInfo;
+ VclPtr<VclContainer> m_pAddressFrame;
+
+ VclPtr<CheckBox> m_pAddrBox;
+ VclPtr<VclMultiLineEdit> m_pWritingEdit;
+ VclPtr<ListBox> m_pDatabaseLB;
+ VclPtr<ListBox> m_pTableLB;
+ VclPtr<PushButton> m_pInsertBT;
+ VclPtr<ListBox> m_pDBFieldLB;
+
+ VclPtr<RadioButton> m_pContButton;
+ VclPtr<RadioButton> m_pSheetButton;
+ VclPtr<ListBox> m_pMakeBox;
+ VclPtr<ListBox> m_pTypeBox;
+ VclPtr<ListBox> m_pHiddenSortTypeBox;
+ VclPtr<FixedText> m_pFormatInfo;
bool m_bLabel;
- SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet);
-
DECL_LINK(AddrHdl, void *);
DECL_LINK( DatabaseHdl, ListBox *pListBox );
DECL_LINK(FieldHdl, void *);
@@ -63,8 +61,12 @@ class SwLabPage : public SfxTabPage
using TabPage::DeactivatePage;
public:
+ SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet);
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ virtual ~SwLabPage();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
@@ -84,9 +86,9 @@ public:
class SwOneExampleFrame;
class SwVisitingCardPage : public SfxTabPage
{
- SvTreeListBox* m_pAutoTextLB;
- ListBox* m_pAutoTextGroupLB;
- vcl::Window* m_pExampleWIN;
+ VclPtr<SvTreeListBox> m_pAutoTextLB;
+ VclPtr<ListBox> m_pAutoTextGroupLB;
+ VclPtr<vcl::Window> m_pExampleWIN;
OUString sTempURL;
@@ -108,15 +110,16 @@ class SwVisitingCardPage : public SfxTabPage
const OUString* pNames,
const OUString* pValues );
- SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet);
virtual ~SwVisitingCardPage();
+ virtual void dispose() SAL_OVERRIDE;
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
public:
+ SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet);
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
@@ -126,35 +129,36 @@ public:
class SwPrivateDataPage : public SfxTabPage
{
- Edit* m_pFirstNameED;
- Edit* m_pNameED;
- Edit* m_pShortCutED;
-
- Edit* m_pFirstName2ED;
- Edit* m_pName2ED;
- Edit* m_pShortCut2ED;
-
- Edit* m_pStreetED;
- Edit* m_pZipED;
- Edit* m_pCityED;
- Edit* m_pCountryED;
- Edit* m_pStateED;
- Edit* m_pTitleED;
- Edit* m_pProfessionED;
- Edit* m_pPhoneED;
- Edit* m_pMobilePhoneED;
- Edit* m_pFaxED;
- Edit* m_pHomePageED;
- Edit* m_pMailED;
-
- SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ VclPtr<Edit> m_pFirstNameED;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<Edit> m_pShortCutED;
+
+ VclPtr<Edit> m_pFirstName2ED;
+ VclPtr<Edit> m_pName2ED;
+ VclPtr<Edit> m_pShortCut2ED;
+
+ VclPtr<Edit> m_pStreetED;
+ VclPtr<Edit> m_pZipED;
+ VclPtr<Edit> m_pCityED;
+ VclPtr<Edit> m_pCountryED;
+ VclPtr<Edit> m_pStateED;
+ VclPtr<Edit> m_pTitleED;
+ VclPtr<Edit> m_pProfessionED;
+ VclPtr<Edit> m_pPhoneED;
+ VclPtr<Edit> m_pMobilePhoneED;
+ VclPtr<Edit> m_pFaxED;
+ VclPtr<Edit> m_pHomePageED;
+ VclPtr<Edit> m_pMailED;
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
public:
+ SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~SwPrivateDataPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
@@ -164,33 +168,34 @@ public:
class SwBusinessDataPage : public SfxTabPage
{
- Edit* m_pCompanyED;
- Edit* m_pCompanyExtED;
- Edit* m_pSloganED;
+ VclPtr<Edit> m_pCompanyED;
+ VclPtr<Edit> m_pCompanyExtED;
+ VclPtr<Edit> m_pSloganED;
- Edit* m_pStreetED;
- Edit* m_pZipED;
- Edit* m_pCityED;
- Edit* m_pCountryED;
- Edit* m_pStateED;
+ VclPtr<Edit> m_pStreetED;
+ VclPtr<Edit> m_pZipED;
+ VclPtr<Edit> m_pCityED;
+ VclPtr<Edit> m_pCountryED;
+ VclPtr<Edit> m_pStateED;
- Edit* m_pPositionED;
+ VclPtr<Edit> m_pPositionED;
- Edit* m_pPhoneED;
- Edit* m_pMobilePhoneED;
- Edit* m_pFaxED;
+ VclPtr<Edit> m_pPhoneED;
+ VclPtr<Edit> m_pMobilePhoneED;
+ VclPtr<Edit> m_pFaxED;
- Edit* m_pHomePageED;
- Edit* m_pMailED;
-
- SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ VclPtr<Edit> m_pHomePageED;
+ VclPtr<Edit> m_pMailED;
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
public:
+ SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~SwBusinessDataPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx
index fce5029d6e32..12ebb825233a 100644
--- a/sw/source/ui/fldui/DropDownFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -71,6 +71,20 @@ sw::DropDownFieldDialog::DropDownFieldDialog(vcl::Window *pParent, SwWrtShell &r
m_pListItemsLB->GrabFocus();
}
+sw::DropDownFieldDialog::~DropDownFieldDialog()
+{
+ disposeOnce();
+}
+
+void sw::DropDownFieldDialog::dispose()
+{
+ m_pListItemsLB.clear();
+ m_pOKPB.clear();
+ m_pNextPB.clear();
+ m_pEditPB.clear();
+ SvxStandardDialog::dispose();
+}
+
void sw::DropDownFieldDialog::Apply()
{
if(pDropField)
diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx
index d5a171d3b0af..b94c049dd59f 100644
--- a/sw/source/ui/fldui/changedb.cxx
+++ b/sw/source/ui/fldui/changedb.cxx
@@ -164,8 +164,20 @@ SvTreeListEntry* SwChangeDBDlg::Insert(const OUString& rDBName)
// destroy dialog
SwChangeDBDlg::~SwChangeDBDlg()
{
+ disposeOnce();
+}
+
+void SwChangeDBDlg::dispose()
+{
delete pMgr;
+ m_pUsedDBTLB.clear();
+ m_pAvailDBTLB.clear();
+ m_pAddDBPB.clear();
+ m_pDocDBNameFT.clear();
+ m_pDefineBT.clear();
+ SvxStandardDialog::dispose();
}
+
// close
void SwChangeDBDlg::Apply()
{
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index a2af66a9d61a..edde37524594 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -74,6 +74,24 @@ SwFldDBPage::SwFldDBPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
SwFldDBPage::~SwFldDBPage()
{
+ disposeOnce();
+}
+
+void SwFldDBPage::dispose()
+{
+ m_pTypeLB.clear();
+ m_pDatabaseTLB.clear();
+ m_pAddDBPB.clear();
+ m_pCondition.clear();
+ m_pConditionED.clear();
+ m_pValue.clear();
+ m_pValueED.clear();
+ m_pDBFormatRB.clear();
+ m_pNewFormatRB.clear();
+ m_pNumFormatLB.clear();
+ m_pFormatLB.clear();
+ m_pFormat.clear();
+ SwFldPage::dispose();
}
// initialise TabPage
@@ -246,10 +264,10 @@ bool SwFldDBPage::FillItemSet(SfxItemSet* )
return false;
}
-SfxTabPage* SwFldDBPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwFldDBPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SwFldDBPage( pParent, *rAttrSet ) );
+ return VclPtr<SwFldDBPage>::Create( pParent, *rAttrSet );
}
sal_uInt16 SwFldDBPage::GetGroup()
diff --git a/sw/source/ui/fldui/flddb.hxx b/sw/source/ui/fldui/flddb.hxx
index 6163cb9566d3..bb18eb27fe82 100644
--- a/sw/source/ui/fldui/flddb.hxx
+++ b/sw/source/ui/fldui/flddb.hxx
@@ -32,20 +32,20 @@
class SwFldDBPage : public SwFldPage
{
- ListBox* m_pTypeLB;
- SwDBTreeList* m_pDatabaseTLB;
+ VclPtr<ListBox> m_pTypeLB;
+ VclPtr<SwDBTreeList> m_pDatabaseTLB;
- PushButton* m_pAddDBPB;
+ VclPtr<PushButton> m_pAddDBPB;
- VclContainer* m_pCondition;
- ConditionEdit* m_pConditionED;
- VclContainer* m_pValue;
- Edit* m_pValueED;
- RadioButton* m_pDBFormatRB;
- RadioButton* m_pNewFormatRB;
- NumFormatListBox* m_pNumFormatLB;
- ListBox* m_pFormatLB;
- VclContainer* m_pFormat;
+ VclPtr<VclContainer> m_pCondition;
+ VclPtr<ConditionEdit> m_pConditionED;
+ VclPtr<VclContainer> m_pValue;
+ VclPtr<Edit> m_pValueED;
+ VclPtr<RadioButton> m_pDBFormatRB;
+ VclPtr<RadioButton> m_pNewFormatRB;
+ VclPtr<NumFormatListBox> m_pNumFormatLB;
+ VclPtr<ListBox> m_pFormatLB;
+ VclPtr<VclContainer> m_pFormat;
OUString m_sOldDBName;
OUString m_sOldTableName;
@@ -71,8 +71,9 @@ public:
SwFldDBPage(vcl::Window* pParent, const SfxItemSet& rSet);
virtual ~SwFldDBPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
index 1655f570b768..8814ceb3c3f9 100644
--- a/sw/source/ui/fldui/flddinf.cxx
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -89,6 +89,18 @@ SwFldDokInfPage::SwFldDokInfPage(vcl::Window* pParent, const SfxItemSet& rCoreSe
SwFldDokInfPage::~SwFldDokInfPage()
{
+ disposeOnce();
+}
+
+void SwFldDokInfPage::dispose()
+{
+ m_pTypeTLB.clear();
+ m_pSelection.clear();
+ m_pSelectionLB.clear();
+ m_pFormat.clear();
+ m_pFormatLB.clear();
+ m_pFixedCB.clear();
+ SwFldPage::dispose();
}
void SwFldDokInfPage::Reset(const SfxItemSet* )
@@ -450,10 +462,10 @@ bool SwFldDokInfPage::FillItemSet(SfxItemSet* )
return false;
}
-SfxTabPage* SwFldDokInfPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwFldDokInfPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SwFldDokInfPage( pParent, *rAttrSet ) );
+ return VclPtr<SwFldDokInfPage>::Create( pParent, *rAttrSet );
}
sal_uInt16 SwFldDokInfPage::GetGroup()
diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx
index 596d3bc2d3b7..fc9452075b4a 100644
--- a/sw/source/ui/fldui/flddinf.hxx
+++ b/sw/source/ui/fldui/flddinf.hxx
@@ -36,12 +36,12 @@ namespace com{namespace sun{ namespace star{ namespace beans{
class SwFldDokInfPage : public SwFldPage
{
- SvTreeListBox* m_pTypeTLB;
- VclContainer* m_pSelection;
- ListBox* m_pSelectionLB;
- VclContainer* m_pFormat;
- NumFormatListBox* m_pFormatLB;
- CheckBox* m_pFixedCB;
+ VclPtr<SvTreeListBox> m_pTypeTLB;
+ VclPtr<VclContainer> m_pSelection;
+ VclPtr<ListBox> m_pSelectionLB;
+ VclPtr<VclContainer> m_pFormat;
+ VclPtr<NumFormatListBox> m_pFormatLB;
+ VclPtr<CheckBox> m_pFixedCB;
SvTreeListEntry* pSelEntry;
com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > xCustomPropertySet;
@@ -62,8 +62,9 @@ public:
SwFldDokInfPage(vcl::Window* pWindow, const SfxItemSet& rSet);
virtual ~SwFldDokInfPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index ea3ec74a5bb9..f8dc98f74e6a 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -80,8 +80,29 @@ SwFldDokPage::SwFldDokPage(vcl::Window* pParent, const SfxItemSet& rCoreSet )
SwFldDokPage::~SwFldDokPage()
{
+ disposeOnce();
}
+void SwFldDokPage::dispose()
+{
+ m_pTypeLB.clear();
+ m_pSelection.clear();
+ m_pSelectionLB.clear();
+ m_pValueFT.clear();
+ m_pValueED.clear();
+ m_pLevelFT.clear();
+ m_pLevelED.clear();
+ m_pDateFT.clear();
+ m_pTimeFT.clear();
+ m_pDateOffsetED.clear();
+ m_pFormat.clear();
+ m_pFormatLB.clear();
+ m_pNumFormatLB.clear();
+ m_pFixedCB.clear();
+ SwFldPage::dispose();
+}
+
+
void SwFldDokPage::Reset(const SfxItemSet* )
{
SavePos(m_pTypeLB);
@@ -632,10 +653,10 @@ bool SwFldDokPage::FillItemSet(SfxItemSet* )
return false;
}
-SfxTabPage* SwFldDokPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwFldDokPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SwFldDokPage( pParent, *rAttrSet ) );
+ return VclPtr<SwFldDokPage>::Create( pParent, *rAttrSet );
}
sal_uInt16 SwFldDokPage::GetGroup()
diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx
index 4e8abc27e2b0..3beb6a7c0a1b 100644
--- a/sw/source/ui/fldui/flddok.hxx
+++ b/sw/source/ui/fldui/flddok.hxx
@@ -32,20 +32,20 @@
class SwFldDokPage : public SwFldPage
{
- ListBox* m_pTypeLB;
- VclContainer* m_pSelection;
- ListBox* m_pSelectionLB;
- FixedText* m_pValueFT;
- Edit* m_pValueED;
- FixedText* m_pLevelFT;
- NumericField* m_pLevelED;
- FixedText* m_pDateFT;
- FixedText* m_pTimeFT;
- NumericField* m_pDateOffsetED;
- VclContainer* m_pFormat;
- ListBox* m_pFormatLB;
- NumFormatListBox* m_pNumFormatLB;
- CheckBox* m_pFixedCB;
+ VclPtr<ListBox> m_pTypeLB;
+ VclPtr<VclContainer> m_pSelection;
+ VclPtr<ListBox> m_pSelectionLB;
+ VclPtr<FixedText> m_pValueFT;
+ VclPtr<Edit> m_pValueED;
+ VclPtr<FixedText> m_pLevelFT;
+ VclPtr<NumericField> m_pLevelED;
+ VclPtr<FixedText> m_pDateFT;
+ VclPtr<FixedText> m_pTimeFT;
+ VclPtr<NumericField> m_pDateOffsetED;
+ VclPtr<VclContainer> m_pFormat;
+ VclPtr<ListBox> m_pFormatLB;
+ VclPtr<NumFormatListBox> m_pNumFormatLB;
+ VclPtr<CheckBox> m_pFixedCB;
sal_Int32 nOldSel;
sal_uLong nOldFormat;
@@ -64,8 +64,9 @@ public:
SwFldDokPage(vcl::Window* pWindow, const SfxItemSet& rSet);
virtual ~SwFldDokPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
index 32dd26eebaff..1b7906b02368 100644
--- a/sw/source/ui/fldui/fldedt.cxx
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -124,7 +124,7 @@ SwFldEditDlg::SwFldEditDlg(SwView& rVw)
// initialise controls
void SwFldEditDlg::Init()
{
- SwFldPage* pTabPage = static_cast<SwFldPage*>(GetTabPage());
+ VclPtr<SwFldPage> pTabPage = static_cast<SwFldPage*>(GetTabPage());
if( pTabPage )
{
@@ -159,10 +159,10 @@ void SwFldEditDlg::Init()
!pSh->HasReadonlySel() );
}
-SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup)
+VclPtr<SfxTabPage> SwFldEditDlg::CreatePage(sal_uInt16 nGroup)
{
// create TabPage
- SfxTabPage* pTabPage = 0;
+ VclPtr<SfxTabPage> pTabPage;
switch (nGroup)
{
@@ -193,7 +193,7 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup)
}
case GRP_DB:
pTabPage = SwFldDBPage::Create(get_content_area(), 0);
- static_cast<SwFldDBPage*>(pTabPage)->SetWrtShell(*pSh);
+ static_cast<SwFldDBPage*>(pTabPage.get())->SetWrtShell(*pSh);
break;
case GRP_VAR:
pTabPage = SwFldVarPage::Create(get_content_area(), 0);
@@ -205,7 +205,7 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup)
if (pTabPage)
{
- static_cast<SwFldPage*>(pTabPage)->SetWrtShell(pSh);
+ static_cast<SwFldPage*>(pTabPage.get())->SetWrtShell(pSh);
SetTabPage(pTabPage);
}
@@ -214,8 +214,17 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup)
SwFldEditDlg::~SwFldEditDlg()
{
+ disposeOnce();
+}
+
+void SwFldEditDlg::dispose()
+{
SwViewShell::SetCareWin(NULL);
pSh->EnterStdMode();
+ m_pPrevBT.clear();
+ m_pNextBT.clear();
+ m_pAddressBT.clear();
+ SfxSingleTabDialog::dispose();
}
void SwFldEditDlg::EnableInsert(bool bEnable)
@@ -235,12 +244,9 @@ IMPL_LINK_NOARG(SwFldEditDlg, OKHdl)
{
if (GetOKButton()->IsEnabled())
{
- SfxTabPage* pTabPage = GetTabPage();
+ VclPtr<SfxTabPage> pTabPage = GetTabPage();
if (pTabPage)
- {
pTabPage->FillItemSet(0);
-
- }
EndDialog( RET_OK );
}
@@ -261,7 +267,7 @@ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton )
pSh->EnterStdMode();
SwFieldType *pOldTyp = 0;
- SwFldPage* pTabPage = static_cast<SwFldPage*>(GetTabPage());
+ VclPtr<SwFldPage> pTabPage = static_cast<SwFldPage*>(GetTabPage());
//#112462# FillItemSet may delete the current field
//that's why it has to be called before accessing the current field
@@ -281,7 +287,7 @@ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton )
sal_uInt16 nGroup = rMgr.GetGroup(false, pCurFld->GetTypeId(), pCurFld->GetSubType());
if (nGroup != pTabPage->GetGroup())
- pTabPage = static_cast<SwFldPage*>(CreatePage(nGroup));
+ pTabPage = static_cast<SwFldPage*>(CreatePage(nGroup).get());
pTabPage->EditNewField();
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
index b190d69c67bd..f079e8787d90 100644
--- a/sw/source/ui/fldui/fldfunc.cxx
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -91,6 +91,37 @@ SwFldFuncPage::SwFldFuncPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
SwFldFuncPage::~SwFldFuncPage()
{
+ disposeOnce();
+}
+
+void SwFldFuncPage::dispose()
+{
+ m_pTypeLB.clear();
+ m_pSelectionLB.clear();
+ m_pFormat.clear();
+ m_pFormatLB.clear();
+ m_pNameFT.clear();
+ m_pNameED.clear();
+ m_pValueGroup.clear();
+ m_pValueFT.clear();
+ m_pValueED.clear();
+ m_pCond1FT.clear();
+ m_pCond1ED.clear();
+ m_pCond2FT.clear();
+ m_pCond2ED.clear();
+ m_pMacroBT.clear();
+ m_pListGroup.clear();
+ m_pListItemFT.clear();
+ m_pListItemED.clear();
+ m_pListAddPB.clear();
+ m_pListItemsFT.clear();
+ m_pListItemsLB.clear();
+ m_pListRemovePB.clear();
+ m_pListUpPB.clear();
+ m_pListDownPB.clear();
+ m_pListNameFT.clear();
+ m_pListNameED.clear();
+ SwFldPage::dispose();
}
void SwFldFuncPage::Reset(const SfxItemSet* )
@@ -597,10 +628,10 @@ OUString SwFldFuncPage::TurnMacroString(const OUString &rMacro)
return rMacro;
}
-SfxTabPage* SwFldFuncPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwFldFuncPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SwFldFuncPage( pParent, *rAttrSet ) );
+ return VclPtr<SwFldFuncPage>::Create( pParent, *rAttrSet );
}
sal_uInt16 SwFldFuncPage::GetGroup()
diff --git a/sw/source/ui/fldui/fldfunc.hxx b/sw/source/ui/fldui/fldfunc.hxx
index fb8cfa906969..fefc9db21ac4 100644
--- a/sw/source/ui/fldui/fldfunc.hxx
+++ b/sw/source/ui/fldui/fldfunc.hxx
@@ -32,33 +32,33 @@
class SwFldFuncPage : public SwFldPage
{
- ListBox* m_pTypeLB;
- ListBox* m_pSelectionLB;
- VclContainer* m_pFormat;
- ListBox* m_pFormatLB;
- FixedText* m_pNameFT;
- ConditionEdit* m_pNameED;
- VclContainer* m_pValueGroup;
- FixedText* m_pValueFT;
- Edit* m_pValueED;
- FixedText* m_pCond1FT;
- ConditionEdit* m_pCond1ED;
- FixedText* m_pCond2FT;
- ConditionEdit* m_pCond2ED;
- PushButton* m_pMacroBT;
+ VclPtr<ListBox> m_pTypeLB;
+ VclPtr<ListBox> m_pSelectionLB;
+ VclPtr<VclContainer> m_pFormat;
+ VclPtr<ListBox> m_pFormatLB;
+ VclPtr<FixedText> m_pNameFT;
+ VclPtr<ConditionEdit> m_pNameED;
+ VclPtr<VclContainer> m_pValueGroup;
+ VclPtr<FixedText> m_pValueFT;
+ VclPtr<Edit> m_pValueED;
+ VclPtr<FixedText> m_pCond1FT;
+ VclPtr<ConditionEdit> m_pCond1ED;
+ VclPtr<FixedText> m_pCond2FT;
+ VclPtr<ConditionEdit> m_pCond2ED;
+ VclPtr<PushButton> m_pMacroBT;
//controls of "Input list"
- VclContainer* m_pListGroup;
- FixedText* m_pListItemFT;
- ReturnActionEdit* m_pListItemED;
- PushButton* m_pListAddPB;
- FixedText* m_pListItemsFT;
- ListBox* m_pListItemsLB;
- PushButton* m_pListRemovePB;
- PushButton* m_pListUpPB;
- PushButton* m_pListDownPB;
- FixedText* m_pListNameFT;
- Edit* m_pListNameED;
+ VclPtr<VclContainer> m_pListGroup;
+ VclPtr<FixedText> m_pListItemFT;
+ VclPtr<ReturnActionEdit> m_pListItemED;
+ VclPtr<PushButton> m_pListAddPB;
+ VclPtr<FixedText> m_pListItemsFT;
+ VclPtr<ListBox> m_pListItemsLB;
+ VclPtr<PushButton> m_pListRemovePB;
+ VclPtr<PushButton> m_pListUpPB;
+ VclPtr<PushButton> m_pListDownPB;
+ VclPtr<FixedText> m_pListNameFT;
+ VclPtr<Edit> m_pListNameED;
OUString m_sOldValueFT;
OUString m_sOldNameFT;
@@ -86,8 +86,9 @@ public:
SwFldFuncPage(vcl::Window* pParent, const SfxItemSet& rSet);
virtual ~SwFldFuncPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 247dda169e18..f704afcf1bd3 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -107,6 +107,21 @@ SwFldRefPage::SwFldRefPage(vcl::Window* pParent, const SfxItemSet& rCoreSet )
SwFldRefPage::~SwFldRefPage()
{
+ disposeOnce();
+}
+
+void SwFldRefPage::dispose()
+{
+ m_pTypeLB.clear();
+ m_pSelection.clear();
+ m_pSelectionLB.clear();
+ m_pSelectionToolTipLB.clear();
+ m_pFormat.clear();
+ m_pFormatLB.clear();
+ m_pNameFT.clear();
+ m_pNameED.clear();
+ m_pValueED.clear();
+ SwFldPage::dispose();
}
// #i83479#
@@ -935,10 +950,10 @@ bool SwFldRefPage::FillItemSet(SfxItemSet* )
return false;
}
-SfxTabPage* SwFldRefPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwFldRefPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SwFldRefPage( pParent, *rAttrSet ) );
+ return VclPtr<SwFldRefPage>::Create( pParent, *rAttrSet );
}
sal_uInt16 SwFldRefPage::GetGroup()
diff --git a/sw/source/ui/fldui/fldref.hxx b/sw/source/ui/fldui/fldref.hxx
index 27e5ab4fb22e..24c540f181f7 100644
--- a/sw/source/ui/fldui/fldref.hxx
+++ b/sw/source/ui/fldui/fldref.hxx
@@ -34,16 +34,16 @@ class SwTxtNode;
class SwFldRefPage : public SwFldPage
{
- ListBox* m_pTypeLB;
- VclContainer* m_pSelection;
- ListBox* m_pSelectionLB;
+ VclPtr<ListBox> m_pTypeLB;
+ VclPtr<VclContainer> m_pSelection;
+ VclPtr<ListBox> m_pSelectionLB;
// #i83479#
- SwFldRefTreeListBox* m_pSelectionToolTipLB;
- VclContainer* m_pFormat;
- ListBox* m_pFormatLB;
- FixedText* m_pNameFT;
- Edit* m_pNameED;
- Edit* m_pValueED;
+ VclPtr<SwFldRefTreeListBox> m_pSelectionToolTipLB;
+ VclPtr<VclContainer> m_pFormat;
+ VclPtr<ListBox> m_pFormatLB;
+ VclPtr<FixedText> m_pNameFT;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<Edit> m_pValueED;
OUString sBookmarkTxt;
OUString sFootnoteTxt;
OUString sEndnoteTxt;
@@ -77,8 +77,9 @@ public:
SwFldRefPage(vcl::Window* pParent, const SfxItemSet& rSet);
virtual ~SwFldRefPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index a72e4c99662e..27c60f81e1f9 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -87,6 +87,28 @@ SwFldVarPage::SwFldVarPage(vcl::Window* pParent, const SfxItemSet& rCoreSet )
SwFldVarPage::~SwFldVarPage()
{
+ disposeOnce();
+}
+
+void SwFldVarPage::dispose()
+{
+ m_pTypeLB.clear();
+ m_pSelection.clear();
+ m_pSelectionLB.clear();
+ m_pNameFT.clear();
+ m_pNameED.clear();
+ m_pValueFT.clear();
+ m_pValueED.clear();
+ m_pFormat.clear();
+ m_pNumFormatLB.clear();
+ m_pFormatLB.clear();
+ m_pChapterFrame.clear();
+ m_pChapterLevelLB.clear();
+ m_pInvisibleCB.clear();
+ m_pSeparatorFT.clear();
+ m_pSeparatorED.clear();
+ m_pNewDelTBX.clear();
+ SwFldPage::dispose();
}
void SwFldVarPage::Reset(const SfxItemSet* )
@@ -1225,10 +1247,10 @@ bool SwFldVarPage::FillItemSet(SfxItemSet* )
return false;
}
-SfxTabPage* SwFldVarPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SwFldVarPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet )
{
- return ( new SwFldVarPage( pParent, *rAttrSet ) );
+ return VclPtr<SwFldVarPage>::Create( pParent, *rAttrSet );
}
sal_uInt16 SwFldVarPage::GetGroup()
diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx
index 9d1a37f0a5a9..a37aa5809fda 100644
--- a/sw/source/ui/fldui/fldvar.hxx
+++ b/sw/source/ui/fldui/fldvar.hxx
@@ -51,22 +51,22 @@ class SwFldVarPage : public SwFldPage
{
friend class SelectionListBox;
- ListBox* m_pTypeLB;
- VclContainer* m_pSelection;
- SelectionListBox* m_pSelectionLB;
- FixedText* m_pNameFT;
- Edit* m_pNameED;
- FixedText* m_pValueFT;
- ConditionEdit* m_pValueED;
- VclContainer* m_pFormat;
- NumFormatListBox* m_pNumFormatLB;
- ListBox* m_pFormatLB;
- VclContainer* m_pChapterFrame;
- ListBox* m_pChapterLevelLB;
- CheckBox* m_pInvisibleCB;
- FixedText* m_pSeparatorFT;
- Edit* m_pSeparatorED;
- ToolBox* m_pNewDelTBX;
+ VclPtr<ListBox> m_pTypeLB;
+ VclPtr<VclContainer> m_pSelection;
+ VclPtr<SelectionListBox> m_pSelectionLB;
+ VclPtr<FixedText> m_pNameFT;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<FixedText> m_pValueFT;
+ VclPtr<ConditionEdit> m_pValueED;
+ VclPtr<VclContainer> m_pFormat;
+ VclPtr<NumFormatListBox> m_pNumFormatLB;
+ VclPtr<ListBox> m_pFormatLB;
+ VclPtr<VclContainer> m_pChapterFrame;
+ VclPtr<ListBox> m_pChapterLevelLB;
+ VclPtr<CheckBox> m_pInvisibleCB;
+ VclPtr<FixedText> m_pSeparatorFT;
+ VclPtr<Edit> m_pSeparatorED;
+ VclPtr<ToolBox> m_pNewDelTBX;
sal_uInt16 m_nApplyId;
sal_uInt16 m_nDeleteId;
@@ -93,8 +93,9 @@ public:
SwFldVarPage(vcl::Window* pParent, const SfxItemSet& rSet);
virtual ~SwFldVarPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx
index 3346d84d9615..1da4ca51f107 100644
--- a/sw/source/ui/fldui/inpdlg.cxx
+++ b/sw/source/ui/fldui/inpdlg.cxx
@@ -106,6 +106,20 @@ SwFldInputDlg::SwFldInputDlg( vcl::Window *pParent, SwWrtShell &rS,
m_pEditED->SetText(convertLineEnd(aStr, GetSystemLineEnd()));
}
+SwFldInputDlg::~SwFldInputDlg()
+{
+ disposeOnce();
+}
+
+void SwFldInputDlg::dispose()
+{
+ m_pLabelED.clear();
+ m_pEditED.clear();
+ m_pOKBT.clear();
+ m_pNextBT.clear();
+ SvxStandardDialog::dispose();
+}
+
void SwFldInputDlg::StateChanged( StateChangedType nType )
{
if ( nType == StateChangedType::INITSHOW )
diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx
index 8bf330418207..7df369a9526c 100644
--- a/sw/source/ui/fldui/javaedit.cxx
+++ b/sw/source/ui/fldui/javaedit.cxx
@@ -88,10 +88,26 @@ SwJavaEditDialog::SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh) :
SwJavaEditDialog::~SwJavaEditDialog()
{
+ disposeOnce();
+}
+
+void SwJavaEditDialog::dispose()
+{
pSh->EnterStdMode();
delete pMgr;
delete pFileDlg;
Application::SetDefDialogParent( pOldDefDlgParent );
+ m_pTypeED.clear();
+ m_pUrlRB.clear();
+ m_pEditRB.clear();
+ m_pUrlPB.clear();
+ m_pUrlED.clear();
+ m_pEditED.clear();
+ m_pOKBtn.clear();
+ m_pPrevBtn.clear();
+ m_pNextBtn.clear();
+ pOldDefDlgParent.clear();
+ SvxStandardDialog::dispose();
}
IMPL_LINK_NOARG_INLINE_START(SwJavaEditDialog, PrevHdl)
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 0fef7a5499cb..11dccd075cc9 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -540,15 +540,15 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
// collect character styles
- ListBox rCharFmtLB(this);
- rCharFmtLB.Clear();
- rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone );
+ ScopedVclPtrInstance< ListBox > rCharFmtLB(this);
+ rCharFmtLB->Clear();
+ rCharFmtLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone );
SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
- ::FillCharStyleListBox(rCharFmtLB, pDocShell);
+ ::FillCharStyleListBox(*rCharFmtLB.get(), pDocShell);
std::vector<OUString> aList;
- for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
- aList.push_back( rCharFmtLB.GetEntry(j) );
+ for(sal_Int32 j = 0; j < rCharFmtLB->GetEntryCount(); j++)
+ aList.push_back( rCharFmtLB->GetEntry(j) );
aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell));
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index c34899cb2361..0d645d34da9d 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -161,7 +161,7 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh)
assert(pColPgSet);
// create TabPage
- pTabPage = static_cast<SwColumnPage*>( SwColumnPage::Create(get_content_area(), pColPgSet) );
+ pTabPage = static_cast<SwColumnPage*>( SwColumnPage::Create(get_content_area(), pColPgSet).get() );
pTabPage->get<vcl::Window>("applytoft")->Show();
pTabPage->get(m_pApplyToLB, "applytolb");
m_pApplyToLB->Show();
@@ -214,10 +214,17 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh)
SwColumnDlg::~SwColumnDlg()
{
- delete pTabPage;
+ disposeOnce();
+}
+
+void SwColumnDlg::dispose()
+{
+ pTabPage.disposeAndClear();
delete pPageSet;
delete pSectionSet;
delete pSelectionSet;
+ m_pApplyToLB.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK(SwColumnDlg, ObjectHdl, ListBox*, pBox)
@@ -542,7 +549,36 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet)
SwColumnPage::~SwColumnPage()
{
+ disposeOnce();
+}
+
+void SwColumnPage::dispose()
+{
delete pColMgr;
+ m_pCLNrEdt.clear();
+ m_pDefaultVS.clear();
+ m_pBalanceColsCB.clear();
+ m_pBtnBack.clear();
+ m_pLbl1.clear();
+ m_pLbl2.clear();
+ m_pLbl3.clear();
+ m_pBtnNext.clear();
+ m_pAutoWidthBox.clear();
+ m_pLineTypeLbl.clear();
+ m_pLineTypeDLB.clear();
+ m_pLineWidthLbl.clear();
+ m_pLineWidthEdit.clear();
+ m_pLineColorLbl.clear();
+ m_pLineColorDLB.clear();
+ m_pLineHeightLbl.clear();
+ m_pLineHeightEdit.clear();
+ m_pLinePosLbl.clear();
+ m_pLinePosDLB.clear();
+ m_pTextDirectionFT.clear();
+ m_pTextDirectionLB.clear();
+ m_pPgeExampleWN.clear();
+ m_pFrmExampleWN.clear();
+ SfxTabPage::dispose();
}
void SwColumnPage::SetPageWidth(long nPageWidth)
@@ -621,10 +657,11 @@ void SwColumnPage::Reset(const SfxItemSet *rSet)
}
// create TabPage
-SfxTabPage* SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+VclPtr<SfxTabPage> SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
{
- return new SwColumnPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwColumnPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
+
// stuff attributes into the Set when OK
bool SwColumnPage::FillItemSet(SfxItemSet *rSet)
{
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 81dfcf9c75d1..719af75fdca5 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -51,14 +51,14 @@ using namespace ::com::sun::star;
class SwSequenceOptionDialog : public SvxStandardDialog
{
- ListBox* m_pLbLevel;
- Edit* m_pEdDelim;
+ VclPtr<ListBox> m_pLbLevel;
+ VclPtr<Edit> m_pEdDelim;
- ListBox* m_pLbCharStyle;
- CheckBox* m_pApplyBorderAndShadowCB;
+ VclPtr<ListBox> m_pLbCharStyle;
+ VclPtr<CheckBox> m_pApplyBorderAndShadowCB;
//#i61007# order of captions
- ListBox* m_pLbCaptionOrder;
+ VclPtr<ListBox> m_pLbCaptionOrder;
SwView& rView;
OUString aFldTypeName;
@@ -67,6 +67,7 @@ public:
SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV,
const OUString& rSeqFldType );
virtual ~SwSequenceOptionDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Apply() SAL_OVERRIDE;
bool IsApplyBorderAndShadow() { return m_pApplyBorderAndShadowCB->IsChecked(); }
@@ -283,18 +284,18 @@ IMPL_LINK_INLINE_START( SwCaptionDialog, OptionHdl, Button*, pButton )
{
OUString sFldTypeName = m_pCategoryBox->GetText();
if(sFldTypeName == m_sNone)
- sFldTypeName = OUString();
- SwSequenceOptionDialog aDlg( pButton, rView, sFldTypeName );
- aDlg.SetApplyBorderAndShadow(bCopyAttributes);
- aDlg.SetCharacterStyle( sCharacterStyle );
- aDlg.SetOrderNumberingFirst( bOrderNumberingFirst );
- aDlg.Execute();
- bCopyAttributes = aDlg.IsApplyBorderAndShadow();
- sCharacterStyle = aDlg.GetCharacterStyle();
+ sFldTypeName.clear();
+ ScopedVclPtrInstance< SwSequenceOptionDialog > aDlg( pButton, rView, sFldTypeName );
+ aDlg->SetApplyBorderAndShadow(bCopyAttributes);
+ aDlg->SetCharacterStyle( sCharacterStyle );
+ aDlg->SetOrderNumberingFirst( bOrderNumberingFirst );
+ aDlg->Execute();
+ bCopyAttributes = aDlg->IsApplyBorderAndShadow();
+ sCharacterStyle = aDlg->GetCharacterStyle();
//#i61007# order of captions
- if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() )
+ if( bOrderNumberingFirst != aDlg->IsOrderNumberingFirst() )
{
- bOrderNumberingFirst = aDlg.IsOrderNumberingFirst();
+ bOrderNumberingFirst = aDlg->IsOrderNumberingFirst();
SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst);
ApplyCaptionOrder();
}
@@ -338,8 +339,8 @@ IMPL_LINK_NOARG(SwCaptionDialog, ModifyHdl)
IMPL_LINK_NOARG(SwCaptionDialog, CaptionHdl)
{
SfxItemSet aSet( rView.GetDocShell()->GetDoc()->GetAttrPool() );
- SwCaptionOptDlg aDlg( this, aSet );
- aDlg.Execute();
+ ScopedVclPtrInstance< SwCaptionOptDlg > aDlg( this, aSet );
+ aDlg->Execute();
return 0;
}
@@ -411,7 +412,27 @@ void SwCaptionDialog::DrawSample()
SwCaptionDialog::~SwCaptionDialog()
{
+ disposeOnce();
+}
+
+void SwCaptionDialog::dispose()
+{
delete pMgr;
+ m_pTextEdit.clear();
+ m_pCategoryBox.clear();
+ m_pFormatText.clear();
+ m_pFormatBox.clear();
+ m_pNumberingSeparatorFT.clear();
+ m_pNumberingSeparatorED.clear();
+ m_pSepText.clear();
+ m_pSepEdit.clear();
+ m_pPosText.clear();
+ m_pPosBox.clear();
+ m_pOKButton.clear();
+ m_pAutoCaptionButton.clear();
+ m_pOptionButton.clear();
+ m_pPreview.clear();
+ SvxStandardDialog::dispose();
}
SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV,
@@ -455,8 +476,20 @@ SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV
SwSequenceOptionDialog::~SwSequenceOptionDialog()
{
+ disposeOnce();
}
+void SwSequenceOptionDialog::dispose()
+{
+ m_pLbLevel.clear();
+ m_pEdDelim.clear();
+ m_pLbCharStyle.clear();
+ m_pApplyBorderAndShadowCB.clear();
+ m_pLbCaptionOrder.clear();
+ SvxStandardDialog::dispose();
+}
+
+
void SwSequenceOptionDialog::Apply()
{
SwWrtShell &rSh = rView.GetWrtShell();
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 14f03807a490..aa7f9d67f1b7 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -712,6 +712,49 @@ SwFrmPage::SwFrmPage(vcl::Window *pParent, const SfxItemSet &rSet)
m_pAutoHeightCB->SetClickHdl( LINK( this, SwFrmPage, AutoHeightClickHdl ) );
}
+SwFrmPage::~SwFrmPage()
+{
+ disposeOnce();
+}
+
+void SwFrmPage::dispose()
+{
+ m_pWidthFT.clear();
+ m_pWidthAutoFT.clear();
+ m_pRelWidthCB.clear();
+ m_pRelWidthRelationLB.clear();
+ m_pAutoWidthCB.clear();
+ m_pHeightFT.clear();
+ m_pHeightAutoFT.clear();
+ m_pRelHeightCB.clear();
+ m_pRelHeightRelationLB.clear();
+ m_pAutoHeightCB.clear();
+ m_pFixedRatioCB.clear();
+ m_pRealSizeBT.clear();
+ m_pAnchorFrame.clear();
+ m_pAnchorAtPageRB.clear();
+ m_pAnchorAtParaRB.clear();
+ m_pAnchorAtCharRB.clear();
+ m_pAnchorAsCharRB.clear();
+ m_pAnchorAtFrameRB.clear();
+ m_pHorizontalFT.clear();
+ m_pHorizontalDLB.clear();
+ m_pAtHorzPosFT.clear();
+ m_pAtHorzPosED.clear();
+ m_pHoriRelationFT.clear();
+ m_pHoriRelationLB.clear();
+ m_pMirrorPagesCB.clear();
+ m_pVerticalFT.clear();
+ m_pVerticalDLB.clear();
+ m_pAtVertPosFT.clear();
+ m_pAtVertPosED.clear();
+ m_pVertRelationFT.clear();
+ m_pVertRelationLB.clear();
+ m_pFollowTextFlowCB.clear();
+ m_pExampleWN.clear();
+ SfxTabPage::dispose();
+}
+
namespace
{
struct FrmMaps
@@ -815,13 +858,9 @@ void SwFrmPage::setOptimalRelWidth()
m_pHoriRelationLB->Clear();
}
-SwFrmPage::~SwFrmPage()
+VclPtr<SfxTabPage> SwFrmPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
{
-}
-
-SfxTabPage* SwFrmPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
-{
- return new SwFrmPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>(new SwFrmPage( pParent, *rSet ), SAL_NO_ACQUIRE);
}
void SwFrmPage::EnableGraficMode()
@@ -2364,12 +2403,27 @@ SwGrfExtPage::SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet)
SwGrfExtPage::~SwGrfExtPage()
{
+ disposeOnce();
+}
+
+void SwGrfExtPage::dispose()
+{
delete pGrfDlg;
+ m_pMirror.clear();
+ m_pMirrorVertBox.clear();
+ m_pMirrorHorzBox.clear();
+ m_pAllPagesRB.clear();
+ m_pLeftPagesRB.clear();
+ m_pRightPagesRB.clear();
+ m_pBmpWin.clear();
+ m_pConnectED.clear();
+ m_pBrowseBT.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet )
+VclPtr<SfxTabPage> SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet )
{
- return new SwGrfExtPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>(new SwGrfExtPage( pParent, *rSet ), SAL_NO_ACQUIRE);
}
void SwGrfExtPage::Reset(const SfxItemSet *rSet)
@@ -2702,6 +2756,18 @@ SwFrmURLPage::SwFrmURLPage( vcl::Window *pParent, const SfxItemSet &rSet ) :
SwFrmURLPage::~SwFrmURLPage()
{
+ disposeOnce();
+}
+
+void SwFrmURLPage::dispose()
+{
+ pURLED.clear();
+ pSearchPB.clear();
+ pNameED.clear();
+ pFrameCB.clear();
+ pServerCB.clear();
+ pClientCB.clear();
+ SfxTabPage::dispose();
}
void SwFrmURLPage::Reset( const SfxItemSet *rSet )
@@ -2781,9 +2847,9 @@ bool SwFrmURLPage::FillItemSet(SfxItemSet *rSet)
return bModified;
}
-SfxTabPage* SwFrmURLPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+VclPtr<SfxTabPage> SwFrmURLPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
{
- return new SwFrmURLPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>(new SwFrmURLPage( pParent, *rSet ), SAL_NO_ACQUIRE);
}
IMPL_LINK_NOARG(SwFrmURLPage, InsertFileHdl)
@@ -2844,11 +2910,38 @@ SwFrmAddPage::SwFrmAddPage(vcl::Window *pParent, const SfxItemSet &rSet)
SwFrmAddPage::~SwFrmAddPage()
{
+ disposeOnce();
}
-SfxTabPage* SwFrmAddPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+void SwFrmAddPage::dispose()
+{
+ pNameFrame.clear();
+ pNameFT.clear();
+ pNameED.clear();
+ pAltNameFT.clear();
+ pAltNameED.clear();
+ pPrevFT.clear();
+ pPrevLB.clear();
+ pNextFT.clear();
+ pNextLB.clear();
+ pProtectFrame.clear();
+ pProtectContentCB.clear();
+ pProtectFrameCB.clear();
+ pProtectSizeCB.clear();
+ m_pContentAlignFrame.clear();
+ m_pVertAlignLB.clear();
+ pPropertiesFrame.clear();
+ pEditInReadonlyCB.clear();
+ pPrintFrameCB.clear();
+ pTextFlowFT.clear();
+ pTextFlowLB.clear();
+ SfxTabPage::dispose();
+}
+
+
+VclPtr<SfxTabPage> SwFrmAddPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
{
- return new SwFrmAddPage(pParent, *rSet);
+ return VclPtr<SfxTabPage>(new SwFrmAddPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwFrmAddPage::Reset(const SfxItemSet *rSet )
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index 6987ce803555..49cba0337bcf 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -57,7 +57,7 @@ SwWrapDlg::SwWrapDlg(vcl::Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, bo
{
// create TabPage
- SwWrapTabPage* pNewPage = static_cast<SwWrapTabPage*>( SwWrapTabPage::Create(get_content_area(), &rSet) );
+ VclPtr<SwWrapTabPage> pNewPage = static_cast<SwWrapTabPage*>( SwWrapTabPage::Create(get_content_area(), &rSet).get() );
pNewPage->SetFormatUsed(false, bDrawMode);
pNewPage->SetShell(pWrtShell);
SetTabPage(pNewPage);
@@ -133,11 +133,31 @@ SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet)
SwWrapTabPage::~SwWrapTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SwWrapTabPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+void SwWrapTabPage::dispose()
{
- return new SwWrapTabPage(pParent, *rSet);
+ m_pNoWrapRB.clear();
+ m_pWrapLeftRB.clear();
+ m_pWrapRightRB.clear();
+ m_pWrapParallelRB.clear();
+ m_pWrapThroughRB.clear();
+ m_pIdealWrapRB.clear();
+ m_pLeftMarginED.clear();
+ m_pRightMarginED.clear();
+ m_pTopMarginED.clear();
+ m_pBottomMarginED.clear();
+ m_pWrapAnchorOnlyCB.clear();
+ m_pWrapTransparentCB.clear();
+ m_pWrapOutlineCB.clear();
+ m_pWrapOutsideCB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwWrapTabPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+{
+ return VclPtr<SfxTabPage>(new SwWrapTabPage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwWrapTabPage::Reset(const SfxItemSet *rSet)
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 9b1a47f9a2ed..df015f1749d5 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -140,8 +140,8 @@ typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base;
class SwEntryBrowseBox : public SwEntryBrowseBox_Base
{
- Edit aCellEdit;
- ::svt::CheckBoxControl aCellCheckBox;
+ VclPtr<Edit> aCellEdit;
+ VclPtr<::svt::CheckBoxControl> aCellCheckBox;
OUString sSearch;
OUString sAlternative;
@@ -174,6 +174,8 @@ protected:
public:
SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pBuilder);
+ virtual ~SwEntryBrowseBox();
+ virtual void dispose() SAL_OVERRIDE;
void ReadEntries(SvStream& rInStr);
void WriteEntries(SvStream& rOutStr);
@@ -186,9 +188,9 @@ public:
class SwAutoMarkDlg_Impl : public ModalDialog
{
- OKButton* m_pOKPB;
+ VclPtr<OKButton> m_pOKPB;
- SwEntryBrowseBox* m_pEntriesBB;
+ VclPtr<SwEntryBrowseBox> m_pEntriesBB;
OUString sAutoMarkURL;
@@ -199,6 +201,7 @@ public:
SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAutoMarkURL,
bool bCreate);
virtual ~SwAutoMarkDlg_Impl();
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -319,6 +322,11 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(vcl::Window* pParent, const SfxItemSet&
SwMultiTOXTabDialog::~SwMultiTOXTabDialog()
{
+ disposeOnce();
+}
+
+void SwMultiTOXTabDialog::dispose()
+{
SW_MOD()->GetModuleConfig()->SetShowIndexPreview(m_pShowExampleCB->IsChecked());
// fdo#38515 Avoid setting focus on deleted controls in the destructors
@@ -336,6 +344,9 @@ SwMultiTOXTabDialog::~SwMultiTOXTabDialog()
delete[] pDescArr;
delete pMgr;
delete pExampleFrame;
+ m_pExampleContainerWIN.clear();
+ m_pShowExampleCB.clear();
+ SfxTabDialog::dispose();
}
void SwMultiTOXTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
@@ -479,8 +490,8 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl )
OUString sInfo(SW_RESSTR(STR_FILE_NOT_FOUND));
sInfo = sInfo.replaceFirst( "%1", sTemplate );
sInfo = sInfo.replaceFirst( "%2", aOpt.GetTemplatePath() );
- InfoBox aInfo(GetParent(), sInfo);
- aInfo.Execute();
+ ScopedVclPtrInstance< InfoBox > aInfo(GetParent(), sInfo);
+ aInfo->Execute();
}
else
{
@@ -500,7 +511,7 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl )
&& pExampleFrame && pExampleFrame->IsServiceAvailable();
m_pExampleContainerWIN->Show( bSetViewWindow );
- SetViewWindow( bSetViewWindow ? m_pExampleContainerWIN : 0 );
+ SetViewWindow( bSetViewWindow ? m_pExampleContainerWIN.get() : 0 );
setOptimalLayoutSize();
@@ -617,11 +628,11 @@ void SwIndexTreeLB::setColSizes()
class SwAddStylesDlg_Impl : public SfxModalDialog
{
- OKButton* m_pOk;
+ VclPtr<OKButton> m_pOk;
- SwIndexTreeLB* m_pHeaderTree;
- PushButton* m_pLeftPB;
- PushButton* m_pRightPB;
+ VclPtr<SwIndexTreeLB> m_pHeaderTree;
+ VclPtr<PushButton> m_pLeftPB;
+ VclPtr<PushButton> m_pRightPB;
OUString* pStyleArr;
@@ -632,6 +643,7 @@ class SwAddStylesDlg_Impl : public SfxModalDialog
public:
SwAddStylesDlg_Impl(vcl::Window* pParent, SwWrtShell& rWrtSh, OUString rStringArr[]);
virtual ~SwAddStylesDlg_Impl();
+ virtual void dispose() SAL_OVERRIDE;
};
SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent,
@@ -648,7 +660,7 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent,
Size aSize = pHeaderTreeContainer->LogicToPixel(Size(273, 164), MAP_APPFONT);
pHeaderTreeContainer->set_width_request(aSize.Width());
pHeaderTreeContainer->set_height_request(aSize.Height());
- m_pHeaderTree = new SwIndexTreeLB(*pHeaderTreeContainer);
+ m_pHeaderTree = VclPtr<SwIndexTreeLB>::Create(*pHeaderTreeContainer);
m_pOk->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl));
m_pLeftPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
@@ -706,7 +718,16 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent,
SwAddStylesDlg_Impl::~SwAddStylesDlg_Impl()
{
- delete m_pHeaderTree;
+ disposeOnce();
+}
+
+void SwAddStylesDlg_Impl::dispose()
+{
+ m_pHeaderTree.disposeAndClear();
+ m_pOk.clear();
+ m_pLeftPB.clear();
+ m_pRightPB.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl)
@@ -881,8 +902,55 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(vcl::Window* pParent, const SfxItemSet& r
SwTOXSelectTabPage::~SwTOXSelectTabPage()
{
+ disposeOnce();
+}
+
+void SwTOXSelectTabPage::dispose()
+{
delete pIndexRes;
delete pIndexEntryWrapper;
+ m_pTitleED.clear();
+ m_pTypeFT.clear();
+ m_pTypeLB.clear();
+ m_pReadOnlyCB.clear();
+ m_pAreaFrame.clear();
+ m_pAreaLB.clear();
+ m_pLevelFT.clear();
+ m_pLevelNF.clear();
+ m_pCreateFrame.clear();
+ m_pFromHeadingsCB.clear();
+ m_pAddStylesCB.clear();
+ m_pAddStylesPB.clear();
+ m_pFromTablesCB.clear();
+ m_pFromFramesCB.clear();
+ m_pFromGraphicsCB.clear();
+ m_pFromOLECB.clear();
+ m_pLevelFromChapterCB.clear();
+ m_pFromCaptionsRB.clear();
+ m_pFromObjectNamesRB.clear();
+ m_pCaptionSequenceFT.clear();
+ m_pCaptionSequenceLB.clear();
+ m_pDisplayTypeFT.clear();
+ m_pDisplayTypeLB.clear();
+ m_pTOXMarksCB.clear();
+ m_pIdxOptionsFrame.clear();
+ m_pCollectSameCB.clear();
+ m_pUseFFCB.clear();
+ m_pUseDashCB.clear();
+ m_pCaseSensitiveCB.clear();
+ m_pInitialCapsCB.clear();
+ m_pKeyAsEntryCB.clear();
+ m_pFromFileCB.clear();
+ m_pAutoMarkPB.clear();
+ m_pFromObjCLB.clear();
+ m_pFromObjFrame.clear();
+ m_pSequenceCB.clear();
+ m_pBracketLB.clear();
+ m_pAuthorityFrame.clear();
+ m_pSortFrame.clear();
+ m_pLanguageLB.clear();
+ m_pSortAlgorithmLB.clear();
+ SfxTabPage::dispose();
}
void SwTOXSelectTabPage::SetWrtShell(SwWrtShell& rSh)
@@ -1245,9 +1313,9 @@ SfxTabPage::sfxpg SwTOXSelectTabPage::DeactivatePage( SfxItemSet* _pSet )
return LEAVE_PAGE;
}
-SfxTabPage* SwTOXSelectTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwTOXSelectTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
{
- return new SwTOXSelectTabPage(pParent, *rAttrSet);
+ return VclPtr<SwTOXSelectTabPage>::Create(pParent, *rAttrSet);
}
IMPL_LINK(SwTOXSelectTabPage, TOXTypeHdl, ListBox*, pBox)
@@ -1410,11 +1478,11 @@ IMPL_LINK(SwTOXSelectTabPage, LanguageHdl, ListBox*, pBox)
IMPL_LINK(SwTOXSelectTabPage, AddStylesHdl, PushButton*, pButton)
{
- boost::scoped_ptr<SwAddStylesDlg_Impl> pDlg(new SwAddStylesDlg_Impl(pButton,
- static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(),
- aStyleArr));
+ ScopedVclPtrInstance<SwAddStylesDlg_Impl> pDlg(
+ pButton, static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(),
+ aStyleArr);
pDlg->Execute();
- pDlg.reset();
+ pDlg.disposeAndClear();
ModifyHdl(0);
return 0;
}
@@ -1446,8 +1514,8 @@ IMPL_LINK(SwTOXSelectTabPage, MenuExecuteHdl, Menu*, pMenu)
return 0;
}
- boost::scoped_ptr<SwAutoMarkDlg_Impl> pAutoMarkDlg(new SwAutoMarkDlg_Impl(
- m_pAutoMarkPB, sAutoMarkURL, bNew ));
+ VclPtrInstance<SwAutoMarkDlg_Impl> pAutoMarkDlg(
+ m_pAutoMarkPB, sAutoMarkURL, bNew );
if( RET_OK != pAutoMarkDlg->Execute() && bNew )
sAutoMarkURL = sSaveAutoMarkURL;
@@ -1460,7 +1528,7 @@ class SwTOXEdit : public Edit
SwFormToken aFormToken;
Link aPrevNextControlLink;
bool bNextControl;
- SwTokenWindow* m_pParent;
+ VclPtr<SwTokenWindow> m_pParent;
public:
SwTOXEdit( vcl::Window* pParent, SwTokenWindow* pTokenWin,
const SwFormToken& aToken)
@@ -1470,6 +1538,8 @@ public:
m_pParent( pTokenWin )
{
}
+ virtual ~SwTOXEdit() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); Edit::dispose(); }
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
@@ -1545,7 +1615,7 @@ class SwTOXButton : public PushButton
SwFormToken aFormToken;
Link aPrevNextControlLink;
bool bNextControl;
- SwTokenWindow* m_pParent;
+ VclPtr<SwTokenWindow> m_pParent;
public:
SwTOXButton( vcl::Window* pParent, SwTokenWindow* pTokenWin,
const SwFormToken& rToken)
@@ -1555,6 +1625,8 @@ public:
m_pParent(pTokenWin)
{
}
+ virtual ~SwTOXButton() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); PushButton::dispose(); }
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
@@ -1675,6 +1747,17 @@ SwIdxTreeListBox::SwIdxTreeListBox(vcl::Window* pPar, WinBits nStyle)
{
}
+SwIdxTreeListBox::~SwIdxTreeListBox()
+{
+ disposeOnce();
+}
+
+void SwIdxTreeListBox::dispose()
+{
+ pParent.clear();
+ SvTreeListBox::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwIdxTreeListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap)
{
WinBits nWinStyle = WB_TABSTOP;
@@ -1873,6 +1956,63 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(vcl::Window* pParent, const SfxItemSet& rAt
m_pSecondKeyLB->SelectEntryPos(0);
m_pThirdKeyLB->SelectEntryPos(0);
}
+
+SwTOXEntryTabPage::~SwTOXEntryTabPage()
+{
+ disposeOnce();
+}
+
+void SwTOXEntryTabPage::dispose()
+{
+ m_pLevelFT.clear();
+ m_pLevelLB.clear();
+ m_pTokenWIN.clear();
+ m_pAllLevelsPB.clear();
+ m_pEntryNoPB.clear();
+ m_pEntryPB.clear();
+ m_pTabPB.clear();
+ m_pChapterInfoPB.clear();
+ m_pPageNoPB.clear();
+ m_pHyperLinkPB.clear();
+ m_pAuthFieldsLB.clear();
+ m_pAuthInsertPB.clear();
+ m_pAuthRemovePB.clear();
+ m_pCharStyleLB.clear();
+ m_pEditStylePB.clear();
+ m_pChapterEntryFT.clear();
+ m_pChapterEntryLB.clear();
+ m_pNumberFormatFT.clear();
+ m_pNumberFormatLB.clear();
+ m_pEntryOutlineLevelFT.clear();
+ m_pEntryOutlineLevelNF.clear();
+ m_pFillCharFT.clear();
+ m_pFillCharCB.clear();
+ m_pTabPosFT.clear();
+ m_pTabPosMF.clear();
+ m_pAutoRightCB.clear();
+ m_pFormatFrame.clear();
+ m_pMainEntryStyleFT.clear();
+ m_pMainEntryStyleLB.clear();
+ m_pAlphaDelimCB.clear();
+ m_pCommaSeparatedCB.clear();
+ m_pRelToStyleCB.clear();
+ m_pSortingFrame.clear();
+ m_pSortDocPosRB.clear();
+ m_pSortContentRB.clear();
+ m_pSortKeyFrame.clear();
+ m_pFirstKeyLB.clear();
+ m_pFirstSortUpRB.clear();
+ m_pFirstSortDownRB.clear();
+ m_pSecondKeyLB.clear();
+ m_pSecondSortUpRB.clear();
+ m_pSecondSortDownRB.clear();
+ m_pThirdKeyLB.clear();
+ m_pThirdSortUpRB.clear();
+ m_pThirdSortDownRB.clear();
+ SfxTabPage::dispose();
+}
+
+
// pVoid is used as signal to change all levels of the example
IMPL_LINK(SwTOXEntryTabPage, ModifyHdl, void*, pVoid)
{
@@ -1890,10 +2030,6 @@ IMPL_LINK(SwTOXEntryTabPage, ModifyHdl, void*, pVoid)
return 0;
}
-SwTOXEntryTabPage::~SwTOXEntryTabPage()
-{
-}
-
bool SwTOXEntryTabPage::FillItemSet( SfxItemSet* )
{
// nothing to do
@@ -2074,9 +2210,9 @@ SfxTabPage::sfxpg SwTOXEntryTabPage::DeactivatePage( SfxItemSet* /*pSet*/)
return LEAVE_PAGE;
}
-SfxTabPage* SwTOXEntryTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwTOXEntryTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
{
- return new SwTOXEntryTabPage(pParent, *rAttrSet);
+ return VclPtr<SwTOXEntryTabPage>::Create(pParent, *rAttrSet);
}
IMPL_LINK(SwTOXEntryTabPage, EditStyleHdl, PushButton*, pBtn)
@@ -2624,13 +2760,26 @@ void SwTokenWindow::setAllocation(const Size &rAllocation)
SwTokenWindow::~SwTokenWindow()
{
+ disposeOnce();
+}
+
+void SwTokenWindow::dispose()
+{
for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
{
- Control* pControl = (*it);
+ VclPtr<Control> pControl = (*it);
pControl->SetGetFocusHdl( Link() );
pControl->SetLoseFocusHdl( Link() );
- delete pControl;
+ pControl.disposeAndClear();
}
+ aControlList.clear();
+ disposeBuilder();
+ m_pLeftScrollWin.clear();
+ m_pCtrlParentWin.clear();
+ m_pRightScrollWin.clear();
+ pActiveCtrl.clear();
+ m_pParent.clear();
+ VclHBox::dispose();
}
void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL)
@@ -2640,10 +2789,11 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL)
if(pForm)
{
- //apply current level settings to the form
for (ctrl_iterator iter = aControlList.begin(); iter != aControlList.end(); ++iter)
- delete (*iter);
-
+ iter->disposeAndClear();
+ //apply current level settings to the form
+ for (auto it = aControlList.begin(); it != aControlList.end(); ++it)
+ it->disposeAndClear();
aControlList.clear();
}
@@ -2725,9 +2875,9 @@ void SwTokenWindow::SetActiveControl(Control* pSet)
//it must be a SwTOXEdit
const SwFormToken* pFToken;
if( WINDOW_EDIT == pActiveCtrl->GetType() )
- pFToken = &static_cast<SwTOXEdit*>(pActiveCtrl)->GetFormToken();
+ pFToken = &static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetFormToken();
else
- pFToken = &static_cast<SwTOXButton*>(pActiveCtrl)->GetFormToken();
+ pFToken = &static_cast<SwTOXButton*>(pActiveCtrl.get())->GetFormToken();
SwFormToken aTemp( *pFToken );
aButtonSelectedHdl.Call( &aTemp );
@@ -2752,7 +2902,7 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken&
if(TOKEN_TEXT == rToken.eTokenType)
{
- SwTOXEdit* pEdit = new SwTOXEdit(m_pCtrlParentWin, this, rToken);
+ VclPtr<SwTOXEdit> pEdit = VclPtr<SwTOXEdit>::Create(m_pCtrlParentWin, this, rToken);
pEdit->SetPosPixel(aControlPos);
aControlList.push_back(pEdit);
@@ -2781,7 +2931,7 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken&
}
else
{
- SwTOXButton* pButton = new SwTOXButton(m_pCtrlParentWin, this, rToken);
+ VclPtr<SwTOXButton> pButton = VclPtr<SwTOXButton>::Create(m_pCtrlParentWin, this, rToken);
pButton->SetPosPixel(aControlPos);
aControlList.push_back(pButton);
@@ -2948,18 +3098,18 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken&
{
++iterActive;
- Selection aSel = static_cast<SwTOXEdit*>(pActiveCtrl)->GetSelection();
+ Selection aSel = static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetSelection();
aSel.Justify();
- const OUString sEditText = static_cast<SwTOXEdit*>(pActiveCtrl)->GetText();
+ const OUString sEditText = static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetText();
const OUString sLeft = sEditText.copy( 0, aSel.A() );
const OUString sRight = sEditText.copy( aSel.B() );
- static_cast<SwTOXEdit*>(pActiveCtrl)->SetText(sLeft);
- static_cast<SwTOXEdit*>(pActiveCtrl)->AdjustSize();
+ static_cast<SwTOXEdit*>(pActiveCtrl.get())->SetText(sLeft);
+ static_cast<SwTOXEdit*>(pActiveCtrl.get())->AdjustSize();
SwFormToken aTmpToken(TOKEN_TEXT);
- SwTOXEdit* pEdit = new SwTOXEdit(m_pCtrlParentWin, this, aTmpToken);
+ VclPtr<SwTOXEdit> pEdit = VclPtr<SwTOXEdit>::Create(m_pCtrlParentWin, this, aTmpToken);
iterActive = aControlList.insert(iterActive, pEdit);
@@ -2987,11 +3137,11 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken&
{
iterActive = aControlList.erase(iterActive);
pActiveCtrl->Hide();
- delete pActiveCtrl;
+ pActiveCtrl.disposeAndClear();
}
//now the new button
- SwTOXButton* pButton = new SwTOXButton(m_pCtrlParentWin, this, aToInsertToken);
+ VclPtr<SwTOXButton> pButton = VclPtr<SwTOXButton>::Create(m_pCtrlParentWin, this, aToInsertToken);
aControlList.insert(iterActive, pButton);
@@ -3040,19 +3190,19 @@ void SwTokenWindow::RemoveControl(SwTOXButton* pDel, bool bInternalCall )
ctrl_iterator itLeft = it, itRight = it;
--itLeft;
++itRight;
- Control *pLeftEdit = *itLeft;
- Control *pRightEdit = *itRight;
+ VclPtr<Control> pLeftEdit = *itLeft;
+ VclPtr<Control> pRightEdit = *itRight;
- static_cast<SwTOXEdit*>(pLeftEdit)->SetText(static_cast<SwTOXEdit*>(pLeftEdit)->GetText() +
- static_cast<SwTOXEdit*>(pRightEdit)->GetText());
- static_cast<SwTOXEdit*>(pLeftEdit)->AdjustSize();
+ static_cast<SwTOXEdit*>(pLeftEdit.get())->SetText(static_cast<SwTOXEdit*>(pLeftEdit.get())->GetText() +
+ static_cast<SwTOXEdit*>(pRightEdit.get())->GetText());
+ static_cast<SwTOXEdit*>(pLeftEdit.get())->AdjustSize();
aControlList.erase(itRight);
- delete pRightEdit;
+ pRightEdit.disposeAndClear();
aControlList.erase(it);
pActiveCtrl->Hide();
- delete pActiveCtrl;
+ pActiveCtrl.disposeAndClear();
SetActiveControl(pLeftEdit);
AdjustPositions();
@@ -3505,7 +3655,18 @@ SwTOXStylesTabPage::SwTOXStylesTabPage(vcl::Window* pParent, const SfxItemSet& r
SwTOXStylesTabPage::~SwTOXStylesTabPage()
{
+ disposeOnce();
+}
+
+void SwTOXStylesTabPage::dispose()
+{
delete m_pCurrentForm;
+ m_pLevelLB.clear();
+ m_pAssignBT.clear();
+ m_pParaLayLB.clear();
+ m_pStdBT.clear();
+ m_pEditStyleBT.clear();
+ SfxTabPage::dispose();
}
bool SwTOXStylesTabPage::FillItemSet( SfxItemSet* )
@@ -3590,10 +3751,10 @@ SfxTabPage::sfxpg SwTOXStylesTabPage::DeactivatePage( SfxItemSet* /*pSet*/ )
return LEAVE_PAGE;
}
-SfxTabPage* SwTOXStylesTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwTOXStylesTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SwTOXStylesTabPage(pParent, *rAttrSet);
+ return VclPtr<SwTOXStylesTabPage>::Create(pParent, *rAttrSet);
}
IMPL_LINK( SwTOXStylesTabPage, EditStyleHdl, Button *, pBtn )
@@ -3705,8 +3866,8 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB
BrowserMode::VLINES |
BrowserMode::AUTO_VSCROLL|
BrowserMode::HIDECURSOR )
- , aCellEdit(&GetDataWindow(), 0)
- , aCellCheckBox(&GetDataWindow())
+ , aCellEdit(VclPtr<Edit>::Create(&GetDataWindow(), 0))
+ , aCellCheckBox(new ::svt::CheckBoxControl(&GetDataWindow()))
, nCurrentRow(0)
, bModified(false)
{
@@ -3720,9 +3881,9 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB
sYes = pBuilder->get<vcl::Window>("yes")->GetText();
sNo = pBuilder->get<vcl::Window>("no")->GetText();
- aCellCheckBox.GetBox().EnableTriState(false);
- xController = new ::svt::EditCellController(&aCellEdit);
- xCheckController = new ::svt::CheckBoxCellController(&aCellCheckBox);
+ aCellCheckBox->GetBox().EnableTriState(false);
+ xController = new ::svt::EditCellController(aCellEdit.get());
+ xCheckController = new ::svt::CheckBoxCellController(aCellCheckBox.get());
// HACK: BrowseBox doesn't invalidate its children, how it should be.
// That's why WB_CLIPCHILDREN is reset in order to enforce the
@@ -3753,6 +3914,18 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB
HeaderBarItemBits::STDSTYLE, HEADERBAR_APPEND );
}
+SwEntryBrowseBox::~SwEntryBrowseBox()
+{
+ disposeOnce();
+}
+
+void SwEntryBrowseBox::dispose()
+{
+ aCellEdit.disposeAndClear();
+ aCellCheckBox.disposeAndClear();
+ SwEntryBrowseBox_Base::dispose();
+}
+
void SwEntryBrowseBox::Resize()
{
SwEntryBrowseBox_Base::Resize();
@@ -4018,7 +4191,7 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAu
, bCreateMode(bCreate)
{
get(m_pOKPB, "ok");
- m_pEntriesBB = new SwEntryBrowseBox(get<VclContainer>("area"), this);
+ m_pEntriesBB = VclPtr<SwEntryBrowseBox>::Create(get<VclContainer>("area"), this);
m_pEntriesBB->set_expand(true);
m_pEntriesBB->Show();
m_pOKPB->SetClickHdl(LINK(this, SwAutoMarkDlg_Impl, OkHdl));
@@ -4042,7 +4215,14 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAu
SwAutoMarkDlg_Impl::~SwAutoMarkDlg_Impl()
{
- delete m_pEntriesBB;
+ disposeOnce();
+}
+
+void SwAutoMarkDlg_Impl::dispose()
+{
+ m_pEntriesBB.disposeAndClear();
+ m_pOKPB.clear();
+ ModalDialog::dispose();
}
IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl)
diff --git a/sw/source/ui/index/multmrk.cxx b/sw/source/ui/index/multmrk.cxx
index 7fe0e656888e..51cffaccac1b 100644
--- a/sw/source/ui/index/multmrk.cxx
+++ b/sw/source/ui/index/multmrk.cxx
@@ -61,6 +61,17 @@ void SwMultiTOXMarkDlg::Apply()
rMgr.SetCurTOXMark(nPos);
}
-SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg() {}
+SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg()
+{
+ disposeOnce();
+}
+
+void SwMultiTOXMarkDlg::dispose()
+{
+ m_pTextFT.clear();
+ m_pTOXLB.clear();
+ SvxStandardDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 526dbb42e606..cb68df271d9b 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -546,8 +546,8 @@ void SwIndexMarkPane::UpdateKeyBoxes()
class SwNewUserIdxDlg : public ModalDialog
{
- OKButton* m_pOKPB;
- Edit* m_pNameED;
+ VclPtr<OKButton> m_pOKPB;
+ VclPtr<Edit> m_pNameED;
SwIndexMarkPane* m_pDlg;
@@ -565,6 +565,13 @@ class SwNewUserIdxDlg : public ModalDialog
m_pOKPB->Enable(false);
m_pNameED->GrabFocus();
}
+ virtual ~SwNewUserIdxDlg() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ m_pOKPB.clear();
+ m_pNameED.clear();
+ ModalDialog::dispose();
+ }
OUString GetName(){return m_pNameED->GetText();}
};
@@ -577,7 +584,7 @@ IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, Edit*, pEdit)
IMPL_LINK_NOARG(SwIndexMarkPane, NewUserIdxHdl)
{
- boost::scoped_ptr<SwNewUserIdxDlg> pDlg(new SwNewUserIdxDlg(this));
+ ScopedVclPtrInstance< SwNewUserIdxDlg > pDlg(this);
if(RET_OK == pDlg->Execute())
{
OUString sNewName(pDlg->GetName());
@@ -982,12 +989,12 @@ void SwIndexMarkModalDlg::Apply()
class SwCreateAuthEntryDlg_Impl : public ModalDialog
{
- FixedText* pFixedTexts[AUTH_FIELD_END];
- ListBox* pTypeListBox;
- ComboBox* pIdentifierBox;
- Edit* pEdits[AUTH_FIELD_END];
+ VclPtr<FixedText> pFixedTexts[AUTH_FIELD_END];
+ VclPtr<ListBox> pTypeListBox;
+ VclPtr<ComboBox> pIdentifierBox;
+ VclPtr<Edit> pEdits[AUTH_FIELD_END];
- OKButton* m_pOKBT;
+ VclPtr<OKButton> m_pOKBT;
Link aShortNameCheckLink;
@@ -1007,6 +1014,7 @@ public:
bool bNewEntry,
bool bCreate);
virtual ~SwCreateAuthEntryDlg_Impl();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetEntryText(ToxAuthorityField eField) const;
@@ -1200,8 +1208,8 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl)
bDifferent |= m_sFields[i] != pEntry->GetAuthorField((ToxAuthorityField)i);
if(bDifferent)
{
- MessageDialog aQuery(&m_rDialog, SW_RES(STR_QUERY_CHANGE_AUTH_ENTRY), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if(RET_YES != aQuery.Execute())
+ ScopedVclPtrInstance< MessageDialog > aQuery(&m_rDialog, SW_RES(STR_QUERY_CHANGE_AUTH_ENTRY), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if(RET_YES != aQuery->Execute())
return 0;
}
}
@@ -1240,14 +1248,14 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton)
OUString sOldId = m_sCreatedEntry[0];
for(int i = 0; i < AUTH_FIELD_END; i++)
m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i];
- SwCreateAuthEntryDlg_Impl aDlg(pButton,
+ ScopedVclPtrInstance<SwCreateAuthEntryDlg_Impl> aDlg(pButton,
bCreate ? m_sCreatedEntry : m_sFields,
*pSh, bNewEntry, bCreate);
if(bNewEntry)
{
- aDlg.SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl));
+ aDlg->SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl));
}
- if(RET_OK == aDlg.Execute())
+ if(RET_OK == aDlg->Execute())
{
if(bCreate && !sOldId.isEmpty())
{
@@ -1255,7 +1263,7 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton)
}
for(int i = 0; i < AUTH_FIELD_END; i++)
{
- m_sFields[i] = aDlg.GetEntryText((ToxAuthorityField)i);
+ m_sFields[i] = aDlg->GetEntryText((ToxAuthorityField)i);
m_sCreatedEntry[i] = m_sFields[i];
}
if(bNewEntry && !m_pFromDocContentRB->IsChecked())
@@ -1438,7 +1446,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
{
const TextInfo aCurInfo = aTextInfoArr[nIndex];
- pFixedTexts[nIndex] = new FixedText(bLeft ? pLeft : pRight, WB_VCENTER);
+ pFixedTexts[nIndex] = VclPtr<FixedText>::Create(bLeft ? pLeft : pRight, WB_VCENTER);
pFixedTexts[nIndex]->set_grid_left_attach(0);
pFixedTexts[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
@@ -1447,7 +1455,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
pEdits[nIndex] = 0;
if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField )
{
- pTypeListBox = new ListBox(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER);
+ pTypeListBox = VclPtr<ListBox>::Create(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER);
for(int j = 0; j < AUTH_TYPE_END; j++)
pTypeListBox->InsertEntry(SW_RESSTR(STR_AUTH_TYPE_START + j));
if(!pFields[aCurInfo.nToxField].isEmpty())
@@ -1464,7 +1472,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
}
else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode)
{
- pIdentifierBox = new ComboBox(bLeft ? pLeft : pRight, WB_BORDER|WB_DROPDOWN|WB_VCENTER);
+ pIdentifierBox = VclPtr<ComboBox>::Create(bLeft ? pLeft : pRight, WB_BORDER|WB_DROPDOWN|WB_VCENTER);
pIdentifierBox->SetSelectHdl(LINK(this,
SwCreateAuthEntryDlg_Impl, IdentifierHdl));
@@ -1488,7 +1496,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
}
else
{
- pEdits[nIndex] = new Edit(bLeft ? pLeft : pRight, WB_BORDER|WB_VCENTER);
+ pEdits[nIndex] = VclPtr<Edit>::Create(bLeft ? pLeft : pRight, WB_BORDER|WB_VCENTER);
pEdits[nIndex]->SetWidthInChars(14);
pEdits[nIndex]->set_grid_left_attach(1);
pEdits[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow);
@@ -1519,13 +1527,20 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl()
{
+ disposeOnce();
+}
+
+void SwCreateAuthEntryDlg_Impl::dispose()
+{
for(int i = 0; i < AUTH_FIELD_END; i++)
{
- delete pFixedTexts[i];
- delete pEdits[i];
+ pFixedTexts[i].disposeAndClear();
+ pEdits[i].disposeAndClear();
}
- delete pTypeListBox;
- delete pIdentifierBox;
+ pTypeListBox.disposeAndClear();
+ pIdentifierBox.disposeAndClear();
+ m_pOKBT.clear();
+ ModalDialog::dispose();
}
OUString SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 59576289d831..5eaf63a98ddb 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -147,6 +147,15 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg( vcl::Window *pParent, SwWrtShell &rS,
SwInsertBookmarkDlg::~SwInsertBookmarkDlg()
{
+ disposeOnce();
+}
+
+void SwInsertBookmarkDlg::dispose()
+{
+ m_pBookmarkBox.clear();
+ m_pOkBtn.clear();
+ m_pDeleteBtn.clear();
+ SvxStandardDialog::dispose();
}
BookmarkCombo::BookmarkCombo(vcl::Window* pWin, WinBits nStyle)
diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
index 15cfb9493333..04467a339ca4 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -117,6 +117,33 @@ SwEndNoteOptionPage::SwEndNoteOptionPage(vcl::Window *pParent, bool bEN,
get(m_pFtnCharTextTemplBox, "charstylelb");
}
+SwEndNoteOptionPage::~SwEndNoteOptionPage()
+{
+ disposeOnce();
+}
+
+void SwEndNoteOptionPage::dispose()
+{
+ m_pNumViewBox.clear();
+ m_pOffsetLbl.clear();
+ m_pOffsetFld.clear();
+ m_pNumCountBox.clear();
+ m_pPrefixED.clear();
+ m_pSuffixED.clear();
+ m_pPosFT.clear();
+ m_pPosPageBox.clear();
+ m_pPosChapterBox.clear();
+ m_pStylesContainer.clear();
+ m_pParaTemplBox.clear();
+ m_pPageTemplLbl.clear();
+ m_pPageTemplBox.clear();
+ m_pFtnCharAnchorTemplBox.clear();
+ m_pFtnCharTextTemplBox.clear();
+ m_pContEdit.clear();
+ m_pContFromEdit.clear();
+ SfxTabPage::dispose();
+}
+
void SwEndNoteOptionPage::Reset( const SfxItemSet* )
{
boost::scoped_ptr<SwEndNoteInfo> pInf(bEndNote ? new SwEndNoteInfo( pSh->GetEndNoteInfo() )
@@ -219,13 +246,9 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet* )
m_pPageTemplBox->SelectEntry( pInf->GetPageDesc( *pSh->GetDoc() )->GetName());
}
-SwEndNoteOptionPage::~SwEndNoteOptionPage()
-{
-}
-
-SfxTabPage *SwEndNoteOptionPage::Create( vcl::Window *pParent, const SfxItemSet *rSet )
+VclPtr<SfxTabPage> SwEndNoteOptionPage::Create( vcl::Window *pParent, const SfxItemSet *rSet )
{
- return new SwEndNoteOptionPage( pParent, true, *rSet );
+ return VclPtr<SwEndNoteOptionPage>::Create( pParent, true, *rSet );
}
// Different kinds of numbering; because the Listbox has varying numbers of
@@ -399,9 +422,9 @@ SwFootNoteOptionPage::~SwFootNoteOptionPage()
{
}
-SfxTabPage *SwFootNoteOptionPage::Create(vcl::Window *pParent, const SfxItemSet *rSet )
+VclPtr<SfxTabPage> SwFootNoteOptionPage::Create(vcl::Window *pParent, const SfxItemSet *rSet )
{
- return new SwFootNoteOptionPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>(new SwFootNoteOptionPage( pParent, *rSet ), SAL_NO_ACQUIRE);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index 11a3666236bb..7f86ef083348 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -112,6 +112,18 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(vcl::Window * pParent,
SwGlossaryGroupDlg::~SwGlossaryGroupDlg()
{
+ disposeOnce();
+}
+
+void SwGlossaryGroupDlg::dispose()
+{
+ m_pNameED.clear();
+ m_pPathLB.clear();
+ m_pGroupTLB.clear();
+ m_pNewPB.clear();
+ m_pDelPB.clear();
+ m_pRenamePB.clear();
+ SvxStandardDialog::dispose();
}
void SwGlossaryGroupDlg::Apply()
@@ -139,8 +151,8 @@ void SwGlossaryGroupDlg::Apply()
const OUString sMsg(SW_RESSTR(STR_QUERY_DELETE_GROUP1)
+ sTitle
+ SW_RESSTR(STR_QUERY_DELETE_GROUP2));
- QueryBox aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg );
- if(RET_YES == aQuery.Execute())
+ ScopedVclPtrInstance< QueryBox > aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg );
+ if(RET_YES == aQuery->Execute())
pGlosHdl->DelGroup( sDelGroup );
}
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 858fd69bdd3a..3664343de66a 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -115,12 +115,12 @@ struct GroupUserData
// dialog for new block name
class SwNewGlosNameDlg : public ModalDialog
{
- Edit* m_pNewName;
- TextFilter m_aNoSpaceFilter;
- Edit* m_pNewShort;
- OKButton* m_pOk;
- Edit* m_pOldName;
- Edit* m_pOldShort;
+ VclPtr<Edit> m_pNewName;
+ TextFilter m_aNoSpaceFilter;
+ VclPtr<Edit> m_pNewShort;
+ VclPtr<OKButton> m_pOk;
+ VclPtr<Edit> m_pOldName;
+ VclPtr<Edit> m_pOldShort;
protected:
DECL_LINK( Modify, Edit * );
@@ -130,6 +130,8 @@ public:
SwNewGlosNameDlg( vcl::Window* pParent,
const OUString& rOldName,
const OUString& rOldShort );
+ virtual ~SwNewGlosNameDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetNewName() const { return m_pNewName->GetText(); }
OUString GetNewShort() const { return m_pNewShort->GetText(); }
@@ -156,6 +158,21 @@ SwNewGlosNameDlg::SwNewGlosNameDlg(vcl::Window* pParent,
m_pNewName->GrabFocus();
}
+SwNewGlosNameDlg::~SwNewGlosNameDlg()
+{
+ disposeOnce();
+}
+
+void SwNewGlosNameDlg::dispose()
+{
+ m_pNewName.clear();
+ m_pNewShort.clear();
+ m_pOk.clear();
+ m_pOldName.clear();
+ m_pOldShort.clear();
+ ModalDialog::dispose();
+}
+
// query / set currently set group
OUString SwGlossaryDlg::GetCurrGroup()
{
@@ -232,8 +249,26 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame,
SwGlossaryDlg::~SwGlossaryDlg()
{
+ disposeOnce();
+}
+
+void SwGlossaryDlg::dispose()
+{
m_pCategoryBox->Clear();
delete pExampleFrame;
+ m_pInsertTipCB.clear();
+ m_pNameED.clear();
+ m_pShortNameLbl.clear();
+ m_pShortNameEdit.clear();
+ m_pCategoryBox.clear();
+ m_pFileRelCB.clear();
+ m_pNetRelCB.clear();
+ m_pExampleWIN.clear();
+ m_pInsertBtn.clear();
+ m_pEditBtn.clear();
+ m_pBibBtn.clear();
+ m_pPathBtn.clear();
+ SvxStandardDialog::dispose();
}
// select new group
@@ -468,8 +503,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
else if (sItemIdent == "rename")
{
m_pShortNameEdit->SetText(pGlossaryHdl->GetGlossaryShortName(m_pNameED->GetText()));
- boost::scoped_ptr<SwNewGlosNameDlg> pNewNameDlg(new SwNewGlosNameDlg(this, m_pNameED->GetText(),
- m_pShortNameEdit->GetText() ));
+ ScopedVclPtrInstance<SwNewGlosNameDlg> pNewNameDlg(this, m_pNameED->GetText(),
+ m_pShortNameEdit->GetText());
if( RET_OK == pNewNameDlg->Execute() &&
pGlossaryHdl->Rename( m_pShortNameEdit->GetText(),
pNewNameDlg->GetNewShort(),
@@ -488,8 +523,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
}
else if (sItemIdent == "delete")
{
- MessageDialog aQuery(this, SW_RES(STR_QUERY_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if (RET_YES == aQuery.Execute())
+ ScopedVclPtrInstance< MessageDialog > aQuery(this, SW_RES(STR_QUERY_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if (RET_YES == aQuery->Execute())
{
const OUString aShortName(m_pShortNameEdit->GetText());
const OUString aTitle(m_pNameED->GetText());
@@ -616,7 +651,7 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl)
if(bIsWritable)
{
- boost::scoped_ptr<SwGlossaryGroupDlg> pDlg(new SwGlossaryGroupDlg( this, pGloss->GetPathArray(), pGlossaryHdl ));
+ ScopedVclPtrInstance< SwGlossaryGroupDlg > pDlg( this, pGloss->GetPathArray(), pGlossaryHdl );
if ( RET_OK == pDlg->Execute() )
{
Init();
@@ -646,9 +681,9 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl)
}
else
{
- MessageDialog aBox(this, sReadonlyPath, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ ScopedVclPtrInstance< MessageDialog > aBox(this, sReadonlyPath, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if(RET_YES == aBox.Execute())
+ if(RET_YES == aBox->Execute())
PathHdl(m_pPathBtn);
}
}
diff --git a/sw/source/ui/misc/impfnote.hxx b/sw/source/ui/misc/impfnote.hxx
index f9808c4dc040..31b5f8a920d0 100644
--- a/sw/source/ui/misc/impfnote.hxx
+++ b/sw/source/ui/misc/impfnote.hxx
@@ -30,27 +30,27 @@ class SwWrtShell;
class SwEndNoteOptionPage : public SfxTabPage
{
- SwNumberingTypeListBox* m_pNumViewBox;
- FixedText* m_pOffsetLbl;
- NumericField* m_pOffsetFld;
- ListBox* m_pNumCountBox;
- Edit* m_pPrefixED;
- Edit* m_pSuffixED;
- FixedText* m_pPosFT;
- RadioButton* m_pPosPageBox;
- RadioButton* m_pPosChapterBox;
+ VclPtr<SwNumberingTypeListBox> m_pNumViewBox;
+ VclPtr<FixedText> m_pOffsetLbl;
+ VclPtr<NumericField> m_pOffsetFld;
+ VclPtr<ListBox> m_pNumCountBox;
+ VclPtr<Edit> m_pPrefixED;
+ VclPtr<Edit> m_pSuffixED;
+ VclPtr<FixedText> m_pPosFT;
+ VclPtr<RadioButton> m_pPosPageBox;
+ VclPtr<RadioButton> m_pPosChapterBox;
- VclContainer *m_pStylesContainer;
+ VclPtr<VclContainer> m_pStylesContainer;
- ListBox* m_pParaTemplBox;
- FixedText* m_pPageTemplLbl;
- ListBox* m_pPageTemplBox;
+ VclPtr<ListBox> m_pParaTemplBox;
+ VclPtr<FixedText> m_pPageTemplLbl;
+ VclPtr<ListBox> m_pPageTemplBox;
- ListBox* m_pFtnCharAnchorTemplBox;
- ListBox* m_pFtnCharTextTemplBox;
+ VclPtr<ListBox> m_pFtnCharAnchorTemplBox;
+ VclPtr<ListBox> m_pFtnCharTextTemplBox;
- Edit* m_pContEdit;
- Edit* m_pContFromEdit;
+ VclPtr<Edit> m_pContEdit;
+ VclPtr<Edit> m_pContFromEdit;
OUString aNumDoc;
OUString aNumPage;
@@ -70,8 +70,9 @@ public:
SwEndNoteOptionPage( vcl::Window *pParent, bool bEndNote,
const SfxItemSet &rSet );
virtual ~SwEndNoteOptionPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
@@ -84,7 +85,7 @@ class SwFootNoteOptionPage : public SwEndNoteOptionPage
virtual ~SwFootNoteOptionPage();
public:
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
};
#endif
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx
index fb45db53321d..0824f3de8fd3 100644
--- a/sw/source/ui/misc/insfnote.cxx
+++ b/sw/source/ui/misc/insfnote.cxx
@@ -204,10 +204,27 @@ SwInsFootNoteDlg::SwInsFootNoteDlg(vcl::Window *pParent, SwWrtShell &rShell, boo
SwInsFootNoteDlg::~SwInsFootNoteDlg()
{
+ disposeOnce();
+}
+
+void SwInsFootNoteDlg::dispose()
+{
SwViewShell::SetCareWin(0);
if (bEdit)
rSh.ResetSelect(0, false);
+
+ m_pNumberFrame.clear();
+ m_pNumberAutoBtn.clear();
+ m_pNumberCharBtn.clear();
+ m_pNumberCharEdit.clear();
+ m_pNumberExtChar.clear();
+ m_pFtnBtn.clear();
+ m_pEndNoteBtn.clear();
+ m_pOkBtn.clear();
+ m_pPrevBT.clear();
+ m_pNextBT.clear();
+ SvxStandardDialog::dispose();
}
void SwInsFootNoteDlg::Init()
diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx
index db98b1ce87b1..b14903c9e170 100644
--- a/sw/source/ui/misc/linenum.cxx
+++ b/sw/source/ui/misc/linenum.cxx
@@ -169,8 +169,30 @@ SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw)
SwLineNumberingDlg::~SwLineNumberingDlg()
{
+ disposeOnce();
}
+void SwLineNumberingDlg::dispose()
+{
+ m_pBodyContent.clear();
+ m_pDivIntervalFT.clear();
+ m_pDivIntervalNF.clear();
+ m_pDivRowsFT.clear();
+ m_pNumIntervalNF.clear();
+ m_pCharStyleLB.clear();
+ m_pFormatLB.clear();
+ m_pPosLB.clear();
+ m_pOffsetMF.clear();
+ m_pDivisorED.clear();
+ m_pCountEmptyLinesCB.clear();
+ m_pCountFrameLinesCB.clear();
+ m_pRestartEachPageCB.clear();
+ m_pNumberingOnCB.clear();
+ m_pNumberingOnFooterHeader.clear();
+ SfxModalDialog::dispose();
+}
+
+
IMPL_LINK_NOARG(SwLineNumberingDlg, OKHdl)
{
SwLineNumberInfo aInf(pSh->GetLineNumberInfo());
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index cd9c26626de3..50047f254f4f 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -163,7 +163,37 @@ SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* pParent,
SwNumPositionTabPage::~SwNumPositionTabPage()
{
+ disposeOnce();
+}
+
+void SwNumPositionTabPage::dispose()
+{
delete pActNum;
+ m_pLevelLB.clear();
+ m_pPositionFrame.clear();
+ m_pDistBorderFT.clear();
+ m_pDistBorderMF.clear();
+ m_pRelativeCB.clear();
+ m_pIndentFT.clear();
+ m_pIndentMF.clear();
+ m_pDistNumFT.clear();
+ m_pDistNumMF.clear();
+ m_pAlignFT.clear();
+ m_pAlignLB.clear();
+ m_pLabelFollowedByFT.clear();
+ m_pLabelFollowedByLB.clear();
+ m_pListtabFT.clear();
+ m_pListtabMF.clear();
+ m_pAlign2FT.clear();
+ m_pAlign2LB.clear();
+ m_pAlignedAtFT.clear();
+ m_pAlignedAtMF.clear();
+ m_pIndentAtFT.clear();
+ m_pIndentAtMF.clear();
+ m_pStandardPB.clear();
+ m_pPreviewWIN.clear();
+ pOutlineDlg.clear();
+ SfxTabPage::dispose();
}
void SwNumPositionTabPage::InitControls()
@@ -175,9 +205,9 @@ void SwNumPositionTabPage::InitControls()
USHRT_MAX != nActNumLvl;
m_pDistBorderMF->Enable( !bLabelAlignmentPosAndSpaceModeActive &&
- ( bSingleSelection || bRelative || pOutlineDlg != 0 ) );
+ ( bSingleSelection || bRelative || pOutlineDlg.get() != 0 ) );
m_pDistBorderFT->Enable( !bLabelAlignmentPosAndSpaceModeActive &&
- ( bSingleSelection || bRelative || pOutlineDlg != 0 ) );
+ ( bSingleSelection || bRelative || pOutlineDlg.get() != 0 ) );
bool bSetDistEmpty = false;
bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
@@ -512,10 +542,10 @@ void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
m_pIndentAtMF->Show( bLabelAlignmentPosAndSpaceModeActive );
}
-SfxTabPage* SwNumPositionTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwNumPositionTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SwNumPositionTabPage(pParent, *rAttrSet);
+ return VclPtr<SwNumPositionTabPage>::Create(pParent, *rAttrSet);
}
void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh)
@@ -960,15 +990,15 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
// collect char styles
- ListBox rCharFmtLB(this);
- rCharFmtLB.Clear();
- rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone );
+ ScopedVclPtrInstance< ListBox > rCharFmtLB(this);
+ rCharFmtLB->Clear();
+ rCharFmtLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone );
SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
- ::FillCharStyleListBox(rCharFmtLB, pDocShell);
+ ::FillCharStyleListBox(*rCharFmtLB.get(), pDocShell);
std::vector<OUString> aList;
- for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
- aList.push_back( rCharFmtLB.GetEntry(j) );
+ for(sal_Int32 j = 0; j < rCharFmtLB->GetEntryCount(); j++)
+ aList.push_back( rCharFmtLB->GetEntry(j) );
aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index c9ef5a1d1631..c66b86947e80 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -60,9 +60,9 @@ using namespace ::com::sun::star;
class SwNumNamesDlg : public ModalDialog
{
- Edit* m_pFormEdit;
- ListBox* m_pFormBox;
- OKButton* m_pOKBtn;
+ VclPtr<Edit> m_pFormEdit;
+ VclPtr<ListBox> m_pFormBox;
+ VclPtr<OKButton> m_pOKBtn;
DECL_LINK( ModifyHdl, Edit * );
DECL_LINK( SelectHdl, ListBox * );
@@ -70,11 +70,27 @@ class SwNumNamesDlg : public ModalDialog
public:
SwNumNamesDlg(vcl::Window *pParent);
+ virtual ~SwNumNamesDlg();
+ virtual void dispose() SAL_OVERRIDE;
void SetUserNames(const OUString *pList[]);
OUString GetName() const { return m_pFormEdit->GetText(); }
sal_Int32 GetCurEntryPos() const { return m_pFormBox->GetSelectEntryPos(); }
};
+SwNumNamesDlg::~SwNumNamesDlg()
+{
+ disposeOnce();
+}
+
+void SwNumNamesDlg::dispose()
+{
+ m_pFormEdit.clear();
+ m_pFormBox.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
+
+
// remember selected entry
IMPL_LINK_INLINE_START( SwNumNamesDlg, SelectHdl, ListBox *, pBox )
{
@@ -193,7 +209,13 @@ SwOutlineTabDialog::SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* p
SwOutlineTabDialog::~SwOutlineTabDialog()
{
+ disposeOnce();
+}
+
+void SwOutlineTabDialog::dispose()
+{
delete pNumRule;
+ SfxTabDialog::dispose();
}
void SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
@@ -265,7 +287,7 @@ IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu )
nLevelNo = 9;
else if (sIdent == "saveas")
{
- boost::scoped_ptr<SwNumNamesDlg> pDlg(new SwNumNamesDlg(this));
+ VclPtrInstance< SwNumNamesDlg > pDlg(this);
const OUString *aStrArr[SwChapterNumRules::nMaxRules];
for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i)
{
@@ -740,8 +762,25 @@ IMPL_LINK_NOARG(SwOutlineSettingsTabPage, CharFmtHdl)
SwOutlineSettingsTabPage::~SwOutlineSettingsTabPage()
{
+ disposeOnce();
}
+void SwOutlineSettingsTabPage::dispose()
+{
+ m_pLevelLB.clear();
+ m_pCollBox.clear();
+ m_pNumberBox.clear();
+ m_pCharFmtLB.clear();
+ m_pAllLevelFT.clear();
+ m_pAllLevelNF.clear();
+ m_pPrefixED.clear();
+ m_pSuffixED.clear();
+ m_pStartEdit.clear();
+ m_pPreviewWIN.clear();
+ SfxTabPage::dispose();
+}
+
+
void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell)
{
pSh = pShell;
@@ -826,10 +865,10 @@ void SwOutlineSettingsTabPage::Reset( const SfxItemSet* rSet )
ActivatePage(*rSet);
}
-SfxTabPage* SwOutlineSettingsTabPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwOutlineSettingsTabPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SwOutlineSettingsTabPage(pParent, *rAttrSet);
+ return VclPtr<SwOutlineSettingsTabPage>::Create(pParent, *rAttrSet);
}
void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
@@ -892,7 +931,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
{
const Size aSize(PixelToLogic(GetOutputSizePixel()));
- boost::scoped_ptr<VirtualDevice> pVDev(new VirtualDevice(*this));
+ ScopedVclPtrInstance< VirtualDevice > pVDev(*this);
pVDev->SetMapMode(GetMapMode());
pVDev->SetOutputSize( aSize );
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 809b09007fa9..bd8b00829e65 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -135,11 +135,27 @@ SwFootNotePage::SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet)
SwFootNotePage::~SwFootNotePage()
{
+ disposeOnce();
}
-SfxTabPage* SwFootNotePage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+void SwFootNotePage::dispose()
{
- return new SwFootNotePage(pParent, *rSet);
+ m_pMaxHeightPageBtn.clear();
+ m_pMaxHeightBtn.clear();
+ m_pMaxHeightEdit.clear();
+ m_pDistEdit.clear();
+ m_pLinePosBox.clear();
+ m_pLineTypeBox.clear();
+ m_pLineWidthEdit.clear();
+ m_pLineColorBox.clear();
+ m_pLineLengthEdit.clear();
+ m_pLineDistEdit.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwFootNotePage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+{
+ return VclPtr<SfxTabPage>(new SwFootNotePage(pParent, *rSet), SAL_NO_ACQUIRE);
}
void SwFootNotePage::Reset(const SfxItemSet *rSet)
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index d4908da737a6..100a2c4d8d67 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -151,14 +151,41 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) :
SwTextGridPage::~SwTextGridPage()
{
+ disposeOnce();
}
-SfxTabPage *SwTextGridPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+void SwTextGridPage::dispose()
{
- return new SwTextGridPage(pParent, *rSet);
+ m_pNoGridRB.clear();
+ m_pLinesGridRB.clear();
+ m_pCharsGridRB.clear();
+ m_pSnapToCharsCB.clear();
+ m_pExampleWN.clear();
+ m_pLayoutFL.clear();
+ m_pLinesPerPageNF.clear();
+ m_pLinesRangeFT.clear();
+ m_pTextSizeMF.clear();
+ m_pCharsPerLineFT.clear();
+ m_pCharsPerLineNF.clear();
+ m_pCharsRangeFT.clear();
+ m_pCharWidthFT.clear();
+ m_pCharWidthMF.clear();
+ m_pRubySizeFT.clear();
+ m_pRubySizeMF.clear();
+ m_pRubyBelowCB.clear();
+ m_pDisplayFL.clear();
+ m_pDisplayCB.clear();
+ m_pPrintCB.clear();
+ m_pColorLB.clear();
+ SfxTabPage::dispose();
}
-bool SwTextGridPage::FillItemSet(SfxItemSet *rSet)
+VclPtr<SfxTabPage> SwTextGridPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
+{
+ return VclPtr<SfxTabPage>(new SwTextGridPage(pParent, *rSet), SAL_NO_ACQUIRE);
+}
+
+bool SwTextGridPage::FillItemSet(SfxItemSet *rSet)
{
bool bRet = false;
if(m_pNoGridRB->IsValueChangedFromSaved() ||
@@ -460,7 +487,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
IMPL_LINK(SwTextGridPage, GridTypeHdl, RadioButton*, pButton)
{
- bool bEnable = m_pNoGridRB != pButton;
+ bool bEnable = m_pNoGridRB.get() != pButton;
m_pLayoutFL->Enable(bEnable);
m_pDisplayFL->Enable(bEnable);
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 3c58114764b1..bb7bcd01222f 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -250,10 +250,41 @@ SwSortDlg::SwSortDlg(vcl::Window* pParent, SwWrtShell &rShell)
SwSortDlg::~SwSortDlg()
{
+ disposeOnce();
+}
+
+void SwSortDlg::dispose()
+{
::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB1);
::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB2);
::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB3);
delete pColRes;
+ m_pColLbl.clear();
+ m_pTypLbl.clear();
+ m_pKeyCB1.clear();
+ m_pColEdt1.clear();
+ m_pTypDLB1.clear();
+ m_pSortUp1RB.clear();
+ m_pSortDn1RB.clear();
+ m_pKeyCB2.clear();
+ m_pColEdt2.clear();
+ m_pTypDLB2.clear();
+ m_pSortUp2RB.clear();
+ m_pSortDn2RB.clear();
+ m_pKeyCB3.clear();
+ m_pColEdt3.clear();
+ m_pTypDLB3.clear();
+ m_pSortUp3RB.clear();
+ m_pSortDn3RB.clear();
+ m_pColumnRB.clear();
+ m_pRowRB.clear();
+ m_pDelimTabRB.clear();
+ m_pDelimFreeRB.clear();
+ m_pDelimEdt.clear();
+ m_pDelimPB.clear();
+ m_pLangLB.clear();
+ m_pCaseCB.clear();
+ SvxStandardDialog::dispose();
}
sal_Unicode SwSortDlg::GetDelimChar() const
@@ -381,7 +412,7 @@ IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl)
IMPL_LINK( SwSortDlg, CheckHdl, void *, pControl )
{
- if( pControl == m_pRowRB)
+ if( pControl == m_pRowRB.get())
{
m_pColLbl->SetText(aColTxt);
m_pColEdt1->SetMax(nY);
@@ -392,7 +423,7 @@ IMPL_LINK( SwSortDlg, CheckHdl, void *, pControl )
m_pColEdt2->SetAccessibleName(aColTxt);
m_pColEdt3->SetAccessibleName(aColTxt);
}
- else if( pControl == m_pColumnRB)
+ else if( pControl == m_pColumnRB.get())
{
m_pColLbl->SetText(aRowTxt);
m_pColEdt1->SetMax(nX);
diff --git a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx
index 153bbc1a27f7..252e264f4b58 100644
--- a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx
+++ b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx
@@ -55,10 +55,16 @@ SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(vcl::Window *pParent)
SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg()
{
+ disposeOnce();
+}
+
+void SwModalRedlineAcceptDlg::dispose()
+{
AcceptAll(false); // refuse everything remaining
pImplDlg->FillInfo(GetExtraData());
delete pImplDlg;
+ SfxModalDialog::dispose();
}
void SwModalRedlineAcceptDlg::Activate()
diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx
index 2dbd5ec742c6..5f888f3f7497 100644
--- a/sw/source/ui/misc/titlepage.cxx
+++ b/sw/source/ui/misc/titlepage.cxx
@@ -270,7 +270,25 @@ IMPL_LINK_NOARG(SwTitlePageDlg, StartPageHdl)
SwTitlePageDlg::~SwTitlePageDlg()
{
+ disposeOnce();
+}
+
+void SwTitlePageDlg::dispose()
+{
delete mpPageFmtDesc;
+ m_pUseExistingPagesRB.clear();
+ m_pPageCountNF.clear();
+ m_pDocumentStartRB.clear();
+ m_pPageStartRB.clear();
+ m_pPageStartNF.clear();
+ m_pRestartNumberingCB.clear();
+ m_pRestartNumberingNF.clear();
+ m_pSetPageNumberCB.clear();
+ m_pSetPageNumberNF.clear();
+ m_pPagePropertiesLB.clear();
+ m_pPagePropertiesPB.clear();
+ m_pOkPB.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK_NOARG(SwTitlePageDlg, EditHdl)
diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx
index 751b5a4c029d..50ffa471b6f3 100644
--- a/sw/source/ui/table/colwd.cxx
+++ b/sw/source/ui/table/colwd.cxx
@@ -66,6 +66,18 @@ SwTableWidthDlg::SwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rTableFnc )
LoseFocusHdl();
}
+SwTableWidthDlg::~SwTableWidthDlg()
+{
+ disposeOnce();
+}
+
+void SwTableWidthDlg::dispose()
+{
+ m_pColNF.clear();
+ m_pWidthMF.clear();
+ SvxStandardDialog::dispose();
+}
+
void SwTableWidthDlg::Apply()
{
rFnc.InitTabCols();
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index cb31042c14de..63fb7aa83277 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -174,7 +174,27 @@ SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable )
SwConvertTableDlg:: ~SwConvertTableDlg()
{
+ disposeOnce();
+}
+
+void SwConvertTableDlg::dispose()
+{
delete pTAutoFmt;
+ mpTabBtn.clear();
+ mpSemiBtn.clear();
+ mpParaBtn.clear();
+ mpOtherBtn.clear();
+ mpOtherEd.clear();
+ mpKeepColumn.clear();
+ mpOptions.clear();
+ mpHeaderCB.clear();
+ mpRepeatHeaderCB.clear();
+ mpRepeatRows.clear();
+ mpRepeatHeaderNF.clear();
+ mpDontSplitCB.clear();
+ mpBorderCB.clear();
+ mpAutoFmtBtn.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton )
diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
index 56e6c02f36c7..e67319432c11 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -137,7 +137,24 @@ IMPL_LINK_NOARG(SwInsTableDlg, OKHdl)
SwInsTableDlg::~SwInsTableDlg()
{
+ disposeOnce();
+}
+
+void SwInsTableDlg::dispose()
+{
delete pTAutoFmt;
+ m_pNameEdit.clear();
+ m_pColNF.clear();
+ m_pRowNF.clear();
+ m_pHeaderCB.clear();
+ m_pRepeatHeaderCB.clear();
+ m_pRepeatHeaderNF.clear();
+ m_pRepeatGroup.clear();
+ m_pDontSplitCB.clear();
+ m_pBorderCB.clear();
+ m_pInsertBtn.clear();
+ m_pAutoFmtBtn.clear();
+ SfxModalDialog::dispose();
}
IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit )
diff --git a/sw/source/ui/table/mergetbl.cxx b/sw/source/ui/table/mergetbl.cxx
index 6c1dd9449336..1206a8b04842 100644
--- a/sw/source/ui/table/mergetbl.cxx
+++ b/sw/source/ui/table/mergetbl.cxx
@@ -28,6 +28,18 @@ SwMergeTblDlg::SwMergeTblDlg( vcl::Window *pParent, bool& rWithPrev )
m_pMergePrevRB->Check();
}
+SwMergeTblDlg::~SwMergeTblDlg()
+{
+ disposeOnce();
+}
+
+void SwMergeTblDlg::dispose()
+{
+ m_pMergePrevRB.clear();
+ SvxStandardDialog::dispose();
+}
+
+
void SwMergeTblDlg::Apply()
{
m_rMergePrev = m_pMergePrevRB->IsChecked();
diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx
index f745f3f9356d..6c8bdb49b0c0 100644
--- a/sw/source/ui/table/rowht.cxx
+++ b/sw/source/ui/table/rowht.cxx
@@ -75,4 +75,16 @@ SwTableHeightDlg::SwTableHeightDlg(vcl::Window *pParent, SwWrtShell &rS)
}
}
+SwTableHeightDlg::~SwTableHeightDlg()
+{
+ disposeOnce();
+}
+
+void SwTableHeightDlg::dispose()
+{
+ m_pHeightEdit.clear();
+ m_pAutoHeightCB.clear();
+ SvxStandardDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx
index d6d7b62ca16b..c1d00489c519 100644
--- a/sw/source/ui/table/splittbl.cxx
+++ b/sw/source/ui/table/splittbl.cxx
@@ -33,6 +33,20 @@ SwSplitTblDlg::SwSplitTblDlg( vcl::Window *pParent, SwWrtShell &rSh )
get(mpBorderCopyRB, "noheading");
}
+SwSplitTblDlg::~SwSplitTblDlg()
+{
+ disposeOnce();
+}
+
+void SwSplitTblDlg::dispose()
+{
+ mpCntntCopyRB.clear();
+ mpBoxAttrCopyWithParaRB.clear();
+ mpBoxAttrCopyNoParaRB.clear();
+ mpBorderCopyRB.clear();
+ SvxStandardDialog::dispose();
+}
+
void SwSplitTblDlg::Apply()
{
m_nSplit = HEADLINE_CNTNTCOPY;
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 5e9d71114e67..e6636d1b2c5b 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -105,6 +105,32 @@ SwFormatTablePage::SwFormatTablePage(vcl::Window* pParent, const SfxItemSet& rSe
Init();
}
+SwFormatTablePage::~SwFormatTablePage()
+{
+ disposeOnce();
+}
+
+void SwFormatTablePage::dispose()
+{
+ m_pNameED.clear();
+ m_pWidthFT.clear();
+ m_pRelWidthCB.clear();
+ m_pFullBtn.clear();
+ m_pLeftBtn.clear();
+ m_pFromLeftBtn.clear();
+ m_pRightBtn.clear();
+ m_pCenterBtn.clear();
+ m_pFreeBtn.clear();
+ m_pLeftFT.clear();
+ m_pRightFT.clear();
+ m_pTopFT.clear();
+ m_pTopMF.clear();
+ m_pBottomFT.clear();
+ m_pBottomMF.clear();
+ m_pTextDirectionLB.clear();
+ SfxTabPage::dispose();
+}
+
void SwFormatTablePage::Init()
{
m_aLeftMF.SetMetricFieldMin(-999999);
@@ -370,10 +396,10 @@ void SwFormatTablePage::ModifyHdl(const Edit * pEdit)
bModified = true;
}
-SfxTabPage* SwFormatTablePage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwFormatTablePage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SwFormatTablePage( pParent, *rAttrSet );
+ return VclPtr<SwFormatTablePage>::Create( pParent, *rAttrSet );
}
bool SwFormatTablePage::FillItemSet( SfxItemSet* rCoreSet )
@@ -749,15 +775,28 @@ SwTableColumnPage::SwTableColumnPage(vcl::Window* pParent, const SfxItemSet& rSe
&& static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON));
}
-//Description: Page column configuration
- SwTableColumnPage::~SwTableColumnPage()
+SwTableColumnPage::~SwTableColumnPage()
{
+ disposeOnce();
}
-SfxTabPage* SwTableColumnPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+void SwTableColumnPage::dispose()
{
- return new SwTableColumnPage( pParent, *rAttrSet );
+ m_pModifyTableCB.clear();
+ m_pProportionalCB.clear();
+ m_pSpaceFT.clear();
+ m_pSpaceED.clear();
+ m_pUpBtn.clear();
+ m_pDownBtn.clear();
+ for (auto p : m_pTextArr)
+ p.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SwTableColumnPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
+{
+ return VclPtr<SwTableColumnPage>::Create( pParent, *rAttrSet );
}
void SwTableColumnPage::Reset( const SfxItemSet* )
@@ -832,7 +871,7 @@ void SwTableColumnPage::Init(bool bWeb)
IMPL_LINK( SwTableColumnPage, AutoClickHdl, void *, pControl )
{
//move display window
- if(pControl == m_pDownBtn)
+ if(pControl == m_pDownBtn.get())
{
if(aValueTbl[0] > 0)
{
@@ -840,7 +879,7 @@ IMPL_LINK( SwTableColumnPage, AutoClickHdl, void *, pControl )
aValueTbl[i] -= 1;
}
}
- if (pControl == m_pUpBtn)
+ if (pControl == m_pUpBtn.get())
{
if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 )
{
@@ -1307,14 +1346,37 @@ SwTextFlowPage::SwTextFlowPage(vcl::Window* pParent, const SfxItemSet& rSet)
HeadLineCBClickHdl();
}
- SwTextFlowPage::~SwTextFlowPage()
+SwTextFlowPage::~SwTextFlowPage()
+{
+ disposeOnce();
+}
+
+void SwTextFlowPage::dispose()
{
+ m_pPgBrkCB.clear();
+ m_pPgBrkRB.clear();
+ m_pColBrkRB.clear();
+ m_pPgBrkBeforeRB.clear();
+ m_pPgBrkAfterRB.clear();
+ m_pPageCollCB.clear();
+ m_pPageCollLB.clear();
+ m_pPageNoFT.clear();
+ m_pPageNoNF.clear();
+ m_pSplitCB.clear();
+ m_pSplitRowCB.clear();
+ m_pKeepCB.clear();
+ m_pHeadLineCB.clear();
+ m_pRepeatHeaderNF.clear();
+ m_pRepeatHeaderCombo.clear();
+ m_pTextDirectionLB.clear();
+ m_pVertOrientLB.clear();
+ SfxTabPage::dispose();
}
-SfxTabPage* SwTextFlowPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwTextFlowPage::Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet)
{
- return new SwTextFlowPage(pParent, *rAttrSet);
+ return VclPtr<SfxTabPage>(new SwTextFlowPage(pParent, *rAttrSet), SAL_NO_ACQUIRE);
}
bool SwTextFlowPage::FillItemSet( SfxItemSet* rSet )
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 8a8c02aa56f0..36a0cccf0061 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -49,6 +49,7 @@ class AutoFmtPreview : public vcl::Window
public:
AutoFmtPreview(vcl::Window* pParent, WinBits nStyle);
virtual ~AutoFmtPreview();
+ virtual void dispose() SAL_OVERRIDE;
void NotifyChange( const SwTableAutoFmt& rNewData );
@@ -60,7 +61,7 @@ protected:
private:
SwTableAutoFmt aCurData;
- VirtualDevice aVD;
+ ScopedVclPtr<VirtualDevice> aVD;
SvtScriptedTextHelper aScriptedText;
svx::frame::Array maArray; /// Implementation to draw the frame borders.
bool bFitWidth;
@@ -105,11 +106,12 @@ public:
const OUString& rEditTitle,
const OUString& rDefault );
virtual ~SwStringInputDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetInputString() const;
private:
- Edit* m_pEdInput; // Edit obtains the focus.
+ VclPtr<Edit> m_pEdInput; // Edit obtains the focus.
};
SwStringInputDlg::SwStringInputDlg(vcl::Window* pParent, const OUString& rTitle,
@@ -130,6 +132,13 @@ OUString SwStringInputDlg::GetInputString() const
SwStringInputDlg::~SwStringInputDlg()
{
+ disposeOnce();
+}
+
+void SwStringInputDlg::dispose()
+{
+ m_pEdInput.clear();
+ ModalDialog::dispose();
}
// AutoFormat-Dialogue:
@@ -174,9 +183,28 @@ SwAutoFormatDlg::SwAutoFormatDlg( vcl::Window* pParent, SwWrtShell* pWrtShell,
SwAutoFormatDlg::~SwAutoFormatDlg()
{
+ disposeOnce();
+}
+
+void SwAutoFormatDlg::dispose()
+{
if (bCoreDataChanged)
pTableTbl->Save();
delete pTableTbl;
+ m_pLbFormat.clear();
+ m_pFormatting.clear();
+ m_pBtnNumFormat.clear();
+ m_pBtnBorder.clear();
+ m_pBtnFont.clear();
+ m_pBtnPattern.clear();
+ m_pBtnAlignment.clear();
+ m_pBtnOk.clear();
+ m_pBtnCancel.clear();
+ m_pBtnAdd.clear();
+ m_pBtnRemove.clear();
+ m_pBtnRename.clear();
+ m_pWndPreview.clear();
+ SfxModalDialog::dispose();
}
void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt )
@@ -287,10 +315,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl)
bool bOk = false, bFmtInserted = false;
while( !bOk )
{
- boost::scoped_ptr<SwStringInputDlg> pDlg(new SwStringInputDlg( this,
- aStrTitle,
- aStrLabel,
- OUString() ));
+ VclPtrInstance<SwStringInputDlg> pDlg( this, aStrTitle,
+ aStrLabel, OUString() );
if( RET_OK == pDlg->Execute() )
{
const OUString aFormatName( pDlg->GetInputString() );
@@ -349,8 +375,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl)
aMessage += m_pLbFormat->GetSelectEntry();
aMessage += "\n";
- boost::scoped_ptr<MessBox> pBox(new MessBox( this, WinBits( WB_OK_CANCEL ),
- aStrDelTitle, aMessage));
+ VclPtrInstance<MessBox> pBox( this, WinBits( WB_OK_CANCEL ),
+ aStrDelTitle, aMessage );
if ( pBox->Execute() == RET_OK )
{
@@ -384,10 +410,9 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
bool bOk = false;
while( !bOk )
{
- boost::scoped_ptr<SwStringInputDlg> pDlg(new SwStringInputDlg( this,
- aStrRenameTitle,
- m_pLbFormat->GetSelectEntry(),
- OUString() ));
+ VclPtrInstance<SwStringInputDlg> pDlg( this, aStrRenameTitle,
+ m_pLbFormat->GetSelectEntry(),
+ OUString() );
if( pDlg->Execute() == RET_OK )
{
bool bFmtRenamed = false;
@@ -489,8 +514,8 @@ IMPL_LINK_NOARG_INLINE_END(SwAutoFormatDlg, OkHdl)
AutoFmtPreview::AutoFmtPreview(vcl::Window* pParent, WinBits nStyle) :
Window ( pParent, nStyle ),
aCurData ( OUString() ),
- aVD ( *this ),
- aScriptedText ( aVD ),
+ aVD ( VclPtr<VirtualDevice>::Create(*this) ),
+ aScriptedText ( *aVD.get() ),
bFitWidth ( false ),
mbRTL ( false ),
aStrJan ( SW_RES( STR_JAN ) ),
@@ -537,7 +562,13 @@ void AutoFmtPreview::DetectRTL(SwWrtShell* pWrtShell)
AutoFmtPreview::~AutoFmtPreview()
{
+ disposeOnce();
+}
+
+void AutoFmtPreview::dispose()
+{
delete pNumFmt;
+ vcl::Window::dispose();
}
static void lcl_SetFontProperties(
@@ -762,11 +793,11 @@ void AutoFmtPreview::DrawBackground()
{
SvxBrushItem aBrushItem( aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() );
- aVD.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
- aVD.SetLineColor();
- aVD.SetFillColor( aBrushItem.GetColor() );
- aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) );
- aVD.Pop();
+ aVD->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+ aVD->SetLineColor();
+ aVD->SetFillColor( aBrushItem.GetColor() );
+ aVD->DrawRect( maArray.GetCellRect( nCol, nRow ) );
+ aVD->Pop();
}
}
}
@@ -782,7 +813,7 @@ void AutoFmtPreview::PaintCells()
// 3) border
if ( aCurData.IsFrame() )
- maArray.DrawArray( aVD );
+ maArray.DrawArray( *aVD.get() );
}
void AutoFmtPreview::Init()
@@ -851,9 +882,9 @@ void AutoFmtPreview::NotifyChange( const SwTableAutoFmt& rNewData )
void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ )
{
- sal_uInt32 nOldDrawMode = aVD.GetDrawMode();
+ sal_uInt32 nOldDrawMode = aVD->GetDrawMode();
if( GetSettings().GetStyleSettings().GetHighContrastMode() )
- aVD.SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
+ aVD->SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
Bitmap thePreview;
Point aCenterPos;
@@ -861,36 +892,36 @@ void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ )
Color oldColor;
vcl::Font aFont;
- aFont = aVD.GetFont();
+ aFont = aVD->GetFont();
aFont.SetTransparent( true );
- aVD.SetFont ( aFont );
- aVD.SetLineColor ();
+ aVD->SetFont ( aFont );
+ aVD->SetLineColor ();
const Color& rWinColor = GetSettings().GetStyleSettings().GetWindowColor();
- aVD.SetBackground ( Wallpaper(rWinColor) );
- aVD.SetFillColor ( rWinColor );
- aVD.SetOutputSizePixel ( aPrvSize );
+ aVD->SetBackground ( Wallpaper(rWinColor) );
+ aVD->SetFillColor ( rWinColor );
+ aVD->SetOutputSizePixel ( aPrvSize );
// Draw cells on virtual device
// and save the result
PaintCells();
- thePreview = aVD.GetBitmap( Point(0,0), aPrvSize );
+ thePreview = aVD->GetBitmap( Point(0,0), aPrvSize );
// Draw the Frame and center the preview:
// (virtual Device for window output)
- aVD.SetOutputSizePixel( theWndSize );
- oldColor = aVD.GetLineColor();
- aVD.SetLineColor();
- aVD.DrawRect( Rectangle( Point(0,0), theWndSize ) );
+ aVD->SetOutputSizePixel( theWndSize );
+ oldColor = aVD->GetLineColor();
+ aVD->SetLineColor();
+ aVD->DrawRect( Rectangle( Point(0,0), theWndSize ) );
SetLineColor( oldColor );
aCenterPos = Point( (theWndSize.Width() - aPrvSize.Width() ) / 2,
(theWndSize.Height() - aPrvSize.Height()) / 2 );
- aVD.DrawBitmap( aCenterPos, thePreview );
+ aVD->DrawBitmap( aCenterPos, thePreview );
// Output in the preview window:
- DrawBitmap( Point(0,0), aVD.GetBitmap( Point(0,0), theWndSize ) );
+ DrawBitmap( Point(0,0), aVD->GetBitmap( Point(0,0), theWndSize ) );
- aVD.SetDrawMode( nOldDrawMode );
+ aVD->SetDrawMode( nOldDrawMode );
}
void AutoFmtPreview::Paint( const Rectangle& rRect )
diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx
index 15902b8a076a..f2ebdb3a6df5 100644
--- a/sw/source/ui/utlui/swrenamexnameddlg.cxx
+++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx
@@ -74,6 +74,18 @@ SwRenameXNamedDlg::SwRenameXNamedDlg( vcl::Window* pWin,
m_pOk->Enable(false);
}
+SwRenameXNamedDlg::~SwRenameXNamedDlg()
+{
+ disposeOnce();
+}
+
+void SwRenameXNamedDlg::dispose()
+{
+ m_pNewNameED.clear();
+ m_pOk.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK_NOARG(SwRenameXNamedDlg, OkHdl)
{
try
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index db3aeb30865d..4d4af5cf1b2a 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -418,9 +418,9 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
}
-SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
+VclPtr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
{
- SfxTabPage* pRet = NULL;
+ VclPtr<SfxTabPage> pRet;
SfxAllItemSet aSet(*(rSet.GetPool()));
switch( nId )
{
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 1ef8a1fd1025..706015d73dbd 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -133,10 +133,10 @@ using namespace ::com::sun::star;
using namespace ::sfx2;
// create DocInfo (virtual)
-SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog(
+VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(
vcl::Window *pParent, const SfxItemSet &rSet)
{
- SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog(pParent, rSet);
+ VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create(pParent, rSet);
//only with statistics, when this document is being shown, not
//from within the Doc-Manager
SwDocShell* pDocSh = static_cast<SwDocShell*>( SfxObjectShell::Current());
@@ -500,8 +500,8 @@ void SwDocShell::Execute(SfxRequest& rReq)
if ( aFileName.isEmpty() )
{
SvtPathOptions aPathOpt;
- boost::scoped_ptr<SfxNewFileDialog> pNewFileDlg(
- new SfxNewFileDialog(&GetView()->GetViewFrame()->GetWindow(), SFXWB_LOAD_TEMPLATE));
+ ScopedVclPtr<SfxNewFileDialog> pNewFileDlg(
+ VclPtr<SfxNewFileDialog>::Create(&GetView()->GetViewFrame()->GetWindow(), SFXWB_LOAD_TEMPLATE));
pNewFileDlg->SetTemplateFlags(nFlags);
nRet = pNewFileDlg->Execute();
@@ -608,10 +608,10 @@ void SwDocShell::Execute(SfxRequest& rReq)
const SfxFilter* pFlt = GetMedium()->GetFilter();
if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData())
{
- MessageDialog aQuery(&pViewFrm->GetWindow(),
- "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui");
+ ScopedVclPtrInstance<MessageDialog> aQuery(&pViewFrm->GetWindow(),
+ "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui");
- if(RET_YES == aQuery.Execute())
+ if(RET_YES == aQuery->Execute())
bLocalHasName = false;
else
break;
@@ -648,7 +648,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
{
SfxPrinter* pTemp = GetDoc()->getIDocumentDeviceAccess().getPrinter( false );
if(pTemp)
- pSavePrinter = new SfxPrinter(*pTemp);
+ pSavePrinter = VclPtr<SfxPrinter>::Create(*pTemp);
bSetModified = IsModified() || pSrcView->IsModified();
if(pSrcView->IsModified()||pSrcView->HasSourceSaved())
{
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index e110b0d75ed3..28e1d2c00948 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -356,8 +356,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
{
case SID_STYLE_NEW_BY_EXAMPLE:
{
- boost::scoped_ptr<SfxNewStyleDlg> pDlg(new SfxNewStyleDlg( 0,
- *GetStyleSheetPool()));
+ VclPtrInstance<SfxNewStyleDlg> pDlg( nullptr, *GetStyleSheetPool());
if(RET_OK == pDlg->Execute())
{
aParam = pDlg->GetName();
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 2163096bce98..299eee2ffd00 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -945,17 +945,17 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
bool bPageStylesWithHeaderFooter = false;
vcl::Window *pSourceWindow = 0;
- CancelableDialog *pProgressDlg = 0;
+ VclPtr<CancelableDialog> pProgressDlg;
if (!IsMergeSilent()) {
pSourceWindow = &pSourceShell->GetView().GetEditWin();
if( ! pParent )
pParent = pSourceWindow;
if( bMergeShell )
- pProgressDlg = new CreateMonitor( pParent, pParent != pSourceWindow );
+ pProgressDlg = VclPtr<CreateMonitor>::Create( pParent, pParent != pSourceWindow );
else {
- pProgressDlg = new PrintMonitor( pParent, pParent != pSourceWindow, PrintMonitor::MONITOR_TYPE_PRINT );
- static_cast<PrintMonitor*>( pProgressDlg )->SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22));
+ pProgressDlg = VclPtr<PrintMonitor>::Create( pParent, pParent != pSourceWindow, PrintMonitor::MONITOR_TYPE_PRINT );
+ static_cast<PrintMonitor*>( pProgressDlg.get() )->SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22));
}
pProgressDlg->SetCancelHdl( LINK(this, SwDBManager, PrtCancelHdl) );
pProgressDlg->Show();
@@ -1030,7 +1030,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
int targetDocPageCount = 0;
if( !IsMergeSilent() && bMergeShell &&
lcl_getCountFromResultSet( nDocCount, pImpl->pMergeData->xResultSet ) )
- static_cast<CreateMonitor*>( pProgressDlg )->SetTotalCount( nDocCount );
+ static_cast<CreateMonitor*>( pProgressDlg.get() )->SetTotalCount( nDocCount );
long nStartRow, nEndRow;
bool bFreezedLayouts = false;
@@ -1094,9 +1094,9 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
aTempFileURL.reset( new INetURLObject(aTempFile->GetURL()));
if (!IsMergeSilent()) {
if( bMergeShell )
- static_cast<CreateMonitor*>( pProgressDlg )->SetCurrentPosition( nDocNo );
+ static_cast<CreateMonitor*>( pProgressDlg.get() )->SetCurrentPosition( nDocNo );
else {
- PrintMonitor *pPrintMonDlg = static_cast<PrintMonitor*>( pProgressDlg );
+ PrintMonitor *pPrintMonDlg = static_cast<PrintMonitor*>( pProgressDlg.get() );
pPrintMonDlg->m_pPrinter->SetText( createTempFile ? aTempFileURL->GetBase() : OUString( pSourceDocSh->GetTitle( 22 )));
OUString sStat(SW_RES(STR_STATSTR_LETTER)); // Brief
sStat += " ";
@@ -1411,7 +1411,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllCheckPageDescs));
}
- DELETEZ( pProgressDlg );
+ pProgressDlg.disposeAndClear();
// save the single output document
if (bMergeShell)
diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index 64bcf9c87ae8..e2dea59c31d3 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -186,7 +186,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwDBTreeList(vcl::Wind
OString sBorder = VclBuilder::extractCustomProperty(rMap);
if (!sBorder.isEmpty())
nStyle |= WB_BORDER;
- return new SwDBTreeList(pParent, nStyle);
+ return VclPtr<SwDBTreeList>::Create(pParent, nStyle);
}
Size SwDBTreeList::GetOptimalSize() const
@@ -196,7 +196,13 @@ Size SwDBTreeList::GetOptimalSize() const
SwDBTreeList::~SwDBTreeList()
{
+ disposeOnce();
+}
+
+void SwDBTreeList::dispose()
+{
delete pImpl;
+ SvTreeListBox::dispose();
}
void SwDBTreeList::InitTreeList()
diff --git a/sw/source/uibase/dbui/dbui.cxx b/sw/source/uibase/dbui/dbui.cxx
index fd94b2818d49..8e44685b868f 100644
--- a/sw/source/uibase/dbui/dbui.cxx
+++ b/sw/source/uibase/dbui/dbui.cxx
@@ -42,6 +42,21 @@ PrintMonitor::PrintMonitor(vcl::Window *pParent, bool modal, PrintMonitorType eT
m_pPrinting->Show();
}
+PrintMonitor::~PrintMonitor()
+{
+ disposeOnce();
+}
+
+void PrintMonitor::dispose()
+{
+ m_pDocName.clear();
+ m_pPrinting.clear();
+ m_pPrinter.clear();
+ m_pPrintInfo.clear();
+
+ CancelableDialog::dispose();
+}
+
// Progress Indicator for Creation of personalized Mail Merge documents:
CreateMonitor::CreateMonitor( vcl::Window *pParent, bool modal )
: CancelableDialog(pParent, modal, "MMCreatingDialog",
@@ -57,6 +72,19 @@ CreateMonitor::CreateMonitor( vcl::Window *pParent, bool modal )
m_pCounting->SetText("...");
}
+CreateMonitor::~CreateMonitor()
+{
+ disposeOnce();
+}
+
+void CreateMonitor::dispose()
+{
+ m_pCancelButton.clear();
+ m_pCounting.clear();
+
+ CancelableDialog::dispose();
+}
+
void CreateMonitor::UpdateCountingText()
{
OUString sText(m_sCountingPattern);
@@ -88,7 +116,15 @@ CancelableDialog::CancelableDialog( vcl::Window *pParent, bool modal,
CancelableDialog::~CancelableDialog()
{
+ disposeOnce();
+}
+
+void CancelableDialog::dispose()
+{
EndDialog( 0 );
+ m_pCancelButton.clear();
+
+ Dialog::dispose();
}
void CancelableDialog::SetCancelHdl( const Link& rLink )
diff --git a/sw/source/uibase/dbui/mailmergechildwindow.cxx b/sw/source/uibase/dbui/mailmergechildwindow.cxx
index e43731b1e399..ad16a82acf59 100644
--- a/sw/source/uibase/dbui/mailmergechildwindow.cxx
+++ b/sw/source/uibase/dbui/mailmergechildwindow.cxx
@@ -43,7 +43,7 @@ SwMailMergeChildWindow::SwMailMergeChildWindow( vcl::Window* _pParent,
SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId )
{
- pWindow = new SwMailMergeChildWin( pBindings, this, _pParent);
+ pWindow = VclPtr<SwMailMergeChildWin>::Create( pBindings, this, _pParent);
if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
{
@@ -59,7 +59,7 @@ SwMailMergeChildWindow::SwMailMergeChildWindow( vcl::Window* _pParent,
pInfo->aSize = pWindow->GetSizePixel();
}
- static_cast<SwMailMergeChildWin *>(pWindow)->Initialize(pInfo);
+ static_cast<SwMailMergeChildWin *>(pWindow.get())->Initialize(pInfo);
pWindow->Show();
}
@@ -73,6 +73,17 @@ SwMailMergeChildWin::SwMailMergeChildWin(SfxBindings* _pBindings,
m_pBackTB->SetButtonType( ButtonType::SYMBOLTEXT );
}
+SwMailMergeChildWin::~SwMailMergeChildWin()
+{
+ disposeOnce();
+}
+
+void SwMailMergeChildWin::dispose()
+{
+ m_pBackTB.clear();
+ SfxFloatingWindow::dispose();
+}
+
IMPL_LINK_NOARG(SwMailMergeChildWin, BackHdl)
{
GetBindings().GetDispatcher()->Execute(FN_MAILMERGE_WIZARD, SfxCallMode::ASYNCHRON);
diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx
index 4e3d3870caf3..8f7baa658f91 100644
--- a/sw/source/uibase/dbui/mailmergehelper.cxx
+++ b/sw/source/uibase/dbui/mailmergehelper.cxx
@@ -187,14 +187,25 @@ struct SwAddressPreview_Impl
SwAddressPreview::SwAddressPreview(vcl::Window* pParent, WinBits nStyle)
: Window( pParent, nStyle )
- , aVScrollBar(this, WB_VSCROLL)
+ , aVScrollBar(VclPtr<ScrollBar>::Create(this, WB_VSCROLL))
, pImpl(new SwAddressPreview_Impl())
{
- aVScrollBar.SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl));
+ aVScrollBar->SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl));
positionScrollBar();
Show();
}
+SwAddressPreview::~SwAddressPreview()
+{
+ disposeOnce();
+}
+
+void SwAddressPreview::dispose()
+{
+ aVScrollBar.disposeAndClear();
+ vcl::Window::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressPreview(vcl::Window *pParent, VclBuilder::stringmap &rMap)
{
WinBits nWinStyle = WB_TABSTOP;
@@ -207,10 +218,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressPreview(vcl::
void SwAddressPreview::positionScrollBar()
{
Size aSize(GetOutputSizePixel());
- Size aScrollSize(aVScrollBar.get_preferred_size().Width(), aSize.Height());
- aVScrollBar.SetSizePixel(aScrollSize);
+ Size aScrollSize(aVScrollBar->get_preferred_size().Width(), aSize.Height());
+ aVScrollBar->SetSizePixel(aScrollSize);
Point aSrollPos(aSize.Width() - aScrollSize.Width(), 0);
- aVScrollBar.SetPosPixel(aSrollPos);
+ aVScrollBar->SetPosPixel(aSrollPos);
}
void SwAddressPreview::Resize()
@@ -235,7 +246,7 @@ void SwAddressPreview::SetAddress(const OUString& rAddress)
{
pImpl->aAddresses.clear();
pImpl->aAddresses.push_back(rAddress);
- aVScrollBar.Show(false);
+ aVScrollBar->Show(false);
Invalidate();
}
@@ -251,9 +262,9 @@ void SwAddressPreview::SelectAddress(sal_uInt16 nSelect)
pImpl->nSelectedAddress = nSelect;
// now make it visible..
sal_uInt16 nSelectRow = nSelect / pImpl->nColumns;
- sal_uInt16 nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos();
+ sal_uInt16 nStartRow = (sal_uInt16)aVScrollBar->GetThumbPos();
if( (nSelectRow < nStartRow) || (nSelectRow >= (nStartRow + pImpl->nRows) ))
- aVScrollBar.SetThumbPos( nSelectRow );
+ aVScrollBar->SetThumbPos( nSelectRow );
}
void SwAddressPreview::Clear()
@@ -294,13 +305,13 @@ void SwAddressPreview::UpdateScrollBar()
{
if(pImpl->nColumns)
{
- aVScrollBar.SetVisibleSize(pImpl->nRows);
+ aVScrollBar->SetVisibleSize(pImpl->nRows);
sal_uInt16 nResultingRows = (sal_uInt16)(pImpl->aAddresses.size() + pImpl->nColumns - 1) / pImpl->nColumns;
++nResultingRows;
- aVScrollBar.Show(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows);
- aVScrollBar.SetRange(Range(0, nResultingRows));
- if(aVScrollBar.GetThumbPos() > nResultingRows)
- aVScrollBar.SetThumbPos(nResultingRows);
+ aVScrollBar->Show(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows);
+ aVScrollBar->SetRange(Range(0, nResultingRows));
+ if(aVScrollBar->GetThumbPos() > nResultingRows)
+ aVScrollBar->SetThumbPos(nResultingRows);
}
}
@@ -318,10 +329,10 @@ void SwAddressPreview::Paint(const Rectangle&)
Size aSize = GetOutputSizePixel();
sal_uInt16 nStartRow = 0;
- if(aVScrollBar.IsVisible())
+ if(aVScrollBar->IsVisible())
{
- aSize.Width() -= aVScrollBar.GetSizePixel().Width();
- nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos();
+ aSize.Width() -= aVScrollBar->GetSizePixel().Width();
+ nStartRow = (sal_uInt16)aVScrollBar->GetThumbPos();
}
Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows );
aPartSize.Width() -= 2;
@@ -358,9 +369,9 @@ void SwAddressPreview::MouseButtonDown( const MouseEvent& rMEvt )
Size aSize(GetOutputSizePixel());
Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows );
sal_uInt32 nRow = rMousePos.Y() / aPartSize.Height() ;
- if(aVScrollBar.IsVisible())
+ if(aVScrollBar->IsVisible())
{
- nRow += (sal_uInt16)aVScrollBar.GetThumbPos();
+ nRow += (sal_uInt16)aVScrollBar->GetThumbPos();
}
sal_uInt32 nCol = rMousePos.X() / aPartSize.Width();
sal_uInt32 nSelect = nRow * pImpl->nColumns + nCol;
@@ -615,7 +626,7 @@ OUString SwAuthenticator::getPassword( ) throw (RuntimeException, std::exceptio
if(!m_aUserName.isEmpty() && m_aPassword.isEmpty() && m_pParentWindow)
{
SfxPasswordDialog* pPasswdDlg =
- new SfxPasswordDialog( m_pParentWindow );
+ VclPtr<SfxPasswordDialog>::Create( m_pParentWindow );
pPasswdDlg->SetMinLen( 0 );
if(RET_OK == pPasswdDlg->Execute())
m_aPassword = pPasswdDlg->GetPassword();
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 2ba22e414c66..7a27619f4f86 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -388,8 +388,10 @@ namespace
sal_uInt16 aRotation = aMetadata.getRotation();
if (aRotation != 0)
{
- MessageDialog aQueryBox( 0,"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui");
- if (aQueryBox.Execute() == RET_YES)
+ ScopedVclPtrInstance< MessageDialog > aQueryBox(
+ nullptr, "QueryRotateIntoStandardOrientationDialog",
+ "modules/swriter/ui/queryrotateintostandarddialog.ui");
+ if (aQueryBox->Execute() == RET_YES)
{
GraphicNativeTransform aTransform( aGraphic );
aTransform.rotate( aRotation );
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
index fbbed6ba7b40..14c486369ca8 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
@@ -58,7 +58,13 @@ AnnotationMenuButton::AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rS
AnnotationMenuButton::~AnnotationMenuButton()
{
+ disposeOnce();
+}
+
+void AnnotationMenuButton::dispose()
+{
RemoveEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) );
+ MenuButton::dispose();
}
void AnnotationMenuButton::Select()
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.hxx b/sw/source/uibase/docvw/AnnotationMenuButton.hxx
index 1bc2c13a56c1..9682bcf491fe 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.hxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.hxx
@@ -33,6 +33,7 @@ class AnnotationMenuButton : public MenuButton
public:
AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin );
virtual ~AnnotationMenuButton();
+ virtual void dispose() SAL_OVERRIDE;
// override MenuButton methods
virtual void Select() SAL_OVERRIDE;
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 5cff22259e9b..2ea841068127 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -70,7 +70,13 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
SwAnnotationWin::~SwAnnotationWin()
{
+ disposeOnce();
+}
+
+void SwAnnotationWin::dispose()
+{
delete mpButtonPopup;
+ sw::sidebarwindows::SwSidebarWin::dispose();
}
void SwAnnotationWin::SetPostItText()
@@ -207,7 +213,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing()
return aCount - 1;
}
-MenuButton* SwAnnotationWin::CreateMenuButton()
+VclPtr<MenuButton> SwAnnotationWin::CreateMenuButton()
{
mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON));
OUString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR );
@@ -215,7 +221,7 @@ MenuButton* SwAnnotationWin::CreateMenuButton()
aRewriter.AddRule(UndoArg1,GetAuthor());
aText = aRewriter.Apply(aText);
mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
- MenuButton* pMenuButton = new AnnotationMenuButton( *this );
+ VclPtr<MenuButton> pMenuButton( new AnnotationMenuButton( *this ), SAL_NO_ACQUIRE );
pMenuButton->SetPopupMenu( mpButtonPopup );
pMenuButton->Show();
return pMenuButton;
diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx
index 7cd0e7f53319..e16809626414 100644
--- a/sw/source/uibase/docvw/FrameControlsManager.cxx
+++ b/sw/source/uibase/docvw/FrameControlsManager.cxx
@@ -34,6 +34,11 @@ SwFrameControlsManager::SwFrameControlsManager( const SwFrameControlsManager& rC
{
}
+void SwFrameControlsManager::dispose()
+{
+ m_aControls.clear();
+}
+
const SwFrameControlsManager& SwFrameControlsManager::operator=( const SwFrameControlsManager& rCopy )
{
m_pEditWin = rCopy.m_pEditWin;
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 43dc81dac543..61dcbd21964e 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -143,7 +143,7 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag
SetMapMode( MapMode ( MAP_PIXEL ) );
// Create the line control
- m_pLine = new SwDashedLine( GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor );
+ m_pLine = VclPtr<SwDashedLine>::Create( GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor );
m_pLine->SetZOrder( this, WINDOW_ZORDER_BEFOR );
// Create and set the PopupMenu
@@ -169,8 +169,14 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag
SwHeaderFooterWin::~SwHeaderFooterWin( )
{
+ disposeOnce();
+}
+
+void SwHeaderFooterWin::dispose()
+{
delete m_pPopupMenu;
- delete m_pLine;
+ m_pLine.disposeAndClear();
+ MenuButton::dispose();
}
const SwPageFrm* SwHeaderFooterWin::GetPageFrame( )
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index 42027fbea9ed..d806eb332395 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -56,12 +56,14 @@ namespace
class SwBreakDashedLine : public SwDashedLine
{
private:
- SwPageBreakWin* m_pWin;
+ VclPtr<SwPageBreakWin> m_pWin;
public:
SwBreakDashedLine( vcl::Window* pParent, Color& ( *pColorFn )(), SwPageBreakWin* pWin ) :
SwDashedLine( pParent, pColorFn ),
m_pWin( pWin ) {};
+ virtual ~SwBreakDashedLine() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { m_pWin.clear(); SwDashedLine::dispose(); }
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
};
@@ -103,7 +105,7 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
SetMapMode( MapMode ( MAP_PIXEL ) );
// Create the line control
- m_pLine = new SwBreakDashedLine( GetEditWin(), &SwViewOption::GetPageBreakColor, this );
+ m_pLine = VclPtr<SwBreakDashedLine>::Create( GetEditWin(), &SwViewOption::GetPageBreakColor, this );
// Create the popup menu
m_pPopupMenu = new PopupMenu( SW_RES( MN_PAGEBREAK_BUTTON ) );
@@ -116,12 +118,21 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
SwPageBreakWin::~SwPageBreakWin( )
{
+ disposeOnce();
+}
+
+void SwPageBreakWin::dispose()
+{
m_bDestroyed = true;
m_aFadeTimer.Stop();
+ m_pLine.disposeAndClear();
delete m_pPopupMenu;
- delete m_pLine;
+ m_pPopupMenu = NULL;
delete m_pMousePt;
+ m_pMousePt = NULL;
+
+ MenuButton::dispose();
}
void SwPageBreakWin::Paint( const Rectangle& )
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 7b36acd7ccb3..09357e2b40b8 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -193,8 +193,7 @@ void SwPostItMgr::CheckForRemovedPostIts()
mvPostItFlds.remove(*it);
if (GetActiveSidebarWin() == p->pPostIt)
SetActiveSidebarWin(0);
- if (p->pPostIt)
- delete p->pPostIt;
+ p->pPostIt.disposeAndClear();
delete p;
bRemoved = true;
}
@@ -243,8 +242,8 @@ void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast )
SwSidebarItem* p = (*i);
if (GetActiveSidebarWin() == p->pPostIt)
SetActiveSidebarWin(0);
+ p->pPostIt.disposeAndClear();
mvPostItFlds.erase(i);
- delete p->pPostIt;
delete p;
break;
}
@@ -1178,8 +1177,7 @@ void SwPostItMgr::RemoveSidebarWin()
for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i)
{
EndListening( *(const_cast<SfxBroadcaster*>((*i)->GetBroadCaster())) );
- if ((*i)->pPostIt)
- delete (*i)->pPostIt;
+ (*i)->pPostIt.disposeAndClear();
delete (*i);
}
mvPostItFlds.clear();
@@ -1498,7 +1496,7 @@ sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItFie
for(const_iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i)
{
if ( (*i)->GetFmtFld().GetField() == pFld )
- return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt);
+ return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt.get());
}
return NULL;
}
@@ -2031,13 +2029,13 @@ void SwPostItMgr::AssureStdModeAtShell()
bool SwPostItMgr::HasActiveSidebarWin() const
{
- return mpActivePostIt != 0;
+ return mpActivePostIt != nullptr;
}
bool SwPostItMgr::HasActiveAnnotationWin() const
{
return HasActiveSidebarWin() &&
- dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt) != 0;
+ dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt.get()) != 0;
}
void SwPostItMgr::GrabFocusOnActiveSidebarWin()
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 88f5316b9ad9..fcb3eb65e4c7 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -70,7 +70,13 @@ SidebarTxtControl::SidebarTxtControl( SwSidebarWin& rSidebarWin,
SidebarTxtControl::~SidebarTxtControl()
{
+ disposeOnce();
+}
+
+void SidebarTxtControl::dispose()
+{
RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+ Control::dispose();
}
OutlinerView* SidebarTxtControl::GetTextView() const
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
index f14502031f98..4bd1fe89b7d8 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
@@ -58,6 +58,7 @@ class SidebarTxtControl : public Control
SwView& rDocView,
SwPostItMgr& rPostItMgr );
virtual ~SidebarTxtControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 93b3cae87068..d9485d76dda2 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -137,6 +137,14 @@ SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin,
SwSidebarWin::~SwSidebarWin()
{
+ disposeOnce();
+}
+
+void SwSidebarWin::dispose()
+{
+ if (IsDisposed())
+ return;
+
mrMgr.DisconnectSidebarWinFromFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
*this );
@@ -148,9 +156,8 @@ SwSidebarWin::~SwSidebarWin()
{
mpOutlinerView->SetWindow( 0 );
}
- delete mpSidebarTxtControl;
- mpSidebarTxtControl = 0;
}
+ mpSidebarTxtControl.disposeAndClear();
if ( mpOutlinerView )
{
@@ -167,23 +174,20 @@ SwSidebarWin::~SwSidebarWin()
if (mpMetadataAuthor)
{
mpMetadataAuthor->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
- delete mpMetadataAuthor;
- mpMetadataAuthor = 0;
}
+ mpMetadataAuthor.disposeAndClear();
if (mpMetadataDate)
{
mpMetadataDate->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
- delete mpMetadataDate;
- mpMetadataDate = 0;
}
+ mpMetadataDate.disposeAndClear();
if (mpVScrollbar)
{
mpVScrollbar->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
- delete mpVScrollbar;
- mpVScrollbar = 0;
}
+ mpVScrollbar.disposeAndClear();
RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
@@ -196,11 +200,12 @@ SwSidebarWin::~SwSidebarWin()
delete mpTextRangeOverlay;
mpTextRangeOverlay = NULL;
- delete mpMenuButton;
- mpMenuButton = 0;
+ mpMenuButton.disposeAndClear();
if (mnEventId)
Application::RemoveUserEvent( mnEventId );
+
+ vcl::Window::dispose();
}
void SwSidebarWin::Paint( const Rectangle& rRect)
@@ -351,13 +356,13 @@ void SwSidebarWin::InitControls()
AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
// actual window which holds the user text
- mpSidebarTxtControl = new SidebarTxtControl( *this,
+ mpSidebarTxtControl = VclPtr<SidebarTxtControl>::Create( *this,
WB_NODIALOGCONTROL,
mrView, mrMgr );
mpSidebarTxtControl->SetPointer(Pointer(POINTER_TEXT));
// window controls for author and date
- mpMetadataAuthor = new Edit( this, 0 );
+ mpMetadataAuthor = VclPtr<Edit>::Create( this, 0 );
mpMetadataAuthor->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
mpMetadataAuthor->EnableRTL(AllSettings::GetLayoutRTL());
mpMetadataAuthor->SetReadOnly();
@@ -376,7 +381,7 @@ void SwSidebarWin::InitControls()
mpMetadataAuthor->SetSettings(aSettings);
}
- mpMetadataDate = new Edit( this, 0 );
+ mpMetadataDate = VclPtr<Edit>::Create( this, 0 );
mpMetadataDate->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_DATE_NAME ) );
mpMetadataDate->EnableRTL(AllSettings::GetLayoutRTL());
mpMetadataDate->SetReadOnly();
@@ -410,7 +415,7 @@ void SwSidebarWin::InitControls()
mpOutlinerView->SetAttribs(DefaultItem());
//create Scrollbars
- mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ mpVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
mpVScrollbar->EnableNativeWidget(false);
mpVScrollbar->EnableRTL( false );
mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl));
@@ -1370,7 +1375,7 @@ void SwSidebarWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayo
bool SwSidebarWin::HasScrollbar() const
{
- return mpVScrollbar != 0;
+ return mpVScrollbar != nullptr;
}
bool SwSidebarWin::IsScrollbarVisible() const
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 22b968a1b4e3..71042f0aa7aa 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -4968,17 +4968,36 @@ SwEditWin::SwEditWin(vcl::Window *pParent, SwView &rMyView):
SwEditWin::~SwEditWin()
{
+ disposeOnce();
+}
+
+void SwEditWin::dispose()
+{
m_aKeyInputTimer.Stop();
+
delete m_pShadCrsr;
+ m_pShadCrsr = NULL;
+
delete m_pRowColumnSelectionStart;
+ m_pRowColumnSelectionStart = NULL;
+
if( m_pQuickHlpData->m_bIsDisplayed && m_rView.GetWrtShellPtr() )
m_pQuickHlpData->Stop( m_rView.GetWrtShell() );
g_bExecuteDrag = false;
delete m_pApplyTempl;
+ m_pApplyTempl = NULL;
+
m_rView.SetDrawFuncPtr(NULL);
delete m_pUserMarker;
+ m_pUserMarker = NULL;
+
delete m_pAnchorMarker;
+ m_pAnchorMarker = NULL;
+
+ m_aFrameControlsManager.dispose();
+
+ vcl::Window::dispose();
}
/**
@@ -5061,9 +5080,10 @@ void SwEditWin::GetFocus()
void SwEditWin::LoseFocus()
{
- m_rView.GetWrtShell().InvalidateAccessibleFocus();
+ if (m_rView.GetWrtShellPtr())
+ m_rView.GetWrtShell().InvalidateAccessibleFocus();
Window::LoseFocus();
- if( m_pQuickHlpData->m_bIsDisplayed )
+ if( m_pQuickHlpData && m_pQuickHlpData->m_bIsDisplayed )
m_pQuickHlpData->Stop( m_rView.GetWrtShell() );
}
diff --git a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
index 75ab9e95312b..2c037ffaf4bb 100644
--- a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
+++ b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
@@ -48,7 +48,7 @@ namespace {
}
};
- typedef ::std::map < SidebarWinKey, sw::sidebarwindows::SwSidebarWin*, SidebarWinOrder > SidebarWinContainer;
+ typedef ::std::map < SidebarWinKey, VclPtr<sw::sidebarwindows::SwSidebarWin>, SidebarWinOrder > SidebarWinContainer;
struct FrmKey
{
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index c4042d812873..5d2dac64c01f 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -268,7 +268,12 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView )
n->addPropertiesChangeListener(s, listener_.get());
}
- SwSrcEditWindow::~SwSrcEditWindow()
+SwSrcEditWindow::~SwSrcEditWindow()
+{
+ disposeOnce();
+}
+
+void SwSrcEditWindow::dispose()
{
css::uno::Reference< css::beans::XMultiPropertySet > n;
{
@@ -284,13 +289,13 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView )
EndListening( *pTextEngine );
pTextEngine->RemoveView( pTextView );
- delete pHScrollbar;
- delete pVScrollbar;
-
delete pTextView;
delete pTextEngine;
}
- delete pOutWin;
+ pHScrollbar.disposeAndClear();
+ pVScrollbar.disposeAndClear();
+ pOutWin.disposeAndClear();
+ vcl::Window::dispose();
}
void SwSrcEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
@@ -482,18 +487,18 @@ void TextViewOutWin::Paint( const Rectangle& rRect )
void SwSrcEditWindow::CreateTextEngine()
{
const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor();
- pOutWin = new TextViewOutWin(this, 0);
+ pOutWin = VclPtr<TextViewOutWin>::Create(this, 0);
pOutWin->SetBackground(Wallpaper(rCol));
pOutWin->SetPointer(Pointer(POINTER_TEXT));
pOutWin->Show();
// create Scrollbars
- pHScrollbar = new ScrollBar(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG);
+ pHScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG);
pHScrollbar->EnableRTL( false ); // --- RTL --- no mirroring for scrollbars
pHScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl));
pHScrollbar->Show();
- pVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ pVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
pVScrollbar->EnableRTL( false ); // --- RTL --- no mirroring for scrollbars
pVScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl));
pHScrollbar->EnableDrag();
diff --git a/sw/source/uibase/envelp/syncbtn.cxx b/sw/source/uibase/envelp/syncbtn.cxx
index a6b73da14126..e75751de5a31 100644
--- a/sw/source/uibase/envelp/syncbtn.cxx
+++ b/sw/source/uibase/envelp/syncbtn.cxx
@@ -37,7 +37,7 @@ SwSyncChildWin::SwSyncChildWin( vcl::Window* _pParent,
SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId )
{
- pWindow = new SwSyncBtnDlg( pBindings, this, _pParent);
+ pWindow = VclPtr<SwSyncBtnDlg>::Create( pBindings, this, _pParent);
if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
{
@@ -53,7 +53,7 @@ SwSyncChildWin::SwSyncChildWin( vcl::Window* _pParent,
pInfo->aSize = pWindow->GetSizePixel();
}
- static_cast<SwSyncBtnDlg *>(pWindow)->Initialize(pInfo);
+ static_cast<SwSyncBtnDlg *>(pWindow.get())->Initialize(pInfo);
pWindow->Show();
}
@@ -68,6 +68,17 @@ SwSyncBtnDlg::SwSyncBtnDlg( SfxBindings* _pBindings,
Show();
}
+SwSyncBtnDlg::~SwSyncBtnDlg()
+{
+ disposeOnce();
+}
+
+void SwSyncBtnDlg::dispose()
+{
+ m_pSyncBtn.clear();
+ SfxFloatingWindow::dispose();
+}
+
IMPL_LINK_NOARG(SwSyncBtnDlg, BtnHdl)
{
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, SfxCallMode::ASYNCHRON);
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index 89038314a97d..2c5df5343023 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -487,7 +487,13 @@ Size SwColumnOnlyExample::GetOptimalSize() const
SwPageGridExample::~SwPageGridExample()
{
+ disposeOnce();
+}
+
+void SwPageGridExample::dispose()
+{
delete pGridItem;
+ SwPageExample::dispose();
}
void SwPageGridExample::DrawPage( const Point& rOrg,
diff --git a/sw/source/uibase/inc/DropDownFieldDialog.hxx b/sw/source/uibase/inc/DropDownFieldDialog.hxx
index 19c42cf7dbfc..a7ef05f126f1 100644
--- a/sw/source/uibase/inc/DropDownFieldDialog.hxx
+++ b/sw/source/uibase/inc/DropDownFieldDialog.hxx
@@ -33,12 +33,12 @@ namespace sw
{
class DropDownFieldDialog : public SvxStandardDialog
{
- ListBox* m_pListItemsLB;
+ VclPtr<ListBox> m_pListItemsLB;
- OKButton* m_pOKPB;
- PushButton* m_pNextPB;
+ VclPtr<OKButton> m_pOKPB;
+ VclPtr<PushButton> m_pNextPB;
- PushButton* m_pEditPB;
+ VclPtr<PushButton> m_pEditPB;
SwWrtShell &rSh;
SwDropDownField* pDropField;
@@ -48,6 +48,8 @@ class DropDownFieldDialog : public SvxStandardDialog
public:
DropDownFieldDialog( vcl::Window *pParent, SwWrtShell &rSh,
SwField* pField, bool bNextButton = false );
+ virtual ~DropDownFieldDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
} //namespace sw
diff --git a/sw/source/uibase/inc/FrameControl.hxx b/sw/source/uibase/inc/FrameControl.hxx
index 0235084c4160..936be2a1cbc8 100644
--- a/sw/source/uibase/inc/FrameControl.hxx
+++ b/sw/source/uibase/inc/FrameControl.hxx
@@ -17,7 +17,7 @@ class Point;
*/
class SwFrameControl
{
- SwEditWin* m_pEditWin;
+ VclPtr<SwEditWin> m_pEditWin;
const SwFrm* m_pFrm;
public:
diff --git a/sw/source/uibase/inc/FrameControlsManager.hxx b/sw/source/uibase/inc/FrameControlsManager.hxx
index 75585ea8fe0b..e87124b64be5 100644
--- a/sw/source/uibase/inc/FrameControlsManager.hxx
+++ b/sw/source/uibase/inc/FrameControlsManager.hxx
@@ -30,12 +30,13 @@ typedef std::map<const SwFrm*, SwFrameControlPtr> SwFrameControlPtrMap;
class SwFrameControlsManager
{
private:
- SwEditWin* m_pEditWin;
+ VclPtr<SwEditWin> m_pEditWin;
std::map< FrameControlType, SwFrameControlPtrMap > m_aControls;
public:
SwFrameControlsManager( SwEditWin* pEditWin );
- ~SwFrameControlsManager( );
+ ~SwFrameControlsManager();
+ void dispose();
SwFrameControlsManager( const SwFrameControlsManager& rCopy );
const SwFrameControlsManager& operator=( const SwFrameControlsManager& rCopy );
diff --git a/sw/source/uibase/inc/HeaderFooterWin.hxx b/sw/source/uibase/inc/HeaderFooterWin.hxx
index 6f151fd8ec69..32e30f5cc70b 100644
--- a/sw/source/uibase/inc/HeaderFooterWin.hxx
+++ b/sw/source/uibase/inc/HeaderFooterWin.hxx
@@ -20,10 +20,10 @@
*/
class SwHeaderFooterWin : public MenuButton, public SwFrameControl
{
- OUString m_sLabel;
+ OUString m_sLabel;
bool m_bIsHeader;
PopupMenu* m_pPopupMenu;
- vcl::Window* m_pLine;
+ VclPtr<vcl::Window> m_pLine;
bool m_bIsAppearing;
int m_nFadeRate;
Timer m_aFadeTimer;
@@ -31,6 +31,7 @@ class SwHeaderFooterWin : public MenuButton, public SwFrameControl
public:
SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm, bool bHeader );
virtual ~SwHeaderFooterWin( );
+ virtual void dispose() SAL_OVERRIDE;
void SetOffset( Point aOffset, long nXLineStart, long nXLineEnd );
diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx
index ff28df16ca3f..d1b048fbc1a3 100644
--- a/sw/source/uibase/inc/PageBreakWin.hxx
+++ b/sw/source/uibase/inc/PageBreakWin.hxx
@@ -23,7 +23,7 @@ class SwPageFrm;
class SwPageBreakWin : public MenuButton, public SwFrameControl
{
PopupMenu* m_pPopupMenu;
- vcl::Window* m_pLine;
+ VclPtr<vcl::Window> m_pLine;
bool m_bIsAppearing;
int m_nFadeRate;
int m_nDelayAppearing; ///< Before we show the control, let it transparent for a few timer ticks to avoid appearing with every mouse over.
@@ -35,6 +35,7 @@ class SwPageBreakWin : public MenuButton, public SwFrameControl
public:
SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm );
virtual ~SwPageBreakWin( );
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Select( ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/abstract.hxx b/sw/source/uibase/inc/abstract.hxx
index 92443efa9d9d..0c12d35e1812 100644
--- a/sw/source/uibase/inc/abstract.hxx
+++ b/sw/source/uibase/inc/abstract.hxx
@@ -25,13 +25,13 @@
class SwInsertAbstractDlg : public SfxModalDialog
{
- NumericField* m_pLevelNF;
- NumericField* m_pParaNF;
-
-protected:
+ VclPtr<NumericField> m_pLevelNF;
+ VclPtr<NumericField> m_pParaNF;
public:
SwInsertAbstractDlg( vcl::Window* pParent );
+ virtual ~SwInsertAbstractDlg();
+ virtual void dispose() SAL_OVERRIDE;
sal_uInt8 GetLevel() const;
sal_uInt8 GetPara() const;
diff --git a/sw/source/uibase/inc/ascfldlg.hxx b/sw/source/uibase/inc/ascfldlg.hxx
index 827d5032bcbc..b7e693814c3c 100644
--- a/sw/source/uibase/inc/ascfldlg.hxx
+++ b/sw/source/uibase/inc/ascfldlg.hxx
@@ -32,14 +32,14 @@ class SwDocShell;
class SwAsciiFilterDlg : public SfxModalDialog
{
- SvxTextEncodingBox* m_pCharSetLB;
- FixedText* m_pFontFT;
- ListBox* m_pFontLB;
- FixedText* m_pLanguageFT;
- SvxLanguageBox* m_pLanguageLB;
- RadioButton* m_pCRLF_RB;
- RadioButton* m_pCR_RB;
- RadioButton* m_pLF_RB;
+ VclPtr<SvxTextEncodingBox> m_pCharSetLB;
+ VclPtr<FixedText> m_pFontFT;
+ VclPtr<ListBox> m_pFontLB;
+ VclPtr<FixedText> m_pLanguageFT;
+ VclPtr<SvxLanguageBox> m_pLanguageLB;
+ VclPtr<RadioButton> m_pCRLF_RB;
+ VclPtr<RadioButton> m_pCR_RB;
+ VclPtr<RadioButton> m_pLF_RB;
bool m_bSaveLineStatus;
DECL_LINK( CharSetSelHdl, SvxTextEncodingBox* );
@@ -53,6 +53,7 @@ public:
SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh,
SvStream* pStream );
virtual ~SwAsciiFilterDlg();
+ virtual void dispose() SAL_OVERRIDE;
void FillOptions( SwAsciiOptions& rOptions );
};
diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx
index d64a08e69a8f..1185317191d6 100644
--- a/sw/source/uibase/inc/bookmark.hxx
+++ b/sw/source/uibase/inc/bookmark.hxx
@@ -47,9 +47,9 @@ public:
class SwInsertBookmarkDlg: public SvxStandardDialog
{
- BookmarkCombo* m_pBookmarkBox;
- OKButton* m_pOkBtn;
- PushButton* m_pDeleteBtn;
+ VclPtr<BookmarkCombo> m_pBookmarkBox;
+ VclPtr<OKButton> m_pOkBtn;
+ VclPtr<PushButton> m_pDeleteBtn;
OUString sRemoveWarning;
SwWrtShell &rSh;
@@ -63,6 +63,7 @@ class SwInsertBookmarkDlg: public SvxStandardDialog
public:
SwInsertBookmarkDlg(vcl::Window *pParent, SwWrtShell &rSh, SfxRequest& rReq);
virtual ~SwInsertBookmarkDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/break.hxx b/sw/source/uibase/inc/break.hxx
index 55610b7dbe8c..85ce67b0ce26 100644
--- a/sw/source/uibase/inc/break.hxx
+++ b/sw/source/uibase/inc/break.hxx
@@ -37,13 +37,13 @@ class SwWrtShell;
class SwBreakDlg: public SvxStandardDialog
{
SwWrtShell &rSh;
- RadioButton* m_pLineBtn;
- RadioButton* m_pColumnBtn;
- RadioButton* m_pPageBtn;
- FixedText* m_pPageCollText;
- ListBox* m_pPageCollBox;
- CheckBox* m_pPageNumBox;
- NumericField* m_pPageNumEdit;
+ VclPtr<RadioButton> m_pLineBtn;
+ VclPtr<RadioButton> m_pColumnBtn;
+ VclPtr<RadioButton> m_pPageBtn;
+ VclPtr<FixedText> m_pPageCollText;
+ VclPtr<ListBox> m_pPageCollBox;
+ VclPtr<CheckBox> m_pPageNumBox;
+ VclPtr<NumericField> m_pPageNumEdit;
OUString aTemplate;
sal_uInt16 nKind;
@@ -64,6 +64,7 @@ protected:
public:
SwBreakDlg( vcl::Window *pParent, SwWrtShell &rSh );
virtual ~SwBreakDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetTemplateName() { return aTemplate; }
sal_uInt16 GetKind() { return nKind; }
diff --git a/sw/source/uibase/inc/changedb.hxx b/sw/source/uibase/inc/changedb.hxx
index 128d7aa8338d..c10948bab9c2 100644
--- a/sw/source/uibase/inc/changedb.hxx
+++ b/sw/source/uibase/inc/changedb.hxx
@@ -35,11 +35,11 @@ struct SwDBData;
// exchange database at fields
class SwChangeDBDlg: public SvxStandardDialog
{
- SvTreeListBox* m_pUsedDBTLB;
- SwDBTreeList* m_pAvailDBTLB;
- PushButton* m_pAddDBPB;
- FixedText* m_pDocDBNameFT;
- PushButton* m_pDefineBT;
+ VclPtr<SvTreeListBox> m_pUsedDBTLB;
+ VclPtr<SwDBTreeList> m_pAvailDBTLB;
+ VclPtr<PushButton> m_pAddDBPB;
+ VclPtr<FixedText> m_pDocDBNameFT;
+ VclPtr<PushButton> m_pDefineBT;
ImageList aImageList;
@@ -59,6 +59,7 @@ class SwChangeDBDlg: public SvxStandardDialog
public:
SwChangeDBDlg(SwView& rVw);
virtual ~SwChangeDBDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/chrdlg.hxx b/sw/source/uibase/inc/chrdlg.hxx
index 7c0520ade242..ff6f91b3a516 100644
--- a/sw/source/uibase/inc/chrdlg.hxx
+++ b/sw/source/uibase/inc/chrdlg.hxx
@@ -59,17 +59,17 @@ public:
class SwCharURLPage : public SfxTabPage
{
- Edit* m_pURLED;
- FixedText* m_pTextFT;
- Edit* m_pTextED;
- Edit* m_pNameED;
- ComboBox* m_pTargetFrmLB;
- PushButton* m_pURLPB;
- PushButton* m_pEventPB;
- ListBox* m_pVisitedLB;
- ListBox* m_pNotVisitedLB;
-
- VclContainer* m_pCharStyleContainer;
+ VclPtr<Edit> m_pURLED;
+ VclPtr<FixedText> m_pTextFT;
+ VclPtr<Edit> m_pTextED;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<ComboBox> m_pTargetFrmLB;
+ VclPtr<PushButton> m_pURLPB;
+ VclPtr<PushButton> m_pEventPB;
+ VclPtr<ListBox> m_pVisitedLB;
+ VclPtr<ListBox> m_pNotVisitedLB;
+
+ VclPtr<VclContainer> m_pCharStyleContainer;
SvxMacroItem* pINetItem;
bool bModified;
@@ -82,8 +82,9 @@ public:
const SfxItemSet& rSet );
virtual ~SwCharURLPage();
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet);
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx
index ce03ddce93b2..638b3c78ab2a 100644
--- a/sw/source/uibase/inc/colex.hxx
+++ b/sw/source/uibase/inc/colex.hxx
@@ -57,6 +57,7 @@ public:
m_bVertical(false){}
virtual ~SwPageGridExample();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateExample( const SfxItemSet& rSet );
};
diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx
index d5efa31c7e59..fda9458182d6 100644
--- a/sw/source/uibase/inc/column.hxx
+++ b/sw/source/uibase/inc/column.hxx
@@ -42,10 +42,10 @@ class SwColumnPage;
class SwColumnDlg : public SfxModalDialog
{
- ListBox* m_pApplyToLB;
+ VclPtr<ListBox> m_pApplyToLB;
SwWrtShell& rWrtShell;
- SwColumnPage* pTabPage;
+ VclPtr<SwColumnPage> pTabPage;
SfxItemSet* pPageSet;
SfxItemSet* pSectionSet;
SfxItemSet* pSelectionSet;
@@ -66,6 +66,7 @@ class SwColumnDlg : public SfxModalDialog
public:
SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh);
virtual ~SwColumnDlg();
+ virtual void dispose() SAL_OVERRIDE;
SwWrtShell& GetWrtShell() { return rWrtShell; }
};
@@ -88,39 +89,39 @@ public:
// column dialog now as TabPage
class SwColumnPage : public SfxTabPage
{
- NumericField* m_pCLNrEdt;
- ColumnValueSet* m_pDefaultVS;
- CheckBox* m_pBalanceColsCB;
+ VclPtr<NumericField> m_pCLNrEdt;
+ VclPtr<ColumnValueSet> m_pDefaultVS;
+ VclPtr<CheckBox> m_pBalanceColsCB;
- PushButton* m_pBtnBack;
- FixedText* m_pLbl1;
+ VclPtr<PushButton> m_pBtnBack;
+ VclPtr<FixedText> m_pLbl1;
PercentField aEd1;
- FixedText* m_pLbl2;
+ VclPtr<FixedText> m_pLbl2;
PercentField aEd2;
- FixedText* m_pLbl3;
+ VclPtr<FixedText> m_pLbl3;
PercentField aEd3;
- PushButton* m_pBtnNext;
+ VclPtr<PushButton> m_pBtnNext;
PercentField aDistEd1;
PercentField aDistEd2;
- CheckBox* m_pAutoWidthBox;
-
- FixedText* m_pLineTypeLbl;
- LineListBox* m_pLineTypeDLB;
- FixedText* m_pLineWidthLbl;
- MetricField* m_pLineWidthEdit;
- FixedText* m_pLineColorLbl;
- ColorListBox* m_pLineColorDLB;
- FixedText* m_pLineHeightLbl;
- MetricField* m_pLineHeightEdit;
- FixedText* m_pLinePosLbl;
- ListBox* m_pLinePosDLB;
-
- FixedText* m_pTextDirectionFT;
- ListBox* m_pTextDirectionLB;
+ VclPtr<CheckBox> m_pAutoWidthBox;
+
+ VclPtr<FixedText> m_pLineTypeLbl;
+ VclPtr<LineListBox> m_pLineTypeDLB;
+ VclPtr<FixedText> m_pLineWidthLbl;
+ VclPtr<MetricField> m_pLineWidthEdit;
+ VclPtr<FixedText> m_pLineColorLbl;
+ VclPtr<ColorListBox> m_pLineColorDLB;
+ VclPtr<FixedText> m_pLineHeightLbl;
+ VclPtr<MetricField> m_pLineHeightEdit;
+ VclPtr<FixedText> m_pLinePosLbl;
+ VclPtr<ListBox> m_pLinePosDLB;
+
+ VclPtr<FixedText> m_pTextDirectionFT;
+ VclPtr<ListBox> m_pTextDirectionLB;
// Example
- SwColExample* m_pPgeExampleWN;
- SwColumnOnlyExample* m_pFrmExampleWN;
+ VclPtr<SwColExample> m_pPgeExampleWN;
+ VclPtr<SwColumnOnlyExample> m_pFrmExampleWN;
SwColMgr* pColMgr;
@@ -131,7 +132,7 @@ class SwColumnPage : public SfxTabPage
sal_uInt16 nMinWidth;
PercentField* pModifiedField;
- std::map<MetricField*, PercentField*> m_aPercentFieldsMap;
+ std::map<VclPtr<MetricField>, PercentField*> m_aPercentFieldsMap;
bool bFormat;
bool bFrm;
@@ -163,8 +164,6 @@ class SwColumnPage : public SfxTabPage
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE;
- SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet);
-
void connectPercentField(PercentField &rWrap, const OString &rName);
bool isLineNotNone() const;
@@ -172,9 +171,11 @@ class SwColumnPage : public SfxTabPage
static const sal_uInt16 aPageRg[];
public:
+ SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet);
virtual ~SwColumnPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
static const sal_uInt16* GetRanges() { return aPageRg; }
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index 080572081d5a..ee23a095d861 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -144,6 +144,7 @@ protected:
public:
SwContentTree(vcl::Window* pParent, const ResId& rResId);
virtual ~SwContentTree();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetEntryAltText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
SdrObject* GetDrawingObjectsByContent(const SwContent *pCnt);
@@ -232,11 +233,11 @@ private:
ImageList aEntryImages;
SwWrtShell* pActiveShell;
- SvTreeListEntry* pEmphasisEntry; // Drag'n Drop emphasis
- SvTreeListEntry* pDDSource; // source for Drag'n Drop
+ SvTreeListEntry* pEmphasisEntry; // Drag'n Drop emphasis
+ SvTreeListEntry* pDDSource; // source for Drag'n Drop
SwGlblDocContents* pSwGlblDocContents; // array with sorted content
- vcl::Window* pDefParentWin;
+ VclPtr<vcl::Window> pDefParentWin;
SwGlblDocContent* pDocContent;
sfx2::DocumentInserter* pDocInserter;
@@ -313,6 +314,7 @@ protected:
public:
SwGlobalTree(vcl::Window* pParent, const ResId& rResId);
virtual ~SwGlobalTree();
+ virtual void dispose() SAL_OVERRIDE;
void TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox);
void InsertRegion( const SwGlblDocContent* pCont,
diff --git a/sw/source/uibase/inc/convert.hxx b/sw/source/uibase/inc/convert.hxx
index 8b803bfee2db..1a52d8ba2c99 100644
--- a/sw/source/uibase/inc/convert.hxx
+++ b/sw/source/uibase/inc/convert.hxx
@@ -32,24 +32,24 @@ struct SwInsertTableOptions;
class SwConvertTableDlg: public SfxModalDialog
{
- RadioButton* mpTabBtn;
- RadioButton* mpSemiBtn;
- RadioButton* mpParaBtn;
- RadioButton* mpOtherBtn;
- Edit* mpOtherEd;
- CheckBox* mpKeepColumn;
+ VclPtr<RadioButton> mpTabBtn;
+ VclPtr<RadioButton> mpSemiBtn;
+ VclPtr<RadioButton> mpParaBtn;
+ VclPtr<RadioButton> mpOtherBtn;
+ VclPtr<Edit> mpOtherEd;
+ VclPtr<CheckBox> mpKeepColumn;
- VclContainer* mpOptions;
+ VclPtr<VclContainer> mpOptions;
- CheckBox* mpHeaderCB;
- CheckBox* mpRepeatHeaderCB;
+ VclPtr<CheckBox> mpHeaderCB;
+ VclPtr<CheckBox> mpRepeatHeaderCB;
- VclContainer* mpRepeatRows;
- NumericField* mpRepeatHeaderNF;
+ VclPtr<VclContainer> mpRepeatRows;
+ VclPtr<NumericField> mpRepeatHeaderNF;
- CheckBox* mpDontSplitCB;
- CheckBox* mpBorderCB;
- PushButton* mpAutoFmtBtn;
+ VclPtr<CheckBox> mpDontSplitCB;
+ VclPtr<CheckBox> mpBorderCB;
+ VclPtr<PushButton> mpAutoFmtBtn;
OUString sConvertTextTable;
SwTableAutoFmt* pTAutoFmt;
@@ -63,6 +63,7 @@ class SwConvertTableDlg: public SfxModalDialog
public:
SwConvertTableDlg( SwView& rView, bool bToTable );
virtual ~SwConvertTableDlg();
+ virtual void dispose() SAL_OVERRIDE;
void GetValues( sal_Unicode& rDelim,
SwInsertTableOptions& rInsTblOpts,
diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx
index 98ed59d65c0d..5f99c2025360 100644
--- a/sw/source/uibase/inc/cption.hxx
+++ b/sw/source/uibase/inc/cption.hxx
@@ -63,24 +63,24 @@ public:
class SwCaptionDialog : public SvxStandardDialog
{
- Edit* m_pTextEdit;
- ComboBox* m_pCategoryBox;
+ VclPtr<Edit> m_pTextEdit;
+ VclPtr<ComboBox> m_pCategoryBox;
OUString m_sNone;
TextFilterAutoConvert m_aTextFilter;
- FixedText* m_pFormatText;
- ListBox* m_pFormatBox;
+ VclPtr<FixedText> m_pFormatText;
+ VclPtr<ListBox> m_pFormatBox;
//#i61007# order of captions
- FixedText* m_pNumberingSeparatorFT;
- Edit* m_pNumberingSeparatorED;
- FixedText* m_pSepText;
- Edit* m_pSepEdit;
- FixedText* m_pPosText;
- ListBox* m_pPosBox;
- OKButton* m_pOKButton;
- PushButton* m_pAutoCaptionButton;
- PushButton* m_pOptionButton;
-
- SwCaptionPreview* m_pPreview;
+ VclPtr<FixedText> m_pNumberingSeparatorFT;
+ VclPtr<Edit> m_pNumberingSeparatorED;
+ VclPtr<FixedText> m_pSepText;
+ VclPtr<Edit> m_pSepEdit;
+ VclPtr<FixedText> m_pPosText;
+ VclPtr<ListBox> m_pPosBox;
+ VclPtr<OKButton> m_pOKButton;
+ VclPtr<PushButton> m_pAutoCaptionButton;
+ VclPtr<PushButton> m_pOptionButton;
+
+ VclPtr<SwCaptionPreview> m_pPreview;
SwView &rView; // search per active, avoid View
SwFldMgr *pMgr; // pointer to save the include
@@ -109,6 +109,7 @@ class SwCaptionDialog : public SvxStandardDialog
public:
SwCaptionDialog( vcl::Window *pParent, SwView &rV );
virtual ~SwCaptionDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx
index e48f422fed9a..260a7fcc96e1 100644
--- a/sw/source/uibase/inc/dbinsdlg.hxx
+++ b/sw/source/uibase/inc/dbinsdlg.hxx
@@ -87,38 +87,38 @@ public:
class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
{
- RadioButton* m_pRbAsTable;
- RadioButton* m_pRbAsField;
- RadioButton* m_pRbAsText;
+ VclPtr<RadioButton> m_pRbAsTable;
+ VclPtr<RadioButton> m_pRbAsField;
+ VclPtr<RadioButton> m_pRbAsText;
- VclFrame* m_pHeadFrame;
+ VclPtr<VclFrame> m_pHeadFrame;
- ListBox* m_pLbTblDbColumn;
- ListBox* m_pLbTxtDbColumn;
+ VclPtr<ListBox> m_pLbTblDbColumn;
+ VclPtr<ListBox> m_pLbTxtDbColumn;
- VclFrame* m_pFormatFrame;
- RadioButton* m_pRbDbFmtFromDb;
- RadioButton* m_pRbDbFmtFromUsr;
- NumFormatListBox* m_pLbDbFmtFromUsr;
+ VclPtr<VclFrame> m_pFormatFrame;
+ VclPtr<RadioButton> m_pRbDbFmtFromDb;
+ VclPtr<RadioButton> m_pRbDbFmtFromUsr;
+ VclPtr<NumFormatListBox> m_pLbDbFmtFromUsr;
// Page Text/Field
- PushButton* m_pIbDbcolToEdit;
- VclMultiLineEdit* m_pEdDbText;
- FixedText* m_pFtDbParaColl;
- ListBox* m_pLbDbParaColl;
+ VclPtr<PushButton> m_pIbDbcolToEdit;
+ VclPtr<VclMultiLineEdit> m_pEdDbText;
+ VclPtr<FixedText> m_pFtDbParaColl;
+ VclPtr<ListBox> m_pLbDbParaColl;
// Page Table
- PushButton* m_pIbDbcolAllTo;
- PushButton* m_pIbDbcolOneTo;
- PushButton* m_pIbDbcolOneFrom;
- PushButton* m_pIbDbcolAllFrom;
- FixedText* m_pFtTableCol;
- ListBox* m_pLbTableCol;
- CheckBox* m_pCbTableHeadon;
- RadioButton* m_pRbHeadlColnms;
- RadioButton* m_pRbHeadlEmpty;
- PushButton* m_pPbTblFormat;
- PushButton* m_pPbTblAutofmt;
+ VclPtr<PushButton> m_pIbDbcolAllTo;
+ VclPtr<PushButton> m_pIbDbcolOneTo;
+ VclPtr<PushButton> m_pIbDbcolOneFrom;
+ VclPtr<PushButton> m_pIbDbcolAllFrom;
+ VclPtr<FixedText> m_pFtTableCol;
+ VclPtr<ListBox> m_pLbTableCol;
+ VclPtr<CheckBox> m_pCbTableHeadon;
+ VclPtr<RadioButton> m_pRbHeadlColnms;
+ VclPtr<RadioButton> m_pRbHeadlEmpty;
+ VclPtr<PushButton> m_pPbTblFormat;
+ VclPtr<PushButton> m_pPbTblAutofmt;
SwInsDBColumns aDBColumns;
const SwDBData aDBData;
@@ -158,6 +158,7 @@ public:
const SwDBData& rData );
virtual ~SwInsertDBColAutoPilot();
+ virtual void dispose() SAL_OVERRIDE;
void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
diff --git a/sw/source/uibase/inc/dbtree.hxx b/sw/source/uibase/inc/dbtree.hxx
index e41d911bf141..94179d40e062 100644
--- a/sw/source/uibase/inc/dbtree.hxx
+++ b/sw/source/uibase/inc/dbtree.hxx
@@ -54,6 +54,7 @@ class SW_DLLPUBLIC SwDBTreeList : public SvTreeListBox
public:
SwDBTreeList(vcl::Window* pParent, WinBits nStyle);
virtual ~SwDBTreeList();
+ virtual void dispose() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
OUString GetDBName( OUString& rTableName, OUString& rColumnName, sal_Bool* pbIsTable = 0);
diff --git a/sw/source/uibase/inc/dbui.hxx b/sw/source/uibase/inc/dbui.hxx
index 0649bcb9ca6e..879da6302939 100644
--- a/sw/source/uibase/inc/dbui.hxx
+++ b/sw/source/uibase/inc/dbui.hxx
@@ -29,7 +29,7 @@ class SW_DLLPUBLIC CancelableDialog : public Dialog
bool mbModal;
protected:
- CancelButton* m_pCancelButton;
+ VclPtr<CancelButton> m_pCancelButton;
CancelableDialog( vcl::Window *pParent, bool modal, const OUString& rID,
const OUString& rUIXMLDescription );
@@ -40,6 +40,8 @@ protected:
public:
virtual ~CancelableDialog();
+ virtual void dispose() SAL_OVERRIDE;
+
void SetCancelHdl( const Link& rLink );
void Show();
};
@@ -53,18 +55,22 @@ public:
MONITOR_TYPE_SAVE
};
- FixedText* m_pDocName;
- FixedText* m_pPrinting;
- FixedText* m_pPrinter;
- FixedText* m_pPrintInfo;
+ VclPtr<FixedText> m_pDocName;
+ VclPtr<FixedText> m_pPrinting;
+ VclPtr<FixedText> m_pPrinter;
+ VclPtr<FixedText> m_pPrintInfo;
PrintMonitor( vcl::Window *pParent, bool modal, PrintMonitorType eType );
+ virtual ~PrintMonitor();
+ virtual void dispose() SAL_OVERRIDE;
};
class CreateMonitor : public CancelableDialog
{
public:
CreateMonitor( vcl::Window *pParent, bool modal );
+ virtual ~CreateMonitor();
+ virtual void dispose() SAL_OVERRIDE;
void SetTotalCount( sal_Int32 nTotal );
void SetCurrentPosition( sal_Int32 nCurrent );
@@ -73,7 +79,7 @@ private:
void UpdateCountingText();
private:
- FixedText* m_pCounting;
+ VclPtr<FixedText> m_pCounting;
OUString m_sCountingPattern;
OUString m_sVariable_Total;
diff --git a/sw/source/uibase/inc/docstdlg.hxx b/sw/source/uibase/inc/docstdlg.hxx
index e02a80ea0369..ce769478e3b2 100644
--- a/sw/source/uibase/inc/docstdlg.hxx
+++ b/sw/source/uibase/inc/docstdlg.hxx
@@ -32,8 +32,9 @@ class SwDocStatPage: public SfxTabPage
public:
SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet);
virtual ~SwDocStatPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
protected:
virtual bool FillItemSet( SfxItemSet *rSet) SAL_OVERRIDE;
@@ -42,18 +43,18 @@ protected:
DECL_LINK(UpdateHdl, void *);
private:
- FixedText* m_pPageNo;
- FixedText* m_pTableNo;
- FixedText* m_pGrfNo;
- FixedText* m_pOLENo;
- FixedText* m_pParaNo;
- FixedText* m_pWordNo;
- FixedText* m_pCharNo;
- FixedText* m_pCharExclSpacesNo;
+ VclPtr<FixedText> m_pPageNo;
+ VclPtr<FixedText> m_pTableNo;
+ VclPtr<FixedText> m_pGrfNo;
+ VclPtr<FixedText> m_pOLENo;
+ VclPtr<FixedText> m_pParaNo;
+ VclPtr<FixedText> m_pWordNo;
+ VclPtr<FixedText> m_pCharNo;
+ VclPtr<FixedText> m_pCharExclSpacesNo;
- FixedText* m_pLineLbl;
- FixedText* m_pLineNo;
- PushButton* m_pUpdatePB;
+ VclPtr<FixedText> m_pLineLbl;
+ VclPtr<FixedText> m_pLineNo;
+ VclPtr<PushButton> m_pUpdatePB;
SwDocStat aDocStat;
diff --git a/sw/source/uibase/inc/drawbase.hxx b/sw/source/uibase/inc/drawbase.hxx
index b6aa7ea849ce..42c3adada3d1 100644
--- a/sw/source/uibase/inc/drawbase.hxx
+++ b/sw/source/uibase/inc/drawbase.hxx
@@ -33,7 +33,7 @@ class SwDrawBase
protected:
SwView* m_pView;
SwWrtShell* m_pSh;
- SwEditWin* m_pWin;
+ VclPtr<SwEditWin> m_pWin;
Point m_aStartPos; // position of BeginCreate
Point m_aMDPos; // position of MouseButtonDown
sal_uInt16 m_nSlotId;
diff --git a/sw/source/uibase/inc/drpcps.hxx b/sw/source/uibase/inc/drpcps.hxx
index f24a6051f4b3..c54fdf8c48a7 100644
--- a/sw/source/uibase/inc/drpcps.hxx
+++ b/sw/source/uibase/inc/drpcps.hxx
@@ -45,20 +45,20 @@ class SwDropCapsPict;
class SwDropCapsPage : public SfxTabPage
{
friend class SwDropCapsPict;
- CheckBox* m_pDropCapsBox;
- CheckBox* m_pWholeWordCB;
- FixedText* m_pSwitchText;
- NumericField* m_pDropCapsField;
- FixedText* m_pLinesText;
- NumericField* m_pLinesField;
- FixedText* m_pDistanceText;
- MetricField* m_pDistanceField;
- FixedText* m_pTextText;
- Edit* m_pTextEdit;
- FixedText* m_pTemplateText;
- ListBox* m_pTemplateBox;
-
- SwDropCapsPict* m_pPict;
+ VclPtr<CheckBox> m_pDropCapsBox;
+ VclPtr<CheckBox> m_pWholeWordCB;
+ VclPtr<FixedText> m_pSwitchText;
+ VclPtr<NumericField> m_pDropCapsField;
+ VclPtr<FixedText> m_pLinesText;
+ VclPtr<NumericField> m_pLinesField;
+ VclPtr<FixedText> m_pDistanceText;
+ VclPtr<MetricField> m_pDistanceField;
+ VclPtr<FixedText> m_pTextText;
+ VclPtr<Edit> m_pTextEdit;
+ VclPtr<FixedText> m_pTemplateText;
+ VclPtr<ListBox> m_pTemplateBox;
+
+ VclPtr<SwDropCapsPict> m_pPict;
bool bModified;
bool bFormat;
@@ -66,9 +66,6 @@ friend class SwDropCapsPict;
SwWrtShell &rSh;
- SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet);
- virtual ~SwDropCapsPage();
-
virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE;
void FillSet( SfxItemSet &rSet );
@@ -83,8 +80,11 @@ friend class SwDropCapsPict;
static const sal_uInt16 aPageRg[];
public:
+ SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet);
+ virtual ~SwDropCapsPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
static const sal_uInt16* GetRanges() { return aPageRg; }
diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx
index ae961362af52..aaf06adaa854 100644
--- a/sw/source/uibase/inc/edtwin.hxx
+++ b/sw/source/uibase/inc/edtwin.hxx
@@ -296,6 +296,8 @@ public:
SwEditWin(vcl::Window *pParent, SwView &);
virtual ~SwEditWin();
+ virtual void dispose() SAL_OVERRIDE;
+
/// @see OutputDevice::LogicInvalidate().
void LogicInvalidate(const Rectangle* pRectangle) SAL_OVERRIDE;
/// Same as MouseButtonDown(), but coordinates are in logic unit.
diff --git a/sw/source/uibase/inc/envlop.hxx b/sw/source/uibase/inc/envlop.hxx
index 1cbd63545850..962dd8ca8dd1 100644
--- a/sw/source/uibase/inc/envlop.hxx
+++ b/sw/source/uibase/inc/envlop.hxx
@@ -62,7 +62,7 @@ friend class SwEnvPreview;
SwEnvItem aEnvItem;
SwWrtShell *pSh;
- Printer *pPrinter;
+ VclPtr<Printer> pPrinter;
SfxItemSet *pAddresseeSet;
SfxItemSet *pSenderSet;
sal_uInt16 m_nEnvPrintId;
@@ -73,25 +73,23 @@ friend class SwEnvPreview;
public:
SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert);
virtual ~SwEnvDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
class SwEnvPage : public SfxTabPage
{
- VclMultiLineEdit* m_pAddrEdit;
- ListBox* m_pDatabaseLB;
- ListBox* m_pTableLB;
- ListBox* m_pDBFieldLB;
- PushButton* m_pInsertBT;
- CheckBox* m_pSenderBox;
- VclMultiLineEdit* m_pSenderEdit;
- SwEnvPreview* m_pPreview;
+ VclPtr<VclMultiLineEdit> m_pAddrEdit;
+ VclPtr<ListBox> m_pDatabaseLB;
+ VclPtr<ListBox> m_pTableLB;
+ VclPtr<ListBox> m_pDBFieldLB;
+ VclPtr<PushButton> m_pInsertBT;
+ VclPtr<CheckBox> m_pSenderBox;
+ VclPtr<VclMultiLineEdit> m_pSenderEdit;
+ VclPtr<SwEnvPreview> m_pPreview;
SwWrtShell* pSh;
OUString sActDBName;
- SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet);
- virtual ~SwEnvPage();
-
DECL_LINK( DatabaseHdl, ListBox * );
DECL_LINK(FieldHdl, void *);
DECL_LINK(SenderHdl, void *);
@@ -104,8 +102,11 @@ class SwEnvPage : public SfxTabPage
using SfxTabPage::DeactivatePage;
public:
+ SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~SwEnvPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/fldedt.hxx b/sw/source/uibase/inc/fldedt.hxx
index 26dc320e0a04..626dc917c8fa 100644
--- a/sw/source/uibase/inc/fldedt.hxx
+++ b/sw/source/uibase/inc/fldedt.hxx
@@ -28,21 +28,22 @@ class SwFldMgr;
class SwFldEditDlg : public SfxSingleTabDialog
{
SwWrtShell* pSh;
- PushButton* m_pPrevBT;
- PushButton* m_pNextBT;
- PushButton* m_pAddressBT;
+ VclPtr<PushButton> m_pPrevBT;
+ VclPtr<PushButton> m_pNextBT;
+ VclPtr<PushButton> m_pAddressBT;
DECL_LINK(AddressHdl, void *);
DECL_LINK(NextPrevHdl, Button *pBt = 0);
void Init();
- SfxTabPage* CreatePage(sal_uInt16 nGroup);
+ VclPtr<SfxTabPage> CreatePage(sal_uInt16 nGroup);
void EnsureSelection(SwField *pCurFld, SwFldMgr &rMgr);
public:
SwFldEditDlg(SwView& rVw);
virtual ~SwFldEditDlg();
+ virtual void dispose() SAL_OVERRIDE;
DECL_LINK(OKHdl, void *);
diff --git a/sw/source/uibase/inc/fldmgr.hxx b/sw/source/uibase/inc/fldmgr.hxx
index e24f19d89303..57cfeda448c8 100644
--- a/sw/source/uibase/inc/fldmgr.hxx
+++ b/sw/source/uibase/inc/fldmgr.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Any.h>
#include <vector>
+#include <vcl/vclptr.hxx>
namespace com{namespace sun{namespace star{
namespace container{
@@ -75,7 +76,7 @@ struct SwInsertFld_Data
::com::sun::star::uno::Any aDBDataSource;
::com::sun::star::uno::Any aDBConnection;
::com::sun::star::uno::Any aDBColumn;
- vcl::Window* pParent; // parent dialog used for SwWrtShell::StartInputFldDlg()
+ VclPtr<vcl::Window> pParent; // parent dialog used for SwWrtShell::StartInputFldDlg()
SwInsertFld_Data(sal_uInt16 nType, sal_uInt16 nSub, const OUString& rPar1, const OUString& rPar2,
sal_uLong nFmtId, SwWrtShell* pShell = NULL, sal_Unicode cSep = ' ', bool bIsAutoLanguage = true) :
diff --git a/sw/source/uibase/inc/formedt.hxx b/sw/source/uibase/inc/formedt.hxx
index 118869e93e74..32f6d8e7de8d 100644
--- a/sw/source/uibase/inc/formedt.hxx
+++ b/sw/source/uibase/inc/formedt.hxx
@@ -50,23 +50,23 @@ class SwIdxFormDlg : public SvxStandardDialog
void UpdatePattern();
void Apply() SAL_OVERRIDE;
- ListBox aEntryLB;
- OKButton aOKBtn;
- CancelButton aCancelBT;
- FixedText aLevelFT;
- Edit aEntryED;
- PushButton aEntryBT;
- PushButton aTabBT;
- PushButton aPageBT;
- PushButton aJumpBT;
- FixedLine aEntryFL;
- FixedText aLevelFT2;
- ListBox aLevelLB;
- FixedText aTemplateFT;
- ListBox aParaLayLB;
- PushButton aStdBT;
- PushButton aAssignBT;
- FixedLine aFormatFL;
+ VclPtr<ListBox> aEntryLB;
+ VclPtr<OKButton> aOKBtn;
+ VclPtr<CancelButton> aCancelBT;
+ VclPtr<FixedText> aLevelFT;
+ VclPtr<Edit> aEntryED;
+ VclPtr<PushButton> aEntryBT;
+ VclPtr<PushButton> aTabBT;
+ VclPtr<PushButton> aPageBT;
+ VclPtr<PushButton> aJumpBT;
+ VclPtr<FixedLine> aEntryFL;
+ VclPtr<FixedText> aLevelFT2;
+ VclPtr<ListBox> aLevelLB;
+ VclPtr<FixedText> aTemplateFT;
+ VclPtr<ListBox> aParaLayLB;
+ VclPtr<PushButton> aStdBT;
+ VclPtr<PushButton> aAssignBT;
+ VclPtr<FixedLine> aFormatFL;
SwWrtShell &rSh;
SwForm *pForm;
@@ -76,6 +76,7 @@ class SwIdxFormDlg : public SvxStandardDialog
public:
SwIdxFormDlg( vcl::Window* pParent, SwWrtShell &rShell, const SwForm& rForm );
virtual ~SwIdxFormDlg();
+ virtual void dispose() SAL_OVERRIDE;
const SwForm& GetTOXForm();
};
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index 6d5ab8e198ee..88498685c99e 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -42,52 +42,52 @@ struct SwPosition;
class SwFrmPage: public SfxTabPage
{
// size
- FixedText* m_pWidthFT;
- FixedText* m_pWidthAutoFT;
- PercentField m_aWidthED;
- CheckBox* m_pRelWidthCB;
- ListBox* m_pRelWidthRelationLB;
- CheckBox* m_pAutoWidthCB;
-
- FixedText* m_pHeightFT;
- FixedText* m_pHeightAutoFT;
- PercentField m_aHeightED;
- CheckBox* m_pRelHeightCB;
- ListBox* m_pRelHeightRelationLB;
- CheckBox* m_pAutoHeightCB;
-
- CheckBox* m_pFixedRatioCB;
- PushButton* m_pRealSizeBT;
+ VclPtr<FixedText> m_pWidthFT;
+ VclPtr<FixedText> m_pWidthAutoFT;
+ PercentField m_aWidthED;
+ VclPtr<CheckBox> m_pRelWidthCB;
+ VclPtr<ListBox> m_pRelWidthRelationLB;
+ VclPtr<CheckBox> m_pAutoWidthCB;
+
+ VclPtr<FixedText> m_pHeightFT;
+ VclPtr<FixedText> m_pHeightAutoFT;
+ PercentField m_aHeightED;
+ VclPtr<CheckBox> m_pRelHeightCB;
+ VclPtr<ListBox> m_pRelHeightRelationLB;
+ VclPtr<CheckBox> m_pAutoHeightCB;
+
+ VclPtr<CheckBox> m_pFixedRatioCB;
+ VclPtr<PushButton> m_pRealSizeBT;
// anchor
- VclContainer* m_pAnchorFrame;
- RadioButton* m_pAnchorAtPageRB;
- RadioButton* m_pAnchorAtParaRB;
- RadioButton* m_pAnchorAtCharRB;
- RadioButton* m_pAnchorAsCharRB;
- RadioButton* m_pAnchorAtFrameRB;
+ VclPtr<VclContainer> m_pAnchorFrame;
+ VclPtr<RadioButton> m_pAnchorAtPageRB;
+ VclPtr<RadioButton> m_pAnchorAtParaRB;
+ VclPtr<RadioButton> m_pAnchorAtCharRB;
+ VclPtr<RadioButton> m_pAnchorAsCharRB;
+ VclPtr<RadioButton> m_pAnchorAtFrameRB;
// position
- FixedText* m_pHorizontalFT;
- ListBox* m_pHorizontalDLB;
- FixedText* m_pAtHorzPosFT;
- MetricField* m_pAtHorzPosED;
- FixedText* m_pHoriRelationFT;
- ListBox* m_pHoriRelationLB;
-
- CheckBox* m_pMirrorPagesCB;
-
- FixedText* m_pVerticalFT;
- ListBox* m_pVerticalDLB;
- FixedText* m_pAtVertPosFT;
- MetricField* m_pAtVertPosED;
- FixedText* m_pVertRelationFT;
- ListBox* m_pVertRelationLB;
+ VclPtr<FixedText> m_pHorizontalFT;
+ VclPtr<ListBox> m_pHorizontalDLB;
+ VclPtr<FixedText> m_pAtHorzPosFT;
+ VclPtr<MetricField> m_pAtHorzPosED;
+ VclPtr<FixedText> m_pHoriRelationFT;
+ VclPtr<ListBox> m_pHoriRelationLB;
+
+ VclPtr<CheckBox> m_pMirrorPagesCB;
+
+ VclPtr<FixedText> m_pVerticalFT;
+ VclPtr<ListBox> m_pVerticalDLB;
+ VclPtr<FixedText> m_pAtVertPosFT;
+ VclPtr<MetricField> m_pAtVertPosED;
+ VclPtr<FixedText> m_pVertRelationFT;
+ VclPtr<ListBox> m_pVertRelationLB;
// #i18732# - check box for new option 'FollowTextFlow'
- CheckBox* m_pFollowTextFlowCB;
+ VclPtr<CheckBox> m_pFollowTextFlowCB;
// example
- SvxSwFrameExample* m_pExampleWN;
+ VclPtr<SvxSwFrameExample> m_pExampleWN;
//'string provider'
SvxSwFramePosString aFramePosString;
@@ -174,9 +174,6 @@ class SwFrmPage: public SfxTabPage
void EnableGraficMode(); // hides auto check boxes and re-org controls for "Real Size" button
- SwFrmPage(vcl::Window *pParent, const SfxItemSet &rSet);
- virtual ~SwFrmPage();
-
SwWrtShell *getFrmDlgParentShell();
using SfxTabPage::ActivatePage;
@@ -185,8 +182,11 @@ class SwFrmPage: public SfxTabPage
static const sal_uInt16 aPageRg[];
public:
+ SwFrmPage(vcl::Window *pParent, const SfxItemSet &rSet);
+ virtual ~SwFrmPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
static const sal_uInt16* GetRanges() { return aPageRg; }
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
@@ -202,16 +202,16 @@ public:
class SwGrfExtPage: public SfxTabPage
{
// mirror
- VclContainer* m_pMirror;
- CheckBox* m_pMirrorVertBox;
- CheckBox* m_pMirrorHorzBox;
- RadioButton* m_pAllPagesRB;
- RadioButton* m_pLeftPagesRB;
- RadioButton* m_pRightPagesRB;
- BmpWindow* m_pBmpWin;
+ VclPtr<VclContainer> m_pMirror;
+ VclPtr<CheckBox> m_pMirrorVertBox;
+ VclPtr<CheckBox> m_pMirrorHorzBox;
+ VclPtr<RadioButton> m_pAllPagesRB;
+ VclPtr<RadioButton> m_pLeftPagesRB;
+ VclPtr<RadioButton> m_pRightPagesRB;
+ VclPtr<BmpWindow> m_pBmpWin;
- Edit* m_pConnectED;
- PushButton* m_pBrowseBT;
+ VclPtr<Edit> m_pConnectED;
+ VclPtr<PushButton> m_pBrowseBT;
OUString aFilterName;
OUString aGrfName, aNewGrfName;
@@ -225,15 +225,16 @@ class SwGrfExtPage: public SfxTabPage
DECL_LINK(BrowseHdl, void *);
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
- SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet);
virtual ~SwGrfExtPage();
+ virtual void dispose() SAL_OVERRIDE;
using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
public:
+ SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet);
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE;
@@ -243,26 +244,26 @@ public:
class SwFrmURLPage : public SfxTabPage
{
// hyperlink
- Edit* pURLED;
- PushButton* pSearchPB;
- Edit* pNameED;
- ComboBox* pFrameCB;
+ VclPtr<Edit> pURLED;
+ VclPtr<PushButton> pSearchPB;
+ VclPtr<Edit> pNameED;
+ VclPtr<ComboBox> pFrameCB;
// image map
- CheckBox* pServerCB;
- CheckBox* pClientCB;
+ VclPtr<CheckBox> pServerCB;
+ VclPtr<CheckBox> pClientCB;
DECL_LINK(InsertFileHdl, void *);
- SwFrmURLPage(vcl::Window *pParent, const SfxItemSet &rSet);
- virtual ~SwFrmURLPage();
-
using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
public:
+ SwFrmURLPage(vcl::Window *pParent, const SfxItemSet &rSet);
+ virtual ~SwFrmURLPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE;
@@ -270,29 +271,29 @@ public:
class SwFrmAddPage : public SfxTabPage
{
- VclContainer* pNameFrame;
- FixedText* pNameFT;
- Edit* pNameED;
- FixedText* pAltNameFT;
- Edit* pAltNameED;
- FixedText* pPrevFT;
- ListBox* pPrevLB;
- FixedText* pNextFT;
- ListBox* pNextLB;
-
- VclContainer* pProtectFrame;
- CheckBox* pProtectContentCB;
- CheckBox* pProtectFrameCB;
- CheckBox* pProtectSizeCB;
-
- VclContainer* m_pContentAlignFrame;
- ListBox* m_pVertAlignLB;
-
- VclContainer* pPropertiesFrame;
- CheckBox* pEditInReadonlyCB;
- CheckBox* pPrintFrameCB;
- FixedText* pTextFlowFT;
- ListBox* pTextFlowLB;
+ VclPtr<VclContainer> pNameFrame;
+ VclPtr<FixedText> pNameFT;
+ VclPtr<Edit> pNameED;
+ VclPtr<FixedText> pAltNameFT;
+ VclPtr<Edit> pAltNameED;
+ VclPtr<FixedText> pPrevFT;
+ VclPtr<ListBox> pPrevLB;
+ VclPtr<FixedText> pNextFT;
+ VclPtr<ListBox> pNextLB;
+
+ VclPtr<VclContainer> pProtectFrame;
+ VclPtr<CheckBox> pProtectContentCB;
+ VclPtr<CheckBox> pProtectFrameCB;
+ VclPtr<CheckBox> pProtectSizeCB;
+
+ VclPtr<VclContainer> m_pContentAlignFrame;
+ VclPtr<ListBox> m_pVertAlignLB;
+
+ VclPtr<VclContainer> pPropertiesFrame;
+ VclPtr<CheckBox> pEditInReadonlyCB;
+ VclPtr<CheckBox> pPrintFrameCB;
+ VclPtr<FixedText> pTextFlowFT;
+ VclPtr<ListBox> pTextFlowLB;
SwWrtShell* pWrtSh;
@@ -304,14 +305,14 @@ class SwFrmAddPage : public SfxTabPage
DECL_LINK(EditModifyHdl, void *);
DECL_LINK(ChainModifyHdl, ListBox*);
- SwFrmAddPage(vcl::Window *pParent, const SfxItemSet &rSet);
- virtual ~SwFrmAddPage();
-
static const sal_uInt16 aAddPgRg[];
public:
+ SwFrmAddPage(vcl::Window *pParent, const SfxItemSet &rSet);
+ virtual ~SwFrmAddPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
static const sal_uInt16* GetRanges() { return aAddPgRg; }
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/glosbib.hxx b/sw/source/uibase/inc/glosbib.hxx
index 622b3cb20692..bcfe4a229eae 100644
--- a/sw/source/uibase/inc/glosbib.hxx
+++ b/sw/source/uibase/inc/glosbib.hxx
@@ -70,13 +70,13 @@ public:
class SwGlossaryGroupDlg : public SvxStandardDialog
{
- FEdit* m_pNameED;
- ListBox* m_pPathLB;
- SwGlossaryGroupTLB* m_pGroupTLB;
+ VclPtr<FEdit> m_pNameED;
+ VclPtr<ListBox> m_pPathLB;
+ VclPtr<SwGlossaryGroupTLB> m_pGroupTLB;
- PushButton* m_pNewPB;
- PushButton* m_pDelPB;
- PushButton* m_pRenamePB;
+ VclPtr<PushButton> m_pNewPB;
+ VclPtr<PushButton> m_pDelPB;
+ VclPtr<PushButton> m_pRenamePB;
typedef std::vector< OUString> OUVector_t;
OUVector_t m_RemovedArr;
@@ -102,6 +102,7 @@ public:
std::vector<OUString> const& rPathArr,
SwGlossaryHdl *pGlosHdl);
virtual ~SwGlossaryGroupDlg();
+ virtual void dispose() SAL_OVERRIDE;
const OUString& GetCreatedGroupName() const {return sCreatedGroup;}
};
diff --git a/sw/source/uibase/inc/glossary.hxx b/sw/source/uibase/inc/glossary.hxx
index 7fad065d8bb9..62ae7b46198e 100644
--- a/sw/source/uibase/inc/glossary.hxx
+++ b/sw/source/uibase/inc/glossary.hxx
@@ -88,19 +88,19 @@ class SwGlossaryDlg : public SvxStandardDialog
friend class SwNewGlosNameDlg;
friend class SwGlTreeListBox;
- CheckBox* m_pInsertTipCB;
- Edit* m_pNameED;
- FixedText* m_pShortNameLbl;
+ VclPtr<CheckBox> m_pInsertTipCB;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<FixedText> m_pShortNameLbl;
TextFilter m_aNoSpaceFilter;
- Edit* m_pShortNameEdit;
- SwGlTreeListBox* m_pCategoryBox;
- CheckBox* m_pFileRelCB;
- CheckBox* m_pNetRelCB;
- vcl::Window* m_pExampleWIN;
- PushButton* m_pInsertBtn;
- MenuButton* m_pEditBtn;
- PushButton* m_pBibBtn;
- PushButton* m_pPathBtn;
+ VclPtr<Edit> m_pShortNameEdit;
+ VclPtr<SwGlTreeListBox> m_pCategoryBox;
+ VclPtr<CheckBox> m_pFileRelCB;
+ VclPtr<CheckBox> m_pNetRelCB;
+ VclPtr<vcl::Window> m_pExampleWIN;
+ VclPtr<PushButton> m_pInsertBtn;
+ VclPtr<MenuButton> m_pEditBtn;
+ VclPtr<PushButton> m_pBibBtn;
+ VclPtr<PushButton> m_pPathBtn;
OUString sReadonlyPath;
@@ -149,6 +149,7 @@ class SwGlossaryDlg : public SvxStandardDialog
public:
SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
virtual ~SwGlossaryDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetCurrGrpName() const;
OUString GetCurrLongName() const
{
diff --git a/sw/source/uibase/inc/inpdlg.hxx b/sw/source/uibase/inc/inpdlg.hxx
index bf42fa788cf6..260423a01ba4 100644
--- a/sw/source/uibase/inc/inpdlg.hxx
+++ b/sw/source/uibase/inc/inpdlg.hxx
@@ -42,17 +42,19 @@ class SwFldInputDlg: public SvxStandardDialog
SwSetExpField* pSetFld;
SwUserFieldType* pUsrType;
- Edit* m_pLabelED;
+ VclPtr<Edit> m_pLabelED;
- VclMultiLineEdit* m_pEditED;
+ VclPtr<VclMultiLineEdit> m_pEditED;
- OKButton* m_pOKBT;
- PushButton* m_pNextBT;
+ VclPtr<OKButton> m_pOKBT;
+ VclPtr<PushButton> m_pNextBT;
DECL_LINK(NextHdl, void *);
public:
SwFldInputDlg( vcl::Window *pParent, SwWrtShell &rSh,
SwField* pField, bool bNextButton = false );
+ virtual ~SwFldInputDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx
index f5a9e28d050b..fdb4a6f4fb69 100644
--- a/sw/source/uibase/inc/inputwin.hxx
+++ b/sw/source/uibase/inc/inputwin.hxx
@@ -47,8 +47,8 @@ class SwInputWindow : public ToolBox
{
friend class InputEdit;
- Edit aPos;
- InputEdit aEdit;
+ VclPtr<Edit> aPos;
+ VclPtr<InputEdit> aEdit;
PopupMenu aPopMenu;
SwFldMgr* pMgr;
SwWrtShell* pWrtShell;
@@ -82,6 +82,7 @@ protected:
public:
SwInputWindow( vcl::Window* pParent, SfxBindings* pBindings );
virtual ~SwInputWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
@@ -108,9 +109,9 @@ public:
virtual ~SwInputChild();
SFX_DECL_CHILDWINDOW_WITHID( SwInputChild );
void SetFormula( const OUString& rFormula, bool bDelSel = true )
- { static_cast<SwInputWindow*>(pWindow)->SetFormula(
+ { static_cast<SwInputWindow*>(pWindow.get())->SetFormula(
rFormula, bDelSel ); }
- const SwView* GetView() const{return static_cast<SwInputWindow*>(pWindow)->GetView();}
+ const SwView* GetView() const{return static_cast<SwInputWindow*>(pWindow.get())->GetView();}
};
diff --git a/sw/source/uibase/inc/insfnote.hxx b/sw/source/uibase/inc/insfnote.hxx
index 39747588a997..8fee498f4022 100644
--- a/sw/source/uibase/inc/insfnote.hxx
+++ b/sw/source/uibase/inc/insfnote.hxx
@@ -40,19 +40,19 @@ class SwInsFootNoteDlg: public SvxStandardDialog
bool bExtCharAvailable;
bool bEdit;
- VclFrame* m_pNumberFrame;
- RadioButton* m_pNumberAutoBtn;
- RadioButton* m_pNumberCharBtn;
- Edit* m_pNumberCharEdit;
- PushButton* m_pNumberExtChar;
+ VclPtr<VclFrame> m_pNumberFrame;
+ VclPtr<RadioButton> m_pNumberAutoBtn;
+ VclPtr<RadioButton> m_pNumberCharBtn;
+ VclPtr<Edit> m_pNumberCharEdit;
+ VclPtr<PushButton> m_pNumberExtChar;
// everything for the selection footnote/endnote
- RadioButton* m_pFtnBtn;
- RadioButton* m_pEndNoteBtn;
+ VclPtr<RadioButton> m_pFtnBtn;
+ VclPtr<RadioButton> m_pEndNoteBtn;
- PushButton* m_pOkBtn;
- PushButton* m_pPrevBT;
- PushButton* m_pNextBT;
+ VclPtr<PushButton> m_pOkBtn;
+ VclPtr<PushButton> m_pPrevBT;
+ VclPtr<PushButton> m_pNextBT;
DECL_LINK(NumberCharHdl, void *);
DECL_LINK(NumberEditHdl, void *);
@@ -67,6 +67,7 @@ class SwInsFootNoteDlg: public SvxStandardDialog
public:
SwInsFootNoteDlg(vcl::Window * pParent, SwWrtShell &rSh, bool bEd = false);
virtual ~SwInsFootNoteDlg();
+ virtual void dispose() SAL_OVERRIDE;
rtl_TextEncoding GetCharSet() { return eCharSet; }
bool IsExtCharAvailable() { return bExtCharAvailable; }
diff --git a/sw/source/uibase/inc/instable.hxx b/sw/source/uibase/inc/instable.hxx
index d61de339f2b8..1e1178306d4c 100644
--- a/sw/source/uibase/inc/instable.hxx
+++ b/sw/source/uibase/inc/instable.hxx
@@ -34,22 +34,22 @@ struct SwInsertTableOptions;
class SwInsTableDlg : public SfxModalDialog
{
- Edit* m_pNameEdit;
+ VclPtr<Edit> m_pNameEdit;
TextFilter m_aTextFilter;
- NumericField* m_pColNF;
- NumericField* m_pRowNF;
+ VclPtr<NumericField> m_pColNF;
+ VclPtr<NumericField> m_pRowNF;
- CheckBox* m_pHeaderCB;
- CheckBox* m_pRepeatHeaderCB;
- NumericField* m_pRepeatHeaderNF;
- VclContainer* m_pRepeatGroup;
+ VclPtr<CheckBox> m_pHeaderCB;
+ VclPtr<CheckBox> m_pRepeatHeaderCB;
+ VclPtr<NumericField> m_pRepeatHeaderNF;
+ VclPtr<VclContainer> m_pRepeatGroup;
- CheckBox* m_pDontSplitCB;
- CheckBox* m_pBorderCB;
+ VclPtr<CheckBox> m_pDontSplitCB;
+ VclPtr<CheckBox> m_pBorderCB;
- PushButton* m_pInsertBtn;
- PushButton* m_pAutoFmtBtn;
+ VclPtr<PushButton> m_pInsertBtn;
+ VclPtr<PushButton> m_pAutoFmtBtn;
SwWrtShell* pShell;
SwTableAutoFmt* pTAutoFmt;
@@ -66,6 +66,7 @@ class SwInsTableDlg : public SfxModalDialog
public:
SwInsTableDlg( SwView& rView );
virtual ~SwInsTableDlg();
+ virtual void dispose() SAL_OVERRIDE;
void GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol,
SwInsertTableOptions& rInsTblOpts, OUString& rTableAutoFmtName,
diff --git a/sw/source/uibase/inc/javaedit.hxx b/sw/source/uibase/inc/javaedit.hxx
index 5649e5ea1e42..13b5295dc973 100644
--- a/sw/source/uibase/inc/javaedit.hxx
+++ b/sw/source/uibase/inc/javaedit.hxx
@@ -33,16 +33,16 @@ namespace sfx2 { class FileDialogHelper; }
class SwJavaEditDialog : public SvxStandardDialog
{
private:
- Edit* m_pTypeED;
- RadioButton* m_pUrlRB;
- RadioButton* m_pEditRB;
- PushButton* m_pUrlPB;
- Edit* m_pUrlED;
- VclMultiLineEdit* m_pEditED;
+ VclPtr<Edit> m_pTypeED;
+ VclPtr<RadioButton> m_pUrlRB;
+ VclPtr<RadioButton> m_pEditRB;
+ VclPtr<PushButton> m_pUrlPB;
+ VclPtr<Edit> m_pUrlED;
+ VclPtr<VclMultiLineEdit> m_pEditED;
- OKButton* m_pOKBtn;
- PushButton* m_pPrevBtn;
- PushButton* m_pNextBtn;
+ VclPtr<OKButton> m_pOKBtn;
+ VclPtr<PushButton> m_pPrevBtn;
+ VclPtr<PushButton> m_pNextBtn;
OUString aText;
OUString aType;
@@ -54,7 +54,7 @@ private:
SwFldMgr* pMgr;
SwWrtShell* pSh;
sfx2::FileDialogHelper* pFileDlg;
- vcl::Window* pOldDefDlgParent;
+ VclPtr<vcl::Window> pOldDefDlgParent;
DECL_LINK(OKHdl, void *);
DECL_LINK(PrevHdl, void *);
@@ -71,6 +71,7 @@ private:
public:
SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh);
virtual ~SwJavaEditDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetScriptText() const { return aText; }
diff --git a/sw/source/uibase/inc/label.hxx b/sw/source/uibase/inc/label.hxx
index 61b452d245d4..bb23e44c80e7 100644
--- a/sw/source/uibase/inc/label.hxx
+++ b/sw/source/uibase/inc/label.hxx
@@ -33,7 +33,7 @@ class SwLabDlg : public SfxTabDialog
{
SwLabelConfig aLabelsCfg;
SwDBManager* pDBManager;
- SwLabPrtPage* pPrtPage;
+ VclPtr<SwLabPrtPage> pPrtPage;
std::vector<sal_uInt16> aTypeIds;
std::vector<OUString> aMakes;
@@ -56,6 +56,7 @@ public:
SwLabDlg( vcl::Window* pParent, const SfxItemSet& rSet,
SwDBManager* pDBManager, bool bLabel);
virtual ~SwLabDlg();
+ virtual void dispose() SAL_OVERRIDE;
SwLabRec* GetRecord(const OUString &rRecName, bool bCont);
void GetLabItem(SwLabItem &rItem);
diff --git a/sw/source/uibase/inc/linenum.hxx b/sw/source/uibase/inc/linenum.hxx
index 7b3f0734dee6..ef0cb2b8dbdd 100644
--- a/sw/source/uibase/inc/linenum.hxx
+++ b/sw/source/uibase/inc/linenum.hxx
@@ -33,21 +33,21 @@ class SwLineNumberingDlg : public SfxModalDialog
{
private:
SwWrtShell* pSh;
- VclContainer* m_pBodyContent;
- vcl::Window* m_pDivIntervalFT;
- NumericField* m_pDivIntervalNF;
- vcl::Window* m_pDivRowsFT;
- NumericField* m_pNumIntervalNF;
- ListBox* m_pCharStyleLB;
- SwNumberingTypeListBox* m_pFormatLB;
- ListBox* m_pPosLB;
- MetricField* m_pOffsetMF;
- Edit* m_pDivisorED;
- CheckBox* m_pCountEmptyLinesCB;
- CheckBox* m_pCountFrameLinesCB;
- CheckBox* m_pRestartEachPageCB;
- CheckBox* m_pNumberingOnCB;
- CheckBox* m_pNumberingOnFooterHeader;
+ VclPtr<VclContainer> m_pBodyContent;
+ VclPtr<vcl::Window> m_pDivIntervalFT;
+ VclPtr<NumericField> m_pDivIntervalNF;
+ VclPtr<vcl::Window> m_pDivRowsFT;
+ VclPtr<NumericField> m_pNumIntervalNF;
+ VclPtr<ListBox> m_pCharStyleLB;
+ VclPtr<SwNumberingTypeListBox> m_pFormatLB;
+ VclPtr<ListBox> m_pPosLB;
+ VclPtr<MetricField> m_pOffsetMF;
+ VclPtr<Edit> m_pDivisorED;
+ VclPtr<CheckBox> m_pCountEmptyLinesCB;
+ VclPtr<CheckBox> m_pCountFrameLinesCB;
+ VclPtr<CheckBox> m_pRestartEachPageCB;
+ VclPtr<CheckBox> m_pNumberingOnCB;
+ VclPtr<CheckBox> m_pNumberingOnFooterHeader;
DECL_LINK(OKHdl, void *);
DECL_LINK(LineOnOffHdl, void * = 0);
DECL_LINK(ModifyHdl, void * = 0);
@@ -56,6 +56,7 @@ public:
SwWrtShell* GetWrtShell() const { return pSh; }
SwLineNumberingDlg(SwView *pVw);
virtual ~SwLineNumberingDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/mailconfigpage.hxx b/sw/source/uibase/inc/mailconfigpage.hxx
index a343c30bf5eb..e502ea9fef8c 100644
--- a/sw/source/uibase/inc/mailconfigpage.hxx
+++ b/sw/source/uibase/inc/mailconfigpage.hxx
@@ -33,20 +33,20 @@ class SwMailConfigPage : public SfxTabPage
{
friend class SwTestAccountSettingsDialog;
- Edit* m_pDisplayNameED;
- Edit* m_pAddressED;
+ VclPtr<Edit> m_pDisplayNameED;
+ VclPtr<Edit> m_pAddressED;
- CheckBox* m_pReplyToCB;
- FixedText* m_pReplyToFT;
- Edit* m_pReplyToED;
+ VclPtr<CheckBox> m_pReplyToCB;
+ VclPtr<FixedText> m_pReplyToFT;
+ VclPtr<Edit> m_pReplyToED;
- Edit* m_pServerED;
- NumericField* m_pPortNF;
+ VclPtr<Edit> m_pServerED;
+ VclPtr<NumericField> m_pPortNF;
- CheckBox* m_pSecureCB;
+ VclPtr<CheckBox> m_pSecureCB;
- PushButton* m_pServerAuthenticationPB;
- PushButton* m_pTestPB;
+ VclPtr<PushButton> m_pServerAuthenticationPB;
+ VclPtr<PushButton> m_pTestPB;
SwMailMergeConfigItem* m_pConfigItem;
@@ -57,9 +57,10 @@ class SwMailConfigPage : public SfxTabPage
public:
SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SwMailConfigPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/mailmergechildwindow.hxx b/sw/source/uibase/inc/mailmergechildwindow.hxx
index 35a76131c26f..742cb322437d 100644
--- a/sw/source/uibase/inc/mailmergechildwindow.hxx
+++ b/sw/source/uibase/inc/mailmergechildwindow.hxx
@@ -25,11 +25,13 @@
class SwMailMergeChildWin : public SfxFloatingWindow
{
- ToolBox* m_pBackTB;
+ VclPtr<ToolBox> m_pBackTB;
DECL_LINK( BackHdl, void* );
public:
SwMailMergeChildWin(SfxBindings*, SfxChildWindow*, vcl::Window *pParent);
+ virtual ~SwMailMergeChildWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE;
};
diff --git a/sw/source/uibase/inc/mailmergehelper.hxx b/sw/source/uibase/inc/mailmergehelper.hxx
index c6691af3dcc1..deb715c98e79 100644
--- a/sw/source/uibase/inc/mailmergehelper.hxx
+++ b/sw/source/uibase/inc/mailmergehelper.hxx
@@ -60,7 +60,7 @@ struct SwAddressPreview_Impl;
// and also the resulting address filled with database data
class SW_DLLPUBLIC SwAddressPreview : public vcl::Window
{
- ScrollBar aVScrollBar;
+ VclPtr<ScrollBar> aVScrollBar;
SwAddressPreview_Impl* pImpl;
Link m_aSelectHdl;
@@ -77,6 +77,8 @@ class SW_DLLPUBLIC SwAddressPreview : public vcl::Window
public:
SwAddressPreview(vcl::Window* pParent, WinBits nStyle=WB_BORDER);
+ virtual ~SwAddressPreview();
+ virtual void dispose() SAL_OVERRIDE;
void positionScrollBar();
@@ -140,7 +142,7 @@ class SW_DLLPUBLIC SwAuthenticator :
{
OUString m_aUserName;
OUString m_aPassword;
- vcl::Window* m_pParentWindow;
+ VclPtr<vcl::Window> m_pParentWindow;
public:
SwAuthenticator() : m_pParentWindow(0) {}
SwAuthenticator(const OUString& username, const OUString& password, vcl::Window* pParent) :
diff --git a/sw/source/uibase/inc/mailmergewizard.hxx b/sw/source/uibase/inc/mailmergewizard.hxx
index 5287ca3576d1..6bcfb25aebb7 100644
--- a/sw/source/uibase/inc/mailmergewizard.hxx
+++ b/sw/source/uibase/inc/mailmergewizard.hxx
@@ -58,7 +58,7 @@ class SwMailMergeWizard : public ::svt::RoadmapWizard
using svt::OWizardMachine::skipUntil;
protected:
- virtual svt::OWizardPage* createPage(WizardState _nState) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage( WizardState _nState ) SAL_OVERRIDE;
virtual void enterState( WizardState _nState ) SAL_OVERRIDE;
// roadmap feature ??
diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx
index f3d67eeb831f..1ae4b78829de 100644
--- a/sw/source/uibase/inc/mailmrge.hxx
+++ b/sw/source/uibase/inc/mailmrge.hxx
@@ -51,46 +51,46 @@ class SwMailMergeDlg : public SvxStandardDialog
{
friend class SwXSelChgLstnr_Impl;
- vcl::Window* m_pBeamerWin;
-
- RadioButton* m_pAllRB;
- RadioButton* m_pMarkedRB;
- RadioButton* m_pFromRB;
- NumericField* m_pFromNF;
- NumericField* m_pToNF;
-
- RadioButton* m_pPrinterRB;
- RadioButton* m_pMailingRB;
- RadioButton* m_pFileRB;
-
- CheckBox* m_pSingleJobsCB;
-
- FixedText* m_pSaveMergedDocumentFT;
- RadioButton* m_pSaveSingleDocRB;
- RadioButton* m_pSaveIndividualRB;
-
- CheckBox* m_pGenerateFromDataBaseCB;
-
- FixedText* m_pColumnFT;
- ListBox* m_pColumnLB;
- FixedText* m_pPathFT;
- Edit* m_pPathED;
- PushButton* m_pPathPB;
- FixedText* m_pFilterFT;
- ListBox* m_pFilterLB;
-
- ListBox* m_pAddressFldLB;
- FixedText* m_pSubjectFT;
- Edit* m_pSubjectED;
- FixedText* m_pFormatFT;
- FixedText* m_pAttachFT;
- Edit* m_pAttachED;
- PushButton* m_pAttachPB;
- CheckBox* m_pFormatHtmlCB;
- CheckBox* m_pFormatRtfCB;
- CheckBox* m_pFormatSwCB;
-
- OKButton* m_pOkBTN;
+ VclPtr<vcl::Window> m_pBeamerWin;
+
+ VclPtr<RadioButton> m_pAllRB;
+ VclPtr<RadioButton> m_pMarkedRB;
+ VclPtr<RadioButton> m_pFromRB;
+ VclPtr<NumericField> m_pFromNF;
+ VclPtr<NumericField> m_pToNF;
+
+ VclPtr<RadioButton> m_pPrinterRB;
+ VclPtr<RadioButton> m_pMailingRB;
+ VclPtr<RadioButton> m_pFileRB;
+
+ VclPtr<CheckBox> m_pSingleJobsCB;
+
+ VclPtr<FixedText> m_pSaveMergedDocumentFT;
+ VclPtr<RadioButton> m_pSaveSingleDocRB;
+ VclPtr<RadioButton> m_pSaveIndividualRB;
+
+ VclPtr<CheckBox> m_pGenerateFromDataBaseCB;
+
+ VclPtr<FixedText> m_pColumnFT;
+ VclPtr<ListBox> m_pColumnLB;
+ VclPtr<FixedText> m_pPathFT;
+ VclPtr<Edit> m_pPathED;
+ VclPtr<PushButton> m_pPathPB;
+ VclPtr<FixedText> m_pFilterFT;
+ VclPtr<ListBox> m_pFilterLB;
+
+ VclPtr<ListBox> m_pAddressFldLB;
+ VclPtr<FixedText> m_pSubjectFT;
+ VclPtr<Edit> m_pSubjectED;
+ VclPtr<FixedText> m_pFormatFT;
+ VclPtr<FixedText> m_pAttachFT;
+ VclPtr<Edit> m_pAttachED;
+ VclPtr<PushButton> m_pAttachPB;
+ VclPtr<CheckBox> m_pFormatHtmlCB;
+ VclPtr<CheckBox> m_pFormatRtfCB;
+ VclPtr<CheckBox> m_pFormatSwCB;
+
+ VclPtr<OKButton> m_pOkBTN;
SwMailMergeDlg_Impl* pImpl;
@@ -122,6 +122,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& xConnection,
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >* pSelection = 0);
virtual ~SwMailMergeDlg();
+ virtual void dispose() SAL_OVERRIDE;
inline DBManagerOptions GetMergeType() { return nMergeType; }
@@ -138,9 +139,11 @@ public:
class SwMailMergeCreateFromDlg : public ModalDialog
{
- RadioButton* m_pThisDocRB;
+ VclPtr<RadioButton> m_pThisDocRB;
public:
SwMailMergeCreateFromDlg(vcl::Window* pParent);
+ virtual ~SwMailMergeCreateFromDlg();
+ virtual void dispose() SAL_OVERRIDE;
bool IsThisDocument() const
{
return m_pThisDocRB->IsChecked();
@@ -149,9 +152,12 @@ public:
class SwMailMergeFieldConnectionsDlg : public ModalDialog
{
- RadioButton* m_pUseExistingRB;
+ VclPtr<RadioButton> m_pUseExistingRB;
public:
SwMailMergeFieldConnectionsDlg(vcl::Window* pParent);
+ virtual ~SwMailMergeFieldConnectionsDlg();
+ virtual void dispose() SAL_OVERRIDE;
+
bool IsUseExistingConnections() const
{
return m_pUseExistingRB->IsChecked();
diff --git a/sw/source/uibase/inc/mergetbl.hxx b/sw/source/uibase/inc/mergetbl.hxx
index fe9882a1429b..5bd7548ca358 100644
--- a/sw/source/uibase/inc/mergetbl.hxx
+++ b/sw/source/uibase/inc/mergetbl.hxx
@@ -26,7 +26,7 @@
class SwMergeTblDlg : public SvxStandardDialog
{
- RadioButton* m_pMergePrevRB;
+ VclPtr<RadioButton> m_pMergePrevRB;
bool& m_rMergePrev;
protected:
@@ -34,6 +34,8 @@ protected:
public:
SwMergeTblDlg( vcl::Window *pParent, bool& rWithPrev );
+ virtual ~SwMergeTblDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/multmrk.hxx b/sw/source/uibase/inc/multmrk.hxx
index 62ab97399cd8..2e9c26abaf82 100644
--- a/sw/source/uibase/inc/multmrk.hxx
+++ b/sw/source/uibase/inc/multmrk.hxx
@@ -32,8 +32,8 @@ class SwTOXMgr;
class SwMultiTOXMarkDlg : public SvxStandardDialog
{
DECL_LINK( SelectHdl, ListBox * );
- FixedText* m_pTextFT;
- ListBox* m_pTOXLB;
+ VclPtr<FixedText> m_pTextFT;
+ VclPtr<ListBox> m_pTOXLB;
SwTOXMgr& rMgr;
sal_uInt16 nPos;
@@ -42,6 +42,7 @@ class SwMultiTOXMarkDlg : public SvxStandardDialog
public:
SwMultiTOXMarkDlg( vcl::Window* pParent, SwTOXMgr &rTOXMgr );
virtual ~SwMultiTOXMarkDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif // INCLUDED_SW_SOURCE_UIBASE_INC_MULTMRK_HXX
diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx
index 074888e6f0ce..1cb6b9fe021d 100644
--- a/sw/source/uibase/inc/navipi.hxx
+++ b/sw/source/uibase/inc/navipi.hxx
@@ -55,12 +55,12 @@ class SwNavigationPI : public vcl::Window,
friend class SwContentTree;
friend class SwGlobalTree;
- SwNavHelpToolBox aContentToolBox;
- SwHelpToolBox aGlobalToolBox;
- ImageList aContentImageList;
- SwContentTree aContentTree;
- SwGlobalTree aGlobalTree;
- ListBox aDocListBox;
+ VclPtr<SwNavHelpToolBox> aContentToolBox;
+ VclPtr<SwHelpToolBox> aGlobalToolBox;
+ ImageList aContentImageList;
+ VclPtr<SwContentTree> aContentTree;
+ VclPtr<SwGlobalTree> aGlobalTree;
+ VclPtr<ListBox> aDocListBox;
Idle aPageChgIdle;
OUString sContentFileName;
OUString aContextArr[3];
@@ -72,8 +72,8 @@ class SwNavigationPI : public vcl::Window,
SwWrtShell *pContentWrtShell;
SwView *pActContView;
SwView *pCreateView;
- SfxPopupWindow *pPopupWindow;
- SfxPopupWindow *pFloatingWindow;
+ VclPtr<SfxPopupWindow> pPopupWindow;
+ VclPtr<SfxPopupWindow> pFloatingWindow;
SfxChildWindowContext* pContextWin;
@@ -137,6 +137,7 @@ public:
SwNavigationPI(SfxBindings*, SfxChildWindowContext*, vcl::Window*);
virtual ~SwNavigationPI();
+ virtual void dispose() SAL_OVERRIDE;
void GotoPage(); // jump to page; bindable function
diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx
index ad1a9cdc0f22..1b712e3cc50e 100644
--- a/sw/source/uibase/inc/num.hxx
+++ b/sw/source/uibase/inc/num.hxx
@@ -49,43 +49,43 @@ struct SwBmpItemInfo
class SwNumPositionTabPage : public SfxTabPage
{
- ListBox* m_pLevelLB;
- VclFrame* m_pPositionFrame;
+ VclPtr<ListBox> m_pLevelLB;
+ VclPtr<VclFrame> m_pPositionFrame;
// former set of controls shown for numbering rules containing list level
// attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
- FixedText* m_pDistBorderFT;
- MetricField* m_pDistBorderMF;
- CheckBox* m_pRelativeCB;
- FixedText* m_pIndentFT;
- MetricField* m_pIndentMF;
- FixedText* m_pDistNumFT;
- MetricField* m_pDistNumMF;
- FixedText* m_pAlignFT;
- ListBox* m_pAlignLB;
+ VclPtr<FixedText> m_pDistBorderFT;
+ VclPtr<MetricField> m_pDistBorderMF;
+ VclPtr<CheckBox> m_pRelativeCB;
+ VclPtr<FixedText> m_pIndentFT;
+ VclPtr<MetricField> m_pIndentMF;
+ VclPtr<FixedText> m_pDistNumFT;
+ VclPtr<MetricField> m_pDistNumMF;
+ VclPtr<FixedText> m_pAlignFT;
+ VclPtr<ListBox> m_pAlignLB;
// new set of controls shown for numbering rules containing list level
// attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
- FixedText* m_pLabelFollowedByFT;
- ListBox* m_pLabelFollowedByLB;
- FixedText* m_pListtabFT;
- MetricField* m_pListtabMF;
- FixedText* m_pAlign2FT;
- ListBox* m_pAlign2LB;
- FixedText* m_pAlignedAtFT;
- MetricField* m_pAlignedAtMF;
- FixedText* m_pIndentAtFT;
- MetricField* m_pIndentAtMF;
+ VclPtr<FixedText> m_pLabelFollowedByFT;
+ VclPtr<ListBox> m_pLabelFollowedByLB;
+ VclPtr<FixedText> m_pListtabFT;
+ VclPtr<MetricField> m_pListtabMF;
+ VclPtr<FixedText> m_pAlign2FT;
+ VclPtr<ListBox> m_pAlign2LB;
+ VclPtr<FixedText> m_pAlignedAtFT;
+ VclPtr<MetricField> m_pAlignedAtMF;
+ VclPtr<FixedText> m_pIndentAtFT;
+ VclPtr<MetricField> m_pIndentAtMF;
- PushButton* m_pStandardPB;
+ VclPtr<PushButton> m_pStandardPB;
- NumberingPreview* m_pPreviewWIN;
+ VclPtr<NumberingPreview> m_pPreviewWIN;
SwNumRule* pActNum;
SwNumRule* pSaveNum;
SwWrtShell* pWrtSh;
- SwOutlineTabDialog* pOutlineDlg;
+ VclPtr<SwOutlineTabDialog> pOutlineDlg;
sal_uInt16 nActNumLvl;
bool bModified : 1;
@@ -117,14 +117,15 @@ public:
SwNumPositionTabPage(vcl::Window* pParent,
const SfxItemSet& rSet);
virtual ~SwNumPositionTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet);
void SetOutlineTabDialog(SwOutlineTabDialog* pDlg){pOutlineDlg = pDlg;}
void SetWrtShell(SwWrtShell* pSh);
diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx
index bedbc7225f69..b1968d7f6857 100644
--- a/sw/source/uibase/inc/numberingtypelistbox.hxx
+++ b/sw/source/uibase/inc/numberingtypelistbox.hxx
@@ -37,6 +37,7 @@ class SW_DLLPUBLIC SwNumberingTypeListBox : public ListBox
public:
SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyle = WB_BORDER );
virtual ~SwNumberingTypeListBox();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/numfmtlb.hxx b/sw/source/uibase/inc/numfmtlb.hxx
index 8dd0394575a1..ede07317deb4 100644
--- a/sw/source/uibase/inc/numfmtlb.hxx
+++ b/sw/source/uibase/inc/numfmtlb.hxx
@@ -48,6 +48,7 @@ public:
NumFormatListBox(vcl::Window* pWin, WinBits nStyle);
virtual ~NumFormatListBox();
+ virtual void dispose() SAL_OVERRIDE;
void Clear();
diff --git a/sw/source/uibase/inc/numpara.hxx b/sw/source/uibase/inc/numpara.hxx
index ab84db3e5cda..a5fe54a69458 100644
--- a/sw/source/uibase/inc/numpara.hxx
+++ b/sw/source/uibase/inc/numpara.hxx
@@ -29,23 +29,23 @@
// are performed.
class SwParagraphNumTabPage : public SfxTabPage
{
- VclHBox* m_pOutlineStartBX;
- ListBox* m_pOutlineLvLB;
- VclHBox* m_pNumberStyleBX;
- ListBox* m_pNumberStyleLB;
- PushButton* m_pEditNumStyleBtn;
+ VclPtr<VclHBox> m_pOutlineStartBX;
+ VclPtr<ListBox> m_pOutlineLvLB;
+ VclPtr<VclHBox> m_pNumberStyleBX;
+ VclPtr<ListBox> m_pNumberStyleLB;
+ VclPtr<PushButton> m_pEditNumStyleBtn;
- TriStateBox* m_pNewStartCB;
- VclHBox* m_pNewStartBX;
- TriStateBox* m_pNewStartNumberCB;
- NumericField* m_pNewStartNF;
+ VclPtr<TriStateBox> m_pNewStartCB;
+ VclPtr<VclHBox> m_pNewStartBX;
+ VclPtr<TriStateBox> m_pNewStartNumberCB;
+ VclPtr<NumericField> m_pNewStartNF;
- VclFrame* m_pCountParaFram;
- TriStateBox* m_pCountParaCB;
- TriStateBox* m_pRestartParaCountCB;
+ VclPtr<VclFrame> m_pCountParaFram;
+ VclPtr<TriStateBox> m_pCountParaCB;
+ VclPtr<TriStateBox> m_pRestartParaCountCB;
- VclHBox* m_pRestartBX;
- NumericField* m_pRestartNF;
+ VclPtr<VclHBox> m_pRestartBX;
+ VclPtr<NumericField> m_pRestartNF;
// --> OD 2008-04-14 #outlinelevel#
const OUString msOutlineNumbering;
@@ -62,17 +62,18 @@ class SwParagraphNumTabPage : public SfxTabPage
static const sal_uInt16 aPageRg[];
protected:
- SwParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet );
void aCountParaFL();
bool ExecuteEditNumStyle_Impl( sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr,
sal_uInt16 nFamily, sal_uInt16 nMask = 0,
const sal_uInt16* pModifier = NULL );
public:
- virtual ~SwParagraphNumTabPage();
+ SwParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet );
+ virtual ~SwParagraphNumTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rSet );
static const sal_uInt16* GetRanges() { return aPageRg; }
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/optcomp.hxx b/sw/source/uibase/inc/optcomp.hxx
index 8a1675176575..d48bf227ef1c 100644
--- a/sw/source/uibase/inc/optcomp.hxx
+++ b/sw/source/uibase/inc/optcomp.hxx
@@ -34,10 +34,10 @@ class SwCompatibilityOptPage : public SfxTabPage
{
private:
// controls
- VclFrame* m_pMain;
- ListBox* m_pFormattingLB;
- SvxCheckListBox* m_pOptionsLB;
- PushButton* m_pDefaultPB;
+ VclPtr<VclFrame> m_pMain;
+ VclPtr<ListBox> m_pFormattingLB;
+ VclPtr<SvxCheckListBox> m_pOptionsLB;
+ VclPtr<PushButton> m_pDefaultPB;
// config item
SvtCompatibilityOptions m_aConfigItem;
// text of the user entry
@@ -62,8 +62,9 @@ private:
public:
SwCompatibilityOptPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SwCompatibilityOptPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx
index 451b30c6b9b5..8c873f184bd0 100644
--- a/sw/source/uibase/inc/optload.hxx
+++ b/sw/source/uibase/inc/optload.hxx
@@ -39,21 +39,21 @@ class SwWrtShell;
class SwLoadOptPage : public SfxTabPage
{
private:
- RadioButton* m_pAlwaysRB;
- RadioButton* m_pRequestRB;
- RadioButton* m_pNeverRB;
-
- CheckBox* m_pAutoUpdateFields;
- CheckBox* m_pAutoUpdateCharts;
-
- ListBox* m_pMetricLB;
- FixedText* m_pTabFT;
- MetricField* m_pTabMF;
- CheckBox* m_pUseSquaredPageMode;
- CheckBox* m_pUseCharUnit;
- Edit* m_pWordCountED;
- CheckBox* m_pShowStandardizedPageCount;
- NumericField* m_pStandardizedPageSizeNF;
+ VclPtr<RadioButton> m_pAlwaysRB;
+ VclPtr<RadioButton> m_pRequestRB;
+ VclPtr<RadioButton> m_pNeverRB;
+
+ VclPtr<CheckBox> m_pAutoUpdateFields;
+ VclPtr<CheckBox> m_pAutoUpdateCharts;
+
+ VclPtr<ListBox> m_pMetricLB;
+ VclPtr<FixedText> m_pTabFT;
+ VclPtr<MetricField> m_pTabMF;
+ VclPtr<CheckBox> m_pUseSquaredPageMode;
+ VclPtr<CheckBox> m_pUseCharUnit;
+ VclPtr<Edit> m_pWordCountED;
+ VclPtr<CheckBox> m_pShowStandardizedPageCount;
+ VclPtr<NumericField> m_pStandardizedPageSizeNF;
SwWrtShell* m_pWrtShell;
sal_uInt16 m_nLastTab;
@@ -64,9 +64,11 @@ private:
public:
SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ virtual ~SwLoadOptPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -105,28 +107,28 @@ public:
class SwCaptionOptPage : public SfxTabPage
{
private:
- SvxCheckListBox* m_pCheckLB;
- ListBox* m_pLbCaptionOrder;
- SwCaptionPreview* m_pPreview;
-
- VclContainer* m_pSettingsGroup;
- CaptionComboBox* m_pCategoryBox;
- FixedText* m_pFormatText;
- ListBox* m_pFormatBox;
+ VclPtr<SvxCheckListBox> m_pCheckLB;
+ VclPtr<ListBox> m_pLbCaptionOrder;
+ VclPtr<SwCaptionPreview> m_pPreview;
+
+ VclPtr<VclContainer> m_pSettingsGroup;
+ VclPtr<CaptionComboBox> m_pCategoryBox;
+ VclPtr<FixedText> m_pFormatText;
+ VclPtr<ListBox> m_pFormatBox;
//#i61007# order of captions
- FixedText* m_pNumberingSeparatorFT;
- Edit* m_pNumberingSeparatorED;
- FixedText* m_pTextText;
- Edit* m_pTextEdit;
- ListBox* m_pPosBox;
+ VclPtr<FixedText> m_pNumberingSeparatorFT;
+ VclPtr<Edit> m_pNumberingSeparatorED;
+ VclPtr<FixedText> m_pTextText;
+ VclPtr<Edit> m_pTextEdit;
+ VclPtr<ListBox> m_pPosBox;
- VclContainer* m_pNumCapt;
- ListBox* m_pLbLevel;
- Edit* m_pEdDelim;
+ VclPtr<VclContainer> m_pNumCapt;
+ VclPtr<ListBox> m_pLbLevel;
+ VclPtr<Edit> m_pEdDelim;
- VclContainer* m_pCategory;
- ListBox* m_pCharStyleLB;
- CheckBox* m_pApplyBorderCB;
+ VclPtr<VclContainer> m_pCategory;
+ VclPtr<ListBox> m_pCharStyleLB;
+ VclPtr<CheckBox> m_pApplyBorderCB;
OUString m_sSWTable;
OUString m_sSWFrame;
@@ -165,9 +167,10 @@ public:
SwCaptionOptPage( vcl::Window* pParent,
const SfxItemSet& rSet );
virtual ~SwCaptionOptPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx
index ba424c9b596d..efe7ebda59e4 100644
--- a/sw/source/uibase/inc/optpage.hxx
+++ b/sw/source/uibase/inc/optpage.hxx
@@ -41,28 +41,28 @@ class FontList;
// Tools->Options->Writer/Web->View
class SwContentOptPage : public SfxTabPage
{
- CheckBox* m_pCrossCB;
-
- CheckBox* m_pHScrollBox;
- CheckBox* m_pVScrollBox;
- CheckBox* m_pAnyRulerCB;
- CheckBox* m_pHRulerCBox;
- ListBox* m_pHMetric;
- CheckBox* m_pVRulerCBox;
- CheckBox* m_pVRulerRightCBox;
- ListBox* m_pVMetric;
- CheckBox* m_pSmoothCBox;
-
- CheckBox* m_pGrfCB;
- CheckBox* m_pTblCB;
- CheckBox* m_pDrwCB;
- CheckBox* m_pFldNameCB;
- CheckBox* m_pPostItCB;
-
- VclFrame* m_pSettingsFrame;
- FixedText* m_pSettingsLabel;
- FixedText* m_pMetricLabel;
- ListBox* m_pMetricLB;
+ VclPtr<CheckBox> m_pCrossCB;
+
+ VclPtr<CheckBox> m_pHScrollBox;
+ VclPtr<CheckBox> m_pVScrollBox;
+ VclPtr<CheckBox> m_pAnyRulerCB;
+ VclPtr<CheckBox> m_pHRulerCBox;
+ VclPtr<ListBox> m_pHMetric;
+ VclPtr<CheckBox> m_pVRulerCBox;
+ VclPtr<CheckBox> m_pVRulerRightCBox;
+ VclPtr<ListBox> m_pVMetric;
+ VclPtr<CheckBox> m_pSmoothCBox;
+
+ VclPtr<CheckBox> m_pGrfCB;
+ VclPtr<CheckBox> m_pTblCB;
+ VclPtr<CheckBox> m_pDrwCB;
+ VclPtr<CheckBox> m_pFldNameCB;
+ VclPtr<CheckBox> m_pPostItCB;
+
+ VclPtr<VclFrame> m_pSettingsFrame;
+ VclPtr<FixedText> m_pSettingsLabel;
+ VclPtr<FixedText> m_pMetricLabel;
+ VclPtr<ListBox> m_pMetricLB;
DECL_LINK(VertRulerHdl, CheckBox*);
DECL_LINK(AnyRulerHdl, CheckBox*);
@@ -70,8 +70,9 @@ public:
SwContentOptPage( vcl::Window* pParent,
const SfxItemSet& rSet );
virtual ~SwContentOptPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -82,29 +83,29 @@ public:
// TabPage printer settings additions
class SwAddPrinterTabPage : public SfxTabPage
{
- CheckBox* m_pGrfCB;
- CheckBox* m_pCtrlFldCB;
- CheckBox* m_pBackgroundCB;
- CheckBox* m_pBlackFontCB;
- CheckBox* m_pPrintHiddenTextCB;
- CheckBox* m_pPrintTextPlaceholderCB;
-
- VclFrame* m_pPagesFrame;
- CheckBox* m_pLeftPageCB;
- CheckBox* m_pRightPageCB;
- CheckBox* m_pProspectCB;
- CheckBox* m_pProspectCB_RTL;
-
- VclFrame* m_pCommentsFrame;
- RadioButton* m_pNoRB;
- RadioButton* m_pOnlyRB;
- RadioButton* m_pEndRB;
- RadioButton* m_pEndPageRB;
- RadioButton* m_pInMarginsRB;
-
- CheckBox* m_pPrintEmptyPagesCB;
- CheckBox* m_pPaperFromSetupCB;
- ListBox* m_pFaxLB;
+ VclPtr<CheckBox> m_pGrfCB;
+ VclPtr<CheckBox> m_pCtrlFldCB;
+ VclPtr<CheckBox> m_pBackgroundCB;
+ VclPtr<CheckBox> m_pBlackFontCB;
+ VclPtr<CheckBox> m_pPrintHiddenTextCB;
+ VclPtr<CheckBox> m_pPrintTextPlaceholderCB;
+
+ VclPtr<VclFrame> m_pPagesFrame;
+ VclPtr<CheckBox> m_pLeftPageCB;
+ VclPtr<CheckBox> m_pRightPageCB;
+ VclPtr<CheckBox> m_pProspectCB;
+ VclPtr<CheckBox> m_pProspectCB_RTL;
+
+ VclPtr<VclFrame> m_pCommentsFrame;
+ VclPtr<RadioButton> m_pNoRB;
+ VclPtr<RadioButton> m_pOnlyRB;
+ VclPtr<RadioButton> m_pEndRB;
+ VclPtr<RadioButton> m_pEndPageRB;
+ VclPtr<RadioButton> m_pInMarginsRB;
+
+ VclPtr<CheckBox> m_pPrintEmptyPagesCB;
+ VclPtr<CheckBox> m_pPaperFromSetupCB;
+ VclPtr<ListBox> m_pFaxLB;
OUString sNone;
@@ -114,11 +115,13 @@ class SwAddPrinterTabPage : public SfxTabPage
DECL_LINK(AutoClickHdl, void *);
DECL_LINK(SelectHdl, void *);
- SwAddPrinterTabPage( vcl::Window* pParent,
- const SfxItemSet& rSet );
public:
+ SwAddPrinterTabPage( vcl::Window* pParent,
+ const SfxItemSet& rSet );
+ virtual ~SwAddPrinterTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -132,20 +135,20 @@ public:
class SwStdFontTabPage : public SfxTabPage
{
- FixedText* pLabelFT;
-
- ComboBox* pStandardBox;
- FontSizeBox* pStandardHeightLB;
- ComboBox* pTitleBox ;
- FontSizeBox* pTitleHeightLB;
- ComboBox* pListBox ;
- FontSizeBox* pListHeightLB;
- ComboBox* pLabelBox ;
- FontSizeBox* pLabelHeightLB;
- ComboBox* pIdxBox ;
- FontSizeBox* pIndexHeightLB;
- CheckBox* pDocOnlyCB ;
- PushButton* pStandardPB;
+ VclPtr<FixedText> pLabelFT;
+
+ VclPtr<ComboBox> pStandardBox;
+ VclPtr<FontSizeBox> pStandardHeightLB;
+ VclPtr<ComboBox> pTitleBox ;
+ VclPtr<FontSizeBox> pTitleHeightLB;
+ VclPtr<ComboBox> pListBox ;
+ VclPtr<FontSizeBox> pListHeightLB;
+ VclPtr<ComboBox> pLabelBox ;
+ VclPtr<FontSizeBox> pLabelHeightLB;
+ VclPtr<ComboBox> pIdxBox ;
+ VclPtr<FontSizeBox> pIndexHeightLB;
+ VclPtr<CheckBox> pDocOnlyCB ;
+ VclPtr<PushButton> pStandardPB;
OUString sShellStd;
OUString sShellTitle;
@@ -153,7 +156,7 @@ class SwStdFontTabPage : public SfxTabPage
OUString sShellLabel;
OUString sShellIndex;
- SfxPrinter* pPrt;
+ VclPtr<SfxPrinter> pPrt;
FontList* pFontList;
SwStdFontConfig* pFontConfig;
SwWrtShell* pWrtShell;
@@ -185,12 +188,13 @@ class SwStdFontTabPage : public SfxTabPage
DECL_LINK( ModifyHeightHdl, FontSizeBox * );
DECL_LINK( LoseFocusHdl, ComboBox * );
- SwStdFontTabPage( vcl::Window* pParent,
- const SfxItemSet& rSet );
- virtual ~SwStdFontTabPage();
+ SwStdFontTabPage( vcl::Window* pParent,
+ const SfxItemSet& rSet );
+ virtual ~SwStdFontTabPage();
+ virtual void dispose() SAL_OVERRIDE;
public:
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -202,37 +206,37 @@ public:
class SwTableOptionsTabPage : public SfxTabPage
{
- CheckBox* pHeaderCB;
- CheckBox* pRepeatHeaderCB;
- CheckBox* pDontSplitCB;
- CheckBox* pBorderCB;
+ VclPtr<CheckBox> pHeaderCB;
+ VclPtr<CheckBox> pRepeatHeaderCB;
+ VclPtr<CheckBox> pDontSplitCB;
+ VclPtr<CheckBox> pBorderCB;
- CheckBox* pNumFormattingCB;
- CheckBox* pNumFmtFormattingCB;
- CheckBox* pNumAlignmentCB;
+ VclPtr<CheckBox> pNumFormattingCB;
+ VclPtr<CheckBox> pNumFmtFormattingCB;
+ VclPtr<CheckBox> pNumAlignmentCB;
- MetricField* pRowMoveMF;
- MetricField* pColMoveMF;
+ VclPtr<MetricField> pRowMoveMF;
+ VclPtr<MetricField> pColMoveMF;
- MetricField* pRowInsertMF;
- MetricField* pColInsertMF;
+ VclPtr<MetricField> pRowInsertMF;
+ VclPtr<MetricField> pColInsertMF;
- RadioButton* pFixRB;
- RadioButton* pFixPropRB;
- RadioButton* pVarRB;
+ VclPtr<RadioButton> pFixRB;
+ VclPtr<RadioButton> pFixPropRB;
+ VclPtr<RadioButton> pVarRB;
SwWrtShell* pWrtShell;
bool bHTMLMode;
DECL_LINK(CheckBoxHdl, void *);
- SwTableOptionsTabPage( vcl::Window* pParent,
- const SfxItemSet& rSet );
- virtual ~SwTableOptionsTabPage();
-
public:
+ SwTableOptionsTabPage( vcl::Window* pParent,
+ const SfxItemSet& rSet );
+ virtual ~SwTableOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -247,38 +251,38 @@ public:
class SwShdwCrsrOptionsTabPage : public SfxTabPage
{
//nonprinting characters
- CheckBox* m_pParaCB;
- CheckBox* m_pSHyphCB;
- CheckBox* m_pSpacesCB;
- CheckBox* m_pHSpacesCB;
- CheckBox* m_pTabCB;
- CheckBox* m_pBreakCB;
- CheckBox* m_pCharHiddenCB;
- CheckBox* m_pFldHiddenCB;
- CheckBox* m_pFldHiddenParaCB;
-
- VclFrame* m_pDirectCursorFrame;
- CheckBox* m_pOnOffCB;
-
- RadioButton* m_pFillMarginRB;
- RadioButton* m_pFillIndentRB;
- RadioButton* m_pFillTabRB;
- RadioButton* m_pFillSpaceRB;
-
- VclFrame* m_pCursorProtFrame;
- CheckBox* m_pCrsrInProtCB;
- CheckBox* m_pIgnoreProtCB;
-
- CheckBox* m_pMathBaselineAlignmentCB;
+ VclPtr<CheckBox> m_pParaCB;
+ VclPtr<CheckBox> m_pSHyphCB;
+ VclPtr<CheckBox> m_pSpacesCB;
+ VclPtr<CheckBox> m_pHSpacesCB;
+ VclPtr<CheckBox> m_pTabCB;
+ VclPtr<CheckBox> m_pBreakCB;
+ VclPtr<CheckBox> m_pCharHiddenCB;
+ VclPtr<CheckBox> m_pFldHiddenCB;
+ VclPtr<CheckBox> m_pFldHiddenParaCB;
+
+ VclPtr<VclFrame> m_pDirectCursorFrame;
+ VclPtr<CheckBox> m_pOnOffCB;
+
+ VclPtr<RadioButton> m_pFillMarginRB;
+ VclPtr<RadioButton> m_pFillIndentRB;
+ VclPtr<RadioButton> m_pFillTabRB;
+ VclPtr<RadioButton> m_pFillSpaceRB;
+
+ VclPtr<VclFrame> m_pCursorProtFrame;
+ VclPtr<CheckBox> m_pCrsrInProtCB;
+ VclPtr<CheckBox> m_pIgnoreProtCB;
+
+ VclPtr<CheckBox> m_pMathBaselineAlignmentCB;
SwWrtShell * m_pWrtShell;
+public:
SwShdwCrsrOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SwShdwCrsrOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
-public:
-
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -328,28 +332,25 @@ public:
// redlining options
class SwRedlineOptionsTabPage : public SfxTabPage
{
- ListBox* pInsertLB;
- ColorListBox* pInsertColorLB;
- SvxFontPrevWindow* pInsertedPreviewWN;
+ VclPtr<ListBox> pInsertLB;
+ VclPtr<ColorListBox> pInsertColorLB;
+ VclPtr<SvxFontPrevWindow> pInsertedPreviewWN;
- ListBox* pDeletedLB;
- ColorListBox* pDeletedColorLB;
- SvxFontPrevWindow* pDeletedPreviewWN;
+ VclPtr<ListBox> pDeletedLB;
+ VclPtr<ColorListBox> pDeletedColorLB;
+ VclPtr<SvxFontPrevWindow> pDeletedPreviewWN;
- ListBox* pChangedLB;
- ColorListBox* pChangedColorLB;
- SvxFontPrevWindow* pChangedPreviewWN;
+ VclPtr<ListBox> pChangedLB;
+ VclPtr<ColorListBox> pChangedColorLB;
+ VclPtr<SvxFontPrevWindow> pChangedPreviewWN;
- ListBox* pMarkPosLB;
- ColorListBox* pMarkColorLB;
- SwMarkPreview* pMarkPreviewWN;
+ VclPtr<ListBox> pMarkPosLB;
+ VclPtr<ColorListBox> pMarkColorLB;
+ VclPtr<SwMarkPreview> pMarkPreviewWN;
OUString sAuthor;
OUString sNone;
- SwRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~SwRedlineOptionsTabPage();
-
DECL_LINK( AttribHdl, ListBox *pLB );
DECL_LINK(ChangedMaskPrevHdl, void * = 0);
DECL_LINK( ColorHdl, ColorListBox *pColorLB );
@@ -357,8 +358,11 @@ class SwRedlineOptionsTabPage : public SfxTabPage
void InitFontStyle(SvxFontPrevWindow& rExampleWin);
public:
+ SwRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ virtual ~SwRedlineOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -373,24 +377,26 @@ class SwTestTabPage : public SfxTabPage
public:
SwTestTabPage( vcl::Window* pParent,
const SfxItemSet& rSet );
+ virtual ~SwTestTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
private:
- CheckBox* m_pTest1CBox;
- CheckBox* m_pTest2CBox;
- CheckBox* m_pTest3CBox;
- CheckBox* m_pTest4CBox;
- CheckBox* m_pTest5CBox;
- CheckBox* m_pTest6CBox;
- CheckBox* m_pTest7CBox;
- CheckBox* m_pTest8CBox;
- CheckBox* m_pTest9CBox;
- CheckBox* m_pTest10CBox;
+ VclPtr<CheckBox> m_pTest1CBox;
+ VclPtr<CheckBox> m_pTest2CBox;
+ VclPtr<CheckBox> m_pTest3CBox;
+ VclPtr<CheckBox> m_pTest4CBox;
+ VclPtr<CheckBox> m_pTest5CBox;
+ VclPtr<CheckBox> m_pTest6CBox;
+ VclPtr<CheckBox> m_pTest7CBox;
+ VclPtr<CheckBox> m_pTest8CBox;
+ VclPtr<CheckBox> m_pTest9CBox;
+ VclPtr<CheckBox> m_pTest10CBox;
bool bAttrModified;
@@ -402,24 +408,24 @@ private:
class SwCompareOptionsTabPage : public SfxTabPage
{
- RadioButton* m_pAutoRB;
- RadioButton* m_pWordRB;
- RadioButton* m_pCharRB;
+ VclPtr<RadioButton> m_pAutoRB;
+ VclPtr<RadioButton> m_pWordRB;
+ VclPtr<RadioButton> m_pCharRB;
- CheckBox* m_pRsidCB;
- CheckBox* m_pIgnoreCB;
- NumericField* m_pLenNF;
- CheckBox* m_pStoreRsidCB;
-
- SwCompareOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
- virtual ~SwCompareOptionsTabPage();
+ VclPtr<CheckBox> m_pRsidCB;
+ VclPtr<CheckBox> m_pIgnoreCB;
+ VclPtr<NumericField> m_pLenNF;
+ VclPtr<CheckBox> m_pStoreRsidCB;
DECL_LINK(ComparisonHdl, void *);
DECL_LINK(IgnoreHdl, void *);
public:
+ SwCompareOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ virtual ~SwCompareOptionsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/outline.hxx b/sw/source/uibase/inc/outline.hxx
index 0e1d24f4315e..d4ae3c69821e 100644
--- a/sw/source/uibase/inc/outline.hxx
+++ b/sw/source/uibase/inc/outline.hxx
@@ -58,7 +58,7 @@ class SwOutlineTabDialog : public SfxTabDialog
bool bModified : 1;
- protected:
+protected:
DECL_LINK(CancelHdl, void *);
DECL_LINK( FormHdl, Button * );
DECL_LINK( MenuSelectHdl, Menu * );
@@ -66,33 +66,34 @@ class SwOutlineTabDialog : public SfxTabDialog
virtual void PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) SAL_OVERRIDE;
virtual short Ok() SAL_OVERRIDE;
- public:
+public:
SwOutlineTabDialog(vcl::Window* pParent,
const SfxItemSet* pSwItemSet,
SwWrtShell &);
virtual ~SwOutlineTabDialog();
+ virtual void dispose() SAL_OVERRIDE;
SwNumRule* GetNumRule() {return pNumRule;}
- sal_uInt16 GetLevel(const OUString &rFmtName) const;
+ sal_uInt16 GetLevel(const OUString &rFmtName) const;
OUString* GetCollNames() {return aCollNames;}
- static sal_uInt16 GetActNumLevel() {return nNumLevel;}
+ static sal_uInt16 GetActNumLevel() {return nNumLevel;}
static void SetActNumLevel(sal_uInt16 nSet) {nNumLevel = nSet;}
};
class SwOutlineSettingsTabPage : public SfxTabPage
{
- ListBox* m_pLevelLB;
-
- ListBox* m_pCollBox;
- SwNumberingTypeListBox* m_pNumberBox;
- ListBox* m_pCharFmtLB;
- FixedText* m_pAllLevelFT;
- NumericField* m_pAllLevelNF;
- Edit* m_pPrefixED;
- Edit* m_pSuffixED;
- NumericField* m_pStartEdit;
- NumberingPreview* m_pPreviewWIN;
+ VclPtr<ListBox> m_pLevelLB;
+
+ VclPtr<ListBox> m_pCollBox;
+ VclPtr<SwNumberingTypeListBox> m_pNumberBox;
+ VclPtr<ListBox> m_pCharFmtLB;
+ VclPtr<FixedText> m_pAllLevelFT;
+ VclPtr<NumericField> m_pAllLevelNF;
+ VclPtr<Edit> m_pPrefixED;
+ VclPtr<Edit> m_pSuffixED;
+ VclPtr<NumericField> m_pStartEdit;
+ VclPtr<NumberingPreview> m_pPreviewWIN;
OUString aNoFmtName;
OUString aSaveCollNames[MAXLEVEL];
@@ -121,6 +122,7 @@ class SwOutlineSettingsTabPage : public SfxTabPage
public:
SwOutlineSettingsTabPage(vcl::Window* pParent, const SfxItemSet& rSet);
virtual ~SwOutlineSettingsTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void SetWrtShell(SwWrtShell* pShell);
@@ -129,8 +131,8 @@ public:
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet);
};
#endif
diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx
index a1ab9bf6df1a..49f1974b8c3e 100644
--- a/sw/source/uibase/inc/pgfnote.hxx
+++ b/sw/source/uibase/inc/pgfnote.hxx
@@ -32,28 +32,29 @@
class SwFootNotePage: public SfxTabPage
{
static const sal_uInt16 aPageRg[];
+ SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet);
public:
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
static const sal_uInt16* GetRanges() { return aPageRg; }
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE;
-private:
- SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet);
virtual ~SwFootNotePage();
+ virtual void dispose() SAL_OVERRIDE;
+private:
- RadioButton* m_pMaxHeightPageBtn;
- RadioButton* m_pMaxHeightBtn;
- MetricField* m_pMaxHeightEdit;
- MetricField* m_pDistEdit;
-
- ListBox* m_pLinePosBox;
- LineListBox* m_pLineTypeBox;
- MetricField* m_pLineWidthEdit;
- ColorListBox* m_pLineColorBox;
- MetricField* m_pLineLengthEdit;
- MetricField* m_pLineDistEdit;
+ VclPtr<RadioButton> m_pMaxHeightPageBtn;
+ VclPtr<RadioButton> m_pMaxHeightBtn;
+ VclPtr<MetricField> m_pMaxHeightEdit;
+ VclPtr<MetricField> m_pDistEdit;
+
+ VclPtr<ListBox> m_pLinePosBox;
+ VclPtr<LineListBox> m_pLineTypeBox;
+ VclPtr<MetricField> m_pLineWidthEdit;
+ VclPtr<ColorListBox> m_pLineColorBox;
+ VclPtr<MetricField> m_pLineLengthEdit;
+ VclPtr<MetricField> m_pLineDistEdit;
DECL_LINK(HeightPage, void *);
DECL_LINK(HeightMetric, void *);
diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx
index 62144bcbe8bd..8823b1d4099f 100644
--- a/sw/source/uibase/inc/pggrid.hxx
+++ b/sw/source/uibase/inc/pggrid.hxx
@@ -28,36 +28,36 @@
// TabPage Format/(Styles/)Page/Text grid
class SwTextGridPage: public SfxTabPage
{
- RadioButton* m_pNoGridRB;
- RadioButton* m_pLinesGridRB;
- RadioButton* m_pCharsGridRB;
- CheckBox* m_pSnapToCharsCB;
+ VclPtr<RadioButton> m_pNoGridRB;
+ VclPtr<RadioButton> m_pLinesGridRB;
+ VclPtr<RadioButton> m_pCharsGridRB;
+ VclPtr<CheckBox> m_pSnapToCharsCB;
- SwPageGridExample* m_pExampleWN;
+ VclPtr<SwPageGridExample> m_pExampleWN;
- VclFrame* m_pLayoutFL;
- NumericField* m_pLinesPerPageNF;
- FixedText* m_pLinesRangeFT;
+ VclPtr<VclFrame> m_pLayoutFL;
+ VclPtr<NumericField> m_pLinesPerPageNF;
+ VclPtr<FixedText> m_pLinesRangeFT;
- MetricField* m_pTextSizeMF;
+ VclPtr<MetricField> m_pTextSizeMF;
- FixedText* m_pCharsPerLineFT;
- NumericField* m_pCharsPerLineNF;
- FixedText* m_pCharsRangeFT;
+ VclPtr<FixedText> m_pCharsPerLineFT;
+ VclPtr<NumericField> m_pCharsPerLineNF;
+ VclPtr<FixedText> m_pCharsRangeFT;
- FixedText* m_pCharWidthFT;
- MetricField* m_pCharWidthMF;
+ VclPtr<FixedText> m_pCharWidthFT;
+ VclPtr<MetricField> m_pCharWidthMF;
- FixedText* m_pRubySizeFT;
- MetricField* m_pRubySizeMF;
+ VclPtr<FixedText> m_pRubySizeFT;
+ VclPtr<MetricField> m_pRubySizeMF;
- CheckBox* m_pRubyBelowCB;
+ VclPtr<CheckBox> m_pRubyBelowCB;
- VclFrame* m_pDisplayFL;
+ VclPtr<VclFrame> m_pDisplayFL;
- CheckBox* m_pDisplayCB;
- CheckBox* m_pPrintCB;
- ColorListBox* m_pColorLB;
+ VclPtr<CheckBox> m_pDisplayCB;
+ VclPtr<CheckBox> m_pPrintCB;
+ VclPtr<ColorListBox> m_pColorLB;
sal_Int32 m_nRubyUserValue;
bool m_bRubyUserValue;
@@ -67,9 +67,6 @@ class SwTextGridPage: public SfxTabPage
bool m_bHRulerChanged;
bool m_bVRulerChanged;
- SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet);
- virtual ~SwTextGridPage();
-
void UpdatePageSize(const SfxItemSet& rSet);
void PutGridItem(SfxItemSet& rSet);
void SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue );
@@ -84,7 +81,11 @@ class SwTextGridPage: public SfxTabPage
using SfxTabPage::DeactivatePage;
public:
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet);
+ virtual ~SwTextGridPage();
+ virtual void dispose() SAL_OVERRIDE;
+
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
static const sal_uInt16* GetRanges();
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx
index 6675290b20b0..314b0b624060 100644
--- a/sw/source/uibase/inc/prcntfld.hxx
+++ b/sw/source/uibase/inc/prcntfld.hxx
@@ -26,7 +26,7 @@
//Wraps a MetricField with extra features, preferred to PercentField
class SW_DLLPUBLIC PercentField
{
- MetricField* m_pField;
+ VclPtr<MetricField> m_pField;
sal_Int64 nRefValue; // 100% value for conversion (in Twips)
sal_Int64 nOldMax;
diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx
index b33a4518b625..c4b154ca2869 100644
--- a/sw/source/uibase/inc/pview.hxx
+++ b/sw/source/uibase/inc/pview.hxx
@@ -150,7 +150,7 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell
{
// ViewWindow and handle to core
// current dispatcher shell
- SwPagePreviewWin* pViewWin;
+ VclPtr<SwPagePreviewWin> pViewWin;
//viewdata of the previous SwView and the new crsrposition
OUString sSwViewData;
//and the new cursor position if the user double click in the PagePreview
@@ -163,14 +163,14 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell
Rectangle aVisArea;
// MDI control elements
- SwScrollbar *pHScrollbar;
- SwScrollbar *pVScrollbar;
+ VclPtr<SwScrollbar> pHScrollbar;
+ VclPtr<SwScrollbar> pVScrollbar;
bool mbHScrollbarEnabled;
bool mbVScrollbarEnabled;
- ImageButton *pPageUpBtn,
- *pPageDownBtn;
+ VclPtr<ImageButton> pPageUpBtn,
+ pPageDownBtn;
// dummy window for filling the lower right edge when both scrollbars are active
- ::vcl::Window *pScrollFill;
+ VclPtr<::vcl::Window> pScrollFill;
sal_uInt16 mnPageCount;
bool bNormalPrint;
@@ -192,7 +192,7 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell
SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) SAL_OVERRIDE;
SAL_DLLPRIVATE virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ) SAL_OVERRIDE;
SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const SAL_OVERRIDE;
- SAL_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent,
+ SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent,
const SfxItemSet &rOptions ) SAL_OVERRIDE;
SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, bool bInner );
diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx
index 7cffc0bb366a..69121137d3e5 100644
--- a/sw/source/uibase/inc/redlndlg.hxx
+++ b/sw/source/uibase/inc/redlndlg.hxx
@@ -67,11 +67,11 @@ typedef std::vector<SvLBoxEntryPtr> SvLBoxEntryArr;
class SW_DLLPUBLIC SwRedlineAcceptDlg
{
- vcl::Window* pParentDlg;
+ VclPtr<vcl::Window> pParentDlg;
SwRedlineDataParentArr aRedlineParents;
SwRedlineDataChildArr aRedlineChildren;
SwRedlineDataParentSortArr aUsedSeqNo;
- SvxAcceptChgCtr aTabPagesCTRL;
+ VclPtr<SvxAcceptChgCtr> aTabPagesCTRL;
PopupMenu aPopup;
Timer aDeselectTimer;
Timer aSelectTimer;
@@ -82,8 +82,8 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg
OUString sFmtCollSet;
OUString sFilterAction;
OUString sAutoFormat;
- SvxTPView* pTPView;
- SvxRedlinTable* pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
+ VclPtr<SvxTPView> pTPView;
+ VclPtr<SvxRedlinTable> pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
Link aOldSelectHdl;
Link aOldDeselectHdl;
bool bOnlyFormatedRedlines;
@@ -120,7 +120,7 @@ public:
DECL_LINK( FilterChangedHdl, void *pDummy = 0 );
- inline SvxAcceptChgCtr& GetChgCtrl() { return aTabPagesCTRL; }
+ inline SvxAcceptChgCtr& GetChgCtrl() { return *aTabPagesCTRL.get(); }
inline bool HasRedlineAutoFmt() const { return bRedlnAutoFmt; }
void Init(sal_uInt16 nStart = 0);
@@ -140,6 +140,7 @@ class SwModelessRedlineAcceptDlg : public SfxModelessDialog
public:
SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, vcl::Window *pParent);
virtual ~SwModelessRedlineAcceptDlg();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Activate() SAL_OVERRIDE;
virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE;
@@ -166,6 +167,7 @@ class SwRedlineAcceptPanel : public PanelLayout, public SfxListener
public:
SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame);
virtual ~SwRedlineAcceptPanel();
+ virtual void dispose() SAL_OVERRIDE;
/// We need to be a SfxListener to be able to update the list of changes when we get SFX_HINT_DOCCHANGED.
using Control::Notify;
diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx
index e50a6d84cfbe..633362531f2c 100644
--- a/sw/source/uibase/inc/regionsw.hxx
+++ b/sw/source/uibase/inc/regionsw.hxx
@@ -61,41 +61,41 @@ typedef boost::ptr_set<SectRepr> SectReprArr;
class SwEditRegionDlg : public SfxModalDialog
{
- Edit* m_pCurName;
- SvTreeListBox* m_pTree;
-
- TriStateBox* m_pFileCB;
- CheckBox* m_pDDECB;
- VclContainer* m_pDDEFrame;
- FixedText* m_pFileNameFT;
- FixedText* m_pDDECommandFT;
- Edit* m_pFileNameED;
- PushButton* m_pFilePB;
- FixedText* m_pSubRegionFT;
- ComboBox* m_pSubRegionED;
+ VclPtr<Edit> m_pCurName;
+ VclPtr<SvTreeListBox> m_pTree;
+
+ VclPtr<TriStateBox> m_pFileCB;
+ VclPtr<CheckBox> m_pDDECB;
+ VclPtr<VclContainer> m_pDDEFrame;
+ VclPtr<FixedText> m_pFileNameFT;
+ VclPtr<FixedText> m_pDDECommandFT;
+ VclPtr<Edit> m_pFileNameED;
+ VclPtr<PushButton> m_pFilePB;
+ VclPtr<FixedText> m_pSubRegionFT;
+ VclPtr<ComboBox> m_pSubRegionED;
bool m_bSubRegionsFilled;
- TriStateBox* m_pProtectCB;
- CheckBox* m_pPasswdCB;
- PushButton* m_pPasswdPB;
+ VclPtr<TriStateBox> m_pProtectCB;
+ VclPtr<CheckBox> m_pPasswdCB;
+ VclPtr<PushButton> m_pPasswdPB;
- TriStateBox* m_pHideCB;
- FixedText* m_pConditionFT;
- ConditionEdit* m_pConditionED;
+ VclPtr<TriStateBox> m_pHideCB;
+ VclPtr<FixedText> m_pConditionFT;
+ VclPtr<ConditionEdit> m_pConditionED;
// #114856# edit in readonly sections
- TriStateBox* m_pEditInReadonlyCB;
+ VclPtr<TriStateBox> m_pEditInReadonlyCB;
- OKButton* m_pOK;
- PushButton* m_pOptionsPB;
- PushButton* m_pDismiss;
+ VclPtr<OKButton> m_pOK;
+ VclPtr<PushButton> m_pOptionsPB;
+ VclPtr<PushButton> m_pDismiss;
ImageList aImageIL;
SwWrtShell& rSh;
SectReprArr aSectReprArr;
const SwSection* pCurrSect;
sfx2::DocumentInserter* m_pDocInserter;
- vcl::Window* m_pOldDefDlgParent;
+ VclPtr<vcl::Window> m_pOldDefDlgParent;
bool bDontCheckPasswd :1;
bool bWeb :1;
@@ -131,6 +131,7 @@ class SwEditRegionDlg : public SfxModalDialog
public:
SwEditRegionDlg( vcl::Window* pParent, SwWrtShell& rWrtSh );
virtual ~SwEditRegionDlg();
+ virtual void dispose() SAL_OVERRIDE;
void SelectSection(const OUString& rSectionName);
@@ -139,27 +140,27 @@ public:
// dialog "insert region"
class SwInsertSectionTabPage : public SfxTabPage
{
- ComboBox* m_pCurName;
+ VclPtr<ComboBox> m_pCurName;
- CheckBox* m_pFileCB;
- CheckBox* m_pDDECB;
- FixedText* m_pDDECommandFT;
- FixedText* m_pFileNameFT;
- Edit* m_pFileNameED;
- PushButton* m_pFilePB;
- FixedText* m_pSubRegionFT;
- ComboBox* m_pSubRegionED;
+ VclPtr<CheckBox> m_pFileCB;
+ VclPtr<CheckBox> m_pDDECB;
+ VclPtr<FixedText> m_pDDECommandFT;
+ VclPtr<FixedText> m_pFileNameFT;
+ VclPtr<Edit> m_pFileNameED;
+ VclPtr<PushButton> m_pFilePB;
+ VclPtr<FixedText> m_pSubRegionFT;
+ VclPtr<ComboBox> m_pSubRegionED;
- CheckBox* m_pProtectCB;
- CheckBox* m_pPasswdCB;
- PushButton* m_pPasswdPB;
+ VclPtr<CheckBox> m_pProtectCB;
+ VclPtr<CheckBox> m_pPasswdCB;
+ VclPtr<PushButton> m_pPasswdPB;
- CheckBox* m_pHideCB;
- FixedText* m_pConditionFT;
- ConditionEdit* m_pConditionED;
+ VclPtr<CheckBox> m_pHideCB;
+ VclPtr<FixedText> m_pConditionFT;
+ VclPtr<ConditionEdit> m_pConditionED;
// #114856# edit in readonly sections
- CheckBox* m_pEditInReadonlyCB;
+ VclPtr<CheckBox> m_pEditInReadonlyCB;
OUString m_sFileName;
OUString m_sFilterName;
@@ -168,7 +169,7 @@ class SwInsertSectionTabPage : public SfxTabPage
::com::sun::star::uno::Sequence <sal_Int8 > m_aNewPasswd;
SwWrtShell* m_pWrtSh;
sfx2::DocumentInserter* m_pDocInserter;
- vcl::Window* m_pOldDefDlgParent;
+ VclPtr<vcl::Window> m_pOldDefDlgParent;
DECL_LINK( ChangeHideHdl, CheckBox * );
// #114856# edit in readonly sections
@@ -184,43 +185,44 @@ class SwInsertSectionTabPage : public SfxTabPage
public:
SwInsertSectionTabPage(vcl::Window *pParent, const SfxItemSet &rAttrSet);
virtual ~SwInsertSectionTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void SetWrtShell(SwWrtShell& rSh);
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
};
class SwSectionFtnEndTabPage : public SfxTabPage
{
- CheckBox* pFtnNtAtTextEndCB;
+ VclPtr<CheckBox> pFtnNtAtTextEndCB;
- CheckBox* pFtnNtNumCB;
- FixedText* pFtnOffsetLbl;
- NumericField* pFtnOffsetFld;
+ VclPtr<CheckBox> pFtnNtNumCB;
+ VclPtr<FixedText> pFtnOffsetLbl;
+ VclPtr<NumericField> pFtnOffsetFld;
- CheckBox* pFtnNtNumFmtCB;
- FixedText* pFtnPrefixFT;
- Edit* pFtnPrefixED;
- SwNumberingTypeListBox* pFtnNumViewBox;
- FixedText* pFtnSuffixFT;
- Edit* pFtnSuffixED;
+ VclPtr<CheckBox> pFtnNtNumFmtCB;
+ VclPtr<FixedText> pFtnPrefixFT;
+ VclPtr<Edit> pFtnPrefixED;
+ VclPtr<SwNumberingTypeListBox> pFtnNumViewBox;
+ VclPtr<FixedText> pFtnSuffixFT;
+ VclPtr<Edit> pFtnSuffixED;
- CheckBox* pEndNtAtTextEndCB;
+ VclPtr<CheckBox> pEndNtAtTextEndCB;
- CheckBox* pEndNtNumCB;
- FixedText* pEndOffsetLbl;
- NumericField* pEndOffsetFld;
+ VclPtr<CheckBox> pEndNtNumCB;
+ VclPtr<FixedText> pEndOffsetLbl;
+ VclPtr<NumericField> pEndOffsetFld;
- CheckBox* pEndNtNumFmtCB;
- FixedText* pEndPrefixFT;
- Edit* pEndPrefixED;
- SwNumberingTypeListBox* pEndNumViewBox;
- FixedText* pEndSuffixFT;
- Edit* pEndSuffixED;
+ VclPtr<CheckBox> pEndNtNumFmtCB;
+ VclPtr<FixedText> pEndPrefixFT;
+ VclPtr<Edit> pEndPrefixED;
+ VclPtr<SwNumberingTypeListBox> pEndNumViewBox;
+ VclPtr<FixedText> pEndSuffixFT;
+ VclPtr<Edit> pEndSuffixED;
DECL_LINK( FootEndHdl, CheckBox * );
void ResetState( bool bFtn, const SwFmtFtnEndAtTxtEnd& );
@@ -228,29 +230,31 @@ class SwSectionFtnEndTabPage : public SfxTabPage
public:
SwSectionFtnEndTabPage( vcl::Window *pParent, const SfxItemSet &rAttrSet );
virtual ~SwSectionFtnEndTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
};
class SwSectionIndentTabPage : public SfxTabPage
{
- MetricField* m_pBeforeMF;
- MetricField* m_pAfterMF;
- SvxParaPrevWindow* m_pPreviewWin;
+ VclPtr<MetricField> m_pBeforeMF;
+ VclPtr<MetricField> m_pAfterMF;
+ VclPtr<SvxParaPrevWindow> m_pPreviewWin;
DECL_LINK(IndentModifyHdl, void *);
public:
SwSectionIndentTabPage( vcl::Window *pParent, const SfxItemSet &rAttrSet );
virtual ~SwSectionIndentTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
void SetWrtShell(SwWrtShell& rSh);
diff --git a/sw/source/uibase/inc/rowht.hxx b/sw/source/uibase/inc/rowht.hxx
index 25d9e7c918f3..9727c8d9d555 100644
--- a/sw/source/uibase/inc/rowht.hxx
+++ b/sw/source/uibase/inc/rowht.hxx
@@ -28,8 +28,8 @@ class SwWrtShell;
class SwTableHeightDlg : public SvxStandardDialog
{
- MetricField* m_pHeightEdit;
- CheckBox* m_pAutoHeightCB;
+ VclPtr<MetricField> m_pHeightEdit;
+ VclPtr<CheckBox> m_pAutoHeightCB;
SwWrtShell &rSh;
protected:
@@ -37,6 +37,8 @@ protected:
public:
SwTableHeightDlg( vcl::Window *pParent, SwWrtShell &rS );
+ virtual ~SwTableHeightDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/selglos.hxx b/sw/source/uibase/inc/selglos.hxx
index 501af9a28200..e67f3788a2f2 100644
--- a/sw/source/uibase/inc/selglos.hxx
+++ b/sw/source/uibase/inc/selglos.hxx
@@ -29,11 +29,14 @@
class SwSelGlossaryDlg : public ModalDialog
{
protected:
- ListBox* m_pGlosBox;
+ VclPtr<ListBox> m_pGlosBox;
DECL_LINK(DoubleClickHdl, ListBox*);
public:
SwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShortName);
+ virtual ~SwSelGlossaryDlg();
+ virtual void dispose() SAL_OVERRIDE;
+
void InsertGlos(const OUString &rRegion, const OUString &rGlosName)
{
const OUString aTmp = rRegion + ":" + rGlosName;
diff --git a/sw/source/uibase/inc/shdwcrsr.hxx b/sw/source/uibase/inc/shdwcrsr.hxx
index 631fde3d7f5b..dcb38480dd16 100644
--- a/sw/source/uibase/inc/shdwcrsr.hxx
+++ b/sw/source/uibase/inc/shdwcrsr.hxx
@@ -27,7 +27,7 @@ namespace vcl { class Window; }
class SwShadowCursor
{
- vcl::Window* pWin;
+ VclPtr<vcl::Window> pWin;
Color aCol;
Point aOldPt;
long nOldHeight;
diff --git a/sw/source/uibase/inc/splittbl.hxx b/sw/source/uibase/inc/splittbl.hxx
index 3bcce8bb03bc..cc6a96d2c5f7 100644
--- a/sw/source/uibase/inc/splittbl.hxx
+++ b/sw/source/uibase/inc/splittbl.hxx
@@ -27,10 +27,10 @@ class SwWrtShell;
class SwSplitTblDlg : public SvxStandardDialog
{
- RadioButton* mpCntntCopyRB;
- RadioButton* mpBoxAttrCopyWithParaRB ;
- RadioButton* mpBoxAttrCopyNoParaRB ;
- RadioButton* mpBorderCopyRB;
+ VclPtr<RadioButton> mpCntntCopyRB;
+ VclPtr<RadioButton> mpBoxAttrCopyWithParaRB ;
+ VclPtr<RadioButton> mpBoxAttrCopyNoParaRB ;
+ VclPtr<RadioButton> mpBorderCopyRB;
SwWrtShell &rShell;
sal_uInt16 m_nSplit;
@@ -40,6 +40,8 @@ protected:
public:
SwSplitTblDlg( vcl::Window *pParent, SwWrtShell &rSh );
+ virtual ~SwSplitTblDlg();
+ virtual void dispose() SAL_OVERRIDE;
sal_uInt16 GetSplitMode() const { return m_nSplit; }
};
diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx
index 153d9e17d09d..8e1a411c645a 100644
--- a/sw/source/uibase/inc/srcedtw.hxx
+++ b/sw/source/uibase/inc/srcedtw.hxx
@@ -69,9 +69,9 @@ private:
ExtTextView* pTextView;
ExtTextEngine* pTextEngine;
- TextViewOutWin* pOutWin;
- ScrollBar *pHScrollbar,
- *pVScrollbar;
+ VclPtr<TextViewOutWin> pOutWin;
+ VclPtr<ScrollBar> pHScrollbar,
+ pVScrollbar;
SwSrcView* pSrcView;
@@ -118,6 +118,7 @@ protected:
public:
SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView );
virtual ~SwSrcEditWindow();
+ virtual void dispose() SAL_OVERRIDE;
void SetScrollBarRanges();
void InitScrollBars();
diff --git a/sw/source/uibase/inc/srcview.hxx b/sw/source/uibase/inc/srcview.hxx
index ab37058fb371..5e0c4e5a5839 100644
--- a/sw/source/uibase/inc/srcview.hxx
+++ b/sw/source/uibase/inc/srcview.hxx
@@ -32,7 +32,7 @@ class SfxMedium;
class SwSrcView: public SfxViewShell
{
- SwSrcEditWindow aEditWin;
+ VclPtr<SwSrcEditWindow> aEditWin;
SvxSearchItem* pSearchItem;
@@ -64,11 +64,11 @@ public:
virtual ~SwSrcView();
SwDocShell* GetDocShell();
- SwSrcEditWindow& GetEditWin() {return aEditWin;}
+ SwSrcEditWindow& GetEditWin() { return *aEditWin.get(); }
void SaveContent(const OUString& rTmpFile);
void SaveContentTo(SfxMedium& rMed);
- bool IsModified() {return aEditWin.IsModified();}
+ bool IsModified() {return aEditWin->IsModified();}
void Execute(SfxRequest&);
void GetState(SfxItemSet&);
diff --git a/sw/source/uibase/inc/srtdlg.hxx b/sw/source/uibase/inc/srtdlg.hxx
index a20fdeb6f04a..7facf548a45d 100644
--- a/sw/source/uibase/inc/srtdlg.hxx
+++ b/sw/source/uibase/inc/srtdlg.hxx
@@ -31,38 +31,38 @@ class CollatorResource;
class SwSortDlg : public SvxStandardDialog
{
- FixedText* m_pColLbl;
- FixedText* m_pTypLbl;
+ VclPtr<FixedText> m_pColLbl;
+ VclPtr<FixedText> m_pTypLbl;
- CheckBox* m_pKeyCB1;
- NumericField* m_pColEdt1;
- ListBox* m_pTypDLB1;
- RadioButton* m_pSortUp1RB;
- RadioButton* m_pSortDn1RB;
+ VclPtr<CheckBox> m_pKeyCB1;
+ VclPtr<NumericField> m_pColEdt1;
+ VclPtr<ListBox> m_pTypDLB1;
+ VclPtr<RadioButton> m_pSortUp1RB;
+ VclPtr<RadioButton> m_pSortDn1RB;
- CheckBox* m_pKeyCB2;
- NumericField* m_pColEdt2;
- ListBox* m_pTypDLB2;
- RadioButton* m_pSortUp2RB;
- RadioButton* m_pSortDn2RB;
+ VclPtr<CheckBox> m_pKeyCB2;
+ VclPtr<NumericField> m_pColEdt2;
+ VclPtr<ListBox> m_pTypDLB2;
+ VclPtr<RadioButton> m_pSortUp2RB;
+ VclPtr<RadioButton> m_pSortDn2RB;
- CheckBox* m_pKeyCB3;
- NumericField* m_pColEdt3;
- ListBox* m_pTypDLB3;
- RadioButton* m_pSortUp3RB;
- RadioButton* m_pSortDn3RB;
+ VclPtr<CheckBox> m_pKeyCB3;
+ VclPtr<NumericField> m_pColEdt3;
+ VclPtr<ListBox> m_pTypDLB3;
+ VclPtr<RadioButton> m_pSortUp3RB;
+ VclPtr<RadioButton> m_pSortDn3RB;
- RadioButton* m_pColumnRB;
- RadioButton* m_pRowRB;
+ VclPtr<RadioButton> m_pColumnRB;
+ VclPtr<RadioButton> m_pRowRB;
- RadioButton* m_pDelimTabRB;
- RadioButton* m_pDelimFreeRB;
- Edit* m_pDelimEdt;
- PushButton* m_pDelimPB;
+ VclPtr<RadioButton> m_pDelimTabRB;
+ VclPtr<RadioButton> m_pDelimFreeRB;
+ VclPtr<Edit> m_pDelimEdt;
+ VclPtr<PushButton> m_pDelimPB;
- SvxLanguageBox* m_pLangLB;
+ VclPtr<SvxLanguageBox> m_pLangLB;
- CheckBox* m_pCaseCB;
+ VclPtr<CheckBox> m_pCaseCB;
OUString aColTxt;
OUString aRowTxt;
@@ -85,6 +85,7 @@ class SwSortDlg : public SvxStandardDialog
public:
SwSortDlg(vcl::Window * pParent, SwWrtShell &rSh);
virtual ~SwSortDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/swmessdialog.hxx b/sw/source/uibase/inc/swmessdialog.hxx
index da9c8afe32fd..c8028265e616 100644
--- a/sw/source/uibase/inc/swmessdialog.hxx
+++ b/sw/source/uibase/inc/swmessdialog.hxx
@@ -20,14 +20,16 @@ class VclMultiLineEdit;
class SwMessageAndEditDialog : public ModalDialog
{
protected:
- OKButton* m_pOKPB;
- FixedImage* m_pImageIM;
- VclMultiLineEdit* m_pPrimaryMessage;
- VclMultiLineEdit* m_pSecondaryMessage;
- Edit* m_pEdit;
+ VclPtr<OKButton> m_pOKPB;
+ VclPtr<FixedImage> m_pImageIM;
+ VclPtr<VclMultiLineEdit> m_pPrimaryMessage;
+ VclPtr<VclMultiLineEdit> m_pSecondaryMessage;
+ VclPtr<Edit> m_pEdit;
public:
SwMessageAndEditDialog(vcl::Window* pParent, const OUString& rID,
const OUString& rUIXMLDescription);
+ virtual ~SwMessageAndEditDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX
diff --git a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx
index 06ccac71cff0..2a4728a689e1 100644
--- a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx
+++ b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx
@@ -30,6 +30,7 @@ class SwModalRedlineAcceptDlg : public SfxModalDialog
public:
SwModalRedlineAcceptDlg(vcl::Window *pParent);
virtual ~SwModalRedlineAcceptDlg();
+ virtual void dispose() SAL_OVERRIDE;
void AcceptAll( bool bAccept );
virtual void Activate() SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/swrenamexnameddlg.hxx b/sw/source/uibase/inc/swrenamexnameddlg.hxx
index aefb1efe0e91..84967e6fd9df 100644
--- a/sw/source/uibase/inc/swrenamexnameddlg.hxx
+++ b/sw/source/uibase/inc/swrenamexnameddlg.hxx
@@ -32,9 +32,9 @@
class SwRenameXNamedDlg : public ModalDialog
{
- Edit* m_pNewNameED;
+ VclPtr<Edit> m_pNewNameED;
TextFilter m_aTextFilter;
- OKButton* m_pOk;
+ VclPtr<OKButton> m_pOk;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess;
@@ -48,6 +48,8 @@ public:
SwRenameXNamedDlg( vcl::Window* pParent,
::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed,
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess );
+ virtual ~SwRenameXNamedDlg();
+ virtual void dispose() SAL_OVERRIDE;
void SetForbiddenChars(const OUString& rSet)
{
diff --git a/sw/source/uibase/inc/swruler.hxx b/sw/source/uibase/inc/swruler.hxx
index 19b877f8253f..7e57c2abe0ae 100644
--- a/sw/source/uibase/inc/swruler.hxx
+++ b/sw/source/uibase/inc/swruler.hxx
@@ -34,6 +34,7 @@ public:
SfxBindings& rBindings,
WinBits nWinStyle);
virtual ~SwCommentRuler ();
+ virtual void dispose() SAL_OVERRIDE;
/**
* Paint the ruler.
@@ -43,11 +44,11 @@ public:
protected:
SwViewShell * mpViewShell; //< Shell to check if there is any comments on doc and their visibility
- SwEditWin * mpSwWin; //< Used to get SwView to change the SideBar visibility
+ VclPtr<SwEditWin> mpSwWin; //< Used to get SwView to change the SideBar visibility
bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it)
Timer maFadeTimer; //< Timer for high/'low'light fading
int mnFadeRate; //< From 0 to 100. 0 means not highlighted.
- VirtualDevice maVirDev; //< VirtualDevice of this window. Just for convenience.
+ ScopedVclPtr<VirtualDevice> maVirDev; //< VirtualDevice of this window. Just for convenience.
/**
* Callback function to handle a mouse button down event.
diff --git a/sw/source/uibase/inc/swuiccoll.hxx b/sw/source/uibase/inc/swuiccoll.hxx
index fc903b33627f..a66a468823d9 100644
--- a/sw/source/uibase/inc/swuiccoll.hxx
+++ b/sw/source/uibase/inc/swuiccoll.hxx
@@ -26,18 +26,18 @@ class SwFmt;
class SwCondCollPage : public SfxTabPage
{
- CheckBox* m_pConditionCB;
+ VclPtr<CheckBox> m_pConditionCB;
- FixedText* m_pContextFT;
- FixedText* m_pUsedFT;
- SvTabListBox* m_pTbLinks;
+ VclPtr<FixedText> m_pContextFT;
+ VclPtr<FixedText> m_pUsedFT;
+ VclPtr<SvTabListBox> m_pTbLinks;
- FixedText* m_pStyleFT;
- ListBox* m_pStyleLB;
- ListBox* m_pFilterLB;
+ VclPtr<FixedText> m_pStyleFT;
+ VclPtr<ListBox> m_pStyleLB;
+ VclPtr<ListBox> m_pFilterLB;
- PushButton* m_pRemovePB;
- PushButton* m_pAssignPB;
+ VclPtr<PushButton> m_pRemovePB;
+ VclPtr<PushButton> m_pAssignPB;
std::vector<OUString> m_aStrArr;
@@ -47,8 +47,8 @@ class SwCondCollPage : public SfxTabPage
bool bNewTemplate;
- SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet);
virtual ~SwCondCollPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE;
@@ -62,8 +62,9 @@ class SwCondCollPage : public SfxTabPage
static const sal_uInt16 aPageRg[];
public:
+ SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet);
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
static const sal_uInt16* GetRanges() { return aPageRg; }
virtual bool FillItemSet( SfxItemSet *rSet) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/swuicnttab.hxx b/sw/source/uibase/inc/swuicnttab.hxx
index 41f57750c17a..a4af88ff19b1 100644
--- a/sw/source/uibase/inc/swuicnttab.hxx
+++ b/sw/source/uibase/inc/swuicnttab.hxx
@@ -61,8 +61,8 @@ struct SwIndexSections_Impl;
class SwMultiTOXTabDialog : public SfxTabDialog
{
- vcl::Window* m_pExampleContainerWIN;
- CheckBox* m_pShowExampleCB;
+ VclPtr<vcl::Window> m_pExampleContainerWIN;
+ VclPtr<CheckBox> m_pShowExampleCB;
SwTOXMgr* pMgr;
SwWrtShell& rSh;
@@ -102,6 +102,7 @@ public:
SwTOXBase* pCurTOX, sal_uInt16 nToxType = USHRT_MAX,
bool bGlobal = false);
virtual ~SwMultiTOXTabDialog();
+ virtual void dispose() SAL_OVERRIDE;
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE;
@@ -130,65 +131,65 @@ class IndexEntrySupplierWrapper;
class SwTOXSelectTabPage : public SfxTabPage
{
- Edit* m_pTitleED;
- FixedText* m_pTypeFT;
- ListBox* m_pTypeLB;
- CheckBox* m_pReadOnlyCB;
+ VclPtr<Edit> m_pTitleED;
+ VclPtr<FixedText> m_pTypeFT;
+ VclPtr<ListBox> m_pTypeLB;
+ VclPtr<CheckBox> m_pReadOnlyCB;
- VclContainer* m_pAreaFrame;
- ListBox* m_pAreaLB;
- FixedText* m_pLevelFT; //content, user
- NumericField* m_pLevelNF; //content, user
+ VclPtr<VclContainer> m_pAreaFrame;
+ VclPtr<ListBox> m_pAreaLB;
+ VclPtr<FixedText> m_pLevelFT; //content, user
+ VclPtr<NumericField> m_pLevelNF; //content, user
//content
- VclContainer* m_pCreateFrame; // content, user, illustration
- CheckBox* m_pFromHeadingsCB;
- CheckBox* m_pAddStylesCB;
- PushButton* m_pAddStylesPB;
+ VclPtr<VclContainer> m_pCreateFrame; // content, user, illustration
+ VclPtr<CheckBox> m_pFromHeadingsCB;
+ VclPtr<CheckBox> m_pAddStylesCB;
+ VclPtr<PushButton> m_pAddStylesPB;
//user
- CheckBox* m_pFromTablesCB;
- CheckBox* m_pFromFramesCB;
- CheckBox* m_pFromGraphicsCB;
- CheckBox* m_pFromOLECB;
- CheckBox* m_pLevelFromChapterCB;
+ VclPtr<CheckBox> m_pFromTablesCB;
+ VclPtr<CheckBox> m_pFromFramesCB;
+ VclPtr<CheckBox> m_pFromGraphicsCB;
+ VclPtr<CheckBox> m_pFromOLECB;
+ VclPtr<CheckBox> m_pLevelFromChapterCB;
//illustration + table
- RadioButton* m_pFromCaptionsRB;
- RadioButton* m_pFromObjectNamesRB;
+ VclPtr<RadioButton> m_pFromCaptionsRB;
+ VclPtr<RadioButton> m_pFromObjectNamesRB;
//illustration and tables
- FixedText* m_pCaptionSequenceFT;
- ListBox* m_pCaptionSequenceLB;
- FixedText* m_pDisplayTypeFT;
- ListBox* m_pDisplayTypeLB;
+ VclPtr<FixedText> m_pCaptionSequenceFT;
+ VclPtr<ListBox> m_pCaptionSequenceLB;
+ VclPtr<FixedText> m_pDisplayTypeFT;
+ VclPtr<ListBox> m_pDisplayTypeLB;
//all but illustration and table
- CheckBox* m_pTOXMarksCB;
+ VclPtr<CheckBox> m_pTOXMarksCB;
//index only
- VclContainer* m_pIdxOptionsFrame;
- CheckBox* m_pCollectSameCB;
- CheckBox* m_pUseFFCB;
- CheckBox* m_pUseDashCB;
- CheckBox* m_pCaseSensitiveCB;
- CheckBox* m_pInitialCapsCB;
- CheckBox* m_pKeyAsEntryCB;
- CheckBox* m_pFromFileCB;
- MenuButton* m_pAutoMarkPB;
+ VclPtr<VclContainer> m_pIdxOptionsFrame;
+ VclPtr<CheckBox> m_pCollectSameCB;
+ VclPtr<CheckBox> m_pUseFFCB;
+ VclPtr<CheckBox> m_pUseDashCB;
+ VclPtr<CheckBox> m_pCaseSensitiveCB;
+ VclPtr<CheckBox> m_pInitialCapsCB;
+ VclPtr<CheckBox> m_pKeyAsEntryCB;
+ VclPtr<CheckBox> m_pFromFileCB;
+ VclPtr<MenuButton> m_pAutoMarkPB;
// object only
SwOLENames aFromNames;
- SvxCheckListBox* m_pFromObjCLB;
- VclContainer* m_pFromObjFrame;
+ VclPtr<SvxCheckListBox> m_pFromObjCLB;
+ VclPtr<VclContainer> m_pFromObjFrame;
- CheckBox* m_pSequenceCB;
- ListBox* m_pBracketLB;
- VclContainer* m_pAuthorityFrame;
+ VclPtr<CheckBox> m_pSequenceCB;
+ VclPtr<ListBox> m_pBracketLB;
+ VclPtr<VclContainer> m_pAuthorityFrame;
//all
- VclContainer* m_pSortFrame;
- SvxLanguageBox* m_pLanguageLB;
- ListBox* m_pSortAlgorithmLB;
+ VclPtr<VclContainer> m_pSortFrame;
+ VclPtr<SvxLanguageBox> m_pLanguageLB;
+ VclPtr<ListBox> m_pSortAlgorithmLB;
IndexEntryResource* pIndexRes;
@@ -221,6 +222,7 @@ class SwTOXSelectTabPage : public SfxTabPage
public:
SwTOXSelectTabPage(vcl::Window* pParent, const SfxItemSet& rAttrSet);
virtual ~SwTOXSelectTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
@@ -228,7 +230,7 @@ public:
virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
const SfxItemSet* rAttrSet);
void SelectType(TOXTypes eSet); //preset TOXType, GlobalDoc
@@ -241,15 +243,15 @@ class SwTOXEntryTabPage;
class SwTokenWindow : public VclHBox, public VclBuilderContainer
{
- typedef std::vector<Control*>::iterator ctrl_iterator;
- typedef std::vector<Control*>::const_iterator ctrl_const_iterator;
- typedef std::vector<Control*>::reverse_iterator ctrl_reverse_iterator;
- typedef std::vector<Control*>::const_reverse_iterator ctrl_const_reverse_iterator;
-
- Button* m_pLeftScrollWin;
- vcl::Window* m_pCtrlParentWin;
- Button* m_pRightScrollWin;
- std::vector<Control*> aControlList;
+ typedef std::vector<VclPtr<Control> >::iterator ctrl_iterator;
+ typedef std::vector<VclPtr<Control> >::const_iterator ctrl_const_iterator;
+ typedef std::vector<VclPtr<Control> >::reverse_iterator ctrl_reverse_iterator;
+ typedef std::vector<VclPtr<Control> >::const_reverse_iterator ctrl_const_reverse_iterator;
+
+ VclPtr<Button> m_pLeftScrollWin;
+ VclPtr<vcl::Window> m_pCtrlParentWin;
+ VclPtr<Button> m_pRightScrollWin;
+ std::vector<VclPtr<Control> > aControlList;
SwForm* pForm;
sal_uInt16 nLevel;
bool bValid;
@@ -257,14 +259,14 @@ class SwTokenWindow : public VclHBox, public VclBuilderContainer
OUString aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons
OUString sCharStyle;
Link aButtonSelectedHdl;
- Control* pActiveCtrl;
+ VclPtr<Control> pActiveCtrl;
Link aModifyHdl;
OUString accessibleName;
OUString sAdditionalAccnameString1;
OUString sAdditionalAccnameString2;
OUString sAdditionalAccnameString3;
- SwTOXEntryTabPage* m_pParent;
+ VclPtr<SwTOXEntryTabPage> m_pParent;
DECL_LINK(EditResize, Edit*);
DECL_LINK(NextItemHdl, SwTOXEdit* );
@@ -283,6 +285,7 @@ class SwTokenWindow : public VclHBox, public VclBuilderContainer
public:
SwTokenWindow(vcl::Window* pParent);
virtual ~SwTokenWindow();
+ virtual void dispose() SAL_OVERRIDE;
void SetTabPage(SwTOXEntryTabPage *pParent) { m_pParent = pParent; }
@@ -325,76 +328,79 @@ class SwTOXEntryTabPage;
class SwIdxTreeListBox : public SvTreeListBox
{
- SwTOXEntryTabPage* pParent;
+ VclPtr<SwTOXEntryTabPage> pParent;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
public:
SwIdxTreeListBox(vcl::Window* pPar, WinBits nStyle);
+ virtual ~SwIdxTreeListBox();
+ virtual void dispose() SAL_OVERRIDE;
+
void SetTabPage(SwTOXEntryTabPage* pPar) { pParent = pPar; }
};
class SwTOXEntryTabPage : public SfxTabPage
{
- FixedText* m_pLevelFT;
- SwIdxTreeListBox* m_pLevelLB;
+ VclPtr<FixedText> m_pLevelFT;
+ VclPtr<SwIdxTreeListBox> m_pLevelLB;
- SwTokenWindow* m_pTokenWIN;
+ VclPtr<SwTokenWindow> m_pTokenWIN;
- PushButton* m_pAllLevelsPB;
+ VclPtr<PushButton> m_pAllLevelsPB;
- PushButton* m_pEntryNoPB;
- PushButton* m_pEntryPB;
- PushButton* m_pTabPB;
- PushButton* m_pChapterInfoPB;
- PushButton* m_pPageNoPB;
- PushButton* m_pHyperLinkPB;
+ VclPtr<PushButton> m_pEntryNoPB;
+ VclPtr<PushButton> m_pEntryPB;
+ VclPtr<PushButton> m_pTabPB;
+ VclPtr<PushButton> m_pChapterInfoPB;
+ VclPtr<PushButton> m_pPageNoPB;
+ VclPtr<PushButton> m_pHyperLinkPB;
- ListBox* m_pAuthFieldsLB;
- PushButton* m_pAuthInsertPB;
- PushButton* m_pAuthRemovePB;
+ VclPtr<ListBox> m_pAuthFieldsLB;
+ VclPtr<PushButton> m_pAuthInsertPB;
+ VclPtr<PushButton> m_pAuthRemovePB;
- ListBox* m_pCharStyleLB; // character style of the current token
- PushButton* m_pEditStylePB;
+ VclPtr<ListBox> m_pCharStyleLB; // character style of the current token
+ VclPtr<PushButton> m_pEditStylePB;
- FixedText* m_pChapterEntryFT;
- ListBox* m_pChapterEntryLB; // type of chapter info
+ VclPtr<FixedText> m_pChapterEntryFT;
+ VclPtr<ListBox> m_pChapterEntryLB; // type of chapter info
- FixedText* m_pNumberFormatFT;
- ListBox* m_pNumberFormatLB; //!< format for numbering (E#)
+ VclPtr<FixedText> m_pNumberFormatFT;
+ VclPtr<ListBox> m_pNumberFormatLB; //!< format for numbering (E#)
- FixedText* m_pEntryOutlineLevelFT; //!< Fixed text, for i53420
- NumericField* m_pEntryOutlineLevelNF; //!< level to evaluate outline level to, for i53420
+ VclPtr<FixedText> m_pEntryOutlineLevelFT; //!< Fixed text, for i53420
+ VclPtr<NumericField> m_pEntryOutlineLevelNF; //!< level to evaluate outline level to, for i53420
- FixedText* m_pFillCharFT;
- ComboBox* m_pFillCharCB; // fill char for tab stop
+ VclPtr<FixedText> m_pFillCharFT;
+ VclPtr<ComboBox> m_pFillCharCB; // fill char for tab stop
- FixedText* m_pTabPosFT;
- MetricField* m_pTabPosMF; // tab stop position
- CheckBox* m_pAutoRightCB;
+ VclPtr<FixedText> m_pTabPosFT;
+ VclPtr<MetricField> m_pTabPosMF; // tab stop position
+ VclPtr<CheckBox> m_pAutoRightCB;
- VclContainer* m_pFormatFrame;
- FixedText* m_pMainEntryStyleFT;
- ListBox* m_pMainEntryStyleLB; // character style of main entries in indexes
- CheckBox* m_pAlphaDelimCB;
- CheckBox* m_pCommaSeparatedCB;
- CheckBox* m_pRelToStyleCB; // position relative to the right margin of the para style
+ VclPtr<VclContainer> m_pFormatFrame;
+ VclPtr<FixedText> m_pMainEntryStyleFT;
+ VclPtr<ListBox> m_pMainEntryStyleLB; // character style of main entries in indexes
+ VclPtr<CheckBox> m_pAlphaDelimCB;
+ VclPtr<CheckBox> m_pCommaSeparatedCB;
+ VclPtr<CheckBox> m_pRelToStyleCB; // position relative to the right margin of the para style
- VclContainer* m_pSortingFrame;
- RadioButton* m_pSortDocPosRB;
- RadioButton* m_pSortContentRB;
+ VclPtr<VclContainer> m_pSortingFrame;
+ VclPtr<RadioButton> m_pSortDocPosRB;
+ VclPtr<RadioButton> m_pSortContentRB;
- VclContainer* m_pSortKeyFrame;
- ListBox* m_pFirstKeyLB;
- RadioButton* m_pFirstSortUpRB;
- RadioButton* m_pFirstSortDownRB;
+ VclPtr<VclContainer> m_pSortKeyFrame;
+ VclPtr<ListBox> m_pFirstKeyLB;
+ VclPtr<RadioButton> m_pFirstSortUpRB;
+ VclPtr<RadioButton> m_pFirstSortDownRB;
- ListBox* m_pSecondKeyLB;
- RadioButton* m_pSecondSortUpRB;
- RadioButton* m_pSecondSortDownRB;
+ VclPtr<ListBox> m_pSecondKeyLB;
+ VclPtr<RadioButton> m_pSecondSortUpRB;
+ VclPtr<RadioButton> m_pSecondSortDownRB;
- ListBox* m_pThirdKeyLB;
- RadioButton* m_pThirdSortUpRB;
- RadioButton* m_pThirdSortDownRB;
+ VclPtr<ListBox> m_pThirdKeyLB;
+ VclPtr<RadioButton> m_pThirdSortUpRB;
+ VclPtr<RadioButton> m_pThirdSortDownRB;
OUString sDelimStr;
OUString sLevelStr;
@@ -434,14 +440,15 @@ class SwTOXEntryTabPage : public SfxTabPage
public:
SwTOXEntryTabPage(vcl::Window* pParent, const SfxItemSet& rAttrSet);
virtual ~SwTOXEntryTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet);
void SetWrtShell(SwWrtShell& rSh);
OUString GetLevelHelp(sal_uInt16 nLevel) const;
@@ -453,11 +460,11 @@ public:
class SwTOXStylesTabPage : public SfxTabPage
{
- ListBox* m_pLevelLB;
- PushButton* m_pAssignBT;
- ListBox* m_pParaLayLB;
- PushButton* m_pStdBT;
- PushButton* m_pEditStyleBT;
+ VclPtr<ListBox> m_pLevelLB;
+ VclPtr<PushButton> m_pAssignBT;
+ VclPtr<ListBox> m_pParaLayLB;
+ VclPtr<PushButton> m_pStdBT;
+ VclPtr<PushButton> m_pEditStyleBT;
SwForm* m_pCurrentForm;
@@ -480,6 +487,7 @@ class SwTOXStylesTabPage : public SfxTabPage
public:
SwTOXStylesTabPage(vcl::Window* pParent, const SfxItemSet& rAttrSet);
virtual ~SwTOXStylesTabPage();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
@@ -487,8 +495,8 @@ public:
virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
+ const SfxItemSet* rAttrSet);
};
diff --git a/sw/source/uibase/inc/swuiidxmrk.hxx b/sw/source/uibase/inc/swuiidxmrk.hxx
index 0f559a63eb85..040c97d7628a 100644
--- a/sw/source/uibase/inc/swuiidxmrk.hxx
+++ b/sw/source/uibase/inc/swuiidxmrk.hxx
@@ -51,40 +51,40 @@ class SwIndexMarkPane
friend class SwIndexMarkFloatDlg;
friend class SwIndexMarkModalDlg;
- VclFrame* m_pFrame;
- FixedText* m_pTypeFT;
- ListBox* m_pTypeDCB;
- PushButton* m_pNewBT;
-
- Edit* m_pEntryED;
- FixedText* m_pPhoneticFT0;
- Edit* m_pPhoneticED0;
-
- FixedText* m_pKey1FT;
- ComboBox* m_pKey1DCB;
- FixedText* m_pPhoneticFT1;
- Edit* m_pPhoneticED1;
-
- FixedText* m_pKey2FT;
- ComboBox* m_pKey2DCB;
- FixedText* m_pPhoneticFT2;
- Edit* m_pPhoneticED2;
-
- FixedText* m_pLevelFT;
- NumericField* m_pLevelNF;
- CheckBox* m_pMainEntryCB;
- CheckBox* m_pApplyToAllCB;
- CheckBox* m_pSearchCaseSensitiveCB;
- CheckBox* m_pSearchCaseWordOnlyCB;
-
- PushButton* m_pOKBT;
- CloseButton* m_pCloseBT;
- PushButton* m_pDelBT;
-
- PushButton* m_pPrevSameBT;
- PushButton* m_pNextSameBT;
- PushButton* m_pPrevBT;
- PushButton* m_pNextBT;
+ VclPtr<VclFrame> m_pFrame;
+ VclPtr<FixedText> m_pTypeFT;
+ VclPtr<ListBox> m_pTypeDCB;
+ VclPtr<PushButton> m_pNewBT;
+
+ VclPtr<Edit> m_pEntryED;
+ VclPtr<FixedText> m_pPhoneticFT0;
+ VclPtr<Edit> m_pPhoneticED0;
+
+ VclPtr<FixedText> m_pKey1FT;
+ VclPtr<ComboBox> m_pKey1DCB;
+ VclPtr<FixedText> m_pPhoneticFT1;
+ VclPtr<Edit> m_pPhoneticED1;
+
+ VclPtr<FixedText> m_pKey2FT;
+ VclPtr<ComboBox> m_pKey2DCB;
+ VclPtr<FixedText> m_pPhoneticFT2;
+ VclPtr<Edit> m_pPhoneticED2;
+
+ VclPtr<FixedText> m_pLevelFT;
+ VclPtr<NumericField> m_pLevelNF;
+ VclPtr<CheckBox> m_pMainEntryCB;
+ VclPtr<CheckBox> m_pApplyToAllCB;
+ VclPtr<CheckBox> m_pSearchCaseSensitiveCB;
+ VclPtr<CheckBox> m_pSearchCaseWordOnlyCB;
+
+ VclPtr<PushButton> m_pOKBT;
+ VclPtr<CloseButton> m_pCloseBT;
+ VclPtr<PushButton> m_pDelBT;
+
+ VclPtr<PushButton> m_pPrevSameBT;
+ VclPtr<PushButton> m_pNextSameBT;
+ VclPtr<PushButton> m_pPrevBT;
+ VclPtr<PushButton> m_pNextBT;
OUString aOrgStr;
bool bDel;
@@ -182,17 +182,17 @@ class SwAuthorMarkPane
friend class SwAuthMarkModalDlg;
friend class SwAuthMarkFloatDlg;
- RadioButton* m_pFromComponentRB;
- RadioButton* m_pFromDocContentRB;
- FixedText* m_pAuthorFI;
- FixedText* m_pTitleFI;
- Edit* m_pEntryED;
- ListBox* m_pEntryLB;
-
- PushButton* m_pActionBT;
- CloseButton* m_pCloseBT;
- PushButton* m_pCreateEntryPB;
- PushButton* m_pEditEntryPB;
+ VclPtr<RadioButton> m_pFromComponentRB;
+ VclPtr<RadioButton> m_pFromDocContentRB;
+ VclPtr<FixedText> m_pAuthorFI;
+ VclPtr<FixedText> m_pTitleFI;
+ VclPtr<Edit> m_pEntryED;
+ VclPtr<ListBox> m_pEntryLB;
+
+ VclPtr<PushButton> m_pActionBT;
+ VclPtr<CloseButton> m_pCloseBT;
+ VclPtr<PushButton> m_pCreateEntryPB;
+ VclPtr<PushButton> m_pEditEntryPB;
bool bNewEntry;
bool bBibAccessInitialized;
diff --git a/sw/source/uibase/inc/syncbtn.hxx b/sw/source/uibase/inc/syncbtn.hxx
index 76f8be74749a..83a16070a5d7 100644
--- a/sw/source/uibase/inc/syncbtn.hxx
+++ b/sw/source/uibase/inc/syncbtn.hxx
@@ -25,12 +25,14 @@
class SwSyncBtnDlg : public SfxFloatingWindow
{
- PushButton* m_pSyncBtn;
+ VclPtr<PushButton> m_pSyncBtn;
DECL_LINK( BtnHdl, void* );
public:
SwSyncBtnDlg(SfxBindings*, SfxChildWindow*, vcl::Window *pParent);
+ virtual ~SwSyncBtnDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
class SwSyncChildWin : public SfxChildWindow
diff --git a/sw/source/uibase/inc/tautofmt.hxx b/sw/source/uibase/inc/tautofmt.hxx
index 603301b94ba4..fac2b1224840 100644
--- a/sw/source/uibase/inc/tautofmt.hxx
+++ b/sw/source/uibase/inc/tautofmt.hxx
@@ -39,18 +39,18 @@ enum AutoFmtLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE };
class SwAutoFormatDlg : public SfxModalDialog
{
- ListBox* m_pLbFormat;
- VclContainer* m_pFormatting;
- CheckBox* m_pBtnNumFormat;
- CheckBox* m_pBtnBorder;
- CheckBox* m_pBtnFont;
- CheckBox* m_pBtnPattern;
- CheckBox* m_pBtnAlignment;
- OKButton* m_pBtnOk;
- CancelButton* m_pBtnCancel;
- PushButton* m_pBtnAdd;
- PushButton* m_pBtnRemove;
- PushButton* m_pBtnRename;
+ VclPtr<ListBox> m_pLbFormat;
+ VclPtr<VclContainer> m_pFormatting;
+ VclPtr<CheckBox> m_pBtnNumFormat;
+ VclPtr<CheckBox> m_pBtnBorder;
+ VclPtr<CheckBox> m_pBtnFont;
+ VclPtr<CheckBox> m_pBtnPattern;
+ VclPtr<CheckBox> m_pBtnAlignment;
+ VclPtr<OKButton> m_pBtnOk;
+ VclPtr<CancelButton> m_pBtnCancel;
+ VclPtr<PushButton> m_pBtnAdd;
+ VclPtr<PushButton> m_pBtnRemove;
+ VclPtr<PushButton> m_pBtnRename;
OUString aStrTitle;
OUString aStrLabel;
OUString aStrClose;
@@ -58,7 +58,7 @@ class SwAutoFormatDlg : public SfxModalDialog
OUString aStrDelMsg;
OUString aStrRenameTitle;
OUString aStrInvalidFmt;
- AutoFmtPreview* m_pWndPreview;
+ VclPtr<AutoFmtPreview> m_pWndPreview;
SwWrtShell* pShell;
SwTableAutoFmtTbl* pTableTbl;
@@ -82,6 +82,7 @@ public:
bool bSetAutoFmt = true,
const SwTableAutoFmt* pSelFmt = 0 );
virtual ~SwAutoFormatDlg();
+ virtual void dispose() SAL_OVERRIDE;
void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const;
};
diff --git a/sw/source/uibase/inc/tblctrl.hxx b/sw/source/uibase/inc/tblctrl.hxx
index 33dad5f048fb..659591b4575d 100644
--- a/sw/source/uibase/inc/tblctrl.hxx
+++ b/sw/source/uibase/inc/tblctrl.hxx
@@ -31,7 +31,7 @@ public:
virtual ~SwTableOptimizeCtrl();
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
};
diff --git a/sw/source/uibase/inc/tbxanchr.hxx b/sw/source/uibase/inc/tbxanchr.hxx
index 64aebb711229..fcc6db520fe9 100644
--- a/sw/source/uibase/inc/tbxanchr.hxx
+++ b/sw/source/uibase/inc/tbxanchr.hxx
@@ -29,7 +29,7 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
virtual void Click() SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/sw/source/uibase/inc/titlepage.hxx b/sw/source/uibase/inc/titlepage.hxx
index 598b5821d173..a881cc41ff6c 100644
--- a/sw/source/uibase/inc/titlepage.hxx
+++ b/sw/source/uibase/inc/titlepage.hxx
@@ -24,22 +24,22 @@ class SwPageDesc;
class SwTitlePageDlg : public SfxModalDialog
{
private:
- RadioButton* m_pUseExistingPagesRB;
- NumericField* m_pPageCountNF;
+ VclPtr<RadioButton> m_pUseExistingPagesRB;
+ VclPtr<NumericField> m_pPageCountNF;
- RadioButton* m_pDocumentStartRB;
- RadioButton* m_pPageStartRB;
- NumericField* m_pPageStartNF;
+ VclPtr<RadioButton> m_pDocumentStartRB;
+ VclPtr<RadioButton> m_pPageStartRB;
+ VclPtr<NumericField> m_pPageStartNF;
- CheckBox* m_pRestartNumberingCB;
- NumericField* m_pRestartNumberingNF;
- CheckBox* m_pSetPageNumberCB;
- NumericField* m_pSetPageNumberNF;
+ VclPtr<CheckBox> m_pRestartNumberingCB;
+ VclPtr<NumericField> m_pRestartNumberingNF;
+ VclPtr<CheckBox> m_pSetPageNumberCB;
+ VclPtr<NumericField> m_pSetPageNumberNF;
- ListBox* m_pPagePropertiesLB;
- PushButton* m_pPagePropertiesPB;
+ VclPtr<ListBox> m_pPagePropertiesLB;
+ VclPtr<PushButton> m_pPagePropertiesPB;
- OKButton* m_pOkPB;
+ VclPtr<OKButton> m_pOkPB;
SwWrtShell *mpSh;
@@ -63,6 +63,7 @@ private:
public:
SwTitlePageDlg( vcl::Window *pParent );
virtual ~SwTitlePageDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/unotools.hxx b/sw/source/uibase/inc/unotools.hxx
index 8d4220f20ffe..d4cd7078b685 100644
--- a/sw/source/uibase/inc/unotools.hxx
+++ b/sw/source/uibase/inc/unotools.hxx
@@ -73,7 +73,7 @@ class SW_DLLPUBLIC SwOneExampleFrame
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > _xController;
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > _xCursor;
- SwFrmCtrlWindow aTopWindow;
+ VclPtr<SwFrmCtrlWindow> aTopWindow;
Idle aLoadedIdle;
Link aInitializedLink;
diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx
index 8cd1d5cf01ca..1e76ee5a3398 100644
--- a/sw/source/uibase/inc/view.hxx
+++ b/sw/source/uibase/inc/view.hxx
@@ -187,7 +187,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
Size m_aDocSz; // current document size
Rectangle m_aVisArea; // visible region
- SwEditWin *m_pEditWin;
+ VclPtr<SwEditWin> m_pEditWin;
SwWrtShell *m_pWrtShell;
SfxShell *m_pShell; // current SubShell at the dispatcher
@@ -195,21 +195,21 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
SwView_Impl *m_pViewImpl; // Impl-data for UNO + Basic
- SwScrollbar *m_pHScrollbar, // MDI control elements
- *m_pVScrollbar;
+ VclPtr<SwScrollbar> m_pHScrollbar, // MDI control elements
+ m_pVScrollbar;
bool m_bHScrollbarEnabled;
bool m_bVScrollbarEnabled;
- ::vcl::Window *m_pScrollFill; // dummy window for filling the lower right edge
+ VclPtr<::vcl::Window> m_pScrollFill; // dummy window for filling the lower right edge
// when both scrollbars are active
- SvxRuler *m_pHRuler,
- *m_pVRuler;
- ImageButton *m_pTogglePageBtn;
+ VclPtr<SvxRuler> m_pHRuler,
+ m_pVRuler;
+ VclPtr<ImageButton> m_pTogglePageBtn;
- SwHlpImageButton *m_pPageUpBtn,
- *m_pPageDownBtn;
+ VclPtr<SwHlpImageButton> m_pPageUpBtn,
+ m_pPageDownBtn;
SwGlossaryHdl *m_pGlosHdl; // handle text block
SwDrawBase *m_pDrawActual;
@@ -221,7 +221,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
SwPostItMgr *m_pPostItMgr;
int m_nSelectionType;
- FloatingWindow *m_pFieldPopup;
+ VclPtr<FloatingWindow> m_pFieldPopup;
static const int m_nMASTERENUMCOMMANDS = 6;
@@ -663,7 +663,7 @@ public:
// methods for printing
SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) SAL_OVERRIDE;
SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const SAL_OVERRIDE;
- SAL_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( vcl::Window* pParent,
+ SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window* pParent,
const SfxItemSet& rSet) SAL_OVERRIDE;
};
@@ -682,9 +682,9 @@ inline const SwDocShell *SwView::GetDocShell() const
return const_cast<SwView*>(this)->GetDocShell();
}
-SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent,
- const SfxItemSet &rOptions,
- bool bPreview);
+VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent,
+ const SfxItemSet &rOptions,
+ bool bPreview);
#endif
diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx
index 6048a83d86be..63aa450f3aeb 100644
--- a/sw/source/uibase/inc/wordcountdialog.hxx
+++ b/sw/source/uibase/inc/wordcountdialog.hxx
@@ -33,22 +33,22 @@ class SwWordCountFloatDlg : public SfxModelessDialog
void showCJK(bool bShowCJK);
void showStandardizedPages(bool bShowStandardizedPages);
- FixedText* m_pCurrentWordFT;
- FixedText* m_pCurrentCharacterFT;
- FixedText* m_pCurrentCharacterExcludingSpacesFT;
- FixedText* m_pCurrentCjkcharsFT;
- FixedText* m_pCurrentStandardizedPagesFT;
+ VclPtr<FixedText> m_pCurrentWordFT;
+ VclPtr<FixedText> m_pCurrentCharacterFT;
+ VclPtr<FixedText> m_pCurrentCharacterExcludingSpacesFT;
+ VclPtr<FixedText> m_pCurrentCjkcharsFT;
+ VclPtr<FixedText> m_pCurrentStandardizedPagesFT;
- FixedText* m_pDocWordFT;
- FixedText* m_pDocCharacterFT;
- FixedText* m_pDocCharacterExcludingSpacesFT;
- FixedText* m_pDocCjkcharsFT;
- FixedText* m_pDocStandardizedPagesFT;
+ VclPtr<FixedText> m_pDocWordFT;
+ VclPtr<FixedText> m_pDocCharacterFT;
+ VclPtr<FixedText> m_pDocCharacterExcludingSpacesFT;
+ VclPtr<FixedText> m_pDocCjkcharsFT;
+ VclPtr<FixedText> m_pDocStandardizedPagesFT;
- FixedText* m_pCjkcharsLabelFT;
- FixedText* m_pStandardizedPagesLabelFT;
+ VclPtr<FixedText> m_pCjkcharsLabelFT;
+ VclPtr<FixedText> m_pStandardizedPagesLabelFT;
- CloseButton* m_pClosePB;
+ VclPtr<CloseButton> m_pClosePB;
DECL_LINK( CloseHdl, void* );
public:
@@ -57,6 +57,7 @@ public:
vcl::Window *pParent,
SfxChildWinInfo* pInfo);
virtual ~SwWordCountFloatDlg();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateCounts();
void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat);
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index 6bb9c1f5377c..85c45282e6eb 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -65,7 +65,7 @@ public:
virtual ~SwTbxInsertCtrl();
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -85,7 +85,7 @@ public:
virtual ~SwTbxAutoTextCtrl();
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -102,7 +102,7 @@ public:
virtual ~SwTbxFieldCtrl();
virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
- virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
virtual void StateChanged( sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -114,7 +114,7 @@ class SwScrollNaviPopup;
class SwScrollNaviToolBox : public ToolBox
{
- SwScrollNaviPopup *m_pNaviPopup;
+ VclPtr<SwScrollNaviPopup> m_pNaviPopup;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
@@ -125,12 +125,14 @@ public:
, m_pNaviPopup(pNaviPopup)
{
}
+ virtual ~SwScrollNaviToolBox();
+ virtual void dispose() SAL_OVERRIDE;
};
class SwScrollNaviPopup : public SfxPopupWindow
{
- SwScrollNaviToolBox* m_pToolBox;
- FixedText* m_pInfoField;
+ VclPtr<SwScrollNaviToolBox> m_pToolBox;
+ VclPtr<FixedText> m_pInfoField;
ImageList aIList;
OUString sQuickHelp[2 * NID_COUNT];
@@ -146,10 +148,11 @@ protected:
public:
SwScrollNaviPopup( sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, vcl::Window *pParent );
virtual ~SwScrollNaviPopup();
+ virtual void dispose() SAL_OVERRIDE;
static OUString GetQuickHelpText(bool bNext);
- virtual SfxPopupWindow* Clone() const SAL_OVERRIDE;
+ virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
void GrabFocus() { m_pToolBox->GrabFocus(); }
};
@@ -178,7 +181,7 @@ public:
SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
- virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
};
#endif
diff --git a/sw/source/uibase/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx
index cd69f5ca98d3..cf5eda21ee2b 100644
--- a/sw/source/uibase/inc/wrap.hxx
+++ b/sw/source/uibase/inc/wrap.hxx
@@ -43,24 +43,24 @@ public:
class SwWrapTabPage: public SfxTabPage
{
// WRAPPING
- RadioButton* m_pNoWrapRB;
- RadioButton* m_pWrapLeftRB;
- RadioButton* m_pWrapRightRB;
- RadioButton* m_pWrapParallelRB;
- RadioButton* m_pWrapThroughRB;
- RadioButton* m_pIdealWrapRB;
+ VclPtr<RadioButton> m_pNoWrapRB;
+ VclPtr<RadioButton> m_pWrapLeftRB;
+ VclPtr<RadioButton> m_pWrapRightRB;
+ VclPtr<RadioButton> m_pWrapParallelRB;
+ VclPtr<RadioButton> m_pWrapThroughRB;
+ VclPtr<RadioButton> m_pIdealWrapRB;
// MARGIN
- MetricField* m_pLeftMarginED;
- MetricField* m_pRightMarginED;
- MetricField* m_pTopMarginED;
- MetricField* m_pBottomMarginED;
+ VclPtr<MetricField> m_pLeftMarginED;
+ VclPtr<MetricField> m_pRightMarginED;
+ VclPtr<MetricField> m_pTopMarginED;
+ VclPtr<MetricField> m_pBottomMarginED;
// OPTIONS
- CheckBox* m_pWrapAnchorOnlyCB;
- CheckBox* m_pWrapTransparentCB;
- CheckBox* m_pWrapOutlineCB;
- CheckBox* m_pWrapOutsideCB;
+ VclPtr<CheckBox> m_pWrapAnchorOnlyCB;
+ VclPtr<CheckBox> m_pWrapTransparentCB;
+ VclPtr<CheckBox> m_pWrapOutlineCB;
+ VclPtr<CheckBox> m_pWrapOutsideCB;
sal_uInt16 nOldLeftMargin;
sal_uInt16 nOldRightMargin;
@@ -79,8 +79,8 @@ class SwWrapTabPage: public SfxTabPage
bool bDrawMode;
bool bContourImage;
- SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet);
virtual ~SwWrapTabPage();
+ virtual void dispose() SAL_OVERRIDE;
void ApplyImageList();
void EnableModes(const SfxItemSet& rSet);
@@ -98,8 +98,9 @@ class SwWrapTabPage: public SfxTabPage
static const sal_uInt16 aWrapPageRg[];
public:
+ SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet);
- static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet);
+ static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet);
virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE;
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index 5cba01ec71c6..5dd31fb7b31f 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -803,9 +803,9 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
uno::Any exc( ::cppu::getCaughtException() );
OUString msg( ::comphelper::anyToString( exc ) );
const SolarMutexGuard guard;
- MessageDialog aErrorBox(NULL, msg);
- aErrorBox.SetText( "Explanations" );
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg);
+ aErrorBox->SetText( "Explanations" );
+ aErrorBox->Execute();
}
}
else if (nId == FN_REDLINE_ACCEPT_DIRECT || nId == FN_REDLINE_REJECT_DIRECT
diff --git a/sw/source/uibase/misc/glshell.cxx b/sw/source/uibase/misc/glshell.cxx
index f973411b850f..0a0f9f6c33d5 100644
--- a/sw/source/uibase/misc/glshell.cxx
+++ b/sw/source/uibase/misc/glshell.cxx
@@ -248,7 +248,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- SfxPrinter* pPrinter = new SfxPrinter( pSet );
+ VclPtr<SfxPrinter> pPrinter = VclPtr<SfxPrinter>::Create( pSet );
// and append it to the document.
xDocSh->GetDoc()->getIDocumentDeviceAccess().setPrinter( pPrinter, true, true );
diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx
index 33361a478546..8f8264e0bc3c 100644
--- a/sw/source/uibase/misc/numberingtypelistbox.cxx
+++ b/sw/source/uibase/misc/numberingtypelistbox.cxx
@@ -63,7 +63,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwNumberingTypeListBox
SwNumberingTypeListBox::~SwNumberingTypeListBox()
{
+ disposeOnce();
+}
+
+void SwNumberingTypeListBox::dispose()
+{
delete pImpl;
+ ListBox::dispose();
}
void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags)
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 1db1ec86d86b..e0ba28d8874e 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -67,9 +67,9 @@ SwRedlineAcceptChild::SwRedlineAcceptChild( vcl::Window* _pParent,
SfxChildWinInfo* pInfo ) :
SwChildWinWrapper( _pParent, nId )
{
- pWindow = new SwModelessRedlineAcceptDlg( pBindings, this, _pParent);
+ pWindow = VclPtr<SwModelessRedlineAcceptDlg>::Create( pBindings, this, _pParent);
- static_cast<SwModelessRedlineAcceptDlg *>(pWindow)->Initialize(pInfo);
+ static_cast<SwModelessRedlineAcceptDlg *>(pWindow.get())->Initialize(pInfo);
}
// newly initialise dialog after document switch
@@ -137,13 +137,19 @@ void SwModelessRedlineAcceptDlg::FillInfo(SfxChildWinInfo& rInfo) const
SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg()
{
+ disposeOnce();
+}
+
+void SwModelessRedlineAcceptDlg::dispose()
+{
delete pImplDlg;
+ SfxModelessDialog::dispose();
}
SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer *pBuilder,
vcl::Window *pContentArea, bool bAutoFmt) :
pParentDlg (pParent),
- aTabPagesCTRL (pContentArea, pBuilder),
+ aTabPagesCTRL (VclPtr<SvxAcceptChgCtr>::Create(pContentArea, pBuilder)),
aPopup (SW_RES(MN_REDLINE_POPUP)),
sInserted (SW_RES(STR_REDLINE_INSERTED)),
sDeleted (SW_RES(STR_REDLINE_DELETED)),
@@ -156,8 +162,8 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer
bRedlnAutoFmt (bAutoFmt),
bInhibitActivate( false )
{
- aTabPagesCTRL.SetHelpId(HID_REDLINE_CTRL);
- pTPView = aTabPagesCTRL.GetViewPage();
+ aTabPagesCTRL->SetHelpId(HID_REDLINE_CTRL);
+ pTPView = aTabPagesCTRL->GetViewPage();
pTable = pTPView->GetTableControl();
@@ -173,9 +179,9 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer
pTPView->EnableAcceptAll(false);
pTPView->EnableRejectAll(false);
- aTabPagesCTRL.GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl));
+ aTabPagesCTRL->GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl));
- ListBox *pActLB = aTabPagesCTRL.GetFilterPage()->GetLbAction();
+ ListBox *pActLB = aTabPagesCTRL->GetFilterPage()->GetLbAction();
pActLB->InsertEntry(sInserted);
pActLB->InsertEntry(sDeleted);
pActLB->InsertEntry(sFormated);
@@ -215,6 +221,7 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer
SwRedlineAcceptDlg::~SwRedlineAcceptDlg()
{
+ aTabPagesCTRL.disposeAndClear();
}
void SwRedlineAcceptDlg::Init(sal_uInt16 nStart)
@@ -247,7 +254,7 @@ void SwRedlineAcceptDlg::InitAuthors()
{
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
- SvxTPFilter *pFilterPage = aTabPagesCTRL.GetFilterPage();
+ SvxTPFilter *pFilterPage = aTabPagesCTRL->GetFilterPage();
std::vector<OUString> aStrings;
OUString sOldAuthor(pFilterPage->GetSelectedAuthor());
@@ -911,7 +918,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, UndoHdl)
IMPL_LINK_NOARG(SwRedlineAcceptDlg, FilterChangedHdl)
{
- SvxTPFilter *pFilterTP = aTabPagesCTRL.GetFilterPage();
+ SvxTPFilter *pFilterTP = aTabPagesCTRL->GetFilterPage();
if (pFilterTP->IsAction())
sFilterAction = pFilterTP->GetLbAction()->GetSelectEntry();
@@ -1242,7 +1249,13 @@ SwRedlineAcceptPanel::SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno:
SwRedlineAcceptPanel::~SwRedlineAcceptPanel()
{
+ disposeOnce();
+}
+
+void SwRedlineAcceptPanel::dispose()
+{
delete mpImplDlg;
+ PanelLayout::dispose();
}
void SwRedlineAcceptPanel::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
diff --git a/sw/source/uibase/misc/swruler.cxx b/sw/source/uibase/misc/swruler.cxx
index b9d43d094ec1..db2adb767018 100644
--- a/sw/source/uibase/misc/swruler.cxx
+++ b/sw/source/uibase/misc/swruler.cxx
@@ -41,7 +41,7 @@ SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEd
, mpSwWin(pWin)
, mbIsHighlighted(false)
, mnFadeRate(0)
-, maVirDev( *this )
+, maVirDev( VclPtr<VirtualDevice>::Create(*this) )
{
// Set fading timeout: 5 x 40ms = 200ms
maFadeTimer.SetTimeout(40);
@@ -51,6 +51,13 @@ SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEd
// Destructor
SwCommentRuler::~SwCommentRuler()
{
+ disposeOnce();
+}
+
+void SwCommentRuler::dispose()
+{
+ mpSwWin.clear();
+ SvxRuler::dispose();
}
void SwCommentRuler::Paint( const Rectangle& rRect )
@@ -68,25 +75,25 @@ void SwCommentRuler::DrawCommentControl()
bool bIsCollapsed = ! mpViewShell->GetPostItMgr()->ShowNotes();
Rectangle aControlRect = GetCommentControlRegion();
- maVirDev.SetOutputSizePixel( aControlRect.GetSize() );
+ maVirDev->SetOutputSizePixel( aControlRect.GetSize() );
// Paint comment control background
// TODO Check if these are best colors to be used
Color aBgColor = GetFadedColor( rStyleSettings.GetDarkShadowColor(), rStyleSettings.GetWorkspaceColor() );
- maVirDev.SetFillColor( aBgColor );
+ maVirDev->SetFillColor( aBgColor );
if ( mbIsHighlighted || !bIsCollapsed )
{
// Draw borders
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
}
else
{
// No borders
- maVirDev.SetLineColor();
+ maVirDev->SetLineColor();
}
- maVirDev.DrawRect( Rectangle( Point(), aControlRect.GetSize() ) );
+ maVirDev->DrawRect( Rectangle( Point(), aControlRect.GetSize() ) );
// Label and arrow tip
OUString aLabel( SW_RESSTR ( STR_COMMENTS_LABEL ) );
@@ -135,9 +142,9 @@ void SwCommentRuler::DrawCommentControl()
// Draw label
Color aTextColor = GetFadedColor( rStyleSettings.GetButtonTextColor(), rStyleSettings.GetDarkShadowColor() );
- maVirDev.SetTextColor( aTextColor );
+ maVirDev->SetTextColor( aTextColor );
// FIXME Expected font size?
- maVirDev.DrawText( aLabelPos, aLabel );
+ maVirDev->DrawText( aLabelPos, aLabel );
// Draw arrow
// FIXME consistence of button colors. http://opengrok.libreoffice.org/xref/core/vcl/source/control/button.cxx#785
@@ -145,26 +152,26 @@ void SwCommentRuler::DrawCommentControl()
ImplDrawArrow ( aArrowPos.X(), aArrowPos.Y(), aArrowColor, bArrowToRight );
// Blit comment control
- DrawOutDev( aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), maVirDev );
+ DrawOutDev( aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), *maVirDev.get() );
}
void SwCommentRuler::ImplDrawArrow(long nX, long nY, const Color& rColor, bool bPointRight)
{
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( rColor );
+ maVirDev->SetLineColor();
+ maVirDev->SetFillColor( rColor );
if ( bPointRight )
{
- maVirDev.DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) );
- maVirDev.DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) );
- maVirDev.DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) );
- maVirDev.DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) );
+ maVirDev->DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) );
+ maVirDev->DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) );
+ maVirDev->DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) );
+ maVirDev->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) );
}
else
{
- maVirDev.DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) );
- maVirDev.DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) );
- maVirDev.DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) );
- maVirDev.DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) );
+ maVirDev->DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) );
+ maVirDev->DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) );
+ maVirDev->DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) );
+ maVirDev->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) );
}
}
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx
index 981fc7660cdb..c20543cdd59e 100644
--- a/sw/source/uibase/ribbar/inputwin.cxx
+++ b/sw/source/uibase/ribbar/inputwin.cxx
@@ -58,8 +58,8 @@ SFX_IMPL_POS_CHILDWINDOW_WITHID( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OB
SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind )
: ToolBox( pParent , SW_RES( RID_TBX_FORMULA )),
- aPos( this, SW_RES(ED_POS)),
- aEdit( this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION),
+ aPos( VclPtr<Edit>::Create(this, SW_RES(ED_POS))),
+ aEdit( VclPtr<InputEdit>::Create(this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION)),
aPopMenu( SW_RES(MN_CALC_POPUP)),
pMgr(0),
pWrtShell(0),
@@ -75,7 +75,7 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind )
FreeResource();
- aEdit.SetSizePixel( aEdit.CalcMinimumSize() );
+ aEdit->SetSizePixel( aEdit->CalcMinimumSize() );
SfxImageManager* pManager = SfxImageManager::GetImageManager( *SW_MOD() );
pManager->RegisterToolBox(this);
@@ -83,15 +83,15 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind )
pView = ::GetActiveView();
pWrtShell = pView ? pView->GetWrtShellPtr() : 0;
- InsertWindow( ED_POS, &aPos, ToolBoxItemBits::NONE, 0);
+ InsertWindow( ED_POS, aPos.get(), ToolBoxItemBits::NONE, 0);
SetItemText(ED_POS, SW_RESSTR(STR_ACCESS_FORMULA_TYPE));
- aPos.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TYPE));
+ aPos->SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TYPE));
SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TOOLBAR));
InsertSeparator ( 1 );
InsertSeparator ();
- InsertWindow( ED_FORMULA, &aEdit);
+ InsertWindow( ED_FORMULA, aEdit.get());
SetItemText(ED_FORMULA, SW_RESSTR(STR_ACCESS_FORMULA_TEXT));
- aEdit.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TEXT));
+ aEdit->SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TEXT));
SetHelpId(ED_FORMULA, HID_EDIT_FORMULA);
SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC ));
@@ -102,7 +102,7 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind )
SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl ));
Size aSizeTbx = CalcWindowSizePixel();
- Size aEditSize = aEdit.GetSizePixel();
+ Size aEditSize = aEdit->GetSizePixel();
Rectangle aItemRect( GetItemRect(FN_FORMULA_CALC) );
long nMaxHeight = (aEditSize.Height() > aItemRect.GetHeight()) ? aEditSize.Height() : aItemRect.GetHeight();
if( nMaxHeight+2 > aSizeTbx.Height() )
@@ -112,21 +112,26 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind )
SetSizePixel( aSize );
// align edit and item vcentered
- Size aPosSize = aPos.GetSizePixel();
+ Size aPosSize = aPos->GetSizePixel();
aPosSize.Height() = nMaxHeight;
aEditSize.Height() = nMaxHeight;
- Point aPosPos = aPos.GetPosPixel();
- Point aEditPos = aEdit.GetPosPixel();
+ Point aPosPos = aPos->GetPosPixel();
+ Point aEditPos = aEdit->GetPosPixel();
aPosPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1;
aEditPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1;
- aPos.SetPosSizePixel( aPosPos, aPosSize );
- aEdit.SetPosSizePixel( aEditPos, aEditSize );
+ aPos->SetPosSizePixel( aPosPos, aPosSize );
+ aEdit->SetPosSizePixel( aEditPos, aEditSize );
aPopMenu.SetSelectHdl(LINK( this, SwInputWindow, MenuHdl ));
}
SwInputWindow::~SwInputWindow()
{
+ disposeOnce();
+}
+
+void SwInputWindow::dispose()
+{
SfxImageManager::GetImageManager( *SW_MOD() )->ReleaseToolBox(this);
// wake rulers
@@ -140,6 +145,10 @@ SwInputWindow::~SwInputWindow()
pWrtShell->EndSelTblCells();
CleanupUglyHackWithUndo();
+
+ aPos.disposeAndClear();
+ aEdit.disposeAndClear();
+ ToolBox::dispose();
}
void SwInputWindow::CleanupUglyHackWithUndo()
@@ -179,12 +188,12 @@ void SwInputWindow::Resize()
ToolBox::Resize();
long nWidth = GetSizePixel().Width();
- long nLeft = aEdit.GetPosPixel().X();
- Size aEditSize = aEdit.GetSizePixel();
+ long nLeft = aEdit->GetPosPixel().X();
+ Size aEditSize = aEdit->GetSizePixel();
aEditSize.Width() = std::max( ((long)(nWidth - nLeft - 5)), (long)0 );
- aEdit.SetSizePixel( aEditSize );
- aEdit.Invalidate();
+ aEdit->SetSizePixel( aEditSize );
+ aEdit->Invalidate();
}
void SwInputWindow::ShowWin()
@@ -210,11 +219,11 @@ void SwInputWindow::ShowWin()
short nSrch = -1;
while( (nPos = rPos.indexOf( ':',nPos + 1 ) ) != -1 )
nSrch = (short) nPos;
- aPos.SetText( rPos.copy( ++nSrch ) );
+ aPos->SetText( rPos.copy( ++nSrch ) );
aAktTableName = pWrtShell->GetTableFmt()->GetName();
}
else
- aPos.SetText(SW_RESSTR(STR_TBL_FORMULA));
+ aPos->SetText(SW_RESSTR(STR_TBL_FORMULA));
// Edit current field
OSL_ENSURE(pMgr == 0, "FieldManager not deleted");
@@ -273,15 +282,15 @@ void SwInputWindow::ShowWin()
bFirst = false;
- aEdit.SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl ));
+ aEdit->SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl ));
- aEdit.SetText( sEdit );
- aEdit.SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) );
+ aEdit->SetText( sEdit );
+ aEdit->SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) );
sOldFml = sEdit;
- aEdit.Invalidate();
- aEdit.Update();
- aEdit.GrabFocus();
+ aEdit->Invalidate();
+ aEdit->Update();
+ aEdit->GrabFocus();
// For input cut the UserInterface
pView->GetEditWin().LockKeyInput(true);
@@ -326,7 +335,7 @@ static const char * const aStrArr[] = {
{
OUString aTmp( OUString::createFromAscii(aStrArr[nId - 1]) );
aTmp += " ";
- aEdit.ReplaceSelected( aTmp );
+ aEdit->ReplaceSelected( aTmp );
}
return 0;
}
@@ -376,7 +385,7 @@ void SwInputWindow::ApplyFormula()
pWrtShell->Pop( false );
// Formular should always begin with "=", so remove it here again
- OUString sEdit(comphelper::string::strip(aEdit.GetText(), ' '));
+ OUString sEdit(comphelper::string::strip(aEdit->GetText(), ' '));
if( !sEdit.isEmpty() && '=' == sEdit[0] )
sEdit = sEdit.copy( 1 );
SfxStringItem aParam(FN_EDIT_FORMULA, sEdit);
@@ -422,11 +431,11 @@ IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller )
if( pTblFmt && aAktTableName != pTblFmt->GetName() )
sTblNm = pTblFmt->GetName();
- aEdit.UpdateRange( sBoxNms, sTblNm );
+ aEdit->UpdateRange( sBoxNms, sTblNm );
OUString sNew;
sNew += OUString(CH_LRE);
- sNew += aEdit.GetText();
+ sNew += aEdit->GetText();
sNew += OUString(CH_PDF);
if( sNew != sOldFml )
@@ -449,7 +458,7 @@ IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller )
}
}
else
- aEdit.GrabFocus();
+ aEdit->GrabFocus();
return 0;
}
@@ -463,9 +472,9 @@ void SwInputWindow::SetFormula( const OUString& rFormula, bool bDelFlag )
else
sEdit += rFormula;
}
- aEdit.SetText( sEdit );
- aEdit.SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) );
- aEdit.Invalidate();
+ aEdit->SetText( sEdit );
+ aEdit->SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) );
+ aEdit->Invalidate();
bDelSel = bDelFlag;
}
@@ -477,7 +486,7 @@ IMPL_LINK_NOARG(SwInputWindow, ModifyHdl)
DelBoxCntnt();
OUString sNew;
sNew += OUString(CH_LRE);
- sNew += aEdit.GetText();
+ sNew += aEdit->GetText();
sNew += OUString(CH_PDF);
pWrtShell->SwEditShell::Insert2( sNew );
pWrtShell->EndAllAction();
@@ -616,8 +625,8 @@ SwInputChild::SwInputChild(vcl::Window* _pParent,
SfxChildWindow( _pParent, nId )
{
pDispatch = pBindings->GetDispatcher();
- pWindow = new SwInputWindow( _pParent, pBindings );
- static_cast<SwInputWindow*>(pWindow)->ShowWin();
+ pWindow = VclPtr<SwInputWindow>::Create( _pParent, pBindings );
+ static_cast<SwInputWindow*>(pWindow.get())->ShowWin();
eChildAlignment = SfxChildAlignment::LOWESTTOP;
}
diff --git a/sw/source/uibase/ribbar/tblctrl.cxx b/sw/source/uibase/ribbar/tblctrl.cxx
index b56e892c0da4..bcdc852aa382 100644
--- a/sw/source/uibase/ribbar/tblctrl.cxx
+++ b/sw/source/uibase/ribbar/tblctrl.cxx
@@ -41,7 +41,7 @@ SwTableOptimizeCtrl::~SwTableOptimizeCtrl()
{
}
-SfxPopupWindow* SwTableOptimizeCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTableOptimizeCtrl::CreatePopupWindow()
{
createAndPositionSubToolBar("private:resource/toolbar/optimizetablebar");
return NULL;
diff --git a/sw/source/uibase/ribbar/tbxanchr.cxx b/sw/source/uibase/ribbar/tbxanchr.cxx
index 1b747b16daa9..b25dd8aa1b56 100644
--- a/sw/source/uibase/ribbar/tbxanchr.cxx
+++ b/sw/source/uibase/ribbar/tbxanchr.cxx
@@ -62,7 +62,7 @@ void SwTbxAnchor::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const
}
-SfxPopupWindow* SwTbxAnchor::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTbxAnchor::CreatePopupWindow()
{
SwTbxAnchor::Click();
return 0;
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index b04dd47f240e..ed6208ca7c06 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -122,7 +122,7 @@ void SwTbxInsertCtrl::StateChanged( sal_uInt16 /*nSID*/,
}
-SfxPopupWindow* SwTbxInsertCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTbxInsertCtrl::CreatePopupWindow()
{
if(GetSlotId() == FN_INSERT_CTRL)
{
@@ -176,7 +176,7 @@ SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl()
DelPopup();
}
-SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow()
{
SwView* pView = ::GetActiveView();
if(pView && !pView->GetDocShell()->IsReadOnly() &&
@@ -288,7 +288,7 @@ SwTbxFieldCtrl::~SwTbxFieldCtrl()
{
}
-SfxPopupWindow* SwTbxFieldCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTbxFieldCtrl::CreatePopupWindow()
{
SwView* pView = ::GetActiveView();
if(pView && !pView->GetDocShell()->IsReadOnly() &&
@@ -398,7 +398,7 @@ SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >&
"modules/swriter/ui/floatingnavigation.ui", rFrame),
aIList(SW_RES(IL_VALUES))
{
- m_pToolBox = new SwScrollNaviToolBox(get<vcl::Window>("box"), this, 0);
+ m_pToolBox = VclPtr<SwScrollNaviToolBox>::Create(get<vcl::Window>("box"), this, 0);
get(m_pInfoField, "label");
sal_uInt16 i;
@@ -448,7 +448,14 @@ SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >&
SwScrollNaviPopup::~SwScrollNaviPopup()
{
- delete m_pToolBox;
+ disposeOnce();
+}
+
+void SwScrollNaviPopup::dispose()
+{
+ m_pToolBox.disposeAndClear();
+ m_pInfoField.clear();
+ SfxPopupWindow::dispose();
}
void SwScrollNaviPopup::DataChanged( const DataChangedEvent& rDCEvt )
@@ -470,9 +477,9 @@ void SwScrollNaviPopup::ApplyImageList()
}
}
-SfxPopupWindow* SwScrollNaviPopup::Clone() const
+VclPtr<SfxPopupWindow> SwScrollNaviPopup::Clone() const
{
- return new SwScrollNaviPopup( GetId(), GetFrame(), GetParent() );
+ return VclPtr<SwScrollNaviPopup>::Create( GetId(), GetFrame(), GetParent() );
}
IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet)
@@ -503,6 +510,17 @@ IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet)
return 0;
}
+SwScrollNaviToolBox::~SwScrollNaviToolBox()
+{
+ disposeOnce();
+}
+
+void SwScrollNaviToolBox::dispose()
+{
+ m_pNaviPopup.disposeAndClear();
+ ToolBox::dispose();
+}
+
void SwScrollNaviToolBox::MouseButtonUp( const MouseEvent& rMEvt )
{
ToolBox::MouseButtonUp(rMEvt);
@@ -515,7 +533,6 @@ void SwScrollNaviToolBox::RequestHelp( const HelpEvent& rHEvt )
SetItemText(NID_NEXT, SwScrollNaviPopup::GetQuickHelpText(true));
SetItemText(NID_PREV, SwScrollNaviPopup::GetQuickHelpText(false));
ToolBox::RequestHelp( rHEvt );
-
}
OUString SwScrollNaviPopup::GetQuickHelpText(bool bNext)
@@ -699,10 +716,10 @@ void SwPreviewZoomControl::StateChanged( sal_uInt16 /*nSID*/,
}
}
-vcl::Window* SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent )
+VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent )
{
- SwZoomBox_Impl* pRet = new SwZoomBox_Impl( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ));
- return pRet;
+ VclPtrInstance<SwZoomBox_Impl> pRet( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ));
+ return pRet.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index effa9f4b31aa..7823ca126637 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -163,19 +163,19 @@ void SwGrfShell::Execute(SfxRequest &rReq)
Graphic aGraphic = Graphic( *pGraphic );
- CompressGraphicsDialog aDialog( GetView().GetWindow(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings() );
- if( aDialog.Execute() == RET_OK )
+ ScopedVclPtrInstance< CompressGraphicsDialog > aDialog( GetView().GetWindow(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings() );
+ if( aDialog->Execute() == RET_OK )
{
rSh.StartAllAction();
rSh.StartUndo(UNDO_START);
- Rectangle aScaledCropedRectangle = aDialog.GetScaledCropRectangle();
+ Rectangle aScaledCropedRectangle = aDialog->GetScaledCropRectangle();
aCrop.SetLeft( convertMm100ToTwip( aScaledCropedRectangle.Left() ));
aCrop.SetTop( convertMm100ToTwip( aScaledCropedRectangle.Top() ));
aCrop.SetRight( convertMm100ToTwip( aScaledCropedRectangle.Right() ));
aCrop.SetBottom( convertMm100ToTwip( aScaledCropedRectangle.Bottom() ));
- Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() );
+ Graphic aCompressedGraphic( aDialog->GetCompressedGraphic() );
rSh.ReRead(OUString(), OUString(), (const Graphic*) &aCompressedGraphic);
rSh.SetAttrItem(aCrop);
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 0631eced063e..ead7b165eb21 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -738,9 +738,9 @@ void SwTableShell::Execute(SfxRequest &rReq)
break;
case TBLMERGE_TOOCOMPLEX:
{
- MessageDialog aInfoBox( GetView().GetWindow(),
+ ScopedVclPtrInstance<MessageDialog> aInfoBox( GetView().GetWindow(),
SW_RES( STR_ERR_TABLE_MERGE ), VCL_MESSAGE_INFO );
- aInfoBox.Execute();
+ aInfoBox->Execute();
break;
}
default:
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 3c268fc3908e..0c0ed9b481da 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -257,23 +257,23 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
static short lcl_AskRedlineMode(vcl::Window *pWin)
{
- MessBox aQBox( pWin, 0,
+ ScopedVclPtrInstance<MessBox> aQBox( pWin, 0,
OUString( SW_RES( STR_REDLINE_TITLE ) ),
OUString( SW_RES( STR_REDLINE_MSG ) ) );
- aQBox.SetImage( QueryBox::GetStandardImage() );
+ aQBox->SetImage( QueryBox::GetStandardImage() );
const sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON |
BUTTONDIALOG_OKBUTTON |
BUTTONDIALOG_FOCUSBUTTON;
- aQBox.AddButton(OUString(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags);
- aQBox.GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
- aQBox.AddButton(OUString(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
- aQBox.GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT );
- aQBox.AddButton(OUString(SW_RES(STR_REDLINE_EDIT)), 2, 0);
- aQBox.GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
- aQBox.SetButtonHelpText( RET_OK, OUString() );
+ aQBox->AddButton(OUString(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags);
+ aQBox->GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
+ aQBox->AddButton(OUString(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
+ aQBox->GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT );
+ aQBox->AddButton(OUString(SW_RES(STR_REDLINE_EDIT)), 2, 0);
+ aQBox->GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
+ aQBox->SetButtonHelpText( RET_OK, OUString() );
- return aQBox.Execute();
+ return aQBox->Execute();
}
void SwTextShell::Execute(SfxRequest &rReq)
diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx
index 17015b256823..cd61fd1b1ec9 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -54,6 +54,7 @@
#include <shells.hrc>
#include <SwStyleNameMapper.hxx>
#include "swabstdlg.hxx"
+#include "outline.hxx"
#include "chrdlg.hrc"
#include <boost/scoped_ptr.hpp>
diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx
index 2b28820e2b91..d7b857162f2f 100644
--- a/sw/source/uibase/shells/txtcrsr.cxx
+++ b/sw/source/uibase/shells/txtcrsr.cxx
@@ -43,6 +43,7 @@
#include <svx/svdouno.hxx>
#include <svx/fmshell.hxx>
#include <svx/sdrobjectfilter.hxx>
+#include "outline.hxx"
using namespace ::com::sun::star;
diff --git a/sw/source/uibase/sidebar/PageColumnControl.cxx b/sw/source/uibase/sidebar/PageColumnControl.cxx
index a8aa1223d6d7..4bec55f89fc3 100644
--- a/sw/source/uibase/sidebar/PageColumnControl.cxx
+++ b/sw/source/uibase/sidebar/PageColumnControl.cxx
@@ -38,7 +38,7 @@ PageColumnControl::PageColumnControl(
const bool bLandscape )
: ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) )
, mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) )
- , maMoreButton( this, SW_RES(CB_COLUMN_MORE) )
+ , maMoreButton( VclPtr<PushButton>::Create( this, SW_RES(CB_COLUMN_MORE) ) )
, mnColumnType( nColumnType )
, mrPagePropPanel(rPanel)
{
@@ -69,15 +69,22 @@ PageColumnControl::PageColumnControl(
mpColumnValueSet->Format();
mpColumnValueSet->StartSelection();
- maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) );
- maMoreButton.GrabFocus();
+ maMoreButton->SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) );
+ maMoreButton->GrabFocus();
FreeResource();
}
PageColumnControl::~PageColumnControl()
{
- delete mpColumnValueSet;
+ disposeOnce();
+}
+
+void PageColumnControl::dispose()
+{
+ mpColumnValueSet.disposeAndClear();
+ maMoreButton.disposeAndClear();
+ ::svx::sidebar::PopupControl::dispose();
}
IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl)
diff --git a/sw/source/uibase/sidebar/PageColumnControl.hxx b/sw/source/uibase/sidebar/PageColumnControl.hxx
index 508951a09670..79e22ccfd40f 100644
--- a/sw/source/uibase/sidebar/PageColumnControl.hxx
+++ b/sw/source/uibase/sidebar/PageColumnControl.hxx
@@ -45,10 +45,11 @@ public:
const bool bLandscape );
virtual ~PageColumnControl();
+ virtual void dispose() SAL_OVERRIDE;
private:
- ::svx::sidebar::ValueSetWithTextControl* mpColumnValueSet;
- PushButton maMoreButton;
+ VclPtr<::svx::sidebar::ValueSetWithTextControl> mpColumnValueSet;
+ VclPtr<PushButton> maMoreButton;
sal_uInt16 mnColumnType;
diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx
index 4760baecfeaf..aee46d43e074 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.cxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.cxx
@@ -50,18 +50,18 @@ PageMarginControl::PageMarginControl(
const SfxMapUnit eUnit )
: ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) )
, mpMarginValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) )
- , maCustom(this, SW_RES(FT_CUSTOM))
- , maLeft(this, SW_RES(FT_LEFT))
- , maInner(this, SW_RES(FT_INNER))
- , maLeftMarginEdit(this, SW_RES(MF_SWLEFT_MARGIN))
- , maRight(this, SW_RES(FT_RIGHT))
- , maOuter(this, SW_RES(FT_OUTER))
- , maRightMarginEdit(this, SW_RES(MF_SWRIGHT_MARGIN))
- , maTop(this, SW_RES(FT_TOP))
- , maTopMarginEdit(this, SW_RES(MF_SWTOP_MARGIN))
- , maBottom(this, SW_RES(FT_BOTTOM))
- , maBottomMarginEdit(this, SW_RES(MF_SWBOTTOM_MARGIN))
- , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) )
+ , maCustom(VclPtr<FixedText>::Create(this, SW_RES(FT_CUSTOM)))
+ , maLeft(VclPtr<FixedText>::Create(this, SW_RES(FT_LEFT)))
+ , maInner(VclPtr<FixedText>::Create(this, SW_RES(FT_INNER)))
+ , maLeftMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWLEFT_MARGIN)))
+ , maRight(VclPtr<FixedText>::Create(this, SW_RES(FT_RIGHT)))
+ , maOuter(VclPtr<FixedText>::Create(this, SW_RES(FT_OUTER)))
+ , maRightMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWRIGHT_MARGIN)))
+ , maTop(VclPtr<FixedText>::Create(this, SW_RES(FT_TOP)))
+ , maTopMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWTOP_MARGIN)))
+ , maBottom(VclPtr<FixedText>::Create(this, SW_RES(FT_BOTTOM)))
+ , maBottomMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWBOTTOM_MARGIN)))
+ , maWidthHeightField(VclPtr<MetricField>::Create( this, SW_RES(FLD_WIDTH_HEIGHT) ) )
, mnPageLeftMargin( aPageLRMargin.GetLeft() )
, mnPageRightMargin( aPageLRMargin.GetRight() )
, mnPageTopMargin( aPageULMargin.GetUpper() )
@@ -77,8 +77,8 @@ PageMarginControl::PageMarginControl(
, mbCustomValuesUsed( false )
, mrPagePropPanel(rPanel)
{
- maWidthHeightField.Hide();
- SetFieldUnit( maWidthHeightField, eFUnit );
+ maWidthHeightField->Hide();
+ SetFieldUnit( *maWidthHeightField.get(), eFUnit );
mbUserCustomValuesAvailable = GetUserCustomValues();
@@ -93,39 +93,39 @@ PageMarginControl::PageMarginControl(
SelectValueSetItem();
- SetFieldUnit( maLeftMarginEdit, eFUnit );
+ SetFieldUnit( *maLeftMarginEdit.get(), eFUnit );
Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
- maLeftMarginEdit.SetModifyHdl( aLinkLR );
- SetMetricValue( maLeftMarginEdit, mnPageLeftMargin, meUnit );
+ maLeftMarginEdit->SetModifyHdl( aLinkLR );
+ SetMetricValue( *maLeftMarginEdit.get(), mnPageLeftMargin, meUnit );
- SetFieldUnit( maRightMarginEdit, eFUnit );
- maRightMarginEdit.SetModifyHdl( aLinkLR );
- SetMetricValue( maRightMarginEdit, mnPageRightMargin, meUnit );
+ SetFieldUnit( *maRightMarginEdit.get(), eFUnit );
+ maRightMarginEdit->SetModifyHdl( aLinkLR );
+ SetMetricValue( *maRightMarginEdit.get(), mnPageRightMargin, meUnit );
Link aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl );
- SetFieldUnit( maTopMarginEdit, eFUnit );
- maTopMarginEdit.SetModifyHdl( aLinkUL );
- SetMetricValue( maTopMarginEdit, mnPageTopMargin, meUnit );
+ SetFieldUnit( *maTopMarginEdit.get(), eFUnit );
+ maTopMarginEdit->SetModifyHdl( aLinkUL );
+ SetMetricValue( *maTopMarginEdit.get(), mnPageTopMargin, meUnit );
- SetFieldUnit( maBottomMarginEdit, eFUnit );
- maBottomMarginEdit.SetModifyHdl( aLinkUL );
- SetMetricValue( maBottomMarginEdit, mnPageBottomMargin, meUnit );
+ SetFieldUnit( *maBottomMarginEdit.get(), eFUnit );
+ maBottomMarginEdit->SetModifyHdl( aLinkUL );
+ SetMetricValue( *maBottomMarginEdit.get(), mnPageBottomMargin, meUnit );
SetMetricFieldMaxValues(rPageSize);
if ( mbMirrored )
{
- maLeft.Hide();
- maRight.Hide();
- maInner.Show();
- maOuter.Show();
+ maLeft->Hide();
+ maRight->Hide();
+ maInner->Show();
+ maOuter->Show();
}
else
{
- maLeft.Show();
- maRight.Show();
- maInner.Hide();
- maOuter.Hide();
+ maLeft->Show();
+ maRight->Show();
+ maInner->Hide();
+ maOuter->Hide();
}
FreeResource();
@@ -133,36 +133,55 @@ PageMarginControl::PageMarginControl(
PageMarginControl::~PageMarginControl()
{
- delete mpMarginValueSet;
+ disposeOnce();
+}
+
+void PageMarginControl::dispose()
+{
+ mpMarginValueSet.disposeAndClear();
StoreUserCustomValues();
+
+ maCustom.disposeAndClear();
+ maLeft.disposeAndClear();
+ maInner.disposeAndClear();
+ maLeftMarginEdit.disposeAndClear();
+ maRight.disposeAndClear();
+ maOuter.disposeAndClear();
+ maRightMarginEdit.disposeAndClear();
+ maTop.disposeAndClear();
+ maTopMarginEdit.disposeAndClear();
+ maBottom.disposeAndClear();
+ maBottomMarginEdit.disposeAndClear();
+ maWidthHeightField.disposeAndClear();
+ ::svx::sidebar::PopupControl::dispose();
}
void PageMarginControl::SetMetricFieldMaxValues(const Size& rPageSize)
{
- const long nML = maLeftMarginEdit.Denormalize( maLeftMarginEdit.GetValue(FUNIT_TWIP) );
- const long nMR = maRightMarginEdit.Denormalize( maRightMarginEdit.GetValue(FUNIT_TWIP) );
- const long nMT = maTopMarginEdit.Denormalize(maTopMarginEdit.GetValue(FUNIT_TWIP) );
- const long nMB = maBottomMarginEdit.Denormalize( maBottomMarginEdit.GetValue(FUNIT_TWIP) );
+ const long nML = maLeftMarginEdit->Denormalize( maLeftMarginEdit->GetValue(FUNIT_TWIP) );
+ const long nMR = maRightMarginEdit->Denormalize( maRightMarginEdit->GetValue(FUNIT_TWIP) );
+ const long nMT = maTopMarginEdit->Denormalize(maTopMarginEdit->GetValue(FUNIT_TWIP) );
+ const long nMB = maBottomMarginEdit->Denormalize( maBottomMarginEdit->GetValue(FUNIT_TWIP) );
const long nPH = LogicToLogic( rPageSize.Height(), (MapUnit)meUnit, MAP_TWIP );
const long nPW = LogicToLogic( rPageSize.Width(), (MapUnit)meUnit, MAP_TWIP );
// Left
long nMax = nPW - nMR - MINBODY;
- maLeftMarginEdit.SetMax(maLeftMarginEdit.Normalize(nMax), FUNIT_TWIP);
+ maLeftMarginEdit->SetMax(maLeftMarginEdit->Normalize(nMax), FUNIT_TWIP);
// Right
nMax = nPW - nML - MINBODY;
- maRightMarginEdit.SetMax(maRightMarginEdit.Normalize(nMax), FUNIT_TWIP);
+ maRightMarginEdit->SetMax(maRightMarginEdit->Normalize(nMax), FUNIT_TWIP);
//Top
nMax = nPH - nMB - MINBODY;
- maTopMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
+ maTopMarginEdit->SetMax(maTopMarginEdit->Normalize(nMax), FUNIT_TWIP);
//Bottom
nMax = nPH - nMT - MINBODY;
- maBottomMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
+ maBottomMarginEdit->SetMax(maTopMarginEdit->Normalize(nMax), FUNIT_TWIP);
}
void PageMarginControl::FillValueSet(
@@ -174,8 +193,8 @@ void PageMarginControl::FillValueSet(
const OUString aTop = SW_RESSTR(STR_MARGIN_TOOLTIP_TOP);
const OUString aBottom = SW_RESSTR(STR_MARGIN_TOOLTIP_BOT);
- SetMetricValue( maWidthHeightField, SWPAGE_NARROW_VALUE, meUnit );
- const OUString aNarrowValText = maWidthHeightField.GetText();
+ SetMetricValue( *maWidthHeightField.get(), SWPAGE_NARROW_VALUE, meUnit );
+ const OUString aNarrowValText = maWidthHeightField->GetText();
OUString aHelpText = aLeft;
aHelpText += aNarrowValText;
aHelpText += aRight;
@@ -188,8 +207,8 @@ void PageMarginControl::FillValueSet(
Image((bLandscape) ? SW_RES(IMG_NARROW_L) : SW_RES(IMG_NARROW)), 0,
SW_RESSTR(STR_NARROW), &aHelpText );
- SetMetricValue( maWidthHeightField, SWPAGE_NORMAL_VALUE, meUnit );
- const OUString aNormalValText = maWidthHeightField.GetText();
+ SetMetricValue( *maWidthHeightField.get(), SWPAGE_NORMAL_VALUE, meUnit );
+ const OUString aNormalValText = maWidthHeightField->GetText();
aHelpText = aLeft;
aHelpText += aNormalValText;
aHelpText += aRight;
@@ -202,10 +221,10 @@ void PageMarginControl::FillValueSet(
Image((bLandscape) ? SW_RES(IMG_NORMAL_L) : SW_RES(IMG_NORMAL)), 0,
SW_RESSTR(STR_NORMAL), &aHelpText );
- SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE1, meUnit );
- const OUString aWide1ValText = maWidthHeightField.GetText();
- SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE2, meUnit );
- const OUString aWide2ValText = maWidthHeightField.GetText();
+ SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE1, meUnit );
+ const OUString aWide1ValText = maWidthHeightField->GetText();
+ SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE2, meUnit );
+ const OUString aWide2ValText = maWidthHeightField->GetText();
aHelpText = aLeft;
aHelpText += aWide2ValText;
aHelpText += aRight;
@@ -221,8 +240,8 @@ void PageMarginControl::FillValueSet(
const OUString aInner = SW_RESSTR(STR_MARGIN_TOOLTIP_INNER);
const OUString aOuter = SW_RESSTR(STR_MARGIN_TOOLTIP_OUTER);
- SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE3, meUnit );
- const OUString aWide3ValText = maWidthHeightField.GetText();
+ SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE3, meUnit );
+ const OUString aWide3ValText = maWidthHeightField->GetText();
aHelpText = aInner;
aHelpText += aWide3ValText;
aHelpText += aOuter;
@@ -238,17 +257,17 @@ void PageMarginControl::FillValueSet(
if ( bUserCustomValuesAvailable )
{
aHelpText = mbUserCustomMirrored ? aInner : aLeft;
- SetMetricValue( maWidthHeightField, mnUserCustomPageLeftMargin, meUnit );
- aHelpText += maWidthHeightField.GetText();
+ SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageLeftMargin, meUnit );
+ aHelpText += maWidthHeightField->GetText();
aHelpText += mbUserCustomMirrored ? aOuter : aRight;
- SetMetricValue( maWidthHeightField, mnUserCustomPageRightMargin, meUnit );
- aHelpText += maWidthHeightField.GetText();
+ SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageRightMargin, meUnit );
+ aHelpText += maWidthHeightField->GetText();
aHelpText += aTop;
- SetMetricValue( maWidthHeightField, mnUserCustomPageTopMargin, meUnit );
- aHelpText += maWidthHeightField.GetText();
+ SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageTopMargin, meUnit );
+ aHelpText += maWidthHeightField->GetText();
aHelpText += aBottom;
- SetMetricValue( maWidthHeightField, mnUserCustomPageBottomMargin, meUnit );
- aHelpText += maWidthHeightField.GetText();
+ SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageBottomMargin, meUnit );
+ aHelpText += maWidthHeightField->GetText();
}
else
{
@@ -389,8 +408,8 @@ IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG )
mpMarginValueSet->Format();
mpMarginValueSet->StartSelection();
- mnPageLeftMargin = GetCoreValue( maLeftMarginEdit, meUnit );
- mnPageRightMargin = GetCoreValue( maRightMarginEdit, meUnit );
+ mnPageLeftMargin = GetCoreValue( *maLeftMarginEdit.get(), meUnit );
+ mnPageRightMargin = GetCoreValue( *maRightMarginEdit.get(), meUnit );
mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
mbCustomValuesUsed = true;
return 0;
@@ -403,8 +422,8 @@ IMPL_LINK( PageMarginControl, ModifyULMarginHdl, MetricField *, EMPTYARG )
mpMarginValueSet->Format();
mpMarginValueSet->StartSelection();
- mnPageTopMargin = GetCoreValue( maTopMarginEdit, meUnit );
- mnPageBottomMargin = GetCoreValue( maBottomMarginEdit, meUnit );
+ mnPageTopMargin = GetCoreValue( *maTopMarginEdit.get(), meUnit );
+ mnPageBottomMargin = GetCoreValue( *maBottomMarginEdit.get(), meUnit );
mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
mbCustomValuesUsed = true;
return 0;
diff --git a/sw/source/uibase/sidebar/PageMarginControl.hxx b/sw/source/uibase/sidebar/PageMarginControl.hxx
index 6a0af3c4bea0..f6d8d28cef61 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.hxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.hxx
@@ -61,24 +61,25 @@ public:
const FieldUnit eFUnit,
const SfxMapUnit eUnit );
virtual ~PageMarginControl();
+ virtual void dispose() SAL_OVERRIDE;
private:
- ::svx::sidebar::ValueSetWithTextControl* mpMarginValueSet;
-
- FixedText maCustom;
- FixedText maLeft;
- FixedText maInner;
- MetricField maLeftMarginEdit;
- FixedText maRight;
- FixedText maOuter;
- MetricField maRightMarginEdit;
- FixedText maTop;
- MetricField maTopMarginEdit;
- FixedText maBottom;
- MetricField maBottomMarginEdit;
+ VclPtr<::svx::sidebar::ValueSetWithTextControl> mpMarginValueSet;
+
+ VclPtr<FixedText> maCustom;
+ VclPtr<FixedText> maLeft;
+ VclPtr<FixedText> maInner;
+ VclPtr<MetricField> maLeftMarginEdit;
+ VclPtr<FixedText> maRight;
+ VclPtr<FixedText> maOuter;
+ VclPtr<MetricField> maRightMarginEdit;
+ VclPtr<FixedText> maTop;
+ VclPtr<MetricField> maTopMarginEdit;
+ VclPtr<FixedText> maBottom;
+ VclPtr<MetricField> maBottomMarginEdit;
// hidden metric field
- MetricField maWidthHeightField;
+ VclPtr<MetricField> maWidthHeightField;
long mnPageLeftMargin;
long mnPageRightMargin;
diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx b/sw/source/uibase/sidebar/PageOrientationControl.cxx
index 105eecccf13b..9e1b284a7328 100644
--- a/sw/source/uibase/sidebar/PageOrientationControl.cxx
+++ b/sw/source/uibase/sidebar/PageOrientationControl.cxx
@@ -63,7 +63,13 @@ PageOrientationControl::PageOrientationControl(
PageOrientationControl::~PageOrientationControl()
{
- delete mpOrientationValueSet;
+ disposeOnce();
+}
+
+void PageOrientationControl::dispose()
+{
+ mpOrientationValueSet.disposeAndClear();
+ ::svx::sidebar::PopupControl::dispose();
}
IMPL_LINK(PageOrientationControl, ImplOrientationHdl, void *, pControl)
diff --git a/sw/source/uibase/sidebar/PageOrientationControl.hxx b/sw/source/uibase/sidebar/PageOrientationControl.hxx
index 15d7e785b2cc..2bf1f6773e72 100644
--- a/sw/source/uibase/sidebar/PageOrientationControl.hxx
+++ b/sw/source/uibase/sidebar/PageOrientationControl.hxx
@@ -38,9 +38,10 @@ public:
PagePropertyPanel& rPanel,
const bool bLandscape );
virtual ~PageOrientationControl();
+ virtual void dispose() SAL_OVERRIDE;
private:
- ::svx::sidebar::ValueSetWithTextControl* mpOrientationValueSet;
+ VclPtr<::svx::sidebar::ValueSetWithTextControl> mpOrientationValueSet;
bool mbLandscape;
diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.cxx b/sw/source/uibase/sidebar/PagePropertyPanel.cxx
index ed4a66aeb3b1..48c7b5af3a2c 100644
--- a/sw/source/uibase/sidebar/PagePropertyPanel.cxx
+++ b/sw/source/uibase/sidebar/PagePropertyPanel.cxx
@@ -83,7 +83,7 @@ namespace {
namespace sw { namespace sidebar {
-PagePropertyPanel* PagePropertyPanel::Create (
+VclPtr<vcl::Window> PagePropertyPanel::Create (
vcl::Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
@@ -95,10 +95,13 @@ PagePropertyPanel* PagePropertyPanel::Create (
if (pBindings == NULL)
throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2);
- return new PagePropertyPanel(
- pParent,
- rxFrame,
- pBindings);
+ return VclPtr<vcl::Window>(
+ VclPtr<PagePropertyPanel>::Create(
+
+ pParent,
+ rxFrame,
+ pBindings),
+ SAL_NO_ACQUIRE);
}
PagePropertyPanel::PagePropertyPanel(
@@ -200,8 +203,34 @@ PagePropertyPanel::PagePropertyPanel(
PagePropertyPanel::~PagePropertyPanel()
{
+ disposeOnce();
+}
+
+void PagePropertyPanel::dispose()
+{
delete[] maImgSize;
+ maImgSize = NULL;
delete[] maImgSize_L;
+ maImgSize_L = NULL;
+
+ mpPageItem.reset();
+ mpPageLRMarginItem.reset();
+ mpPageULMarginItem.reset();
+ mpPageSizeItem.reset();
+
+ mpToolBoxOrientation.clear();
+ mpToolBoxMargin.clear();
+ mpToolBoxSize.clear();
+ mpToolBoxColumn.clear();
+
+ m_aSwPagePgULControl.dispose();
+ m_aSwPagePgLRControl.dispose();
+ m_aSwPagePgSizeControl.dispose();
+ m_aSwPagePgControl.dispose();
+ m_aSwPageColControl.dispose();
+ m_aSwPagePgMetricControl.dispose();
+
+ PanelLayout::dispose();
}
void PagePropertyPanel::Initialize()
@@ -266,9 +295,9 @@ void PagePropertyPanel::Initialize()
mpBindings->Update( SID_ATTR_PAGE_SIZE );
}
-::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent )
+VclPtr<::svx::sidebar::PopupControl> PagePropertyPanel::CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent )
{
- return new PageOrientationControl( pParent, *this , mpPageItem->IsLandscape() );
+ return VclPtr<PageOrientationControl>::Create( pParent, *this , mpPageItem->IsLandscape() );
}
IMPL_LINK( PagePropertyPanel, ClickOrientationHdl, ToolBox*, pToolBox )
@@ -343,9 +372,10 @@ void PagePropertyPanel::ClosePageOrientationPopup()
maOrientationPopup.Hide();
}
-::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent )
+VclPtr<::svx::sidebar::PopupControl> PagePropertyPanel::CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent )
{
- return new PageMarginControl(
+ return VclPtr<PageMarginControl>::Create(
+
pParent,
*this,
*mpPageLRMarginItem.get(),
@@ -393,9 +423,10 @@ void PagePropertyPanel::ClosePageMarginPopup()
maMarginPopup.Hide();
}
-::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent )
+VclPtr<::svx::sidebar::PopupControl> PagePropertyPanel::CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent )
{
- return new PageSizeControl(
+ return VclPtr<PageSizeControl>::Create(
+
pParent,
*this,
mePaper,
@@ -427,9 +458,10 @@ void PagePropertyPanel::ClosePageSizePopup()
maSizePopup.Hide();
}
-::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent )
+VclPtr<::svx::sidebar::PopupControl> PagePropertyPanel::CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent )
{
- return new PageColumnControl(
+ return VclPtr<PageColumnControl>::Create(
+
pParent,
*this,
mpPageColumnTypeItem->GetValue(),
@@ -462,6 +494,9 @@ void PagePropertyPanel::NotifyItemUpdate(
{
(void)bIsEnabled;
+ if (IsDisposed())
+ return;
+
switch( nSId )
{
case SID_ATTR_PAGE_COLUMN:
diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.hxx b/sw/source/uibase/sidebar/PagePropertyPanel.hxx
index 68e3bb3c074d..05119bf2b34a 100644
--- a/sw/source/uibase/sidebar/PagePropertyPanel.hxx
+++ b/sw/source/uibase/sidebar/PagePropertyPanel.hxx
@@ -55,7 +55,7 @@ namespace sw { namespace sidebar {
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static PagePropertyPanel* Create(
+ static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
SfxBindings* pBindings );
@@ -72,11 +72,11 @@ namespace sw { namespace sidebar {
return mpBindings;
}
- ::svx::sidebar::PopupControl* CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent );
+ VclPtr<::svx::sidebar::PopupControl> CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent );
void ExecuteOrientationChange( const bool bLandscape );
void ClosePageOrientationPopup();
- ::svx::sidebar::PopupControl* CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent );
+ VclPtr<::svx::sidebar::PopupControl> CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent );
void ExecuteMarginLRChange(
const long nPageLeftMargin,
const long nPageRightMargin );
@@ -86,31 +86,32 @@ namespace sw { namespace sidebar {
void ExecutePageLayoutChange( const bool bMirrored );
void ClosePageMarginPopup();
- ::svx::sidebar::PopupControl* CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent );
+ VclPtr<::svx::sidebar::PopupControl> CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent );
void ExecuteSizeChange( const Paper ePaper );
void ClosePageSizePopup();
- ::svx::sidebar::PopupControl* CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent );
+ VclPtr<::svx::sidebar::PopupControl> CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent );
void ExecuteColumnChange( const sal_uInt16 nColumnType );
void ClosePageColumnPopup();
void StartUndo();
void EndUndo();
- private:
PagePropertyPanel(
vcl::Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
SfxBindings* pBindings );
+ private:
virtual ~PagePropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
SfxBindings* mpBindings;
// toolboxes - on click open corresponding popup
- ToolBox* mpToolBoxOrientation;
- ToolBox* mpToolBoxMargin;
- ToolBox* mpToolBoxSize;
- ToolBox* mpToolBoxColumn;
+ VclPtr<ToolBox> mpToolBoxOrientation;
+ VclPtr<ToolBox> mpToolBoxMargin;
+ VclPtr<ToolBox> mpToolBoxSize;
+ VclPtr<ToolBox> mpToolBoxColumn;
Image* maImgSize;
Image* maImgSize_L;
diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx
index dedc35530ce8..bc9c0b9be335 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.cxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.cxx
@@ -43,14 +43,14 @@ PageSizeControl::PageSizeControl(
const FieldUnit eFUnit )
: ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_SIZE) )
, mpSizeValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::TEXT_TEXT, this, SW_RES(VS_SIZE) ) )
- , maMoreButton( this, SW_RES(CB_SIZE_MORE) )
- , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) )
+ , maMoreButton( VclPtr<PushButton>::Create( this, SW_RES(CB_SIZE_MORE) ) )
+ , maWidthHeightField( VclPtr<MetricField>::Create( this, SW_RES(FLD_WIDTH_HEIGHT) ) )
, mePaper( ePaper )
, maPaperList()
, mrPagePropPanel(rPanel)
{
- maWidthHeightField.Hide();
- SetFieldUnit( maWidthHeightField, eFUnit );
+ maWidthHeightField->Hide();
+ SetFieldUnit( *maWidthHeightField.get(), eFUnit );
maPaperList.push_back( PAPER_A3 );
maPaperList.push_back( PAPER_A4 );
@@ -68,7 +68,7 @@ PageSizeControl::PageSizeControl(
{
OUString aMetricStr;
{
- const OUString aText = maWidthHeightField.GetText();
+ const OUString aText = maWidthHeightField->GetText();
for (short i = aText.getLength() - 1; i >= 0; i--)
{
sal_Unicode c = aText[i];
@@ -86,7 +86,7 @@ PageSizeControl::PageSizeControl(
}
}
- const LocaleDataWrapper& localeDataWrapper = maWidthHeightField.GetLocaleDataWrapper();
+ const LocaleDataWrapper& localeDataWrapper = maWidthHeightField->GetLocaleDataWrapper();
OUString aWidthStr;
OUString aHeightStr;
OUString aItemText2;
@@ -99,19 +99,19 @@ PageSizeControl::PageSizeControl(
{
Swap( aPaperSize );
}
- maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Width() ), FUNIT_TWIP );
+ maWidthHeightField->SetValue( maWidthHeightField->Normalize( aPaperSize.Width() ), FUNIT_TWIP );
aWidthStr = localeDataWrapper.getNum(
- maWidthHeightField.GetValue(),
- maWidthHeightField.GetDecimalDigits(),
- maWidthHeightField.IsUseThousandSep(),
- maWidthHeightField.IsShowTrailingZeros() );
+ maWidthHeightField->GetValue(),
+ maWidthHeightField->GetDecimalDigits(),
+ maWidthHeightField->IsUseThousandSep(),
+ maWidthHeightField->IsShowTrailingZeros() );
- maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Height() ), FUNIT_TWIP);
+ maWidthHeightField->SetValue( maWidthHeightField->Normalize( aPaperSize.Height() ), FUNIT_TWIP);
aHeightStr = localeDataWrapper.getNum(
- maWidthHeightField.GetValue(),
- maWidthHeightField.GetDecimalDigits(),
- maWidthHeightField.IsUseThousandSep(),
- maWidthHeightField.IsShowTrailingZeros() );
+ maWidthHeightField->GetValue(),
+ maWidthHeightField->GetDecimalDigits(),
+ maWidthHeightField->IsUseThousandSep(),
+ maWidthHeightField->IsShowTrailingZeros() );
aItemText2 = aWidthStr + " x " + aHeightStr + " " + aMetricStr;
@@ -135,15 +135,23 @@ PageSizeControl::PageSizeControl(
mpSizeValueSet->Format();
mpSizeValueSet->StartSelection();
- maMoreButton.SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) );
- maMoreButton.GrabFocus();
+ maMoreButton->SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) );
+ maMoreButton->GrabFocus();
FreeResource();
}
PageSizeControl::~PageSizeControl()
{
- delete mpSizeValueSet;
+ disposeOnce();
+}
+
+void PageSizeControl::dispose()
+{
+ mpSizeValueSet.disposeAndClear();
+ maMoreButton.disposeAndClear();
+ maWidthHeightField.disposeAndClear();
+ ::svx::sidebar::PopupControl::dispose();
}
IMPL_LINK(PageSizeControl, ImplSizeHdl, void *, pControl)
diff --git a/sw/source/uibase/sidebar/PageSizeControl.hxx b/sw/source/uibase/sidebar/PageSizeControl.hxx
index bd3e9f0ca1b8..91f63cea737f 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.hxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.hxx
@@ -48,12 +48,13 @@ public:
const bool bLandscape,
const FieldUnit eFUnit );
virtual ~PageSizeControl();
+ virtual void dispose() SAL_OVERRIDE;
private:
- ::svx::sidebar::ValueSetWithTextControl* mpSizeValueSet;
- PushButton maMoreButton;
+ VclPtr<::svx::sidebar::ValueSetWithTextControl> mpSizeValueSet;
+ VclPtr<PushButton> maMoreButton;
// hidden metric field
- MetricField maWidthHeightField;
+ VclPtr<MetricField> maWidthHeightField;
Paper mePaper;
::std::vector< Paper > maPaperList;
diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx
index ead31d610595..c180c383446f 100644
--- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx
+++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx
@@ -43,7 +43,7 @@
namespace sw { namespace sidebar {
-StylePresetsPanel* StylePresetsPanel::Create (vcl::Window* pParent,
+VclPtr<vcl::Window> StylePresetsPanel::Create (vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
{
@@ -54,7 +54,7 @@ StylePresetsPanel* StylePresetsPanel::Create (vcl::Window* pParent,
if (pBindings == NULL)
throw css::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2);
- return new StylePresetsPanel(pParent, rxFrame, pBindings);
+ return VclPtr<vcl::Window>(new StylePresetsPanel(pParent, rxFrame, pBindings), SAL_NO_ACQUIRE);
}
StylePresetsPanel::StylePresetsPanel(vcl::Window* pParent,
@@ -91,6 +91,14 @@ StylePresetsPanel::StylePresetsPanel(vcl::Window* pParent,
StylePresetsPanel::~StylePresetsPanel()
{
+ disposeOnce();
+}
+
+void StylePresetsPanel::dispose()
+{
+ mpListBox.disposeAndClear();
+
+ PanelLayout::dispose();
}
IMPL_LINK_NOARG(StylePresetsPanel, DoubleClickHdl)
diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.hxx b/sw/source/uibase/sidebar/StylePresetsPanel.hxx
index 9560da8a6919..047272ea87ca 100644
--- a/sw/source/uibase/sidebar/StylePresetsPanel.hxx
+++ b/sw/source/uibase/sidebar/StylePresetsPanel.hxx
@@ -42,7 +42,7 @@ class StylePresetsPanel : public PanelLayout,
public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static StylePresetsPanel* Create(vcl::Window* pParent,
+ static VclPtr<vcl::Window> Create(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
@@ -73,10 +73,11 @@ private:
SfxBindings* pBindings);
virtual ~StylePresetsPanel();
+ virtual void dispose() SAL_OVERRIDE;
SfxBindings* mpBindings;
- ListBox* mpListBox;
+ VclPtr<ListBox> mpListBox;
std::vector<std::unique_ptr<TemplateEntry>> maTemplateEntries;
diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx
index ea66e3b91ece..013519661a13 100644
--- a/sw/source/uibase/sidebar/SwPanelFactory.cxx
+++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx
@@ -121,7 +121,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
if (rsResourceURL.endsWith("/PagePropertyPanel"))
{
- sw::sidebar::PagePropertyPanel* pPanel = sw::sidebar::PagePropertyPanel::Create( pParentWindow, xFrame, pBindings );
+ VclPtr<vcl::Window> pPanel = sw::sidebar::PagePropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
@@ -130,7 +130,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
}
else if (rsResourceURL.endsWith("/WrapPropertyPanel"))
{
- sw::sidebar::WrapPropertyPanel* pPanel = sw::sidebar::WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+ VclPtr<vcl::Window> pPanel = sw::sidebar::WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
@@ -139,7 +139,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
}
else if (rsResourceURL.endsWith("/NavigatorPanel"))
{
- vcl::Window* pPanel = new SwNavigationPI(pBindings, NULL, pParentWindow);
+ VclPtr<vcl::Window> pPanel( new SwNavigationPI(pBindings, NULL, pParentWindow), SAL_NO_ACQUIRE );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
@@ -148,7 +148,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
}
else if (rsResourceURL.endsWith("/ManageChangesPanel"))
{
- vcl::Window* pPanel = new SwRedlineAcceptPanel(pParentWindow, xFrame);
+ VclPtr<vcl::Window> pPanel( new SwRedlineAcceptPanel(pParentWindow, xFrame), SAL_NO_ACQUIRE );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
@@ -157,13 +157,13 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
}
else if (rsResourceURL.endsWith("/StylePresetsPanel"))
{
- sw::sidebar::StylePresetsPanel* pPanel = sw::sidebar::StylePresetsPanel::Create(pParentWindow, xFrame, pBindings);
+ VclPtr<vcl::Window> pPanel = sw::sidebar::StylePresetsPanel::Create(pParentWindow, xFrame, pBindings);
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL, xFrame, pPanel, ui::LayoutSize(-1,-1,-1));
}
else if (rsResourceURL.endsWith("/ThemePanel"))
{
- sw::sidebar::ThemePanel* pPanel = sw::sidebar::ThemePanel::Create(pParentWindow, xFrame, pBindings);
+ VclPtr<vcl::Window> pPanel = sw::sidebar::ThemePanel::Create(pParentWindow, xFrame, pBindings);
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL, xFrame, pPanel, ui::LayoutSize(-1,-1,-1));
}
diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx
index 91abd8983dbe..a246a24ad57a 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -466,7 +466,7 @@ void applyTheme(SfxStyleSheetBasePool* pPool, const OUString& sFontSetName, cons
namespace sw { namespace sidebar {
-ThemePanel* ThemePanel::Create (vcl::Window* pParent,
+VclPtr<vcl::Window> ThemePanel::Create (vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
{
@@ -477,7 +477,7 @@ ThemePanel* ThemePanel::Create (vcl::Window* pParent,
if (pBindings == NULL)
throw css::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2);
- return new ThemePanel(pParent, rxFrame, pBindings);
+ return VclPtr<vcl::Window>(new ThemePanel(pParent, rxFrame, pBindings), SAL_NO_ACQUIRE);
}
ThemePanel::ThemePanel(vcl::Window* pParent,
@@ -509,6 +509,16 @@ ThemePanel::ThemePanel(vcl::Window* pParent,
ThemePanel::~ThemePanel()
{
+ disposeOnce();
+}
+
+void ThemePanel::dispose()
+{
+ mpListBoxFonts.clear();
+ mpListBoxColors.clear();
+ mpApplyButton.clear();
+
+ PanelLayout::dispose();
}
IMPL_LINK_NOARG(ThemePanel, ClickHdl)
diff --git a/sw/source/uibase/sidebar/ThemePanel.hxx b/sw/source/uibase/sidebar/ThemePanel.hxx
index ed5c19df39f3..a14ac51de4ae 100644
--- a/sw/source/uibase/sidebar/ThemePanel.hxx
+++ b/sw/source/uibase/sidebar/ThemePanel.hxx
@@ -42,7 +42,7 @@ class ThemePanel : public PanelLayout,
public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static ThemePanel* Create(vcl::Window* pParent,
+ static VclPtr<vcl::Window> Create(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
@@ -62,12 +62,13 @@ private:
SfxBindings* pBindings);
virtual ~ThemePanel();
+ virtual void dispose() SAL_OVERRIDE;
SfxBindings* mpBindings;
- ListBox* mpListBoxFonts;
- ListBox* mpListBoxColors;
- PushButton* mpApplyButton;
+ VclPtr<ListBox> mpListBoxFonts;
+ VclPtr<ListBox> mpListBoxColors;
+ VclPtr<PushButton> mpApplyButton;
DECL_LINK(ClickHdl, void*);
};
diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
index 9c7204921934..2dfe37c4b8c6 100644
--- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
+++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
@@ -42,7 +42,7 @@ const char UNO_WRAPIDEAL[] = ".uno:WrapIdeal";
namespace sw { namespace sidebar {
-WrapPropertyPanel* WrapPropertyPanel::Create (
+VclPtr<vcl::Window> WrapPropertyPanel::Create (
vcl::Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
SfxBindings* pBindings)
@@ -54,10 +54,10 @@ WrapPropertyPanel* WrapPropertyPanel::Create (
if (pBindings == NULL)
throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to WrapPropertyPanel::Create", NULL, 2);
- return new WrapPropertyPanel(
- pParent,
- rxFrame,
- pBindings);
+ return VclPtr<WrapPropertyPanel>::Create(
+ pParent,
+ rxFrame,
+ pBindings);
}
WrapPropertyPanel::WrapPropertyPanel(
@@ -89,6 +89,26 @@ WrapPropertyPanel::WrapPropertyPanel(
WrapPropertyPanel::~WrapPropertyPanel()
{
+ disposeOnce();
+}
+
+void WrapPropertyPanel::dispose()
+{
+ mpRBNoWrap.clear();
+ mpRBWrapLeft.clear();
+ mpRBWrapRight.clear();
+ mpRBWrapParallel.clear();
+ mpRBWrapThrough.clear();
+ mpRBIdealWrap.clear();
+
+ maSwNoWrapControl.dispose();
+ maSwWrapLeftControl.dispose();
+ maSwWrapRightControl.dispose();
+ maSwWrapParallelControl.dispose();
+ maSwWrapThroughControl.dispose();
+ maSwWrapIdealControl.dispose();
+
+ PanelLayout::dispose();
}
void WrapPropertyPanel::Initialize()
diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx
index d1c53394021f..bd1f27ad0931 100644
--- a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx
+++ b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx
@@ -35,7 +35,7 @@ namespace sw { namespace sidebar {
, public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
- static WrapPropertyPanel* Create(
+ static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
SfxBindings* pBindings );
@@ -47,23 +47,23 @@ namespace sw { namespace sidebar {
const SfxPoolItem* pState,
const bool bIsEnabled) SAL_OVERRIDE;
- private:
+ virtual ~WrapPropertyPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
WrapPropertyPanel(
vcl::Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
SfxBindings* pBindings );
-
- virtual ~WrapPropertyPanel();
-
+ private:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
SfxBindings* mpBindings;
- RadioButton* mpRBNoWrap;
- RadioButton* mpRBWrapLeft;
- RadioButton* mpRBWrapRight;
- RadioButton* mpRBWrapParallel;
- RadioButton* mpRBWrapThrough;
- RadioButton* mpRBIdealWrap;
+ VclPtr<RadioButton> mpRBNoWrap;
+ VclPtr<RadioButton> mpRBWrapLeft;
+ VclPtr<RadioButton> mpRBWrapRight;
+ VclPtr<RadioButton> mpRBWrapParallel;
+ VclPtr<RadioButton> mpRBWrapThrough;
+ VclPtr<RadioButton> mpRBIdealWrap;
//Image resource.
ImageList aWrapIL;
diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx
index cfc07cfacaa7..3f2d8bc0734f 100644
--- a/sw/source/uibase/table/tablepg.hxx
+++ b/sw/source/uibase/table/tablepg.hxx
@@ -37,29 +37,29 @@ struct TColumn
class SwFormatTablePage : public SfxTabPage
{
- Edit* m_pNameED;
+ VclPtr<Edit> m_pNameED;
TextFilter m_aTextFilter;
- FixedText* m_pWidthFT;
+ VclPtr<FixedText> m_pWidthFT;
PercentField m_aWidthMF;
- CheckBox* m_pRelWidthCB;
+ VclPtr<CheckBox> m_pRelWidthCB;
- RadioButton* m_pFullBtn;
- RadioButton* m_pLeftBtn;
- RadioButton* m_pFromLeftBtn;
- RadioButton* m_pRightBtn;
- RadioButton* m_pCenterBtn;
- RadioButton* m_pFreeBtn;
+ VclPtr<RadioButton> m_pFullBtn;
+ VclPtr<RadioButton> m_pLeftBtn;
+ VclPtr<RadioButton> m_pFromLeftBtn;
+ VclPtr<RadioButton> m_pRightBtn;
+ VclPtr<RadioButton> m_pCenterBtn;
+ VclPtr<RadioButton> m_pFreeBtn;
- FixedText* m_pLeftFT;
+ VclPtr<FixedText> m_pLeftFT;
PercentField m_aLeftMF;
- FixedText* m_pRightFT;
+ VclPtr<FixedText> m_pRightFT;
PercentField m_aRightMF;
- FixedText* m_pTopFT;
- MetricField* m_pTopMF;
- FixedText* m_pBottomFT;
- MetricField* m_pBottomMF;
+ VclPtr<FixedText> m_pTopFT;
+ VclPtr<MetricField> m_pTopMF;
+ VclPtr<FixedText> m_pBottomFT;
+ VclPtr<MetricField> m_pBottomMF;
- ListBox* m_pTextDirectionLB;
+ VclPtr<ListBox> m_pTextDirectionLB;
SwTableRep* pTblData;
SwTwips nSaveWidth;
@@ -81,8 +81,10 @@ class SwFormatTablePage : public SfxTabPage
public:
SwFormatTablePage( vcl::Window* pParent, const SfxItemSet& rSet );
+ virtual ~SwFormatTablePage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
@@ -94,16 +96,16 @@ public:
class SwTableColumnPage : public SfxTabPage
{
- CheckBox* m_pModifyTableCB;
- CheckBox* m_pProportionalCB;
- FixedText* m_pSpaceFT;
- MetricField* m_pSpaceED;
- PushButton* m_pUpBtn;
- PushButton* m_pDownBtn;
+ VclPtr<CheckBox> m_pModifyTableCB;
+ VclPtr<CheckBox> m_pProportionalCB;
+ VclPtr<FixedText> m_pSpaceFT;
+ VclPtr<MetricField> m_pSpaceED;
+ VclPtr<PushButton> m_pUpBtn;
+ VclPtr<PushButton> m_pDownBtn;
SwTableRep* pTblData;
PercentField m_aFieldArr[MET_FIELDS];
- FixedText* m_pTextArr[MET_FIELDS];
+ VclPtr<FixedText> m_pTextArr[MET_FIELDS];
SwTwips nTableWidth;
SwTwips nMinWidth;
sal_uInt16 nNoOfCols;
@@ -131,8 +133,9 @@ class SwTableColumnPage : public SfxTabPage
public:
SwTableColumnPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SwTableColumnPage();
+ virtual void dispose() SAL_OVERRIDE;
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
@@ -142,27 +145,27 @@ public:
class SwTextFlowPage : public SfxTabPage
{
- CheckBox* m_pPgBrkCB;
+ VclPtr<CheckBox> m_pPgBrkCB;
- RadioButton* m_pPgBrkRB;
- RadioButton* m_pColBrkRB;
+ VclPtr<RadioButton> m_pPgBrkRB;
+ VclPtr<RadioButton> m_pColBrkRB;
- RadioButton* m_pPgBrkBeforeRB;
- RadioButton* m_pPgBrkAfterRB;
+ VclPtr<RadioButton> m_pPgBrkBeforeRB;
+ VclPtr<RadioButton> m_pPgBrkAfterRB;
- CheckBox* m_pPageCollCB;
- ListBox* m_pPageCollLB;
- FixedText* m_pPageNoFT;
- NumericField* m_pPageNoNF;
- CheckBox* m_pSplitCB;
- TriStateBox* m_pSplitRowCB;
- CheckBox* m_pKeepCB;
- CheckBox* m_pHeadLineCB;
- NumericField* m_pRepeatHeaderNF;
- VclContainer* m_pRepeatHeaderCombo;
- ListBox* m_pTextDirectionLB;
+ VclPtr<CheckBox> m_pPageCollCB;
+ VclPtr<ListBox> m_pPageCollLB;
+ VclPtr<FixedText> m_pPageNoFT;
+ VclPtr<NumericField> m_pPageNoNF;
+ VclPtr<CheckBox> m_pSplitCB;
+ VclPtr<TriStateBox> m_pSplitRowCB;
+ VclPtr<CheckBox> m_pKeepCB;
+ VclPtr<CheckBox> m_pHeadLineCB;
+ VclPtr<NumericField> m_pRepeatHeaderNF;
+ VclPtr<VclContainer> m_pRepeatHeaderCombo;
+ VclPtr<ListBox> m_pTextDirectionLB;
- ListBox* m_pVertOrientLB;
+ VclPtr<ListBox> m_pVertOrientLB;
SwWrtShell* pShell;
@@ -177,11 +180,11 @@ class SwTextFlowPage : public SfxTabPage
DECL_LINK( SplitRowHdl_Impl, TriStateBox* );
DECL_LINK( HeadLineCBClickHdl, void* p = 0 );
+public:
SwTextFlowPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SwTextFlowPage();
-
-public:
- static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 973cc9114358..aa2417c0f556 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -145,13 +145,15 @@ static void lcl_InvalidateZoomSlots(SfxBindings& rBindings)
// At first the zoom dialog
class SwPreviewZoomDlg : public SvxStandardDialog
{
- NumericField* m_pRowEdit;
- NumericField* m_pColEdit;
+ VclPtr<NumericField> m_pRowEdit;
+ VclPtr<NumericField> m_pColEdit;
virtual void Apply() SAL_OVERRIDE;
public:
SwPreviewZoomDlg( SwPagePreviewWin& rParent );
+ virtual ~SwPreviewZoomDlg();
+ virtual void dispose() SAL_OVERRIDE;
};
SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent )
@@ -164,6 +166,18 @@ SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent )
m_pColEdit->SetValue( rParent.GetCol() );
}
+SwPreviewZoomDlg::~SwPreviewZoomDlg()
+{
+ disposeOnce();
+}
+
+void SwPreviewZoomDlg::dispose()
+{
+ m_pRowEdit.clear();
+ m_pColEdit.clear();
+ SvxStandardDialog::dispose();
+}
+
void SwPreviewZoomDlg::Apply()
{
static_cast<SwPagePreviewWin*>(GetParent())->CalcWish(
@@ -1145,12 +1159,12 @@ void SwPagePreview::Init(const SwViewOption * pPrefs)
SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
SfxViewShell( pViewFrame, SWVIEWFLAGS ),
- pViewWin( new SwPagePreviewWin(&(GetViewFrame())->GetWindow(), *this ) ),
+ pViewWin( VclPtr<SwPagePreviewWin>::Create(&(GetViewFrame())->GetWindow(), *this ) ),
nNewPage(USHRT_MAX),
sPageStr(SW_RES(STR_PAGE)),
pHScrollbar(0),
pVScrollbar(0),
- pScrollFill(new ScrollBarBox( &pViewFrame->GetWindow(),
+ pScrollFill(VclPtr<ScrollBarBox>::Create( &pViewFrame->GetWindow(),
pViewFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
mnPageCount( 0 ),
mbResetFormDesignMode( false ),
@@ -1224,11 +1238,12 @@ SwPagePreview::~SwPagePreview()
SwViewShell* pVShell = pViewWin->GetViewShell();
pVShell->SetWin(0);
delete pVShell;
- delete pViewWin;
- delete pScrollFill;
- delete pHScrollbar;
- delete pVScrollbar;
+ pViewWin.disposeAndClear();
+
+ pScrollFill.disposeAndClear();
+ pHScrollbar.disposeAndClear();
+ pVScrollbar.disposeAndClear();
}
SwDocShell* SwPagePreview::GetDocShell()
@@ -1239,20 +1254,20 @@ SwDocShell* SwPagePreview::GetDocShell()
int SwPagePreview::_CreateScrollbar( bool bHori )
{
vcl::Window *pMDI = &GetViewFrame()->GetWindow();
- SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar;
+ VclPtr<SwScrollbar>& ppScrollbar = bHori ? pHScrollbar : pVScrollbar;
- assert(!*ppScrollbar); //check beforehand!
+ assert(!ppScrollbar.get()); //check beforehand!
- *ppScrollbar = new SwScrollbar( pMDI, bHori );
+ ppScrollbar = VclPtr<SwScrollbar>::Create( pMDI, bHori );
ScrollDocSzChg();
- (*ppScrollbar)->EnableDrag( true );
- (*ppScrollbar)->SetEndScrollHdl( LINK( this, SwPagePreview, EndScrollHdl ));
+ ppScrollbar->EnableDrag( true );
+ ppScrollbar->SetEndScrollHdl( LINK( this, SwPagePreview, EndScrollHdl ));
- (*ppScrollbar)->SetScrollHdl( LINK( this, SwPagePreview, ScrollHdl ));
+ ppScrollbar->SetScrollHdl( LINK( this, SwPagePreview, ScrollHdl ));
InvalidateBorder();
- (*ppScrollbar)->ExtendedShow();
+ ppScrollbar->ExtendedShow();
return 1;
}
@@ -1694,8 +1709,8 @@ bool SwPagePreview::HasPrintOptionsPage() const
return true;
}
-SfxTabPage* SwPagePreview::CreatePrintOptionsPage( vcl::Window *pParent,
- const SfxItemSet &rOptions )
+VclPtr<SfxTabPage> SwPagePreview::CreatePrintOptionsPage( vcl::Window *pParent,
+ const SfxItemSet &rOptions )
{
return ::CreatePrintOptionsPage( pParent, rOptions, !bNormalPrint );
}
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index bb5696ccc5ae..76f17325268f 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -218,7 +218,7 @@ static OUString lcl_ConvertTabsToSpaces( const OUString& sLine )
SwSrcView::SwSrcView(SfxViewFrame* pViewFrame, SfxViewShell*) :
SfxViewShell( pViewFrame, SWSRCVIEWFLAGS ),
- aEditWin( &pViewFrame->GetWindow(), this ),
+ aEditWin( VclPtr<SwSrcEditWindow>::Create( &pViewFrame->GetWindow(), this ) ),
pSearchItem(0),
bSourceSaved(false),
eLoadEncoding(RTL_TEXTENCODING_DONTKNOW)
@@ -230,7 +230,7 @@ SwSrcView::~SwSrcView()
{
SwDocShell* pDocShell = GetDocShell();
OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?");
- const TextSelection& rSel = aEditWin.GetTextView()->GetSelection();
+ const TextSelection& rSel = aEditWin->GetTextView()->GetSelection();
static_cast<SwWebDocShell*>(pDocShell)->SetSourcePara( static_cast< sal_uInt16 >( rSel.GetStart().GetPara() ) );
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
@@ -249,14 +249,14 @@ void SwSrcView::SaveContentTo(SfxMedium& rMed)
{
SvStream* pOutStream = rMed.GetOutStream();
pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding));
- aEditWin.Write( *pOutStream );
+ aEditWin->Write( *pOutStream );
}
void SwSrcView::Init()
{
SetHelpId(SW_SRC_VIEWSHELL);
SetName(OUString("Source"));
- SetWindow( &aEditWin );
+ SetWindow( aEditWin.get() );
SwDocShell* pDocShell = GetDocShell();
// If the doc is still loading, then the DocShell must fire up
// the Load if the loading is completed.
@@ -264,7 +264,7 @@ void SwSrcView::Init()
Load(pDocShell);
else
{
- aEditWin.SetReadonly(true);
+ aEditWin->SetReadonly(true);
}
SetNewWindowAllowed( false );
@@ -282,13 +282,13 @@ void SwSrcView::SaveContent(const OUString& rTmpFile)
SfxMedium aMedium( rTmpFile, StreamMode::WRITE);
SvStream* pOutStream = aMedium.GetOutStream();
pOutStream->SetStreamCharSet( lcl_GetStreamCharSet(eLoadEncoding) );
- aEditWin.Write(*pOutStream);
+ aEditWin->Write(*pOutStream);
aMedium.Commit();
}
void SwSrcView::Execute(SfxRequest& rReq)
{
- TextView* pTextView = aEditWin.GetTextView();
+ TextView* pTextView = aEditWin->GetTextView();
switch( rReq.GetSlot() )
{
case SID_SAVEACOPY:
@@ -328,7 +328,7 @@ void SwSrcView::Execute(SfxRequest& rReq)
StreamMode::WRITE | StreamMode::SHARE_DENYNONE );
SvStream* pOutStream = aMedium.GetOutStream();
pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding));
- aEditWin.Write( *pOutStream );
+ aEditWin->Write( *pOutStream );
aMedium.Commit();
}
}
@@ -351,12 +351,12 @@ void SwSrcView::Execute(SfxRequest& rReq)
pOutStream->Seek(0);
pOutStream->SetStreamSize(0);
pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding));
- aEditWin.Write( *pOutStream );
+ aEditWin->Write( *pOutStream );
pMed->CloseOutStream();
pMed->Commit();
pDocShell->GetDoc()->getIDocumentState().ResetModified();
SourceSaved();
- aEditWin.ClearModifyFlag();
+ aEditWin->ClearModifyFlag();
}
}
break;
@@ -369,7 +369,7 @@ void SwSrcView::Execute(SfxRequest& rReq)
const SfxPoolItem& rItem = pTmpArgs->Get( nWhich );
SetSearchItem( static_cast<const SvxSearchItem&>(rItem));
StartSearchAndReplace( static_cast<const SvxSearchItem&>(rItem), false, rReq.IsAPI() );
- if(aEditWin.IsModified())
+ if(aEditWin->IsModified())
GetDocShell()->GetDoc()->getIDocumentState().SetModified();
}
break;
@@ -379,7 +379,7 @@ void SwSrcView::Execute(SfxRequest& rReq)
if(pSrchItem)
{
StartSearchAndReplace( *pSrchItem, false, rReq.IsAPI() );
- if(aEditWin.IsModified())
+ if(aEditWin->IsModified())
GetDocShell()->GetDoc()->getIDocumentState().SetModified();
}
}
@@ -415,14 +415,14 @@ void SwSrcView::Execute(SfxRequest& rReq)
pTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
break;
}
- aEditWin.Invalidate();
+ aEditWin->Invalidate();
}
void SwSrcView::GetState(SfxItemSet& rSet)
{
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
- TextView* pTextView = aEditWin.GetTextView();
+ TextView* pTextView = aEditWin->GetTextView();
while(nWhich)
{
@@ -471,7 +471,7 @@ void SwSrcView::GetState(SfxItemSet& rSet)
if ( !pTextView->HasSelection() )
{
const TextSelection& rSel = pTextView->GetSelection();
- sSelected = aEditWin.GetTextEngine()->GetWord( rSel.GetStart());
+ sSelected = aEditWin->GetTextEngine()->GetWord( rSel.GetStart());
}
else
{
@@ -538,7 +538,7 @@ void SwSrcView::GetState(SfxItemSet& rSet)
{
TransferableDataHelper aDataHelper(
TransferableDataHelper::CreateFromSystemClipboard(
- &aEditWin) );
+ aEditWin.get()) );
bool bDisable = !aDataHelper.GetXTransferable().is() ||
0 == aDataHelper.GetFormatCount();
if( bDisable )
@@ -570,7 +570,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
bool bApi,
bool bRecursive)
{
- ExtTextView* pTextView = aEditWin.GetTextView();
+ ExtTextView* pTextView = aEditWin->GetTextView();
TextSelection aSel;
TextPaM aPaM;
@@ -701,11 +701,11 @@ sal_Int32 SwSrcView::PrintSource(
pOutDev->Push();
- TextEngine* pTextEngine = aEditWin.GetTextEngine();
+ TextEngine* pTextEngine = aEditWin->GetTextEngine();
pOutDev->SetMapMode( MAP_100TH_MM );
- vcl::Font aFont( aEditWin.GetOutWin()->GetFont() );
+ vcl::Font aFont( aEditWin->GetOutWin()->GetFont() );
Size aSize( aFont.GetSize() );
- aSize = aEditWin.GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM );
+ aSize = aEditWin->GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM );
aFont.SetSize( aSize );
aFont.SetColor( COL_BLACK );
pOutDev->SetFont( aFont );
@@ -772,7 +772,7 @@ void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
pSimpleHint->GetId() == SFX_HINT_MODECHANGED ||
(
pSimpleHint->GetId() == SFX_HINT_TITLECHANGED &&
- !GetDocShell()->IsReadOnly() && aEditWin.IsReadonly()
+ !GetDocShell()->IsReadOnly() && aEditWin->IsReadonly()
)
)
)
@@ -780,7 +780,7 @@ void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
// Broadcast only comes once!
const SwDocShell* pDocSh = GetDocShell();
const bool bReadonly = pDocSh->IsReadOnly();
- aEditWin.SetReadonly(bReadonly);
+ aEditWin->SetReadonly(bReadonly);
}
SfxViewShell::Notify(rBC, rHint);
}
@@ -792,8 +792,8 @@ void SwSrcView::Load(SwDocShell* pDocShell)
rtl_getBestMimeCharsetFromTextEncoding( rHtmlOptions.GetTextEncoding() );
rtl_TextEncoding eDestEnc = rtl_getTextEncodingFromMimeCharset( pCharSet );
- aEditWin.SetReadonly(pDocShell->IsReadOnly());
- aEditWin.SetTextEncoding(eDestEnc);
+ aEditWin->SetReadonly(pDocShell->IsReadOnly());
+ aEditWin->SetTextEncoding(eDestEnc);
SfxMedium* pMedium = pDocShell->GetMedium();
const SfxFilter* pFilter = pMedium->GetFilter();
@@ -817,13 +817,13 @@ void SwSrcView::Load(SwDocShell* pDocShell)
eDestEnc != eHeaderEnc )
{
eDestEnc = eHeaderEnc;
- aEditWin.SetTextEncoding(eDestEnc);
+ aEditWin->SetTextEncoding(eDestEnc);
}
pStream->SetStreamCharSet( eDestEnc );
pStream->Seek(0);
- TextEngine* pTextEngine = aEditWin.GetTextEngine();
+ TextEngine* pTextEngine = aEditWin->GetTextEngine();
pTextEngine->EnableUndo(false);
- aEditWin.Read(*pStream);
+ aEditWin->Read(*pStream);
pTextEngine->EnableUndo(true);
}
else
@@ -851,17 +851,17 @@ void SwSrcView::Load(SwDocShell* pDocShell)
if(nRes)
{
ErrorHandler::HandleError(ErrCode(nRes));
- aEditWin.SetReadonly(true);
+ aEditWin->SetReadonly(true);
}
aMedium.Commit();
SvStream* pInStream = aMedium.GetInStream();
pInStream->Seek(0);
pInStream->SetStreamCharSet( eDestEnc );
- aEditWin.Read(*pInStream);
+ aEditWin->Read(*pInStream);
}
}
- aEditWin.ClearModifyFlag();
+ aEditWin->ClearModifyFlag();
eLoadEncoding = eDestEnc;
@@ -871,9 +871,9 @@ void SwSrcView::Load(SwDocShell* pDocShell)
pDocShell->SetAutoLoad(INetURLObject(), 0, false);
OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?");
sal_uInt16 nLine = static_cast<SwWebDocShell*>(pDocShell)->GetSourcePara();
- aEditWin.SetStartLine(nLine);
- aEditWin.GetTextEngine()->ResetUndo();
- aEditWin.GetOutWin()->GrabFocus();
+ aEditWin->SetStartLine(nLine);
+ aEditWin->GetTextEngine()->ResetUndo();
+ aEditWin->GetOutWin()->GrabFocus();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 16e497b5c848..a3da88c0fcc7 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -692,14 +692,14 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
m_nNewPage(USHRT_MAX),
m_nOldPageNum(0),
m_pNumRuleNodeFromDoc(0),
- m_pEditWin( new SwEditWin( &_pFrame->GetWindow(), *this ) ),
+ m_pEditWin( VclPtr<SwEditWin>::Create( &_pFrame->GetWindow(), *this ) ),
m_pWrtShell(0),
m_pShell(0),
m_pFormShell(0),
m_pHScrollbar(0),
m_pVScrollbar(0),
- m_pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
- m_pVRuler(new SvxRuler(&GetViewFrame()->GetWindow(), m_pEditWin,
+ m_pScrollFill(VclPtr<ScrollBarBox>::Create( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
+ m_pVRuler(VclPtr<SvxRuler>::Create(&GetViewFrame()->GetWindow(), m_pEditWin,
SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL|
SVXRULER_SUPPORT_BORDERS | SVXRULER_SUPPORT_REDUCED_METRIC,
GetViewFrame()->GetBindings(),
@@ -846,7 +846,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
}
}
SAL_INFO( "sw.ui", "after create WrtShell" );
- m_pHRuler = new SwCommentRuler(m_pWrtShell, &GetViewFrame()->GetWindow(), m_pEditWin,
+ m_pHRuler = VclPtr<SwCommentRuler>::Create(m_pWrtShell, &GetViewFrame()->GetWindow(), m_pEditWin,
SVXRULER_SUPPORT_TABS |
SVXRULER_SUPPORT_PARAGRAPH_MARGINS |
SVXRULER_SUPPORT_BORDERS |
@@ -1050,18 +1050,18 @@ SwView::~SwView()
m_pViewImpl->Invalidate();
EndListening(*GetViewFrame());
EndListening(*GetDocShell());
- delete m_pScrollFill;
+ m_pScrollFill.disposeAndClear();
delete m_pWrtShell;
m_pWrtShell = 0; // Set to 0, so that it is not accessible by the following dtors cannot.
m_pShell = 0;
- delete m_pHScrollbar;
- delete m_pVScrollbar;
- delete m_pHRuler;
- delete m_pVRuler;
- delete m_pTogglePageBtn;
+ m_pHScrollbar.disposeAndClear();
+ m_pVScrollbar.disposeAndClear();
+ m_pHRuler.disposeAndClear();
+ m_pVRuler.disposeAndClear();
+ m_pTogglePageBtn.disposeAndClear();
delete m_pGlosHdl;
delete m_pViewImpl;
- delete m_pEditWin;
+ m_pEditWin.disposeAndClear();
delete m_pFormatClipboard;
}
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index f052dbe1e2ea..83586ec227f1 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -240,8 +240,8 @@ int SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter,
const sal_uInt16 aRotation = aMetadata.getRotation();
if (aRotation != 0)
{
- MessageDialog aQueryBox( GetWindow(),"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui");
- if (aQueryBox.Execute() == RET_YES)
+ ScopedVclPtrInstance< MessageDialog > aQueryBox( GetWindow(),"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui");
+ if (aQueryBox->Execute() == RET_YES)
{
GraphicNativeTransform aTransform( aGraphic );
aTransform.rotate( aRotation );
@@ -439,8 +439,8 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
// really store as link only?
if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() )
{
- SvxLinkWarningDialog aWarnDlg(GetWindow(),pFileDlg->GetPath());
- if( aWarnDlg.Execute() != RET_OK )
+ ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(GetWindow(),pFileDlg->GetPath());
+ if( aWarnDlg->Execute() != RET_OK )
bAsLink=false; // don't store as link
}
}
@@ -504,8 +504,8 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
{
if( bShowError )
{
- MessageDialog aInfoBox( GetWindow(), SW_RESSTR( nResId ), VCL_MESSAGE_INFO);
- aInfoBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aInfoBox( GetWindow(), SW_RESSTR( nResId ), VCL_MESSAGE_INFO);
+ aInfoBox->Execute();
}
rReq.Ignore();
}
@@ -585,11 +585,11 @@ void SwView::Execute(SfxRequest &rReq)
pParent = static_cast<const XWindowItem*>( pParentItem )->GetWindowPtr();
else
pParent = &GetViewFrame()->GetWindow();
- SfxPasswordDialog aPasswdDlg( pParent );
- aPasswdDlg.SetMinLen( 1 );
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg( pParent );
+ aPasswdDlg->SetMinLen( 1 );
//#i69751# the result of Execute() can be ignored
- (void)aPasswdDlg.Execute();
- OUString sNewPasswd( aPasswdDlg.GetPassword() );
+ (void)aPasswdDlg->Execute();
+ OUString sNewPasswd( aPasswdDlg->GetPassword() );
Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword();
SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
@@ -623,14 +623,14 @@ void SwView::Execute(SfxRequest &rReq)
pParent = static_cast<const XWindowItem*>( pParentItem )->GetWindowPtr();
else
pParent = &GetViewFrame()->GetWindow();
- SfxPasswordDialog aPasswdDlg( pParent );
- aPasswdDlg.SetMinLen( 1 );
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg( pParent );
+ aPasswdDlg->SetMinLen( 1 );
if(!aPasswd.getLength())
- aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
- if (aPasswdDlg.Execute())
+ aPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM);
+ if (aPasswdDlg->Execute())
{
sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON;
- OUString sNewPasswd( aPasswdDlg.GetPassword() );
+ OUString sNewPasswd( aPasswdDlg->GetPassword() );
Sequence <sal_Int8> aNewPasswd =
pIDRA->GetRedlinePassword();
SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
@@ -2286,11 +2286,11 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument)
if ( lcl_NeedAdditionalDataSource( xDBContext ) )
{
// no data sources are available - create a new one
- MessageDialog aQuery(&GetViewFrame()->GetWindow(),
+ ScopedVclPtrInstance<MessageDialog> aQuery(&GetViewFrame()->GetWindow(),
"DataSourcesUnavailableDialog",
"modules/swriter/ui/datasourcesunavailabledialog.ui");
// no cancel allowed
- if (RET_OK != aQuery.Execute())
+ if (RET_OK != aQuery->Execute())
return;
bCallAddressPilot = true;
}
@@ -2335,12 +2335,12 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument)
OUString sSource;
if(!GetWrtShell().IsFieldDataSourceAvailable(sSource))
{
- MessageDialog aWarning(&GetViewFrame()->GetWindow(),
+ ScopedVclPtrInstance<MessageDialog> aWarning(&GetViewFrame()->GetWindow(),
"WarnDataSourceDialog",
"modules/swriter/ui/warndatasourcedialog.ui");
- OUString sTmp(aWarning.get_primary_text());
- aWarning.set_primary_text(sTmp.replaceFirst("%1", sSource));
- if (RET_OK == aWarning.Execute())
+ OUString sTmp(aWarning->get_primary_text());
+ aWarning->set_primary_text(sTmp.replaceFirst("%1", sSource));
+ if (RET_OK == aWarning->Execute())
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
if ( pFact )
@@ -2389,8 +2389,8 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument)
SfxApplication* pSfxApp = SfxGetpApp();
vcl::Window* pTopWin = pSfxApp->GetTopWindow();
- SfxTemplateManagerDlg aDocTemplDlg;
- int nRet = aDocTemplDlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateManagerDlg > aDocTemplDlg;
+ int nRet = aDocTemplDlg->Execute();
bool bNewWin = false;
if ( nRet == RET_OK )
{
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 8ed2185dd44f..81e2ead3c251 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -177,9 +177,9 @@ void SwView::ExecDraw(SfxRequest& rReq)
if ( pSdrView )
{
SdrObject* pObj = NULL;
- svx::FontWorkGalleryDialog aDlg( pSdrView, pWin, nSlotId );
- aDlg.SetSdrObjectRef( &pObj, pSdrView->GetModel() );
- aDlg.Execute();
+ ScopedVclPtrInstance< svx::FontWorkGalleryDialog > aDlg( pSdrView, pWin, nSlotId );
+ aDlg->SetSdrObjectRef( &pObj, pSdrView->GetModel() );
+ aDlg->Execute();
if ( pObj )
{
Size aDocSize( m_pWrtShell->GetDocSize() );
diff --git a/sw/source/uibase/uiview/viewfunc.hxx b/sw/source/uibase/uiview/viewfunc.hxx
index 4102270a1999..c66822e95a26 100644
--- a/sw/source/uibase/uiview/viewfunc.hxx
+++ b/sw/source/uibase/uiview/viewfunc.hxx
@@ -33,7 +33,7 @@ namespace vcl { class Window; }
// The following functions are available in viewprt.cxx
void SetPrinter( IDocumentDeviceAccess*, SfxPrinter*, bool bWeb );
-SfxTabPage* CreatePrintOptionsPage( vcl::Window*, const SfxItemSet& );
+VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window*, const SfxItemSet& );
void SetAppPrintOptions( SwViewShell* pSh, bool bWeb );
// The following functions are available in viewport.cxx
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index b0142b985c58..559b9ff747b7 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -459,8 +459,8 @@ void SwView::HyphenateDocument()
// turned on no special area
{
// I want also in special areas hyphenation
- MessageDialog aBox(&GetEditWin(), SW_RES(STR_QUERY_SPECIAL_FORCED), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if( aBox.Execute() == RET_YES )
+ ScopedVclPtrInstance< MessageDialog > aBox(&GetEditWin(), SW_RES(STR_QUERY_SPECIAL_FORCED), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ if( aBox->Execute() == RET_YES )
{
bOther = true;
if (xProp.is())
@@ -799,18 +799,20 @@ bool SwView::ExecSmartTagPopup( const Point& rPt )
class SwFieldDialog : public FloatingWindow
{
private:
- ListBox aListBox;
+ VclPtr<ListBox> aListBox;
IFieldmark *pFieldmark;
DECL_LINK( MyListBoxHandler, ListBox * );
public:
SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM );
+ virtual ~SwFieldDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) :
FloatingWindow( parent, WB_BORDER | WB_SYSTEMWINDOW ),
- aListBox(this),
+ aListBox(VclPtr<ListBox>::Create(this)),
pFieldmark( fieldBM )
{
if ( fieldBM != NULL )
@@ -827,7 +829,7 @@ SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) :
pCurrent != vListEntries.getArray() + vListEntries.getLength();
++pCurrent)
{
- aListBox.InsertEntry(*pCurrent);
+ aListBox->InsertEntry(*pCurrent);
}
}
@@ -838,20 +840,31 @@ SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) :
{
sal_Int32 nSelection = -1;
pResult->second >>= nSelection;
- aListBox.SelectEntryPos( nSelection );
+ aListBox->SelectEntryPos( nSelection );
}
}
- Size lbSize(aListBox.GetOptimalSize());
+ Size lbSize(aListBox->GetOptimalSize());
lbSize.Width()+=50;
lbSize.Height()+=20;
- aListBox.SetSizePixel(lbSize);
- aListBox.SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) );
- aListBox.Show();
+ aListBox->SetSizePixel(lbSize);
+ aListBox->SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) );
+ aListBox->Show();
SetSizePixel( lbSize );
}
+SwFieldDialog::~SwFieldDialog()
+{
+ disposeOnce();
+}
+
+void SwFieldDialog::dispose()
+{
+ aListBox.disposeAndClear();
+ FloatingWindow::dispose();
+}
+
IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox )
{
short res = 0;
@@ -875,11 +888,7 @@ IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox )
IMPL_LINK_NOARG(SwView, FieldPopupModeEndHdl)
{
- if ( m_pFieldPopup )
- {
- delete m_pFieldPopup;
- m_pFieldPopup = NULL;
- }
+ m_pFieldPopup.disposeAndClear();
return 0;
}
@@ -887,7 +896,7 @@ void SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM )
{
const Point aPixPos = GetEditWin().LogicToPixel( rPt );
- m_pFieldPopup = new SwFieldDialog( m_pEditWin, fieldBM );
+ m_pFieldPopup = VclPtr<SwFieldDialog>::Create( m_pEditWin, fieldBM );
m_pFieldPopup->SetPopupModeEndHdl( LINK( this, SwView, FieldPopupModeEndHdl ) );
Rectangle aRect( m_pEditWin->OutputToScreenPixel( aPixPos ), Size( 0, 0 ) );
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 8d63bcb4580a..b362b67520bf 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -290,25 +290,25 @@ IMPL_LINK( SwView, WindowChildEventListener, VclSimpleEvent*, pEvent )
int SwView::_CreateScrollbar( bool bHori )
{
vcl::Window *pMDI = &GetViewFrame()->GetWindow();
- SwScrollbar** ppScrollbar = bHori ? &m_pHScrollbar : &m_pVScrollbar;
+ VclPtr<SwScrollbar>& ppScrollbar = bHori ? m_pHScrollbar : m_pVScrollbar;
- assert(!*ppScrollbar); //check beforehand!
+ assert(!ppScrollbar.get()); //check beforehand!
- *ppScrollbar = new SwScrollbar( pMDI, bHori );
+ ppScrollbar = VclPtr<SwScrollbar>::Create( pMDI, bHori );
UpdateScrollbars();
if(bHori)
- (*ppScrollbar)->SetScrollHdl( LINK( this, SwView, EndScrollHdl ));
+ ppScrollbar->SetScrollHdl( LINK( this, SwView, EndScrollHdl ));
else
- (*ppScrollbar)->SetScrollHdl( LINK( this, SwView, ScrollHdl ));
- (*ppScrollbar)->SetEndScrollHdl( LINK( this, SwView, EndScrollHdl ));
+ ppScrollbar->SetScrollHdl( LINK( this, SwView, ScrollHdl ));
+ ppScrollbar->SetEndScrollHdl( LINK( this, SwView, EndScrollHdl ));
- (*ppScrollbar)->EnableDrag( true );
+ ppScrollbar->EnableDrag( true );
if(GetWindow())
InvalidateBorder();
if (!m_bShowAtResize)
- (*ppScrollbar)->ExtendedShow();
+ ppScrollbar->ExtendedShow();
return 1;
}
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index a9e63c363856..76cbdb39cdbe 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -147,8 +147,8 @@ bool SwView::HasPrintOptionsPage() const
// TabPage for application-specific print options
-SfxTabPage* SwView::CreatePrintOptionsPage(vcl::Window* pParent,
- const SfxItemSet& rSet)
+VclPtr<SfxTabPage> SwView::CreatePrintOptionsPage(vcl::Window* pParent,
+ const SfxItemSet& rSet)
{
return ::CreatePrintOptionsPage( pParent, rSet, false );
}
@@ -175,10 +175,10 @@ void SwView::ExecutePrint(SfxRequest& rReq)
}
else
{
- MessageDialog aInfoBox(&GetEditWin(), SW_RES(STR_ERR_NO_FAX), VCL_MESSAGE_INFO);
+ ScopedVclPtrInstance< MessageDialog > aInfoBox(&GetEditWin(), SW_RES(STR_ERR_NO_FAX), VCL_MESSAGE_INFO);
sal_uInt16 nResNo = bWeb ? STR_WEBOPTIONS : STR_TEXTOPTIONS;
- aInfoBox.set_primary_text(aInfoBox.get_primary_text().replaceFirst("%1", OUString(SW_RES(nResNo))));
- aInfoBox.Execute();
+ aInfoBox->set_primary_text(aInfoBox->get_primary_text().replaceFirst("%1", OUString(SW_RES(nResNo))));
+ aInfoBox->Execute();
SfxUInt16Item aDefPage(SID_SW_EDITOPTIONS, TP_OPTPRINT_PAGE);
GetViewFrame()->GetDispatcher()->Execute(SID_SW_EDITOPTIONS,
SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
@@ -201,9 +201,9 @@ void SwView::ExecutePrint(SfxRequest& rReq)
if(!bSilent && !bFromMerge &&
SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc())
{
- MessageDialog aBox(&GetEditWin(), "PrintMergeDialog",
+ ScopedVclPtrInstance<MessageDialog> aBox(&GetEditWin(), "PrintMergeDialog",
"modules/swriter/ui/printmergedialog.ui");
- short nRet = aBox.Execute();
+ short nRet = aBox->Execute();
if(RET_YES == nRet)
{
SfxBoolItem aBool(FN_QRY_MERGE, true);
@@ -245,8 +245,9 @@ void SwView::ExecutePrint(SfxRequest& rReq)
// Create page printer/additions for SwView and SwPagePreview
-SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent,
- const SfxItemSet &rOptions, bool bPreview )
+VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent,
+ const SfxItemSet &rOptions,
+ bool bPreview )
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "No Print Dialog");
@@ -258,7 +259,9 @@ SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent,
if (!fnCreatePage)
return NULL;
- SfxTabPage* pPage = (*fnCreatePage)(pParent, &rOptions);
+ VclPtr<SfxTabPage> pPage =
+ VclPtr<SfxTabPage>((*fnCreatePage)(pParent, &rOptions),
+ SAL_NO_ACQUIRE);
OSL_ENSURE(pPage, "No page");
if (!pPage)
return NULL;
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index b80a0c4403fb..7d222ae10473 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -390,7 +390,8 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
if ( OUString ( pPrinter->GetName()) != sPrinterName )
{
- SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
+ VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
+ assert (! pNewPrinter->isDisposed() );
if( pNewPrinter->IsKnown() )
{
// set printer only once; in _postSetValues
@@ -398,7 +399,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
}
else
{
- delete pNewPrinter;
+ pNewPrinter.disposeAndClear();
}
}
}
@@ -427,10 +428,10 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
0
};
SfxItemSet *pItemSet = new SfxItemSet( mpDoc->GetAttrPool(), nRange );
- SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet );
-
+ VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+ assert (! pPrinter->isDisposed() );
// set printer only once; in _postSetValues
- delete mpPrinter;
+ mpPrinter.disposeAndClear();
mpPrinter = pPrinter;
}
}
@@ -838,7 +839,7 @@ void SwXDocumentSettings::_postSetValues ()
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
{
// set printer only once, namely here!
- if( mpPrinter != NULL )
+ if( mpPrinter != nullptr )
{
// #i86352# the printer is also used as container for options by sfx
// when setting a printer it should have decent default options
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.hxx b/sw/source/uibase/uno/SwXDocumentSettings.hxx
index 5485a1b971c6..20f30410f8ae 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.hxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.hxx
@@ -47,7 +47,7 @@ protected:
/** the printer should be set only once; since there are several
* printer-related properties, remember the last printer and set it in
* _postSetValues */
- SfxPrinter* mpPrinter;
+ VclPtr<SfxPrinter> mpPrinter;
virtual void _preSetValues ()
throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index f570dd9954de..5c12fc645d8a 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2320,9 +2320,9 @@ Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName
return aAny;
}
-static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions )
+static VclPtr< OutputDevice > lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions )
{
- OutputDevice *pOut = 0;
+ VclPtr< OutputDevice > pOut;
uno::Any aAny( rPrintUIOptions.getValue( "RenderDevice" ));
uno::Reference< awt::XDevice > xRenderDevice;
@@ -2330,7 +2330,7 @@ static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptio
if (xRenderDevice.is())
{
VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
- pOut = pDevice ? pDevice->GetOutputDevice() : 0;
+ pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >();
}
return pOut;
@@ -2519,7 +2519,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
if (bIsSwSrcView)
{
SwSrcView& rSwSrcView = dynamic_cast<SwSrcView&>(*pView);
- OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ VclPtr< OutputDevice> pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
nRet = rSwSrcView.PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ );
}
else
@@ -2634,7 +2634,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 );
if (nPostItMode != POSTITS_NONE)
{
- OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ VclPtr< OutputDevice > pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
m_pRenderData->CreatePostItData( pDoc, pViewShell->GetViewOptions(), pOutDev );
}
@@ -2758,7 +2758,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
// Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this
// case we won't get an OutputDevice here, but then the caller also has no need
// for the correct PageSisze right now...
- Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ));
+ VclPtr< Printer > pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ).get());
if (pPrinter)
{
// HTML source view and prospect adapt to the printer's paper size
@@ -2976,7 +2976,7 @@ void SAL_CALL SwXTextDocument::render(
if (bIsSwSrcView)
{
SwSrcView& rSwSrcView = dynamic_cast<SwSrcView&>(*pView);
- OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ VclPtr< OutputDevice > pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
rSwSrcView.PrintSource(pOutDev, nRenderer + 1, false);
}
else
@@ -2998,7 +2998,7 @@ void SAL_CALL SwXTextDocument::render(
}
// get output device to use
- OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ VclPtr< OutputDevice > pOut = lcl_GetOutputDevice( *m_pPrintUIOptions );
if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions())
{
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 282a72749611..d80c5097f7dd 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -91,6 +91,7 @@
#include <unomid.h>
#include "navmgr.hxx"
+#include "SidebarWin.hxx"
#include <boost/scoped_ptr.hpp>
#define CTYPE_CNT 0
@@ -836,8 +837,15 @@ SwContentTree::SwContentTree(vcl::Window* pParent, const ResId& rResId)
SwContentTree::~SwContentTree()
{
+ disposeOnce();
+}
+
+void SwContentTree::dispose()
+{
Clear(); // If applicable erase content types previously.
bIsInDrag = false;
+ aUpdTimer.Stop();
+ SvTreeListBox::dispose();
}
OUString SwContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const
@@ -1594,11 +1602,11 @@ void SwContentTree::Display( bool bActive )
bIsLastReadOnly = bReadOnly;
bool bDisable = pShell == 0 || bReadOnly;
SwNavigationPI* pNavi = GetParentWindow();
- pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , !bDisable);
- pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, !bDisable);
- pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, !bDisable);
- pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT, !bDisable);
- pNavi->aContentToolBox.EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable);
+ pNavi->aContentToolBox->EnableItem(FN_ITEM_UP , !bDisable);
+ pNavi->aContentToolBox->EnableItem(FN_ITEM_DOWN, !bDisable);
+ pNavi->aContentToolBox->EnableItem(FN_ITEM_LEFT, !bDisable);
+ pNavi->aContentToolBox->EnableItem(FN_ITEM_RIGHT, !bDisable);
+ pNavi->aContentToolBox->EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable);
}
if(pShell)
{
@@ -1927,7 +1935,7 @@ bool SwContentTree::ToggleToRoot()
}
}
pConfig->SetRootType( nRootType );
- GetParentWindow()->aContentToolBox.CheckItem(FN_SHOW_ROOT, bIsRoot);
+ GetParentWindow()->aContentToolBox->CheckItem(FN_SHOW_ROOT, bIsRoot);
return bIsRoot;
}
@@ -2440,6 +2448,9 @@ void SwContentTree::HideTree()
IMPL_LINK_NOARG(SwContentTree, TimerUpdate)
{
+ if (IsDisposed())
+ return 0;
+
// No update while drag and drop.
// Query view because the Navigator is cleared too late.
SwView* pView = GetParentWindow()->GetCreateView();
@@ -3046,10 +3057,10 @@ bool SwContentTree::Select( SvTreeListEntry* pEntry, bool bSelect )
}
}
SwNavigationPI* pNavi = GetParentWindow();
- pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , bEnable);
- pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, bEnable);
- pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, bEnable);
- pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT,bEnable);
+ pNavi->aContentToolBox->EnableItem(FN_ITEM_UP , bEnable);
+ pNavi->aContentToolBox->EnableItem(FN_ITEM_DOWN, bEnable);
+ pNavi->aContentToolBox->EnableItem(FN_ITEM_LEFT, bEnable);
+ pNavi->aContentToolBox->EnableItem(FN_ITEM_RIGHT,bEnable);
return SvTreeListBox::Select(pEntry, bSelect);
}
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 2f4b0a5009f6..5c5a1aa75d93 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -180,8 +180,18 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, const ResId& rResId) :
SwGlobalTree::~SwGlobalTree()
{
+ disposeOnce();
+}
+
+void SwGlobalTree::dispose()
+{
delete pSwGlblDocContents;
+ pSwGlblDocContents = NULL;
delete pDocInserter;
+ pDocInserter = NULL;
+ pDefParentWin.clear();
+ aUpdateTimer.Stop();
+ SvTreeListBox::dispose();
}
sal_Int8 SwGlobalTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
@@ -505,12 +515,12 @@ void SwGlobalTree::SelectHdl()
SwNavigationPI* pNavi = GetParentWindow();
bool bReadonly = !pActiveShell ||
pActiveShell->GetView().GetDocShell()->IsReadOnly();
- pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_EDIT, nSelCount == 1 && !bReadonly);
- pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_OPEN, nSelCount <= 1 && !bReadonly);
- pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_UPDATE, GetEntryCount() > 0 && !bReadonly);
- pNavi->aGlobalToolBox.EnableItem(FN_ITEM_UP,
+ pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_EDIT, nSelCount == 1 && !bReadonly);
+ pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_OPEN, nSelCount <= 1 && !bReadonly);
+ pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_UPDATE, GetEntryCount() > 0 && !bReadonly);
+ pNavi->aGlobalToolBox->EnableItem(FN_ITEM_UP,
nSelCount == 1 && nAbsPos && !bReadonly);
- pNavi->aGlobalToolBox.EnableItem(FN_ITEM_DOWN,
+ pNavi->aGlobalToolBox->EnableItem(FN_ITEM_DOWN,
nSelCount == 1 && nAbsPos < GetEntryCount() - 1 && !bReadonly);
}
@@ -1001,7 +1011,7 @@ void SwGlobalTree::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry
IMPL_LINK_NOARG(SwGlobalTree, Timeout)
{
- if(!HasFocus() && Update( false ))
+ if(!IsDisposed() && !HasFocus() && Update( false ))
Display();
return 0;
}
diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx
index 7f18c24ab564..53980635be55 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -51,14 +51,17 @@ struct TripleString
class SwGlossDecideDlg : public ModalDialog
{
- OKButton* m_pOk;
- ListBox* m_pListLB;
+ VclPtr<OKButton> m_pOk;
+ VclPtr<ListBox> m_pListLB;
DECL_LINK(DoubleClickHdl, void*);
DECL_LINK(SelectHdl, void*);
- public:
- SwGlossDecideDlg(vcl::Window* pParent);
+public:
+ SwGlossDecideDlg(vcl::Window* pParent);
+ virtual ~SwGlossDecideDlg();
+ virtual void dispose() SAL_OVERRIDE;
+
ListBox& GetListBox() {return *m_pListLB;}
};
@@ -73,6 +76,18 @@ SwGlossDecideDlg::SwGlossDecideDlg(vcl::Window* pParent)
m_pListLB->SetSelectHdl(LINK(this, SwGlossDecideDlg, SelectHdl));
}
+SwGlossDecideDlg::~SwGlossDecideDlg()
+{
+ disposeOnce();
+}
+
+void SwGlossDecideDlg::dispose()
+{
+ m_pOk.clear();
+ m_pListLB.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK_NOARG(SwGlossDecideDlg, DoubleClickHdl)
{
EndDialog(RET_OK);
@@ -143,16 +158,16 @@ bool SwGlossaryList::GetShortName(const OUString& rLongName,
}
else if(1 < nCount)
{
- SwGlossDecideDlg aDlg(0);
- OUString sTitle = aDlg.GetText() + " " + aTripleStrings.front().sBlock;
- aDlg.SetText(sTitle);
+ ScopedVclPtrInstance< SwGlossDecideDlg > aDlg(nullptr);
+ OUString sTitle = aDlg->GetText() + " " + aTripleStrings.front().sBlock;
+ aDlg->SetText(sTitle);
- ListBox& rLB = aDlg.GetListBox();
+ ListBox& rLB = aDlg->GetListBox();
for(std::vector<TripleString>::const_iterator i = aTripleStrings.begin(); i != aTripleStrings.end(); ++i)
rLB.InsertEntry(i->sGroup.getToken(0, GLOS_DELIM));
rLB.SelectEntryPos(0);
- if(RET_OK == aDlg.Execute() &&
+ if(RET_OK == aDlg->Execute() &&
LISTBOX_ENTRY_NOTFOUND != rLB.GetSelectEntryPos())
{
const TripleString& pTriple(aTripleStrings[rLB.GetSelectEntryPos()]);
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 946d409c1e58..b23fbb88f3b3 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -135,13 +135,13 @@ IMPL_LINK( SwNavigationPI, DocListBoxSelectHdl, ListBox *, pBox )
if(!pView)
{
nEntryIdx == 0 ?
- aContentTree.ShowHiddenShell():
- aContentTree.ShowActualView();
+ aContentTree->ShowHiddenShell():
+ aContentTree->ShowActualView();
}
else
{
- aContentTree.SetConstantShell(pView->GetWrtShellPtr());
+ aContentTree->SetConstantShell(pView->GetWrtShellPtr());
}
return 0;
}
@@ -153,23 +153,23 @@ void SwNavigationPI::FillBox()
{
if(pContentWrtShell)
{
- aContentTree.SetHiddenShell( pContentWrtShell );
- aContentTree.Display( false );
+ aContentTree->SetHiddenShell( pContentWrtShell );
+ aContentTree->Display( false );
}
else
{
SwView *pView = GetCreateView();
if(!pView)
{
- aContentTree.SetActiveShell(0);
+ aContentTree->SetActiveShell(0);
}
else if( pView != pActContView)
{
SwWrtShell* pWrtShell = pView->GetWrtShellPtr();
- aContentTree.SetActiveShell(pWrtShell);
+ aContentTree->SetActiveShell(pWrtShell);
}
else
- aContentTree.Display( true );
+ aContentTree->Display( true );
pActContView = pView;
}
}
@@ -222,7 +222,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox )
break;
case FN_SHOW_ROOT:
{
- aContentTree.ToggleToRoot();
+ aContentTree->ToggleToRoot();
}
break;
case FN_SHOW_CONTENT_BOX:
@@ -305,9 +305,9 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox )
case FN_GLOBAL_EDIT:
{
if(IsGlobalMode())
- aGlobalTree.ExecCommand(nCurrItemId);
+ aGlobalTree->ExecCommand(nCurrItemId);
else
- aContentTree.ExecCommand(nCurrItemId, bOutlineWithChildren);
+ aContentTree->ExecCommand(nCurrItemId, bOutlineWithChildren);
}
break;
case FN_GLOBAL_SWITCH:
@@ -343,7 +343,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxClickHdl, ToolBox *, pBox )
case FN_GLOBAL_UPDATE:
case FN_GLOBAL_OPEN:
{
- aGlobalTree.TbxMenuHdl(nCurrItemId, pBox);
+ aGlobalTree->TbxMenuHdl(nCurrItemId, pBox);
}
break;
}
@@ -396,7 +396,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox )
pMenu->InsertItem( i, OUString::number(i - 100) );
pMenu->SetHelpId( i, HID_NAVI_OUTLINES );
}
- pMenu->CheckItem( aContentTree.GetOutlineLevel() + 100 );
+ pMenu->CheckItem( aContentTree->GetOutlineLevel() + 100 );
pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl));
pBox->SetItemDown( nCurrItemId, true );
pMenu->Execute( pBox,
@@ -435,7 +435,7 @@ void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, bool bSetFocus
Rectangle aRect(rRect);
Point aT1 = aRect.TopLeft();
- aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox.OutputToAbsoluteScreenPixel(aT1)));
+ aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox->OutputToAbsoluteScreenPixel(aT1)));
aRect.SetPos(aT1);
pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_RIGHT|FLOATWIN_POPUPMODE_ALLOWTEAROFF);
SetPopupWindow( pPopup );
@@ -544,18 +544,18 @@ void SwNavigationPI::_ZoomOut()
FillBox();
if(IsGlobalMode())
{
- aGlobalTree.ShowTree();
+ aGlobalTree->ShowTree();
}
else
{
- aContentTree.ShowTree();
- aDocListBox.Show();
+ aContentTree->ShowTree();
+ aDocListBox->Show();
}
- SvTreeListEntry* pFirst = aContentTree.FirstSelected();
+ SvTreeListEntry* pFirst = aContentTree->FirstSelected();
if(pFirst)
- aContentTree.Select(pFirst, true); // Enable toolbox
+ aContentTree->Select(pFirst, true); // Enable toolbox
pConfig->SetSmall( false );
- aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX);
+ aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX);
}
}
@@ -567,9 +567,9 @@ void SwNavigationPI::_ZoomIn()
if (pFloat &&
(!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
{
- aContentTree.HideTree();
- aDocListBox.Hide();
- aGlobalTree.HideTree();
+ aContentTree->HideTree();
+ aDocListBox->Hide();
+ aGlobalTree->HideTree();
bIsZoomedIn = true;
Size aSz(GetOutputSizePixel());
if( aSz.Height() > nZoomIn )
@@ -580,11 +580,11 @@ void SwNavigationPI::_ZoomIn()
static_cast<SfxDockingWindow*>(GetParent())->SetMinOutputSizePixel(Size(
aMinOutSizePixel.Width(), aSz.Height()));
pFloat->SetOutputSizePixel(aSz);
- SvTreeListEntry* pFirst = aContentTree.FirstSelected();
+ SvTreeListEntry* pFirst = aContentTree->FirstSelected();
if(pFirst)
- aContentTree.Select(pFirst, true); // Enable toolbox
+ aContentTree->Select(pFirst, true); // Enable toolbox
pConfig->SetSmall( true );
- aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, false);
+ aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX, false);
}
}
}
@@ -616,25 +616,25 @@ void SwNavigationPI::Resize()
pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel);
}
- const Point aPos = aContentTree.GetPosPixel();
- Point aLBPos = aDocListBox.GetPosPixel();
+ const Point aPos = aContentTree->GetPosPixel();
+ Point aLBPos = aDocListBox->GetPosPixel();
long nDist = aPos.X();
aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist);
aNewSize.Width() -= 2 * nDist;
aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist;
- aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() );
+ aDocListBox->Show(!aGlobalTree->IsVisible() && aLBPos.Y() > aPos.Y() );
- Size aDocLBSz = aDocListBox.GetSizePixel();
+ Size aDocLBSz = aDocListBox->GetSizePixel();
aDocLBSz.Width() = aNewSize.Width();
if(aNewSize.Height() < 0)
aDocLBSz.Height() = 0;
else
aDocLBSz.Height() = nDocLBIniHeight;
- aContentTree.SetSizePixel(aNewSize);
+ aContentTree->SetSizePixel(aNewSize);
// GlobalTree starts on to the top and goes all the way down.
- aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y());
- aGlobalTree.SetSizePixel(aNewSize);
- aDocListBox.setPosSizePixel( aLBPos.X(), aLBPos.Y(),
+ aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree->GetPosPixel().Y());
+ aGlobalTree->SetSizePixel(aNewSize);
+ aDocListBox->setPosSizePixel( aLBPos.X(), aLBPos.Y(),
aDocLBSz.Width(), aDocLBSz.Height(),
WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
}
@@ -647,12 +647,12 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
Window( pParent, SW_RES(DLG_NAVIGATION_PI)),
SfxControllerItem( SID_DOCFULLNAME, *_pBindings ),
- aContentToolBox(this, SW_RES(TB_CONTENT)),
- aGlobalToolBox(this, SW_RES(TB_GLOBAL)),
+ aContentToolBox(VclPtr<SwNavHelpToolBox>::Create(this, SW_RES(TB_CONTENT))),
+ aGlobalToolBox(VclPtr<SwHelpToolBox>::Create(this, SW_RES(TB_GLOBAL))),
aContentImageList(SW_RES(IL_CONTENT)),
- aContentTree(this, SW_RES(TL_CONTENT)),
- aGlobalTree(this, SW_RES(TL_GLOBAL)),
- aDocListBox(this, SW_RES(LB_DOCS)),
+ aContentTree(VclPtr<SwContentTree>::Create(this, SW_RES(TL_CONTENT))),
+ aGlobalTree(VclPtr<SwGlobalTree>::Create(this, SW_RES(TL_GLOBAL))),
+ aDocListBox(VclPtr<ListBox>::Create(this, SW_RES(LB_DOCS))),
pxObjectShell(0),
pContentView(0),
@@ -679,17 +679,17 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
GetCreateView();
InitImageList();
- aContentToolBox.SetHelpId(HID_NAVIGATOR_TOOLBOX );
- aGlobalToolBox.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX);
- aDocListBox.SetHelpId(HID_NAVIGATOR_LISTBOX );
- aDocListBox.SetDropDownLineCount(9);
+ aContentToolBox->SetHelpId(HID_NAVIGATOR_TOOLBOX );
+ aGlobalToolBox->SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX);
+ aDocListBox->SetHelpId(HID_NAVIGATOR_LISTBOX );
+ aDocListBox->SetDropDownLineCount(9);
- nDocLBIniHeight = aDocListBox.GetSizePixel().Height();
+ nDocLBIniHeight = aDocListBox->GetSizePixel().Height();
nZoomOutInit = nZoomOut = Resource::ReadShortRes();
// Insert the numeric field in the toolbox.
- NumEditAction* pEdit = new NumEditAction(
- &aContentToolBox, SW_RES(NF_PAGE ));
+ VclPtr<NumEditAction> pEdit = VclPtr<NumEditAction>::Create(
+ aContentToolBox.get(), SW_RES(NF_PAGE ));
pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction));
pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus));
pEdit->SetAccessibleName(pEdit->GetQuickHelpText());
@@ -700,16 +700,16 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
// Double separators are not allowed, so you have to
// determine the suitable size differently.
- Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SELECT_FOOTNOTE);
- Rectangle aSecondRect = aContentToolBox.GetItemRect(FN_SELECT_HEADER);
+ Rectangle aFirstRect = aContentToolBox->GetItemRect(FN_SELECT_FOOTNOTE);
+ Rectangle aSecondRect = aContentToolBox->GetItemRect(FN_SELECT_HEADER);
Size aItemWinSize( aFirstRect.Left() - aSecondRect.Left(),
aFirstRect.Bottom() - aFirstRect.Top() );
pEdit->SetSizePixel(aItemWinSize);
- aContentToolBox.InsertSeparator(4);
- aContentToolBox.InsertWindow( FN_PAGENUMBER, pEdit, ToolBoxItemBits::NONE, 4);
- aContentToolBox.InsertSeparator(4);
- aContentToolBox.SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16);
- aContentToolBox.ShowItem( FN_PAGENUMBER );
+ aContentToolBox->InsertSeparator(4);
+ aContentToolBox->InsertWindow( FN_PAGENUMBER, pEdit, ToolBoxItemBits::NONE, 4);
+ aContentToolBox->InsertSeparator(4);
+ aContentToolBox->SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16);
+ aContentToolBox->ShowItem( FN_PAGENUMBER );
for( sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++ )
{
@@ -724,15 +724,15 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
nZoomIn = (short)rOutSize.Height();
// Make sure the toolbox has a size that fits all its contents
- Size aContentToolboxSize( aContentToolBox.CalcWindowSizePixel() );
- aContentToolBox.SetOutputSizePixel( aContentToolboxSize );
+ Size aContentToolboxSize( aContentToolBox->CalcWindowSizePixel() );
+ aContentToolBox->SetOutputSizePixel( aContentToolboxSize );
// position listbox below toolbar and add some space
- long nListboxYPos = aContentToolBox.GetPosPixel().Y() + aContentToolboxSize.Height() + 4;
+ long nListboxYPos = aContentToolBox->GetPosPixel().Y() + aContentToolboxSize.Height() + 4;
// The left and right margins around the toolboxes should be equal.
nWishWidth = aContentToolboxSize.Width();
- nWishWidth += 2 * aContentToolBox.GetPosPixel().X();
+ nWishWidth += 2 * aContentToolBox->GetPosPixel().X();
DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent);
if (pDockingParent != NULL)
@@ -758,76 +758,76 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
}
}
- aContentTree.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
- aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
+ aContentTree->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+ aContentTree->SetStyle( aContentTree->GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
- aContentTree.SetSpaceBetweenEntries(3);
- aContentTree.SetSelectionMode( SINGLE_SELECTION );
- aContentTree.SetDragDropMode( DragDropMode::CTRL_MOVE |
- DragDropMode::CTRL_COPY |
- DragDropMode::ENABLE_TOP );
- aContentTree.EnableAsyncDrag(true);
- aContentTree.ShowTree();
- aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, true);
+ aContentTree->SetSpaceBetweenEntries(3);
+ aContentTree->SetSelectionMode( SINGLE_SELECTION );
+ aContentTree->SetDragDropMode( DragDropMode::CTRL_MOVE |
+ DragDropMode::CTRL_COPY |
+ DragDropMode::ENABLE_TOP );
+ aContentTree->EnableAsyncDrag(true);
+ aContentTree->ShowTree();
+ aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX, true);
// TreeListBox for global document
- aGlobalTree.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
- aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION );
- aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
+ aGlobalTree->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+ aGlobalTree->SetSelectionMode( MULTIPLE_SELECTION );
+ aGlobalTree->SetStyle( aGlobalTree->GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
WB_CLIPCHILDREN|WB_HSCROLL );
- Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel());
- aGlobalToolBox.SetSizePixel(aGlblSize);
+ Size aGlblSize(aGlobalToolBox->CalcWindowSizePixel());
+ aGlobalToolBox->SetSizePixel(aGlblSize);
// Handler
Link aLk = LINK(this, SwNavigationPI, ToolBoxSelectHdl);
- aContentToolBox.SetSelectHdl( aLk );
- aGlobalToolBox.SetSelectHdl( aLk );
- aDocListBox.SetSelectHdl(LINK(this, SwNavigationPI,
+ aContentToolBox->SetSelectHdl( aLk );
+ aGlobalToolBox->SetSelectHdl( aLk );
+ aDocListBox->SetSelectHdl(LINK(this, SwNavigationPI,
DocListBoxSelectHdl));
- aContentToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
- aContentToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
- aGlobalToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
- aGlobalToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
- aGlobalToolBox.CheckItem(FN_GLOBAL_SWITCH, true);
+ aContentToolBox->SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
+ aContentToolBox->SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
+ aGlobalToolBox->SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
+ aGlobalToolBox->SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
+ aGlobalToolBox->CheckItem(FN_GLOBAL_SWITCH, true);
vcl::Font aFont(GetFont());
aFont.SetWeight(WEIGHT_NORMAL);
GetPageEdit().SetFont(aFont);
- aFont = aContentTree.GetFont();
+ aFont = aContentTree->GetFont();
aFont.SetWeight(WEIGHT_NORMAL);
- aContentTree.SetFont(aFont);
- aGlobalTree.SetFont(aFont);
+ aContentTree->SetFont(aFont);
+ aGlobalTree->SetFont(aFont);
StartListening(*SfxGetpApp());
if ( pCreateView )
StartListening(*pCreateView);
SfxImageManager* pImgMan = SfxImageManager::GetImageManager(*SW_MOD());
- pImgMan->RegisterToolBox(&aContentToolBox, SfxToolboxFlags::CHANGEOUTSTYLE);
- pImgMan->RegisterToolBox(&aGlobalToolBox, SfxToolboxFlags::CHANGEOUTSTYLE);
+ pImgMan->RegisterToolBox(aContentToolBox.get(), SfxToolboxFlags::CHANGEOUTSTYLE);
+ pImgMan->RegisterToolBox(aGlobalToolBox.get(), SfxToolboxFlags::CHANGEOUTSTYLE);
- aContentToolBox.SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox.GetItemBits( FN_CREATE_NAVIGATION ) | ToolBoxItemBits::DROPDOWNONLY );
- aContentToolBox.SetItemBits( FN_DROP_REGION, aContentToolBox.GetItemBits( FN_DROP_REGION ) | ToolBoxItemBits::DROPDOWNONLY );
- aContentToolBox.SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox.GetItemBits( FN_OUTLINE_LEVEL ) | ToolBoxItemBits::DROPDOWNONLY );
+ aContentToolBox->SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox->GetItemBits( FN_CREATE_NAVIGATION ) | ToolBoxItemBits::DROPDOWNONLY );
+ aContentToolBox->SetItemBits( FN_DROP_REGION, aContentToolBox->GetItemBits( FN_DROP_REGION ) | ToolBoxItemBits::DROPDOWNONLY );
+ aContentToolBox->SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox->GetItemBits( FN_OUTLINE_LEVEL ) | ToolBoxItemBits::DROPDOWNONLY );
if(IsGlobalDoc())
{
SwView *pActView = GetCreateView();
- aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT,
+ aGlobalToolBox->CheckItem(FN_GLOBAL_SAVE_CONTENT,
pActView->GetWrtShellPtr()->IsGlblDocSaveLinks());
if(pConfig->IsGlobalActive())
ToggleTree();
- aGlobalTree.GrabFocus();
+ aGlobalTree->GrabFocus();
}
else
- aContentTree.GrabFocus();
+ aContentTree->GrabFocus();
UsePage(0);
aPageChgIdle.SetIdleHdl(LINK(this, SwNavigationPI, ChangePageHdl));
aPageChgIdle.SetPriority(SchedulerPriority::LOWEST);
- aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT));
- aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL));
- aDocListBox.SetAccessibleName(aStatusArr[3]);
+ aContentTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT));
+ aGlobalTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL));
+ aDocListBox->SetAccessibleName(aStatusArr[3]);
if (pContextWin == NULL)
{
@@ -835,12 +835,17 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
// displayed in the sidebar. While the navigator could change
// its size, the sidebar can not, and the navigator would just
// waste space. Therefore hide this button.
- aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX));
+ aContentToolBox->RemoveItem(aContentToolBox->GetItemPos(FN_SHOW_CONTENT_BOX));
}
}
SwNavigationPI::~SwNavigationPI()
{
+ disposeOnce();
+}
+
+void SwNavigationPI::dispose()
+{
if(IsGlobalDoc() && !IsGlobalMode())
{
SwView *pView = GetCreateView();
@@ -852,21 +857,31 @@ SwNavigationPI::~SwNavigationPI()
EndListening(*SfxGetpApp());
SfxImageManager* pImgMan = SfxImageManager::GetImageManager(*SW_MOD());
- pImgMan->ReleaseToolBox(&aContentToolBox);
- pImgMan->ReleaseToolBox(&aGlobalToolBox);
- delete aContentToolBox.GetItemWindow(FN_PAGENUMBER);
- aContentToolBox.Clear();
+ pImgMan->ReleaseToolBox(aContentToolBox.get());
+ pImgMan->ReleaseToolBox(aGlobalToolBox.get());
+ aContentToolBox->GetItemWindow(FN_PAGENUMBER)->disposeOnce();
+ aContentToolBox->Clear();
if(pxObjectShell)
{
if(pxObjectShell->Is())
(*pxObjectShell)->DoClose();
delete pxObjectShell;
}
- delete pPopupWindow;
- delete pFloatingWindow;
if ( IsBound() )
rBindings.Release(*this);
+
+ pPopupWindow.disposeAndClear();
+ pFloatingWindow.disposeAndClear();
+ aContentToolBox.disposeAndClear();
+ aGlobalToolBox.disposeAndClear();
+ aContentTree.disposeAndClear();
+ aGlobalTree.disposeAndClear();
+ aDocListBox.disposeAndClear();
+
+ aPageChgIdle.Stop();
+
+ vcl::Window::dispose();
}
void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow )
@@ -882,7 +897,7 @@ IMPL_LINK_NOARG(SwNavigationPI, PopupModeEndHdl)
{
// Replace floating window with popup window and destroy
// floating window instance.
- delete pFloatingWindow;
+ pFloatingWindow.disposeAndClear();
pFloatingWindow = pPopupWindow;
pPopupWindow = 0;
}
@@ -915,9 +930,9 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
if(pActView)
{
SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
- aContentTree.SetActiveShell(pWrtShell);
+ aContentTree->SetActiveShell(pWrtShell);
bool bGlobal = IsGlobalDoc();
- aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal);
+ aContentToolBox->EnableItem(FN_GLOBAL_SWITCH, bGlobal);
if( (!bGlobal && IsGlobalMode()) ||
(!IsGlobalMode() && pConfig->IsGlobalActive()) )
{
@@ -925,12 +940,12 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
}
if(bGlobal)
{
- aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks());
+ aGlobalToolBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks());
}
}
else
{
- aContentTree.SetActiveShell(0);
+ aContentTree->SetActiveShell(0);
}
UpdateListBox();
}
@@ -940,7 +955,7 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
NumEditAction& SwNavigationPI::GetPageEdit()
{
- return *static_cast<NumEditAction*>(aContentToolBox.GetItemWindow(FN_PAGENUMBER));
+ return *static_cast<NumEditAction*>(aContentToolBox->GetItemWindow(FN_PAGENUMBER));
}
// Notification on modified DocInfo
@@ -969,15 +984,15 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint )
if(pActView)
{
SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
- aContentTree.SetActiveShell(pWrtShell);
- if(aGlobalTree.IsVisible())
+ aContentTree->SetActiveShell(pWrtShell);
+ if(aGlobalTree->IsVisible())
{
- if(aGlobalTree.Update( false ))
- aGlobalTree.Display();
+ if(aGlobalTree->Update( false ))
+ aGlobalTree->Display();
else
// If no update is needed, then paint at least,
// because of the red entries for the broken links.
- aGlobalTree.Invalidate();
+ aGlobalTree->Invalidate();
}
}
}
@@ -993,24 +1008,24 @@ IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu )
if(nMenuId < 100)
SetRegionDropMode( --nMenuId);
else
- aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) );
+ aContentTree->SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) );
}
return 0;
}
void SwNavigationPI::UpdateListBox()
{
- aDocListBox.SetUpdateMode(false);
- aDocListBox.Clear();
+ aDocListBox->SetUpdateMode(false);
+ aDocListBox->Clear();
SwView *pActView = GetCreateView();
bool bDisable = pActView == 0;
SwView *pView = SwModule::GetFirstView();
sal_Int32 nCount = 0;
sal_Int32 nAct = 0;
sal_Int32 nConstPos = 0;
- const SwView* pConstView = aContentTree.IsConstantView() &&
- aContentTree.GetActiveWrtShell() ?
- &aContentTree.GetActiveWrtShell()->GetView():
+ const SwView* pConstView = aContentTree->IsConstantView() &&
+ aContentTree->GetActiveWrtShell() ?
+ &aContentTree->GetActiveWrtShell()->GetView():
0;
while (pView)
{
@@ -1028,7 +1043,7 @@ void SwNavigationPI::UpdateListBox()
else
sEntry += aStatusArr[ST_INACTIVE - ST_STATUS_FIRST];
sEntry += ")";
- aDocListBox.InsertEntry(sEntry);
+ aDocListBox->InsertEntry(sEntry);
if (pConstView && pView == pConstView)
nConstPos = nCount;
@@ -1037,33 +1052,33 @@ void SwNavigationPI::UpdateListBox()
}
pView = SwModule::GetNextView(pView);
}
- aDocListBox.InsertEntry(aStatusArr[3]); // "Active Window"
+ aDocListBox->InsertEntry(aStatusArr[3]); // "Active Window"
nCount++;
- if(aContentTree.GetHiddenWrtShell())
+ if(aContentTree->GetHiddenWrtShell())
{
- OUString sEntry = aContentTree.GetHiddenWrtShell()->GetView().
+ OUString sEntry = aContentTree->GetHiddenWrtShell()->GetView().
GetDocShell()->GetTitle();
sEntry += " (";
sEntry += aStatusArr[ST_HIDDEN - ST_STATUS_FIRST];
sEntry += ")";
- aDocListBox.InsertEntry(sEntry);
+ aDocListBox->InsertEntry(sEntry);
bDisable = false;
}
- if(aContentTree.IsActiveView())
+ if(aContentTree->IsActiveView())
{
//Either the name of the current Document or "Active Document".
- aDocListBox.SelectEntryPos( pActView ? nAct : --nCount );
+ aDocListBox->SelectEntryPos( pActView ? nAct : --nCount );
}
- else if(aContentTree.IsHiddenView())
+ else if(aContentTree->IsHiddenView())
{
- aDocListBox.SelectEntryPos(nCount);
+ aDocListBox->SelectEntryPos(nCount);
}
else
- aDocListBox.SelectEntryPos(nConstPos);
+ aDocListBox->SelectEntryPos(nConstPos);
- aDocListBox.Enable( !bDisable );
- aDocListBox.SetUpdateMode(true);
+ aDocListBox->Enable( !bDisable );
+ aDocListBox->SetUpdateMode(true);
}
IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem)
@@ -1074,7 +1089,7 @@ IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem)
SfxViewFrame* pFrame = pFrameItem->GetFrame();
if(pFrame)
{
- aContentTree.Clear();
+ aContentTree->Clear();
pContentView = PTR_CAST(SwView, pFrame->GetViewShell());
OSL_ENSURE(pContentView, "no SwView");
if(pContentView)
@@ -1083,7 +1098,7 @@ IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem)
pContentWrtShell = 0;
pxObjectShell = new SfxObjectShellLock(pFrame->GetObjectShell());
FillBox();
- aContentTree.Update();
+ aContentTree->Update();
}
}
return 0;
@@ -1125,14 +1140,14 @@ OUString SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData )
sal_Int8 SwNavigationPI::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
{
return ( !SwContentTree::IsInDrag() &&
- ( aContentTree.IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) ||
- aContentTree.IsDropFormatSupported( SotClipboardFormatId::STRING ) ||
- aContentTree.IsDropFormatSupported( SotClipboardFormatId::SOLK ) ||
- aContentTree.IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )||
- aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILECONTENT ) ||
- aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR ) ||
- aContentTree.IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) ||
- aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILENAME )))
+ ( aContentTree->IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) ||
+ aContentTree->IsDropFormatSupported( SotClipboardFormatId::STRING ) ||
+ aContentTree->IsDropFormatSupported( SotClipboardFormatId::SOLK ) ||
+ aContentTree->IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )||
+ aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILECONTENT ) ||
+ aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR ) ||
+ aContentTree->IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) ||
+ aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILENAME )))
? DND_ACTION_COPY
: DND_ACTION_NONE;
}
@@ -1157,7 +1172,7 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt )
sContentFileName = sFileName;
if(pxObjectShell)
{
- aContentTree.SetHiddenShell( 0 );
+ aContentTree->SetHiddenShell( 0 );
(*pxObjectShell)->DoClose();
DELETEZ( pxObjectShell);
}
@@ -1187,7 +1202,7 @@ void SwNavigationPI::SetRegionDropMode(sal_uInt16 nNewMode)
ImageList& rImgLst = aContentImageList;
- aContentToolBox.SetItemImage( FN_DROP_REGION, rImgLst.GetImage(nDropId));
+ aContentToolBox->SetItemImage( FN_DROP_REGION, rImgLst.GetImage(nDropId));
}
bool SwNavigationPI::ToggleTree()
@@ -1199,23 +1214,23 @@ bool SwNavigationPI::ToggleTree()
SetUpdateMode(false);
if(_IsZoomedIn())
_ZoomOut();
- aGlobalTree.ShowTree();
- aGlobalToolBox.Show();
- aContentTree.HideTree();
- aContentToolBox.Hide();
- aDocListBox.Hide();
+ aGlobalTree->ShowTree();
+ aGlobalToolBox->Show();
+ aContentTree->HideTree();
+ aContentToolBox->Hide();
+ aDocListBox->Hide();
SetGlobalMode(true);
SetUpdateMode(true);
}
else
{
- aGlobalTree.HideTree();
- aGlobalToolBox.Hide();
+ aGlobalTree->HideTree();
+ aGlobalToolBox->Hide();
if(!_IsZoomedIn())
{
- aContentTree.ShowTree();
- aContentToolBox.Show();
- aDocListBox.Show();
+ aContentTree->ShowTree();
+ aContentToolBox->Show();
+ aDocListBox->Show();
}
bRet = false;
SetGlobalMode(false);
@@ -1237,8 +1252,11 @@ bool SwNavigationPI::IsGlobalDoc() const
IMPL_LINK_NOARG(SwNavigationPI, ChangePageHdl)
{
- EditAction(&GetPageEdit());
- GetPageEdit().GrabFocus();
+ if (!IsDisposed())
+ {
+ EditAction(&GetPageEdit());
+ GetPageEdit().GrabFocus();
+ }
return 0;
}
@@ -1275,7 +1293,7 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent,
SfxChildWinInfo* )
: SfxChildWindowContext( nId )
{
- SwNavigationPI* pNavi = new SwNavigationPI( _pBindings, this, pParent );
+ VclPtr<SwNavigationPI> pNavi = VclPtr<SwNavigationPI>::Create( _pBindings, this, pParent );
SetWindow( pNavi );
_pBindings->Invalidate(SID_NAVIGATOR);
@@ -1284,10 +1302,10 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent,
const sal_uInt16 nRootType = static_cast< sal_uInt16 >( pNaviConfig->GetRootType() );
if( nRootType < CONTENT_TYPE_MAX )
{
- pNavi->aContentTree.SetRootType(nRootType);
- pNavi->aContentToolBox.CheckItem(FN_SHOW_ROOT, true);
+ pNavi->aContentTree->SetRootType(nRootType);
+ pNavi->aContentToolBox->CheckItem(FN_SHOW_ROOT, true);
}
- pNavi->aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) );
+ pNavi->aContentTree->SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) );
pNavi->SetRegionDropMode( static_cast< sal_uInt16 >( pNaviConfig->GetRegionMode() ) );
if(GetFloatingWindow() && pNaviConfig->IsSmall())
@@ -1313,20 +1331,20 @@ void SwNavigationPI::DataChanged( const DataChangedEvent& rDCEvt )
void SwNavigationPI::InitImageList()
{
ImageList& rImgLst = aContentImageList;
- for( sal_uInt16 k = 0; k < aContentToolBox.GetItemCount(); k++)
- aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k),
- rImgLst.GetImage(aContentToolBox.GetItemId(k)));
+ for( sal_uInt16 k = 0; k < aContentToolBox->GetItemCount(); k++)
+ aContentToolBox->SetItemImage(aContentToolBox->GetItemId(k),
+ rImgLst.GetImage(aContentToolBox->GetItemId(k)));
- for( sal_uInt16 k = 0; k < aGlobalToolBox.GetItemCount(); k++)
- aGlobalToolBox.SetItemImage(aGlobalToolBox.GetItemId(k),
- rImgLst.GetImage(aGlobalToolBox.GetItemId(k)));
+ for( sal_uInt16 k = 0; k < aGlobalToolBox->GetItemCount(); k++)
+ aGlobalToolBox->SetItemImage(aGlobalToolBox->GetItemId(k),
+ rImgLst.GetImage(aGlobalToolBox->GetItemId(k)));
sal_uInt16 nDropId = FN_DROP_REGION;
if(nRegionMode == REGION_MODE_LINK)
nDropId = FN_DROP_REGION_LINK;
else if(nRegionMode == REGION_MODE_EMBEDDED)
nDropId = FN_DROP_REGION_COPY;
- aContentToolBox.SetItemImage( FN_DROP_REGION,
+ aContentToolBox->SetItemImage( FN_DROP_REGION,
rImgLst.GetImage(nDropId));
}
diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx
index c4ad0d190093..56d87e6edb49 100644
--- a/sw/source/uibase/utlui/numfmtlb.cxx
+++ b/sw/source/uibase/utlui/numfmtlb.cxx
@@ -109,7 +109,13 @@ void NumFormatListBox::Init(short nFormatType, bool bUsrFmts)
NumFormatListBox::~NumFormatListBox()
{
+ disposeOnce();
+}
+
+void NumFormatListBox::dispose()
+{
delete pOwnFormatter;
+ ListBox::dispose();
}
SwView* NumFormatListBox::GetView()
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index 707f361d5020..a7446c3a4096 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -66,7 +66,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin,
sal_uInt32 nFlags,
const Link* pInitializedLink,
const OUString* pURL ) :
- aTopWindow(&rWin, this),
+ aTopWindow(VclPtr<SwFrmCtrlWindow>::Create(&rWin, this)),
aMenuRes(SW_RES(RES_FRMEX_MENU)),
pModuleView(SW_MOD()->GetView()),
nStyleFlags(nFlags),
@@ -76,7 +76,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin,
if (pURL && !pURL->isEmpty())
sArgumentURL = *pURL;
- aTopWindow.SetPosSizePixel(Point(0, 0), rWin.GetSizePixel());
+ aTopWindow->SetPosSizePixel(Point(0, 0), rWin.GetSizePixel());
if( pInitializedLink )
aInitializedLink = *pInitializedLink;
@@ -87,7 +87,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin,
CreateControl();
- aTopWindow.Show();
+ aTopWindow->Show();
}
void SwOneExampleFrame::CreateErrorMessage(vcl::Window* pParent)
@@ -117,7 +117,7 @@ void SwOneExampleFrame::CreateControl()
_xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY);
if(_xControl.is())
{
- uno::Reference< awt::XWindowPeer > xParent( aTopWindow.GetComponentInterface() );
+ uno::Reference< awt::XWindowPeer > xParent( aTopWindow->GetComponentInterface() );
uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
@@ -125,7 +125,7 @@ void SwOneExampleFrame::CreateControl()
uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY );
xWin->setVisible(sal_False);
- Size aWinSize(aTopWindow.GetOutputSizePixel());
+ Size aWinSize(aTopWindow->GetOutputSizePixel());
xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY);
@@ -361,7 +361,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
}
uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY );
- Size aWinSize(aTopWindow.GetOutputSizePixel());
+ Size aWinSize(aTopWindow->GetOutputSizePixel());
xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
// can only be done here - the SFX changes the ScrollBar values
@@ -376,7 +376,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
xScrCrsr->screenUp();
xWin->setVisible( sal_True );
- aTopWindow.Show();
+ aTopWindow->Show();
if( xTunnel.is() )
{
@@ -482,7 +482,7 @@ void SwOneExampleFrame::CreatePopup(const Point& rPt)
aPop.SetPopupMenu( ITEM_ZOOM, &aSubPop1 );
aSubPop1.SetSelectHdl(aSelLk);
}
- aPop.Execute( &aTopWindow, rPt );
+ aPop.Execute( aTopWindow.get(), rPt );
}
diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx
index 13da483cde92..b9215fcdbfb4 100644
--- a/toolkit/source/awt/animatedimagespeer.cxx
+++ b/toolkit/source/awt/animatedimagespeer.cxx
@@ -182,8 +182,8 @@ namespace toolkit
void lcl_updateImageList_nothrow( AnimatedImagesPeer_Data& i_data )
{
- Throbber* pThrobber = dynamic_cast< Throbber* >( i_data.rAntiImpl.GetWindow() );
- if ( pThrobber == NULL )
+ VclPtr<Throbber> pThrobber = i_data.rAntiImpl.GetAsDynamic<Throbber>();
+ if ( !pThrobber )
return;
try
@@ -308,40 +308,37 @@ namespace toolkit
}
- void SAL_CALL AnimatedImagesPeer::startAnimation( ) throw (RuntimeException, std::exception)
+ void SAL_CALL AnimatedImagesPeer::startAnimation() throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
- if ( pThrobber != NULL)
+ VclPtr<Throbber> pThrobber = GetAsDynamic<Throbber>();
+ if (pThrobber)
pThrobber->start();
}
-
- void SAL_CALL AnimatedImagesPeer::stopAnimation( ) throw (RuntimeException, std::exception)
+ void SAL_CALL AnimatedImagesPeer::stopAnimation() throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
- if ( pThrobber != NULL)
+ VclPtr<Throbber> pThrobber = GetAsDynamic<Throbber>();
+ if (pThrobber)
pThrobber->stop();
}
-
- sal_Bool SAL_CALL AnimatedImagesPeer::isAnimationRunning( ) throw (RuntimeException, std::exception)
+ sal_Bool SAL_CALL AnimatedImagesPeer::isAnimationRunning() throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
- if ( pThrobber != NULL)
+ VclPtr<Throbber> pThrobber = GetAsDynamic<Throbber>();
+ if (pThrobber)
return pThrobber->isRunning();
return sal_False;
}
-
void SAL_CALL AnimatedImagesPeer::setProperty( const OUString& i_propertyName, const Any& i_value ) throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
- if ( pThrobber == NULL )
+ VclPtr<Throbber> pThrobber = GetAsDynamic<Throbber>();
+ if ( pThrobber )
{
VCLXWindow::setProperty( i_propertyName, i_value );
return;
@@ -368,11 +365,9 @@ namespace toolkit
case BASEPROPERTY_IMAGE_SCALE_MODE:
{
sal_Int16 nScaleMode( ImageScaleMode::ANISOTROPIC );
- ImageControl* pImageControl = dynamic_cast< ImageControl* >( GetWindow() );
+ VclPtr<ImageControl> pImageControl = GetAsDynamic< ImageControl >();
if ( pImageControl && ( i_value >>= nScaleMode ) )
- {
pImageControl->SetScaleMode( nScaleMode );
- }
}
break;
@@ -389,8 +384,8 @@ namespace toolkit
Any aReturn;
- Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
- if ( pThrobber == NULL )
+ VclPtr<Throbber> pThrobber = GetAsDynamic<Throbber>();
+ if ( !pThrobber )
return VCLXWindow::getProperty( i_propertyName );
const sal_uInt16 nPropertyId = GetPropertyId( i_propertyName );
@@ -406,7 +401,7 @@ namespace toolkit
case BASEPROPERTY_IMAGE_SCALE_MODE:
{
- ImageControl const* pImageControl = dynamic_cast< ImageControl* >( GetWindow() );
+ VclPtr<ImageControl> pImageControl = GetAsDynamic<ImageControl>();
aReturn <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::ANISOTROPIC );
}
break;
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index 823fba383af5..bcb508c8c06e 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -31,11 +31,17 @@ namespace toolkit
// in the same bitmap :-( WB_VSCROLL & WB_HSCROLL apparently are only for
// child classes ( whole thing is a mess if you ask me )
template< class T>
-ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle ) : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None )
+ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle )
+ : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ),
+ maHScrollBar( VclPtr<ScrollBar>::Create(this, WB_HSCROLL | WB_DRAG) ),
+ maVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_DRAG) ),
+ mbHasHoriBar( false ),
+ mbHasVertBar( false ),
+ maScrollVis( None )
{
Link aLink( LINK( this, ScrollableWrapper, ScrollBarHdl ) );
- maVScrollBar.SetScrollHdl( aLink );
- maHScrollBar.SetScrollHdl( aLink );
+ maVScrollBar->SetScrollHdl( aLink );
+ maHScrollBar->SetScrollHdl( aLink );
ScrollBarVisibility aVis = None;
@@ -62,12 +68,12 @@ void ScrollableWrapper<T>::setScrollVisibility( ScrollBarVisibility rVisState )
if ( maScrollVis == Hori || maScrollVis == Both )
{
mbHasHoriBar = true;
- maHScrollBar.Show();
+ maHScrollBar->Show();
}
if ( maScrollVis == Vert || maScrollVis == Both )
{
mbHasVertBar = true;
- maVScrollBar.Show();
+ maVScrollBar->Show();
}
if ( mbHasHoriBar || mbHasVertBar )
this->SetStyle( T::GetStyle() | WB_CLIPCHILDREN | SCROLL_UPDATE );
@@ -76,6 +82,15 @@ void ScrollableWrapper<T>::setScrollVisibility( ScrollBarVisibility rVisState )
template< class T>
ScrollableWrapper<T>::~ScrollableWrapper()
{
+ dispose();
+}
+
+template< class T>
+void ScrollableWrapper<T>::dispose()
+{
+ maHScrollBar.disposeAndClear();
+ maVScrollBar.disposeAndClear();
+ T::dispose();
}
template< class T>
@@ -91,7 +106,7 @@ void ScrollableWrapper<T>::lcl_Scroll( long nX, long nY )
for ( int index = 0; index < T::GetChildCount(); ++index )
{
vcl::Window* pChild = T::GetChild( index );
- if ( pChild && pChild != &maVScrollBar && pChild != &maHScrollBar )
+ if ( pChild && pChild != maVScrollBar.get() && pChild != maHScrollBar.get() )
{
Point aPos = pChild->GetPosPixel();
aPos += Point( nXScroll, nYScroll );
@@ -113,9 +128,9 @@ template< class T>
sal_IntPtr ScrollableWrapper<T>::ScrollBarHdl( ScrollBar* pSB )
{
sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos();
- if( pSB == &maVScrollBar )
+ if( pSB == maVScrollBar.get() )
lcl_Scroll(mnScrollPos.X(), nPos );
- else if( pSB == &maHScrollBar )
+ else if( pSB == maHScrollBar.get() )
lcl_Scroll(nPos, mnScrollPos.Y() );
return 1;
}
@@ -125,7 +140,7 @@ void ScrollableWrapper<T>::SetScrollTop( long nTop )
{
Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() , mnScrollPos.Y() - nTop );
- maHScrollBar.SetThumbPos( 0 );
+ maHScrollBar->SetThumbPos( 0 );
// new pos is 0,0
mnScrollPos = aOld;
}
@@ -134,7 +149,7 @@ void ScrollableWrapper<T>::SetScrollLeft( long nLeft )
{
Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() - nLeft , mnScrollPos.Y() );
- maVScrollBar.SetThumbPos( 0 );
+ maVScrollBar->SetThumbPos( 0 );
// new pos is 0,0
mnScrollPos = aOld;
}
@@ -166,14 +181,14 @@ void ScrollableWrapper<T>::ResetScrollBars()
Point aVPos( aOutSz.Width() - mnScrWidth, 0 );
Point aHPos( 0, aOutSz.Height() - mnScrWidth );
- maVScrollBar.SetPosSizePixel( aVPos, Size( mnScrWidth, T::GetSizePixel().Height() - mnScrWidth ) );
- maHScrollBar.SetPosSizePixel( aHPos, Size( T::GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
+ maVScrollBar->SetPosSizePixel( aVPos, Size( mnScrWidth, T::GetSizePixel().Height() - mnScrWidth ) );
+ maHScrollBar->SetPosSizePixel( aHPos, Size( T::GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
- maHScrollBar.SetRangeMax( maScrollArea.Width() + mnScrWidth );
- maHScrollBar.SetVisibleSize( T::GetSizePixel().Width() );
+ maHScrollBar->SetRangeMax( maScrollArea.Width() + mnScrWidth );
+ maHScrollBar->SetVisibleSize( T::GetSizePixel().Width() );
- maVScrollBar.SetRangeMax( maScrollArea.Height() + mnScrWidth );
- maVScrollBar.SetVisibleSize( T::GetSizePixel().Height() );
+ maVScrollBar->SetRangeMax( maScrollArea.Height() + mnScrWidth );
+ maVScrollBar->SetVisibleSize( T::GetSizePixel().Height() );
}
template class ScrollableWrapper< Dialog >;
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index b1f338690563..1dcb9b88f3d7 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -356,14 +356,15 @@ void VCLXAccessibleComponent::disposing()
mpVCLXindow = NULL;
}
-vcl::Window* VCLXAccessibleComponent::GetWindow() const
+VclPtr<vcl::Window> VCLXAccessibleComponent::GetWindow() const
{
- return GetVCLXWindow() ? GetVCLXWindow()->GetWindow() : NULL;
+ return GetVCLXWindow() ? GetVCLXWindow()->GetWindow()
+ : VclPtr<vcl::Window>();
}
void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
{
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
vcl::Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
@@ -394,7 +395,7 @@ void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelation
void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
{
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
if ( pWindow->IsVisible() )
@@ -433,7 +434,7 @@ void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHel
rStateSet.AddState( accessibility::AccessibleStateType::MOVEABLE );
if( pWindow->IsDialog() )
{
- Dialog *pDlg = static_cast< Dialog* >( pWindow );
+ Dialog *pDlg = static_cast< Dialog* >( pWindow.get() );
if( pDlg->IsInExecute() )
rStateSet.AddState( accessibility::AccessibleStateType::MODAL );
}
@@ -442,26 +443,26 @@ void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHel
if( pWindow && pWindow->GetType() == WINDOW_COMBOBOX )
{
if( !( pWindow->GetStyle() & WB_READONLY) ||
- !static_cast<Edit*>(pWindow)->IsReadOnly() )
+ !static_cast<Edit*>(pWindow.get())->IsReadOnly() )
rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE );
}
- vcl::Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ VclPtr<vcl::Window> pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
while( pWindow && pChild )
{
- vcl::Window* pWinTemp = pChild->GetWindow( WINDOW_FIRSTCHILD );
+ VclPtr<vcl::Window> pWinTemp = pChild->GetWindow( WINDOW_FIRSTCHILD );
if( pWinTemp && pWinTemp->GetType() == WINDOW_EDIT )
{
if( !( pWinTemp->GetStyle() & WB_READONLY) ||
- !static_cast<Edit*>(pWinTemp)->IsReadOnly() )
+ !static_cast<Edit*>(pWinTemp.get())->IsReadOnly() )
rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE );
break;
}
if( pChild->GetType() == WINDOW_EDIT )
{
if( !( pChild->GetStyle() & WB_READONLY) ||
- !static_cast<Edit*>(pChild)->IsReadOnly())
+ !static_cast<Edit*>(pChild.get())->IsReadOnly())
rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE );
break;
}
diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx
index 57cd040d40e0..da7ad04a0b18 100644
--- a/toolkit/source/awt/vclxdevice.cxx
+++ b/toolkit/source/awt/vclxdevice.cxx
@@ -43,8 +43,7 @@
// class VCLXDevice
VCLXDevice::VCLXDevice()
- : mpOutputDevice(NULL)
- , pDummy(NULL)
+ : pDummy(NULL)
, nFlags(0)
{
}
@@ -53,12 +52,6 @@ VCLXDevice::~VCLXDevice()
{
}
-void VCLXDevice::DestroyOutputDevice()
-{
- delete mpOutputDevice;
- mpOutputDevice = NULL;
-}
-
void VCLXDevice::SetCreatedWithToolkit( bool bCreatedWithToolkit )
{
if ( bCreatedWithToolkit )
@@ -109,7 +102,7 @@ IMPL_XTYPEPROVIDER_END
if ( GetOutputDevice() )
{
VCLXVirtualDevice* pVDev = new VCLXVirtualDevice;
- VirtualDevice* pVclVDev = new VirtualDevice( *GetOutputDevice() );
+ VclPtrInstance<VirtualDevice> pVclVDev( *GetOutputDevice() );
pVclVDev->SetOutputSizePixel( Size( nWidth, nHeight ) );
pVDev->SetVirtualDevice( pVclVDev );
xRef = pVDev;
@@ -129,14 +122,14 @@ IMPL_XTYPEPROVIDER_END
OutDevType eDevType = mpOutputDevice->GetOutDevType();
if ( eDevType == OUTDEV_WINDOW )
{
- aDevSz = static_cast<vcl::Window*>(mpOutputDevice)->GetSizePixel();
- static_cast<vcl::Window*>(mpOutputDevice)->GetBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
+ aDevSz = static_cast<vcl::Window*>(mpOutputDevice.get())->GetSizePixel();
+ static_cast<vcl::Window*>(mpOutputDevice.get())->GetBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
}
else if ( eDevType == OUTDEV_PRINTER )
{
- aDevSz = static_cast<Printer*>(mpOutputDevice)->GetPaperSizePixel();
+ aDevSz = static_cast<Printer*>(mpOutputDevice.get())->GetPaperSizePixel();
Size aOutSz = mpOutputDevice->GetOutputSizePixel();
- Point aOffset = static_cast<Printer*>(mpOutputDevice)->GetPageOffset();
+ Point aOffset = static_cast<Printer*>(mpOutputDevice.get())->GetPageOffset();
aInfo.LeftInset = aOffset.X();
aInfo.TopInset = aOffset.Y();
aInfo.RightInset = aDevSz.Width() - aOutSz.Width() - aOffset.X();
@@ -228,19 +221,15 @@ IMPL_XTYPEPROVIDER_END
return xDBmp;
}
-
VCLXVirtualDevice::~VCLXVirtualDevice()
{
SolarMutexGuard aGuard;
- DestroyOutputDevice();
+ mpOutputDevice.disposeAndClear();
}
-
-
// Interface implementation of ::com::sun::star::awt::XUnitConversion
-
::com::sun::star::awt::Point SAL_CALL VCLXDevice::convertPointToLogic( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception)
{
(void)aPoint;
diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx
index 5cef0d0c70b7..b5fbf456b876 100644
--- a/toolkit/source/awt/vclxprinter.cxx
+++ b/toolkit/source/awt/vclxprinter.cxx
@@ -71,7 +71,7 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXPrinterPropertySet, VCLXPrinterPropertySet
VCLXPrinterPropertySet::VCLXPrinterPropertySet( const OUString& rPrinterName )
: OPropertySetHelper( BrdcstHelper )
- , mxPrinter(std::make_shared<Printer>(rPrinterName))
+ , mxPrinter(VclPtrInstance< Printer >(rPrinterName))
{
SolarMutexGuard aSolarGuard;
diff --git a/toolkit/source/awt/vclxspinbutton.cxx b/toolkit/source/awt/vclxspinbutton.cxx
index b3ab308edd92..2488359b13b7 100644
--- a/toolkit/source/awt/vclxspinbutton.cxx
+++ b/toolkit/source/awt/vclxspinbutton.cxx
@@ -199,7 +199,7 @@ namespace toolkit
{
SolarMutexClearableGuard aGuard;
Reference< XSpinValue > xKeepAlive( this );
- SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() );
+ VclPtr<SpinButton> pSpinButton = GetAs<SpinButton>();
if ( !pSpinButton )
return;
diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx
index b0e0ef1807bb..7eb39fa623e5 100644
--- a/toolkit/source/awt/vclxtabpagecontainer.cxx
+++ b/toolkit/source/awt/vclxtabpagecontainer.cxx
@@ -57,7 +57,7 @@ VCLXTabPageContainer::~VCLXTabPageContainer()
void SAL_CALL VCLXTabPageContainer::draw( sal_Int32 nX, sal_Int32 nY ) throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- TabControl* pTabControl = static_cast<TabControl*>(GetWindow());
+ VclPtr<TabControl> pTabControl = GetAs<TabControl>();
if ( pTabControl )
{
TabPage *pTabPage = pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( pTabControl->GetCurPageId( ) ) );
@@ -86,37 +86,40 @@ void SAL_CALL VCLXTabPageContainer::draw( sal_Int32 nX, sal_Int32 nY ) throw(Run
void SAL_CALL VCLXTabPageContainer::setProperty(const OUString& PropertyName, const Any& Value ) throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- TabControl* pTabPage = static_cast<TabControl*>(GetWindow());
+ VclPtr<TabControl> pTabPage = GetAs<TabControl>();
if ( pTabPage )
- {
VCLXWindow::setProperty( PropertyName, Value );
- }
}
+
::sal_Int16 SAL_CALL VCLXTabPageContainer::getActiveTabPageID() throw (RuntimeException, std::exception)
{
- TabControl* pTabCtrl = static_cast<TabControl*>(GetWindow());
- return pTabCtrl != NULL ? pTabCtrl->GetCurPageId( ) : 0;
+ VclPtr<TabControl> pTabCtrl = GetAs<TabControl>();
+ return pTabCtrl ? pTabCtrl->GetCurPageId( ) : 0;
}
+
void SAL_CALL VCLXTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException, std::exception)
{
- TabControl* pTabCtrl = static_cast<TabControl*>(GetWindow());
+ VclPtr<TabControl> pTabCtrl = GetAs<TabControl>();
if ( pTabCtrl )
pTabCtrl->SelectTabPage(_activetabpageid);
}
+
::sal_Int16 SAL_CALL VCLXTabPageContainer::getTabPageCount( ) throw (RuntimeException, std::exception)
{
- TabControl* pTabCtrl = static_cast<TabControl*>(GetWindow());
- return pTabCtrl != NULL ? pTabCtrl->GetPageCount() : 0;
+ VclPtr<TabControl> pTabCtrl = GetAs<TabControl>();
+ return pTabCtrl ? pTabCtrl->GetPageCount() : 0;
}
+
sal_Bool SAL_CALL VCLXTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException, std::exception)
{
return (getActiveTabPageID() == tabPageIndex);
}
+
Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException, std::exception)
{
return (tabPageIndex >= 0 && tabPageIndex < static_cast<sal_Int16>(m_aTabPages.size())) ? m_aTabPages[tabPageIndex] : NULL;
}
+
Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
@@ -135,10 +138,12 @@ Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer:
}
return xTabPage;
}
+
void SAL_CALL VCLXTabPageContainer::addTabPageContainerListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException, std::exception)
{
m_aTabPageListeners.addInterface( listener );
}
+
void SAL_CALL VCLXTabPageContainer::removeTabPageContainerListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException, std::exception)
{
m_aTabPageListeners.removeInterface( listener );
@@ -147,7 +152,7 @@ void SAL_CALL VCLXTabPageContainer::removeTabPageContainerListener( const Refere
void VCLXTabPageContainer::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
{
SolarMutexClearableGuard aGuard;
- TabControl* pTabControl = static_cast< TabControl* >( GetWindow() );
+ VclPtr<TabControl> pTabControl = GetAs<TabControl>();
if ( pTabControl )
{
switch ( _rVclWindowEvent.GetId() )
@@ -172,7 +177,7 @@ void SAL_CALL VCLXTabPageContainer::disposing( const ::com::sun::star::lang::Eve
void SAL_CALL VCLXTabPageContainer::elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- TabControl* pTabCtrl = static_cast<TabControl*>(GetWindow());
+ VclPtr<TabControl> pTabCtrl = GetAs<TabControl>();
Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY);
if ( pTabCtrl && xTabPage.is() )
{
@@ -196,7 +201,7 @@ void SAL_CALL VCLXTabPageContainer::elementInserted( const ::com::sun::star::con
void SAL_CALL VCLXTabPageContainer::elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- TabControl* pTabCtrl = static_cast<TabControl*>(GetWindow());
+ VclPtr<TabControl> pTabCtrl = GetAs<TabControl>();
Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY);
if ( pTabCtrl && xTabPage.is() )
{
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 22ce65128c78..50106d844729 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -800,67 +800,67 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
switch ( (WindowType)nType )
{
case WINDOW_CANCELBUTTON:
- pNewWindow = new CancelButton( pParent, nWinBits );
+ pNewWindow = VclPtr<CancelButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
break;
case WINDOW_CHECKBOX:
- pNewWindow = new CheckBox( pParent, nWinBits );
+ pNewWindow = VclPtr<CheckBox>::Create( pParent, nWinBits );
*ppNewComp = new VCLXCheckBox;
break;
case WINDOW_COMBOBOX:
- pNewWindow = new ComboBox( pParent, nWinBits|WB_AUTOHSCROLL );
+ pNewWindow = VclPtr<ComboBox>::Create( pParent, nWinBits|WB_AUTOHSCROLL );
static_cast<ComboBox*>(pNewWindow)->EnableAutoSize( false );
*ppNewComp = new VCLXComboBox;
break;
case WINDOW_CURRENCYBOX:
- pNewWindow = new CurrencyBox( pParent, nWinBits );
+ pNewWindow = VclPtr<CurrencyBox>::Create( pParent, nWinBits );
break;
case WINDOW_CURRENCYFIELD:
- pNewWindow = new CurrencyField( pParent, nWinBits );
+ pNewWindow = VclPtr<CurrencyField>::Create( pParent, nWinBits );
static_cast<CurrencyField*>(pNewWindow)->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXNumericField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<CurrencyField*>(pNewWindow) );
break;
case WINDOW_DATEBOX:
- pNewWindow = new DateBox( pParent, nWinBits );
+ pNewWindow = VclPtr<DateBox>::Create( pParent, nWinBits );
break;
case WINDOW_DATEFIELD:
- pNewWindow = new DateField( pParent, nWinBits );
+ pNewWindow = VclPtr<DateField>::Create( pParent, nWinBits );
static_cast<DateField*>(pNewWindow)->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXDateField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<DateField*>(pNewWindow) );
break;
case WINDOW_DOCKINGAREA:
- pNewWindow = new DockingAreaWindow( pParent );
+ pNewWindow = VclPtr<DockingAreaWindow>::Create( pParent );
break;
case WINDOW_MULTILINEEDIT:
case WINDOW_EDIT:
- pNewWindow = new Edit( pParent, nWinBits );
+ pNewWindow = VclPtr<Edit>::Create( pParent, nWinBits );
*ppNewComp = new VCLXEdit;
break;
case WINDOW_ERRORBOX:
- pNewWindow = new ErrorBox( pParent, nWinBits, OUString() );
+ pNewWindow = VclPtr<ErrorBox>::Create( pParent, nWinBits, OUString() );
*ppNewComp = new VCLXMessageBox;
break;
case WINDOW_FIXEDBITMAP:
- pNewWindow = new FixedBitmap( pParent, nWinBits );
+ pNewWindow = VclPtr<FixedBitmap>::Create( pParent, nWinBits );
break;
case WINDOW_FIXEDIMAGE:
- pNewWindow = new ImageControl( pParent, nWinBits );
+ pNewWindow = VclPtr<ImageControl>::Create( pParent, nWinBits );
*ppNewComp = new VCLXImageControl;
break;
case WINDOW_FIXEDLINE:
- pNewWindow = new FixedLine( pParent, nWinBits );
+ pNewWindow = VclPtr<FixedLine>::Create( pParent, nWinBits );
break;
case WINDOW_FIXEDTEXT:
- pNewWindow = new FixedText( pParent, nWinBits );
+ pNewWindow = VclPtr<FixedText>::Create( pParent, nWinBits );
*ppNewComp = new VCLXFixedText;
break;
case WINDOW_FLOATINGWINDOW:
- pNewWindow = new FloatingWindow( pParent, nWinBits );
+ pNewWindow = VclPtr<FloatingWindow>::Create( pParent, nWinBits );
break;
case WINDOW_GROUPBOX:
- pNewWindow = new GroupBox( pParent, nWinBits );
+ pNewWindow = VclPtr<GroupBox>::Create( pParent, nWinBits );
if ( bFrameControl )
{
GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow );
@@ -871,43 +871,43 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
}
break;
case WINDOW_HELPBUTTON:
- pNewWindow = new HelpButton( pParent, nWinBits );
+ pNewWindow = VclPtr<HelpButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
break;
case WINDOW_IMAGEBUTTON:
- pNewWindow = new ImageButton( pParent, nWinBits );
+ pNewWindow = VclPtr<ImageButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
break;
case WINDOW_INFOBOX:
- pNewWindow = new InfoBox( pParent, OUString() );
+ pNewWindow = VclPtr<InfoBox>::Create( pParent, OUString() );
*ppNewComp = new VCLXMessageBox;
break;
case WINDOW_LISTBOX:
- pNewWindow = new ListBox( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL );
+ pNewWindow = VclPtr<ListBox>::Create( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL );
static_cast<ListBox*>(pNewWindow)->EnableAutoSize( false );
*ppNewComp = new VCLXListBox;
break;
case WINDOW_LONGCURRENCYBOX:
- pNewWindow = new LongCurrencyBox( pParent, nWinBits );
+ pNewWindow = VclPtr<LongCurrencyBox>::Create( pParent, nWinBits );
break;
case WINDOW_LONGCURRENCYFIELD:
- pNewWindow = new LongCurrencyField( pParent, nWinBits );
+ pNewWindow = VclPtr<LongCurrencyField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXCurrencyField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<LongCurrencyField*>(pNewWindow) );
break;
case WINDOW_MENUBUTTON:
- pNewWindow = new MenuButton( pParent, nWinBits );
+ pNewWindow = VclPtr<MenuButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
break;
case WINDOW_MESSBOX:
- pNewWindow = new MessBox( pParent, nWinBits, OUString(), OUString() );
+ pNewWindow = VclPtr<MessBox>::Create( pParent, nWinBits, OUString(), OUString() );
*ppNewComp = new VCLXMessageBox;
break;
case WINDOW_METRICBOX:
- pNewWindow = new MetricBox( pParent, nWinBits );
+ pNewWindow = VclPtr<MetricBox>::Create( pParent, nWinBits );
break;
case WINDOW_METRICFIELD:
- pNewWindow = new MetricField( pParent, nWinBits );
+ pNewWindow = VclPtr<MetricField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXMetricField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<MetricField*>(pNewWindow) );
break;
@@ -930,44 +930,44 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
}
break;
case WINDOW_MOREBUTTON:
- pNewWindow = new MoreButton( pParent, nWinBits );
+ pNewWindow = VclPtr<MoreButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
break;
case WINDOW_MULTILISTBOX:
- pNewWindow = new MultiListBox( pParent, nWinBits );
+ pNewWindow = VclPtr<MultiListBox>::Create( pParent, nWinBits );
*ppNewComp = new VCLXListBox;
break;
case WINDOW_NUMERICBOX:
- pNewWindow = new NumericBox( pParent, nWinBits );
+ pNewWindow = VclPtr<NumericBox>::Create( pParent, nWinBits );
break;
case WINDOW_NUMERICFIELD:
- pNewWindow = new NumericField( pParent, nWinBits );
+ pNewWindow = VclPtr<NumericField>::Create( pParent, nWinBits );
static_cast<NumericField*>(pNewWindow)->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXNumericField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<NumericField*>(pNewWindow) );
break;
case WINDOW_OKBUTTON:
- pNewWindow = new OKButton( pParent, nWinBits );
+ pNewWindow = VclPtr<OKButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
break;
case WINDOW_PATTERNBOX:
- pNewWindow = new PatternBox( pParent, nWinBits );
+ pNewWindow = VclPtr<PatternBox>::Create( pParent, nWinBits );
break;
case WINDOW_PATTERNFIELD:
- pNewWindow = new PatternField( pParent, nWinBits );
+ pNewWindow = VclPtr<PatternField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXPatternField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<PatternField*>(pNewWindow) );
break;
case WINDOW_PUSHBUTTON:
- pNewWindow = new PushButton( pParent, nWinBits );
+ pNewWindow = VclPtr<PushButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
break;
case WINDOW_QUERYBOX:
- pNewWindow = new QueryBox( pParent, nWinBits, OUString() );
+ pNewWindow = VclPtr<QueryBox>::Create( pParent, nWinBits, OUString() );
*ppNewComp = new VCLXMessageBox;
break;
case WINDOW_RADIOBUTTON:
- pNewWindow = new RadioButton( pParent, nWinBits );
+ pNewWindow = VclPtr<RadioButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXRadioButton;
// by default, disable RadioCheck
@@ -982,64 +982,64 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
static_cast<RadioButton*>(pNewWindow)->EnableRadioCheck( false );
break;
case WINDOW_SCROLLBAR:
- pNewWindow = new ScrollBar( pParent, nWinBits );
+ pNewWindow = VclPtr<ScrollBar>::Create( pParent, nWinBits );
*ppNewComp = new VCLXScrollBar;
break;
case WINDOW_SCROLLBARBOX:
- pNewWindow = new ScrollBarBox( pParent, nWinBits );
+ pNewWindow = VclPtr<ScrollBarBox>::Create( pParent, nWinBits );
break;
case WINDOW_SPINBUTTON:
- pNewWindow = new SpinButton( pParent, nWinBits );
+ pNewWindow = VclPtr<SpinButton>::Create( pParent, nWinBits );
*ppNewComp = new ::toolkit::VCLXSpinButton;
break;
case WINDOW_SPINFIELD:
- pNewWindow = new SpinField( pParent, nWinBits );
+ pNewWindow = VclPtr<SpinField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXNumericField;
break;
case WINDOW_SPLITTER:
- pNewWindow = new Splitter( pParent, nWinBits );
+ pNewWindow = VclPtr<Splitter>::Create( pParent, nWinBits );
break;
case WINDOW_SPLITWINDOW:
- pNewWindow = new SplitWindow( pParent, nWinBits );
+ pNewWindow = VclPtr<SplitWindow>::Create( pParent, nWinBits );
break;
case WINDOW_STATUSBAR:
- pNewWindow = new StatusBar( pParent, nWinBits );
+ pNewWindow = VclPtr<StatusBar>::Create( pParent, nWinBits );
break;
case VCLWINDOW_SYSTEMCHILDWINDOW:
- pNewWindow = new SystemChildWindow( pParent, nWinBits );
+ pNewWindow = VclPtr<SystemChildWindow>::Create( pParent, nWinBits );
*ppNewComp = new VCLXSystemDependentWindow();
break;
case WINDOW_TABCONTROL:
- pNewWindow = new TabControl( pParent, nWinBits );
+ pNewWindow = VclPtr<TabControl>::Create( pParent, nWinBits );
*ppNewComp = new VCLXMultiPage;
break;
case WINDOW_TABDIALOG:
- pNewWindow = new TabDialog( pParent, nWinBits );
+ pNewWindow = VclPtr<TabDialog>::Create( pParent, nWinBits );
break;
case WINDOW_TABPAGE:
{
- pNewWindow = new TabPage( pParent, nWinBits );
+ pNewWindow = VclPtr<TabPage>::Create( pParent, nWinBits );
*ppNewComp = new VCLXTabPage;
}
break;
case WINDOW_TIMEBOX:
- pNewWindow = new TimeBox( pParent, nWinBits );
+ pNewWindow = VclPtr<TimeBox>::Create( pParent, nWinBits );
break;
case WINDOW_TIMEFIELD:
- pNewWindow = new TimeField( pParent, nWinBits );
+ pNewWindow = VclPtr<TimeField>::Create( pParent, nWinBits );
static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXTimeField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( (FormatterBase*)static_cast<TimeField*>(pNewWindow) );
break;
case WINDOW_TOOLBOX:
- pNewWindow = new ToolBox( pParent, nWinBits );
+ pNewWindow = VclPtr<ToolBox>::Create( pParent, nWinBits );
*ppNewComp = new VCLXToolBox;
break;
case WINDOW_TRISTATEBOX:
- pNewWindow = new TriStateBox( pParent, nWinBits );
+ pNewWindow = VclPtr<TriStateBox>::Create( pParent, nWinBits );
break;
case WINDOW_WARNINGBOX:
- pNewWindow = new WarningBox( pParent, nWinBits, OUString() );
+ pNewWindow = VclPtr<WarningBox>::Create( pParent, nWinBits, OUString() );
*ppNewComp = new VCLXMessageBox;
break;
case WINDOW_WORKWINDOW:
@@ -1049,7 +1049,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP )
{
if (nType == WINDOW_DOCKINGWINDOW )
- pNewWindow = new DockingWindow( pParent, nWinBits );
+ pNewWindow = VclPtr<DockingWindow>::Create( pParent, nWinBits );
else
{
if ((pParent == NULL) && rDescriptor.Parent.is())
@@ -1108,13 +1108,13 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
#elif defined WNT
aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
#endif
- pNewWindow = new WorkWindow( &aParentData );
+ pNewWindow = VclPtr<WorkWindow>::Create( &aParentData );
}
}
}
if (!pNewWindow)
- pNewWindow = new WorkWindow( pParent, nWinBits );
+ pNewWindow = VclPtr<WorkWindow>::Create( pParent, nWinBits );
}
*ppNewComp = new VCLXTopWindow( pNewWindow->GetType() == WINDOW_WORKWINDOW );
@@ -1122,17 +1122,17 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
else if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_CONTAINER )
{
if (nType == WINDOW_DOCKINGWINDOW )
- pNewWindow = new DockingWindow( pParent, nWinBits );
+ pNewWindow = VclPtr<DockingWindow>::Create( pParent, nWinBits );
else
- pNewWindow = new vcl::Window( pParent, nWinBits );
+ pNewWindow = VclPtr<vcl::Window>::Create( pParent, nWinBits );
*ppNewComp = new VCLXContainer;
}
else
{
if (nType == WINDOW_DOCKINGWINDOW )
- pNewWindow = new DockingWindow( pParent, nWinBits );
+ pNewWindow = VclPtr<DockingWindow>::Create( pParent, nWinBits );
else
- pNewWindow = new vcl::Window( pParent, nWinBits );
+ pNewWindow = VclPtr<vcl::Window>::Create( pParent, nWinBits );
*ppNewComp = new VCLXWindow;
}
break;
@@ -1140,12 +1140,12 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
"tabpagecontainer" ) )
{
- pNewWindow = new TabControl( pParent, nWinBits );
+ pNewWindow = VclPtr<TabControl>::Create( pParent, nWinBits );
*ppNewComp = new VCLXTabPageContainer;
}
else if ( aServiceName == "animatedimages" )
{
- pNewWindow = new Throbber( pParent, nWinBits );
+ pNewWindow = VclPtr<Throbber>::Create( pParent, nWinBits );
*ppNewComp = new ::toolkit::AnimatedImagesPeer;
}
break;
@@ -1293,7 +1293,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
// ::com::sun::star::awt::XSystemChildFactory
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createSystemChild( const ::com::sun::star::uno::Any& Parent, const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 nSystemType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
- vcl::Window* pChildWindow = NULL;
+ VclPtr<vcl::Window> pChildWindow;
if ( nSystemType == SYSTEM_DEPENDENT_TYPE )
{
// use sal_Int64 here to accommodate all int types
@@ -1340,7 +1340,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
SolarMutexGuard aGuard;
try
{
- pChildWindow = new WorkWindow( &aParentData );
+ pChildWindow.reset( VclPtr<WorkWindow>::Create( &aParentData ) );
}
catch ( const ::com::sun::star::uno::RuntimeException & rEx )
{
@@ -1349,14 +1349,14 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
"VCLXToolkit::createSystemChild: caught %s\n",
OUStringToOString(
rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
- pChildWindow = NULL;
+ pChildWindow.clear();
}
}
}
else if (nSystemType == com::sun::star::lang::SystemDependent::SYSTEM_JAVA)
{
SolarMutexGuard aGuard;
- pChildWindow = new WorkWindow(0, Parent);
+ pChildWindow.reset(VclPtr<WorkWindow>::Create(nullptr, Parent));
}
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer;
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 3d7a22dbeb23..ba8e5b3feb11 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -366,7 +366,7 @@ void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
return mpImpl->getAccessibleFactory().getFactory();
}
-void VCLXWindow::SetWindow( vcl::Window* pWindow )
+void VCLXWindow::SetWindow( const VclPtr<vcl::Window> &pWindow )
{
if ( GetWindow() )
{
@@ -922,10 +922,11 @@ void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException, std:
if ( GetWindow() )
{
- OutputDevice* pOutDev = GetOutputDevice();
+ VclPtr<OutputDevice> pOutDev = GetOutputDevice();
SetWindow( NULL ); // so that handlers are logged off, if necessary (virtual)
SetOutputDevice( pOutDev );
- DestroyOutputDevice();
+ pOutDev.disposeAndClear();
+ SetOutputDevice( NULL );
}
// #i14103# dispose the accessible context after the window has been destroyed,
@@ -1921,7 +1922,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const ::com::sun::st
{
case BASEPROPERTY_REFERENCE_DEVICE:
{
- Control* pControl = dynamic_cast< Control* >( GetWindow() );
+ VclPtr<Control> pControl = GetAsDynamic<Control >();
OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
if ( !pControl )
break;
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index a8c8cc0c4cd5..9b70dcf6daae 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -215,7 +215,7 @@ void VCLXGraphicControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
void VCLXGraphicControl::ImplSetNewImage()
{
OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" );
- Button* pButton = static_cast< Button* >( GetWindow() );
+ VclPtr< Button > pButton = GetAsDynamic< Button >();
pButton->SetModeImage( GetImage() );
}
@@ -236,8 +236,10 @@ void VCLXGraphicControl::setProperty( const OUString& PropertyName, const ::com:
{
SolarMutexGuard aGuard;
- if ( !GetWindow() )
+ VclPtr< Button > pButton = GetAs< Button >();
+ if ( !pButton )
return;
+
sal_uInt16 nPropType = GetPropertyId( PropertyName );
switch ( nPropType )
{
@@ -260,10 +262,7 @@ void VCLXGraphicControl::setProperty( const OUString& PropertyName, const ::com:
{
sal_Int16 nAlignment = sal_Int16();
if ( Value >>= nAlignment )
- {
- Button* pButton = static_cast< Button* >( GetWindow() );
- pButton->SetImageAlign( static_cast< ImageAlign >( nAlignment ) );
- }
+ GetAs< Button >()->SetImageAlign( static_cast< ImageAlign >( nAlignment ) );
}
}
break;
@@ -277,8 +276,7 @@ void VCLXGraphicControl::setProperty( const OUString& PropertyName, const ::com:
{
sal_Int16 nImagePosition = 2;
OSL_VERIFY( Value >>= nImagePosition );
- Button* pButton = static_cast< Button* >( GetWindow() );
- pButton->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition ) );
+ GetAs<Button>()->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition ) );
}
}
break;
@@ -310,7 +308,8 @@ void VCLXGraphicControl::setProperty( const OUString& PropertyName, const ::com:
|| ( eType == WINDOW_CHECKBOX )
)
{
- aProp <<= ::toolkit::getCompatibleImageAlign( static_cast< Button* >( GetWindow() )->GetImageAlign() );
+ aProp <<= ::toolkit::getCompatibleImageAlign(
+ GetAs<Button>()->GetImageAlign() );
}
}
break;
@@ -322,7 +321,8 @@ void VCLXGraphicControl::setProperty( const OUString& PropertyName, const ::com:
|| ( eType == WINDOW_CHECKBOX )
)
{
- aProp <<= ::toolkit::translateImagePosition( static_cast< Button* >( GetWindow() )->GetImageAlign() );
+ aProp <<= ::toolkit::translateImagePosition(
+ GetAs< Button >()->GetImageAlign() );
}
}
break;
@@ -444,7 +444,7 @@ void VCLXButton::setActionCommand( const OUString& rCommand ) throw(::com::sun::
SolarMutexGuard aGuard;
Size aSz;
- PushButton* pButton = static_cast<PushButton*>(GetWindow());
+ VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton )
aSz = pButton->CalcMinimumSize();
return AWTSize(aSz);
@@ -463,7 +463,7 @@ void VCLXButton::setActionCommand( const OUString& rCommand ) throw(::com::sun::
SolarMutexGuard aGuard;
Size aSz = VCLSize(rNewSize);
- PushButton* pButton = static_cast<PushButton*>( GetWindow() );
+ VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton )
{
Size aMinSz = pButton->CalcMinimumSize();
@@ -490,7 +490,7 @@ void VCLXButton::setProperty( const OUString& PropertyName, const ::com::sun::st
{
SolarMutexGuard aGuard;
- Button* pButton = static_cast<Button*>(GetWindow());
+ VclPtr< Button > pButton = GetAs< Button >();
if ( pButton )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -519,7 +519,7 @@ void VCLXButton::setProperty( const OUString& PropertyName, const ::com::sun::st
{
sal_Int16 n = sal_Int16();
if ( Value >>= n )
- static_cast<PushButton*>(pButton)->SetState( (TriState)n );
+ static_cast<PushButton*>(pButton.get())->SetState( (TriState)n );
}
}
break;
@@ -536,7 +536,7 @@ void VCLXButton::setProperty( const OUString& PropertyName, const ::com::sun::st
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- Button* pButton = static_cast<Button*>(GetWindow());
+ VclPtr< Button > pButton = GetAs< Button >();
if ( pButton )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -559,7 +559,7 @@ void VCLXButton::setProperty( const OUString& PropertyName, const ::com::sun::st
{
if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
{
- aProp <<= (sal_Int16)static_cast<PushButton*>(pButton)->GetState();
+ aProp <<= (sal_Int16)static_cast<PushButton*>(pButton.get())->GetState();
}
}
break;
@@ -658,7 +658,7 @@ VCLXImageControl::~VCLXImageControl()
void VCLXImageControl::ImplSetNewImage()
{
OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
- ImageControl* pControl = static_cast< ImageControl* >( GetWindow() );
+ VclPtr<ImageControl> pControl = GetAs< ImageControl >();
pControl->SetImage( GetImage() );
}
@@ -694,7 +694,7 @@ void VCLXImageControl::setProperty( const OUString& PropertyName, const ::com::s
{
SolarMutexGuard aGuard;
- ImageControl* pImageControl = static_cast<ImageControl*>(GetWindow());
+ VclPtr< ImageControl > pImageControl = GetAs< ImageControl >();
sal_uInt16 nPropType = GetPropertyId( PropertyName );
switch ( nPropType )
@@ -731,7 +731,7 @@ void VCLXImageControl::setProperty( const OUString& PropertyName, const ::com::s
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- ImageControl* pImageControl = static_cast<ImageControl*>(GetWindow());
+ VclPtr< ImageControl > pImageControl = GetAs< ImageControl >();
sal_uInt16 nPropType = GetPropertyId( PropertyName );
switch ( nPropType )
@@ -863,7 +863,7 @@ void VCLXCheckBox::setState( short n ) throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox> pCheckBox = GetAs< CheckBox >();
if ( pCheckBox)
{
TriState eState;
@@ -892,7 +892,7 @@ short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException, st
SolarMutexGuard aGuard;
short nState = -1;
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox )
{
switch ( pCheckBox->GetState() )
@@ -911,23 +911,23 @@ void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox)
pCheckBox->EnableTriState( b );
}
-::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
+::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
Size aSz;
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox )
aSz = pCheckBox->CalcMinimumSize();
return AWTSize(aSz);
}
-::com::sun::star::awt::Size VCLXCheckBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
+::com::sun::star::awt::Size VCLXCheckBox::getPreferredSize() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
return getMinimumSize();
}
@@ -937,7 +937,7 @@ void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::Run
SolarMutexGuard aGuard;
Size aSz = VCLSize(rNewSize);
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox )
{
Size aMinSz = pCheckBox->CalcMinimumSize();
@@ -953,7 +953,7 @@ void VCLXCheckBox::setProperty( const OUString& PropertyName, const ::com::sun::
{
SolarMutexGuard aGuard;
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -990,7 +990,7 @@ void VCLXCheckBox::setProperty( const OUString& PropertyName, const ::com::sun::
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1025,7 +1025,7 @@ void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
// in during the listener call. To prevent the resulting crashs, we keep us
// alive as long as we're here
- CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
+ VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
if ( pCheckBox )
{
if ( maItemListeners.getLength() )
@@ -1125,7 +1125,7 @@ void VCLXRadioButton::setProperty( const OUString& PropertyName, const ::com::su
{
SolarMutexGuard aGuard;
- RadioButton* pButton = static_cast<RadioButton*>(GetWindow());
+ VclPtr< RadioButton > pButton = GetAs< RadioButton >();
if ( pButton )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1168,7 +1168,7 @@ void VCLXRadioButton::setProperty( const OUString& PropertyName, const ::com::su
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- RadioButton* pButton = static_cast<RadioButton*>(GetWindow());
+ VclPtr< RadioButton > pButton = GetAs< RadioButton >();
if ( pButton )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1235,7 +1235,7 @@ void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- RadioButton* pRadioButton = static_cast<RadioButton*>(GetWindow());
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton)
{
pRadioButton->Check( b );
@@ -1254,7 +1254,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- RadioButton* pRadioButton = static_cast<RadioButton*>(GetWindow());
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
return pRadioButton ? pRadioButton->IsChecked() : sal_False;
}
@@ -1263,7 +1263,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti
SolarMutexGuard aGuard;
Size aSz;
- RadioButton* pRadioButton = static_cast<RadioButton*>(GetWindow());
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton )
aSz = pRadioButton->CalcMinimumSize();
return AWTSize(aSz);
@@ -1279,7 +1279,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti
SolarMutexGuard aGuard;
Size aSz = VCLSize(rNewSize);
- RadioButton* pRadioButton = static_cast<RadioButton*>(GetWindow());
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton )
{
Size aMinSz = pRadioButton->CalcMinimumSize();
@@ -1325,7 +1325,7 @@ void VCLXRadioButton::ImplClickedOrToggled( bool bToggled )
{
// In the formulars, RadioChecked is not enabled, call itemStateChanged only for click
// In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
- RadioButton* pRadioButton = static_cast<RadioButton*>(GetWindow());
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton && ( pRadioButton->IsRadioCheckEnabled() == bToggled ) && ( bToggled || pRadioButton->IsStateChanged() ) && maItemListeners.getLength() )
{
::com::sun::star::awt::ItemEvent aEvent;
@@ -1381,7 +1381,7 @@ void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException, std::exc
{
SolarMutexGuard aGuard;
- SpinField* pSpinField = static_cast<SpinField*>(GetWindow());
+ VclPtr< SpinField > pSpinField = GetAs< SpinField >();
if ( pSpinField )
pSpinField->Up();
}
@@ -1390,7 +1390,7 @@ void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException, std::e
{
SolarMutexGuard aGuard;
- SpinField* pSpinField = static_cast<SpinField*>(GetWindow());
+ VclPtr< SpinField > pSpinField = GetAs< SpinField >();
if ( pSpinField )
pSpinField->Down();
}
@@ -1399,7 +1399,7 @@ void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException, std::
{
SolarMutexGuard aGuard;
- SpinField* pSpinField = static_cast<SpinField*>(GetWindow());
+ VclPtr< SpinField > pSpinField = GetAs< SpinField >();
if ( pSpinField )
pSpinField->First();
}
@@ -1408,7 +1408,7 @@ void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException, std::e
{
SolarMutexGuard aGuard;
- SpinField* pSpinField = static_cast<SpinField*>(GetWindow());
+ VclPtr< SpinField > pSpinField = GetAs< SpinField >();
if ( pSpinField )
pSpinField->Last();
}
@@ -1549,8 +1549,7 @@ void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference<
void VCLXListBox::addItem( const OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
pBox->InsertEntry( aItem, nPos );
}
@@ -1558,8 +1557,7 @@ void VCLXListBox::addItem( const OUString& aItem, sal_Int16 nPos ) throw(::com::
void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence< OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
{
sal_uInt16 nP = nPos;
@@ -1582,8 +1580,7 @@ void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence< OUString>& aI
void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
{
for ( sal_uInt16 n = nCount; n; )
@@ -1595,7 +1592,7 @@ sal_Int16 VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeExcept
{
SolarMutexGuard aGuard;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
return pBox ? pBox->GetEntryCount() : 0;
}
@@ -1604,7 +1601,7 @@ OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Run
SolarMutexGuard aGuard;
OUString aItem;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
aItem = pBox->GetEntry( nPos );
return aItem;
@@ -1615,7 +1612,7 @@ OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Run
SolarMutexGuard aGuard;
::com::sun::star::uno::Sequence< OUString> aSeq;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
{
sal_uInt16 nEntries = pBox->GetEntryCount();
@@ -1632,8 +1629,7 @@ OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Run
sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
return pBox ? pBox->GetSelectEntryPos() : 0;
}
@@ -1642,7 +1638,7 @@ sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::Runtime
SolarMutexGuard aGuard;
::com::sun::star::uno::Sequence<sal_Int16> aSeq;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
{
sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
@@ -1658,7 +1654,7 @@ OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeExce
SolarMutexGuard aGuard;
OUString aItem;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
aItem = pBox->GetSelectEntry();
return aItem;
@@ -1669,7 +1665,7 @@ OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeExce
SolarMutexGuard aGuard;
::com::sun::star::uno::Sequence< OUString> aSeq;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
{
sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
@@ -1684,7 +1680,7 @@ void VCLXListBox::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com:
{
SolarMutexGuard aGuard;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox && ( pBox->IsEntryPosSelected( nPos ) != bool(bSelect) ) )
{
pBox->SelectEntryPos( nPos, bSelect );
@@ -1703,7 +1699,7 @@ void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int1
{
SolarMutexGuard aGuard;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
{
bool bChanged = false;
@@ -1734,7 +1730,7 @@ void VCLXListBox::selectItem( const OUString& rItemText, sal_Bool bSelect ) thro
{
SolarMutexGuard aGuard;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
{
OUString aItemText( rItemText );
@@ -1742,12 +1738,10 @@ void VCLXListBox::selectItem( const OUString& rItemText, sal_Bool bSelect ) thro
}
}
-
void VCLXListBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
pBox->SetDropDownLineCount( nLines );
}
@@ -1757,7 +1751,7 @@ sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::Runti
SolarMutexGuard aGuard;
sal_Int16 nLines = 0;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
nLines = pBox->GetDropDownLineCount();
return nLines;
@@ -1766,9 +1760,8 @@ sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::Runti
sal_Bool VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
bool bMulti = false;
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
bMulti = pBox->IsMultiSelectionEnabled();
return bMulti;
@@ -1777,8 +1770,7 @@ sal_Bool VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeExcept
void VCLXListBox::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
pBox->EnableMultiSelection( bMulti );
}
@@ -1786,8 +1778,7 @@ void VCLXListBox::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno
void VCLXListBox::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
pBox->SetTopEntry( nEntry );
}
@@ -1803,8 +1794,7 @@ void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
case VCLEVENT_LISTBOX_SELECT:
{
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
-
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if( pListBox )
{
bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) != 0;
@@ -1830,7 +1820,7 @@ void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
::com::sun::star::awt::ActionEvent aEvent;
aEvent.Source = (::cppu::OWeakObject*)this;
- aEvent.ActionCommand = static_cast<ListBox*>(GetWindow())->GetSelectEntry();
+ aEvent.ActionCommand = GetAs<ListBox>()->GetSelectEntry();
maActionListeners.actionPerformed( aEvent );
}
break;
@@ -1851,8 +1841,7 @@ void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if ( pListBox )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1928,9 +1917,8 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::uno::Any VCLXListBox::getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
::com::sun::star::uno::Any aProp;
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if ( pListBox )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1982,9 +1970,8 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::awt::Size VCLXListBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
Size aSz;
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if ( pListBox )
aSz = pListBox->CalcMinimumSize();
return AWTSize(aSz);
@@ -1993,9 +1980,8 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::awt::Size VCLXListBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
Size aSz;
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if ( pListBox )
{
aSz = pListBox->CalcMinimumSize();
@@ -2008,9 +1994,8 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::awt::Size VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
Size aSz = VCLSize(rNewSize);
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if ( pListBox )
aSz = pListBox->CalcAdjustedSize( aSz );
return AWTSize(aSz);
@@ -2019,9 +2004,8 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
Size aSz;
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if ( pListBox )
aSz = pListBox->CalcBlockSize( nCols, nLines );
return AWTSize(aSz);
@@ -2030,9 +2014,8 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
nCols = nLines = 0;
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if ( pListBox )
{
sal_uInt16 nC, nL;
@@ -2044,7 +2027,7 @@ void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) thro
void VCLXListBox::ImplCallItemListeners()
{
- ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if ( pListBox && maItemListeners.getLength() )
{
::com::sun::star::awt::ItemEvent aEvent;
@@ -2083,8 +2066,7 @@ namespace
void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" );
ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ),
@@ -2098,8 +2080,7 @@ void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) thr
void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" );
ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
@@ -2111,8 +2092,7 @@ void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) thro
void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
@@ -2131,7 +2111,7 @@ void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw
{
SolarMutexGuard aGuard;
- ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
pListBox->Clear();
@@ -2143,7 +2123,7 @@ void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw
{
SolarMutexGuard aGuard;
- ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
pListBox->Clear();
@@ -2233,8 +2213,7 @@ OUString VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeEx
void VCLXMessageBox::setMessageText( const OUString& rText ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- MessBox* pBox = static_cast<MessBox*>(GetWindow());
+ VclPtr< MessBox > pBox = GetAs< MessBox >();
if ( pBox )
pBox->SetMessText( rText );
}
@@ -2242,9 +2221,8 @@ void VCLXMessageBox::setMessageText( const OUString& rText ) throw(::com::sun::s
OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
OUString aText;
- MessBox* pBox = static_cast<MessBox*>(GetWindow());
+ VclPtr< MessBox > pBox = GetAs< MessBox >();
if ( pBox )
aText = pBox->GetMessText();
return aText;
@@ -2253,8 +2231,7 @@ OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeEx
sal_Int16 VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- MessBox* pBox = static_cast<MessBox*>(GetWindow());
+ VclPtr< MessBox > pBox = GetAs< MessBox >();
return pBox ? pBox->Execute() : 0;
}
@@ -2301,8 +2278,7 @@ IMPL_XTYPEPROVIDER_END
void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() );
+ VclPtr<Dialog> pDialog = GetAsDynamic< Dialog >();
if ( pDialog )
pDialog->EndDialog( i_result );
}
@@ -2310,8 +2286,7 @@ void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeExcept
void SAL_CALL VCLXDialog::setHelpId( const OUString& rId ) throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
pWindow->SetHelpId( OUStringToOString( rId, RTL_TEXTENCODING_UTF8 ) );
}
@@ -2319,8 +2294,7 @@ void SAL_CALL VCLXDialog::setHelpId( const OUString& rId ) throw (RuntimeExcepti
void VCLXDialog::setTitle( const OUString& Title ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
pWindow->SetText( Title );
}
@@ -2330,7 +2304,7 @@ OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException, s
SolarMutexGuard aGuard;
OUString aTitle;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
aTitle = pWindow->GetText();
return aTitle;
@@ -2343,7 +2317,7 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException, s
sal_Int16 nRet = 0;
if ( GetWindow() )
{
- Dialog* pDlg = static_cast<Dialog*>(GetWindow());
+ VclPtr< Dialog > pDlg = GetAs< Dialog >();
vcl::Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
vcl::Window* pOldParent = NULL;
vcl::Window* pSetParent = NULL;
@@ -2376,8 +2350,7 @@ void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException, std
void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
-
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
@@ -2396,7 +2369,7 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s
::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
SolarMutexGuard aGuard;
- Dialog* pDlg = static_cast<Dialog*>(GetWindow());
+ VclPtr< Dialog > pDlg = GetAs< Dialog >();
if ( pDlg )
pDlg->GetDrawWindowBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
@@ -2409,8 +2382,7 @@ void SAL_CALL VCLXDialog::setProperty(
throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- Dialog* pDialog = static_cast<Dialog*>(GetWindow());
+ VclPtr< Dialog > pDialog = GetAs< Dialog >();
if ( pDialog )
{
bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
@@ -2510,7 +2482,7 @@ void SAL_CALL VCLXMultiPage::draw( sal_Int32 nX, sal_Int32 nY )
throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
@@ -2563,7 +2535,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
SolarMutexGuard aGuard;
OSL_TRACE(" **** VCLXMultiPage::setProperty( %s )", OUStringToOString( PropertyName, RTL_TEXTENCODING_UTF8 ).getStr() );
- TabControl* pTabControl = static_cast<TabControl*>(GetWindow());
+ VclPtr< TabControl > pTabControl = GetAs< TabControl >();
if ( pTabControl )
{
bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
@@ -2615,7 +2587,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException)
{
- TabControl *pTabControl = dynamic_cast< TabControl* >( GetWindow() );
+ VclPtr<TabControl> pTabControl = GetAsDynamic< TabControl >();
if ( pTabControl )
return pTabControl;
throw uno::RuntimeException();
@@ -2623,7 +2595,7 @@ TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException)
sal_Int32 SAL_CALL VCLXMultiPage::insertTab() throw (uno::RuntimeException, std::exception)
{
TabControl *pTabControl = getTabControl();
- TabPage* pTab = new TabPage( pTabControl );
+ VclPtrInstance<TabPage> pTab( pTabControl );
OUString title ("");
return static_cast< sal_Int32 >( insertTab( pTab, title ) );
}
@@ -2787,7 +2759,7 @@ void SAL_CALL VCLXTabPage::draw( sal_Int32 nX, sal_Int32 nY )
throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
@@ -2816,8 +2788,7 @@ void SAL_CALL VCLXTabPage::setProperty(
throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- TabPage* pTabPage = static_cast<TabPage*>(GetWindow());
+ VclPtr< TabPage > pTabPage = GetAs< TabPage >();
if ( pTabPage )
{
bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
@@ -2867,7 +2838,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
TabPage *VCLXTabPage::getTabPage() const throw (uno::RuntimeException)
{
- TabPage *pTabPage = dynamic_cast< TabPage* >( GetWindow() );
+ VclPtr< TabPage > pTabPage = GetAsDynamic< TabPage >();
if ( pTabPage )
return pTabPage;
throw uno::RuntimeException();
@@ -2928,7 +2899,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve
{
// open the URL
OUString sURL;
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
sURL = pBase->GetURL();
Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::com::sun::star::system::SystemShellExecute::create(
@@ -2962,8 +2933,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve
void VCLXFixedHyperlink::setText( const OUString& Text ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if (pBase)
pBase->SetText(Text);
}
@@ -2973,7 +2943,7 @@ OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeExcep
SolarMutexGuard aGuard;
OUString aText;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
aText = pWindow->GetText();
return aText;
@@ -2982,8 +2952,7 @@ OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeExcep
void VCLXFixedHyperlink::setURL( const OUString& URL ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
pBase->SetURL( URL );
}
@@ -2993,7 +2962,7 @@ OUString VCLXFixedHyperlink::getURL( ) throw(::com::sun::star::uno::RuntimeExce
SolarMutexGuard aGuard;
OUString aText;
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
aText = pBase->GetURL();
return aText;
@@ -3003,7 +2972,7 @@ void VCLXFixedHyperlink::setAlignment( short nAlign ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
WinBits nNewBits = 0;
@@ -3025,7 +2994,7 @@ short VCLXFixedHyperlink::getAlignment() throw(::com::sun::star::uno::RuntimeExc
SolarMutexGuard aGuard;
short nAlign = 0;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
WinBits nStyle = pWindow->GetStyle();
@@ -3054,9 +3023,8 @@ void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Refe
::com::sun::star::awt::Size VCLXFixedHyperlink::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
Size aSz;
- FixedText* pFixedText = static_cast<FixedText*>(GetWindow());
+ VclPtr< FixedText > pFixedText = GetAs< FixedText >();
if ( pFixedText )
aSz = pFixedText->CalcMinimumSize();
return AWTSize(aSz);
@@ -3083,7 +3051,7 @@ void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const ::com:
{
SolarMutexGuard aGuard;
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -3118,7 +3086,7 @@ void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const ::com:
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -3225,7 +3193,7 @@ void VCLXFixedText::setText( const OUString& Text ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
pWindow->SetText( Text );
}
@@ -3235,7 +3203,7 @@ OUString VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException,
SolarMutexGuard aGuard;
OUString aText;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
aText = pWindow->GetText();
return aText;
@@ -3245,7 +3213,7 @@ void VCLXFixedText::setAlignment( short nAlign ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
WinBits nNewBits = 0;
@@ -3267,7 +3235,7 @@ short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeExceptio
SolarMutexGuard aGuard;
short nAlign = 0;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
WinBits nStyle = pWindow->GetStyle();
@@ -3286,7 +3254,7 @@ short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeExceptio
SolarMutexGuard aGuard;
Size aSz;
- FixedText* pFixedText = static_cast<FixedText*>(GetWindow());
+ VclPtr< FixedText > pFixedText = GetAs< FixedText >();
if ( pFixedText )
aSz = pFixedText->CalcMinimumSize();
return AWTSize(aSz);
@@ -3302,7 +3270,7 @@ short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeExceptio
SolarMutexGuard aGuard;
Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) );
- FixedText* pFixedText = static_cast<FixedText*>(GetWindow());
+ VclPtr< FixedText > pFixedText = GetAs< FixedText >();
if ( pFixedText )
aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width );
return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize );
@@ -3391,7 +3359,7 @@ void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::Runtime
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->DoScroll( n );
}
@@ -3400,7 +3368,7 @@ void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 n
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
{
pScrollBar->SetVisibleSize( nVisible );
@@ -3413,7 +3381,7 @@ sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetThumbPos() : 0;
}
@@ -3421,7 +3389,7 @@ void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetRangeMax( n );
}
@@ -3430,7 +3398,7 @@ sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeExcept
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetRangeMax() : 0;
}
@@ -3438,7 +3406,7 @@ void VCLXScrollBar::setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetRangeMin( n );
}
@@ -3447,7 +3415,7 @@ sal_Int32 VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeExcept
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetRangeMin() : 0;
}
@@ -3455,7 +3423,7 @@ void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetLineSize( n );
}
@@ -3464,7 +3432,7 @@ sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::Runtime
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetLineSize() : 0;
}
@@ -3472,7 +3440,7 @@ void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetPageSize( n );
}
@@ -3481,7 +3449,7 @@ sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetPageSize() : 0;
}
@@ -3489,7 +3457,7 @@ void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::R
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetVisibleSize( n );
}
@@ -3498,7 +3466,7 @@ sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeEx
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetVisibleSize() : 0;
}
@@ -3506,7 +3474,7 @@ void VCLXScrollBar::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::R
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
WinBits nStyle = pWindow->GetStyle();
@@ -3526,7 +3494,7 @@ sal_Int32 VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeEx
SolarMutexGuard aGuard;
sal_Int32 n = 0;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
WinBits nStyle = pWindow->GetStyle();
@@ -3544,7 +3512,7 @@ void VCLXScrollBar::setProperty( const OUString& PropertyName, const ::com::sun:
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
{
bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
@@ -3660,7 +3628,7 @@ void VCLXScrollBar::setProperty( const OUString& PropertyName, const ::com::sun:
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -3737,7 +3705,7 @@ void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if ( maAdjustmentListeners.getLength() )
{
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if( pScrollBar )
{
@@ -3877,7 +3845,7 @@ void VCLXEdit::setText( const OUString& aText ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
pEdit->SetText( aText );
@@ -3894,7 +3862,7 @@ void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const O
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) );
@@ -3913,7 +3881,7 @@ OUString VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException, std:
SolarMutexGuard aGuard;
OUString aText;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
aText = pWindow->GetText();
return aText;
@@ -3924,7 +3892,7 @@ OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeExcepti
SolarMutexGuard aGuard;
OUString aText;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit)
aText = pEdit->GetSelected();
return aText;
@@ -3935,7 +3903,7 @@ void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
}
@@ -3945,7 +3913,7 @@ void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection
SolarMutexGuard aGuard;
Selection aSel;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
aSel = pEdit->GetSelection();
return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() );
@@ -3955,7 +3923,7 @@ sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException, s
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False;
}
@@ -3963,7 +3931,7 @@ void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
pEdit->SetReadOnly( !bEditable );
}
@@ -3973,7 +3941,7 @@ void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
pEdit->SetMaxTextLen( nLen );
}
@@ -3982,7 +3950,7 @@ sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
return pEdit ? pEdit->GetMaxTextLen() : 0;
}
@@ -3990,7 +3958,7 @@ void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
pEdit->SetEchoChar( cEcho );
}
@@ -3999,7 +3967,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -4045,7 +4013,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -4077,7 +4045,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star
SolarMutexGuard aGuard;
Size aSz;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
aSz = pEdit->CalcMinimumSize();
return AWTSize(aSz);
@@ -4088,7 +4056,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star
SolarMutexGuard aGuard;
Size aSz;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
aSz = pEdit->CalcMinimumSize();
@@ -4114,7 +4082,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star
SolarMutexGuard aGuard;
Size aSz;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
if ( nCols )
@@ -4131,7 +4099,7 @@ void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(:
nLines = 1;
nCols = 0;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
nCols = pEdit->GetMaxVisChars();
}
@@ -4257,7 +4225,7 @@ void VCLXComboBox::addItem( const OUString& aItem, sal_Int16 nPos ) throw(::com:
{
SolarMutexGuard aGuard;
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
pBox->InsertEntry( aItem, nPos );
}
@@ -4266,7 +4234,7 @@ void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< OUString>& a
{
SolarMutexGuard aGuard;
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
{
sal_uInt16 nP = nPos;
@@ -4287,7 +4255,7 @@ void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::
{
SolarMutexGuard aGuard;
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
{
for ( sal_uInt16 n = nCount; n; )
@@ -4299,7 +4267,7 @@ sal_Int16 VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
return pBox ? pBox->GetEntryCount() : 0;
}
@@ -4308,7 +4276,7 @@ OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru
SolarMutexGuard aGuard;
OUString aItem;
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
aItem = pBox->GetEntry( nPos );
return aItem;
@@ -4319,7 +4287,7 @@ OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru
SolarMutexGuard aGuard;
::com::sun::star::uno::Sequence< OUString> aSeq;
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
{
sal_uInt16 nEntries = pBox->GetEntryCount();
@@ -4337,7 +4305,7 @@ void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::st
{
SolarMutexGuard aGuard;
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
pBox->SetDropDownLineCount( nLines );
}
@@ -4347,7 +4315,7 @@ sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::Runt
SolarMutexGuard aGuard;
sal_Int16 nLines = 0;
- ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox )
nLines = pBox->GetDropDownLineCount();
return nLines;
@@ -4357,7 +4325,7 @@ void VCLXComboBox::setProperty( const OUString& PropertyName, const ::com::sun::
{
SolarMutexGuard aGuard;
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
if ( pComboBox )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -4414,7 +4382,7 @@ void VCLXComboBox::setProperty( const OUString& PropertyName, const ::com::sun::
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
if ( pComboBox )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -4462,7 +4430,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VCLEVENT_COMBOBOX_SELECT:
if ( maItemListeners.getLength() )
{
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
if( pComboBox )
{
if ( !pComboBox->IsTravelSelect() )
@@ -4501,7 +4469,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
SolarMutexGuard aGuard;
Size aSz;
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
if ( pComboBox )
aSz = pComboBox->CalcMinimumSize();
return AWTSize(aSz);
@@ -4512,7 +4480,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
SolarMutexGuard aGuard;
Size aSz;
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
if ( pComboBox )
{
aSz = pComboBox->CalcMinimumSize();
@@ -4527,7 +4495,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
SolarMutexGuard aGuard;
Size aSz = VCLSize(rNewSize);
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
if ( pComboBox )
aSz = pComboBox->CalcAdjustedSize( aSz );
return AWTSize(aSz);
@@ -4538,7 +4506,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
SolarMutexGuard aGuard;
Size aSz;
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
if ( pComboBox )
aSz = pComboBox->CalcBlockSize( nCols, nLines );
return AWTSize(aSz);
@@ -4549,7 +4517,7 @@ void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) thr
SolarMutexGuard aGuard;
nCols = nLines = 0;
- ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
if ( pComboBox )
{
sal_uInt16 nC, nL;
@@ -4562,7 +4530,7 @@ void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) th
{
SolarMutexGuard aGuard;
- ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >();
ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" );
ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ),
@@ -4577,7 +4545,7 @@ void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) thr
{
SolarMutexGuard aGuard;
- ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >();
ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" );
ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
@@ -4590,7 +4558,7 @@ void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) th
{
SolarMutexGuard aGuard;
- ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >();
ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
@@ -4609,7 +4577,7 @@ void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw
{
SolarMutexGuard aGuard;
- ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >();
ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
pComboBox->Clear();
@@ -4621,7 +4589,7 @@ void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw
{
SolarMutexGuard aGuard;
- ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ VclPtr< ComboBox > pComboBox = GetAsDynamic< ComboBox >();
ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
pComboBox->Clear();
@@ -4816,7 +4784,7 @@ VCLXDateField::~VCLXDateField()
//change the window type here to match the role
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXDateField::CreateAccessibleContext()
{
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
pWindow->SetType( WINDOW_DATEFIELD );
@@ -4853,8 +4821,8 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun:
{
if ( bVoid )
{
- static_cast<DateField*>(GetWindow())->EnableEmptyFieldValue( true );
- static_cast<DateField*>(GetWindow())->SetEmptyFieldValue();
+ GetAs< DateField >()->EnableEmptyFieldValue( true );
+ GetAs< DateField >()->SetEmptyFieldValue();
}
else
{
@@ -4882,21 +4850,21 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun:
{
sal_Int16 n = sal_Int16();
if ( Value >>= n )
- static_cast<DateField*>(GetWindow())->SetExtDateFormat( (ExtDateFieldFormat) n );
+ GetAs< DateField >()->SetExtDateFormat( (ExtDateFieldFormat) n );
}
break;
case BASEPROPERTY_DATESHOWCENTURY:
{
bool b = bool();
if ( Value >>= b )
- static_cast<DateField*>(GetWindow())->SetShowDateCentury( b );
+ GetAs< DateField >()->SetShowDateCentury( b );
}
break;
case BASEPROPERTY_ENFORCE_FORMAT:
{
bool bEnforce( true );
OSL_VERIFY( Value >>= bEnforce );
- static_cast< DateField* >( GetWindow() )->EnforceValidValue( bEnforce );
+ GetAs< DateField >()->EnforceValidValue( bEnforce );
}
break;
default:
@@ -4935,12 +4903,12 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun:
break;
case BASEPROPERTY_DATESHOWCENTURY:
{
- aProp <<= static_cast<DateField*>(GetWindow())->IsShowDateCentury();
+ aProp <<= GetAs< DateField >()->IsShowDateCentury();
}
break;
case BASEPROPERTY_ENFORCE_FORMAT:
{
- aProp <<= static_cast< DateField* >( GetWindow() )->IsEnforceValidValue( );
+ aProp <<= GetAs< DateField >()->IsEnforceValidValue( );
}
break;
default:
@@ -4957,7 +4925,7 @@ void VCLXDateField::setDate( const util::Date& aDate ) throw(::com::sun::star::u
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
{
pDateField->SetDate( aDate );
@@ -4974,7 +4942,7 @@ util::Date VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
return pDateField->GetDate().GetUNODate();
else
@@ -4985,7 +4953,7 @@ void VCLXDateField::setMin( const util::Date& aDate ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
pDateField->SetMin( aDate );
}
@@ -4994,7 +4962,7 @@ util::Date VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
return pDateField->GetMin().GetUNODate();
else
@@ -5005,7 +4973,7 @@ void VCLXDateField::setMax( const util::Date& aDate ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
pDateField->SetMax( aDate );
}
@@ -5014,7 +4982,7 @@ util::Date VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
return pDateField->GetMax().GetUNODate();
else
@@ -5025,7 +4993,7 @@ void VCLXDateField::setFirst( const util::Date& aDate ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
pDateField->SetFirst( aDate );
}
@@ -5034,7 +5002,7 @@ util::Date VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
return pDateField->GetFirst().GetUNODate();
else
@@ -5045,7 +5013,7 @@ void VCLXDateField::setLast( const util::Date& aDate ) throw(::com::sun::star::u
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
pDateField->SetLast( aDate );
}
@@ -5054,7 +5022,7 @@ util::Date VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
return pDateField->GetLast().GetUNODate();
else
@@ -5065,7 +5033,7 @@ void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
pDateField->SetLongFormat( bLong );
}
@@ -5074,7 +5042,7 @@ sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
return pDateField ? pDateField->IsLongFormat() : sal_False;
}
@@ -5082,7 +5050,7 @@ void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException, st
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
if ( pDateField )
{
pDateField->SetEmptyDate();
@@ -5099,7 +5067,7 @@ sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- DateField* pDateField = static_cast<DateField*>(GetWindow());
+ VclPtr< DateField > pDateField = GetAs< DateField >();
return pDateField ? pDateField->IsEmptyDate() : sal_False;
}
@@ -5164,7 +5132,7 @@ VCLXTimeField::~VCLXTimeField()
//change the window type here to match the role
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXTimeField::CreateAccessibleContext()
{
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
pWindow->SetType( WINDOW_TIMEFIELD );
@@ -5190,7 +5158,7 @@ void VCLXTimeField::setTime( const util::Time& aTime ) throw(::com::sun::star::u
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
{
pTimeField->SetTime( aTime );
@@ -5207,7 +5175,7 @@ util::Time VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetTime().GetUNOTime();
else
@@ -5218,7 +5186,7 @@ void VCLXTimeField::setMin( const util::Time& aTime ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetMin( aTime );
}
@@ -5227,7 +5195,7 @@ util::Time VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetMin().GetUNOTime();
else
@@ -5238,7 +5206,7 @@ void VCLXTimeField::setMax( const util::Time& aTime ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetMax( aTime );
}
@@ -5247,7 +5215,7 @@ util::Time VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetMax().GetUNOTime();
else
@@ -5258,7 +5226,7 @@ void VCLXTimeField::setFirst( const util::Time& aTime ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetFirst( aTime );
}
@@ -5267,7 +5235,7 @@ util::Time VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetFirst().GetUNOTime();
else
@@ -5278,7 +5246,7 @@ void VCLXTimeField::setLast( const util::Time& aTime ) throw(::com::sun::star::u
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetLast( aTime );
}
@@ -5287,7 +5255,7 @@ util::Time VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetLast().GetUNOTime();
else
@@ -5298,7 +5266,7 @@ void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException, st
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetEmptyTime();
}
@@ -5307,7 +5275,7 @@ sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
return pTimeField ? pTimeField->IsEmptyTime() : sal_False;
}
@@ -5337,8 +5305,8 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
{
if ( bVoid )
{
- static_cast<TimeField*>(GetWindow())->EnableEmptyFieldValue( true );
- static_cast<TimeField*>(GetWindow())->SetEmptyFieldValue();
+ GetAs< TimeField >()->EnableEmptyFieldValue( true );
+ GetAs< TimeField >()->SetEmptyFieldValue();
}
else
{
@@ -5366,14 +5334,14 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
{
sal_Int16 n = sal_Int16();
if ( Value >>= n )
- static_cast<TimeField*>(GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n );
+ GetAs< TimeField >()->SetExtFormat( (ExtTimeFieldFormat) n );
}
break;
case BASEPROPERTY_ENFORCE_FORMAT:
{
bool bEnforce( true );
OSL_VERIFY( Value >>= bEnforce );
- static_cast< TimeField* >( GetWindow() )->EnforceValidValue( bEnforce );
+ GetAs< TimeField >()->EnforceValidValue( bEnforce );
}
break;
default:
@@ -5411,7 +5379,7 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
break;
case BASEPROPERTY_ENFORCE_FORMAT:
{
- aProp <<= static_cast< TimeField* >( GetWindow() )->IsEnforceValidValue( );
+ aProp <<= GetAs< TimeField >()->IsEnforceValidValue( );
}
break;
default:
@@ -5499,7 +5467,7 @@ void VCLXNumericField::setValue( double Value ) throw(::com::sun::star::uno::Run
(long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
// #107218# Call same listeners like VCL would do after user interaction
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
SetSynthesizingVCLEvent( true );
@@ -5564,7 +5532,7 @@ void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
if ( pNumericField )
pNumericField->SetFirst(
(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5574,7 +5542,7 @@ double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
return pNumericField
? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() )
: 0;
@@ -5584,7 +5552,7 @@ void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
if ( pNumericField )
pNumericField->SetLast(
(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5594,7 +5562,7 @@ double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
return pNumericField
? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() )
: 0;
@@ -5615,7 +5583,7 @@ void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
if ( pNumericField )
pNumericField->SetSpinSize(
(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5625,7 +5593,7 @@ double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
return pNumericField
? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() )
: 0;
@@ -5667,8 +5635,8 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
{
if ( bVoid )
{
- static_cast<NumericField*>(GetWindow())->EnableEmptyFieldValue( true );
- static_cast<NumericField*>(GetWindow())->SetEmptyFieldValue();
+ GetAs< NumericField >()->EnableEmptyFieldValue( true );
+ GetAs< NumericField >()->SetEmptyFieldValue();
}
else
{
@@ -5710,7 +5678,7 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
{
bool b = bool();
if ( Value >>= b )
- static_cast<NumericField*>(GetWindow())->SetUseThousandSep( b );
+ GetAs< NumericField >()->SetUseThousandSep( b );
}
break;
default:
@@ -5754,7 +5722,7 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
break;
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
{
- aProp <<= static_cast<NumericField*>(GetWindow())->IsUseThousandSep();
+ aProp <<= GetAs< NumericField >()->IsUseThousandSep();
}
break;
default:
@@ -5822,7 +5790,7 @@ MetricFormatter *VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::u
MetricField *VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException)
{
- MetricField *pField = static_cast<MetricField *>(GetWindow());
+ VclPtr< MetricField > pField = GetAs< MetricField >();
if (!pField)
throw ::com::sun::star::uno::RuntimeException();
return pField;
@@ -5880,7 +5848,7 @@ METRIC_MAP_PAIR(Last, Field)
void VCLXMetricField::CallListeners()
{
// #107218# Call same listeners like VCL would do after user interaction
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
SetSynthesizingVCLEvent( true );
@@ -5960,21 +5928,21 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const ::com::su
{
bool b = false;
if ( Value >>= b )
- static_cast<NumericField*>(GetWindow())->SetUseThousandSep( b );
+ GetAs< NumericField >()->SetUseThousandSep( b );
}
break;
case BASEPROPERTY_UNIT:
{
sal_uInt16 nVal = 0;
if ( Value >>= nVal )
- static_cast<MetricField*>(GetWindow())->SetUnit( (FieldUnit) nVal );
+ GetAs< MetricField >()->SetUnit( (FieldUnit) nVal );
break;
}
case BASEPROPERTY_CUSTOMUNITTEXT:
{
OUString aStr;
if ( Value >>= aStr )
- static_cast<MetricField*>(GetWindow())->SetCustomUnitText( aStr );
+ GetAs< MetricField >()->SetCustomUnitText( aStr );
break;
}
default:
@@ -5998,13 +5966,13 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const ::com::su
switch ( nPropType )
{
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
- aProp <<= static_cast<NumericField*>(GetWindow())->IsUseThousandSep();
+ aProp <<= GetAs< NumericField >()->IsUseThousandSep();
break;
case BASEPROPERTY_UNIT:
- aProp <<= (sal_uInt16) (static_cast<MetricField*>(GetWindow())->GetUnit());
+ aProp <<= (sal_uInt16) (GetAs< MetricField >()->GetUnit());
break;
case BASEPROPERTY_CUSTOMUNITTEXT:
- aProp <<= OUString( static_cast<MetricField*>(GetWindow())->GetCustomUnitText() );
+ aProp <<= OUString( GetAs< MetricField >()->GetCustomUnitText() );
break;
default:
{
@@ -6095,7 +6063,7 @@ void VCLXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::Ru
ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
// #107218# Call same listeners like VCL would do after user interaction
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
SetSynthesizingVCLEvent( true );
@@ -6160,7 +6128,7 @@ void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
if ( pCurrencyField )
pCurrencyField->SetFirst(
ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6170,7 +6138,7 @@ double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
return pCurrencyField
? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() )
: 0;
@@ -6180,7 +6148,7 @@ void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
if ( pCurrencyField )
pCurrencyField->SetLast(
ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6190,7 +6158,7 @@ double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
return pCurrencyField
? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() )
: 0;
@@ -6200,7 +6168,7 @@ void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
if ( pCurrencyField )
pCurrencyField->SetSpinSize(
ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6210,7 +6178,7 @@ double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeExce
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
return pCurrencyField
? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() )
: 0;
@@ -6263,8 +6231,8 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
{
if ( bVoid )
{
- static_cast<LongCurrencyField*>(GetWindow())->EnableEmptyFieldValue( true );
- static_cast<LongCurrencyField*>(GetWindow())->SetEmptyFieldValue();
+ GetAs< LongCurrencyField >()->EnableEmptyFieldValue( true );
+ GetAs< LongCurrencyField >()->SetEmptyFieldValue();
}
else
{
@@ -6306,14 +6274,14 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
{
OUString aString;
if ( Value >>= aString )
- static_cast<LongCurrencyField*>(GetWindow())->SetCurrencySymbol( aString );
+ GetAs< LongCurrencyField >()->SetCurrencySymbol( aString );
}
break;
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
{
bool b = bool();
if ( Value >>= b )
- static_cast<LongCurrencyField*>(GetWindow())->SetUseThousandSep( b );
+ GetAs< LongCurrencyField >()->SetUseThousandSep( b );
}
break;
default:
@@ -6357,12 +6325,12 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
break;
case BASEPROPERTY_CURRENCYSYMBOL:
{
- aProp <<= OUString( static_cast<LongCurrencyField*>(GetWindow())->GetCurrencySymbol() );
+ aProp <<= OUString( GetAs< LongCurrencyField >()->GetCurrencySymbol() );
}
break;
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
{
- aProp <<= static_cast<LongCurrencyField*>(GetWindow())->IsUseThousandSep();
+ aProp <<= GetAs< LongCurrencyField >()->IsUseThousandSep();
}
break;
default:
@@ -6434,7 +6402,7 @@ void VCLXPatternField::setMasks( const OUString& EditMask, const OUString& Liter
{
SolarMutexGuard aGuard;
- PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+ VclPtr< PatternField > pPatternField = GetAs< PatternField >();
if ( pPatternField )
{
pPatternField->SetMask( OUStringToOString(EditMask, RTL_TEXTENCODING_ASCII_US), LiteralMask );
@@ -6445,7 +6413,7 @@ void VCLXPatternField::getMasks( OUString& EditMask, OUString& LiteralMask ) thr
{
SolarMutexGuard aGuard;
- PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+ VclPtr< PatternField > pPatternField = GetAs< PatternField >();
if ( pPatternField )
{
EditMask = OStringToOUString(pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US);
@@ -6456,12 +6424,9 @@ void VCLXPatternField::getMasks( OUString& EditMask, OUString& LiteralMask ) thr
void VCLXPatternField::setString( const OUString& Str ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+ VclPtr< PatternField > pPatternField = GetAs< PatternField >();
if ( pPatternField )
- {
pPatternField->SetString( Str );
- }
}
OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException, std::exception)
@@ -6469,7 +6434,7 @@ OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeExcep
SolarMutexGuard aGuard;
OUString aString;
- PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+ VclPtr< PatternField > pPatternField = GetAs< PatternField >();
if ( pPatternField )
aString = pPatternField->GetString();
return aString;
@@ -6608,7 +6573,7 @@ void SAL_CALL VCLXFrame::draw( sal_Int32 nX, sal_Int32 nY )
throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr< vcl::Window > pWindow = GetWindow();
if ( pWindow )
{
diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx
index d8084d46832e..bf8f38065672 100644
--- a/toolkit/source/controls/accessiblecontrolcontext.cxx
+++ b/toolkit/source/controls/accessiblecontrolcontext.cxx
@@ -225,17 +225,18 @@ namespace toolkit
}
- vcl::Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
+ VclPtr< vcl::Window > OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
{
Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY );
Reference< awt::XWindow > xWindow;
if ( xControl.is() )
xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY);
- vcl::Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : NULL;
+ VclPtr< vcl::Window > pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : VclPtr< vcl::Window >();
if ( _pxUNOWindow )
*_pxUNOWindow = xWindow;
+
return pWindow;
}
@@ -259,7 +260,7 @@ namespace toolkit
// our control
Reference< awt::XWindow > xWindow;
- vcl::Window* pVCLWindow = implGetWindow( &xWindow );
+ VclPtr< vcl::Window > pVCLWindow = implGetWindow( &xWindow );
awt::Rectangle aBounds( 0, 0, 0, 0 );
if ( xWindow.is() )
@@ -319,7 +320,7 @@ namespace toolkit
// want to do some VCL stuff here ...
OContextEntryGuard aGuard( this );
- vcl::Window* pWindow = implGetWindow( );
+ VclPtr< vcl::Window > pWindow = implGetWindow();
sal_Int32 nColor = 0;
if ( pWindow )
{
@@ -345,7 +346,7 @@ namespace toolkit
// want to do some VCL stuff here ...
OContextEntryGuard aGuard( this );
- vcl::Window* pWindow = implGetWindow( );
+ VclPtr< vcl::Window > pWindow = implGetWindow();
sal_Int32 nColor = 0;
if ( pWindow )
{
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index 3681847a26f9..56b620c62a77 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -219,13 +219,13 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
{
// their still might be some children created with ::com::sun::star::loader::Java
// that would otherwise not be destroyed until the garbage collector cleans up
- vcl::Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ VclPtr< vcl::Window > pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
while ( pChild )
{
- vcl::Window* pNextChild = pChild->GetWindow( WINDOW_NEXT );
+ VclPtr< vcl::Window > pNextChild = pChild->GetWindow( WINDOW_NEXT );
- vcl::Window* pClient = pChild->GetWindow( WINDOW_CLIENT );
- if ( pClient->GetWindowPeer() )
+ VclPtr< vcl::Window > pClient = pChild->GetWindow( WINDOW_CLIENT );
+ if ( pClient && pClient->GetWindowPeer() )
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( false ), ::com::sun::star::uno::UNO_QUERY );
xComp->dispose();
@@ -235,16 +235,16 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
}
// System-Windows suchen...
- vcl::Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
+ VclPtr< vcl::Window > pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
if ( pOverlap )
{
pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP );
while ( pOverlap )
{
- vcl::Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
- vcl::Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT );
+ VclPtr< vcl::Window > pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
+ VclPtr< vcl::Window > pClient = pOverlap->GetWindow( WINDOW_CLIENT );
- if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
+ if ( pClient && pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( false ), ::com::sun::star::uno::UNO_QUERY );
xComp->dispose();
@@ -254,9 +254,11 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
}
}
- vcl::Window* pParent = pWindow->GetParent();
- if ( pParent && pParent->GetWindowPeer() )
- pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow );
+ {
+ VclPtr< vcl::Window > pParent = pWindow->GetParent();
+ if ( pParent && pParent->GetWindowPeer() )
+ pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow );
+ }
VCLXWindow* pWindowPeer = pWindow->GetWindowPeer();
uno::Reference< lang::XComponent > xWindowPeerComp( pWindow->GetComponentInterface( false ), uno::UNO_QUERY );
@@ -276,13 +278,13 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
// #i42462#/#116855# no, don't loop: Instead, just ensure that all our top-window-children
// are disposed, too (which should also be a valid fix for #102132#, but doesn't have the extreme
// performance penalties)
- vcl::Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
+ VclPtr< vcl::Window > pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
while ( pTopWindowChild )
{
OSL_ENSURE( pTopWindowChild->GetParent() == pWindow,
"UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" );
- vcl::Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
+ VclPtr< vcl::Window > pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
//the window still could be on the stack, so we have to
// use lazy delete ( it will automatically
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
index 7b80bc7a26e6..005caccf8871 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -108,22 +108,22 @@ BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com:
return xBmp;
}
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
{
VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
}
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
{
VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
}
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
{
VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
}
vcl::Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion )
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx
index 0ddbafdbad66..d97c91d9626b 100644
--- a/tools/source/ref/errinf.cxx
+++ b/tools/source/ref/errinf.cxx
@@ -23,6 +23,7 @@
#include <tools/errinf.hxx>
#include <rtl/strbuf.hxx>
#include <osl/diagnose.h>
+#include <vcl/window.hxx>
class ErrorHandler;
@@ -185,22 +186,31 @@ static void aDspFunc(const OUString &rErr, const OUString &rAction)
OSL_FAIL(aErr.getStr());
}
+// FIXME: this is a horrible reverse dependency on VCL
+struct ErrorContextImpl
+{
+ ErrorContext *pNext;
+ vcl::Window *pWin; // should be VclPtr for strong lifecyle
+};
+
ErrorContext::ErrorContext(vcl::Window *pWinP)
{
+ pImpl = new ErrorContextImpl();
EDcrData *pData=EDcrData::GetData();
- ErrorContext *&pHdl=pData->pFirstCtx;
- pWin=pWinP;
- pNext=pHdl;
- pHdl=this;
+ ErrorContext *&pHdl = pData->pFirstCtx;
+ pImpl->pWin = pWinP;
+ pImpl->pNext = pHdl;
+ pHdl = this;
}
ErrorContext::~ErrorContext()
{
ErrorContext **ppCtx=&(EDcrData::GetData()->pFirstCtx);
while(*ppCtx && *ppCtx!=this)
- ppCtx=&((*ppCtx)->pNext);
+ ppCtx=&((*ppCtx)->pImpl->pNext);
if(*ppCtx)
- *ppCtx=(*ppCtx)->pNext;
+ *ppCtx=(*ppCtx)->pImpl->pNext;
+ delete pImpl;
}
ErrorContext *ErrorContext::GetContext()
@@ -229,6 +239,11 @@ ErrorHandler::~ErrorHandler()
delete pImpl;
}
+vcl::Window* ErrorContext::GetParent()
+{
+ return pImpl ? pImpl->pWin : NULL;
+}
+
void ErrorHandler::RegisterDisplay(WindowDisplayErrorFunc *aDsp)
{
EDcrData *pData=EDcrData::GetData();
@@ -275,7 +290,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl(
pCtx->GetString(pInfo->GetErrorCode(), aAction);
vcl::Window *pParent=0;
// Remove parent from context
- for(;pCtx;pCtx=pCtx->pNext)
+ for(;pCtx;pCtx=pCtx->pImpl->pNext)
if(pCtx->GetParent())
{
pParent=pCtx->GetParent();
diff --git a/uui/source/authfallbackdlg.cxx b/uui/source/authfallbackdlg.cxx
index eac0d301b300..58362cb24494 100644
--- a/uui/source/authfallbackdlg.cxx
+++ b/uui/source/authfallbackdlg.cxx
@@ -32,6 +32,21 @@ AuthFallbackDlg::AuthFallbackDlg(Window* pParent, const OUString& instructions,
m_pEDUrl->SetText( url );
}
+AuthFallbackDlg::~AuthFallbackDlg()
+{
+ disposeOnce();
+}
+
+void AuthFallbackDlg::dispose()
+{
+ m_pTVInstructions.clear();
+ m_pEDUrl.clear();
+ m_pEDCode.clear();
+ m_pBTOk.clear();
+ m_pBTCancel.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK ( AuthFallbackDlg, OKHdl, Button *, EMPTYARG )
{
EndDialog( RET_OK );
diff --git a/uui/source/authfallbackdlg.hxx b/uui/source/authfallbackdlg.hxx
index d73eebf70f4f..29634d1f69b0 100644
--- a/uui/source/authfallbackdlg.hxx
+++ b/uui/source/authfallbackdlg.hxx
@@ -19,15 +19,17 @@
class AuthFallbackDlg : public ModalDialog
{
private:
- VclMultiLineEdit* m_pTVInstructions;
- Edit* m_pEDUrl;
- Edit* m_pEDCode;
- PushButton* m_pBTOk;
- PushButton* m_pBTCancel;
+ VclPtr<VclMultiLineEdit> m_pTVInstructions;
+ VclPtr<Edit> m_pEDUrl;
+ VclPtr<Edit> m_pEDCode;
+ VclPtr<PushButton> m_pBTOk;
+ VclPtr<PushButton> m_pBTCancel;
public:
AuthFallbackDlg(Window* pParent, const OUString& instructions,
const OUString& url);
+ virtual ~AuthFallbackDlg();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetCode() const { return m_pEDCode->GetText(); }
diff --git a/uui/source/fltdlg.cxx b/uui/source/fltdlg.cxx
index a24a34e1e35a..c2135bead606 100644
--- a/uui/source/fltdlg.cxx
+++ b/uui/source/fltdlg.cxx
@@ -57,6 +57,18 @@ FilterDialog::FilterDialog( vcl::Window* pParentWindow )
m_pFtURL->SetSizePixel(Size(aSize.Width(), m_pFtURL->GetOptimalSize().Height()));
}
+FilterDialog::~FilterDialog()
+{
+ disposeOnce();
+}
+
+void FilterDialog::dispose()
+{
+ m_pFtURL.clear();
+ m_pLbFilters.clear();
+ ModalDialog::dispose();
+}
+
/*-************************************************************************************************************
@short set file name on dialog control
@descr We convert given URL (it must be an URL!) into valid file name and show it on our dialog.
@@ -157,7 +169,7 @@ class StringCalculator : public ::cppu::WeakImplHelper1< ::com::sun::star::util:
{
public:
StringCalculator( const OutputDevice* pDevice )
- : m_pDevice( pDevice )
+ : m_pDevice( const_cast< OutputDevice * >( pDevice ) )
{
}
@@ -167,7 +179,7 @@ class StringCalculator : public ::cppu::WeakImplHelper1< ::com::sun::star::util:
}
private:
- const OutputDevice* m_pDevice;
+ VclPtr<OutputDevice> m_pDevice;
};
/*-************************************************************************************************************
diff --git a/uui/source/fltdlg.hxx b/uui/source/fltdlg.hxx
index 6c245445ab97..958ad99f5f54 100644
--- a/uui/source/fltdlg.hxx
+++ b/uui/source/fltdlg.hxx
@@ -47,6 +47,8 @@ class FilterDialog : public ModalDialog
// public interface
public:
FilterDialog ( vcl::Window* pParentWindow );
+ virtual ~FilterDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetURL ( const OUString& sURL );
void ChangeFilters( const FilterNameList* pFilterNames );
bool AskForFilter ( FilterNameListPtr& pSelectedItem );
@@ -58,8 +60,8 @@ class FilterDialog : public ModalDialog
// member
private:
- FixedText *m_pFtURL ;
- ListBox *m_pLbFilters ;
+ VclPtr<FixedText> m_pFtURL ;
+ VclPtr<ListBox> m_pLbFilters ;
const FilterNameList* m_pFilterNames;
}; // class FilterDialog
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index 51bf286ffe5b..47ed642a8868 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -88,8 +88,8 @@ executeLoginDialog(
if (!bCanUseSysCreds)
nFlags |= LF_NO_USESYSCREDS;
- boost::scoped_ptr< LoginDialog > xDialog(
- new LoginDialog(pParent, nFlags, rInfo.GetServer(), rRealm));
+ VclPtr< LoginDialog > xDialog(
+ VclPtr<LoginDialog>::Create(pParent, nFlags, rInfo.GetServer(), rRealm));
if (!rInfo.GetErrorText().isEmpty())
xDialog->SetErrorText(rInfo.GetErrorText());
xDialog->SetName(rInfo.GetUserName());
@@ -417,8 +417,8 @@ executeMasterPasswordDialog(
boost::scoped_ptr< ResMgr > xManager(ResMgr::CreateResMgr("uui"));
if( nMode == task::PasswordRequestMode_PASSWORD_CREATE )
{
- boost::scoped_ptr< MasterPasswordCreateDialog > xDialog(
- new MasterPasswordCreateDialog(pParent, xManager.get()));
+ VclPtr< MasterPasswordCreateDialog > xDialog(
+ VclPtr<MasterPasswordCreateDialog>::Create(pParent, xManager.get()));
rInfo.SetResult(xDialog->Execute()
== RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
aMaster = OUStringToOString(
@@ -426,8 +426,8 @@ executeMasterPasswordDialog(
}
else
{
- boost::scoped_ptr< MasterPasswordDialog > xDialog(
- new MasterPasswordDialog(pParent, nMode, xManager.get()));
+ VclPtr< MasterPasswordDialog > xDialog(
+ VclPtr<MasterPasswordDialog>::Create(pParent, nMode, xManager.get()));
rInfo.SetResult(xDialog->Execute()
== RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
aMaster = OUStringToOString(
@@ -517,8 +517,8 @@ executePasswordDialog(
{
if (bIsSimplePasswordRequest)
{
- boost::scoped_ptr< PasswordDialog > pDialog(
- new PasswordDialog( pParent, nMode, xManager.get(), aDocName,
+ VclPtr< PasswordDialog > pDialog(
+ VclPtr<PasswordDialog>::Create( pParent, nMode, xManager.get(), aDocName,
bIsPasswordToModify, bIsSimplePasswordRequest ) );
pDialog->SetMinLen(0);
@@ -541,8 +541,8 @@ executePasswordDialog(
}
else // enter password or reenter password
{
- boost::scoped_ptr< PasswordDialog > pDialog(
- new PasswordDialog( pParent, nMode, xManager.get(), aDocName,
+ VclPtr< PasswordDialog > pDialog(
+ VclPtr<PasswordDialog>::Create( pParent, nMode, xManager.get(), aDocName,
bIsPasswordToModify, bIsSimplePasswordRequest ) );
pDialog->SetMinLen(0);
@@ -752,7 +752,7 @@ UUIInteractionHelper::handleAuthFallbackRequest( OUString & instructions,
uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations )
{
vcl::Window * pParent = getParentProperty( );
- AuthFallbackDlg *dlg = new AuthFallbackDlg( pParent, instructions, url );
+ VclPtrInstance<AuthFallbackDlg> dlg( pParent, instructions, url );
int retCode = dlg->Execute( );
uno::Reference< task::XInteractionAbort > xAbort;
uno::Reference< ucb::XInteractionAuthFallback > xAuthFallback;
diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx
index 68b09382baed..3b12c7ba011c 100644
--- a/uui/source/iahndl-errorhandler.cxx
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -55,19 +55,19 @@ executeErrorDialog(
//TODO! must be internationalized
aText.append(rMessage);
- boost::scoped_ptr< MessBox > xBox;
+ VclPtr< MessBox > xBox;
try
{
switch (eClassification)
{
case task::InteractionClassification_ERROR:
- xBox.reset(new ErrorBox(pParent,
+ xBox.reset(VclPtr<ErrorBox>::Create(pParent,
nButtonMask,
aText.makeStringAndClear()));
break;
case task::InteractionClassification_WARNING:
- xBox.reset(new WarningBox(pParent,
+ xBox.reset(VclPtr<WarningBox>::Create(pParent,
nButtonMask,
aText.makeStringAndClear()));
break;
@@ -76,16 +76,16 @@ executeErrorDialog(
# define WB_DEF_BUTTONS (WB_DEF_OK | WB_DEF_CANCEL | WB_DEF_RETRY)
//(want to ignore any default button settings)...
if ((nButtonMask & WB_DEF_BUTTONS) == WB_DEF_OK)
- xBox.reset(new InfoBox(pParent,
+ xBox.reset(VclPtr<InfoBox>::Create(pParent,
aText.makeStringAndClear()));
else
- xBox.reset(new ErrorBox(pParent,
+ xBox.reset(VclPtr<ErrorBox>::Create(pParent,
nButtonMask,
aText.makeStringAndClear()));
break;
case task::InteractionClassification_QUERY:
- xBox.reset(new QueryBox(pParent,
+ xBox.reset(VclPtr<QueryBox>::Create(pParent,
nButtonMask,
aText.makeStringAndClear()));
break;
diff --git a/uui/source/iahndl-filter.cxx b/uui/source/iahndl-filter.cxx
index 6291553f7203..710cd8ae545c 100644
--- a/uui/source/iahndl-filter.cxx
+++ b/uui/source/iahndl-filter.cxx
@@ -55,8 +55,7 @@ executeFilterDialog(
{
SolarMutexGuard aGuard;
- boost::scoped_ptr< uui::FilterDialog > xDialog(
- new uui::FilterDialog(pParent));
+ ScopedVclPtrInstance< uui::FilterDialog > xDialog(pParent);
xDialog->SetURL(rURL);
xDialog->ChangeFilters(&rFilters);
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
index e7e911bb8aef..0b7c5cfd5fea 100644
--- a/uui/source/iahndl-locking.cxx
+++ b/uui/source/iahndl-locking.cxx
@@ -93,8 +93,7 @@ handleLockedDocumentRequest_(
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
- boost::scoped_ptr< OpenLockedQueryBox > xDialog(new OpenLockedQueryBox(
- pParent, xManager.get(), aMessage ) );
+ ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, xManager.get(), aMessage);
nResult = xDialog->Execute();
}
else if ( nMode == UUI_DOC_SAVE_LOCK )
@@ -107,8 +106,7 @@ handleLockedDocumentRequest_(
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
- boost::scoped_ptr< TryLaterQueryBox > xDialog(
- new TryLaterQueryBox( pParent, xManager.get(), aMessage ) );
+ ScopedVclPtrInstance< TryLaterQueryBox > xDialog( pParent, xManager.get(), aMessage );
nResult = xDialog->Execute();
}
else if ( nMode == UUI_DOC_OWN_LOAD_LOCK ||
@@ -122,8 +120,8 @@ handleLockedDocumentRequest_(
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
- boost::scoped_ptr< AlreadyOpenQueryBox > xDialog(
- new AlreadyOpenQueryBox( pParent,
+ VclPtr< AlreadyOpenQueryBox > xDialog(
+ VclPtr<AlreadyOpenQueryBox>::Create( pParent,
xManager.get(),
aMessage,
nMode == UUI_DOC_OWN_SAVE_LOCK ) );
@@ -163,8 +161,8 @@ handleChangedByOthersRequest_(
if (!xManager.get())
return;
- boost::scoped_ptr< FileChangedQueryBox > xDialog(
- new FileChangedQueryBox( pParent, xManager.get() ) );
+ VclPtr< FileChangedQueryBox > xDialog(
+ VclPtr<FileChangedQueryBox>::Create( pParent, xManager.get() ) );
sal_Int32 nResult = xDialog->Execute();
if ( nResult == RET_YES )
@@ -198,8 +196,8 @@ handleLockFileIgnoreRequest_(
if (!xManager.get())
return;
- boost::scoped_ptr< LockFailedQueryBox > xDialog(
- new LockFailedQueryBox( pParent, xManager.get() ) );
+ VclPtr< LockFailedQueryBox > xDialog(
+ VclPtr<LockFailedQueryBox>::Create( pParent, xManager.get() ) );
sal_Int32 nResult = xDialog->Execute();
if ( nResult == RET_OK )
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
index 47969699e0de..e42ed909b5b2 100644
--- a/uui/source/iahndl-ssl.cxx
+++ b/uui/source/iahndl-ssl.cxx
@@ -145,8 +145,7 @@ executeUnknownAuthDialog(
{
SolarMutexGuard aGuard;
- boost::scoped_ptr< UnknownAuthDialog > xDialog(
- new UnknownAuthDialog(pParent, rXCert, xContext));
+ ScopedVclPtrInstance< UnknownAuthDialog > xDialog(pParent, rXCert, xContext);
// Get correct resource string
OUString aMessage;
@@ -187,8 +186,7 @@ executeSSLWarnDialog(
{
SolarMutexGuard aGuard;
- boost::scoped_ptr< SSLWarnDialog > xDialog(
- new SSLWarnDialog(pParent, rXCert, xContext));
+ ScopedVclPtrInstance< SSLWarnDialog > xDialog(pParent, rXCert, xContext);
// Get correct resource string
OUString aMessage_1;
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index f265fe6370b4..e0ea07c1b85f 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -1024,9 +1024,9 @@ executeMessageBox(
{
SolarMutexGuard aGuard;
- MessBox xBox( pParent, nButtonMask, rTitle, rMessage );
+ ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, rTitle, rMessage);
- sal_uInt16 aResult = xBox.Execute();
+ sal_uInt16 aResult = xBox->Execute();
switch( aResult )
{
case RET_OK:
@@ -1059,11 +1059,11 @@ NameClashResolveDialogResult executeSimpleNameClashResolveDialog( vcl::Window *p
if ( !xManager.get() )
return ABORT;
- NameClashDialog aDialog( pParent, xManager.get(), rTargetFolderURL,
- rClashingName, rProposedNewName, bAllowOverwrite );
+ ScopedVclPtrInstance<NameClashDialog> aDialog(pParent, xManager.get(), rTargetFolderURL,
+ rClashingName, rProposedNewName, bAllowOverwrite);
- NameClashResolveDialogResult eResult = (NameClashResolveDialogResult) aDialog.Execute();
- rProposedNewName = aDialog.getNewName();
+ NameClashResolveDialogResult eResult = (NameClashResolveDialogResult) aDialog->Execute();
+ rProposedNewName = aDialog->getNewName();
return eResult;
}
@@ -1207,20 +1207,20 @@ UUIInteractionHelper::handleMacroConfirmRequest(
if ( pResMgr.get() )
{
bool bShowSignatures = aSignInfo.getLength() > 0;
- MacroWarning aWarning(
+ ScopedVclPtrInstance<MacroWarning> aWarning(
getParentProperty(), bShowSignatures, *pResMgr.get() );
- aWarning.SetDocumentURL( aDocumentURL );
+ aWarning->SetDocumentURL( aDocumentURL );
if ( aSignInfo.getLength() > 1 )
{
- aWarning.SetStorage( xZipStorage, aDocumentVersion, aSignInfo );
+ aWarning->SetStorage( xZipStorage, aDocumentVersion, aSignInfo );
}
else if ( aSignInfo.getLength() == 1 )
{
- aWarning.SetCertificate( aSignInfo[ 0 ].Signer );
+ aWarning->SetCertificate( aSignInfo[ 0 ].Signer );
}
- bApprove = aWarning.Execute() == RET_OK;
+ bApprove = aWarning->Execute() == RET_OK;
}
if ( bApprove && xApprove.is() )
diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx
index c28e17098a51..ca44729e15f0 100644
--- a/uui/source/logindlg.cxx
+++ b/uui/source/logindlg.cxx
@@ -36,6 +36,31 @@
using namespace com::sun::star;
+LoginDialog::~LoginDialog()
+{
+ disposeOnce();
+}
+
+void LoginDialog::dispose()
+{
+ m_pErrorFT.clear();
+ m_pErrorInfo.clear();
+ m_pRequestInfo.clear();
+ m_pPathFT.clear();
+ m_pPathED.clear();
+ m_pPathBtn.clear();
+ m_pNameFT.clear();
+ m_pNameED.clear();
+ m_pPasswordFT.clear();
+ m_pPasswordED.clear();
+ m_pAccountFT.clear();
+ m_pAccountED.clear();
+ m_pSavePasswdBtn.clear();
+ m_pUseSysCredsCB.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
+
void LoginDialog::HideControls_Impl( sal_uInt16 nFlags )
{
if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH )
diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx
index 0cd7eb6e2016..cc32d5e94ae9 100644
--- a/uui/source/logindlg.hxx
+++ b/uui/source/logindlg.hxx
@@ -43,21 +43,21 @@
class LoginDialog : public ModalDialog
{
- FixedText* m_pErrorFT;
- FixedText* m_pErrorInfo;
- FixedText* m_pRequestInfo;
- FixedText* m_pPathFT;
- Edit* m_pPathED;
- PushButton* m_pPathBtn;
- FixedText* m_pNameFT;
- Edit* m_pNameED;
- FixedText* m_pPasswordFT;
- Edit* m_pPasswordED;
- FixedText* m_pAccountFT;
- Edit* m_pAccountED;
- CheckBox* m_pSavePasswdBtn;
- CheckBox* m_pUseSysCredsCB;
- OKButton* m_pOKBtn;
+ VclPtr<FixedText> m_pErrorFT;
+ VclPtr<FixedText> m_pErrorInfo;
+ VclPtr<FixedText> m_pRequestInfo;
+ VclPtr<FixedText> m_pPathFT;
+ VclPtr<Edit> m_pPathED;
+ VclPtr<PushButton> m_pPathBtn;
+ VclPtr<FixedText> m_pNameFT;
+ VclPtr<Edit> m_pNameED;
+ VclPtr<FixedText> m_pPasswordFT;
+ VclPtr<Edit> m_pPasswordED;
+ VclPtr<FixedText> m_pAccountFT;
+ VclPtr<Edit> m_pAccountED;
+ VclPtr<CheckBox> m_pSavePasswdBtn;
+ VclPtr<CheckBox> m_pUseSysCredsCB;
+ VclPtr<OKButton> m_pOKBtn;
void HideControls_Impl( sal_uInt16 nFlags );
void EnableUseSysCredsControls_Impl( bool bUseSysCredsEnabled );
@@ -69,6 +69,8 @@ class LoginDialog : public ModalDialog
public:
LoginDialog(vcl::Window* pParent, sal_uInt16 nFlags,
const OUString& rServer, const OUString &rRealm);
+ virtual ~LoginDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetPath() const { return m_pPathED->GetText(); }
void SetPath( const OUString& rNewPath ) { m_pPathED->SetText( rNewPath ); }
diff --git a/uui/source/masterpasscrtdlg.cxx b/uui/source/masterpasscrtdlg.cxx
index a7acc0189a26..85ddf2754b81 100644
--- a/uui/source/masterpasscrtdlg.cxx
+++ b/uui/source/masterpasscrtdlg.cxx
@@ -41,8 +41,8 @@ IMPL_LINK_NOARG(MasterPasswordCreateDialog, OKHdl_Impl)
else
{
OUString aErrorMsg( ResId( STR_ERROR_PASSWORDS_NOT_IDENTICAL, *pResourceMgr ));
- MessageDialog aErrorBox(this, aErrorMsg);
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(this, aErrorMsg);
+ aErrorBox->Execute();
m_pEDMasterPasswordCrt->SetText( OUString() );
m_pEDMasterPasswordRepeat->SetText( OUString() );
m_pEDMasterPasswordCrt->GrabFocus();
@@ -63,4 +63,17 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog(vcl::Window* pParent, Res
m_pEDMasterPasswordCrt->SetModifyHdl( LINK( this, MasterPasswordCreateDialog, EditHdl_Impl ) );
}
+MasterPasswordCreateDialog::~MasterPasswordCreateDialog()
+{
+ disposeOnce();
+}
+
+void MasterPasswordCreateDialog::dispose()
+{
+ m_pEDMasterPasswordCrt.clear();
+ m_pEDMasterPasswordRepeat.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/masterpasscrtdlg.hxx b/uui/source/masterpasscrtdlg.hxx
index 31e9eb60ab87..b8279fcec363 100644
--- a/uui/source/masterpasscrtdlg.hxx
+++ b/uui/source/masterpasscrtdlg.hxx
@@ -32,9 +32,9 @@
class MasterPasswordCreateDialog : public ModalDialog
{
private:
- Edit* m_pEDMasterPasswordCrt;
- Edit* m_pEDMasterPasswordRepeat;
- OKButton* m_pOKBtn;
+ VclPtr<Edit> m_pEDMasterPasswordCrt;
+ VclPtr<Edit> m_pEDMasterPasswordRepeat;
+ VclPtr<OKButton> m_pOKBtn;
DECL_LINK(OKHdl_Impl, void *);
@@ -42,6 +42,8 @@ private:
public:
MasterPasswordCreateDialog( vcl::Window* pParent, ResMgr * pResMgr );
+ virtual ~MasterPasswordCreateDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetMasterPassword() const { return m_pEDMasterPasswordCrt->GetText(); }
diff --git a/uui/source/masterpassworddlg.cxx b/uui/source/masterpassworddlg.cxx
index 3b6a071968a3..924112b088c7 100644
--- a/uui/source/masterpassworddlg.cxx
+++ b/uui/source/masterpassworddlg.cxx
@@ -49,11 +49,23 @@ MasterPasswordDialog::MasterPasswordDialog
if( nDialogMode == ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER )
{
OUString aErrorMsg( ResId( STR_ERROR_MASTERPASSWORD_WRONG, *pResourceMgr ));
- MessageDialog aErrorBox(pParent, aErrorMsg);
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(pParent, aErrorMsg);
+ aErrorBox->Execute();
}
m_pOKBtn->SetClickHdl( LINK( this, MasterPasswordDialog, OKHdl_Impl ) );
};
+MasterPasswordDialog::~MasterPasswordDialog()
+{
+ disposeOnce();
+}
+
+void MasterPasswordDialog::dispose()
+{
+ m_pEDMasterPassword.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/masterpassworddlg.hxx b/uui/source/masterpassworddlg.hxx
index 4b834d4fa5ed..1d37d0d93d78 100644
--- a/uui/source/masterpassworddlg.hxx
+++ b/uui/source/masterpassworddlg.hxx
@@ -30,13 +30,15 @@
class MasterPasswordDialog : public ModalDialog
{
- Edit* m_pEDMasterPassword;
- OKButton* m_pOKBtn;
+ VclPtr<Edit> m_pEDMasterPassword;
+ VclPtr<OKButton> m_pOKBtn;
DECL_LINK(OKHdl_Impl, void *);
public:
MasterPasswordDialog( vcl::Window* pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr );
+ virtual ~MasterPasswordDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetMasterPassword() const { return m_pEDMasterPassword->GetText(); }
diff --git a/uui/source/nameclashdlg.cxx b/uui/source/nameclashdlg.cxx
index 63ad0926dc02..06ff359bf3ca 100644
--- a/uui/source/nameclashdlg.cxx
+++ b/uui/source/nameclashdlg.cxx
@@ -34,8 +34,8 @@ IMPL_LINK( NameClashDialog, ButtonHdl_Impl, PushButton *, pBtn )
OUString aNewName = m_pEDNewName->GetText();
if ( ( aNewName == maNewName ) || aNewName.isEmpty() )
{
- MessageDialog aError(NULL, maSameName);
- aError.Execute();
+ ScopedVclPtrInstance< MessageDialog > aError(nullptr, maSameName);
+ aError->Execute();
return 1;
}
maNewName = aNewName;
@@ -94,4 +94,19 @@ NameClashDialog::NameClashDialog( vcl::Window* pParent, ResMgr* pResMgr,
m_pEDNewName->SetText( rClashingName );
}
+NameClashDialog::~NameClashDialog()
+{
+ disposeOnce();
+}
+
+void NameClashDialog::dispose()
+{
+ m_pFTMessage.clear();
+ m_pEDNewName.clear();
+ m_pBtnOverwrite.clear();
+ m_pBtnRename.clear();
+ m_pBtnCancel.clear();
+ ModalDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/nameclashdlg.hxx b/uui/source/nameclashdlg.hxx
index 6185e996305c..545f581dd077 100644
--- a/uui/source/nameclashdlg.hxx
+++ b/uui/source/nameclashdlg.hxx
@@ -31,11 +31,11 @@ enum NameClashResolveDialogResult { ABORT, RENAME, OVERWRITE };
class NameClashDialog : public ModalDialog
{
- FixedText *m_pFTMessage;
- Edit *m_pEDNewName;
- PushButton *m_pBtnOverwrite;
- PushButton *m_pBtnRename;
- CancelButton *m_pBtnCancel;
+ VclPtr<FixedText> m_pFTMessage;
+ VclPtr<Edit> m_pEDNewName;
+ VclPtr<PushButton> m_pBtnOverwrite;
+ VclPtr<PushButton> m_pBtnRename;
+ VclPtr<CancelButton> m_pBtnCancel;
OUString maSameName;
OUString maNewName;
@@ -48,6 +48,8 @@ public:
OUString const & rClashingName,
OUString const & rProposedNewName,
bool bAllowOverwrite );
+ virtual ~NameClashDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString getNewName() const { return maNewName; }
};
diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx
index 2e5ed497b599..2563ea745de7 100644
--- a/uui/source/passworddlg.cxx
+++ b/uui/source/passworddlg.cxx
@@ -44,8 +44,8 @@ PasswordDialog::PasswordDialog(vcl::Window* _pParent,
const sal_uInt16 nOpenToModifyErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG;
const sal_uInt16 nErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG : nOpenToModifyErrStrId;
OUString aErrorMsg(ResId(nErrStrId, *pResourceMgr).toString());
- MessageDialog aErrorBox(GetParent(), aErrorMsg);
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(GetParent(), aErrorMsg);
+ aErrorBox->Execute();
}
// default settings for enter password or reenter passwd...
@@ -82,6 +82,21 @@ PasswordDialog::PasswordDialog(vcl::Window* _pParent,
m_pOKBtn->SetClickHdl( LINK( this, PasswordDialog, OKHdl_Impl ) );
}
+PasswordDialog::~PasswordDialog()
+{
+ disposeOnce();
+}
+
+void PasswordDialog::dispose()
+{
+ m_pFTPassword.clear();
+ m_pEDPassword.clear();
+ m_pFTConfirmPassword.clear();
+ m_pEDConfirmPassword.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
+
IMPL_LINK_NOARG(PasswordDialog, OKHdl_Impl)
{
bool bEDPasswdValid = m_pEDPassword->GetText().getLength() >= nMinLen;
@@ -91,8 +106,8 @@ IMPL_LINK_NOARG(PasswordDialog, OKHdl_Impl)
if (m_pEDConfirmPassword->IsVisible() && bPasswdMismatch)
{
- MessageDialog aErrorBox(this, aPasswdMismatch);
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(this, aPasswdMismatch);
+ aErrorBox->Execute();
}
else if (bValid)
EndDialog( RET_OK );
diff --git a/uui/source/passworddlg.hxx b/uui/source/passworddlg.hxx
index 3cec5ca190d3..712bcfae0ee3 100644
--- a/uui/source/passworddlg.hxx
+++ b/uui/source/passworddlg.hxx
@@ -32,11 +32,11 @@
class PasswordDialog : public ModalDialog
{
- FixedText* m_pFTPassword;
- Edit* m_pEDPassword;
- FixedText* m_pFTConfirmPassword;
- Edit* m_pEDConfirmPassword;
- OKButton* m_pOKBtn;
+ VclPtr<FixedText> m_pFTPassword;
+ VclPtr<Edit> m_pEDPassword;
+ VclPtr<FixedText> m_pFTConfirmPassword;
+ VclPtr<Edit> m_pEDConfirmPassword;
+ VclPtr<OKButton> m_pOKBtn;
sal_uInt16 nMinLen;
OUString aPasswdMismatch;
@@ -46,6 +46,8 @@ class PasswordDialog : public ModalDialog
public:
PasswordDialog( vcl::Window* pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr, const OUString& aDocURL,
bool bOpenToModify = false, bool bIsSimplePasswordRequest = false );
+ virtual ~PasswordDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetMinLen( sal_uInt16 nMin ) { nMinLen = nMin; }
OUString GetPassword() const { return m_pEDPassword->GetText(); }
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 935ecf66ecf4..cb32f762299b 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -89,6 +89,21 @@ MacroWarning::MacroWarning( vcl::Window* _pParent, bool _bWithSignatures, ResMgr
MacroWarning::~MacroWarning()
{
+ disposeOnce();
+}
+
+void MacroWarning::dispose()
+{
+ mpSymbolImg.clear();
+ mpDocNameFI.clear();
+ mpDescr1FI.clear();
+ mpSignsFI.clear();
+ mpViewSignsBtn.clear();
+ mpDescr2FI.clear();
+ mpAlwaysTrustCB.clear();
+ mpEnableBtn.clear();
+ mpDisableBtn.clear();
+ ModalDialog::dispose();
}
void MacroWarning::SetDocumentURL( const OUString& rDocURL )
diff --git a/uui/source/secmacrowarnings.hxx b/uui/source/secmacrowarnings.hxx
index 84daaad9ee3a..076916fc10cc 100644
--- a/uui/source/secmacrowarnings.hxx
+++ b/uui/source/secmacrowarnings.hxx
@@ -44,15 +44,15 @@ private:
OUString maODFVersion;
const css::uno::Sequence< css::security::DocumentSignatureInformation >* mpInfos;
- FixedImage* mpSymbolImg;
- FixedText* mpDocNameFI;
- FixedText* mpDescr1FI;
- FixedText* mpSignsFI;
- PushButton* mpViewSignsBtn;
- FixedText* mpDescr2FI;
- CheckBox* mpAlwaysTrustCB;
- PushButton* mpEnableBtn;
- PushButton* mpDisableBtn;
+ VclPtr<FixedImage> mpSymbolImg;
+ VclPtr<FixedText> mpDocNameFI;
+ VclPtr<FixedText> mpDescr1FI;
+ VclPtr<FixedText> mpSignsFI;
+ VclPtr<PushButton> mpViewSignsBtn;
+ VclPtr<FixedText> mpDescr2FI;
+ VclPtr<CheckBox> mpAlwaysTrustCB;
+ VclPtr<PushButton> mpEnableBtn;
+ VclPtr<PushButton> mpDisableBtn;
const bool mbSignedMode; // modus of dialog (signed / unsigned macros)
const bool mbShowSignatures;
@@ -68,6 +68,7 @@ private:
public:
MacroWarning( vcl::Window* pParent, bool _bShowSignatures, ResMgr& rResMgr );
virtual ~MacroWarning();
+ virtual void dispose() SAL_OVERRIDE;
void SetDocumentURL( const OUString& rDocURL );
diff --git a/uui/source/unknownauthdlg.cxx b/uui/source/unknownauthdlg.cxx
index 34f706fec139..731882ccc45b 100644
--- a/uui/source/unknownauthdlg.cxx
+++ b/uui/source/unknownauthdlg.cxx
@@ -75,4 +75,18 @@ UnknownAuthDialog::UnknownAuthDialog(vcl::Window* pParent,
m_pCommandButtonOK->SetClickHdl(LINK(this, UnknownAuthDialog, OKHdl_Impl));
}
+UnknownAuthDialog::~UnknownAuthDialog()
+{
+ disposeOnce();
+}
+
+void UnknownAuthDialog::dispose()
+{
+ m_pCommandButtonOK.clear();
+ m_pView_Certificate.clear();
+ m_pOptionButtonAccept.clear();
+ m_pOptionButtonDontAccept.clear();
+ MessageDialog::dispose();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/unknownauthdlg.hxx b/uui/source/unknownauthdlg.hxx
index 0b8d1e64ab2b..2eafe5e3b5f0 100644
--- a/uui/source/unknownauthdlg.hxx
+++ b/uui/source/unknownauthdlg.hxx
@@ -31,10 +31,10 @@
class UnknownAuthDialog : public MessageDialog
{
private:
- PushButton* m_pCommandButtonOK;
- PushButton* m_pView_Certificate;
- RadioButton* m_pOptionButtonAccept;
- RadioButton* m_pOptionButtonDontAccept;
+ VclPtr<PushButton> m_pCommandButtonOK;
+ VclPtr<PushButton> m_pView_Certificate;
+ VclPtr<RadioButton> m_pOptionButtonAccept;
+ VclPtr<RadioButton> m_pOptionButtonDontAccept;
const css::uno::Reference< css::uno::XComponentContext >& m_xContext;
const css::uno::Reference< css::security::XCertificate >& m_rXCert;
@@ -46,6 +46,8 @@ public:
UnknownAuthDialog(vcl::Window* pParent,
const css::uno::Reference< css::security::XCertificate >& rXCert,
const css::uno::Reference< css::uno::XComponentContext >& xContext);
+ virtual ~UnknownAuthDialog();
+ virtual void dispose() SAL_OVERRIDE;
css::uno::Reference< css::security::XCertificate > getCert()
{
diff --git a/vcl/CppunitTest_vcl_lifecycle.mk b/vcl/CppunitTest_vcl_lifecycle.mk
new file mode 100644
index 000000000000..54d4affc1ce0
--- /dev/null
+++ b/vcl/CppunitTest_vcl_lifecycle.mk
@@ -0,0 +1,52 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,vcl_lifecycle))
+
+$(eval $(call gb_CppunitTest_set_include,vcl_lifecycle,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,vcl_lifecycle, \
+ vcl/qa/cppunit/lifecycle \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,vcl_lifecycle,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_libraries,vcl_lifecycle, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ svt \
+ test \
+ tl \
+ unotest \
+ vcl \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,vcl_lifecycle,\
+ udkapi \
+ offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,vcl_lifecycle))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_lifecycle))
+
+$(eval $(call gb_CppunitTest_use_components,vcl_lifecycle,\
+ configmgr/source/configmgr \
+ i18npool/util/i18npool \
+ ucb/source/core/ucb1 \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,vcl_lifecycle))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index f5be45ec10c8..8cb05ba73bd8 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -103,6 +103,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
CppunitTest_vcl_fontcharmap \
CppunitTest_vcl_complextext \
CppunitTest_vcl_filters_test \
+ CppunitTest_vcl_lifecycle \
CppunitTest_vcl_outdev \
CppunitTest_vcl_app_test \
CppunitTest_vcl_wmf_test \
diff --git a/vcl/README.lifecycle b/vcl/README.lifecycle
new file mode 100644
index 000000000000..c4ca67a19944
--- /dev/null
+++ b/vcl/README.lifecycle
@@ -0,0 +1,261 @@
+** Understanding transitional VCL lifecycle **
+
+---------- How it used to look ----------
+
+ All VCL classes were explicitly lifecycle managed; so you would
+do:
+ Dialog aDialog(...); // old - on stack allocation
+ aDialog.Execute(...);
+or:
+ Dialog *pDialog = new Dialog(...); // old - manual heap allocation
+ pDialog->Execute(...);
+ delete pDialog;
+or:
+ boost::shared_ptr<Dialog> xDialog(new pDialog()); // old
+ xDialog->Execute(...);
+ // depending who shared the ptr this would be freed sometime
+
+ In several cases this lead to rather unpleasant code, when
+various shared_ptr wrappers were used, the lifecycle was far less than
+obvious. Where controls were wrapped by other ref-counted classes -
+such as UNO interfaces, which were also used by native Window
+pointers, the lifecycle became extremely opaque. In addition VCL had
+significant issues with re-enterancy and event emission - adding
+various means such as DogTags to try to detect destruction of a window
+between calls:
+
+ ImplDelData aDogTag( this ); // 'orrible old code
+ Show( true, SHOW_NOACTIVATE );
+ if( !aDogTag.IsDead() ) // did 'this' go invalid yet ?
+ Update();
+
+ Unfortunately use of such protection is/was ad-hoc, and far
+from uniform, despite the prevelance of such potential problems.
+
+ When a lifecycle problem was hit, typically it would take the
+form of accessing memory that had been freed, and contained garbage due
+to lingering pointers to freed objects.
+
+
+---------- Where we are now: ----------
+
+ To fix this situation we now have a VclPtr - which is a smart
+ reference-counting pointer (include/vcl/vclptr.hxx) which is
+ designed to look and behave -very- much like a normal pointer
+ to reduce code-thrash. VclPtr is used to wrap all OutputDevice
+ derived classes thus:
+
+ VclPtr<Dialog> pDialog( new Dialog( ... ), SAL_NO_ACQUIRE );
+ ...
+ pDialog.disposeAndClear();
+
+ However - while the VclPtr reference count controls the
+ lifecycle of the Dialog object, it is necessary to be able to
+ break reference count cycles. These are extremely common in
+ widget hierarchies as each widget holds (smart) pointers to
+ its parents and also its children.
+
+ Thus - all previous 'delete' calls are replaced with 'dispose'
+ method calls:
+
+** What is dispose ?
+
+ Dispose is defined to be a method that releases all references
+ that an object holds - thus allowing their underlying
+ resources to be released. However - in this specific case it
+ also releases all backing graphical resources. In practical
+ terms, all destructor functionality has been moved into
+ 'dispose' methods, in order to provide a minimal initial
+ behavioral change.
+
+ As such a VclPtr can have three states:
+
+ VclPtr<PushButton> pButton;
+ ...
+ assert (pButton == nullptr || !pButton); // null
+ assert (pButton && !pButton->IsDisposed()); // alive
+ assert (pButton && pButton->IsDisposed()); // disposed
+
+** ScopedVclPtr - making disposes easier
+
+ While replacing existing code with new, it can be a bit
+ tiresome to have to manually add 'disposeAndClear()'
+ calls to VclPtr<> instances.
+
+ Luckily it is easy to avoid that with a ScopedVclPtr which
+ does this for you when it goes out of scope.
+
+** One extra gotcha - an initial reference-count of 1
+
+ In the normal world of love and sanity, eg. creating UNO
+ objects, the objects start with a ref-count of zero. Thus
+ the first reference is always taken after construction by
+ the surrounding smart pointer.
+
+ Unfortunately, the existing VCL code is somewhat tortured,
+ and does a lot of reference and de-reference action on the
+ class -during- construction. This forces us to construct with
+ a reference of 1 - and to hand that into the initial smart
+ pointer with a SAL_NO_ACQUIRE.
+
+ To make this easier, we have 'Instance' template wrappers
+ that make this apparently easier, by constructing the
+ pointer for you.
+
+** How does my familiar code change ?
+
+ Lets tweak the exemplary code above to fit the new model:
+
+- Dialog aDialog(... dialog params ... );
+- aDialog.Execute(...);
++ ScopedVclPtrInstance<Dialog> pDialog(... dialog params ... );
++ pDialog->Execute(...); // VclPtr behaves much like a pointer
+
+or:
+- Dialog *pDialog = new Dialog(... dialog params ...);
++ VclPtrInstance<Dialog> pDialog(... dialog params ...);
+ pDialog->Execute(...);
+- delete pDialog;
++ pDialog.disposeAndClear(); // done manually - replaces a delete
+or:
+- boost::shared_ptr<Dialog> xDialog(new Dialog(...));
++ ScopedVclPtrInstance<Dialog> xDialog(...);
+ xDialog->Execute(...);
++ // depending how shared_ptr was shared perhaps
++ // someone else gets a VclPtr to xDialog
+or:
+- VirtualDevice aDev;
++ ScopedVclPtrInstance<VirtualDevice> pDev;
+
+ Other things that are changed are these:
+
+- pButton = new PushButton(NULL);
++ pButton = VclPtr<PushButton>::Create(nullptr);
+...
+- vcl::Window *pWindow = new PushButton(NULL);
++ VclPtr<vcl::Window> pWindow;
++ pWindow.reset(VclPtr<PushButton>::Create(nullptr));
+
+** Why are these 'disposeOnce' calls in destructors ?
+
+ This is an interim measure while we are migrating, such that
+ it is possible to delete an object conventionally and ensure
+ that its dispose method gets called. In the 'end' we would
+ instead assert that a Window has been disposed in it's
+ destructor, and elide these calls.
+
+ As the object's vtable is altered as we go down the
+ destruction process, and we want to call the correct dispose
+ methods we need this disposeOnce(); call for the interim in
+ every destructor. This is enforced by a clang plugin.
+
+ The plus side of disposeOnce is that the mechanics behind it
+ ensure that a dispose() method is only called a single time,
+ simplifying their implementation.
+
+
+---------- Who owns & disposes what ? ----------
+
+** referencing / ownership inheritance / hierarchy.
+
+** VclBuilder
+ + and it's magic dispose method.
+
+
+---------- What remains to be done ? ----------
+
+ * Cleanup DogTags and LazyDelete.
+
+ * Expand the VclPtr pattern to many other less
+ than safe VCL types.
+
+ * create factory functions for VclPtr<> types and privatize
+ their constructors.
+
+ * Pass 'const VclPtr<> &' instead of pointers everywhere
+ + add 'explicit' keywords to VclPtr constructors to
+ accelerate compilation etc.
+
+ * Cleanup common existing methods such that they continue to
+ work post-dispose.
+
+ * Dispose functions should be audited to:
+ + not leave dangling pointsr
+ + shrink them - some work should incrementally
+ migrate back to destructors.
+
+ * VclBuilder
+ + ideally should keep a reference to pointers assigned
+ in 'get()' calls - to avoid needing explicit 'clear'
+ code in destructors.
+
+ * VclBuilder 'makeFoo' methods
+ + these should return VclPtr<> types and have their
+ signatures adjusted en-masse.
+ + currently we use a VclPtr<> constructor with
+ SAL_NO_ACQUIRE inside the builder.
+
+---------- FAQ / debugging hints ----------
+
+** Compile with dbgutil
+
+ This is by far the best way to turn on debugging and
+ assertions that help you find problems. In particular
+ there are a few that are really helpful:
+
+ vcl/source/window/window.cxx (Window::dispose)
+ "Window ( N4sfx27sidebar20SidebarDockingWindowE (Properties))
+ ^^^ class name window title ^^^
+ with live children destroyed: N4sfx27sidebar6TabBarE ()
+ N4sfx27sidebar4DeckE () 10FixedImage ()"
+
+ You can de-mangle these names if you can't read them thus:
+
+ $ c++filt -t N4sfx27sidebar20SidebarDockingWindowE
+ sfx2::sidebar::SidebarDockingWindow
+
+ In the above case - it is clear that the children have not been
+ disposed before their parents. As an aside, having a dispose chain
+ separate from destructors allows us to emit real type names for
+ parents here.
+
+ To fix this, we will need to get the dispose ordering right,
+ occasionally in the conversion we re-ordered destruction, or
+ omitted a disposeAndClear() in a ::dispose() method.
+
+ => If you see this, check the order of disposeAndClear() in
+ the sfx2::Sidebar::SidebarDockingWindow::dispose() method
+
+ => also worth git grepping for 'new sfx::sidebar::TabBar' to
+ see where those children were added.
+
+** Check what it used to do
+
+ While a ton of effort has been put into ensuring that the new
+ lifecycle code is the functional equivalent of the old code,
+ the code was created by humans. If you identify an area where
+ something asserts or crashes here are a few helpful heuristics:
+
+ * Read the git log -u -- path/to/file.cxx
+
+ => Is the order of destruction different ?
+
+ in the past many things were destructed (in reverse order of
+ declaration in the class) without explicit code. Some of these
+ may be important to do explicitly at the end of the destructor.
+
+ eg. having a 'Idle' or 'Timer' as a member, may now need an
+ explicit .Stop() and/or protection from running on a
+ disposed Window in its callback.
+
+ => Is it 'clear' not 'disposeAndClear' ?
+
+ sometimes we get this wrong. If the code previously used to
+ use 'delete pFoo;' it should now read pFoo->disposeAndClear();
+ Conversely if it didn't delete it, it should be 'clear()' it
+ is by far the best to leave disposing to the VclBuilder where
+ possible.
+
+ In simple cases, if we allocate the widget with VclPtrInstance
+ or VclPtr<Foo>::Create - then we need to disposeAndClear it too.
+
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 71f35eb2d3e0..05dfc4003351 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -91,16 +91,24 @@ namespace
class QueryString : public ModalDialog
{
private:
- OKButton* m_pOKButton;
- FixedText* m_pFixedText;
- Edit* m_pEdit;
- OUString& m_rReturnValue;
+ VclPtr<OKButton> m_pOKButton;
+ VclPtr<FixedText> m_pFixedText;
+ VclPtr<Edit> m_pEdit;
+ OUString& m_rReturnValue;
DECL_LINK( ClickBtnHdl, Button* );
public:
// parent window, Query text, initial value
QueryString(vcl::Window*, OUString &, OUString &);
+ virtual ~QueryString() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ m_pOKButton.clear();
+ m_pFixedText.clear();
+ m_pEdit.clear();
+ ModalDialog::dispose();
+ }
};
/*
@@ -136,8 +144,8 @@ namespace
int QueryFaxNumber(OUString& rNumber)
{
OUString aTmpString(VclResId(SV_PRINT_QUERYFAXNUMBER_TXT));
- QueryString aQuery(NULL, aTmpString, rNumber);
- return aQuery.Execute();
+ ScopedVclPtrInstance< QueryString > aQuery( nullptr, aTmpString, rNumber );
+ return aQuery->Execute();
}
}
@@ -1071,7 +1079,7 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo
std::shared_ptr<vcl::PDFWriter> xWriter;
std::vector< PDFPrintFile > aPDFFiles;
- std::shared_ptr<Printer> xPrinter(i_rController.getPrinter());
+ VclPtr<Printer> xPrinter( i_rController.getPrinter() );
int nAllPages = i_rController.getFilteredPageCount();
i_rController.createProgressDialog();
bool bAborted = false;
diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx
index cbe60c35f3f5..738d00de721a 100644
--- a/vcl/generic/print/prtsetup.cxx
+++ b/vcl/generic/print/prtsetup.cxx
@@ -93,8 +93,17 @@ RTSDialog::RTSDialog(const PrinterInfo& rJobData, vcl::Window* pParent)
RTSDialog::~RTSDialog()
{
- delete m_pPaperPage;
- delete m_pDevicePage;
+ disposeOnce();
+}
+
+void RTSDialog::dispose()
+{
+ m_pTabControl.clear();
+ m_pOKButton.clear();
+ m_pCancelButton.clear();
+ m_pPaperPage.disposeAndClear();
+ m_pDevicePage.disposeAndClear();
+ TabDialog::dispose();
}
IMPL_LINK( RTSDialog, ActivatePage, TabControl*, pTabCtrl )
@@ -108,9 +117,9 @@ IMPL_LINK( RTSDialog, ActivatePage, TabControl*, pTabCtrl )
{
TabPage *pPage = NULL;
if (sPage == "paper")
- pPage = m_pPaperPage = new RTSPaperPage( this );
+ pPage = m_pPaperPage = VclPtr<RTSPaperPage>::Create( this );
else if (sPage == "device")
- pPage = m_pDevicePage = new RTSDevicePage( this );
+ pPage = m_pDevicePage = VclPtr<RTSDevicePage>::Create( this );
if( pPage )
m_pTabControl->SetTabPage( nId, pPage );
}
@@ -187,6 +196,20 @@ RTSPaperPage::RTSPaperPage(RTSDialog* pParent)
RTSPaperPage::~RTSPaperPage()
{
+ disposeOnce();
+}
+
+void RTSPaperPage::dispose()
+{
+ m_pParent.clear();
+ m_pPaperText.clear();
+ m_pPaperBox.clear();
+ m_pOrientBox.clear();
+ m_pDuplexText.clear();
+ m_pDuplexBox.clear();
+ m_pSlotText.clear();
+ m_pSlotBox.clear();
+ TabPage::dispose();
}
void RTSPaperPage::update()
@@ -355,6 +378,19 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
RTSDevicePage::~RTSDevicePage()
{
+ disposeOnce();
+}
+
+void RTSDevicePage::dispose()
+{
+ m_pParent.clear();
+ m_pPPDKeyBox.clear();
+ m_pPPDValueBox.clear();
+ m_pCustomEdit.clear();
+ m_pLevelBox.clear();
+ m_pSpaceBox.clear();
+ m_pDepthBox.clear();
+ TabPage::dispose();
}
sal_uLong RTSDevicePage::getDepth()
@@ -466,11 +502,11 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey )
int SetupPrinterDriver(::psp::PrinterInfo& rJobData)
{
int nRet = 0;
- RTSDialog aDialog( rJobData, NULL );
+ ScopedVclPtrInstance< RTSDialog > aDialog( rJobData, nullptr );
- if( aDialog.Execute() )
+ if( aDialog->Execute() )
{
- rJobData = aDialog.getSetup();
+ rJobData = aDialog->getSetup();
nRet = 1;
}
diff --git a/vcl/generic/print/prtsetup.hxx b/vcl/generic/print/prtsetup.hxx
index 6d641bedadf9..67b6cd2216b8 100644
--- a/vcl/generic/print/prtsetup.hxx
+++ b/vcl/generic/print/prtsetup.hxx
@@ -45,13 +45,13 @@ class RTSDialog : public TabDialog
::psp::PrinterInfo m_aJobData;
// controls
- TabControl* m_pTabControl;
- OKButton* m_pOKButton;
- CancelButton* m_pCancelButton;
+ VclPtr<TabControl> m_pTabControl;
+ VclPtr<OKButton> m_pOKButton;
+ VclPtr<CancelButton> m_pCancelButton;
// pages
- RTSPaperPage* m_pPaperPage;
- RTSDevicePage* m_pDevicePage;
+ VclPtr<RTSPaperPage> m_pPaperPage;
+ VclPtr<RTSDevicePage> m_pDevicePage;
// some resources
OUString m_aInvalidString;
@@ -64,29 +64,31 @@ class RTSDialog : public TabDialog
public:
RTSDialog(const ::psp::PrinterInfo& rJobData, vcl::Window* pParent = NULL);
virtual ~RTSDialog();
+ virtual void dispose() SAL_OVERRIDE;
const ::psp::PrinterInfo& getSetup() const { return m_aJobData; }
};
class RTSPaperPage : public TabPage
{
- RTSDialog* m_pParent;
+ VclPtr<RTSDialog> m_pParent;
- FixedText* m_pPaperText;
- ListBox* m_pPaperBox;
+ VclPtr<FixedText> m_pPaperText;
+ VclPtr<ListBox> m_pPaperBox;
- ListBox* m_pOrientBox;
+ VclPtr<ListBox> m_pOrientBox;
- FixedText* m_pDuplexText;
- ListBox* m_pDuplexBox;
+ VclPtr<FixedText> m_pDuplexText;
+ VclPtr<ListBox> m_pDuplexBox;
- FixedText* m_pSlotText;
- ListBox* m_pSlotBox;
+ VclPtr<FixedText> m_pSlotText;
+ VclPtr<ListBox> m_pSlotBox;
DECL_LINK( SelectHdl, ListBox* );
public:
RTSPaperPage( RTSDialog* );
virtual ~RTSPaperPage();
+ virtual void dispose() SAL_OVERRIDE;
void update();
@@ -95,16 +97,16 @@ public:
class RTSDevicePage : public TabPage
{
- RTSDialog* m_pParent;
+ VclPtr<RTSDialog> m_pParent;
- ListBox* m_pPPDKeyBox;
- ListBox* m_pPPDValueBox;
+ VclPtr<ListBox> m_pPPDKeyBox;
+ VclPtr<ListBox> m_pPPDValueBox;
const psp::PPDValue* m_pCustomValue;
- Edit* m_pCustomEdit;
+ VclPtr<Edit> m_pCustomEdit;
- ListBox* m_pLevelBox;
- ListBox* m_pSpaceBox;
- ListBox* m_pDepthBox;
+ VclPtr<ListBox> m_pLevelBox;
+ VclPtr<ListBox> m_pSpaceBox;
+ VclPtr<ListBox> m_pDepthBox;
void FillValueBox( const ::psp::PPDKey* );
@@ -113,6 +115,7 @@ class RTSDevicePage : public TabPage
public:
RTSDevicePage( RTSDialog* );
virtual ~RTSDevicePage();
+ virtual void dispose() SAL_OVERRIDE;
sal_uLong getLevel();
sal_uLong getPDFDevice();
diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx
index d47f07103e00..77a690c75dc0 100644
--- a/vcl/inc/brdwin.hxx
+++ b/vcl/inc/brdwin.hxx
@@ -83,14 +83,14 @@ class ImplBorderWindow : public vcl::Window
private:
ImplBorderWindowView* mpBorderView;
- vcl::Window* mpMenuBarWindow;
+ VclPtr<vcl::Window> mpMenuBarWindow;
long mnMinWidth;
long mnMinHeight;
long mnMaxWidth;
long mnMaxHeight;
long mnRollHeight;
long mnOrgMenuHeight;
- sal_uInt16 mnTitleType;
+ sal_uInt16 mnTitleType;
WindowBorderStyle mnBorderStyle;
bool mbFloatWindow;
bool mbSmallOutBorder;
@@ -121,7 +121,8 @@ public:
sal_uInt16 nTypeStyle = 0 );
ImplBorderWindow( vcl::Window* pParent, WinBits nStyle = 0,
sal_uInt16 nTypeStyle = 0 );
- virtual ~ImplBorderWindow();
+ virtual ~ImplBorderWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -173,8 +174,8 @@ public:
struct ImplBorderFrameData
{
- ImplBorderWindow* mpBorderWindow;
- OutputDevice* mpOutDev;
+ VclPtr<ImplBorderWindow> mpBorderWindow;
+ VclPtr<OutputDevice> mpOutDev;
Rectangle maTitleRect;
Rectangle maPinRect;
Rectangle maCloseRect;
@@ -252,8 +253,8 @@ public:
class ImplSmallBorderWindowView : public ImplBorderWindowView
{
- ImplBorderWindow* mpBorderWindow;
- OutputDevice* mpOutDev;
+ VclPtr<ImplBorderWindow> mpBorderWindow;
+ VclPtr<OutputDevice> mpOutDev;
long mnWidth;
long mnHeight;
sal_Int32 mnLeftBorder;
@@ -275,8 +276,8 @@ public:
class ImplStdBorderWindowView : public ImplBorderWindowView
{
ImplBorderFrameData maFrameData;
- VirtualDevice* mpATitleVirDev;
- VirtualDevice* mpDTitleVirDev;
+ VclPtr<VirtualDevice> mpATitleVirDev;
+ VclPtr<VirtualDevice> mpDTitleVirDev;
public:
ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow );
diff --git a/vcl/inc/controldata.hxx b/vcl/inc/controldata.hxx
index 20720911d038..0ef77c809541 100644
--- a/vcl/inc/controldata.hxx
+++ b/vcl/inc/controldata.hxx
@@ -30,7 +30,7 @@ namespace vcl
struct ImplControlData
{
mutable ControlLayoutData* mpLayoutData;
- OutputDevice* mpReferenceDevice;
+ VclPtr<OutputDevice> mpReferenceDevice;
ImplControlData()
:mpLayoutData( NULL )
diff --git a/vcl/inc/dndevdis.hxx b/vcl/inc/dndevdis.hxx
index 978910a46f01..b542581efee1 100644
--- a/vcl/inc/dndevdis.hxx
+++ b/vcl/inc/dndevdis.hxx
@@ -32,9 +32,9 @@ class DNDEventDispatcher: public ::cppu::WeakImplHelper3<
::com::sun::star::datatransfer::dnd::XDropTargetDragContext,
::com::sun::star::datatransfer::dnd::XDragGestureListener >
{
- vcl::Window * m_pTopWindow;
+ VclPtr<vcl::Window> m_pTopWindow;
- vcl::Window * m_pCurrentWindow;
+ VclPtr<vcl::Window> m_pCurrentWindow;
void designate_currentwindow(vcl::Window *pWindow);
DECL_LINK(WindowEventListener, VclSimpleEvent*);
diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx
index b6beda35a6d3..c092d292d4ea 100644
--- a/vcl/inc/helpwin.hxx
+++ b/vcl/inc/helpwin.hxx
@@ -38,8 +38,8 @@ private:
Timer maShowTimer;
Timer maHideTimer;
- sal_uInt16 mnHelpWinStyle;
- sal_uInt16 mnStyle;
+ sal_uInt16 mnHelpWinStyle;
+ sal_uInt16 mnStyle;
protected:
DECL_LINK( TimerHdl, Timer* );
@@ -50,7 +50,8 @@ protected:
public:
HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle );
- virtual ~HelpTextWindow();
+ virtual ~HelpTextWindow();
+ virtual void dispose() SAL_OVERRIDE;
const OUString& GetHelpText() const { return maHelpText; }
void SetHelpText( const OUString& rHelpText );
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 0efc7e12988b..dfab1ad7185b 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -87,7 +87,7 @@ struct ImplEntryType
class ImplEntryList
{
private:
- vcl::Window* mpWindow; ///< For getting the current locale when matching strings
+ VclPtr<vcl::Window> mpWindow; ///< For getting the current locale when matching strings
sal_Int32 mnLastSelected;
sal_Int32 mnSelectionAnchor;
sal_Int32 mnImages;
@@ -266,7 +266,8 @@ public:
virtual void FillLayoutData() const SAL_OVERRIDE;
ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle );
- virtual ~ImplListBoxWindow();
+ virtual ~ImplListBoxWindow();
+ virtual void dispose() SAL_OVERRIDE;
ImplEntryList* GetEntryList() const { return mpEntryList; }
@@ -380,10 +381,10 @@ protected:
class ImplListBox : public Control
{
private:
- ImplListBoxWindow maLBWindow;
- ScrollBar* mpHScrollBar;
- ScrollBar* mpVScrollBar;
- ScrollBarBox* mpScrollBarBox;
+ VclPtr<ImplListBoxWindow> maLBWindow;
+ VclPtr<ScrollBar> mpHScrollBar;
+ VclPtr<ScrollBar> mpVScrollBar;
+ VclPtr<ScrollBarBox> mpScrollBarBox;
/// bitfield
bool mbVScroll : 1; // VScroll an oder aus
@@ -412,9 +413,10 @@ protected:
public:
ImplListBox( vcl::Window* pParent, WinBits nWinStyle );
virtual ~ImplListBox();
+ virtual void dispose() SAL_OVERRIDE;
- const ImplEntryList* GetEntryList() const { return maLBWindow.GetEntryList(); }
- ImplListBoxWindow& GetMainWindow() { return maLBWindow; }
+ const ImplEntryList* GetEntryList() const { return maLBWindow->GetEntryList(); }
+ ImplListBoxWindow* GetMainWindow() { return maLBWindow.get(); }
virtual void Resize() SAL_OVERRIDE;
virtual const Wallpaper& GetDisplayBackground() const SAL_OVERRIDE;
@@ -423,91 +425,91 @@ public:
sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr );
sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage );
void RemoveEntry( sal_Int32 nPos );
- void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow.GetEntryList()->SetEntryData( nPos, pNewData ); }
+ void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow->GetEntryList()->SetEntryData( nPos, pNewData ); }
void Clear();
void SetEntryFlags( sal_Int32 nPos, long nFlags );
void SelectEntry( sal_Int32 nPos, bool bSelect );
void SetNoSelection();
- void ResetCurrentPos() { maLBWindow.ResetCurrentPos(); }
- sal_Int32 GetCurrentPos() const { return maLBWindow.GetCurrentPos(); }
+ void ResetCurrentPos() { maLBWindow->ResetCurrentPos(); }
+ sal_Int32 GetCurrentPos() const { return maLBWindow->GetCurrentPos(); }
- bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow.ProcessKeyInput( rKEvt ); }
+ bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow->ProcessKeyInput( rKEvt ); }
bool HandleWheelAsCursorTravel( const CommandEvent& rCEvt );
- void SetSeparatorPos( sal_Int32 n ) { maLBWindow.SetSeparatorPos( n ); }
- sal_Int32 GetSeparatorPos() const { return maLBWindow.GetSeparatorPos(); }
+ void SetSeparatorPos( sal_Int32 n ) { maLBWindow->SetSeparatorPos( n ); }
+ sal_Int32 GetSeparatorPos() const { return maLBWindow->GetSeparatorPos(); }
- void SetTopEntry( sal_Int32 nTop ) { maLBWindow.SetTopEntry( nTop ); }
- sal_Int32 GetTopEntry() const { return maLBWindow.GetTopEntry(); }
- void ShowProminentEntry( sal_Int32 nPos ) { maLBWindow.ShowProminentEntry( nPos ); }
+ void SetTopEntry( sal_Int32 nTop ) { maLBWindow->SetTopEntry( nTop ); }
+ sal_Int32 GetTopEntry() const { return maLBWindow->GetTopEntry(); }
+ void ShowProminentEntry( sal_Int32 nPos ) { maLBWindow->ShowProminentEntry( nPos ); }
using Window::IsVisible;
- bool IsVisible( sal_Int32 nEntry ) const { return maLBWindow.IsVisible( nEntry ); }
+ bool IsVisible( sal_Int32 nEntry ) const { return maLBWindow->IsVisible( nEntry ); }
- void SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); }
- ProminentEntry GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); }
+ void SetProminentEntryType( ProminentEntry eType ) { maLBWindow->SetProminentEntryType( eType ); }
+ ProminentEntry GetProminentEntryType() const { return maLBWindow->GetProminentEntryType(); }
- long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); }
- void SetLeftIndent( sal_uInt16 n ) { maLBWindow.SetLeftIndent( n ); }
- void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); }
+ long GetLeftIndent() const { return maLBWindow->GetLeftIndent(); }
+ void SetLeftIndent( sal_uInt16 n ) { maLBWindow->SetLeftIndent( n ); }
+ void ScrollHorz( short nDiff ) { maLBWindow->ScrollHorz( nDiff ); }
- void SetTravelSelect( bool bTravelSelect ) { maLBWindow.SetTravelSelect( bTravelSelect ); }
- bool IsTravelSelect() const { return maLBWindow.IsTravelSelect(); }
- bool IsTrackingSelect() const { return maLBWindow.IsTrackingSelect(); }
+ void SetTravelSelect( bool bTravelSelect ) { maLBWindow->SetTravelSelect( bTravelSelect ); }
+ bool IsTravelSelect() const { return maLBWindow->IsTravelSelect(); }
+ bool IsTrackingSelect() const { return maLBWindow->IsTrackingSelect(); }
- void EnableMultiSelection( bool bMulti, bool bStackMode ) { maLBWindow.EnableMultiSelection( bMulti, bStackMode ); }
- bool IsMultiSelectionEnabled() const { return maLBWindow.IsMultiSelectionEnabled(); }
+ void EnableMultiSelection( bool bMulti, bool bStackMode ) { maLBWindow->EnableMultiSelection( bMulti, bStackMode ); }
+ bool IsMultiSelectionEnabled() const { return maLBWindow->IsMultiSelectionEnabled(); }
- void SetMultiSelectionSimpleMode( bool bSimple ) { maLBWindow.SetMultiSelectionSimpleMode( bSimple ); }
- bool IsMultiSelectionSimpleMode() const { return maLBWindow.IsMultiSelectionSimpleMode(); }
+ void SetMultiSelectionSimpleMode( bool bSimple ) { maLBWindow->SetMultiSelectionSimpleMode( bSimple ); }
+ bool IsMultiSelectionSimpleMode() const { return maLBWindow->IsMultiSelectionSimpleMode(); }
- void SetReadOnly( bool b ) { maLBWindow.SetReadOnly( b ); }
- bool IsReadOnly() const { return maLBWindow.IsReadOnly(); }
+ void SetReadOnly( bool b ) { maLBWindow->SetReadOnly( b ); }
+ bool IsReadOnly() const { return maLBWindow->IsReadOnly(); }
- Size CalcSize( sal_Int32 nMaxLines ) const { return maLBWindow.CalcSize( nMaxLines ); }
- long GetEntryHeight() const { return maLBWindow.GetEntryHeight(); }
- long GetMaxEntryWidth() const { return maLBWindow.GetMaxEntryWidth(); }
+ Size CalcSize( sal_Int32 nMaxLines ) const { return maLBWindow->CalcSize( nMaxLines ); }
+ long GetEntryHeight() const { return maLBWindow->GetEntryHeight(); }
+ long GetMaxEntryWidth() const { return maLBWindow->GetMaxEntryWidth(); }
void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; }
const Link& GetScrollHdl() const { return maScrollHdl; }
- void SetSelectHdl( const Link& rLink ) { maLBWindow.SetSelectHdl( rLink ); }
- const Link& GetSelectHdl() const { return maLBWindow.GetSelectHdl(); }
- void SetCancelHdl( const Link& rLink ) { maLBWindow.SetCancelHdl( rLink ); }
- const Link& GetCancelHdl() const { return maLBWindow.GetCancelHdl(); }
- void SetDoubleClickHdl( const Link& rLink ) { maLBWindow.SetDoubleClickHdl( rLink ); }
- const Link& GetDoubleClickHdl() const { return maLBWindow.GetDoubleClickHdl(); }
+ void SetSelectHdl( const Link& rLink ) { maLBWindow->SetSelectHdl( rLink ); }
+ const Link& GetSelectHdl() const { return maLBWindow->GetSelectHdl(); }
+ void SetCancelHdl( const Link& rLink ) { maLBWindow->SetCancelHdl( rLink ); }
+ const Link& GetCancelHdl() const { return maLBWindow->GetCancelHdl(); }
+ void SetDoubleClickHdl( const Link& rLink ) { maLBWindow->SetDoubleClickHdl( rLink ); }
+ const Link& GetDoubleClickHdl() const { return maLBWindow->GetDoubleClickHdl(); }
boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal;
- void SetFocusHdl( const Link& rLink ) { maLBWindow.SetFocusHdl( rLink ); }
- const Link& GetFocusHdl() const { return maLBWindow.GetFocusHdl(); }
- void SetListItemSelectHdl( const Link& rLink ) { maLBWindow.SetListItemSelectHdl( rLink ); }
- const Link& GetListItemSelectHdl() const { return maLBWindow.GetListItemSelectHdl(); }
- void SetSelectionChangedHdl( const Link& rLnk ) { maLBWindow.GetEntryList()->SetSelectionChangedHdl( rLnk ); }
- void SetCallSelectionChangedHdl( bool bCall ) { maLBWindow.GetEntryList()->SetCallSelectionChangedHdl( bCall ); }
- bool IsSelectionChanged() const { return maLBWindow.IsSelectionChanged(); }
- sal_uInt16 GetSelectModifier() const { return maLBWindow.GetSelectModifier(); }
+ void SetFocusHdl( const Link& rLink ) { maLBWindow->SetFocusHdl( rLink ); }
+ const Link& GetFocusHdl() const { return maLBWindow->GetFocusHdl(); }
+ void SetListItemSelectHdl( const Link& rLink ) { maLBWindow->SetListItemSelectHdl( rLink ); }
+ const Link& GetListItemSelectHdl() const { return maLBWindow->GetListItemSelectHdl(); }
+ void SetSelectionChangedHdl( const Link& rLnk ) { maLBWindow->GetEntryList()->SetSelectionChangedHdl( rLnk ); }
+ void SetCallSelectionChangedHdl( bool bCall ) { maLBWindow->GetEntryList()->SetCallSelectionChangedHdl( bCall ); }
+ bool IsSelectionChanged() const { return maLBWindow->IsSelectionChanged(); }
+ sal_uInt16 GetSelectModifier() const { return maLBWindow->GetSelectModifier(); }
void SetMRUEntries( const OUString& rEntries, sal_Unicode cSep );
OUString GetMRUEntries( sal_Unicode cSep ) const;
- void SetMaxMRUCount( sal_Int32 n ) { maLBWindow.GetEntryList()->SetMaxMRUCount( n ); }
- sal_Int32 GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); }
+ void SetMaxMRUCount( sal_Int32 n ) { maLBWindow->GetEntryList()->SetMaxMRUCount( n ); }
+ sal_Int32 GetMaxMRUCount() const { return maLBWindow->GetEntryList()->GetMaxMRUCount(); }
sal_uInt16 GetDisplayLineCount() const
- { return maLBWindow.GetDisplayLineCount(); }
+ { return maLBWindow->GetDisplayLineCount(); }
bool GetEdgeBlending() const { return mbEdgeBlending; }
void SetEdgeBlending(bool bNew);
/// pb: #106948# explicit mirroring for calc
- inline void EnableMirroring() { maLBWindow.EnableMirroring(); }
+ inline void EnableMirroring() { maLBWindow->EnableMirroring(); }
inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; }
};
class ImplListBoxFloatingWindow : public FloatingWindow
{
private:
- ImplListBox* mpImplLB;
+ VclPtr<ImplListBox> mpImplLB;
Size maPrefSz;
sal_uInt16 mnDDLineCount;
sal_Int32 mnPopupModeStartSaveSelection;
@@ -518,7 +520,8 @@ protected:
public:
ImplListBoxFloatingWindow( vcl::Window* pParent );
-
+ virtual ~ImplListBoxFloatingWindow();
+ virtual void dispose() SAL_OVERRIDE;
void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; }
void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; }
@@ -565,7 +568,6 @@ protected:
public:
ImplWin( vcl::Window* pParent, WinBits nWinStyle = 0 );
- virtual ~ImplWin() {};
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
@@ -607,7 +609,6 @@ private:
public:
ImplBtn( vcl::Window* pParent, WinBits nWinStyle = 0 );
- virtual ~ImplBtn() {};
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
void MBDown();
diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h
index a1e1b850d66c..eae0c597a03b 100644
--- a/vcl/inc/outdev.h
+++ b/vcl/inc/outdev.h
@@ -25,6 +25,7 @@
#include <vector>
#include <tools/gen.hxx>
+#include <vcl/vclptr.hxx>
#include "outfont.hxx"
#include "PhysicalFontFace.hxx"
@@ -164,7 +165,7 @@ namespace basegfx { class B2DHomMatrix; }
struct ImplOutDevData
{
- VirtualDevice* mpRotateDev;
+ VclPtr<VirtualDevice> mpRotateDev;
vcl::ControlLayoutData* mpRecordLayout;
Rectangle maRecordRect;
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index fef1da807543..a071c9d5cbac 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -51,19 +51,20 @@ namespace vcl
GDIMetaFile maMtf;
Size maOrigSize;
Size maPreviewSize;
- VirtualDevice maPageVDev;
+ VclPtr<VirtualDevice> maPageVDev;
Bitmap maPreviewBitmap;
- OUString maReplacementString;
- OUString maToolTipString;
+ OUString maReplacementString;
+ OUString maToolTipString;
bool mbGreyscale;
- FixedLine maHorzDim;
- FixedLine maVertDim;
+ VclPtr<FixedLine> maHorzDim;
+ VclPtr<FixedLine> maVertDim;
void preparePreviewBitmap();
public:
PrintPreviewWindow( vcl::Window* pParent );
virtual ~PrintPreviewWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Command( const CommandEvent& ) SAL_OVERRIDE;
@@ -86,7 +87,6 @@ namespace vcl
void ImplInitSettings();
public:
ShowNupOrderWindow( vcl::Window* pParent );
- virtual ~ShowNupOrderWindow();
virtual Size GetOptimalSize() const SAL_OVERRIDE;
@@ -106,31 +106,31 @@ namespace vcl
class NUpTabPage
{
public:
- RadioButton* mpPagesBtn;
- RadioButton* mpBrochureBtn;
- FixedText* mpPagesBoxTitleTxt;
- ListBox* mpNupPagesBox;
+ VclPtr<RadioButton> mpPagesBtn;
+ VclPtr<RadioButton> mpBrochureBtn;
+ VclPtr<FixedText> mpPagesBoxTitleTxt;
+ VclPtr<ListBox> mpNupPagesBox;
// controls for "Custom" page mode
- FixedText* mpNupNumPagesTxt;
- NumericField* mpNupColEdt;
- FixedText* mpNupTimesTxt;
- NumericField* mpNupRowsEdt;
- FixedText* mpPageMarginTxt1;
- MetricField* mpPageMarginEdt;
- FixedText* mpPageMarginTxt2;
- FixedText* mpSheetMarginTxt1;
- MetricField* mpSheetMarginEdt;
- FixedText* mpSheetMarginTxt2;
- FixedText* mpNupOrientationTxt;
- ListBox* mpNupOrientationBox;
+ VclPtr<FixedText> mpNupNumPagesTxt;
+ VclPtr<NumericField> mpNupColEdt;
+ VclPtr<FixedText> mpNupTimesTxt;
+ VclPtr<NumericField> mpNupRowsEdt;
+ VclPtr<FixedText> mpPageMarginTxt1;
+ VclPtr<MetricField> mpPageMarginEdt;
+ VclPtr<FixedText> mpPageMarginTxt2;
+ VclPtr<FixedText> mpSheetMarginTxt1;
+ VclPtr<MetricField> mpSheetMarginEdt;
+ VclPtr<FixedText> mpSheetMarginTxt2;
+ VclPtr<FixedText> mpNupOrientationTxt;
+ VclPtr<ListBox> mpNupOrientationBox;
// page order ("left to right, then down")
- FixedText* mpNupOrderTxt;
- ListBox* mpNupOrderBox;
- ShowNupOrderWindow* mpNupOrderWin;
+ VclPtr<FixedText> mpNupOrderTxt;
+ VclPtr<ListBox> mpNupOrderBox;
+ VclPtr<ShowNupOrderWindow> mpNupOrderWin;
/// border around each page
- CheckBox* mpBorderCB;
+ VclPtr<CheckBox> mpBorderCB;
void setupLayout();
@@ -145,18 +145,18 @@ namespace vcl
class JobTabPage
{
public:
- ListBox* mpPrinters;
- FixedText* mpStatusTxt;
- FixedText* mpLocationTxt;
- FixedText* mpCommentTxt;
+ VclPtr<ListBox> mpPrinters;
+ VclPtr<FixedText> mpStatusTxt;
+ VclPtr<FixedText> mpLocationTxt;
+ VclPtr<FixedText> mpCommentTxt;
- PushButton* mpSetupButton;
+ VclPtr<PushButton> mpSetupButton;
- FixedLine* mpCopySpacer;
- NumericField* mpCopyCountField;
- CheckBox* mpCollateBox;
- FixedImage* mpCollateImage;
- CheckBox* mpReverseOrderBox;
+ VclPtr<FixedLine> mpCopySpacer;
+ VclPtr<NumericField> mpCopyCountField;
+ VclPtr<CheckBox> mpCollateBox;
+ VclPtr<FixedImage> mpCollateImage;
+ VclPtr<CheckBox> mpReverseOrderBox;
Image maCollateImg;
Image maNoCollateImg;
@@ -172,9 +172,9 @@ namespace vcl
class OutputOptPage
{
public:
- CheckBox* mpToFileBox;
- CheckBox* mpCollateSingleJobsBox;
- CheckBox* mpPapersizeFromSetup;
+ VclPtr<CheckBox> mpToFileBox;
+ VclPtr<CheckBox> mpCollateSingleJobsBox;
+ VclPtr<CheckBox> mpPapersizeFromSetup;
OutputOptPage( VclBuilder* );
@@ -185,31 +185,31 @@ namespace vcl
VclBuilder* mpCustomOptionsUIBuilder;
std::shared_ptr<PrinterController> maPController;
- TabControl* mpTabCtrl;
+ VclPtr<TabControl> mpTabCtrl;
NUpTabPage maNUpPage;
JobTabPage maJobPage;
OutputOptPage maOptionsPage;
- PrintPreviewWindow* mpPreviewWindow;
- NumericField* mpPageEdit;
+ VclPtr<PrintPreviewWindow> mpPreviewWindow;
+ VclPtr<NumericField> mpPageEdit;
- FixedText* mpNumPagesText;
- PushButton* mpBackwardBtn;
- PushButton* mpForwardBtn;
+ VclPtr<FixedText> mpNumPagesText;
+ VclPtr<PushButton> mpBackwardBtn;
+ VclPtr<PushButton> mpForwardBtn;
- OKButton* mpOKButton;
- CancelButton* mpCancelButton;
- HelpButton* mpHelpButton;
+ VclPtr<OKButton> mpOKButton;
+ VclPtr<CancelButton> mpCancelButton;
+ VclPtr<HelpButton> mpHelpButton;
- OUString maPageStr;
- OUString maNoPageStr;
+ OUString maPageStr;
+ OUString maNoPageStr;
sal_Int32 mnCurPage;
sal_Int32 mnCachedPages;
- std::map< vcl::Window*, OUString > maControlToPropertyMap;
- std::map< OUString, std::vector< vcl::Window* > >
+ std::map< VclPtr<vcl::Window>, OUString > maControlToPropertyMap;
+ std::map< OUString, std::vector< VclPtr<vcl::Window> > >
maPropertyToWindowMap;
- std::map< vcl::Window*, sal_Int32 > maControlToNumValMap;
- std::set< OUString > maReverseDependencySet;
+ std::map< VclPtr<vcl::Window>, sal_Int32 > maControlToNumValMap;
+ std::set< OUString > maReverseDependencySet;
Size maNupPortraitSize;
Size maNupLandscapeSize;
@@ -258,6 +258,7 @@ namespace vcl
public:
PrintDialog( vcl::Window*, const std::shared_ptr< PrinterController >& );
virtual ~PrintDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool isPrintToFile();
bool isCollate();
@@ -270,9 +271,9 @@ namespace vcl
class PrintProgressDialog : public ModelessDialog
{
OUString maStr;
- FixedText* mpText;
- ProgressBar* mpProgress;
- CancelButton* mpButton;
+ VclPtr<FixedText> mpText;
+ VclPtr<ProgressBar> mpProgress;
+ VclPtr<CancelButton> mpButton;
bool mbCanceled;
sal_Int32 mnCur;
@@ -282,7 +283,8 @@ namespace vcl
public:
PrintProgressDialog(vcl::Window* i_pParent, int i_nMax);
-
+ virtual ~PrintProgressDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool isCanceled() const { return mbCanceled; }
void setProgress( int i_nCurrent, int i_nMax = -1 );
void tick();
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 6d54ca9a0864..84cd1f53567c 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -33,6 +33,8 @@
#include <vcl/impdel.hxx>
#include <rtl/ustring.hxx>
#include <vcl/keycod.hxx>
+#include <vcl/window.hxx>
+#include <vcl/vclptr.hxx>
#include <vcl/window.hxx>
// complete vcl::Window for SalFrame::CallCallback under -fsanitize=function
@@ -100,11 +102,11 @@ class VCL_PLUGIN_PUBLIC SalFrame
, public SalGeometryProvider
{
// the VCL window corresponding to this frame
- vcl::Window* m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
SALFRAMEPROC m_pProc;
public:
- SalFrame() : m_pWindow( NULL ), m_pProc( NULL ) {}
+ SalFrame();
virtual ~SalFrame();
SalFrameGeometry maGeometry;
@@ -230,8 +232,7 @@ public:
// Callbacks (indepent part in vcl/source/window/winproc.cxx)
// for default message handling return 0
- void SetCallback( vcl::Window* pWindow, SALFRAMEPROC pProc )
- { m_pWindow = pWindow; m_pProc = pProc; }
+ void SetCallback( vcl::Window* pWindow, SALFRAMEPROC pProc );
// returns the instance set
vcl::Window* GetWindow() const { return m_pWindow; }
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index c4da2e8db51c..82ae80ebbde6 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -122,7 +122,7 @@ struct ImplSVAppData
Help* mpHelp; // Application help
PopupMenu* mpActivePopupMenu; // Actives Popup-Menu (in Execute)
ImplIdleMgr* mpIdleMgr; // Idle-Manager
- ImplWheelWindow* mpWheelWindow; // WheelWindow
+ VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow
ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung
ImplEventHook* mpFirstEventHook; // Event-Hooks
VclEventListeners2* mpPostYieldListeners; // post yield listeners
@@ -153,18 +153,20 @@ struct ImplSVAppData
struct ImplSVGDIData
{
- OutputDevice* mpFirstWinGraphics; // First OutputDevice with a Frame Graphics
- OutputDevice* mpLastWinGraphics; // Last OutputDevice with a Frame Graphics
- OutputDevice* mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics
- OutputDevice* mpLastVirGraphics; // Last OutputDevice with a VirtualDevice Graphics
- OutputDevice* mpFirstPrnGraphics; // First OutputDevice with a InfoPrinter Graphics
- OutputDevice* mpLastPrnGraphics; // Last OutputDevice with a InfoPrinter Graphics
- VirtualDevice* mpFirstVirDev; // First VirtualDevice
- VirtualDevice* mpLastVirDev; // Last VirtualDevice
+ ~ImplSVGDIData();
+
+ VclPtr<OutputDevice> mpFirstWinGraphics; // First OutputDevice with a Frame Graphics
+ VclPtr<OutputDevice> mpLastWinGraphics; // Last OutputDevice with a Frame Graphics
+ VclPtr<OutputDevice> mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics
+ VclPtr<OutputDevice> mpLastVirGraphics; // Last OutputDevice with a VirtualDevice Graphics
+ VclPtr<OutputDevice> mpFirstPrnGraphics; // First OutputDevice with a InfoPrinter Graphics
+ VclPtr<OutputDevice> mpLastPrnGraphics; // Last OutputDevice with a InfoPrinter Graphics
+ VclPtr<VirtualDevice> mpFirstVirDev; // First VirtualDevice
+ VclPtr<VirtualDevice> mpLastVirDev; // Last VirtualDevice
OpenGLContext* mpFirstContext; // First OpenGLContext
OpenGLContext* mpLastContext; // Last OpenGLContext
- Printer* mpFirstPrinter; // First Printer
- Printer* mpLastPrinter; // Last Printer
+ VclPtr<Printer> mpFirstPrinter; // First Printer
+ VclPtr<Printer> mpLastPrinter; // Last Printer
ImplPrnQueueList* mpPrinterQueueList; // List of all printer queue
PhysicalFontCollection* mpScreenFontList; // Screen-Font-List
ImplFontCache* mpScreenFontCache; // Screen-Font-Cache
@@ -179,20 +181,20 @@ struct ImplSVGDIData
struct ImplSVWinData
{
- vcl::Window* mpFirstFrame; // First FrameWindow
- vcl::Window* mpDefDialogParent; // Default Dialog Parent
- WorkWindow* mpAppWin; // Application-Window
- vcl::Window* mpFocusWin; // window, that has the focus
- vcl::Window* mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set
- vcl::Window* mpCaptureWin; // window, that has the mouse capture
- vcl::Window* mpLastDeacWin; // Window, that need a deactivate (FloatingWindow-Handling)
- FloatingWindow* mpFirstFloat; // First FloatingWindow in PopupMode
- Dialog* mpLastExecuteDlg; // First Dialog that is in Execute
- vcl::Window* mpExtTextInputWin; // Window, which is in ExtTextInput
- vcl::Window* mpTrackWin; // window, that is in tracking mode
+ VclPtr<vcl::Window> mpFirstFrame; // First FrameWindow
+ VclPtr<vcl::Window> mpDefDialogParent; // Default Dialog Parent
+ VclPtr<WorkWindow> mpAppWin; // Application-Window
+ VclPtr<vcl::Window> mpFocusWin; // window, that has the focus
+ VclPtr<vcl::Window> mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set
+ VclPtr<vcl::Window> mpCaptureWin; // window, that has the mouse capture
+ VclPtr<vcl::Window> mpLastDeacWin; // Window, that need a deactivate (FloatingWindow-Handling)
+ VclPtr<FloatingWindow> mpFirstFloat; // First FloatingWindow in PopupMode
+ VclPtr<Dialog> mpLastExecuteDlg; // First Dialog that is in Execute
+ VclPtr<vcl::Window> mpExtTextInputWin; // Window, which is in ExtTextInput
+ VclPtr<vcl::Window> mpTrackWin; // window, that is in tracking mode
AutoTimer* mpTrackTimer; // tracking timer
ImageList* mpMsgBoxImgList; // ImageList for MessageBox
- vcl::Window* mpAutoScrollWin; // window, that is in AutoScrollMode mode
+ VclPtr<vcl::Window> mpAutoScrollWin; // window, that is in AutoScrollMode mode
sal_uInt16 mnTrackFlags; // tracking flags
sal_uInt16 mnAutoScrollFlags; // auto scroll flags
bool mbNoDeactivate; // true: do not execute Deactivate
@@ -239,7 +241,7 @@ struct ImplSVHelpData
bool mbKeyboardHelp : 1; // tiphelp was activated by keyboard
bool mbAutoHelpId : 1; // generate HelpIds
bool mbRequestingHelp : 1; // In Window::RequestHelp
- HelpTextWindow* mpHelpWin; // HelpWindow
+ VclPtr<HelpTextWindow> mpHelpWin; // HelpWindow
sal_uInt64 mnLastHelpHideTime; // ticks of last show
};
@@ -307,7 +309,7 @@ struct ImplSVData
SalData* mpSalData;
SalInstance* mpDefInst; // Default SalInstance
Application* mpApp; // pApp
- WorkWindow* mpDefaultWin; // Default-Window
+ VclPtr<WorkWindow> mpDefaultWin; // Default-Window
bool mbDeInit; // Is VCL deinitializing
sal_uLong mnThreadCount; // is VCL MultiThread enabled
ImplConfigData* mpFirstConfigData; // pointer to the first config block
@@ -325,7 +327,7 @@ struct ImplSVData
ImplSVHelpData maHelpData; // indepen data for Help classes
ImplSVNWFData maNWFData;
UnoWrapperBase* mpUnoWrapper;
- vcl::Window* mpIntroWindow; // the splash screen
+ VclPtr<vcl::Window> mpIntroWindow; // the splash screen
DockingManager* mpDockingManager;
BlendFrameCache* mpBlendFrameCache;
bool mbIsTestTool;
@@ -372,15 +374,10 @@ FieldUnitStringList* ImplGetCleanedFieldUnits();
struct ImplDelData
{
ImplDelData* mpNext;
- const vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
bool mbDel;
- ImplDelData( const vcl::Window* pWindow = NULL ) :
- mpNext( NULL ),
- mpWindow( NULL ),
- mbDel( false )
- { if( pWindow ) AttachToWindow( pWindow ); }
-
+ ImplDelData( vcl::Window* pWindow = NULL );
virtual ~ImplDelData();
bool IsDead() const
@@ -396,14 +393,14 @@ private:
struct ImplFocusDelData : public ImplDelData
{
- vcl::Window* mpFocusWin;
+ VclPtr<vcl::Window> mpFocusWin;
};
struct ImplSVEvent
{
void* mpData;
Link* mpLink;
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
ImplDelData maDelData;
bool mbCall;
};
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index 935d1184e81c..61d247bd270b 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -37,7 +37,7 @@ namespace vcl { class Window; }
struct ImplToolItem
{
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
void* mpUserData;
Image maImage;
Image maImageOriginal;
diff --git a/vcl/inc/unx/i18n_status.hxx b/vcl/inc/unx/i18n_status.hxx
index ee0ff3419bb8..ff954ceb37c4 100644
--- a/vcl/inc/unx/i18n_status.hxx
+++ b/vcl/inc/unx/i18n_status.hxx
@@ -22,6 +22,7 @@
#include <rtl/ustring.hxx>
#include <salimestatus.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
@@ -57,7 +58,7 @@ public:
};
private:
SalFrame* m_pParent;
- StatusWindow* m_pStatusWindow;
+ VclPtr<StatusWindow> m_pStatusWindow;
OUString m_aCurrentIM;
::std::vector< ChoiceData > m_aChoices;
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 75b8f5af3f61..a2066d4bf5b0 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -35,6 +35,7 @@
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <vcl/vclevent.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
struct SalPaintEvent;
@@ -114,15 +115,15 @@ struct ImplWinData
sal_uInt16 mnIsTopWindow;
bool mbMouseOver; //< tracks mouse over for native widget paint effect
bool mbEnableNativeWidget; //< toggle native widget rendering
- ::std::list< vcl::Window* >
+ ::std::list< VclPtr<vcl::Window> >
maTopWindowChildren;
};
struct ImplOverlapData
{
- VirtualDevice* mpSaveBackDev; //< saved background bitmap
- vcl::Region* mpSaveBackRgn; //< saved region, which must be invalidated
- vcl::Window* mpNextBackWin; //< next window with saved background
+ VclPtr<VirtualDevice> mpSaveBackDev; //< saved background bitmap
+ vcl::Region* mpSaveBackRgn; //< saved region, which must be invalidated
+ VclPtr<vcl::Window> mpNextBackWin; //< next window with saved background
sal_uIntPtr mnSaveBackSize; //< bitmap size of saved background
bool mbSaveBack; //< true: save background
sal_uInt8 mnTopLevel; //< Level for Overlap-Window
@@ -133,13 +134,13 @@ struct ImplFrameData
Idle maPaintIdle; //< paint idle handler
Idle maResizeIdle; //< resize timer
InputContext maOldInputContext; //< last set Input Context
- vcl::Window* mpNextFrame; //< next frame window
- vcl::Window* mpFirstOverlap; //< first overlap vcl::Window
- vcl::Window* mpFocusWin; //< focus window (is also set, when frame doesn't have the focous)
- vcl::Window* mpMouseMoveWin; //< last window, where MouseMove() called
- vcl::Window* mpMouseDownWin; //< last window, where MouseButtonDown() called
- vcl::Window* mpFirstBackWin; //< first overlap-window with saved background
- ::std::vector<vcl::Window *> maOwnerDrawList; //< List of system windows with owner draw decoration
+ VclPtr<vcl::Window> mpNextFrame; //< next frame window
+ VclPtr<vcl::Window> mpFirstOverlap; //< first overlap vcl::Window
+ VclPtr<vcl::Window> mpFocusWin; //< focus window (is also set, when frame doesn't have the focous)
+ VclPtr<vcl::Window> mpMouseMoveWin; //< last window, where MouseMove() called
+ VclPtr<vcl::Window> mpMouseDownWin; //< last window, where MouseButtonDown() called
+ VclPtr<vcl::Window> mpFirstBackWin; //< first overlap-window with saved background
+ ::std::vector<VclPtr<vcl::Window> > maOwnerDrawList; //< List of system windows with owner draw decoration
PhysicalFontCollection* mpFontCollection; //< Font-List for this frame
ImplFontCache* mpFontCache; //< Font-Cache for this frame
sal_Int32 mnDPIX; //< Original Screen Resolution
@@ -188,9 +189,9 @@ struct ImplAccessibleInfos
sal_uInt16 nAccessibleRole;
OUString* pAccessibleName;
OUString* pAccessibleDescription;
- vcl::Window* pLabeledByWindow;
- vcl::Window* pLabelForWindow;
- vcl::Window* pMemberOfWindow;
+ VclPtr<vcl::Window> pLabeledByWindow;
+ VclPtr<vcl::Window> pLabelForWindow;
+ VclPtr<vcl::Window> pMemberOfWindow;
ImplAccessibleInfos();
~ImplAccessibleInfos();
@@ -212,21 +213,21 @@ public:
ImplFrameData* mpFrameData;
SalFrame* mpFrame;
SalObject* mpSysObj;
- vcl::Window* mpFrameWindow;
- vcl::Window* mpOverlapWindow;
- vcl::Window* mpBorderWindow;
- vcl::Window* mpClientWindow;
- vcl::Window* mpParent;
- vcl::Window* mpRealParent;
- vcl::Window* mpFirstChild;
- vcl::Window* mpLastChild;
- vcl::Window* mpFirstOverlap;
- vcl::Window* mpLastOverlap;
- vcl::Window* mpPrev;
- vcl::Window* mpNext;
- vcl::Window* mpNextOverlap;
- vcl::Window* mpLastFocusWindow;
- vcl::Window* mpDlgCtrlDownWindow;
+ VclPtr<vcl::Window> mpFrameWindow;
+ VclPtr<vcl::Window> mpOverlapWindow;
+ VclPtr<vcl::Window> mpBorderWindow;
+ VclPtr<vcl::Window> mpClientWindow;
+ VclPtr<vcl::Window> mpParent;
+ VclPtr<vcl::Window> mpRealParent;
+ VclPtr<vcl::Window> mpFirstChild;
+ VclPtr<vcl::Window> mpLastChild;
+ VclPtr<vcl::Window> mpFirstOverlap;
+ VclPtr<vcl::Window> mpLastOverlap;
+ VclPtr<vcl::Window> mpPrev;
+ VclPtr<vcl::Window> mpNext;
+ VclPtr<vcl::Window> mpNextOverlap;
+ VclPtr<vcl::Window> mpLastFocusWindow;
+ VclPtr<vcl::Window> mpDlgCtrlDownWindow;
VclEventListeners maEventListeners;
VclEventListeners maChildEventListeners;
@@ -261,8 +262,8 @@ public:
InputContext maInputContext;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
- std::shared_ptr<VclSizeGroup> m_xSizeGroup;
- std::vector<FixedText*> m_aMnemonicLabels;
+ std::shared_ptr< VclSizeGroup > m_xSizeGroup;
+ std::vector< VclPtr<FixedText> > m_aMnemonicLabels;
ImplAccessibleInfos* mpAccessibleInfos;
VCLXWindow* mpVCLXWindow;
vcl::Region maWinRegion; //< region to 'shape' the VCL window (frame coordinates)
@@ -354,7 +355,7 @@ public:
mbCompoundControlHasFocus:1,
mbPaintDisabled:1,
mbAllResize:1,
- mbInDtor:1,
+ mbInDispose:1,
mbExtTextInput:1,
mbInFocusHdl:1,
mbOverlapVisible:1,
diff --git a/vcl/osx/a11ylistener.cxx b/vcl/osx/a11ylistener.cxx
index bc966361633a..630a126dc7a9 100644
--- a/vcl/osx/a11ylistener.cxx
+++ b/vcl/osx/a11ylistener.cxx
@@ -71,7 +71,7 @@ AquaA11yEventListener::notifyEvent( const AccessibleEventObject& aEvent ) throw(
{
NSString * notification = nil;
id element = m_wrapperObject;
- Rectangle bounds;
+ ::css::awt::Rectangle bounds;
// TODO: NSAccessibilityValueChanged, NSAccessibilitySelectedRowsChangedNotification
switch( aEvent.EventId )
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index 0becb853426a..ed631b082b75 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -448,7 +448,7 @@ bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName,
// information (e.g. brochure printing scales to the found paper size)
// also SetPaperSizeUser has the advantage that we can share a
// platform independent paper matching algorithm
- std::shared_ptr<Printer> pPrinter( i_rController.getPrinter() );
+ VclPtr<Printer> pPrinter( i_rController.getPrinter() );
pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
pPrinter->SetPaperSizeUser( aCurSize, true );
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a6330e4880c8..0c666c356a93 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -43,10 +43,10 @@ void VclComplexTextTest::testArabic()
OUString aOneTwoThree( reinterpret_cast<char const *>(pOneTwoThreeUTF8),
SAL_N_ELEMENTS( pOneTwoThreeUTF8 ) - 1,
RTL_TEXTENCODING_UTF8 );
- vcl::Window* pWin = new WorkWindow( (vcl::Window *)NULL );
- CPPUNIT_ASSERT( pWin != NULL );
+ VclPtr<vcl::Window> pWin = VclPtr<WorkWindow>::Create( (vcl::Window *)nullptr );
+ CPPUNIT_ASSERT( pWin );
- OutputDevice *pOutDev = static_cast< OutputDevice * >( pWin );
+ OutputDevice *pOutDev = static_cast< OutputDevice * >( pWin.get() );
vcl::Font aFont = OutputDevice::GetDefaultFont(
DEFAULTFONT_CTL_SPREADSHEET,
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
new file mode 100644
index 000000000000..4a0bebff8d0c
--- /dev/null
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <unotest/filters-test.hxx>
+#include <test/bootstrapfixture.hxx>
+
+#include <vcl/wrkwin.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/virdev.hxx>
+
+class LifecycleTest : public test::BootstrapFixture
+{
+ void testWidgets(vcl::Window *pParent);
+
+public:
+ LifecycleTest() : BootstrapFixture(true, false) {}
+
+ void testCast();
+ void testVirtualDevice();
+ void testMultiDispose();
+ void testIsolatedWidgets();
+ void testParentedWidgets();
+ void testChildDispose();
+ void testPostDispose();
+
+ CPPUNIT_TEST_SUITE(LifecycleTest);
+ CPPUNIT_TEST(testCast);
+ CPPUNIT_TEST(testVirtualDevice);
+ CPPUNIT_TEST(testMultiDispose);
+ CPPUNIT_TEST(testIsolatedWidgets);
+ CPPUNIT_TEST(testParentedWidgets);
+ CPPUNIT_TEST(testChildDispose);
+ CPPUNIT_TEST(testPostDispose);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+// A compile time sanity check
+void LifecycleTest::testCast()
+{
+ ScopedVclPtrInstance< PushButton > xButton( nullptr, 0 );
+ ScopedVclPtr<vcl::Window> xWindow(xButton);
+
+ ScopedVclPtrInstance< MetricField > xField( nullptr, 0 );
+ ScopedVclPtr<SpinField> xSpin(xField);
+ ScopedVclPtr<Edit> xEdit(xField);
+
+// the following line should NOT compile
+// VclPtr<PushButton> xButton2(xWindow);
+}
+
+void LifecycleTest::testVirtualDevice()
+{
+ VclPtr<VirtualDevice> pVDev = VclPtr< VirtualDevice >::Create();
+ ScopedVclPtrInstance< VirtualDevice > pVDev2;
+ VclPtrInstance<VirtualDevice> pVDev3;
+ VclPtrInstance<VirtualDevice> pVDev4( 1 );
+ CPPUNIT_ASSERT(!!pVDev && !!pVDev2 && !!pVDev3 && !!pVDev4);
+}
+
+void LifecycleTest::testMultiDispose()
+{
+ VclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK);
+ CPPUNIT_ASSERT(xWin.get() != NULL);
+ xWin->disposeOnce();
+ xWin->disposeOnce();
+ xWin->disposeOnce();
+ CPPUNIT_ASSERT(xWin->GetWindow(0) == NULL);
+ CPPUNIT_ASSERT(xWin->GetChild(0) == NULL);
+ CPPUNIT_ASSERT(xWin->GetChildCount() == 0);
+}
+
+void LifecycleTest::testWidgets(vcl::Window *pParent)
+{
+ { ScopedVclPtrInstance< PushButton > aPtr( pParent ); }
+ { ScopedVclPtrInstance< OKButton > aPtr( pParent ); }
+ { ScopedVclPtrInstance< CancelButton > aPtr( pParent ); }
+ { ScopedVclPtrInstance< HelpButton > aPtr( pParent ); }
+
+ // Some widgets really insist on adoption.
+ if (pParent)
+ {
+ { ScopedVclPtrInstance< CheckBox > aPtr( pParent ); }
+ { ScopedVclPtrInstance< Edit > aPtr( pParent ); }
+ { ScopedVclPtrInstance< ComboBox > aPtr( pParent ); }
+ { ScopedVclPtrInstance< RadioButton > aPtr( pParent ); }
+ }
+}
+
+void LifecycleTest::testIsolatedWidgets()
+{
+ testWidgets(NULL);
+}
+
+void LifecycleTest::testParentedWidgets()
+{
+ ScopedVclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK);
+ CPPUNIT_ASSERT(xWin.get() != NULL);
+ xWin->Show();
+ testWidgets(xWin);
+}
+
+class DisposableChild : public vcl::Window
+{
+public:
+ DisposableChild(vcl::Window *pParent) : vcl::Window(pParent) {}
+ virtual ~DisposableChild()
+ {
+ disposeOnce();
+ }
+};
+
+void LifecycleTest::testChildDispose()
+{
+ VclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK);
+ CPPUNIT_ASSERT(xWin.get() != NULL);
+ VclPtrInstance< DisposableChild > xChild( xWin.get() );
+ xWin->Show();
+ xChild->disposeOnce();
+ xWin->disposeOnce();
+}
+
+void LifecycleTest::testPostDispose()
+{
+ VclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK);
+ xWin->disposeOnce();
+
+ // check selected methods continue to work post-dispose
+ CPPUNIT_ASSERT(!xWin->GetParent());
+ xWin->Show();
+ CPPUNIT_ASSERT(!xWin->IsReallyShown());
+ CPPUNIT_ASSERT(!xWin->IsEnabled());
+ CPPUNIT_ASSERT(!xWin->IsInputEnabled());
+ CPPUNIT_ASSERT(!xWin->GetChild(0));
+ CPPUNIT_ASSERT(!xWin->GetWindow(0));
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 6ee359320931..a32ee7d3fd94 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -32,17 +32,17 @@ public:
void VclOutdevTest::testVirtualDevice()
{
- VirtualDevice aVDev;
- aVDev.SetOutputSizePixel(Size(32,32));
- aVDev.SetBackground(Wallpaper(COL_WHITE));
- aVDev.Erase();
- aVDev.DrawPixel(Point(1,2),COL_BLUE);
- aVDev.DrawPixel(Point(31,30),COL_RED);
-
- Size aSize = aVDev.GetOutputSizePixel();
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->SetOutputSizePixel(Size(32,32));
+ pVDev->SetBackground(Wallpaper(COL_WHITE));
+ pVDev->Erase();
+ pVDev->DrawPixel(Point(1,2),COL_BLUE);
+ pVDev->DrawPixel(Point(31,30),COL_RED);
+
+ Size aSize = pVDev->GetOutputSizePixel();
CPPUNIT_ASSERT(aSize == Size(32,32));
- Bitmap aBmp = aVDev.GetBitmap(Point(),aSize);
+ Bitmap aBmp = pVDev->GetBitmap(Point(),aSize);
#if 0
OUString rFileName("/tmp/foo-unx.png");
@@ -56,12 +56,12 @@ void VclOutdevTest::testVirtualDevice()
}
#endif
- CPPUNIT_ASSERT_EQUAL(COL_WHITE, aVDev.GetPixel(Point(0,0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(0,0)).GetColor());
#if defined LINUX //TODO: various failures on Mac and Windows tinderboxes
- CPPUNIT_ASSERT_EQUAL(COL_BLUE, aVDev.GetPixel(Point(1,2)).GetColor());
- CPPUNIT_ASSERT_EQUAL(COL_RED, aVDev.GetPixel(Point(31,30)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(COL_BLUE, pVDev->GetPixel(Point(1,2)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(COL_RED, pVDev->GetPixel(Point(31,30)).GetColor());
#endif
- CPPUNIT_ASSERT_EQUAL(COL_WHITE, aVDev.GetPixel(Point(30,31)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(30,31)).GetColor());
// Gotcha: y and x swap for BitmapReadAccess: deep joy.
Bitmap::ScopedReadAccess pAcc(aBmp);
@@ -73,8 +73,8 @@ void VclOutdevTest::testVirtualDevice()
CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(pAcc->GetPixel(31,30)).GetColor());
#if 0
- vcl::Window* pWin = new WorkWindow( (vcl::Window *)NULL );
- CPPUNIT_ASSERT( pWin != NULL );
+ VclPtr<vcl::Window> pWin = VclPtr<WorkWindow>::Create( (vcl::Window *)nullptr );
+ CPPUNIT_ASSERT( pWin );
OutputDevice *pOutDev = static_cast< OutputDevice * >( pWin );
#endif
}
diff --git a/vcl/quartz/cairo_quartz_cairo.cxx b/vcl/quartz/cairo_quartz_cairo.cxx
index b3a05541c438..0b0835c8fb05 100644
--- a/vcl/quartz/cairo_quartz_cairo.cxx
+++ b/vcl/quartz/cairo_quartz_cairo.cxx
@@ -244,13 +244,13 @@ namespace cairo
*
* @return The new virtual device
**/
- boost::shared_ptr<VirtualDevice> QuartzSurface::createVirtualDevice() const
+ VclPtr<VirtualDevice> QuartzSurface::createVirtualDevice() const
{
SystemGraphicsData aSystemGraphicsData;
aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
aSystemGraphicsData.rCGContext = getCGContext();
- return boost::shared_ptr<VirtualDevice>(
- new VirtualDevice( &aSystemGraphicsData, Size(1, 1), getDepth() ));
+ return VclPtr<VirtualDevice>(
+ VclPtr<VirtualDevice>::Create( &aSystemGraphicsData, Size(1, 1), getDepth() ));
}
} // namespace cairo
diff --git a/vcl/quartz/cairo_quartz_cairo.hxx b/vcl/quartz/cairo_quartz_cairo.hxx
index a3f94d20abf3..9c31c42c6ab9 100644
--- a/vcl/quartz/cairo_quartz_cairo.hxx
+++ b/vcl/quartz/cairo_quartz_cairo.hxx
@@ -55,7 +55,7 @@ namespace cairo {
virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const;
- virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const;
+ virtual VclPtr<VirtualDevice> createVirtualDevice() const;
virtual void flush() const;
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index 1c643f241176..e8d27ae769eb 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -207,98 +207,104 @@ NULL
class DbgInfoDialog : public ModalDialog
{
private:
- ListBox maListBox;
- OKButton maOKButton;
- bool mbHelpText;
+ VclPtr<ListBox> maListBox;
+ VclPtr<OKButton> maOKButton;
+ bool mbHelpText;
public:
DbgInfoDialog( vcl::Window* pParent, bool bHelpText = false );
void SetInfoText( const OUString& rStr );
+private:
+ virtual void dispose() SAL_OVERRIDE;
+ virtual ~DbgInfoDialog() { disposeOnce(); }
};
class DbgDialog : public ModalDialog
{
private:
- CheckBox maRes;
- CheckBox maDialog;
- CheckBox maBoldAppFont;
- GroupBox maBox3;
+ VclPtr<CheckBox> maRes;
+ VclPtr<CheckBox> maDialog;
+ VclPtr<CheckBox> maBoldAppFont;
+ VclPtr<GroupBox> maBox3;
- OKButton maOKButton;
- CancelButton maCancelButton;
- HelpButton maHelpButton;
+ VclPtr<OKButton> maOKButton;
+ VclPtr<CancelButton> maCancelButton;
+ VclPtr<HelpButton> maHelpButton;
public:
DbgDialog();
DECL_LINK( ClickHdl, Button* );
void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
+private:
+ virtual void dispose() SAL_OVERRIDE;
+ virtual ~DbgDialog() { disposeOnce(); }
};
DbgDialog::DbgDialog() :
ModalDialog( NULL, WB_STDMODAL | WB_SYSTEMWINDOW ),
- maRes( this ),
- maDialog( this ),
- maBoldAppFont( this ),
- maBox3( this ),
- maOKButton( this, WB_DEFBUTTON ),
- maCancelButton( this ),
- maHelpButton( this )
+ maRes(VclPtr<CheckBox>::Create(this)),
+ maDialog(VclPtr<CheckBox>::Create(this)),
+ maBoldAppFont(VclPtr<CheckBox>::Create(this)),
+ maBox3(VclPtr<GroupBox>::Create(this)),
+ maOKButton(VclPtr<OKButton>::Create(this, WB_DEFBUTTON)),
+ maCancelButton(VclPtr<CancelButton>::Create(this)),
+ maHelpButton(VclPtr<HelpButton>::Create(this))
{
DbgData* pData = DbgGetData();
MapMode aAppMap( MAP_APPFONT );
Size aButtonSize = LogicToPixel( Size( 60, 12 ), aAppMap );
{
- maRes.Show();
- maRes.SetText("~Resourcen");
+ maRes->Show();
+ maRes->SetText("~Resourcen");
if ( pData->nTestFlags & DBG_TEST_RESOURCE )
- maRes.Check( true );
- maRes.SetPosSizePixel( LogicToPixel( Point( 75, 95 ), aAppMap ),
+ maRes->Check( true );
+ maRes->SetPosSizePixel( LogicToPixel( Point( 75, 95 ), aAppMap ),
aButtonSize );
}
{
- maDialog.Show();
- maDialog.SetText("~Dialog");
+ maDialog->Show();
+ maDialog->SetText("~Dialog");
if ( pData->nTestFlags & DBG_TEST_DIALOG )
- maDialog.Check( true );
- maDialog.SetPosSizePixel( LogicToPixel( Point( 140, 95 ), aAppMap ),
+ maDialog->Check( true );
+ maDialog->SetPosSizePixel( LogicToPixel( Point( 140, 95 ), aAppMap ),
aButtonSize );
}
{
- maBoldAppFont.Show();
- maBoldAppFont.SetText("~Bold AppFont");
+ maBoldAppFont->Show();
+ maBoldAppFont->SetText("~Bold AppFont");
if ( pData->nTestFlags & DBG_TEST_BOLDAPPFONT )
- maBoldAppFont.Check( true );
- maBoldAppFont.SetPosSizePixel( LogicToPixel( Point( 205, 95 ), aAppMap ),
+ maBoldAppFont->Check( true );
+ maBoldAppFont->SetPosSizePixel( LogicToPixel( Point( 205, 95 ), aAppMap ),
aButtonSize );
- maBoldAppFont.SaveValue();
+ maBoldAppFont->SaveValue();
}
{
- maBox3.Show();
- maBox3.SetText("Test Options");
- maBox3.SetPosSizePixel( LogicToPixel( Point( 5, 85 ), aAppMap ),
+ maBox3->Show();
+ maBox3->SetText("Test Options");
+ maBox3->SetPosSizePixel( LogicToPixel( Point( 5, 85 ), aAppMap ),
LogicToPixel( Size( 330, 30 ), aAppMap ) );
}
{
- maOKButton.Show();
- maOKButton.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
- maOKButton.SetPosSizePixel( LogicToPixel( Point( 10, 260 ), aAppMap ),
+ maOKButton->Show();
+ maOKButton->SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
+ maOKButton->SetPosSizePixel( LogicToPixel( Point( 10, 260 ), aAppMap ),
LogicToPixel( Size( 50, 15 ), aAppMap ) );
}
{
- maCancelButton.Show();
- maCancelButton.SetPosSizePixel( LogicToPixel( Point( 70, 260 ), aAppMap ),
+ maCancelButton->Show();
+ maCancelButton->SetPosSizePixel( LogicToPixel( Point( 70, 260 ), aAppMap ),
LogicToPixel( Size( 50, 15 ), aAppMap ) );
}
{
- maHelpButton.Show();
- maHelpButton.SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap ),
+ maHelpButton->Show();
+ maHelpButton->SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap ),
LogicToPixel( Size( 50, 15 ), aAppMap ) );
}
@@ -310,20 +316,20 @@ DbgDialog::DbgDialog() :
IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
{
- if ( pButton == &maOKButton )
+ if ( pButton == maOKButton )
{
DbgData aData;
memcpy( &aData, DbgGetData(), sizeof( DbgData ) );
aData.nTestFlags = 0;
- if ( maRes.IsChecked() )
+ if ( maRes->IsChecked() )
aData.nTestFlags |= DBG_TEST_RESOURCE;
- if ( maDialog.IsChecked() )
+ if ( maDialog->IsChecked() )
aData.nTestFlags |= DBG_TEST_DIALOG;
- if ( maBoldAppFont.IsChecked() )
+ if ( maBoldAppFont->IsChecked() )
aData.nTestFlags |= DBG_TEST_BOLDAPPFONT;
// Daten speichern
@@ -333,12 +339,12 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
#define IMMEDIATE_FLAGS (DBG_TEST_RESOURCE | DBG_TEST_DIALOG | DBG_TEST_BOLDAPPFONT)
pData->nTestFlags &= ~IMMEDIATE_FLAGS;
pData->nTestFlags |= aData.nTestFlags & IMMEDIATE_FLAGS;
- if ( maBoldAppFont.IsValueChangedFromSaved() )
+ if ( maBoldAppFont->IsValueChangedFromSaved() )
{
AllSettings aSettings = Application::GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
vcl::Font aFont = aStyleSettings.GetAppFont();
- if ( maBoldAppFont.IsChecked() )
+ if ( maBoldAppFont->IsChecked() )
aFont.SetWeight( WEIGHT_BOLD );
else
aFont.SetWeight( WEIGHT_NORMAL );
@@ -348,10 +354,10 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
}
if( (aData.nTestFlags & ~IMMEDIATE_FLAGS) != (pData->nTestFlags & ~IMMEDIATE_FLAGS) )
{
- MessageDialog aBox(this, OUString(
+ ScopedVclPtrInstance<MessageDialog> aBox(this, OUString(
"Some of the changed settings will only be active after "
"restarting the process"), VCL_MESSAGE_INFO);
- aBox.Execute();
+ aBox->Execute();
}
EndDialog( RET_OK );
}
@@ -363,7 +369,7 @@ void DbgDialog::RequestHelp( const HelpEvent& rHEvt )
{
if ( rHEvt.GetMode() & HelpEventMode::CONTEXT )
{
- DbgInfoDialog aInfoDialog( this, true );
+ ScopedVclPtrInstance< DbgInfoDialog > aInfoDialog( this, true );
OUString aHelpText;
const sal_Char** pHelpStrs = pDbgHelpText;
while ( *pHelpStrs )
@@ -371,16 +377,28 @@ void DbgDialog::RequestHelp( const HelpEvent& rHEvt )
aHelpText += OUString::createFromAscii(*pHelpStrs);
pHelpStrs++;
}
- aInfoDialog.SetText( "Debug Hilfe" );
- aInfoDialog.SetInfoText( aHelpText );
- aInfoDialog.Execute();
+ aInfoDialog->SetText( "Debug Hilfe" );
+ aInfoDialog->SetInfoText( aHelpText );
+ aInfoDialog->Execute();
}
}
+void DbgDialog::dispose()
+{
+ maRes.disposeAndClear();
+ maDialog.disposeAndClear();
+ maBoldAppFont.disposeAndClear();
+ maBox3.disposeAndClear();
+ maOKButton.disposeAndClear();
+ maCancelButton.disposeAndClear();
+ maHelpButton.disposeAndClear();
+ ModalDialog::dispose();
+}
+
DbgInfoDialog::DbgInfoDialog( vcl::Window* pParent, bool bHelpText ) :
ModalDialog( pParent, WB_STDMODAL ),
- maListBox( this, WB_BORDER | WB_AUTOHSCROLL ),
- maOKButton( this, WB_DEFBUTTON )
+ maListBox(VclPtr<ListBox>::Create( this, WB_BORDER | WB_AUTOHSCROLL )),
+ maOKButton(VclPtr<OKButton>::Create(this, WB_DEFBUTTON))
{
mbHelpText = bHelpText;
@@ -389,21 +407,21 @@ DbgInfoDialog::DbgInfoDialog( vcl::Window* pParent, bool bHelpText ) :
vcl::Font aFont = GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_ENGLISH_US, 0 );
aFont.SetHeight( 8 );
aFont.SetPitch( PITCH_FIXED );
- maListBox.SetControlFont( aFont );
+ maListBox->SetControlFont( aFont );
}
- maListBox.SetPosSizePixel( Point( 5, 5 ), Size( 630, 380 ) );
- maListBox.Show();
+ maListBox->SetPosSizePixel( Point( 5, 5 ), Size( 630, 380 ) );
+ maListBox->Show();
- maOKButton.SetPosSizePixel( Point( 290, 390 ), Size( 60, 25 ) );
- maOKButton.Show();
+ maOKButton->SetPosSizePixel( Point( 290, 390 ), Size( 60, 25 ) );
+ maOKButton->Show();
SetOutputSizePixel( Size( 640, 420 ) );
}
void DbgInfoDialog::SetInfoText( const OUString& rStr )
{
- maListBox.SetUpdateMode( false );
- maListBox.Clear();
+ maListBox->SetUpdateMode( false );
+ maListBox->Clear();
OUString aStr = convertLineEnd(rStr, LINEEND_LF);
sal_Int32 nStrIndex = 0;
sal_Int32 nFoundIndex;
@@ -413,18 +431,18 @@ void DbgInfoDialog::SetInfoText( const OUString& rStr )
OUString aTextParagraph = aStr.copy( nStrIndex, nFoundIndex-nStrIndex );
if ( mbHelpText )
{
- long nMaxWidth = maListBox.GetOutputSizePixel().Width()-30;
+ long nMaxWidth = maListBox->GetOutputSizePixel().Width()-30;
sal_Int32 nLastIndex = 0;
sal_Int32 nIndex = aTextParagraph.indexOf( ' ' );
while ( nIndex != -1 )
{
- if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
+ if ( maListBox->GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
{
if ( !nLastIndex )
nLastIndex = nIndex+1;
OUString aTempStr = aTextParagraph.copy( 0, nLastIndex );
aTextParagraph = aTextParagraph.replaceAt( 0, nLastIndex, "" );
- maListBox.InsertEntry( aTempStr );
+ maListBox->InsertEntry( aTempStr );
nLastIndex = 0;
}
else
@@ -432,20 +450,27 @@ void DbgInfoDialog::SetInfoText( const OUString& rStr )
nIndex = aTextParagraph.indexOf( ' ', nLastIndex );
}
- if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
+ if ( maListBox->GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
{
if ( !nLastIndex )
nLastIndex = nIndex+1;
OUString aTempStr = aTextParagraph.copy( 0, nLastIndex );
aTextParagraph = aTextParagraph.replaceAt( 0, nLastIndex, "" );
- maListBox.InsertEntry( aTempStr );
+ maListBox->InsertEntry( aTempStr );
}
}
- maListBox.InsertEntry( aTextParagraph );
+ maListBox->InsertEntry( aTextParagraph );
nStrIndex = nFoundIndex+1;
}
while ( nFoundIndex != -1 );
- maListBox.SetUpdateMode( true );
+ maListBox->SetUpdateMode( true );
+}
+
+void DbgInfoDialog::dispose()
+{
+ maListBox.disposeAndClear();
+ maOKButton.disposeAndClear();
+ ModalDialog::dispose();
}
void DbgDialogTest( vcl::Window* pWindow )
@@ -808,7 +833,7 @@ void DbgGUIStart()
if ( pData )
{
- std::unique_ptr<DbgDialog> xDialog(new DbgDialog);
+ ScopedVclPtrInstance< DbgDialog > xDialog;
// we switch off dialog tests for the debug dialog
sal_uLong nOldFlags = pData->nTestFlags;
pData->nTestFlags &= ~DBG_TEST_DIALOG;
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 53ebd746a3f6..2f52375d1e02 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -204,9 +204,9 @@ sal_uIntPtr Help::ShowTip( vcl::Window* pParent, const Rectangle& rScreenRect,
const OUString& rText, sal_uInt16 nStyle )
{
sal_uInt16 nHelpWinStyle = ( ( nStyle & QUICKHELP_TIP_STYLE_BALLOON ) != 0 ) ? HELPWINSTYLE_BALLOON : HELPWINSTYLE_QUICK;
- HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle );
+ VclPtrInstance<HelpTextWindow> pHelpWin( pParent, rText, nHelpWinStyle, nStyle );
- sal_uIntPtr nId = reinterpret_cast< sal_uIntPtr >( pHelpWin );
+ sal_uIntPtr nId = reinterpret_cast< sal_uIntPtr >( pHelpWin.get() );
UpdateTip( nId, pParent, rScreenRect, rText );
pHelpWin->ShowHelp( HELPDELAY_NONE );
@@ -229,12 +229,12 @@ void Help::UpdateTip( sal_uIntPtr nId, vcl::Window* pParent, const Rectangle& rS
void Help::HideTip( sal_uLong nId )
{
- HelpTextWindow* pHelpWin = reinterpret_cast<HelpTextWindow*>(nId);
+ VclPtr<HelpTextWindow> pHelpWin = reinterpret_cast<HelpTextWindow*>(nId);
vcl::Window* pFrameWindow = pHelpWin->ImplGetFrameWindow();
pHelpWin->Hide();
// trigger update, so that a Paint is instantly triggered since we do not save the background
pFrameWindow->ImplUpdateAll();
- delete pHelpWin;
+ pHelpWin.disposeAndClear();
ImplGetSVData()->maHelpData.mnLastHelpHideTime = tools::Time::GetSystemTicks();
}
@@ -290,11 +290,17 @@ HelpTextWindow::HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal
HelpTextWindow::~HelpTextWindow()
{
+ disposeOnce();
+}
+
+void HelpTextWindow::dispose()
+{
maShowTimer.Stop();
maHideTimer.Stop();
if( this == ImplGetSVData()->maHelpData.mpHelpWin )
ImplGetSVData()->maHelpData.mpHelpWin = NULL;
+ FloatingWindow::dispose();
}
void HelpTextWindow::SetHelpText( const OUString& rHelpText )
@@ -524,7 +530,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, sal_uIn
nDelayMode = HELPDELAY_NONE;
DBG_ASSERT( !pHelpWin, "Noch ein HelpWin ?!" );
- pHelpWin = new HelpTextWindow( pParent, rHelpText, nHelpWinStyle, nStyle );
+ pHelpWin = VclPtr<HelpTextWindow>::Create( pParent, rHelpText, nHelpWinStyle, nStyle );
pSVData->maHelpData.mpHelpWin = pHelpWin;
pHelpWin->SetStatusText( rStatusText );
if ( pHelpArea )
@@ -544,7 +550,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, sal_uIn
void ImplDestroyHelpWindow( bool bUpdateHideTime )
{
ImplSVData* pSVData = ImplGetSVData();
- HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
+ VclPtr<HelpTextWindow> pHelpWin = pSVData->maHelpData.mpHelpWin;
if ( pHelpWin )
{
vcl::Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
@@ -555,7 +561,7 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime )
pSVData->maHelpData.mpHelpWin = NULL;
pSVData->maHelpData.mbKeyboardHelp = false;
pHelpWin->Hide();
- delete pHelpWin;
+ pHelpWin.disposeAndClear();
if( bUpdateHideTime )
pSVData->maHelpData.mnLastHelpHideTime = tools::Time::GetSystemTicks();
}
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index a0447312a778..e05b73480148 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -28,6 +28,9 @@
#include <salobj.hxx>
#include <salmenu.hxx>
+
+SalFrame::SalFrame() : m_pWindow( NULL ), m_pProc( NULL ) {}
+
// this file contains the virtual destructors of the sal interface
// compilers usually put their vtables where the destructor is
@@ -35,6 +38,12 @@ SalFrame::~SalFrame()
{
}
+void SalFrame::SetCallback( vcl::Window* pWindow, SALFRAMEPROC pProc )
+{
+ m_pWindow = pWindow;
+ m_pProc = pProc;
+}
+
// default to full-frame flushes
// on ports where partial-flushes are much cheaper this method should be overridden
void SalFrame::Flush( const Rectangle& )
diff --git a/vcl/source/app/stdtext.cxx b/vcl/source/app/stdtext.cxx
index 8093a6fe6900..fcf7b9d129c7 100644
--- a/vcl/source/app/stdtext.cxx
+++ b/vcl/source/app/stdtext.cxx
@@ -39,8 +39,8 @@ void ShowServiceNotAvailableError(vcl::Window* pParent,
{
OUString aText = GetStandardText(STANDARD_TEXT_SERVICE_NOT_AVAILABLE).
replaceAll("%s", rServiceName);
- MessageDialog aBox(pParent, aText, bError ? VCL_MESSAGE_ERROR : VCL_MESSAGE_WARNING);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox( pParent, aText, bError ? VCL_MESSAGE_ERROR : VCL_MESSAGE_WARNING );
+ aBox->Execute();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 3d22d7cf5621..7859ccc370c4 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -156,28 +156,28 @@ struct ImplEventHook
struct ImplPostEventData
{
sal_uLong mnEvent;
- const vcl::Window* mpWin;
+ VclPtr<vcl::Window> mpWin;
ImplSVEvent * mnEventId;
KeyEvent maKeyEvent;
MouseEvent maMouseEvent;
ZoomEvent maZoomEvent;
ScrollEvent maScrollEvent;
- ImplPostEventData( sal_uLong nEvent, const vcl::Window* pWin, const KeyEvent& rKeyEvent ) :
+ ImplPostEventData( sal_uLong nEvent, vcl::Window* pWin, const KeyEvent& rKeyEvent ) :
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maKeyEvent( rKeyEvent ) {}
- ImplPostEventData( sal_uLong nEvent, const vcl::Window* pWin, const MouseEvent& rMouseEvent ) :
+ ImplPostEventData( sal_uLong nEvent, vcl::Window* pWin, const MouseEvent& rMouseEvent ) :
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maMouseEvent( rMouseEvent ) {}
#if !HAVE_FEATURE_DESKTOP
- ImplPostEventData( sal_uLong nEvent, const vcl::Window* pWin, const ZoomEvent& rZoomEvent ) :
+ ImplPostEventData( sal_uLong nEvent, vcl::Window* pWin, const ZoomEvent& rZoomEvent ) :
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maZoomEvent( rZoomEvent ) {}
- ImplPostEventData( sal_uLong nEvent, const vcl::Window* pWin, const ScrollEvent& rScrollEvent ) :
+ ImplPostEventData( sal_uLong nEvent, vcl::Window* pWin, const ScrollEvent& rScrollEvent ) :
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maScrollEvent( rScrollEvent ) {}
#endif
~ImplPostEventData() {}
};
-typedef ::std::pair< vcl::Window*, ImplPostEventData* > ImplPostEventPair;
+typedef ::std::pair< VclPtr<vcl::Window>, ImplPostEventData* > ImplPostEventPair;
static ::std::list< ImplPostEventPair > aPostedEventList;
@@ -855,8 +855,8 @@ IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData )
break;
};
- if( pData->mpWin && pData->mpWin->mpWindowImpl->mpFrameWindow && pEventData )
- ImplWindowFrameProc( pData->mpWin->mpWindowImpl->mpFrameWindow, NULL, (sal_uInt16) nEvent, pEventData );
+ if( pData->mpWin && pData->mpWin.get()->mpWindowImpl->mpFrameWindow.get() && pEventData )
+ ImplWindowFrameProc( pData->mpWin.get()->mpWindowImpl->mpFrameWindow.get(), NULL, (sal_uInt16) nEvent, pEventData );
// remove this event from list of posted events, watch for destruction of internal data
::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() );
@@ -1010,7 +1010,7 @@ long Application::GetTopWindowCount()
{
long nRet = 0;
ImplSVData* pSVData = ImplGetSVData();
- vcl::Window *pWin = pSVData ? pSVData->maWinData.mpFirstFrame : NULL;
+ vcl::Window *pWin = pSVData ? pSVData->maWinData.mpFirstFrame.get() : NULL;
while( pWin )
{
if( pWin->ImplGetWindow()->IsTopWindow() )
@@ -1024,7 +1024,7 @@ vcl::Window* Application::GetTopWindow( long nIndex )
{
long nIdx = 0;
ImplSVData* pSVData = ImplGetSVData();
- vcl::Window *pWin = pSVData ? pSVData->maWinData.mpFirstFrame : NULL;
+ vcl::Window *pWin = pSVData ? pSVData->maWinData.mpFirstFrame.get() : NULL;
while( pWin )
{
if( pWin->ImplGetWindow()->IsTopWindow() )
@@ -1268,7 +1268,7 @@ vcl::Window* Application::GetDefDialogParent()
// #103442# find some useful dialog parent if there
// was no default set
// NOTE: currently even the default is not used
- if( false && pSVData->maWinData.mpDefDialogParent != NULL )
+ if( false && pSVData->maWinData.mpDefDialogParent.get() != NULL )
return pSVData->maWinData.mpDefDialogParent;
else
{
@@ -1629,11 +1629,24 @@ void Application::setDeInitHook(Link const & hook) {
pSVData->maAppData.mbInAppMain = true;
}
+ImplDelData::ImplDelData( vcl::Window* pWindow ) :
+ mpNext( NULL ),
+ mpWindow( NULL ),
+ mbDel( false )
+{
+ if( pWindow ) AttachToWindow( pWindow );
+}
+
// helper method to allow inline constructor even for pWindow!=NULL case
void ImplDelData::AttachToWindow( const vcl::Window* pWindow )
{
if( pWindow )
- const_cast<vcl::Window*>(pWindow)->ImplAddDel( this );
+ {
+ if( pWindow->IsDisposed() )
+ mbDel = true;
+ else
+ const_cast<vcl::Window*>(pWindow)->ImplAddDel( this );
+ }
}
// define dtor for ImplDelData
@@ -1644,7 +1657,7 @@ ImplDelData::~ImplDelData()
if( !mbDel && mpWindow )
{
// the window still exists but we were not removed
- const_cast<vcl::Window*>(mpWindow)->ImplRemoveDel( this );
+ const_cast<vcl::Window*>(mpWindow.get())->ImplRemoveDel( this );
mpWindow = NULL;
}
}
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 155b5cc0ba3c..14cf94de9dd2 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -37,6 +37,8 @@
#include "vcl/layout.hxx"
#include "vcl/button.hxx"
#include "vcl/dockwin.hxx"
+#include "vcl/print.hxx"
+#include "vcl/virdev.hxx"
#include "salinst.hxx"
#include "salframe.hxx"
#include "salgdi.hxx"
@@ -45,6 +47,8 @@
#include "salimestatus.hxx"
#include "salsys.hxx"
#include "svids.hrc"
+#include "helpwin.hxx"
+#include "../window/scrwnd.hxx"
#include "com/sun/star/accessibility/MSAAService.hpp"
@@ -84,6 +88,14 @@ ImplSVData::ImplSVData()
maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT );
}
+ImplSVGDIData::~ImplSVGDIData()
+{
+ // FIXME: deliberately leak any remaining OutputDevice
+ // until we have their pGraphics reference counted, doing
+ // any disposes so late in shutdown is rather unsafe.
+ memset( this, 0, sizeof( ImplSVGDIData ) );
+}
+
void ImplDeInitSVData()
{
ImplSVData* pSVData = ImplGetSVData();
@@ -124,7 +136,7 @@ vcl::Window* ImplGetDefaultWindow()
if ( !pSVData->mpDefaultWin && !pSVData->mbDeInit )
{
DBG_WARNING( "ImplGetDefaultWindow(): No AppWindow" );
- pSVData->mpDefaultWin = new WorkWindow( 0, WB_DEFAULTWIN );
+ pSVData->mpDefaultWin = VclPtr<WorkWindow>::Create( nullptr, WB_DEFAULTWIN );
pSVData->mpDefaultWin->SetText( OUString( "VCL ImplGetDefaultWindow" ) );
// Add a reference to the default context so it never gets deleted
@@ -160,8 +172,8 @@ ResMgr* ImplGetResMgr()
"Missing vcl resource. This indicates that files vital to localization are missing. "
"You might have a corrupt installation.";
fprintf( stderr, "%s\n", pMsg );
- MessageDialog aBox(NULL, OUString(pMsg, strlen(pMsg), RTL_TEXTENCODING_ASCII_US));
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox( nullptr, OUString(pMsg, strlen(pMsg), RTL_TEXTENCODING_ASCII_US) );
+ aBox->Execute();
}
}
return pSVData->mpResMgr;
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index a80d576c1987..fce2961c2c53 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -423,11 +423,7 @@ void DeInitVCL()
delete pSVData->maCtrlData.mpDisclosureMinus;
pSVData->maCtrlData.mpDisclosureMinus = NULL;
}
- if ( pSVData->mpDefaultWin )
- {
- delete pSVData->mpDefaultWin;
- pSVData->mpDefaultWin = NULL;
- }
+ pSVData->mpDefaultWin.disposeAndClear();
DBGGUI_DEINIT_SOLARMUTEXCHECK();
diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index 11d03e3f8b03..325c9b659b18 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -18,6 +18,7 @@
*/
#include "vcl/vclevent.hxx"
+#include "vcl/window.hxx"
#include "svdata.hxx"
@@ -158,4 +159,12 @@ void VclEventListeners2::callListeners( VclSimpleEvent* i_pEvent )
m_aIterators.pop_back();
}
+
+VclWindowEvent::VclWindowEvent( vcl::Window* pWin, sal_uLong n, void* pDat ) : VclSimpleEvent(n)
+{
+ pWindow = pWin; pData = pDat;
+}
+
+VclWindowEvent::~VclWindowEvent() {}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 09abe44f5f80..bf23b10fb9d4 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -88,14 +88,19 @@ ImplCommonButtonData::~ImplCommonButtonData()
}
Button::Button( WindowType nType ) :
- Control( nType )
+ Control( nType ),
+ mpButtonData( new ImplCommonButtonData )
{
- mpButtonData = new ImplCommonButtonData;
}
Button::~Button()
{
- delete mpButtonData;
+ disposeOnce();
+}
+
+void Button::dispose()
+{
+ Control::dispose();
}
void Button::SetCommandHandler(const OUString& aCommand)
@@ -1173,10 +1178,6 @@ PushButton::PushButton( vcl::Window* pParent, const ResId& rResId ) :
Show();
}
-PushButton::~PushButton()
-{
-}
-
void PushButton::MouseButtonDown( const MouseEvent& rMEvt )
{
if ( rMEvt.IsLeft() &&
@@ -1583,7 +1584,8 @@ void PushButton::SetPressed( bool bPressed )
void PushButton::EndSelection()
{
EndTracking( ENDTRACK_CANCEL );
- if ( ImplGetButtonState() & BUTTON_DRAW_PRESSED )
+ if ( !IsDisposed() &&
+ ImplGetButtonState() & BUTTON_DRAW_PRESSED )
{
ImplGetButtonState() &= ~BUTTON_DRAW_PRESSED;
if ( !mbPressed )
@@ -2143,20 +2145,20 @@ void RadioButton::group(RadioButton &rOther)
if (!m_xGroup)
{
- m_xGroup.reset(new std::vector<RadioButton*>);
+ m_xGroup.reset(new std::vector<VclPtr<RadioButton> >);
m_xGroup->push_back(this);
}
- std::vector<RadioButton*>::iterator aFind = std::find(m_xGroup->begin(), m_xGroup->end(), &rOther);
+ auto aFind = std::find(m_xGroup->begin(), m_xGroup->end(), VclPtr<RadioButton>(&rOther));
if (aFind == m_xGroup->end())
{
m_xGroup->push_back(&rOther);
if (rOther.m_xGroup)
{
- std::vector< RadioButton* > aOthers(rOther.GetRadioButtonGroup(false));
+ std::vector< VclPtr<RadioButton> > aOthers(rOther.GetRadioButtonGroup(false));
//make all members of the group share the same button group
- for (std::vector<RadioButton*>::iterator aI = aOthers.begin(), aEnd = aOthers.end(); aI != aEnd; ++aI)
+ for (auto aI = aOthers.begin(), aEnd = aOthers.end(); aI != aEnd; ++aI)
{
aFind = std::find(m_xGroup->begin(), m_xGroup->end(), *aI);
if (aFind == m_xGroup->end())
@@ -2165,8 +2167,7 @@ void RadioButton::group(RadioButton &rOther)
}
//make all members of the group share the same button group
- for (std::vector<RadioButton*>::iterator aI = m_xGroup->begin(), aEnd = m_xGroup->end();
- aI != aEnd; ++aI)
+ for (auto aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI)
{
RadioButton* pButton = *aI;
pButton->m_xGroup = m_xGroup;
@@ -2178,14 +2179,14 @@ void RadioButton::group(RadioButton &rOther)
ImplUncheckAllOther();
}
-std::vector< RadioButton* > RadioButton::GetRadioButtonGroup(bool bIncludeThis) const
+std::vector< VclPtr<RadioButton> > RadioButton::GetRadioButtonGroup(bool bIncludeThis) const
{
if (m_xGroup)
{
if (bIncludeThis)
return *m_xGroup;
- std::vector< RadioButton* > aGroup;
- for (std::vector<RadioButton*>::iterator aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI)
+ std::vector< VclPtr<RadioButton> > aGroup;
+ for (auto aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI)
{
RadioButton *pRadioButton = *aI;
if (pRadioButton == this)
@@ -2207,7 +2208,7 @@ std::vector< RadioButton* > RadioButton::GetRadioButtonGroup(bool bIncludeThis)
else
break;
}
- std::vector< RadioButton* > aGroup;
+ std::vector< VclPtr<RadioButton> > aGroup;
// insert radiobuttons up to next group
do
{
@@ -2226,9 +2227,9 @@ void RadioButton::ImplUncheckAllOther()
{
mpWindowImpl->mnStyle |= WB_TABSTOP;
- std::vector<RadioButton*> aGroup(GetRadioButtonGroup(false));
+ std::vector<VclPtr<RadioButton> > aGroup(GetRadioButtonGroup(false));
// iterate over radio button group and checked buttons
- for (std::vector<RadioButton*>::iterator aI = aGroup.begin(), aEnd = aGroup.end(); aI != aEnd; ++aI)
+ for (auto aI = aGroup.begin(), aEnd = aGroup.end(); aI != aEnd; ++aI)
{
RadioButton *pWindow = *aI;
if ( pWindow->IsChecked() )
@@ -2305,11 +2306,18 @@ void RadioButton::ImplLoadRes( const ResId& rResId )
RadioButton::~RadioButton()
{
+ disposeOnce();
+}
+
+void RadioButton::dispose()
+{
if (m_xGroup)
{
- m_xGroup->erase(std::remove(m_xGroup->begin(), m_xGroup->end(), this),
- m_xGroup->end());
+ m_xGroup->erase(std::remove(m_xGroup->begin(), m_xGroup->end(), VclPtr<RadioButton>(this)),
+ m_xGroup->end());
+ m_xGroup.reset();
}
+ Button::dispose();
}
void RadioButton::MouseButtonDown( const MouseEvent& rMEvt )
@@ -3753,10 +3761,6 @@ ImageButton::ImageButton( vcl::Window* pParent, const ResId& rResId ) :
ImplInitStyle();
}
-ImageButton::~ImageButton()
-{
-}
-
void ImageButton::ImplInitStyle()
{
WinBits nStyle = GetStyle();
@@ -3775,20 +3779,12 @@ ImageRadioButton::ImageRadioButton( vcl::Window* pParent, WinBits nStyle ) :
{
}
-ImageRadioButton::~ImageRadioButton()
-{
-}
-
TriStateBox::TriStateBox( vcl::Window* pParent, WinBits nStyle ) :
CheckBox( pParent, nStyle )
{
EnableTriState( true );
}
-TriStateBox::~TriStateBox()
-{
-}
-
DisclosureButton::DisclosureButton( vcl::Window* pParent, WinBits nStyle ) :
CheckBox( pParent, nStyle )
{
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index be0e048991c6..e9e24ee3cabc 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -68,20 +68,25 @@ ComboBox::ComboBox( vcl::Window* pParent, const ResId& rResId ) :
ComboBox::~ComboBox()
{
- SetSubEdit( NULL );
- delete mpSubEdit;
+ disposeOnce();
+}
+
+void ComboBox::dispose()
+{
+ mpSubEdit.disposeAndClear();
- ImplListBox *pImplLB = mpImplLB;
- mpImplLB = NULL;
- delete pImplLB;
+ VclPtr< ImplListBox > pImplLB = mpImplLB;
+ mpImplLB.clear();
+ pImplLB.disposeAndClear();
- delete mpFloatWin;
- delete mpBtn;
+ mpFloatWin.disposeAndClear();
+ mpBtn.disposeAndClear();
+ Edit::dispose();
}
void ComboBox::ImplInitComboBoxData()
{
- mpSubEdit = NULL;
+ mpSubEdit.disposeAndClear();
mpBtn = NULL;
mpImplLB = NULL;
mpFloatWin = NULL;
@@ -142,11 +147,11 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
WinBits nListStyle = nStyle;
if( nStyle & WB_DROPDOWN )
{
- mpFloatWin = new ImplListBoxFloatingWindow( this );
+ mpFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this );
mpFloatWin->SetAutoWidth( true );
mpFloatWin->SetPopupModeEndHdl( LINK( this, ComboBox, ImplPopupModeEndHdl ) );
- mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
+ mpBtn = VclPtr<ImplBtn>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
ImplInitDropDownButton( mpBtn );
mpBtn->buttonDownSignal.connect( boost::bind( &ComboBox::ImplClickButtonHandler, this, _1 ));
mpBtn->Show();
@@ -165,7 +170,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
}
}
- mpSubEdit = new Edit( this, nEditStyle );
+ mpSubEdit.set( VclPtr<Edit>::Create( this, nEditStyle ) );
mpSubEdit->EnableRTL( false );
SetSubEdit( mpSubEdit );
mpSubEdit->SetPosPixel( Point() );
@@ -175,7 +180,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
vcl::Window* pLBParent = this;
if ( mpFloatWin )
pLBParent = mpFloatWin;
- mpImplLB = new ImplListBox( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL );
+ mpImplLB = VclPtr<ImplListBox>::Create( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL );
mpImplLB->SetPosPixel( Point() );
mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) );
mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) );
@@ -188,7 +193,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
if ( mpFloatWin )
mpFloatWin->SetImplListBox( mpImplLB );
else
- mpImplLB->GetMainWindow().AllowGrabFocus( true );
+ mpImplLB->GetMainWindow()->AllowGrabFocus( true );
ImplCalcEditHeight();
@@ -253,7 +258,7 @@ void ComboBox::ImplClickButtonHandler( ImplBtn* )
ImplClearLayoutData();
if( mpImplLB )
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
}
IMPL_LINK_NOARG(ComboBox, ImplPopupModeEndHdl)
@@ -272,7 +277,7 @@ IMPL_LINK_NOARG(ComboBox, ImplPopupModeEndHdl)
ImplClearLayoutData();
if( mpImplLB )
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
mpBtn->SetPressed( false );
CallEventListeners( VCLEVENT_DROPDOWN_CLOSE );
@@ -581,20 +586,20 @@ void ComboBox::FillLayoutData() const
mpControlData->mpLayoutData = new vcl::ControlLayoutData();
AppendLayoutData( *mpSubEdit );
mpSubEdit->SetLayoutDataParent( this );
- Control& rMainWindow = mpImplLB->GetMainWindow();
+ ImplListBoxWindow* rMainWindow = mpImplLB->GetMainWindow();
if( mpFloatWin )
{
// dropdown mode
if( mpFloatWin->IsReallyVisible() )
{
- AppendLayoutData( rMainWindow );
- rMainWindow.SetLayoutDataParent( this );
+ AppendLayoutData( *rMainWindow );
+ rMainWindow->SetLayoutDataParent( this );
}
}
else
{
- AppendLayoutData( rMainWindow );
- rMainWindow.SetLayoutDataParent( this );
+ AppendLayoutData( *rMainWindow );
+ rMainWindow->SetLayoutDataParent( this );
}
}
@@ -647,7 +652,7 @@ void ComboBox::StateChanged( StateChangedType nType )
else if ( nType == StateChangedType::STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
- mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) != 0 );
+ mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) != 0 );
}
else if( nType == StateChangedType::MIRRORING )
{
@@ -765,7 +770,7 @@ bool ComboBox::Notify( NotifyEvent& rNEvt )
nDone = false; // don't eat this event, let the default handling happen (i.e. scroll the context)
}
}
- else if( ( rNEvt.GetType() == MouseNotifyEvent::MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == &mpImplLB->GetMainWindow() ) )
+ else if( ( rNEvt.GetType() == MouseNotifyEvent::MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == mpImplLB->GetMainWindow() ) )
{
mpSubEdit->GrabFocus();
}
@@ -799,6 +804,9 @@ void ComboBox::Modify()
void ComboBox::ImplUpdateFloatSelection()
{
+ if (!mpImplLB)
+ return;
+
// move text in the ListBox into the visible region
mpImplLB->SetCallSelectionChangedHdl( false );
if ( !IsMultiSelectionEnabled() )
@@ -1106,7 +1114,7 @@ void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines
long nCharWidth = GetTextWidth(OUString(static_cast<sal_Unicode>('x')));
if ( !IsDropDownBox() )
{
- Size aOutSz = mpImplLB->GetMainWindow().GetOutputSizePixel();
+ Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel();
rnCols = (nCharWidth > 0) ? (sal_uInt16)(aOutSz.Width()/nCharWidth) : 1;
rnLines = (sal_uInt16)(aOutSz.Height()/mpImplLB->GetEntryHeight());
}
@@ -1120,11 +1128,11 @@ void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines
void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
{
- mpImplLB->GetMainWindow().ImplInitSettings( true, true, true );
+ mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true );
Point aPos = pDev->LogicToPixel( rPos );
Size aSize = pDev->LogicToPixel( rSize );
- vcl::Font aFont = mpImplLB->GetMainWindow().GetDrawPixelFont( pDev );
+ vcl::Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
OutDevType eOutDevType = pDev->GetOutDevType();
pDev->Push();
@@ -1233,18 +1241,18 @@ void ComboBox::UserDraw( const UserDrawEvent& )
void ComboBox::SetUserItemSize( const Size& rSz )
{
- mpImplLB->GetMainWindow().SetUserItemSize( rSz );
+ mpImplLB->GetMainWindow()->SetUserItemSize( rSz );
}
void ComboBox::EnableUserDraw( bool bUserDraw )
{
- mpImplLB->GetMainWindow().EnableUserDraw( bUserDraw );
+ mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw );
}
void ComboBox::DrawEntry( const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos )
{
- DBG_ASSERT( rEvt.GetDevice() == &mpImplLB->GetMainWindow(), "DrawEntry?!" );
- mpImplLB->GetMainWindow().DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
+ DBG_ASSERT( rEvt.GetDevice() == mpImplLB->GetMainWindow(), "DrawEntry?!" );
+ mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
}
void ComboBox::SetSeparatorPos( sal_Int32 n )
@@ -1259,7 +1267,7 @@ void ComboBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
OUString ComboBox::GetMRUEntries( sal_Unicode cSep ) const
{
- return mpImplLB->GetMRUEntries( cSep );
+ return mpImplLB ? mpImplLB->GetMRUEntries( cSep ) : OUString();
}
void ComboBox::SetMaxMRUCount( sal_Int32 n )
@@ -1269,12 +1277,12 @@ void ComboBox::SetMaxMRUCount( sal_Int32 n )
sal_Int32 ComboBox::GetMaxMRUCount() const
{
- return mpImplLB->GetMaxMRUCount();
+ return mpImplLB ? mpImplLB->GetMaxMRUCount() : 0;
}
sal_uInt16 ComboBox::GetDisplayLineCount() const
{
- return mpImplLB->GetDisplayLineCount();
+ return mpImplLB ? mpImplLB->GetDisplayLineCount() : 0;
}
void ComboBox::SetEntryData( sal_Int32 nPos, void* pNewData )
@@ -1355,8 +1363,8 @@ void ComboBox::SetNoSelection()
Rectangle ComboBox::GetBoundingRectangle( sal_Int32 nItem ) const
{
- Rectangle aRect = mpImplLB->GetMainWindow().GetBoundingRectangle( nItem );
- Rectangle aOffset = mpImplLB->GetMainWindow().GetWindowExtentsRelative( (vcl::Window*)this );
+ Rectangle aRect = mpImplLB->GetMainWindow()->GetBoundingRectangle( nItem );
+ Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( (vcl::Window*)this );
aRect.Move( aOffset.TopLeft().X(), aOffset.TopLeft().Y() );
return aRect;
}
@@ -1382,16 +1390,16 @@ long ComboBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) const
{
// point must be either in main list window
// or in impl window (dropdown case)
- ImplListBoxWindow& rMain = mpImplLB->GetMainWindow();
+ ImplListBoxWindow* rMain = mpImplLB->GetMainWindow();
// convert coordinates to ImplListBoxWindow pixel coordinate space
Point aConvPoint = LogicToPixel( rPoint );
aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
- aConvPoint = rMain.AbsoluteScreenToOutputPixel( aConvPoint );
- aConvPoint = rMain.PixelToLogic( aConvPoint );
+ aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPoint );
+ aConvPoint = rMain->PixelToLogic( aConvPoint );
// try to find entry
- sal_Int32 nEntry = rMain.GetEntryPosForPoint( aConvPoint );
+ sal_Int32 nEntry = rMain->GetEntryPosForPoint( aConvPoint );
if( nEntry == LISTBOX_ENTRY_NOTFOUND )
nIndex = -1;
else
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 411243cccaeb..85ca49501f24 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -67,7 +67,13 @@ Control::Control( vcl::Window* pParent, const ResId& rResId ) :
Control::~Control()
{
+ disposeOnce();
+}
+
+void Control::dispose()
+{
delete mpControlData, mpControlData = NULL;
+ Window::dispose();
}
void Control::EnableRTL( bool bEnable )
@@ -107,7 +113,7 @@ void Control::CreateLayoutData() const
bool Control::HasLayoutData() const
{
- return mpControlData->mpLayoutData != NULL;
+ return mpControlData ? mpControlData->mpLayoutData != NULL : false;
}
::vcl::ControlLayoutData* Control::GetLayoutData() const
@@ -121,6 +127,10 @@ void Control::SetText( const OUString& rStr )
Window::SetText( rStr );
}
+ControlLayoutData::ControlLayoutData() : m_pParent( NULL )
+{
+}
+
Rectangle ControlLayoutData::GetCharacterBounds( long nIndex ) const
{
return (nIndex >= 0 && nIndex < (long) m_aUnicodeBoundRects.size()) ? m_aUnicodeBoundRects[ nIndex ] : Rectangle();
@@ -338,7 +348,11 @@ void Control::SetLayoutDataParent( const Control* pParent ) const
void Control::ImplClearLayoutData() const
{
- delete mpControlData->mpLayoutData, mpControlData->mpLayoutData = NULL;
+ if (mpControlData)
+ {
+ delete mpControlData->mpLayoutData;
+ mpControlData->mpLayoutData = NULL;
+ }
}
void Control::ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect )
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 809e9445fe1a..6efac8a766b7 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -239,7 +239,14 @@ bool Edit::set_property(const OString &rKey, const OString &rValue)
Edit::~Edit()
{
+ disposeOnce();
+}
+
+void Edit::dispose()
+{
delete mpDDInfo;
+ mpDDInfo = NULL;
+
vcl::Cursor* pCursor = GetCursor();
if ( pCursor )
{
@@ -248,8 +255,10 @@ Edit::~Edit()
}
delete mpIMEInfos;
+ mpIMEInfos = NULL;
delete mpUpdateDataTimer;
+ mpUpdateDataTimer = NULL;
if ( mxDnDListener.is() )
{
@@ -266,14 +275,18 @@ Edit::~Edit()
uno::Reference< lang::XEventListener> xEL( mxDnDListener, uno::UNO_QUERY );
xEL->disposing( lang::EventObject() ); // #95154# #96585# Empty Source means it's the Client
+ mxDnDListener.clear();
}
SetType(WINDOW_WINDOW);
+
+ mpSubEdit.disposeAndClear();
+ Control::dispose();
}
void Edit::ImplInitEditData()
{
- mpSubEdit = NULL;
+ mpSubEdit = VclPtr<Edit>();
mpUpdateDataTimer = NULL;
mpFilterText = NULL;
mnXOffset = 0;
@@ -792,8 +805,8 @@ void Edit::ShowTruncationWarning( vcl::Window* pParent )
ResMgr* pResMgr = ImplGetResMgr();
if( pResMgr )
{
- MessageDialog aBox(pParent, ResId(SV_EDIT_WARNING_STR, *pResMgr), VCL_MESSAGE_WARNING);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox( pParent, ResId(SV_EDIT_WARNING_STR, *pResMgr), VCL_MESSAGE_WARNING );
+ aBox->Execute();
}
}
@@ -2696,7 +2709,8 @@ void Edit::ClearModifyFlag()
void Edit::SetSubEdit( Edit* pEdit )
{
- mpSubEdit = pEdit;
+ mpSubEdit.disposeAndClear();
+ mpSubEdit.set( pEdit );
if ( mpSubEdit )
{
SetPointer( POINTER_ARROW ); // Nur das SubEdit hat den BEAM...
@@ -2771,8 +2785,8 @@ Size Edit::CalcMinimumSize() const
Size Edit::GetMinimumEditSize()
{
vcl::Window* pDefWin = ImplGetDefaultWindow();
- Edit aEdit( pDefWin, WB_BORDER );
- Size aSize( aEdit.CalcMinimumSize() );
+ ScopedVclPtrInstance< Edit > aEdit( pDefWin, WB_BORDER );
+ Size aSize( aEdit->CalcMinimumSize() );
return aSize;
}
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index c71b7265c32e..cb6b46b8cb7a 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -842,10 +842,6 @@ void NumericField::ImplLoadRes( const ResId& rResId )
mnSpinSize = ReadLongRes();
}
-NumericField::~NumericField()
-{
-}
-
bool NumericField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -979,10 +975,6 @@ Size NumericBox::CalcMinimumSize() const
return aRet;
}
-NumericBox::~NumericBox()
-{
-}
-
bool NumericBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -1679,10 +1671,6 @@ void MetricField::ImplLoadRes( const ResId& rResId )
Reformat();
}
-MetricField::~MetricField()
-{
-}
-
void MetricField::SetUnit( FieldUnit nNewUnit )
{
sal_Int64 nRawMax = GetMax( nNewUnit );
@@ -1826,10 +1814,6 @@ Size MetricBox::CalcMinimumSize() const
return aRet;
}
-MetricBox::~MetricBox()
-{
-}
-
bool MetricBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -2056,10 +2040,6 @@ CurrencyField::CurrencyField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
-CurrencyField::~CurrencyField()
-{
-}
-
bool CurrencyField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -2138,10 +2118,6 @@ CurrencyBox::CurrencyBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
-CurrencyBox::~CurrencyBox()
-{
-}
-
bool CurrencyBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 4bf320f61f48..3f343b215760 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -820,10 +820,6 @@ PatternField::PatternField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
-PatternField::~PatternField()
-{
-}
-
bool PatternField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -870,10 +866,6 @@ PatternBox::PatternBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
-PatternBox::~PatternBox()
-{
-}
-
bool PatternBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -1738,10 +1730,6 @@ DateField::DateField( vcl::Window* pParent, WinBits nWinStyle ) :
ResetLastDate();
}
-DateField::~DateField()
-{
-}
-
bool DateField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() &&
@@ -1841,10 +1829,6 @@ DateBox::DateBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
-DateBox::~DateBox()
-{
-}
-
bool DateBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() &&
@@ -2532,10 +2516,6 @@ TimeField::TimeField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
-TimeField::~TimeField()
-{
-}
-
bool TimeField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -2673,10 +2653,6 @@ TimeBox::TimeBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
-TimeBox::~TimeBox()
-{
-}
-
bool TimeBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 62c6135438b6..69922de6df07 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -460,7 +460,14 @@ void FixedText::set_mnemonic_widget(vcl::Window *pWindow)
FixedText::~FixedText()
{
+ disposeOnce();
+}
+
+void FixedText::dispose()
+{
set_mnemonic_widget(NULL);
+ m_pMnemonicWindow.clear();
+ Control::dispose();
}
SelectableFixedText::SelectableFixedText(vcl::Window* pParent, WinBits nStyle)
@@ -748,10 +755,6 @@ FixedBitmap::FixedBitmap( vcl::Window* pParent, WinBits nStyle ) :
ImplInit( pParent, nStyle );
}
-FixedBitmap::~FixedBitmap()
-{
-}
-
void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */,
const Point& rPos, const Size& rSize )
{
@@ -915,10 +918,6 @@ FixedImage::FixedImage( vcl::Window* pParent, const ResId& rResId ) :
Show();
}
-FixedImage::~FixedImage()
-{
-}
-
void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
const Point& rPos, const Size& rSize )
{
diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx
index 6926a0c843c6..db36f90c2572 100644
--- a/vcl/source/control/fixedhyper.cxx
+++ b/vcl/source/control/fixedhyper.cxx
@@ -26,10 +26,6 @@ FixedHyperlink::FixedHyperlink(vcl::Window* pParent, WinBits nWinStyle)
Initialize();
}
-FixedHyperlink::~FixedHyperlink()
-{
-}
-
void FixedHyperlink::Initialize()
{
// saves the old pointer
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 64d009ab9e34..083faf072e96 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -536,7 +536,13 @@ ImplListBoxWindow::ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle )
ImplListBoxWindow::~ImplListBoxWindow()
{
+ disposeOnce();
+}
+
+void ImplListBoxWindow::dispose()
+{
delete mpEntryList;
+ Control::dispose();
}
void ImplListBoxWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground )
@@ -2135,16 +2141,16 @@ sal_uInt16 ImplListBoxWindow::ImplGetTextStyle() const
ImplListBox::ImplListBox( vcl::Window* pParent, WinBits nWinStyle ) :
Control( pParent, nWinStyle ),
- maLBWindow( this, nWinStyle&(~WB_BORDER) )
+ maLBWindow(VclPtr<ImplListBoxWindow>::Create( this, nWinStyle&(~WB_BORDER) ))
{
- maLBWindow.userDrawSignal.connect( userDrawSignal );
+ maLBWindow->userDrawSignal.connect( userDrawSignal );
// for native widget rendering we must be able to detect this window type
SetType( WINDOW_LISTBOXWINDOW );
- mpVScrollBar = new ScrollBar( this, WB_VSCROLL | WB_DRAG );
- mpHScrollBar = new ScrollBar( this, WB_HSCROLL | WB_DRAG );
- mpScrollBarBox = new ScrollBarBox( this );
+ mpVScrollBar = VclPtr<ScrollBar>::Create( this, WB_VSCROLL | WB_DRAG );
+ mpHScrollBar = VclPtr<ScrollBar>::Create( this, WB_HSCROLL | WB_DRAG );
+ mpScrollBarBox = VclPtr<ScrollBarBox>::Create( this );
Link aLink( LINK( this, ImplListBox, ScrollBarHdl ) );
mpVScrollBar->SetScrollHdl( aLink );
@@ -2155,26 +2161,33 @@ ImplListBox::ImplListBox( vcl::Window* pParent, WinBits nWinStyle ) :
mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL );
mbEdgeBlending = false;
- maLBWindow.SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) );
- maLBWindow.SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) );
- maLBWindow.SetEdgeBlending(GetEdgeBlending());
- maLBWindow.Show();
+ maLBWindow->SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) );
+ maLBWindow->SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) );
+ maLBWindow->SetEdgeBlending(GetEdgeBlending());
+ maLBWindow->Show();
}
ImplListBox::~ImplListBox()
{
- delete mpHScrollBar;
- delete mpVScrollBar;
- delete mpScrollBarBox;
+ disposeOnce();
+}
+
+void ImplListBox::dispose()
+{
+ mpHScrollBar.disposeAndClear();
+ mpVScrollBar.disposeAndClear();
+ mpScrollBarBox.disposeAndClear();
+ maLBWindow.disposeAndClear();
+ Control::dispose();
}
void ImplListBox::Clear()
{
- maLBWindow.Clear();
+ maLBWindow->Clear();
if ( GetEntryList()->GetMRUCount() )
{
- maLBWindow.GetEntryList()->SetMRUCount( 0 );
- maLBWindow.SetSeparatorPos( LISTBOX_ENTRY_NOTFOUND );
+ maLBWindow->GetEntryList()->SetMRUCount( 0 );
+ maLBWindow->SetSeparatorPos( LISTBOX_ENTRY_NOTFOUND );
}
mpVScrollBar->SetThumbPos( 0 );
mpHScrollBar->SetThumbPos( 0 );
@@ -2184,7 +2197,7 @@ void ImplListBox::Clear()
sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
{
ImplEntryType* pNewEntry = new ImplEntryType( rStr );
- sal_Int32 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
+ sal_Int32 nNewPos = maLBWindow->InsertEntry( nPos, pNewEntry );
if (nNewPos == LISTBOX_ERROR)
{
delete pNewEntry;
@@ -2197,7 +2210,7 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage )
{
ImplEntryType* pNewEntry = new ImplEntryType( rStr, rImage );
- sal_Int32 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
+ sal_Int32 nNewPos = maLBWindow->InsertEntry( nPos, pNewEntry );
if (nNewPos == LISTBOX_ERROR)
{
delete pNewEntry;
@@ -2209,33 +2222,33 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr, const
void ImplListBox::RemoveEntry( sal_Int32 nPos )
{
- maLBWindow.RemoveEntry( nPos );
+ maLBWindow->RemoveEntry( nPos );
StateChanged( StateChangedType::DATA );
}
void ImplListBox::SetEntryFlags( sal_Int32 nPos, long nFlags )
{
- maLBWindow.SetEntryFlags( nPos, nFlags );
+ maLBWindow->SetEntryFlags( nPos, nFlags );
}
void ImplListBox::SelectEntry( sal_Int32 nPos, bool bSelect )
{
- maLBWindow.SelectEntry( nPos, bSelect );
+ maLBWindow->SelectEntry( nPos, bSelect );
}
void ImplListBox::SetNoSelection()
{
- maLBWindow.DeselectAll();
+ maLBWindow->DeselectAll();
}
void ImplListBox::GetFocus()
{
- maLBWindow.GrabFocus();
+ maLBWindow->GrabFocus();
}
vcl::Window* ImplListBox::GetPreferredKeyInputWindow()
{
- return &maLBWindow;
+ return maLBWindow.get();
}
void ImplListBox::Resize()
@@ -2359,7 +2372,7 @@ void ImplListBox::ImplCheckScrollBars()
void ImplListBox::ImplInitScrollBars()
{
- Size aOutSz = maLBWindow.GetOutputSizePixel();
+ Size aOutSz = maLBWindow->GetOutputSizePixel();
if ( mbVScroll )
{
@@ -2396,9 +2409,9 @@ void ImplListBox::ImplResizeControls()
// pb: #106948# explicit mirroring for calc
// Scrollbar on left or right side?
- bool bMirroring = maLBWindow.IsMirroring();
+ bool bMirroring = maLBWindow->IsMirroring();
Point aWinPos( bMirroring && mbVScroll ? nSBWidth : 0, 0 );
- maLBWindow.SetPosSizePixel( aWinPos, aInnerSz );
+ maLBWindow->SetPosSizePixel( aWinPos, aInnerSz );
// ScrollBarBox
if( mbVScroll && mbHScroll )
@@ -2450,7 +2463,7 @@ void ImplListBox::StateChanged( StateChangedType nType )
else if ( ( nType == StateChangedType::UPDATEMODE ) || ( nType == StateChangedType::DATA ) )
{
bool bUpdate = IsUpdateMode();
- maLBWindow.SetUpdateMode( bUpdate );
+ maLBWindow->SetUpdateMode( bUpdate );
if ( bUpdate && IsReallyVisible() )
ImplCheckScrollBars();
}
@@ -2459,30 +2472,30 @@ void ImplListBox::StateChanged( StateChangedType nType )
mpHScrollBar->Enable( IsEnabled() );
mpVScrollBar->Enable( IsEnabled() );
mpScrollBarBox->Enable( IsEnabled() );
- maLBWindow.Enable( IsEnabled() );
+ maLBWindow->Enable( IsEnabled() );
Invalidate();
}
else if ( nType == StateChangedType::ZOOM )
{
- maLBWindow.SetZoom( GetZoom() );
+ maLBWindow->SetZoom( GetZoom() );
Resize();
}
else if ( nType == StateChangedType::CONTROLFONT )
{
- maLBWindow.SetControlFont( GetControlFont() );
+ maLBWindow->SetControlFont( GetControlFont() );
}
else if ( nType == StateChangedType::CONTROLFOREGROUND )
{
- maLBWindow.SetControlForeground( GetControlForeground() );
+ maLBWindow->SetControlForeground( GetControlForeground() );
}
else if ( nType == StateChangedType::CONTROLBACKGROUND )
{
- maLBWindow.SetControlBackground( GetControlBackground() );
+ maLBWindow->SetControlBackground( GetControlBackground() );
}
else if( nType == StateChangedType::MIRRORING )
{
- maLBWindow.EnableRTL( IsRTLEnabled() );
+ maLBWindow->EnableRTL( IsRTLEnabled() );
mpHScrollBar->EnableRTL( IsRTLEnabled() );
mpVScrollBar->EnableRTL( IsRTLEnabled() );
ImplResizeControls();
@@ -2517,7 +2530,7 @@ bool ImplListBox::Notify( NotifyEvent& rNEvt )
const Wallpaper& ImplListBox::GetDisplayBackground() const
{
- return maLBWindow.GetDisplayBackground();
+ return maLBWindow->GetDisplayBackground();
}
bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
@@ -2542,7 +2555,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
// Remove old MRU entries
for ( sal_Int32 n = GetEntryList()->GetMRUCount();n; )
- maLBWindow.RemoveEntry( --n );
+ maLBWindow->RemoveEntry( --n );
sal_Int32 nMRUCount = 0;
sal_Int32 nIndex = 0;
@@ -2553,7 +2566,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND )
{
ImplEntryType* pNewEntry = new ImplEntryType( aEntry );
- maLBWindow.GetEntryList()->InsertEntry( nMRUCount++, pNewEntry, false );
+ maLBWindow->GetEntryList()->InsertEntry( nMRUCount++, pNewEntry, false );
bChanges = true;
}
}
@@ -2561,7 +2574,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
if ( bChanges )
{
- maLBWindow.GetEntryList()->SetMRUCount( nMRUCount );
+ maLBWindow->GetEntryList()->SetMRUCount( nMRUCount );
SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 );
StateChanged( StateChangedType::DATA );
}
@@ -2584,7 +2597,7 @@ void ImplListBox::SetEdgeBlending(bool bNew)
if(mbEdgeBlending != bNew)
{
mbEdgeBlending = bNew;
- maLBWindow.SetEdgeBlending(GetEdgeBlending());
+ maLBWindow->SetEdgeBlending(GetEdgeBlending());
}
}
@@ -2918,6 +2931,18 @@ ImplListBoxFloatingWindow::ImplListBoxFloatingWindow( vcl::Window* pParent ) :
}
+ImplListBoxFloatingWindow::~ImplListBoxFloatingWindow()
+{
+ disposeOnce();
+}
+
+void ImplListBoxFloatingWindow::dispose()
+{
+ mpImplLB.clear();
+ FloatingWindow::dispose();
+}
+
+
bool ImplListBoxFloatingWindow::PreNotify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS )
@@ -2959,13 +2984,13 @@ void ImplListBoxFloatingWindow::setPosSizePixel( long nX, long nY, long nWidth,
// this the presence of the vertical Scrollbar has to be known.
mpImplLB->SetSizePixel( GetOutputSizePixel() );
((vcl::Window*)mpImplLB)->Resize();
- ((vcl::Window&)mpImplLB->GetMainWindow()).Resize();
+ ((vcl::Window*)mpImplLB->GetMainWindow())->Resize();
}
}
void ImplListBoxFloatingWindow::Resize()
{
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
FloatingWindow::Resize();
}
@@ -3085,12 +3110,12 @@ void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking )
mpImplLB->ShowProminentEntry( nPos );
if( bStartTracking )
- mpImplLB->GetMainWindow().EnableMouseMoveSelect( true );
+ mpImplLB->GetMainWindow()->EnableMouseMoveSelect( true );
- if ( mpImplLB->GetMainWindow().IsGrabFocusAllowed() )
- mpImplLB->GetMainWindow().GrabFocus();
+ if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() )
+ mpImplLB->GetMainWindow()->GrabFocus();
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
}
}
diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx
index 5f081bed20de..77724b0b02d3 100644
--- a/vcl/source/control/longcurr.cxx
+++ b/vcl/source/control/longcurr.cxx
@@ -468,10 +468,6 @@ LongCurrencyField::LongCurrencyField( vcl::Window* pParent, WinBits nWinStyle )
Reformat();
}
-LongCurrencyField::~LongCurrencyField()
-{
-}
-
bool LongCurrencyField::PreNotify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
@@ -546,10 +542,6 @@ LongCurrencyBox::LongCurrencyBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
-LongCurrencyBox::~LongCurrencyBox()
-{
-}
-
bool LongCurrencyBox::PreNotify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index a35c502851fd..06da9a114911 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -39,7 +39,7 @@
void ListBox::EnableQuickSelection( const bool& b )
{
- mpImplLB->GetMainWindow().EnableQuickSelection(b);
+ mpImplLB->GetMainWindow()->EnableQuickSelection(b);
}
ListBox::ListBox(WindowType nType)
@@ -70,17 +70,19 @@ ListBox::ListBox( vcl::Window* pParent, const ResId& rResId ) :
ListBox::~ListBox()
{
+ disposeOnce();
+}
+
+void ListBox::dispose()
+{
CallEventListeners( VCLEVENT_OBJECT_DYING );
- // When destroying the FloatWin TH does a GrabFocus to the Parent:
- // that means this "ListBox => PreNotify() ..."
- ImplListBox *pImplLB = mpImplLB;
- mpImplLB = NULL;
- delete pImplLB;
+ mpImplLB.disposeAndClear();
+ mpFloatWin.disposeAndClear();
+ mpImplWin.disposeAndClear();
+ mpBtn.disposeAndClear();
- delete mpFloatWin;
- delete mpImplWin;
- delete mpBtn;
+ Control::dispose();
}
void ListBox::ImplInitListBoxData()
@@ -130,19 +132,19 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
}
}
- mpFloatWin = new ImplListBoxFloatingWindow( this );
+ mpFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this );
mpFloatWin->SetAutoWidth( true );
mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) );
mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop);
- mpImplWin = new ImplWin( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER );
+ mpImplWin = VclPtr<ImplWin>::Create( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER );
mpImplWin->buttonDownSignal.connect( boost::bind( &ListBox::ImplClickButtonHandler, this, _1 ));
mpImplWin->userDrawSignal.connect( boost::bind( &ListBox::ImplUserDrawHandler, this, _1 ) );
mpImplWin->Show();
mpImplWin->GetDropTarget()->addDropTargetListener(xDrop);
mpImplWin->SetEdgeBlending(GetEdgeBlending());
- mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
+ mpBtn = VclPtr<ImplBtn>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
ImplInitDropDownButton( mpBtn );
mpBtn->buttonDownSignal.connect( boost::bind( &ListBox::ImplClickButtonHandler, this, _1 ));
mpBtn->Show();
@@ -152,7 +154,7 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
vcl::Window* pLBParent = this;
if ( mpFloatWin )
pLBParent = mpFloatWin;
- mpImplLB = new ImplListBox( pLBParent, nStyle&(~WB_BORDER) );
+ mpImplLB = VclPtr<ImplListBox>::Create( pLBParent, nStyle&(~WB_BORDER) );
mpImplLB->SetSelectHdl( LINK( this, ListBox, ImplSelectHdl ) );
mpImplLB->SetScrollHdl( LINK( this, ListBox, ImplScrollHdl ) );
mpImplLB->SetCancelHdl( LINK( this, ListBox, ImplCancelHdl ) );
@@ -173,7 +175,7 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
mpImplLB->SetSelectionChangedHdl( LINK( this, ListBox, ImplSelectionChangedHdl ) );
}
else
- mpImplLB->GetMainWindow().AllowGrabFocus( true );
+ mpImplLB->GetMainWindow()->AllowGrabFocus( true );
SetCompoundControl( true );
}
@@ -311,7 +313,7 @@ void ListBox::ImplClickButtonHandler( Control* )
ImplClearLayoutData();
if( mpImplLB )
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
if( mpImplWin )
mpImplWin->ImplClearLayoutData();
}
@@ -341,7 +343,7 @@ IMPL_LINK_NOARG(ListBox, ImplPopupModeEndHdl)
ImplClearLayoutData();
if( mpImplLB )
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
if( mpImplWin )
mpImplWin->ImplClearLayoutData();
@@ -369,11 +371,11 @@ void ListBox::ToggleDropDown()
void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
{
- mpImplLB->GetMainWindow().ImplInitSettings( true, true, true );
+ mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true );
Point aPos = pDev->LogicToPixel( rPos );
Size aSize = pDev->LogicToPixel( rSize );
- vcl::Font aFont = mpImplLB->GetMainWindow().GetDrawPixelFont( pDev );
+ vcl::Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
OutDevType eOutDevType = pDev->GetOutDevType();
pDev->Push();
@@ -519,9 +521,15 @@ vcl::Window* ListBox::GetPreferredKeyInputWindow()
void ListBox::LoseFocus()
{
if( IsDropDownBox() )
- mpImplWin->HideFocus();
+ {
+ if (mpImplWin)
+ mpImplWin->HideFocus();
+ }
else
- mpImplLB->HideFocus();
+ {
+ if (mpImplLB)
+ mpImplLB->HideFocus();
+ }
Control::LoseFocus();
}
@@ -691,7 +699,7 @@ void ListBox::Resize()
void ListBox::FillLayoutData() const
{
mpControlData->mpLayoutData = new vcl::ControlLayoutData();
- const Control& rMainWin = mpImplLB->GetMainWindow();
+ const ImplListBoxWindow* rMainWin = mpImplLB->GetMainWindow();
if( mpFloatWin )
{
// Dropdown mode
@@ -699,14 +707,14 @@ void ListBox::FillLayoutData() const
mpImplWin->SetLayoutDataParent( this );
if( mpFloatWin->IsReallyVisible() )
{
- AppendLayoutData( rMainWin );
- rMainWin.SetLayoutDataParent( this );
+ AppendLayoutData( *rMainWin );
+ rMainWin->SetLayoutDataParent( this );
}
}
else
{
- AppendLayoutData( rMainWin );
- rMainWin.SetLayoutDataParent( this );
+ AppendLayoutData( *rMainWin );
+ rMainWin->SetLayoutDataParent( this );
}
}
@@ -721,16 +729,16 @@ long ListBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) const
{
// Point must be either in main list window
// or in impl window (dropdown case)
- ImplListBoxWindow& rMain = mpImplLB->GetMainWindow();
+ ImplListBoxWindow* rMain = mpImplLB->GetMainWindow();
// Convert coordinates to ImplListBoxWindow pixel coordinate space
Point aConvPoint = LogicToPixel( rPoint );
aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
- aConvPoint = rMain.AbsoluteScreenToOutputPixel( aConvPoint );
- aConvPoint = rMain.PixelToLogic( aConvPoint );
+ aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPoint );
+ aConvPoint = rMain->PixelToLogic( aConvPoint );
// Try to find entry
- sal_Int32 nEntry = rMain.GetEntryPosForPoint( aConvPoint );
+ sal_Int32 nEntry = rMain->GetEntryPosForPoint( aConvPoint );
if( nEntry == LISTBOX_ENTRY_NOTFOUND )
{
// Not found, maybe dropdown case
@@ -803,7 +811,7 @@ void ListBox::StateChanged( StateChangedType nType )
if ( mpImplWin )
{
mpImplWin->SetZoom( GetZoom() );
- mpImplWin->SetFont( mpImplLB->GetMainWindow().GetFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
mpImplWin->Invalidate();
}
Resize();
@@ -814,7 +822,7 @@ void ListBox::StateChanged( StateChangedType nType )
if ( mpImplWin )
{
mpImplWin->SetControlFont( GetControlFont() );
- mpImplWin->SetFont( mpImplLB->GetMainWindow().GetFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
mpImplWin->Invalidate();
}
Resize();
@@ -826,7 +834,7 @@ void ListBox::StateChanged( StateChangedType nType )
{
mpImplWin->SetControlForeground( GetControlForeground() );
mpImplWin->SetTextColor( GetControlForeground() );
- mpImplWin->SetFont( mpImplLB->GetMainWindow().GetFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
mpImplWin->Invalidate();
}
}
@@ -843,17 +851,17 @@ void ListBox::StateChanged( StateChangedType nType )
}
else
{
- mpImplWin->SetBackground( mpImplLB->GetMainWindow().GetControlBackground() );
- mpImplWin->SetControlBackground( mpImplLB->GetMainWindow().GetControlBackground() );
+ mpImplWin->SetBackground( mpImplLB->GetMainWindow()->GetControlBackground() );
+ mpImplWin->SetControlBackground( mpImplLB->GetMainWindow()->GetControlBackground() );
}
- mpImplWin->SetFont( mpImplLB->GetMainWindow().GetFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
mpImplWin->Invalidate();
}
}
else if ( nType == StateChangedType::STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
- mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) != 0 );
+ mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) != 0 );
bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
}
@@ -1157,8 +1165,8 @@ bool ListBox::IsInDropDown() const
Rectangle ListBox::GetBoundingRectangle( sal_Int32 nItem ) const
{
- Rectangle aRect = mpImplLB->GetMainWindow().GetBoundingRectangle( nItem );
- Rectangle aOffset = mpImplLB->GetMainWindow().GetWindowExtentsRelative( (vcl::Window*)this );
+ Rectangle aRect = mpImplLB->GetMainWindow()->GetBoundingRectangle( nItem );
+ Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( (vcl::Window*)this );
aRect.Move( aOffset.TopLeft().X(), aOffset.TopLeft().Y() );
return aRect;
}
@@ -1180,7 +1188,7 @@ void ListBox::EnableMultiSelection( bool bMulti, bool bStackSelection )
// In a MultiSelection, we can't see us travelling without focus
if ( mpFloatWin )
- mpImplLB->GetMainWindow().AllowGrabFocus( bMulti );
+ mpImplLB->GetMainWindow()->AllowGrabFocus( bMulti );
}
bool ListBox::IsMultiSelectionEnabled() const
@@ -1348,7 +1356,7 @@ void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines
float nCharWidth = approximate_char_width();
if ( !IsDropDownBox() )
{
- Size aOutSz = mpImplLB->GetMainWindow().GetOutputSizePixel();
+ Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel();
rnCols = (sal_uInt16) (aOutSz.Width()/nCharWidth);
rnLines = (sal_uInt16) (aOutSz.Height()/mpImplLB->GetEntryHeight());
}
@@ -1371,22 +1379,22 @@ void ListBox::UserDraw( const UserDrawEvent& )
void ListBox::DrawEntry( const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos )
{
- if ( rEvt.GetDevice() == &mpImplLB->GetMainWindow() )
- mpImplLB->GetMainWindow().DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
+ if ( rEvt.GetDevice() == mpImplLB->GetMainWindow() )
+ mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
else if ( rEvt.GetDevice() == mpImplWin )
mpImplWin->DrawEntry( bDrawImage, bDrawText, bDrawTextAtImagePos );
}
void ListBox::SetUserItemSize( const Size& rSz )
{
- mpImplLB->GetMainWindow().SetUserItemSize( rSz );
+ mpImplLB->GetMainWindow()->SetUserItemSize( rSz );
if ( mpImplWin )
mpImplWin->SetUserItemSize( rSz );
}
void ListBox::EnableUserDraw( bool bUserDraw )
{
- mpImplLB->GetMainWindow().EnableUserDraw( bUserDraw );
+ mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw );
if ( mpImplWin )
mpImplWin->EnableUserDraw( bUserDraw );
}
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index a78c5612ec86..314c41ab7f9f 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -82,8 +82,14 @@ MenuButton::MenuButton( vcl::Window* pParent, WinBits nWinBits )
MenuButton::~MenuButton()
{
+ disposeOnce();
+}
+
+void MenuButton::dispose()
+{
delete mpMenuTimer;
delete mpOwnMenu;
+ PushButton::dispose();
}
IMPL_LINK_NOARG(MenuButton, ImplMenuTimeoutHdl)
diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx
index 95cd171afd81..999c3c308d73 100644
--- a/vcl/source/control/morebtn.cxx
+++ b/vcl/source/control/morebtn.cxx
@@ -22,7 +22,7 @@
#include <tools/rc.h>
#include <vector>
-typedef ::std::vector< vcl::Window* > ImplMoreWindowList;
+typedef ::std::vector< VclPtr<vcl::Window> > ImplMoreWindowList;
struct ImplMoreButtonData
{
@@ -80,8 +80,14 @@ MoreButton::MoreButton( vcl::Window* pParent, WinBits nStyle ) :
MoreButton::~MoreButton()
{
+ disposeOnce();
+}
+
+void MoreButton::dispose()
+{
delete mpMBData->mpItemList;
delete mpMBData;
+ PushButton::dispose();
}
void MoreButton::Click()
diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx
index d6443cd16515..a89afac723bb 100644
--- a/vcl/source/control/prgsbar.cxx
+++ b/vcl/source/control/prgsbar.cxx
@@ -56,10 +56,6 @@ ProgressBar::ProgressBar( vcl::Window* pParent, WinBits nWinStyle ) :
ImplInit();
}
-ProgressBar::~ProgressBar()
-{
-}
-
void ProgressBar::ImplInitSettings( bool bFont,
bool bForeground, bool bBackground )
{
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index e31391d27ab3..b239c623e3ff 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -125,7 +125,13 @@ ScrollBar::ScrollBar( vcl::Window* pParent, WinBits nStyle ) :
ScrollBar::~ScrollBar()
{
- delete mpData;
+ disposeOnce();
+}
+
+void ScrollBar::dispose()
+{
+ delete mpData; mpData = NULL;
+ Control::dispose();
}
void ScrollBar::ImplUpdateRects( bool bUpdate )
diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx
index 9b16b4753751..c9feafa07663 100644
--- a/vcl/source/control/spinbtn.cxx
+++ b/vcl/source/control/spinbtn.cxx
@@ -55,10 +55,6 @@ SpinButton::SpinButton( vcl::Window* pParent, WinBits nStyle )
ImplInit( pParent, nStyle );
}
-SpinButton::~SpinButton()
-{
-}
-
IMPL_LINK( SpinButton, ImplTimeout, Timer*, pTimer )
{
if ( pTimer->GetTimeout() == GetSettings().GetMouseSettings().GetButtonStartRepeat() )
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 972bded96429..fe1feea8ef05 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -286,7 +286,7 @@ void ImplDrawSpinButton( OutputDevice* pOutDev,
void SpinField::ImplInitSpinFieldData()
{
- mpEdit = NULL;
+ mpEdit.disposeAndClear();
mbSpin = false;
mbRepeat = false;
mbUpperIn = false;
@@ -311,11 +311,11 @@ void SpinField::ImplInit( vcl::Window* pParent, WinBits nWinStyle )
if ( (nWinStyle & WB_SPIN) && ImplUseNativeBorder( nWinStyle ) )
{
SetBackground();
- mpEdit = new Edit( this, WB_NOBORDER );
+ mpEdit.set( VclPtr<Edit>::Create( this, WB_NOBORDER ) );
mpEdit->SetBackground();
}
else
- mpEdit = new Edit( this, WB_NOBORDER );
+ mpEdit.set( VclPtr<Edit>::Create( this, WB_NOBORDER ) );
mpEdit->EnableRTL( false );
mpEdit->SetPosPixel( Point() );
@@ -359,7 +359,14 @@ SpinField::SpinField( vcl::Window* pParent, const ResId& rResId ) :
SpinField::~SpinField()
{
- delete mpEdit;
+ disposeOnce();
+}
+
+void SpinField::dispose()
+{
+ mpEdit.disposeAndClear();
+
+ Edit::dispose();
}
void SpinField::Up()
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index ca63e5485d68..3bf2d59598d6 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -42,7 +42,7 @@
struct ImplTabItem
{
sal_uInt16 mnId;
- TabPage* mpTabPage;
+ VclPtr<TabPage> mpTabPage;
OUString maText;
OUString maFormatText;
OUString maHelpText;
@@ -67,7 +67,7 @@ struct ImplTabCtrlData
std::vector< Rectangle > maTabRectangles;
Point maItemsOffset; // offset of the tabitems
std::vector< ImplTabItem > maItemList;
- ListBox* mpListBox;
+ VclPtr<ListBox> mpListBox;
};
#define TAB_OFFSET 3
@@ -112,7 +112,7 @@ void TabControl::ImplInit( vcl::Window* pParent, WinBits nStyle )
if( (nStyle & WB_DROPDOWN) )
{
- mpTabCtrlData->mpListBox = new ListBox( this, WB_DROPDOWN );
+ mpTabCtrlData->mpListBox = VclPtr<ListBox>::Create( this, WB_DROPDOWN );
mpTabCtrlData->mpListBox->SetPosSizePixel( Point( 0, 0 ), Size( 200, 20 ) );
mpTabCtrlData->mpListBox->SetSelectHdl( LINK( this, TabControl, ImplListBoxSelectHdl ) );
mpTabCtrlData->mpListBox->Show();
@@ -192,6 +192,11 @@ TabControl::TabControl( vcl::Window* pParent, WinBits nStyle ) :
TabControl::~TabControl()
{
+ disposeOnce();
+}
+
+void TabControl::dispose()
+{
Window *pParent = GetParent();
if (pParent && pParent->IsDialog())
GetParent()->RemoveChildEventListener( LINK( this, TabControl, ImplWindowEventListener ) );
@@ -199,12 +204,11 @@ TabControl::~TabControl()
ImplFreeLayoutData();
// delete TabCtrl data
- if ( mpTabCtrlData )
- {
- if( mpTabCtrlData->mpListBox )
- delete mpTabCtrlData->mpListBox;
- delete mpTabCtrlData;
- }
+ if (mpTabCtrlData)
+ mpTabCtrlData->mpListBox.disposeAndClear();
+ delete mpTabCtrlData;
+ mpTabCtrlData = NULL;
+ Control::dispose();
}
ImplTabItem* TabControl::ImplGetItem( sal_uInt16 nId ) const
@@ -574,9 +578,9 @@ void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId )
ImplTabItem* pOldItem = ImplGetItem( nOldId );
ImplTabItem* pItem = ImplGetItem( nId );
- TabPage* pOldPage = (pOldItem) ? pOldItem->mpTabPage : NULL;
- TabPage* pPage = (pItem) ? pItem->mpTabPage : NULL;
- vcl::Window* pCtrlParent = GetParent();
+ TabPage* pOldPage = (pOldItem) ? pOldItem->mpTabPage.get() : NULL;
+ TabPage* pPage = (pItem) ? pItem->mpTabPage.get() : NULL;
+ vcl::Window* pCtrlParent = GetParent();
if ( IsReallyVisible() && IsUpdateMode() )
{
@@ -1013,7 +1017,7 @@ IMPL_LINK( TabControl, ImplWindowEventListener, VclSimpleEvent*, pEvent )
void TabControl::MouseButtonDown( const MouseEvent& rMEvt )
{
- if( mpTabCtrlData->mpListBox == NULL )
+ if( mpTabCtrlData->mpListBox.get() == NULL )
{
if( rMEvt.IsLeft() )
{
@@ -1083,7 +1087,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout )
// in this case we're only interested in the top border of the tabpage because the tabitems are used
// standalone (eg impress)
bool bNoTabPage = false;
- TabPage* pCurPage = pCurItem ? pCurItem->mpTabPage : NULL;
+ TabPage* pCurPage = pCurItem ? pCurItem->mpTabPage.get() : NULL;
if( !pCurPage || !pCurPage->IsVisible() )
{
bNoTabPage = true;
@@ -1169,7 +1173,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout )
}
}
- if ( !mpTabCtrlData->maItemList.empty() && mpTabCtrlData->mpListBox == NULL )
+ if ( !mpTabCtrlData->maItemList.empty() && mpTabCtrlData->mpListBox == nullptr )
{
// Some native toolkits (GTK+) draw tabs right-to-left, with an
// overlap between adjacent tabs
@@ -1427,7 +1431,7 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt )
void TabControl::Command( const CommandEvent& rCEvt )
{
- if( (mpTabCtrlData->mpListBox == NULL) && (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) )
+ if( (mpTabCtrlData->mpListBox == nullptr) && (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) )
{
Point aMenuPos;
bool bMenu;
@@ -1879,7 +1883,7 @@ void TabControl::SetTabPage( sal_uInt16 nPageId, TabPage* pTabPage )
{
ImplTabItem* pItem = ImplGetItem( nPageId );
- if ( pItem && (pItem->mpTabPage != pTabPage) )
+ if ( pItem && (pItem->mpTabPage.get() != pTabPage) )
{
if ( pTabPage )
{
diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx
index 347f24a32e31..eedadc4e5637 100644
--- a/vcl/source/control/throbber.cxx
+++ b/vcl/source/control/throbber.cxx
@@ -59,7 +59,13 @@ Throbber::Throbber( vcl::Window* i_parentWindow, WinBits i_style, const ImageSet
Throbber::~Throbber()
{
+ disposeOnce();
+}
+
+void Throbber::dispose()
+{
maWaitTimer.Stop();
+ ImageControl::dispose();
}
namespace
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index f4a11a2d0ec3..235dd138be99 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -116,7 +116,7 @@ TextEngine::~TextEngine()
delete mpDoc;
delete mpTEParaPortions;
delete mpViews; // only the list, not the Views
- delete mpRefDev;
+ mpRefDev.disposeAndClear();
delete mpUndoManager;
delete mpIMEInfos;
delete mpLocaleDataWrapper;
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 768125bf2a35..2dd8da99768f 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -147,7 +147,7 @@ struct ImpTextView
{
TextEngine* mpTextEngine;
- vcl::Window* mpWindow;
+ VclPtr<vcl::Window> mpWindow;
TextSelection maSelection;
Point maStartDocPos;
// TextPaM maMBDownPaM;
@@ -156,7 +156,7 @@ struct ImpTextView
TextDDInfo* mpDDInfo;
- VirtualDevice* mpVirtDev;
+ VclPtr<VirtualDevice> mpVirtDev;
SelectionEngine* mpSelEngine;
TextSelFunctionSet* mpSelFuncSet;
@@ -235,7 +235,7 @@ TextView::~TextView()
{
delete mpImpl->mpSelEngine;
delete mpImpl->mpSelFuncSet;
- delete mpImpl->mpVirtDev;
+ mpImpl->mpVirtDev.disposeAndClear();
if ( mpImpl->mpWindow->GetCursor() == mpImpl->mpCursor )
mpImpl->mpWindow->SetCursor( 0 );
@@ -541,8 +541,7 @@ VirtualDevice* TextView::GetVirtualDevice()
void TextView::EraseVirtualDevice()
{
- delete mpImpl->mpVirtDev;
- mpImpl->mpVirtDev = 0;
+ mpImpl->mpVirtDev.disposeAndClear();
}
bool TextView::KeyInput( const KeyEvent& rKeyEvent )
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index dd46cdad48fd..cc3a5898cab7 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -47,7 +47,8 @@ private:
public:
TextWindow( vcl::Window* pParent );
- virtual ~TextWindow();
+ virtual ~TextWindow();
+ virtual void dispose() SAL_OVERRIDE;
ExtTextEngine* GetTextEngine() const { return mpExtTextEngine; }
ExtTextView* GetTextView() const { return mpExtTextView; }
@@ -75,12 +76,12 @@ public:
class ImpVclMEdit : public SfxListener
{
private:
- VclMultiLineEdit* pVclMultiLineEdit;
+ VclPtr<VclMultiLineEdit> pVclMultiLineEdit;
- TextWindow* mpTextWindow;
- ScrollBar* mpHScrollBar;
- ScrollBar* mpVScrollBar;
- ScrollBarBox* mpScrollBox;
+ VclPtr<TextWindow> mpTextWindow;
+ VclPtr<ScrollBar> mpHScrollBar;
+ VclPtr<ScrollBar> mpVScrollBar;
+ VclPtr<ScrollBarBox> mpScrollBox;
Point maTextWindowOffset;
sal_Int32 mnTextWidth;
@@ -152,7 +153,7 @@ ImpVclMEdit::ImpVclMEdit( VclMultiLineEdit* pEdt, WinBits nWinStyle )
{
pVclMultiLineEdit = pEdt;
mnTextWidth = 0;
- mpTextWindow = new TextWindow( pEdt );
+ mpTextWindow = VclPtr<TextWindow>::Create( pEdt );
mpTextWindow->Show();
InitFromStyle( nWinStyle );
StartListening( *mpTextWindow->GetTextEngine() );
@@ -160,9 +161,9 @@ ImpVclMEdit::ImpVclMEdit( VclMultiLineEdit* pEdt, WinBits nWinStyle )
void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
{
- const bool bHaveVScroll = (NULL != mpVScrollBar);
- const bool bHaveHScroll = (NULL != mpHScrollBar);
- const bool bHaveScrollBox = (NULL != mpScrollBox);
+ const bool bHaveVScroll = (nullptr != mpVScrollBar);
+ const bool bHaveHScroll = (nullptr != mpHScrollBar);
+ const bool bHaveScrollBox = (nullptr != mpScrollBox);
bool bNeedVScroll = ( nWinStyle & WB_VSCROLL ) == WB_VSCROLL;
const bool bNeedHScroll = ( nWinStyle & WB_HSCROLL ) == WB_HSCROLL;
@@ -183,8 +184,8 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
bool bScrollbarsChanged = false;
if ( bHaveVScroll != bNeedVScroll )
{
- delete mpVScrollBar;
- mpVScrollBar = bNeedVScroll ? new ScrollBar( pVclMultiLineEdit, WB_VSCROLL|WB_DRAG ) : NULL;
+ mpVScrollBar.disposeAndClear();
+ mpVScrollBar = bNeedVScroll ? VclPtr<ScrollBar>::Create( pVclMultiLineEdit, WB_VSCROLL|WB_DRAG ) : nullptr;
if ( bNeedVScroll )
{
@@ -197,8 +198,8 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
if ( bHaveHScroll != bNeedHScroll )
{
- delete mpHScrollBar;
- mpHScrollBar = bNeedHScroll ? new ScrollBar( pVclMultiLineEdit, WB_HSCROLL|WB_DRAG ) : NULL;
+ mpHScrollBar.disposeAndClear();
+ mpHScrollBar = bNeedHScroll ? VclPtr<ScrollBar>::Create( pVclMultiLineEdit, WB_HSCROLL|WB_DRAG ) : nullptr;
if ( bNeedHScroll )
{
@@ -211,8 +212,8 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
if ( bHaveScrollBox != bNeedScrollBox )
{
- delete mpScrollBox;
- mpScrollBox = bNeedScrollBox ? new ScrollBarBox( pVclMultiLineEdit, WB_SIZEABLE ) : NULL;
+ mpScrollBox.disposeAndClear();
+ mpScrollBox = bNeedScrollBox ? VclPtr<ScrollBarBox>::Create( pVclMultiLineEdit, WB_SIZEABLE ) : nullptr;
if ( bNeedScrollBox )
mpScrollBox->Show();
@@ -257,10 +258,11 @@ void ImpVclMEdit::InitFromStyle( WinBits nWinStyle )
ImpVclMEdit::~ImpVclMEdit()
{
EndListening( *mpTextWindow->GetTextEngine() );
- delete mpTextWindow;
- delete mpHScrollBar;
- delete mpVScrollBar;
- delete mpScrollBox;
+ mpTextWindow.disposeAndClear();
+ mpHScrollBar.disposeAndClear();
+ mpVScrollBar.disposeAndClear();
+ mpScrollBox.disposeAndClear();
+ pVclMultiLineEdit.disposeAndClear();
}
void ImpVclMEdit::ImpSetScrollBarRanges()
@@ -730,8 +732,14 @@ TextWindow::TextWindow( vcl::Window* pParent ) : Window( pParent )
TextWindow::~TextWindow()
{
+ disposeOnce();
+}
+
+void TextWindow::dispose()
+{
delete mpExtTextView;
delete mpExtTextEngine;
+ Window::dispose();
}
void TextWindow::MouseMove( const MouseEvent& rMEvt )
@@ -937,11 +945,19 @@ VclMultiLineEdit::VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle )
VclMultiLineEdit::~VclMultiLineEdit()
{
+ disposeOnce();
+}
+
+void VclMultiLineEdit::dispose()
+{
{
std::unique_ptr< ImpVclMEdit > xDelete(pImpVclMEdit);
pImpVclMEdit = NULL;
}
delete pUpdateDataTimer;
+ pUpdateDataTimer = NULL;
+
+ Edit::dispose();
}
WinBits VclMultiLineEdit::ImplInitStyle( WinBits nStyle )
@@ -1145,17 +1161,17 @@ void VclMultiLineEdit::SetText( const OUString& rStr )
OUString VclMultiLineEdit::GetText() const
{
- return pImpVclMEdit->GetText();
+ return pImpVclMEdit ? pImpVclMEdit->GetText() : OUString("");
}
OUString VclMultiLineEdit::GetText( LineEnd aSeparator ) const
{
- return pImpVclMEdit->GetText( aSeparator );
+ return pImpVclMEdit ? pImpVclMEdit->GetText( aSeparator ) : OUString("");
}
-OUString VclMultiLineEdit::GetTextLines( LineEnd aSeparator ) const
+OUString VclMultiLineEdit::GetTextLines( LineEnd aSeparator ) const
{
- return pImpVclMEdit->GetTextLines( aSeparator );
+ return pImpVclMEdit ? pImpVclMEdit->GetTextLines( aSeparator ) : OUString("");
}
void VclMultiLineEdit::Resize()
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 147070e52810..961679796fc7 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1892,16 +1892,16 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
{
Size aSizePixel;
sal_uLong nColorCount,nBitsPerPixel,nNeededMem,nMaxMem;
- VirtualDevice aVirDev;
+ ScopedVclPtrInstance< VirtualDevice > aVirDev;
nMaxMem = 1024;
nMaxMem *= 1024; // In Bytes
// Calculate how big the image would normally be:
- aSizePixel=aVirDev.LogicToPixel(aGraphic.GetPrefSize(),aGraphic.GetPrefMapMode());
+ aSizePixel=aVirDev->LogicToPixel(aGraphic.GetPrefSize(),aGraphic.GetPrefMapMode());
// Calculate how much memory the image will take up
- nColorCount=aVirDev.GetColorCount();
+ nColorCount=aVirDev->GetColorCount();
if (nColorCount<=2) nBitsPerPixel=1;
else if (nColorCount<=4) nBitsPerPixel=2;
else if (nColorCount<=16) nBitsPerPixel=4;
@@ -1918,12 +1918,12 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
aSizePixel.Height()=(sal_uLong)(((double)aSizePixel.Height())*fFak);
}
- aVirDev.SetMapMode(MapMode(MAP_PIXEL));
- aVirDev.SetOutputSizePixel(aSizePixel);
+ aVirDev->SetMapMode(MapMode(MAP_PIXEL));
+ aVirDev->SetOutputSizePixel(aSizePixel);
Graphic aGraphic2=aGraphic;
- aGraphic2.Draw(&aVirDev,Point(0,0),aSizePixel); // this changes the MapMode
- aVirDev.SetMapMode(MapMode(MAP_PIXEL));
- aGraphic=Graphic(aVirDev.GetBitmap(Point(0,0),aSizePixel));
+ aGraphic2.Draw(aVirDev.get(),Point(0,0),aSizePixel); // this changes the MapMode
+ aVirDev->SetMapMode(MapMode(MAP_PIXEL));
+ aGraphic=Graphic(aVirDev->GetBitmap(Point(0,0),aSizePixel));
}
}
if( rOStm.GetError() )
diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx
index 8e9d167cd486..277e4af32366 100644
--- a/vcl/source/filter/sgfbram.cxx
+++ b/vcl/source/filter/sgfbram.cxx
@@ -390,7 +390,7 @@ Color Hpgl2SvFarbe( sal_uInt8 nFarb )
bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMtf)
{
- VirtualDevice aOutDev;
+ ScopedVclPtrInstance< VirtualDevice > aOutDev;
SgfVector aVect;
sal_uInt8 nFarb;
sal_uInt8 nFrb0=7;
@@ -401,9 +401,9 @@ bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMt
Point aP1(0,0);
sal_uInt16 RecNr=0;
- rMtf.Record(&aOutDev);
- aOutDev.SetLineColor(Color(COL_BLACK));
- aOutDev.SetFillColor(Color(COL_BLACK));
+ rMtf.Record(aOutDev.get());
+ aOutDev->SetLineColor(Color(COL_BLACK));
+ aOutDev->SetFillColor(Color(COL_BLACK));
while (!bEoDt && !rInp.GetError()) {
ReadSgfVector( rInp, aVect ); RecNr++;
@@ -429,15 +429,15 @@ bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMt
switch(nOTyp) {
case 1: if (nFarb!=nFrb0) {
switch(rHead.SwGrCol) {
- case SgfVectFarb: aOutDev.SetLineColor(Hpgl2SvFarbe(nFarb)); break;
+ case SgfVectFarb: aOutDev->SetLineColor(Hpgl2SvFarbe(nFarb)); break;
case SgfVectGray: break;
case SgfVectWdth: break;
}
}
- aOutDev.DrawLine(aP0,aP1); break; // line
+ aOutDev->DrawLine(aP0,aP1); break; // line
case 2: break; // circle
case 3: break; // text
- case 5: aOutDev.DrawRect(Rectangle(aP0,aP1)); break; // rectangle (solid)
+ case 5: aOutDev->DrawRect(Rectangle(aP0,aP1)); break; // rectangle (solid)
}
}
aP0=aP1;
diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx
index 63526dccecad..ca754c28e4d9 100644
--- a/vcl/source/filter/sgvmain.cxx
+++ b/vcl/source/filter/sgvmain.cxx
@@ -794,13 +794,13 @@ bool SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf )
{
bool bRet = false;
PageType aPage;
- VirtualDevice aOutDev;
+ ScopedVclPtrInstance< VirtualDevice > aOutDev;
OutputDevice* pOutDev;
sal_uLong nStdPos;
sal_uLong nCharPos;
sal_uInt16 Num;
- pOutDev=&aOutDev;
+ pOutDev=aOutDev.get();
DtHdOverSeek(rInp); // read dataheader
nStdPos=rInp.Tell();
diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx
index 2a01dbcb3ae9..290ff1427912 100644
--- a/vcl/source/filter/sgvtext.cxx
+++ b/vcl/source/filter/sgvtext.cxx
@@ -660,7 +660,7 @@ void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType&
double, double,
UCHAR* cLine, bool TextFit)
{
- VirtualDevice vOut;
+ ScopedVclPtrInstance< VirtualDevice > vOut;
UCHAR c,c0;
bool First; // first char ?
sal_uInt8 Just = 0; // paragraph format
@@ -684,18 +684,18 @@ void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType&
sal_uInt16 i,j,k,h;
sal_uInt16 re,li;
- vOut.SetMapMode(MapMode(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4)));
+ vOut->SetMapMode(MapMode(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4)));
nChars=0;
- SetTextContext(vOut,AktAtr,false,0,1,1,1,1);
+ SetTextContext(*vOut.get(),AktAtr,false,0,1,1,1,1);
InitProcessCharState(*R,AktAtr,Index);
(*R0)=(*R); (*WErec)=(*R); WEnChar=0; c0=0; Border0=false;
Border=false; First=true;
WordEndCnt=0;
do { // check how many words to on that line
- if (Border) c=ProcessChar(vOut,TBuf,*R,Atr0,nChars,DoTrenn,Line,cLine);
- else c=ProcessChar(vOut,TBuf,*R,Atr0,nChars,NoTrenn,Line,cLine);
+ if (Border) c=ProcessChar(*vOut.get(),TBuf,*R,Atr0,nChars,DoTrenn,Line,cLine);
+ else c=ProcessChar(*vOut.get(),TBuf,*R,Atr0,nChars,NoTrenn,Line,cLine);
AbsEnd=(c==AbsatzEnd || c==TextEnd);
//if not AbsEnd then
{
@@ -729,8 +729,8 @@ void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType&
(*TRrec)=(*R); TRnChar=nChars;
Border0=false; Border=false;
do { // first check how many syllables fit
- UCHAR ct=ProcessChar(vOut,TBuf,*TRrec,Atr0,TRnChar,DoTrenn,Line,cLine);
- c=ProcessChar(vOut,TBuf,*R,Atr0,nChars,NoTrenn,Line,cLine);
+ UCHAR ct=ProcessChar(*vOut.get(),TBuf,*TRrec,Atr0,TRnChar,DoTrenn,Line,cLine);
+ c=ProcessChar(*vOut.get(),TBuf,*R,Atr0,nChars,NoTrenn,Line,cLine);
AbsEnd=(ct==AbsatzEnd) || (ct==TextEnd) || (nChars>=MaxLineChars);
Border=TRrec->ChrXP>UmbWdt;
@@ -754,7 +754,7 @@ void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType&
} while (!(AbsEnd || (Border && ((WordEndCnt>0) || WordEnd || Trenn))));
while (WErec0->Index<WErec->Index) { // to assure Line[] matches }
- ProcessChar(vOut,TBuf,*WErec0,Atr0,WEnChar0,WEnChar-WEnChar0-1,Line,cLine);
+ ProcessChar(*vOut.get(),TBuf,*WErec0,Atr0,WEnChar0,WEnChar-WEnChar0-1,Line,cLine);
}
(*R)=(*WErec); nChars=WEnChar;
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index ea74f6b618ad..3d50e2667bd9 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -266,7 +266,7 @@ void EMFWriter::ImplWritePlusColor( const Color& rColor, const sal_uInt32& nTran
void EMFWriter::ImplWritePlusPoint( const Point& rPoint )
{
// Convert to pixels
- const Point aPoint(maVDev.LogicToPixel( rPoint, maDestMapMode ));
+ const Point aPoint(maVDev->LogicToPixel( rPoint, maDestMapMode ));
m_rStm.WriteUInt16( aPoint.X() ).WriteUInt16( aPoint.Y() );
}
@@ -276,7 +276,7 @@ void EMFWriter::ImplWritePlusFillPolygonRecord( const Polygon& rPoly, const sal_
if( rPoly.GetSize() )
{
ImplBeginPlusRecord( EmfPlusFillPolygon, 0xC000 ); // Sets the color as well
- ImplWritePlusColor( maVDev.GetFillColor(), nTrans );
+ ImplWritePlusColor( maVDev->GetFillColor(), nTrans );
m_rStm.WriteUInt32( rPoly.GetSize() );
for( sal_uInt16 i = 0; i < rPoly.GetSize(); i++ )
ImplWritePlusPoint( rPoly[ i ] );
@@ -289,8 +289,8 @@ bool EMFWriter::WriteEMF(const GDIMetaFile& rMtf)
{
const sal_uLong nHeaderPos = m_rStm.Tell();
- maVDev.EnableOutput( false );
- maVDev.SetMapMode( rMtf.GetPrefMapMode() );
+ maVDev->EnableOutput( false );
+ maVDev->SetMapMode( rMtf.GetPrefMapMode() );
// don't work with pixel as destination map mode -> higher resolution preferrable
maDestMapMode.SetMapUnit( MAP_100TH_MM );
mpHandlesUsed = new bool[ MAXHANDLES ];
@@ -301,7 +301,7 @@ bool EMFWriter::WriteEMF(const GDIMetaFile& rMtf)
mnLineHandle = mnFillHandle = mnTextHandle = HANDLE_INVALID;
mnHorTextAlign = 0;
- const Size aMtfSizePix( maVDev.LogicToPixel( rMtf.GetPrefSize(), rMtf.GetPrefMapMode() ) );
+ const Size aMtfSizePix( maVDev->LogicToPixel( rMtf.GetPrefSize(), rMtf.GetPrefMapMode() ) );
const Size aMtfSizeLog( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_100TH_MM ) );
// seek over header
@@ -319,7 +319,7 @@ bool EMFWriter::WriteEMF(const GDIMetaFile& rMtf)
ImplEndRecord();
ImplBeginRecord( WIN_EMR_SETVIEWPORTEXTEX );
- m_rStm.WriteInt32( maVDev.GetDPIX() ).WriteInt32( maVDev.GetDPIY() );
+ m_rStm.WriteInt32( maVDev->GetDPIX() ).WriteInt32( maVDev->GetDPIY() );
ImplEndRecord();
ImplBeginRecord( WIN_EMR_SETWINDOWEXTEX );
@@ -466,12 +466,12 @@ void EMFWriter::ImplCheckLineAttr()
{
if( mbLineChanged && ImplPrepareHandleSelect( mnLineHandle, LINE_SELECT ) )
{
- sal_uInt32 nStyle = maVDev.IsLineColor() ? 0 : 5;
+ sal_uInt32 nStyle = maVDev->IsLineColor() ? 0 : 5;
sal_uInt32 nWidth = 0, nHeight = 0;
ImplBeginRecord( WIN_EMR_CREATEPEN );
m_rStm.WriteUInt32( mnLineHandle ).WriteUInt32( nStyle ).WriteUInt32( nWidth ).WriteUInt32( nHeight );
- ImplWriteColor( maVDev.GetLineColor() );
+ ImplWriteColor( maVDev->GetLineColor() );
ImplEndRecord();
ImplBeginRecord( WIN_EMR_SELECTOBJECT );
@@ -484,12 +484,12 @@ void EMFWriter::ImplCheckFillAttr()
{
if( mbFillChanged && ImplPrepareHandleSelect( mnFillHandle, FILL_SELECT ) )
{
- sal_uInt32 nStyle = maVDev.IsFillColor() ? 0 : 1;
+ sal_uInt32 nStyle = maVDev->IsFillColor() ? 0 : 1;
sal_uInt32 nPatternStyle = 0;
ImplBeginRecord( WIN_EMR_CREATEBRUSHINDIRECT );
m_rStm.WriteUInt32( mnFillHandle ).WriteUInt32( nStyle );
- ImplWriteColor( maVDev.GetFillColor() );
+ ImplWriteColor( maVDev->GetFillColor() );
m_rStm.WriteUInt32( nPatternStyle );
ImplEndRecord();
@@ -503,7 +503,7 @@ void EMFWriter::ImplCheckTextAttr()
{
if( mbTextChanged && ImplPrepareHandleSelect( mnTextHandle, TEXT_SELECT ) )
{
- const vcl::Font& rFont = maVDev.GetFont();
+ const vcl::Font& rFont = maVDev->GetFont();
OUString aFontName( rFont.GetName() );
sal_Int32 nWeight;
sal_uInt16 i;
@@ -601,7 +601,7 @@ void EMFWriter::ImplCheckTextAttr()
// Text color
ImplBeginRecord( WIN_EMR_SETTEXTCOLOR );
- ImplWriteColor( maVDev.GetTextColor() );
+ ImplWriteColor( maVDev->GetTextColor() );
ImplEndRecord();
ImplBeginRecord( WIN_EMR_SELECTOBJECT );
@@ -638,25 +638,25 @@ void EMFWriter::ImplWriteRasterOp( RasterOp eRop )
void EMFWriter::ImplWriteExtent( long nExtent )
{
- nExtent = OutputDevice::LogicToLogic( Size( nExtent, 0 ), maVDev.GetMapMode(), maDestMapMode ).Width();
+ nExtent = OutputDevice::LogicToLogic( Size( nExtent, 0 ), maVDev->GetMapMode(), maDestMapMode ).Width();
m_rStm.WriteInt32( nExtent );
}
void EMFWriter::ImplWritePoint( const Point& rPoint )
{
- const Point aPoint( OutputDevice::LogicToLogic( rPoint, maVDev.GetMapMode(), maDestMapMode ));
+ const Point aPoint( OutputDevice::LogicToLogic( rPoint, maVDev->GetMapMode(), maDestMapMode ));
m_rStm.WriteInt32( aPoint.X() ).WriteInt32( aPoint.Y() );
}
void EMFWriter::ImplWriteSize( const Size& rSize)
{
- const Size aSize( OutputDevice::LogicToLogic( rSize, maVDev.GetMapMode(), maDestMapMode ));
+ const Size aSize( OutputDevice::LogicToLogic( rSize, maVDev->GetMapMode(), maDestMapMode ));
m_rStm.WriteInt32( aSize.Width() ).WriteInt32( aSize.Height() );
}
void EMFWriter::ImplWriteRect( const Rectangle& rRect )
{
- const Rectangle aRect( OutputDevice::LogicToLogic ( rRect, maVDev.GetMapMode(), maDestMapMode ));
+ const Rectangle aRect( OutputDevice::LogicToLogic ( rRect, maVDev->GetMapMode(), maDestMapMode ));
m_rStm
.WriteInt32( aRect.Left() )
.WriteInt32( aRect.Top() )
@@ -840,7 +840,7 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt,
const sal_uLong nOffPos = m_rStm.Tell();
m_rStm.SeekRel( 16 );
- m_rStm.WriteUInt32( 0 ).WriteInt32( ( ROP_XOR == maVDev.GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
+ m_rStm.WriteUInt32( 0 ).WriteInt32( ( ROP_XOR == maVDev->GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
ImplWriteSize( rSz );
WriteDIB(rBmp, aMemStm, true, false);
@@ -898,19 +898,19 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, c
// get text sizes
if( pDXArray )
{
- nNormWidth = maVDev.GetTextWidth( rText );
+ nNormWidth = maVDev->GetTextWidth( rText );
pDX = const_cast<long*>(pDXArray);
}
else
{
pOwnArray.reset(new long[ nLen ]);
- nNormWidth = maVDev.GetTextArray( rText, pOwnArray.get() );
+ nNormWidth = maVDev->GetTextArray( rText, pOwnArray.get() );
pDX = pOwnArray.get();
}
if( nLen > 1 )
{
- nNormWidth = pDX[ nLen - 2 ] + maVDev.GetTextWidth( OUString(rText[ nLen - 1 ]) );
+ nNormWidth = pDX[ nLen - 2 ] + maVDev->GetTextWidth( OUString(rText[ nLen - 1 ]) );
if( nWidth && nNormWidth && ( nWidth != nNormWidth ) )
{
@@ -924,7 +924,7 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, c
// write text record
ImplBeginRecord( WIN_EMR_EXTTEXTOUTW );
- ImplWriteRect( Rectangle( rPos, Size( nNormWidth, maVDev.GetTextHeight() ) ) );
+ ImplWriteRect( Rectangle( rPos, Size( nNormWidth, maVDev->GetTextHeight() ) ) );
m_rStm.WriteUInt32( 1 );
m_rStm.WriteInt32( 0 ).WriteInt32( 0 );
ImplWritePoint( rPos );
@@ -975,11 +975,11 @@ void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const bas
if(aFillPolyPolygon.count())
{
- const Color aOldLineColor(maVDev.GetLineColor());
- const Color aOldFillColor(maVDev.GetFillColor());
+ const Color aOldLineColor(maVDev->GetLineColor());
+ const Color aOldFillColor(maVDev->GetFillColor());
- maVDev.SetLineColor();
- maVDev.SetFillColor(aOldLineColor);
+ maVDev->SetLineColor();
+ maVDev->SetFillColor(aOldLineColor);
for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
{
@@ -987,8 +987,8 @@ void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const bas
ImplWritePolyPolygonRecord(tools::PolyPolygon(Polygon(aPolygon)));
}
- maVDev.SetLineColor(aOldLineColor);
- maVDev.SetFillColor(aOldFillColor);
+ maVDev->SetLineColor(aOldLineColor);
+ maVDev->SetFillColor(aOldFillColor);
}
}
}
@@ -1016,14 +1016,14 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_POINT_ACTION ):
{
- if( maVDev.IsLineColor() )
+ if( maVDev->IsLineColor() )
{
const MetaPointAction* pA = static_cast<const MetaPointAction*>(pAction);
ImplCheckLineAttr();
ImplBeginRecord( WIN_EMR_SETPIXELV );
ImplWritePoint( pA->GetPoint() );
- ImplWriteColor( maVDev.GetLineColor() );
+ ImplWriteColor( maVDev->GetLineColor() );
ImplEndRecord();
}
}
@@ -1031,7 +1031,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_LINE_ACTION ):
{
- if( maVDev.IsLineColor() )
+ if( maVDev->IsLineColor() )
{
const MetaLineAction* pA = static_cast<const MetaLineAction*>(pAction);
@@ -1049,7 +1049,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
ImplBeginRecord( WIN_EMR_SETPIXELV );
ImplWritePoint( pA->GetEndPoint() );
- ImplWriteColor( maVDev.GetLineColor() );
+ ImplWriteColor( maVDev->GetLineColor() );
ImplEndRecord();
}
else
@@ -1066,7 +1066,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_RECT_ACTION ):
{
- if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ if( maVDev->IsLineColor() || maVDev->IsFillColor() )
{
const MetaRectAction* pA = static_cast<const MetaRectAction*>(pAction);
@@ -1082,7 +1082,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_ROUNDRECT_ACTION ):
{
- if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ if( maVDev->IsLineColor() || maVDev->IsFillColor() )
{
const MetaRoundRectAction* pA = static_cast<const MetaRoundRectAction*>(pAction);
@@ -1099,7 +1099,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_ELLIPSE_ACTION ):
{
- if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ if( maVDev->IsLineColor() || maVDev->IsFillColor() )
{
const MetaEllipseAction* pA = static_cast<const MetaEllipseAction*>(pAction);
@@ -1118,7 +1118,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_CHORD_ACTION ):
case( META_POLYGON_ACTION ):
{
- if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ if( maVDev->IsLineColor() || maVDev->IsFillColor() )
{
Polygon aPoly;
@@ -1157,7 +1157,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_POLYLINE_ACTION ):
{
- if( maVDev.IsLineColor() )
+ if( maVDev->IsLineColor() )
{
const MetaPolyLineAction* pA = static_cast<const MetaPolyLineAction*>(pAction);
const Polygon& rPoly = pA->GetPolygon();
@@ -1180,7 +1180,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_POLYPOLYGON_ACTION ):
{
- if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ if( maVDev->IsLineColor() || maVDev->IsFillColor() )
ImplWritePolyPolygonRecord( static_cast<const MetaPolyPolygonAction*>(pAction)->GetPolyPolygon() );
}
break;
@@ -1190,7 +1190,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
const MetaGradientAction* pA = static_cast<const MetaGradientAction*>(pAction);
GDIMetaFile aTmpMtf;
- maVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ maVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
ImplWrite( aTmpMtf );
}
break;
@@ -1200,7 +1200,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
const MetaHatchAction* pA = static_cast<const MetaHatchAction*>(pAction);
GDIMetaFile aTmpMtf;
- maVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ maVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
ImplWrite( aTmpMtf );
}
break;
@@ -1261,19 +1261,19 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
const MetaAction* pSubstAct = aSubstitute.GetAction( i );
if( pSubstAct->GetType() == META_BMPSCALE_ACTION )
{
- maVDev.Push( PushFlags::ALL );
+ maVDev->Push( PushFlags::ALL );
ImplBeginRecord( WIN_EMR_SAVEDC );
ImplEndRecord();
MapMode aMapMode( aSubstitute.GetPrefMapMode() );
- Size aOutSize( OutputDevice::LogicToLogic( pA->GetSize(), maVDev.GetMapMode(), aMapMode ) );
+ Size aOutSize( OutputDevice::LogicToLogic( pA->GetSize(), maVDev->GetMapMode(), aMapMode ) );
aMapMode.SetScaleX( Fraction( aOutSize.Width(), aSubstitute.GetPrefSize().Width() ) );
aMapMode.SetScaleY( Fraction( aOutSize.Height(), aSubstitute.GetPrefSize().Height() ) );
- aMapMode.SetOrigin( OutputDevice::LogicToLogic( pA->GetPoint(), maVDev.GetMapMode(), aMapMode ) );
- maVDev.SetMapMode( aMapMode );
+ aMapMode.SetOrigin( OutputDevice::LogicToLogic( pA->GetPoint(), maVDev->GetMapMode(), aMapMode ) );
+ maVDev->SetMapMode( aMapMode );
ImplWrite( aSubstitute );
- maVDev.Pop();
+ maVDev->Pop();
ImplBeginRecord( WIN_EMR_RESTOREDC );
m_rStm.WriteInt32( -1 );
ImplEndRecord();
@@ -1286,7 +1286,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case META_BMP_ACTION:
{
const MetaBmpAction* pA = static_cast<const MetaBmpAction *>(pAction);
- ImplWriteBmpRecord( pA->GetBitmap(), pA->GetPoint(), maVDev.PixelToLogic( pA->GetBitmap().GetSizePixel() ), WIN_SRCCOPY );
+ ImplWriteBmpRecord( pA->GetBitmap(), pA->GetPoint(), maVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ), WIN_SRCCOPY );
}
break;
@@ -1317,8 +1317,8 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
{
aBmp.Replace( aMsk, COL_WHITE );
aMsk.Invert();
- ImplWriteBmpRecord( aMsk, pA->GetPoint(), maVDev.PixelToLogic( aMsk.GetSizePixel() ), WIN_SRCPAINT );
- ImplWriteBmpRecord( aBmp, pA->GetPoint(), maVDev.PixelToLogic( aBmp.GetSizePixel() ), WIN_SRCAND );
+ ImplWriteBmpRecord( aMsk, pA->GetPoint(), maVDev->PixelToLogic( aMsk.GetSizePixel() ), WIN_SRCPAINT );
+ ImplWriteBmpRecord( aBmp, pA->GetPoint(), maVDev->PixelToLogic( aBmp.GetSizePixel() ), WIN_SRCAND );
}
else
ImplWriteBmpRecord( aBmp, pA->GetPoint(), aBmp.GetSizePixel(), WIN_SRCCOPY );
@@ -1405,14 +1405,14 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_LINECOLOR_ACTION ):
{
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
mbLineChanged = true;
}
break;
case( META_FILLCOLOR_ACTION ):
{
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
mbFillChanged = true;
}
break;
@@ -1423,14 +1423,14 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_TEXTALIGN_ACTION ):
case( META_FONT_ACTION ):
{
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
mbTextChanged = true;
}
break;
case( META_ISECTRECTCLIPREGION_ACTION ):
{
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
ImplBeginRecord( WIN_EMR_INTERSECTCLIPRECT );
ImplWriteRect( static_cast<const MetaISectRectClipRegionAction*>(pAction)->GetRect() );
@@ -1442,18 +1442,18 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_ISECTREGIONCLIPREGION_ACTION ):
case( META_MOVECLIPREGION_ACTION ):
{
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
}
break;
case( META_REFPOINT_ACTION ):
case( META_MAPMODE_ACTION ):
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
break;
case( META_PUSH_ACTION ):
{
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
ImplBeginRecord( WIN_EMR_SAVEDC );
ImplEndRecord();
@@ -1462,20 +1462,20 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_POP_ACTION ):
{
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
ImplBeginRecord( WIN_EMR_RESTOREDC );
m_rStm.WriteInt32( -1 );
ImplEndRecord();
- ImplWriteRasterOp( maVDev.GetRasterOp() );
+ ImplWriteRasterOp( maVDev->GetRasterOp() );
mbLineChanged = mbFillChanged = mbTextChanged = true;
}
break;
case( META_RASTEROP_ACTION ):
{
- const_cast<MetaAction*>(pAction)->Execute( &maVDev );
+ const_cast<MetaAction*>(pAction)->Execute( maVDev );
ImplWriteRasterOp( static_cast<const MetaRasterOpAction*>(pAction)->GetRasterOp() );
}
break;
diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx
index 5bf294a0e323..d037bdeb9d6c 100644
--- a/vcl/source/filter/wmf/emfwr.hxx
+++ b/vcl/source/filter/wmf/emfwr.hxx
@@ -33,7 +33,7 @@ class EMFWriter
{
private:
- VirtualDevice maVDev;
+ ScopedVclPtr<VirtualDevice> maVDev;
MapMode maDestMapMode;
SvStream& m_rStm;
bool* mpHandlesUsed;
@@ -90,7 +90,8 @@ private:
public:
EMFWriter(SvStream &rStream)
- : m_rStm(rStream)
+ : maVDev( VclPtr<VirtualDevice>::Create() )
+ , m_rStm(rStream)
, mpHandlesUsed(NULL)
, mnHandleCount(0)
, mnRecordCount(0)
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 72c20cb0ac25..740ac493f353 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -236,12 +236,11 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont )
{
// #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
SolarMutexGuard aGuard;
- VirtualDevice aVDev;
-
+ VclPtrInstance< VirtualDevice > pVDev;
// converting the cell height into a font height
aFont.SetSize( aFontSize );
- aVDev.SetFont( aFont );
- FontMetric aMetric( aVDev.GetFontMetric() );
+ pVDev->SetFont( aFont );
+ FontMetric aMetric( pVDev->GetFontMetric() );
long nHeight = aMetric.GetAscent() + aMetric.GetDescent();
if (nHeight)
{
@@ -1448,20 +1447,19 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b
{
// #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
SolarMutexGuard aGuard;
- VirtualDevice aVDev;
-
+ VclPtrInstance< VirtualDevice > pVDev;
sal_Int32 nTextWidth;
- aVDev.SetMapMode( MapMode( MAP_100TH_MM ) );
- aVDev.SetFont( maFont );
+ pVDev->SetMapMode( MapMode( MAP_100TH_MM ) );
+ pVDev->SetFont( maFont );
if( pDXArry )
{
sal_uInt32 nLen = rText.getLength();
- nTextWidth = aVDev.GetTextWidth( OUString(rText[ nLen - 1 ]) );
+ nTextWidth = pVDev->GetTextWidth( OUString(rText[ nLen - 1 ]) );
if( nLen > 1 )
nTextWidth += pDXArry[ nLen - 2 ];
}
else
- nTextWidth = aVDev.GetTextWidth( rText );
+ nTextWidth = pVDev->GetTextWidth( rText );
if( mnTextAlign & TA_UPDATECP )
rPosition = maActPos;
@@ -1497,12 +1495,11 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b
{
// #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
SolarMutexGuard aGuard;
- VirtualDevice aVDev;
-
+ VclPtrInstance< VirtualDevice > pVDev;
pDX = new long[ rText.getLength() ];
- aVDev.SetMapMode( MAP_100TH_MM );
- aVDev.SetFont( maLatestFont );
- aVDev.GetTextArray( rText, pDX, 0, rText.getLength());
+ pVDev->SetMapMode( MAP_100TH_MM );
+ pVDev->SetFont( maLatestFont );
+ pVDev->GetTextArray( rText, pDX, 0, rText.getLength());
}
mpGDIMetaFile->AddAction( new MetaTextArrayAction( rPosition, rText, pDX, 0, rText.getLength() ) );
if ( !pDXArry ) // this means we have created our own array
@@ -1516,26 +1513,26 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B
BitmapEx aBmpEx( rBitmap );
if ( mbComplexClip )
{
- VirtualDevice aVDev;
+ VclPtrInstance< VirtualDevice > pVDev;
MapMode aMapMode( MAP_100TH_MM );
aMapMode.SetOrigin( Point( -rPos.X(), -rPos.Y() ) );
- const Size aOutputSizePixel( aVDev.LogicToPixel( rSize, aMapMode ) );
+ const Size aOutputSizePixel( pVDev->LogicToPixel( rSize, aMapMode ) );
const Size aSizePixel( rBitmap.GetSizePixel() );
if ( aOutputSizePixel.Width() && aOutputSizePixel.Height() )
{
aMapMode.SetScaleX( Fraction( aSizePixel.Width(), aOutputSizePixel.Width() ) );
aMapMode.SetScaleY( Fraction( aSizePixel.Height(), aOutputSizePixel.Height() ) );
}
- aVDev.SetMapMode( aMapMode );
- aVDev.SetOutputSizePixel( aSizePixel );
- aVDev.SetFillColor( Color( COL_BLACK ) );
+ pVDev->SetMapMode( aMapMode );
+ pVDev->SetOutputSizePixel( aSizePixel );
+ pVDev->SetFillColor( Color( COL_BLACK ) );
const tools::PolyPolygon aClip( aClipPath.getClipPath() );
- aVDev.DrawPolyPolygon( aClip );
+ pVDev->DrawPolyPolygon( aClip );
const Point aEmptyPoint;
// #i50672# Extract whole VDev content (to match size of rBitmap)
- aVDev.EnableMapMode( false );
- Bitmap aMask( aVDev.GetBitmap( aEmptyPoint, aSizePixel ).CreateMask( Color( COL_WHITE ) ) );
+ pVDev->EnableMapMode( false );
+ Bitmap aMask( pVDev->GetBitmap( aEmptyPoint, aSizePixel ).CreateMask( Color( COL_WHITE ) ) );
if ( aBmpEx.IsTransparent() )
{
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 2b6e6a40ddcd..dc98e2eae9b6 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1815,7 +1815,7 @@ bool WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
delete pAt;
}
- delete pVirDev;
+ pVirDev.disposeAndClear();
if ( xStatusIndicator.is() )
xStatusIndicator->end();
diff --git a/vcl/source/filter/wmf/wmfwr.hxx b/vcl/source/filter/wmf/wmfwr.hxx
index c27a8eb3be7f..c017eb53aa61 100644
--- a/vcl/source/filter/wmf/wmfwr.hxx
+++ b/vcl/source/filter/wmf/wmfwr.hxx
@@ -58,7 +58,7 @@ private:
com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
SvStream* pWMF;
- VirtualDevice* pVirDev;
+ VclPtr<VirtualDevice> pVirDev;
MapMode aTargetMapMode;
Size aTargetSize;
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index f83581fd8bba..4ab246f0d713 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -802,4 +802,10 @@ SvStream& ReadAnimation( SvStream& rIStm, Animation& rAnimation )
return rIStm;
}
+AInfo::AInfo() : pOutDev( NULL ),
+ pViewData( NULL ),
+ nExtraData( 0L ),
+ bWithSize( false ),
+ bPause( false ) {}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 79ae295b3f74..80cb6f832b29 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -706,16 +706,16 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize
Size aStdSize( aStandardSize, aStandardSize );
Rectangle aRect(aEmptyPoint, aStdSize );
- VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
- aVirDevice.SetOutputSizePixel( aStdSize );
- aVirDevice.SetFillColor( COL_TRANSPARENT );
- aVirDevice.SetLineColor( COL_TRANSPARENT );
+ ScopedVclPtrInstance< VirtualDevice > aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
+ aVirDevice->SetOutputSizePixel( aStdSize );
+ aVirDevice->SetFillColor( COL_TRANSPARENT );
+ aVirDevice->SetLineColor( COL_TRANSPARENT );
// Draw a rect into virDevice
- aVirDevice.DrawRect( aRect );
+ aVirDevice->DrawRect( aRect );
Point aPointPixel( (long)imgposX, (long)imgposY );
- aVirDevice.DrawBitmapEx( aPointPixel, aRet );
- aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
+ aVirDevice->DrawBitmapEx( aPointPixel, aRet );
+ aRet = aVirDevice->GetBitmapEx( aEmptyPoint, aStdSize );
return aRet;
}
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 3ef048230e30..8509f66d8eaf 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -497,8 +497,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
}
LineInfo aLineInfo( LINE_NONE, 0 );
- ::std::stack< LineInfo* > aLIStack;
- VirtualDevice aFontVDev;
+ ::std::stack< LineInfo* > aLIStack;
+ ScopedVclPtrInstance< VirtualDevice > aFontVDev;
rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding();
bool bFatLine = false;
@@ -848,7 +848,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rMtf.AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) );
// #106172# Track font relevant data in shadow VDev
- aFontVDev.SetFont( aFont );
+ aFontVDev->SetFont( aFont );
}
break;
@@ -904,7 +904,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
{
boost::scoped_array<long> pTmpAry(new long[nStrLen]);
- aFontVDev.GetTextArray( aStr, pTmpAry.get(), nIndex, nLen );
+ aFontVDev->GetTextArray( aStr, pTmpAry.get(), nIndex, nLen );
// now, the difference between the
// last and the second last DX array
@@ -1022,7 +1022,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rMtf.AddAction( new MetaMapModeAction( aMapMode ) );
// #106172# Track font relevant data in shadow VDev
- aFontVDev.SetMapMode( aMapMode );
+ aFontVDev->SetMapMode( aMapMode );
}
break;
@@ -1132,7 +1132,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rMtf.AddAction( new MetaPushAction( PushFlags::ALL ) );
// #106172# Track font relevant data in shadow VDev
- aFontVDev.Push();
+ aFontVDev->Push();
}
break;
@@ -1159,7 +1159,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rMtf.AddAction( new MetaPopAction() );
// #106172# Track font relevant data in shadow VDev
- aFontVDev.Pop();
+ aFontVDev->Pop();
}
break;
@@ -1259,9 +1259,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
// #106172# Track font relevant data in shadow VDev
if( bSet )
- aFontVDev.SetRefPoint( aRefPoint );
+ aFontVDev->SetRefPoint( aRefPoint );
else
- aFontVDev.SetRefPoint();
+ aFontVDev->SetRefPoint();
}
break;
@@ -1374,7 +1374,7 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding();
const Size aPrefSize( rMtf.GetPrefSize() );
bool bRop_0_1 = false;
- VirtualDevice aSaveVDev;
+ ScopedVclPtrInstance< VirtualDevice > aSaveVDev;
Color aLineCol( COL_BLACK );
::std::stack< Color* > aLineColStack;
@@ -1392,7 +1392,7 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
nCountPos = rOStm.Tell();
rOStm.SeekRel( 4L );
- const sal_Int32 nActCount = ImplWriteActions( rOStm, rMtf, aSaveVDev, bRop_0_1, aLineCol, aLineColStack, eActualCharSet );
+ const sal_Int32 nActCount = ImplWriteActions( rOStm, rMtf, *aSaveVDev.get(), bRop_0_1, aLineCol, aLineColStack, eActualCharSet );
const sal_uLong nActPos = rOStm.Tell();
rOStm.Seek( nCountPos );
@@ -2311,10 +2311,10 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
{
// write actions for hatch
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
GDIMetaFile aTmpMtf;
- aVDev.AddHatchActions( rPolyPoly, rHatch, aTmpMtf );
+ aVDev->AddHatchActions( rPolyPoly, rHatch, aTmpMtf );
nAddCount = ImplWriteActions( rOStm, aTmpMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet );
nNewPos = rOStm.Tell();
rOStm.Seek( nOldPos );
diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx
index 3fa559a6abb8..1c19a11a4305 100644
--- a/vcl/source/gdi/gdimetafiletools.cxx
+++ b/vcl/source/gdi/gdimetafiletools.cxx
@@ -161,23 +161,23 @@ namespace
// in pixel mode for alpha channel painting (black is transparent,
// white to paint 100% opacity)
const Size aSizePixel(rBitmapEx.GetSizePixel());
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
- aVDev.SetOutputSizePixel(aSizePixel);
- aVDev.EnableMapMode(false);
- aVDev.SetFillColor(COL_WHITE);
- aVDev.SetLineColor();
+ aVDev->SetOutputSizePixel(aSizePixel);
+ aVDev->EnableMapMode(false);
+ aVDev->SetFillColor(COL_WHITE);
+ aVDev->SetLineColor();
if(rBitmapEx.IsTransparent())
{
// use given alpha channel
- aVDev.DrawBitmap(Point(0, 0), rBitmapEx.GetAlpha().GetBitmap());
+ aVDev->DrawBitmap(Point(0, 0), rBitmapEx.GetAlpha().GetBitmap());
}
else
{
// reset alpha channel
- aVDev.SetBackground(Wallpaper(Color(COL_BLACK)));
- aVDev.Erase();
+ aVDev->SetBackground(Wallpaper(Color(COL_BLACK)));
+ aVDev->Erase();
}
// transform polygon from clipping to pixel coordinates
@@ -203,11 +203,11 @@ namespace
aInvertPixelPoly.append(aPixelPoly);
// paint as alpha
- aVDev.DrawPolyPolygon(aInvertPixelPoly);
+ aVDev->DrawPolyPolygon(aInvertPixelPoly);
// get created alpha mask and set defaults
AlphaMask aAlpha(
- aVDev.GetBitmap(
+ aVDev->GetBitmap(
Point(0, 0),
aSizePixel));
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index a761a5d07516..0eafc4f67e38 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -723,10 +723,10 @@ void GDIMetaFile::Move( long nX, long nY )
{
const Size aBaseOffset( nX, nY );
Size aOffset( aBaseOffset );
- VirtualDevice aMapVDev;
+ ScopedVclPtrInstance< VirtualDevice > aMapVDev;
- aMapVDev.EnableOutput( false );
- aMapVDev.SetMapMode( GetPrefMapMode() );
+ aMapVDev->EnableOutput( false );
+ aMapVDev->SetMapMode( GetPrefMapMode() );
for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() )
{
@@ -745,8 +745,8 @@ void GDIMetaFile::Move( long nX, long nY )
( META_PUSH_ACTION == nType ) ||
( META_POP_ACTION == nType ) )
{
- pModAct->Execute( &aMapVDev );
- aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev.GetMapMode() );
+ pModAct->Execute( aMapVDev.get() );
+ aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev->GetMapMode() );
}
pModAct->Move( aOffset.Width(), aOffset.Height() );
@@ -757,11 +757,11 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY )
{
const Size aBaseOffset( nX, nY );
Size aOffset( aBaseOffset );
- VirtualDevice aMapVDev;
+ ScopedVclPtrInstance< VirtualDevice > aMapVDev;
- aMapVDev.EnableOutput( false );
- aMapVDev.SetReferenceDevice( nDPIX, nDPIY );
- aMapVDev.SetMapMode( GetPrefMapMode() );
+ aMapVDev->EnableOutput( false );
+ aMapVDev->SetReferenceDevice( nDPIX, nDPIY );
+ aMapVDev->SetMapMode( GetPrefMapMode() );
for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() )
{
@@ -780,16 +780,16 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY )
( META_PUSH_ACTION == nType ) ||
( META_POP_ACTION == nType ) )
{
- pModAct->Execute( &aMapVDev );
- if( aMapVDev.GetMapMode().GetMapUnit() == MAP_PIXEL )
+ pModAct->Execute( aMapVDev.get() );
+ if( aMapVDev->GetMapMode().GetMapUnit() == MAP_PIXEL )
{
- aOffset = aMapVDev.LogicToPixel( aBaseOffset, GetPrefMapMode() );
- MapMode aMap( aMapVDev.GetMapMode() );
+ aOffset = aMapVDev->LogicToPixel( aBaseOffset, GetPrefMapMode() );
+ MapMode aMap( aMapVDev->GetMapMode() );
aOffset.Width() = static_cast<long>(aOffset.Width() * (double)aMap.GetScaleX());
aOffset.Height() = static_cast<long>(aOffset.Height() * (double)aMap.GetScaleY());
}
else
- aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev.GetMapMode() );
+ aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev->GetMapMode() );
}
pModAct->Move( aOffset.Width(), aOffset.Height() );
@@ -825,10 +825,10 @@ void GDIMetaFile::Scale( const Fraction& rScaleX, const Fraction& rScaleY )
void GDIMetaFile::Clip( const Rectangle& i_rClipRect )
{
Rectangle aCurRect( i_rClipRect );
- VirtualDevice aMapVDev;
+ ScopedVclPtrInstance< VirtualDevice > aMapVDev;
- aMapVDev.EnableOutput( false );
- aMapVDev.SetMapMode( GetPrefMapMode() );
+ aMapVDev->EnableOutput( false );
+ aMapVDev->SetMapMode( GetPrefMapMode() );
for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() )
{
@@ -838,8 +838,8 @@ void GDIMetaFile::Clip( const Rectangle& i_rClipRect )
( META_PUSH_ACTION == nType ) ||
( META_POP_ACTION == nType ) )
{
- pAct->Execute( &aMapVDev );
- aCurRect = OutputDevice::LogicToLogic( i_rClipRect, GetPrefMapMode(), aMapVDev.GetMapMode() );
+ pAct->Execute( aMapVDev.get() );
+ aCurRect = OutputDevice::LogicToLogic( i_rClipRect, GetPrefMapMode(), aMapVDev->GetMapMode() );
}
else if( nType == META_CLIPREGION_ACTION )
{
@@ -892,12 +892,12 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf,
const Gradient& rGrad )
{
// Generate comment, GradientEx and Gradient actions (within DrawGradient)
- VirtualDevice aVDev( rMapDev, 0 );
- aVDev.EnableOutput( false );
+ ScopedVclPtrInstance< VirtualDevice > aVDev( rMapDev, 0 );
+ aVDev->EnableOutput( false );
GDIMetaFile aGradMtf;
- aGradMtf.Record( &aVDev );
- aVDev.DrawGradient( rPolyPoly, rGrad );
+ aGradMtf.Record( aVDev.get() );
+ aVDev->DrawGradient( rPolyPoly, rGrad );
aGradMtf.Stop();
size_t i, nAct( aGradMtf.GetActionSize() );
@@ -917,7 +917,7 @@ void GDIMetaFile::Rotate( long nAngle10 )
if( nAngle10 )
{
GDIMetaFile aMtf;
- VirtualDevice aMapVDev;
+ ScopedVclPtrInstance< VirtualDevice > aMapVDev;
const double fAngle = F_PI1800 * nAngle10;
const double fSin = sin( fAngle );
const double fCos = cos( fAngle );
@@ -926,8 +926,8 @@ void GDIMetaFile::Rotate( long nAngle10 )
aPoly.Rotate( Point(), fSin, fCos );
- aMapVDev.EnableOutput( false );
- aMapVDev.SetMapMode( GetPrefMapMode() );
+ aMapVDev->EnableOutput( false );
+ aMapVDev->SetMapMode( GetPrefMapMode() );
const Rectangle aNewBound( aPoly.GetBoundRect() );
@@ -1130,7 +1130,7 @@ void GDIMetaFile::Rotate( long nAngle10 )
{
MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction);
- ImplAddGradientEx( aMtf, aMapVDev,
+ ImplAddGradientEx( aMtf, *aMapVDev.get(),
ImplGetRotatedPolygon( pAct->GetRect(), aRotAnchor, aRotOffset, fSin, fCos ),
pAct->GetGradient() );
}
@@ -1162,7 +1162,7 @@ void GDIMetaFile::Rotate( long nAngle10 )
{
// Add rotated gradientex
MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
- ImplAddGradientEx( aMtf, aMapVDev,
+ ImplAddGradientEx( aMtf, *aMapVDev.get(),
ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
pAct->GetGradient() );
}
@@ -1225,7 +1225,7 @@ void GDIMetaFile::Rotate( long nAngle10 )
else if ( pCommentAct->GetComment() == "XPATHSTROKE_SEQ_END"
|| pCommentAct->GetComment() == "XPATHFILL_SEQ_END" )
{
- pAction->Execute( &aMapVDev );
+ pAction->Execute( aMapVDev.get() );
pAction->Duplicate();
aMtf.AddAction( pAction );
}
@@ -1348,7 +1348,7 @@ void GDIMetaFile::Rotate( long nAngle10 )
default:
{
- pAction->Execute( &aMapVDev );
+ pAction->Execute( aMapVDev.get() );
pAction->Duplicate();
aMtf.AddAction( pAction );
@@ -1357,8 +1357,8 @@ void GDIMetaFile::Rotate( long nAngle10 )
( META_PUSH_ACTION == nActionType ) ||
( META_POP_ACTION == nActionType ) )
{
- aRotAnchor = OutputDevice::LogicToLogic( aOrigin, aPrefMapMode, aMapVDev.GetMapMode() );
- aRotOffset = OutputDevice::LogicToLogic( aOffset, aPrefMapMode, aMapVDev.GetMapMode() );
+ aRotAnchor = OutputDevice::LogicToLogic( aOrigin, aPrefMapMode, aMapVDev->GetMapMode() );
+ aRotOffset = OutputDevice::LogicToLogic( aOffset, aPrefMapMode, aMapVDev->GetMapMode() );
}
}
break;
@@ -1400,10 +1400,10 @@ static void ImplActionBounds( Rectangle& o_rOutBounds,
Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHairline ) const
{
GDIMetaFile aMtf;
- VirtualDevice aMapVDev( i_rReference );
+ ScopedVclPtrInstance< VirtualDevice > aMapVDev( i_rReference );
- aMapVDev.EnableOutput( false );
- aMapVDev.SetMapMode( GetPrefMapMode() );
+ aMapVDev->EnableOutput( false );
+ aMapVDev->SetMapMode( GetPrefMapMode() );
std::vector<Rectangle> aClipStack( 1, Rectangle() );
std::vector<PushFlags> aPushFlagStack;
@@ -1419,7 +1419,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaAction* pAction = GetAction(a);
const sal_uInt16 nActionType = pAction->GetType();
- Rectangle* pUseHairline = (pHairline && aMapVDev.IsLineColor()) ? pHairline : 0;
+ Rectangle* pUseHairline = (pHairline && aMapVDev->IsLineColor()) ? pHairline : 0;
switch( nActionType )
{
@@ -1427,8 +1427,8 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaPixelAction* pAct = static_cast<MetaPixelAction*>(pAction);
ImplActionBounds( aBound,
- Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev.GetMapMode(), GetPrefMapMode() ),
- aMapVDev.PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ),
+ Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev->GetMapMode(), GetPrefMapMode() ),
+ aMapVDev->PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ),
aClipStack, pUseHairline );
}
break;
@@ -1437,8 +1437,8 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaPointAction* pAct = static_cast<MetaPointAction*>(pAction);
ImplActionBounds( aBound,
- Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev.GetMapMode(), GetPrefMapMode() ),
- aMapVDev.PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ),
+ Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev->GetMapMode(), GetPrefMapMode() ),
+ aMapVDev->PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ),
aClipStack, pUseHairline );
}
break;
@@ -1458,28 +1458,28 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
pUseHairline = 0;
}
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
case( META_RECT_ACTION ):
{
MetaRectAction* pAct = static_cast<MetaRectAction*>(pAction);
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
case( META_ROUNDRECT_ACTION ):
{
MetaRoundRectAction* pAct = static_cast<MetaRoundRectAction*>(pAction);
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
case( META_ELLIPSE_ACTION ):
{
MetaEllipseAction* pAct = static_cast<MetaEllipseAction*>(pAction);
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1488,7 +1488,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
MetaArcAction* pAct = static_cast<MetaArcAction*>(pAction);
// FIXME: this is imprecise
// e.g. for small arcs the whole rectangle is WAY too large
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1497,7 +1497,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
MetaPieAction* pAct = static_cast<MetaPieAction*>(pAction);
// FIXME: this is imprecise
// e.g. for small arcs the whole rectangle is WAY too large
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1506,7 +1506,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
MetaChordAction* pAct = static_cast<MetaChordAction*>(pAction);
// FIXME: this is imprecise
// e.g. for small arcs the whole rectangle is WAY too large
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1523,7 +1523,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
pUseHairline = 0;
}
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1531,7 +1531,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaPolygonAction* pAct = static_cast<MetaPolygonAction*>(pAction);
Rectangle aRect( pAct->GetPolygon().GetBoundRect() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1539,7 +1539,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaPolyPolygonAction* pAct = static_cast<MetaPolyPolygonAction*>(pAction);
Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline );
}
break;
@@ -1548,10 +1548,10 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
MetaTextAction* pAct = static_cast<MetaTextAction*>(pAction);
Rectangle aRect;
// hdu said base = index
- aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen() );
+ aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen() );
Point aPt( pAct->GetPoint() );
aRect.Move( aPt.X(), aPt.Y() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1560,11 +1560,11 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pAction);
Rectangle aRect;
// hdu said base = index
- aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(),
+ aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(),
0, pAct->GetDXArray() );
Point aPt( pAct->GetPoint() );
aRect.Move( aPt.X(), aPt.Y() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1573,11 +1573,11 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
MetaStretchTextAction* pAct = static_cast<MetaStretchTextAction*>(pAction);
Rectangle aRect;
// hdu said base = index
- aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(),
+ aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(),
pAct->GetWidth(), NULL );
Point aPt( pAct->GetPoint() );
aRect.Move( aPt.X(), aPt.Y() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1589,11 +1589,11 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
OUString aStr( pStr );
Rectangle aRect;
- aMapVDev.GetTextBoundRect( aRect, aStr, 0, 0, aStr.getLength(), 0, NULL );
+ aMapVDev->GetTextBoundRect( aRect, aStr, 0, 0, aStr.getLength(), 0, NULL );
Point aPt( pAct->GetStartPoint() );
aRect.Move( aPt.X(), aPt.Y() );
aRect.Right() = aRect.Left() + pAct->GetWidth();
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1601,7 +1601,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1609,7 +1609,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1617,7 +1617,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1625,7 +1625,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1633,7 +1633,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction);
Rectangle aRect( pAct->GetRect() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1641,7 +1641,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1655,7 +1655,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction);
Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1663,7 +1663,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaTransparentAction* pAct = static_cast<MetaTransparentAction*>(pAction);
Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1673,7 +1673,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
// MetaFloatTransparentAction is defined limiting it's content Metafile
// to it's geometry definition(Point, Size), so use these directly
const Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1681,7 +1681,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1689,7 +1689,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaClipRegionAction* pAct = static_cast<MetaClipRegionAction*>(pAction);
if( pAct->IsClipping() )
- aClipStack.back() = OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev.GetMapMode(), GetPrefMapMode() );
+ aClipStack.back() = OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev->GetMapMode(), GetPrefMapMode() );
else
aClipStack.back() = Rectangle();
}
@@ -1698,7 +1698,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
case( META_ISECTRECTCLIPREGION_ACTION ):
{
MetaISectRectClipRegionAction* pAct = static_cast<MetaISectRectClipRegionAction*>(pAction);
- Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ) );
+ Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ) );
if( aClipStack.back().IsEmpty() )
aClipStack.back() = aRect;
else
@@ -1709,7 +1709,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
case( META_ISECTREGIONCLIPREGION_ACTION ):
{
MetaISectRegionClipRegionAction* pAct = static_cast<MetaISectRegionClipRegionAction*>(pAction);
- Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ) );
+ Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ) );
if( aClipStack.back().IsEmpty() )
aClipStack.back() = aRect;
else
@@ -1720,24 +1720,24 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
case( META_BMP_ACTION ):
{
MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction);
- Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
case( META_BMPEX_ACTION ):
{
MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction);
- Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
case( META_MASK_ACTION ):
{
MetaMaskAction* pAct = static_cast<MetaMaskAction*>(pAction);
- Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1745,7 +1745,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction);
Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1753,7 +1753,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction);
Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1761,7 +1761,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaWallpaperAction* pAct = static_cast<MetaWallpaperAction*>(pAction);
Rectangle aRect( pAct->GetRect() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1769,7 +1769,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
{
MetaTextRectAction* pAct = static_cast<MetaTextRectAction*>(pAction);
Rectangle aRect( pAct->GetRect() );
- ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
+ ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 );
}
break;
@@ -1779,7 +1779,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
if( ! aClipStack.back().IsEmpty() )
{
Size aDelta( pAct->GetHorzMove(), pAct->GetVertMove() );
- aDelta = OutputDevice::LogicToLogic( aDelta, aMapVDev.GetMapMode(), GetPrefMapMode() );
+ aDelta = OutputDevice::LogicToLogic( aDelta, aMapVDev->GetMapMode(), GetPrefMapMode() );
aClipStack.back().Move( aDelta.Width(), aDelta.Width() );
}
}
@@ -1787,7 +1787,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai
default:
{
- pAction->Execute( &aMapVDev );
+ pAction->Execute( aMapVDev.get() );
if( nActionType == META_PUSH_ACTION )
{
@@ -2890,11 +2890,11 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm )
bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, sal_uInt32 nMaximumExtent, BmpConversion eColorConversion, long nScaleFlag) const
{
// initialization seems to be complicated but is used to avoid rounding errors
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
const Point aNullPt;
- const Point aTLPix( aVDev.LogicToPixel( aNullPt, GetPrefMapMode() ) );
- const Point aBRPix( aVDev.LogicToPixel( Point( GetPrefSize().Width() - 1, GetPrefSize().Height() - 1 ), GetPrefMapMode() ) );
- Size aDrawSize( aVDev.LogicToPixel( GetPrefSize(), GetPrefMapMode() ) );
+ const Point aTLPix( aVDev->LogicToPixel( aNullPt, GetPrefMapMode() ) );
+ const Point aBRPix( aVDev->LogicToPixel( Point( GetPrefSize().Width() - 1, GetPrefSize().Height() - 1 ), GetPrefMapMode() ) );
+ Size aDrawSize( aVDev->LogicToPixel( GetPrefSize(), GetPrefMapMode() ) );
Size aSizePix( labs( aBRPix.X() - aTLPix.X() ) + 1, labs( aBRPix.Y() - aTLPix.Y() ) + 1 );
if (!rBitmapEx.IsEmpty())
@@ -2929,7 +2929,7 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, sal_uInt32 nMaximumExtent
// draw image(s) into VDev and get resulting image
// do it 4x larger to be able to scale it down & get beautiful antialias
Size aAntialiasSize(aSizePix.Width() * 4, aSizePix.Height() * 4);
- if (aVDev.SetOutputSizePixel(aAntialiasSize))
+ if (aVDev->SetOutputSizePixel(aAntialiasSize))
{
// antialias: provide 4x larger size, and then scale down the result
Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4);
@@ -2937,10 +2937,10 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, sal_uInt32 nMaximumExtent
// draw metafile into VDev
Point aBackPosPix;
const_cast<GDIMetaFile *>(this)->WindStart();
- const_cast<GDIMetaFile *>(this)->Play(&aVDev, aBackPosPix, aAntialias);
+ const_cast<GDIMetaFile *>(this)->Play(aVDev.get(), aBackPosPix, aAntialias);
// get paint bitmap
- Bitmap aBitmap( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
+ Bitmap aBitmap( aVDev->GetBitmap( aNullPt, aVDev->GetOutputSizePixel() ) );
// scale down the image to the desired size - use the input scaler for the scaling operation
aBitmap.Scale(aDrawSize, nScaleFlag);
diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx
index c3e7b793580c..b225280a6102 100644
--- a/vcl/source/gdi/impanmvw.cxx
+++ b/vcl/source/gdi/impanmvw.cxx
@@ -77,7 +77,7 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut,
MapMode aTempMap( mpOut->GetMapMode() );
aTempMap.SetOrigin( Point() );
mpBackground->SetMapMode( aTempMap );
- static_cast<vcl::Window*>( mpOut )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground );
+ static_cast<vcl::Window*>( mpOut.get() )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground );
mpBackground->SetMapMode( MapMode() );
}
else
@@ -93,8 +93,8 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut,
ImplAnimView::~ImplAnimView()
{
- delete mpBackground;
- delete mpRestore;
+ mpBackground.disposeAndClear();
+ mpRestore.disposeAndClear();
Animation::ImplDecAnimCount();
}
@@ -153,19 +153,19 @@ void ImplAnimView::getPosSize( const AnimationBitmap& rAnm, Point& rPosPix, Size
void ImplAnimView::drawToPos( sal_uLong nPos )
{
- VirtualDevice aVDev;
+ ScopedVclPtrInstance<VirtualDevice> aVDev;
std::unique_ptr<vcl::Region> xOldClip(!maClip.IsNull() ? new vcl::Region( mpOut->GetClipRegion() ) : NULL);
- aVDev.SetOutputSizePixel( maSzPix, false );
+ aVDev->SetOutputSizePixel( maSzPix, false );
nPos = std::min( nPos, (sal_uLong) mpParent->Count() - 1UL );
for( sal_uLong i = 0UL; i <= nPos; i++ )
- draw( i, &aVDev );
+ draw( i, aVDev.get() );
if (xOldClip)
mpOut->SetClipRegion( maClip );
- mpOut->DrawOutDev( maDispPt, maDispSz, Point(), maSzPix, aVDev );
+ mpOut->DrawOutDev( maDispPt, maDispSz, Point(), maSzPix, *aVDev.get() );
if (xOldClip)
mpOut->SetClipRegion(*xOldClip);
@@ -180,7 +180,7 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev )
setMarked( true );
else if( !mbPause )
{
- VirtualDevice* pDev;
+ VclPtr<VirtualDevice> pDev;
Point aPosPix;
Point aBmpPosPix;
Size aSizePix;
@@ -273,10 +273,10 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev )
xOldClip.reset();
}
- delete pDev;
+ pDev.disposeAndClear();
if( mpOut->GetOutDevType() == OUTDEV_WINDOW )
- static_cast<vcl::Window*>( mpOut )->Sync();
+ static_cast<vcl::Window*>( mpOut.get() )->Sync();
}
}
}
@@ -290,7 +290,7 @@ void ImplAnimView::repaint()
MapMode aTempMap( mpOut->GetMapMode() );
aTempMap.SetOrigin( Point() );
mpBackground->SetMapMode( aTempMap );
- static_cast<vcl::Window*>( mpOut )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground );
+ static_cast<vcl::Window*>( mpOut.get() )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground );
mpBackground->SetMapMode( MapMode() );
}
else
diff --git a/vcl/source/gdi/impanmvw.hxx b/vcl/source/gdi/impanmvw.hxx
index ce49476e0718..0955046d7f30 100644
--- a/vcl/source/gdi/impanmvw.hxx
+++ b/vcl/source/gdi/impanmvw.hxx
@@ -34,7 +34,7 @@ private:
friend class Animation;
Animation* mpParent;
- OutputDevice* mpOut;
+ VclPtr<OutputDevice> mpOut;
long mnExtraData;
Point maPt;
Point maDispPt;
@@ -45,8 +45,8 @@ private:
Size maRestSz;
MapMode maMap;
vcl::Region maClip;
- VirtualDevice* mpBackground;
- VirtualDevice* mpRestore;
+ VclPtr<VirtualDevice> mpBackground;
+ VclPtr<VirtualDevice> mpRestore;
sal_uLong mnActPos;
Disposal meLastDisposal;
bool mbPause;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 3f65281a7163..0aace4e88651 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -467,8 +467,8 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
if(maEx.IsEmpty())
{
// calculate size
- VirtualDevice aVDev;
- Size aDrawSize(aVDev.LogicToPixel(maMetaFile.GetPrefSize(), maMetaFile.GetPrefMapMode()));
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
+ Size aDrawSize(aVDev->LogicToPixel(maMetaFile.GetPrefSize(), maMetaFile.GetPrefMapMode()));
if(rParameters.getSizePixel().Width() && rParameters.getSizePixel().Height())
{
@@ -502,7 +502,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
{
// get hairline and full bound rect
Rectangle aHairlineRect;
- const Rectangle aRect(maMetaFile.GetBoundRect(aVDev, &aHairlineRect));
+ const Rectangle aRect(maMetaFile.GetBoundRect(*aVDev.get(), &aHairlineRect));
if(!aRect.IsEmpty() && !aHairlineRect.IsEmpty())
{
@@ -519,22 +519,22 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
}
}
- if(aVDev.SetOutputSizePixel(aPixelSize))
+ if(aVDev->SetOutputSizePixel(aPixelSize))
{
if(rParameters.getAntiAliase())
{
- aVDev.SetAntialiasing(aVDev.GetAntialiasing() | ANTIALIASING_ENABLE_B2DDRAW);
+ aVDev->SetAntialiasing(aVDev->GetAntialiasing() | ANTIALIASING_ENABLE_B2DDRAW);
}
if(rParameters.getSnapHorVerLines())
{
- aVDev.SetAntialiasing(aVDev.GetAntialiasing() | ANTIALIASING_PIXELSNAPHAIRLINE);
+ aVDev->SetAntialiasing(aVDev->GetAntialiasing() | ANTIALIASING_PIXELSNAPHAIRLINE);
}
- ImplDraw( &aVDev, Point(), aDrawSize );
+ ImplDraw( aVDev.get(), Point(), aDrawSize );
// use maEx as local buffer for rendered metafile
- const_cast< ImpGraphic* >(this)->maEx = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
+ const_cast< ImpGraphic* >(this)->maEx = aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() );
}
}
diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx
index 9a71a241fd65..bdb5f3114eeb 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -717,8 +717,8 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
if( rMtf.GetActionSize() )
{
MapMode aMap( MAP_100TH_MM );
- VirtualDevice aVDev;
- const Size aLogSize1( aVDev.PixelToLogic( Size( 1, 1 ), aMap ) );
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
+ const Size aLogSize1( aVDev->PixelToLogic( Size( 1, 1 ), aMap ) );
rMtf.SetPrefMapMode( aMap );
rMtf.SetPrefSize( Size( nWidth + 2, nHeight + 2 ) );
diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx
index b1485a945f00..b71d9dd15654 100644
--- a/vcl/source/gdi/oldprintadaptor.cxx
+++ b/vcl/source/gdi/oldprintadaptor.cxx
@@ -44,8 +44,8 @@ using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
-OldStylePrintAdaptor::OldStylePrintAdaptor(const std::shared_ptr< Printer >& i_xPrinter)
- : PrinterController(i_xPrinter)
+OldStylePrintAdaptor::OldStylePrintAdaptor( const VclPtr< Printer >& i_xPrinter )
+ : PrinterController( i_xPrinter )
, mpData( new ImplOldStyleAdaptorData() )
{
}
@@ -64,7 +64,7 @@ void OldStylePrintAdaptor::StartPage()
getPrinter()->SetConnectMetaFile( &mpData->maPages.back().maPage );
// copy state into metafile
- std::shared_ptr<Printer> xPrinter(getPrinter());
+ VclPtr<Printer> xPrinter( getPrinter() );
xPrinter->SetMapMode(xPrinter->GetMapMode());
xPrinter->SetFont(xPrinter->GetFont());
xPrinter->SetDrawMode(xPrinter->GetDrawMode());
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 2a4166f4b951..9ed2d19e1644 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1874,7 +1874,7 @@ PDFWriterImpl::~PDFWriterImpl()
{
if( m_aDocDigest )
rtl_digest_destroyMD5( m_aDocDigest );
- delete static_cast<VirtualDevice*>(m_pReferenceDevice);
+ m_pReferenceDevice.disposeAndClear();
if( m_aCipher )
rtl_cipher_destroyARCFOUR( m_aCipher );
@@ -2220,7 +2220,7 @@ OutputDevice* PDFWriterImpl::getReferenceDevice()
{
if( ! m_pReferenceDevice )
{
- VirtualDevice* pVDev = new VirtualDevice( 0 );
+ VclPtrInstance<VirtualDevice> pVDev( 0 );
m_pReferenceDevice = pVDev;
@@ -10938,16 +10938,16 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject )
sal_Int32 nFunctionObject = createObject();
CHECK_RETURN( updateObject( nFunctionObject ) );
- VirtualDevice aDev;
- aDev.SetOutputSizePixel( rObject.m_aSize );
- aDev.SetMapMode( MapMode( MAP_PIXEL ) );
+ ScopedVclPtrInstance< VirtualDevice > aDev;
+ aDev->SetOutputSizePixel( rObject.m_aSize );
+ aDev->SetMapMode( MapMode( MAP_PIXEL ) );
if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
- aDev.SetDrawMode( aDev.GetDrawMode() |
+ aDev->SetDrawMode( aDev->GetDrawMode() |
( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT |
DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) );
- aDev.DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient );
+ aDev->DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient );
- Bitmap aSample = aDev.GetBitmap( Point( 0, 0 ), rObject.m_aSize );
+ Bitmap aSample = aDev->GetBitmap( Point( 0, 0 ), rObject.m_aSize );
BitmapReadAccess* pAccess = aSample.AcquireReadAccess();
AccessReleaser aReleaser( pAccess );
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 1f2ac6b1558a..60e12f58786b 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -590,7 +590,7 @@ public:
private:
static const BuiltinFont m_aBuiltinFonts[14];
- OutputDevice* m_pReferenceDevice;
+ VclPtr<OutputDevice> m_pReferenceDevice;
MapMode m_aMapMode; // PDFWriterImpl scaled units
std::vector< PDFPage > m_aPages;
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index e6bd287f6393..09c8d1b27997 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -244,10 +244,10 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
{
bool bAssertionFired( false );
- std::unique_ptr<VirtualDevice> xPrivateDevice;
+ ScopedVclPtr<VirtualDevice> xPrivateDevice;
if( ! pDummyVDev )
{
- xPrivateDevice.reset(new VirtualDevice());
+ xPrivateDevice.reset(VclPtr<VirtualDevice>::Create());
pDummyVDev = xPrivateDevice.get();
pDummyVDev->EnableOutput( false );
pDummyVDev->SetMapMode( i_rMtf.GetPrefMapMode() );
@@ -431,7 +431,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
if ( nPixelX && nPixelY )
{
Size aDstSizePixel( nPixelX, nPixelY );
- std::unique_ptr<VirtualDevice> xVDev(new VirtualDevice);
+ ScopedVclPtrInstance<VirtualDevice> xVDev;
if( xVDev->SetOutputSizePixel( aDstSizePixel ) )
{
Bitmap aPaint, aMask;
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index e96e14bc9c68..10d27223d22e 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -792,9 +792,9 @@ void Printer::ImplInitDisplay( const vcl::Window* pWindow )
mpJobGraphics = NULL;
if ( pWindow )
- mpDisplayDev = new VirtualDevice( *pWindow );
+ mpDisplayDev = VclPtr<VirtualDevice>::Create( *pWindow );
else
- mpDisplayDev = new VirtualDevice();
+ mpDisplayDev = VclPtr<VirtualDevice>::Create();
mpFontCollection = pSVData->maGDIData.mpScreenFontList;
mpFontCache = pSVData->maGDIData.mpScreenFontCache;
mnDPIX = mpDisplayDev->mnDPIX;
@@ -1015,16 +1015,22 @@ Printer::Printer( const OUString& rPrinterName )
Printer::~Printer()
{
+ disposeOnce();
+}
+
+void Printer::dispose()
+{
DBG_ASSERT( !IsPrinting(), "Printer::~Printer() - Job is printing" );
DBG_ASSERT( !IsJobActive(), "Printer::~Printer() - Job is active" );
delete mpPrinterOptions;
+ mpPrinterOptions = NULL;
ReleaseGraphics();
if ( mpInfoPrinter )
ImplGetSVData()->mpDefInst->DestroyInfoPrinter( mpInfoPrinter );
if ( mpDisplayDev )
- delete mpDisplayDev;
+ mpDisplayDev.disposeAndClear();
else
{
// OutputDevice Dtor is tryig the same thing; that why we need to set
@@ -1060,6 +1066,10 @@ Printer::~Printer()
mpNext->mpPrev = mpPrev;
else
pSVData->maGDIData.mpLastPrinter = mpPrev;
+
+ mpPrev.clear();
+ mpNext.clear();
+ OutputDevice::dispose();
}
sal_uLong Printer::GetCapabilities( sal_uInt16 nType ) const
@@ -1215,8 +1225,7 @@ bool Printer::SetPrinterProps( const Printer* pPrinter )
ReleaseGraphics();
if ( mpDisplayDev )
{
- delete mpDisplayDev;
- mpDisplayDev = NULL;
+ mpDisplayDev.disposeAndClear();
}
else
{
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 4b5a2f1505b9..c8470ac55d09 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -728,10 +728,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
ConnectedComponents aBackgroundComponent;
// create an OutputDevice to record mapmode changes and the like
- VirtualDevice aMapModeVDev;
- aMapModeVDev.mnDPIX = mnDPIX;
- aMapModeVDev.mnDPIY = mnDPIY;
- aMapModeVDev.EnableOutput(false);
+ ScopedVclPtrInstance< VirtualDevice > aMapModeVDev;
+ aMapModeVDev->mnDPIX = mnDPIX;
+ aMapModeVDev->mnDPIY = mnDPIY;
+ aMapModeVDev->EnableOutput(false);
int nLastBgAction, nActionNum;
@@ -766,7 +766,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
aBackgroundComponent.aBounds,
aBackgroundComponent.aBgColor,
static_cast<const MetaRectAction*>(pCurrAct)->GetRect(),
- aMapModeVDev) )
+ *aMapModeVDev.get()) )
bStillBackground=false; // incomplete occlusion of background
else
nLastBgAction=nActionNum; // this _is_ background
@@ -782,7 +782,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
aBackgroundComponent.aBounds,
aBackgroundComponent.aBgColor,
aPoly.GetBoundRect(),
- aMapModeVDev) )
+ *aMapModeVDev.get()) )
bStillBackground=false; // incomplete occlusion of background
else
nLastBgAction=nActionNum; // this _is_ background
@@ -799,7 +799,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
aBackgroundComponent.aBounds,
aBackgroundComponent.aBgColor,
aPoly.GetBoundRect(),
- aMapModeVDev) )
+ *aMapModeVDev.get()) )
bStillBackground=false; // incomplete occlusion of background
else
nLastBgAction=nActionNum; // this _is_ background
@@ -811,7 +811,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
aBackgroundComponent.aBounds,
aBackgroundComponent.aBgColor,
static_cast<const MetaWallpaperAction*>(pCurrAct)->GetRect(),
- aMapModeVDev) )
+ *aMapModeVDev.get()) )
bStillBackground=false; // incomplete occlusion of background
else
nLastBgAction=nActionNum; // this _is_ background
@@ -820,29 +820,29 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
default:
{
if( ImplIsNotTransparent( *pCurrAct,
- aMapModeVDev ) )
+ *aMapModeVDev.get() ) )
bStillBackground=false; // non-transparent action, possibly
// not uniform
else
// extend current bounds (next uniform action
// needs to fully cover this area)
aBackgroundComponent.aBounds.Union(
- ImplCalcActionBounds(*pCurrAct, aMapModeVDev) );
+ ImplCalcActionBounds(*pCurrAct, *aMapModeVDev.get()) );
break;
}
}
// execute action to get correct MapModes etc.
- pCurrAct->Execute( &aMapModeVDev );
+ pCurrAct->Execute( aMapModeVDev.get() );
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction();
++nActionNum;
}
// clean up aMapModeVDev
- sal_uInt32 nCount = aMapModeVDev.GetGCStackDepth();
+ sal_uInt32 nCount = aMapModeVDev->GetGCStackDepth();
while( nCount-- )
- aMapModeVDev.Pop();
+ aMapModeVDev->Pop();
ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements.
@@ -859,7 +859,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
pCurrAct, nActionNum) );
// execute action to get correct MapModes etc.
- pCurrAct->Execute( &aMapModeVDev );
+ pCurrAct->Execute( aMapModeVDev.get() );
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction();
++nActionNum;
}
@@ -873,10 +873,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(), ++nActionNum )
{
// execute action to get correct MapModes etc.
- pCurrAct->Execute( &aMapModeVDev );
+ pCurrAct->Execute( aMapModeVDev.get() );
// cache bounds of current action
- const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev) );
+ const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, *aMapModeVDev.get()) );
// accumulate collected bounds here, initialize with current action
Rectangle aTotalBounds( aBBCurrAct ); // thus,
@@ -902,7 +902,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// not be considered for connected components,
// too. Just put each of them into a separate
// component.
- aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev);
+ aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, *aMapModeVDev.get());
if( !aBBCurrAct.IsEmpty() &&
!aTotalComponents.bIsFullyTransparent )
@@ -1155,16 +1155,16 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
Point aDstPtPix( aBoundRect.TopLeft() );
Size aDstSzPix;
- VirtualDevice aMapVDev; // here, we record only mapmode information
- aMapVDev.EnableOutput(false);
+ ScopedVclPtrInstance<VirtualDevice> aMapVDev; // here, we record only mapmode information
+ aMapVDev->EnableOutput(false);
- VirtualDevice aPaintVDev; // into this one, we render.
- aPaintVDev.SetBackground( aBackgroundComponent.aBgColor );
+ ScopedVclPtrInstance<VirtualDevice> aPaintVDev; // into this one, we render.
+ aPaintVDev->SetBackground( aBackgroundComponent.aBgColor );
rOutMtf.AddAction( new MetaPushAction( PushFlags::MAPMODE ) );
rOutMtf.AddAction( new MetaMapModeAction() );
- aPaintVDev.SetDrawMode( GetDrawMode() );
+ aPaintVDev->SetDrawMode( GetDrawMode() );
while( aDstPtPix.Y() <= aBoundRect.Bottom() )
{
@@ -1180,15 +1180,15 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
aDstSzPix.Width() = aBoundRect.Right() - aDstPtPix.X() + 1L;
if( !Rectangle( aDstPtPix, aDstSzPix ).Intersection( aBoundRect ).IsEmpty() &&
- aPaintVDev.SetOutputSizePixel( aDstSzPix ) )
+ aPaintVDev->SetOutputSizePixel( aDstSzPix ) )
{
- aPaintVDev.Push();
- aMapVDev.Push();
+ aPaintVDev->Push();
+ aMapVDev->Push();
- aMapVDev.mnDPIX = aPaintVDev.mnDPIX = mnDPIX;
- aMapVDev.mnDPIY = aPaintVDev.mnDPIY = mnDPIY;
+ aMapVDev->mnDPIX = aPaintVDev->mnDPIX = mnDPIX;
+ aMapVDev->mnDPIY = aPaintVDev->mnDPIY = mnDPIY;
- aPaintVDev.EnableOutput(false);
+ aPaintVDev->EnableOutput(false);
// iterate over all actions
for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0;
@@ -1200,38 +1200,38 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// the current aCCList element
// (aCurr)
if( aCCList_MemberMap[nActionNum] == &(*aCurr) )
- aPaintVDev.EnableOutput(true);
+ aPaintVDev->EnableOutput(true);
// but process every action
const sal_uInt16 nType( pCurrAct->GetType() );
if( META_MAPMODE_ACTION == nType )
{
- pCurrAct->Execute( &aMapVDev );
+ pCurrAct->Execute( aMapVDev.get() );
- MapMode aMtfMap( aMapVDev.GetMapMode() );
- const Point aNewOrg( aMapVDev.PixelToLogic( aDstPtPix ) );
+ MapMode aMtfMap( aMapVDev->GetMapMode() );
+ const Point aNewOrg( aMapVDev->PixelToLogic( aDstPtPix ) );
aMtfMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
- aPaintVDev.SetMapMode( aMtfMap );
+ aPaintVDev->SetMapMode( aMtfMap );
}
else if( ( META_PUSH_ACTION == nType ) || ( META_POP_ACTION ) == nType )
{
- pCurrAct->Execute( &aMapVDev );
- pCurrAct->Execute( &aPaintVDev );
+ pCurrAct->Execute( aMapVDev.get() );
+ pCurrAct->Execute( aPaintVDev.get() );
}
else if( META_GRADIENT_ACTION == nType )
{
MetaGradientAction* pGradientAction = static_cast<MetaGradientAction*>(pCurrAct);
Printer* pPrinter = dynamic_cast< Printer* >(this);
if( pPrinter )
- pPrinter->DrawGradientEx( &aPaintVDev, pGradientAction->GetRect(), pGradientAction->GetGradient() );
+ pPrinter->DrawGradientEx( aPaintVDev.get(), pGradientAction->GetRect(), pGradientAction->GetGradient() );
else
DrawGradient( pGradientAction->GetRect(), pGradientAction->GetGradient() );
}
else
{
- pCurrAct->Execute( &aPaintVDev );
+ pCurrAct->Execute( aPaintVDev.get() );
}
if( !( nActionNum % 8 ) )
@@ -1239,9 +1239,9 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
}
const bool bOldMap = mbMap;
- mbMap = aPaintVDev.mbMap = false;
+ mbMap = aPaintVDev->mbMap = false;
- Bitmap aBandBmp( aPaintVDev.GetBitmap( Point(), aDstSzPix ) );
+ Bitmap aBandBmp( aPaintVDev->GetBitmap( Point(), aDstSzPix ) );
// scale down bitmap, if requested
if( bDownsampleBitmaps )
@@ -1255,10 +1255,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
rOutMtf.AddAction( new MetaBmpScaleAction( aDstPtPix, aDstSzPix, aBandBmp ) );
rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_END" ) );
- aPaintVDev.mbMap = true;
+ aPaintVDev->mbMap = true;
mbMap = bOldMap;
- aMapVDev.Pop();
- aPaintVDev.Pop();
+ aMapVDev->Pop();
+ aPaintVDev->Pop();
}
// overlapping bands to avoid missing lines (e.g. PostScript)
@@ -1276,9 +1276,9 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
}
// clean up aMapModeVDev
- nCount = aMapModeVDev.GetGCStackDepth();
+ nCount = aMapModeVDev->GetGCStackDepth();
while( nCount-- )
- aMapModeVDev.Pop();
+ aMapModeVDev->Pop();
// STAGE 4: Copy actions to output metafile
@@ -1309,7 +1309,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// given background color
ImplConvertTransparentAction(rOutMtf,
*pCurrAct,
- aMapModeVDev,
+ *aMapModeVDev.get(),
aBackgroundComponent.aBgColor);
}
else
@@ -1318,7 +1318,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
rOutMtf.AddAction( ( pCurrAct->Duplicate(), pCurrAct ) );
}
- pCurrAct->Execute(&aMapModeVDev);
+ pCurrAct->Execute(aMapModeVDev.get());
}
}
@@ -1335,7 +1335,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
else
rOutMtf.AddAction( new MetaLineColorAction( COL_BLUE, true) );
- rOutMtf.AddAction( new MetaRectAction( aMapModeVDev.PixelToLogic( aCurr->aBounds ) ) );
+ rOutMtf.AddAction( new MetaRectAction( aMapModeVDev->PixelToLogic( aCurr->aBounds ) ) );
}
#endif
}
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 543ab88ad245..bf5c5eef4ae8 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -140,7 +140,7 @@ public:
typedef std::unordered_map< OUString, ControlDependency, OUStringHash > ControlDependencyMap;
typedef std::unordered_map< OUString, Sequence< sal_Bool >, OUStringHash > ChoiceDisableMap;
- std::shared_ptr<Printer> mxPrinter;
+ VclPtr< Printer > mxPrinter;
Sequence< PropertyValue > maUIOptions;
std::vector< PropertyValue > maUIProperties;
std::vector< bool > maUIPropertyEnabled;
@@ -156,7 +156,7 @@ public:
vcl::PrinterController::MultiPageSetup maMultiPage;
- vcl::PrintProgressDialog* mpProgress;
+ VclPtr<vcl::PrintProgressDialog> mpProgress;
ImplPageCache maPageCache;
@@ -191,7 +191,7 @@ public:
mnDefaultPaperBin( -1 ),
mnFixedPaperBin( -1 )
{}
- ~ImplPrinterControllerData() { delete mpProgress; }
+ ~ImplPrinterControllerData() { mpProgress.disposeAndClear(); }
Size getRealPaperSize( const Size& i_rPageSize, bool bNoNUP ) const
{
@@ -207,7 +207,7 @@ public:
void resetPaperToLastConfigured();
};
-PrinterController::PrinterController(const std::shared_ptr<Printer>& i_xPrinter)
+PrinterController::PrinterController( const VclPtr<Printer>& i_xPrinter )
: mpImplData( new ImplPrinterControllerData )
{
mpImplData->mxPrinter = i_xPrinter;
@@ -305,9 +305,10 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
{
if (xController->isShowDialogs())
{
- MessageDialog aBox(NULL, "ErrorNoPrinterDialog",
+ ScopedVclPtrInstance<MessageDialog> aBox(
+ nullptr, "ErrorNoPrinterDialog",
"vcl/ui/errornoprinterdialog.ui");
- aBox.Execute();
+ aBox->Execute();
}
xController->setValue( OUString( "IsDirect" ),
makeAny( false ) );
@@ -320,7 +321,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
if (!xController->getPrinter())
{
OUString aPrinterName( i_rInitSetup.GetPrinterName() );
- std::shared_ptr<Printer> xPrinter(std::make_shared<Printer>(aPrinterName));
+ VclPtrInstance<Printer> xPrinter( aPrinterName );
xPrinter->SetJobSetup(i_rInitSetup);
xController->setPrinter(xPrinter);
}
@@ -454,9 +455,10 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
{
if( xController->getFilteredPageCount() == 0 )
{
- MessageDialog aBox(NULL, "ErrorNoContentDialog",
+ ScopedVclPtrInstance<MessageDialog> aBox(
+ nullptr, "ErrorNoContentDialog",
"vcl/ui/errornocontentdialog.ui");
- aBox.Execute();
+ aBox->Execute();
return;
}
}
@@ -470,13 +472,13 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
{
try
{
- PrintDialog aDlg( NULL, xController );
- if( ! aDlg.Execute() )
+ ScopedVclPtrInstance< PrintDialog > aDlg( nullptr, xController );
+ if( ! aDlg->Execute() )
{
xController->abortJob();
return;
}
- if( aDlg.isPrintToFile() )
+ if( aDlg->isPrintToFile() )
{
OUString aFile = queryFile( xController->getPrinter().get() );
if( aFile.isEmpty() )
@@ -487,7 +489,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
xController->setValue( OUString( "LocalFileName" ),
makeAny( aFile ) );
}
- else if( aDlg.isSingleJobs() )
+ else if( aDlg->isSingleJobs() )
{
xController->setValue( OUString( "PrintCollateAsSingleJobs" ),
makeAny( true ) );
@@ -771,12 +773,12 @@ void PrinterController::setJobState( view::PrintableState i_eState )
mpImplData->meJobState = i_eState;
}
-const std::shared_ptr<Printer>& PrinterController::getPrinter() const
+const VclPtr<Printer>& PrinterController::getPrinter() const
{
return mpImplData->mxPrinter;
}
-void PrinterController::setPrinter(const std::shared_ptr<Printer>& i_rPrinter)
+void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter )
{
mpImplData->mxPrinter = i_rPrinter;
setValue( OUString( "Name" ),
@@ -1332,8 +1334,7 @@ void PrinterController::abortJob()
// applications (well, sw) depend on a page request with "IsLastPage" = true
// to free resources, else they (well, sw) will crash eventually
setLastPage( true );
- delete mpImplData->mpProgress;
- mpImplData->mpProgress = NULL;
+ mpImplData->mpProgress.disposeAndClear();
GDIMetaFile aMtf;
getPageFile( 0, aMtf, false );
}
@@ -1660,7 +1661,7 @@ void PrinterController::createProgressDialog()
if( bShow && ! Application::IsHeadlessModeEnabled() )
{
- mpImplData->mpProgress = new PrintProgressDialog( NULL, getPageCountProtected() );
+ mpImplData->mpProgress = VclPtr<PrintProgressDialog>::Create( nullptr, getPageCountProtected() );
mpImplData->mpProgress->Show();
}
}
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index b94b6c20e1d6..c453d91ef81d 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -255,6 +255,12 @@ VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size &rSize,
VirtualDevice::~VirtualDevice()
{
SAL_INFO( "vcl.gdi", "VirtualDevice::~VirtualDevice()" );
+ disposeOnce();
+}
+
+void VirtualDevice::dispose()
+{
+ SAL_INFO( "vcl.gdi", "VirtualDevice::dispose()" );
ImplSVData* pSVData = ImplGetSVData();
@@ -272,6 +278,8 @@ VirtualDevice::~VirtualDevice()
mpNext->mpPrev = mpPrev;
else
pSVData->maGDIData.mpLastVirDev = mpPrev;
+
+ OutputDevice::dispose();
}
bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
@@ -392,13 +400,12 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
// #110958# Setup alpha bitmap
if(mpAlphaVDev && mpAlphaVDev->GetOutputSizePixel() != rNewSize)
{
- delete mpAlphaVDev;
- mpAlphaVDev = 0L;
+ mpAlphaVDev.disposeAndClear();
}
if( !mpAlphaVDev )
{
- mpAlphaVDev = new VirtualDevice( *this, mnAlphaDepth );
+ mpAlphaVDev = VclPtr<VirtualDevice>::Create( *this, mnAlphaDepth );
mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase,
basebmp::RawMemorySharedArray(),
bTopDown );
diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx
index 45ea7e091820..2594ad47c22a 100644
--- a/vcl/source/helper/lazydelete.cxx
+++ b/vcl/source/helper/lazydelete.cxx
@@ -32,9 +32,8 @@ LazyDeletorBase::~LazyDeletorBase()
{
}
-// instantiate instance pointers for LazyDeletor<Window,Menu>
+// instantiate instance pointer for LazyDeletor<Window>
template<> LazyDeletor<vcl::Window>* LazyDeletor<vcl::Window>::s_pOneInstance = NULL;
-template<> LazyDeletor<Menu>* LazyDeletor<Menu>::s_pOneInstance = NULL;
// a list for all LazyeDeletor<T> singletons
static std::vector< LazyDeletorBase* > lcl_aDeletors;
@@ -60,16 +59,6 @@ template<> bool LazyDeletor<vcl::Window>::is_less( vcl::Window* left, vcl::Windo
return left != right && right->IsChild( left, true );
}
-#ifndef LINUX
-// specialized is_less function for Menu
-template<> bool LazyDeletor<Menu>::is_less( Menu* left, Menu* right )
-{
- while( left && left != right )
- left = left->ImplGetStartedFrom();
- return left != NULL;
-}
-#endif
-
DeleteOnDeinitBase::~DeleteOnDeinitBase()
{
ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 70c263a01ed3..8d298a434978 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -102,6 +102,8 @@ OpenGLContext::~OpenGLContext()
mpNextContext->mpPrevContext = mpPrevContext;
else
pSVData->maGDIData.mpLastContext = mpPrevContext;
+
+ m_pChildWindow.disposeAndClear();
}
#ifdef DBG_UTIL
@@ -657,7 +659,7 @@ bool OpenGLContext::init( vcl::Window* pParent )
if(mbInitialized)
return true;
- m_xWindow.reset(pParent ? NULL : new vcl::Window(0, WB_NOBORDER|WB_NODIALOGCONTROL));
+ m_xWindow.reset(pParent ? nullptr : VclPtr<vcl::Window>::Create(nullptr, WB_NOBORDER|WB_NODIALOGCONTROL));
mpWindow = pParent ? pParent : m_xWindow.get();
if(m_xWindow)
m_xWindow->setPosSizePixel(0,0,0,0);
@@ -1080,8 +1082,7 @@ bool OpenGLContext::initWindow()
if( !m_pChildWindow )
{
SystemWindowData winData = generateWinData(mpWindow, false);
- m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false);
- m_xChildWindowGC.reset(m_pChildWindow);
+ m_pChildWindow = VclPtr<SystemChildWindow>::Create(mpWindow, 0, &winData, false);
}
if( m_pChildWindow )
@@ -1108,8 +1109,7 @@ bool OpenGLContext::initWindow()
if( !m_pChildWindow )
{
SystemWindowData winData = generateWinData(mpWindow, mbRequestLegacyContext);
- m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false);
- m_xChildWindowGC.reset(m_pChildWindow);
+ m_pChildWindow = VclPtr<SystemChildWindow>::Create(mpWindow, 0, &winData, false);
}
if( m_pChildWindow )
@@ -1143,8 +1143,7 @@ bool OpenGLContext::initWindow()
{
if( !m_pChildWindow )
{
- m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false);
- m_xChildWindowGC.reset(m_pChildWindow);
+ m_pChildWindow = VclPtr<SystemChildWindow>::Create(mpWindow, 0, &winData, false);
}
pChildSysData = m_pChildWindow->GetSystemData();
}
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 9f13a24f1442..03938508643f 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -410,11 +410,11 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
// If the visible part has been clipped, we have to create a
// Bitmap with the correct size in which we copy the clipped
// Bitmap to the correct position.
- VirtualDevice aVDev( *this );
+ ScopedVclPtrInstance< VirtualDevice > aVDev( *this );
- if ( aVDev.SetOutputSizePixel( aRect.GetSize() ) )
+ if ( aVDev->SetOutputSizePixel( aRect.GetSize() ) )
{
- if ( ((OutputDevice*)&aVDev)->mpGraphics || ((OutputDevice*)&aVDev)->AcquireGraphics() )
+ if ( ((OutputDevice*)aVDev.get())->mpGraphics || ((OutputDevice*)aVDev.get())->AcquireGraphics() )
{
if ( (nWidth > 0) && (nHeight > 0) )
{
@@ -422,14 +422,14 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
(aRect.Left() < mnOutOffX) ? (mnOutOffX - aRect.Left()) : 0L,
(aRect.Top() < mnOutOffY) ? (mnOutOffY - aRect.Top()) : 0L,
nWidth, nHeight);
- (((OutputDevice*)&aVDev)->mpGraphics)->CopyBits( aPosAry, mpGraphics, this, this );
+ (((OutputDevice*)aVDev.get())->mpGraphics)->CopyBits( aPosAry, mpGraphics, this, this );
}
else
{
OSL_ENSURE(false, "CopyBits with negative width or height (!)");
}
- aBmp = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
+ aBmp = aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() );
}
else
bClipped = false;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 1bf2df824ff6..27810d43ade9 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -91,7 +91,12 @@ vcl::FontInfo OutputDevice::GetDevFont( int nDevFontIndex ) const
int OutputDevice::GetDevFontCount() const
{
if( !mpGetDevFontList )
+ {
+ if (!mpFontCollection)
+ return 0;
+
mpGetDevFontList = mpFontCollection->GetDevFontList();
+ }
return mpGetDevFontList->Count();
}
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index b359e504d0a9..e7eed8872143 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -232,9 +232,8 @@ static void ImplCalcMapResolution( const MapMode& rMapMode,
vcl::Window::ImplInitAppFontData( pSVData->maWinData.mpFirstFrame );
else
{
- WorkWindow* pWin = new WorkWindow( NULL, 0 );
+ ScopedVclPtrInstance<WorkWindow> pWin( nullptr, 0 );
vcl::Window::ImplInitAppFontData( pWin );
- delete pWin;
}
}
rMapRes.mnMapScNumX = pSVData->maGDIData.mnAppFontX;
@@ -343,6 +342,9 @@ inline void ImplCalcMapResolution( const MapMode& rMapMode,
// #i75163#
void OutputDevice::ImplInvalidateViewTransform()
{
+ if(!mpOutDevData)
+ return;
+
if(mpOutDevData->mpViewTransform)
{
delete mpOutDevData->mpViewTransform;
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 372eb23bc8f4..855a2d46a27f 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -82,12 +82,12 @@ namespace {
// Begin initializer and accessor public functions
OutputDevice::OutputDevice() :
+ mnRefCnt(1), // cf. VclPtrInstance and README.lifecycle
maRegion(true),
maFillColor( COL_WHITE ),
maTextLineColor( COL_TRANSPARENT ),
mxSettings( new AllSettings(Application::GetSettings()) )
{
-
mpGraphics = NULL;
mpUnoGraphicsList = NULL;
mpPrevGraphics = NULL;
@@ -179,11 +179,32 @@ OutputDevice::OutputDevice() :
// #i75163#
mpOutDevData->mpViewTransform = NULL;
mpOutDevData->mpInverseViewTransform = NULL;
+
+ mbDisposed = false;
}
OutputDevice::~OutputDevice()
{
+ disposeOnce();
+}
+
+void OutputDevice::disposeOnce()
+{
+ if ( mbDisposed )
+ return;
+ mbDisposed = true;
+
+ // catch badness where our OutputDevice sub-class was not
+ // wrapped safely in a VclPtr cosily.
+ // FIXME: as/when we make our destructors all protected,
+ // we should introduce this assert:
+ // assert( mnRefCnt > 0 );
+ dispose();
+}
+
+void OutputDevice::dispose()
+{
if ( GetUnoGraphicsList() )
{
UnoWrapperBase* pWrapper = Application::GetUnoWrapper( false );
@@ -193,12 +214,13 @@ OutputDevice::~OutputDevice()
mpUnoGraphicsList = NULL;
}
- delete mpOutDevData->mpRotateDev;
+ mpOutDevData->mpRotateDev.disposeAndClear();
// #i75163#
ImplInvalidateViewTransform();
delete mpOutDevData;
+ mpOutDevData = NULL;
// for some reason, we haven't removed state from the stack properly
if ( !mpOutDevStateStack->empty() )
@@ -210,6 +232,7 @@ OutputDevice::~OutputDevice()
}
}
delete mpOutDevStateStack;
+ mpOutDevStateStack = NULL;
// release the active font instance
if( mpFontEntry )
@@ -218,8 +241,10 @@ OutputDevice::~OutputDevice()
// remove cached results of GetDevFontList/GetDevSizeList
// TODO: use smart pointers for them
delete mpGetDevFontList;
+ mpGetDevFontList = NULL;
delete mpGetDevSizeList;
+ mpGetDevSizeList = NULL;
// release ImplFontCache specific to this OutputDevice
// TODO: refcount ImplFontCache
@@ -242,7 +267,7 @@ OutputDevice::~OutputDevice()
mpFontCollection = NULL;
}
- delete mpAlphaVDev;
+ mpAlphaVDev.disposeAndClear();
}
SalGraphics* OutputDevice::GetGraphics()
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index a71c7d66cb92..bc6bd4a8b6c9 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -641,6 +641,7 @@ void OutputDevice::InitFillColor()
void OutputDevice::ImplReleaseFonts()
{
mpGraphics->ReleaseFonts();
+
mbNewFont = true;
mbInitFont = true;
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index eb7104d06215..1cc48a32223b 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -236,7 +236,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )
// cache virtual device for rotation
if (!mpOutDevData->mpRotateDev)
- mpOutDevData->mpRotateDev = new VirtualDevice( *this, 1 );
+ mpOutDevData->mpRotateDev = VclPtr<VirtualDevice>::Create( *this, 1 );
VirtualDevice* pVDev = mpOutDevData->mpRotateDev;
// size it accordingly
@@ -2494,18 +2494,18 @@ bool OutputDevice::GetTextBoundRect( Rectangle& rRect,
// fall back to bitmap method to get the bounding rectangle,
// so we need a monochrome virtual device with matching font
- VirtualDevice aVDev( 1 );
+ ScopedVclPtrInstance< VirtualDevice > aVDev( 1 );
vcl::Font aFont( GetFont() );
aFont.SetShadow( false );
aFont.SetOutline( false );
aFont.SetRelief( RELIEF_NONE );
aFont.SetOrientation( 0 );
aFont.SetSize( Size( mpFontEntry->maFontSelData.mnWidth, mpFontEntry->maFontSelData.mnHeight ) );
- aVDev.SetFont( aFont );
- aVDev.SetTextAlign( ALIGN_TOP );
+ aVDev->SetFont( aFont );
+ aVDev->SetTextAlign( ALIGN_TOP );
// layout the text on the virtual device
- pSalLayout = aVDev.ImplLayout( rStr, nIndex, nLen, aPoint, nLayoutWidth, pDXAry );
+ pSalLayout = aVDev->ImplLayout( rStr, nIndex, nLen, aPoint, nLayoutWidth, pDXAry );
if( !pSalLayout )
return false;
@@ -2515,7 +2515,7 @@ bool OutputDevice::GetTextBoundRect( Rectangle& rRect,
long nHeight = mpFontEntry->mnLineHeight + mnEmphasisAscent + mnEmphasisDescent;
Point aOffset( nWidth/2, 8 );
Size aOutSize( nWidth + 2*aOffset.X(), nHeight + 2*aOffset.Y() );
- if( !nWidth || !aVDev.SetOutputSizePixel( aOutSize ) )
+ if( !nWidth || !aVDev->SetOutputSizePixel( aOutSize ) )
{
pSalLayout->Release();
return false;
@@ -2523,14 +2523,14 @@ bool OutputDevice::GetTextBoundRect( Rectangle& rRect,
// draw text in black
pSalLayout->DrawBase() = aOffset;
- aVDev.SetTextColor( Color( COL_BLACK ) );
- aVDev.SetTextFillColor();
- aVDev.ImplInitTextColor();
- aVDev.ImplDrawText( *pSalLayout );
+ aVDev->SetTextColor( Color( COL_BLACK ) );
+ aVDev->SetTextFillColor();
+ aVDev->ImplInitTextColor();
+ aVDev->ImplDrawText( *pSalLayout );
pSalLayout->Release();
// find extents using the bitmap
- Bitmap aBmp = aVDev.GetBitmap( Point(), aOutSize );
+ Bitmap aBmp = aVDev->GetBitmap( Point(), aOutSize );
BitmapReadAccess* pAcc = aBmp.AcquireReadAccess();
if( !pAcc )
return false;
@@ -2718,7 +2718,7 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
+ mnEmphasisDescent;
pSalLayout->Release();
- VirtualDevice aVDev(1);
+ ScopedVclPtrInstance< VirtualDevice > aVDev( 1 );
vcl::Font aFont(GetFont());
aFont.SetShadow(false);
@@ -2728,19 +2728,19 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
if( bOptimize )
{
aFont.SetSize( Size( 0, GLYPH_FONT_HEIGHT ) );
- aVDev.SetMapMode( MAP_PIXEL );
+ aVDev->SetMapMode( MAP_PIXEL );
}
- aVDev.SetFont( aFont );
- aVDev.SetTextAlign( ALIGN_TOP );
- aVDev.SetTextColor( Color(COL_BLACK) );
- aVDev.SetTextFillColor();
+ aVDev->SetFont( aFont );
+ aVDev->SetTextAlign( ALIGN_TOP );
+ aVDev->SetTextColor( Color(COL_BLACK) );
+ aVDev->SetTextFillColor();
- pSalLayout = aVDev.ImplLayout( rStr, nIndex, nLen, Point(0,0), nLayoutWidth, pDXArray );
+ pSalLayout = aVDev->ImplLayout( rStr, nIndex, nLen, Point(0,0), nLayoutWidth, pDXArray );
if (pSalLayout == 0)
return false;
long nWidth = pSalLayout->GetTextWidth();
- long nHeight = ((OutputDevice*)&aVDev)->mpFontEntry->mnLineHeight + ((OutputDevice*)&aVDev)->mnEmphasisAscent
- + ((OutputDevice*)&aVDev)->mnEmphasisDescent;
+ long nHeight = aVDev->mpFontEntry->mnLineHeight + aVDev->mnEmphasisAscent +
+ aVDev->mnEmphasisDescent;
pSalLayout->Release();
if( !nWidth || !nHeight )
@@ -2755,7 +2755,7 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
{
sal_Int32 nStart = ((nBase < nIndex) ? nBase : nIndex);
sal_Int32 nLength = ((nBase > nIndex) ? nBase : nIndex) - nStart;
- pSalLayout = aVDev.ImplLayout( rStr, nStart, nLength, Point(0,0), nLayoutWidth, pDXArray );
+ pSalLayout = aVDev->ImplLayout( rStr, nStart, nLength, Point(0,0), nLayoutWidth, pDXArray );
if( pSalLayout )
{
nXOffset = pSalLayout->GetTextWidth();
@@ -2776,25 +2776,25 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
bool bSuccess = false;
// draw character into virtual device
- pSalLayout = aVDev.ImplLayout( rStr, nCharPos, 1, Point(0,0), nLayoutWidth, pDXArray );
+ pSalLayout = aVDev->ImplLayout( rStr, nCharPos, 1, Point(0,0), nLayoutWidth, pDXArray );
if (pSalLayout == 0)
return false;
long nCharWidth = pSalLayout->GetTextWidth();
Point aOffset(nCharWidth / 2, 8);
Size aSize(nCharWidth + 2 * aOffset.X(), nHeight + 2 * aOffset.Y());
- bSuccess = (bool)aVDev.SetOutputSizePixel(aSize);
+ bSuccess = (bool)aVDev->SetOutputSizePixel(aSize);
if( bSuccess )
{
// draw glyph into virtual device
- aVDev.Erase();
+ aVDev->Erase();
pSalLayout->DrawBase() += aOffset;
- pSalLayout->DrawBase() += Point( ((OutputDevice*)&aVDev)->mnTextOffX, ((OutputDevice*)&aVDev)->mnTextOffY );
- pSalLayout->DrawText( *((OutputDevice*)&aVDev)->mpGraphics );
+ pSalLayout->DrawBase() += Point( aVDev->mnTextOffX, aVDev->mnTextOffY );
+ pSalLayout->DrawText( *aVDev->mpGraphics );
pSalLayout->Release();
// convert character image into outline
- Bitmap aBmp( aVDev.GetBitmap(Point(0, 0), aSize));
+ Bitmap aBmp( aVDev->GetBitmap(Point(0, 0), aSize));
tools::PolyPolygon aPolyPoly;
bool bVectorized = aBmp.Vectorize(aPolyPoly, BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES);
@@ -2810,8 +2810,8 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
{
Point& rPt = rPoly[k];
rPt -= aOffset;
- int nPixelX = rPt.X() - ((OutputDevice&)aVDev).mnTextOffX + nXOffset;
- int nPixelY = rPt.Y() - ((OutputDevice&)aVDev).mnTextOffY;
+ int nPixelX = rPt.X() - ((OutputDevice*)aVDev.get())->mnTextOffX + nXOffset;
+ int nPixelY = rPt.Y() - ((OutputDevice*)aVDev.get())->mnTextOffY;
rPt.X() = ImplDevicePixelToLogicWidth( nPixelX );
rPt.Y() = ImplDevicePixelToLogicHeight( nPixelY );
}
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 60f68c28e5dc..425a56ab7514 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -116,7 +116,7 @@ sal_uInt16 OutputDevice::GetAlphaBitCount() const
bool OutputDevice::HasAlpha()
{
- return mpAlphaVDev != NULL;
+ return mpAlphaVDev != nullptr;
}
void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
@@ -431,25 +431,25 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
if( !bDrawn )
{
- VirtualDevice aVDev( *this, 1 );
+ ScopedVclPtrInstance< VirtualDevice > aVDev( *this, 1 );
const Size aDstSz( aDstRect.GetSize() );
const sal_uInt8 cTrans = (sal_uInt8) MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 );
if( aDstRect.Left() || aDstRect.Top() )
aPolyPoly.Move( -aDstRect.Left(), -aDstRect.Top() );
- if( aVDev.SetOutputSizePixel( aDstSz ) )
+ if( aVDev->SetOutputSizePixel( aDstSz ) )
{
const bool bOldMap = mbMap;
EnableMapMode( false );
- aVDev.SetLineColor( COL_BLACK );
- aVDev.SetFillColor( COL_BLACK );
- aVDev.DrawPolyPolygon( aPolyPoly );
+ aVDev->SetLineColor( COL_BLACK );
+ aVDev->SetFillColor( COL_BLACK );
+ aVDev->DrawPolyPolygon( aPolyPoly );
Bitmap aPaint( GetBitmap( aDstRect.TopLeft(), aDstSz ) );
- Bitmap aPolyMask( aVDev.GetBitmap( Point(), aDstSz ) );
+ Bitmap aPolyMask( aVDev->GetBitmap( Point(), aDstSz ) );
// #107766# check for non-empty bitmaps before accessing them
if( !!aPaint && !!aPolyMask )
@@ -683,7 +683,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
if( !aDstRect.IsEmpty() )
{
- std::unique_ptr<VirtualDevice> xVDev(new VirtualDevice);
+ ScopedVclPtrInstance< VirtualDevice > xVDev;
((OutputDevice*)xVDev.get())->mnDPIX = mnDPIX;
((OutputDevice*)xVDev.get())->mnDPIY = mnDPIY;
diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx
index 8e4d86bc321f..ba7928b4f812 100644
--- a/vcl/source/outdev/wallpaper.cxx
+++ b/vcl/source/outdev/wallpaper.cxx
@@ -129,11 +129,11 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
{
if( !pCached && !rWallpaper.GetColor().GetTransparency() )
{
- VirtualDevice aVDev( *this );
- aVDev.SetBackground( rWallpaper.GetColor() );
- aVDev.SetOutputSizePixel( Size( nBmpWidth, nBmpHeight ) );
- aVDev.DrawBitmapEx( Point(), aBmpEx );
- aBmpEx = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
+ ScopedVclPtrInstance< VirtualDevice > aVDev( *this );
+ aVDev->SetBackground( rWallpaper.GetColor() );
+ aVDev->SetOutputSizePixel( Size( nBmpWidth, nBmpHeight ) );
+ aVDev->DrawBitmapEx( Point(), aBmpEx );
+ aBmpEx = aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() );
}
bDrawColorBackground = true;
diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx
index e889e78f8644..bb93b1207dd8 100644
--- a/vcl/source/uipreviewer/previewer.cxx
+++ b/vcl/source/uipreviewer/previewer.cxx
@@ -68,8 +68,7 @@ int UIPreviewApp::Main()
try
{
- Dialog *pDialog = new Dialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);
-
+ VclPtrInstance<Dialog> pDialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);
{
VclBuilder aBuilder(pDialog, OUString(), uifiles[0]);
vcl::Window *pRoot = aBuilder.get_widget_root();
@@ -90,7 +89,7 @@ int UIPreviewApp::Main()
pRealDialog->Execute();
}
- delete pDialog;
+ pDialog.disposeAndClear();
}
catch (const uno::Exception &e)
{
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index a3b7c0f8d061..99fea0983520 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -20,6 +20,7 @@
#include <tools/debug.hxx>
#include <tools/rc.h>
+#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
#include <accel.h>
#include <vcl/accel.hxx>
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx
index fc3dc74d009d..07abf759c92d 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -136,6 +136,8 @@ namespace vcl {
return pChild->GetAccessible();
}
*/
+ if ( !mpWindowImpl )
+ return css::uno::Reference< css::accessibility::XAccessible >();
if ( !mpWindowImpl->mxAccessible.is() && bCreate )
mpWindowImpl->mxAccessible = CreateAccessible();
@@ -647,12 +649,11 @@ vcl::Window* Window::GetAccessibleRelationLabeledBy() const
if (mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow)
return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow;
- std::vector<FixedText*> aMnemonicLabels(list_mnemonic_labels());
+ std::vector<VclPtr<FixedText> > aMnemonicLabels(list_mnemonic_labels());
if (!aMnemonicLabels.empty())
{
//if we have multiple labels, then prefer the first that is visible
- for (std::vector<FixedText*>::iterator
- aI = aMnemonicLabels.begin(), aEnd = aMnemonicLabels.end(); aI != aEnd; ++aI)
+ for (auto aI = aMnemonicLabels.begin(), aEnd = aMnemonicLabels.end(); aI != aEnd; ++aI)
{
vcl::Window *pCandidate = *aI;
if (pCandidate->IsVisible())
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index c472777cf101..88ef65a07391 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1013,7 +1013,7 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei
vcl::Window *pWin = NULL, *pCtrl = NULL;
if (mpOutDev->GetOutDevType() == OUTDEV_WINDOW)
- pWin = static_cast<vcl::Window*>(mpOutDev);
+ pWin = static_cast<vcl::Window*>(mpOutDev.get());
if (pWin)
pCtrl = mpBorderWindow->GetWindow(WINDOW_CLIENT);
@@ -1193,7 +1193,7 @@ void ImplSmallBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice*
// control this border belongs to
vcl::Window *pWin = NULL, *pCtrl = NULL;
if( mpOutDev->GetOutDevType() == OUTDEV_WINDOW )
- pWin = static_cast<vcl::Window*>(mpOutDev);
+ pWin = static_cast<vcl::Window*>(mpOutDev.get());
ControlType aCtrlType = 0;
ControlPart aCtrlPart = PART_ENTIRE_CONTROL;
@@ -1364,8 +1364,8 @@ ImplStdBorderWindowView::ImplStdBorderWindowView( ImplBorderWindow* pBorderWindo
ImplStdBorderWindowView::~ImplStdBorderWindowView()
{
- delete mpATitleVirDev;
- delete mpDTitleVirDev;
+ mpATitleVirDev.disposeAndClear();
+ mpDTitleVirDev.disposeAndClear();
}
bool ImplStdBorderWindowView::MouseMove( const MouseEvent& rMEvt )
@@ -1556,7 +1556,7 @@ long ImplStdBorderWindowView::CalcTitleWidth() const
void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset )
{
ImplBorderFrameData* pData = &maFrameData;
- OutputDevice* pDev = pOutDev ? pOutDev : pData->mpOutDev;
+ OutputDevice* pDev = pOutDev ? pOutDev : pData->mpOutDev.get();
ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
Point aTmpPoint = pOffset ? Point(*pOffset) : Point();
Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
@@ -1851,7 +1851,15 @@ ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, WinBits nStyle ,
ImplBorderWindow::~ImplBorderWindow()
{
+ disposeOnce();
+}
+
+void ImplBorderWindow::dispose()
+{
delete mpBorderView;
+ mpBorderView = NULL;
+ mpMenuBarWindow.clear();
+ vcl::Window::dispose();
}
void ImplBorderWindow::MouseMove( const MouseEvent& rMEvt )
diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx
index 515d17a20cc6..2e8532cecba7 100644
--- a/vcl/source/window/btndlg.cxx
+++ b/vcl/source/window/btndlg.cxx
@@ -30,10 +30,10 @@ typedef boost::ptr_vector<ImplBtnDlgItem>::const_iterator btn_const_iterator;
struct ImplBtnDlgItem
{
sal_uInt16 mnId;
- bool mbOwnButton;
- bool mbDummyAlign;
- long mnSepSize;
- PushButton* mpPushButton;
+ bool mbOwnButton;
+ bool mbDummyAlign;
+ long mnSepSize;
+ VclPtr<PushButton> mpPushButton;
};
void ButtonDialog::ImplInitButtonDialogData()
@@ -59,11 +59,18 @@ ButtonDialog::ButtonDialog( vcl::Window* pParent, WinBits nStyle ) :
ButtonDialog::~ButtonDialog()
{
+ disposeOnce();
+}
+
+void ButtonDialog::dispose()
+{
for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
- if ( it->mpPushButton && it->mbOwnButton )
- delete it->mpPushButton;
+ if ( it->mbOwnButton )
+ it->mpPushButton.disposeAndClear();
}
+ maItemList.clear();
+ Dialog::dispose();
}
PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags )
@@ -74,13 +81,13 @@ PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags )
if ( nBtnFlags & BUTTONDIALOG_DEFBUTTON )
nStyle |= WB_DEFBUTTON;
if ( nBtnFlags & BUTTONDIALOG_CANCELBUTTON )
- pBtn = new CancelButton( this, nStyle );
+ pBtn = VclPtr<CancelButton>::Create( this, nStyle );
else if ( nBtnFlags & BUTTONDIALOG_OKBUTTON )
- pBtn = new OKButton( this, nStyle );
+ pBtn = VclPtr<OKButton>::Create( this, nStyle );
else if ( nBtnFlags & BUTTONDIALOG_HELPBUTTON )
- pBtn = new HelpButton( this, nStyle );
+ pBtn = VclPtr<HelpButton>::Create( this, nStyle );
else
- pBtn = new PushButton( this, nStyle );
+ pBtn = VclPtr<PushButton>::Create( this, nStyle );
if ( !(nBtnFlags & BUTTONDIALOG_HELPBUTTON) )
pBtn->SetClickHdl( LINK( this, ButtonDialog, ImplClickHdl ) );
@@ -327,10 +334,10 @@ void ButtonDialog::RemoveButton( sal_uInt16 nId )
if (it->mnId == nId)
{
it->mpPushButton->Hide();
-
- if (it->mbOwnButton )
- delete it->mpPushButton;
-
+ if (it->mbOwnButton)
+ it->mpPushButton.disposeAndClear();
+ else
+ it->mpPushButton.clear();
maItemList.erase(it);
return;
}
@@ -344,9 +351,8 @@ void ButtonDialog::Clear()
for (btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
it->mpPushButton->Hide();
-
- if (it->mbOwnButton )
- delete it->mpPushButton;
+ if (it->mbOwnButton)
+ it->mpPushButton.disposeAndClear();
}
maItemList.clear();
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index f7de2d12130a..dc06f34a003f 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -471,14 +471,14 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
//Remove ScrollWindow parent widgets whose children in vcl implement scrolling
//internally.
- for (std::map<vcl::Window*, vcl::Window*>::iterator aI = m_pParserState->m_aRedundantParentWidgets.begin(),
+ for (auto aI = m_pParserState->m_aRedundantParentWidgets.begin(),
aEnd = m_pParserState->m_aRedundantParentWidgets.end(); aI != aEnd; ++aI)
{
delete_by_window(aI->first);
}
//fdo#67378 merge the label into the disclosure button
- for (std::vector<VclExpander*>::iterator aI = m_pParserState->m_aExpanderWidgets.begin(),
+ for (auto aI = m_pParserState->m_aExpanderWidgets.begin(),
aEnd = m_pParserState->m_aExpanderWidgets.end(); aI != aEnd; ++aI)
{
VclExpander *pOne = *aI;
@@ -525,17 +525,24 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
VclBuilder::~VclBuilder()
{
+ disposeBuilder();
+}
+
+void VclBuilder::disposeBuilder()
+{
for (std::vector<WinAndId>::reverse_iterator aI = m_aChildren.rbegin(),
aEnd = m_aChildren.rend(); aI != aEnd; ++aI)
{
- delete aI->m_pWindow;
+ aI->m_pWindow.disposeAndClear();
}
+ m_aChildren.clear();
for (std::vector<MenuAndId>::reverse_iterator aI = m_aMenus.rbegin(),
aEnd = m_aMenus.rend(); aI != aEnd; ++aI)
{
delete aI->m_pMenu;
}
+ m_aMenus.clear();
}
void VclBuilder::handleTranslations(xmlreader::XmlReader &reader)
@@ -1259,7 +1266,7 @@ void VclBuilder::cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, vcl::Wind
extern "C" { static void SAL_CALL thisModule() {} }
#endif
-vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, const OString &name, const OString &id,
+VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &name, const OString &id,
stringmap &rMap)
{
bool bIsPlaceHolder = name.isEmpty();
@@ -1301,7 +1308,7 @@ vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, const OString &name, c
}
if (bIsPlaceHolder || name == "GtkTreeSelection")
- return NULL;
+ return nullptr;
extractButtonImage(id, rMap, name == "GtkRadioButton");
@@ -1696,7 +1703,7 @@ vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, const OString &name, c
m_pParserState->m_nLastToolbarId = nItemId;
- return NULL; // no widget to be created
+ return nullptr; // no widget to be created
}
}
else if (name == "GtkSeparatorToolItem")
@@ -1705,7 +1712,7 @@ vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, const OString &name, c
if (pToolBox)
{
pToolBox->InsertSeparator();
- return NULL; // no widget to be created
+ return nullptr; // no widget to be created
}
}
else if (name == "GtkWindow")
@@ -1763,16 +1770,17 @@ vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, const OString &name, c
SAL_WARN_IF(!pWindow, "vcl.layout", "probably need to implement " << name.getStr() << " or add a make" << name.getStr() << " function");
if (pWindow)
{
+ VclPtr< vcl::Window > xWindow( pWindow );
pWindow->SetHelpId(m_sHelpRoot + id);
SAL_INFO("vcl.layout", "for " << name.getStr() <<
", created " << pWindow << " child of " <<
- pParent << "(" << pWindow->mpWindowImpl->mpParent << "/" <<
- pWindow->mpWindowImpl->mpRealParent << "/" <<
- pWindow->mpWindowImpl->mpBorderWindow << ") with helpid " <<
+ pParent << "(" << pWindow->mpWindowImpl->mpParent.get() << "/" <<
+ pWindow->mpWindowImpl->mpRealParent.get() << "/" <<
+ pWindow->mpWindowImpl->mpBorderWindow.get() << ") with helpid " <<
pWindow->GetHelpId().getStr());
- m_aChildren.push_back(WinAndId(id, pWindow, bVertical));
+ m_aChildren.push_back(WinAndId(id, xWindow, bVertical));
}
- return pWindow;
+ return VclPtr<vcl::Window>(pWindow, SAL_NO_ACQUIRE);
}
namespace
@@ -1807,10 +1815,10 @@ void VclBuilder::set_properties(vcl::Window *pWindow, const stringmap &rProps)
}
}
-vcl::Window *VclBuilder::insertObject(vcl::Window *pParent, const OString &rClass,
+VclPtr<vcl::Window> VclBuilder::insertObject(vcl::Window *pParent, const OString &rClass,
const OString &rID, stringmap &rProps, stringmap &rPango, stringmap &rAtk)
{
- vcl::Window *pCurrentChild = NULL;
+ VclPtr<vcl::Window> pCurrentChild;
if (m_pParent && !isConsideredGtkPseudo(m_pParent) && !m_sID.isEmpty() && rID.equals(m_sID))
{
@@ -1821,13 +1829,13 @@ vcl::Window *VclBuilder::insertObject(vcl::Window *pParent, const OString &rClas
//initialize the dialog.
if (pParent && pParent->IsSystemWindow())
{
- SystemWindow *pSysWin = static_cast<SystemWindow*>(pCurrentChild);
+ SystemWindow *pSysWin = static_cast<SystemWindow*>(pCurrentChild.get());
pSysWin->doDeferredInit(extractDeferredBits(rProps));
m_bToplevelHasDeferredInit = false;
}
else if (pParent && pParent->IsDockingWindow())
{
- DockingWindow *pDockWin = static_cast<DockingWindow*>(pCurrentChild);
+ DockingWindow *pDockWin = static_cast<DockingWindow*>(pCurrentChild.get());
pDockWin->doDeferredInit(extractDeferredBits(rProps));
m_bToplevelHasDeferredInit = false;
}
@@ -1846,14 +1854,14 @@ vcl::Window *VclBuilder::insertObject(vcl::Window *pParent, const OString &rClas
//if we're being inserting under a toplevel dialog whose init is
//deferred due to waiting to encounter it in this .ui, and it hasn't
//been seen yet, then make unattached widgets parent-less toplevels
- if (pParent == m_pParent && m_bToplevelHasDeferredInit)
+ if (pParent == m_pParent.get() && m_bToplevelHasDeferredInit)
pParent = NULL;
pCurrentChild = makeObject(pParent, rClass, rID, rProps);
}
if (pCurrentChild)
{
- if (pCurrentChild == m_pParent && m_bToplevelHasDeferredProperties)
+ if (pCurrentChild == m_pParent.get() && m_bToplevelHasDeferredProperties)
m_aDeferredProperties = rProps;
else
set_properties(pCurrentChild, rProps);
@@ -1865,7 +1873,7 @@ vcl::Window *VclBuilder::insertObject(vcl::Window *pParent, const OString &rClas
pCurrentChild->set_font_attribute(rKey, rValue);
}
- m_pParserState->m_aAtkInfo[pCurrentChild] = rAtk;
+ m_pParserState->m_aAtkInfo[VclPtr<vcl::Window>(pCurrentChild)] = rAtk;
}
rProps.clear();
@@ -1873,7 +1881,7 @@ vcl::Window *VclBuilder::insertObject(vcl::Window *pParent, const OString &rClas
rAtk.clear();
if (!pCurrentChild)
- pCurrentChild = m_aChildren.empty() ? pParent : m_aChildren.back().m_pWindow;
+ pCurrentChild = m_aChildren.empty() ? pParent : m_aChildren.back().m_pWindow.get();
return pCurrentChild;
}
@@ -2093,14 +2101,14 @@ void VclBuilder::handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader)
if (sInternalChild.startsWith("vbox") || sInternalChild.startsWith("messagedialog-vbox"))
{
if (Dialog *pBoxParent = dynamic_cast<Dialog*>(pParent))
- pBoxParent->set_content_area(static_cast<VclBox*>(pCurrentChild));
+ pBoxParent->set_content_area(static_cast<VclBox*>(pCurrentChild)); // FIXME-VCLPTR
}
else if (sInternalChild.startsWith("action_area") || sInternalChild.startsWith("messagedialog-action_area"))
{
vcl::Window *pContentArea = pCurrentChild->GetParent();
if (Dialog *pBoxParent = dynamic_cast<Dialog*>(pContentArea ? pContentArea->GetParent() : NULL))
{
- pBoxParent->set_action_area(static_cast<VclButtonBox*>(pCurrentChild));
+ pBoxParent->set_action_area(static_cast<VclButtonBox*>(pCurrentChild)); // FIXME-VCLPTR
}
}
@@ -2835,7 +2843,7 @@ template<typename T> bool insertItems(vcl::Window *pWindow, VclBuilder::stringma
return true;
}
-vcl::Window* VclBuilder::handleObject(vcl::Window *pParent, xmlreader::XmlReader &reader)
+VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, xmlreader::XmlReader &reader)
{
OString sClass;
OString sID;
@@ -2867,22 +2875,22 @@ vcl::Window* VclBuilder::handleObject(vcl::Window *pParent, xmlreader::XmlReader
if (sClass == "GtkListStore")
{
handleListStore(reader, sID);
- return NULL;
+ return nullptr;
}
else if (sClass == "GtkMenu")
{
handleMenu(reader, sID);
- return NULL;
+ return nullptr;
}
else if (sClass == "GtkSizeGroup")
{
handleSizeGroup(reader, sID);
- return NULL;
+ return nullptr;
}
else if (sClass == "AtkObject")
{
handleAtkObject(reader, sID, pParent);
- return NULL;
+ return nullptr;
}
int nLevel = 1;
@@ -2893,7 +2901,7 @@ vcl::Window* VclBuilder::handleObject(vcl::Window *pParent, xmlreader::XmlReader
if (!sCustomProperty.isEmpty())
aProperties[OString("customproperty")] = sCustomProperty;
- vcl::Window *pCurrentChild = NULL;
+ VclPtr<vcl::Window> pCurrentChild;
while(true)
{
xmlreader::XmlReader::Result res = reader.nextItem(
@@ -3015,7 +3023,7 @@ void VclBuilder::applyPackingProperty(vcl::Window *pCurrent,
if (pCurrent->GetType() == WINDOW_SCROLLWINDOW)
{
- std::map<vcl::Window*, vcl::Window*>::iterator aFind = m_pParserState->m_aRedundantParentWidgets.find(pCurrent);
+ auto aFind = m_pParserState->m_aRedundantParentWidgets.find(VclPtr<vcl::Window>(pCurrent));
if (aFind != m_pParserState->m_aRedundantParentWidgets.end())
{
pCurrent = aFind->second;
@@ -3213,7 +3221,7 @@ void VclBuilder::collectAccelerator(xmlreader::XmlReader &reader, stringmap &rMa
vcl::Window *VclBuilder::get_widget_root()
{
- return m_aChildren.empty() ? NULL : m_aChildren[0].m_pWindow;
+ return m_aChildren.empty() ? NULL : m_aChildren[0].m_pWindow.get();
}
vcl::Window *VclBuilder::get_by_name(const OString& sID)
@@ -3279,17 +3287,17 @@ void VclBuilder::delete_by_name(const OString& sID)
{
if (aI->m_sID.equals(sID))
{
- delete aI->m_pWindow;
+ aI->m_pWindow.disposeAndClear();
m_aChildren.erase(aI);
break;
}
}
}
-void VclBuilder::delete_by_window(const vcl::Window *pWindow)
+void VclBuilder::delete_by_window(vcl::Window *pWindow)
{
drop_ownership(pWindow);
- delete pWindow;
+ pWindow->disposeOnce();
}
void VclBuilder::drop_ownership(const vcl::Window *pWindow)
@@ -3551,4 +3559,8 @@ void VclBuilder::mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rT
}
}
+VclBuilder::ParserState::ParserState()
+ : m_nLastToolbarId(0)
+{}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx
index 0c24e3051832..38efc376c7ef 100644
--- a/vcl/source/window/clipping.cxx
+++ b/vcl/source/window/clipping.cxx
@@ -842,7 +842,7 @@ void Window::ImplSaveOverlapBackground()
if ( nSaveBackSize+mpWindowImpl->mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE )
{
Size aOutSize( mnOutWidth, mnOutHeight );
- mpWindowImpl->mpOverlapData->mpSaveBackDev = new VirtualDevice( *mpWindowImpl->mpFrameWindow );
+ mpWindowImpl->mpOverlapData->mpSaveBackDev = VclPtr<VirtualDevice>::Create( *mpWindowImpl->mpFrameWindow );
if ( mpWindowImpl->mpOverlapData->mpSaveBackDev->SetOutputSizePixel( aOutSize ) )
{
mpWindowImpl->mpFrameWindow->ImplUpdateAll();
@@ -863,8 +863,7 @@ void Window::ImplSaveOverlapBackground()
}
else
{
- delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
- mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
+ mpWindowImpl->mpOverlapData->mpSaveBackDev.disposeAndClear();
}
}
}
@@ -915,8 +914,7 @@ void Window::ImplDeleteOverlapBackground()
if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
{
mpWindowImpl->mpFrameData->mnAllSaveBackSize -= mpWindowImpl->mpOverlapData->mnSaveBackSize;
- delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
- mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
+ mpWindowImpl->mpOverlapData->mpSaveBackDev.disposeAndClear();
if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
{
delete mpWindowImpl->mpOverlapData->mpSaveBackRgn;
@@ -929,7 +927,7 @@ void Window::ImplDeleteOverlapBackground()
else
{
vcl::Window* pTemp = mpWindowImpl->mpFrameData->mpFirstBackWin;
- while ( pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin != this )
+ while ( pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin.get() != this )
pTemp = pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin;
pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
}
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index d0c9a7327e5d..e61d82b1b5d6 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -38,7 +38,7 @@ struct ImplCursorData
unsigned char mnDirection; // indicates writing direction
sal_uInt16 mnStyle; // Cursor-Style
bool mbCurVisible; // Ist Cursor aktuell sichtbar
- vcl::Window* mpWindow; // Zugeordnetes Windows
+ VclPtr<vcl::Window> mpWindow; // Zugeordnetes Windows
};
static void ImplCursorInvert( ImplCursorData* pData )
@@ -319,7 +319,7 @@ void vcl::Cursor::Hide()
void vcl::Cursor::SetWindow( vcl::Window* pWindow )
{
- if ( mpWindow != pWindow )
+ if ( mpWindow.get() != pWindow )
{
mpWindow = pWindow;
ImplNew();
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index c04c430ceac3..5bb7b79cbb0e 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -1050,7 +1050,7 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo
{
Point aStart( rStart ), aStop( rStop );
const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
- vcl::Window *const pWin = (mpOutDev->GetOutDevType()==OUTDEV_WINDOW) ? static_cast<vcl::Window*>(mpOutDev) : NULL;
+ vcl::Window *const pWin = (mpOutDev->GetOutDevType()==OUTDEV_WINDOW) ? static_cast<vcl::Window*>(mpOutDev.get()) : NULL;
if(pWin)
{
ControlPart nPart = ( bVertical ? PART_SEPARATOR_VERT : PART_SEPARATOR_HORZ );
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 1e9f53a86df3..9e6d4bf12dae 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -347,8 +347,8 @@ void Dialog::ImplInitDialogData()
mbOldSaveBack = false;
mbInClose = false;
mbModalMode = false;
- mpContentArea = NULL;
- mpActionArea = NULL;
+ mpContentArea.clear();
+ mpActionArea.clear();
mnMousePositioned = 0;
mpDialogImpl = new DialogImpl;
}
@@ -403,7 +403,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle )
// create window with a small border ?
if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER )
{
- ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_FRAME );
+ VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BORDERWINDOW_STYLE_FRAME );
SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
@@ -421,7 +421,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle )
}
else
{
- ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER );
+ VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER );
SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
@@ -456,6 +456,12 @@ Dialog::Dialog( WindowType nType )
ImplInitDialogData();
}
+void VclBuilderContainer::disposeBuilder()
+{
+ if (m_pUIBuilder)
+ m_pUIBuilder->disposeBuilder();
+}
+
OUString VclBuilderContainer::getUIRootDir()
{
/*to-do, check if user config has an override before using shared one, etc*/
@@ -482,7 +488,7 @@ OUString VclBuilderContainer::getUIRootDir()
//do the init. Find the real parent stashed in mpDialogParent.
void Dialog::doDeferredInit(WinBits nBits)
{
- vcl::Window *pParent = mpDialogParent;
+ VclPtr<vcl::Window> pParent = mpDialogParent;
mpDialogParent = NULL;
ImplInit(pParent, nBits);
mbIsDefferedInit = false;
@@ -509,14 +515,14 @@ Dialog::Dialog(vcl::Window* pParent, WinBits nStyle)
ImplInit( pParent, nStyle );
}
-void Dialog::set_action_area(VclButtonBox* pActionArea)
+void Dialog::set_action_area(VclButtonBox* pBox)
{
- mpActionArea = pActionArea;
+ mpActionArea.set(pBox);
}
-void Dialog::set_content_area(VclBox* pContentArea)
+void Dialog::set_content_area(VclBox* pBox)
{
- mpContentArea = pContentArea;
+ mpContentArea.set(pBox);
}
void Dialog::settingOptimalLayoutSize(Window *pBox)
@@ -538,8 +544,17 @@ void Dialog::settingOptimalLayoutSize(Window *pBox)
Dialog::~Dialog()
{
+ disposeOnce();
+}
+
+void Dialog::dispose()
+{
delete mpDialogImpl;
mpDialogImpl = NULL;
+ mpPrevExecuteDlg.clear();
+ mpActionArea.clear();
+ mpContentArea.clear();
+ SystemWindow::dispose();
}
IMPL_LINK_NOARG(Dialog, ImplAsyncCloseHdl)
@@ -991,7 +1006,7 @@ void Dialog::SetModalInputMode( bool bModal )
pPrevModalDlg = pPrevModalDlg->mpPrevExecuteDlg;
if( pPrevModalDlg &&
- ( pPrevModalDlg == mpPrevExecuteDlg
+ ( pPrevModalDlg == mpPrevExecuteDlg.get()
|| !pPrevModalDlg->IsWindowOrChild( this, true ) ) )
{
mpPrevExecuteDlg->SetModalInputMode( false );
@@ -1050,8 +1065,8 @@ void Dialog::GrabFocusToFirstControl()
void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
{
- ImplBorderWindow aImplWin( (vcl::Window*)this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP );
- aImplWin.GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
+ ScopedVclPtrInstance<ImplBorderWindow> aImplWin( (vcl::Window*)this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP );
+ aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
}
void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong )
@@ -1077,13 +1092,13 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal
if (!( GetStyle() & WB_NOBORDER ))
{
- ImplBorderWindow aImplWin( this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP );
- aImplWin.SetText( GetText() );
- aImplWin.setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
- aImplWin.SetDisplayActive( true );
- aImplWin.InitView();
+ ScopedVclPtrInstance< ImplBorderWindow > aImplWin( this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP );
+ aImplWin->SetText( GetText() );
+ aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
+ aImplWin->SetDisplayActive( true );
+ aImplWin->InitView();
- aImplWin.Draw( Rectangle( aPos, aSize ), pDev, aPos );
+ aImplWin->Draw( Rectangle( aPos, aSize ), pDev, aPos );
}
pDev->Pop();
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 2b63b3f3920d..eb899fdb2831 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -530,9 +530,9 @@ namespace
);
}
- bool focusNextInGroup(std::vector<RadioButton*>::iterator aStart, std::vector<RadioButton*> &rGroup)
+ bool focusNextInGroup(const std::vector<VclPtr<RadioButton> >::iterator& aStart, std::vector<VclPtr<RadioButton> > &rGroup)
{
- std::vector<RadioButton*>::iterator aI(aStart);
+ std::vector<VclPtr<RadioButton> >::iterator aI(aStart);
if (aStart != rGroup.end())
++aI;
@@ -564,7 +564,7 @@ namespace
bool nextInGroup(RadioButton *pSourceWindow, bool bBackward)
{
- std::vector<RadioButton*> aGroup(pSourceWindow->GetRadioButtonGroup(true));
+ std::vector<VclPtr<RadioButton> > aGroup(pSourceWindow->GetRadioButtonGroup(true));
if (aGroup.size() == 1) //only one button in group
return false;
@@ -572,7 +572,7 @@ namespace
if (bBackward)
std::reverse(aGroup.begin(), aGroup.end());
- std::vector<RadioButton*>::iterator aStart(std::find(aGroup.begin(), aGroup.end(), pSourceWindow));
+ auto aStart(std::find(aGroup.begin(), aGroup.end(), VclPtr<RadioButton>(pSourceWindow)));
assert(aStart != aGroup.end());
@@ -716,9 +716,9 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput )
if ( bKeyInput && mpWindowImpl->mpDlgCtrlDownWindow )
{
- if ( mpWindowImpl->mpDlgCtrlDownWindow != pButtonWindow )
+ if ( mpWindowImpl->mpDlgCtrlDownWindow.get() != pButtonWindow )
{
- static_cast<PushButton*>(mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( false );
+ static_cast<PushButton*>(mpWindowImpl->mpDlgCtrlDownWindow.get())->SetPressed( false );
mpWindowImpl->mpDlgCtrlDownWindow = NULL;
return true;
}
@@ -928,16 +928,16 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput )
{
if ( bKeyInput )
{
- if ( mpWindowImpl->mpDlgCtrlDownWindow && (mpWindowImpl->mpDlgCtrlDownWindow != pButtonWindow) )
+ if ( mpWindowImpl->mpDlgCtrlDownWindow && (mpWindowImpl->mpDlgCtrlDownWindow.get() != pButtonWindow) )
{
- static_cast<PushButton*>(mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( false );
+ static_cast<PushButton*>(mpWindowImpl->mpDlgCtrlDownWindow.get())->SetPressed( false );
mpWindowImpl->mpDlgCtrlDownWindow = NULL;
}
static_cast<PushButton*>(pButtonWindow)->SetPressed( true );
mpWindowImpl->mpDlgCtrlDownWindow = pButtonWindow;
}
- else if ( mpWindowImpl->mpDlgCtrlDownWindow == pButtonWindow )
+ else if ( mpWindowImpl->mpDlgCtrlDownWindow.get() == pButtonWindow )
{
mpWindowImpl->mpDlgCtrlDownWindow = NULL;
static_cast<PushButton*>(pButtonWindow)->SetPressed( false );
@@ -1060,7 +1060,7 @@ void Window::ImplDlgCtrlFocusChanged( vcl::Window* pWindow, bool bGetFocus )
{
if ( mpWindowImpl->mpDlgCtrlDownWindow && !bGetFocus )
{
- static_cast<PushButton*>(mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( false );
+ static_cast<PushButton*>(mpWindowImpl->mpDlgCtrlDownWindow.get())->SetPressed( false );
mpWindowImpl->mpDlgCtrlDownWindow = NULL;
}
diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx
index dabfef79569e..94d6ae75b1dd 100644
--- a/vcl/source/window/dndevdis.cxx
+++ b/vcl/source/window/dndevdis.cxx
@@ -99,7 +99,7 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
vcl::Window* pChildWindow = findTopLevelWindow(location);
// handle the case that drop is in an other vcl window than the last dragOver
- if( pChildWindow != m_pCurrentWindow )
+ if( pChildWindow != m_pCurrentWindow.get() )
{
// fire dragExit on listeners of previous window
fireDragExitEvent( m_pCurrentWindow );
@@ -177,7 +177,7 @@ void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde )
vcl::Window * pChildWindow = findTopLevelWindow(location);
- if( pChildWindow != m_pCurrentWindow )
+ if( pChildWindow != m_pCurrentWindow.get() )
{
// fire dragExit on listeners of previous window
fireDragExitEvent( m_pCurrentWindow );
@@ -215,7 +215,7 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent&
vcl::Window* pChildWindow = findTopLevelWindow(location);
- if( pChildWindow != m_pCurrentWindow )
+ if( pChildWindow != m_pCurrentWindow.get() )
{
// fire dragExit on listeners of previous window
fireDragExitEvent( m_pCurrentWindow );
diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx
index 623ea9635b37..43ce7bdb3c4d 100644
--- a/vcl/source/window/dockingarea.cxx
+++ b/vcl/source/window/dockingarea.cxx
@@ -92,7 +92,13 @@ DockingAreaWindow::DockingAreaWindow( vcl::Window* pParent ) :
DockingAreaWindow::~DockingAreaWindow()
{
+ disposeOnce();
+}
+
+void DockingAreaWindow::dispose()
+{
delete mpImplData;
+ Window::dispose();
}
void DockingAreaWindow::DataChanged( const DataChangedEvent& rDCEvt )
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 66b01f9e1283..160e21074029 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -57,6 +57,7 @@ public:
ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits,
ImplDockingWindowWrapper* pDockingWin );
virtual ~ImplDockFloatWin2();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Move() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
@@ -97,8 +98,14 @@ ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits,
ImplDockFloatWin2::~ImplDockFloatWin2()
{
+ disposeOnce();
+}
+
+void ImplDockFloatWin2::dispose()
+{
if( mnLastUserEvent )
Application::RemoveUserEvent( mnLastUserEvent );
+ FloatingWindow::dispose();
}
IMPL_LINK_NOARG(ImplDockFloatWin2, DockTimerHdl)
@@ -477,6 +484,7 @@ private:
public:
ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip );
virtual ~ImplPopupFloatWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
@@ -513,7 +521,13 @@ ImplPopupFloatWin::ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWra
ImplPopupFloatWin::~ImplPopupFloatWin()
{
+ disposeOnce();
+}
+
+void ImplPopupFloatWin::dispose()
+{
mpDockingWin = NULL;
+ FloatingWindow::dispose();
}
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > ImplPopupFloatWin::CreateAccessible()
@@ -813,7 +827,7 @@ ImplDockingWindowWrapper::ImplDockingWindowWrapper( const vcl::Window *pWindow )
, mbStartDockingEnabled(false)
, mbLocked(false)
{
- DockingWindow *pDockWin = dynamic_cast< DockingWindow* > ( mpDockingWindow );
+ DockingWindow *pDockWin = dynamic_cast< DockingWindow* > ( mpDockingWindow.get() );
if( pDockWin )
mnFloatBits = pDockWin->GetFloatStyle();
}
@@ -842,14 +856,14 @@ bool ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos )
mbStartFloat = mbLastFloatMode;
// calculate FloatingBorder
- FloatingWindow* pWin;
+ VclPtr<FloatingWindow> pWin;
if ( mpFloatWin )
pWin = mpFloatWin;
else
- pWin = new ImplDockFloatWin2( mpParent, mnFloatBits, NULL );
+ pWin = VclPtr<ImplDockFloatWin2>::Create( mpParent, mnFloatBits, nullptr );
pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom );
if ( !mpFloatWin )
- delete pWin;
+ pWin.disposeAndClear();
Point aPos = GetWindow()->ImplOutputToFrame( Point() );
Size aSize = GetWindow()->GetOutputSizePixel();
@@ -1098,11 +1112,11 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, sal_uLon
// prepare reparenting
vcl::Window* pRealParent = GetWindow()->GetWindow( WINDOW_PARENT );
mpOldBorderWin = GetWindow()->GetWindow( WINDOW_BORDER );
- if( mpOldBorderWin == GetWindow() )
+ if( mpOldBorderWin.get() == GetWindow() )
mpOldBorderWin = NULL; // no border window found
// the new parent for popup mode
- ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 );
+ VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 );
pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) );
pWin->SetText( GetWindow()->GetText() );
@@ -1153,7 +1167,7 @@ IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd)
GetWindow()->Show( false, SHOW_NOFOCUSCHANGE );
// set parameter for handler before destroying floating window
- ImplPopupFloatWin *pPopupFloatWin = static_cast<ImplPopupFloatWin*>(mpFloatWin);
+ ImplPopupFloatWin *pPopupFloatWin = static_cast<ImplPopupFloatWin*>(mpFloatWin.get());
EndPopupModeData aData( pPopupFloatWin->GetTearOffPosition(), mpFloatWin->IsPopupModeTearOff() );
// before deleting change parent back, so we can delete the floating window alone
@@ -1162,7 +1176,7 @@ IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd)
if ( mpOldBorderWin )
{
GetWindow()->SetParent( mpOldBorderWin );
- static_cast<ImplBorderWindow*>(mpOldBorderWin)->GetBorder(
+ static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder(
GetWindow()->mpWindowImpl->mnLeftBorder, GetWindow()->mpWindowImpl->mnTopBorder,
GetWindow()->mpWindowImpl->mnRightBorder, GetWindow()->mpWindowImpl->mnBottomBorder );
mpOldBorderWin->Resize();
@@ -1171,8 +1185,7 @@ IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd)
GetWindow()->SetParent( pRealParent );
GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
- delete mpFloatWin;
- mpFloatWin = NULL;
+ mpFloatWin.disposeAndClear();
// call handler - which will destroy the window and thus the wrapper as well !
GetWindow()->CallEventListeners( VCLEVENT_WINDOW_ENDPOPUPMODE, &aData );
@@ -1212,7 +1225,8 @@ void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode )
mpOldBorderWin = NULL; // no border window found
ImplDockFloatWin2* pWin =
- new ImplDockFloatWin2(
+ VclPtr<ImplDockFloatWin2>::Create(
+
mpParent,
mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ?
mnFloatBits | WB_SYSTEMWINDOW
@@ -1277,7 +1291,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode )
if ( mpOldBorderWin )
{
GetWindow()->SetParent( mpOldBorderWin );
- static_cast<ImplBorderWindow*>(mpOldBorderWin)->GetBorder(
+ static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder(
GetWindow()->mpWindowImpl->mnLeftBorder, GetWindow()->mpWindowImpl->mnTopBorder,
GetWindow()->mpWindowImpl->mnRightBorder, GetWindow()->mpWindowImpl->mnBottomBorder );
mpOldBorderWin->Resize();
@@ -1286,8 +1300,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode )
GetWindow()->SetParent( pRealParent );
GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
- delete static_cast<ImplDockFloatWin2*>(mpFloatWin);
- mpFloatWin = NULL;
+ mpFloatWin.disposeAndClear();
GetWindow()->SetPosPixel( maDockPos );
if ( bVisible )
@@ -1350,7 +1363,7 @@ void ImplDockingWindowWrapper::SetMaxOutputSizePixel( const Size& rSize )
bool ImplDockingWindowWrapper::IsFloatingMode() const
{
- return (mpFloatWin != NULL);
+ return (mpFloatWin != nullptr);
}
void ImplDockingWindowWrapper::SetDragArea( const Rectangle& rRect )
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index a170e3f3d5ca..408cb328a132 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -42,8 +42,8 @@ public:
ImplData();
~ImplData();
- vcl::Window* mpParent;
- Size maMaxOutSize;
+ VclPtr<vcl::Window> mpParent;
+ Size maMaxOutSize;
};
DockingWindow::ImplData::ImplData()
@@ -59,7 +59,7 @@ DockingWindow::ImplData::~ImplData()
class ImplDockFloatWin : public FloatingWindow
{
private:
- DockingWindow* mpDockWin;
+ VclPtr<DockingWindow> mpDockWin;
sal_uInt64 mnLastTicks;
Idle maDockIdle;
Point maDockPos;
@@ -73,6 +73,7 @@ public:
ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits,
DockingWindow* pDockingWin );
virtual ~ImplDockFloatWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Move() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
@@ -111,8 +112,18 @@ ImplDockFloatWin::ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits,
ImplDockFloatWin::~ImplDockFloatWin()
{
+ disposeOnce();
+}
+
+void ImplDockFloatWin::dispose()
+{
if( mnLastUserEvent )
Application::RemoveUserEvent( mnLastUserEvent );
+
+ disposeBuilder();
+
+ mpDockWin.clear();
+ FloatingWindow::dispose();
}
IMPL_LINK_NOARG(ImplDockFloatWin, DockTimerHdl)
@@ -253,14 +264,14 @@ bool DockingWindow::ImplStartDocking( const Point& rPos )
mbStartFloat = mbLastFloatMode;
// calculate FloatingBorder
- FloatingWindow* pWin;
+ VclPtr<FloatingWindow> pWin;
if ( mpFloatWin )
pWin = mpFloatWin;
else
- pWin = new ImplDockFloatWin( mpImplData->mpParent, mnFloatBits, NULL );
+ pWin = VclPtr<ImplDockFloatWin>::Create( mpImplData->mpParent, mnFloatBits, nullptr );
pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom );
if ( !mpFloatWin )
- delete pWin;
+ pWin.disposeAndClear();
Point aPos = ImplOutputToFrame( Point() );
Size aSize = Window::GetOutputSizePixel();
@@ -460,6 +471,11 @@ DockingWindow::DockingWindow(vcl::Window* pParent, const OString& rID,
DockingWindow::~DockingWindow()
{
+ disposeOnce();
+}
+
+void DockingWindow::dispose()
+{
if ( IsFloatingMode() )
{
Show( false, SHOW_NOFOCUSCHANGE );
@@ -467,6 +483,11 @@ DockingWindow::~DockingWindow()
}
delete mpImplData;
mpImplData = NULL;
+ mpFloatWin.clear();
+ mpOldBorderWin.clear();
+ mpDialogParent.clear();
+ disposeBuilder();
+ Window::dispose();
}
void DockingWindow::Tracking( const TrackingEvent& rTEvt )
@@ -781,7 +802,8 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
mpOldBorderWin = mpWindowImpl->mpBorderWindow;
ImplDockFloatWin* pWin =
- new ImplDockFloatWin(
+ VclPtr<ImplDockFloatWin>::Create(
+
mpImplData->mpParent,
mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? mnFloatBits | WB_SYSTEMWINDOW : mnFloatBits,
this );
@@ -851,14 +873,13 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
if ( mpOldBorderWin )
{
SetParent( mpOldBorderWin );
- static_cast<ImplBorderWindow*>(mpOldBorderWin)->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
+ static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
mpOldBorderWin->Resize();
}
mpWindowImpl->mpBorderWindow = mpOldBorderWin;
SetParent( pRealParent );
mpWindowImpl->mpRealParent = pRealParent;
- delete static_cast<ImplDockFloatWin*>(mpFloatWin);
- mpFloatWin = NULL;
+ mpFloatWin.disposeAndClear();
SetPosPixel( maDockPos );
ToggleFloatingMode();
@@ -1033,7 +1054,7 @@ bool DockingWindow::IsFloatingMode() const
if( pWrapper )
return pWrapper->IsFloatingMode();
else
- return (mpFloatWin != NULL);
+ return (mpFloatWin != nullptr);
}
void DockingWindow::SetMaxOutputSizePixel( const Size& rSize )
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index da38fde26b36..9c954125779d 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -94,6 +94,9 @@ bool Window::Notify( NotifyEvent& rNEvt )
{
bool nRet = false;
+ if (IsDisposed())
+ return false;
+
// check for docking window
// but do nothing if window is docked and locked
ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
@@ -221,6 +224,9 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
{
pWindow->ImplAddDel( &aDelData );
+ if ( aDelData.IsDead() )
+ return;
+
pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent );
if ( aDelData.IsDead() )
@@ -277,7 +283,7 @@ ImplSVEvent * Window::PostUserEvent( const Link& rLink, void* pCaller )
void Window::RemoveUserEvent( ImplSVEvent * nUserEvent )
{
- DBG_ASSERT( nUserEvent->mpWindow == this,
+ DBG_ASSERT( nUserEvent->mpWindow.get() == this,
"Window::RemoveUserEvent(): Event doesn't send to this window or is already removed" );
DBG_ASSERT( nUserEvent->mbCall,
"Window::RemoveUserEvent(): Event is already removed" );
@@ -515,14 +521,14 @@ void Window::ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow,
{
if ( pSVData->maWinData.mpLastDeacWin )
{
- if ( pSVData->maWinData.mpLastDeacWin == pNewOverlapWindow )
+ if ( pSVData->maWinData.mpLastDeacWin.get() == pNewOverlapWindow )
bCallActivate = false;
else
{
vcl::Window* pLastRealWindow = pSVData->maWinData.mpLastDeacWin->ImplGetWindow();
pSVData->maWinData.mpLastDeacWin->mpWindowImpl->mbActive = false;
pSVData->maWinData.mpLastDeacWin->Deactivate();
- if ( pLastRealWindow != pSVData->maWinData.mpLastDeacWin )
+ if ( pLastRealWindow != pSVData->maWinData.mpLastDeacWin.get() )
{
pLastRealWindow->mpWindowImpl->mbActive = true;
pLastRealWindow->Activate();
@@ -568,5 +574,21 @@ void Window::ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow,
} /* namespace vcl */
+NotifyEvent::NotifyEvent()
+{
+ mpWindow = NULL;
+ mpData = NULL;
+ mnEventType = MouseNotifyEvent::NONE;
+ mnRetValue = 0;
+}
+
+NotifyEvent::NotifyEvent( MouseNotifyEvent nEventType, vcl::Window* pWindow,
+ const void* pEvent, long nRet )
+{
+ mpWindow = pWindow;
+ mpData = const_cast<void*>(pEvent);
+ mnEventType = nEventType;
+ mnRetValue = nRet;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 8ad024e1511f..65a5ef452458 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -39,7 +39,7 @@ public:
ImplData();
~ImplData();
- ToolBox* mpBox;
+ VclPtr<ToolBox> mpBox;
Rectangle maItemEdgeClipRect; // used to clip the common edge between a toolbar item and the border of this window
};
@@ -107,7 +107,7 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle )
nBorderStyle |= BORDERWINDOW_STYLE_FRAME;
nStyle |= WB_CLOSEABLE; // make undecorated floaters closeable
}
- pBorderWin = new ImplBorderWindow( pParent, nStyle, nBorderStyle );
+ pBorderWin = VclPtr<ImplBorderWindow>::Create( pParent, nStyle, nBorderStyle );
SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
@@ -185,18 +185,32 @@ void FloatingWindow::doDeferredInit(WinBits nBits)
FloatingWindow::~FloatingWindow()
{
- if( mbPopupModeCanceled )
- // indicates that ESC key was pressed
- // will be handled in Window::ImplGrabFocus()
- SetDialogControlFlags( GetDialogControlFlags() | WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL );
+ disposeOnce();
+}
+
+void FloatingWindow::dispose()
+{
+ if (mpImplData)
+ {
+ if( mbPopupModeCanceled )
+ // indicates that ESC key was pressed
+ // will be handled in Window::ImplGrabFocus()
+ SetDialogControlFlags( GetDialogControlFlags() | WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL );
- if ( IsInPopupMode() )
- EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL | FLOATWIN_POPUPMODEEND_DONTCALLHDL );
+ if ( IsInPopupMode() )
+ EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL | FLOATWIN_POPUPMODEEND_DONTCALLHDL );
- if ( mnPostId )
- Application::RemoveUserEvent( mnPostId );
+ if ( mnPostId )
+ Application::RemoveUserEvent( mnPostId );
+ mnPostId = 0;
+ }
delete mpImplData;
+ mpImplData = NULL;
+
+ mpNextFloat.clear();
+ mpFirstPopupModeWin.clear();
+ SystemWindow::dispose();
}
Point FloatingWindow::CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex )
@@ -593,8 +607,8 @@ void FloatingWindow::SetTitleType( sal_uInt16 nTitle )
nTitleStyle = BORDERWINDOW_TITLE_POPUP;
else // nTitle == FLOATWIN_TITLE_NONE
nTitleStyle = BORDERWINDOW_TITLE_NONE;
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetTitleType( nTitleStyle, aOutSize );
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetTitleType( nTitleStyle, aOutSize );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
}
}
@@ -734,7 +748,7 @@ void FloatingWindow::ImplEndPopupMode( sal_uInt16 nFlags, sal_uLong nFocusId )
mbInCleanUp = true; // prevent killing this window due to focus change while working with it
// stop the PopupMode also for all following PopupMode windows
- while ( pSVData->maWinData.mpFirstFloat && pSVData->maWinData.mpFirstFloat != this )
+ while ( pSVData->maWinData.mpFirstFloat && pSVData->maWinData.mpFirstFloat.get() != this )
pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
// delete window from the list
diff --git a/vcl/source/window/introwin.cxx b/vcl/source/window/introwin.cxx
index fa311d3129b5..d8b400135477 100644
--- a/vcl/source/window/introwin.cxx
+++ b/vcl/source/window/introwin.cxx
@@ -40,9 +40,16 @@ IntroWindow::IntroWindow( ) :
IntroWindow::~IntroWindow()
{
+ disposeOnce();
+}
+
+void IntroWindow::dispose()
+{
ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->mpIntroWindow == this )
- pSVData->mpIntroWindow = NULL;
+ if ( pSVData->mpIntroWindow.get() == this )
+ pSVData->mpIntroWindow = nullptr;
+
+ WorkWindow::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 2cc0a675b5dc..c9a43087cdf7 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1286,6 +1286,17 @@ void VclBin::setAllocation(const Size &rAllocation)
setLayoutAllocation(*pChild, Point(0, 0), rAllocation);
}
+VclFrame::~VclFrame()
+{
+ disposeOnce();
+}
+
+void VclFrame::dispose()
+{
+ m_pLabel.clear();
+ VclBin::dispose();
+}
+
//To-Do, hook a DecorationView into VclFrame ?
Size VclFrame::calculateRequisition() const
@@ -1467,11 +1478,17 @@ bool VclAlignment::set_property(const OString &rKey, const OString &rValue)
return true;
}
+void VclExpander::dispose()
+{
+ m_pDisclosureButton.disposeAndClear();
+ VclBin::dispose();
+}
+
const vcl::Window *VclExpander::get_child() const
{
const WindowImpl* pWindowImpl = ImplGetWindowImpl();
- assert(pWindowImpl->mpFirstChild == m_pDisclosureButton.get());
+ assert(pWindowImpl->mpFirstChild == m_pDisclosureButton);
return pWindowImpl->mpFirstChild->GetWindow(WINDOW_NEXT);
}
@@ -1488,12 +1505,12 @@ Size VclExpander::calculateRequisition() const
WindowImpl* pWindowImpl = ImplGetWindowImpl();
const vcl::Window *pChild = get_child();
- const vcl::Window *pLabel = pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild : NULL;
+ const vcl::Window *pLabel = pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild.get() : NULL;
if (pChild && pChild->IsVisible() && m_pDisclosureButton->IsChecked())
aRet = getLayoutRequisition(*pChild);
- Size aExpanderSize = getLayoutRequisition(*m_pDisclosureButton.get());
+ Size aExpanderSize = getLayoutRequisition(*m_pDisclosureButton);
if (pLabel && pLabel->IsVisible())
{
@@ -1525,9 +1542,9 @@ void VclExpander::setAllocation(const Size &rAllocation)
//The label widget is the last (of two) children
vcl::Window *pChild = get_child();
- vcl::Window *pLabel = pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild : NULL;
+ vcl::Window *pLabel = pChild != pWindowImpl->mpLastChild.get() ? pWindowImpl->mpLastChild.get() : NULL;
- Size aButtonSize = getLayoutRequisition(*m_pDisclosureButton.get());
+ Size aButtonSize = getLayoutRequisition(*m_pDisclosureButton);
Size aLabelSize;
Size aExpanderSize = aButtonSize;
if (pLabel && pLabel->IsVisible())
@@ -1545,7 +1562,7 @@ void VclExpander::setAllocation(const Size &rAllocation)
long nExtraExpanderHeight = aExpanderSize.Height() - aButtonSize.Height();
Point aButtonPos(aChildPos.X(), aChildPos.Y() + nExtraExpanderHeight/2);
- setLayoutAllocation(*m_pDisclosureButton.get(), aButtonPos, aButtonSize);
+ setLayoutAllocation(*m_pDisclosureButton, aButtonPos, aButtonSize);
if (pLabel && pLabel->IsVisible())
{
@@ -1610,9 +1627,9 @@ IMPL_LINK( VclExpander, ClickHdl, DisclosureButton*, pBtn )
VclScrolledWindow::VclScrolledWindow(vcl::Window *pParent, WinBits nStyle)
: VclBin(pParent, nStyle)
, m_bUserManagedScrolling(false)
- , m_pVScroll(new ScrollBar(this, WB_HIDE | WB_VERT))
- , m_pHScroll(new ScrollBar(this, WB_HIDE | WB_HORZ))
- , m_aScrollBarBox(this, WB_HIDE)
+ , m_pVScroll(VclPtr<ScrollBar>::Create(this, WB_HIDE | WB_VERT))
+ , m_pHScroll(VclPtr<ScrollBar>::Create(this, WB_HIDE | WB_HORZ))
+ , m_aScrollBarBox(VclPtr<ScrollBarBox>::Create(this, WB_HIDE))
{
SetType(WINDOW_SCROLLWINDOW);
@@ -1621,6 +1638,14 @@ VclScrolledWindow::VclScrolledWindow(vcl::Window *pParent, WinBits nStyle)
m_pHScroll->SetScrollHdl(aLink);
}
+void VclScrolledWindow::dispose()
+{
+ m_pVScroll.disposeAndClear();
+ m_pHScroll.disposeAndClear();
+ m_aScrollBarBox.disposeAndClear();
+ VclBin::dispose();
+}
+
IMPL_LINK_NOARG(VclScrolledWindow, ScrollBarHdl)
{
vcl::Window *pChild = get_child();
@@ -1672,10 +1697,10 @@ Size VclScrolledWindow::calculateRequisition() const
aRet = getLayoutRequisition(*pChild);
if (GetStyle() & WB_VSCROLL)
- aRet.Width() += getLayoutRequisition(*m_pVScroll.get()).Width();
+ aRet.Width() += getLayoutRequisition(*m_pVScroll).Width();
if (GetStyle() & WB_HSCROLL)
- aRet.Height() += getLayoutRequisition(*m_pHScroll.get()).Height();
+ aRet.Height() += getLayoutRequisition(*m_pHScroll).Height();
return aRet;
}
@@ -1721,7 +1746,7 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation)
}
if (m_pVScroll->IsVisible())
- nAvailWidth -= getLayoutRequisition(*m_pVScroll.get()).Width();
+ nAvailWidth -= getLayoutRequisition(*m_pVScroll).Width();
// horz. ScrollBar
if (GetStyle() & WB_AUTOHSCROLL)
@@ -1730,7 +1755,7 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation)
m_pHScroll->Show(bShowHScroll);
if (bShowHScroll)
- nAvailHeight -= getLayoutRequisition(*m_pHScroll.get()).Height();
+ nAvailHeight -= getLayoutRequisition(*m_pHScroll).Height();
if (GetStyle() & WB_AUTOVSCROLL)
m_pVScroll->Show(nAvailHeight < aChildReq.Height());
@@ -1741,10 +1766,10 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation)
if (m_pVScroll->IsVisible())
{
- nScrollBarWidth = getLayoutRequisition(*m_pVScroll.get()).Width();
+ nScrollBarWidth = getLayoutRequisition(*m_pVScroll).Width();
Point aScrollPos(rAllocation.Width() - nScrollBarWidth, 0);
Size aScrollSize(nScrollBarWidth, rAllocation.Height());
- setLayoutAllocation(*m_pVScroll.get(), aScrollPos, aScrollSize);
+ setLayoutAllocation(*m_pVScroll, aScrollPos, aScrollSize);
aChildAllocation.Width() -= nScrollBarWidth;
aInnerSize.Width() -= nScrollBarWidth;
aChildAllocation.Height() = aChildReq.Height();
@@ -1752,10 +1777,10 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation)
if (m_pHScroll->IsVisible())
{
- nScrollBarHeight = getLayoutRequisition(*m_pHScroll.get()).Height();
+ nScrollBarHeight = getLayoutRequisition(*m_pHScroll).Height();
Point aScrollPos(0, rAllocation.Height() - nScrollBarHeight);
Size aScrollSize(rAllocation.Width(), nScrollBarHeight);
- setLayoutAllocation(*m_pHScroll.get(), aScrollPos, aScrollSize);
+ setLayoutAllocation(*m_pHScroll, aScrollPos, aScrollSize);
aChildAllocation.Height() -= nScrollBarHeight;
aInnerSize.Height() -= nScrollBarHeight;
aChildAllocation.Width() = aChildReq.Width();
@@ -1764,12 +1789,12 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation)
if (m_pVScroll->IsVisible() && m_pHScroll->IsVisible())
{
Point aBoxPos(aInnerSize.Width(), aInnerSize.Height());
- m_aScrollBarBox.SetPosSizePixel(aBoxPos, Size(nScrollBarWidth, nScrollBarHeight));
- m_aScrollBarBox.Show();
+ m_aScrollBarBox->SetPosSizePixel(aBoxPos, Size(nScrollBarWidth, nScrollBarHeight));
+ m_aScrollBarBox->Show();
}
else
{
- m_aScrollBarBox.Hide();
+ m_aScrollBarBox->Hide();
}
if (pChild && pChild->IsVisible())
@@ -1811,7 +1836,7 @@ bool VclScrolledWindow::Notify(NotifyEvent& rNEvt)
const CommandWheelData* pData = rCEvt.GetWheelData();
if( !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) )
{
- nDone = HandleScrollCommand(rCEvt, m_pHScroll.get(), m_pVScroll.get());
+ nDone = HandleScrollCommand(rCEvt, m_pHScroll, m_pVScroll);
}
}
}
@@ -1835,7 +1860,7 @@ const vcl::Window *VclEventBox::get_child() const
{
const WindowImpl* pWindowImpl = ImplGetWindowImpl();
- assert(pWindowImpl->mpFirstChild == &m_aEventBoxHelper);
+ assert(pWindowImpl->mpFirstChild.get() == m_aEventBoxHelper.get());
return pWindowImpl->mpFirstChild->GetWindow(WINDOW_NEXT);
}
@@ -1878,6 +1903,17 @@ void VclEventBox::Command(const CommandEvent&)
//discard events by default to block them reaching children
}
+VclEventBox::~VclEventBox()
+{
+ disposeOnce();
+}
+
+void VclEventBox::dispose()
+{
+ m_aEventBoxHelper.disposeAndClear();
+ VclBin::dispose();
+}
+
void VclSizeGroup::trigger_queue_resize()
{
//sufficient to trigger one widget to trigger all of them
@@ -1939,10 +1975,10 @@ bool VclSizeGroup::set_property(const OString &rKey, const OString &rValue)
void MessageDialog::create_owned_areas()
{
set_border_width(12);
- m_pOwnedContentArea = new VclVBox(this, false, 24);
+ m_pOwnedContentArea.set(VclPtr<VclVBox>::Create(this, false, 24));
set_content_area(m_pOwnedContentArea);
m_pOwnedContentArea->Show();
- m_pOwnedActionArea = new VclHButtonBox(m_pOwnedContentArea);
+ m_pOwnedActionArea.set( VclPtr<VclHButtonBox>::Create(m_pOwnedContentArea) );
set_action_area(m_pOwnedActionArea);
m_pOwnedActionArea->Show();
}
@@ -1992,16 +2028,24 @@ MessageDialog::MessageDialog(vcl::Window* pParent, const OString& rID, const OUS
{
}
-MessageDialog::~MessageDialog()
+void MessageDialog::dispose()
{
for (size_t i = 0; i < m_aOwnedButtons.size(); ++i)
- delete m_aOwnedButtons[i];
- delete m_pSecondaryMessage;
- delete m_pPrimaryMessage;
- delete m_pImage;
- delete m_pGrid;
- delete m_pOwnedActionArea;
- delete m_pOwnedContentArea;
+ m_aOwnedButtons[i].disposeAndClear();
+ m_aOwnedButtons.clear();
+
+ m_pPrimaryMessage.disposeAndClear();
+ m_pSecondaryMessage.disposeAndClear();
+ m_pImage.disposeAndClear();
+ m_pGrid.disposeAndClear();
+ m_pOwnedActionArea.disposeAndClear();
+ m_pOwnedContentArea.disposeAndClear();
+ Dialog::dispose();
+}
+
+MessageDialog::~MessageDialog()
+{
+ disposeOnce();
}
void MessageDialog::response(short nResponseId)
@@ -2017,7 +2061,7 @@ IMPL_LINK(MessageDialog, ButtonHdl, Button *, pButton)
short MessageDialog::get_response(const vcl::Window *pWindow) const
{
- std::map<const vcl::Window*, short>::const_iterator aFind = m_aResponses.find(pWindow);
+ auto aFind = m_aResponses.find(pWindow);
if (aFind != m_aResponses.end())
return aFind->second;
if (!m_pUIBuilder)
@@ -2090,12 +2134,12 @@ short MessageDialog::Execute()
VclContainer *pContainer = get_content_area();
assert(pContainer);
- m_pGrid = new VclGrid(pContainer);
+ m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) );
m_pGrid->reorderWithinParent(0);
m_pGrid->set_column_spacing(12);
m_pGrid->set_row_spacing(GetTextHeight());
- m_pImage = new FixedImage(m_pGrid, WB_CENTER | WB_VCENTER | WB_3DLOOK);
+ m_pImage = VclPtr<FixedImage>::Create(m_pGrid, WB_CENTER | WB_VCENTER | WB_3DLOOK);
switch (m_eMessageType)
{
case VCL_MESSAGE_INFO:
@@ -2120,7 +2164,7 @@ short MessageDialog::Execute()
bool bHasSecondaryText = !m_sSecondaryString.isEmpty();
- m_pPrimaryMessage = new VclMultiLineEdit(m_pGrid, nWinStyle);
+ m_pPrimaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pGrid, nWinStyle);
m_pPrimaryMessage->SetPaintTransparent(true);
m_pPrimaryMessage->EnableCursor(false);
@@ -2130,7 +2174,7 @@ short MessageDialog::Execute()
m_pPrimaryMessage->SetText(m_sPrimaryString);
m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty());
- m_pSecondaryMessage = new VclMultiLineEdit(m_pGrid, nWinStyle);
+ m_pSecondaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pGrid, nWinStyle);
m_pSecondaryMessage->SetPaintTransparent(true);
m_pSecondaryMessage->EnableCursor(false);
m_pSecondaryMessage->set_grid_left_attach(1);
@@ -2139,44 +2183,44 @@ short MessageDialog::Execute()
m_pSecondaryMessage->SetText(m_sSecondaryString);
m_pSecondaryMessage->Show(bHasSecondaryText);
- MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage : NULL);
+ MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage.get() : NULL);
VclButtonBox *pButtonBox = get_action_area();
assert(pButtonBox);
- PushButton *pBtn;
+ VclPtr<PushButton> pBtn;
switch (m_eButtonsType)
{
case VCL_BUTTONS_NONE:
break;
case VCL_BUTTONS_OK:
- pBtn = new OKButton(pButtonBox);
+ pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_OK;
break;
case VCL_BUTTONS_CLOSE:
- pBtn = new CloseButton(pButtonBox);
+ pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_CLOSE;
break;
case VCL_BUTTONS_CANCEL:
- pBtn = new CancelButton(pButtonBox);
+ pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_CANCEL;
break;
case VCL_BUTTONS_YES_NO:
- pBtn = new PushButton(pButtonBox);
+ pBtn = VclPtr<PushButton>::Create(pButtonBox);
pBtn->SetText(Button::GetStandardText(StandardButtonType::Yes));
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_YES;
- pBtn = new PushButton(pButtonBox);
+ pBtn.set( VclPtr<PushButton>::Create(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
pBtn->SetText(Button::GetStandardText(StandardButtonType::No));
pBtn->Show();
@@ -2184,12 +2228,12 @@ short MessageDialog::Execute()
m_aResponses[pBtn] = RET_NO;
break;
case VCL_BUTTONS_OK_CANCEL:
- pBtn = new OKButton(pButtonBox);
+ pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_OK;
- pBtn = new CancelButton(pButtonBox);
+ pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 597e6627d1fb..e972321a7f53 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -133,16 +133,13 @@ Menu::Menu()
Menu::~Menu()
{
-
- vcl::LazyDeletor<Menu>::Undelete( this );
-
ImplCallEventListeners( VCLEVENT_OBJECT_DYING, ITEMPOS_INVALID );
// at the window free the reference to the accessible component
// and make sure the MenuFloatingWindow knows about our destruction
if ( pWindow )
{
- MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow);
+ MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow.get());
if( pFloat->pMenu == this )
pFloat->pMenu = NULL;
pWindow->SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >() );
@@ -1704,7 +1701,7 @@ Size Menu::ImplCalcSize( const vcl::Window* pWin )
// account for the size of the close button, which actually is a toolbox
// due to NWF this is variable
- long nCloseButtonHeight = static_cast<MenuBarWindow*>(pWindow)->MinCloseButtonSize().Height();
+ long nCloseButtonHeight = static_cast<MenuBarWindow*>(pWindow.get())->MinCloseButtonSize().Height();
if (aSz.Height() < nCloseButtonHeight)
aSz.Height() = nCloseButtonHeight;
}
@@ -2269,7 +2266,7 @@ void Menu::ImplFillLayoutData() const
}
else
{
- MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow);
+ MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow.get());
ImplPaint( pWindow, pFloat->nScrollerHeight, pFloat->ImplGetStartY(), 0, false, true );
}
}
@@ -2381,9 +2378,9 @@ bool Menu::IsHighlighted( sal_uInt16 nItemPos ) const
if( pWindow )
{
if (IsMenuBar())
- bRet = ( nItemPos == static_cast< MenuBarWindow * > (pWindow)->GetHighlightedItem() );
+ bRet = ( nItemPos == static_cast< MenuBarWindow * > (pWindow.get())->GetHighlightedItem() );
else
- bRet = ( nItemPos == static_cast< MenuFloatingWindow * > (pWindow)->GetHighlightedItem() );
+ bRet = ( nItemPos == static_cast< MenuFloatingWindow * > (pWindow.get())->GetHighlightedItem() );
}
return bRet;
@@ -2395,13 +2392,13 @@ void Menu::HighlightItem( sal_uInt16 nItemPos )
{
if (IsMenuBar())
{
- MenuBarWindow* pMenuWin = static_cast< MenuBarWindow* >( pWindow );
+ MenuBarWindow* pMenuWin = static_cast< MenuBarWindow* >( pWindow.get() );
pMenuWin->SetAutoPopup( false );
pMenuWin->ChangeHighlightItem( nItemPos, false );
}
else
{
- static_cast< MenuFloatingWindow* >( pWindow )->ChangeHighlightItem( nItemPos, false );
+ static_cast< MenuFloatingWindow* >( pWindow.get() )->ChangeHighlightItem( nItemPos, false );
}
}
}
@@ -2411,7 +2408,7 @@ IMenuBarWindow* MenuBar::getMenuBarWindow()
{
// so far just a dynamic_cast, hopefully to be turned into something saner
// at some stage
- IMenuBarWindow *pWin = dynamic_cast<IMenuBarWindow*>(pWindow);
+ IMenuBarWindow *pWin = dynamic_cast<IMenuBarWindow*>(pWindow.get());
//either there is no window (fdo#87663) or it is an IMenuBarWindow
assert(!pWindow || pWin);
return pWin;
@@ -2505,7 +2502,7 @@ vcl::Window* MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, Men
MenuBarWindow *pMenuBarWindow = dynamic_cast<MenuBarWindow*>(pWindow);
if (!pMenuBarWindow)
{
- pWindow = pMenuBarWindow = new MenuBarWindow( pParent );
+ pWindow = pMenuBarWindow = VclPtr<MenuBarWindow>::Create( pParent );
}
pMenu->pStartedFrom = 0;
@@ -2532,7 +2529,7 @@ void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete )
IMenuBarWindow* pMenuWin = pMenu->getMenuBarWindow();
if (pMenuWin)
pMenuWin->KillActivePopup();
- delete pWindow;
+ pWindow->disposeOnce();
}
pMenu->pWindow = NULL;
}
@@ -2929,7 +2926,7 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_
CreateAutoMnemonics();
}
- MenuFloatingWindow* pWin = new MenuFloatingWindow( this, pW, nStyle | WB_SYSTEMWINDOW );
+ VclPtrInstance<MenuFloatingWindow> pWin( this, pW, nStyle | WB_SYSTEMWINDOW );
if( pSVData->maNWFData.mbFlatMenu )
pWin->SetBorderStyle( WindowBorderStyle::NOBORDER );
else
@@ -3009,9 +3006,9 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_
{
sal_uInt16 aPos;
if (pSFrom->IsMenuBar())
- aPos = static_cast<MenuBarWindow *>(pSFrom->pWindow)->GetHighlightedItem();
+ aPos = static_cast<MenuBarWindow *>(pSFrom->pWindow.get())->GetHighlightedItem();
else
- aPos = static_cast<MenuFloatingWindow *>(pSFrom->pWindow)->GetHighlightedItem();
+ aPos = static_cast<MenuFloatingWindow *>(pSFrom->pWindow.get())->GetHighlightedItem();
pWin->SetPosInParent( aPos ); // store position to be sent in SUBMENUDEACTIVATE
pSFrom->ImplCallEventListeners( VCLEVENT_MENU_SUBMENUACTIVATE, aPos );
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 553baa472ecb..47f61ad6829d 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -60,7 +60,7 @@ void DecoToolBox::DataChanged( const DataChangedEvent& rDCEvt )
void DecoToolBox::calcMinSize()
{
- ToolBox aTbx( GetParent() );
+ ScopedVclPtrInstance<ToolBox> aTbx( GetParent() );
if( GetItemCount() == 0 )
{
ResMgr* pResMgr = ImplGetResMgr();
@@ -68,7 +68,7 @@ void DecoToolBox::calcMinSize()
Bitmap aBitmap;
if( pResMgr )
aBitmap = Bitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) );
- aTbx.InsertItem( IID_DOCUMENTCLOSE, Image( aBitmap ) );
+ aTbx->InsertItem( IID_DOCUMENTCLOSE, Image( aBitmap ) );
}
else
{
@@ -76,11 +76,13 @@ void DecoToolBox::calcMinSize()
for( sal_uInt16 i = 0; i < nItems; i++ )
{
sal_uInt16 nId = GetItemId( i );
- aTbx.InsertItem( nId, GetItemImage( nId ) );
+ aTbx->InsertItem( nId, GetItemImage( nId ) );
}
}
- aTbx.SetOutStyle( TOOLBOX_STYLE_FLAT );
- maMinSize = aTbx.CalcWindowSizePixel();
+ aTbx->SetOutStyle( TOOLBOX_STYLE_FLAT );
+ maMinSize = aTbx->CalcWindowSizePixel();
+
+ aTbx.disposeAndClear();
}
void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
@@ -117,9 +119,9 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
Window( pParent, 0 ),
- aCloseBtn(this),
- aFloatBtn( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ),
- aHideBtn( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )
+ aCloseBtn(VclPtr<DecoToolBox>::Create(this)),
+ aFloatBtn(VclPtr<PushButton>::Create( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )),
+ aHideBtn(VclPtr<PushButton>::Create(this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ))
{
SetType( WINDOW_MENUBARWINDOW );
pMenu = NULL;
@@ -137,25 +139,25 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
if( pResMgr )
{
BitmapEx aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) );
- aCloseBtn.maImage = Image(aBitmap);
+ aCloseBtn->maImage = Image(aBitmap);
- aCloseBtn.SetOutStyle(TOOLBOX_STYLE_FLAT);
- aCloseBtn.SetBackground();
- aCloseBtn.SetPaintTransparent(true);
- aCloseBtn.SetParentClipMode(PARENTCLIPMODE_NOCLIP);
+ aCloseBtn->SetOutStyle(TOOLBOX_STYLE_FLAT);
+ aCloseBtn->SetBackground();
+ aCloseBtn->SetPaintTransparent(true);
+ aCloseBtn->SetParentClipMode(PARENTCLIPMODE_NOCLIP);
- aCloseBtn.InsertItem(IID_DOCUMENTCLOSE, aCloseBtn.maImage, ToolBoxItemBits::NONE);
- aCloseBtn.SetSelectHdl(LINK(this, MenuBarWindow, CloseHdl));
- aCloseBtn.AddEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
- aCloseBtn.SetQuickHelpText(IID_DOCUMENTCLOSE, ResId(SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr).toString());
+ aCloseBtn->InsertItem(IID_DOCUMENTCLOSE, aCloseBtn->maImage, ToolBoxItemBits::NONE);
+ aCloseBtn->SetSelectHdl(LINK(this, MenuBarWindow, CloseHdl));
+ aCloseBtn->AddEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
+ aCloseBtn->SetQuickHelpText(IID_DOCUMENTCLOSE, ResId(SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr).toString());
- aFloatBtn.SetClickHdl( LINK( this, MenuBarWindow, FloatHdl ) );
- aFloatBtn.SetSymbol( SymbolType::FLOAT );
- aFloatBtn.SetQuickHelpText( ResId(SV_HELPTEXT_RESTORE, *pResMgr).toString() );
+ aFloatBtn->SetClickHdl( LINK( this, MenuBarWindow, FloatHdl ) );
+ aFloatBtn->SetSymbol( SymbolType::FLOAT );
+ aFloatBtn->SetQuickHelpText( ResId(SV_HELPTEXT_RESTORE, *pResMgr).toString() );
- aHideBtn.SetClickHdl( LINK( this, MenuBarWindow, HideHdl ) );
- aHideBtn.SetSymbol( SymbolType::HIDE );
- aHideBtn.SetQuickHelpText( ResId(SV_HELPTEXT_MINIMIZE, *pResMgr).toString() );
+ aHideBtn->SetClickHdl( LINK( this, MenuBarWindow, HideHdl ) );
+ aHideBtn->SetSymbol( SymbolType::HIDE );
+ aHideBtn->SetQuickHelpText( ResId(SV_HELPTEXT_MINIMIZE, *pResMgr).toString() );
}
ImplInitStyleSettings();
@@ -165,8 +167,19 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
MenuBarWindow::~MenuBarWindow()
{
- aCloseBtn.RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
+ disposeOnce();
+}
+
+void MenuBarWindow::dispose()
+{
+ aCloseBtn->RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
RemoveEventListener(LINK(this, MenuBarWindow, ShowHideListener));
+
+ aHideBtn.disposeAndClear();
+ aFloatBtn.disposeAndClear();
+ aCloseBtn.disposeAndClear();
+
+ Window::dispose();
}
void MenuBarWindow::SetMenu( MenuBar* pMen )
@@ -177,10 +190,10 @@ void MenuBarWindow::SetMenu( MenuBar* pMen )
ImplInitMenuWindow( this, true, true );
if ( pMen )
{
- aCloseBtn.ShowItem(IID_DOCUMENTCLOSE, pMen->HasCloseButton());
- aCloseBtn.Show(pMen->HasCloseButton() || !m_aAddButtons.empty());
- aFloatBtn.Show(pMen->HasFloatButton());
- aHideBtn.Show(pMen->HasHideButton());
+ aCloseBtn->ShowItem(IID_DOCUMENTCLOSE, pMen->HasCloseButton());
+ aCloseBtn->Show(pMen->HasCloseButton() || !m_aAddButtons.empty());
+ aFloatBtn->Show(pMen->HasFloatButton());
+ aHideBtn->Show(pMen->HasHideButton());
}
Invalidate();
@@ -201,16 +214,16 @@ void MenuBarWindow::SetHeight(long nHeight)
void MenuBarWindow::ShowButtons( bool bClose, bool bFloat, bool bHide )
{
- aCloseBtn.ShowItem(IID_DOCUMENTCLOSE, bClose);
- aCloseBtn.Show(bClose || !m_aAddButtons.empty());
- aFloatBtn.Show( bFloat );
- aHideBtn.Show( bHide );
+ aCloseBtn->ShowItem(IID_DOCUMENTCLOSE, bClose);
+ aCloseBtn->Show(bClose || !m_aAddButtons.empty());
+ aFloatBtn->Show( bFloat );
+ aHideBtn->Show( bHide );
Resize();
}
Size MenuBarWindow::MinCloseButtonSize()
{
- return aCloseBtn.getMinSize();
+ return aCloseBtn->getMinSize();
}
IMPL_LINK_NOARG(MenuBarWindow, CloseHdl)
@@ -218,7 +231,7 @@ IMPL_LINK_NOARG(MenuBarWindow, CloseHdl)
if( ! pMenu )
return 0;
- if( aCloseBtn.GetCurItemId() == IID_DOCUMENTCLOSE )
+ if( aCloseBtn->GetCurItemId() == IID_DOCUMENTCLOSE )
{
// #i106052# call close hdl asynchronously to ease handler implementation
// this avoids still being in the handler while the DecoToolBox already
@@ -227,12 +240,12 @@ IMPL_LINK_NOARG(MenuBarWindow, CloseHdl)
}
else
{
- std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(aCloseBtn.GetCurItemId());
+ std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(aCloseBtn->GetCurItemId());
if( it != m_aAddButtons.end() )
{
MenuBar::MenuBarButtonCallbackArg aArg;
aArg.nId = it->first;
- aArg.bHighlight = (aCloseBtn.GetHighlightItemId() == it->first);
+ aArg.bHighlight = (aCloseBtn->GetHighlightItemId() == it->first);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
return it->second.m_aSelectLink.Call( &aArg );
}
@@ -250,11 +263,11 @@ IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent*, pEvent )
aArg.bHighlight = (pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
if( pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT )
- aArg.nId = aCloseBtn.GetHighlightItemId();
+ aArg.nId = aCloseBtn->GetHighlightItemId();
else if( pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHTOFF )
{
sal_uInt16 nPos = static_cast< sal_uInt16 >(reinterpret_cast<sal_IntPtr>(pEvent->GetData()));
- aArg.nId = aCloseBtn.GetItemId(nPos);
+ aArg.nId = aCloseBtn->GetItemId(nPos);
}
std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( aArg.nId );
if( it != m_aAddButtons.end() )
@@ -338,8 +351,8 @@ void MenuBarWindow::KillActivePopup()
{
if ( pActivePopup )
{
- if( pActivePopup->pWindow != NULL )
- if( static_cast<FloatingWindow *>(pActivePopup->pWindow)->IsInCleanUp() )
+ if( pActivePopup->pWindow )
+ if( static_cast<FloatingWindow *>(pActivePopup->pWindow.get())->IsInCleanUp() )
return; // kill it later
if ( pActivePopup->bInCallback )
@@ -446,7 +459,7 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b
if( !bStayActive )
{
// #105406# avoid saving the focus when we already have the focus
- bool bNoSaveFocus = (this == ImplGetSVData()->maWinData.mpFocusWin );
+ bool bNoSaveFocus = (this == ImplGetSVData()->maWinData.mpFocusWin.get() );
if( nSaveFocusId )
{
@@ -913,30 +926,30 @@ void MenuBarWindow::Resize()
long nX = aOutSz.Width()-3;
long nY = 2;
- if ( aCloseBtn.IsVisible() )
+ if ( aCloseBtn->IsVisible() )
{
- aCloseBtn.Hide();
- aCloseBtn.SetImages(n);
- Size aTbxSize( aCloseBtn.CalcWindowSizePixel() );
+ aCloseBtn->Hide();
+ aCloseBtn->SetImages(n);
+ Size aTbxSize( aCloseBtn->CalcWindowSizePixel() );
nX -= aTbxSize.Width();
long nTbxY = (aOutSz.Height() - aTbxSize.Height())/2;
- aCloseBtn.setPosSizePixel(nX, nTbxY, aTbxSize.Width(), aTbxSize.Height());
+ aCloseBtn->setPosSizePixel(nX, nTbxY, aTbxSize.Width(), aTbxSize.Height());
nX -= 3;
- aCloseBtn.Show();
+ aCloseBtn->Show();
}
- if ( aFloatBtn.IsVisible() )
+ if ( aFloatBtn->IsVisible() )
{
nX -= n;
- aFloatBtn.setPosSizePixel( nX, nY, n, n );
+ aFloatBtn->setPosSizePixel( nX, nY, n, n );
}
- if ( aHideBtn.IsVisible() )
+ if ( aHideBtn->IsVisible() )
{
nX -= n;
- aHideBtn.setPosSizePixel( nX, nY, n, n );
+ aHideBtn->setPosSizePixel( nX, nY, n, n );
}
- aFloatBtn.SetSymbol( SymbolType::FLOAT );
- aHideBtn.SetSymbol( SymbolType::HIDE );
+ aFloatBtn->SetSymbol( SymbolType::FLOAT );
+ aHideBtn->SetSymbol( SymbolType::HIDE );
Invalidate();
}
@@ -1083,9 +1096,9 @@ sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link& i
AddButtonEntry& rNewEntry = m_aAddButtons[nId];
rNewEntry.m_nId = nId;
rNewEntry.m_aSelectLink = i_rLink;
- aCloseBtn.InsertItem(nId, i_rImage, ToolBoxItemBits::NONE, 0);
- aCloseBtn.calcMinSize();
- ShowButtons(aCloseBtn.IsItemVisible(IID_DOCUMENTCLOSE), aFloatBtn.IsVisible(), aHideBtn.IsVisible());
+ aCloseBtn->InsertItem(nId, i_rImage, ToolBoxItemBits::NONE, 0);
+ aCloseBtn->calcMinSize();
+ ShowButtons(aCloseBtn->IsItemVisible(IID_DOCUMENTCLOSE), aFloatBtn->IsVisible(), aHideBtn->IsVisible());
LayoutChanged();
if( pMenu->mpSalMenu )
@@ -1118,8 +1131,8 @@ Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( sal_uInt16 nId )
if( aRect.IsEmpty() )
{
- aRect = aCloseBtn.GetItemRect(nId);
- Point aOffset = aCloseBtn.OutputToScreenPixel(Point());
+ aRect = aCloseBtn->GetItemRect(nId);
+ Point aOffset = aCloseBtn->OutputToScreenPixel(Point());
aRect.Move( aOffset.X(), aOffset.Y() );
}
}
@@ -1128,10 +1141,10 @@ Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( sal_uInt16 nId )
void MenuBarWindow::RemoveMenuBarButton( sal_uInt16 nId )
{
- sal_uInt16 nPos = aCloseBtn.GetItemPos(nId);
- aCloseBtn.RemoveItem(nPos);
+ sal_uInt16 nPos = aCloseBtn->GetItemPos(nId);
+ aCloseBtn->RemoveItem(nPos);
m_aAddButtons.erase( nId );
- aCloseBtn.calcMinSize();
+ aCloseBtn->calcMinSize();
LayoutChanged();
if( pMenu->mpSalMenu )
diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx
index 46c79accc0f5..bb3c8be22073 100644
--- a/vcl/source/window/menubarwindow.hxx
+++ b/vcl/source/window/menubarwindow.hxx
@@ -39,7 +39,9 @@ class DecoToolBox : public ToolBox
using Window::ImplInit;
public:
- DecoToolBox( vcl::Window* pParent, WinBits nStyle = 0 );
+ DecoToolBox( vcl::Window* pParent, WinBits nStyle = 0 );
+ virtual ~DecoToolBox() {}
+
void ImplInit();
void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
@@ -52,6 +54,7 @@ public:
Image maImage;
};
+
/** Class that implements the actual window of the menu bar.
*/
class MenuBarWindow : public vcl::Window, public IMenuBarWindow
@@ -62,32 +65,32 @@ class MenuBarWindow : public vcl::Window, public IMenuBarWindow
private:
struct AddButtonEntry
{
- sal_uInt16 m_nId;
- Link m_aSelectLink;
- Link m_aHighlightLink;
+ sal_uInt16 m_nId;
+ Link m_aSelectLink;
+ Link m_aHighlightLink;
AddButtonEntry() : m_nId( 0 ) {}
};
Menu* pMenu;
PopupMenu* pActivePopup;
- sal_uInt16 nHighlightedItem;
- sal_uInt16 nRolloveredItem;
- sal_uLong nSaveFocusId;
+ sal_uInt16 nHighlightedItem;
+ sal_uInt16 nRolloveredItem;
+ sal_uLong nSaveFocusId;
bool mbAutoPopup;
bool bIgnoreFirstMove;
bool bStayActive;
- DecoToolBox aCloseBtn;
- PushButton aFloatBtn;
- PushButton aHideBtn;
+ VclPtr<DecoToolBox> aCloseBtn;
+ VclPtr<PushButton> aFloatBtn;
+ VclPtr<PushButton> aHideBtn;
std::map< sal_uInt16, AddButtonEntry > m_aAddButtons;
void HighlightItem( sal_uInt16 nPos, bool bHighlight );
virtual void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true) SAL_OVERRIDE;
- sal_uInt16 ImplFindEntry( const Point& rMousePos ) const;
+ sal_uInt16 ImplFindEntry( const Point& rMousePos ) const;
void ImplCreatePopup( bool bPreSelectFirst );
virtual bool HandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true) SAL_OVERRIDE;
Rectangle ImplGetItemRect( sal_uInt16 nPos );
@@ -107,7 +110,8 @@ private:
public:
MenuBarWindow( vcl::Window* pParent );
- virtual ~MenuBarWindow();
+ virtual ~MenuBarWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ShowButtons(bool bClose, bool bFloat, bool bHide) SAL_OVERRIDE;
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 19e709d43423..227cc8bb5932 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -104,7 +104,14 @@ void MenuFloatingWindow::doShutdown()
MenuFloatingWindow::~MenuFloatingWindow()
{
+ disposeOnce();
+}
+
+void MenuFloatingWindow::dispose()
+{
doShutdown();
+
+ FloatingWindow::dispose();
}
void MenuFloatingWindow::Resize()
@@ -406,8 +413,8 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
{
if ( pActivePopup && ( !pThisOnly || ( pThisOnly == pActivePopup ) ) )
{
- if( pActivePopup->pWindow != NULL )
- if( static_cast<FloatingWindow *>(pActivePopup->pWindow)->IsInCleanUp() )
+ if( pActivePopup->pWindow )
+ if( static_cast<FloatingWindow *>(pActivePopup->pWindow.get())->IsInCleanUp() )
return; // kill it later
if ( pActivePopup->bInCallback )
pActivePopup->bCanceled = true;
diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx
index 5e1b3437584d..3157be8d493f 100644
--- a/vcl/source/window/menufloatingwindow.hxx
+++ b/vcl/source/window/menufloatingwindow.hxx
@@ -80,7 +80,8 @@ protected:
public:
MenuFloatingWindow( Menu* pMenu, vcl::Window* pParent, WinBits nStyle );
- virtual ~MenuFloatingWindow();
+ virtual ~MenuFloatingWindow();
+ virtual void dispose() SAL_OVERRIDE;
void doShutdown();
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index bb7698a8428e..c4623a61fb72 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -198,7 +198,7 @@ static bool IsWindowFocused(const WindowImpl& rWinImpl)
void Window::ImplGrabFocus( sal_uInt16 nFlags )
{
// #143570# no focus for destructing windows
- if( mpWindowImpl->mbInDtor )
+ if( !mpWindowImpl || mpWindowImpl->mbInDispose )
return;
// some event listeners do really bad stuff
@@ -215,7 +215,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
// For a lack of design we need a little hack here to
// ensure that dialogs on close pass the focus back to
// the correct window
- if ( mpWindowImpl->mpLastFocusWindow && (mpWindowImpl->mpLastFocusWindow != this) &&
+ if ( mpWindowImpl->mpLastFocusWindow && (mpWindowImpl->mpLastFocusWindow.get() != this) &&
!(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) &&
mpWindowImpl->mpLastFocusWindow->IsEnabled() &&
mpWindowImpl->mpLastFocusWindow->IsInputEnabled() &&
@@ -231,7 +231,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
// For a lack of design we need a little hack here to
// ensure that dialogs on close pass the focus back to
// the correct window
- if ( mpWindowImpl->mpLastFocusWindow && (mpWindowImpl->mpLastFocusWindow != this) &&
+ if ( mpWindowImpl->mpLastFocusWindow && (mpWindowImpl->mpLastFocusWindow.get() != this) &&
!(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) &&
mpWindowImpl->mpLastFocusWindow->IsEnabled() &&
mpWindowImpl->mpLastFocusWindow->IsInputEnabled() &&
@@ -257,7 +257,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
vcl::Window *pFrame = pSVData->maWinData.mpFirstFrame;
while( pFrame )
{
- if( pFrame != mpWindowImpl->mpFrameWindow && pFrame->mpWindowImpl->mpFrameData->mnFocusId )
+ if( pFrame != mpWindowImpl->mpFrameWindow.get() && pFrame->mpWindowImpl->mpFrameData->mnFocusId )
{
bAsyncFocusWaiting = true;
break;
@@ -283,11 +283,13 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
pParent = pParent->mpWindowImpl->mpParent;
}
- if ( ( pSVData->maWinData.mpFocusWin != this && ! mpWindowImpl->mbInDtor ) || ( bAsyncFocusWaiting && !bHasFocus && !bMustNotGrabFocus ) )
+ if ( ( pSVData->maWinData.mpFocusWin.get() != this &&
+ mpWindowImpl && !mpWindowImpl->mbInDispose ) ||
+ ( bAsyncFocusWaiting && !bHasFocus && !bMustNotGrabFocus ) )
{
// EndExtTextInput if it is not the same window
if ( pSVData->maWinData.mpExtTextInputWin &&
- (pSVData->maWinData.mpExtTextInputWin != this) )
+ (pSVData->maWinData.mpExtTextInputWin.get() != this) )
pSVData->maWinData.mpExtTextInputWin->EndExtTextInput( EXTTEXTINPUT_END_COMPLETE );
// mark this windows as the last FocusWindow
@@ -358,7 +360,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
pOldFocusWindow->ImplCallDeactivateListeners( this );
}
- if ( pSVData->maWinData.mpFocusWin == this )
+ if ( pSVData->maWinData.mpFocusWin.get() == this )
{
if ( mpWindowImpl->mpSysObj )
{
@@ -367,7 +369,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
mpWindowImpl->mpSysObj->GrabFocus();
}
- if ( pSVData->maWinData.mpFocusWin == this )
+ if ( pSVData->maWinData.mpFocusWin.get() == this )
{
if ( mpWindowImpl->mpCursor )
mpWindowImpl->mpCursor->ImplShow();
@@ -450,13 +452,13 @@ void Window::CaptureMouse()
ImplSVData* pSVData = ImplGetSVData();
// possibly stop tracking
- if ( pSVData->maWinData.mpTrackWin != this )
+ if ( pSVData->maWinData.mpTrackWin.get() != this )
{
if ( pSVData->maWinData.mpTrackWin )
pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
}
- if ( pSVData->maWinData.mpCaptureWin != this )
+ if ( pSVData->maWinData.mpCaptureWin.get() != this )
{
pSVData->maWinData.mpCaptureWin = this;
mpWindowImpl->mpFrame->CaptureMouse( true );
@@ -468,10 +470,10 @@ void Window::ReleaseMouse()
ImplSVData* pSVData = ImplGetSVData();
- DBG_ASSERTWARNING( pSVData->maWinData.mpCaptureWin == this,
+ DBG_ASSERTWARNING( pSVData->maWinData.mpCaptureWin.get() == this,
"Window::ReleaseMouse(): window doesn't have the mouse capture" );
- if ( pSVData->maWinData.mpCaptureWin == this )
+ if ( pSVData->maWinData.mpCaptureWin.get() == this )
{
pSVData->maWinData.mpCaptureWin = NULL;
mpWindowImpl->mpFrame->CaptureMouse( false );
@@ -657,6 +659,8 @@ void Window::ImplStartDnd()
Reference< css::datatransfer::dnd::XDropTarget > Window::GetDropTarget()
{
+ if( !mpWindowImpl )
+ return Reference< css::datatransfer::dnd::XDropTarget >();
if( ! mpWindowImpl->mxDNDListenerContainer.is() )
{
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 2c68157e759c..9f2fd75973c7 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -151,9 +151,15 @@ MessBox::MessBox( vcl::Window* pParent, WinBits nStyle,
MessBox::~MessBox()
{
- delete mpVCLMultiLineEdit;
- delete mpFixedImage;
- delete mpCheckBox;
+ disposeOnce();
+}
+
+void MessBox::dispose()
+{
+ mpVCLMultiLineEdit.disposeAndClear();
+ mpFixedImage.disposeAndClear();
+ mpCheckBox.disposeAndClear();
+ ButtonDialog::dispose();
}
void MessBox::ImplPosControls()
@@ -190,17 +196,12 @@ void MessBox::ImplPosControls()
WinBits nWinStyle = WB_LEFT | WB_NOLABEL;
sal_uInt16 nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT;
- delete mpVCLMultiLineEdit;
- if ( mpFixedImage )
- {
- delete mpFixedImage;
- mpFixedImage = NULL;
- }
+ mpVCLMultiLineEdit.disposeAndClear();
+ mpFixedImage.disposeAndClear();
if ( mpCheckBox )
{
mbCheck = mpCheckBox->IsChecked();
- delete mpCheckBox;
- mpCheckBox = NULL;
+ mpCheckBox.disposeAndClear();
}
// Clean up message text with tabs
@@ -230,7 +231,7 @@ void MessBox::ImplPosControls()
aImageSize.Width() += 4;
aImageSize.Height() += 4;
aTextPos.X() += aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
- mpFixedImage = new FixedImage( this );
+ mpFixedImage = VclPtr<FixedImage>::Create( this );
mpFixedImage->SetPosSizePixel( Point( IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_X,
IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ),
aImageSize );
@@ -320,7 +321,7 @@ void MessBox::ImplPosControls()
}
}
- mpCheckBox = new CheckBox( this );
+ mpCheckBox = VclPtr<CheckBox>::Create( this );
mpCheckBox->Check( mbCheck );
mpCheckBox->SetText( aMnemonicString );
mpCheckBox->SetStyle( mpCheckBox->GetStyle() | WB_WORDBREAK );
@@ -342,7 +343,7 @@ void MessBox::ImplPosControls()
mpCheckBox->Show();
}
- mpVCLMultiLineEdit = new VclMultiLineEdit( this, nWinStyle );
+ mpVCLMultiLineEdit = VclPtr<VclMultiLineEdit>::Create( this, nWinStyle );
mpVCLMultiLineEdit->SetText( aMessText );
mpVCLMultiLineEdit->SetPosSizePixel( aTextPos, aMEditSize );
mpVCLMultiLineEdit->Show();
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 741940f45e2d..21af6cc53598 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -16,22 +16,22 @@ class OpenGLWindowImpl
{
public:
OpenGLWindowImpl(vcl::Window* pWindow);
+ ~OpenGLWindowImpl() { mxChildWindow.disposeAndClear(); }
OpenGLContext& getContext() { return maContext;}
private:
OpenGLContext maContext;
- std::unique_ptr<SystemChildWindow> mxChildWindow;
+ VclPtr<SystemChildWindow> mxChildWindow;
};
OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow)
{
SystemWindowData aData = OpenGLContext::generateWinData(pWindow, false);
- mxChildWindow.reset(new SystemChildWindow(pWindow, 0, &aData));
+ mxChildWindow.reset(VclPtr<SystemChildWindow>::Create(pWindow, 0, &aData));
mxChildWindow->Show();
maContext.init(mxChildWindow.get());
pWindow->SetMouseTransparent(false);
}
-
OpenGLWindow::OpenGLWindow(vcl::Window* pParent):
Window(pParent, 0),
mxImpl(new OpenGLWindowImpl(this)),
@@ -41,8 +41,16 @@ OpenGLWindow::OpenGLWindow(vcl::Window* pParent):
OpenGLWindow::~OpenGLWindow()
{
+ disposeOnce();
+}
+
+void OpenGLWindow::dispose()
+{
if(mpRenderer)
mpRenderer->contextDestroyed();
+ mpRenderer = NULL;
+ mxImpl.reset();
+ Window::dispose();
}
OpenGLContext& OpenGLWindow::getContext()
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 1384dfe3d8f2..1dd9b3a50e98 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -43,7 +43,7 @@
class PaintHelper
{
private:
- vcl::Window* m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
vcl::Region* m_pChildRegion;
Rectangle m_aSelectionRect;
Rectangle m_aPaintRect;
@@ -1094,7 +1094,7 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
mpWindowImpl->mbReallyVisible = bRVisible;
// paint metafile to VDev
- VirtualDevice* pMaskedDevice = new VirtualDevice( *i_pTargetOutDev, 0, 0 );
+ VclPtrInstance<VirtualDevice> pMaskedDevice( *i_pTargetOutDev, 0, 0 );
pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
pMaskedDevice->EnableRTL( IsRTLEnabled() );
aMtf.WindStart();
@@ -1102,7 +1102,7 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), pMaskedDevice->GetOutputSizePixel() ) );
i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx );
// get rid of virtual device now so they don't pile up during recursive calls
- delete pMaskedDevice, pMaskedDevice = NULL;
+ pMaskedDevice.disposeAndClear();
for( vcl::Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext )
{
diff --git a/vcl/source/window/popupmenuwindow.cxx b/vcl/source/window/popupmenuwindow.cxx
index 1a33ff9037ca..2d9c52699054 100644
--- a/vcl/source/window/popupmenuwindow.cxx
+++ b/vcl/source/window/popupmenuwindow.cxx
@@ -46,7 +46,13 @@ PopupMenuFloatingWindow::PopupMenuFloatingWindow( vcl::Window* pParent, WinBits
PopupMenuFloatingWindow::~PopupMenuFloatingWindow()
{
+ disposeOnce();
+}
+
+void PopupMenuFloatingWindow::dispose()
+{
delete mpImplData;
+ FloatingWindow::dispose();
}
sal_uInt16 PopupMenuFloatingWindow::GetMenuStackLevel() const
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index c4ea5c7aac3c..f24755d92904 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -64,24 +64,33 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeShowNupOrderWindow(vcl
PrintDialog::PrintPreviewWindow::PrintPreviewWindow( vcl::Window* i_pParent )
: Window( i_pParent, 0 )
, maOrigSize( 10, 10 )
- , maPageVDev( *this )
+ , maPageVDev( VclPtr<VirtualDevice>::Create(*this) )
, maToolTipString(VclResId( SV_PRINT_PRINTPREVIEW_TXT).toString())
, mbGreyscale( false )
- , maHorzDim( this, WB_HORZ | WB_CENTER )
- , maVertDim( this, WB_VERT | WB_VCENTER )
+ , maHorzDim(VclPtr<FixedLine>::Create(this, WB_HORZ | WB_CENTER))
+ , maVertDim(VclPtr<FixedLine>::Create(this, WB_VERT | WB_VCENTER))
{
SetPaintTransparent( true );
SetBackground();
- maPageVDev.SetBackground( Color( COL_WHITE ) );
- maHorzDim.Show();
- maVertDim.Show();
+ maPageVDev->SetBackground( Color( COL_WHITE ) );
+ maHorzDim->Show();
+ maVertDim->Show();
- maHorzDim.SetText( OUString( "2.0in" ) );
- maVertDim.SetText( OUString( "2.0in" ) );
+ maHorzDim->SetText( OUString( "2.0in" ) );
+ maVertDim->SetText( OUString( "2.0in" ) );
}
PrintDialog::PrintPreviewWindow::~PrintPreviewWindow()
{
+ disposeOnce();
+}
+
+void PrintDialog::PrintPreviewWindow::dispose()
+{
+ maHorzDim.disposeAndClear();
+ maVertDim.disposeAndClear();
+ maPageVDev.disposeAndClear();
+ Window::dispose();
}
const sal_Int32 PrintDialog::PrintPreviewWindow::PREVIEW_BITMAP_WIDTH = 1600;
@@ -91,7 +100,7 @@ void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDC
// react on settings changed
if( i_rDCEvt.GetType() == DataChangedEventType::SETTINGS )
{
- maPageVDev.SetBackground( Color( COL_WHITE ) );
+ maPageVDev->SetBackground( Color( COL_WHITE ) );
}
Window::DataChanged( i_rDCEvt );
}
@@ -99,7 +108,7 @@ void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDC
void PrintDialog::PrintPreviewWindow::Resize()
{
Size aNewSize( GetSizePixel() );
- long nTextHeight = maHorzDim.GetTextHeight();
+ long nTextHeight = maHorzDim->GetTextHeight();
// leave small space for decoration
aNewSize.Width() -= nTextHeight + 2;
aNewSize.Height() -= nTextHeight + 2;
@@ -140,21 +149,21 @@ void PrintDialog::PrintPreviewWindow::Resize()
aScaledSize.Width() = PREVIEW_BITMAP_WIDTH;
aScaledSize.Height() = PREVIEW_BITMAP_WIDTH * aAspectRatio;
- maPageVDev.SetOutputSizePixel( aScaledSize, false );
+ maPageVDev->SetOutputSizePixel( aScaledSize, false );
// position dimension lines
Point aRef( nTextHeight + (aNewSize.Width() - maPreviewSize.Width())/2,
nTextHeight + (aNewSize.Height() - maPreviewSize.Height())/2 );
- maHorzDim.SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ),
+ maHorzDim->SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ),
Size( maPreviewSize.Width(), nTextHeight ) );
- maVertDim.SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ),
+ maVertDim->SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ),
Size( nTextHeight, maPreviewSize.Height() ) );
}
void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
{
- long nTextHeight = maHorzDim.GetTextHeight();
+ long nTextHeight = maHorzDim->GetTextHeight();
Size aSize( GetSizePixel() );
Point aOffset( (aSize.Width() - maPreviewSize.Width() + nTextHeight) / 2 ,
(aSize.Height() - maPreviewSize.Height() + nTextHeight) / 2 );
@@ -218,8 +227,8 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
maOrigSize = i_rOrigSize;
maReplacementString = i_rReplacement;
mbGreyscale = i_bGreyscale;
- maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY );
- maPageVDev.EnableOutput( true );
+ maPageVDev->SetReferenceDevice( i_nDPIX, i_nDPIY );
+ maPageVDev->EnableOutput( true );
// use correct measurements
const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() );
@@ -241,13 +250,13 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
aBuf.append( i_rPaperName );
aBuf.append( ')' );
}
- maHorzDim.SetText( aBuf.makeStringAndClear() );
+ maHorzDim->SetText( aBuf.makeStringAndClear() );
aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits );
aBuf.append( aNumText )
.append( sal_Unicode( ' ' ) );
aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" );
- maVertDim.SetText( aBuf.makeStringAndClear() );
+ maVertDim->SetText( aBuf.makeStringAndClear() );
Resize();
preparePreviewBitmap();
@@ -258,8 +267,8 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap()
{
GDIMetaFile aMtf( maMtf );
- Size aVDevSize( maPageVDev.GetOutputSizePixel() );
- const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) );
+ Size aVDevSize( maPageVDev->GetOutputSizePixel() );
+ const Size aLogicSize( maPageVDev->PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) );
Size aOrigSize( maOrigSize );
if( aOrigSize.Width() < 1 )
aOrigSize.Width() = aLogicSize.Width();
@@ -267,31 +276,31 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap()
aOrigSize.Height() = aLogicSize.Height();
double fScale = double(aLogicSize.Width())/double(aOrigSize.Width());
- maPageVDev.Erase();
- maPageVDev.Push();
- maPageVDev.SetMapMode( MAP_100TH_MM );
- sal_uLong nOldDrawMode = maPageVDev.GetDrawMode();
+ maPageVDev->Erase();
+ maPageVDev->Push();
+ maPageVDev->SetMapMode( MAP_100TH_MM );
+ sal_uLong nOldDrawMode = maPageVDev->GetDrawMode();
if( mbGreyscale )
- maPageVDev.SetDrawMode( maPageVDev.GetDrawMode() |
+ maPageVDev->SetDrawMode( maPageVDev->GetDrawMode() |
( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT |
DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) );
aMtf.WindStart();
aMtf.Scale( fScale, fScale );
aMtf.WindStart();
- const sal_uInt16 nOriginalAA(maPageVDev.GetAntialiasing());
- maPageVDev.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW);
- aMtf.Play( &maPageVDev, Point( 0, 0 ), aLogicSize );
- maPageVDev.SetAntialiasing(nOriginalAA);
+ const sal_uInt16 nOriginalAA(maPageVDev->GetAntialiasing());
+ maPageVDev->SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW);
+ aMtf.Play( maPageVDev.get(), Point( 0, 0 ), aLogicSize );
+ maPageVDev->SetAntialiasing(nOriginalAA);
- maPageVDev.Pop();
+ maPageVDev->Pop();
SetMapMode( MAP_PIXEL );
- maPageVDev.SetMapMode( MAP_PIXEL );
+ maPageVDev->SetMapMode( MAP_PIXEL );
- maPreviewBitmap = Bitmap(maPageVDev.GetBitmap(Point(0, 0), aVDevSize));
+ maPreviewBitmap = Bitmap(maPageVDev->GetBitmap(Point(0, 0), aVDevSize));
- maPageVDev.SetDrawMode( nOldDrawMode );
+ maPageVDev->SetDrawMode( nOldDrawMode );
}
PrintDialog::ShowNupOrderWindow::ShowNupOrderWindow( vcl::Window* i_pParent )
@@ -303,10 +312,6 @@ PrintDialog::ShowNupOrderWindow::ShowNupOrderWindow( vcl::Window* i_pParent )
ImplInitSettings();
}
-PrintDialog::ShowNupOrderWindow::~ShowNupOrderWindow()
-{
-}
-
void PrintDialog::ShowNupOrderWindow::ImplInitSettings()
{
SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
@@ -619,13 +624,13 @@ PrintDialog::PrintDialog( vcl::Window* i_pParent, const std::shared_ptr<PrinterC
if( maJobPage.mpPrinters->GetEntryPos( aValue ) != LISTBOX_ENTRY_NOTFOUND )
{
maJobPage.mpPrinters->SelectEntry( aValue );
- maPController->setPrinter(std::make_shared<Printer>(aValue));
+ maPController->setPrinter( VclPtrInstance<Printer>( aValue ) );
}
else
{
// fall back to default printer
maJobPage.mpPrinters->SelectEntry( Printer::GetDefaultPrinterName() );
- maPController->setPrinter(std::make_shared<Printer>(Printer::GetDefaultPrinterName()));
+ maPController->setPrinter( VclPtrInstance<Printer>( Printer::GetDefaultPrinterName() ) );
}
}
// not printing to file
@@ -712,7 +717,22 @@ PrintDialog::PrintDialog( vcl::Window* i_pParent, const std::shared_ptr<PrinterC
PrintDialog::~PrintDialog()
{
+ disposeOnce();
+}
+
+void PrintDialog::dispose()
+{
delete mpCustomOptionsUIBuilder;
+ mpTabCtrl.clear();
+ mpPreviewWindow.clear();
+ mpPageEdit.clear();
+ mpNumPagesText.clear();
+ mpBackwardBtn.clear();
+ mpForwardBtn.clear();
+ mpOKButton.clear();
+ mpCancelButton.clear();
+ mpHelpButton.clear();
+ ModalDialog::dispose();
}
void PrintDialog::readFromSettings()
@@ -1207,7 +1227,7 @@ void PrintDialog::checkControlDependencies()
void PrintDialog::checkOptionalControlDependencies()
{
- for( std::map< vcl::Window*, OUString >::iterator it = maControlToPropertyMap.begin();
+ for( auto it = maControlToPropertyMap.begin();
it != maControlToPropertyMap.end(); ++it )
{
bool bShouldbeEnabled = maPController->isUIOptionEnabled( it->second );
@@ -1229,9 +1249,9 @@ void PrintDialog::checkOptionalControlDependencies()
}
}
- if( bShouldbeEnabled && dynamic_cast<RadioButton*>(it->first) )
+ if( bShouldbeEnabled && dynamic_cast<RadioButton*>(it->first.get()) )
{
- std::map< vcl::Window*, sal_Int32 >::const_iterator r_it = maControlToNumValMap.find( it->first );
+ auto r_it = maControlToNumValMap.find( it->first );
if( r_it != maControlToNumValMap.end() )
{
bShouldbeEnabled = maPController->isUIChoiceEnabled( it->second, r_it->second );
@@ -1308,7 +1328,7 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache )
{
const MapMode aMapMode( MAP_100TH_MM );
GDIMetaFile aMtf;
- std::shared_ptr<Printer> aPrt(maPController->getPrinter());
+ VclPtr<Printer> aPrt( maPController->getPrinter() );
if( nPages > 0 )
{
PrinterController::PageSize aPageSize =
@@ -1501,7 +1521,7 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox )
{
OUString aNewPrinter( pBox->GetSelectEntry() );
// set new printer
- maPController->setPrinter(std::make_shared<Printer>(aNewPrinter));
+ maPController->setPrinter( VclPtrInstance<Printer>( aNewPrinter ) );
maPController->resetPrinterOptions( maOptionsPage.mpToFileBox->IsChecked() );
// update text fields
updatePrinterText();
@@ -1650,7 +1670,7 @@ IMPL_LINK_NOARG(PrintDialog, UIOptionsChanged)
PropertyValue* PrintDialog::getValueForWindow( vcl::Window* i_pWindow ) const
{
PropertyValue* pVal = NULL;
- std::map< vcl::Window*, OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow );
+ auto it = maControlToPropertyMap.find( i_pWindow );
if( it != maControlToPropertyMap.end() )
{
pVal = maPController->getValue( it->second );
@@ -1666,10 +1686,10 @@ PropertyValue* PrintDialog::getValueForWindow( vcl::Window* i_pWindow ) const
void PrintDialog::updateWindowFromProperty( const OUString& i_rProperty )
{
beans::PropertyValue* pValue = maPController->getValue( i_rProperty );
- std::map< OUString, std::vector< vcl::Window* > >::const_iterator it = maPropertyToWindowMap.find( i_rProperty );
+ auto it = maPropertyToWindowMap.find( i_rProperty );
if( pValue && it != maPropertyToWindowMap.end() )
{
- const std::vector< vcl::Window* >& rWindows( it->second );
+ const std::vector< VclPtr<vcl::Window> >& rWindows( it->second );
if( ! rWindows.empty() )
{
bool bVal = false;
@@ -1677,7 +1697,7 @@ void PrintDialog::updateWindowFromProperty( const OUString& i_rProperty )
if( pValue->Value >>= bVal )
{
// we should have a CheckBox for this one
- CheckBox* pBox = dynamic_cast< CheckBox* >( rWindows.front() );
+ CheckBox* pBox = dynamic_cast< CheckBox* >( rWindows.front().get() );
if( pBox )
{
pBox->Check( bVal );
@@ -1698,14 +1718,14 @@ void PrintDialog::updateWindowFromProperty( const OUString& i_rProperty )
else if( pValue->Value >>= nVal )
{
// this could be a ListBox or a RadioButtonGroup
- ListBox* pList = dynamic_cast< ListBox* >( rWindows.front() );
+ ListBox* pList = dynamic_cast< ListBox* >( rWindows.front().get() );
if( pList )
{
pList->SelectEntryPos( static_cast< sal_uInt16 >(nVal) );
}
else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) )
{
- RadioButton* pBtn = dynamic_cast< RadioButton* >( rWindows[nVal] );
+ RadioButton* pBtn = dynamic_cast< RadioButton* >( rWindows[nVal].get() );
DBG_ASSERT( pBtn, "unexpected control for property" );
if( pBtn )
pBtn->Check();
@@ -1717,7 +1737,7 @@ void PrintDialog::updateWindowFromProperty( const OUString& i_rProperty )
void PrintDialog::makeEnabled( vcl::Window* i_pWindow )
{
- std::map< vcl::Window*, OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow );
+ auto it = maControlToPropertyMap.find( i_pWindow );
if( it != maControlToPropertyMap.end() )
{
OUString aDependency( maPController->makeEnabled( it->second ) );
@@ -1752,7 +1772,7 @@ IMPL_LINK( PrintDialog, UIOption_RadioHdl, RadioButton*, i_pBtn )
if( i_pBtn->IsChecked() )
{
PropertyValue* pVal = getValueForWindow( i_pBtn );
- std::map< vcl::Window*, sal_Int32 >::const_iterator it = maControlToNumValMap.find( i_pBtn );
+ auto it = maControlToNumValMap.find( i_pBtn );
if( pVal && it != maControlToNumValMap.end() )
{
makeEnabled( i_pBtn );
@@ -1895,6 +1915,19 @@ PrintProgressDialog::PrintProgressDialog(vcl::Window* i_pParent, int i_nMax)
}
+PrintProgressDialog::~PrintProgressDialog()
+{
+ disposeOnce();
+}
+
+void PrintProgressDialog::dispose()
+{
+ mpText.clear();
+ mpProgress.clear();
+ mpButton.clear();
+ ModelessDialog::dispose();
+}
+
IMPL_LINK( PrintProgressDialog, ClickHdl, Button*, pButton )
{
if( pButton == mpButton )
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
index 7532ccf9cdc4..a40ef10dc592 100644
--- a/vcl/source/window/scrwnd.cxx
+++ b/vcl/source/window/scrwnd.cxx
@@ -84,8 +84,16 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) :
ImplWheelWindow::~ImplWheelWindow()
{
+ disposeOnce();
+}
+
+void ImplWheelWindow::dispose()
+{
ImplStop();
delete mpTimer;
+ mpTimer = NULL;
+
+ FloatingWindow::dispose();
}
void ImplWheelWindow::ImplStop()
diff --git a/vcl/source/window/scrwnd.hxx b/vcl/source/window/scrwnd.hxx
index ddd08f940cc9..6ec18c4e2b73 100644
--- a/vcl/source/window/scrwnd.hxx
+++ b/vcl/source/window/scrwnd.hxx
@@ -70,7 +70,8 @@ protected:
public:
ImplWheelWindow( vcl::Window* pParent );
- virtual ~ImplWheelWindow();
+ virtual ~ImplWheelWindow();
+ virtual void dispose() SAL_OVERRIDE;
void ImplStop();
void ImplSetWheelMode( sal_uLong nWheelMode );
diff --git a/vcl/source/window/settings.cxx b/vcl/source/window/settings.cxx
index 3e60bbd9bab0..63586e3ee70e 100644
--- a/vcl/source/window/settings.cxx
+++ b/vcl/source/window/settings.cxx
@@ -51,8 +51,8 @@ void Window::SetSettings( const AllSettings& rSettings, bool bChild )
{
mpWindowImpl->mpBorderWindow->SetSettings( rSettings, false );
if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->mpMenuBarWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->SetSettings( rSettings, true );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow )
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->SetSettings( rSettings, true );
}
AllSettings aOldSettings(*mxSettings);
@@ -86,8 +86,8 @@ void Window::UpdateSettings( const AllSettings& rSettings, bool bChild )
{
mpWindowImpl->mpBorderWindow->UpdateSettings( rSettings, false );
if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->mpMenuBarWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->UpdateSettings( rSettings, true );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow )
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->UpdateSettings( rSettings, true );
}
AllSettings aOldSettings(*mxSettings);
diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx
index 947dc986cf20..70482c02a039 100644
--- a/vcl/source/window/split.cxx
+++ b/vcl/source/window/split.cxx
@@ -151,8 +151,19 @@ Splitter::Splitter( vcl::Window* pParent, WinBits nStyle ) :
Splitter::~Splitter()
{
- TaskPaneList *pTList = GetSystemWindow()->GetTaskPaneList();
- pTList->RemoveWindow( this );
+ disposeOnce();
+}
+
+void Splitter::dispose()
+{
+ SystemWindow *pSysWin = GetSystemWindow();
+ if(pSysWin)
+ {
+ TaskPaneList *pTList = pSysWin->GetTaskPaneList();
+ pTList->RemoveWindow(this);
+ }
+ mpRefWin.clear();
+ Window::dispose();
}
void Splitter::SetHorizontal(bool bNew)
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index c18e1d06adca..293479151943 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -53,9 +53,9 @@ struct ImplSplitItem
long mnOldWidth;
long mnOldHeight;
ImplSplitSet* mpSet;
- vcl::Window* mpWindow;
- vcl::Window* mpOrgParent;
- sal_uInt16 mnId;
+ VclPtr<vcl::Window> mpWindow;
+ VclPtr<vcl::Window> mpOrgParent;
+ sal_uInt16 mnId;
SplitWindowItemBits mnBits;
bool mbFixed;
bool mbSubSize;
@@ -1347,9 +1347,16 @@ SplitWindow::SplitWindow( vcl::Window* pParent, WinBits nStyle ) :
SplitWindow::~SplitWindow()
{
+ disposeOnce();
+}
+
+void SplitWindow::dispose()
+{
// delete Sets
- ImplDeleteSet( mpMainSet );
+ if (mpMainSet)
+ ImplDeleteSet( mpMainSet );
mpMainSet = NULL; //NULL for base-class callbacks during dtoring
+ DockingWindow::dispose();
}
void SplitWindow::ImplSetWindowSize( long nDelta )
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index f20c0ece86dd..ccf60ca60f5f 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -46,8 +46,8 @@ using ::com::sun::star::awt::XTopWindow;
struct ImplCalcToTopData
{
- ImplCalcToTopData* mpNext;
- vcl::Window* mpWindow;
+ ImplCalcToTopData* mpNext;
+ VclPtr<vcl::Window> mpWindow;
vcl::Region* mpInvalidateRegion;
};
@@ -117,12 +117,12 @@ void Window::ImplRemoveWindow( bool bRemoveFrameData )
{
if ( ImplIsOverlapWindow() )
{
- if ( mpWindowImpl->mpFrameData->mpFirstOverlap == this )
+ if ( mpWindowImpl->mpFrameData->mpFirstOverlap.get() == this )
mpWindowImpl->mpFrameData->mpFirstOverlap = mpWindowImpl->mpNextOverlap;
else
{
vcl::Window* pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap;
- while ( pTempWin->mpWindowImpl->mpNextOverlap != this )
+ while ( pTempWin->mpWindowImpl->mpNextOverlap.get() != this )
pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
pTempWin->mpWindowImpl->mpNextOverlap = mpWindowImpl->mpNextOverlap;
}
@@ -194,7 +194,7 @@ void Window::reorderWithinParent(sal_uInt16 nNewPosition)
void Window::ImplToBottomChild()
{
- if ( !ImplIsOverlapWindow() && !mpWindowImpl->mbReallyVisible && (mpWindowImpl->mpParent->mpWindowImpl->mpLastChild != this) )
+ if ( !ImplIsOverlapWindow() && !mpWindowImpl->mbReallyVisible && (mpWindowImpl->mpParent->mpWindowImpl->mpLastChild.get() != this) )
{
// put the window to the end of the list
if ( mpWindowImpl->mpPrev )
@@ -265,7 +265,7 @@ void Window::ImplToTop( sal_uInt16 nFlags )
}
else
{
- if ( mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap != this )
+ if ( mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap.get() != this )
{
// remove window from the list
mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
@@ -477,7 +477,7 @@ void Window::SetZOrder( vcl::Window* pRefWindow, sal_uInt16 nFlags )
DBG_ASSERT( pRefWindow->mpWindowImpl->mpParent == mpWindowImpl->mpParent, "Window::SetZOrder() - pRefWindow has other parent" );
if ( nFlags & WINDOW_ZORDER_BEFOR )
{
- if ( pRefWindow->mpWindowImpl->mpPrev == this )
+ if ( pRefWindow->mpWindowImpl->mpPrev.get() == this )
return;
if ( ImplIsOverlapWindow() )
@@ -515,7 +515,7 @@ void Window::SetZOrder( vcl::Window* pRefWindow, sal_uInt16 nFlags )
}
else if ( nFlags & WINDOW_ZORDER_BEHIND )
{
- if ( pRefWindow->mpWindowImpl->mpNext == this )
+ if ( pRefWindow->mpWindowImpl->mpNext.get() == this )
return;
if ( ImplIsOverlapWindow() )
@@ -632,7 +632,7 @@ void Window::EnableAlwaysOnTop( bool bEnable )
bool Window::IsTopWindow() const
{
- if ( mpWindowImpl->mbInDtor )
+ if ( !mpWindowImpl || mpWindowImpl->mbInDispose )
return false;
// topwindows must be frames or they must have a borderwindow which is a frame
@@ -879,9 +879,8 @@ void Window::SetParent( vcl::Window* pNewParent )
// remove ownerdraw decorated windows from list in the top-most frame window
if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame )
{
- ::std::vector< vcl::Window* >& rList = ImplGetOwnerDrawList();
- ::std::vector< vcl::Window* >::iterator p;
- p = ::std::find( rList.begin(), rList.end(), this );
+ ::std::vector< VclPtr<vcl::Window> >& rList = ImplGetOwnerDrawList();
+ auto p = ::std::find( rList.begin(), rList.end(), VclPtr<vcl::Window>(this) );
if( p != rList.end() )
rList.erase( p );
}
@@ -895,7 +894,7 @@ void Window::SetParent( vcl::Window* pNewParent )
return;
}
- if ( mpWindowImpl->mpParent == pNewParent )
+ if ( mpWindowImpl->mpParent.get() == pNewParent )
return;
if ( mpWindowImpl->mbFrame )
@@ -912,7 +911,7 @@ void Window::SetParent( vcl::Window* pNewParent )
else
{
pNewOverlapWindow = pNewParent->ImplGetFirstOverlapWindow();
- if ( mpWindowImpl->mpOverlapWindow != pNewOverlapWindow )
+ if ( mpWindowImpl->mpOverlapWindow.get() != pNewOverlapWindow )
pOldOverlapWindow = mpWindowImpl->mpOverlapWindow;
else
pOldOverlapWindow = NULL;
@@ -1023,6 +1022,8 @@ void Window::SetParent( vcl::Window* pNewParent )
sal_uInt16 Window::GetChildCount() const
{
+ if (!mpWindowImpl)
+ return 0;
sal_uInt16 nChildCount = 0;
vcl::Window* pChild = mpWindowImpl->mpFirstChild;
@@ -1037,6 +1038,8 @@ sal_uInt16 Window::GetChildCount() const
vcl::Window* Window::GetChild( sal_uInt16 nChild ) const
{
+ if (!mpWindowImpl)
+ return NULL;
sal_uInt16 nChildCount = 0;
vcl::Window* pChild = mpWindowImpl->mpFirstChild;
@@ -1053,6 +1056,8 @@ vcl::Window* Window::GetChild( sal_uInt16 nChild ) const
vcl::Window* Window::GetWindow( sal_uInt16 nType ) const
{
+ if (!mpWindowImpl)
+ return 0;
switch ( nType )
{
@@ -1104,17 +1109,17 @@ vcl::Window* Window::GetWindow( sal_uInt16 nType ) const
return const_cast<vcl::Window*>(this);
case WINDOW_FIRSTTOPWINDOWCHILD:
- return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : *ImplGetWinData()->maTopWindowChildren.begin();
+ return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : (*ImplGetWinData()->maTopWindowChildren.begin()).get();
case WINDOW_LASTTOPWINDOWCHILD:
- return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : *ImplGetWinData()->maTopWindowChildren.rbegin();
+ return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : (*ImplGetWinData()->maTopWindowChildren.rbegin()).get();
case WINDOW_PREVTOPWINDOWSIBLING:
{
if ( !mpWindowImpl->mpRealParent )
return NULL;
- const ::std::list< vcl::Window* >& rTopWindows( mpWindowImpl->mpRealParent->ImplGetWinData()->maTopWindowChildren );
- ::std::list< vcl::Window* >::const_iterator myPos =
+ const ::std::list< VclPtr<vcl::Window> >& rTopWindows( mpWindowImpl->mpRealParent->ImplGetWinData()->maTopWindowChildren );
+ ::std::list< VclPtr<vcl::Window> >::const_iterator myPos =
::std::find( rTopWindows.begin(), rTopWindows.end(), this );
if ( myPos == rTopWindows.end() )
return NULL;
@@ -1127,8 +1132,8 @@ vcl::Window* Window::GetWindow( sal_uInt16 nType ) const
{
if ( !mpWindowImpl->mpRealParent )
return NULL;
- const ::std::list< vcl::Window* >& rTopWindows( mpWindowImpl->mpRealParent->ImplGetWinData()->maTopWindowChildren );
- ::std::list< vcl::Window* >::const_iterator myPos =
+ const ::std::list< VclPtr<vcl::Window> >& rTopWindows( mpWindowImpl->mpRealParent->ImplGetWinData()->maTopWindowChildren );
+ ::std::list< VclPtr<vcl::Window> >::const_iterator myPos =
::std::find( rTopWindows.begin(), rTopWindows.end(), this );
if ( ( myPos == rTopWindows.end() ) || ( ++myPos == rTopWindows.end() ) )
return NULL;
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index bca642e23612..7f43c18e2b1a 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -45,7 +45,7 @@ public:
ImplData();
~ImplData();
- VirtualDevice* mpVirDev;
+ VclPtr<VirtualDevice> mpVirDev;
long mnItemBorderWidth;
bool mbDrawItemFrames:1;
};
@@ -123,7 +123,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
// remember WinBits
mpItemList = new ImplStatusItemList;
- mpImplData->mpVirDev = new VirtualDevice( *this );
+ mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *this );
mnCurItemId = 0;
mbFormat = true;
mbVisibleItems = true;
@@ -151,6 +151,11 @@ StatusBar::StatusBar( vcl::Window* pParent, WinBits nStyle ) :
StatusBar::~StatusBar()
{
+ disposeOnce();
+}
+
+void StatusBar::dispose()
+{
// delete all items
for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
delete (*mpItemList)[ i ];
@@ -158,8 +163,9 @@ StatusBar::~StatusBar()
delete mpItemList;
// delete VirtualDevice
- delete mpImplData->mpVirDev;
+ mpImplData->mpVirDev.disposeAndClear();
delete mpImplData;
+ Window::dispose();
}
void StatusBar::AdjustItemWidthsForHiDPI(bool bAdjustHiDPI)
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index f82e274d3c12..618170994105 100644
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -133,12 +133,18 @@ SystemChildWindow::SystemChildWindow( vcl::Window* pParent, WinBits nStyle, Syst
SystemChildWindow::~SystemChildWindow()
{
+ disposeOnce();
+}
+
+void SystemChildWindow::dispose()
+{
Hide();
- if ( mpWindowImpl->mpSysObj )
+ if ( mpWindowImpl && mpWindowImpl->mpSysObj )
{
ImplGetSVData()->mpDefInst->DestroyObject( mpWindowImpl->mpSysObj );
mpWindowImpl->mpSysObj = NULL;
}
+ Window::dispose();
}
const SystemEnvData* SystemChildWindow::GetSystemData() const
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index c5d0522dc0e1..99ac9bcb4fa4 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -106,12 +106,21 @@ void SystemWindow::loadUI(vcl::Window* pParent, const OString& rID, const OUStri
SystemWindow::~SystemWindow()
{
+ disposeOnce();
+}
+
+void SystemWindow::dispose()
+{
maLayoutIdle.Stop();
delete mpImplData;
mpImplData = NULL;
+
// Hack to make sure code called from base ~Window does not interpret this
// as a SystemWindow (which it no longer is by then):
mpWindowImpl->mbSysWin = false;
+ disposeBuilder();
+ mpDialogParent.clear();
+ Window::dispose();
}
bool SystemWindow::Notify( NotifyEvent& rNEvt )
@@ -177,6 +186,8 @@ bool SystemWindow::PreNotify( NotifyEvent& rNEvt )
TaskPaneList* SystemWindow::GetTaskPaneList()
{
+ if( !mpImplData )
+ return NULL;
if( mpImplData->mpTaskPaneList )
return mpImplData->mpTaskPaneList ;
else
@@ -306,7 +317,7 @@ void SystemWindow::ShowTitleButton( sal_uInt16 nButton, bool bVisible )
{
mbDockBtn = bVisible;
if ( mpWindowImpl->mpBorderWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetDockButton( bVisible );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetDockButton( bVisible );
}
}
else if ( nButton == TITLE_BUTTON_HIDE )
@@ -315,13 +326,13 @@ void SystemWindow::ShowTitleButton( sal_uInt16 nButton, bool bVisible )
{
mbHideBtn = bVisible;
if ( mpWindowImpl->mpBorderWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetHideButton( bVisible );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetHideButton( bVisible );
}
}
else if ( nButton == TITLE_BUTTON_MENU )
{
if ( mpWindowImpl->mpBorderWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetMenuButton( bVisible );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuButton( bVisible );
}
else
return;
@@ -341,7 +352,7 @@ void SystemWindow::SetPin( bool bPin )
{
mbPinned = bPin;
if ( mpWindowImpl->mpBorderWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetPin( bPin );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetPin( bPin );
}
}
@@ -356,7 +367,7 @@ void SystemWindow::RollUp()
aSize.Width() = GetOutputSizePixel().Width();
mbRollUp = true;
if ( mpWindowImpl->mpBorderWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetRollUp( true, aSize );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetRollUp( true, aSize );
else
SetOutputSizePixel( aSize );
mbRollFunc = false;
@@ -369,7 +380,7 @@ void SystemWindow::RollDown()
{
mbRollUp = false;
if ( mpWindowImpl->mpBorderWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetRollUp( false, maOrgSize );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetRollUp( false, maOrgSize );
else
SetOutputSizePixel( maOrgSize );
}
@@ -380,7 +391,7 @@ void SystemWindow::SetMinOutputSizePixel( const Size& rSize )
maMinOutSize = rSize;
if ( mpWindowImpl->mpBorderWindow )
{
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetMinOutputSize( rSize.Width(), rSize.Height() );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMinOutputSize( rSize.Width(), rSize.Height() );
if ( mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame )
mpWindowImpl->mpBorderWindow->mpWindowImpl->mpFrame->SetMinClientSize( rSize.Width(), rSize.Height() );
}
@@ -399,7 +410,7 @@ void SystemWindow::SetMaxOutputSizePixel( const Size& rSize )
mpImplData->maMaxOutSize = aSize;
if ( mpWindowImpl->mpBorderWindow )
{
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetMaxOutputSize( aSize.Width(), aSize.Height() );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMaxOutputSize( aSize.Width(), aSize.Height() );
if ( mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame )
mpWindowImpl->mpBorderWindow->mpWindowImpl->mpFrame->SetMaxClientSize( aSize.Width(), aSize.Height() );
}
@@ -905,11 +916,11 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar, const css::uno::Reference<css::
if ( pMenuBar )
{
DBG_ASSERT( !pMenuBar->pWindow, "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" );
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetMenuBarWindow( pNewWindow = MenuBar::ImplCreate( mpWindowImpl->mpBorderWindow, pOldWindow, pMenuBar, rFrame));
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow( pNewWindow = MenuBar::ImplCreate( mpWindowImpl->mpBorderWindow, pOldWindow, pMenuBar, rFrame));
CallEventListeners( VCLEVENT_WINDOW_MENUBARADDED, (void*) pMenuBar );
}
else
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetMenuBarWindow( NULL );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow( NULL );
ImplToBottomChild();
if ( pOldMenuBar )
{
@@ -952,9 +963,9 @@ void SystemWindow::SetMenuBarMode( sal_uInt16 nMode )
if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) )
{
if ( nMode == MENUBAR_MODE_HIDE )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetMenuBarMode( true );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarMode( true );
else
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetMenuBarMode( false );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarMode( false );
}
}
}
diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx
index f15a2a03be49..e5c9061389e3 100644
--- a/vcl/source/window/tabdlg.cxx
+++ b/vcl/source/window/tabdlg.cxx
@@ -197,7 +197,7 @@ void TabDialog::ImplPosControls()
{
Size aDlgSize = GetOutputSizePixel();
if ( !mpFixedLine )
- mpFixedLine = new FixedLine( this );
+ mpFixedLine = VclPtr<FixedLine>::Create( this );
mpFixedLine->SetPosSizePixel( Point( 0, nOffY ),
Size( aDlgSize.Width(), 2 ) );
mpFixedLine->Show();
@@ -221,7 +221,14 @@ TabDialog::TabDialog( vcl::Window* pParent, const OUString& rID, const OUString&
TabDialog::~TabDialog()
{
- delete mpFixedLine;
+ disposeOnce();
+}
+
+void TabDialog::dispose()
+{
+ mpFixedLine.disposeAndClear();
+ mpViewWindow.clear();
+ Dialog::dispose();
}
void TabDialog::StateChanged( StateChangedType nType )
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index d55496412e2b..964f96043d78 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -85,6 +85,17 @@ TabPage::TabPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXM
set_expand(true);
}
+TabPage::~TabPage()
+{
+ disposeOnce();
+}
+
+void TabPage::dispose()
+{
+ disposeBuilder();
+ vcl::Window::dispose();
+}
+
void TabPage::StateChanged( StateChangedType nType )
{
Window::StateChanged( nType );
diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx
index 2089172df14d..af4f617205ae 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -95,11 +95,8 @@ void TaskPaneList::AddWindow( vcl::Window *pWindow )
{
if( pWindow )
{
- ::std::vector< vcl::Window* >::iterator insertionPos = mTaskPanes.end();
- for ( ::std::vector< vcl::Window* >::iterator p = mTaskPanes.begin();
- p != mTaskPanes.end();
- ++p
- )
+ auto insertionPos = mTaskPanes.end();
+ for ( auto p = mTaskPanes.begin(); p != mTaskPanes.end(); ++p )
{
if ( *p == pWindow )
// avoid duplicates
@@ -131,8 +128,7 @@ void TaskPaneList::AddWindow( vcl::Window *pWindow )
void TaskPaneList::RemoveWindow( vcl::Window *pWindow )
{
- ::std::vector< vcl::Window* >::iterator p;
- p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), pWindow );
+ auto p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), VclPtr<vcl::Window>(pWindow) );
if( p != mTaskPanes.end() )
{
mTaskPanes.erase( p );
@@ -142,8 +138,7 @@ void TaskPaneList::RemoveWindow( vcl::Window *pWindow )
bool TaskPaneList::IsInList( vcl::Window *pWindow )
{
- ::std::vector< vcl::Window* >::iterator p;
- p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), pWindow );
+ auto p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), VclPtr<vcl::Window>(pWindow) );
if( p != mTaskPanes.end() )
return true;
else
@@ -172,7 +167,7 @@ bool TaskPaneList::HandleKeyEvent(const KeyEvent& rKeyEvent)
bSplitterOnly = aKeyCode.IsMod1() && aKeyCode.IsShift();
// is the focus in the list ?
- ::std::vector< vcl::Window* >::iterator p = mTaskPanes.begin();
+ auto p = mTaskPanes.begin();
while( p != mTaskPanes.end() )
{
vcl::Window *pWin = *p;
@@ -245,7 +240,7 @@ vcl::Window* TaskPaneList::FindNextSplitter( vcl::Window *pWindow, bool bForward
else
::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSortBackward() );
- ::std::vector< vcl::Window* >::iterator p = mTaskPanes.begin();
+ auto p = mTaskPanes.begin();
while( p != mTaskPanes.end() )
{
if( !pWindow || *p == pWindow )
@@ -282,7 +277,7 @@ vcl::Window* TaskPaneList::FindNextFloat( vcl::Window *pWindow, bool bForward )
else
::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSortBackward() );
- ::std::vector< vcl::Window* >::iterator p = mTaskPanes.begin();
+ auto p = mTaskPanes.begin();
while( p != mTaskPanes.end() )
{
if( !pWindow || *p == pWindow )
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 5b627939ef76..2369a7d25da5 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -84,13 +84,13 @@
static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bEnabled, bool bIsWindow );
-typedef ::std::vector< ToolBox* > ImplTBList;
+typedef ::std::vector< VclPtr<ToolBox> > ImplTBList;
class ImplTBDragMgr
{
private:
ImplTBList* mpBoxList;
- ToolBox* mpDragBox;
+ VclPtr<ToolBox> mpDragBox;
Point maMouseOff;
Rectangle maRect;
Rectangle maStartRect;
@@ -1570,8 +1570,13 @@ ToolBox::ToolBox( vcl::Window* pParent, const ResId& rResId ) :
ToolBox::~ToolBox()
{
+ disposeOnce();
+}
+
+void ToolBox::dispose()
+{
// custom menu event still running?
- if( mpData->mnEventId )
+ if( mpData && mpData->mnEventId )
Application::RemoveUserEvent( mpData->mnEventId );
// #103005# make sure our activate/deactivate balance is right
@@ -1582,9 +1587,12 @@ ToolBox::~ToolBox()
// still connected
if ( mpFloatWin )
mpFloatWin->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
+ mpFloatWin = NULL;
// delete private data
- delete mpData;
+ if (mpData)
+ delete mpData;
+ mpData = NULL;
// remove the lists when there are no more toolbox references to
// the lists
@@ -1601,10 +1609,15 @@ ToolBox::~ToolBox()
pSVData->maCtrlData.mpTBDragMgr = NULL;
}
}
+ mpFloatWin.clear();
+ DockingWindow::dispose();
}
ImplToolItem* ToolBox::ImplGetItem( sal_uInt16 nItemId ) const
{
+ if (!mpData)
+ return NULL;
+
std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin();
while ( it != mpData->m_aItems.end() )
{
@@ -2630,7 +2643,7 @@ IMPL_LINK_NOARG(ToolBox, ImplDropdownLongClickHdl)
// do not reset data if the dropdown handler opened a floating window
// see ImplFloatControl()
- if( mpFloatWin == NULL )
+ if( !mpFloatWin )
{
// no floater was opened
Deactivate();
@@ -2651,7 +2664,7 @@ IMPL_LINK_NOARG(ToolBox, ImplDropdownLongClickHdl)
IMPL_LINK_NOARG(ToolBox, ImplUpdateHdl)
{
- if( mbFormat )
+ if( mbFormat && mpData )
ImplFormat();
return 0;
@@ -2952,7 +2965,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint,
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
// no gradient background for items that have a popup open
- bool bHasOpenPopup = (mpFloatWin != NULL) && (mnDownItemId==pItem->mnId);
+ bool bHasOpenPopup = mpFloatWin && (mnDownItemId==pItem->mnId);
bool bHighContrastWhite = false;
// check the face color as highcontrast indicator
@@ -3864,7 +3877,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt )
// do not reset data if the dropdown handler opened a floating window
// see ImplFloatControl()
- if( mpFloatWin == NULL )
+ if( !mpFloatWin )
{
// no floater was opened
Deactivate();
@@ -4823,7 +4836,7 @@ Size ToolBox::CalcMinimumWindowSizePixel() const
else
{
// create dummy toolbox for measurements
- ToolBox *pToolBox = new ToolBox( GetParent(), GetStyle() );
+ VclPtrInstance< ToolBox > pToolBox( GetParent(), GetStyle() );
// copy until first useful item
std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin();
@@ -4851,7 +4864,8 @@ Size ToolBox::CalcMinimumWindowSizePixel() const
ImplGetDockingManager()->RemoveWindow( pToolBox );
pToolBox->Clear();
- delete pToolBox;
+
+ pToolBox.disposeAndClear();
return aSize;
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 80b2bf920075..481122834fc5 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -165,6 +165,7 @@ ImplToolItem::ImplToolItem( const ImplToolItem& rItem ) :
ImplToolItem::~ImplToolItem()
{
+ // don't dispose mpWindow - we get copied around.
}
ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem )
@@ -866,7 +867,7 @@ void ToolBox::SetPageScroll( bool b )
sal_uInt16 ToolBox::GetItemCount() const
{
- return (sal_uInt16)mpData->m_aItems.size();
+ return mpData ? (sal_uInt16)mpData->m_aItems.size() : 0;
}
ToolBoxItemType ToolBox::GetItemType( sal_uInt16 nPos ) const
@@ -876,11 +877,13 @@ ToolBoxItemType ToolBox::GetItemType( sal_uInt16 nPos ) const
sal_uInt16 ToolBox::GetItemPos( sal_uInt16 nItemId ) const
{
- int nCount = mpData->m_aItems.size();
- for( int nPos = 0; nPos < nCount; nPos++ )
- if( mpData->m_aItems[nPos].mnId == nItemId )
- return (sal_uInt16)nPos;
-
+ if (mpData)
+ {
+ int nCount = mpData->m_aItems.size();
+ for( int nPos = 0; nPos < nCount; nPos++ )
+ if( mpData->m_aItems[nPos].mnId == nItemId )
+ return (sal_uInt16)nPos;
+ }
return TOOLBOX_ITEM_NOTFOUND;
}
@@ -934,6 +937,9 @@ sal_uInt16 ToolBox::GetItemId( const Point& rPos ) const
sal_uInt16 ToolBox::GetItemId(const OUString &rCommand) const
{
+ if (!mpData)
+ return TOOLBOX_ITEM_NOTFOUND;
+
for (std::vector<ImplToolItem>::const_iterator it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it)
{
if (it->maCommandStr == rCommand)
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 4a898eeac6b9..f991b98b6fe5 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -33,6 +33,7 @@
#include <vcl/syschild.hxx>
#include <vcl/dockwin.hxx>
#include <vcl/wall.hxx>
+#include <vcl/fixed.hxx>
#include <vcl/gradient.hxx>
#include <vcl/button.hxx>
#include <vcl/taskpanelist.hxx>
@@ -131,13 +132,18 @@ namespace
}
#endif
-Window::~Window()
+bool Window::IsDisposed() const
{
- vcl::LazyDeletor<vcl::Window>::Undelete( this );
-
- DBG_ASSERT( !mpWindowImpl->mbInDtor, "~Window - already in DTOR!" );
+ return !mpWindowImpl;
+}
- dispose();
+void Window::dispose()
+{
+ assert( mpWindowImpl );
+ assert( !mpWindowImpl->mbInDispose ); // should only be called from disposeOnce()
+ assert( !mpWindowImpl->mpParent ||
+ !mpWindowImpl->mpParent->IsDisposed() ||
+ "vcl::Window child should have its parent disposed first" );
// remove Key and Mouse events issued by Application::PostKey/MouseEvent
Application::RemoveMouseAndKeyEvents( this );
@@ -152,7 +158,7 @@ Window::~Window()
xCanvasComponent->dispose();
}
- mpWindowImpl->mbInDtor = true;
+ mpWindowImpl->mbInDispose = true;
CallEventListeners( VCLEVENT_OBJECT_DYING );
@@ -167,9 +173,8 @@ Window::~Window()
// remove ownerdraw decorated windows from list in the top-most frame window
if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame )
{
- ::std::vector< vcl::Window* >& rList = ImplGetOwnerDrawList();
- ::std::vector< vcl::Window* >::iterator p;
- p = ::std::find( rList.begin(), rList.end(), this );
+ ::std::vector< VclPtr<vcl::Window> >& rList = ImplGetOwnerDrawList();
+ auto p = ::std::find( rList.begin(), rList.end(), VclPtr<vcl::Window>(this) );
if( p != rList.end() )
rList.erase( p );
}
@@ -232,9 +237,9 @@ Window::~Window()
if ( pSVData->maHelpData.mpHelpWin && (pSVData->maHelpData.mpHelpWin->GetParent() == this) )
ImplDestroyHelpWindow( true );
- DBG_ASSERT( pSVData->maWinData.mpTrackWin != this,
+ DBG_ASSERT( pSVData->maWinData.mpTrackWin.get() != this,
"Window::~Window(): Window is in TrackingMode" );
- DBG_ASSERT( pSVData->maWinData.mpCaptureWin != this,
+ DBG_ASSERT( pSVData->maWinData.mpCaptureWin.get() != this,
"Window::~Window(): Window has the mouse captured" );
// due to old compatibility
@@ -251,6 +256,22 @@ Window::~Window()
OStringBuffer aErrorStr;
bool bError = false;
vcl::Window* pTempWin;
+
+ if ( mpWindowImpl->mpFirstChild )
+ {
+ OStringBuffer aTempStr("Window (");
+ aTempStr.append(lcl_createWindowInfo(*this));
+ aTempStr.append(") with live children destroyed: ");
+ pTempWin = mpWindowImpl->mpFirstChild;
+ while ( pTempWin )
+ {
+ aTempStr.append(lcl_createWindowInfo(*pTempWin));
+ pTempWin = pTempWin->mpWindowImpl->mpNext;
+ }
+ OSL_FAIL( aTempStr.getStr() );
+ Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
+ }
+
if (mpWindowImpl->mpFrameData != 0)
{
pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap;
@@ -267,8 +288,7 @@ Window::~Window()
{
OStringBuffer aTempStr;
aTempStr.append("Window (");
- aTempStr.append(OUStringToOString(GetText(),
- RTL_TEXTENCODING_UTF8));
+ aTempStr.append(lcl_createWindowInfo(*this));
aTempStr.append(") with live SystemWindows destroyed: ");
aTempStr.append(aErrorStr.toString());
OSL_FAIL(aTempStr.getStr());
@@ -292,32 +312,17 @@ Window::~Window()
if ( bError )
{
OStringBuffer aTempStr( "Window (" );
- aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+ aTempStr.append(lcl_createWindowInfo(*this));
aTempStr.append(") with live SystemWindows destroyed: ");
aTempStr.append(aErrorStr.toString());
OSL_FAIL( aTempStr.getStr() );
Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
}
- if ( mpWindowImpl->mpFirstChild )
- {
- OStringBuffer aTempStr("Window (");
- aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
- aTempStr.append(") with live children destroyed: ");
- pTempWin = mpWindowImpl->mpFirstChild;
- while ( pTempWin )
- {
- aTempStr.append(lcl_createWindowInfo(*pTempWin));
- pTempWin = pTempWin->mpWindowImpl->mpNext;
- }
- OSL_FAIL( aTempStr.getStr() );
- Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
- }
-
if ( mpWindowImpl->mpFirstOverlap )
{
OStringBuffer aTempStr("Window (");
- aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+ aTempStr.append(lcl_createWindowInfo(*this));
aTempStr.append(") with live SystemWindows destroyed: ");
pTempWin = mpWindowImpl->mpFirstOverlap;
while ( pTempWin )
@@ -343,7 +348,7 @@ Window::~Window()
if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
{
OStringBuffer aTempStr("Window (");
- aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+ aTempStr.append(lcl_createWindowInfo(*this));
aTempStr.append(") still in TaskPanelList!");
OSL_FAIL( aTempStr.getStr() );
Application::Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in debug builds, this must be fixed!
@@ -381,9 +386,8 @@ Window::~Window()
remove_from_all_size_groups();
// clear mnemonic labels
- std::vector<FixedText*> aMnemonicLabels(list_mnemonic_labels());
- for (std::vector<FixedText*>::iterator aI = aMnemonicLabels.begin();
- aI != aMnemonicLabels.end(); ++aI)
+ std::vector<VclPtr<FixedText> > aMnemonicLabels(list_mnemonic_labels());
+ for (auto aI = aMnemonicLabels.begin(); aI != aMnemonicLabels.end(); ++aI)
{
remove_mnemonic_label(*aI);
}
@@ -499,7 +503,7 @@ Window::~Window()
while ( pDelData )
{
pDelData->mbDel = true;
- pDelData->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore
+ pDelData->mpWindow.clear(); // #112873# pDel is not associated with a Window anymore
pDelData = pDelData->mpNext;
}
@@ -514,8 +518,8 @@ Window::~Window()
{
ImplWinData* pParentWinData = mpWindowImpl->mpRealParent->ImplGetWinData();
- ::std::list< vcl::Window* >::iterator myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(),
- pParentWinData->maTopWindowChildren.end(), this );
+ auto myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(),
+ pParentWinData->maTopWindowChildren.end(), VclPtr<vcl::Window>(this) );
DBG_ASSERT( myPos != pParentWinData->maTopWindowChildren.end(), "Window::~Window: inconsistency in top window chain!" );
if ( myPos != pParentWinData->maTopWindowChildren.end() )
pParentWinData->maTopWindowChildren.erase( myPos );
@@ -546,17 +550,18 @@ Window::~Window()
delete mpWindowImpl->mpOverlapData;
// remove BorderWindow or Frame window data
- if ( mpWindowImpl->mpBorderWindow )
- delete mpWindowImpl->mpBorderWindow;
- else if ( mpWindowImpl->mbFrame )
+ mpWindowImpl->mpBorderWindow.disposeAndClear();
+ if ( mpWindowImpl->mbFrame )
{
if ( pSVData->maWinData.mpFirstFrame == this )
pSVData->maWinData.mpFirstFrame = mpWindowImpl->mpFrameData->mpNextFrame;
else
{
vcl::Window* pSysWin = pSVData->maWinData.mpFirstFrame;
- while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame != this )
+ while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame.get() != this )
pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame;
+
+ assert (mpWindowImpl->mpFrameData->mpNextFrame.get() != pSysWin);
pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = mpWindowImpl->mpFrameData->mpNextFrame;
}
mpWindowImpl->mpFrame->SetCallback( NULL, NULL );
@@ -566,6 +571,31 @@ Window::~Window()
// should be the last statements
delete mpWindowImpl; mpWindowImpl = NULL;
+
+ OutputDevice::dispose();
+}
+
+Window::~Window()
+{
+ // FIXME: we should kill all LazyDeletor usage.
+ vcl::LazyDeletor<vcl::Window>::Undelete( this );
+ disposeOnce();
+}
+
+// We will eventually being removing the inheritance of OutputDevice
+// from Window. It will be replaced with a transient relationship such
+// that the OutputDevice is only live for the scope of the Paint method.
+// In the meantime this can help move us towards a Window use an
+// OutputDevice, not being one.
+
+::OutputDevice const* Window::GetOutDev() const
+{
+ return this;
+}
+
+::OutputDevice* Window::GetOutDev()
+{
+ return this;
}
} /* namespace vcl */
@@ -584,8 +614,8 @@ WindowImpl::WindowImpl( WindowType nType )
mpOverlapWindow = NULL; // first overlap parent
mpBorderWindow = NULL; // Border-Window
mpClientWindow = NULL; // Client-Window of a FrameWindow
- mpParent = NULL; // parent (inkl. BorderWindow)
- mpRealParent = NULL; // real parent (exkl. BorderWindow)
+ mpParent = NULL; // parent (incl. BorderWindow)
+ mpRealParent = NULL; // real parent (excl. BorderWindow)
mpFirstChild = NULL; // first child window
mpLastChild = NULL; // last child window
mpFirstOverlap = NULL; // first overlap window (only set in overlap windows)
@@ -704,7 +734,7 @@ WindowImpl::WindowImpl( WindowType nType )
mbCompoundControlHasFocus = false; // true: Composite Control has focus somewhere
mbPaintDisabled = false; // true: Paint should not be executed
mbAllResize = false; // true: Also sent ResizeEvents with 0,0
- mbInDtor = false; // true: We're still in Window-Dtor
+ mbInDispose = false; // true: We're still in Window::dispose()
mbExtTextInput = false; // true: ExtTextInput-Mode is active
mbInFocusHdl = false; // true: Within GetFocus-Handler
mbCreatedWithToolkit = false;
@@ -876,7 +906,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME;
nStyle |= WB_BORDER;
}
- ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
+ VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
((vcl::Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
mpWindowImpl->mpBorderWindow = pBorderWin;
@@ -989,6 +1019,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
mpWindowImpl->mpOverlapWindow = this;
// set frame data
+ assert (pSVData->maWinData.mpFirstFrame.get() != this);
mpWindowImpl->mpFrameData->mpNextFrame = pSVData->maWinData.mpFirstFrame;
pSVData->maWinData.mpFirstFrame = this;
mpWindowImpl->mpFrameData->mpFirstOverlap = NULL;
@@ -1181,13 +1212,6 @@ void Window::ImplInitAppFontData( vcl::Window* pWindow )
void Window::ImplInitWindowData( WindowType nType )
{
- // We will eventually being removing the inheritance of OutputDevice from Window.
- // It will be replaced with a composition relationship. A Window will use an OutputDevice,
- // it will not *be* an OutputDevice
- mpOutputDevice = (OutputDevice*)this;
-
- mnRefCnt = 0;
-
mpWindowImpl = new WindowImpl( nType );
meOutDevType = OUTDEV_WINDOW;
@@ -1352,6 +1376,12 @@ void Window::ImplSetReallyVisible()
void Window::ImplAddDel( ImplDelData* pDel ) // TODO: make "const" when incompatibility ok
{
+ if ( IsDisposed() )
+ {
+ pDel->mbDel = true;
+ return;
+ }
+
DBG_ASSERT( !pDel->mpWindow, "Window::ImplAddDel(): cannot add ImplDelData twice !" );
if( !pDel->mpWindow )
{
@@ -1364,6 +1394,10 @@ void Window::ImplAddDel( ImplDelData* pDel ) // TODO: make "const" when incompat
void Window::ImplRemoveDel( ImplDelData* pDel ) // TODO: make "const" when incompatibility ok
{
pDel->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore
+
+ if ( IsDisposed() )
+ return;
+
if ( mpWindowImpl->mpFirstDel == pDel )
mpWindowImpl->mpFirstDel = pDel->mpNext;
else
@@ -2074,7 +2108,7 @@ void Window::SetBorderStyle( WindowBorderStyle nBorderStyle )
// this is a little awkward: some controls (e.g. svtools ProgressBar)
// cannot avoid getting constructed with WB_BORDER but want to disable
// borders in case of NWF drawing. So they need a method to remove their border window
- vcl::Window* pBorderWin = mpWindowImpl->mpBorderWindow;
+ VclPtr<vcl::Window> pBorderWin = mpWindowImpl->mpBorderWindow;
// remove us as border window's client
pBorderWin->mpWindowImpl->mpClientWindow = NULL;
mpWindowImpl->mpBorderWindow = NULL;
@@ -2086,7 +2120,7 @@ void Window::SetBorderStyle( WindowBorderStyle nBorderStyle )
Size aBorderSize( pBorderWin->GetSizePixel() );
setPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() );
// release border window
- delete pBorderWin;
+ pBorderWin.disposeAndClear();
// set new style bits
SetStyle( GetStyle() & (~WB_BORDER) );
@@ -2094,7 +2128,7 @@ void Window::SetBorderStyle( WindowBorderStyle nBorderStyle )
else
{
if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->SetBorderStyle( nBorderStyle );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetBorderStyle( nBorderStyle );
else
mpWindowImpl->mpBorderWindow->SetBorderStyle( nBorderStyle );
}
@@ -2107,7 +2141,7 @@ WindowBorderStyle Window::GetBorderStyle() const
if ( mpWindowImpl->mpBorderWindow )
{
if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
- return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->GetBorderStyle();
+ return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->GetBorderStyle();
else
return mpWindowImpl->mpBorderWindow->GetBorderStyle();
}
@@ -2121,7 +2155,7 @@ long Window::CalcTitleWidth() const
if ( mpWindowImpl->mpBorderWindow )
{
if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
- return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->CalcTitleWidth();
+ return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->CalcTitleWidth();
else
return mpWindowImpl->mpBorderWindow->CalcTitleWidth();
}
@@ -2241,8 +2275,7 @@ vcl::Font Window::GetPointFont() const
void Window::Show( bool bVisible, sal_uInt16 nFlags )
{
-
- if ( mpWindowImpl->mbVisible == bVisible )
+ if ( IsDisposed() || mpWindowImpl->mbVisible == bVisible )
return;
ImplDelData aDogTag( this );
@@ -2482,7 +2515,7 @@ Size Window::GetSizePixel() const
// #i43257# trigger pending resize handler to assure correct window sizes
if( mpWindowImpl->mpFrameData->maResizeIdle.IsActive() )
{
- ImplDelData aDogtag( this );
+ ImplDelData aDogtag( const_cast<Window*>(this) );
mpWindowImpl->mpFrameData->maResizeIdle.Stop();
mpWindowImpl->mpFrameData->maResizeIdle.GetIdleHdl().Call( NULL );
if( aDogtag.IsDead() )
@@ -2504,6 +2537,8 @@ void Window::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
void Window::Enable( bool bEnable, bool bChild )
{
+ if ( IsDisposed() )
+ return;
if ( !bEnable )
{
@@ -2525,15 +2560,15 @@ void Window::Enable( bool bEnable, bool bChild )
{
mpWindowImpl->mpBorderWindow->Enable( bEnable, false );
if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->mpMenuBarWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->Enable( bEnable, true );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow )
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->Enable( bEnable, true );
}
// #i56102# restore app focus win in case the
// window was disabled when the frame focus changed
ImplSVData* pSVData = ImplGetSVData();
if( bEnable &&
- pSVData->maWinData.mpFocusWin == NULL &&
+ pSVData->maWinData.mpFocusWin == nullptr &&
mpWindowImpl->mpFrameData->mbHasFocus &&
mpWindowImpl->mpFrameData->mpFocusWin == this )
pSVData->maWinData.mpFocusWin = this;
@@ -2587,8 +2622,8 @@ void Window::EnableInput( bool bEnable, bool bChild )
{
mpWindowImpl->mpBorderWindow->EnableInput( bEnable, false );
if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->mpMenuBarWindow )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->EnableInput( bEnable, true );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow )
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->EnableInput( bEnable, true );
}
if ( (! bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled) ||
@@ -2616,7 +2651,7 @@ void Window::EnableInput( bool bEnable, bool bChild )
// window was disabled when the frame focus changed
ImplSVData* pSVData = ImplGetSVData();
if( bEnable &&
- pSVData->maWinData.mpFocusWin == NULL &&
+ pSVData->maWinData.mpFocusWin == nullptr &&
mpWindowImpl->mpFrameData->mbHasFocus &&
mpWindowImpl->mpFrameData->mpFocusWin == this )
pSVData->maWinData.mpFocusWin = this;
@@ -2688,8 +2723,8 @@ void Window::EnableInput( bool bEnable, bool bChild, bool bSysWin,
// the same for ownerdraw floating windows
if( mpWindowImpl->mbFrame )
{
- ::std::vector< vcl::Window* >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList;
- ::std::vector< vcl::Window* >::iterator p = rList.begin();
+ ::std::vector< VclPtr<vcl::Window> >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList;
+ auto p = rList.begin();
while( p != rList.end() )
{
// Is Window in the path from this window
@@ -3055,7 +3090,7 @@ Rectangle Window::ImplGetWindowExtentsRelative( vcl::Window *pRelativeWindow, bo
if( pRelativeWindow )
{
// #106399# express coordinates relative to borderwindow
- vcl::Window *pRelWin = (!bClientOnly && pRelativeWindow->mpWindowImpl->mpBorderWindow) ? pRelativeWindow->mpWindowImpl->mpBorderWindow : pRelativeWindow;
+ vcl::Window *pRelWin = (!bClientOnly && pRelativeWindow->mpWindowImpl->mpBorderWindow) ? pRelativeWindow->mpWindowImpl->mpBorderWindow.get() : pRelativeWindow;
aPos = pRelWin->AbsoluteScreenToOutputPixel( aPos );
}
return Rectangle( aPos, aSize );
@@ -3102,7 +3137,6 @@ void Window::SetUpdateMode( bool bUpdate )
void Window::GrabFocus()
{
-
ImplGrabFocus( 0 );
}
@@ -3608,7 +3642,7 @@ void Window::ImplIncModalCount()
{
pParent = pParent->GetParent();
}
- pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow : NULL;
+ pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow.get() : NULL;
}
}
void Window::ImplDecModalCount()
@@ -3622,7 +3656,7 @@ void Window::ImplDecModalCount()
{
pParent = pParent->GetParent();
}
- pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow : NULL;
+ pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow.get() : NULL;
}
}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 68129c08561b..c43563e7db74 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -375,7 +375,7 @@ void Window::StartTracking( sal_uInt16 nFlags )
{
ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->maWinData.mpTrackWin != this )
+ if ( pSVData->maWinData.mpTrackWin.get() != this )
{
if ( pSVData->maWinData.mpTrackWin )
pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
@@ -402,7 +402,7 @@ void Window::EndTracking( sal_uInt16 nFlags )
{
ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->maWinData.mpTrackWin == this )
+ if ( pSVData->maWinData.mpTrackWin.get() == this )
{
// due to DbgChkThis in brackets, as the window could be destroyed
// in the handler
@@ -449,7 +449,7 @@ void Window::StartAutoScroll( sal_uInt16 nFlags )
{
ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->maWinData.mpAutoScrollWin != this )
+ if ( pSVData->maWinData.mpAutoScrollWin.get() != this )
{
if ( pSVData->maWinData.mpAutoScrollWin )
pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
@@ -457,14 +457,14 @@ void Window::StartAutoScroll( sal_uInt16 nFlags )
pSVData->maWinData.mpAutoScrollWin = this;
pSVData->maWinData.mnAutoScrollFlags = nFlags;
- pSVData->maAppData.mpWheelWindow = new ImplWheelWindow( this );
+ pSVData->maAppData.mpWheelWindow = VclPtr<ImplWheelWindow>::Create( this );
}
void Window::EndAutoScroll()
{
ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->maWinData.mpAutoScrollWin == this )
+ if ( pSVData->maWinData.mpAutoScrollWin.get() == this )
{
pSVData->maWinData.mpAutoScrollWin = NULL;
pSVData->maWinData.mnAutoScrollFlags = 0;
@@ -938,7 +938,7 @@ void Window::EnableDocking( bool bEnable )
}
// retrieves the list of owner draw decorated windows for this window hiearchy
-::std::vector<vcl::Window *>& Window::ImplGetOwnerDrawList()
+::std::vector<VclPtr<vcl::Window> >& Window::ImplGetOwnerDrawList()
{
return ImplGetTopmostFrameWindow()->mpWindowImpl->mpFrameData->maOwnerDrawList;
}
@@ -975,27 +975,27 @@ vcl::Window* Window::ImplGetWindow()
ImplFrameData* Window::ImplGetFrameData()
{
- return mpWindowImpl->mpFrameData;
+ return mpWindowImpl ? mpWindowImpl->mpFrameData : NULL;
}
SalFrame* Window::ImplGetFrame() const
{
- return mpWindowImpl->mpFrame;
+ return mpWindowImpl ? mpWindowImpl->mpFrame : NULL;
}
vcl::Window* Window::ImplGetParent() const
{
- return mpWindowImpl->mpParent;
+ return mpWindowImpl ? mpWindowImpl->mpParent.get() : NULL;
}
vcl::Window* Window::ImplGetClientWindow() const
{
- return mpWindowImpl->mpClientWindow;
+ return mpWindowImpl ? mpWindowImpl->mpClientWindow.get() : NULL;
}
vcl::Window* Window::ImplGetBorderWindow() const
{
- return mpWindowImpl->mpBorderWindow;
+ return mpWindowImpl ? mpWindowImpl->mpBorderWindow.get() : NULL;
}
vcl::Window* Window::ImplGetFirstOverlapWindow()
@@ -1016,37 +1016,38 @@ const vcl::Window* Window::ImplGetFirstOverlapWindow() const
vcl::Window* Window::ImplGetFrameWindow() const
{
- return mpWindowImpl->mpFrameWindow;
+ return mpWindowImpl ? mpWindowImpl->mpFrameWindow.get() : NULL;
}
bool Window::IsDockingWindow() const
{
- return mpWindowImpl->mbDockWin;
+ return mpWindowImpl ? mpWindowImpl->mbDockWin : false;
}
bool Window::ImplIsFloatingWindow() const
{
- return mpWindowImpl->mbFloatWin;
+ return mpWindowImpl ? mpWindowImpl->mbFloatWin : false;
}
bool Window::ImplIsSplitter() const
{
- return mpWindowImpl->mbSplitter;
+ return mpWindowImpl ? mpWindowImpl->mbSplitter : false;
}
bool Window::ImplIsPushButton() const
{
- return mpWindowImpl->mbPushButton;
+ return mpWindowImpl ? mpWindowImpl->mbPushButton : false;
}
bool Window::ImplIsOverlapWindow() const
{
- return mpWindowImpl->mbOverlapWin;
+ return mpWindowImpl ? mpWindowImpl->mbOverlapWin : false;
}
void Window::ImplSetMouseTransparent( bool bTransparent )
{
- mpWindowImpl->mbMouseTransparent = bTransparent;
+ if (mpWindowImpl)
+ mpWindowImpl->mbMouseTransparent = bTransparent;
}
Point Window::ImplOutputToFrame( const Point& rPos )
@@ -1061,7 +1062,8 @@ Point Window::ImplFrameToOutput( const Point& rPos )
void Window::SetCompoundControl( bool bCompound )
{
- mpWindowImpl->mbCompoundControl = bCompound;
+ if (mpWindowImpl)
+ mpWindowImpl->mbCompoundControl = bCompound;
}
void Window::IncrementLockCount()
@@ -1076,27 +1078,31 @@ void Window::DecrementLockCount()
WinBits Window::GetStyle() const
{
- return mpWindowImpl->mnStyle;
+ return mpWindowImpl ? mpWindowImpl->mnStyle : 0;
}
WinBits Window::GetPrevStyle() const
{
- return mpWindowImpl->mnPrevStyle;
+ return mpWindowImpl ? mpWindowImpl->mnPrevStyle : 0;
}
WinBits Window::GetExtendedStyle() const
{
- return mpWindowImpl->mnExtendedStyle;
+ return mpWindowImpl ? mpWindowImpl->mnExtendedStyle : 0;
}
void Window::SetType( WindowType nType )
{
- mpWindowImpl->mnType = nType;
+ if (mpWindowImpl)
+ mpWindowImpl->mnType = nType;
}
WindowType Window::GetType() const
{
- return mpWindowImpl->mnType;
+ if (mpWindowImpl)
+ return mpWindowImpl->mnType;
+ else
+ return WINDOW_PARENT;
}
Dialog* Window::GetParentDialog() const
@@ -1116,22 +1122,22 @@ Dialog* Window::GetParentDialog() const
bool Window::IsSystemWindow() const
{
- return mpWindowImpl->mbSysWin;
+ return mpWindowImpl ? mpWindowImpl->mbSysWin : false;
}
bool Window::IsDialog() const
{
- return mpWindowImpl->mbDialog;
+ return mpWindowImpl ? mpWindowImpl->mbDialog : false;
}
bool Window::IsMenuFloatingWindow() const
{
- return mpWindowImpl->mbMenuFloatingWindow;
+ return mpWindowImpl ? mpWindowImpl->mbMenuFloatingWindow : false;
}
bool Window::IsToolbarFloatingWindow() const
{
- return mpWindowImpl->mbToolbarFloatingWindow;
+ return mpWindowImpl ? mpWindowImpl->mbToolbarFloatingWindow : false;
}
void Window::EnableAllResize( bool bEnable )
@@ -1146,17 +1152,17 @@ void Window::EnableChildTransparentMode( bool bEnable )
bool Window::IsChildTransparentModeEnabled() const
{
- return mpWindowImpl->mbChildTransparent;
+ return mpWindowImpl ? mpWindowImpl->mbChildTransparent : false;
}
bool Window::IsMouseTransparent() const
{
- return mpWindowImpl->mbMouseTransparent;
+ return mpWindowImpl ? mpWindowImpl->mbMouseTransparent : false;
}
bool Window::IsPaintTransparent() const
{
- return mpWindowImpl->mbPaintTransparent;
+ return mpWindowImpl ? mpWindowImpl->mbPaintTransparent : false;
}
void Window::SetDialogControlStart( bool bStart )
@@ -1166,7 +1172,7 @@ void Window::SetDialogControlStart( bool bStart )
bool Window::IsDialogControlStart() const
{
- return mpWindowImpl->mbDlgCtrlStart;
+ return mpWindowImpl ? mpWindowImpl->mbDlgCtrlStart : false;
}
void Window::SetDialogControlFlags( sal_uInt16 nFlags )
@@ -1211,27 +1217,27 @@ bool Window::IsControlBackground() const
bool Window::IsInPaint() const
{
- return mpWindowImpl->mbInPaint;
+ return mpWindowImpl ? mpWindowImpl->mbInPaint : false;
}
vcl::Window* Window::GetParent() const
{
- return mpWindowImpl->mpRealParent;
+ return mpWindowImpl ? mpWindowImpl->mpRealParent.get() : NULL;
}
bool Window::IsVisible() const
{
- return mpWindowImpl->mbVisible;
+ return mpWindowImpl ? mpWindowImpl->mbVisible : false;
}
bool Window::IsReallyVisible() const
{
- return mpWindowImpl->mbReallyVisible;
+ return mpWindowImpl ? mpWindowImpl->mbReallyVisible : false;
}
bool Window::IsReallyShown() const
{
- return mpWindowImpl->mbReallyShown;
+ return mpWindowImpl ? mpWindowImpl->mbReallyShown : false;
}
bool Window::IsInInitShow() const
@@ -1241,12 +1247,12 @@ bool Window::IsInInitShow() const
bool Window::IsEnabled() const
{
- return !mpWindowImpl->mbDisabled;
+ return mpWindowImpl ? !mpWindowImpl->mbDisabled : false;
}
bool Window::IsInputEnabled() const
{
- return !mpWindowImpl->mbInputDisabled;
+ return mpWindowImpl ? !mpWindowImpl->mbInputDisabled : false;
}
bool Window::IsAlwaysEnableInput() const
@@ -1317,6 +1323,8 @@ bool Window::IsWait() const
vcl::Cursor* Window::GetCursor() const
{
+ if (!mpWindowImpl)
+ return NULL;
return mpWindowImpl->mpCursor;
}
@@ -1338,7 +1346,8 @@ void Window::SetHelpText( const OUString& rHelpText )
void Window::SetQuickHelpText( const OUString& rHelpText )
{
- mpWindowImpl->maQuickHelpText = rHelpText;
+ if (mpWindowImpl)
+ mpWindowImpl->maQuickHelpText = rHelpText;
}
const OUString& Window::GetQuickHelpText() const
@@ -1364,8 +1373,8 @@ bool Window::IsCreatedWithToolkit() const
void Window::SetCreatedWithToolkit( bool b )
{
mpWindowImpl->mbCreatedWithToolkit = b;
-
}
+
const Pointer& Window::GetPointer() const
{
return mpWindowImpl->maPointer;
@@ -1373,7 +1382,7 @@ const Pointer& Window::GetPointer() const
VCLXWindow* Window::GetWindowPeer() const
{
- return mpWindowImpl->mpVCLXWindow;
+ return mpWindowImpl ? mpWindowImpl->mpVCLXWindow : NULL;
}
void Window::SetPosPixel( const Point& rNewPos )
@@ -1436,6 +1445,9 @@ void Window::InvalidateSizeCache()
void Window::queue_resize(StateChangedType eReason)
{
+ if (IsDisposed())
+ return;
+
bool bSomeoneCares = queue_ungrouped_resize(this);
if (eReason != StateChangedType::VISIBLE)
@@ -1446,9 +1458,8 @@ void Window::queue_resize(StateChangedType eReason)
WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
if (pWindowImpl->m_xSizeGroup && pWindowImpl->m_xSizeGroup->get_mode() != VCL_SIZE_GROUP_NONE)
{
- std::set<vcl::Window*> &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
- for (std::set<vcl::Window*>::iterator aI = rWindows.begin(),
- aEnd = rWindows.end(); aI != aEnd; ++aI)
+ std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
+ for (auto aI = rWindows.begin(), aEnd = rWindows.end(); aI != aEnd; ++aI)
{
vcl::Window *pOther = *aI;
if (pOther == this)
@@ -1743,9 +1754,8 @@ Size Window::get_preferred_size() const
if (eMode != VCL_SIZE_GROUP_NONE)
{
const bool bIgnoreInHidden = pWindowImpl->m_xSizeGroup->get_ignore_hidden();
- const std::set<vcl::Window*> &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
- for (std::set<vcl::Window*>::const_iterator aI = rWindows.begin(),
- aEnd = rWindows.end(); aI != aEnd; ++aI)
+ const std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
+ for (auto aI = rWindows.begin(), aEnd = rWindows.end(); aI != aEnd; ++aI)
{
const vcl::Window *pOther = *aI;
if (pOther == this)
@@ -2029,8 +2039,8 @@ void Window::remove_from_all_size_groups()
void Window::add_mnemonic_label(FixedText *pLabel)
{
- std::vector<FixedText*>& v = mpWindowImpl->m_aMnemonicLabels;
- if (std::find(v.begin(), v.end(), pLabel) != v.end())
+ std::vector<VclPtr<FixedText> >& v = mpWindowImpl->m_aMnemonicLabels;
+ if (std::find(v.begin(), v.end(), VclPtr<FixedText>(pLabel)) != v.end())
return;
v.push_back(pLabel);
pLabel->set_mnemonic_widget(this);
@@ -2038,15 +2048,15 @@ void Window::add_mnemonic_label(FixedText *pLabel)
void Window::remove_mnemonic_label(FixedText *pLabel)
{
- std::vector<FixedText*>& v = mpWindowImpl->m_aMnemonicLabels;
- std::vector<FixedText*>::iterator aFind = std::find(v.begin(), v.end(), pLabel);
+ std::vector<VclPtr<FixedText> >& v = mpWindowImpl->m_aMnemonicLabels;
+ auto aFind = std::find(v.begin(), v.end(), VclPtr<FixedText>(pLabel));
if (aFind == v.end())
return;
v.erase(aFind);
pLabel->set_mnemonic_widget(NULL);
}
-std::vector<FixedText*> Window::list_mnemonic_labels() const
+std::vector<VclPtr<FixedText> > Window::list_mnemonic_labels() const
{
return mpWindowImpl->m_aMnemonicLabels;
}
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 139d77149e1e..ce4edf81670b 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -243,7 +243,7 @@ static bool ImplCallCommand( vcl::Window* pChild, sal_uInt16 nEvt, void* pData =
struct ContextMenuEvent
{
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
ImplDelData aDelData;
Point aChildPos;
};
@@ -377,13 +377,13 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool
// no mouse messages to disabled windows
// #106845# if the window was disabed during capturing we have to pass the mouse events to release capturing
- if ( pSVData->maWinData.mpCaptureWin != pChild && (!pChild->IsEnabled() || !pChild->IsInputEnabled() || pChild->IsInModalNonRefMode() ) )
+ if ( pSVData->maWinData.mpCaptureWin.get() != pChild && (!pChild->IsEnabled() || !pChild->IsInputEnabled() || pChild->IsInModalNonRefMode() ) )
{
ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave );
if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
{
ImplHandleMouseHelpRequest( pChild, aMousePos );
- if( pWinFrameData->mpMouseMoveWin != pChild )
+ if( pWinFrameData->mpMouseMoveWin.get() != pChild )
nMode |= MouseEventModifiers::ENTERWINDOW;
}
@@ -1371,11 +1371,10 @@ class HandleGestureEventBase
{
protected:
ImplSVData* m_pSVData;
- vcl::Window *m_pWindow;
+ VclPtr<vcl::Window> m_pWindow;
Point m_aMousePos;
public:
-
HandleGestureEventBase(vcl::Window *pWindow, const Point &rMousePos)
: m_pSVData(ImplGetSVData())
, m_pWindow(pWindow)
@@ -1692,7 +1691,7 @@ void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight )
{
// #i42750# presentation wants to be informed about resize
// as early as possible
- WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pWindow->ImplGetWindowImpl()->mpClientWindow);
+ WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pWindow->ImplGetWindowImpl()->mpClientWindow.get());
if( ! pWorkWindow || pWorkWindow->IsPresentationMode() )
bStartTimer = false;
}
@@ -1938,7 +1937,7 @@ static void ImplHandleLoseFocus( vcl::Window* pWindow )
struct DelayedCloseEvent
{
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
ImplDelData aDelData;
};
@@ -1951,9 +1950,9 @@ static sal_IntPtr DelayedCloseEventLink( void* pCEvent, void* )
pEv->pWindow->ImplRemoveDel( &pEv->aDelData );
// dispatch to correct window type
if( pEv->pWindow->IsSystemWindow() )
- static_cast<SystemWindow*>(pEv->pWindow)->Close();
+ static_cast<SystemWindow*>(pEv->pWindow.get())->Close();
else if( pEv->pWindow->IsDockingWindow() )
- static_cast<DockingWindow*>(pEv->pWindow)->Close();
+ static_cast<DockingWindow*>(pEv->pWindow.get())->Close();
}
delete pEv;
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
index 1f75bd63a5ec..136adc859d84 100644
--- a/vcl/source/window/wrkwin.cxx
+++ b/vcl/source/window/wrkwin.cxx
@@ -49,7 +49,7 @@ void WorkWindow::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentDat
if ( nStyle & WB_APP )
nFrameStyle |= BORDERWINDOW_STYLE_APP;
- ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, pSystemParentData, nStyle, nFrameStyle );
+ VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, pSystemParentData, nStyle, nFrameStyle );
Window::ImplInit( pBorderWin, nStyle & (WB_3DLOOK | WB_CLIPCHILDREN | WB_DIALOGCONTROL | WB_SYSTEMFLOATWIN), NULL );
pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
@@ -113,12 +113,18 @@ WorkWindow::WorkWindow( SystemParentData* pParent ) :
WorkWindow::~WorkWindow()
{
+ disposeOnce();
+}
+
+void WorkWindow::dispose()
+{
ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->maWinData.mpAppWin == this )
{
pSVData->maWinData.mpAppWin = NULL;
Application::Quit();
}
+ SystemWindow::dispose();
}
void WorkWindow::ShowFullScreenMode( bool bFullScreenMode )
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index e957671c8ce3..5df56b0d9362 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -52,7 +52,6 @@ class StatusWindow : public WorkWindow
protected:
StatusWindow( WinBits nWinBits );
public:
- virtual ~StatusWindow();
virtual void setPosition( SalFrame* );
virtual void setText( const OUString & ) = 0;
@@ -67,8 +66,6 @@ StatusWindow::StatusWindow( WinBits nWinBits ) :
{
}
-StatusWindow::~StatusWindow() {}
-
void StatusWindow::setPosition( SalFrame* )
{
}
@@ -77,7 +74,7 @@ namespace vcl {
class XIMStatusWindow : public StatusWindow
{
- FixedText m_aStatusText;
+ VclPtr<FixedText> m_aStatusText;
SalFrame* m_pLastParent;
Size m_aWindowSize;
bool m_bAnchoredAtRight;
@@ -104,6 +101,7 @@ public:
virtual void setText( const OUString & ) SAL_OVERRIDE;
virtual void show( bool bShow, I18NStatus::ShowReason eReason ) SAL_OVERRIDE;
virtual void toggle( bool bOn ) SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
// override WorkWindow::DataChanged
virtual void DataChanged( const DataChangedEvent& rEvt ) SAL_OVERRIDE;
@@ -113,7 +111,7 @@ public:
XIMStatusWindow::XIMStatusWindow( bool bOn ) :
StatusWindow( WB_BORDER | WB_SYSTEMFLOATWIN | WB_TOOLTIPWIN ),
- m_aStatusText( this, 0 ),
+ m_aStatusText(VclPtr<FixedText>::Create(this, 0)),
m_pLastParent( NULL ),
m_bAnchoredAtRight( false ),
m_bDelayedShow( false ),
@@ -126,8 +124,15 @@ XIMStatusWindow::XIMStatusWindow( bool bOn ) :
XIMStatusWindow::~XIMStatusWindow()
{
+ disposeOnce();
+}
+
+void XIMStatusWindow::dispose()
+{
if( m_nDelayedEvent )
Application::RemoveUserEvent( m_nDelayedEvent );
+ m_aStatusText.disposeAndClear();
+ StatusWindow::dispose();
}
void XIMStatusWindow::toggle( bool bOn )
@@ -138,8 +143,8 @@ void XIMStatusWindow::toggle( bool bOn )
void XIMStatusWindow::layout()
{
- m_aWindowSize.Width() = m_aStatusText.GetTextWidth( m_aStatusText.GetText() )+8;
- Font aFont( m_aStatusText.GetFont() );
+ m_aWindowSize.Width() = m_aStatusText->GetTextWidth( m_aStatusText->GetText() )+8;
+ Font aFont( m_aStatusText->GetFont() );
m_aWindowSize.Height() = aFont.GetHeight()+10;
m_aWindowSize = LogicToPixel( m_aWindowSize );
@@ -147,9 +152,9 @@ void XIMStatusWindow::layout()
aControlSize.Width() -= 4;
aControlSize.Height() -= 4;
- m_aStatusText.SetPosSizePixel( Point( 1, 1 ), aControlSize );
- m_aStatusText.SetFont( aFont );
- m_aStatusText.Show( true );
+ m_aStatusText->SetPosSizePixel( Point( 1, 1 ), aControlSize );
+ m_aStatusText->SetFont( aFont );
+ m_aStatusText->Show( true );
if (m_bAnchoredAtRight && IsVisible())
{
@@ -181,7 +186,7 @@ bool XIMStatusWindow::checkLastParent() const
void XIMStatusWindow::DataChanged( const DataChangedEvent& )
{
- m_aStatusText.SetSettings( GetSettings() );
+ m_aStatusText->SetSettings( GetSettings() );
layout();
}
@@ -261,7 +266,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl)
if( m_bDelayedShow )
{
Size aControlSize( m_aWindowSize.Width()-4, m_aWindowSize.Height()-4 );
- m_aStatusText.SetPosSizePixel( Point( 1, 1 ), aControlSize );
+ m_aStatusText->SetPosSizePixel( Point( 1, 1 ), aControlSize );
Point aPoint = updatePosition();
pStatusFrame->SetPosSize( aPoint.X(), aPoint.Y(), m_aWindowSize.Width(), m_aWindowSize.Height(), SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
}
@@ -276,7 +281,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl)
void XIMStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason )
{
- if( bShow && m_aStatusText.GetText().isEmpty() )
+ if( bShow && m_aStatusText->GetText().isEmpty() )
bShow = false;
m_bDelayedShow = bShow;
@@ -287,15 +292,15 @@ void XIMStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason )
void XIMStatusWindow::setText( const OUString& rText )
{
- m_aStatusText.SetText( rText );
- m_aWindowSize.Width() = m_aStatusText.GetTextWidth( rText )+8;
+ m_aStatusText->SetText( rText );
+ m_aWindowSize.Width() = m_aStatusText->GetTextWidth( rText )+8;
}
namespace vcl {
class IIIMPStatusWindow : public StatusWindow
{
- MenuButton m_aStatusBtn;
+ VclPtr<MenuButton> m_aStatusBtn;
PopupMenu m_aMenu;
SalFrame* m_pResetFocus;
bool m_bShow;
@@ -307,11 +312,12 @@ class IIIMPStatusWindow : public StatusWindow
public:
IIIMPStatusWindow( SalFrame* pParent, bool bOn ); // for initial position
- virtual ~IIIMPStatusWindow();
virtual void setText( const OUString & ) SAL_OVERRIDE;
virtual void show( bool bShow, I18NStatus::ShowReason eReason ) SAL_OVERRIDE;
virtual void toggle( bool bOn ) SAL_OVERRIDE;
+ virtual ~IIIMPStatusWindow() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
void layout();
// override Window focus handler
@@ -324,7 +330,7 @@ public:
IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
StatusWindow( WB_MOVEABLE ),
- m_aStatusBtn( this, WB_BORDER ),
+ m_aStatusBtn(VclPtr<MenuButton>::Create(this, WB_BORDER)),
m_pResetFocus( pParent ),
m_bShow( true ),
m_bOn( bOn )
@@ -333,9 +339,9 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
layout();
- m_aStatusBtn.SetSelectHdl( LINK( this, IIIMPStatusWindow, SelectHdl ) );
- m_aStatusBtn.SetPopupMenu( &m_aMenu );
- m_aStatusBtn.Show( true );
+ m_aStatusBtn->SetSelectHdl( LINK( this, IIIMPStatusWindow, SelectHdl ) );
+ m_aStatusBtn->SetPopupMenu( &m_aMenu );
+ m_aStatusBtn->Show( true );
const ::std::vector< I18NStatus::ChoiceData >& rChoices( I18NStatus::get().getChoices() );
int i = 1;
@@ -363,17 +369,13 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
EnableAlwaysOnTop( true );
}
-IIIMPStatusWindow::~IIIMPStatusWindow()
-{
-}
-
void IIIMPStatusWindow::layout()
{
- Font aFont( m_aStatusBtn.GetFont() );
+ Font aFont( m_aStatusBtn->GetFont() );
Size aSize( 15*aFont.GetHeight(), aFont.GetHeight()+14 );
- aSize = m_aStatusBtn.LogicToPixel( aSize );
+ aSize = m_aStatusBtn->LogicToPixel( aSize );
- m_aStatusBtn.SetPosSizePixel( Point( 0, 0 ), aSize );
+ m_aStatusBtn->SetPosSizePixel( Point( 0, 0 ), aSize );
SetOutputSizePixel( aSize );
if( IsVisible() )
Invalidate();
@@ -381,13 +383,13 @@ void IIIMPStatusWindow::layout()
void IIIMPStatusWindow::DataChanged( const DataChangedEvent& )
{
- m_aStatusBtn.SetSettings( GetSettings() );
+ m_aStatusBtn->SetSettings( GetSettings() );
layout();
}
void IIIMPStatusWindow::setText( const OUString& rText )
{
- m_aStatusBtn.SetText( rText );
+ m_aStatusBtn->SetText( rText );
}
void IIIMPStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason )
@@ -411,6 +413,12 @@ void IIIMPStatusWindow::toggle( bool bOn )
}
}
+void IIIMPStatusWindow::dispose()
+{
+ m_aStatusBtn.disposeAndClear();
+ StatusWindow::dispose();
+}
+
void IIIMPStatusWindow::show()
{
if (m_bOn && m_bShow && !IsVisible())
@@ -454,10 +462,10 @@ void IIIMPStatusWindow::GetFocus()
IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn )
{
- if( pBtn == & m_aStatusBtn )
+ if( pBtn == m_aStatusBtn )
{
const ::std::vector< I18NStatus::ChoiceData >& rChoices( I18NStatus::get().getChoices() );
- unsigned int nIndex = m_aStatusBtn.GetCurItemId()-1;
+ unsigned int nIndex = m_aStatusBtn->GetCurItemId()-1;
if( nIndex < rChoices.size() )
{
XSetICValues( static_cast<X11SalFrame*>(I18NStatus::get().getParent())->getInputContext()->GetContext(),
@@ -515,8 +523,7 @@ I18NStatus::I18NStatus() :
I18NStatus::~I18NStatus()
{
- if( m_pStatusWindow )
- delete m_pStatusWindow, m_pStatusWindow = NULL;
+ m_pStatusWindow.disposeAndClear();
if( pInstance == this )
pInstance = NULL;
}
@@ -528,10 +535,10 @@ void I18NStatus::setParent( SalFrame* pParent )
{
bool bIIIMPmode = m_aChoices.begin() != m_aChoices.end();
if( bIIIMPmode )
- m_pStatusWindow = new IIIMPStatusWindow( pParent,
+ m_pStatusWindow = VclPtr<IIIMPStatusWindow>::Create( pParent,
getStatusWindowMode() );
else
- m_pStatusWindow = new XIMStatusWindow( getStatusWindowMode() );
+ m_pStatusWindow = VclPtr<XIMStatusWindow>::Create( getStatusWindowMode() );
setStatusText( m_aCurrentIM );
}
m_pStatusWindow->setPosition( m_pParent );
@@ -599,7 +606,7 @@ SalFrame* I18NStatus::getStatusFrame() const
void I18NStatus::toggleStatusWindow()
{
- if (m_pStatusWindow != 0)
+ if (m_pStatusWindow != nullptr)
m_pStatusWindow->toggle(getStatusWindowMode());
}
diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
index bf58b95bf4bb..0bc8004c58b8 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
@@ -257,7 +257,7 @@ namespace cairo
&cairo_surface_destroy )));
}
- boost::shared_ptr<VirtualDevice> X11Surface::createVirtualDevice() const
+ VclPtr<VirtualDevice> X11Surface::createVirtualDevice() const
{
SystemGraphicsData aSystemGraphicsData;
@@ -268,8 +268,8 @@ namespace cairo
int width = cairo_xlib_surface_get_width(mpSurface.get());
int height = cairo_xlib_surface_get_height(mpSurface.get());
- return boost::shared_ptr<VirtualDevice>(
- new VirtualDevice(&aSystemGraphicsData,
+ return VclPtr<VirtualDevice>(
+ VclPtr<VirtualDevice>::Create(&aSystemGraphicsData,
Size(width, height),
std::max(getDepth(), 0)));
}
diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
index 166ebaf0a882..5be944f87e42 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
@@ -87,7 +87,7 @@ namespace cairo {
virtual CairoSurfaceSharedPtr getCairoSurface() const SAL_OVERRIDE { return mpSurface; }
virtual SurfaceSharedPtr getSimilar(int cairo_content_type, int width, int height) const SAL_OVERRIDE;
- virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
+ virtual VclPtr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
virtual bool Resize( int width, int height ) SAL_OVERRIDE;
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 4611f377ac48..d51f752463df 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -913,13 +913,14 @@ namespace
{
class RTSPWDialog : public ModalDialog
{
- FixedText* m_pText;
- Edit* m_pUserEdit;
- Edit* m_pPassEdit;
+ VclPtr<FixedText> m_pText;
+ VclPtr<Edit> m_pUserEdit;
+ VclPtr<Edit> m_pPassEdit;
public:
RTSPWDialog(const OString& rServer, const OString& rUserName, vcl::Window* pParent);
-
+ virtual ~RTSPWDialog();
+ virtual void dispose() SAL_OVERRIDE;
OString getUserName() const;
OString getPassword() const;
};
@@ -938,6 +939,19 @@ namespace
m_pUserEdit->SetText( OStringToOUString(rUserName, osl_getThreadTextEncoding()));
}
+ RTSPWDialog::~RTSPWDialog()
+ {
+ disposeOnce();
+ }
+
+ void RTSPWDialog::dispose()
+ {
+ m_pText.clear();
+ m_pUserEdit.clear();
+ m_pPassEdit.clear();
+ ModalDialog::dispose();
+ }
+
OString RTSPWDialog::getUserName() const
{
return OUStringToOString( m_pUserEdit->GetText(), osl_getThreadTextEncoding() );
@@ -952,11 +966,11 @@ namespace
{
bool bRet = false;
- RTSPWDialog aDialog(rServer, rUserName, NULL);
- if (aDialog.Execute())
+ ScopedVclPtrInstance<RTSPWDialog> aDialog(rServer, rUserName, nullptr);
+ if (aDialog->Execute())
{
- rUserName = aDialog.getUserName();
- rPassword = aDialog.getPassword();
+ rUserName = aDialog->getUserName();
+ rPassword = aDialog->getPassword();
bRet = true;
}
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index c7a1221cd340..d95f700809c8 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -497,7 +497,7 @@ static void handle_toolbox_buttonchange(VclWindowEvent const *pEvent)
/*****************************************************************************/
-static std::set< vcl::Window * > g_aWindowList;
+static std::set< VclPtr<vcl::Window> > g_aWindowList;
static void handle_get_focus(::VclWindowEvent const * pEvent)
{
diff --git a/vcl/unx/gtk3/gdi/cairo_gtk3_cairo.cxx b/vcl/unx/gtk3/gdi/cairo_gtk3_cairo.cxx
index 6917596f473d..b9a2751fc4aa 100644
--- a/vcl/unx/gtk3/gdi/cairo_gtk3_cairo.cxx
+++ b/vcl/unx/gtk3/gdi/cairo_gtk3_cairo.cxx
@@ -107,9 +107,9 @@ namespace cairo
mpGraphics->WidgetQueueDraw();
}
- boost::shared_ptr<VirtualDevice> Gtk3Surface::createVirtualDevice() const
+ VclPtr<VirtualDevice> Gtk3Surface::createVirtualDevice() const
{
- return boost::shared_ptr<VirtualDevice>(new VirtualDevice(NULL, Size(1, 1), 0));
+ return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), 0);
}
}
diff --git a/vcl/unx/gtk3/gdi/cairo_gtk3_cairo.hxx b/vcl/unx/gtk3/gdi/cairo_gtk3_cairo.hxx
index dee313f526ee..5bb12eaf2eca 100644
--- a/vcl/unx/gtk3/gdi/cairo_gtk3_cairo.hxx
+++ b/vcl/unx/gtk3/gdi/cairo_gtk3_cairo.hxx
@@ -37,7 +37,7 @@ namespace cairo {
virtual CairoSurfaceSharedPtr getCairoSurface() const SAL_OVERRIDE { return mpSurface; }
virtual SurfaceSharedPtr getSimilar(int nContentType, int width, int height) const SAL_OVERRIDE;
- virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
+ virtual VclPtr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
virtual void flush() const SAL_OVERRIDE;
diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx
index 5882fdb0589d..6723c63b8047 100644
--- a/vcl/unx/x11/x11sys.cxx
+++ b/vcl/unx/x11/x11sys.cxx
@@ -134,19 +134,19 @@ int X11SalSystem::ShowNativeDialog( const OUString& rTitle, const OUString& rMes
if( pSVData->mpIntroWindow )
pSVData->mpIntroWindow->Hide();
- WarningBox aWarn( NULL, WB_STDWORK, rMessage );
- aWarn.SetText( rTitle );
- aWarn.Clear();
+ ScopedVclPtrInstance<WarningBox> aWarn(nullptr, WB_STDWORK, rMessage);
+ aWarn->SetText( rTitle );
+ aWarn->Clear();
sal_uInt16 nButton = 0;
for( std::list< OUString >::const_iterator it = rButtons.begin(); it != rButtons.end(); ++it )
{
- aWarn.AddButton( *it, nButton+1, nButton == (sal_uInt16)nDefButton ? BUTTONDIALOG_DEFBUTTON : 0 );
+ aWarn->AddButton( *it, nButton+1, nButton == (sal_uInt16)nDefButton ? BUTTONDIALOG_DEFBUTTON : 0 );
nButton++;
}
- aWarn.SetFocusButton( (sal_uInt16)nDefButton+1 );
+ aWarn->SetFocusButton( (sal_uInt16)nDefButton+1 );
- nRet = ((int)aWarn.Execute()) - 1;
+ nRet = ((int)aWarn->Execute()) - 1;
// normalize behaviour, actually this should never happen
if( nRet < -1 || nRet >= int(rButtons.size()) )
diff --git a/vcl/win/source/gdi/cairo_win32_cairo.cxx b/vcl/win/source/gdi/cairo_win32_cairo.cxx
index 9cf81c7002de..65dd478bd1dc 100644
--- a/vcl/win/source/gdi/cairo_win32_cairo.cxx
+++ b/vcl/win/source/gdi/cairo_win32_cairo.cxx
@@ -170,14 +170,12 @@ namespace cairo
*
* @return The new virtual device
**/
- boost::shared_ptr<VirtualDevice> Win32Surface::createVirtualDevice() const
+ VclPtr<VirtualDevice> Win32Surface::createVirtualDevice() const
{
SystemGraphicsData aSystemGraphicsData;
- aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
+ aSystemGraphicsData.nSize = sizeof( SystemGraphicsData );
aSystemGraphicsData.hDC = cairo_win32_surface_get_dc( mpSurface.get() );
-
- return boost::shared_ptr<VirtualDevice>(
- new VirtualDevice( &aSystemGraphicsData, Size(1, 1), sal::static_int_cast<USHORT>(getDepth()) ));
+ return VclPtr<VirtualDevice>::Create( &aSystemGraphicsData, Size(1, 1), sal::static_int_cast<USHORT>( getDepth() ) );
}
} // namespace cairo
diff --git a/vcl/win/source/gdi/cairo_win32_cairo.hxx b/vcl/win/source/gdi/cairo_win32_cairo.hxx
index dd1be37db7dd..5dee0eaa3dd8 100644
--- a/vcl/win/source/gdi/cairo_win32_cairo.hxx
+++ b/vcl/win/source/gdi/cairo_win32_cairo.hxx
@@ -43,7 +43,7 @@ namespace cairo {
virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
virtual SurfaceSharedPtr getSimilar( int aContent, int width, int height ) const;
- virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const;
+ virtual VclPtr<VirtualDevice> createVirtualDevice() const;
virtual void flush() const;
diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
index 3710a16ce152..cef8ac6755c8 100644
--- a/vcl/workben/icontest.cxx
+++ b/vcl/workben/icontest.cxx
@@ -71,10 +71,11 @@ protected:
public:
Graphic maGraphic;
Bitmap *mpBitmap;
- FixedBitmap *mpFixedBitmap;
+ VclPtr<FixedBitmap> mpFixedBitmap;
MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle );
-
+ virtual ~MyWorkWindow() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE { mpFixedBitmap.clear(); WorkWindow::dispose(); }
void LoadGraphic( const OUString& sImageFile );
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
@@ -185,12 +186,12 @@ void IconTestApp::DoItWithVcl( const OUString& sImageFile)
{
try
{
- MyWorkWindow *pWindow = new MyWorkWindow( NULL, WB_APP | WB_STDWORK | WB_SIZEABLE | WB_CLOSEABLE | WB_CLIPCHILDREN );
+ VclPtrInstance<MyWorkWindow> pWindow( nullptr, WB_APP | WB_STDWORK | WB_SIZEABLE | WB_CLOSEABLE | WB_CLIPCHILDREN );
pWindow->SetText(OUString("VCL Image Test"));
pWindow->LoadGraphic( sImageFile );
- pWindow->mpFixedBitmap = new FixedBitmap( pWindow );
+ pWindow->mpFixedBitmap = VclPtr<FixedBitmap>::Create( pWindow );
pWindow->mpFixedBitmap->SetPosPixel( Point( 0, 0 ) );
pWindow->mpFixedBitmap->Show();
diff --git a/vcl/workben/mtfdemo.cxx b/vcl/workben/mtfdemo.cxx
index 4f65b0ff12ce..05ab64430972 100644
--- a/vcl/workben/mtfdemo.cxx
+++ b/vcl/workben/mtfdemo.cxx
@@ -67,7 +67,7 @@ void DemoMtfWin::Paint( const Rectangle& rRect )
class DemoMtfApp : public Application
{
- DemoMtfWin *mpWin;
+ VclPtr<DemoMtfWin> mpWin;
OUString maFileName;
void showHelp()
@@ -88,7 +88,7 @@ public:
{
try
{
- mpWin = new DemoMtfWin(maFileName);
+ mpWin = VclPtr<DemoMtfWin>::Create(maFileName);
mpWin->SetText(OUString("Display metafile"));
mpWin->Show();
diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx
index 528eae381abb..da14e1aac673 100644
--- a/vcl/workben/outdevgrind.cxx
+++ b/vcl/workben/outdevgrind.cxx
@@ -72,7 +72,6 @@ class TestWindow : public Dialog
Show();
}
- virtual ~TestWindow() {}
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
};
@@ -899,8 +898,8 @@ sal_uInt16 GrindApp::Exception( sal_uInt16 nError )
int GrindApp::Main()
{
- TestWindow aWindow;
- aWindow.Execute();
+ ScopedVclPtrInstance<TestWindow> aWindow;
+ aWindow->Execute();
return 0;
}
diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx
index a06bf5cc13d7..e349934a5af1 100644
--- a/vcl/workben/svdem.cxx
+++ b/vcl/workben/svdem.cxx
@@ -81,9 +81,9 @@ public:
void Main()
{
- MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
- aMainWin.SetText(OUString("VCL - Workbench"));
- aMainWin.Show();
+ ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK );
+ aMainWin->SetText(OUString("VCL - Workbench"));
+ aMainWin->Show();
Application::Execute();
}
diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx
index 2ed9ac302368..01ad3e9d5f08 100644
--- a/vcl/workben/svpclient.cxx
+++ b/vcl/workben/svpclient.cxx
@@ -92,10 +92,10 @@ SAL_IMPLEMENT_MAIN()
class MyWin : public WorkWindow
{
- PushButton m_aListButton;
- ListBox m_aSvpBitmaps;
- ImageControl m_aImage;
- PushButton m_aQuitButton;
+ VclPtr<PushButton> m_aListButton;
+ VclPtr<ListBox> m_aSvpBitmaps;
+ VclPtr<ImageControl> m_aImage;
+ VclPtr<PushButton> m_aQuitButton;
public:
MyWin( vcl::Window* pParent, WinBits nWinStyle );
@@ -108,6 +108,8 @@ public:
virtual void Resize() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
+ virtual ~MyWin() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE;
void parseList( const OString& rList );
OString processCommand( const OString& rCommand );
@@ -119,37 +121,37 @@ public:
void Main()
{
- MyWin aMainWin( NULL, WB_STDWORK );
- aMainWin.SetText( OUString( "SvpClient" ) );
- aMainWin.Show();
+ ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_STDWORK );
+ aMainWin->SetText( OUString( "SvpClient" ) );
+ aMainWin->Show();
Application::Execute();
}
MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
WorkWindow( pParent, nWinStyle ),
- m_aListButton( this, 0 ),
- m_aSvpBitmaps( this, WB_BORDER ),
- m_aImage( this, WB_BORDER ),
- m_aQuitButton( this, 0 )
+ m_aListButton(VclPtr<PushButton>::Create(this, 0)),
+ m_aSvpBitmaps(VclPtr<ListBox>::Create(this, WB_BORDER)),
+ m_aImage(VclPtr<ImageControl>::Create(this, WB_BORDER)),
+ m_aQuitButton(VclPtr<PushButton>::Create(this, 0))
{
- m_aListButton.SetPosSizePixel( Point( 10, 10 ), Size( 120, 25 ) );
- m_aListButton.SetText( OUString( "List Elements" ) );
- m_aListButton.SetClickHdl( LINK( this, MyWin, ListHdl ) );
- m_aListButton.Show();
-
- m_aSvpBitmaps.SetPosSizePixel( Point( 10, 40 ), Size( 150, 150 ) );
- m_aSvpBitmaps.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
- m_aSvpBitmaps.Show();
-
- m_aImage.SetPosSizePixel( Point( 170, 10 ), Size( 400, 400 ) );
- m_aImage.SetScaleMode( com::sun::star::awt::ImageScaleMode::NONE );
- m_aImage.Show();
-
- m_aQuitButton.SetPosSizePixel( Point( 10, 300 ), Size( 120,25 ) );
- m_aQuitButton.SetText( OUString( "Quit SVP server" ) );
- m_aQuitButton.SetClickHdl( LINK( this, MyWin, QuitHdl ) );
- m_aQuitButton.Show();
+ m_aListButton->SetPosSizePixel( Point( 10, 10 ), Size( 120, 25 ) );
+ m_aListButton->SetText( OUString( "List Elements" ) );
+ m_aListButton->SetClickHdl( LINK( this, MyWin, ListHdl ) );
+ m_aListButton->Show();
+
+ m_aSvpBitmaps->SetPosSizePixel( Point( 10, 40 ), Size( 150, 150 ) );
+ m_aSvpBitmaps->SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
+ m_aSvpBitmaps->Show();
+
+ m_aImage->SetPosSizePixel( Point( 170, 10 ), Size( 400, 400 ) );
+ m_aImage->SetScaleMode( com::sun::star::awt::ImageScaleMode::NONE );
+ m_aImage->Show();
+
+ m_aQuitButton->SetPosSizePixel( Point( 10, 300 ), Size( 120,25 ) );
+ m_aQuitButton->SetText( OUString( "Quit SVP server" ) );
+ m_aQuitButton->SetClickHdl( LINK( this, MyWin, QuitHdl ) );
+ m_aQuitButton->Show();
}
bool MyWin::Close()
@@ -160,11 +162,20 @@ bool MyWin::Close()
return bRet;
}
+void MyWin::dispose()
+{
+ m_aListButton.disposeAndClear();
+ m_aSvpBitmaps.disposeAndClear();
+ m_aImage.disposeAndClear();
+ m_aQuitButton.disposeAndClear();
+ WorkWindow::dispose();
+}
+
void MyWin::parseList( const OString& rList )
{
sal_Int32 nTokenPos = 0;
OUString aElementType;
- m_aSvpBitmaps.Clear();
+ m_aSvpBitmaps->Clear();
while( nTokenPos >= 0 )
{
OString aLine = rList.getToken( 0, '\n', nTokenPos );
@@ -179,7 +190,7 @@ void MyWin::parseList( const OString& rList )
aNewElement.append( aElementType );
aNewElement.appendAscii( ": " );
aNewElement.append( OStringToOUString( aLine, RTL_TEXTENCODING_ASCII_US ) );
- m_aSvpBitmaps.InsertEntry( aNewElement.makeStringAndClear() );
+ m_aSvpBitmaps->InsertEntry( aNewElement.makeStringAndClear() );
}
}
}
@@ -235,7 +246,7 @@ IMPL_LINK( MyWin, QuitHdl, Button*, )
IMPL_LINK( MyWin, SelectHdl, ListBox*, )
{
- OUString aEntry = m_aSvpBitmaps.GetSelectEntry();
+ OUString aEntry = m_aSvpBitmaps->GetSelectEntry();
sal_Int32 nPos = aEntry.indexOf( ": " );
if( nPos != -1 )
{
@@ -259,8 +270,8 @@ IMPL_LINK( MyWin, SelectHdl, ListBox*, )
Size aFixedSize( aBitmap.GetSizePixel() );
aFixedSize.Width() += 10;
aFixedSize.Height() += 10;
- m_aImage.SetSizePixel( aFixedSize );
- m_aImage.SetImage( Image( BitmapEx( aBitmap ) ) );
+ m_aImage->SetSizePixel( aFixedSize );
+ m_aImage->SetImage( Image( BitmapEx( aBitmap ) ) );
}
return 0;
}
diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx
index ebf716c3abd1..ac2c5527a8e0 100644
--- a/vcl/workben/svptest.cxx
+++ b/vcl/workben/svptest.cxx
@@ -34,6 +34,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/metric.hxx>
+#include <vcl/vclptr.hxx>
#include <rtl/ustrbuf.hxx>
@@ -90,9 +91,9 @@ public:
void Main()
{
- MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
- aMainWin.SetText( OUString( "VCL - Workbench" ) );
- aMainWin.Show();
+ ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK );
+ aMainWin->SetText( OUString( "VCL - Workbench" ) );
+ aMainWin->Show();
Application::Execute();
}
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index f272ccbb88c4..4f42f9353445 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -774,12 +774,12 @@ public:
void SizeAndRender(OutputDevice &rDev, const Rectangle& r, RenderType eType,
const RenderContext &rCtx)
{
- VirtualDevice *pNested;
+ ScopedVclPtr<VirtualDevice> pNested;
if ((int)eType < RENDER_AS_BITMAPEX)
- pNested = new VirtualDevice(rDev);
+ pNested = VclPtr<VirtualDevice>::Create(rDev).get();
else
- pNested = new VirtualDevice(rDev,0,0);
+ pNested = VclPtr<VirtualDevice>::Create(rDev,0,0).get();
pNested->SetOutputSizePixel(r.GetSize());
Rectangle aWhole(Point(0,0), r.GetSize());
@@ -804,7 +804,6 @@ public:
aWhole.TopLeft(), aWhole.GetSize(),
*pNested);
}
- delete pNested;
}
virtual void RenderRegion(OutputDevice &rDev, Rectangle r,
const RenderContext &rCtx) SAL_OVERRIDE
@@ -945,19 +944,20 @@ public:
BitmapEx AlphaRecovery(OutputDevice &rDev, Point aPt, BitmapEx &aSrc)
{
// Compositing onto 2x colors beyond our control
- VirtualDevice aWhite, aBlack;
- aWhite.SetOutputSizePixel(aSrc.GetSizePixel());
- aWhite.SetBackground(Wallpaper(COL_WHITE));
- aWhite.Erase();
- aBlack.SetOutputSizePixel(aSrc.GetSizePixel());
- aBlack.SetBackground(Wallpaper(COL_BLACK));
- aBlack.Erase();
- aWhite.DrawBitmapEx(Point(), aSrc);
- aBlack.DrawBitmapEx(Point(), aSrc);
+ ScopedVclPtrInstance< VirtualDevice > aWhite;
+ ScopedVclPtrInstance< VirtualDevice > aBlack;
+ aWhite->SetOutputSizePixel(aSrc.GetSizePixel());
+ aWhite->SetBackground(Wallpaper(COL_WHITE));
+ aWhite->Erase();
+ aBlack->SetOutputSizePixel(aSrc.GetSizePixel());
+ aBlack->SetBackground(Wallpaper(COL_BLACK));
+ aBlack->Erase();
+ aWhite->DrawBitmapEx(Point(), aSrc);
+ aBlack->DrawBitmapEx(Point(), aSrc);
// Now recover that alpha...
- Bitmap aWhiteBmp = aWhite.GetBitmap(Point(),aSrc.GetSizePixel());
- Bitmap aBlackBmp = aBlack.GetBitmap(Point(),aSrc.GetSizePixel());
+ Bitmap aWhiteBmp = aWhite->GetBitmap(Point(),aSrc.GetSizePixel());
+ Bitmap aBlackBmp = aBlack->GetBitmap(Point(),aSrc.GetSizePixel());
AlphaMask aMask(aSrc.GetSizePixel());
Bitmap aRecovered(aSrc.GetSizePixel(), 24);
{
@@ -1133,12 +1133,11 @@ public:
}
}
}
- std::vector<vcl::Window *> maInvalidates;
+ std::vector<VclPtr<vcl::Window> > maInvalidates;
void addInvalidate(vcl::Window *pWindow) { maInvalidates.push_back(pWindow); };
void removeInvalidate(vcl::Window *pWindow)
{
- std::vector<vcl::Window *>::iterator aIt;
- for (aIt = maInvalidates.begin(); aIt != maInvalidates.end(); ++aIt)
+ for (auto aIt = maInvalidates.begin(); aIt != maInvalidates.end(); ++aIt)
{
if (*aIt == pWindow)
{
@@ -1231,8 +1230,8 @@ bool DemoRenderer::MouseButtonDown(const MouseEvent& rMEvt)
// otherwise bounce floating windows
if (!mpButton)
{
- mpButtonWin = new FloatingWindow(this);
- mpButton = new PushButton(mpButtonWin);
+ mpButtonWin = VclPtr<FloatingWindow>::Create(this);
+ mpButton = VclPtr<PushButton>::Create(mpButtonWin);
mpButton->SetSymbol(SymbolType::HELP);
mpButton->SetText("PushButton demo");
mpButton->SetPosSizePixel(Point(0,0), mpButton->GetOptimalSize());
@@ -1385,8 +1384,13 @@ public:
}
virtual ~DemoWin()
{
+ disposeOnce();
+ }
+ virtual void dispose() SAL_OVERRIDE
+ {
mxThread.clear();
mrRenderer.removeInvalidate(this);
+ WorkWindow::dispose();
}
virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE
{
@@ -1402,7 +1406,7 @@ public:
}
else
{ // spawn another window
- DemoWin *pNewWin = new DemoWin(mrRenderer, testThreads);
+ VclPtrInstance<DemoWin> pNewWin(mrRenderer, testThreads);
pNewWin->SetText("Another interactive VCL demo window");
pNewWin->Show();
}
@@ -1445,16 +1449,16 @@ public:
class DemoWidgets : public WorkWindow
{
- VclBox *mpBox;
- ToolBox *mpToolbox;
- PushButton *mpButton;
+ VclPtr<VclBox> mpBox;
+ VclPtr<ToolBox> mpToolbox;
+ VclPtr<PushButton> mpButton;
public:
DemoWidgets() :
WorkWindow(NULL, WB_STDWORK),
- mpBox(new VclVBox(this, false, 3)),
- mpToolbox(new ToolBox(mpBox)),
- mpButton(new PushButton(mpBox))
+ mpBox(VclPtrInstance<VclVBox>(this, false, 3)),
+ mpToolbox(VclPtrInstance<ToolBox>(mpBox.get())),
+ mpButton(VclPtrInstance<PushButton>(mpBox.get()))
{
SetText("VCL widget demo");
@@ -1477,14 +1481,14 @@ public:
Show();
}
-
- virtual ~DemoWidgets()
+ virtual ~DemoWidgets() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
{
- delete mpButton;
- delete mpToolbox;
- delete mpBox;
+ mpBox.disposeAndClear();
+ mpToolbox.disposeAndClear();
+ mpButton.disposeAndClear();
+ WorkWindow::dispose();
}
-
virtual void Paint(const Rectangle&) SAL_OVERRIDE
{
Rectangle aWholeSize(Point(0, 0),GetOutputSizePixel());
@@ -1499,16 +1503,16 @@ public:
DrawWallpaper(aWholeSize, aWallpaper);
Pop();
- VirtualDevice aDev(*this);
- aDev.EnableRTL(IsRTLEnabled());
- aDev.SetOutputSizePixel(aExclude.GetSize());
+ ScopedVclPtrInstance< VirtualDevice > pDev(*this);
+ pDev->EnableRTL(IsRTLEnabled());
+ pDev->SetOutputSizePixel(aExclude.GetSize());
Rectangle aSubRect(aWholeSize);
aSubRect.Move(-aExclude.Left(), -aExclude.Top());
- aDev.DrawWallpaper(aSubRect, aWallpaper );
+ pDev->DrawWallpaper(aSubRect, aWallpaper );
DrawOutDev(aExclude.TopLeft(), aExclude.GetSize(),
- Point( 0, 0 ), aExclude.GetSize(), aDev );
+ Point( 0, 0 ), aExclude.GetSize(), *pDev.get() );
}
};
@@ -1612,20 +1616,23 @@ public:
}
}
- DemoWin aMainWin(aRenderer, bThreads);
- std::unique_ptr<DemoWidgets> xWidgets;
- std::unique_ptr<DemoPopup> xPopup;
+ ScopedVclPtrInstance<DemoWin> aMainWin(aRenderer, bThreads);
+ VclPtr<DemoWidgets> xWidgets;
+ VclPtr<DemoPopup> xPopup;
- aMainWin.SetText("Interactive VCL demo #1");
+ aMainWin->SetText("Interactive VCL demo #1");
if (bWidgets)
- xWidgets.reset(new DemoWidgets());
+ xWidgets = VclPtr< DemoWidgets >::Create ();
else if (bPopup)
- xPopup.reset(new DemoPopup());
+ xPopup = VclPtrInstance< DemoPopup> ();
else
- aMainWin.Show();
+ aMainWin->Show();
Application::Execute();
+
+ xWidgets.disposeAndClear();
+ xPopup.disposeAndClear();
}
catch (const css::uno::Exception& e)
{
diff --git a/writerperfect/source/writer/WordPerfectImportFilter.cxx b/writerperfect/source/writer/WordPerfectImportFilter.cxx
index 5294e2e030f3..8d484dd3ba35 100644
--- a/writerperfect/source/writer/WordPerfectImportFilter.cxx
+++ b/writerperfect/source/writer/WordPerfectImportFilter.cxx
@@ -119,11 +119,11 @@ throw (RuntimeException, std::exception)
int unsuccessfulAttempts = 0;
while (true)
{
- SfxPasswordDialog aPasswdDlg(0);
- aPasswdDlg.SetMinLen(0);
- if (!aPasswdDlg.Execute())
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(nullptr);
+ aPasswdDlg->SetMinLen(0);
+ if (!aPasswdDlg->Execute())
return false;
- OUString aPasswd = aPasswdDlg.GetPassword();
+ OUString aPasswd = aPasswdDlg->GetPassword();
aUtf8Passwd = OUStringToOString(aPasswd, RTL_TEXTENCODING_UTF8);
if (libwpd::WPD_PASSWORD_MATCH_OK == libwpd::WPDocument::verifyPassword(&input, aUtf8Passwd.getStr()))
break;
@@ -303,11 +303,11 @@ throw (RuntimeException, std::exception)
int unsuccessfulAttempts = 0;
while (true)
{
- SfxPasswordDialog aPasswdDlg(0);
- aPasswdDlg.SetMinLen(0);
- if (!aPasswdDlg.Execute())
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(nullptr);
+ aPasswdDlg->SetMinLen(0);
+ if (!aPasswdDlg->Execute())
return com::sun::star::ui::dialogs::ExecutableDialogResults::CANCEL;
- msPassword = aPasswdDlg.GetPassword().getStr();
+ msPassword = aPasswdDlg->GetPassword().getStr();
aUtf8Passwd = OUStringToOString(msPassword, RTL_TEXTENCODING_UTF8);
if (libwpd::WPD_PASSWORD_MATCH_OK == libwpd::WPDocument::verifyPassword(&input, aUtf8Passwd.getStr()))
break;
diff --git a/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx b/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx
index f12837a49ca2..353473ca6c8d 100644
--- a/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx
+++ b/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx
@@ -48,9 +48,9 @@ private:
css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > maCerts;
SignatureInformations maCertsToIgnore;
- SvSimpleTable* m_pCertLB;
- PushButton* m_pViewBtn;
- OKButton* m_pOKBtn;
+ VclPtr<SvSimpleTable> m_pCertLB;
+ VclPtr<PushButton> m_pViewBtn;
+ VclPtr<OKButton> m_pOKBtn;
bool mbInitialized;
@@ -65,6 +65,7 @@ private:
public:
CertificateChooser( vcl::Window* pParent, css::uno::Reference< css::uno::XComponentContext>& rxCtx, css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const SignatureInformations& rCertsToIgnore );
virtual ~CertificateChooser();
+ virtual void dispose() SAL_OVERRIDE;
short Execute() SAL_OVERRIDE;
diff --git a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx
index f3eea2ba062d..3f61891bc0fd 100644
--- a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx
+++ b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx
@@ -46,7 +46,7 @@ private:
friend class CertificateViewerDetailsTP;
friend class CertificateViewerCertPathTP;
- TabControl* mpTabCtrl;
+ VclPtr<TabControl> mpTabCtrl;
sal_uInt16 mnGeneralId;
sal_uInt16 mnDetailsId;
sal_uInt16 mnPathId;
@@ -58,16 +58,19 @@ private:
public:
CertificateViewer( vcl::Window* pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& rXCert, bool bCheckForPrivateKey );
virtual ~CertificateViewer();
+ virtual void dispose() SAL_OVERRIDE;
};
class CertificateViewerTP : public TabPage
{
protected:
- CertificateViewer* mpDlg;
+ VclPtr<CertificateViewer> mpDlg;
public:
CertificateViewerTP( vcl::Window* _pParent, const OString& rID,
const OUString& rUIXMLDescription, CertificateViewer* _pDlg );
+ virtual ~CertificateViewerTP();
+ virtual void dispose() SAL_OVERRIDE;
void SetTabDlg( CertificateViewer* _pTabDlg )
{
mpDlg = _pTabDlg;
@@ -77,16 +80,18 @@ public:
class CertificateViewerGeneralTP : public CertificateViewerTP
{
private:
- FixedImage* m_pCertImg;
- FixedText* m_pHintNotTrustedFI;
- FixedText* m_pIssuedToFI;
- FixedText* m_pIssuedByFI;
- FixedText* m_pValidFromDateFI;
- FixedText* m_pValidToDateFI;
- FixedImage* m_pKeyImg;
- FixedText* m_pHintCorrespPrivKeyFI;
+ VclPtr<FixedImage> m_pCertImg;
+ VclPtr<FixedText> m_pHintNotTrustedFI;
+ VclPtr<FixedText> m_pIssuedToFI;
+ VclPtr<FixedText> m_pIssuedByFI;
+ VclPtr<FixedText> m_pValidFromDateFI;
+ VclPtr<FixedText> m_pValidToDateFI;
+ VclPtr<FixedImage> m_pKeyImg;
+ VclPtr<FixedText> m_pHintCorrespPrivKeyFI;
public:
CertificateViewerGeneralTP( vcl::Window* pParent, CertificateViewer* _pDlg );
+ virtual ~CertificateViewerGeneralTP();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
};
@@ -95,9 +100,9 @@ public:
class CertificateViewerDetailsTP : public CertificateViewerTP
{
private:
- SvSimpleTableContainer* m_pElementsLBContainer;
- SvSimpleTable* m_pElementsLB;
- MultiLineEdit* m_pValueDetails;
+ VclPtr<SvSimpleTableContainer> m_pElementsLBContainer;
+ VclPtr<SvSimpleTable> m_pElementsLB;
+ VclPtr<MultiLineEdit> m_pValueDetails;
vcl::Font m_aStdFont;
vcl::Font m_aFixedWidthFont;
@@ -108,6 +113,7 @@ private:
public:
CertificateViewerDetailsTP( vcl::Window* pParent, CertificateViewer* _pDlg );
virtual ~CertificateViewerDetailsTP();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
};
@@ -116,11 +122,11 @@ public:
class CertificateViewerCertPathTP : public CertificateViewerTP
{
private:
- SvTreeListBox* mpCertPathLB;
- PushButton* mpViewCertPB;
- VclMultiLineEdit* mpCertStatusML;
+ VclPtr<SvTreeListBox> mpCertPathLB;
+ VclPtr<PushButton> mpViewCertPB;
+ VclPtr<VclMultiLineEdit> mpCertStatusML;
- CertificateViewer* mpParent;
+ VclPtr<CertificateViewer> mpParent;
bool mbFirstActivateDone;
Image maCertImage;
Image maCertNotValidatedImage;
@@ -137,6 +143,7 @@ private:
public:
CertificateViewerCertPathTP( vcl::Window* pParent, CertificateViewer* _pDlg );
virtual ~CertificateViewerCertPathTP();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
};
diff --git a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
index c73fc3bbbd3b..a3cdb392bb45 100644
--- a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
@@ -63,24 +63,24 @@ private:
DocumentSignatureMode meSignatureMode;
css::uno::Sequence < css::uno::Sequence < css::beans::PropertyValue > > m_manifest;
- FixedText* m_pHintDocFT;
- FixedText* m_pHintBasicFT;
- FixedText* m_pHintPackageFT;
- SvSimpleTable* m_pSignaturesLB;
- FixedImage* m_pSigsValidImg;
- FixedText* m_pSigsValidFI;
- FixedImage* m_pSigsInvalidImg;
- FixedText* m_pSigsInvalidFI;
- FixedImage* m_pSigsNotvalidatedImg;
- FixedText* m_pSigsNotvalidatedFI;
- FixedImage* m_pSigsOldSignatureImg;
- FixedText* m_pSigsOldSignatureFI;
-
- PushButton* m_pViewBtn;
- PushButton* m_pAddBtn;
- PushButton* m_pRemoveBtn;
-
- CloseButton* m_pCloseBtn;
+ VclPtr<FixedText> m_pHintDocFT;
+ VclPtr<FixedText> m_pHintBasicFT;
+ VclPtr<FixedText> m_pHintPackageFT;
+ VclPtr<SvSimpleTable> m_pSignaturesLB;
+ VclPtr<FixedImage> m_pSigsValidImg;
+ VclPtr<FixedText> m_pSigsValidFI;
+ VclPtr<FixedImage> m_pSigsInvalidImg;
+ VclPtr<FixedText> m_pSigsInvalidFI;
+ VclPtr<FixedImage> m_pSigsNotvalidatedImg;
+ VclPtr<FixedText> m_pSigsNotvalidatedFI;
+ VclPtr<FixedImage> m_pSigsOldSignatureImg;
+ VclPtr<FixedText> m_pSigsOldSignatureFI;
+
+ VclPtr<PushButton> m_pViewBtn;
+ VclPtr<PushButton> m_pAddBtn;
+ VclPtr<PushButton> m_pRemoveBtn;
+
+ VclPtr<CloseButton> m_pCloseBtn;
OUString m_sODFVersion;
//Signals if the document contains already a document signature. This is only
@@ -117,6 +117,7 @@ public:
css::uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
bool bReadOnly, const OUString& sODFVersion, bool bHasDocumentSignature);
virtual ~DigitalSignaturesDialog();
+ virtual void dispose() SAL_OVERRIDE;
// Initialize the dialog and the security environment, returns TRUE on success
bool Init();
diff --git a/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx b/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx
index 2707fe5e2ccd..8f0edfd44e85 100644
--- a/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx
+++ b/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx
@@ -47,9 +47,9 @@ private:
friend class MacroSecurityLevelTP;
friend class MacroSecurityTrustedSourcesTP;
- TabControl* m_pTabCtrl;
- OKButton* m_pOkBtn;
- PushButton* m_pResetBtn;
+ VclPtr<TabControl> m_pTabCtrl;
+ VclPtr<OKButton> m_pOkBtn;
+ VclPtr<PushButton> m_pResetBtn;
css::uno::Reference< css::uno::XComponentContext > mxCtx;
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
@@ -58,8 +58,8 @@ private:
sal_uInt16 m_nSecLevelId;
sal_uInt16 m_nSecTrustId;
- MacroSecurityTP* mpLevelTP;
- MacroSecurityTP* mpTrustSrcTP;
+ VclPtr<MacroSecurityTP> mpLevelTP;
+ VclPtr<MacroSecurityTP> mpTrustSrcTP;
DECL_LINK( OkBtnHdl, void* );
public:
@@ -67,6 +67,7 @@ public:
const css::uno::Reference< css::uno::XComponentContext>& rxCtx,
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment);
virtual ~MacroSecurity();
+ virtual void dispose() SAL_OVERRIDE;
inline void EnableReset(bool _bEnable = true)
{
@@ -77,10 +78,12 @@ public:
class MacroSecurityTP : public TabPage
{
protected:
- MacroSecurity* mpDlg;
+ VclPtr<MacroSecurity> mpDlg;
public:
MacroSecurityTP(vcl::Window* _pParent, const OString& rID,
const OUString& rUIXMLDescription, MacroSecurity* _pDlg);
+ virtual ~MacroSecurityTP();
+ virtual void dispose() SAL_OVERRIDE;
void SetTabDlg(MacroSecurity* pTabDlg)
{
@@ -93,10 +96,10 @@ public:
class MacroSecurityLevelTP : public MacroSecurityTP
{
private:
- RadioButton* m_pVeryHighRB;
- RadioButton* m_pHighRB;
- RadioButton* m_pMediumRB;
- RadioButton* m_pLowRB;
+ VclPtr<RadioButton> m_pVeryHighRB;
+ VclPtr<RadioButton> m_pHighRB;
+ VclPtr<RadioButton> m_pMediumRB;
+ VclPtr<RadioButton> m_pLowRB;
sal_uInt16 mnCurLevel;
@@ -105,6 +108,8 @@ protected:
public:
MacroSecurityLevelTP( vcl::Window* pParent, MacroSecurity* _pDlg );
+ virtual ~MacroSecurityLevelTP();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ClosePage() SAL_OVERRIDE;
};
@@ -113,14 +118,14 @@ public:
class MacroSecurityTrustedSourcesTP : public MacroSecurityTP
{
private:
- FixedImage* m_pTrustCertROFI;
- SvSimpleTable* m_pTrustCertLB;
- PushButton* m_pViewCertPB;
- PushButton* m_pRemoveCertPB;
- FixedImage* m_pTrustFileROFI;
- ListBox* m_pTrustFileLocLB;
- PushButton* m_pAddLocPB;
- PushButton* m_pRemoveLocPB;
+ VclPtr<FixedImage> m_pTrustCertROFI;
+ VclPtr<SvSimpleTable> m_pTrustCertLB;
+ VclPtr<PushButton> m_pViewCertPB;
+ VclPtr<PushButton> m_pRemoveCertPB;
+ VclPtr<FixedImage> m_pTrustFileROFI;
+ VclPtr<ListBox> m_pTrustFileLocLB;
+ VclPtr<PushButton> m_pAddLocPB;
+ VclPtr<PushButton> m_pRemoveLocPB;
css::uno::Sequence< SvtSecurityOptions::Certificate > maTrustedAuthors;
@@ -140,6 +145,7 @@ private:
public:
MacroSecurityTrustedSourcesTP(vcl::Window* pParent, MacroSecurity* _pDlg);
virtual ~MacroSecurityTrustedSourcesTP();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual void ClosePage() SAL_OVERRIDE;
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index acaac53e3e43..287b5cf50125 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -222,17 +222,18 @@ bool DocumentDigitalSignatures::ImplViewSignatures(
DocumentSignatureMode eMode, bool bReadOnly ) throw (RuntimeException, std::exception)
{
bool bChanges = false;
- DigitalSignaturesDialog aSignaturesDialog(
- NULL, mxCtx, eMode, bReadOnly, m_sODFVersion, m_bHasDocumentSignature);
- bool bInit = aSignaturesDialog.Init();
+ ScopedVclPtrInstance<DigitalSignaturesDialog> aSignaturesDialog(
+ nullptr, mxCtx, eMode, bReadOnly, m_sODFVersion,
+ m_bHasDocumentSignature);
+ bool bInit = aSignaturesDialog->Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
if ( bInit )
{
- aSignaturesDialog.SetStorage( rxStorage );
- aSignaturesDialog.SetSignatureStream( xSignStream );
- if ( aSignaturesDialog.Execute() )
+ aSignaturesDialog->SetStorage( rxStorage );
+ aSignaturesDialog->SetSignatureStream( xSignStream );
+ if ( aSignaturesDialog->Execute() )
{
- if ( aSignaturesDialog.SignaturesChanged() )
+ if ( aSignaturesDialog->SignaturesChanged() )
{
bChanges = true;
// If we have a storage and no stream, we are responsible for commit
@@ -246,8 +247,8 @@ bool DocumentDigitalSignatures::ImplViewSignatures(
}
else
{
- MessageDialog aBox(NULL, XMLSEC_RES(RID_XMLSECWB_NO_MOZILLA_PROFILE), VCL_MESSAGE_WARNING);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(nullptr, XMLSEC_RES(RID_XMLSECWB_NO_MOZILLA_PROFILE), VCL_MESSAGE_WARNING);
+ aBox->Execute();
}
return bChanges;
@@ -386,8 +387,8 @@ void DocumentDigitalSignatures::manageTrustedSources( ) throw (RuntimeException
if ( aSignatureHelper.Init() )
xSecEnv = aSignatureHelper.GetSecurityEnvironment();
- MacroSecurity aDlg( NULL, mxCtx, xSecEnv );
- aDlg.Execute();
+ ScopedVclPtrInstance< MacroSecurity > aDlg( nullptr, mxCtx, xSecEnv );
+ aDlg->Execute();
}
void DocumentDigitalSignatures::showCertificate(
@@ -401,8 +402,8 @@ void DocumentDigitalSignatures::showCertificate(
if ( bInit )
{
- CertificateViewer aViewer( NULL, aSignatureHelper.GetSecurityEnvironment(), _Certificate, false );
- aViewer.Execute();
+ ScopedVclPtrInstance< CertificateViewer > aViewer( nullptr, aSignatureHelper.GetSecurityEnvironment(), _Certificate, false );
+ aViewer->Execute();
}
}
@@ -441,12 +442,12 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertif
if ( aSignatureHelper.Init() )
xSecEnv = aSignatureHelper.GetSecurityEnvironment();
- CertificateChooser aChooser( NULL, mxCtx, xSecEnv, aSignatureHelper.GetSignatureInformations());
+ ScopedVclPtrInstance< CertificateChooser > aChooser( nullptr, mxCtx, xSecEnv, aSignatureHelper.GetSignatureInformations());
- if (aChooser.Execute() != RET_OK)
+ if (aChooser->Execute() != RET_OK)
return Reference< css::security::XCertificate >(0);
- Reference< css::security::XCertificate > xCert = aChooser.GetSelectedCertificate();
+ Reference< css::security::XCertificate > xCert = aChooser->GetSelectedCertificate();
if ( !xCert.is() )
return Reference< css::security::XCertificate >(0);
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 4f822527997b..9c5e28e94b67 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -62,7 +62,7 @@ CertificateChooser::CertificateChooser( vcl::Window* _pParent, uno::Reference< u
pSignatures->set_width_request(aControlSize.Width());
pSignatures->set_height_request(aControlSize.Height());
- m_pCertLB = new SvSimpleTable(*pSignatures);
+ m_pCertLB = VclPtr<SvSimpleTable>::Create(*pSignatures);
static long nTabs[] = { 3, 0, 30*nControlWidth/100, 60*nControlWidth/100 };
m_pCertLB->SetTabs( &nTabs[0] );
m_pCertLB->InsertHeaderEntry(get<FixedText>("issuedto")->GetText() + "\t" + get<FixedText>("issuedby")->GetText()
@@ -81,7 +81,15 @@ CertificateChooser::CertificateChooser( vcl::Window* _pParent, uno::Reference< u
CertificateChooser::~CertificateChooser()
{
- delete m_pCertLB;
+ disposeOnce();
+}
+
+void CertificateChooser::dispose()
+{
+ m_pCertLB.disposeAndClear();
+ m_pViewBtn.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
}
short CertificateChooser::Execute()
@@ -217,8 +225,8 @@ void CertificateChooser::ImplShowCertificateDetails()
uno::Reference< css::security::XCertificate > xCert = GetSelectedCertificate();
if( xCert.is() )
{
- CertificateViewer aViewer( this, mxSecurityEnvironment, xCert, true );
- aViewer.Execute();
+ ScopedVclPtrInstance< CertificateViewer > aViewer( this, mxSecurityEnvironment, xCert, true );
+ aViewer->Execute();
}
}
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 7a14960be47c..61cbf28f1dae 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -53,17 +53,24 @@ CertificateViewer::CertificateViewer(
mnDetailsId = mpTabCtrl->GetPageId("details");
mnPathId = mpTabCtrl->GetPageId("path");
- mpTabCtrl->SetTabPage(mnGeneralId, new CertificateViewerGeneralTP( mpTabCtrl, this));
- mpTabCtrl->SetTabPage(mnDetailsId, new CertificateViewerDetailsTP( mpTabCtrl, this));
- mpTabCtrl->SetTabPage(mnPathId, new CertificateViewerCertPathTP( mpTabCtrl, this));
+ mpTabCtrl->SetTabPage(mnGeneralId, VclPtr<CertificateViewerGeneralTP>::Create( mpTabCtrl, this));
+ mpTabCtrl->SetTabPage(mnDetailsId, VclPtr<CertificateViewerDetailsTP>::Create( mpTabCtrl, this));
+ mpTabCtrl->SetTabPage(mnPathId, VclPtr<CertificateViewerCertPathTP>::Create( mpTabCtrl, this));
mpTabCtrl->SetCurPageId(mnGeneralId);
}
CertificateViewer::~CertificateViewer()
{
- delete mpTabCtrl->GetTabPage(mnGeneralId);
- delete mpTabCtrl->GetTabPage(mnDetailsId);
- delete mpTabCtrl->GetTabPage(mnPathId);
+ disposeOnce();
+}
+
+void CertificateViewer::dispose()
+{
+ mpTabCtrl->GetTabPage(mnGeneralId)->disposeOnce();
+ mpTabCtrl->GetTabPage(mnDetailsId)->disposeOnce();
+ mpTabCtrl->GetTabPage(mnPathId)->disposeOnce();
+ mpTabCtrl.clear();
+ TabDialog::dispose();
}
CertificateViewerTP::CertificateViewerTP( vcl::Window* _pParent, const OString& rID,
@@ -73,6 +80,18 @@ CertificateViewerTP::CertificateViewerTP( vcl::Window* _pParent, const OString&
{
}
+CertificateViewerTP::~CertificateViewerTP()
+{
+ disposeOnce();
+}
+
+void CertificateViewerTP::dispose()
+{
+ mpDlg.clear();
+ TabPage::dispose();
+}
+
+
CertificateViewerGeneralTP::CertificateViewerGeneralTP( vcl::Window* _pParent, CertificateViewer* _pDlg )
:CertificateViewerTP ( _pParent, "CertGeneral", "xmlsec/ui/certgeneral.ui", _pDlg )
{
@@ -130,6 +149,24 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( vcl::Window* _pParent, C
}
}
+CertificateViewerGeneralTP::~CertificateViewerGeneralTP()
+{
+ disposeOnce();
+}
+
+void CertificateViewerGeneralTP::dispose()
+{
+ m_pCertImg.clear();
+ m_pHintNotTrustedFI.clear();
+ m_pIssuedToFI.clear();
+ m_pIssuedByFI.clear();
+ m_pValidFromDateFI.clear();
+ m_pValidToDateFI.clear();
+ m_pKeyImg.clear();
+ m_pHintCorrespPrivKeyFI.clear();
+ CertificateViewerTP::dispose();
+}
+
void CertificateViewerGeneralTP::ActivatePage()
{
@@ -180,7 +217,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
{
get( m_pValueDetails, "valuedetails" );
get( m_pElementsLBContainer, "tablecontainer" );
- m_pElementsLB = new SvSimpleTable( *m_pElementsLBContainer );
+ m_pElementsLB = VclPtr<SvSimpleTable>::Create( *m_pElementsLBContainer );
m_aStdFont = m_pValueDetails->GetControlFont();
WinBits nStyle = m_pElementsLB->GetStyle();
@@ -256,8 +293,16 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C
CertificateViewerDetailsTP::~CertificateViewerDetailsTP()
{
+ disposeOnce();
+}
+
+void CertificateViewerDetailsTP::dispose()
+{
Clear();
- delete m_pElementsLB;
+ m_pElementsLB.disposeAndClear();
+ m_pElementsLBContainer.clear();
+ m_pValueDetails.clear();
+ CertificateViewerTP::dispose();
}
void CertificateViewerDetailsTP::ActivatePage()
@@ -327,7 +372,17 @@ CertificateViewerCertPathTP::CertificateViewerCertPathTP( vcl::Window* _pParent,
CertificateViewerCertPathTP::~CertificateViewerCertPathTP()
{
+ disposeOnce();
+}
+
+void CertificateViewerCertPathTP::dispose()
+{
Clear();
+ mpCertPathLB.clear();
+ mpViewCertPB.clear();
+ mpCertStatusML.clear();
+ mpParent.clear();
+ CertificateViewerTP::dispose();
}
void CertificateViewerCertPathTP::ActivatePage()
@@ -370,8 +425,11 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl)
SvTreeListEntry* pEntry = mpCertPathLB->FirstSelected();
if( pEntry )
{
- CertificateViewer aViewer( this, mpDlg->mxSecurityEnvironment, static_cast<CertPath_UserData*>(pEntry->GetUserData())->mxCert, false );
- aViewer.Execute();
+ ScopedVclPtrInstance< CertificateViewer > aViewer(
+ this, mpDlg->mxSecurityEnvironment,
+ static_cast<CertPath_UserData*>(pEntry->GetUserData())->mxCert,
+ false );
+ aViewer->Execute();
}
return 0;
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 6f5db4db79af..9673a3c617f1 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -198,7 +198,7 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
pSignatures->set_width_request(aControlSize.Width());
pSignatures->set_height_request(aControlSize.Height());
- m_pSignaturesLB = new SvSimpleTable(*pSignatures);
+ m_pSignaturesLB = VclPtr<SvSimpleTable>::Create(*pSignatures);
// #i48253# the tablistbox needs its own unique id
m_pSignaturesLB->Window::SetUniqueId( HID_XMLSEC_TREE_SIGNATURESDLG );
static long aTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 };
@@ -235,7 +235,28 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
DigitalSignaturesDialog::~DigitalSignaturesDialog()
{
- delete m_pSignaturesLB;
+ disposeOnce();
+}
+
+void DigitalSignaturesDialog::dispose()
+{
+ m_pSignaturesLB.disposeAndClear();
+ m_pHintDocFT.clear();
+ m_pHintBasicFT.clear();
+ m_pHintPackageFT.clear();
+ m_pSigsValidImg.clear();
+ m_pSigsValidFI.clear();
+ m_pSigsInvalidImg.clear();
+ m_pSigsInvalidFI.clear();
+ m_pSigsNotvalidatedImg.clear();
+ m_pSigsNotvalidatedFI.clear();
+ m_pSigsOldSignatureImg.clear();
+ m_pSigsOldSignatureFI.clear();
+ m_pViewBtn.clear();
+ m_pAddBtn.clear();
+ m_pRemoveBtn.clear();
+ m_pCloseBtn.clear();
+ ModalDialog::dispose();
}
bool DigitalSignaturesDialog::Init()
@@ -292,8 +313,8 @@ bool DigitalSignaturesDialog::canAddRemove()
if ( (!bSave1_1 && bDoc1_1) || (bSave1_1 && bDoc1_1) )
{
//#4
- MessageDialog err(NULL, XMLSEC_RES(STR_XMLSECDLG_OLD_ODF_FORMAT));
- err.Execute();
+ ScopedVclPtrInstance< MessageDialog > err(nullptr, XMLSEC_RES(STR_XMLSECDLG_OLD_ODF_FORMAT));
+ err->Execute();
ret = false;
}
@@ -411,10 +432,10 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl)
uno::Reference<com::sun::star::security::XSerialNumberAdapter> xSerialNumberAdapter =
::com::sun::star::security::SerialNumberAdapter::create(mxCtx);
- CertificateChooser aChooser( this, mxCtx, xSecEnv, maCurrentSignatureInformations );
- if ( aChooser.Execute() == RET_OK )
+ ScopedVclPtrInstance< CertificateChooser > aChooser( this, mxCtx, xSecEnv, maCurrentSignatureInformations );
+ if ( aChooser->Execute() == RET_OK )
{
- uno::Reference< ::com::sun::star::security::XCertificate > xCert = aChooser.GetSelectedCertificate();
+ uno::Reference< ::com::sun::star::security::XCertificate > xCert = aChooser->GetSelectedCertificate();
if ( !xCert.is() )
{
SAL_WARN( "xmlsecurity.dialogs", "no certificate selected" );
@@ -746,8 +767,8 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails()
DBG_ASSERT( xCert.is(), "Error getting cCertificate!" );
if ( xCert.is() )
{
- CertificateViewer aViewer( this, maSignatureHelper.GetSecurityEnvironment(), xCert, false );
- aViewer.Execute();
+ ScopedVclPtrInstance< CertificateViewer > aViewer( this, maSignatureHelper.GetSecurityEnvironment(), xCert, false );
+ aViewer->Execute();
}
}
}
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index c06982339d02..1142b1dfd173 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -69,8 +69,8 @@ MacroSecurity::MacroSecurity( vcl::Window* _pParent,
get(m_pResetBtn, "reset");
get(m_pOkBtn, "ok");
- mpLevelTP = new MacroSecurityLevelTP(m_pTabCtrl, this);
- mpTrustSrcTP = new MacroSecurityTrustedSourcesTP(m_pTabCtrl, this);
+ mpLevelTP.reset(VclPtr<MacroSecurityLevelTP>::Create(m_pTabCtrl, this));
+ mpTrustSrcTP.reset(VclPtr<MacroSecurityTrustedSourcesTP>::Create(m_pTabCtrl, this));
m_nSecLevelId = m_pTabCtrl->GetPageId("SecurityLevelPage");
m_nSecTrustId = m_pTabCtrl->GetPageId("SecurityTrustPage");
@@ -84,8 +84,19 @@ MacroSecurity::MacroSecurity( vcl::Window* _pParent,
MacroSecurity::~MacroSecurity()
{
- delete m_pTabCtrl->GetTabPage(m_nSecTrustId);
- delete m_pTabCtrl->GetTabPage(m_nSecLevelId);
+ disposeOnce();
+}
+
+void MacroSecurity::dispose()
+{
+ m_pTabCtrl->GetTabPage(m_nSecTrustId)->disposeOnce();
+ m_pTabCtrl->GetTabPage(m_nSecLevelId)->disposeOnce();
+ m_pTabCtrl.clear();
+ m_pOkBtn.clear();
+ m_pResetBtn.clear();
+ mpLevelTP.disposeAndClear();
+ mpTrustSrcTP.disposeAndClear();
+ TabDialog::dispose();
}
MacroSecurityTP::MacroSecurityTP(vcl::Window* _pParent, const OString& rID,
@@ -95,6 +106,17 @@ MacroSecurityTP::MacroSecurityTP(vcl::Window* _pParent, const OString& rID,
{
}
+MacroSecurityTP::~MacroSecurityTP()
+{
+ disposeOnce();
+}
+
+void MacroSecurityTP::dispose()
+{
+ mpDlg.clear();
+ TabPage::dispose();
+}
+
MacroSecurityLevelTP::MacroSecurityLevelTP(vcl::Window* _pParent, MacroSecurity* _pDlg)
: MacroSecurityTP(_pParent, "SecurityLevelPage", "xmlsec/ui/securitylevelpage.ui", _pDlg)
{
@@ -148,6 +170,20 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(vcl::Window* _pParent, MacroSecurity*
}
}
+MacroSecurityLevelTP::~MacroSecurityLevelTP()
+{
+ disposeOnce();
+}
+
+void MacroSecurityLevelTP::dispose()
+{
+ m_pVeryHighRB.clear();
+ m_pHighRB.clear();
+ m_pMediumRB.clear();
+ m_pLowRB.clear();
+ MacroSecurityTP::dispose();
+}
+
IMPL_LINK_NOARG(MacroSecurityLevelTP, RadioButtonHdl)
{
sal_uInt16 nNewLevel = 0;
@@ -202,8 +238,8 @@ IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, ViewCertPBHdl)
if ( xCert.is() )
{
- CertificateViewer aViewer( this, mpDlg->mxSecurityEnvironment, xCert, false );
- aViewer.Execute();
+ ScopedVclPtrInstance< CertificateViewer > aViewer( this, mpDlg->mxSecurityEnvironment, xCert, false );
+ aViewer->Execute();
}
}
return 0;
@@ -352,7 +388,7 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(vcl::Window* _pPare
get(m_pRemoveLocPB, "removefile");
SvSimpleTableContainer *pCertificates = get<SvSimpleTableContainer>("certificates");
- m_pTrustCertLB = new TrustCertLB(*pCertificates);
+ m_pTrustCertLB.reset(VclPtr<TrustCertLB>::Create(*pCertificates));
static long aTabs[] = { 3, 0, 0, 0 };
m_pTrustCertLB->SetTabs( aTabs );
@@ -394,7 +430,20 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(vcl::Window* _pPare
MacroSecurityTrustedSourcesTP::~MacroSecurityTrustedSourcesTP()
{
- delete m_pTrustCertLB;
+ disposeOnce();
+}
+
+void MacroSecurityTrustedSourcesTP::dispose()
+{
+ m_pTrustCertLB.disposeAndClear();
+ m_pTrustCertROFI.clear();
+ m_pViewCertPB.clear();
+ m_pRemoveCertPB.clear();
+ m_pTrustFileROFI.clear();
+ m_pTrustFileLocLB.clear();
+ m_pAddLocPB.clear();
+ m_pRemoveLocPB.clear();
+ MacroSecurityTP::dispose();
}
void MacroSecurityTrustedSourcesTP::ActivatePage()