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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Mar 16 12:51:28 UTC 2019


 sw/inc/unoredline.hxx             |    2 +-
 sw/inc/unotbl.hxx                 |   28 ++++++++++++++--------------
 sw/source/core/unocore/unotbl.cxx |   23 ++++++++++++++---------
 3 files changed, 29 insertions(+), 24 deletions(-)

New commits:
commit 65fde448d391195e5fcf942f8dd541ab6023ff9a
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Wed Feb 27 20:55:26 2019 +0100
Commit:     Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Sat Mar 16 13:51:20 2019 +0100

    UNO SwXTableTextCursor: uso SvtListener instead of SwClient
    
    Change-Id: Ie026909a1822c0e928f022e61b14e785224f5d17
    Reviewed-on: https://gerrit.libreoffice.org/68472
    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 d96a969f333e..f3061f309faf 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -184,20 +184,20 @@ public:
 };
 
 typedef cppu::WeakImplHelper<
-                                css::text::XTextTableCursor,
-                                css::lang::XServiceInfo,
-                                css::beans::XPropertySet
-                            > SwXTextTableCursor_Base;
-class SW_DLLPUBLIC SwXTextTableCursor : public SwXTextTableCursor_Base
-    ,public SwClient
-    ,public OTextCursorHelper
+    css::text::XTextTableCursor,
+    css::lang::XServiceInfo,
+    css::beans::XPropertySet> SwXTextTableCursor_Base;
+class SW_DLLPUBLIC SwXTextTableCursor
+    : public SwXTextTableCursor_Base
+    , public SvtListener
+    , public OTextCursorHelper
 {
-    const SfxItemPropertySet*   m_pPropSet;
+    SwFrameFormat* m_pFrameFormat;
+    const SfxItemPropertySet* m_pPropSet;
 
 public:
-    SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const * pBox);
-    SwXTextTableCursor(SwFrameFormat& rTableFormat,
-                        const SwTableCursor* pTableSelection);
+    SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const* pBox);
+    SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection);
     DECLARE_XINTERFACE()
 
     //XTextTableCursor
@@ -226,8 +226,6 @@ public:
     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
-    //SwClient
-    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
 
     // ITextCursorHelper
     virtual const SwPaM*        GetPaM() const override;
@@ -235,10 +233,12 @@ public:
     virtual const SwDoc*        GetDoc() const override;
     virtual SwDoc*              GetDoc() override;
 
+    virtual void Notify( const SfxHint& ) override;
+
     const SwUnoCursor&            GetCursor() const;
     SwUnoCursor&                  GetCursor();
     sw::UnoCursorPointer m_pUnoCursor;
-    SwFrameFormat*       GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
+    SwFrameFormat* GetFrameFormat() const { return m_pFrameFormat; }
 };
 
 struct SwRangeDescriptor
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 2db210758520..8badc4d54978 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1479,11 +1479,12 @@ SwUnoCursor&          SwXTextTableCursor::GetCursor()       { return *m_pUnoCurs
 uno::Sequence<OUString> SwXTextTableCursor::getSupportedServiceNames()
     { return {"com.sun.star.text.TextTableCursor"}; }
 
-SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const * pBox) :
-    SwClient(pFormat),
-    m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
+SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFrameFormat, SwTableBox const* pBox)
+    : m_pFrameFormat(pFrameFormat)
+    , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
 {
-    SwDoc* pDoc = pFormat->GetDoc();
+    StartListening(m_pFrameFormat->GetNotifier());
+    SwDoc* pDoc = m_pFrameFormat->GetDoc();
     const SwStartNode* pSttNd = pBox->GetSttNd();
     SwPosition aPos(*pSttNd);
     m_pUnoCursor = pDoc->CreateUnoCursor(aPos, true);
@@ -1492,10 +1493,11 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const
     rTableCursor.MakeBoxSels();
 }
 
-SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection) :
-    SwClient(&rTableFormat),
-    m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
+SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection)
+    : m_pFrameFormat(&rTableFormat)
+    , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
 {
+    StartListening(m_pFrameFormat->GetNotifier());
     m_pUnoCursor = pTableSelection->GetDoc()->CreateUnoCursor(*pTableSelection->GetPoint(), true);
     if(pTableSelection->HasMark())
     {
@@ -1768,8 +1770,11 @@ void SwXTextTableCursor::addVetoableChangeListener(const OUString& /*rPropertyNa
 void SwXTextTableCursor::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
     { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
 
-void SwXTextTableCursor::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
-    { ClientModify(this, pOld, pNew); }
+void SwXTextTableCursor::Notify( const SfxHint& rHint )
+{
+    if(rHint.GetId() == SfxHintId::Dying)
+        m_pFrameFormat = nullptr;
+}
 
 
 // SwXTextTable ===========================================================
commit 368059f7f6abd6eed2a5a1bd142d406f14cf9ecb
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Wed Feb 27 20:52:14 2019 +0100
Commit:     Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Sat Mar 16 13:51:07 2019 +0100

    make SwXRedline final
    
    Change-Id: Iad53e3dea745cf2d473b8218775816dfb042fcec
    Reviewed-on: https://gerrit.libreoffice.org/68471
    Tested-by: Jenkins
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/inc/unoredline.hxx b/sw/inc/unoredline.hxx
index ac2b658b5a8f..80a3db1b3c69 100644
--- a/sw/inc/unoredline.hxx
+++ b/sw/inc/unoredline.hxx
@@ -62,7 +62,7 @@ public:
 
 typedef cppu::WeakImplHelper<css::container::XEnumerationAccess> SwXRedlineBaseClass;
 
-class SwXRedline
+class SwXRedline final
     : public SwXRedlineBaseClass
     , public SwXText
     , public SvtListener


More information about the Libreoffice-commits mailing list