summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-04-28 11:41:31 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-04-28 15:08:48 +0100
commite8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch)
treeb322529f4a54a6427862cb20cb4cf87fb6a5d065 /svx
parent2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff)
parent0cde74f788a054fa2b65107a030dd463b8d11c7a (diff)
Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts. Conflicts: accessibility/source/extended/accessiblelistbox.cxx accessibility/source/standard/vclxaccessiblecombobox.cxx accessibility/source/standard/vclxaccessibledropdowncombobox.cxx accessibility/source/standard/vclxaccessibledropdownlistbox.cxx accessibility/source/standard/vclxaccessiblelistbox.cxx accessibility/source/standard/vclxaccessibletextfield.cxx basctl/source/basicide/basidesh.cxx cui/source/inc/chardlg.hxx cui/source/tabpages/tpbitmap.cxx dbaccess/source/ui/dlg/UserAdmin.cxx dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx extensions/source/propctrlr/propertyeditor.hxx extensions/source/scanner/sanedlg.cxx filter/source/pdf/impdialog.cxx include/sfx2/mgetempl.hxx include/sfx2/sidebar/SidebarToolBox.hxx include/sfx2/viewsh.hxx include/svtools/brwbox.hxx include/svtools/filectrl.hxx include/svtools/scrwin.hxx include/svx/dlgctrl.hxx include/svx/sidebar/Popup.hxx include/svx/sidebar/PopupContainer.hxx include/svx/sidebar/PopupControl.hxx include/svx/sidebar/SidebarDialControl.hxx include/svx/sidebar/ValueSetWithTextControl.hxx sc/source/ui/condformat/condformatdlgentry.cxx sc/source/ui/navipi/navipi.cxx sc/source/ui/sidebar/CellBorderStyleControl.hxx sd/source/ui/animations/CustomAnimationDialog.cxx sd/source/ui/inc/DrawViewShell.hxx sd/source/ui/inc/Ruler.hxx sd/source/ui/inc/SlideSorter.hxx sd/source/ui/inc/ViewTabBar.hxx sd/source/ui/inc/Window.hxx sd/source/ui/inc/morphdlg.hxx sd/source/ui/inc/sdpreslt.hxx sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx sd/source/ui/sidebar/LayoutMenu.hxx sd/source/ui/sidebar/MasterPagesSelector.hxx sd/source/ui/sidebar/NavigatorWrapper.hxx sd/source/ui/sidebar/PanelBase.hxx sd/source/ui/sidebar/RecentMasterPagesSelector.cxx sd/source/ui/sidebar/RecentMasterPagesSelector.hxx sd/source/ui/slideshow/showwindow.hxx sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx sd/source/ui/view/ViewShellBase.cxx sd/source/ui/view/drviewsa.cxx sfx2/source/appl/fileobj.hxx sfx2/source/appl/opengrf.cxx sfx2/source/control/thumbnailviewacc.hxx sfx2/source/dialog/securitypage.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/doc/docinsert.cxx sfx2/source/doc/guisaveas.cxx sfx2/source/inc/alienwarn.hxx sfx2/source/sidebar/Deck.cxx sfx2/source/sidebar/Deck.hxx sfx2/source/sidebar/DeckTitleBar.cxx sfx2/source/sidebar/DeckTitleBar.hxx sfx2/source/sidebar/MenuButton.cxx sfx2/source/sidebar/MenuButton.hxx sfx2/source/sidebar/Panel.cxx sfx2/source/sidebar/Panel.hxx sfx2/source/sidebar/PanelTitleBar.hxx sfx2/source/sidebar/SidebarDockingWindow.hxx sfx2/source/sidebar/SidebarToolBox.cxx sfx2/source/sidebar/TabBar.hxx sfx2/source/sidebar/TabItem.cxx sfx2/source/sidebar/TabItem.hxx sfx2/source/sidebar/TitleBar.hxx sfx2/source/toolbox/imgmgr.cxx starmath/inc/edit.hxx starmath/inc/smmod.hxx starmath/qa/cppunit/test_starmath.cxx starmath/source/edit.cxx starmath/source/smmod.cxx svtools/source/brwbox/brwbox1.cxx svtools/source/brwbox/datwin.hxx svtools/source/contnr/fileview.cxx svtools/source/contnr/simptabl.cxx svtools/source/control/filectrl.cxx svtools/source/control/valueimp.hxx svx/inc/GalleryControl.hxx svx/source/dialog/dlgctrl.cxx svx/source/dialog/swframeexample.cxx svx/source/fmcomp/fmgridif.cxx svx/source/gallery2/GalleryControl.cxx svx/source/sidebar/EmptyPanel.hxx svx/source/sidebar/area/AreaPropertyPanel.hxx svx/source/sidebar/area/AreaTransparencyGradientControl.hxx svx/source/sidebar/graphic/GraphicPropertyPanel.hxx svx/source/sidebar/insert/InsertPropertyPanel.cxx svx/source/sidebar/insert/InsertPropertyPanel.hxx svx/source/sidebar/line/LinePropertyPanel.hxx svx/source/sidebar/line/LineWidthControl.cxx svx/source/sidebar/line/LineWidthControl.hxx svx/source/sidebar/line/LineWidthValueSet.hxx svx/source/sidebar/paragraph/ParaPropertyPanel.hxx svx/source/sidebar/possize/SidebarDialControl.cxx svx/source/sidebar/text/TextCharacterSpacingPopup.hxx svx/source/sidebar/text/TextPropertyPanel.hxx svx/source/sidebar/tools/PopupContainer.cxx svx/source/sidebar/tools/PopupControl.cxx svx/source/sidebar/tools/ValueSetWithTextControl.cxx svx/source/svdraw/svdfmtf.hxx svx/source/svdraw/svdibrow.cxx svx/source/tbxctrls/colrctrl.cxx svx/source/tbxctrls/tbcontrl.cxx sw/source/ui/dbui/mmaddressblockpage.cxx sw/source/ui/dialog/uiregionsw.cxx sw/source/ui/index/cnttab.cxx sw/source/uibase/inc/drpcps.hxx sw/source/uibase/sidebar/PageColumnControl.hxx sw/source/uibase/sidebar/PageMarginControl.hxx sw/source/uibase/sidebar/PageOrientationControl.hxx sw/source/uibase/sidebar/PagePropertyPanel.hxx sw/source/uibase/sidebar/PageSizeControl.hxx sw/source/uibase/uiview/view2.cxx sw/source/uibase/utlui/navipi.cxx vcl/inc/svdata.hxx vcl/source/control/combobox.cxx vcl/source/control/lstbox.cxx vcl/source/window/dockwin.cxx vcl/source/window/winproc.cxx Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
Diffstat (limited to 'svx')
-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
182 files changed, 3534 insertions, 2445 deletions
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()