tdf#158556 avoid dynamic_cast
reduces load time by 2% Change-Id: I8b31257baacd49657cccf7cc6bd04408581803c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172102 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -71,6 +71,8 @@ public:
|
||||
|
||||
/// Used to avoid cost of dynamic_cast in SdrViewIter::ImpFindView
|
||||
virtual bool IsSdrView() const { return false; }
|
||||
/// Used to avoid cost of dynamic_cast in SwXStyleFamily::FindStyle
|
||||
virtual bool IsSwXStyle() const { return false; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -171,6 +171,9 @@ public:
|
||||
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
|
||||
//SvtListener
|
||||
virtual void Notify(const SfxHint&) override;
|
||||
//SfxListener
|
||||
/// Used to avoid cost of dynamic_cast in SwXStyleFamily::FindStyle
|
||||
virtual bool IsSwXStyle() const override final { return true; }
|
||||
|
||||
SW_DLLPUBLIC rtl::Reference<SwXNumberingRules> getNumberingRules();
|
||||
|
||||
|
||||
@@ -1190,7 +1190,9 @@ SwXStyle* SwXStyleFamily::FindStyle(std::u16string_view rStyleName) const
|
||||
m_pBasePool->ForAllListeners(
|
||||
[this, &pFoundStyle, &rStyleName] (SfxListener* pListener)
|
||||
{
|
||||
SwXStyle* pTempStyle = dynamic_cast<SwXStyle*>(pListener);
|
||||
if (!pListener->IsSwXStyle())
|
||||
return false;
|
||||
SwXStyle* pTempStyle = static_cast<SwXStyle*>(pListener);
|
||||
if(pTempStyle && pTempStyle->GetFamily() == m_rEntry.family() && pTempStyle->GetStyleName() == rStyleName)
|
||||
{
|
||||
pFoundStyle = pTempStyle;
|
||||
|
||||
Reference in New Issue
Block a user