diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-25 12:59:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-27 17:19:26 +0100 |
commit | c95d91ee35ca09379a8a1d415ae77716ddeadaac (patch) | |
tree | 370b0ad6832f3aca2ee0e2ef375bb6f953e5d360 /include/svx | |
parent | 2d8f17565ebe867210f5769851d91b2e7b612a8f (diff) |
improve subtyping when dealing with tools::WeakReference
tweak the templating to make it easier to declare a WeakReference that
points to a subclass for a weak-capable class.
Which lets us declare some fields with more specific types, and dump a
lot of unnecessary casting.
And make WeakBase be inherited from virtually, so we don't end
up with weird states where two weak refernces could point to two
different parts of the same object.
Change-Id: I3213ea27e087038457b0761b5171c7bce96e71f3
Reviewed-on: https://gerrit.libreoffice.org/48650
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svx')
-rw-r--r-- | include/svx/sdr/table/tablecontroller.hxx | 4 | ||||
-rw-r--r-- | include/svx/svdedxv.hxx | 4 | ||||
-rw-r--r-- | include/svx/svdmodel.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdobj.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdoutl.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdpage.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdtext.hxx | 4 | ||||
-rw-r--r-- | include/svx/svdview.hxx | 2 |
8 files changed, 11 insertions, 11 deletions
diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx index d621d87d2fd0..b2eeadc48007 100644 --- a/include/svx/sdr/table/tablecontroller.hxx +++ b/include/svx/sdr/table/tablecontroller.hxx @@ -116,7 +116,7 @@ public: bool isColumnSelected( sal_Int32 nColumn ); bool isRowHeader(); bool isColumnHeader(); - sdr::table::SdrTableObj* GetTableObj() { return dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() ); } + sdr::table::SdrTableObj* GetTableObj() { return mxTableObj.get(); } private: SvxTableController(SvxTableController &) = delete; void operator =(SvxTableController &) = delete; @@ -176,7 +176,7 @@ private: sdr::overlay::OverlayObjectList* mpSelectionOverlay; SdrView* mpView; - tools::WeakReference<SdrObject> mxTableObj; + tools::WeakReference<SdrTableObj> mxTableObj; SdrModel* mpModel; css::uno::Reference< css::util::XModifyListener > mxModifyListener; diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx index 20f61dff15af..46dd040e0d5a 100644 --- a/include/svx/svdedxv.hxx +++ b/include/svx/svdedxv.hxx @@ -74,7 +74,7 @@ class SVX_DLLPUBLIC SdrObjEditView: public SdrGlueEditView, public EditViewCallb protected: // TextEdit - tools::WeakReference<SdrObject> + tools::WeakReference<SdrTextObj> mxTextEditObj; // current object in TextEdit SdrPageView* pTextEditPV; SdrOutliner* pTextEditOutliner; // outliner for the TextEdit @@ -216,7 +216,7 @@ public: bool IsTextEditInSelectionMode() const; // If sb needs the object out of the TextEdit: - SdrObject* GetTextEditObject() const { return mxTextEditObj.get(); } + SdrTextObj* GetTextEditObject() const { return mxTextEditObj.get(); } // info about TextEditPageView. Default is 0L. virtual SdrPageView* GetTextEditPageView() const override; diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 5d72c59477b7..b30493328d24 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -141,7 +141,7 @@ public: struct SdrModelImpl; -class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase< SdrModel > +class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public virtual tools::WeakBase { protected: std::vector<SdrPage*> maMaPag; // master pages diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 25ab2c824e14..007283844a7a 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -268,7 +268,7 @@ public: /// Abstract DrawObject class SvxShape; -class SVX_DLLPUBLIC SdrObject: public SfxListener, public tools::WeakBase< SdrObject > +class SVX_DLLPUBLIC SdrObject: public SfxListener, public virtual tools::WeakBase { friend class SdrObjListIter; friend class SdrVirtObj; diff --git a/include/svx/svdoutl.hxx b/include/svx/svdoutl.hxx index b13cd4b0ab6f..c1ec4636dff6 100644 --- a/include/svx/svdoutl.hxx +++ b/include/svx/svdoutl.hxx @@ -30,7 +30,7 @@ class SdrPage; class SVX_DLLPUBLIC SdrOutliner : public Outliner { protected: - tools::WeakReference<SdrObject> mpTextObj; + tools::WeakReference<SdrTextObj> mpTextObj; const SdrPage* mpVisualizedPage; public: diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index 7f9917bacb29..8cd45fbe93f5 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -350,7 +350,7 @@ public: Also it's possible to request and directly set the order number (ZOrder) of SdrObjects. */ -class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage > +class SVX_DLLPUBLIC SdrPage : public SdrObjList, public virtual tools::WeakBase { // #i9076# friend class SdrModel; diff --git a/include/svx/svdtext.hxx b/include/svx/svdtext.hxx index 4733ad4f6230..f16e16edd4e1 100644 --- a/include/svx/svdtext.hxx +++ b/include/svx/svdtext.hxx @@ -40,11 +40,11 @@ namespace sdr { namespace properties { */ class SfxStyleSheet; -class SVX_DLLPUBLIC SdrText : public tools::WeakBase< SdrText > +class SVX_DLLPUBLIC SdrText : public virtual tools::WeakBase { public: SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject = nullptr ); - virtual ~SdrText(); + virtual ~SdrText() override; virtual void SetModel(SdrModel* pNewModel); void ForceOutlinerParaObject( OutlinerMode nOutlMode ); diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx index 0fc3672b562c..b289cb5b66b4 100644 --- a/include/svx/svdview.hxx +++ b/include/svx/svdview.hxx @@ -144,7 +144,7 @@ public: }; -class SVX_DLLPUBLIC SdrView: public SdrCreateView, public tools::WeakBase< SdrView > +class SVX_DLLPUBLIC SdrView: public SdrCreateView, public virtual tools::WeakBase { friend class SdrPageView; |