[Libreoffice-commits] core.git: include/svl sw/inc sw/source
include/svl/hint.hxx|1 sw/inc/fchrfmt.hxx |2 - sw/inc/fmtfld.hxx |2 - sw/inc/format.hxx |1 sw/inc/hintids.hxx |2 - sw/inc/hints.hxx| 17 + sw/inc/txtatr.hxx |4 +- sw/inc/txtinet.hxx |2 - sw/source/core/attr/format.cxx | 13 ++- sw/source/core/attr/hints.cxx | 10 ++--- sw/source/core/doc/DocumentStylePoolManager.cxx | 28 +++- sw/source/core/doc/docfmt.cxx | 35 +--- sw/source/core/doc/fmtcol.cxx |5 ++ sw/source/core/doc/poolfmt.cxx |8 ++-- sw/source/core/docnode/node.cxx | 11 ++ sw/source/core/fields/ddetbl.cxx|2 - sw/source/core/fields/docufld.cxx |5 +- sw/source/core/inc/flyfrm.hxx |3 - sw/source/core/inc/pagefrm.hxx |3 - sw/source/core/layout/atrfrm.cxx|9 - sw/source/core/layout/fly.cxx | 14 +++- sw/source/core/layout/flyincnt.cxx |6 +++ sw/source/core/layout/flylay.cxx|6 +++ sw/source/core/layout/pagechg.cxx | 17 +++-- sw/source/core/layout/pagedesc.cxx |7 sw/source/core/table/swtable.cxx| 10 ++--- sw/source/core/txtnode/atrfld.cxx | 16 +++-- sw/source/core/txtnode/fmtatr2.cxx | 11 +++--- sw/source/core/txtnode/ndtxt.cxx|7 +++- sw/source/core/txtnode/txtatr2.cxx | 42 +++- sw/source/core/unocore/unocoll.cxx | 22 +--- sw/source/core/unocore/unostyle.cxx |7 +--- sw/source/uibase/utlui/content.cxx |6 +-- 33 files changed, 173 insertions(+), 161 deletions(-) New commits: commit 140079362502408c75ceee67e86d779f61c0ac1b Author: Bjoern Michaelsen AuthorDate: Wed Aug 9 11:34:00 2023 +0200 Commit: Bjoern Michaelsen CommitDate: Fri Sep 1 00:05:28 2023 +0200 remove AUTOFMT_DOCNODE - remove obsolete GetInfo()s - introduce SwFormat::IsUsed() - move handling from GetInfo to SwClientNotify - make sure SwAutoFormatUsedHint is forwarded to clients where needed (e.g. SwTextFormatColl, SwDDETable, SwPageDesc, ...) Change-Id: I07d9e94ee791ca6e738b4eb3e597055ad8fbe755 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155504 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index ba230f92b817..91533d4ffdbb 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -153,6 +153,7 @@ enum class SfxHintId { SwDocPosUpdateAtIndex, SwTableHeadingChange, SwVirtPageNumHint, +SwAutoFormatUsedHint, ThisIsAnSdrHint }; diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx index 87508596013b..2b5aec14278e 100644 --- a/sw/inc/fchrfmt.hxx +++ b/sw/inc/fchrfmt.hxx @@ -60,8 +60,6 @@ public: virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; -virtual boolGetInfo( SfxPoolItem& rInfo ) const override; - void SetCharFormat( SwFormat* pFormat ) { assert(!pFormat->IsDefault()); // expose cases that lead to use-after-free diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 4c4c1ea91293..ba23014a1f82 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -124,8 +124,6 @@ public: virtual booloperator==( const SfxPoolItem& ) const override; virtual SwFormatField* Clone( SfxItemPool* pPool = nullptr ) const override; -virtual bool GetInfo( SfxPoolItem& rInfo ) const override; - void InvalidateField(); const SwField* GetField() const diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index 9313b863dfbb..f420afcf512e 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -280,6 +280,7 @@ public: virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; virtual bool supportsFullDrawingLayerFillAttributeSet() const; void RemoveAllUnos(); +bool IsUsed() const; }; #endif // INCLUDED_SW_INC_FORMAT_HXX diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 339a73068162..feb6299ee001 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -140,7 +140,6 @@ class SwTextGridItem; class SwTransparencyGrf; class SwFormatRuby; class SwTableFormulaUpdate; -class SwAutoFormatGetDocNode; class VirtPageNumHint; class SwFindNearestNode; class SwFltAnchor; @@ -431,7 +430,6 @@ constexpr TypedWhichId
[Libreoffice-commits] core.git: include/svl sw/inc sw/source
include/svl/hint.hxx |1 sw/inc/hintids.hxx |1 sw/inc/hints.hxx |5 + sw/source/core/docnode/ndtbl.cxx |3 sw/source/core/inc/tabfrm.hxx|2 sw/source/core/layout/tabfrm.cxx | 119 --- 6 files changed, 72 insertions(+), 59 deletions(-) New commits: commit 116a646a9f36ff07393186d5a001628023c6ded6 Author: Bjoern Michaelsen AuthorDate: Sat Apr 1 23:25:57 2023 +0200 Commit: Michael Stahl CommitDate: Tue Apr 4 11:27:22 2023 +0200 RES_TBLHEADINGCHG no more ... - replaced LegacyModifyHint by a proper SfxHint - Refactor SwTabFrame for table heading change: * split out Invalidate(SwTabFrameInvFlags) * split out HandleTableHeadlineChange() Change-Id: I374db7a3b16a3062d6ad54c32527ec1056cbc00b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149929 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index f06f4c6449e9..5967d834ceeb 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -151,6 +151,7 @@ enum class SfxHintId { SwDescriptionChanged, SwDocPosUpdate, SwDocPosUpdateAtIndex, +SwTableHeadingChange, ThisIsAnSdrHint }; diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 5e84921ec832..17c1fe545136 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -433,7 +433,6 @@ constexpr TypedWhichId RES_FMT_CHG(168); constexpr TypedWhichId RES_ATTRSET_CHG(169); constexpr TypedWhichId RES_UPDATE_ATTR(170); constexpr TypedWhichId RES_REFMARKFLD_UPDATE(171); -constexpr TypedWhichId RES_TBLHEADLINECHG(175); constexpr TypedWhichId RES_AUTOFMT_DOCNODE(176); constexpr TypedWhichId RES_HIDDENPARA_PRINT(178); constexpr TypedWhichId RES_VIRTPAGENUM_INFO(180); diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index 6b993795c058..4cf9e2464c6d 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -256,6 +256,11 @@ public: const bool m_isHidden; SectionHidden(const bool isHidden = true) : SfxHint(SfxHintId::SwSectionHidden), m_isHidden(isHidden) {}; }; +class TableHeadingChange final: public SfxHint +{ +public: +TableHeadingChange() : SfxHint(SfxHintId::SwTableHeadingChange) {}; +}; } class SwUpdateAttr final : public SwMsgPoolItem diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 111daec55ef3..d076e616af5c 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2891,8 +2891,7 @@ void SwDoc::SetRowsToRepeat( SwTable , sal_uInt16 nSet ) } rTable.SetRowsToRepeat(nSet); -const SwMsgPoolItem aChg(RES_TBLHEADLINECHG); -rTable.GetFrameFormat()->CallSwClientNotify(sw::LegacyModifyHint(, )); +rTable.GetFrameFormat()->CallSwClientNotify(sw::TableHeadingChange()); getIDocumentState().SetModified(); } diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx index ca4af59b223c..4fa1c54d27d0 100644 --- a/sw/source/core/inc/tabfrm.hxx +++ b/sw/source/core/inc/tabfrm.hxx @@ -115,6 +115,8 @@ class SW_DLLPUBLIC SwTabFrame final: public SwLayoutFrame, public SwFlowFrame const SfxPoolItem*, SwTabFrameInvFlags &, SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr ); +void Invalidate(SwTabFrameInvFlags); +void HandleTableHeadlineChange(); virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool ) override; diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 9bb630f181a0..13c65b977bf5 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3377,10 +3377,51 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) return nDist; } +void SwTabFrame::Invalidate(SwTabFrameInvFlags eInvFlags) +{ +if(eInvFlags == SwTabFrameInvFlags::NONE) +return; +SwPageFrame* pPage = FindPageFrame(); +InvalidatePage(pPage); +if(eInvFlags & SwTabFrameInvFlags::InvalidatePrt) +InvalidatePrt_(); +if(eInvFlags & SwTabFrameInvFlags::InvalidatePos) +InvalidatePos_(); +SwFrame* pTmp = GetIndNext(); +if(nullptr != pTmp) +{ +if(eInvFlags & SwTabFrameInvFlags::InvalidateIndNextPrt) +{ +pTmp->InvalidatePrt_(); +if(pTmp->IsContentFrame()) +pTmp->InvalidatePage(pPage); +} +if(eInvFlags & SwTabFrameInvFlags::SetIndNextCompletePaint) +pTmp->SetCompletePaint(); +} +if(eInvFlags & SwTabFrameInvFlags::InvalidatePrevPrt && nullptr != (pTmp = GetPrev())) +{ +pTmp->InvalidatePrt_(); +if(pTmp->IsContentFrame()) +pTmp->InvalidatePage(pPage); +} +if(eInvFlags & SwTabFrameInvFlags::InvalidateBrowseWidth) +{ +if(pPage && pPage->GetUpper() && !IsFollow()) + static_cast(pPage->GetUpper())->InvalidateBrowseWidth(); +} +
[Libreoffice-commits] core.git: include/svl sw/inc sw/source
include/svl/hint.hxx |2 sw/inc/hintids.hxx |2 sw/inc/hints.hxx | 12 sw/source/core/access/accnotextframe.cxx | 66 -- sw/source/core/access/acctextframe.cxx | 90 --- sw/source/core/layout/atrfrm.cxx | 12 +--- 6 files changed, 81 insertions(+), 103 deletions(-) New commits: commit 9dd29fce292fbcfee9c5cc93d9b1de5b14aa85db Author: Bjoern Michaelsen AuthorDate: Wed Feb 15 23:19:51 2023 +0100 Commit: Michael Stahl CommitDate: Tue Feb 21 11:35:54 2023 + replace RES_TITLE_CHANGED and RES_DESCRIPTION_CHANGED with SfxHints Change-Id: I8342722dc4235508c86683fd292bd525247a9910 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147134 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index c3d0336ac790..b85e4f66d285 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -147,6 +147,8 @@ enum class SfxHintId { SwDeleteText, SwDeleteChar, SwSectionHidden, +SwTitleChanged, +SwDescriptionChanged, ThisIsAnSdrHint }; diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 1119ca70dc8e..05ee37676181 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -434,8 +434,6 @@ constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181); // empty constexpr TypedWhichId RES_FINDNEARESTNODE(184); constexpr TypedWhichId RES_CONTENT_VISIBLE(185); -constexpr TypedWhichId RES_TITLE_CHANGED(188); -constexpr TypedWhichId RES_DESCRIPTION_CHANGED(189); constexpr sal_uInt16 RES_FORMAT_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 ea856ae5cbaf..5530ce7922f3 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -214,6 +214,18 @@ public: const OUString m_sNew; NameChanged(const OUString& rOld, const OUString& rNew) : SfxHint(SfxHintId::NameChanged), m_sOld(rOld), m_sNew(rNew) {}; }; +class TitleChanged final : public SfxHint +{ +public: +const OUString m_sOld; +const OUString m_sNew; +TitleChanged(const OUString& rOld, const OUString& rNew) : SfxHint(SfxHintId::SwTitleChanged), m_sOld(rOld), m_sNew(rNew) {}; +}; +class DescriptionChanged final : public SfxHint +{ +public: +DescriptionChanged() : SfxHint(SfxHintId::SwDescriptionChanged) {} +}; class SectionHidden final: public SfxHint { public: diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx index 0f1454602031..d3f7c38bae77 100644 --- a/sw/source/core/access/accnotextframe.cxx +++ b/sw/source/core/access/accnotextframe.cxx @@ -83,33 +83,23 @@ SwAccessibleNoTextFrame::~SwAccessibleNoTextFrame() void SwAccessibleNoTextFrame::Notify(const SfxHint& rHint) { -if(rHint.GetId() == SfxHintId::Dying) -EndListeningAll(); -else if (rHint.GetId() == SfxHintId::SwLegacyModify) +const SwNoTextNode* pNd = GetNoTextNode(); +switch(rHint.GetId()) { -auto pLegacyModifyHint = static_cast(); -const sal_uInt16 nWhich = pLegacyModifyHint->GetWhich(); -if (nWhich != RES_TITLE_CHANGED && nWhich != RES_DESCRIPTION_CHANGED) +case SfxHintId::Dying: +EndListeningAll(); return; -const SwNoTextNode* pNd = GetNoTextNode(); -switch(nWhich) -{ -// #i73249# -case RES_TITLE_CHANGED: +default: +return; +case SfxHintId::SwTitleChanged: { -OUString sOldTitle, sNewTitle; -const SwStringMsgPoolItem* pOldItem = dynamic_cast(pLegacyModifyHint->m_pOld); -if(pOldItem) -sOldTitle = pOldItem->GetString(); -const SwStringMsgPoolItem* pNewItem = dynamic_cast(pLegacyModifyHint->m_pNew); -if(pNewItem) -sNewTitle = pNewItem->GetString(); -if(sOldTitle == sNewTitle) +auto rTitleChanged = static_cast(rHint); +if(rTitleChanged.m_sOld == rTitleChanged.m_sNew) break; -msTitle = sNewTitle; +msTitle = rTitleChanged.m_sNew; AccessibleEventObject aEvent; aEvent.EventId = AccessibleEventId::NAME_CHANGED; -aEvent.OldValue <<= sOldTitle; +aEvent.OldValue <<= rTitleChanged.m_sOld; aEvent.NewValue <<= msTitle; FireAccessibleEvent(aEvent); @@ -117,28 +107,22 @@ void SwAccessibleNoTextFrame::Notify(const SfxHint& rHint) break; [[fallthrough]]; } -case RES_DESCRIPTION_CHANGED: +case SfxHintId::SwDescriptionChanged: +if(pNd && GetFrame()) { -if(pNd && GetFrame()) -{ -
[Libreoffice-commits] core.git: include/svl sw/inc sw/source
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 AuthorDate: Sat Feb 11 12:24:38 2023 +0100 Commit: Michael Stahl CommitDate: Wed Feb 15 10:47:09 2023 + 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 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 RES_TABLEFML_UPDATE(170); constexpr TypedWhichId RES_UPDATEDDETBL(171); constexpr TypedWhichId RES_TBLHEADLINECHG(172); constexpr TypedWhichId RES_AUTOFMT_DOCNODE(173); -constexpr TypedWhichId RES_GRAPHIC_PIECE_ARRIVED(177); constexpr TypedWhichId RES_HIDDENPARA_PRINT(178); constexpr TypedWhichId RES_VIRTPAGENUM_INFO(180); constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181); @@ -438,7 +437,6 @@ constexpr TypedWhichId RES_FINDNEARESTNODE(184); constexpr TypedWhichId RES_CONTENT_VISIBLE(185); constexpr TypedWhichId RES_TITLE_CHANGED(188); constexpr TypedWhichId RES_DESCRIPTION_CHANGED(189); -constexpr TypedWhichId 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()) +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(); sal_uInt16 nWhich = pLegacy->GetWhich(); -// #i73788# -// no 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(, )); +CallSwClientNotify(sw::GraphicPieceArrivedHint());
[Libreoffice-commits] core.git: include/svl sw/inc sw/source
include/svl/hint.hxx |1 sw/inc/hintids.hxx |2 - sw/inc/hints.hxx |6 sw/source/core/docnode/section.cxx | 47 - 4 files changed, 28 insertions(+), 28 deletions(-) New commits: commit b89a5eef6daa23c27265f7451ec617dfedd2ce67 Author: Bjoern Michaelsen AuthorDate: Sun Sep 25 13:15:03 2022 +0200 Commit: Bjoern Michaelsen CommitDate: Mon Sep 26 09:30:22 2022 +0200 introduce sw::SectionHidden as plain SfxHint Change-Id: I7412c16d0ffd4cf38a1b4186f81703443cdf6fbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140576 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 22f0bb8eb7e2..e0807ca89cae 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -143,6 +143,7 @@ enum class SfxHintId { SwInsertText, SwDeleteText, SwDeleteChar, +SwSectionHidden, ThisIsAnSdrHint }; diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 497635f71f5b..22dba273ec1b 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -428,8 +428,6 @@ constexpr TypedWhichId RES_TABLEFML_UPDATE(170); constexpr TypedWhichId RES_UPDATEDDETBL(171); constexpr TypedWhichId RES_TBLHEADLINECHG(172); constexpr TypedWhichId RES_AUTOFMT_DOCNODE(173); -constexpr TypedWhichId RES_SECTION_HIDDEN(174); -constexpr TypedWhichId RES_SECTION_NOT_HIDDEN(175); constexpr TypedWhichId RES_GRAPHIC_PIECE_ARRIVED(177); constexpr TypedWhichId RES_HIDDENPARA_PRINT(178); constexpr TypedWhichId RES_VIRTPAGENUM_INFO(180); diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index 777825ae4969..1148af5c1598 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -200,6 +200,12 @@ public: const OUString m_sNew; NameChanged(const OUString& rOld, const OUString& rNew) : SfxHint(SfxHintId::NameChanged), m_sOld(rOld), m_sNew(rNew) {}; }; +class SectionHidden final: public SfxHint +{ +public: +const bool m_isHidden; +SectionHidden(const bool isHidden = true) : SfxHint(SfxHintId::SwSectionHidden), m_isHidden(isHidden) {}; +}; } class SwUpdateAttr final : public SwMsgPoolItem diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index a2f7d37ef581..975f72a9d607 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -289,8 +289,8 @@ void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition) // This should be shown by the bHiddenFlag. // Tell all Children that they are hidden -const SwMsgPoolItem aMsgItem( RES_SECTION_HIDDEN ); -pFormat->CallSwClientNotify(sw::LegacyModifyHint(, )); +const sw::SectionHidden aHint; +pFormat->CallSwClientNotify(aHint); // Delete all Frames pFormat->DelFrames(); @@ -304,8 +304,8 @@ void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition) if( !pParentSect || !pParentSect->IsHiddenFlag() ) { // Tell all Children that the Parent is not hidden anymore -const SwMsgPoolItem aMsgItem( RES_SECTION_NOT_HIDDEN ); -pFormat->CallSwClientNotify(sw::LegacyModifyHint(, )); +const sw::SectionHidden aHint(false); +pFormat->CallSwClientNotify(aHint); pFormat->MakeFrames(); } @@ -393,7 +393,12 @@ void SwSection::SwClientNotify(const SwModify&, const SfxHint& rHint) void SwSection::Notify(SfxHint const& rHint) { -if (rHint.GetId() != SfxHintId::SwLegacyModify) +if (rHint.GetId() == SfxHintId::SwSectionHidden) +{ +auto rSectionHidden = static_cast(rHint); +m_Data.SetHiddenFlag(rSectionHidden.m_isHidden || (m_Data.IsHidden() && m_Data.IsCondHidden())); +return; +} else if (rHint.GetId() != SfxHintId::SwLegacyModify) return; auto pLegacy = static_cast(); auto pOld = pLegacy->m_pOld; @@ -457,14 +462,6 @@ void SwSection::Notify(SfxHint const& rHint) } return; -case RES_SECTION_HIDDEN: -m_Data.SetHiddenFlag(true); -return; - -case RES_SECTION_NOT_HIDDEN: -m_Data.SetHiddenFlag( m_Data.IsHidden() && m_Data.IsCondHidden() ); -return; - case RES_COL: // Is handled by the Layout, if appropriate break; @@ -700,7 +697,15 @@ void SwSectionFormat::MakeFrames() void SwSectionFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) { -if (rHint.GetId() != SfxHintId::SwLegacyModify) +if (rHint.GetId() == SfxHintId::SwSectionHidden) +{ +auto rSectionHidden = static_cast(rHint); +auto pSect = GetSection(); +if(!pSect || rSectionHidden.m_isHidden == pSect->IsHiddenFlag()) // already at target state, skipping. +return; +GetNotifier().Broadcast(rSectionHidden); +return; +}
[Libreoffice-commits] core.git: include/svl sw/inc sw/source
include/svl/hint.hxx |1 sw/inc/hintids.hxx |1 sw/inc/hints.hxx |7 sw/source/core/access/accframebase.cxx | 36 +- sw/source/core/access/acctable.cxx | 54 ++--- sw/source/core/attr/format.cxx |4 -- sw/source/core/layout/atrfrm.cxx |5 +-- 7 files changed, 50 insertions(+), 58 deletions(-) New commits: commit f48cb25a914902d92bd109eff86ec3b6d26ba9c3 Author: Bjoern Michaelsen AuthorDate: Thu Sep 15 00:34:50 2022 +0200 Commit: Bjoern Michaelsen CommitDate: Sat Sep 24 15:09:41 2022 +0200 Replace RES_NAME_CHANGED with an SfxHint for stronger typing Change-Id: I0bbe9dc4e10491aafcc623c2add62a246ea67d80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139961 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 0009a2b3b080..a5cbc1913e2e 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -139,6 +139,7 @@ enum class SfxHintId { SwGatherNodeIndex, SwGatherRefFields, SwGatherFields, +SwNameChanged, // this can possibly be replaced by the generic NameChanged above ThisIsAnSdrHint }; diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 80aa40b9fd8a..b4fddf911179 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -443,7 +443,6 @@ constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181); // empty constexpr TypedWhichId RES_FINDNEARESTNODE(184); constexpr TypedWhichId RES_CONTENT_VISIBLE(185); -constexpr TypedWhichId RES_NAME_CHANGED(187); constexpr TypedWhichId RES_TITLE_CHANGED(188); constexpr TypedWhichId RES_DESCRIPTION_CHANGED(189); constexpr TypedWhichId RES_LINKED_GRAPHIC_STREAM_ARRIVED(189); diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index 9b4962246fa4..8c15ed64ced6 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -191,6 +191,13 @@ public: const SwTableBox& m_rTableBox; TableBoxFormatChanged(const SwTableBoxFormat& rNewFormat, const SwTableBox& rTableBox) : m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {}; }; +class NameChanged final : public SfxHint +{ +public: +const OUString m_sOld; +const OUString m_sNew; +NameChanged(const OUString& rOld, const OUString& rNew) : SfxHint(SfxHintId::NameChanged), m_sOld(rOld), m_sNew(rNew) {}; +}; } class SwUpdateAttr final : public SwMsgPoolItem diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx index e0821f3ded24..fc94259b5bfd 100644 --- a/sw/source/core/access/accframebase.cxx +++ b/sw/source/core/access/accframebase.cxx @@ -206,35 +206,29 @@ SwAccessibleFrameBase::~SwAccessibleFrameBase() void SwAccessibleFrameBase::Notify(const SfxHint& rHint) { +const SwFlyFrame* pFlyFrame = static_cast(GetFrame()); if(rHint.GetId() == SfxHintId::Dying) { EndListeningAll(); } -else if (rHint.GetId() == SfxHintId::SwLegacyModify) +else if (rHint.GetId() == SfxHintId::SwNameChanged && pFlyFrame) { -auto pLegacyModifyHint = static_cast(); -const sal_uInt16 nWhich = pLegacyModifyHint->GetWhich(); -const SwFlyFrame* pFlyFrame = static_cast(GetFrame()); -if(nWhich == RES_NAME_CHANGED && pFlyFrame) -{ -const SwFrameFormat* pFrameFormat = pFlyFrame->GetFormat(); +auto rNameChanged = static_cast(rHint); +const SwFrameFormat* pFrameFormat = pFlyFrame->GetFormat(); -const OUString sOldName( GetName() ); -assert( !pLegacyModifyHint->m_pOld || -static_cast(pLegacyModifyHint->m_pOld)->GetString() == GetName()); +const OUString sOldName( GetName() ); +assert( rNameChanged.m_sOld == sOldName); -SetName( pFrameFormat->GetName() ); -assert( !pLegacyModifyHint->m_pNew || -static_cast(pLegacyModifyHint->m_pNew)->GetString() == GetName()); +SetName( pFrameFormat->GetName() ); +assert( rNameChanged.m_sNew == GetName()); -if( sOldName != GetName() ) -{ -AccessibleEventObject aEvent; -aEvent.EventId = AccessibleEventId::NAME_CHANGED; -aEvent.OldValue <<= sOldName; -aEvent.NewValue <<= GetName(); -FireAccessibleEvent( aEvent ); -} +if( sOldName != GetName() ) +{ +AccessibleEventObject aEvent; +aEvent.EventId = AccessibleEventId::NAME_CHANGED; +aEvent.OldValue <<= sOldName; +aEvent.NewValue <<= GetName(); +FireAccessibleEvent( aEvent ); } } } diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 46772c4ec732..0e3101c71cef 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -632,45 +632,39 @@
[Libreoffice-commits] core.git: include/svl sw/inc sw/source
include/svl/hint.hxx |1 + sw/inc/calbck.hxx|2 +- sw/inc/swevent.hxx |4 ++-- sw/source/core/access/accframebase.cxx |3 ++- sw/source/core/access/accnotextframe.cxx |3 ++- sw/source/core/access/acctable.cxx |3 ++- sw/source/core/access/acctextframe.cxx |3 ++- sw/source/core/attr/calbck.cxx | 27 +++ sw/source/core/attr/format.cxx |4 ++-- sw/source/core/crsr/bookmrk.cxx |6 -- sw/source/core/crsr/crsrsh.cxx |4 ++-- sw/source/core/doc/acmplwrd.cxx |4 ++-- sw/source/core/doc/docftn.cxx|3 ++- sw/source/core/doc/fmtcol.cxx|6 +++--- sw/source/core/doc/lineinfo.cxx |4 ++-- sw/source/core/doc/notxtfrm.cxx |4 ++-- sw/source/core/doc/number.cxx|4 ++-- sw/source/core/docnode/node.cxx |3 ++- sw/source/core/docnode/section.cxx |8 sw/source/core/draw/dcontact.cxx |3 ++- sw/source/core/fields/ddetbl.cxx |3 ++- sw/source/core/fields/docufld.cxx|4 ++-- sw/source/core/fields/expfld.cxx |6 -- sw/source/core/fields/reffld.cxx |4 ++-- sw/source/core/fields/usrfld.cxx |9 ++--- sw/source/core/layout/atrfrm.cxx |7 --- sw/source/core/layout/fly.cxx|3 ++- sw/source/core/layout/flycnt.cxx |4 ++-- sw/source/core/layout/flyincnt.cxx |4 ++-- sw/source/core/layout/flylay.cxx |6 -- sw/source/core/layout/pagechg.cxx|3 ++- sw/source/core/layout/pagedesc.cxx |3 ++- sw/source/core/layout/sectfrm.cxx|3 ++- sw/source/core/layout/tabfrm.cxx | 11 ++- sw/source/core/layout/wsfrm.cxx |8 sw/source/core/table/swtable.cxx |8 sw/source/core/text/txtfrm.cxx |3 ++- sw/source/core/tox/tox.cxx |3 ++- sw/source/core/txtnode/atrfld.cxx|3 ++- sw/source/core/txtnode/atrftn.cxx|4 ++-- sw/source/core/txtnode/atrref.cxx|4 ++-- sw/source/core/txtnode/fmtatr2.cxx | 10 ++ sw/source/core/txtnode/ndtxt.cxx |3 ++- sw/source/core/txtnode/txtatr2.cxx |8 sw/source/core/undo/rolbck.cxx |6 -- sw/source/core/undo/unattr.cxx |6 -- sw/source/core/undo/undobj1.cxx |6 -- sw/source/core/unocore/unochart.cxx |2 +- sw/source/core/unocore/unofield.cxx |3 ++- sw/source/core/unocore/unoidx.cxx|3 ++- sw/source/filter/basflt/fltshell.cxx |3 ++- 51 files changed, 147 insertions(+), 105 deletions(-) New commits: commit 7d188fe4639717df47e2ff72d8c1295e23862ef9 Author: Noel Grandin AuthorDate: Mon Jun 21 14:38:19 2021 +0200 Commit: Noel Grandin CommitDate: Mon Jun 21 20:01:56 2021 +0200 create SfxHintId::SwLegacyModify id to avoid expensive dynamic_casts in writer Change-Id: Ic73ae7d4af985043f8533913b33939e3445ec7de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117586 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 284ebe7200c4..337930335a0f 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -116,6 +116,7 @@ enum class SfxHintId { SwSectionFrameMoveAndDelete, SwNavigatorUpdateTracking, SwNavigatorSelectOutlinesWithSelections, +SwLegacyModify, ThisIsAnSdrHint // used to avoid dynamic_cast }; diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 0863b2da7f2f..2d873107e069 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -68,7 +68,7 @@ namespace sw void ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, SwAttrSet& aOld, SwAttrSet& aNew); struct LegacyModifyHint final: SfxHint { -LegacyModifyHint(const SfxPoolItem* pOld, const SfxPoolItem* pNew) : m_pOld(pOld), m_pNew(pNew) {}; +LegacyModifyHint(const SfxPoolItem* pOld, const SfxPoolItem* pNew) : SfxHint(SfxHintId::SwLegacyModify), m_pOld(pOld), m_pNew(pNew) {}; sal_uInt16 GetWhich() const { return m_pOld ? m_pOld->Which() : m_pNew ? m_pNew->Which() : 0; }; virtual ~LegacyModifyHint() override; const SfxPoolItem* m_pOld; diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx index e18020320544..b25246cb2e12 100644 --- a/sw/inc/swevent.hxx +++ b/sw/inc/swevent.hxx @@ -118,9 +118,9 @@ struct SwCallMouseEvent final virtual void SwClientNotify(const SwModify& rMod, const SfxHint& rHint) override { -auto pLegacy = dynamic_cast(); -if(!pLegacy) +if (rHint.GetId() != SfxHintId::SwLegacyModify) return; +auto pLegacy = static_cast(); assert(EVENT_OBJECT_IMAGE ==
[Libreoffice-commits] core.git: include/svl sw/inc sw/source
include/svl/hint.hxx|4 +++- sw/inc/calbck.hxx |3 ++- sw/inc/format.hxx |2 +- sw/inc/frmfmt.hxx |1 - sw/inc/section.hxx |2 +- sw/inc/unochart.hxx | 14 +++--- sw/source/core/attr/format.cxx | 22 ++ sw/source/core/layout/sectfrm.cxx | 12 ++-- sw/source/core/unocore/unochart.cxx | 26 +++--- sw/source/core/unocore/unosect.cxx |7 ++- 10 files changed, 51 insertions(+), 42 deletions(-) New commits: commit 18bb85aa303c17b7705a9ccb0dd3d76673a1955e Author: Bjoern Michaelsen AuthorDate: Sat Jan 12 12:04:04 2019 +0100 Commit: Björn Michaelsen CommitDate: Sat Jan 12 13:09:01 2019 +0100 make SwFormat a ::sw::BroadcastingModify - clean up SwSection..Hint: Lazily reusing the Dying HintId is evil - switch the SwChartDataSequence to SvtListener - add some description to RuntimeException Change-Id: I897a63030f207cabe4d1ba7de0c25c6c581ffd1f Reviewed-on: https://gerrit.libreoffice.org/65816 Tested-by: Jenkins Reviewed-by: Björn Michaelsen diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 9091e2de4336..98d0ca81de55 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -108,9 +108,10 @@ enum class SfxHintId { // STARMATH MathFormatChanged, -// SW +// Sw SwDrawViewsCreated, SwSplitNodeOperation, +SwSectionFrameMoveAndDelete, }; template< typename charT, typename traits > @@ -188,6 +189,7 @@ inline std::basic_ostream & operator <<( case SfxHintId::MathFormatChanged: return stream << "MathFormatChanged"; case SfxHintId::SwDrawViewsCreated: return stream << "SwDrawViewsCreated"; case SfxHintId::SwSplitNodeOperation: return stream << "SwSplitNodeOperation"; +case SfxHintId::SwSectionFrameMoveAndDelete: return stream << "SwSectionFrameMoveAndDelete"; default: return stream << "unk(" << std::to_string(int(id)) << ")"; } } diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 4d33243ed277..5cc590989c8a 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -237,7 +237,8 @@ namespace sw // used anymore, in which case a BroadcasterMixin should be enough instead // then. class SW_DLLPUBLIC BroadcastingModify : public SwModify, public BroadcasterMixin { -virtual void CallSwClientNotify(const SfxHint& rHint) const override; +public: +virtual void CallSwClientNotify(const SfxHint& rHint) const override; }; // this should be hidden but sadly SwIterator template needs it... class ListenerEntry final : public SwClient diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index 870cfff0367e..cbeda7237f66 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -40,7 +40,7 @@ namespace drawinglayer { namespace attribute { }} /// Base class for various Writer styles. -class SW_DLLPUBLIC SwFormat : public SwModify +class SW_DLLPUBLIC SwFormat : public sw::BroadcastingModify { friend class SwFrameFormat; diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 4469a2c8b4c0..bb8a9622d2be 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -56,7 +56,6 @@ class SwFrameFormats; /// Style of a layout element. class SW_DLLPUBLIC SwFrameFormat : public SwFormat -, public sw::BroadcasterMixin { friend class SwDoc; friend class SwPageDesc;///< Is allowed to call protected CTor. diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index 30b582b89a80..d0fcff0078bd 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -252,7 +252,7 @@ class SwSectionFrameMoveAndDeleteHint : public SfxHint { public: SwSectionFrameMoveAndDeleteHint( const bool bSaveContent ) -: SfxHint( SfxHintId::Dying ) +: SfxHint( SfxHintId::SwSectionFrameMoveAndDelete ) , mbSaveContent( bSaveContent ) {} diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx index 0b4e9c73e752..bb5b8fa7afc4 100644 --- a/sw/inc/unochart.hxx +++ b/sw/inc/unochart.hxx @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -229,8 +230,9 @@ SwChartDataSequenceBaseClass; class SwChartDataSequence : public SwChartDataSequenceBaseClass, -public SwClient +public SvtListener { +SwFrameFormat* m_pFormat; ::comphelper::OInterfaceContainerHelper2 m_aEvtListeners; ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; css::chart2::data::DataSequenceRole m_aRole; @@ -249,10 +251,6 @@ class SwChartDataSequence : SwChartDataSequence( const SwChartDataSequence ); SwChartDataSequence & operator = ( const SwChartDataSequence & ) = delete; -protected: -//SwClient -virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; - public: SwChartDataSequence(