summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2019-01-14 20:51:23 +0100
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2019-01-15 20:46:59 +0100
commitdc0d3a3757e3ad617b8b9f0908662bac3d405228 (patch)
treeeca7aac32f7b6f5014f792ef8da5983174e07e03 /sw
parent14087d3e5fed9b56384432d9aeac608a5e8d86cf (diff)
UNO Styles: uno SvtListener instead of SwClient
Change-Id: I173f8e2e74d4892f259fb62b623cad87523bc990 Reviewed-on: https://gerrit.libreoffice.org/66334 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/unostyle.hxx20
-rw-r--r--sw/source/core/unocore/unostyle.cxx25
2 files changed, 18 insertions, 27 deletions
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx
index 5f2470f87b9d..153ddd6536a2 100644
--- a/sw/inc/unostyle.hxx
+++ b/sw/inc/unostyle.hxx
@@ -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;
};
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 2f7747027e9c..6c03614b793b 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -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( )