diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 11:41:31 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:08:48 +0100 |
commit | e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch) | |
tree | b322529f4a54a6427862cb20cb4cf87fb6a5d065 /include | |
parent | tdf#86606 Removal of additional direct formatting (diff) | |
parent | Make Window's inDispose map more precisely to mbInDtor. (diff) | |
download | core-e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67.tar.gz core-e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67.zip |
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 'include')
226 files changed, 1614 insertions, 1102 deletions
diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx index 101c6c623dfc..bb24bd08ff0a 100644 --- a/include/avmedia/mediaplayer.hxx +++ b/include/avmedia/mediaplayer.hxx @@ -45,6 +45,7 @@ public: MediaFloater( SfxBindings* pBindings, SfxChildWindow* pCW, vcl::Window* pParent ); virtual ~MediaFloater(); + virtual void dispose() SAL_OVERRIDE; void setURL( const OUString& rURL, const OUString& rReferer, bool bPlayImmediately ); diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx index 4c512979288a..fb61d33b865f 100644 --- a/include/avmedia/mediatoolbox.hxx +++ b/include/avmedia/mediatoolbox.hxx @@ -45,7 +45,7 @@ public: virtual ~MediaToolBoxControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; private: diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx index b17ffe4afbc8..3eeb7078552b 100644 --- a/include/avmedia/mediawindow.hxx +++ b/include/avmedia/mediawindow.hxx @@ -28,6 +28,7 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/uno/XInterface.hpp> #include <vcl/bitmapex.hxx> +#include <vcl/vclptr.hxx> #include <avmedia/avmediadllapi.h> #define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0 @@ -115,7 +116,7 @@ namespace avmedia MediaWindow& operator =( const MediaWindow& ) SAL_DELETED_FUNCTION; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxIFace; - std::unique_ptr<priv::MediaWindowImpl> mpImpl; + VclPtr<priv::MediaWindowImpl> mpImpl; }; } diff --git a/include/dbaccess/ToolBoxHelper.hxx b/include/dbaccess/ToolBoxHelper.hxx index 4757c8ffb802..d9671b45fe3b 100644 --- a/include/dbaccess/ToolBoxHelper.hxx +++ b/include/dbaccess/ToolBoxHelper.hxx @@ -23,6 +23,7 @@ #include <sal/types.h> #include <tools/link.hxx> #include <vcl/image.hxx> +#include <vcl/vclptr.hxx> #include <dbaccess/dbaccessdllapi.h> class SvtMiscOptions; @@ -34,7 +35,7 @@ namespace dbaui class DBACCESS_DLLPUBLIC OToolBoxHelper { sal_Int16 m_nSymbolsSize; // shows the toolbox large or small bitmaps - ToolBox* m_pToolBox; // our toolbox (may be NULL) + VclPtr<ToolBox> m_pToolBox; // our toolbox (may be NULL) public: OToolBoxHelper(); virtual ~OToolBoxHelper(); diff --git a/include/dbaccess/dataview.hxx b/include/dbaccess/dataview.hxx index 8189cc93a4f0..4dabda021210 100644 --- a/include/dbaccess/dataview.hxx +++ b/include/dbaccess/dataview.hxx @@ -37,8 +37,8 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; // the service factory to work with protected: - IController& m_rController; // the controller in where we resides in - FixedLine m_aSeparator; + rtl::Reference<IController> m_xController; // the controller in where we resides in + VclPtr<FixedLine> m_aSeparator; ::std::unique_ptr< ::svt::AcceleratorExecute> m_pAccel; public: @@ -47,6 +47,7 @@ namespace dbaui const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& , WinBits nStyle = 0 ); virtual ~ODataView(); + virtual void dispose() SAL_OVERRIDE; /// late construction virtual void Construct(); @@ -57,7 +58,7 @@ namespace dbaui virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; - inline IController& getCommandController() const { return m_rController; } + inline IController& getCommandController() const { return *m_xController.get(); } /** will be called when the controls need to be resized. */ diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx index 4dffac9b87f7..c98af7393b5e 100644 --- a/include/dbaccess/genericcontroller.hxx +++ b/include/dbaccess/genericcontroller.hxx @@ -59,6 +59,7 @@ #include <boost/optional.hpp> #include <sfx2/userinputinterception.hxx> +#include <vcl/vclptr.hxx> namespace dbtools { @@ -212,7 +213,7 @@ namespace dbaui ::std::unique_ptr< OGenericUnoController_Data > m_pData; - ODataView* m_pView; // our (VCL) "main window" + VclPtr<ODataView> m_pView; // our (VCL) "main window" #ifdef DBG_UTIL bool m_bDescribingSupportedFeatures; @@ -407,8 +408,8 @@ namespace dbaui public: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const { return m_xContext; } ODataView* getView() const { return m_pView; } - void setView( ODataView& i_rView ) { m_pView = &i_rView; } - void clearView() { m_pView = NULL; } + void setView( const VclPtr<ODataView>& i_rView ); + void clearView(); // shows a error box if the SQLExceptionInfo is valid void showError(const ::dbtools::SQLExceptionInfo& _rInfo); diff --git a/include/drawinglayer/processor2d/canvasprocessor.hxx b/include/drawinglayer/processor2d/canvasprocessor.hxx index d928a84a5d35..fb10ad339e0b 100644 --- a/include/drawinglayer/processor2d/canvasprocessor.hxx +++ b/include/drawinglayer/processor2d/canvasprocessor.hxx @@ -71,7 +71,7 @@ namespace drawinglayer { private: // the (current) destination OutDev and canvas - OutputDevice* mpOutputDevice; + VclPtr<OutputDevice> mpOutputDevice; com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > mxCanvas; com::sun::star::rendering::ViewState maViewState; com::sun::star::rendering::RenderState maRenderState; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 12bb7792fe13..9bfb4b4552c8 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -30,6 +30,7 @@ #include <tools/color.hxx> #include <tools/contnr.hxx> #include <vcl/graph.hxx> +#include <vcl/outdev.hxx> #include <tools/link.hxx> #include <rsc/rscsfx.hxx> #include <editeng/editengdllapi.h> @@ -476,7 +477,7 @@ struct EDITENG_DLLPUBLIC PaintFirstLineInfo long mnBaseLineY; const Point& mrOrigin; short mnOrientation; - OutputDevice* mpOutDev; + VclPtr<OutputDevice> mpOutDev; PaintFirstLineInfo( sal_Int32 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev ) diff --git a/include/editeng/splwrap.hxx b/include/editeng/splwrap.hxx index 6c77e530e1e9..5e879f453381 100644 --- a/include/editeng/splwrap.hxx +++ b/include/editeng/splwrap.hxx @@ -23,6 +23,7 @@ #include <editeng/svxenum.hxx> #include <rtl/ustring.hxx> #include <com/sun/star/uno/Reference.hxx> +#include <vcl/vclptr.hxx> // forward --------------------------------------------------------------- @@ -48,7 +49,7 @@ private: friend class SvxHyphenWordDialog; friend struct SvxHyphenWordDialog_Impl; - vcl::Window* pWin; + VclPtr<vcl::Window> pWin; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xLast; // result of last spelling/hyphenation attempt ::com::sun::star::uno::Reference< diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx index bc407057d183..400a49b79876 100644 --- a/include/formula/funcutl.hxx +++ b/include/formula/funcutl.hxx @@ -34,7 +34,7 @@ class FORMULA_DLLPUBLIC RefEdit : public Edit private: Idle aIdle; IControlReferenceHandler* pAnyRefDlg; // parent dialog - vcl::Window* pLabelWidget; + VclPtr<vcl::Window> pLabelWidget; DECL_LINK( UpdateHdl, void* ); @@ -48,6 +48,7 @@ public: RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits nStyle = WB_BORDER ); virtual ~RefEdit(); + virtual void dispose() SAL_OVERRIDE; void SetRefString( const OUString& rStr ); @@ -86,7 +87,7 @@ private: OUString aShrinkQuickHelp; OUString aExpandQuickHelp; IControlReferenceHandler* pAnyRefDlg; // parent dialog - RefEdit* pRefEdit; // zugeordnetes Edit-Control + VclPtr<RefEdit> pRefEdit; // zugeordnetes Edit-Control protected: virtual void Click() SAL_OVERRIDE; @@ -96,6 +97,8 @@ protected: public: RefButton(vcl::Window* _pParent, WinBits nStyle = 0); + virtual ~RefButton(); + virtual void dispose() SAL_OVERRIDE; void SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit ); void SetStartImage(); void SetEndImage(); diff --git a/include/rtl/ref.hxx b/include/rtl/ref.hxx index 942923ad6819..097584b1a276 100644 --- a/include/rtl/ref.hxx +++ b/include/rtl/ref.hxx @@ -49,6 +49,13 @@ public: /** Constructor... */ + inline Reference (reference_type * pBody, __sal_NoAcquire) + : m_pBody (pBody) + { + } + + /** Constructor... + */ inline Reference (reference_type * pBody) : m_pBody (pBody) { @@ -56,7 +63,6 @@ public: m_pBody->acquire(); } - /** Copy constructor... */ inline Reference (const Reference<reference_type> & handle) diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index 5a19603bdca8..99feed27df20 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -81,6 +81,7 @@ protected: public: virtual ~SfxModalDialog(); + virtual void dispose() SAL_OVERRIDE; const SfxItemSet* GetOutputItemSet() const { return pOutputSet; } const SfxItemSet* GetInputItemSet() const { return pInputSet; } }; @@ -102,6 +103,7 @@ protected: SfxModelessDialog( SfxBindings*, SfxChildWindow*, vcl::Window*, const OUString& rID, const OUString& rUIXMLDescription ); virtual ~SfxModelessDialog(); + virtual void dispose() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void Move() SAL_OVERRIDE; @@ -140,6 +142,7 @@ protected: const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); virtual ~SfxFloatingWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; @@ -161,16 +164,12 @@ public: struct SingleTabDlgImpl { - SfxTabPage* m_pSfxPage; - FixedLine* m_pLine; + VclPtr<SfxTabPage> m_pSfxPage; + VclPtr<FixedLine> m_pLine; OUString m_sInfoURL; Link m_aInfoLink; - SingleTabDlgImpl() - : m_pSfxPage(NULL) - , m_pLine(NULL) - { - } + SingleTabDlgImpl(); }; typedef const sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte @@ -187,6 +186,7 @@ public: const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui")); virtual ~SfxSingleTabDialog(); + virtual void dispose() SAL_OVERRIDE; void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0); SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; } @@ -197,9 +197,9 @@ public: protected: GetTabPageRanges fnGetRanges; - OKButton* pOKBtn; - CancelButton* pCancelBtn; - HelpButton* pHelpBtn; + VclPtr<OKButton> pOKBtn; + VclPtr<CancelButton> pCancelBtn; + VclPtr<HelpButton> pHelpBtn; SingleTabDlgImpl* pImpl; diff --git a/include/sfx2/checkin.hxx b/include/sfx2/checkin.hxx index c5d93f68846d..54d2dffa2174 100644 --- a/include/sfx2/checkin.hxx +++ b/include/sfx2/checkin.hxx @@ -16,15 +16,17 @@ class SfxCheckinDialog : public ModalDialog { private: - Edit* m_pCommentED; - CheckBox* m_pMajorCB; + VclPtr<Edit> m_pCommentED; + VclPtr<CheckBox> m_pMajorCB; - OKButton* m_pOKBtn; + VclPtr<OKButton> m_pOKBtn; DECL_DLLPRIVATE_LINK(OKHdl, void *); public: SfxCheckinDialog( vcl::Window* pParent ); + virtual ~SfxCheckinDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetComment( ); bool IsMajor( ); diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index a74b236a3f63..eb43f8e38343 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -124,7 +124,7 @@ struct SfxChildWindow_Impl; class SFX2_DLLPUBLIC SfxChildWindowContext { friend class SfxChildWindow; - vcl::Window* pWindow; + VclPtr<vcl::Window> pWindow; sal_uInt16 nContextId; protected: @@ -148,12 +148,12 @@ public: class SFX2_DLLPUBLIC SfxChildWindow { - vcl::Window* pParent; // parent window ( Topwindow ) - sal_uInt16 nType; // ChildWindow-Id + VclPtr<vcl::Window> pParent; // parent window ( Topwindow ) + sal_uInt16 nType; // ChildWindow-Id protected: SfxChildAlignment eChildAlignment; // Current ::com::sun::star::drawing::Alignment - vcl::Window* pWindow; // actual contents + VclPtr<vcl::Window> pWindow; // actual contents SfxChildWindow_Impl* pImp; // Implementation data private: diff --git a/include/sfx2/ctrlitem.hxx b/include/sfx2/ctrlitem.hxx index aa38dc0e54b9..24f64d9a73c1 100644 --- a/include/sfx2/ctrlitem.hxx +++ b/include/sfx2/ctrlitem.hxx @@ -56,6 +56,7 @@ public: SfxControllerItem(); // for arrays SfxControllerItem( sal_uInt16 nId, SfxBindings & ); virtual ~SfxControllerItem(); + virtual void dispose(); void Bind( sal_uInt16 nNewId, SfxBindings * = 0); // Register in SfxBindings void UnBind(); diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 58c874cba363..babea564b5df 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -180,27 +180,27 @@ public: class SfxDocumentPage : public SfxTabPage { private: - FixedImage* m_pBmp; - SelectableFixedText* m_pNameED; - PushButton* m_pChangePassBtn; + VclPtr<FixedImage> m_pBmp; + VclPtr<SelectableFixedText> m_pNameED; + VclPtr<PushButton> m_pChangePassBtn; - SelectableFixedText* m_pShowTypeFT; - Edit* m_pFileValEd; - SelectableFixedText* m_pShowSizeFT; + VclPtr<SelectableFixedText> m_pShowTypeFT; + VclPtr<Edit> m_pFileValEd; + VclPtr<SelectableFixedText> m_pShowSizeFT; - SelectableFixedText* m_pCreateValFt; - SelectableFixedText* m_pChangeValFt; - SelectableFixedText* m_pSignedValFt; - PushButton* m_pSignatureBtn; - SelectableFixedText* m_pPrintValFt; - SelectableFixedText* m_pTimeLogValFt; - SelectableFixedText* m_pDocNoValFt; + VclPtr<SelectableFixedText> m_pCreateValFt; + VclPtr<SelectableFixedText> m_pChangeValFt; + VclPtr<SelectableFixedText> m_pSignedValFt; + VclPtr<PushButton> m_pSignatureBtn; + VclPtr<SelectableFixedText> m_pPrintValFt; + VclPtr<SelectableFixedText> m_pTimeLogValFt; + VclPtr<SelectableFixedText> m_pDocNoValFt; - CheckBox* m_pUseUserDataCB; - PushButton* m_pDeleteBtn; + VclPtr<CheckBox> m_pUseUserDataCB; + VclPtr<PushButton> m_pDeleteBtn; - FixedText* m_pTemplFt; - SelectableFixedText* m_pTemplValFt; + VclPtr<FixedText> m_pTemplFt; + VclPtr<SelectableFixedText> m_pTemplValFt; OUString m_aUnknownSize; OUString m_aMultiSignedStr; @@ -215,13 +215,15 @@ private: void ImplCheckPasswordState(); protected: - SfxDocumentPage( vcl::Window* pParent, const SfxItemSet& ); + virtual ~SfxDocumentPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* ); + SfxDocumentPage( vcl::Window* pParent, const SfxItemSet& ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); void EnableUseUserData(); }; @@ -231,20 +233,22 @@ public: class SfxDocumentDescPage : public SfxTabPage { private: - Edit* m_pTitleEd; - Edit* m_pThemaEd; - Edit* m_pKeywordsEd; - VclMultiLineEdit* m_pCommentEd; - SfxDocumentInfoItem* m_pInfoItem; + VclPtr<Edit> m_pTitleEd; + VclPtr<Edit> m_pThemaEd; + VclPtr<Edit> m_pKeywordsEd; + VclPtr<VclMultiLineEdit> m_pCommentEd; + SfxDocumentInfoItem* m_pInfoItem; protected: - SfxDocumentDescPage( vcl::Window* pParent, const SfxItemSet& ); + virtual ~SfxDocumentDescPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* ); + SfxDocumentDescPage( vcl::Window* pParent, const SfxItemSet& ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); }; // class SfxDocumentInfoDialog ------------------------------------------- @@ -335,7 +339,6 @@ protected: virtual void RequestHelp(const HelpEvent& rEvt) SAL_OVERRIDE; public: CustomPropertiesDurationField(vcl::Window* pParent, WinBits nStyle, CustomPropertyLine* pLine); - virtual ~CustomPropertiesDurationField(); void SetDuration( const com::sun::star::util::Duration& rDuration ); const com::sun::star::util::Duration& GetDuration() const { return m_aDuration; } @@ -347,7 +350,6 @@ class CustomPropertiesEditButton : public PushButton public: CustomPropertiesEditButton(vcl::Window* pParent, WinBits nStyle, CustomPropertyLine* pLine); - virtual ~CustomPropertiesEditButton(); DECL_LINK(ClickHdl, void *); }; @@ -370,33 +372,35 @@ public: class CustomPropertiesYesNoButton : public Control { private: - RadioButton m_aYesButton; - RadioButton m_aNoButton; + VclPtr<RadioButton> m_aYesButton; + VclPtr<RadioButton> m_aNoButton; public: CustomPropertiesYesNoButton( vcl::Window* pParent, const ResId& rResId ); + virtual ~CustomPropertiesYesNoButton(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; - inline void CheckYes() { m_aYesButton.Check(); } - inline void CheckNo() { m_aNoButton.Check(); } - inline bool IsYesChecked() const { return m_aYesButton.IsChecked(); } + inline void CheckYes() { m_aYesButton->Check(); } + inline void CheckNo() { m_aNoButton->Check(); } + inline bool IsYesChecked() const { return m_aYesButton->IsChecked(); } }; // struct CustomPropertyLine --------------------------------------------- struct CustomPropertyLine { - ComboBox m_aNameBox; - CustomPropertiesTypeBox m_aTypeBox; - CustomPropertiesEdit m_aValueEdit; - CustomPropertiesDateField m_aDateField; - CustomPropertiesTimeField m_aTimeField; - const OUString m_sDurationFormat; - CustomPropertiesDurationField m_aDurationField; - CustomPropertiesEditButton m_aEditButton; - CustomPropertiesYesNoButton m_aYesNoButton; - CustomPropertiesRemoveButton m_aRemoveButton; + VclPtr<ComboBox> m_aNameBox; + VclPtr<CustomPropertiesTypeBox> m_aTypeBox; + VclPtr<CustomPropertiesEdit> m_aValueEdit; + VclPtr<CustomPropertiesDateField> m_aDateField; + VclPtr<CustomPropertiesTimeField> m_aTimeField; + const OUString m_sDurationFormat; + VclPtr<CustomPropertiesDurationField> m_aDurationField; + VclPtr<CustomPropertiesEditButton> m_aEditButton; + VclPtr<CustomPropertiesYesNoButton> m_aYesNoButton; + VclPtr<CustomPropertiesRemoveButton> m_aRemoveButton; bool m_bIsDate; bool m_bIsRemoved; @@ -412,19 +416,19 @@ struct CustomPropertyLine class CustomPropertiesWindow : public vcl::Window { private: - FixedText* m_pHeaderAccName; - FixedText* m_pHeaderAccType; - FixedText* m_pHeaderAccValue; - - ComboBox m_aNameBox; - ListBox m_aTypeBox; - Edit m_aValueEdit; - DateField m_aDateField; - TimeField m_aTimeField; - Edit m_aDurationField; - PushButton m_aEditButton; - CustomPropertiesYesNoButton m_aYesNoButton; - ImageButton m_aRemoveButton; + VclPtr<FixedText> m_pHeaderAccName; + VclPtr<FixedText> m_pHeaderAccType; + VclPtr<FixedText> m_pHeaderAccValue; + + VclPtr<ComboBox> m_aNameBox; + VclPtr<ListBox> m_aTypeBox; + VclPtr<Edit> m_aValueEdit; + VclPtr<DateField> m_aDateField; + VclPtr<TimeField> m_aTimeField; + VclPtr<Edit> m_aDurationField; + VclPtr<PushButton> m_aEditButton; + VclPtr<CustomPropertiesYesNoButton> m_aYesNoButton; + VclPtr<ImageButton> m_aRemoveButton; sal_Int32 m_nLineHeight; sal_Int32 m_nScrollPos; @@ -454,6 +458,7 @@ public: FixedText *pHeaderAccType, FixedText *pHeaderAccValue); virtual ~CustomPropertiesWindow(); + virtual void dispose() SAL_OVERRIDE; bool InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar ); sal_uInt16 GetVisibleLineCount() const; @@ -476,11 +481,11 @@ public: class CustomPropertiesControl : public vcl::Window { private: - VclVBox* m_pVBox; - HeaderBar* m_pHeaderBar; - VclHBox* m_pBody; - CustomPropertiesWindow* m_pPropertiesWin; - ScrollBar* m_pVertScroll; + VclPtr<VclVBox> m_pVBox; + VclPtr<HeaderBar> m_pHeaderBar; + VclPtr<VclHBox> m_pBody; + VclPtr<CustomPropertiesWindow> m_pPropertiesWin; + VclPtr<ScrollBar> m_pVertScroll; sal_Int32 m_nThumbPos; @@ -490,6 +495,7 @@ private: public: CustomPropertiesControl(vcl::Window* pParent); virtual ~CustomPropertiesControl(); + virtual void dispose() SAL_OVERRIDE; void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive ); @@ -507,42 +513,44 @@ public: class SfxCustomPropertiesPage : public SfxTabPage { private: - CustomPropertiesControl* m_pPropertiesCtrl; + VclPtr<CustomPropertiesControl> m_pPropertiesCtrl; DECL_LINK(AddHdl, void *); using TabPage::DeactivatePage; protected: - SfxCustomPropertiesPage( vcl::Window* pParent, const SfxItemSet& ); + virtual ~SfxCustomPropertiesPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; virtual sfxpg DeactivatePage( SfxItemSet* pSet = NULL ) SAL_OVERRIDE; public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* ); + SfxCustomPropertiesPage( vcl::Window* pParent, const SfxItemSet& ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); }; struct CmisValue : public VclBuilderContainer { - Edit* m_aValueEdit; + VclPtr<Edit> m_aValueEdit; CmisValue( vcl::Window* pParent, const OUString& aStr ); }; struct CmisDateTime : public VclBuilderContainer { - DateField* m_aDateField; - TimeField* m_aTimeField; + VclPtr<DateField> m_aDateField; + VclPtr<TimeField> m_aTimeField; CmisDateTime( vcl::Window* pParent, const ::com::sun::star::util::DateTime& aDateTime ); }; struct CmisYesNo : public VclBuilderContainer { - RadioButton* m_aYesButton; - RadioButton* m_aNoButton; + VclPtr<RadioButton> m_aYesButton; + VclPtr<RadioButton> m_aNoButton; CmisYesNo( vcl::Window* pParent, bool bValue); }; @@ -551,15 +559,15 @@ struct CmisYesNo : public VclBuilderContainer struct CmisPropertyLine : public VclBuilderContainer { - VclFrame* m_pFrame; + VclPtr<VclFrame> m_pFrame; OUString m_sId; OUString m_sType; bool m_bUpdatable; bool m_bRequired; bool m_bMultiValued; bool m_bOpenChoice; - FixedText* m_aName; - FixedText* m_aType; + VclPtr<FixedText> m_aName; + VclPtr<FixedText> m_aType; std::vector< CmisValue* > m_aValues; std::vector< CmisDateTime* > m_aDateTimes; std::vector< CmisYesNo* > m_aYesNos; @@ -574,7 +582,7 @@ struct CmisPropertyLine : public VclBuilderContainer class CmisPropertiesWindow { private: - VclBox* m_pBox; + VclPtr<VclBox> m_pBox; sal_Int32 m_nItemHeight; SvNumberFormatter m_aNumberFormatter; std::vector< CmisPropertyLine* > m_aCmisPropertiesLines; @@ -636,14 +644,13 @@ private: DECL_LINK(UpdateHdl, void *); protected: - SfxCmisPropertiesPage( vcl::Window* pParent, const SfxItemSet& ); - virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; virtual sfxpg DeactivatePage( SfxItemSet* pSet = NULL ) SAL_OVERRIDE; public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* ); + SfxCmisPropertiesPage( vcl::Window* pParent, const SfxItemSet& ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); }; #endif // #ifndef _ INCLUDED_SFX2_DINFDLG_HXX diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx index 57f256707658..e5a5ff8a704b 100644 --- a/include/sfx2/dockwin.hxx +++ b/include/sfx2/dockwin.hxx @@ -84,6 +84,7 @@ public: vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription ); virtual ~SfxDockingWindow(); + virtual void dispose() SAL_OVERRIDE; void Initialize (SfxChildWinInfo* pInfo); virtual void FillInfo(SfxChildWinInfo&) const; diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx index 7e66740176ac..1c325b92f628 100644 --- a/include/sfx2/fcontnr.hxx +++ b/include/sfx2/fcontnr.hxx @@ -57,14 +57,13 @@ public: class SfxFrameWindow { - vcl::Window* pWindow; + ScopedVclPtr<vcl::Window> pWindow; public: SfxFrameWindow( vcl::Window *pWin ) : pWindow( pWin ) {} - virtual ~SfxFrameWindow() - { delete pWindow; } + virtual ~SfxFrameWindow() {} vcl::Window* GetWindow() const { return pWindow; } void SetWindow( vcl::Window *pWin ) diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx index fcd6c46c748b..d9c3620ee1eb 100644 --- a/include/sfx2/frame.hxx +++ b/include/sfx2/frame.hxx @@ -29,6 +29,7 @@ #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <vcl/vclptr.hxx> namespace com { @@ -103,7 +104,7 @@ private: SfxFrame* pParentFrame; SfxFrameArr_Impl* pChildArr; SfxFrame_Impl* pImp; - vcl::Window* pWindow; + VclPtr<vcl::Window> pWindow; protected: bool Close(); diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx index eb0c4c6dcb8c..7a89267b3bc5 100644 --- a/include/sfx2/infobar.hxx +++ b/include/sfx2/infobar.hxx @@ -43,16 +43,16 @@ class SFX2_DLLPUBLIC SfxInfoBarContainerChild : public SfxChildWindow class SfxInfoBarWindow : public vcl::Window { private: - OUString m_sId; - - std::unique_ptr<FixedText> m_pMessage; - std::unique_ptr<Button> m_pCloseBtn; - - boost::ptr_vector<PushButton> m_aActionBtns; + OUString m_sId; + VclPtr<FixedText> m_pMessage; + VclPtr<Button> m_pCloseBtn; + std::vector< VclPtr<PushButton> > m_aActionBtns; public: - SfxInfoBarWindow(vcl::Window* parent, const OUString& sId, const OUString& sMessage); + SfxInfoBarWindow( vcl::Window* parent, const OUString& sId, + const OUString& sMessage ); virtual ~SfxInfoBarWindow( ); + virtual void dispose() SAL_OVERRIDE; const OUString& getId() const { return m_sId; } virtual void Paint( const Rectangle& ) SAL_OVERRIDE; @@ -71,12 +71,13 @@ class SfxInfoBarWindow : public vcl::Window class SfxInfoBarContainerWindow : public vcl::Window { private: - SfxInfoBarContainerChild* m_pChildWin; - boost::ptr_vector<SfxInfoBarWindow> m_pInfoBars; + SfxInfoBarContainerChild* m_pChildWin; + std::vector< VclPtr<SfxInfoBarWindow> > m_pInfoBars; public: SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin); virtual ~SfxInfoBarContainerWindow( ); + virtual void dispose() SAL_OVERRIDE; SfxInfoBarWindow* appendInfoBar(const OUString& sId, const OUString& sMessage); SfxInfoBarWindow* getInfoBar(const OUString& sId); diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx index 10ab174bbdbd..9022f73573c7 100644 --- a/include/sfx2/ipclient.hxx +++ b/include/sfx2/ipclient.hxx @@ -29,11 +29,11 @@ #include <tools/gen.hxx> #include <sfx2/objsh.hxx> +#include <vcl/window.hxx> class SfxInPlaceClient_Impl; class SfxViewShell; class SfxObjectShell; -namespace vcl { class Window; } class Fraction; @@ -44,7 +44,7 @@ friend class SfxInPlaceClient_Impl; SfxInPlaceClient_Impl* m_pImp; SfxViewShell* m_pViewSh; - vcl::Window* m_pEditWin; + VclPtr<vcl::Window> m_pEditWin; // called after the requested new object area was negotiated SAL_DLLPRIVATE virtual void ObjectAreaChanged(); diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx index 6b5ba434c562..f8f4b5556be6 100644 --- a/include/sfx2/mgetempl.hxx +++ b/include/sfx2/mgetempl.hxx @@ -36,23 +36,23 @@ class SfxStyleSheetBase; class SfxManageStyleSheetPage : public SfxTabPage { - VclMultiLineEdit* m_pNameRo; - Edit* m_pNameRw; + VclPtr<VclMultiLineEdit> m_pNameRo; + VclPtr<Edit> m_pNameRw; - CheckBox* m_pAutoCB; + VclPtr<CheckBox> m_pAutoCB; - FixedText* m_pFollowFt; - ListBox* m_pFollowLb; - PushButton* m_pEditStyleBtn; + VclPtr<FixedText> m_pFollowFt; + VclPtr<ListBox> m_pFollowLb; + VclPtr<PushButton> m_pEditStyleBtn; - FixedText* m_pBaseFt; - ListBox* m_pBaseLb; - PushButton* m_pEditLinkStyleBtn; + VclPtr<FixedText> m_pBaseFt; + VclPtr<ListBox> m_pBaseLb; + VclPtr<PushButton> m_pEditLinkStyleBtn; - FixedText* m_pFilterFt; - ListBox* m_pFilterLb; + VclPtr<FixedText> m_pFilterFt; + VclPtr<ListBox> m_pFilterLb; - FixedText *m_pDescFt; + VclPtr<FixedText> m_pDescFt; SfxStyleSheetBase *pStyle; SfxStyleFamilies *pFamilies; @@ -79,10 +79,10 @@ friend class SfxStyleDialog; void UpdateName_Impl(ListBox *, const OUString &rNew); void SetDescriptionText_Impl(); - SfxManageStyleSheetPage(vcl::Window *pParent, const SfxItemSet &rAttrSet ); virtual ~SfxManageStyleSheetPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window *pParent, const SfxItemSet *rAttrSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); protected: virtual bool FillItemSet(SfxItemSet *) SAL_OVERRIDE; @@ -95,6 +95,9 @@ protected: virtual void ActivatePage(const SfxItemSet &) SAL_OVERRIDE; using TabPage::DeactivatePage; virtual sfxpg DeactivatePage(SfxItemSet * = 0) SAL_OVERRIDE; + +public: + SfxManageStyleSheetPage(vcl::Window *pParent, const SfxItemSet &rAttrSet ); }; #endif diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx index 4c30e4f2cac4..d98b5c9c190d 100644 --- a/include/sfx2/module.hxx +++ b/include/sfx2/module.hxx @@ -83,7 +83,7 @@ public: void RegisterStatusBarControl(SfxStbCtrlFactory*); void RegisterMenuControl(SfxMenuCtrlFactory*); - virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, + virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ); virtual void Invalidate(sal_uInt16 nId = 0) SAL_OVERRIDE; diff --git a/include/sfx2/new.hxx b/include/sfx2/new.hxx index 48b6dab5cc38..05482a4e1027 100644 --- a/include/sfx2/new.hxx +++ b/include/sfx2/new.hxx @@ -67,6 +67,7 @@ public: SfxNewFileDialog(vcl::Window *pParent, sal_uInt16 nFlags = 0); virtual ~SfxNewFileDialog(); + virtual void dispose() SAL_OVERRIDE; // Returns false, when '- No -' is set as Template // Template names can only be obtained when IsTemplate() returns true. diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx index f0f47e26bb15..1a23a8d78683 100644 --- a/include/sfx2/newstyle.hxx +++ b/include/sfx2/newstyle.hxx @@ -33,10 +33,10 @@ class SfxStyleSheetBasePool; class SFX2_DLLPUBLIC SfxNewStyleDlg : public ModalDialog { private: - ComboBox* m_pColBox; - OKButton* m_pOKBtn; + VclPtr<ComboBox> m_pColBox; + VclPtr<OKButton> m_pOKBtn; - MessageDialog aQueryOverwriteBox; + VclPtr<MessageDialog> aQueryOverwriteBox; SfxStyleSheetBasePool& rPool; DECL_DLLPRIVATE_LINK( OKHdl, Control * ); @@ -45,6 +45,7 @@ private: public: SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& ); virtual ~SfxNewStyleDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetName() const { return comphelper::string::stripStart(m_pColBox->GetText(), ' '); } }; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 041631e3aa01..b9d20fe2d6a1 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -37,6 +37,7 @@ #include <com/sun/star/document/CmisVersion.hpp> #include <vcl/timer.hxx> +#include <vcl/vclptr.hxx> #include <svl/poolitem.hxx> #include <vcl/bitmap.hxx> #include <sot/storage.hxx> @@ -370,7 +371,7 @@ public: SignatureState GetScriptingSignatureState(); void SignScriptingContent(); - virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( + virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet& ); ErrCode CallBasic( const OUString& rMacro, const OUString& rBasicName, diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx index 4b241d0a243c..647776241eaa 100644 --- a/include/sfx2/passwd.hxx +++ b/include/sfx2/passwd.hxx @@ -50,23 +50,23 @@ namespace o3tl class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog { private: - VclFrame* mpPassword1Box; - FixedText* mpUserFT; - Edit* mpUserED; - FixedText* mpPassword1FT; - Edit* mpPassword1ED; - FixedText* mpConfirm1FT; - Edit* mpConfirm1ED; + VclPtr<VclFrame> mpPassword1Box; + VclPtr<FixedText> mpUserFT; + VclPtr<Edit> mpUserED; + VclPtr<FixedText> mpPassword1FT; + VclPtr<Edit> mpPassword1ED; + VclPtr<FixedText> mpConfirm1FT; + VclPtr<Edit> mpConfirm1ED; - VclFrame* mpPassword2Box; - FixedText* mpPassword2FT; - Edit* mpPassword2ED; - FixedText* mpConfirm2FT; - Edit* mpConfirm2ED; + VclPtr<VclFrame> mpPassword2Box; + VclPtr<FixedText> mpPassword2FT; + VclPtr<Edit> mpPassword2ED; + VclPtr<FixedText> mpConfirm2FT; + VclPtr<Edit> mpConfirm2ED; - FixedText* mpMinLengthFT; + VclPtr<FixedText> mpMinLengthFT; - OKButton* mpOKBtn; + VclPtr<OKButton> mpOKBtn; OUString maMinLenPwdStr; OUString maMinLenPwdStr1; @@ -83,6 +83,8 @@ private: public: SfxPasswordDialog(vcl::Window* pParent, const OUString* pGroupText = NULL); + virtual ~SfxPasswordDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetUser() const { diff --git a/include/sfx2/printer.hxx b/include/sfx2/printer.hxx index f07a135c8ece..d419b356507d 100644 --- a/include/sfx2/printer.hxx +++ b/include/sfx2/printer.hxx @@ -51,10 +51,11 @@ public: const JobSetup &rTheOrigJobSetup ); SfxPrinter( const SfxPrinter &rPrinter ); virtual ~SfxPrinter(); + virtual void dispose() SAL_OVERRIDE; - SfxPrinter* Clone() const; + VclPtr<SfxPrinter> Clone() const; - static SfxPrinter* Create( SvStream &rStream, SfxItemSet *pOptions ); + static VclPtr<SfxPrinter> Create( SvStream &rStream, SfxItemSet *pOptions ); SvStream& Store( SvStream &rStream ) const; const JobSetup& GetOrigJobSetup() const { return aOrigJobSetup; } diff --git a/include/sfx2/printopt.hxx b/include/sfx2/printopt.hxx index 3fcf7a0fdd4e..f969b5ff645f 100644 --- a/include/sfx2/printopt.hxx +++ b/include/sfx2/printopt.hxx @@ -41,32 +41,32 @@ class SFX2_DLLPUBLIC SfxCommonPrintOptionsTabPage : public SfxTabPage { private: - RadioButton* m_pPrinterOutputRB; - RadioButton* m_pPrintFileOutputRB; + VclPtr<RadioButton> m_pPrinterOutputRB; + VclPtr<RadioButton> m_pPrintFileOutputRB; - CheckBox* m_pReduceTransparencyCB; - RadioButton* m_pReduceTransparencyAutoRB; - RadioButton* m_pReduceTransparencyNoneRB; + VclPtr<CheckBox> m_pReduceTransparencyCB; + VclPtr<RadioButton> m_pReduceTransparencyAutoRB; + VclPtr<RadioButton> m_pReduceTransparencyNoneRB; - CheckBox* m_pReduceGradientsCB; - RadioButton* m_pReduceGradientsStripesRB; - RadioButton* m_pReduceGradientsColorRB; - NumericField* m_pReduceGradientsStepCountNF; + VclPtr<CheckBox> m_pReduceGradientsCB; + VclPtr<RadioButton> m_pReduceGradientsStripesRB; + VclPtr<RadioButton> m_pReduceGradientsColorRB; + VclPtr<NumericField> m_pReduceGradientsStepCountNF; - CheckBox* m_pReduceBitmapsCB; - RadioButton* m_pReduceBitmapsOptimalRB; - RadioButton* m_pReduceBitmapsNormalRB; - RadioButton* m_pReduceBitmapsResolutionRB; - ListBox* m_pReduceBitmapsResolutionLB; - CheckBox* m_pReduceBitmapsTransparencyCB; + VclPtr<CheckBox> m_pReduceBitmapsCB; + VclPtr<RadioButton> m_pReduceBitmapsOptimalRB; + VclPtr<RadioButton> m_pReduceBitmapsNormalRB; + VclPtr<RadioButton> m_pReduceBitmapsResolutionRB; + VclPtr<ListBox> m_pReduceBitmapsResolutionLB; + VclPtr<CheckBox> m_pReduceBitmapsTransparencyCB; - CheckBox* m_pConvertToGreyscalesCB; + VclPtr<CheckBox> m_pConvertToGreyscalesCB; - CheckBox* m_pPDFCB; + VclPtr<CheckBox> m_pPDFCB; - CheckBox* m_pPaperSizeCB; - CheckBox* m_pPaperOrientationCB; - CheckBox* m_pTransparencyCB; + VclPtr<CheckBox> m_pPaperSizeCB; + VclPtr<CheckBox> m_pPaperOrientationCB; + VclPtr<CheckBox> m_pTransparencyCB; private: @@ -94,14 +94,14 @@ protected: public: SfxCommonPrintOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); - virtual ~SfxCommonPrintOptionsTabPage(); - + virtual ~SfxCommonPrintOptionsTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; virtual vcl::Window* GetParentLabeledBy( const vcl::Window* pLabel ) const SAL_OVERRIDE; virtual vcl::Window* GetParentLabelFor( const vcl::Window* pLabel ) const SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); }; #endif // INCLUDED_SFX2_PRINTOPT_HXX diff --git a/include/sfx2/prnmon.hxx b/include/sfx2/prnmon.hxx index 1468ee81fe82..ff42cb0253df 100644 --- a/include/sfx2/prnmon.hxx +++ b/include/sfx2/prnmon.hxx @@ -38,13 +38,14 @@ private: SfxPrintOptDlg_Impl* pDlgImpl; SfxViewShell* pViewSh; SfxItemSet* pOptions; - SfxTabPage* pPage; + VclPtr<SfxTabPage> pPage; public: SfxPrintOptionsDialog( vcl::Window *pParent, SfxViewShell *pViewShell, const SfxItemSet *rOptions ); virtual ~SfxPrintOptionsDialog(); + virtual void dispose() SAL_OVERRIDE; bool Construct(); virtual short Execute() SAL_OVERRIDE; diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx index 68176cf8a7eb..1affc2e23b58 100644 --- a/include/sfx2/recentdocsview.hxx +++ b/include/sfx2/recentdocsview.hxx @@ -42,7 +42,6 @@ class SFX2_DLLPUBLIC RecentDocsView : public ThumbnailView { public: RecentDocsView( vcl::Window* pParent ); - virtual ~RecentDocsView(); void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId); diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx index 2777088ddc60..84ad9dc0e609 100644 --- a/include/sfx2/securitypage.hxx +++ b/include/sfx2/securitypage.hxx @@ -33,14 +33,12 @@ class SfxSecurityPage : public SfxTabPage std::unique_ptr< SfxSecurityPage_Impl > m_pImpl; protected: - SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& ); - virtual ~SfxSecurityPage(); - virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* ); + SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); }; diff --git a/include/sfx2/sidebar/ControlFactory.hxx b/include/sfx2/sidebar/ControlFactory.hxx index a078e00c20c2..142f249c4627 100644 --- a/include/sfx2/sidebar/ControlFactory.hxx +++ b/include/sfx2/sidebar/ControlFactory.hxx @@ -22,6 +22,7 @@ #include <sfx2/dllapi.h> #include <sfx2/sidebar/SidebarToolBox.hxx> #include <vcl/button.hxx> +#include <vcl/vclptr.hxx> #include <com/sun/star/frame/XFrame.hpp> class ToolBox; @@ -39,9 +40,9 @@ class SFX2_DLLPUBLIC ControlFactory public: /** Create the menu button for the task bar. */ - static CheckBox* CreateMenuButton (vcl::Window* pParentWindow); + static VclPtr<CheckBox> CreateMenuButton (vcl::Window* pParentWindow); - static ImageRadioButton* CreateTabItem (vcl::Window* pParentWindow); + static VclPtr<ImageRadioButton> CreateTabItem (vcl::Window* pParentWindow); }; diff --git a/include/sfx2/sidebar/ControllerItem.hxx b/include/sfx2/sidebar/ControllerItem.hxx index 7210dea31c3d..ef1a6db600fa 100644 --- a/include/sfx2/sidebar/ControllerItem.hxx +++ b/include/sfx2/sidebar/ControllerItem.hxx @@ -80,6 +80,9 @@ public: SfxBindings &rBindings, ItemUpdateReceiverInterface& rItemUpdateReceiver); + /// releases our action listener + virtual void dispose() SAL_OVERRIDE; + virtual ~ControllerItem(); /** Returns </TRUE> when the slot/command has not been disabled. diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx index 2f34065a8480..a60f951b618f 100644 --- a/include/sfx2/sidebar/SidebarPanelBase.hxx +++ b/include/sfx2/sidebar/SidebarPanelBase.hxx @@ -33,6 +33,7 @@ #include <boost/noncopyable.hpp> #include <boost/function.hpp> +#include <vcl/vclptr.hxx> namespace vcl { class Window; } @@ -111,7 +112,7 @@ protected: throw (css::uno::RuntimeException) SAL_OVERRIDE; private: - vcl::Window* mpControl; + VclPtr<vcl::Window> mpControl; const ::rtl::OUString msResourceURL; const css::ui::LayoutSize maLayoutSize; }; diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx index a19e182f648a..129940de2ccf 100644 --- a/include/sfx2/sidebar/SidebarToolBox.hxx +++ b/include/sfx2/sidebar/SidebarToolBox.hxx @@ -41,6 +41,7 @@ class SFX2_DLLPUBLIC SidebarToolBox public: SidebarToolBox(vcl::Window* pParentWindow); virtual ~SidebarToolBox(); + virtual void dispose() SAL_OVERRIDE; using ToolBox::InsertItem; virtual void InsertItem(const OUString& rCommand, diff --git a/include/sfx2/stbitem.hxx b/include/sfx2/stbitem.hxx index 835fcff98b46..9e4850a46e15 100644 --- a/include/sfx2/stbitem.hxx +++ b/include/sfx2/stbitem.hxx @@ -59,9 +59,9 @@ class UserDrawEvent; class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController { - sal_uInt16 nSlotId; - sal_uInt16 nId; - StatusBar* pBar; + sal_uInt16 nSlotId; + sal_uInt16 nId; + VclPtr<StatusBar> pBar; protected: // new controller API diff --git a/include/sfx2/styledlg.hxx b/include/sfx2/styledlg.hxx index 9e9bef903aeb..e837c87d6ae1 100644 --- a/include/sfx2/styledlg.hxx +++ b/include/sfx2/styledlg.hxx @@ -41,6 +41,7 @@ public: const OUString& rUIXMLDescription, SfxStyleSheetBase&); virtual ~SfxStyleDialog(); + virtual void dispose() SAL_OVERRIDE; SfxStyleSheetBase& GetStyleSheet() { return *pStyle; } const SfxStyleSheetBase& GetStyleSheet() const { return *pStyle; } diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index b54d974f306e..88a05b95ea30 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -37,7 +37,7 @@ class SfxViewFrame; class SfxTabPage; class SfxBindings; -typedef SfxTabPage* (*CreateTabPage)(vcl::Window *pParent, const SfxItemSet *rAttrSet); +typedef VclPtr<SfxTabPage> (*CreateTabPage)(vcl::Window *pParent, const SfxItemSet *rAttrSet); typedef const sal_uInt16* (*GetTabPageRanges)(); // provides international Which-value struct TabPageImpl; @@ -64,16 +64,16 @@ friend class SfxTabDialogController; SfxViewFrame* pFrame; - VclBox *m_pBox; - TabControl *m_pTabCtrl; + VclPtr<VclBox> m_pBox; + VclPtr<TabControl> m_pTabCtrl; - PushButton* m_pOKBtn; - PushButton* m_pApplyBtn; - PushButton* m_pUserBtn; - CancelButton* m_pCancelBtn; - HelpButton* m_pHelpBtn; - PushButton* m_pResetBtn; - PushButton* m_pBaseFmtBtn; + VclPtr<PushButton> m_pOKBtn; + VclPtr<PushButton> m_pApplyBtn; + VclPtr<PushButton> m_pUserBtn; + VclPtr<CancelButton> m_pCancelBtn; + VclPtr<HelpButton> m_pHelpBtn; + VclPtr<PushButton> m_pResetBtn; + VclPtr<PushButton> m_pBaseFmtBtn; bool m_bOwnsOKBtn; bool m_bOwnsCancelBtn; @@ -106,7 +106,7 @@ protected: virtual void RefreshInputSet(); virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - VclButtonBox* m_pActionArea; + VclPtr<VclButtonBox> m_pActionArea; SfxItemSet* pExampleSet; SfxItemSet* GetInputSetImpl(); SfxTabPage* GetTabPage( sal_uInt16 nPageId ) const; @@ -129,6 +129,7 @@ public: const OUString& rID, const OUString& rUIXMLDescription, const SfxItemSet * = 0, bool bEditFmt = false); virtual ~SfxTabDialog(); + virtual void dispose() SAL_OVERRIDE; sal_uInt16 AddTabPage( const OString& rName, // Name of the label for the page in the notebook .ui CreateTabPage pCreateFunc, // != 0 @@ -249,6 +250,7 @@ protected: public: virtual ~SfxTabPage(); + virtual void dispose() SAL_OVERRIDE; const SfxItemSet& GetItemSet() const { return *pSet; } diff --git a/include/sfx2/taskpane.hxx b/include/sfx2/taskpane.hxx index dadbdf1d300f..21556961e85f 100644 --- a/include/sfx2/taskpane.hxx +++ b/include/sfx2/taskpane.hxx @@ -163,6 +163,8 @@ namespace sfx2 public: TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, vcl::Window* i_pParent, WinBits i_nBits ); + virtual ~TaskPaneDockingWindow(); + virtual void dispose() SAL_OVERRIDE; // ITaskPaneToolPanelAccess virtual void ActivateToolPanel( const OUString& i_rPanelURL ) SAL_OVERRIDE; @@ -175,8 +177,8 @@ namespace sfx2 virtual void onLayoutDone() SAL_OVERRIDE; private: - ModuleTaskPane m_aTaskPane; - TaskPaneController m_aPaneController; + VclPtr<ModuleTaskPane> m_aTaskPane; + TaskPaneController m_aPaneController; }; diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index b76a9d06980b..402d0c1df6e6 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -151,8 +151,9 @@ public: vcl::Window* pParentWindow, WinBits nBits ); virtual ~SfxPopupWindow(); + virtual void dispose() SAL_OVERRIDE; - virtual SfxPopupWindow* Clone() const; + virtual VclPtr<SfxPopupWindow> Clone() const; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; void StartCascading(); @@ -200,9 +201,9 @@ protected: virtual void DoubleClick(); virtual void Click(); virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); + virtual VclPtr<SfxPopupWindow> CreatePopupWindow(); virtual SfxPopupWindow* CreatePopupWindowCascading(); - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ); + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ); // Must be called by subclass to set a new popup window instance void SetPopupWindow( SfxPopupWindow* pWindow ); @@ -305,7 +306,7 @@ class SfxDragToolBoxControl_Impl : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); SfxDragToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox ); - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE; }; @@ -329,7 +330,7 @@ public: virtual ~SfxRecentFilesToolBoxControl(); protected: - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; class SfxReloadToolBoxControl_Impl : public SfxToolBoxControl diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx index 5509374c25b2..41979ca0dfc6 100644 --- a/include/sfx2/templateabstractview.hxx +++ b/include/sfx2/templateabstractview.hxx @@ -83,7 +83,8 @@ public: TemplateAbstractView(vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren); TemplateAbstractView(vcl::Window* pParent); - virtual ~TemplateAbstractView (); + virtual ~TemplateAbstractView(); + virtual void dispose() SAL_OVERRIDE; void insertItem (const TemplateItemProperties &rTemplate); @@ -137,8 +138,8 @@ protected: sal_uInt16 mnCurRegionId; OUString maCurRegionName; - PushButton maAllButton; - FixedText maFTName; + VclPtr<PushButton> maAllButton; + VclPtr<FixedText> maFTName; Link maOpenRegionHdl; Link maOpenTemplateHdl; diff --git a/include/sfx2/templatedefaultview.hxx b/include/sfx2/templatedefaultview.hxx index 005201b364d7..205083554d52 100644 --- a/include/sfx2/templatedefaultview.hxx +++ b/include/sfx2/templatedefaultview.hxx @@ -17,7 +17,6 @@ class SFX2_DLLPUBLIC TemplateDefaultView : public TemplateLocalView { public: TemplateDefaultView(Window *pParent); - virtual ~TemplateDefaultView(); virtual void reload() SAL_OVERRIDE; protected: diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx index 17ba13a0b432..f26792bb0a04 100644 --- a/include/sfx2/templatedlg.hxx +++ b/include/sfx2/templatedlg.hxx @@ -50,7 +50,8 @@ public: SfxTemplateManagerDlg(vcl::Window *parent = NULL); - virtual ~SfxTemplateManagerDlg (); + virtual ~SfxTemplateManagerDlg(); + virtual void dispose() SAL_OVERRIDE; void setSaveMode(); @@ -142,16 +143,16 @@ private: private: - TabControl *mpTabControl; + VclPtr<TabControl> mpTabControl; - Edit *mpSearchEdit; - ToolBox *mpViewBar; - ToolBox *mpActionBar; - ToolBox *mpTemplateBar; - TemplateSearchView *mpSearchView; - TemplateAbstractView *mpCurView; - TemplateLocalView *mpLocalView; - TemplateRemoteView *mpRemoteView; + VclPtr<Edit> mpSearchEdit; + VclPtr<ToolBox> mpViewBar; + VclPtr<ToolBox> mpActionBar; + VclPtr<ToolBox> mpTemplateBar; + VclPtr<TemplateSearchView> mpSearchView; + VclPtr<TemplateAbstractView> mpCurView; + VclPtr<TemplateLocalView> mpLocalView; + VclPtr<TemplateRemoteView> mpRemoteView; PopupMenu *mpActionMenu; PopupMenu *mpRepositoryMenu; PopupMenu *mpTemplateDefaultMenu; diff --git a/include/sfx2/templateinfodlg.hxx b/include/sfx2/templateinfodlg.hxx index 9f5d9dfd2965..97a711c58028 100644 --- a/include/sfx2/templateinfodlg.hxx +++ b/include/sfx2/templateinfodlg.hxx @@ -27,7 +27,8 @@ public: SfxTemplateInfoDlg (vcl::Window *pParent = NULL); - virtual ~SfxTemplateInfoDlg (); + virtual ~SfxTemplateInfoDlg(); + virtual void dispose() SAL_OVERRIDE; void loadDocument (const OUString &rURL); @@ -37,11 +38,11 @@ protected: private: - PushButton* mpBtnClose; - VclBox* mpBox; + VclPtr<PushButton> mpBtnClose; + VclPtr<VclBox> mpBox; - vcl::Window *mpPreviewView; // gets released when xWindows get destroyed (dont delete in constructor) - svtools::ODocumentInfoPreview *mpInfoView; + VclPtr<vcl::Window> mpPreviewView; // gets released when xWindows get destroyed (dont delete in constructor) + VclPtr<svtools::ODocumentInfoPreview> mpInfoView; ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 > m_xFrame; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow; diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx index 6d2e1d044dcf..123a6f6f13b5 100644 --- a/include/sfx2/templatelocalview.hxx +++ b/include/sfx2/templatelocalview.hxx @@ -32,6 +32,7 @@ public: TemplateLocalView ( vcl::Window* pParent ); virtual ~TemplateLocalView (); + virtual void dispose() SAL_OVERRIDE; // Fill view with template folders thumbnails virtual void Populate () SAL_OVERRIDE; diff --git a/include/sfx2/templateremoteview.hxx b/include/sfx2/templateremoteview.hxx index 6c64e9a6dcaf..ada041dcb85e 100644 --- a/include/sfx2/templateremoteview.hxx +++ b/include/sfx2/templateremoteview.hxx @@ -23,8 +23,6 @@ public: TemplateRemoteView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren); - virtual ~TemplateRemoteView (); - virtual void showRootRegion () SAL_OVERRIDE; virtual void showRegion (ThumbnailViewItem *pItem) SAL_OVERRIDE; diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx index 280610ff3e14..4e9ada86b359 100644 --- a/include/sfx2/templdlg.hxx +++ b/include/sfx2/templdlg.hxx @@ -43,6 +43,7 @@ class SFX2_DLLPUBLIC SfxTemplatePanelControl : public DockingWindow public: SfxTemplatePanelControl (SfxBindings* pBindings, vcl::Window* pParentWindow); virtual ~SfxTemplatePanelControl(); + virtual void dispose() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& _rDCEvt ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -50,7 +51,7 @@ public: void FreeResource(); private: - const std::unique_ptr<SfxTemplateDialog_Impl> pImpl; + std::unique_ptr<SfxTemplateDialog_Impl> pImpl; SfxBindings* mpBindings; }; diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx index 2c9967b601da..0e4a7e0af1cf 100644 --- a/include/sfx2/thumbnailview.hxx +++ b/include/sfx2/thumbnailview.hxx @@ -183,6 +183,7 @@ public: ThumbnailView(vcl::Window* pParent, WinBits nWinStyle = WB_TABSTOP, bool bDisableTransientChildren = false); virtual ~ThumbnailView(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE; @@ -308,7 +309,7 @@ protected: ThumbnailValueItemList mItemList; ThumbnailValueItemList mFilteredItemList; ///< Cache to store the filtered items ThumbnailValueItemList::iterator mpStartSelRange; - ScrollBar* mpScrBar; + VclPtr<ScrollBar> mpScrBar; long mnHeaderHeight; long mnItemWidth; long mnItemHeight; diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx index 9136a5688476..a4c7bbcdb920 100644 --- a/include/sfx2/thumbnailviewitem.hxx +++ b/include/sfx2/thumbnailviewitem.hxx @@ -138,7 +138,7 @@ protected: Rectangle maDrawArea; Link maClickHdl; bool mbEditTitle; - VclMultiLineEdit* mpTitleED; + VclPtr<VclMultiLineEdit> mpTitleED; Rectangle maTextEditMaxArea; }; diff --git a/include/sfx2/titledockwin.hxx b/include/sfx2/titledockwin.hxx index 61db702d236c..44d8a68c511a 100644 --- a/include/sfx2/titledockwin.hxx +++ b/include/sfx2/titledockwin.hxx @@ -24,6 +24,7 @@ #include <sfx2/dockwin.hxx> #include <vcl/toolbox.hxx> +#include <vcl/vclptr.hxx> #include <tools/svborder.hxx> @@ -43,6 +44,7 @@ namespace sfx2 ); virtual ~TitledDockingWindow(); + virtual void dispose() SAL_OVERRIDE; /** sets a title to be displayed in the docking window */ @@ -77,11 +79,11 @@ namespace sfx2 /** returns the content window, which is to be used as parent window for any content to be displayed in the docking window. */ - vcl::Window& GetContentWindow() { return m_aContentWindow; } - const vcl::Window& GetContentWindow() const { return m_aContentWindow; } + vcl::Window& GetContentWindow() { return *m_aContentWindow.get(); } + const vcl::Window& GetContentWindow() const { return *m_aContentWindow.get(); } - ToolBox& GetToolBox() { return m_aToolbox; } - const ToolBox& GetToolBox() const { return m_aToolbox; } + ToolBox& GetToolBox() { return *m_aToolbox.get(); } + const ToolBox& GetToolBox() const { return *m_aToolbox.get(); } /** Return the border that is painted around the inner window as decoration. @@ -126,8 +128,8 @@ namespace sfx2 private: OUString m_sTitle; - ToolBox m_aToolbox; - Window m_aContentWindow; + VclPtr<ToolBox> m_aToolbox; + VclPtr<Window> m_aContentWindow; Link m_aEndDockingHdl; diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index c0f38d1fe436..39effbb31caf 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -37,6 +37,8 @@ #include <tools/errcode.hxx> #include <vcl/jobset.hxx> #include <o3tl/typed_flags_set.hxx> +#include <vcl/vclptr.hxx> +#include <sfx2/tabdlg.hxx> class SfxBaseController; class Size; @@ -51,7 +53,6 @@ class SfxMedium; class SfxModule; class SfxViewFrame; class SfxItemPool; -class SfxTabPage; class SfxFrameSetDescriptor; class Printer; class SfxPrinter; @@ -145,7 +146,7 @@ friend class SfxPrinterController; struct SfxViewShell_Impl* pImp; SfxViewFrame* pFrame; SfxShell* pSubShell; - vcl::Window* pWindow; + VclPtr<vcl::Window> pWindow; bool bNoNewWindow; protected: @@ -233,7 +234,7 @@ public: virtual SfxPrinter* GetPrinter( bool bCreate = false ); virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ); virtual bool HasPrintOptionsPage() const; - virtual SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ); + virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ); static JobSetup GetJobSetup(); Printer* GetActivePrinter() const; @@ -294,7 +295,7 @@ public: SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient *pIP ); SAL_DLLPRIVATE void DiscardClients_Impl(); - SAL_DLLPRIVATE SfxPrinter* SetPrinter_Impl( SfxPrinter *pNewPrinter ); + SAL_DLLPRIVATE SfxPrinter* SetPrinter_Impl( VclPtr<SfxPrinter>& pNewPrinter ); SAL_DLLPRIVATE bool IsShowView_Impl() const; SAL_DLLPRIVATE bool HandleNotifyEvent_Impl( NotifyEvent& rEvent ); diff --git a/include/svtools/DocumentInfoPreview.hxx b/include/svtools/DocumentInfoPreview.hxx index e75877588029..9eba310af05c 100644 --- a/include/svtools/DocumentInfoPreview.hxx +++ b/include/svtools/DocumentInfoPreview.hxx @@ -43,6 +43,7 @@ public: ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits); virtual ~ODocumentInfoPreview(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -54,8 +55,8 @@ public: OUString const & rURL); private: - ExtMultiLineEdit m_pEditWin; - std::unique_ptr< SvtDocInfoTable_Impl > m_xInfoTable; + VclPtr<ExtMultiLineEdit> m_pEditWin; + boost::scoped_ptr< SvtDocInfoTable_Impl > m_xInfoTable; LanguageTag m_aLanguageTag; void insertEntry(OUString const & title, OUString const & value); diff --git a/include/svtools/GraphicExportOptionsDialog.hxx b/include/svtools/GraphicExportOptionsDialog.hxx index 1982aa1bc679..884e08b3e2a2 100644 --- a/include/svtools/GraphicExportOptionsDialog.hxx +++ b/include/svtools/GraphicExportOptionsDialog.hxx @@ -37,9 +37,9 @@ class SVT_DLLPUBLIC GraphicExportOptionsDialog : public ModalDialog { private: - NumericField* mpWidth; - NumericField* mpHeight; - ComboBox* mpResolution; + VclPtr<NumericField> mpWidth; + VclPtr<NumericField> mpHeight; + VclPtr<ComboBox> mpResolution; Size mSize100mm; double mResolution; @@ -63,7 +63,7 @@ private: public: GraphicExportOptionsDialog( vcl::Window* pWindow, const css::uno::Reference<css::lang::XComponent>& rxSourceDocument ); virtual ~GraphicExportOptionsDialog(); - + virtual void dispose() SAL_OVERRIDE; css::uno::Sequence<css::beans::PropertyValue> getFilterData(); }; diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx index 5cdad02f1807..a3e4c2caa77b 100644 --- a/include/svtools/PlaceEditDialog.hxx +++ b/include/svtools/PlaceEditDialog.hxx @@ -27,16 +27,15 @@ class SVT_DLLPUBLIC PlaceEditDialog : public ModalDialog { private : - - Edit* m_pEDServerName; - ListBox* m_pLBServerType; + VclPtr<Edit> m_pEDServerName; + VclPtr<ListBox> m_pLBServerType; std::shared_ptr< DetailsContainer > m_xCurrentDetails; - Edit* m_pEDUsername; - OKButton* m_pBTOk; - CancelButton* m_pBTCancel; + VclPtr<Edit> m_pEDUsername; + VclPtr<OKButton> m_pBTOk; + VclPtr<CancelButton> m_pBTCancel; - PushButton* m_pBTDelete; + VclPtr<PushButton> m_pBTDelete; /** Vector holding the details UI control for each server type. @@ -51,11 +50,12 @@ public : PlaceEditDialog( vcl::Window* pParent); PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Place> &rPlace ); virtual ~PlaceEditDialog(); + virtual void dispose() SAL_OVERRIDE; // Returns a place instance with given information std::shared_ptr<Place> GetPlace(); - OUString GetServerName() { return m_pEDServerName->GetText(); } + OUString GetServerName() { return m_pEDServerName->GetText(); } OUString GetServerUrl(); private: diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx index a4997b3113c7..9c17ecea0191 100644 --- a/include/svtools/ServerDetailsControls.hxx +++ b/include/svtools/ServerDetailsControls.hxx @@ -25,7 +25,7 @@ class DetailsContainer { private: Link m_aChangeHdl; - VclFrame* m_pFrame; + VclPtr<VclFrame> m_pFrame; public: DetailsContainer( VclBuilderContainer* pBuilder, const OString& rFrame ); @@ -57,9 +57,9 @@ class HostDetailsContainer : public DetailsContainer OUString m_sScheme; protected: - Edit* m_pEDHost; - NumericField* m_pEDPort; - Edit* m_pEDPath; + VclPtr<Edit> m_pEDHost; + VclPtr<NumericField> m_pEDPort; + VclPtr<Edit> m_pEDPath; public: HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, const OUString& sScheme ); @@ -81,7 +81,7 @@ class HostDetailsContainer : public DetailsContainer class DavDetailsContainer : public HostDetailsContainer { private: - CheckBox* m_pCBDavs; + VclPtr<CheckBox> m_pCBDavs; public: DavDetailsContainer( VclBuilderContainer* pBuilder ); @@ -99,9 +99,9 @@ class DavDetailsContainer : public HostDetailsContainer class SmbDetailsContainer : public DetailsContainer { private: - Edit* m_pEDHost; - Edit* m_pEDShare; - Edit* m_pEDPath; + VclPtr<Edit> m_pEDHost; + VclPtr<Edit> m_pEDShare; + VclPtr<Edit> m_pEDPath; public: SmbDetailsContainer( VclBuilderContainer* pBuilder ); @@ -120,11 +120,11 @@ class CmisDetailsContainer : public DetailsContainer std::vector< OUString > m_aRepoIds; OUString m_sRepoId; - Edit* m_pEDBinding; - ListBox* m_pLBRepository; - Button* m_pBTRepoRefresh; - ListBox* m_pLBServerType; - Edit* m_pEDPath; + VclPtr<Edit> m_pEDBinding; + VclPtr<ListBox> m_pLBRepository; + VclPtr<Button> m_pBTRepoRefresh; + VclPtr<ListBox> m_pLBServerType; + VclPtr<Edit> m_pEDPath; public: CmisDetailsContainer( VclBuilderContainer* pBuilder ); diff --git a/include/svtools/accessibleruler.hxx b/include/svtools/accessibleruler.hxx index 0c286ee73cd2..b8811613da1b 100644 --- a/include/svtools/accessibleruler.hxx +++ b/include/svtools/accessibleruler.hxx @@ -38,6 +38,7 @@ #include <comphelper/broadcasthelper.hxx> #include <cppuhelper/implbase5.hxx> #include <comphelper/servicehelper.hxx> +#include <vcl/vclptr.hxx> namespace com { namespace sun { namespace star { namespace awt { struct Point; @@ -198,7 +199,7 @@ private: mxParent; /// pointer to internal representation - Ruler* mpRepr; + VclPtr<Ruler> mpRepr; /// client id in the AccessibleEventNotifier queue sal_uInt32 mnClientId; diff --git a/include/svtools/addresstemplate.hxx b/include/svtools/addresstemplate.hxx index d771efb5e473..28bc7edfcc1d 100644 --- a/include/svtools/addresstemplate.hxx +++ b/include/svtools/addresstemplate.hxx @@ -48,10 +48,10 @@ namespace svt { private: // Controls - ComboBox* m_pDatasource; - PushButton* m_pAdministrateDatasources; - ComboBox* m_pTable; - ScrollBar* m_pFieldScroller; + VclPtr<ComboBox> m_pDatasource; + VclPtr<PushButton> m_pAdministrateDatasources; + VclPtr<ComboBox> m_pTable; + VclPtr<ScrollBar> m_pFieldScroller; // string to display for "no selection" const OUString m_sNoFieldSelection; @@ -100,6 +100,7 @@ namespace svt ); virtual ~AddressBookSourceDialog(); + virtual void dispose() SAL_OVERRIDE; // to be used if the object was constructed for editing a field mapping only void getFieldMapping( diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index 8ad76b82caab..fb8fc3a63aa1 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -22,6 +22,7 @@ #include <svtools/svtdllapi.h> #include <vcl/scrbar.hxx> #include <vcl/ctrl.hxx> +#include <vcl/vclptr.hxx> #include <tools/multisel.hxx> #include <svtools/headbar.hxx> #include <svtools/transfer.hxx> @@ -129,9 +130,9 @@ namespace o3tl class BrowseEvent { - vcl::Window* pWin; - long nRow; - Rectangle aRect; + VclPtr<vcl::Window> pWin; + long nRow; + Rectangle aRect; sal_uInt16 nCol; sal_uInt16 nColId; @@ -142,10 +143,10 @@ public: sal_uInt16 nColumn, sal_uInt16 nColumnId, const Rectangle& rRect ); - vcl::Window* GetWindow() const { return pWin; } + vcl::Window* GetWindow() const { return pWin; } long GetRow() const { return nRow; } - sal_uInt16 GetColumn() const { return nCol; } - sal_uInt16 GetColumnId() const { return nColId; } + sal_uInt16 GetColumn() const { return nCol; } + sal_uInt16 GetColumnId() const { return nColId; } const Rectangle& GetRect() const { return aRect; } }; @@ -218,9 +219,9 @@ public: static const sal_uInt16 HandleColumnId = 0; private: - vcl::Window* pDataWin; // window to display data rows - ScrollBar* pVScroll; // vertical scrollbar - ScrollBar aHScroll; // horizontal scrollbar + VclPtr<vcl::Window> pDataWin; // window to display data rows + VclPtr<ScrollBar> pVScroll; // vertical scrollbar + VclPtr<ScrollBar> aHScroll; // horizontal scrollbar long nDataRowHeight; // height of a single data-row sal_uInt16 nTitleLines; // number of lines in title row @@ -391,7 +392,7 @@ protected: void DoHideCursor( const char *pWhoLog ); short GetCursorHideCount() const; - virtual BrowserHeader* CreateHeaderBar( BrowseBox* pParent ); + virtual VclPtr<BrowserHeader> CreateHeaderBar( BrowseBox* pParent ); // HACK(virtual create is not called in Ctor) void SetHeaderBar( BrowserHeader* ); @@ -423,7 +424,8 @@ public: BrowserMode nMode = BrowserMode::NONE ); BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode = BrowserMode::NONE ); - virtual ~BrowseBox(); + virtual ~BrowseBox(); + virtual void dispose() SAL_OVERRIDE; // override inherited handler virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; diff --git a/include/svtools/brwhead.hxx b/include/svtools/brwhead.hxx index e60949100731..c82ccace0601 100644 --- a/include/svtools/brwhead.hxx +++ b/include/svtools/brwhead.hxx @@ -29,8 +29,11 @@ class BrowseBox; class SVT_DLLPUBLIC BrowserHeader: public HeaderBar { - BrowseBox* _pBrowseBox; + VclPtr<BrowseBox> _pBrowseBox; +public: + virtual ~BrowserHeader(); + virtual void dispose() SAL_OVERRIDE; protected: virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE; virtual void Select() SAL_OVERRIDE; diff --git a/include/svtools/calendar.hxx b/include/svtools/calendar.hxx index e970842480a7..48173a37003c 100644 --- a/include/svtools/calendar.hxx +++ b/include/svtools/calendar.hxx @@ -258,7 +258,8 @@ protected: public: Calendar( vcl::Window* pParent, WinBits nWinStyle = 0 ); - virtual ~Calendar(); + virtual ~Calendar(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; @@ -400,11 +401,11 @@ method in CalendarField and create an own calendar there ourselves. class SVT_DLLPUBLIC CalendarField : public DateField { private: - ImplCFieldFloatWin* mpFloatWin; - Calendar* mpCalendar; + VclPtr<ImplCFieldFloatWin> mpFloatWin; + VclPtr<Calendar> mpCalendar; WinBits mnCalendarStyle; - PushButton* mpTodayBtn; - PushButton* mpNoneBtn; + VclPtr<PushButton> mpTodayBtn; + VclPtr<PushButton> mpNoneBtn; Date maDefaultDate; bool mbToday; bool mbNone; @@ -416,12 +417,13 @@ private: public: CalendarField( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~CalendarField(); + virtual ~CalendarField(); + virtual void dispose() SAL_OVERRIDE; void Select(); virtual bool ShowDropDown( bool bShow ) SAL_OVERRIDE; - Calendar* CreateCalendar( vcl::Window* pParent ); + VclPtr<Calendar> CreateCalendar( vcl::Window* pParent ); Calendar* GetCalendar(); void SetDefaultDate( const Date& rDate ) { maDefaultDate = rDate; } diff --git a/include/svtools/colrdlg.hxx b/include/svtools/colrdlg.hxx index 1919ba0666c4..4fe31bfa1d8a 100644 --- a/include/svtools/colrdlg.hxx +++ b/include/svtools/colrdlg.hxx @@ -21,7 +21,7 @@ #define INCLUDED_SVTOOLS_COLRDLG_HXX #include <svtools/svtdllapi.h> - +#include <vcl/vclptr.hxx> #include <tools/color.hxx> namespace vcl { class Window; } @@ -50,9 +50,9 @@ public: short Execute(); private: - vcl::Window* mpParent; - Color maColor; - sal_Int16 meMode; + VclPtr<vcl::Window> mpParent; + Color maColor; + sal_Int16 meMode; }; #endif // INCLUDED_SVTOOLS_COLRDLG_HXX diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index fe29ee120083..a38f00940fb2 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -155,6 +155,7 @@ public: WinBits nWinStyle = WB_BORDER ); ColorListBox( vcl::Window* pParent, const ResId& rResId ); virtual ~ColorListBox(); + virtual void dispose() SAL_OVERRIDE; virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE; @@ -287,7 +288,7 @@ class SVT_DLLPUBLIC LineListBox : public ListBox long m_nWidth; OUString m_sNone; - VirtualDevice aVirDev; + ScopedVclPtr<VirtualDevice> aVirDev; Size aTxtSize; Color aColor; Color maPaintCol; @@ -311,6 +312,7 @@ public: LineListBox( vcl::Window* pParent, WinBits nWinStyle = WB_BORDER ); virtual ~LineListBox(); + virtual void dispose() SAL_OVERRIDE; /** Set the width in Twips */ void SetWidth( long nWidth ); @@ -408,6 +410,7 @@ public: FontNameBox( vcl::Window* pParent, WinBits nWinStyle = WB_SORT ); virtual ~FontNameBox(); + virtual void dispose() SAL_OVERRIDE; virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE; @@ -433,7 +436,6 @@ private: using ComboBox::SetText; public: FontStyleBox( vcl::Window* pParent, WinBits nBits ); - virtual ~FontStyleBox(); virtual void Select() SAL_OVERRIDE; virtual void LoseFocus() SAL_OVERRIDE; @@ -477,7 +479,6 @@ protected: public: FontSizeBox( vcl::Window* pParent, WinBits nWinStyle = 0 ); - virtual ~FontSizeBox(); void Reformat() SAL_OVERRIDE; void Modify() SAL_OVERRIDE; diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx index 5ff6a2df5510..c6be1c49acf7 100644 --- a/include/svtools/ctrltool.hxx +++ b/include/svtools/ctrltool.hxx @@ -147,8 +147,8 @@ private: OUString maBlack; OUString maBlackItalic; sal_IntPtr* mpSizeAry; - OutputDevice* mpDev; - OutputDevice* mpDev2; + VclPtr<OutputDevice> mpDev; + VclPtr<OutputDevice> mpDev2; boost::ptr_vector<ImplFontListNameInfo> maEntries; SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const; diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index 43320ef78185..dbc921b58d80 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -85,7 +85,7 @@ namespace svt friend class EditBrowseBox; protected: - Control* pWindow; + VclPtr<Control> pWindow; bool bSuspended; // <true> if the window is hidden and disabled public: @@ -279,13 +279,14 @@ namespace svt class SVT_DLLPUBLIC CheckBoxControl : public Control { - CheckBox* pBox; + VclPtr<CheckBox> pBox; Rectangle aFocusRect; Link m_aClickLink,m_aModifyLink; public: CheckBoxControl(vcl::Window* pParent, WinBits nWinStyle = 0); virtual ~CheckBoxControl(); + virtual void dispose() SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; virtual bool PreNotify(NotifyEvent& rEvt) SAL_OVERRIDE; @@ -479,7 +480,7 @@ namespace svt aOldController; ImplSVEvent * nStartEvent, * nEndEvent, * nCellModifiedEvent; // event ids - vcl::Window* m_pFocusWhileRequest; + VclPtr<vcl::Window> m_pFocusWhileRequest; // In ActivateCell, we grab the focus asynchronously, but if between requesting activation // and the asynchornous event the focus has changed, we won't grab it for ourself. @@ -491,14 +492,14 @@ namespace svt mutable bool bPaintStatus : 1; // paint a status (image) in the handle column bool bActiveBeforeTracking; - CheckBoxControl* pCheckBoxPaint; + VclPtr<CheckBoxControl> pCheckBoxPaint; EditBrowseBoxFlags m_nBrowserFlags; ImageList m_aStatusImages; ::std::unique_ptr< EditBrowseBoxImpl> m_aImpl; protected: - BrowserHeader* pHeader; + VclPtr<BrowserHeader> pHeader; bool isGetCellFocusPending() const { return nStartEvent != 0; } void cancelGetCellFocus() { if (nStartEvent) Application::RemoveUserEvent(nStartEvent); nStartEvent = 0; } @@ -509,10 +510,10 @@ namespace svt protected: BrowserHeader* GetHeaderBar() const {return pHeader;} - virtual BrowserHeader* CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE; + virtual VclPtr<BrowserHeader> CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE; // if you want to have an own header ... - virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent); + virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent); virtual void ColumnMoved(sal_uInt16 nId) SAL_OVERRIDE; virtual void ColumnResized(sal_uInt16 nColId) SAL_OVERRIDE; @@ -598,6 +599,7 @@ namespace svt EditBrowseBox(vcl::Window* pParent, EditBrowseBoxFlags nBrowserFlags = EditBrowseBoxFlags::NONE, WinBits nBits = WB_TABSTOP, BrowserMode nMode = BrowserMode::NONE ); EditBrowseBox(vcl::Window* pParent, const ResId& rId, EditBrowseBoxFlags nBrowserFlags = EditBrowseBoxFlags::NONE, BrowserMode nMode = BrowserMode::NONE ); virtual ~EditBrowseBox(); + virtual void dispose() SAL_OVERRIDE; bool IsEditing() const {return aController.Is();} void InvalidateStatusCell(long nRow) {RowModified(nRow, 0);} diff --git a/include/svtools/editsyntaxhighlighter.hxx b/include/svtools/editsyntaxhighlighter.hxx index 5099750026b2..be6da6e118e2 100644 --- a/include/svtools/editsyntaxhighlighter.hxx +++ b/include/svtools/editsyntaxhighlighter.hxx @@ -40,7 +40,6 @@ class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public MultiLineEdit public: MultiLineEditSyntaxHighlight( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = HIGHLIGHT_SQL); - virtual ~MultiLineEditSyntaxHighlight(); virtual void UpdateData() SAL_OVERRIDE; virtual void SetText(const OUString& rNewText) SAL_OVERRIDE; diff --git a/include/svtools/filectrl.hxx b/include/svtools/filectrl.hxx index 53486c0e4d35..20506dbd7b51 100644 --- a/include/svtools/filectrl.hxx +++ b/include/svtools/filectrl.hxx @@ -54,8 +54,8 @@ namespace o3tl class SVT_DLLPUBLIC FileControl : public vcl::Window { private: - Edit maEdit; - PushButton maButton; + VclPtr<Edit> maEdit; + VclPtr<PushButton> maButton; OUString maButtonText; bool mbOpenDlg; @@ -77,10 +77,11 @@ protected: public: FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode = FileControlMode::NONE ); - virtual ~FileControl(); + virtual ~FileControl(); + virtual void dispose() SAL_OVERRIDE; - Edit& GetEdit() { return maEdit; } - PushButton& GetButton() { return maButton; } + Edit& GetEdit() { return *maEdit.get(); } + PushButton& GetButton() { return *maButton.get(); } void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; @@ -89,13 +90,13 @@ public: void SetText( const OUString& rStr ) SAL_OVERRIDE; OUString GetText() const SAL_OVERRIDE; - OUString GetSelectedText() const { return maEdit.GetSelected(); } + OUString GetSelectedText() const { return maEdit->GetSelected(); } - void SetSelection( const Selection& rSelection ) { maEdit.SetSelection( rSelection ); } - Selection GetSelection() const { return maEdit.GetSelection(); } + void SetSelection( const Selection& rSelection ) { maEdit->SetSelection( rSelection ); } + Selection GetSelection() const { return maEdit->GetSelection(); } - void SetReadOnly( bool bReadOnly = true ) { maEdit.SetReadOnly( bReadOnly ); } - bool IsReadOnly() const { return maEdit.IsReadOnly(); } + void SetReadOnly( bool bReadOnly = true ) { maEdit->SetReadOnly( bReadOnly ); } + bool IsReadOnly() const { return maEdit->IsReadOnly(); } //use this to manipulate the dialog bevore executing it: diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx index 27384412655a..690efd1aa076 100644 --- a/include/svtools/fileview.hxx +++ b/include/svtools/fileview.hxx @@ -76,6 +76,7 @@ protected: public: SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection ); virtual ~SvtFileView(); + virtual void dispose() SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE; @@ -205,10 +206,12 @@ enum QueryDeleteResult_Impl class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public MessageDialog { private: - PushButton* m_pAllButton; + VclPtr<PushButton> m_pAllButton; public: QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& rName); + virtual ~QueryDeleteDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; void EnableAllButton() { m_pAllButton->Enable(true); } }; diff --git a/include/svtools/fmtfield.hxx b/include/svtools/fmtfield.hxx index 9e8eaf7fe4cb..562cf5ca14f5 100644 --- a/include/svtools/fmtfield.hxx +++ b/include/svtools/fmtfield.hxx @@ -95,7 +95,6 @@ protected: public: FormattedField(vcl::Window* pParent, WinBits nStyle = 0, SvNumberFormatter* pInitialFormatter = NULL, sal_Int32 nFormatKey = 0); - virtual ~FormattedField(); // Min-/Max-management bool HasMinValue() const { return m_bHasMin; } @@ -270,6 +269,7 @@ public: } virtual ~DoubleNumericField(); + virtual void dispose() SAL_OVERRIDE; protected: virtual bool CheckText(const OUString& sText) const SAL_OVERRIDE; diff --git a/include/svtools/generictoolboxcontroller.hxx b/include/svtools/generictoolboxcontroller.hxx index 15b542cc3458..d5bf7d7fc51d 100644 --- a/include/svtools/generictoolboxcontroller.hxx +++ b/include/svtools/generictoolboxcontroller.hxx @@ -50,8 +50,8 @@ class SVT_DLLPUBLIC GenericToolboxController : public svt::ToolboxController DECL_STATIC_LINK( GenericToolboxController, ExecuteHdl_Impl, ExecuteInfo* ); private: - ToolBox* m_pToolbox; - sal_uInt16 m_nID; + VclPtr<ToolBox> m_pToolbox; + sal_uInt16 m_nID; }; } diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx index f0445ff96405..072516f3d5ce 100644 --- a/include/svtools/genericunodialog.hxx +++ b/include/svtools/genericunodialog.hxx @@ -38,6 +38,7 @@ #include <comphelper/propertycontainer.hxx> #include <comphelper/broadcasthelper.hxx> #include <tools/link.hxx> +#include <vcl/vclptr.hxx> class Dialog; namespace vcl { class Window; } @@ -73,7 +74,7 @@ namespace svt ::osl::Mutex m_aExecutionMutex; /// access safety for execute/cancel protected: - Dialog* m_pDialog; /// the dialog to execute + VclPtr<Dialog> m_pDialog; /// the dialog to execute bool m_bExecuting : 1; /// we're currently executing the dialog bool m_bCanceled : 1; /// endDialog was called while we were executing bool m_bTitleAmbiguous : 1; /// m_sTitle has not been set yet @@ -124,7 +125,7 @@ namespace svt but the application-wide solar mutex is (to guard the not thread-safe ctor of the dialog). @param pParent the parent window for the new dialog */ - virtual Dialog* createDialog(vcl::Window* _pParent) = 0; + virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) = 0; /// called to destroy the dialog used. the default implementation just deletes m_pDialog and resets it to NULL virtual void destroyDialog(); diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx index acdb018a59ae..27fd4e8f7865 100644 --- a/include/svtools/headbar.hxx +++ b/include/svtools/headbar.hxx @@ -288,6 +288,7 @@ private: public: HeaderBar( vcl::Window* pParent, WinBits nWinBits = WB_STDHEADERBAR ); virtual ~HeaderBar(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/hyperlabel.hxx b/include/svtools/hyperlabel.hxx index eacfe4896372..cdda74067bab 100644 --- a/include/svtools/hyperlabel.hxx +++ b/include/svtools/hyperlabel.hxx @@ -32,7 +32,7 @@ namespace svt { - class HyperLabelImpl; + class HyperLabelImpl; class HyperLabel : public FixedText { @@ -54,6 +54,7 @@ namespace svt public: HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle = 0 ); virtual ~HyperLabel( ); + virtual void dispose() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx index 7d2d4f5ccbee..35a0893ec09f 100644 --- a/include/svtools/inettbc.hxx +++ b/include/svtools/inettbc.hxx @@ -63,6 +63,7 @@ public: SvtURLBox( vcl::Window* pParent, WinBits _nStyle, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true ); SvtURLBox( vcl::Window* pParent, const ResId& _rResId, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true ); virtual ~SvtURLBox(); + virtual void dispose() SAL_OVERRIDE; void SetBaseURL( const OUString& rURL ); const OUString& GetBaseURL() const { return aBaseURL; } diff --git a/include/svtools/ivctrl.hxx b/include/svtools/ivctrl.hxx index c48803c88ee9..d862e7d0b31c 100644 --- a/include/svtools/ivctrl.hxx +++ b/include/svtools/ivctrl.hxx @@ -268,6 +268,7 @@ public: SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle = WB_ICON | WB_BORDER ); virtual ~SvtIconChoiceCtrl(); + virtual void dispose() SAL_OVERRIDE; void SetStyle( WinBits nWinStyle ); WinBits GetStyle() const; diff --git a/include/svtools/popupwindowcontroller.hxx b/include/svtools/popupwindowcontroller.hxx index d505e2f04dc2..a455670b8c95 100644 --- a/include/svtools/popupwindowcontroller.hxx +++ b/include/svtools/popupwindowcontroller.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <svtools/toolboxcontroller.hxx> +#include <vcl/vclptr.hxx> namespace vcl { class Window; } @@ -40,7 +41,7 @@ public: const OUString& aCommandURL ); virtual ~PopupWindowController(); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) = 0; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) = 0; // XInterface virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/include/svtools/prnsetup.hxx b/include/svtools/prnsetup.hxx index b7ed0fd8f3dc..62d430a053c3 100644 --- a/include/svtools/prnsetup.hxx +++ b/include/svtools/prnsetup.hxx @@ -40,16 +40,16 @@ class QueueInfo; class SVT_DLLPUBLIC PrinterSetupDialog : public ModalDialog { private: - ListBox* m_pLbName; - PushButton* m_pBtnProperties; - PushButton* m_pBtnOptions; - FixedText* m_pFiStatus; - FixedText* m_pFiType; - FixedText* m_pFiLocation; - FixedText* m_pFiComment; - AutoTimer maStatusTimer; - Printer* mpPrinter; - Printer* mpTempPrinter; + VclPtr<ListBox> m_pLbName; + VclPtr<PushButton> m_pBtnProperties; + VclPtr<PushButton> m_pBtnOptions; + VclPtr<FixedText> m_pFiStatus; + VclPtr<FixedText> m_pFiType; + VclPtr<FixedText> m_pFiLocation; + VclPtr<FixedText> m_pFiComment; + AutoTimer maStatusTimer; + VclPtr<Printer> mpPrinter; + VclPtr<Printer> mpTempPrinter; SVT_DLLPRIVATE void ImplSetInfo(); @@ -60,7 +60,8 @@ private: public: PrinterSetupDialog( vcl::Window* pWindow ); - virtual ~PrinterSetupDialog(); + virtual ~PrinterSetupDialog(); + virtual void dispose() SAL_OVERRIDE; void SetPrinter( Printer* pNewPrinter ) { mpPrinter = pNewPrinter; } Printer* GetPrinter() const { return mpPrinter; } diff --git a/include/svtools/roadmapwizard.hxx b/include/svtools/roadmapwizard.hxx index 578ba284adb8..237d0f17d78b 100644 --- a/include/svtools/roadmapwizard.hxx +++ b/include/svtools/roadmapwizard.hxx @@ -36,7 +36,7 @@ namespace svt public: typedef sal_Int16 PathId; typedef ::std::vector< WizardTypes::WizardState > WizardPath; - typedef TabPage* (* RoadmapPageFactory)( RoadmapWizard& ); + typedef VclPtr<TabPage> (* RoadmapPageFactory)( RoadmapWizard& ); }; @@ -77,6 +77,7 @@ namespace svt sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP ); virtual ~RoadmapWizard( ); + virtual void dispose() SAL_OVERRIDE; void SetRoadmapHelpId( const OString& _rId ); @@ -89,7 +90,7 @@ namespace svt virtual bool canAdvance() const SAL_OVERRIDE; virtual void updateTravelUI() SAL_OVERRIDE; -protected: + protected: /** declares a valid path in the wizard The very first path which is declared is automatically activated. @@ -207,7 +208,7 @@ protected: This member is inherited from OWizardMachine, and default-implemented in this class for all states which have been described using describeState. */ - virtual TabPage* createPage( WizardState _nState ) SAL_OVERRIDE; + virtual VclPtr<TabPage> createPage( WizardState _nState ) SAL_OVERRIDE; /** asks for a new label of the wizard page diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index 76a7bc57889d..0f9f68359533 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -606,7 +606,7 @@ class ImplRulerData; class SVT_DLLPUBLIC Ruler : public vcl::Window { private: - VirtualDevice maVirDev; + ScopedVclPtr<VirtualDevice> maVirDev; MapMode maMapMode; long mnBorderOff; long mnWinOff; @@ -708,6 +708,7 @@ protected: public: Ruler( vcl::Window* pParent, WinBits nWinStyle = WB_STDRULER ); virtual ~Ruler(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/scrwin.hxx b/include/svtools/scrwin.hxx index 4e034e69f82d..2396725af54c 100644 --- a/include/svtools/scrwin.hxx +++ b/include/svtools/scrwin.hxx @@ -23,6 +23,7 @@ #include <svtools/svtdllapi.h> #include <vcl/scrbar.hxx> #include <o3tl/typed_flags_set.hxx> +#include <vcl/vclptr.hxx> class DataChangedEvent; @@ -54,9 +55,9 @@ private: long nLinePixH; // size of a line/column (pixel) long nColumnPixW; - ScrollBar aVScroll; // the scrollbars - ScrollBar aHScroll; - ScrollBarBox aCornerWin; // window in the bottom right corner + VclPtr<ScrollBar> aVScroll; // the scrollbars + VclPtr<ScrollBar> aHScroll; + VclPtr<ScrollBarBox> aCornerWin; // window in the bottom right corner bool bScrolling:1, // user controlled scrolling bHandleDragging:1, // scroll window while dragging bHCenter:1, @@ -69,6 +70,8 @@ private: public: ScrollableWindow( vcl::Window* pParent, WinBits nBits = 0, ScrollableWindowFlags = ScrollableWindowFlags::DEFAULT ); + virtual ~ScrollableWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE; diff --git a/include/svtools/simptabl.hxx b/include/svtools/simptabl.hxx index e3fc9f9cb929..07eb53d48e59 100644 --- a/include/svtools/simptabl.hxx +++ b/include/svtools/simptabl.hxx @@ -29,13 +29,15 @@ class SvSimpleTable; class SVT_DLLPUBLIC SvSimpleTableContainer : public Control { private: - SvSimpleTable* m_pTable; + VclPtr<SvSimpleTable> m_pTable; protected: virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; public: SvSimpleTableContainer( vcl::Window* pParent, WinBits nBits = WB_BORDER ); + virtual ~SvSimpleTableContainer(); + virtual void dispose() SAL_OVERRIDE; void SetTable(SvSimpleTable* pTable); @@ -53,7 +55,7 @@ private: Link aHeaderBarDblClickLink; Link aCommandLink; CommandEvent aCEvt; - HeaderBar aHeaderBar; + VclPtr<HeaderBar> aHeaderBar; long nOldPos; sal_uInt16 nHeaderItemId; bool bPaintFlag; @@ -89,6 +91,7 @@ public: SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER); virtual ~SvSimpleTable(); + virtual void dispose() SAL_OVERRIDE; void UpdateViewSize(); @@ -126,9 +129,9 @@ public: void SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; } const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; } - void SetHeaderBarHelpId(const OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);} + void SetHeaderBarHelpId(const OString& rHelpId) { aHeaderBar->SetHelpId(rHelpId); } - HeaderBar& GetTheHeaderBar() {return aHeaderBar;} + HeaderBar& GetTheHeaderBar() { return *aHeaderBar.get(); } }; diff --git a/include/svtools/svmedit.hxx b/include/svtools/svmedit.hxx index 33c2b90fe6f2..0c322f267e04 100644 --- a/include/svtools/svmedit.hxx +++ b/include/svtools/svmedit.hxx @@ -27,7 +27,6 @@ #include <svtools/colorcfg.hxx> - class SVT_DLLPUBLIC MultiLineEdit : public VclMultiLineEdit { public: diff --git a/include/svtools/svmedit2.hxx b/include/svtools/svmedit2.hxx index 2e17023629c9..d6c30d26872b 100644 --- a/include/svtools/svmedit2.hxx +++ b/include/svtools/svmedit2.hxx @@ -28,7 +28,6 @@ class SVT_DLLPUBLIC ExtMultiLineEdit : public MultiLineEdit { public: ExtMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER ); - virtual ~ExtMultiLineEdit(); // methods of TextView void InsertText( const OUString& rNew, bool bSelect = false ); @@ -37,7 +36,7 @@ public: // methods of TextEngine void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd ); void SetLeftMargin( sal_uInt16 nLeftMargin ); - sal_uLong GetParagraphCount() const; + sal_uLong GetParagraphCount() const; }; #endif diff --git a/include/svtools/svtabbx.hxx b/include/svtools/svtabbx.hxx index dcded33f9c90..5d1d9e1320b9 100644 --- a/include/svtools/svtabbx.hxx +++ b/include/svtools/svtabbx.hxx @@ -65,8 +65,9 @@ protected: public: SvTabListBox( vcl::Window* pParent, WinBits = WB_BORDER ); virtual ~SvTabListBox(); + virtual void dispose() SAL_OVERRIDE; void SetTabs(const long* pTabs, MapUnit = MAP_APPFONT); - sal_uInt16 TabCount() const { return (sal_uInt16)nTabCount; } + sal_uInt16 TabCount() const { return (sal_uInt16)nTabCount; } using SvTreeListBox::GetTab; long GetTab( sal_uInt16 nTab ) const; void SetTab( sal_uInt16 nTab, long nValue, MapUnit = MAP_APPFONT ); @@ -139,6 +140,7 @@ private: public: SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits ); virtual ~SvHeaderTabListBox(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& ) SAL_OVERRIDE; diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx index 7e5dc03e90ad..fc44b0f75d3b 100644 --- a/include/svtools/tabbar.hxx +++ b/include/svtools/tabbar.hxx @@ -315,6 +315,8 @@ class SVT_DLLPUBLIC TabBar : public vcl::Window private: std::unique_ptr<TabBar_Impl> mpImpl; + ImplTabBarList* mpItemList; + OUString maEditText; Color maSelColor; Color maSelTextColor; @@ -384,6 +386,7 @@ public: TabBar( vcl::Window* pParent, WinBits nWinStyle = WB_STDTABBAR ); virtual ~TabBar(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx index 2b20a31c5f2f..7c679ac5bdb3 100644 --- a/include/svtools/toolbarmenu.hxx +++ b/include/svtools/toolbarmenu.hxx @@ -51,6 +51,7 @@ public: WinBits nBits ); virtual ~ToolbarMenu(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; @@ -68,7 +69,7 @@ public: void appendSeparator(); /** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */ - ValueSet* createEmptyValueSetControl(); + VclPtr<ValueSet> createEmptyValueSetControl(); void checkEntry( int nEntryId, bool bCheck = true ); diff --git a/include/svtools/toolpanel/drawerlayouter.hxx b/include/svtools/toolpanel/drawerlayouter.hxx index cba7f020e735..e35d0dd211c9 100644 --- a/include/svtools/toolpanel/drawerlayouter.hxx +++ b/include/svtools/toolpanel/drawerlayouter.hxx @@ -29,12 +29,8 @@ namespace svt { - - class ToolPanelViewShell; class ToolPanelDrawer; - typedef std::shared_ptr< ToolPanelDrawer > PToolPanelDrawer; - //= ToolPanelDrawer @@ -79,7 +75,7 @@ namespace svt private: vcl::Window& m_rParentWindow; IToolPanelDeck& m_rPanelDeck; - ::std::vector< PToolPanelDrawer > m_aDrawers; + ::std::vector< VclPtr<ToolPanelDrawer> > m_aDrawers; ::boost::optional< size_t > m_aLastKnownActivePanel; }; diff --git a/include/svtools/toolpanel/paneltabbar.hxx b/include/svtools/toolpanel/paneltabbar.hxx index 18e4d1ea1197..3e20b2dede70 100644 --- a/include/svtools/toolpanel/paneltabbar.hxx +++ b/include/svtools/toolpanel/paneltabbar.hxx @@ -52,6 +52,7 @@ namespace svt public: PanelTabBar( vcl::Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); virtual ~PanelTabBar(); + virtual void dispose() SAL_OVERRIDE; // attribute access TabItemContent GetTabItemContent() const; diff --git a/include/svtools/toolpanel/toolpaneldeck.hxx b/include/svtools/toolpanel/toolpaneldeck.hxx index d9c06ced6771..211c099deb93 100644 --- a/include/svtools/toolpanel/toolpaneldeck.hxx +++ b/include/svtools/toolpanel/toolpaneldeck.hxx @@ -138,6 +138,7 @@ namespace svt public: ToolPanelDeck( vcl::Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL ); virtual ~ToolPanelDeck(); + virtual void dispose() SAL_OVERRIDE; // attributes PDeckLayouter GetLayouter() const; diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index 3f74b4c7fa37..7d55c17ad403 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -373,6 +373,7 @@ public: SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 ); SvTreeListBox( vcl::Window* pParent, const ResId& rResId ); virtual ~SvTreeListBox(); + virtual void dispose() SAL_OVERRIDE; SvTreeList* GetModel() const { @@ -385,11 +386,11 @@ public: sal_uLong GetEntryCount() const { - return pModel->GetEntryCount(); + return pModel ? pModel->GetEntryCount() : 0; } SvTreeListEntry* First() const { - return pModel->First(); + return pModel ? pModel->First() : NULL; } SvTreeListEntry* Next( SvTreeListEntry* pEntry, sal_uInt16* pDepth = 0 ) const { @@ -401,7 +402,7 @@ public: } SvTreeListEntry* Last() const { - return pModel->Last(); + return pModel ? pModel->Last() : NULL; } SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const; @@ -820,7 +821,7 @@ public: struct SvLBoxDDInfo { Application* pApp; - SvTreeListBox* pSource; + VclPtr<SvTreeListBox> pSource; SvTreeListEntry* pDDStartEntry; // Relative position in the Entry at DragBeginn (IconView) long nMouseRelX,nMouseRelY; @@ -833,7 +834,7 @@ class SvInplaceEdit2 Accelerator aAccReturn; Accelerator aAccEscape; Idle aIdle; - Edit* pEdit; + VclPtr<Edit> pEdit; bool bCanceled; bool bAlreadyInCallBack; diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index baebae42db8c..a6a8e5e47ffc 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -197,11 +197,11 @@ class SVT_DLLPUBLIC ValueSet : public Control { private: - VirtualDevice maVirDev; + ScopedVclPtr<VirtualDevice> maVirDev; Timer maTimer; ValueItemList mItemList; ValueSetItemPtr mpNoneItem; - std::unique_ptr<ScrollBar> mxScrollBar; + VclPtr<ScrollBar> mxScrollBar; Rectangle maNoneItemRect; Rectangle maItemListRect; long mnItemWidth; @@ -284,7 +284,8 @@ protected: public: ValueSet( vcl::Window* pParent, WinBits nWinStyle, bool bDisableTransientChildren = false ); ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false ); - virtual ~ValueSet(); + virtual ~ValueSet(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/wizardmachine.hxx b/include/svtools/wizardmachine.hxx index b5cd150dee07..6865c4e2e74a 100644 --- a/include/svtools/wizardmachine.hxx +++ b/include/svtools/wizardmachine.hxx @@ -100,6 +100,7 @@ namespace svt */ OWizardPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription); virtual ~OWizardPage(); + virtual void dispose() SAL_OVERRIDE; // IWizardPageController overridables virtual void initializePage() SAL_OVERRIDE; @@ -154,15 +155,14 @@ namespace svt // So use the travelXXX methods if you need to travel protected: - OKButton* m_pFinish; - CancelButton* m_pCancel; - PushButton* m_pNextPage; - PushButton* m_pPrevPage; - HelpButton* m_pHelp; + VclPtr<OKButton> m_pFinish; + VclPtr<CancelButton> m_pCancel; + VclPtr<PushButton> m_pNextPage; + VclPtr<PushButton> m_pPrevPage; + VclPtr<HelpButton> m_pHelp; private: - WizardMachineImplData* - m_pImpl; + WizardMachineImplData* m_pImpl; // hold members in this structure to allow keeping compatible when members are added SVT_DLLPRIVATE void addButtons(vcl::Window* _pParent, sal_uInt32 _nButtonFlags); @@ -175,6 +175,7 @@ namespace svt OWizardMachine(vcl::Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags ); OWizardMachine(vcl::Window* _pParent, sal_uInt32 _nButtonFlags ); virtual ~OWizardMachine(); + virtual void dispose() SAL_OVERRIDE; /// enable (or disable) buttons void enableButtons(sal_uInt32 _nWizardButtonFlags, bool _bEnable); @@ -205,7 +206,7 @@ namespace svt // our own overridables /// to override to create new pages - virtual TabPage* createPage(WizardState _nState) = 0; + virtual VclPtr<TabPage> createPage(WizardState _nState) = 0; /// will be called when a new page is about to be displayed virtual void enterState(WizardState _nState); diff --git a/include/svtools/wizdlg.hxx b/include/svtools/wizdlg.hxx index a8c7e4e332f7..00f9d95b9db7 100644 --- a/include/svtools/wizdlg.hxx +++ b/include/svtools/wizdlg.hxx @@ -202,10 +202,10 @@ private: Size maPageSize; ImplWizPageData* mpFirstPage; ImplWizButtonData* mpFirstBtn; - TabPage* mpCurTabPage; - PushButton* mpPrevBtn; - PushButton* mpNextBtn; - vcl::Window* mpViewWindow; + VclPtr<TabPage> mpCurTabPage; + VclPtr<PushButton> mpPrevBtn; + VclPtr<PushButton> mpNextBtn; + VclPtr<vcl::Window> mpViewWindow; sal_uInt16 mnCurLevel; WindowAlign meViewAlign; Link maActivateHdl; @@ -242,6 +242,7 @@ public: WizardDialog( vcl::Window* pParent, WinBits nStyle = WB_STDTABDIALOG ); WizardDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ); virtual ~WizardDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; @@ -272,7 +273,7 @@ public: PushButton* GetNextButton() const { return mpNextBtn; } void SetViewWindow( vcl::Window* pWindow ) { mpViewWindow = pWindow; } - vcl::Window* GetViewWindow() const { return mpViewWindow; } + vcl::Window* GetViewWindow() const { return mpViewWindow; } void SetViewAlign( WindowAlign eAlign ) { meViewAlign = eAlign; } WindowAlign GetViewAlign() const { return meViewAlign; } diff --git a/include/svx/AccessibleShapeTreeInfo.hxx b/include/svx/AccessibleShapeTreeInfo.hxx index 65aae3bd00eb..aca3221ffc52 100644 --- a/include/svx/AccessibleShapeTreeInfo.hxx +++ b/include/svx/AccessibleShapeTreeInfo.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/frame/XController.hpp> #include <svx/IAccessibleViewForwarder.hxx> #include <svx/svxdllapi.h> +#include <vcl/vclptr.hxx> class SdrView; namespace vcl { class Window; } @@ -176,7 +177,7 @@ private: /** This window is necessary to construct an SvxTextEditSource which in turn is used to create an accessible edit engine. */ - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; /** The view forwarder allows the transformation between internal and pixel coordinates and can be asked for the visible area. diff --git a/include/svx/ParaLineSpacingPopup.hxx b/include/svx/ParaLineSpacingPopup.hxx index ba8cebc6e103..1460c744f384 100644 --- a/include/svx/ParaLineSpacingPopup.hxx +++ b/include/svx/ParaLineSpacingPopup.hxx @@ -39,7 +39,7 @@ public: virtual ~ParaLineSpacingPopup(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; } // namespace svx diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx index 7be37ee40177..81bdd06253cd 100644 --- a/include/svx/bmpmask.hxx +++ b/include/svx/bmpmask.hxx @@ -81,33 +81,33 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxBmpMask : public SfxDockingWindow friend class MaskData; friend class MaskSet; - ToolBox* m_pTbxPipette; - ColorWindow* m_pCtlPipette; - PushButton* m_pBtnExec; - - CheckBox* m_pCbx1; - MaskSet* m_pQSet1; - MetricField* m_pSp1; - ColorLB* m_pLbColor1; - - CheckBox* m_pCbx2; - MaskSet* m_pQSet2; - MetricField* m_pSp2; - ColorLB* m_pLbColor2; - - CheckBox* m_pCbx3; - MaskSet* m_pQSet3; - MetricField* m_pSp3; - ColorLB* m_pLbColor3; - - CheckBox* m_pCbx4; - MaskSet* m_pQSet4; - MetricField* m_pSp4; - ColorLB* m_pLbColor4; + VclPtr<ToolBox> m_pTbxPipette; + VclPtr<ColorWindow> m_pCtlPipette; + VclPtr<PushButton> m_pBtnExec; + + VclPtr<CheckBox> m_pCbx1; + VclPtr<MaskSet> m_pQSet1; + VclPtr<MetricField> m_pSp1; + VclPtr<ColorLB> m_pLbColor1; + + VclPtr<CheckBox> m_pCbx2; + VclPtr<MaskSet> m_pQSet2; + VclPtr<MetricField> m_pSp2; + VclPtr<ColorLB> m_pLbColor2; + + VclPtr<CheckBox> m_pCbx3; + VclPtr<MaskSet> m_pQSet3; + VclPtr<MetricField> m_pSp3; + VclPtr<ColorLB> m_pLbColor3; + + VclPtr<CheckBox> m_pCbx4; + VclPtr<MaskSet> m_pQSet4; + VclPtr<MetricField> m_pSp4; + VclPtr<ColorLB> m_pLbColor4; MaskData* pData; - CheckBox* m_pCbxTrans; - ColorLB* m_pLbColorTrans; + VclPtr<CheckBox> m_pCbxTrans; + VclPtr<ColorLB> m_pLbColorTrans; XColorListRef pColLst; Color aPipetteColor; @@ -135,6 +135,7 @@ public: SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* pParent); virtual ~SvxBmpMask(); + virtual void dispose() SAL_OVERRIDE; void SetColor( const Color& rColor ); void PipetteClicked(); diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx index fd9a1d00c15d..cf05bf2764a3 100644 --- a/include/svx/charmap.hxx +++ b/include/svx/charmap.hxx @@ -22,6 +22,8 @@ #include <vcl/ctrl.hxx> #include <vcl/metric.hxx> #include <vcl/scrbar.hxx> +#include <vcl/vclptr.hxx> +#include <boost/shared_ptr.hpp> #include <map> #include <memory> #include <svx/svxdllapi.h> @@ -44,6 +46,7 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxShowCharSet : public Control public: SvxShowCharSet( vcl::Window* pParent ); virtual ~SvxShowCharSet(); + virtual void dispose() SAL_OVERRIDE; void SetFont( const vcl::Font& rFont ); @@ -71,7 +74,7 @@ public: static sal_uInt16 GetRowPos(sal_uInt16 _nPos); static sal_uInt16 GetColumnPos(sal_uInt16 _nPos); - ScrollBar& getScrollBar() { return aVscrollSB;} + ScrollBar& getScrollBar() { return *aVscrollSB.get();} void ReleaseAccessible(); sal_Int32 getMaxCharCount() const; @@ -112,7 +115,7 @@ private: sal_Int32 nSelectedIndex; FontCharMapPtr mpFontCharMap; - ScrollBar aVscrollSB; + VclPtr<ScrollBar> aVscrollSB; private: void DrawChars_Impl( int n1, int n2); diff --git a/include/svx/checklbx.hxx b/include/svx/checklbx.hxx index dd15c8a66c07..63db8545c3bd 100644 --- a/include/svx/checklbx.hxx +++ b/include/svx/checklbx.hxx @@ -46,6 +46,7 @@ public: SvxCheckListBox( vcl::Window* pParent, WinBits nWinStyle = 0 ); void SetNormalStaticImage(const Image& rNormalStaticImage); virtual ~SvxCheckListBox(); + virtual void dispose() SAL_OVERRIDE; void InsertEntry ( const OUString& rStr, sal_uLong nPos = TREELIST_APPEND, diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx index 07c5bbb0dc70..64ed0d94e832 100644 --- a/include/svx/clipboardctl.hxx +++ b/include/svx/clipboardctl.hxx @@ -45,7 +45,7 @@ public: virtual ~SvxClipBoardControl(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; diff --git a/include/svx/colrctrl.hxx b/include/svx/colrctrl.hxx index 0987da9dea53..04e67f1f0a9f 100644 --- a/include/svx/colrctrl.hxx +++ b/include/svx/colrctrl.hxx @@ -26,6 +26,7 @@ #include <svl/lstner.hxx> #include <svx/svxdllapi.h> #include <svx/xtable.hxx> +#include <vcl/vclptr.hxx> class SvData; @@ -75,7 +76,7 @@ friend class SvxColorChildWindow; private: XColorListRef pColorList; - SvxColorValueSet_docking aColorSet; + VclPtr<SvxColorValueSet_docking> aColorSet; sal_uInt16 nLeftSlot; sal_uInt16 nRightSlot; sal_uInt16 nCols; @@ -103,6 +104,7 @@ public: SfxChildWindow *pCW, vcl::Window* pParent); virtual ~SvxColorDockingWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; diff --git a/include/svx/compressgraphicdialog.hxx b/include/svx/compressgraphicdialog.hxx index 17aa10ad09a2..ba5e51aa52c1 100644 --- a/include/svx/compressgraphicdialog.hxx +++ b/include/svx/compressgraphicdialog.hxx @@ -33,22 +33,22 @@ class SdrGrafObj; class SVX_DLLPUBLIC SAL_WARN_UNUSED CompressGraphicsDialog : public ModalDialog { private: - FixedText* m_pLabelGraphicType; - FixedText* m_pFixedText2; - FixedText* m_pFixedText3; - FixedText* m_pFixedText5; - FixedText* m_pFixedText6; - - CheckBox* m_pReduceResolutionCB; - NumericField* m_pMFNewWidth; - NumericField* m_pMFNewHeight; - ComboBox* m_pResolutionLB; - RadioButton* m_pLosslessRB; - RadioButton* m_pJpegCompRB; - NumericField* m_pCompressionMF; - NumericField* m_pQualityMF; - PushButton* m_pBtnCalculate; - ListBox* m_pInterpolationCombo; + VclPtr<FixedText> m_pLabelGraphicType; + VclPtr<FixedText> m_pFixedText2; + VclPtr<FixedText> m_pFixedText3; + VclPtr<FixedText> m_pFixedText5; + VclPtr<FixedText> m_pFixedText6; + + VclPtr<CheckBox> m_pReduceResolutionCB; + VclPtr<NumericField> m_pMFNewWidth; + VclPtr<NumericField> m_pMFNewHeight; + VclPtr<ComboBox> m_pResolutionLB; + VclPtr<RadioButton> m_pLosslessRB; + VclPtr<RadioButton> m_pJpegCompRB; + VclPtr<NumericField> m_pCompressionMF; + VclPtr<NumericField> m_pQualityMF; + VclPtr<PushButton> m_pBtnCalculate; + VclPtr<ListBox> m_pInterpolationCombo; SdrGrafObj* m_pGraphicObj; Graphic m_aGraphic; @@ -83,8 +83,8 @@ private: public: CompressGraphicsDialog( vcl::Window* pParent, SdrGrafObj* pGraphicObj, SfxBindings& rBindings ); CompressGraphicsDialog( vcl::Window* pParent, Graphic& rGraphic, Size rViewSize100mm, Rectangle& rCropRectangle, SfxBindings& rBindings ); - virtual ~CompressGraphicsDialog(); + virtual void dispose() SAL_OVERRIDE; SdrGrafObj* GetCompressedSdrGrafObj(); Graphic GetCompressedGraphic(); diff --git a/include/svx/connctrl.hxx b/include/svx/connctrl.hxx index 7febedffef35..1c037d88584c 100644 --- a/include/svx/connctrl.hxx +++ b/include/svx/connctrl.hxx @@ -46,6 +46,7 @@ private: public: SvxXConnectionPreview( vcl::Window* pParent, WinBits nStyle); virtual ~SvxXConnectionPreview(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; diff --git a/include/svx/contdlg.hxx b/include/svx/contdlg.hxx index 57080eb7da0f..de25491cb15c 100644 --- a/include/svx/contdlg.hxx +++ b/include/svx/contdlg.hxx @@ -47,18 +47,19 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxContourDlg : public SfxFloatingWindow { using Window::Update; - SvxSuperContourDlg* pSuperClass; + VclPtr<SvxSuperContourDlg> pSuperClass; protected: - void SetSuperClass( SvxSuperContourDlg& rSuperClass ) { pSuperClass = &rSuperClass; } + void SetSuperClass( SvxSuperContourDlg& rSuperClass ); public: SvxContourDlg(SfxBindings *pBindings, SfxChildWindow *pCW, vcl::Window* pParent); - virtual ~SvxContourDlg(); + virtual ~SvxContourDlg(); + virtual void dispose() SAL_OVERRIDE; const Graphic& GetGraphic() const; bool IsGraphicChanged() const; diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx index 160ef1000237..83c590d57ac0 100644 --- a/include/svx/ctredlin.hxx +++ b/include/svx/ctredlin.hxx @@ -116,6 +116,7 @@ public: SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER); virtual ~SvxRedlinTable(); + virtual void dispose() SAL_OVERRIDE; // For FilterPage only { void SetFilterDate(bool bFlag=true); @@ -179,25 +180,25 @@ private: Link aRefLink; Link aModifyComLink; - SvxRedlinTable* pRedlinTable; - CheckBox* m_pCbDate; - ListBox* m_pLbDate; - DateField* m_pDfDate; - TimeField* m_pTfDate; - PushButton* m_pIbClock; - FixedText* m_pFtDate2; - DateField* m_pDfDate2; - TimeField* m_pTfDate2; - PushButton* m_pIbClock2; - CheckBox* m_pCbAuthor; - ListBox* m_pLbAuthor; - CheckBox* m_pCbRange; - Edit* m_pEdRange; - PushButton* m_pBtnRange; - CheckBox* m_pCbAction; - ListBox* m_pLbAction; - CheckBox* m_pCbComment; - Edit* m_pEdComment; + VclPtr<SvxRedlinTable> pRedlinTable; + VclPtr<CheckBox> m_pCbDate; + VclPtr<ListBox> m_pLbDate; + VclPtr<DateField> m_pDfDate; + VclPtr<TimeField> m_pTfDate; + VclPtr<PushButton> m_pIbClock; + VclPtr<FixedText> m_pFtDate2; + VclPtr<DateField> m_pDfDate2; + VclPtr<TimeField> m_pTfDate2; + VclPtr<PushButton> m_pIbClock2; + VclPtr<CheckBox> m_pCbAuthor; + VclPtr<ListBox> m_pLbAuthor; + VclPtr<CheckBox> m_pCbRange; + VclPtr<Edit> m_pEdRange; + VclPtr<PushButton> m_pBtnRange; + VclPtr<CheckBox> m_pCbAction; + VclPtr<ListBox> m_pLbAction; + VclPtr<CheckBox> m_pCbComment; + VclPtr<Edit> m_pEdComment; bool bModified; DECL_LINK( SelDateHdl, ListBox* ); @@ -215,6 +216,8 @@ protected: public: SvxTPFilter( vcl::Window * pParent); + virtual ~SvxTPFilter(); + virtual void dispose() SAL_OVERRIDE; virtual void DeactivatePage() SAL_OVERRIDE; void SetRedlinTable(SvxRedlinTable*); @@ -304,12 +307,12 @@ private: Link RejectAllClickLk; Link UndoClickLk; - SvxRedlinTable* m_pViewData; - PushButton* m_pAccept; - PushButton* m_pReject; - PushButton* m_pAcceptAll; - PushButton* m_pRejectAll; - PushButton* m_pUndo; + VclPtr<SvxRedlinTable> m_pViewData; + VclPtr<PushButton> m_pAccept; + VclPtr<PushButton> m_pReject; + VclPtr<PushButton> m_pAcceptAll; + VclPtr<PushButton> m_pRejectAll; + VclPtr<PushButton> m_pUndo; bool bEnableAccept; bool bEnableAcceptAll; @@ -322,6 +325,7 @@ private: public: SvxTPView(vcl::Window * pParent, VclBuilderContainer *pTopLevel); virtual ~SvxTPView(); + virtual void dispose() SAL_OVERRIDE; void InsertWriterHeader(); void InsertCalcHeader(); @@ -370,8 +374,8 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxAcceptChgCtr { private: - SvxTPFilter* pTPFilter; - SvxTPView* pTPView; + VclPtr<SvxTPFilter> pTPFilter; + VclPtr<SvxTPView> pTPView; sal_uInt16 m_nViewPageId; sal_uInt16 m_nFilterPageId; @@ -380,6 +384,7 @@ public: SvxAcceptChgCtr(vcl::Window* pParent, VclBuilderContainer* pTopLevel); virtual ~SvxAcceptChgCtr(); + virtual void dispose() SAL_OVERRIDE; void ShowFilterPage(); void ShowViewPage(); diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx index 36ac077369d9..9477de1f7a9b 100644 --- a/include/svx/dialcontrol.hxx +++ b/include/svx/dialcontrol.hxx @@ -80,8 +80,6 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED DialControl : public Control public: explicit DialControl( vcl::Window* pParent, WinBits nBits ); - virtual ~DialControl(); - virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; @@ -126,11 +124,11 @@ public: protected: struct DialControl_Impl { - std::unique_ptr<DialControlBmp> mxBmpEnabled; - std::unique_ptr<DialControlBmp> mxBmpDisabled; - std::unique_ptr<DialControlBmp> mxBmpBuffered; + ScopedVclPtr<DialControlBmp> mxBmpEnabled; + ScopedVclPtr<DialControlBmp> mxBmpDisabled; + ScopedVclPtr<DialControlBmp> mxBmpBuffered; Link maModifyHdl; - NumericField* mpLinkField; + VclPtr<NumericField> mpLinkField; sal_Int32 mnLinkedFieldValueMultiplyer; Size maWinSize; vcl::Font maWinFont; diff --git a/include/svx/dlgctl3d.hxx b/include/svx/dlgctl3d.hxx index 09b1c52c55d1..a9eab331774b 100644 --- a/include/svx/dlgctl3d.hxx +++ b/include/svx/dlgctl3d.hxx @@ -51,6 +51,7 @@ protected: public: Svx3DPreviewControl(vcl::Window* pParent, WinBits nStyle = 0); virtual ~Svx3DPreviewControl(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; @@ -104,7 +105,6 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED Svx3DLightControl : public Svx3DPreviewContr public: Svx3DLightControl(vcl::Window* pParent, WinBits nStyle = 0); - virtual ~Svx3DLightControl(); virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE; virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE; @@ -145,18 +145,19 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxLightCtl3D : public Control { private: // local controls - Svx3DLightControl maLightControl; - ScrollBar maHorScroller; - ScrollBar maVerScroller; - PushButton maSwitcher; + VclPtr<Svx3DLightControl> maLightControl; + VclPtr<ScrollBar> maHorScroller; + VclPtr<ScrollBar> maVerScroller; + VclPtr<PushButton> maSwitcher; // callback for interactive changes - Link maUserInteractiveChangeCallback; - Link maUserSelectionChangeCallback; + Link maUserInteractiveChangeCallback; + Link maUserSelectionChangeCallback; public: SvxLightCtl3D(vcl::Window* pParent); virtual ~SvxLightCtl3D(); + virtual void dispose() SAL_OVERRIDE; // react to size changes virtual void Resize() SAL_OVERRIDE; @@ -166,7 +167,7 @@ public: void CheckSelection(); // bring further settings to the outside world - Svx3DLightControl& GetSvx3DLightControl() { return maLightControl; } + Svx3DLightControl& GetSvx3DLightControl() { return *maLightControl.get(); } // register user callback void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; } diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 95713734122a..119aafa84290 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -100,6 +100,7 @@ public: void SetControlSettings(RECT_POINT eRpt = RP_MM, sal_uInt16 nBorder = 200, sal_uInt16 nCircle = 80, CTL_STYLE eStyle = CS_RECT); virtual ~SvxRectCtl(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; @@ -179,6 +180,7 @@ public: SvxPixelCtl( vcl::Window* pParent, sal_uInt16 nNumber = 8 ); virtual ~SvxPixelCtl(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; @@ -322,7 +324,6 @@ private: public: LineLB(vcl::Window* pParent, WinBits aWB); - virtual ~LineLB(); void Fill(const XDashListRef &pList); bool getAddStandardFields() const { return mbAddStandardFields; } @@ -341,7 +342,6 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED LineEndLB : public ListBox public: LineEndLB( vcl::Window* pParent, WinBits aWB ); - virtual ~LineEndLB(); void Fill( const XLineEndListRef &pList, bool bStart = true ); @@ -350,7 +350,6 @@ public: }; - class SdrObject; class SdrPathObj; class SdrModel; @@ -358,8 +357,8 @@ class SdrModel; class SAL_WARN_UNUSED SvxPreviewBase : public Control { private: - SdrModel* mpModel; - VirtualDevice* mpBufferDevice; + SdrModel* mpModel; + VclPtr<VirtualDevice> mpBufferDevice; protected: void InitSettings(bool bForeground, bool bBackground); @@ -373,6 +372,7 @@ protected: public: SvxPreviewBase(vcl::Window* pParent); virtual ~SvxPreviewBase(); + virtual void dispose() SAL_OVERRIDE; // change support virtual void StateChanged(StateChangedType nStateChange) SAL_OVERRIDE; @@ -403,6 +403,7 @@ private: public: SvxXLinePreview( vcl::Window* pParent ); virtual ~SvxXLinePreview(); + virtual void dispose() SAL_OVERRIDE; void SetLineAttributes(const SfxItemSet& rItemSet); @@ -429,6 +430,7 @@ private: public: SvxXRectPreview(vcl::Window* pParent); virtual ~SvxXRectPreview(); + virtual void dispose() SAL_OVERRIDE; void SetAttributes(const SfxItemSet& rItemSet); @@ -454,6 +456,7 @@ public: SvxXShadowPreview(vcl::Window *pParent); virtual ~SvxXShadowPreview(); + virtual void dispose() SAL_OVERRIDE; void SetRectangleAttributes(const SfxItemSet& rItemSet); void SetShadowAttributes(const SfxItemSet& rItemSet); diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx index 60955a6a6219..d33c5e6c3739 100644 --- a/include/svx/fillctrl.hxx +++ b/include/svx/fillctrl.hxx @@ -50,9 +50,9 @@ private: XFillHatchItem* mpHatchItem; XFillBitmapItem* mpBitmapItem; - FillControl* mpFillControl; - SvxFillTypeBox* mpFillTypeLB; - SvxFillAttrBox* mpFillAttrLB; + VclPtr<FillControl> mpFillControl; + VclPtr<SvxFillTypeBox> mpFillTypeLB; + VclPtr<SvxFillAttrBox> mpFillAttrLB; css::drawing::FillStyle meLastXFS; @@ -67,7 +67,7 @@ public: virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; void Update(const SfxPoolItem* pState); - virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; }; @@ -77,8 +77,8 @@ class SAL_WARN_UNUSED FillControl : public vcl::Window private: friend class SvxFillToolBoxControl; - SvxFillTypeBox* mpLbFillType; - SvxFillAttrBox* mpLbFillAttr; + VclPtr<SvxFillTypeBox> mpLbFillType; + VclPtr<SvxFillAttrBox> mpLbFillAttr; Size maLogicalFillSize; Size maLogicalAttrSize; @@ -101,6 +101,7 @@ private: public: FillControl(vcl::Window* pParent, WinBits nStyle = 0); virtual ~FillControl(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; }; diff --git a/include/svx/float3d.hxx b/include/svx/float3d.hxx index f538f7d53aed..04c166228a94 100644 --- a/include/svx/float3d.hxx +++ b/include/svx/float3d.hxx @@ -60,108 +60,108 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED Svx3DWin : public SfxDockingWindow using Window::Update; private: - PushButton* m_pBtnGeo; - PushButton* m_pBtnRepresentation; - PushButton* m_pBtnLight; - PushButton* m_pBtnTexture; - PushButton* m_pBtnMaterial; - PushButton* m_pBtnUpdate; - PushButton* m_pBtnAssign; + VclPtr<PushButton> m_pBtnGeo; + VclPtr<PushButton> m_pBtnRepresentation; + VclPtr<PushButton> m_pBtnLight; + VclPtr<PushButton> m_pBtnTexture; + VclPtr<PushButton> m_pBtnMaterial; + VclPtr<PushButton> m_pBtnUpdate; + VclPtr<PushButton> m_pBtnAssign; // geometry - VclContainer* m_pFLGeometrie; - FixedText* m_pFtPercentDiagonal; - MetricField* m_pMtrPercentDiagonal; - FixedText* m_pFtBackscale; - MetricField* m_pMtrBackscale; - FixedText* m_pFtEndAngle; - MetricField* m_pMtrEndAngle; - FixedText* m_pFtDepth; - MetricField* m_pMtrDepth; - - VclContainer* m_pFLSegments; - NumericField* m_pNumHorizontal; - NumericField* m_pNumVertical; - - VclContainer* m_pFLNormals; - PushButton* m_pBtnNormalsObj; - PushButton* m_pBtnNormalsFlat; - PushButton* m_pBtnNormalsSphere; - PushButton* m_pBtnNormalsInvert; - PushButton* m_pBtnTwoSidedLighting; - PushButton* m_pBtnDoubleSided; + VclPtr<VclContainer> m_pFLGeometrie; + VclPtr<FixedText> m_pFtPercentDiagonal; + VclPtr<MetricField> m_pMtrPercentDiagonal; + VclPtr<FixedText> m_pFtBackscale; + VclPtr<MetricField> m_pMtrBackscale; + VclPtr<FixedText> m_pFtEndAngle; + VclPtr<MetricField> m_pMtrEndAngle; + VclPtr<FixedText> m_pFtDepth; + VclPtr<MetricField> m_pMtrDepth; + + VclPtr<VclContainer> m_pFLSegments; + VclPtr<NumericField> m_pNumHorizontal; + VclPtr<NumericField> m_pNumVertical; + + VclPtr<VclContainer> m_pFLNormals; + VclPtr<PushButton> m_pBtnNormalsObj; + VclPtr<PushButton> m_pBtnNormalsFlat; + VclPtr<PushButton> m_pBtnNormalsSphere; + VclPtr<PushButton> m_pBtnNormalsInvert; + VclPtr<PushButton> m_pBtnTwoSidedLighting; + VclPtr<PushButton> m_pBtnDoubleSided; // presentation - VclContainer* m_pFLRepresentation; - ListBox* m_pLbShademode; + VclPtr<VclContainer> m_pFLRepresentation; + VclPtr<ListBox> m_pLbShademode; - VclContainer* m_pFLShadow; - PushButton* m_pBtnShadow3d; - FixedText* m_pFtSlant; - MetricField* m_pMtrSlant; + VclPtr<VclContainer> m_pFLShadow; + VclPtr<PushButton> m_pBtnShadow3d; + VclPtr<FixedText> m_pFtSlant; + VclPtr<MetricField> m_pMtrSlant; - VclContainer* m_pFLCamera; - MetricField* m_pMtrDistance; - MetricField* m_pMtrFocalLength; + VclPtr<VclContainer> m_pFLCamera; + VclPtr<MetricField> m_pMtrDistance; + VclPtr<MetricField> m_pMtrFocalLength; // lighting - VclContainer* m_pFLLight; - PushButton* m_pBtnLight1; - PushButton* m_pBtnLight2; - PushButton* m_pBtnLight3; - PushButton* m_pBtnLight4; - PushButton* m_pBtnLight5; - PushButton* m_pBtnLight6; - PushButton* m_pBtnLight7; - PushButton* m_pBtnLight8; - ColorLB* m_pLbLight1; - ColorLB* m_pLbLight2; - ColorLB* m_pLbLight3; - ColorLB* m_pLbLight4; - ColorLB* m_pLbLight5; - ColorLB* m_pLbLight6; - ColorLB* m_pLbLight7; - ColorLB* m_pLbLight8; - PushButton* m_pBtnLightColor; - ColorLB* m_pLbAmbientlight; // ListBox - PushButton* m_pBtnAmbientColor; // color button + VclPtr<VclContainer> m_pFLLight; + VclPtr<PushButton> m_pBtnLight1; + VclPtr<PushButton> m_pBtnLight2; + VclPtr<PushButton> m_pBtnLight3; + VclPtr<PushButton> m_pBtnLight4; + VclPtr<PushButton> m_pBtnLight5; + VclPtr<PushButton> m_pBtnLight6; + VclPtr<PushButton> m_pBtnLight7; + VclPtr<PushButton> m_pBtnLight8; + VclPtr<ColorLB> m_pLbLight1; + VclPtr<ColorLB> m_pLbLight2; + VclPtr<ColorLB> m_pLbLight3; + VclPtr<ColorLB> m_pLbLight4; + VclPtr<ColorLB> m_pLbLight5; + VclPtr<ColorLB> m_pLbLight6; + VclPtr<ColorLB> m_pLbLight7; + VclPtr<ColorLB> m_pLbLight8; + VclPtr<PushButton> m_pBtnLightColor; + VclPtr<ColorLB> m_pLbAmbientlight; // ListBox + VclPtr<PushButton> m_pBtnAmbientColor; // color button // Textures - VclContainer* m_pFLTexture; - PushButton* m_pBtnTexLuminance; - PushButton* m_pBtnTexColor; - PushButton* m_pBtnTexReplace; - PushButton* m_pBtnTexModulate; - PushButton* m_pBtnTexBlend; - PushButton* m_pBtnTexObjectX; - PushButton* m_pBtnTexParallelX; - PushButton* m_pBtnTexCircleX; - PushButton* m_pBtnTexObjectY; - PushButton* m_pBtnTexParallelY; - PushButton* m_pBtnTexCircleY; - PushButton* m_pBtnTexFilter; + VclPtr<VclContainer> m_pFLTexture; + VclPtr<PushButton> m_pBtnTexLuminance; + VclPtr<PushButton> m_pBtnTexColor; + VclPtr<PushButton> m_pBtnTexReplace; + VclPtr<PushButton> m_pBtnTexModulate; + VclPtr<PushButton> m_pBtnTexBlend; + VclPtr<PushButton> m_pBtnTexObjectX; + VclPtr<PushButton> m_pBtnTexParallelX; + VclPtr<PushButton> m_pBtnTexCircleX; + VclPtr<PushButton> m_pBtnTexObjectY; + VclPtr<PushButton> m_pBtnTexParallelY; + VclPtr<PushButton> m_pBtnTexCircleY; + VclPtr<PushButton> m_pBtnTexFilter; // material // material editor - VclContainer* m_pFLMaterial; - ListBox* m_pLbMatFavorites; - ColorLB* m_pLbMatColor; - PushButton* m_pBtnMatColor; - ColorLB* m_pLbMatEmission; - PushButton* m_pBtnEmissionColor; + VclPtr<VclContainer> m_pFLMaterial; + VclPtr<ListBox> m_pLbMatFavorites; + VclPtr<ColorLB> m_pLbMatColor; + VclPtr<PushButton> m_pBtnMatColor; + VclPtr<ColorLB> m_pLbMatEmission; + VclPtr<PushButton> m_pBtnEmissionColor; - VclContainer* m_pFLMatSpecular; - ColorLB* m_pLbMatSpecular; - PushButton* m_pBtnSpecularColor; - MetricField* m_pMtrMatSpecularIntensity; + VclPtr<VclContainer> m_pFLMatSpecular; + VclPtr<ColorLB> m_pLbMatSpecular; + VclPtr<PushButton> m_pBtnSpecularColor; + VclPtr<MetricField> m_pMtrMatSpecularIntensity; - Svx3DPreviewControl* m_pCtlPreview; - SvxLightCtl3D* m_pCtlLightPreview; + VclPtr<Svx3DPreviewControl> m_pCtlPreview; + VclPtr<SvxLightCtl3D> m_pCtlLightPreview; // bottom part - PushButton* m_pBtnConvertTo3D; - PushButton* m_pBtnLatheObject; - PushButton* m_pBtnPerspective; + VclPtr<PushButton> m_pBtnConvertTo3D; + VclPtr<PushButton> m_pBtnLatheObject; + VclPtr<PushButton> m_pBtnPerspective; // the rest ... Image aImgLightOn; @@ -171,7 +171,7 @@ private: // Model, Page, View etc. for favourites FmFormModel* pModel; - VirtualDevice* pVDev; + VclPtr<VirtualDevice> pVDev; E3dView* p3DView; SfxBindings* pBindings; @@ -189,8 +189,6 @@ private: bool bOnly3DChanged; - - DECL_LINK( ClickViewTypeHdl, void * ); DECL_LINK( ClickUpdateHdl, void * ); DECL_LINK( ClickAssignHdl, void * ); @@ -220,6 +218,7 @@ public: Svx3DWin( SfxBindings* pBindings, SfxChildWindow *pCW, vcl::Window* pParent ); virtual ~Svx3DWin(); + virtual void dispose() SAL_OVERRIDE; void InitColorLB( const SdrModel* pDoc ); bool IsUpdateMode() const { return bUpdate; } diff --git a/include/svx/fmgridcl.hxx b/include/svx/fmgridcl.hxx index 0bcb6124e7ff..7bb356852b28 100644 --- a/include/svx/fmgridcl.hxx +++ b/include/svx/fmgridcl.hxx @@ -43,6 +43,7 @@ protected: public: FmGridHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG ); virtual ~FmGridHeader(); + virtual void dispose() SAL_OVERRIDE; public: struct AccessControl { friend class FmGridControl; private: AccessControl() { } }; @@ -153,7 +154,7 @@ public: protected: virtual void Command(const CommandEvent& rEvt) SAL_OVERRIDE; - virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE; + virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) SAL_OVERRIDE; virtual long QueryMinimumRowHeight() SAL_OVERRIDE; virtual void RowHeightChanged() SAL_OVERRIDE; virtual void ColumnResized(sal_uInt16 nId) SAL_OVERRIDE; diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx index bb9d2fcfa18c..d752b881e064 100644 --- a/include/svx/fmgridif.hxx +++ b/include/svx/fmgridif.hxx @@ -501,7 +501,7 @@ public: virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; protected: - virtual FmGridControl* imp_CreateControl(vcl::Window* pParent, WinBits nStyle); + virtual VclPtr<FmGridControl> imp_CreateControl(vcl::Window* pParent, WinBits nStyle); static ::com::sun::star::uno::Sequence< ::com::sun::star::util::URL>& getSupportedURLs(); static ::com::sun::star::uno::Sequence<sal_uInt16>& getSupportedGridSlots(); diff --git a/include/svx/fmshell.hxx b/include/svx/fmshell.hxx index 462c304590d1..8249ef9c46b7 100644 --- a/include/svx/fmshell.hxx +++ b/include/svx/fmshell.hxx @@ -88,7 +88,7 @@ class SVX_DLLPUBLIC FmFormShell : public SfxShell class FormShellWaitObject { - vcl::Window* m_pWindow; + VclPtr<vcl::Window> m_pWindow; public: FormShellWaitObject(const FmFormShell* _pShell); ~FormShellWaitObject(); diff --git a/include/svx/fntctrl.hxx b/include/svx/fntctrl.hxx index a9ad36d99855..2278f0c3f755 100644 --- a/include/svx/fntctrl.hxx +++ b/include/svx/fntctrl.hxx @@ -49,6 +49,7 @@ public: SvxFontPrevWindow( vcl::Window* pParent, const ResId& rId ); SvxFontPrevWindow(vcl::Window* pParent, WinBits nStyle); virtual ~SvxFontPrevWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; diff --git a/include/svx/fontwork.hxx b/include/svx/fontwork.hxx index 6760ace56b0e..8905b76b9511 100644 --- a/include/svx/fontwork.hxx +++ b/include/svx/fontwork.hxx @@ -92,20 +92,22 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxFontWorkDialog : public SfxDockingWindow SvxFontWorkControllerItem* pCtrlItems[CONTROLLER_COUNT]; - ToolBox* m_pTbxStyle; - ToolBox* m_pTbxAdjust; + VclPtr<ToolBox> m_pTbxStyle; + VclPtr<ToolBox> m_pTbxAdjust; - MetricField* m_pMtrFldDistance; - MetricField* m_pMtrFldTextStart; + VclPtr<FixedImage> m_pFbDistance; + VclPtr<MetricField> m_pMtrFldDistance; + VclPtr<FixedImage> m_pFbTextStart; + VclPtr<MetricField> m_pMtrFldTextStart; - ToolBox* m_pTbxShadow; + VclPtr<ToolBox> m_pTbxShadow; - FixedImage* m_pFbShadowX; - MetricField* m_pMtrFldShadowX; - FixedImage* m_pFbShadowY; - MetricField* m_pMtrFldShadowY; + VclPtr<FixedImage> m_pFbShadowX; + VclPtr<MetricField> m_pMtrFldShadowX; + VclPtr<FixedImage> m_pFbShadowY; + VclPtr<MetricField> m_pMtrFldShadowY; - ColorLB* m_pShadowColorLB; + VclPtr<ColorLB> m_pShadowColorLB; SfxBindings& rBindings; Idle aInputIdle; @@ -172,6 +174,7 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxFontWorkDialog : public SfxDockingWindow SvxFontWorkDialog(SfxBindings *pBinding, SfxChildWindow *pCW, vcl::Window* pParent); virtual ~SvxFontWorkDialog(); + virtual void dispose() SAL_OVERRIDE; void SetColorList(const XColorListRef &pTable); }; diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx index 56787ec3df65..dfae49d09336 100644 --- a/include/svx/fontworkgallery.hxx +++ b/include/svx/fontworkgallery.hxx @@ -57,23 +57,25 @@ public: virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE; virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; class SAL_WARN_UNUSED FontworkCharacterSpacingDialog : public ModalDialog { - MetricField* m_pMtrScale; + VclPtr<MetricField> m_pMtrScale; public: FontworkCharacterSpacingDialog( vcl::Window* pParent, sal_Int32 nScale ); + virtual ~FontworkCharacterSpacingDialog(); + virtual void dispose() SAL_OVERRIDE; sal_Int32 getScale() const; }; class SVX_DLLPUBLIC SAL_WARN_UNUSED FontWorkGalleryDialog : public ModalDialog { - ValueSet* mpCtlFavorites; - OKButton* mpOKButton; + VclPtr<ValueSet> mpCtlFavorites; + VclPtr<OKButton> mpOKButton; sal_uInt16 mnThemeId; @@ -96,6 +98,7 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED FontWorkGalleryDialog : public ModalDialog public: FontWorkGalleryDialog( SdrView* pView, vcl::Window* pParent, sal_uInt16 nSID ); virtual ~FontWorkGalleryDialog(); + virtual void dispose() SAL_OVERRIDE; // SJ: if the SdrObject** is set, the SdrObject is not inserted into the page when executing the dialog void SetSdrObjectRef( SdrObject**, SdrModel* pModel ); diff --git a/include/svx/frmdirlbox.hxx b/include/svx/frmdirlbox.hxx index d584acc91104..d4df82a607c8 100644 --- a/include/svx/frmdirlbox.hxx +++ b/include/svx/frmdirlbox.hxx @@ -40,7 +40,6 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED FrameDirectionListBox : public ListBox { public: explicit FrameDirectionListBox( vcl::Window* pParent, WinBits nBits ); - virtual ~FrameDirectionListBox(); /** Inserts a string with corresponding direction enum into the listbox. */ void InsertEntryValue( diff --git a/include/svx/frmsel.hxx b/include/svx/frmsel.hxx index aa34ef62c504..48bb2f90d785 100644 --- a/include/svx/frmsel.hxx +++ b/include/svx/frmsel.hxx @@ -84,7 +84,7 @@ class SVX_DLLPUBLIC SAL_WARN_UNUSED FrameSelector : public Control { public: FrameSelector(vcl::Window* pParent); - virtual ~FrameSelector(); + virtual ~FrameSelector(); /** Initializes the control, enables/disables frame borders according to flags. */ void Initialize( FrameSelFlags nFlags ); diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx index 4508e283cc6f..d0ccb6c62323 100644 --- a/include/svx/galctrl.hxx +++ b/include/svx/galctrl.hxx @@ -109,7 +109,6 @@ private: public: GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme ); - virtual ~GalleryIconView(); }; class GalleryListView : public BrowseBox @@ -144,7 +143,6 @@ private: public: GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ); - virtual ~GalleryListView(); void SetSelectHdl( const Link& rSelectHdl ) { maSelectHdl = rSelectHdl; } diff --git a/include/svx/grafctrl.hxx b/include/svx/grafctrl.hxx index acfd5f356cfa..ba4124de41e1 100644 --- a/include/svx/grafctrl.hxx +++ b/include/svx/grafctrl.hxx @@ -54,7 +54,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; @@ -68,7 +68,7 @@ public: virtual ~SvxGrafToolBoxControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; @@ -160,7 +160,7 @@ public: virtual ~SvxGrafModeToolBoxControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx index d941b6fbb581..3d646afa2baf 100644 --- a/include/svx/graphctl.hxx +++ b/include/svx/graphctl.hxx @@ -80,8 +80,9 @@ protected: public: - GraphCtrl( vcl::Window* pParent, WinBits nStyle ); - virtual ~GraphCtrl(); + GraphCtrl( vcl::Window* pParent, WinBits nStyle ); + virtual ~GraphCtrl(); + virtual void dispose() SAL_OVERRIDE; void SetWinStyle( WinBits nWinBits ); WinBits GetWinStyle() const { return nWinStyle; } diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx index bf42c434ea13..94bbad044a2b 100644 --- a/include/svx/gridctrl.hxx +++ b/include/svx/gridctrl.hxx @@ -151,20 +151,20 @@ public: friend class NavigationBar::AbsolutePos; // zusaetzliche Controls - FixedText m_aRecordText; - AbsolutePos m_aAbsolute; // absolute positioning - FixedText m_aRecordOf; - FixedText m_aRecordCount; + VclPtr<FixedText> m_aRecordText; + VclPtr<AbsolutePos> m_aAbsolute; // absolute positioning + VclPtr<FixedText> m_aRecordOf; + VclPtr<FixedText> m_aRecordCount; - ImageButton m_aFirstBtn; // ImageButton for 'go to the first record' - ImageButton m_aPrevBtn; // ImageButton for 'go to the previous record' - ImageButton m_aNextBtn; // ImageButton for 'go to the next record' - ImageButton m_aLastBtn; // ImageButton for 'go to the last record' - ImageButton m_aNewBtn; // ImageButton for 'go to a new record' - sal_uInt16 m_nDefaultWidth; - sal_Int32 m_nCurrentPos; + VclPtr<ImageButton> m_aFirstBtn; // ImageButton for 'go to the first record' + VclPtr<ImageButton> m_aPrevBtn; // ImageButton for 'go to the previous record' + VclPtr<ImageButton> m_aNextBtn; // ImageButton for 'go to the next record' + VclPtr<ImageButton> m_aLastBtn; // ImageButton for 'go to the last record' + VclPtr<ImageButton> m_aNewBtn; // ImageButton for 'go to a new record' + sal_uInt16 m_nDefaultWidth; + sal_Int32 m_nCurrentPos; - bool m_bPositioning; // protect PositionDataSource against recursion + bool m_bPositioning; // protect PositionDataSource against recursion public: // StatusIds for Controls of the Bar @@ -183,6 +183,8 @@ public: }; NavigationBar(vcl::Window* pParent, WinBits nStyle = 0); + virtual ~NavigationBar(); + virtual void dispose() SAL_OVERRIDE; // Status methods for Controls void InvalidateAll(sal_Int32 nCurrentPos = -1, bool bAll = false); @@ -225,7 +227,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; DbGridColumns m_aColumns; // Column description - NavigationBar m_aBar; + VclPtr<NavigationBar> m_aBar; DbGridRowRef m_xDataRow; // Row which can be modified // comes from the data cursor DbGridRowRef m_xSeekRow, // Row to which the iterator can set @@ -370,6 +372,7 @@ public: WinBits nBits = WB_BORDER); virtual ~DbGridControl(); + virtual void dispose() SAL_OVERRIDE; virtual void Init() SAL_OVERRIDE; virtual void InitColumnsByFields(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xFields) = 0; @@ -431,7 +434,7 @@ public: bool HasNavigationBar() const {return m_bNavigationBar;} sal_uInt16 GetOptions() const {return m_nOptions;} - NavigationBar& GetNavigationBar() {return m_aBar;} + NavigationBar& GetNavigationBar() {return *m_aBar.get();} sal_uInt16 SetOptions(sal_uInt16 nOpt); // The new options are interpreted with respect to the current data source. If it is unable // to update, to insert or to restore, the according options are ignored. If the grid isn't diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx index 53450d36491a..7df23df2dc70 100644 --- a/include/svx/hdft.hxx +++ b/include/svx/hdft.hxx @@ -52,6 +52,7 @@ public: virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; virtual ~SvxHFPage(); + virtual void dispose() SAL_OVERRIDE; void DisableDeleteQueryBox() { mbDisableQueryBox = true; } void EnableBackgroundSelector(bool bNew) { mbEnableBackgroundSelector = bNew; } @@ -69,22 +70,22 @@ protected: SvxHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId ); - FixedText* m_pPageLbl; - CheckBox* m_pTurnOnBox; - CheckBox* m_pCntSharedBox; - CheckBox* m_pCntSharedFirstBox; - FixedText* m_pLMLbl; - MetricField* m_pLMEdit; - FixedText* m_pRMLbl; - MetricField* m_pRMEdit; - FixedText* m_pDistFT; - MetricField* m_pDistEdit; - CheckBox* m_pDynSpacingCB; - FixedText* m_pHeightFT; - MetricField* m_pHeightEdit; - CheckBox* m_pHeightDynBtn; - SvxPageWindow* m_pBspWin; - PushButton* m_pBackgroundBtn; + VclPtr<FixedText> m_pPageLbl; + VclPtr<CheckBox> m_pTurnOnBox; + VclPtr<CheckBox> m_pCntSharedBox; + VclPtr<CheckBox> m_pCntSharedFirstBox; + VclPtr<FixedText> m_pLMLbl; + VclPtr<MetricField> m_pLMEdit; + VclPtr<FixedText> m_pRMLbl; + VclPtr<MetricField> m_pRMEdit; + VclPtr<FixedText> m_pDistFT; + VclPtr<MetricField> m_pDistEdit; + VclPtr<CheckBox> m_pDynSpacingCB; + VclPtr<FixedText> m_pHeightFT; + VclPtr<MetricField> m_pHeightEdit; + VclPtr<CheckBox> m_pHeightDynBtn; + VclPtr<SvxPageWindow> m_pBspWin; + VclPtr<PushButton> m_pBackgroundBtn; sal_uInt16 nId; SfxItemSet* pBBSet; @@ -112,12 +113,10 @@ private: class SVX_DLLPUBLIC SvxHeaderPage : public SvxHFPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); // returns the Which values to the range - static const sal_uInt16* GetRanges() { return pRanges; } - -private: - SvxHeaderPage( vcl::Window* pParent, const SfxItemSet& rSet ); + static const sal_uInt16* GetRanges() { return pRanges; } + SVX_DLLPRIVATE SvxHeaderPage( vcl::Window* pParent, const SfxItemSet& rSet ); }; // class SvxFooterPage --------------------------------------------------- @@ -125,10 +124,8 @@ private: class SVX_DLLPUBLIC SvxFooterPage : public SvxHFPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet ); - static const sal_uInt16* GetRanges() { return pRanges; } - -private: + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static const sal_uInt16* GetRanges() { return pRanges; } SVX_DLLPRIVATE SvxFooterPage( vcl::Window* pParent, const SfxItemSet& rSet ); }; diff --git a/include/svx/imapdlg.hxx b/include/svx/imapdlg.hxx index 7c288fed577a..fc0b758d3c37 100644 --- a/include/svx/imapdlg.hxx +++ b/include/svx/imapdlg.hxx @@ -82,14 +82,14 @@ class SVX_DLLPUBLIC SvxIMapDlg : public SfxModelessDialog // SfxFloatingWindow friend class IMapOwnData; friend class IMapWindow; - ToolBox *m_pTbxIMapDlg1; - FixedText *m_pFtURL; - SvtURLBox *m_pURLBox; - FixedText *m_pFtText; - Edit *m_pEdtText; - FixedText *m_pFtTarget; - ComboBox *m_pCbbTarget; - StatusBar *m_pStbStatus; + VclPtr<ToolBox> m_pTbxIMapDlg1; + VclPtr<FixedText> m_pFtURL; + VclPtr<SvtURLBox> m_pURLBox; + VclPtr<FixedText> m_pFtText; + VclPtr<Edit> m_pEdtText; + VclPtr<FixedText> m_pFtTarget; + VclPtr<ComboBox> m_pCbbTarget; + VclPtr<StatusBar> m_pStbStatus; sal_uInt16 mnApplyId; sal_uInt16 mnOpenId; @@ -110,7 +110,7 @@ class SVX_DLLPUBLIC SvxIMapDlg : public SfxModelessDialog // SfxFloatingWindow sal_uInt16 mnPropertyId; Size aLastSize; - IMapWindow* pIMapWnd; + VclPtr<IMapWindow> pIMapWnd; IMapOwnData* pOwnData; void* pCheckObj; SvxIMapDlgItem aIMapItem; @@ -136,6 +136,7 @@ public: SvxIMapDlg( SfxBindings *pBindings, SfxChildWindow *pCW, vcl::Window* pParent ); virtual ~SvxIMapDlg(); + virtual void dispose() SAL_OVERRIDE; void SetExecState( bool bEnable ); diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx index a71d9bcb0026..8d2c1bfb6726 100644 --- a/include/svx/itemwin.hxx +++ b/include/svx/itemwin.hxx @@ -49,7 +49,6 @@ public: SvxLineBox( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL ); - virtual ~SvxLineBox(); void FillControl(); @@ -87,7 +86,6 @@ public: SvxMetricField( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, WinBits nBits = WB_BORDER | WB_SPIN | WB_REPEAT ); - virtual ~SvxMetricField(); void Update( const XLineWidthItem* pItem ); void SetCoreUnit( SfxMapUnit eUnit ); @@ -100,7 +98,6 @@ class SvxFillTypeBox : public FillTypeLB { public: SvxFillTypeBox( vcl::Window* pParent, WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL ); - virtual ~SvxFillTypeBox(); void Selected() { bSelect = true; } bool IsRelease() { return bRelease;} @@ -123,7 +120,6 @@ class SvxFillAttrBox : public FillAttrLB { public: SvxFillAttrBox( vcl::Window* pParent, WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL ); - virtual ~SvxFillAttrBox(); bool IsRelease() { return bRelease;} diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx index f804f32b0d33..7cc8a3e9afe5 100644 --- a/include/svx/langbox.hxx +++ b/include/svx/langbox.hxx @@ -116,7 +116,6 @@ class SVX_DLLPUBLIC SvxLanguageBox : public ListBox, public SvxLanguageBoxBase { public: SvxLanguageBox( vcl::Window* pParent, WinBits nBits, bool bCheck = false ); - virtual ~SvxLanguageBox(); private: SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ) SAL_OVERRIDE; @@ -143,7 +142,6 @@ class SVX_DLLPUBLIC SvxLanguageComboBox : public ComboBox, public SvxLanguageBox { public: SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits, bool bCheck = false ); - virtual ~SvxLanguageComboBox(); enum EditedAndValid { diff --git a/include/svx/layctrl.hxx b/include/svx/layctrl.hxx index 9652aea57322..05eaf5dec50d 100644 --- a/include/svx/layctrl.hxx +++ b/include/svx/layctrl.hxx @@ -31,7 +31,7 @@ private: public: virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual SfxPopupWindow* CreatePopupWindowCascading() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, @@ -50,7 +50,7 @@ class SVX_DLLPUBLIC SvxColumnsToolBoxControl : public SfxToolBoxControl bool bEnabled; public: virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual SfxPopupWindow* CreatePopupWindowCascading() SAL_OVERRIDE; SFX_DECL_TOOLBOX_CONTROL(); diff --git a/include/svx/lboxctrl.hxx b/include/svx/lboxctrl.hxx index 30a21b37f71a..fe3062d18a40 100644 --- a/include/svx/lboxctrl.hxx +++ b/include/svx/lboxctrl.hxx @@ -34,7 +34,7 @@ class SvxListBoxControl : public SfxToolBoxControl { protected: OUString aActionStr; - SvxPopupWindowListBox * pPopupWin; + VclPtr<SvxPopupWindowListBox> pPopupWin; void Impl_SetInfo( sal_uInt16 nCount ); @@ -46,7 +46,7 @@ public: virtual ~SvxListBoxControl(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; @@ -69,7 +69,7 @@ public: SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; #endif diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx index 1c3a90ee50ca..a6576387bef5 100644 --- a/include/svx/linectrl.hxx +++ b/include/svx/linectrl.hxx @@ -52,7 +52,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; void Update( const SfxPoolItem* pState ); - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; @@ -69,7 +69,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; @@ -82,7 +82,7 @@ class SvxLineEndWindow : public SfxPopupWindow private: XLineEndListRef pLineEndList; - ValueSet aLineEndSet; + VclPtr<ValueSet> aLineEndSet; sal_uInt16 nCols; sal_uInt16 nLines; sal_uIntPtr nLineEndWidth; @@ -118,12 +118,13 @@ public: vcl::Window* pParentWindow, const OUString& rWndTitle ); virtual ~SvxLineEndWindow(); + virtual void dispose() SAL_OVERRIDE; void StartSelection(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual SfxPopupWindow* Clone() const SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE; }; @@ -140,7 +141,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; diff --git a/include/svx/linkwarn.hxx b/include/svx/linkwarn.hxx index 8fc66afffb18..b832637fc8b9 100644 --- a/include/svx/linkwarn.hxx +++ b/include/svx/linkwarn.hxx @@ -27,11 +27,12 @@ class SVX_DLLPUBLIC SvxLinkWarningDialog : public MessageDialog { private: - CheckBox* m_pWarningOnBox; + VclPtr<CheckBox> m_pWarningOnBox; public: SvxLinkWarningDialog(vcl::Window* pParent, const OUString& _rFileName); virtual ~SvxLinkWarningDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif // INCLUDED_SVX_LINKWARN_HXX diff --git a/include/svx/measctrl.hxx b/include/svx/measctrl.hxx index 83161ca627ed..4753ab17a671 100644 --- a/include/svx/measctrl.hxx +++ b/include/svx/measctrl.hxx @@ -43,6 +43,7 @@ private: public: SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle); virtual ~SvxXMeasurePreview(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; diff --git a/include/svx/numvset.hxx b/include/svx/numvset.hxx index f5e3781e6642..d4a13cb1d3b8 100644 --- a/include/svx/numvset.hxx +++ b/include/svx/numvset.hxx @@ -53,7 +53,7 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet sal_uInt16 nPageType; bool bHTMLMode; Rectangle aOrgRect; - VirtualDevice* pVDev; + VclPtr<VirtualDevice> pVDev; com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter; com::sun::star::lang::Locale aLocale; @@ -66,27 +66,26 @@ class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess> > aOutlineSettings; - public: +public: SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits = WB_TABSTOP); void init(sal_uInt16 nType); virtual ~SvxNumValueSet(); + virtual void dispose() SAL_OVERRIDE; virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE; void SetHTMLMode(bool bSet) {bHTMLMode = bSet;} void SetNumberingSettings( - const com::sun::star::uno::Sequence< - com::sun::star::uno::Sequence< - com::sun::star::beans::PropertyValue> >& aNum, - com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter, - const com::sun::star::lang::Locale& rLocale ); + const css::uno::Sequence< + css::uno::Sequence<css::beans::PropertyValue> >& aNum, + css::uno::Reference<css::text::XNumberingFormatter>& xFormatter, + const css::lang::Locale& rLocale ); void SetOutlineNumberingSettings( - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::container::XIndexAccess> >& rOutline, - com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter, - const com::sun::star::lang::Locale& rLocale); + css::uno::Sequence< + css::uno::Reference<css::container::XIndexAccess> >& rOutline, + css::uno::Reference<css::text::XNumberingFormatter>& xFormatter, + const css::lang::Locale& rLocale); }; class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet @@ -96,7 +95,7 @@ class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet void init(); - protected: +protected: DECL_LINK(FormatHdl_Impl, void *); void SetGrfNotFound(bool bSet) {bGrfNotFound = bSet;} @@ -104,9 +103,10 @@ class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet Idle& GetFormatIdle() {return aFormatIdle;} - public: +public: SvxBmpNumValueSet(vcl::Window* pParent, WinBits nWinBits = WB_TABSTOP); virtual ~SvxBmpNumValueSet(); + virtual void dispose() SAL_OVERRIDE; virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE; diff --git a/include/svx/optgrid.hxx b/include/svx/optgrid.hxx index 02c74ca42b05..9aeee8d1c8c1 100644 --- a/include/svx/optgrid.hxx +++ b/include/svx/optgrid.hxx @@ -101,8 +101,10 @@ class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage public: SvxGridTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~SvxGridTabPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet& rAttrSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet& rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; @@ -111,30 +113,30 @@ public: virtual sfxpg DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE; private: - CheckBox* pCbxUseGridsnap; - CheckBox* pCbxGridVisible; + VclPtr<CheckBox> pCbxUseGridsnap; + VclPtr<CheckBox> pCbxGridVisible; - MetricField* pMtrFldDrawX; - MetricField* pMtrFldDrawY; + VclPtr<MetricField> pMtrFldDrawX; + VclPtr<MetricField> pMtrFldDrawY; - NumericField* pNumFldDivisionX; - NumericField* pNumFldDivisionY; + VclPtr<NumericField> pNumFldDivisionX; + VclPtr<NumericField> pNumFldDivisionY; - CheckBox* pCbxSynchronize; + VclPtr<CheckBox> pCbxSynchronize; protected: //these controls are used in draw and impress - VclContainer* pSnapFrames; - CheckBox* pCbxSnapHelplines; - CheckBox* pCbxSnapBorder; - CheckBox* pCbxSnapFrame; - CheckBox* pCbxSnapPoints; - MetricField* pMtrFldSnapArea; - - CheckBox* pCbxOrtho; - CheckBox* pCbxBigOrtho; - CheckBox* pCbxRotate; - MetricField* pMtrFldAngle; - MetricField* pMtrFldBezAngle; + VclPtr<VclContainer> pSnapFrames; + VclPtr<CheckBox> pCbxSnapHelplines; + VclPtr<CheckBox> pCbxSnapBorder; + VclPtr<CheckBox> pCbxSnapFrame; + VclPtr<CheckBox> pCbxSnapPoints; + VclPtr<MetricField> pMtrFldSnapArea; + + VclPtr<CheckBox> pCbxOrtho; + VclPtr<CheckBox> pCbxBigOrtho; + VclPtr<CheckBox> pCbxRotate; + VclPtr<MetricField> pMtrFldAngle; + VclPtr<MetricField> pMtrFldBezAngle; private: bool bAttrModified; diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx index 8b6da4dd29f0..007d4caf5634 100644 --- a/include/svx/pagectrl.hxx +++ b/include/svx/pagectrl.hxx @@ -89,6 +89,7 @@ protected: public: SvxPageWindow( vcl::Window* pParent ); virtual ~SvxPageWindow(); + virtual void dispose() SAL_OVERRIDE; //UUUU void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maHeaderFillAttributes = rFillAttributes; } diff --git a/include/svx/passwd.hxx b/include/svx/passwd.hxx index 920fa19c7c68..89fbbded5221 100644 --- a/include/svx/passwd.hxx +++ b/include/svx/passwd.hxx @@ -33,12 +33,12 @@ class SVX_DLLPUBLIC SvxPasswordDialog : public SfxModalDialog { private: - FixedText* m_pOldFL; - FixedText* m_pOldPasswdFT; - Edit* m_pOldPasswdED; - Edit* m_pNewPasswdED; - Edit* m_pRepeatPasswdED; - OKButton* m_pOKBtn; + VclPtr<FixedText> m_pOldFL; + VclPtr<FixedText> m_pOldPasswdFT; + VclPtr<Edit> m_pOldPasswdED; + VclPtr<Edit> m_pNewPasswdED; + VclPtr<Edit> m_pRepeatPasswdED; + VclPtr<OKButton> m_pOKBtn; OUString aOldPasswdErrStr; OUString aRepeatPasswdErrStr; @@ -52,7 +52,8 @@ private: public: SvxPasswordDialog( vcl::Window* pParent, bool bAllowEmptyPasswords = false, bool bDisableOldPassword = false ); - virtual ~SvxPasswordDialog(); + virtual ~SvxPasswordDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetOldPassword() const { return m_pOldPasswdED->GetText(); } OUString GetNewPassword() const { return m_pNewPasswdED->GetText(); } diff --git a/include/svx/prtqry.hxx b/include/svx/prtqry.hxx index afe6b9b6d85a..a2f4e9298262 100644 --- a/include/svx/prtqry.hxx +++ b/include/svx/prtqry.hxx @@ -26,7 +26,6 @@ class SVX_DLLPUBLIC SvxPrtQryBox : public MessBox { public: SvxPrtQryBox(vcl::Window* pParent); - virtual ~SvxPrtQryBox(); }; #endif diff --git a/include/svx/rubydialog.hxx b/include/svx/rubydialog.hxx index d0e9429501a2..4ea04bcd041d 100644 --- a/include/svx/rubydialog.hxx +++ b/include/svx/rubydialog.hxx @@ -44,10 +44,12 @@ class RubyPreview : public vcl::Window { protected: virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; - SvxRubyDialog* m_pParentDlg; + VclPtr<SvxRubyDialog> m_pParentDlg; public: RubyPreview(vcl::Window *pParent); + virtual ~RubyPreview(); + virtual void dispose() SAL_OVERRIDE; void setRubyDialog(SvxRubyDialog* pParentDlg) { m_pParentDlg = pParentDlg; @@ -89,33 +91,33 @@ class SvxRubyDialog : public SfxModelessDialog { friend class RubyPreview; - FixedText* m_pLeftFT; - FixedText* m_pRightFT; - RubyEdit* m_pLeft1ED; - RubyEdit* m_pRight1ED; - RubyEdit* m_pLeft2ED; - RubyEdit* m_pRight2ED; - RubyEdit* m_pLeft3ED; - RubyEdit* m_pRight3ED; - RubyEdit* m_pLeft4ED; - RubyEdit* m_pRight4ED; + VclPtr<FixedText> m_pLeftFT; + VclPtr<FixedText> m_pRightFT; + VclPtr<RubyEdit> m_pLeft1ED; + VclPtr<RubyEdit> m_pRight1ED; + VclPtr<RubyEdit> m_pLeft2ED; + VclPtr<RubyEdit> m_pRight2ED; + VclPtr<RubyEdit> m_pLeft3ED; + VclPtr<RubyEdit> m_pRight3ED; + VclPtr<RubyEdit> m_pLeft4ED; + VclPtr<RubyEdit> m_pRight4ED; - RubyEdit* aEditArr[8]; - VclScrolledWindow* m_pScrolledWindow; - ScrollBar* m_pScrollSB; + VclPtr<RubyEdit> aEditArr[8]; + VclPtr<VclScrolledWindow> m_pScrolledWindow; + VclPtr<ScrollBar> m_pScrollSB; - ListBox* m_pAdjustLB; + VclPtr<ListBox> m_pAdjustLB; - ListBox* m_pPositionLB; + VclPtr<ListBox> m_pPositionLB; - FixedText* m_pCharStyleFT; - ListBox* m_pCharStyleLB; - PushButton* m_pStylistPB; + VclPtr<FixedText> m_pCharStyleFT; + VclPtr<ListBox> m_pCharStyleLB; + VclPtr<PushButton> m_pStylistPB; - RubyPreview* m_pPreviewWin; + VclPtr<RubyPreview> m_pPreviewWin; - PushButton* m_pApplyPB; - PushButton* m_pClosePB; + VclPtr<PushButton> m_pApplyPB; + VclPtr<PushButton> m_pClosePB; long nLastPos; long nCurrentEdit; @@ -143,7 +145,7 @@ class SvxRubyDialog : public SfxModelessDialog void AssertOneEntry(); void Update(); - virtual bool Close() SAL_OVERRIDE; + virtual bool Close() SAL_OVERRIDE; long GetLastPos() const {return nLastPos;} void SetLastPos(long nSet) {nLastPos = nSet;} @@ -163,6 +165,7 @@ public: SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW, vcl::Window* pParent); virtual ~SvxRubyDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void Activate() SAL_OVERRIDE; virtual void Deactivate() SAL_OVERRIDE; diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx index 2cef64f3691d..007f4d89c378 100644 --- a/include/svx/ruler.hxx +++ b/include/svx/ruler.hxx @@ -57,7 +57,7 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener std::unique_ptr<SvxColumnItem> mxColumnItem; // columns std::unique_ptr<SvxObjectItem> mxObjectItem; // object - vcl::Window* pEditWin; + VclPtr<vcl::Window> pEditWin; std::unique_ptr<SvxRuler_Impl> mxRulerImpl; @@ -254,6 +254,7 @@ public: SvxRuler(vcl::Window* pParent, vcl::Window *pEditWin, sal_uInt16 nRulerFlags, SfxBindings &rBindings, WinBits nWinStyle = WB_STDRULER); virtual ~SvxRuler(); + virtual void dispose() SAL_OVERRIDE; void SetMinFrameSize(long lSize); long GetMinFrameSize() const ; diff --git a/include/svx/sdrpaintwindow.hxx b/include/svx/sdrpaintwindow.hxx index 3a1f1ef7f986..d8f091885c95 100644 --- a/include/svx/sdrpaintwindow.hxx +++ b/include/svx/sdrpaintwindow.hxx @@ -50,10 +50,10 @@ PaintTransparentChildren(vcl::Window & rWindow, Rectangle const& rPixelRect); class SdrPreRenderDevice { // The original OutputDevice - OutputDevice& mrOutputDevice; + OutputDevice& mrOutputDevice; // The VirtualDevice for PreRendering - VirtualDevice maPreRenderDevice; + VclPtr<VirtualDevice> mpPreRenderDevice; public: explicit SdrPreRenderDevice(OutputDevice& rOriginal); @@ -63,7 +63,7 @@ public: void OutputPreRenderDevice(const vcl::Region& rExpandedRegion); OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; } - OutputDevice& GetPreRenderDevice() { return maPreRenderDevice; } + OutputDevice& GetPreRenderDevice() { return *mpPreRenderDevice.get(); } }; diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx index 6eac3d3eef90..82790a402e62 100644 --- a/include/svx/sidebar/PanelLayout.hxx +++ b/include/svx/sidebar/PanelLayout.hxx @@ -16,6 +16,7 @@ #include <vcl/ctrl.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> +#include <vcl/vclptr.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -34,6 +35,7 @@ public: PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame); virtual ~PanelLayout(); + virtual void dispose() SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE; virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL) SAL_OVERRIDE; diff --git a/include/svx/sidebar/Popup.hxx b/include/svx/sidebar/Popup.hxx index 7f0d804f78c2..4fd74d14db8a 100644 --- a/include/svx/sidebar/Popup.hxx +++ b/include/svx/sidebar/Popup.hxx @@ -22,6 +22,9 @@ #include <svx/svxdllapi.h> #include <rtl/ustring.hxx> #include <tools/link.hxx> +#include <vcl/vclptr.hxx> +#include <svx/sidebar/PopupContainer.hxx> +#include <svx/sidebar/PopupControl.hxx> #include <boost/function.hpp> @@ -30,9 +33,6 @@ class ToolBox; namespace svx { namespace sidebar { -class PopupContainer; -class PopupControl; - /** A wrapper around a PopupContainer and a PopupControl object. Usually used as drop down for a toolbox. Use Show() to start drop down mode and Hide() to end it. @@ -76,7 +76,7 @@ public : void SetPopupModeEndHandler (const ::boost::function<void()>& rCallback); protected: - std::unique_ptr<PopupControl> mxControl; + VclPtr<PopupControl> mxControl; /** Make sure that both PopupContainer and PopupControl objects exist. Calls the maControlCreator functor if necessary. @@ -89,11 +89,11 @@ protected: void CreateContainerAndControl(); private: - vcl::Window* mpParent; - ::boost::function<PopupControl*(PopupContainer*)> maControlCreator; + VclPtr<vcl::Window> mpParent; + ::boost::function<VclPtr<PopupControl>(PopupContainer*)> maControlCreator; ::boost::function<void()> maPopupModeEndCallback; const ::rtl::OUString msAccessibleName; - std::unique_ptr<PopupContainer> mxContainer; + VclPtr<PopupContainer> mxContainer; DECL_LINK(PopupModeEndHandler, void*); }; diff --git a/include/svx/sidebar/PopupControl.hxx b/include/svx/sidebar/PopupControl.hxx index 32658b3ae4d7..626e7074501d 100644 --- a/include/svx/sidebar/PopupControl.hxx +++ b/include/svx/sidebar/PopupControl.hxx @@ -38,7 +38,6 @@ public : PopupControl ( vcl::Window* pParent, const ResId& rResId); - virtual ~PopupControl(); virtual void Paint (const Rectangle& rect) SAL_OVERRIDE; }; diff --git a/include/svx/sidebar/SidebarDialControl.hxx b/include/svx/sidebar/SidebarDialControl.hxx index 1d829d27fe76..52d798e2ab89 100644 --- a/include/svx/sidebar/SidebarDialControl.hxx +++ b/include/svx/sidebar/SidebarDialControl.hxx @@ -29,7 +29,6 @@ class SVX_DLLPUBLIC SidebarDialControl : public svx::DialControl { public: SidebarDialControl (vcl::Window* pParent, WinBits nBits = 0); - virtual ~SidebarDialControl(); virtual Size GetOptimalSize() const SAL_OVERRIDE; virtual void MouseButtonDown (const MouseEvent& rMEvt) SAL_OVERRIDE; diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx index e6724b278c9c..e0c941d19645 100644 --- a/include/svx/sidebar/ValueSetWithTextControl.hxx +++ b/include/svx/sidebar/ValueSetWithTextControl.hxx @@ -52,8 +52,6 @@ public: vcl::Window* pParent, const ResId& rResId); - virtual ~ValueSetWithTextControl(); - // add item for control type IMAGE_TEXT // if control type does not match IMAGE_TEXT no item is added. // @param pSelectedItemImage diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx index 5750ca0857da..ec241902877b 100644 --- a/include/svx/srchdlg.hxx +++ b/include/svx/srchdlg.hxx @@ -89,7 +89,7 @@ enum SearchLabel class SvxSearchDialog; class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow { - SvxSearchDialog *dialog; + VclPtr<SvxSearchDialog> dialog; public: SvxSearchDialogWrapper( vcl::Window*pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo ); @@ -120,6 +120,7 @@ friend class SvxJSearchOptionsDialog; public: SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind ); virtual ~SvxSearchDialog(); + virtual void dispose() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; @@ -150,57 +151,57 @@ public: void SetSearchLabel(const OUString& rStr) { m_pSearchLabel->SetText(rStr); } private: - vcl::Window* mpDocWin; + VclPtr<vcl::Window> mpDocWin; bool mbSuccess; - VclFrame* m_pSearchFrame; - ComboBox* m_pSearchLB; - ListBox* m_pSearchTmplLB; - FixedText* m_pSearchAttrText; - FixedText* m_pSearchLabel; - - VclFrame* m_pReplaceFrame; - ComboBox* m_pReplaceLB; - ListBox* m_pReplaceTmplLB; - FixedText* m_pReplaceAttrText; - - PushButton* m_pSearchBtn; - PushButton* m_pSearchAllBtn; - PushButton* m_pReplaceBtn; - PushButton* m_pReplaceAllBtn; - - VclFrame* m_pComponentFrame; - PushButton* m_pSearchComponent1PB; - PushButton* m_pSearchComponent2PB; - - CheckBox* m_pMatchCaseCB; - CheckBox* m_pWordBtn; - - PushButton* m_pCloseBtn; - CheckBox* m_pIgnoreDiacritics; - CheckBox* m_pIgnoreKashida; - CheckBox* m_pSelectionBtn; - CheckBox* m_pBackwardsBtn; - CheckBox* m_pRegExpBtn; - CheckBox* m_pSimilarityBox; - PushButton* m_pSimilarityBtn; - CheckBox* m_pLayoutBtn; - CheckBox* m_pNotesBtn; - CheckBox* m_pJapMatchFullHalfWidthCB; - CheckBox* m_pJapOptionsCB; - PushButton* m_pJapOptionsBtn; - - PushButton* m_pAttributeBtn; - PushButton* m_pFormatBtn; - PushButton* m_pNoFormatBtn; - - VclContainer* m_pCalcGrid; - FixedText* m_pCalcSearchInFT; - ListBox* m_pCalcSearchInLB; - FixedText* m_pCalcSearchDirFT; - RadioButton* m_pRowsBtn; - RadioButton* m_pColumnsBtn; - CheckBox* m_pAllSheetsCB; + VclPtr<VclFrame> m_pSearchFrame; + VclPtr<ComboBox> m_pSearchLB; + VclPtr<ListBox> m_pSearchTmplLB; + VclPtr<FixedText> m_pSearchAttrText; + VclPtr<FixedText> m_pSearchLabel; + + VclPtr<VclFrame> m_pReplaceFrame; + VclPtr<ComboBox> m_pReplaceLB; + VclPtr<ListBox> m_pReplaceTmplLB; + VclPtr<FixedText> m_pReplaceAttrText; + + VclPtr<PushButton> m_pSearchBtn; + VclPtr<PushButton> m_pSearchAllBtn; + VclPtr<PushButton> m_pReplaceBtn; + VclPtr<PushButton> m_pReplaceAllBtn; + + VclPtr<VclFrame> m_pComponentFrame; + VclPtr<PushButton> m_pSearchComponent1PB; + VclPtr<PushButton> m_pSearchComponent2PB; + + VclPtr<CheckBox> m_pMatchCaseCB; + VclPtr<CheckBox> m_pWordBtn; + + VclPtr<PushButton> m_pCloseBtn; + VclPtr<CheckBox> m_pIgnoreDiacritics; + VclPtr<CheckBox> m_pIgnoreKashida; + VclPtr<CheckBox> m_pSelectionBtn; + VclPtr<CheckBox> m_pBackwardsBtn; + VclPtr<CheckBox> m_pRegExpBtn; + VclPtr<CheckBox> m_pSimilarityBox; + VclPtr<PushButton> m_pSimilarityBtn; + VclPtr<CheckBox> m_pLayoutBtn; + VclPtr<CheckBox> m_pNotesBtn; + VclPtr<CheckBox> m_pJapMatchFullHalfWidthCB; + VclPtr<CheckBox> m_pJapOptionsCB; + VclPtr<PushButton> m_pJapOptionsBtn; + + VclPtr<PushButton> m_pAttributeBtn; + VclPtr<PushButton> m_pFormatBtn; + VclPtr<PushButton> m_pNoFormatBtn; + + VclPtr<VclContainer> m_pCalcGrid; + VclPtr<FixedText> m_pCalcSearchInFT; + VclPtr<ListBox> m_pCalcSearchInLB; + VclPtr<FixedText> m_pCalcSearchDirFT; + VclPtr<RadioButton> m_pRowsBtn; + VclPtr<RadioButton> m_pColumnsBtn; + VclPtr<CheckBox> m_pAllSheetsCB; SfxBindings& rBindings; bool bWriter; diff --git a/include/svx/stddlg.hxx b/include/svx/stddlg.hxx index 85cdf46c5b52..a3e3df05f628 100644 --- a/include/svx/stddlg.hxx +++ b/include/svx/stddlg.hxx @@ -28,7 +28,6 @@ class SVX_DLLPUBLIC SvxStandardDialog: public SfxModalDialog { public: SvxStandardDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ); - virtual ~SvxStandardDialog(); short Execute() SAL_OVERRIDE; diff --git a/include/svx/subtoolboxcontrol.hxx b/include/svx/subtoolboxcontrol.hxx index e7f2904a456f..7921a270f405 100644 --- a/include/svx/subtoolboxcontrol.hxx +++ b/include/svx/subtoolboxcontrol.hxx @@ -36,7 +36,7 @@ public: virtual ~SvxSubToolBoxControl(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx index 08231959c61f..ed0ce097989c 100644 --- a/include/svx/svdedxv.hxx +++ b/include/svx/svdedxv.hxx @@ -65,12 +65,12 @@ protected: SdrPageView* pTextEditPV; SdrOutliner* pTextEditOutliner; // outliner for the TextEdit OutlinerView* pTextEditOutlinerView; // current view of the outliners - vcl::Window* pTextEditWin; // matching window to pTextEditOutlinerView + VclPtr<vcl::Window> pTextEditWin; // matching window to pTextEditOutlinerView vcl::Cursor* pTextEditCursorMerker; // to restore the cursor in each window ImpSdrEditPara* pEditPara; // trashbin for everything else to stay compatible SdrObject* pMacroObj; SdrPageView* pMacroPV; - vcl::Window* pMacroWin; + VclPtr<vcl::Window> pMacroWin; Rectangle aTextEditArea; Rectangle aMinTextEditArea; diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 917182aface2..ea9e4c222919 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -170,7 +170,7 @@ protected: SdrOutliner* pDrawOutliner; // an Outliner for outputting text SdrOutliner* pHitTestOutliner;// an Outliner for the HitTest sal_uIntPtr nDefTextHgt; // Default text heigth in logical units - OutputDevice* pRefOutDev; // ReferenceDevice for the EditEngine + VclPtr<OutputDevice> pRefOutDev; // ReferenceDevice for the EditEngine /// Set if we are doing tiled rendering. bool mbTiledRendering; LibreOfficeKitCallback mpLibreOfficeKitCallback; @@ -335,7 +335,7 @@ public: // ReferenceDevice for the EditEngine void SetRefDevice(OutputDevice* pDev); - OutputDevice* GetRefDevice() const { return pRefOutDev; } + OutputDevice* GetRefDevice() const { return pRefOutDev.get(); } /// Set if we are doing tiled rendering. void setTiledRendering(bool bTiledRendering); /// Are we doing tiled rendering? diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index ffa7f29ea5fb..74b5a18ee290 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/uno/Any.hxx> #include <cppuhelper/weakref.hxx> #include <rtl/ustring.hxx> +#include <vcl/vclptr.hxx> #include <svl/lstner.hxx> #include <svl/poolitem.hxx> #include <svx/svdtypes.hxx> @@ -174,7 +175,7 @@ class SVX_DLLPUBLIC SdrObjMacroHitRec public: Point aPos; Point aDownPos; - OutputDevice* pOut; + VclPtr<OutputDevice> pOut; const SetOfByte* pVisiLayer; const SdrPageView* pPageView; sal_uInt16 nTol; diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index f228a1c308f1..cdb2ea62c7ba 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -134,10 +134,10 @@ class SVX_DLLPUBLIC SdrPaintView : public SfxListener, public SfxRepeatTarget, p protected: SdrModel* pMod; #ifdef DBG_UTIL - SdrItemBrowser* pItemBrowser; + VclPtr<SdrItemBrowser> pItemBrowser; #endif - const OutputDevice* pActualOutDev; // Nur zum vergleichen - OutputDevice* pDragWin; + VclPtr<OutputDevice> pActualOutDev; // Nur zum vergleichen + VclPtr<OutputDevice> pDragWin; SfxStyleSheet* pDefaultStyleSheet; OUString aAktLayer; // Aktueller Zeichenlayer @@ -517,7 +517,7 @@ public: // bei bShow=sal_False wird der Browser destruiert #ifdef DBG_UTIL void ShowItemBrowser(bool bShow=true); - bool IsItemBrowserVisible() const { return pItemBrowser!=NULL && GetItemBrowser()->IsVisible(); } + bool IsItemBrowserVisible() const { return pItemBrowser!=nullptr && GetItemBrowser()->IsVisible(); } vcl::Window* GetItemBrowser() const; #endif diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 080c807aa562..87ada7aa6c11 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -42,8 +42,8 @@ namespace linguistic2{ }}}} class SvxSpellWrapper; -typedef SfxTabPage* (*CreateSvxDistributePage)(vcl::Window *pParent, const SfxItemSet &rAttrSet, SvxDistributeHorizontal eHor, SvxDistributeVertical eVer); -typedef const sal_uInt16* (*DialogGetRanges)(); +typedef VclPtr<SfxTabPage> (*CreateSvxDistributePage)(vcl::Window *pParent, const SfxItemSet &rAttrSet, SvxDistributeHorizontal eHor, SvxDistributeVertical eVer); +typedef const sal_uInt16* (*DialogGetRanges)(); struct ExchangeData; class INetURLObject; diff --git a/include/svx/swframeexample.hxx b/include/svx/swframeexample.hxx index 45bb9098c83a..494c241f74e9 100644 --- a/include/svx/swframeexample.hxx +++ b/include/svx/swframeexample.hxx @@ -74,7 +74,6 @@ protected: public: SvxSwFrameExample(vcl::Window* pParent, WinBits nStyle); - virtual ~SvxSwFrameExample(); inline void SetWrap(sal_uInt16 nW) { nWrap = nW; } diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index 329bb208145b..42c79454ee20 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -163,7 +163,7 @@ public: SvxStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox); virtual ~SvxStyleToolBoxControl(); - virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; @@ -210,7 +210,7 @@ public: virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; }; class BorderColorStatus @@ -242,7 +242,7 @@ public: virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE; }; @@ -253,7 +253,7 @@ public: SvxFrameToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; }; @@ -265,7 +265,7 @@ public: SvxFrameLineStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; }; diff --git a/include/svx/tbxalign.hxx b/include/svx/tbxalign.hxx index 00a98d1eaf80..71322ee67bcf 100644 --- a/include/svx/tbxalign.hxx +++ b/include/svx/tbxalign.hxx @@ -32,7 +32,7 @@ public: virtual void SAL_CALL updateImage() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; SFX_DECL_TOOLBOX_CONTROL(); diff --git a/include/svx/tbxcolorupdate.hxx b/include/svx/tbxcolorupdate.hxx index 343d0fe768f5..9f00d1386a64 100644 --- a/include/svx/tbxcolorupdate.hxx +++ b/include/svx/tbxcolorupdate.hxx @@ -24,6 +24,7 @@ #include <tools/gen.hxx> #include <tools/color.hxx> +#include <vcl/vclptr.hxx> class ToolBox; class VirtualDevice; @@ -44,8 +45,8 @@ namespace svx { public: ToolboxButtonColorUpdater( sal_uInt16 nSlotId, - sal_uInt16 nTbxBtnId, - ToolBox* ptrTbx); + sal_uInt16 nTbxBtnId, + ToolBox* ptrTbx); ~ToolboxButtonColorUpdater(); void Update( const Color& rColor ); @@ -53,7 +54,7 @@ namespace svx private: sal_uInt16 mnBtnId; sal_uInt16 mnSlotId; - ToolBox* mpTbx; + VclPtr<ToolBox> mpTbx; Color maCurColor; Rectangle maUpdRect; Size maBmpSize; diff --git a/include/svx/tbxcustomshapes.hxx b/include/svx/tbxcustomshapes.hxx index c4ebc1b5dd9f..2be1ac8807c9 100644 --- a/include/svx/tbxcustomshapes.hxx +++ b/include/svx/tbxcustomshapes.hxx @@ -35,7 +35,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; SFX_DECL_TOOLBOX_CONTROL(); diff --git a/include/svx/txencbox.hxx b/include/svx/txencbox.hxx index e0df5adeef38..43f028bcaae7 100644 --- a/include/svx/txencbox.hxx +++ b/include/svx/txencbox.hxx @@ -35,6 +35,7 @@ private: public: SvxTextEncodingBox( vcl::Window* pParent, WinBits nBits ); virtual ~SvxTextEncodingBox(); + virtual void dispose() SAL_OVERRIDE; /** Fill with all known encodings but exclude those matching one or more given flags as defined in rtl/tencinfo.h diff --git a/include/toolkit/awt/scrollabledialog.hxx b/include/toolkit/awt/scrollabledialog.hxx index e75fac70b0ed..70e2b32be919 100644 --- a/include/toolkit/awt/scrollabledialog.hxx +++ b/include/toolkit/awt/scrollabledialog.hxx @@ -43,8 +43,8 @@ namespace toolkit template < class T > class ScrollableWrapper : public T, public ScrollableInterface { - ScrollBar maHScrollBar; - ScrollBar maVScrollBar; + VclPtr<ScrollBar> maHScrollBar; + VclPtr<ScrollBar> maVScrollBar; Size maScrollArea; bool mbHasHoriBar; bool mbHasVertBar; @@ -59,6 +59,7 @@ namespace toolkit public: ScrollableWrapper( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG ); virtual ~ScrollableWrapper(); + virtual void dispose() SAL_OVERRIDE; virtual void SetScrollWidth( long nWidth ) SAL_OVERRIDE; virtual long GetScrollWidth() SAL_OVERRIDE { return maScrollArea.Width(); } virtual void SetScrollHeight( long nHeight ) SAL_OVERRIDE; diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx index 62d167ba10f1..0fdc2a8f083f 100644 --- a/include/toolkit/awt/vclxaccessiblecomponent.hxx +++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx @@ -33,6 +33,7 @@ #include <comphelper/accessiblecomponenthelper.hxx> #include <tools/link.hxx> +#include <vcl/vclptr.hxx> namespace vcl { class Window; } class VCLXWindow; @@ -83,7 +84,11 @@ public: virtual ~VCLXAccessibleComponent(); VCLXWindow* GetVCLXWindow() const { return mpVCLXindow; } - vcl::Window* GetWindow() const; + VclPtr<vcl::Window> GetWindow() const; + template< class derived_type > VclPtr< derived_type > GetAs() const { + return VclPtr< derived_type >( static_cast< derived_type * >( GetWindow().get() ) ); } + template< class derived_type > VclPtr< derived_type > GetAsDynamic() const { + return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetWindow().get() ) ); } virtual void SAL_CALL disposing() SAL_OVERRIDE; diff --git a/include/toolkit/awt/vclxdevice.hxx b/include/toolkit/awt/vclxdevice.hxx index 61d568911b38..47a99ea1995e 100644 --- a/include/toolkit/awt/vclxdevice.hxx +++ b/include/toolkit/awt/vclxdevice.hxx @@ -27,43 +27,40 @@ #include <cppuhelper/weak.hxx> #include <osl/mutex.hxx> #include <vcl/virdev.hxx> +#include <vcl/vclptr.hxx> #include <com/sun/star/awt/XUnitConversion.hpp> class OutputDevice; class VirtualDevice; - -// class VCLXDevice - - // For using nDummy, no incompatible update, add a sal_Bool bCreatedWithToolkitMember later... #define FLAGS_CREATEDWITHTOOLKIT 0x00000001 -class TOOLKIT_DLLPUBLIC VCLXDevice : public ::com::sun::star::awt::XDevice, +/// An UNO wrapper for the VCL OutputDevice +class TOOLKIT_DLLPUBLIC VCLXDevice : + public ::com::sun::star::awt::XDevice, public ::com::sun::star::lang::XTypeProvider, public ::com::sun::star::lang::XUnoTunnel, public ::com::sun::star::awt::XUnitConversion, public ::cppu::OWeakObject { friend class VCLXGraphics; + friend class VCLXVirtualDevice; private: - OutputDevice* mpOutputDevice; + VclPtr<OutputDevice> mpOutputDevice; public: void* pDummy; sal_uInt32 nFlags; -protected: - void DestroyOutputDevice(); - public: VCLXDevice(); virtual ~VCLXDevice(); - void SetOutputDevice( OutputDevice* pOutDev ) { mpOutputDevice = pOutDev; } - OutputDevice* GetOutputDevice() const { return mpOutputDevice; } + void SetOutputDevice( const VclPtr<OutputDevice> &pOutDev ) { mpOutputDevice = pOutDev; } + VclPtr<OutputDevice> GetOutputDevice() const { return mpOutputDevice; } void SetCreatedWithToolkit( bool bCreatedWithToolkit ); diff --git a/include/toolkit/awt/vclxgraphics.hxx b/include/toolkit/awt/vclxgraphics.hxx index 627b6759f43b..89a568fe6fa9 100644 --- a/include/toolkit/awt/vclxgraphics.hxx +++ b/include/toolkit/awt/vclxgraphics.hxx @@ -31,6 +31,7 @@ #include <vcl/font.hxx> #include <tools/color.hxx> #include <vcl/vclenum.hxx> +#include <vcl/vclptr.hxx> class OutputDevice; namespace vcl { class Region; } @@ -55,7 +56,7 @@ private: // used to return same reference on each call to getDevice() ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice> mxDevice; - OutputDevice* mpOutputDevice; + VclPtr<OutputDevice> mpOutputDevice; vcl::Font maFont; Color maTextColor; Color maTextFillColor; diff --git a/include/toolkit/awt/vclxprinter.hxx b/include/toolkit/awt/vclxprinter.hxx index 892cc4cb0839..a63f7746911d 100644 --- a/include/toolkit/awt/vclxprinter.hxx +++ b/include/toolkit/awt/vclxprinter.hxx @@ -57,11 +57,11 @@ class VCLXPrinterPropertySet :public VCLXPrinterPropertySet_Base ,public ::cppu::OPropertySetHelper { protected: - std::shared_ptr<Printer> mxPrinter; + VclPtr<Printer> mxPrinter; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice; sal_Int16 mnOrientation; - bool mbHorizontal; + bool mbHorizontal; public: VCLXPrinterPropertySet( const OUString& rPrinterName ); virtual ~VCLXPrinterPropertySet(); diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx index 6306ce6717e3..1ab1f9e8a8d2 100644 --- a/include/toolkit/awt/vclxwindow.hxx +++ b/include/toolkit/awt/vclxwindow.hxx @@ -128,8 +128,12 @@ public: VCLXWindow( bool bWithDefaultProps = false ); virtual ~VCLXWindow(); - virtual void SetWindow( vcl::Window* pWindow ); - vcl::Window* GetWindow() const { return static_cast<vcl::Window*>(GetOutputDevice()); } + virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ); + template< class derived_type > VclPtr< derived_type > GetAs() const { + return VclPtr< derived_type >( static_cast< derived_type * >( GetOutputDevice().get() ) ); } + template< class derived_type > VclPtr< derived_type > GetAsDynamic() const { + return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetOutputDevice().get() ) ); } + VclPtr<vcl::Window> GetWindow() const { return GetAs<vcl::Window>(); } void suspendVclEventListening( ); void resumeVclEventListening( ); diff --git a/include/toolkit/controls/accessiblecontrolcontext.hxx b/include/toolkit/controls/accessiblecontrolcontext.hxx index 78fdfe7cc4d8..b991b80793f3 100644 --- a/include/toolkit/controls/accessiblecontrolcontext.hxx +++ b/include/toolkit/controls/accessiblecontrolcontext.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/XWindow.hpp> +#include <vcl/vclptr.hxx> namespace vcl { class Window; } @@ -116,7 +117,7 @@ namespace toolkit // stops listening at the control model void stopModelListening( ); - vcl::Window* implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const; + VclPtr< vcl::Window > implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const; }; diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx index dc1ae888476f..c902e5c9155c 100644 --- a/include/toolkit/helper/vclunohelper.hxx +++ b/include/toolkit/helper/vclunohelper.hxx @@ -56,11 +56,12 @@ namespace com { namespace sun { namespace star { namespace awt { #include <vcl/bitmapex.hxx> #include <vcl/region.hxx> #include <vcl/metric.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/window.hxx> #include <tools/mapunit.hxx> #include <tools/fldunit.hxx> #include <tools/poly.hxx> -namespace vcl { class Window; } class OutputDevice; class MouseEvent; class KeyEvent; @@ -79,9 +80,9 @@ public: static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap ); // Window - static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow ); - static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 ); - static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer ); + static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow ); + static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 ); + static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer ); static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> GetInterface( vcl::Window* pWindow ); // OutputDevice diff --git a/include/tools/errinf.hxx b/include/tools/errinf.hxx index a16b56a179f4..4a9f07a69d62 100644 --- a/include/tools/errinf.hxx +++ b/include/tools/errinf.hxx @@ -28,9 +28,11 @@ #include <tools/errcode.hxx> #include <tools/toolsdllapi.h> +// FIXME: horrible legacy dependency on VCL from tools. +namespace vcl { class Window; } + class EDcr_Impl; class ErrHdl_Impl; -namespace vcl { class Window; } class ErrorInfo { @@ -115,20 +117,20 @@ private: OUString aArg; }; +struct ErrorContextImpl; class TOOLS_DLLPUBLIC ErrorContext { friend class ErrorHandler; private: - ErrorContext* pNext; - vcl::Window* pWin; + ErrorContextImpl *pImpl; public: ErrorContext(vcl::Window *pWin=0); virtual ~ErrorContext(); virtual bool GetString( sal_uIntPtr nErrId, OUString& rCtxStr ) = 0; - vcl::Window* GetParent() { return pWin; } + vcl::Window* GetParent(); static ErrorContext* GetContext(); }; diff --git a/include/vcl/animate.hxx b/include/vcl/animate.hxx index e966e3feac81..17d62a1a3d1a 100644 --- a/include/vcl/animate.hxx +++ b/include/vcl/animate.hxx @@ -23,6 +23,7 @@ #include <vcl/dllapi.h> #include <vcl/timer.hxx> #include <vcl/bitmapex.hxx> +#include <vcl/vclptr.hxx> #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L @@ -108,17 +109,13 @@ struct AInfo Point aLastSavePoint; Point aStartOrg; Size aStartSize; - OutputDevice* pOutDev; + VclPtr<OutputDevice> pOutDev; void* pViewData; long nExtraData; bool bWithSize; bool bPause; - AInfo() : pOutDev( NULL ), - pViewData( NULL ), - nExtraData( 0L ), - bWithSize( false ), - bPause( false ) {} + AInfo(); }; class ImplAnimView; diff --git a/include/vcl/btndlg.hxx b/include/vcl/btndlg.hxx index fc51c15b95d1..c7fdab639d1b 100644 --- a/include/vcl/btndlg.hxx +++ b/include/vcl/btndlg.hxx @@ -40,6 +40,7 @@ class VCL_DLLPUBLIC ButtonDialog : public Dialog public: ButtonDialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG ); virtual ~ButtonDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 011d45e14399..4b7683d467ae 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -17,6 +17,7 @@ #include <tools/fldunit.hxx> #include <vcl/dllapi.h> #include <vcl/window.hxx> +#include <vcl/vclptr.hxx> #include <map> #include <set> #include <stack> @@ -45,6 +46,7 @@ class VCL_DLLPUBLIC VclBuilder { public: typedef std::map<OString, OString> stringmap; + /// These functions return a vcl::Window with a reference count of one. typedef vcl::Window* (*customMakeWidget)(vcl::Window *pParent, stringmap &rVec); public: @@ -56,8 +58,11 @@ public: const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); ~VclBuilder(); + ///releases references and disposes all children. + void disposeBuilder(); + //sID must exist and be of type T - template <typename T> T* get(T*& ret, const OString& sID); + template <typename T> T* get(VclPtr<T>& ret, const OString& sID); //sID may not exist, but must be of type T if it does template <typename T /*= vcl::Window if we had c++11*/> T* get(const OString& sID); @@ -73,7 +78,7 @@ public: short get_response(const vcl::Window *pWindow) const; OString get_by_window(const vcl::Window *pWindow) const; - void delete_by_window(const vcl::Window *pWindow); + void delete_by_window(vcl::Window *pWindow); //release ownership of pWindow, i.e. don't delete it void drop_ownership(const vcl::Window *pWindow); @@ -147,7 +152,7 @@ private: struct WinAndId { OString m_sID; - vcl::Window *m_pWindow; + VclPtr<vcl::Window> m_pWindow; short m_nResponseId; PackingData m_aPackingData; WinAndId(const OString &rId, vcl::Window *pWindow, bool bVertical) @@ -263,7 +268,7 @@ private: } }; - typedef std::map< vcl::Window*, stringmap> AtkMap; + typedef std::map< VclPtr<vcl::Window>, stringmap> AtkMap; struct ParserState { @@ -290,7 +295,7 @@ private: Translations m_aTranslations; - std::map< vcl::Window*, vcl::Window*> m_aRedundantParentWidgets; + std::map< VclPtr<vcl::Window>, VclPtr<vcl::Window> > m_aRedundantParentWidgets; std::vector<SizeGroup> m_aSizeGroups; @@ -298,13 +303,11 @@ private: std::vector<MnemonicWidgetMap> m_aMnemonicWidgetMaps; - std::vector<VclExpander*> m_aExpanderWidgets; + std::vector< VclPtr<VclExpander> > m_aExpanderWidgets; sal_uInt16 m_nLastToolbarId; - ParserState() - : m_nLastToolbarId(0) - {} + ParserState(); }; void loadTranslations(const LanguageTag &rLanguageTag, const OUString &rUri); @@ -313,7 +316,7 @@ private: OString m_sID; OString m_sHelpRoot; ResHookProc m_pStringReplace; - vcl::Window *m_pParent; + VclPtr<vcl::Window> m_pParent; bool m_bToplevelHasDeferredInit; bool m_bToplevelHasDeferredProperties; bool m_bToplevelParentFound; @@ -339,12 +342,12 @@ private: css::uno::Reference<css::frame::XFrame> m_xFrame; private: - vcl::Window *insertObject(vcl::Window *pParent, + VclPtr<vcl::Window> insertObject(vcl::Window *pParent, const OString &rClass, const OString &rID, stringmap &rProps, stringmap &rPangoAttributes, stringmap &rAtkProps); - vcl::Window *makeObject(vcl::Window *pParent, + VclPtr<vcl::Window> makeObject(vcl::Window *pParent, const OString &rClass, const OString &rID, stringmap &rVec); @@ -363,7 +366,7 @@ private: void handleTranslations(xmlreader::XmlReader &reader); void handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader); - vcl::Window* handleObject(vcl::Window *pParent, xmlreader::XmlReader &reader); + VclPtr<vcl::Window> handleObject(vcl::Window *pParent, xmlreader::XmlReader &reader); void handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader); void applyPackingProperty(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader); void collectProperty(xmlreader::XmlReader &reader, const OString &rID, stringmap &rVec); @@ -405,7 +408,7 @@ private: }; template <typename T> -inline T* VclBuilder::get(T*& ret, const OString& sID) +inline T* VclBuilder::get(VclPtr<T>& ret, const OString& sID) { vcl::Window *w = get_by_name(sID); SAL_WARN_IF(!w, "vcl.layout", "widget \"" << sID.getStr() << "\" not found in .ui"); @@ -414,7 +417,7 @@ inline T* VclBuilder::get(T*& ret, const OString& sID) assert(w); assert(dynamic_cast<T*>(w)); ret = static_cast<T*>(w); - return ret; + return ret.get(); } //sID may not exist, but must be of type T if it does @@ -446,19 +449,24 @@ inline PopupMenu* VclBuilder::get_menu(PopupMenu*& ret, const OString& sID) // //i.e. class Dialog : public SystemWindow, public VclBuilderContainer //not class Dialog : public VclBuilderContainer, public SystemWindow +// +//With the new 'dispose' framework, it is necessary to force the builder +//dispose before the Window dispose; so a Dialog::dispose() method would +//finish: disposeBuilder(); SystemWindow::dispose() to capture this ordering. class VCL_DLLPUBLIC VclBuilderContainer { public: VclBuilderContainer(); virtual ~VclBuilderContainer(); + void disposeBuilder(); static OUString getUIRootDir(); bool hasBuilder() const { return m_pUIBuilder != NULL; } css::uno::Reference<css::frame::XFrame> getFrame() { return m_pUIBuilder->getFrame(); } - template <typename T> T* get(T*& ret, const OString& sID) + template <typename T> T* get(VclPtr<T>& ret, const OString& sID) { return m_pUIBuilder->get<T>(ret, sID); } diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index 1a100c0f83dd..937c4ff75f48 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -28,7 +28,7 @@ #include <vcl/bitmap.hxx> #include <vcl/salnativewidgets.hxx> #include <rsc/rsc-vcl-shared-types.hxx> - +#include <vcl/vclptr.hxx> #include <vector> class UserDrawEvent; @@ -37,7 +37,7 @@ class ImplCommonButtonData; class VCL_DLLPUBLIC Button : public Control { private: - ImplCommonButtonData *mpButtonData; + std::unique_ptr<ImplCommonButtonData> mpButtonData; Link maClickHdl; /// Command URL (like .uno:Save) in case the button should handle it. @@ -64,6 +64,7 @@ protected: public: virtual ~Button(); + virtual void dispose() SAL_OVERRIDE; virtual void Click(); @@ -153,7 +154,6 @@ protected: public: explicit PushButton( vcl::Window* pParent, WinBits nStyle = 0 ); explicit PushButton( vcl::Window* pParent, const ResId& ); - virtual ~PushButton(); virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE; @@ -226,7 +226,6 @@ public: virtual void Click() SAL_OVERRIDE; }; - class VCL_DLLPUBLIC CancelButton : public PushButton { protected: @@ -275,7 +274,7 @@ public: class VCL_DLLPUBLIC RadioButton : public Button { private: - std::shared_ptr< std::vector<RadioButton*> > m_xGroup; + std::shared_ptr< std::vector< VclPtr< RadioButton > > > m_xGroup; Rectangle maStateRect; Rectangle maMouseRect; Image maImage; @@ -336,6 +335,7 @@ public: explicit RadioButton( vcl::Window* pParent, WinBits nWinStyle = 0 ); explicit RadioButton( vcl::Window* pParent, const ResId& ); virtual ~RadioButton(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE; @@ -389,7 +389,7 @@ public: on return contains the <code>RadioButton</code>s in the same group as this <code>RadioButton</code>. */ - std::vector<RadioButton*> GetRadioButtonGroup(bool bIncludeThis = true) const; + std::vector<VclPtr<RadioButton> > GetRadioButtonGroup(bool bIncludeThis = true) const; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; @@ -518,9 +518,8 @@ private: ImageButton & operator= ( const ImageButton & ) SAL_DELETED_FUNCTION; public: - ImageButton( vcl::Window* pParent, WinBits nStyle = 0 ); - ImageButton( vcl::Window* pParent, const ResId& rResId ); - virtual ~ImageButton(); + ImageButton( vcl::Window* pParent, WinBits nStyle = 0 ); + ImageButton( vcl::Window* pParent, const ResId& rResId ); }; class VCL_DLLPUBLIC ImageRadioButton : public RadioButton @@ -530,7 +529,6 @@ class VCL_DLLPUBLIC ImageRadioButton : public RadioButton public: explicit ImageRadioButton( vcl::Window* pParent, WinBits nStyle = 0 ); - virtual ~ImageRadioButton(); }; class VCL_DLLPUBLIC TriStateBox : public CheckBox @@ -540,7 +538,6 @@ class VCL_DLLPUBLIC TriStateBox : public CheckBox public: explicit TriStateBox( vcl::Window* pParent, WinBits nStyle = 0 ); - virtual ~TriStateBox(); }; class VCL_DLLPUBLIC DisclosureButton : public CheckBox @@ -553,8 +550,6 @@ public: virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; }; -typedef rtl::Reference<DisclosureButton> DisclosureButtonPtr; - #endif // INCLUDED_VCL_BUTTON_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/cairo.hxx b/include/vcl/cairo.hxx index c8cc23e802b3..13983a84d63f 100644 --- a/include/vcl/cairo.hxx +++ b/include/vcl/cairo.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> #include <boost/shared_ptr.hpp> +#include <vcl/vclptr.hxx> typedef struct _cairo_surface cairo_surface_t; typedef struct _cairo cairo_t; @@ -49,7 +50,7 @@ namespace cairo { virtual boost::shared_ptr<Surface> getSimilar(int cairo_content_type, int width, int height) const = 0; /// factory for VirDev on this surface - virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const = 0; + virtual VclPtr<VirtualDevice> createVirtualDevice() const = 0; /// Resize the surface (possibly destroying content), only possible for X11 typically /// so on failure caller must create a new surface instead diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index 95ec9bc9e215..a835a40d215f 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -32,23 +32,19 @@ class ImplListBoxFloatingWindow; class ImplListBox; class ImplBtn; - -// - ComboBox - - - class VCL_DLLPUBLIC ComboBox : public Edit { private: - Edit* mpSubEdit; - ImplListBox* mpImplLB; - ImplBtn* mpBtn; - ImplListBoxFloatingWindow* mpFloatWin; + VclPtr<Edit> mpSubEdit; + VclPtr<ImplListBox> mpImplLB; + VclPtr<ImplBtn> mpBtn; + VclPtr<ImplListBoxFloatingWindow> mpFloatWin; sal_uInt16 mnDDHeight; sal_Unicode mcMultiSep; bool mbDDAutoSize : 1; bool mbSyntheticModify : 1; bool mbMatchCase : 1; - sal_Int32 m_nMaxWidthChars; + sal_Int32 m_nMaxWidthChars; Link maSelectHdl; Link maDoubleClickHdl; boost::signals2::scoped_connection mAutocompleteConnection; @@ -73,7 +69,7 @@ private: DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* ); DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* ); DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* ); - DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* ); + DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* ); SAL_DLLPRIVATE void ImplClickButtonHandler( ImplBtn* ); SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* ); @@ -90,11 +86,13 @@ protected: protected: bool IsDropDownBox() const { return mpFloatWin != nullptr; } - virtual void FillLayoutData() const SAL_OVERRIDE; + virtual void FillLayoutData() const SAL_OVERRIDE; + public: explicit ComboBox( vcl::Window* pParent, WinBits nStyle = 0 ); explicit ComboBox( vcl::Window* pParent, const ResId& ); virtual ~ComboBox(); + virtual void dispose() SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -117,12 +115,12 @@ public: Rectangle GetDropDownPosSizePixel() const; - void AdaptDropDownLineCountToMaximum(); + void AdaptDropDownLineCountToMaximum(); void SetDropDownLineCount( sal_uInt16 nLines ); sal_uInt16 GetDropDownLineCount() const; void EnableAutoSize( bool bAuto ); - bool IsAutoSizeEnabled() const { return mbDDAutoSize; } + bool IsAutoSizeEnabled() const { return mbDDAutoSize; } void EnableDDAutoWidth( bool b ); diff --git a/include/vcl/controllayout.hxx b/include/vcl/controllayout.hxx index 0856a69946b5..ea85d379a792 100644 --- a/include/vcl/controllayout.hxx +++ b/include/vcl/controllayout.hxx @@ -24,8 +24,7 @@ #include <tools/gen.hxx> #include <vector> #include <vcl/dllapi.h> - -class Control; +#include <vcl/ctrl.hxx> namespace vcl { @@ -42,9 +41,9 @@ struct VCL_DLLPUBLIC ControlLayoutData // start indices of lines std::vector< long > m_aLineIndices; // notify parent control on destruction - const Control* m_pParent; + VclPtr<const Control> m_pParent; - ControlLayoutData() : m_pParent( NULL ) {} + ControlLayoutData(); ~ControlLayoutData(); Rectangle GetCharacterBounds( long nIndex ) const; diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx index d85c85885b2c..4d1f9030a074 100644 --- a/include/vcl/ctrl.hxx +++ b/include/vcl/ctrl.hxx @@ -127,6 +127,7 @@ public: explicit Control( vcl::Window* pParent, WinBits nWinStyle = 0 ); explicit Control( vcl::Window* pParent, const ResId& ); virtual ~Control(); + virtual void dispose() SAL_OVERRIDE; virtual void EnableRTL ( bool bEnable = true ) SAL_OVERRIDE; diff --git a/include/vcl/cursor.hxx b/include/vcl/cursor.hxx index 2d3b83c0b119..eecbd0c0ca8a 100644 --- a/include/vcl/cursor.hxx +++ b/include/vcl/cursor.hxx @@ -23,6 +23,7 @@ #include <tools/gen.hxx> #include <tools/link.hxx> #include <vcl/dllapi.h> +#include <vcl/vclptr.hxx> struct ImplCursorData; namespace vcl { class Window; } @@ -40,7 +41,7 @@ class VCL_DLLPUBLIC Cursor { private: ImplCursorData* mpData; - vcl::Window* mpWindow; // only for shadow cursor + VclPtr<vcl::Window> mpWindow; // only for shadow cursor long mnSlant; Size maSize; Point maPos; diff --git a/include/vcl/decoview.hxx b/include/vcl/decoview.hxx index 4094f693bca2..2de96a5941dd 100644 --- a/include/vcl/decoview.hxx +++ b/include/vcl/decoview.hxx @@ -21,6 +21,7 @@ #define INCLUDED_VCL_DECOVIEW_HXX #include <vcl/dllapi.h> +#include <vcl/vclptr.hxx> #include <rsc/rsc-vcl-shared-types.hxx> class Rectangle; @@ -70,7 +71,7 @@ class OutputDevice; class VCL_DLLPUBLIC DecorationView { private: - OutputDevice* mpOutDev; + VclPtr<OutputDevice> mpOutDev; public: DecorationView(OutputDevice* pOutDev); diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 3dbde87e371c..652a06965e27 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -24,6 +24,7 @@ #include <vcl/dllapi.h> #include <vcl/syswin.hxx> #include <vcl/timer.hxx> +#include <vcl/vclptr.hxx> // parameter to pass to the dialog constructor if really no parent is wanted // whereas NULL chooses the default dialog parent @@ -39,7 +40,7 @@ class VclButtonBox; class VCL_DLLPUBLIC Dialog : public SystemWindow { private: - Dialog* mpPrevExecuteDlg; + VclPtr<Dialog> mpPrevExecuteDlg; DialogImpl* mpDialogImpl; long mnMousePositioned; bool mbInExecute; @@ -47,8 +48,8 @@ private: bool mbInClose; bool mbModalMode; - VclButtonBox* mpActionArea; - VclBox* mpContentArea; + VclPtr<VclButtonBox> mpActionArea; + VclPtr<VclBox> mpContentArea; SAL_DLLPRIVATE void ImplInitDialogData(); SAL_DLLPRIVATE void ImplInitSettings(); @@ -74,13 +75,14 @@ protected: protected: friend class VclBuilder; - void set_action_area(VclButtonBox *pBox); - void set_content_area(VclBox *pBox); + void set_action_area(VclButtonBox* pBox); + void set_content_area(VclBox* pBox); public: explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG ); explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ); virtual ~Dialog(); + virtual void dispose() SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; @@ -88,8 +90,8 @@ public: virtual void queue_resize(StateChangedType eReason = StateChangedType::LAYOUT) SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; - VclButtonBox* get_action_area() { return mpActionArea;} - VclBox* get_content_area() { return mpContentArea;} + VclButtonBox* get_action_area() { return mpActionArea; } + VclBox* get_content_area() { return mpContentArea; } virtual bool Close() SAL_OVERRIDE; diff --git a/include/vcl/dockingarea.hxx b/include/vcl/dockingarea.hxx index 7fa2ad55fec0..4bc2deff6b02 100644 --- a/include/vcl/dockingarea.hxx +++ b/include/vcl/dockingarea.hxx @@ -37,6 +37,7 @@ private: public: explicit DockingAreaWindow( vcl::Window* pParent ); virtual ~DockingAreaWindow(); + virtual void dispose() SAL_OVERRIDE; void SetAlign( WindowAlign eNewAlign ); WindowAlign GetAlign() const; diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx index dac66c731c06..71c81818fa22 100644 --- a/include/vcl/dockwin.hxx +++ b/include/vcl/dockwin.hxx @@ -80,12 +80,12 @@ class ImplDockingWindowWrapper private: // the original 'Docking'window - vcl::Window *mpDockingWindow; + VclPtr<vcl::Window> mpDockingWindow; // the original DockingWindow members - FloatingWindow* mpFloatWin; - vcl::Window* mpOldBorderWin; - vcl::Window* mpParent; + VclPtr<FloatingWindow> mpFloatWin; + VclPtr<vcl::Window> mpOldBorderWin; + VclPtr<vcl::Window> mpParent; Point maFloatPos; Point maDockPos; Point maMouseOff; @@ -225,8 +225,8 @@ class VCL_DLLPUBLIC DockingWindow { class ImplData; private: - FloatingWindow* mpFloatWin; - vcl::Window* mpOldBorderWin; + VclPtr<FloatingWindow> mpFloatWin; + VclPtr<vcl::Window> mpOldBorderWin; ImplData* mpImplData; Point maFloatPos; Point maDockPos; @@ -261,7 +261,7 @@ private: mbIsCalculatingInitialLayoutSize:1, mbInitialLayoutDone:1; - vcl::Window* mpDialogParent; + VclPtr<vcl::Window> mpDialogParent; SAL_DLLPRIVATE void ImplInitDockingWindowData(); SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox); @@ -299,6 +299,7 @@ public: DockingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); virtual ~DockingWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void StartDocking(); virtual bool Docking( const Point& rPos, Rectangle& rRect ); diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx index ec05923011b8..f32c93269f80 100644 --- a/include/vcl/edit.hxx +++ b/include/vcl/edit.hxx @@ -28,6 +28,7 @@ #include <vcl/ctrl.hxx> #include <vcl/menu.hxx> #include <vcl/dndhelp.hxx> +#include <vcl/vclptr.hxx> #include <com/sun/star/uno/Reference.h> namespace com { @@ -68,7 +69,7 @@ enum AutocompleteAction{ AUTOCOMPLETE_KEYINPUT, AUTOCOMPLETE_TABFORWARD, AUTOCOM class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient { private: - Edit* mpSubEdit; + VclPtr<Edit> mpSubEdit; Timer* mpUpdateDataTimer; TextFilter* mpFilterText; DDInfo* mpDDInfo; @@ -85,7 +86,7 @@ private: sal_Int32 mnMaxWidthChars; AutocompleteAction meAutocompleteAction; sal_Unicode mcEchoChar; - bool mbModified:1, + bool mbModified:1, mbInternModified:1, mbReadOnly:1, mbInsertMode:1, @@ -164,6 +165,7 @@ public: Edit( vcl::Window* pParent, WinBits nStyle = WB_BORDER ); Edit( vcl::Window* pParent, const ResId& rResId ); virtual ~Edit(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx index 05a54dc7dfc5..89929d085018 100644 --- a/include/vcl/event.hxx +++ b/include/vcl/event.hxx @@ -26,10 +26,11 @@ #include <vcl/keycod.hxx> #include <vcl/cmdevt.hxx> #include <vcl/settings.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/outdev.hxx> +#include <vcl/window.hxx> class AllSettings; -class OutputDevice; -namespace vcl { class Window; } struct IDataObject; namespace com { namespace sun { namespace star { namespace awt { @@ -302,7 +303,7 @@ inline HelpEvent::HelpEvent( HelpEventMode nHelpMode ) class VCL_DLLPUBLIC UserDrawEvent { private: - OutputDevice* mpOutDev; + VclPtr<OutputDevice> mpOutDev; Rectangle maOutRect; sal_uInt16 mnItemId; sal_uInt16 mnStyle; @@ -411,7 +412,7 @@ enum class MouseNotifyEvent class VCL_DLLPUBLIC NotifyEvent { private: - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; void* mpData; MouseNotifyEvent mnEventType; long mnRetValue; @@ -435,23 +436,6 @@ public: const CommandEvent* GetCommandEvent() const; }; -inline NotifyEvent::NotifyEvent() -{ - mpWindow = NULL; - mpData = NULL; - mnEventType = MouseNotifyEvent::NONE; - mnRetValue = 0; -} - -inline NotifyEvent::NotifyEvent( MouseNotifyEvent nEventType, vcl::Window* pWindow, - const void* pEvent, long nRet ) -{ - mpWindow = pWindow; - mpData = const_cast<void*>(pEvent); - mnEventType = nEventType; - mnRetValue = nRet; -} - inline const KeyEvent* NotifyEvent::GetKeyEvent() const { if ( (mnEventType == MouseNotifyEvent::KEYINPUT) || (mnEventType == MouseNotifyEvent::KEYUP) ) diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 179c16a974a1..cdc80d9cd31c 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -41,7 +41,7 @@ class LanguageTag; class VCL_DLLPUBLIC FormatterBase { private: - Edit* mpField; + VclPtr<Edit> mpField; LocaleDataWrapper* mpLocaleDataWrapper; Link maErrorLink; bool mbReformat; @@ -485,7 +485,6 @@ class VCL_DLLPUBLIC PatternField : public SpinField, public PatternFormatter { public: explicit PatternField( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~PatternField(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -505,7 +504,6 @@ protected: public: explicit NumericField( vcl::Window* pParent, WinBits nWinStyle ); explicit NumericField( vcl::Window* pParent, const ResId& ); - virtual ~NumericField(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -535,7 +533,6 @@ protected: public: explicit MetricField( vcl::Window* pParent, WinBits nWinStyle ); explicit MetricField( vcl::Window* pParent, const ResId& ); - virtual ~MetricField(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -602,7 +599,6 @@ class VCL_DLLPUBLIC CurrencyField : public SpinField, public CurrencyFormatter { public: CurrencyField( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~CurrencyField(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -632,7 +628,6 @@ protected: public: explicit DateField( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~DateField(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -666,7 +661,6 @@ protected: public: explicit TimeField( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~TimeField(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -696,7 +690,6 @@ class VCL_DLLPUBLIC PatternBox : public ComboBox, public PatternFormatter { public: PatternBox( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~PatternBox(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -715,7 +708,6 @@ class VCL_DLLPUBLIC NumericBox : public ComboBox, public NumericFormatter { public: explicit NumericBox( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~NumericBox(); virtual Size CalcMinimumSize() const SAL_OVERRIDE; @@ -739,7 +731,6 @@ class VCL_DLLPUBLIC MetricBox : public ComboBox, public MetricFormatter { public: explicit MetricBox( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~MetricBox(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -772,7 +763,6 @@ class VCL_DLLPUBLIC CurrencyBox : public ComboBox, public CurrencyFormatter { public: explicit CurrencyBox( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~CurrencyBox(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -793,7 +783,6 @@ class VCL_DLLPUBLIC DateBox : public ComboBox, public DateFormatter { public: explicit DateBox( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~DateBox(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -813,7 +802,6 @@ class VCL_DLLPUBLIC TimeBox : public ComboBox, public TimeFormatter { public: explicit TimeBox( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~TimeBox(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx index 109cecfe812d..3ba8b2c9fa1c 100644 --- a/include/vcl/fixed.hxx +++ b/include/vcl/fixed.hxx @@ -38,7 +38,7 @@ class VCL_DLLPUBLIC FixedText : public Control private: sal_Int32 m_nMaxWidthChars; sal_Int32 m_nMinWidthChars; - vcl::Window *m_pMnemonicWindow; + VclPtr<vcl::Window> m_pMnemonicWindow; using Control::ImplInitSettings; using Window::ImplInit; @@ -62,6 +62,7 @@ public: explicit FixedText( vcl::Window* pParent, WinBits nStyle = 0 ); explicit FixedText( vcl::Window* pParent, const ResId& rResId ); virtual ~FixedText(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; @@ -140,7 +141,6 @@ private: public: explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 ); - virtual ~FixedBitmap(); virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; @@ -178,7 +178,6 @@ protected: public: explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 ); explicit FixedImage( vcl::Window* pParent, const ResId& ); - virtual ~FixedImage(); virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; diff --git a/include/vcl/fixedhyper.hxx b/include/vcl/fixedhyper.hxx index c85bd1cb6ac0..2fc8e2f95469 100644 --- a/include/vcl/fixedhyper.hxx +++ b/include/vcl/fixedhyper.hxx @@ -66,11 +66,6 @@ class VCL_DLLPUBLIC FixedHyperlink : public FixedText */ FixedHyperlink( vcl::Window* pParent, WinBits nWinStyle = 0 ); - /** dtor - - */ - virtual ~FixedHyperlink(); - /** overwrites Window::GetFocus(). Changes the color of the text and shows a focus rectangle. diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx index b000fb7940e5..a9033a22670b 100644 --- a/include/vcl/floatwin.hxx +++ b/include/vcl/floatwin.hxx @@ -73,8 +73,8 @@ class VCL_DLLPUBLIC FloatingWindow : public SystemWindow { class ImplData; private: - FloatingWindow* mpNextFloat; - vcl::Window* mpFirstPopupModeWin; + VclPtr<FloatingWindow> mpNextFloat; + VclPtr<vcl::Window> mpFirstPopupModeWin; ImplData* mpImplData; Rectangle maFloatRect; ImplSVEvent * mnPostId; @@ -122,6 +122,7 @@ public: explicit FloatingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); virtual ~FloatingWindow(); + virtual void dispose() SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE; diff --git a/include/vcl/fltcall.hxx b/include/vcl/fltcall.hxx index 6e7ab514ea5a..48f7ac973534 100644 --- a/include/vcl/fltcall.hxx +++ b/include/vcl/fltcall.hxx @@ -33,7 +33,7 @@ namespace vcl { class Window; } struct FltCallDialogParameter { - vcl::Window* pWindow; + VclPtr<vcl::Window> pWindow; ResMgr* pResMgr; FieldUnit eFieldUnit; OUString aFilterExt; diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx index 05ab48ad2c98..e860dda464b1 100644 --- a/include/vcl/gdimtf.hxx +++ b/include/vcl/gdimtf.hxx @@ -25,6 +25,7 @@ #include <tools/link.hxx> #include <vcl/mapmod.hxx> #include <vcl/bitmap.hxx> +#include <vcl/vclptr.hxx> #include <vector> class OutputDevice; @@ -80,7 +81,7 @@ private: Link aHookHdlLink; GDIMetaFile* pPrev; GDIMetaFile* pNext; - OutputDevice* pOutDev; + VclPtr<OutputDevice> pOutDev; bool bPause; bool bRecord; bool bUseCanvas; diff --git a/include/vcl/introwin.hxx b/include/vcl/introwin.hxx index 7b9fc1e837ea..8576ecda3e81 100644 --- a/include/vcl/introwin.hxx +++ b/include/vcl/introwin.hxx @@ -30,8 +30,10 @@ private: SAL_DLLPRIVATE void ImplInitIntroWindowData(); public: - IntroWindow(); - virtual ~IntroWindow(); + IntroWindow(); + virtual ~IntroWindow(); + virtual void dispose() SAL_OVERRIDE; + }; #endif // INCLUDED_VCL_INTROWIN_HXX diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 24ad21732d4c..bec9976a7317 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -17,6 +17,7 @@ #include <vcl/scrbar.hxx> #include <vcl/vclmedit.hxx> #include <vcl/window.hxx> +#include <vcl/vclptr.hxx> #include <boost/multi_array.hpp> #include <set> @@ -353,7 +354,7 @@ private: struct GridEntry { - vcl::Window *pChild; + VclPtr<vcl::Window> pChild; sal_Int32 nSpanWidth; sal_Int32 nSpanHeight; GridEntry() @@ -455,7 +456,7 @@ public: class VCL_DLLPUBLIC VclFrame : public VclBin { private: - vcl::Window *m_pLabel; + VclPtr<vcl::Window> m_pLabel; private: friend class VclBuilder; void designate_label(vcl::Window *pWindow); @@ -466,6 +467,8 @@ public: , m_pLabel(NULL) { } + virtual ~VclFrame(); + virtual void dispose() SAL_OVERRIDE; void set_label(const OUString &rLabel); OUString get_label() const; virtual vcl::Window *get_child() SAL_OVERRIDE; @@ -514,11 +517,13 @@ public: VclExpander(vcl::Window *pParent) : VclBin(pParent) , m_bResizeTopLevel(true) - , m_pDisclosureButton(new DisclosureButton(this)) + , m_pDisclosureButton(VclPtr<DisclosureButton>::Create(this)) { m_pDisclosureButton->SetToggleHdl(LINK(this, VclExpander, ClickHdl)); m_pDisclosureButton->Show(); } + virtual ~VclExpander() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE; virtual vcl::Window *get_child() SAL_OVERRIDE; virtual const vcl::Window *get_child() const SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; @@ -544,10 +549,9 @@ public: protected: virtual Size calculateRequisition() const SAL_OVERRIDE; virtual void setAllocation(const Size &rAllocation) SAL_OVERRIDE; - void dispose() SAL_OVERRIDE { m_pDisclosureButton.clear(); VclBin::dispose(); } private: bool m_bResizeTopLevel; - DisclosureButtonPtr m_pDisclosureButton; + VclPtr<DisclosureButton> m_pDisclosureButton; Link maExpandedHdl; DECL_DLLPRIVATE_LINK(ClickHdl, DisclosureButton* pBtn); }; @@ -556,11 +560,13 @@ class VCL_DLLPUBLIC VclScrolledWindow : public VclBin { public: VclScrolledWindow(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN | WB_AUTOHSCROLL | WB_AUTOVSCROLL); + virtual ~VclScrolledWindow() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE; virtual vcl::Window *get_child() SAL_OVERRIDE; virtual const vcl::Window *get_child() const SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; - ScrollBar& getVertScrollBar() { return *m_pVScroll.get(); } - ScrollBar& getHorzScrollBar() { return *m_pHScroll.get(); } + ScrollBar& getVertScrollBar() { return *m_pVScroll; } + ScrollBar& getHorzScrollBar() { return *m_pHScroll; } Size getVisibleChildSize() const; //set to true to disable the built-in scrolling callbacks to allow the user //to override it @@ -571,12 +577,11 @@ protected: DECL_LINK(ScrollBarHdl, void *); void InitScrollBars(const Size &rRequest); virtual bool Notify(NotifyEvent& rNEvt) SAL_OVERRIDE; - void dispose() SAL_OVERRIDE { m_pVScroll.clear(); m_pHScroll.clear(); VclBin::dispose(); } private: bool m_bUserManagedScrolling; - ScrollBarPtr m_pVScroll; - ScrollBarPtr m_pHScroll; - ScrollBarBox m_aScrollBarBox; + VclPtr<ScrollBar> m_pVScroll; + VclPtr<ScrollBar> m_pHScroll; + VclPtr<ScrollBarBox> m_aScrollBarBox; }; class VCL_DLLPUBLIC VclViewport : public VclBin @@ -618,13 +623,16 @@ private: } }; - EventBoxHelper m_aEventBoxHelper; + VclPtr<EventBoxHelper> m_aEventBoxHelper; +protected: + virtual void dispose() SAL_OVERRIDE; + virtual ~VclEventBox(); public: VclEventBox(vcl::Window* pParent) : VclBin(pParent) - , m_aEventBoxHelper(this) + , m_aEventBoxHelper(VclPtr<EventBoxHelper>::Create(this)) { - m_aEventBoxHelper.Show(); + m_aEventBoxHelper->Show(); } virtual vcl::Window *get_child() SAL_OVERRIDE; virtual const vcl::Window *get_child() const SAL_OVERRIDE; @@ -645,7 +653,7 @@ enum VclSizeGroupMode class VCL_DLLPUBLIC VclSizeGroup { private: - std::set<vcl::Window*> m_aWindows; + std::set< VclPtr<vcl::Window> > m_aWindows; bool m_bIgnoreHidden; VclSizeGroupMode m_eMode; @@ -658,17 +666,17 @@ public: } void insert(vcl::Window *pWindow) { - m_aWindows.insert(pWindow); + m_aWindows.insert(VclPtr<vcl::Window>(pWindow)); } void erase(vcl::Window *pWindow) { - m_aWindows.erase(pWindow); + m_aWindows.erase(VclPtr<vcl::Window>(pWindow)); } - const std::set<vcl::Window*>& get_widgets() const + const std::set< VclPtr<vcl::Window> >& get_widgets() const { return m_aWindows; } - std::set<vcl::Window*>& get_widgets() + std::set< VclPtr<vcl::Window> >& get_widgets() { return m_aWindows; } @@ -708,14 +716,14 @@ class VCL_DLLPUBLIC MessageDialog : public Dialog private: VclButtonsType m_eButtonsType; VclMessageType m_eMessageType; - VclBox *m_pOwnedContentArea; - VclButtonBox *m_pOwnedActionArea; - VclGrid* m_pGrid; - FixedImage* m_pImage; - VclMultiLineEdit* m_pPrimaryMessage; - VclMultiLineEdit* m_pSecondaryMessage; - std::vector<PushButton*> m_aOwnedButtons; - std::map<const vcl::Window*, short> m_aResponses; + VclPtr<VclBox> m_pOwnedContentArea; + VclPtr<VclButtonBox> m_pOwnedActionArea; + VclPtr<VclGrid> m_pGrid; + VclPtr<FixedImage> m_pImage; + VclPtr<VclMultiLineEdit> m_pPrimaryMessage; + VclPtr<VclMultiLineEdit> m_pSecondaryMessage; + std::vector<VclPtr<PushButton> > m_aOwnedButtons; + std::map< VclPtr<const vcl::Window>, short> m_aResponses; OUString m_sPrimaryString; OUString m_sSecondaryString; DECL_DLLPRIVATE_LINK(ButtonHdl, Button *); @@ -742,6 +750,7 @@ public: void set_primary_text(const OUString &rPrimaryString); void set_secondary_text(const OUString &rSecondaryString); virtual ~MessageDialog(); + virtual void dispose() SAL_OVERRIDE; static void SetMessagesWidths(vcl::Window *pParent, VclMultiLineEdit *pPrimaryMessage, VclMultiLineEdit *pSecondaryMessage); diff --git a/include/vcl/lazydelete.hxx b/include/vcl/lazydelete.hxx index ad4e9cfaeb8e..08da855ac360 100644 --- a/include/vcl/lazydelete.hxx +++ b/include/vcl/lazydelete.hxx @@ -21,6 +21,7 @@ #define INCLUDED_VCL_LAZYDELETE_HXX #include <vcl/dllapi.h> +#include <vcl/vclptr.hxx> #include <unordered_map> #include <vector> @@ -101,8 +102,8 @@ namespace vcl struct DeleteObjectEntry { - T* m_pObject; - bool m_bDeleted; + VclPtr<T> m_pObject; + bool m_bDeleted; DeleteObjectEntry() : m_pObject( NULL ), @@ -136,7 +137,7 @@ namespace vcl // do the actual work unsigned int nCount = m_aObjects.size(); - std::vector<T*> aRealDelete; + std::vector< VclPtr < T > > aRealDelete; aRealDelete.reserve( nCount ); for( unsigned int i = 0; i < nCount; i++ ) { @@ -158,8 +159,8 @@ namespace vcl #endif // check if the object to be deleted is not already destroyed // as a side effect of a previous lazily destroyed object - if( ! m_aObjects[ m_aPtrToIndex[ reinterpret_cast<sal_IntPtr>(aRealDelete[n]) ] ].m_bDeleted ) - delete aRealDelete[n]; + if( ! m_aObjects[ m_aPtrToIndex[ reinterpret_cast<sal_IntPtr>(aRealDelete[n].get()) ] ].m_bDeleted ) + aRealDelete[n].disposeAndClear(); } } diff --git a/include/vcl/longcurr.hxx b/include/vcl/longcurr.hxx index 0c2d1a969de0..0dbe82ca401f 100644 --- a/include/vcl/longcurr.hxx +++ b/include/vcl/longcurr.hxx @@ -90,7 +90,6 @@ private: public: LongCurrencyField( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~LongCurrencyField(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -117,7 +116,6 @@ class VCL_DLLPUBLIC LongCurrencyBox : public ComboBox, public LongCurrencyFormat { public: LongCurrencyBox( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~LongCurrencyBox(); virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index 3f03f63d1b55..5647f974f396 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -37,10 +37,10 @@ class ImplWin; class VCL_DLLPUBLIC ListBox : public Control { private: - ImplListBox* mpImplLB; - ImplListBoxFloatingWindow* mpFloatWin; - ImplWin* mpImplWin; - ImplBtn* mpBtn; + VclPtr<ImplListBox> mpImplLB; + VclPtr<ImplListBoxFloatingWindow> mpFloatWin; + VclPtr<ImplWin> mpImplWin; + VclPtr<ImplBtn> mpBtn; sal_uInt16 mnDDHeight; sal_Int32 mnSaveValue; sal_Int32 m_nMaxWidthChars; @@ -83,6 +83,7 @@ public: explicit ListBox( vcl::Window* pParent, WinBits nStyle = WB_BORDER ); explicit ListBox( vcl::Window* pParent, const ResId& ); virtual ~ListBox(); + virtual void dispose() SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index ef4f1eec5762..32dfd5a73d28 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -124,7 +124,7 @@ private: MenuItemList* pItemList; // Liste mit den MenuItems MenuLogo* pLogo; Menu* pStartedFrom; - vcl::Window* pWindow; + VclPtr<vcl::Window> pWindow; Link aActivateHdl; // Active-Handler Link aDeactivateHdl; // Deactivate-Handler diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx index 41e03c6462f9..eb2c446a4a53 100644 --- a/include/vcl/menubtn.hxx +++ b/include/vcl/menubtn.hxx @@ -57,6 +57,7 @@ protected: public: explicit MenuButton( vcl::Window* pParent, WinBits nStyle = 0 ); virtual ~MenuButton(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; diff --git a/include/vcl/morebtn.hxx b/include/vcl/morebtn.hxx index 4dbd6da57736..936cbba77d9e 100644 --- a/include/vcl/morebtn.hxx +++ b/include/vcl/morebtn.hxx @@ -35,7 +35,7 @@ class VCL_DLLPUBLIC MoreButton : public PushButton { private: ImplMoreButtonData* mpMBData; - sal_uLong mnDelta; + sal_uLong mnDelta; MapUnit meUnit; bool mbState; @@ -50,6 +50,7 @@ protected: public: explicit MoreButton( vcl::Window* pParent, WinBits nStyle = 0 ); virtual ~MoreButton(); + virtual void dispose() SAL_OVERRIDE; void Click() SAL_OVERRIDE; diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx index 04ea155cb6d8..8147821280c1 100644 --- a/include/vcl/msgbox.hxx +++ b/include/vcl/msgbox.hxx @@ -32,14 +32,14 @@ class CheckBox; class VCL_DLLPUBLIC MessBox : public ButtonDialog { protected: - VclMultiLineEdit* mpVCLMultiLineEdit; - FixedImage* mpFixedImage; - OUString maMessText; - Image maImage; - bool mbHelpBtn; - CheckBox* mpCheckBox; - OUString maCheckBoxText; - bool mbCheck; + VclPtr<VclMultiLineEdit> mpVCLMultiLineEdit; + VclPtr<FixedImage> mpFixedImage; + OUString maMessText; + Image maImage; + bool mbHelpBtn; + VclPtr<CheckBox> mpCheckBox; + OUString maCheckBoxText; + bool mbCheck; SAL_DLLPRIVATE void ImplInitMessBoxData(); SAL_DLLPRIVATE void ImplInitButtons(); @@ -48,7 +48,8 @@ protected: public: MessBox( vcl::Window* pParent, WinBits nStyle, const OUString& rTitle, const OUString& rMessage ); - virtual ~MessBox(); + virtual ~MessBox(); + virtual void dispose() SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; diff --git a/include/vcl/oldprintadaptor.hxx b/include/vcl/oldprintadaptor.hxx index 72d1163d67c4..987b58ff3aa3 100644 --- a/include/vcl/oldprintadaptor.hxx +++ b/include/vcl/oldprintadaptor.hxx @@ -29,7 +29,7 @@ namespace vcl { ImplOldStyleAdaptorData* mpData; public: - OldStylePrintAdaptor(const std::shared_ptr<Printer>&); + OldStylePrintAdaptor( const VclPtr< Printer >& ); virtual ~OldStylePrintAdaptor(); void StartPage(); diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index d733560f2a2b..2d2ce8f823d5 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -249,10 +249,9 @@ private: #endif GLWindow m_aGLWin; - std::unique_ptr<vcl::Window> m_xWindow; - vcl::Window* mpWindow; //points to m_xWindow or the parent window, don't delete it - SystemChildWindow* m_pChildWindow; - std::unique_ptr<SystemChildWindow> m_xChildWindowGC; + VclPtr<vcl::Window> m_xWindow; + VclPtr<vcl::Window> mpWindow; //points to m_pWindow or the parent window, don't delete it + VclPtr<SystemChildWindow> m_pChildWindow; bool mbInitialized; int mnRefCount; bool mbRequestLegacyContext; diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx index dfeb95c076e6..e8c2a1e545a7 100644 --- a/include/vcl/openglwin.hxx +++ b/include/vcl/openglwin.hxx @@ -33,8 +33,10 @@ public: class VCL_DLLPUBLIC OpenGLWindow : public vcl::Window { public: - OpenGLWindow(vcl::Window* pParent); - virtual ~OpenGLWindow(); + OpenGLWindow(vcl::Window* pParent); + virtual ~OpenGLWindow(); + virtual void dispose() SAL_OVERRIDE; + OpenGLContext& getContext(); void setRenderer(IRenderer* pRenderer); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 4cf24545c928..16f44b8085f5 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -263,13 +263,34 @@ class VCL_DLLPUBLIC OutputDevice friend class vcl::PDFWriterImpl; friend void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight ); + // All of this will need to be replicated in Window + // or a shared base-class as/when we can break the + // OutputDevice -> Window inheritance. +private: + mutable int mnRefCnt; // reference count + + template<typename T> friend class ::rtl::Reference; + template<typename T> friend class ::VclPtr; + + inline void acquire() const + { + mnRefCnt++; + } + + inline void release() const + { + assert(mnRefCnt>0); + if (!--mnRefCnt) + delete this; + } + private: OutputDevice(const OutputDevice&) SAL_DELETED_FUNCTION; OutputDevice& operator=(const OutputDevice&) SAL_DELETED_FUNCTION; mutable SalGraphics* mpGraphics; ///< Graphics context to draw on - mutable OutputDevice* mpPrevGraphics; ///< Previous output device in list - mutable OutputDevice* mpNextGraphics; ///< Next output device in list + mutable VclPtr<OutputDevice> mpPrevGraphics; ///< Previous output device in list + mutable VclPtr<OutputDevice> mpNextGraphics; ///< Next output device in list GDIMetaFile* mpMetaFile; mutable ImplFontEntry* mpFontEntry; mutable ImplFontCache* mpFontCache; @@ -283,7 +304,7 @@ private: vcl::ExtOutDevData* mpExtOutDevData; // TEMP TEMP TEMP - VirtualDevice* mpAlphaVDev; + VclPtr<VirtualDevice> mpAlphaVDev; /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset) long mnOutOffOrigX; @@ -352,6 +373,7 @@ private: mutable bool mbTextSpecial : 1; mutable bool mbRefPoint : 1; mutable bool mbEnableRTL : 1; + mutable bool mbDisposed : 1; /** @name Initialization and accessor functions */ @@ -359,10 +381,18 @@ private: protected: OutputDevice(); - public: virtual ~OutputDevice(); +protected: + /// release all references to other objects. + virtual void dispose(); + +public: + /// call the dispose() method if we have not already been disposed. + void disposeOnce(); + bool isDisposed() const { return mbDisposed; } + public: /** Get the graphic context that the output device uses to draw on. diff --git a/include/vcl/popupmenuwindow.hxx b/include/vcl/popupmenuwindow.hxx index 266738a170c3..13d699f69542 100644 --- a/include/vcl/popupmenuwindow.hxx +++ b/include/vcl/popupmenuwindow.hxx @@ -30,6 +30,7 @@ private: public: PopupMenuFloatingWindow( vcl::Window* pParent, WinBits nStyle = (WB_SYSTEMFLOATWIN|WB_SYSTEMWINDOW|WB_NOBORDER) ); virtual ~PopupMenuFloatingWindow(); + virtual void dispose() SAL_OVERRIDE; sal_uInt16 GetMenuStackLevel() const; void SetMenuStackLevel( sal_uInt16 nLevel ); diff --git a/include/vcl/prgsbar.hxx b/include/vcl/prgsbar.hxx index 782b2c549a9a..43d340689d18 100644 --- a/include/vcl/prgsbar.hxx +++ b/include/vcl/prgsbar.hxx @@ -61,8 +61,8 @@ private: Point maPos; long mnPrgsWidth; long mnPrgsHeight; - sal_uInt16 mnPercent; - sal_uInt16 mnPercentCount; + sal_uInt16 mnPercent; + sal_uInt16 mnPercentCount; bool mbCalcNew; using Window::ImplInit; @@ -72,7 +72,6 @@ private: public: ProgressBar( vcl::Window* pParent, WinBits nWinBits = WB_STDPROGRESSBAR ); - virtual ~ProgressBar(); virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index d74976981bd8..be18fd06bb6a 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -203,9 +203,9 @@ private: SalInfoPrinter* mpInfoPrinter; SalPrinter* mpPrinter; SalGraphics* mpJobGraphics; - Printer* mpPrev; - Printer* mpNext; - VirtualDevice* mpDisplayDev; + VclPtr<Printer> mpPrev; + VclPtr<Printer> mpNext; + VclPtr<VirtualDevice> mpDisplayDev; PrinterOptions* mpPrinterOptions; OUString maPrinterName; OUString maDriver; @@ -299,6 +299,7 @@ public: Printer( const QueueInfo& rQueueInfo ); Printer( const OUString& rPrinterName ); virtual ~Printer(); + virtual void dispose() SAL_OVERRIDE; static const std::vector< OUString >& GetPrinterQueues(); static const QueueInfo* GetQueueInfo( const OUString& rPrinterName, bool bStatusUpdate ); @@ -309,7 +310,7 @@ public: const OUString& GetName() const { return maPrinterName; } const OUString& GetDriverName() const { return maDriver; } bool IsDefPrinter() const { return mbDefPrinter; } - bool IsDisplayPrinter() const { return mpDisplayDev != NULL; } + bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; } bool IsValid() const { return !IsDisplayPrinter(); } sal_uLong GetCapabilities( sal_uInt16 nType ) const; @@ -426,7 +427,7 @@ class VCL_DLLPUBLIC PrinterController { ImplPrinterControllerData* mpImplData; protected: - PrinterController( const std::shared_ptr<Printer>& ); + PrinterController( const VclPtr<Printer>& ); public: enum NupOrderType { LRTB, TBLR, TBRL, RLTB }; @@ -469,7 +470,7 @@ public: virtual ~PrinterController(); - const std::shared_ptr<Printer>& getPrinter() const; + const VclPtr<Printer>& getPrinter() const; /* for implementations: get current job properties as changed by e.g. print dialog this gets the current set of properties initially told to Printer::PrintJob @@ -550,7 +551,7 @@ public: SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false ); VCL_PLUGIN_PUBLIC PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false ); VCL_PLUGIN_PUBLIC void printFilteredPage( int i_nPage ); - SAL_DLLPRIVATE void setPrinter( const std::shared_ptr<Printer>& ); + SAL_DLLPRIVATE void setPrinter( const VclPtr<Printer>& ); SAL_DLLPRIVATE void setOptionChangeHdl( const Link& ); VCL_PLUGIN_PUBLIC void createProgressDialog(); VCL_PLUGIN_PUBLIC bool isProgressCanceled() const; diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx index da949dfdf8d2..27871afc2cb6 100644 --- a/include/vcl/scrbar.hxx +++ b/include/vcl/scrbar.hxx @@ -91,6 +91,7 @@ private: public: explicit ScrollBar( vcl::Window* pParent, WinBits nStyle = WB_VERT ); virtual ~ScrollBar(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE; @@ -141,8 +142,6 @@ public: virtual Size GetOptimalSize() const SAL_OVERRIDE; }; -typedef rtl::Reference<ScrollBar> ScrollBarPtr; - // - ScrollBarBox - diff --git a/include/vcl/seleng.hxx b/include/vcl/seleng.hxx index cbfd9c3a0970..781527157607 100644 --- a/include/vcl/seleng.hxx +++ b/include/vcl/seleng.hxx @@ -83,7 +83,7 @@ class VCL_DLLPUBLIC SelectionEngine { private: FunctionSet* pFunctionSet; - vcl::Window* pWin; + VclPtr<vcl::Window> pWin; Rectangle aArea; Timer aWTimer; // generate fake mouse moves MouseEvent aLastMove; diff --git a/include/vcl/spin.hxx b/include/vcl/spin.hxx index 4fb25f31829f..ad261f2ef478 100644 --- a/include/vcl/spin.hxx +++ b/include/vcl/spin.hxx @@ -57,7 +57,6 @@ private: public: explicit SpinButton( vcl::Window* pParent, WinBits nStyle = 0 ); - virtual ~SpinButton(); void Up(); void Down(); diff --git a/include/vcl/spinfld.hxx b/include/vcl/spinfld.hxx index fe5431be04b6..b0474b1685c9 100644 --- a/include/vcl/spinfld.hxx +++ b/include/vcl/spinfld.hxx @@ -26,13 +26,10 @@ #include <vcl/timer.hxx> -// - SpinField - - - class VCL_DLLPUBLIC SpinField : public Edit { protected: - Edit* mpEdit; + VclPtr<Edit> mpEdit; AutoTimer maRepeatTimer; Rectangle maUpperRect; Rectangle maLowerRect; @@ -73,6 +70,7 @@ public: explicit SpinField( vcl::Window* pParent, WinBits nWinStyle = 0 ); explicit SpinField( vcl::Window* pParent, const ResId& ); virtual ~SpinField(); + virtual void dispose() SAL_OVERRIDE; virtual bool ShowDropDown( bool bShow ); diff --git a/include/vcl/split.hxx b/include/vcl/split.hxx index fbc833272ce7..86df902692b4 100644 --- a/include/vcl/split.hxx +++ b/include/vcl/split.hxx @@ -28,7 +28,7 @@ class VCL_DLLPUBLIC Splitter : public vcl::Window { private: - vcl::Window* mpRefWin; + VclPtr<vcl::Window> mpRefWin; long mnSplitPos; long mnLastSplitPos; long mnStartSplitPos; @@ -63,6 +63,7 @@ protected: public: explicit Splitter( vcl::Window* pParent, WinBits nStyle = WB_VSCROLL ); virtual ~Splitter(); + virtual void dispose() SAL_OVERRIDE; void StartSplit(); void EndSplit(); diff --git a/include/vcl/splitwin.hxx b/include/vcl/splitwin.hxx index 157f0c23ed60..009f9e9fb274 100644 --- a/include/vcl/splitwin.hxx +++ b/include/vcl/splitwin.hxx @@ -123,7 +123,8 @@ private: SplitWindow & operator= (const SplitWindow &) SAL_DELETED_FUNCTION; public: SplitWindow( vcl::Window* pParent, WinBits nStyle = 0 ); - virtual ~SplitWindow(); + virtual ~SplitWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void StartSplit(); virtual void Split(); diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx index a9ad080e8715..6824233e43d3 100644 --- a/include/vcl/status.hxx +++ b/include/vcl/status.hxx @@ -85,9 +85,9 @@ private: long mnCalcHeight; long mnTextY; long mnItemY; - sal_uInt16 mnCurItemId; - sal_uInt16 mnPercent; - sal_uInt16 mnPercentCount; + sal_uInt16 mnCurItemId; + sal_uInt16 mnPercent; + sal_uInt16 mnPercentCount; bool mbVisibleItems; bool mbFormat; bool mbProgressMode; @@ -113,7 +113,8 @@ private: public: StatusBar( vcl::Window* pParent, WinBits nWinStyle = WB_BORDER | WB_RIGHT ); - virtual ~StatusBar(); + virtual ~StatusBar(); + virtual void dispose() SAL_OVERRIDE; void AdjustItemWidthsForHiDPI(bool bAdjustHiDPI); diff --git a/include/vcl/syschild.hxx b/include/vcl/syschild.hxx index 87e16fcc183a..928c1861b52a 100644 --- a/include/vcl/syschild.hxx +++ b/include/vcl/syschild.hxx @@ -42,6 +42,7 @@ public: // create a SystemChildWindow using the given SystemWindowData explicit SystemChildWindow( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow = true ); virtual ~SystemChildWindow(); + virtual void dispose() SAL_OVERRIDE; const SystemEnvData* GetSystemData() const; diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx index c313e2ff2c34..f90fb16bfeea 100644 --- a/include/vcl/syswin.hxx +++ b/include/vcl/syswin.hxx @@ -149,7 +149,7 @@ private: Idle maLayoutIdle; protected: bool mbIsDefferedInit; - vcl::Window* mpDialogParent; + VclPtr<vcl::Window> mpDialogParent; public: using Window::ImplIsInTaskPaneList; SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin ); @@ -172,7 +172,9 @@ protected: SAL_DLLPRIVATE void DoInitialLayout(); public: - virtual ~SystemWindow(); + virtual ~SystemWindow(); + virtual void dispose() SAL_OVERRIDE; + virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx index 526bc25ddfec..a3b8aa0f0bec 100644 --- a/include/vcl/tabctrl.hxx +++ b/include/vcl/tabctrl.hxx @@ -42,13 +42,13 @@ private: long mnLastHeight; long mnBtnSize; long mnMaxPageWidth; - sal_uInt16 mnActPageId; - sal_uInt16 mnCurPageId; + sal_uInt16 mnActPageId; + sal_uInt16 mnCurPageId; bool mbFormat; bool mbRestoreHelpId; bool mbRestoreUnqId; bool mbSmallInvalidate; - bool mbLayoutDirty; + bool mbLayoutDirty; Link maActivateHdl; Link maDeactivateHdl; @@ -83,6 +83,7 @@ public: TabControl( vcl::Window* pParent, WinBits nStyle = WB_STDTABCONTROL ); virtual ~TabControl(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; diff --git a/include/vcl/tabdlg.hxx b/include/vcl/tabdlg.hxx index f02efc726596..db3f592ea20b 100644 --- a/include/vcl/tabdlg.hxx +++ b/include/vcl/tabdlg.hxx @@ -29,8 +29,8 @@ class TabControl; class VCL_DLLPUBLIC TabDialog : public Dialog { private: - FixedLine* mpFixedLine; - vcl::Window* mpViewWindow; + VclPtr<FixedLine> mpFixedLine; + VclPtr<vcl::Window> mpViewWindow; WindowAlign meViewAlign; bool mbPosControls; @@ -41,7 +41,8 @@ public: TabDialog( vcl::Window* pParent, WinBits nStyle = WB_STDTABDIALOG ); TabDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ); - virtual ~TabDialog(); + virtual ~TabDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx index c7361972ccb1..702a42c756b6 100644 --- a/include/vcl/tabpage.hxx +++ b/include/vcl/tabpage.hxx @@ -41,6 +41,8 @@ private: public: explicit TabPage( vcl::Window* pParent, WinBits nStyle = 0 ); explicit TabPage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription ); + virtual ~TabPage(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; diff --git a/include/vcl/taskpanelist.hxx b/include/vcl/taskpanelist.hxx index c8a6abd0e489..738f2b81f3a9 100644 --- a/include/vcl/taskpanelist.hxx +++ b/include/vcl/taskpanelist.hxx @@ -27,7 +27,7 @@ class VCL_DLLPUBLIC TaskPaneList { - ::std::vector<vcl::Window *> mTaskPanes; + ::std::vector< VclPtr<vcl::Window> > mTaskPanes; vcl::Window *FindNextFloat( vcl::Window *pWindow, bool bForward = true ); vcl::Window *FindNextSplitter( vcl::Window *pWindow, bool bForward = true ); diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx index 3464b2460629..f5273d9d9b33 100644 --- a/include/vcl/texteng.hxx +++ b/include/vcl/texteng.hxx @@ -20,6 +20,7 @@ #define INCLUDED_VCL_TEXTENG_HXX #include <vcl/dllapi.h> +#include <vcl/vclptr.hxx> class TextDoc; class TextView; @@ -91,7 +92,7 @@ class VCL_DLLPUBLIC TextEngine : public SfxBroadcaster private: TextDoc* mpDoc; TEParaPortions* mpTEParaPortions; - OutputDevice* mpRefDev; + VclPtr<OutputDevice> mpRefDev; TextViews* mpViews; TextView* mpActiveView; diff --git a/include/vcl/throbber.hxx b/include/vcl/throbber.hxx index aaf8edf5fba5..f7cbbedf62e2 100644 --- a/include/vcl/throbber.hxx +++ b/include/vcl/throbber.hxx @@ -48,6 +48,7 @@ public: public: Throbber(vcl::Window* i_parentWindow, WinBits i_style, const ImageSet i_imageSet = IMAGES_AUTO); virtual ~Throbber(); + virtual void dispose() SAL_OVERRIDE; // Properties void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; } diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index d723e6ee3ab1..269c51883836 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -42,7 +42,7 @@ class PopupMenu; class VCL_DLLPUBLIC ToolBoxCustomizeEvent { private: - ToolBox* mpTargetBox; + VclPtr<ToolBox> mpTargetBox; void* mpData; sal_uInt16 mnIdFrom; sal_uInt16 mnPosTo; @@ -131,7 +131,7 @@ private: Rectangle maOutDockRect; Rectangle maInDockRect; Rectangle maPaintRect; - FloatingWindow* mpFloatWin; + VclPtr<FloatingWindow> mpFloatWin; sal_uInt16 mnKeyModifier; long mnDX; long mnDY; @@ -281,7 +281,8 @@ protected: public: ToolBox( vcl::Window* pParent, WinBits nStyle = 0 ); ToolBox( vcl::Window* pParent, const ResId& rResId ); - virtual ~ToolBox(); + virtual ~ToolBox(); + virtual void dispose() SAL_OVERRIDE; virtual void Click(); void DoubleClick(); diff --git a/include/vcl/vclevent.hxx b/include/vcl/vclevent.hxx index 4e165a438643..99f329e8da65 100644 --- a/include/vcl/vclevent.hxx +++ b/include/vcl/vclevent.hxx @@ -24,13 +24,14 @@ #include <tools/rtti.hxx> #include <vcl/dllapi.h> #include <vcl/impdel.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/window.hxx> #include <com/sun/star/uno/Reference.hxx> #include <list> #include <vector> -namespace vcl { class Window; } class Menu; namespace com { namespace sun { namespace star { @@ -213,12 +214,12 @@ public: class VCL_DLLPUBLIC VclWindowEvent : public VclSimpleEvent { private: - vcl::Window* pWindow; + VclPtr<vcl::Window> pWindow; void* pData; public: - VclWindowEvent( vcl::Window* pWin, sal_uLong n, void* pDat = NULL ) : VclSimpleEvent(n) { pWindow = pWin; pData = pDat; } - virtual ~VclWindowEvent() {} + VclWindowEvent( vcl::Window* pWin, sal_uLong n, void* pDat = NULL ); + virtual ~VclWindowEvent(); TYPEINFO_OVERRIDE(); vcl::Window* GetWindow() const { return pWindow; } diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx index 649725b1c1f2..034c25412969 100644 --- a/include/vcl/vclmedit.hxx +++ b/include/vcl/vclmedit.hxx @@ -25,7 +25,6 @@ #include <vcl/edit.hxx> #include <vcl/dllapi.h> - class ImpVclMEdit; class Timer; class ExtTextEngine; @@ -58,8 +57,10 @@ protected: ScrollBar* GetVScrollBar() const; public: - VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER ); - virtual ~VclMultiLineEdit(); + VclMultiLineEdit( vcl::Window* pParent, + WinBits nWinStyle = WB_LEFT | WB_BORDER ); + virtual ~VclMultiLineEdit(); + virtual void dispose() SAL_OVERRIDE; void SelectionChanged(); void CaretChanged(); diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx new file mode 100644 index 000000000000..5ad0bdabfd2d --- /dev/null +++ b/include/vcl/vclptr.hxx @@ -0,0 +1,357 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_PTR_HXX +#define INCLUDED_VCL_PTR_HXX + +#include <rtl/ref.hxx> +#include <cstddef> +#include <utility> +#include <type_traits> + +/// @cond INTERNAL +namespace vcl { namespace detail { + +// A mechanism to enable up-casts, used by the VclReference conversion constructor, +// heavily borrowed from boost::is_base_and_derived +// (which manages to avoid compilation problems with ambiguous bases and cites +// comp.lang.c++.moderated mail <http://groups.google.com/groups? +// selm=df893da6.0301280859.522081f7%40posting.google.com> "SuperSubclass +// (is_base_and_derived) complete implementation!" by Rani Sharoni and cites +// Aleksey Gurtovoy for the workaround for MSVC), to avoid including Boost +// headers in URE headers (could ultimately be based on C++11 std::is_base_of): + +template< typename T1, typename T2 > struct UpCast { +private: + template< bool, typename U1, typename > struct C + { typedef U1 t; }; + + template< typename U1, typename U2 > struct C< false, U1, U2 > + { typedef U2 t; }; + + struct S { char c[2]; }; + +#if defined _MSC_VER + static char f(T2 *, long); + static S f(T1 * const &, int); +#else + template< typename U > static char f(T2 *, U); + static S f(T1 *, int); +#endif + + struct H { + H(); // avoid C2514 "class has no constructors" from MSVC 2008 +#if defined _MSC_VER + operator T1 * const & () const; +#else + operator T1 * () const; +#endif + operator T2 * (); + }; + +public: + typedef typename C< sizeof (f(H(), 0)) == 1, void *, void >::t t; +}; + +}; }; // namespace detail, namespace vcl + +namespace vcl { class Window; } + +/** + * A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for references to vcl::Window subclasses. + * + * For more details on the design please see vcl/README.lifecycle + * + * @param reference_type must be a subclass of vcl::Window + */ +template <class reference_type> +class VclPtr +{ + ::rtl::Reference<reference_type> m_rInnerRef; + +public: + /** Constructor... + */ + inline VclPtr() + : m_rInnerRef() + {} + + /** Constructor... + */ + inline VclPtr (reference_type * pBody) + : m_rInnerRef(pBody) + {} + + /** Constructor... that doesn't take a ref. + */ + inline VclPtr (reference_type * pBody, __sal_NoAcquire) + : m_rInnerRef(pBody, SAL_NO_ACQUIRE) + {} + + /** Copy constructor... + */ + inline VclPtr (const VclPtr<reference_type> & handle) + : m_rInnerRef (handle.m_rInnerRef) + {} + + /** Up-casting conversion constructor: Copies interface reference. + + Does not work for up-casts to ambiguous bases. For the special case of + up-casting to Reference< XInterface >, see the corresponding conversion + operator. + + @param rRef another reference + */ + template< class derived_type > + inline VclPtr( + const VclPtr< derived_type > & rRef, + typename ::vcl::detail::UpCast< reference_type, derived_type >::t = 0 ) + : m_rInnerRef( static_cast<reference_type*>(rRef) ) + { + } + + /** + * A construction helper for VclPtr. Since VclPtr types are created + * with a reference-count of one - to help fit into the existing + * code-flow; this helps us to construct them easily. + * + * For more details on the design please see vcl/README.lifecycle + * + * @param reference_type must be a subclass of vcl::Window + */ + template<typename... Arg> static VclPtr< reference_type > Create(Arg &&... arg) + { + return VclPtr< reference_type >( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ); + } + + /** Probably most common used: handle->someBodyOp(). + */ + inline reference_type * SAL_CALL operator->() const + { + return m_rInnerRef.get(); + } + + /** Get the body. Can be used instead of operator->(). + I.e. handle->someBodyOp() and handle.get()->someBodyOp() + are the same. + */ + inline reference_type * SAL_CALL get() const + { + return m_rInnerRef.get(); + } + + inline void SAL_CALL set(reference_type *pBody) + { + m_rInnerRef.set(pBody); + } + + inline void SAL_CALL reset(reference_type *pBody) + { + m_rInnerRef.set(pBody); + } + + /** Up-casting conversion constructor: Copies interface reference. + + Does not work for up-casts to ambiguous bases. For the special case of + up-casting to Reference< XInterface >, see the corresponding conversion + operator. + + @param rRef another reference + */ + template< class derived_type, class = typename std::enable_if< ::vcl::detail::UpCast< reference_type, derived_type >::t >::type > + inline VclPtr<reference_type>& SAL_CALL operator= (derived_type * pBody) + { + m_rInnerRef.set(pBody); + return *this; + } + + inline SAL_CALL operator reference_type * () const + { + return m_rInnerRef.get(); + } + + inline SAL_CALL operator bool () const + { + return m_rInnerRef.get() != NULL; + } + + inline void SAL_CALL clear() + { + m_rInnerRef.clear(); + } + + inline void SAL_CALL reset() + { + m_rInnerRef.clear(); + } + + inline void disposeAndClear() + { + // hold it alive for the lifetime of this method + ::rtl::Reference<reference_type> aTmp(m_rInnerRef); + m_rInnerRef.clear(); // we should use some 'swap' method ideally ;-) + if (aTmp.get()) { + aTmp->disposeOnce(); + } + } + + /** Returns True if handle points to the same body. + */ + template<class T> + inline bool SAL_CALL operator== (const VclPtr<T> & handle) const + { + return (get() == handle.get()); + } + + /** Needed to place VclPtr's into STL collection. + */ + inline bool SAL_CALL operator!= (const VclPtr<reference_type> & handle) const + { + return (m_rInnerRef != handle.m_rInnerRef); + } + + /** Makes comparing against NULL easier, resolves compile-time ambiguity */ + inline bool SAL_CALL operator!= (::std::nullptr_t ) const + { + return (get() != nullptr); + } + + /** Needed to place VclPtr's into STL collection. + */ + inline bool SAL_CALL operator< (const VclPtr<reference_type> & handle) const + { + return (m_rInnerRef < handle.m_rInnerRef); + } + + /** Needed to place VclPtr's into STL collection. + */ + inline bool SAL_CALL operator> (const VclPtr<reference_type> & handle) const + { + return (m_rInnerRef > handle.m_rInnerRef); + } +}; // class VclPtr + +/** + * A construction helper for a temporary VclPtr. Since VclPtr types + * are created with a reference-count of one - to help fit into + * the existing code-flow; this helps us to construct them easily. + * see also VclPtr::Create and ScopedVclPtr + * + * For more details on the design please see vcl/README.lifecycle + * + * @param reference_type must be a subclass of vcl::Window + */ +template <class reference_type> +class VclPtrInstance : public VclPtr<reference_type> +{ +public: + template<typename... Arg> VclPtrInstance(Arg &&... arg) + : VclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) + { + } +}; + +template <class reference_type> +class ScopedVclPtr : public VclPtr<reference_type> +{ +public: + /** Constructor... + */ + inline ScopedVclPtr() + : VclPtr<reference_type>() + {} + + /** Constructor + */ + inline ScopedVclPtr (reference_type * pBody) + : VclPtr<reference_type>(pBody) + {} + + /** Copy constructor... + */ + inline ScopedVclPtr (const VclPtr<reference_type> & handle) + : VclPtr<reference_type>(handle) + {} + + /** + Assignment that releases the last reference. + */ + inline ScopedVclPtr<reference_type>& SAL_CALL operator= (reference_type * pBody) + { + VclPtr<reference_type>::disposeAndClear(); + VclPtr<reference_type>::set(pBody); + return *this; + } + + /** Up-casting conversion constructor: Copies interface reference. + + Does not work for up-casts to ambiguous bases. For the special case of + up-casting to Reference< XInterface >, see the corresponding conversion + operator. + + @param rRef another reference + */ + template< class derived_type > + inline ScopedVclPtr( + const VclPtr< derived_type > & rRef, + typename ::vcl::detail::UpCast< reference_type, derived_type >::t = 0 ) + : VclPtr<reference_type>( rRef ) + { + } + + ~ScopedVclPtr() + { + VclPtr<reference_type>::disposeAndClear(); + assert(VclPtr<reference_type>::get() == nullptr); // make sure there are no lingering references + } + +private: + // Most likely we don't want this default copy-construtor. + ScopedVclPtr (const ScopedVclPtr<reference_type> &) SAL_DELETED_FUNCTION; + // And certainly we don't want a default assignment operator. + ScopedVclPtr<reference_type>& SAL_CALL operator= (const ScopedVclPtr<reference_type> &) SAL_DELETED_FUNCTION; + +protected: + inline ScopedVclPtr (reference_type * pBody, __sal_NoAcquire) + : VclPtr<reference_type>(pBody, SAL_NO_ACQUIRE) + {} +}; + +/** + * A construction helper for ScopedVclPtr. Since VclPtr types are created + * with a reference-count of one - to help fit into the existing + * code-flow; this helps us to construct them easily. + * + * For more details on the design please see vcl/README.lifecycle + * + * @param reference_type must be a subclass of vcl::Window + */ +template <class reference_type> +class ScopedVclPtrInstance : public ScopedVclPtr<reference_type> +{ +public: + template<typename... Arg> ScopedVclPtrInstance(Arg &&... arg) + : ScopedVclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) + { + } +}; + +#endif // INCLUDED_VCL_PTR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index 06dbae6ddffa..3720a19c98f3 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -35,8 +35,8 @@ class VCL_DLLPUBLIC VirtualDevice : public OutputDevice private: SalVirtualDevice* mpVirDev; - VirtualDevice* mpPrev; - VirtualDevice* mpNext; + VclPtr<VirtualDevice> mpPrev; + VclPtr<VirtualDevice> mpNext; sal_uInt16 mnBitCount; bool mbScreenComp; sal_Int8 mnAlphaDepth; @@ -118,6 +118,7 @@ public: sal_uInt16 nBitCount); virtual ~VirtualDevice(); + virtual void dispose() SAL_OVERRIDE; virtual void EnableRTL( bool bEnable = true ) SAL_OVERRIDE; diff --git a/include/vcl/waitobj.hxx b/include/vcl/waitobj.hxx index d6deecf33f29..daf0e2a68a4f 100644 --- a/include/vcl/waitobj.hxx +++ b/include/vcl/waitobj.hxx @@ -26,7 +26,7 @@ class VCL_DLLPUBLIC WaitObject { private: - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; public: WaitObject( vcl::Window* pWindow ) { diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index bc20cbe7550b..3134e5012258 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -31,9 +31,7 @@ #include <vcl/apptypes.hxx> #include <vcl/cursor.hxx> #include <vcl/inputctx.hxx> -#include <vcl/vclevent.hxx> -// Only for compatibility - because many people outside haven't included event.hxx -#include <vcl/event.hxx> +#include <vcl/keycodes.hxx> #include <vcl/region.hxx> #include <vcl/salnativewidgets.hxx> #include <rtl/ustring.hxx> @@ -63,6 +61,7 @@ class CommandEvent; class TrackingEvent; class HelpEvent; class DataChangedEvent; +class VclSimpleEvent; class NotifyEvent; class SystemWindow; class SalFrame; @@ -119,6 +118,8 @@ namespace vcl { namespace svt { class PopupWindowControllerImpl; } +template<class T> class VclPtr; + // - WindowTypes - @@ -361,6 +362,8 @@ class VclBuilder; class ImplDockingWindowWrapper; class ImplPopupFloatWin; class MenuFloatingWindow; +class LifecycleTest; + namespace svt { class PopupWindowControllerImpl; } struct WindowResHeader @@ -390,6 +393,7 @@ class VCL_DLLPUBLIC Window : public ::OutputDevice, public Resource friend class ::ImplBorderWindow; friend class ::VclBuilder; friend class ::PaintHelper; + friend class ::LifecycleTest; // TODO: improve missing functionality // only required because of SetFloatingMode() @@ -411,12 +415,6 @@ private: WindowImpl* mpWindowImpl; - // This is a first attempt to start to remove the dependency of Window on - // OutputDevice - ::OutputDevice* mpOutputDevice; - - mutable int mnRefCnt; // reference count - #ifdef DBG_UTIL friend const char* ::ImplDbgCheckWindow( const void* pObj ); #endif @@ -495,24 +493,10 @@ public: SAL_DLLPRIVATE static void ImplCalcSymbolRect( Rectangle& rRect ); -private: - template<typename T> friend class ::rtl::Reference; - - inline void acquire() const - { - mnRefCnt++; - } - - inline void release() const - { - if (!--mnRefCnt) - delete this; - } - protected: /** This is intended to be used to clear any locally held references to other Window-subclass objects */ - virtual void dispose() {} + virtual void dispose() SAL_OVERRIDE; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData ); @@ -656,7 +640,7 @@ private: SAL_DLLPRIVATE long ImplGetUnmirroredOutOffX(); // retrieves the list of owner draw decorated windows for this window hiearchy - SAL_DLLPRIVATE ::std::vector<vcl::Window *>& ImplGetOwnerDrawList(); + SAL_DLLPRIVATE ::std::vector<VclPtr<vcl::Window> >& ImplGetOwnerDrawList(); SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow(); @@ -706,8 +690,8 @@ public: Window( vcl::Window* pParent, const ResId& rResId ); virtual ~Window(); - ::OutputDevice const* GetOutDev() const { return mpOutputDevice; }; - ::OutputDevice* GetOutDev() { return mpOutputDevice; }; + ::OutputDevice const* GetOutDev() const; + ::OutputDevice* GetOutDev(); virtual void EnableRTL ( bool bEnable = true ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ); @@ -765,6 +749,7 @@ public: bool IsMenuFloatingWindow() const; bool IsToolbarFloatingWindow() const; bool IsTopWindow() const; + bool IsDisposed() const; SystemWindow* GetSystemWindow() const; void EnableAllResize( bool bEnable = true ); @@ -1424,7 +1409,7 @@ public: */ void add_mnemonic_label(FixedText *pLabel); void remove_mnemonic_label(FixedText *pLabel); - std::vector<FixedText*> list_mnemonic_labels() const; + std::vector<VclPtr<FixedText> > list_mnemonic_labels() const; /* * Move this widget to be the nNewPosition'd child of its parent @@ -1468,6 +1453,11 @@ public: } +// Only for compatibility - because many people outside haven't included event.hxx +// These require Window to be defined for VclPtr<Window> +#include <vcl/vclevent.hxx> +#include <vcl/event.hxx> + #endif // INCLUDED_VCL_WINDOW_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/wrkwin.hxx b/include/vcl/wrkwin.hxx index 637bfc8779a6..9fa12281bc02 100644 --- a/include/vcl/wrkwin.hxx +++ b/include/vcl/wrkwin.hxx @@ -66,6 +66,7 @@ public: explicit WorkWindow( vcl::Window* pParent, const ::com::sun::star::uno::Any& aSystemWorkWindowToken, WinBits nStyle = WB_STDWORK ); explicit WorkWindow( SystemParentData* pParent ); // Not in the REMOTE-Version virtual ~WorkWindow(); + virtual void dispose() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; |