[Libreoffice-commits] core.git: sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 15 19:47:23 UTC 2019
sw/inc/unostyle.hxx | 20 +++++++++-----------
sw/source/core/unocore/unostyle.cxx | 25 +++++++++----------------
2 files changed, 18 insertions(+), 27 deletions(-)
New commits:
commit dc0d3a3757e3ad617b8b9f0908662bac3d405228
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Mon Jan 14 20:51:23 2019 +0100
Commit: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Tue Jan 15 20:46:59 2019 +0100
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 at libreoffice.org>
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( )
More information about the Libreoffice-commits
mailing list