Kaydet (Commit) dc0d3a37 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen Kaydeden (comit) Björn Michaelsen

UNO Styles: uno SvtListener instead of SwClient

Change-Id: I173f8e2e74d4892f259fb62b623cad87523bc990
Reviewed-on: https://gerrit.libreoffice.org/66334
Tested-by: Jenkins
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>
üst 14087d3e
......@@ -19,6 +19,7 @@
#ifndef INCLUDED_SW_INC_UNOSTYLE_HXX
#define INCLUDED_SW_INC_UNOSTYLE_HXX
#include <svl/listener.hxx>
#include <svl/style.hxx>
#include "unocoll.hxx"
#include "tblafmt.hxx"
......@@ -131,14 +132,11 @@ public:
};
// access to a family of automatic styles (character or paragraph or ...)
class SwXAutoStyleFamily : public cppu::WeakImplHelper< css::style::XAutoStyleFamily >,
public SwClient
class SwXAutoStyleFamily : public cppu::WeakImplHelper< css::style::XAutoStyleFamily >, public SvtListener
{
SwDocShell *m_pDocShell;
IStyleAccess::SwAutoStyleFamily const m_eFamily;
protected:
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
public:
SwXAutoStyleFamily(SwDocShell* pDocShell, IStyleAccess::SwAutoStyleFamily eFamily);
......@@ -154,10 +152,10 @@ public:
virtual css::uno::Type SAL_CALL getElementType( ) override;
virtual sal_Bool SAL_CALL hasElements( ) override;
virtual void Notify( const SfxHint&) override;
};
class SwXAutoStylesEnumerator : public cppu::WeakImplHelper< css::container::XEnumeration >,
public SwClient
class SwXAutoStylesEnumerator : public cppu::WeakImplHelper< css::container::XEnumeration >, public SvtListener
{
std::unique_ptr<SwAutoStylesEnumImpl> m_pImpl;
public:
......@@ -167,8 +165,8 @@ public:
//XEnumeration
virtual sal_Bool SAL_CALL hasMoreElements( ) override;
virtual css::uno::Any SAL_CALL nextElement( ) override;
protected:
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
virtual void Notify( const SfxHint&) override;
};
// an automatic style
......@@ -178,7 +176,7 @@ class SwXAutoStyle : public cppu::WeakImplHelper
css::beans::XPropertyState,
css::style::XAutoStyle
>,
public SwClient
public SvtListener
{
private:
std::shared_ptr<SfxItemSet> mpSet;
......@@ -224,8 +222,8 @@ public:
// Special
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getProperties() override;
protected:
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
virtual void Notify( const SfxHint& ) override;
};
......
......@@ -3474,17 +3474,16 @@ SwXAutoStyleFamily::SwXAutoStyleFamily(SwDocShell* pDocSh, IStyleAccess::SwAutoS
m_pDocShell( pDocSh ), m_eFamily(nFamily)
{
// Register ourselves as a listener to the document (via the page descriptor)
pDocSh->GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
StartListening(pDocSh->GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier());
}
SwXAutoStyleFamily::~SwXAutoStyleFamily()
{
}
void SwXAutoStyleFamily::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
void SwXAutoStyleFamily::Notify(const SfxHint& rHint)
{
ClientModify(this, pOld, pNew);
if(!GetRegisteredIn())
if(rHint.GetId() == SfxHintId::Dying)
m_pDocShell = nullptr;
}
......@@ -3772,20 +3771,17 @@ SwXAutoStylesEnumerator::SwXAutoStylesEnumerator( SwDoc* pDoc, IStyleAccess::SwA
: m_pImpl( new SwAutoStylesEnumImpl( pDoc, eFam ) )
{
// Register ourselves as a listener to the document (via the page descriptor)
pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
StartListening(pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier());
}
SwXAutoStylesEnumerator::~SwXAutoStylesEnumerator()
{
}
void SwXAutoStylesEnumerator::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
void SwXAutoStylesEnumerator::Notify( const SfxHint& rHint)
{
ClientModify(this, pOld, pNew);
if(!GetRegisteredIn())
{
if(rHint.GetId() == SfxHintId::Dying)
m_pImpl.reset();
}
}
sal_Bool SwXAutoStylesEnumerator::hasMoreElements( )
......@@ -3826,20 +3822,17 @@ SwXAutoStyle::SwXAutoStyle(
mrDoc(*pDoc)
{
// Register ourselves as a listener to the document (via the page descriptor)
mrDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
//StartListening(mrDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier());
}
SwXAutoStyle::~SwXAutoStyle()
{
}
void SwXAutoStyle::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
void SwXAutoStyle::Notify(const SfxHint& rHint)
{
ClientModify(this, pOld, pNew);
if(!GetRegisteredIn())
{
if(rHint.GetId() == SfxHintId::Dying)
mpSet.reset();
}
}
uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment