summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2019-09-06 23:36:23 +0200
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2019-09-07 08:23:17 +0200
commitf2bc27972c13f54c4860a3ca995017bc5ad84e6e (patch)
tree70e9cfb49315152e357ac2a8e7e8740a59daec9f
parent8ac6d2e7e7293e7c5f4bb79ab7b36a843b2c3175 (diff)
kill SwXShape SwClient
this completely removes calbck.hxx from sw/source/core/unocore -- may it never return. Change-Id: Ie4c8b3a29fd4038a19c34116d47672b504ee9f2c Reviewed-on: https://gerrit.libreoffice.org/78735 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
-rw-r--r--sw/inc/unodraw.hxx14
-rw-r--r--sw/source/core/unocore/unodraw.cxx25
-rw-r--r--sw/source/core/unocore/unofield.cxx1
-rw-r--r--sw/source/core/unocore/unoframe.cxx1
4 files changed, 26 insertions, 15 deletions
diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx
index 6bfa4839eba7..2938e7a79114 100644
--- a/sw/inc/unodraw.hxx
+++ b/sw/inc/unodraw.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_SW_INC_UNODRAW_HXX
#include <svl/itemprop.hxx>
+#include <svl/listener.hxx>
#include <svx/fmdpage.hxx>
#include "calbck.hxx"
#include "frmfmt.hxx"
@@ -130,12 +131,13 @@ cppu::WeakAggImplHelper6
css::drawing::XShape
>
SwXShapeBaseClass;
-class SwXShape : public SwXShapeBaseClass, public SwClient
+class SwXShape : public SwXShapeBaseClass, public SvtListener
{
friend class SwXGroupShape;
friend class SwXDrawPage;
friend class SwFmDrawPage;
const SwFmDrawPage* m_pPage;
+ SwFrameFormat* m_pFormat;
css::uno::Reference< css::uno::XAggregation > xShapeAgg;
// reference to <XShape>, determined in the
@@ -197,13 +199,19 @@ class SwXShape : public SwXShapeBaseClass, public SwClient
@throws css::uno::RuntimeException
*/
css::uno::Any _getPropAtAggrObj( const OUString& _rPropertyName );
+ void SetFrameFormat(SwFrameFormat* pFormat)
+ {
+ EndListeningAll();
+ StartListening(pFormat->GetNotifier());
+ m_pFormat = pFormat;
+ }
protected:
virtual ~SwXShape() override;
- void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
public:
SwXShape(css::uno::Reference<css::uno::XInterface> & xShape, SwDoc const*const pDoc);
+ virtual void Notify(const SfxHint&) override;
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
@@ -248,7 +256,7 @@ public:
virtual OUString SAL_CALL getShapeType( ) override;
SwShapeDescriptor_Impl* GetDescImpl() {return pImpl.get();}
- SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
+ SwFrameFormat* GetFrameFormat() const { return m_pFormat; }
const css::uno::Reference< css::uno::XAggregation >& GetAggregationInterface() {return xShapeAgg;}
// helper
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index e91e4168c7fb..be29668a6b40 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -72,7 +72,6 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <com/sun/star/drawing/PointSequence.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <calbck.hxx>
using namespace ::com::sun::star;
@@ -575,7 +574,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
static_cast< cppu::OWeakObject * > ( this ) );
// we're already registered in the model / SwXDrawPage::add() already called
- if(pShape->m_pPage || pShape->GetRegisteredIn() || !pShape->m_bDescriptor )
+ if(pShape->m_pPage || pShape->m_pFormat || !pShape->m_bDescriptor )
return;
// we're inserted elsewhere already
@@ -711,7 +710,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
pDoc->getIDocumentContentOperations().InsertDrawObj( *pTemp, *pObj, aSet );
SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
if(pFormat)
- pFormat->Add(pShape);
+ pShape->SetFrameFormat(pFormat);
pShape->m_bDescriptor = false;
pPam.reset();
@@ -871,6 +870,7 @@ SwXShape::SwXShape(
uno::Reference<uno::XInterface> & xShape,
SwDoc const*const pDoc)
: m_pPage(nullptr)
+ , m_pFormat(nullptr)
, m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SHAPE))
, m_pPropertyMapEntries(aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_TEXT_SHAPE))
, pImpl(new SwShapeDescriptor_Impl(pDoc))
@@ -907,9 +907,9 @@ SwXShape::SwXShape(
SdrObject* pObj = pShape ? pShape->GetSdrObject() : nullptr;
if(pObj)
{
- SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
+ auto pFormat = ::FindFrameFormat( pObj );
if(pFormat)
- pFormat->Add(this);
+ SetFrameFormat(pFormat);
lcl_addShapePropertyEventFactories( *pObj, *this );
pImpl->bInitializedPropertyNotifier = true;
@@ -936,9 +936,9 @@ void SwXShape::AddExistingShapeToFormat( SdrObject const & _rObj )
{
if ( pSwShape->m_bDescriptor )
{
- SwFrameFormat* pFormat = ::FindFrameFormat( pCurrent );
+ auto pFormat = ::FindFrameFormat( pCurrent );
if ( pFormat )
- pFormat->Add( pSwShape );
+ pSwShape->SetFrameFormat(pFormat);
pSwShape->m_bDescriptor = false;
}
@@ -1984,9 +1984,13 @@ void SwXShape::removeVetoableChangeListener(
OSL_FAIL("not implemented");
}
-void SwXShape::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+void SwXShape::Notify(const SfxHint& rHint)
{
- ClientModify(this, pOld, pNew);
+ if(rHint.GetId() == SfxHintId::Dying)
+ {
+ m_pFormat = nullptr;
+ EndListeningAll();
+ }
}
void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
@@ -2754,8 +2758,9 @@ void SwXGroupShape::add( const uno::Reference< XShape >& xShape )
pSwShape->m_bDescriptor = false;
//add the group member to the format of the group
SwFrameFormat* pShapeFormat = ::FindFrameFormat( pSvxShape->GetSdrObject() );
+
if(pShapeFormat)
- pFormat->Add(pSwShape);
+ pSwShape->SetFrameFormat(pShapeFormat);
}
}
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 729bc6ecb1e3..a23a88b85121 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -96,7 +96,6 @@
#include <editeng/outliner.hxx>
#include <docsh.hxx>
#include <fmtmeta.hxx>
-#include <calbck.hxx>
#include <rtl/strbuf.hxx>
#include <editeng/outlobj.hxx>
#include <vector>
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 5ed7b51c6cc6..aa978f2962ea 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -125,7 +125,6 @@
#include <fmtfollowtextflow.hxx>
#include <fmtwrapinfluenceonobjpos.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <calbck.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <sal/log.hxx>