diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2023-02-11 12:24:38 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-02-15 10:47:09 +0000 |
commit | 0723238a88ae16af061f0a050b704d2299a28a9a (patch) | |
tree | 057c4675d9690153f567be7c82b583b1d8bef69a | |
parent | ef0d23e6b7a8330e070c93a59c33b0ce4a8896d5 (diff) |
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.stahl@allotropia.de>
-rw-r--r-- | include/svl/hint.hxx | 3 | ||||
-rw-r--r-- | sw/inc/hintids.hxx | 2 | ||||
-rw-r--r-- | sw/inc/hints.hxx | 14 | ||||
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 19 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 6 |
5 files changed, 24 insertions, 20 deletions
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()); } } } |