include/svl/hint.hxx             |    3 +++
 sw/inc/hintids.hxx               |    2 --
 sw/inc/hints.hxx                 |   14 ++++++++++++++
 sw/source/core/doc/notxtfrm.cxx  |   19 +++++--------------
 sw/source/core/graphic/ndgrf.cxx |    6 ++----
 5 files changed, 24 insertions(+), 20 deletions(-)

New commits:
commit 0723238a88ae16af061f0a050b704d2299a28a9a
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Sat Feb 11 12:24:38 2023 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Feb 15 10:47:09 2023 +0000

    replace RES_GRAPHIC_PIECE_ARRIVED and RES_LINKED_GRAPHIC_STREAM_ARRIVED
    
    - also use SfxHintIds and get rid of some dynamic_casts
    
    Change-Id: Id12d72fb726c1d747008f72defd6ba9eba3ba253
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146820
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index e0807ca89cae..c3d0336ac790 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -117,6 +117,9 @@ enum class SfxHintId {
     SwSectionFrameMoveAndDelete,
     SwNavigatorUpdateTracking,
     SwNavigatorSelectOutlinesWithSelections,
+    SwPreGraphicArrived,
+    SwGraphicPieceArrived,
+    SwLinkedGraphicStreamArrived,
     SwLegacyModify,
     SwCollectTextMarks,
     SwCollectTextTOXMarksForLayout,
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 8d0c14f23572..891815c3cd1a 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -429,7 +429,6 @@ constexpr TypedWhichId<SwTableFormulaUpdate> 
RES_TABLEFML_UPDATE(170);
 constexpr TypedWhichId<SwMsgPoolItem> RES_UPDATEDDETBL(171);
 constexpr TypedWhichId<SwMsgPoolItem> RES_TBLHEADLINECHG(172);
 constexpr TypedWhichId<SwAutoFormatGetDocNode> RES_AUTOFMT_DOCNODE(173);
-constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_PIECE_ARRIVED(177);
 constexpr TypedWhichId<SwMsgPoolItem> RES_HIDDENPARA_PRINT(178);
 constexpr TypedWhichId<SwVirtPageNumInfo> RES_VIRTPAGENUM_INFO(180);
 constexpr TypedWhichId<SwPtrMsgPoolItem> RES_REMOVE_UNO_OBJECT(181);
@@ -438,7 +437,6 @@ constexpr TypedWhichId<SwFindNearestNode> 
RES_FINDNEARESTNODE(184);
 constexpr TypedWhichId<SwPtrMsgPoolItem> RES_CONTENT_VISIBLE(185);
 constexpr TypedWhichId<SwStringMsgPoolItem> RES_TITLE_CHANGED(188);
 constexpr TypedWhichId<SwStringMsgPoolItem> RES_DESCRIPTION_CHANGED(189);
-constexpr TypedWhichId<SwMsgPoolItem> RES_LINKED_GRAPHIC_STREAM_ARRIVED(189);
 constexpr sal_uInt16 RES_MSG_END(190);
 
 // An ID for the RTF-reader. The stylesheets are treated like attributes,
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 1148af5c1598..7c37af060f68 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -153,12 +153,26 @@ class GrfRereadAndInCacheHint final : public SfxHint
 
 class PreGraphicArrivedHint final : public SfxHint
 {
+public:
+    PreGraphicArrivedHint() : SfxHint(SfxHintId::SwPreGraphicArrived) {}
 };
 
 class PostGraphicArrivedHint final : public SfxHint
 {
 };
 
+class GraphicPieceArrivedHint final : public SfxHint
+{
+public:
+    GraphicPieceArrivedHint() : SfxHint(SfxHintId::SwGraphicPieceArrived) {}
+};
+
+class LinkedGraphicStreamArrivedHint final : public SfxHint
+{
+public:
+    LinkedGraphicStreamArrivedHint() : 
SfxHint(SfxHintId::SwLinkedGraphicStreamArrived) {}
+};
+
 class MoveTableLineHint final : public SfxHint
 {
 public:
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 640d8dce0fe3..eb0b4d96102a 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -739,33 +739,24 @@ void SwNoTextFrame::SwClientNotify(const SwModify& 
rModify, const SfxHint& rHint
         }
         return;
     }
-    if(dynamic_cast<const sw::PreGraphicArrivedHint*>(&rHint))
+    if(rHint.GetId() == SfxHintId::SwPreGraphicArrived
+            || rHint.GetId() == SfxHintId::SwGraphicPieceArrived
+            || rHint.GetId() == SfxHintId::SwLinkedGraphicStreamArrived)
     {
         OnGraphicArrived();
         return;
     }
-    if (rHint.GetId() != SfxHintId::SwLegacyModify)
+    else if (rHint.GetId() != SfxHintId::SwLegacyModify)
         return;
     auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
     sal_uInt16 nWhich = pLegacy->GetWhich();
 
-    // #i73788#
-    // no <SwContentFrame::Modify(..)> for RES_LINKED_GRAPHIC_STREAM_ARRIVED
-    if ( RES_GRAPHIC_PIECE_ARRIVED != nWhich &&
-         RES_LINKED_GRAPHIC_STREAM_ARRIVED != nWhich )
-    {
-        SwContentFrame::SwClientNotify(rModify, rHint);
-    }
+    SwContentFrame::SwClientNotify(rModify, rHint);
 
     bool bComplete = true;
 
     switch( nWhich )
     {
-    case RES_GRAPHIC_PIECE_ARRIVED:
-    case RES_LINKED_GRAPHIC_STREAM_ARRIVED:
-        OnGraphicArrived();
-        return;
-
     case RES_OBJECTDYING:
         break;
 
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 1d13b7a7a917..e96c7557ba69 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -470,8 +470,7 @@ bool SwGrfNode::SwapIn(bool bWaitForData)
 
                 maGrfObj.SetGraphic( Graphic() );
                 onGraphicChanged();
-                SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
-                CallSwClientNotify(sw::LegacyModifyHint(&aMsgHint, &aMsgHint));
+                CallSwClientNotify(sw::GraphicPieceArrivedHint());
             }
         }
         else
@@ -861,8 +860,7 @@ void SwGrfNode::ApplyInputStream(
             mxInputStream = xInputStream;
             mbIsStreamReadOnly = bIsStreamReadOnly;
             mbLinkedInputStreamReady = true;
-            SwMsgPoolItem aMsgHint( RES_LINKED_GRAPHIC_STREAM_ARRIVED );
-            CallSwClientNotify(sw::LegacyModifyHint(&aMsgHint, &aMsgHint));
+            CallSwClientNotify(sw::LinkedGraphicStreamArrivedHint());
         }
     }
 }

Reply via email to