diff options
Diffstat (limited to 'include/vcl')
-rw-r--r-- | include/vcl/builder.hxx | 20 | ||||
-rw-r--r-- | include/vcl/button.hxx | 4 | ||||
-rw-r--r-- | include/vcl/combobox.hxx | 6 | ||||
-rw-r--r-- | include/vcl/controllayout.hxx | 4 | ||||
-rw-r--r-- | include/vcl/cursor.hxx | 3 | ||||
-rw-r--r-- | include/vcl/dialog.hxx | 2 | ||||
-rw-r--r-- | include/vcl/dockwin.hxx | 14 | ||||
-rw-r--r-- | include/vcl/event.hxx | 3 | ||||
-rw-r--r-- | include/vcl/field.hxx | 2 | ||||
-rw-r--r-- | include/vcl/fixed.hxx | 2 | ||||
-rw-r--r-- | include/vcl/floatwin.hxx | 4 | ||||
-rw-r--r-- | include/vcl/fltcall.hxx | 2 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 30 | ||||
-rw-r--r-- | include/vcl/lstbox.hxx | 8 | ||||
-rw-r--r-- | include/vcl/menu.hxx | 2 | ||||
-rw-r--r-- | include/vcl/msgbox.hxx | 16 | ||||
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 8 | ||||
-rw-r--r-- | include/vcl/seleng.hxx | 2 | ||||
-rw-r--r-- | include/vcl/split.hxx | 2 | ||||
-rw-r--r-- | include/vcl/syswin.hxx | 2 | ||||
-rw-r--r-- | include/vcl/tabdlg.hxx | 4 | ||||
-rw-r--r-- | include/vcl/tabpage.hxx | 2 | ||||
-rw-r--r-- | include/vcl/taskpanelist.hxx | 2 | ||||
-rw-r--r-- | include/vcl/toolbox.hxx | 4 | ||||
-rw-r--r-- | include/vcl/vclevent.hxx | 7 | ||||
-rw-r--r-- | include/vcl/vclptr.hxx | 40 | ||||
-rw-r--r-- | include/vcl/waitobj.hxx | 2 | ||||
-rw-r--r-- | include/vcl/window.hxx | 4 |
28 files changed, 122 insertions, 79 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index aba3f0889e60..cdf2a9dd9a21 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -60,7 +60,7 @@ public: 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); @@ -266,7 +266,7 @@ private: } }; - typedef std::map< vcl::Window*, stringmap> AtkMap; + typedef std::map< VclPtr<vcl::Window>, stringmap> AtkMap; struct ParserState { @@ -293,7 +293,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; @@ -301,13 +301,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); @@ -316,7 +314,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; @@ -408,7 +406,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"); @@ -417,7 +415,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 @@ -466,7 +464,7 @@ public: 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 124b314f8f4a..de7fbeea9bd7 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -274,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; @@ -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; diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index d36db77d8c9c..678dbc5db491 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -36,9 +36,9 @@ class VCL_DLLPUBLIC ComboBox : public Edit { private: VclPtr<Edit> mpSubEdit; - ImplListBox* mpImplLB; - ImplBtn* mpBtn; - ImplListBoxFloatingWindow* mpFloatWin; + VclPtr<ImplListBox> mpImplLB; + VclPtr<ImplBtn> mpBtn; + VclPtr<ImplListBoxFloatingWindow> mpFloatWin; sal_uInt16 mnDDHeight; sal_Unicode mcMultiSep; bool mbDDAutoSize : 1; diff --git a/include/vcl/controllayout.hxx b/include/vcl/controllayout.hxx index 0856a69946b5..f9167244e0a1 100644 --- a/include/vcl/controllayout.hxx +++ b/include/vcl/controllayout.hxx @@ -42,9 +42,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/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/dialog.hxx b/include/vcl/dialog.hxx index e5a895fdba6e..652a06965e27 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -40,7 +40,7 @@ class VclButtonBox; class VCL_DLLPUBLIC Dialog : public SystemWindow { private: - Dialog* mpPrevExecuteDlg; + VclPtr<Dialog> mpPrevExecuteDlg; DialogImpl* mpDialogImpl; long mnMousePositioned; bool mbInExecute; diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx index 685dcd4624e7..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); diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx index 05a54dc7dfc5..22361a6f910b 100644 --- a/include/vcl/event.hxx +++ b/include/vcl/event.hxx @@ -26,6 +26,7 @@ #include <vcl/keycod.hxx> #include <vcl/cmdevt.hxx> #include <vcl/settings.hxx> +#include <vcl/vclptr.hxx> class AllSettings; class OutputDevice; @@ -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; diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index fc51b627978e..65baa304b245 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; diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx index 19c070ea6c0e..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; diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx index 6c1147d241ce..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; 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/layout.hxx b/include/vcl/layout.hxx index 1f8555675f53..469c7e4851b0 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -354,7 +354,7 @@ private: struct GridEntry { - vcl::Window *pChild; + VclPtr<vcl::Window> pChild; sal_Int32 nSpanWidth; sal_Int32 nSpanHeight; GridEntry() @@ -456,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); @@ -467,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; @@ -520,6 +522,8 @@ public: m_pDisclosureButton->SetToggleHdl(LINK(this, VclExpander, ClickHdl)); m_pDisclosureButton->Show(); } + virtual ~VclExpander() { dispose(); } + void dispose() SAL_OVERRIDE { m_pDisclosureButton.clear(); VclBin::dispose(); } 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; @@ -545,7 +549,6 @@ public: protected: virtual Size calculateRequisition() const SAL_OVERRIDE; virtual void setAllocation(const Size &rAllocation) SAL_OVERRIDE; - void dispose() SAL_OVERRIDE { m_pDisclosureButton.disposeAndClear(); VclBin::dispose(); } private: bool m_bResizeTopLevel; VclPtr<DisclosureButton> m_pDisclosureButton; @@ -557,6 +560,8 @@ class VCL_DLLPUBLIC VclScrolledWindow : public VclBin { public: VclScrolledWindow(vcl::Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN | WB_AUTOHSCROLL | WB_AUTOVSCROLL); + virtual ~VclScrolledWindow() { dispose(); } + void dispose() SAL_OVERRIDE { m_pVScroll.disposeAndClear(); m_pHScroll.disposeAndClear(); m_aScrollBarBox.clear(); VclBin::dispose(); } 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; @@ -572,7 +577,6 @@ protected: DECL_LINK(ScrollBarHdl, void *); void InitScrollBars(const Size &rRequest); virtual bool Notify(NotifyEvent& rNEvt) SAL_OVERRIDE; - void dispose() SAL_OVERRIDE { m_pVScroll.disposeAndClear(); m_pHScroll.disposeAndClear(); m_aScrollBarBox.disposeAndClear(); VclBin::dispose(); } private: bool m_bUserManagedScrolling; VclPtr<ScrollBar> m_pVScroll; @@ -648,7 +652,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; @@ -661,17 +665,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; } @@ -714,11 +718,11 @@ private: VclPtr<VclBox> m_pOwnedContentArea; VclPtr<VclButtonBox> m_pOwnedActionArea; VclPtr<VclGrid> m_pGrid; - FixedImage* m_pImage; - VclMultiLineEdit* m_pPrimaryMessage; - VclMultiLineEdit* m_pSecondaryMessage; + VclPtr<FixedImage> m_pImage; + VclPtr<VclMultiLineEdit> m_pPrimaryMessage; + VclPtr<VclMultiLineEdit> m_pSecondaryMessage; std::vector<VclPtr<PushButton> > m_aOwnedButtons; - std::map<const vcl::Window*, short> m_aResponses; + std::map< VclPtr<const vcl::Window>, short> m_aResponses; OUString m_sPrimaryString; OUString m_sSecondaryString; DECL_DLLPRIVATE_LINK(ButtonHdl, Button *); diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index fdbce0795ad9..c62ee8d977f7 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; diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index cd058dbdd539..8cf8c00a60de 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/msgbox.hxx b/include/vcl/msgbox.hxx index 15d41614cf0d..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(); diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 56c34c0af5a7..b69bda35276c 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -249,10 +249,10 @@ 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; + boost::scoped_ptr<SystemChildWindow> m_pChildWindowGC; bool mbInitialized; int mnRefCount; bool mbRequestLegacyContext; 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/split.hxx b/include/vcl/split.hxx index c167ce7cc506..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; diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx index 4f7d5728bb83..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 ); diff --git a/include/vcl/tabdlg.hxx b/include/vcl/tabdlg.hxx index f02e2a79de16..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; diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx index 7294d4896748..702a42c756b6 100644 --- a/include/vcl/tabpage.hxx +++ b/include/vcl/tabpage.hxx @@ -41,7 +41,7 @@ private: public: explicit TabPage( vcl::Window* pParent, WinBits nStyle = 0 ); explicit TabPage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription ); - ~TabPage(); + virtual ~TabPage(); virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) 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/toolbox.hxx b/include/vcl/toolbox.hxx index 8c72c3cc3aae..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; diff --git a/include/vcl/vclevent.hxx b/include/vcl/vclevent.hxx index 4e165a438643..a6a809ffb460 100644 --- a/include/vcl/vclevent.hxx +++ b/include/vcl/vclevent.hxx @@ -24,6 +24,7 @@ #include <tools/rtti.hxx> #include <vcl/dllapi.h> #include <vcl/impdel.hxx> +#include <vcl/vclptr.hxx> #include <com/sun/star/uno/Reference.hxx> @@ -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/vclptr.hxx b/include/vcl/vclptr.hxx index 50a87ba247ef..832d608b686f 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -21,6 +21,7 @@ #define INCLUDED_VCL_PTR_HXX #include <rtl/ref.hxx> +#include <cstddef> /// @cond INTERNAL namespace vcl { namespace detail { @@ -68,6 +69,8 @@ public: }; }; // 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. * @@ -91,7 +94,7 @@ public: /** Constructor... */ - explicit inline VclPtr (reference_type * pBody) + inline VclPtr (reference_type * pBody) : m_rInnerRef(pBody) {} @@ -180,6 +183,41 @@ public: } } + /** 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 #endif // INCLUDED_VCL_PTR_HXX 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 7d104a4700c2..cb178d2c3571 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -662,7 +662,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(); @@ -1431,7 +1431,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 |