use less dynamic_cast when broadcasting BulkDataHint

we never read the hint id that we pass in to the constructor, so drop it

Change-Id: I8ec377e51bddbc2a12a2fd226fc1a915afef59e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172862
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2024-09-04 20:03:40 +02:00
parent 7ff601feca
commit b1309730b8
5 changed files with 9 additions and 9 deletions
+1
View File
@@ -129,6 +129,7 @@ enum class SfxHintId {
ScTables,
ScEditView,
ScUnoRefUndo,
ScBulkData,
// SC accessibility hints
ScAccTableChanged,
+2 -2
View File
@@ -23,8 +23,8 @@ class BulkDataHint final : public SfxHint
const ColumnSpanSet* mpSpans;
public:
BulkDataHint(ScDocument& rDoc, SfxHintId nHintId)
: SfxHint(nHintId)
BulkDataHint(ScDocument& rDoc)
: SfxHint(SfxHintId::ScBulkData)
, mrDoc(rDoc)
, mpSpans(nullptr)
{
+3 -3
View File
@@ -1145,7 +1145,7 @@ void ScBroadcastAreaSlotMachine::LeaveBulkBroadcast( SfxHintId nHintId )
if (--nInBulkBroadcast == 0)
{
ScBroadcastAreasBulk().swap( aBulkBroadcastAreas);
bool bBroadcasted = BulkBroadcastGroupAreas( nHintId );
bool bBroadcasted = BulkBroadcastGroupAreas();
// Trigger the "final" tracking.
if (pDoc->IsTrackFormulasPending())
pDoc->FinalTrackFormulas( nHintId );
@@ -1172,12 +1172,12 @@ void ScBroadcastAreaSlotMachine::InsertBulkGroupArea( ScBroadcastArea* pArea, co
rSet.set(*pDoc, rRange, true);
}
bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas( SfxHintId nHintId )
bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas()
{
if (m_BulkGroupAreas.empty())
return false;
sc::BulkDataHint aHint( *pDoc, nHintId);
sc::BulkDataHint aHint( *pDoc );
bool bBroadcasted = false;
for (const auto& [pArea, rSpans] : m_BulkGroupAreas)
+1 -1
View File
@@ -348,7 +348,7 @@ public:
void InsertBulkGroupArea( ScBroadcastArea* pArea, const ScRange& rRange );
void RemoveBulkGroupArea( ScBroadcastArea* pArea );
bool BulkBroadcastGroupAreas( SfxHintId nHintId );
bool BulkBroadcastGroupAreas();
/// @return: how many removed
size_t RemoveBulkArea( const ScBroadcastArea* p );
+2 -3
View File
@@ -117,10 +117,9 @@ ScRange FormulaGroupAreaListener::getListeningRange() const
void FormulaGroupAreaListener::Notify( const SfxHint& rHint )
{
// BulkDataHint may include (SfxHintId::ScDataChanged |
// SfxHintId::ScTableOpDirty) so has to be checked first.
if ( const BulkDataHint* pBulkHint = dynamic_cast<const BulkDataHint*>(&rHint) )
if ( rHint.GetId() == SfxHintId::ScBulkData )
{
const BulkDataHint* pBulkHint = static_cast<const BulkDataHint*>(&rHint);
notifyBulkChange(*pBulkHint);
}
else if (rHint.GetId() == SfxHintId::ScDataChanged || rHint.GetId() == SfxHintId::ScTableOpDirty)