avoid some dynamic_cast in SwTextFrame
Change-Id: Ib73063871472727f27b552b1074d9d3872269b44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168231 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
50a27ef3fb
commit
91dbd5ca9f
@@ -163,6 +163,9 @@ enum class SfxHintId {
|
||||
SwModifyChanged,
|
||||
SwAttr,
|
||||
SwDocumentDying,
|
||||
SwRedlineDelText,
|
||||
SwRedlineUnDelText,
|
||||
SwMoveText,
|
||||
|
||||
ThisIsAnSdrHint,
|
||||
ThisIsAnSfxEventHint
|
||||
@@ -257,6 +260,9 @@ inline std::basic_ostream<charT, traits> & operator <<(
|
||||
case SfxHintId::SwModifyChanged: return stream << "SwModifyChanged";
|
||||
case SfxHintId::SwAttr: return stream << "SwAttr";
|
||||
case SfxHintId::SwDocumentDying: return stream << "SwDocumentDying";
|
||||
case SfxHintId::SwRedlineDelText: return stream << "SwRedlineDelText";
|
||||
case SfxHintId::SwRedlineUnDelText: return stream << "SwRedlineUnDelText";
|
||||
case SfxHintId::SwMoveText: return stream << "SwMoveText";
|
||||
case SfxHintId::ThisIsAnSdrHint: return stream << "SdrHint";
|
||||
default: return stream << "unk(" << std::to_string(int(id)) << ")";
|
||||
}
|
||||
|
||||
+4
-3
@@ -92,7 +92,8 @@ public:
|
||||
sal_Int32 nSourceStart;
|
||||
sal_Int32 nLen;
|
||||
|
||||
MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL);
|
||||
MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL)
|
||||
: SfxHint(SfxHintId::SwMoveText), pDestNode(pD), nDestStart(nD), nSourceStart(nS), nLen(nL) {}
|
||||
};
|
||||
|
||||
class InsertText final : public SfxHint
|
||||
@@ -130,7 +131,7 @@ public:
|
||||
sal_Int32 nStart;
|
||||
sal_Int32 nLen;
|
||||
|
||||
RedlineDelText(sal_Int32 nS, sal_Int32 nL);
|
||||
RedlineDelText(sal_Int32 nS, sal_Int32 nL) : SfxHint(SfxHintId::SwRedlineDelText), nStart(nS), nLen(nL) {}
|
||||
};
|
||||
|
||||
/// delete redline is removed
|
||||
@@ -140,7 +141,7 @@ public:
|
||||
sal_Int32 nStart;
|
||||
sal_Int32 nLen;
|
||||
|
||||
RedlineUnDelText(sal_Int32 nS, sal_Int32 nL);
|
||||
RedlineUnDelText(sal_Int32 nS, sal_Int32 nL) : SfxHint(SfxHintId::SwRedlineUnDelText), nStart(nS), nLen(nL) {}
|
||||
};
|
||||
|
||||
/** DocPosUpdate is sent to signal that only the frames from or to a specified document-global position
|
||||
|
||||
@@ -37,11 +37,6 @@ SwFormatChg::SwFormatChg( SwFormat* pFormat )
|
||||
|
||||
namespace sw {
|
||||
|
||||
MoveText::MoveText(SwTextNode *const pD, sal_Int32 const nD, sal_Int32 const nS, sal_Int32 const nL)
|
||||
: pDestNode(pD), nDestStart(nD), nSourceStart(nS), nLen(nL)
|
||||
{
|
||||
}
|
||||
|
||||
InsertText::InsertText(const sal_Int32 nP, const sal_Int32 nL, const bool isInFMCommand, const bool isInFMResult)
|
||||
: SfxHint( SfxHintId::SwInsertText )
|
||||
, nPos( nP ), nLen( nL )
|
||||
@@ -60,16 +55,6 @@ DeleteChar::DeleteChar( const sal_Int32 nPos )
|
||||
{
|
||||
}
|
||||
|
||||
RedlineDelText::RedlineDelText(sal_Int32 const nS, sal_Int32 const nL)
|
||||
: nStart(nS), nLen(nL)
|
||||
{
|
||||
}
|
||||
|
||||
RedlineUnDelText::RedlineUnDelText(sal_Int32 const nS, sal_Int32 const nL)
|
||||
: nStart(nS), nLen(nL)
|
||||
{
|
||||
}
|
||||
|
||||
VirtPageNumHint::VirtPageNumHint(const SwPageFrame* pPg):
|
||||
SfxHint(SfxHintId::SwVirtPageNumHint),
|
||||
m_pPage(nullptr),
|
||||
|
||||
@@ -2159,17 +2159,17 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
|
||||
pPage->UpdateVirtPageNumInfo(rVirtPageNumHint, this);
|
||||
return;
|
||||
}
|
||||
else if (auto const pHt = dynamic_cast<sw::MoveText const*>(&rHint))
|
||||
else if (rHint.GetId() == SfxHintId::SwMoveText)
|
||||
{
|
||||
pMoveText = pHt;
|
||||
pMoveText = static_cast<sw::MoveText const*>(&rHint);
|
||||
}
|
||||
else if (auto const pHynt = dynamic_cast<sw::RedlineDelText const*>(&rHint))
|
||||
else if (rHint.GetId() == SfxHintId::SwRedlineDelText)
|
||||
{
|
||||
pRedlineDelText = pHynt;
|
||||
pRedlineDelText = static_cast<sw::RedlineDelText const*>(&rHint);
|
||||
}
|
||||
else if (auto const pHnt = dynamic_cast<sw::RedlineUnDelText const*>(&rHint))
|
||||
else if (rHint.GetId() == SfxHintId::SwRedlineUnDelText)
|
||||
{
|
||||
pRedlineUnDelText = pHnt;
|
||||
pRedlineUnDelText = static_cast<sw::RedlineUnDelText const*>(&rHint);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user