[Libreoffice-commits] core.git: sw/inc sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 13 21:56:10 UTC 2018


 sw/inc/unotbl.hxx                 |   11 ++++++-----
 sw/source/core/unocore/unotbl.cxx |   23 +++++++++++------------
 2 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 036e7d8ca0527fc6bebda2c1745750e04dbd3d1f
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Mon Nov 12 22:29:39 2018 +0100
Commit:     Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Tue Nov 13 22:55:43 2018 +0100

    no more SwClient/SwModify for SwXCell
    
    Change-Id: I014d3e8eed3f65e4eb09ac53c6d34886a2d1086a
    Reviewed-on: https://gerrit.libreoffice.org/63310
    Tested-by: Jenkins
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 83dbb04c951c..59a762a6f4f4 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -34,6 +34,8 @@
 
 #include <comphelper/uno3.hxx>
 
+#include <svl/listener.hxx>
+
 #include "calbck.hxx"
 #include "TextCursorHelper.hxx"
 #include "unotext.hxx"
@@ -57,7 +59,7 @@ cppu::WeakImplHelper
 SwXCellBaseClass;
 class SwXCell final : public SwXCellBaseClass,
     public SwXText,
-    public SwClient
+    public SvtListener
 {
     friend void   sw_setString( SwXCell &rCell, const OUString &rText,
                                 bool bKeepNumberFormat );
@@ -66,6 +68,7 @@ class SwXCell final : public SwXCellBaseClass,
     const SfxItemPropertySet*   m_pPropSet;
     SwTableBox*                 pBox;       // only set in non-XML import
     const SwStartNode*      pStartNode; // only set in XML import
+    SwFrameFormat* m_pTableFormat;
 
     // table position where pBox was found last
     size_t nFndPos;
@@ -80,9 +83,7 @@ class SwXCell final : public SwXCellBaseClass,
 
     virtual ~SwXCell() override;
 
-    //SwClient
-    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
-    virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
+    virtual void Notify(const SfxHint&) override;
 
 public:
     SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, size_t nPos);
@@ -142,7 +143,7 @@ public:
     SwTableBox* GetTableBox() const { return pBox; }
     static SwXCell* CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr );
     SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox);
-    SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
+    SwFrameFormat* GetFrameFormat() const { return m_pTableFormat; }
     double GetForcedNumericalValue() const;
     css::uno::Any GetAny() const;
 };
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 0d99f14f1b26..268b2f542622 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -757,22 +757,24 @@ void sw_setValue( SwXCell &rCell, double nVal )
 
 SwXCell::SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBx, size_t const nPos) :
     SwXText(pTableFormat->GetDoc(), CursorType::TableText),
-    SwClient(pTableFormat),
     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
     pBox(pBx),
     pStartNode(nullptr),
+    m_pTableFormat(pTableFormat),
     nFndPos(nPos)
 {
+    StartListening(pTableFormat->GetNotifier());
 }
 
 SwXCell::SwXCell(SwFrameFormat* pTableFormat, const SwStartNode& rStartNode) :
     SwXText(pTableFormat->GetDoc(), CursorType::TableText),
-    SwClient(pTableFormat),
     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
     pBox(nullptr),
     pStartNode(&rStartNode),
+    m_pTableFormat(pTableFormat),
     nFndPos(NOTFOUND)
 {
+    StartListening(pTableFormat->GetNotifier());
 }
 
 SwXCell::~SwXCell()
@@ -1172,20 +1174,17 @@ sal_Bool SwXCell::hasElements()
     return true;
 }
 
-void SwXCell::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
+void SwXCell::Notify(const SfxHint& rHint)
 {
-    ClientModify(this, pOld, pNew);
-}
-
-void SwXCell::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
-{
-    if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableBox, SwXCell>*>(&rHint))
+    if(rHint.GetId() == SfxHintId::Dying)
+    {
+        m_pTableFormat = nullptr;
+    }
+    else if(auto pFindHint = dynamic_cast<const FindUnoInstanceHint<SwTableBox, SwXCell>*>(&rHint))
     {
         if(!pFindHint->m_pResult && pFindHint->m_pCore == GetTableBox())
             pFindHint->m_pResult = this;
     }
-    else
-        SwClient::SwClientNotify(rModify, rHint);
 }
 
 SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable )
@@ -1199,7 +1198,7 @@ SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwT
         return nullptr;
     size_t const nPos = it - pTable->GetTabSortBoxes().begin();
     FindUnoInstanceHint<SwTableBox, SwXCell> aHint{pBox};
-    pTableFormat->CallSwClientNotify(aHint);
+    pTableFormat->GetNotifier().Broadcast(aHint);
     return aHint.m_pResult ? aHint.m_pResult : new SwXCell(pTableFormat, pBox, nPos);
 }
 


More information about the Libreoffice-commits mailing list