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>
This commit is contained in:
Bjoern Michaelsen
2019-09-06 23:36:23 +02:00
committed by Björn Michaelsen
parent 8ac6d2e7e7
commit f2bc27972c
4 changed files with 26 additions and 15 deletions

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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>

View File

@@ -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>