summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/animate.hxx9
-rw-r--r--include/vcl/btndlg.hxx1
-rw-r--r--include/vcl/builder.hxx40
-rw-r--r--include/vcl/button.hxx21
-rw-r--r--include/vcl/cairo.hxx3
-rw-r--r--include/vcl/combobox.hxx24
-rw-r--r--include/vcl/controllayout.hxx7
-rw-r--r--include/vcl/ctrl.hxx1
-rw-r--r--include/vcl/cursor.hxx3
-rw-r--r--include/vcl/decoview.hxx3
-rw-r--r--include/vcl/dialog.hxx16
-rw-r--r--include/vcl/dockingarea.hxx1
-rw-r--r--include/vcl/dockwin.hxx15
-rw-r--r--include/vcl/edit.hxx6
-rw-r--r--include/vcl/event.hxx26
-rw-r--r--include/vcl/field.hxx14
-rw-r--r--include/vcl/fixed.hxx5
-rw-r--r--include/vcl/fixedhyper.hxx5
-rw-r--r--include/vcl/floatwin.hxx5
-rw-r--r--include/vcl/fltcall.hxx2
-rw-r--r--include/vcl/gdimtf.hxx3
-rw-r--r--include/vcl/introwin.hxx6
-rw-r--r--include/vcl/layout.hxx63
-rw-r--r--include/vcl/lazydelete.hxx11
-rw-r--r--include/vcl/longcurr.hxx2
-rw-r--r--include/vcl/lstbox.hxx9
-rw-r--r--include/vcl/menu.hxx2
-rw-r--r--include/vcl/menubtn.hxx1
-rw-r--r--include/vcl/morebtn.hxx3
-rw-r--r--include/vcl/msgbox.hxx19
-rw-r--r--include/vcl/oldprintadaptor.hxx2
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx7
-rw-r--r--include/vcl/openglwin.hxx6
-rw-r--r--include/vcl/outdev.hxx38
-rw-r--r--include/vcl/popupmenuwindow.hxx1
-rw-r--r--include/vcl/prgsbar.hxx5
-rw-r--r--include/vcl/print.hxx15
-rw-r--r--include/vcl/scrbar.hxx3
-rw-r--r--include/vcl/seleng.hxx2
-rw-r--r--include/vcl/spin.hxx1
-rw-r--r--include/vcl/spinfld.hxx6
-rw-r--r--include/vcl/split.hxx3
-rw-r--r--include/vcl/splitwin.hxx3
-rw-r--r--include/vcl/status.hxx9
-rw-r--r--include/vcl/syschild.hxx1
-rw-r--r--include/vcl/syswin.hxx6
-rw-r--r--include/vcl/tabctrl.hxx7
-rw-r--r--include/vcl/tabdlg.hxx7
-rw-r--r--include/vcl/tabpage.hxx2
-rw-r--r--include/vcl/taskpanelist.hxx2
-rw-r--r--include/vcl/texteng.hxx3
-rw-r--r--include/vcl/throbber.hxx1
-rw-r--r--include/vcl/toolbox.hxx7
-rw-r--r--include/vcl/vclevent.hxx9
-rw-r--r--include/vcl/vclmedit.hxx7
-rw-r--r--include/vcl/vclptr.hxx357
-rw-r--r--include/vcl/virdev.hxx5
-rw-r--r--include/vcl/waitobj.hxx2
-rw-r--r--include/vcl/window.hxx46
-rw-r--r--include/vcl/wrkwin.hxx1
60 files changed, 636 insertions, 254 deletions
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;