summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-09-12 17:01:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-14 11:22:49 +0200
commit3a2176ae256643a3b8c42bca33d333aecad61d19 (patch)
tree1a67f920f34141ffe485cedf5bcec74b9f878bbf /svx
parent58cb4fc7d17ae5b339c5ed6ae139e6ef2433c927 (diff)
new loplugin refcountingbase
Look for classes that have more than one ref-counting base class. A situation which is going to cause trouble. Which reveals that sdr::table::Cell has two different ref-counting bases, so rather make SdrText extends OWeakObject, which means that Cell can just have one ref-counting base, Change-Id: I8d968270f7b449cff2f29da0bd48fa17181c68c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139807 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx3
-rw-r--r--svx/source/inc/cell.hxx3
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx4
-rw-r--r--svx/source/svdraw/svdotext.cxx12
-rw-r--r--svx/source/svdraw/svdtext.cxx1
-rw-r--r--svx/source/table/cell.cxx4
6 files changed, 13 insertions, 14 deletions
diff --git a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
index bc44ca0096ee..dfe66d3b601a 100644
--- a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
+++ b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -30,6 +30,7 @@
#include <tools/weakbase.h>
#include <svx/sdtaitm.hxx>
#include <rtl/ref.hxx>
+#include <unotools/weakref.hxx>
// predefines
@@ -43,7 +44,7 @@ namespace drawinglayer::primitive2d
private:
// The text model data; this should later just be the OutlinerParaObject or
// something equal
- ::tools::WeakReference< SdrText > mrSdrText;
+ ::unotools::WeakReference< SdrText > mxSdrText;
// #i97628#
// The text content; now as local OutlinerParaObject copy (internally RefCounted and
diff --git a/svx/source/inc/cell.hxx b/svx/source/inc/cell.hxx
index 36ce254d1aa7..331465f4eaa3 100644
--- a/svx/source/inc/cell.hxx
+++ b/svx/source/inc/cell.hxx
@@ -46,8 +46,7 @@ class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Cell final : public SdrText,
public SvxUnoTextBase,
public css::table::XMergeableCell,
public css::awt::XLayoutConstrains,
- public css::lang::XEventListener,
- public ::cppu::OWeakObject
+ public css::lang::XEventListener
{
friend class CellUndo;
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index 1d44b8fbf7db..8e67f32b1e6b 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -97,7 +97,7 @@ namespace drawinglayer::primitive2d
SdrTextPrimitive2D::SdrTextPrimitive2D(
const SdrText* pSdrText,
OutlinerParaObject aOutlinerParaObject)
- : mrSdrText(const_cast< SdrText* >(pSdrText)),
+ : mxSdrText(const_cast< SdrText* >(pSdrText)),
maOutlinerParaObject(std::move(aOutlinerParaObject)),
mnLastPageNumber(0),
mnLastPageCount(0),
@@ -115,7 +115,7 @@ namespace drawinglayer::primitive2d
|| rETO.HasField(SvxAuthorField::CLASS_ID);
}
- const SdrText* SdrTextPrimitive2D::getSdrText() const { return mrSdrText.get(); }
+ const SdrText* SdrTextPrimitive2D::getSdrText() const { return mxSdrText.get().get(); }
bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 24223aaee738..53b32ddf28b2 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -193,7 +193,7 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrObjKind eNewTextKind,
SdrTextObj::~SdrTextObj()
{
- mpText.reset();
+ mxText.clear();
ImpDeregisterLink();
}
@@ -2047,10 +2047,10 @@ rtl::Reference<SdrObject> SdrTextObj::getFullDragClone() const
/** returns the currently active text. */
SdrText* SdrTextObj::getActiveText() const
{
- if( !mpText )
+ if( !mxText )
return getText( 0 );
else
- return mpText.get();
+ return mxText.get();
}
/** returns the nth available text. */
@@ -2058,9 +2058,9 @@ SdrText* SdrTextObj::getText( sal_Int32 nIndex ) const
{
if( nIndex == 0 )
{
- if( !mpText )
- const_cast< SdrTextObj* >(this)->mpText.reset( new SdrText( *const_cast< SdrTextObj* >(this) ) );
- return mpText.get();
+ if( !mxText )
+ const_cast< SdrTextObj* >(this)->mxText = new SdrText( *const_cast< SdrTextObj* >(this) );
+ return mxText.get();
}
else
{
diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx
index 72591ef67d92..e013620b7d06 100644
--- a/svx/source/svdraw/svdtext.cxx
+++ b/svx/source/svdraw/svdtext.cxx
@@ -36,7 +36,6 @@ SdrText::SdrText( SdrTextObj& rObject )
SdrText::~SdrText()
{
- clearWeak();
}
void SdrText::CheckPortionInfo( const SdrOutliner& rOutliner )
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 9922952fc780..a358865334d9 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -866,13 +866,13 @@ Any SAL_CALL Cell::queryInterface( const Type & rType )
void SAL_CALL Cell::acquire() noexcept
{
- ::cppu::OWeakObject::acquire();
+ SdrText::acquire();
}
void SAL_CALL Cell::release() noexcept
{
- ::cppu::OWeakObject::release();
+ SdrText::release();
}