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@libreoffice.org>
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 7787d43..67dc6bae 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -427,8 +427,6 @@
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 @@
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 96c8f3d..be5f842 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -2056,19 +2056,4 @@
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 5c005b3..53a649c 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 @@
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 3e1f7bab..fd71114 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -730,8 +730,7 @@
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) );