dont use SwClient/SwModify in unocore: NumberingRules
Change-Id: I20ee1662310f33831757015659a70d3ffd855b3e
Reviewed-on: https://gerrit.libreoffice.org/54508
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index c12d434..3dd5a1d 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -134,7 +134,9 @@ namespace o3tl {
template<> struct typed_flags<UseOnPage> : is_typed_flags<UseOnPage, 0xffff> {};
}
class SW_DLLPUBLIC SwPageDesc : public SwModify
class SW_DLLPUBLIC SwPageDesc
: public SwModify
, public sw::BroadcasterMixin
{
friend class SwDoc;
friend class SwPageDescs;
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index a283a79..c0894ce 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -73,6 +73,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/propertyvalue.hxx>
#include <svl/itemprop.hxx>
#include <svl/listener.hxx>
#include <paratr.hxx>
using namespace ::com::sun::star;
@@ -82,6 +83,14 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::text;
using namespace ::com::sun::star::style;
namespace
{
inline SvtBroadcaster& GetPageDescNotifier(SwDoc* pDoc)
{
return pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier();
}
}
// Constants for the css::text::ColumnSeparatorStyle
#define API_COL_LINE_NONE 0
#define API_COL_LINE_SOLID 1
@@ -999,15 +1008,13 @@ OSL_FAIL("not implemented");
static const char aInvalidStyle[] = "__XXX___invalid";
class SwXNumberingRules::Impl : public SwClient
class SwXNumberingRules::Impl
: public SvtListener
{
private:
SwXNumberingRules& m_rParent;
public:
explicit Impl(SwXNumberingRules& rParent) : m_rParent(rParent) {}
protected:
//SwClient
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
virtual void Notify(const SfxHint&) override;
public:
explicit Impl(SwXNumberingRules& rParent) : m_rParent(rParent) {}
};
bool SwXNumberingRules::isInvalidStyle(const OUString &rName)
@@ -1074,7 +1081,7 @@ SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) :
}
}
if(pDoc)
pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(&*m_pImpl);
m_pImpl->StartListening(GetPageDescNotifier(pDoc));
for(sal_uInt16 i = 0; i < MAXLEVEL; ++i)
{
m_sNewCharStyleNames[i] = aInvalidStyle;
@@ -1090,7 +1097,7 @@ SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) :
m_pPropertySet(GetNumberingRulesSet()),
bOwnNumRuleCreated(false)
{
pDocShell->GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(&*m_pImpl);
m_pImpl->StartListening(GetPageDescNotifier(pDocShell->GetDoc()));
}
SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
@@ -1101,7 +1108,7 @@ SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
m_pPropertySet(GetNumberingRulesSet()),
bOwnNumRuleCreated(false)
{
rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(&*m_pImpl);
m_pImpl->StartListening(GetPageDescNotifier(&rDoc));
m_sCreatedNumRuleName = rDoc.GetUniqueNumRuleName();
rDoc.MakeNumRule( m_sCreatedNumRuleName, nullptr, false,
// #i89178#
@@ -2234,10 +2241,9 @@ void SwXNumberingRules::setName(const OUString& /*rName*/)
throw aExcept;
}
void SwXNumberingRules::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
void SwXNumberingRules::Impl::Notify(const SfxHint& rHint)
{
ClientModify(this, pOld, pNew);
if(!GetRegisteredIn())
if(rHint.GetId() == SfxHintId::Dying)
{
if(m_rParent.bOwnNumRuleCreated)
delete m_rParent.pNumRule;