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

Bjoern Michaelsen (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 30 18:47:24 UTC 2020


 sw/inc/tox.hxx                     |    3 +--
 sw/source/core/doc/doctxm.cxx      |   15 ---------------
 sw/source/core/inc/doctxm.hxx      |    6 ++++++
 sw/source/uibase/utlui/content.cxx |    3 +--
 4 files changed, 8 insertions(+), 19 deletions(-)

New commits:
commit 907b60b37f089e952ae2e80499c7b168296469a4
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Sun Jun 28 22:40:35 2020 +0200
Commit:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Tue Jun 30 20:46:41 2020 +0200

    dont (ab-)use typeless GetInfo() interface
    
    Change-Id: I73ab1e0efcb3559dfe37f3f408b3ec4862a408e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97472
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 7787d432d01b..67dc6bae169b 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -427,8 +427,6 @@ public:
     SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = nullptr );
     virtual ~SwTOXBase() override;
 
-    virtual bool GetInfo( SfxPoolItem& rInfo ) const override;
-
     // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
     // If not, so create it and copy all other used things.
     void                CopyTOXBase( SwDoc*, const SwTOXBase& );
@@ -525,6 +523,7 @@ public:
 
     SwTOXBase& operator=(const SwTOXBase& rSource);
     void RegisterToTOXType( SwTOXType& rMark );
+    virtual bool IsVisible() const { return true; }
 };
 
 //SwTOXMark
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 96c8f3d4bf7d..be5f84233f6f 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -2056,19 +2056,4 @@ void SwTOXBase::SetAttrSet( const SfxItemSet& rSet )
         pSect->GetFormat()->SetFormatAttr( rSet );
 }
 
-bool SwTOXBase::GetInfo( SfxPoolItem& rInfo ) const
-{
-    switch( rInfo.Which() )
-    {
-    case RES_CONTENT_VISIBLE:
-        {
-            const SwTOXBaseSection *pSect = dynamic_cast<const SwTOXBaseSection*>(this);
-            if( pSect && pSect->GetFormat() )
-                pSect->GetFormat()->GetInfo( rInfo );
-        }
-        return false;
-    }
-    return true;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx
index 5c005b37f119..53a649cdd12e 100644
--- a/sw/source/core/inc/doctxm.hxx
+++ b/sw/source/core/inc/doctxm.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_DOCTXM_HXX
 
 #include <tools/gen.hxx>
+#include <hints.hxx>
 #include <tox.hxx>
 #include <section.hxx>
 
@@ -85,6 +86,11 @@ public:
     void UpdatePageNum();               // insert page numbering
 
     bool SetPosAtStartEnd( SwPosition& rPos ) const;
+    bool IsVisible() const override
+    {
+        SwPtrMsgPoolItem aInfo(RES_CONTENT_VISIBLE, nullptr);
+        return GetFormat() && GetFormat()->GetInfo(aInfo);
+    }
 };
 
 struct SwDefTOXBase_Impl
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 3e1f7bab5d39..fd71114b8a40 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -730,8 +730,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
                 SwContent* pCnt = new SwTOXBaseContent(
                         this, sTOXNm, nTox, *pBase);
 
-                if( !pBase->GetInfo( aAskItem ) &&
-                    !aAskItem.pObject )     // not visible
+                if(pBase && !pBase->IsVisible())
                     pCnt->SetInvisible();
 
                 m_pMember->insert( std::unique_ptr<SwContent>(pCnt) );


More information about the Libreoffice-commits mailing list