summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/hint.hxx1
-rw-r--r--sw/inc/hintids.hxx2
-rw-r--r--sw/inc/hints.hxx6
-rw-r--r--sw/source/core/docnode/section.cxx47
4 files changed, 28 insertions, 28 deletions
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<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_SECTION_HIDDEN(174);
-constexpr TypedWhichId<SwMsgPoolItem> RES_SECTION_NOT_HIDDEN(175);
constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_PIECE_ARRIVED(177);
constexpr TypedWhichId<SwMsgPoolItem> RES_HIDDENPARA_PRINT(178);
constexpr TypedWhichId<SwVirtPageNumInfo> 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(&aMsgItem, &aMsgItem));
+ 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(&aMsgItem, &aMsgItem));
+ 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<const sw::SectionHidden&>(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<const sw::LegacyModifyHint*>(&rHint);
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<const sw::SectionHidden&>(rHint);
+ auto pSect = GetSection();
+ if(!pSect || rSectionHidden.m_isHidden == pSect->IsHiddenFlag()) // already at target state, skipping.
+ return;
+ GetNotifier().Broadcast(rSectionHidden);
+ return;
+ } else if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
sal_uInt16 nWhich = pLegacy->GetWhich();
@@ -750,14 +755,6 @@ void SwSectionFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
}
break;
- case RES_SECTION_HIDDEN:
- case RES_SECTION_NOT_HIDDEN:
- {
- auto pSect = GetSection();
- if(!pSect || (RES_SECTION_HIDDEN == nWhich) == pSect->IsHiddenFlag()) // already at target state, skipping.
- return;
- }
- [[fallthrough]];
case RES_FTN_AT_TXTEND:
case RES_END_AT_TXTEND:
GetNotifier().Broadcast(sw::LegacyModifyHint(pOld, pNew));
@@ -918,10 +915,8 @@ void SwSectionFormat::UpdateParent()
if(bIsHidden == pSection->IsHiddenFlag())
{
- SwMsgPoolItem aMsgItem(o3tl::narrowing<sal_uInt16>(bIsHidden
- ? RES_SECTION_HIDDEN
- : RES_SECTION_NOT_HIDDEN));
- CallSwClientNotify(sw::LegacyModifyHint(&aMsgItem, &aMsgItem));
+ const sw::SectionHidden aHint(bIsHidden);
+ CallSwClientNotify(aHint);
}
}