summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-05-27 21:45:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-05-28 18:01:46 +0200
commitaea4dd58521b5621463c653a47275808a315edd6 (patch)
treef111afbdf8f053b7a40b951e1d14c72409e139cf
parent57c7269fb48237573a0d2a0429dd6e82fe62fd71 (diff)
avoid dynamic_cast in SwXRedline
Change-Id: Id39e34c0f1b68639d3adf0092d753cb5dfb4cb0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svl/hint.hxx2
-rw-r--r--sw/inc/unoredline.hxx3
-rw-r--r--sw/source/core/unocore/unoredline.cxx5
3 files changed, 8 insertions, 2 deletions
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 98c37e4b7baa..31564677dd32 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -158,6 +158,7 @@ enum class SfxHintId {
SwVirtPageNumHint,
SwAutoFormatUsedHint,
SwFormatField,
+ SwFindRedline,
ThisIsAnSdrHint,
ThisIsAnSfxEventHint
@@ -248,6 +249,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
case SfxHintId::SwCollectTextMarks: return stream << "SwCollectTextMarks";
case SfxHintId::SwCollectTextTOXMarksForLayout: return stream << "SwCollectTextTOXMarksForLayout";
case SfxHintId::SwFormatField: return stream << "SwFormatField";
+ case SfxHintId::SwFindRedline: return stream << "SwFindRedline";
case SfxHintId::ThisIsAnSdrHint: return stream << "SdrHint";
default: return stream << "unk(" << std::to_string(int(id)) << ")";
}
diff --git a/sw/inc/unoredline.hxx b/sw/inc/unoredline.hxx
index b0c2dc41cfab..90f9d212a168 100644
--- a/sw/inc/unoredline.hxx
+++ b/sw/inc/unoredline.hxx
@@ -114,7 +114,8 @@ namespace sw
{
const SwRangeRedline& m_rRedline;
SwXRedline** m_ppXRedline;
- FindRedlineHint(const SwRangeRedline& rRedline, SwXRedline** ppXRedline) : m_rRedline(rRedline), m_ppXRedline(ppXRedline) {}
+ FindRedlineHint(const SwRangeRedline& rRedline, SwXRedline** ppXRedline)
+ : SfxHint(SfxHintId::SwFindRedline), m_rRedline(rRedline), m_ppXRedline(ppXRedline) {}
};
}
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index b97cc20028b2..414bebbc1056 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -490,7 +490,10 @@ void SwXRedline::Notify( const SfxHint& rHint )
{
m_pDoc = nullptr;
m_pRedline = nullptr;
- } else if(auto pHint = dynamic_cast<const sw::FindRedlineHint*>(&rHint)) {
+ }
+ else if(rHint.GetId() == SfxHintId::SwFindRedline)
+ {
+ auto pHint = static_cast<const sw::FindRedlineHint*>(&rHint);
if(!*pHint->m_ppXRedline && &pHint->m_rRedline == GetRedline())
*pHint->m_ppXRedline = this;
}