summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/hint.hxx2
-rw-r--r--svl/source/items/poolitem.cxx1
-rw-r--r--sw/IwyuFilter_sw.yaml1
-rw-r--r--sw/inc/fldbas.hxx2
-rw-r--r--sw/inc/fmtfld.hxx2
-rw-r--r--sw/inc/hintids.hxx2
-rw-r--r--sw/inc/hints.hxx33
-rw-r--r--sw/inc/ndtxt.hxx1
-rw-r--r--sw/source/core/attr/hints.cxx5
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx4
-rw-r--r--sw/source/core/fields/ddefld.cxx2
-rw-r--r--sw/source/core/fields/expfld.cxx10
-rw-r--r--sw/source/core/fields/fldbas.cxx4
-rw-r--r--sw/source/core/text/txtfrm.cxx31
-rw-r--r--sw/source/core/txtnode/atrfld.cxx29
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx6
16 files changed, 74 insertions, 61 deletions
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index b85e4f66d285..f06f4c6449e9 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -149,6 +149,8 @@ enum class SfxHintId {
SwSectionHidden,
SwTitleChanged,
SwDescriptionChanged,
+ SwDocPosUpdate,
+ SwDocPosUpdateAtIndex,
ThisIsAnSdrHint
};
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index cac0e80a3a6f..c09b635696d9 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -435,7 +435,6 @@
// class SwPtrMsgPoolItem : public SwMsgPoolItem
// class SwFormatChg: public SwMsgPoolItem
// class SwUpdateAttr : public SwMsgPoolItem
-// class SwDocPosUpdate : public SwMsgPoolItem
// class SwTableFormulaUpdate : public SwMsgPoolItem
// class SwAutoFormatGetDocNode: public SwMsgPoolItem
// class SwAttrSetChg: public SwMsgPoolItem
diff --git a/sw/IwyuFilter_sw.yaml b/sw/IwyuFilter_sw.yaml
index 3c3c82cc9ea5..86988d595077 100644
--- a/sw/IwyuFilter_sw.yaml
+++ b/sw/IwyuFilter_sw.yaml
@@ -219,7 +219,6 @@ excludelist:
- class SfxStringItem
- class SvXMLAttrContainerItem
- class SwAttrSetChg
- - class SwDocPosUpdate
- class SwFormatChg
- class SwFormatMeta
- class SwMsgPoolItem
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 4a1de6b77dcb..5768d822d853 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -21,6 +21,7 @@
#include <i18nlangtag/lang.h>
#include "swdllapi.h"
+#include "swtypes.hxx"
#include "calbck.hxx"
#include "nodeoffset.hxx"
@@ -283,6 +284,7 @@ public:
void GatherRefFields(std::vector<SwGetRefField*>& rvRFields, const sal_uInt16 nTyp);
void GatherFields(std::vector<SwFormatField*>& rvFormatFields, bool bCollectOnlyInDocNodes=true) const;
void GatherDdeTables(std::vector<SwDDETable*>& rvTables) const;
+ void UpdateDocPos(const SwTwips nDocPos);
virtual void UpdateFields();
};
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 1efb7665c953..4bbd6d4cdf05 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -27,6 +27,7 @@
#include <unotools/weakref.hxx>
#include "swdllapi.h"
+#include "swtypes.hxx"
#include "calbck.hxx"
#include "reffld.hxx"
#include "nodeoffset.hxx"
@@ -168,6 +169,7 @@ public:
void ForceUpdateTextNode();
void UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* pNew);
+ void UpdateDocPos(const SwTwips nDocPos);
};
enum class SwFormatFieldHintWhich
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 4be4a5182585..330b0042b3a9 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -31,7 +31,6 @@ class SfxStringItem;
class SwFormatChg;
class SwUpdateAttr;
class SwAttrSetChg;
-class SwDocPosUpdate;
class SwFormatMeta;
class SwFormatContentControl;
class SvXMLAttrContainerItem;
@@ -434,7 +433,6 @@ constexpr TypedWhichId<SwFormatChg> RES_FMT_CHG(168);
constexpr TypedWhichId<SwAttrSetChg> RES_ATTRSET_CHG(169);
constexpr TypedWhichId<SwUpdateAttr> RES_UPDATE_ATTR(170);
constexpr TypedWhichId<SwPtrMsgPoolItem> RES_REFMARKFLD_UPDATE(171);
-constexpr TypedWhichId<SwDocPosUpdate> RES_DOCPOS_UPDATE(172);
constexpr TypedWhichId<SwTableFormulaUpdate> RES_TABLEFML_UPDATE(173);
constexpr TypedWhichId<SwMsgPoolItem> RES_UPDATEDDETBL(174);
constexpr TypedWhichId<SwMsgPoolItem> RES_TBLHEADLINECHG(175);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 5530ce7922f3..2b870373dcf1 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -140,6 +140,30 @@ public:
RedlineUnDelText(sal_Int32 nS, sal_Int32 nL);
};
+/** DocPosUpdate is sent to signal that only the frames from or to a specified document-global position
+ have to be updated. At the moment this is only needed when updating pagenumber fields. */
+class DocPosUpdate final : public SfxHint
+{
+public:
+ const SwTwips m_nDocPos;
+ DocPosUpdate(const SwTwips nDocPos)
+ : SfxHint(SfxHintId::SwDocPosUpdate)
+ , m_nDocPos(nDocPos)
+ {};
+};
+class DocPosUpdateAtIndex final : public SfxHint
+{
+public:
+ const SwTwips m_nDocPos;
+ const SwTextNode& m_rNode;
+ const sal_uInt32 m_nIndex;
+ DocPosUpdateAtIndex(const SwTwips nDocPos, const SwTextNode& rNode, sal_uInt32 nIndex)
+ : SfxHint(SfxHintId::SwDocPosUpdateAtIndex)
+ , m_nDocPos(nDocPos)
+ , m_rNode(rNode)
+ , m_nIndex(nIndex)
+ {};
+};
class CondCollCondChg final : public SfxHint
{
public:
@@ -267,15 +291,6 @@ public:
}
};
-/** SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position
- have to be updated. At the moment this is only needed when updating pagenumber fields. */
-class SwDocPosUpdate final : public SwMsgPoolItem
-{
-public:
- const SwTwips nDocPos;
- SwDocPosUpdate( const SwTwips nDocPos );
-};
-
/// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or split
enum TableFormulaUpdateFlags { TBL_CALC = 0,
TBL_BOXNAME,
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 4b15545b41bc..a22d1afeb2c1 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -237,6 +237,7 @@ public:
public:
using SwContentNode::GetAttr;
+ void UpdateDocPos(const SwTwips nDocPos, const sal_uInt32 nIndex);
/// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
void TriggerNodeUpdate(const sw::LegacyModifyHint&);
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index a755cc47b7e2..f1e41491a726 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -81,11 +81,6 @@ SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vect
{
}
-SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos )
- : SwMsgPoolItem( RES_DOCPOS_UPDATE ), nDocPos(nDcPos)
-{
-}
-
SwTableFormulaUpdate::SwTableFormulaUpdate( const SwTable* pNewTable )
: SwMsgPoolItem( RES_TABLEFML_UPDATE ),
m_pTable( pNewTable ), m_pHistory( nullptr ), m_nSplitLine( USHRT_MAX ),
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 4d6486bca262..62ed40812160 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1337,8 +1337,6 @@ sal_Int32 DocumentFieldsManager::GetRecordsPerDocument() const
void DocumentFieldsManager::UpdatePageFields(const SwTwips nDocPos)
{
- SwDocPosUpdate aDosPosUpdate(nDocPos);
- sw::LegacyModifyHint aHint(nullptr, &aDosPosUpdate);
for(SwFieldTypes::size_type i = 0; i < INIT_FLDTYPES; ++i)
{
SwFieldType* pFieldType = (*mpFieldTypes)[i].get();
@@ -1348,7 +1346,7 @@ void DocumentFieldsManager::UpdatePageFields(const SwTwips nDocPos)
case SwFieldIds::Chapter:
case SwFieldIds::GetExp:
case SwFieldIds::RefPageGet:
- pFieldType->CallSwClientNotify(aHint);
+ pFieldType->UpdateDocPos(nDocPos);
break;
case SwFieldIds::DocStat:
pFieldType->CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 8f01b257aa5e..cf4c93c97122 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -320,7 +320,7 @@ void SwDDEFieldType::UpdateDDE(const bool bNotifyShells)
for(auto pFormatField: vFields)
{
if(pFormatField->GetTextField())
- pFormatField->UpdateTextNode( nullptr, &aUpdateDDE );
+ pFormatField->UpdateTextNode(nullptr, &aUpdateDDE);
}
// a DDE tables in the text
for(auto pTable: vTables)
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index d79f46ad09f3..39467d9b7a61 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -269,15 +269,9 @@ std::unique_ptr<SwFieldType> SwGetExpFieldType::Copy() const
return std::make_unique<SwGetExpFieldType>(GetDoc());
}
-void SwGetExpFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
+void SwGetExpFieldType::SwClientNotify(const SwModify&, const SfxHint&)
{
- if (rHint.GetId() != SfxHintId::SwLegacyModify)
- return;
- auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
- // do not expand anything else
- if(pLegacy->GetWhich() != RES_DOCPOS_UPDATE)
- return;
- CallSwClientNotify(rHint);
+ // do not expand anything (else)
}
SwGetExpField::SwGetExpField(SwGetExpFieldType* pTyp, const OUString& rFormel,
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index e20a563a407e..71afe0d7e425 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -210,6 +210,10 @@ void SwFieldType::GatherDdeTables(std::vector<SwDDETable*>& rvTables) const
CallSwClientNotify(sw::GatherDdeTablesHint(rvTables));
}
+void SwFieldType::UpdateDocPos(const SwTwips nDocPos)
+{
+ CallSwClientNotify(sw::DocPosUpdate(nDocPos));
+}
void SwFieldType::UpdateFields()
{
CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index bd772efc74f9..6ae786f8b435 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -2024,6 +2024,20 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
{
pDeleteChar = static_cast<const sw::DeleteChar*>(&rHint);
}
+ else if (rHint.GetId() == SfxHintId::SwDocPosUpdateAtIndex)
+ {
+ auto pDocPosAt = static_cast<const sw::DocPosUpdateAtIndex*>(&rHint);
+ Broadcast(SfxHint()); // notify SwAccessibleParagraph
+ if(IsLocked())
+ return;
+ if(pDocPosAt->m_nDocPos > getFrameArea().Top())
+ return;
+ TextFrameIndex const nIndex(MapModelToView(
+ &pDocPosAt->m_rNode,
+ pDocPosAt->m_nIndex));
+ InvalidateRange(SwCharRange(nIndex, TextFrameIndex(1)));
+ return;
+ }
else if (auto const pHt = dynamic_cast<sw::MoveText const*>(&rHint))
{
pMoveText = pHt;
@@ -2613,23 +2627,6 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
#endif
}
break;
-
- // Process SwDocPosUpdate
- case RES_DOCPOS_UPDATE:
- {
- if( pOld && pNew )
- {
- const SwDocPosUpdate *pDocPos = static_cast<const SwDocPosUpdate*>(pOld);
- if( pDocPos->nDocPos <= getFrameArea().Top() )
- {
- const SwFormatField *pField = static_cast<const SwFormatField *>(pNew);
- TextFrameIndex const nIndex(MapModelToView(&rNode,
- pField->GetTextField()->GetStart()));
- InvalidateRange(SwCharRange(nIndex, TextFrameIndex(1)));
- }
- }
- break;
- }
case RES_PARATR_SPLIT:
if ( GetPrev() )
CheckKeep();
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index a1794b78d0b2..a78ed5291590 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -302,6 +302,10 @@ void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHin
}
pGatherFieldsHint->m_rvFields.push_back(this);
}
+ else if (rHint.GetId() == SfxHintId::SwDocPosUpdate)
+ {
+ UpdateDocPos(static_cast<const sw::DocPosUpdate*>(&rHint)->m_nDocPos);
+ }
}
namespace
@@ -383,6 +387,14 @@ void SwFormatField::ForceUpdateTextNode()
bool bNeedForced = lcl_NeedsForcedUpdate(*mpTextField->GetFormatField().GetField());
mpTextField->ExpandTextField(bNeedForced);
}
+void SwFormatField::UpdateDocPos(const SwTwips nDocPos)
+{
+ if (!IsFieldInDoc())
+ return;
+ auto pTextNd = &mpTextField->GetTextNode();
+
+ pTextNd->UpdateDocPos(nDocPos, mpTextField->GetStart());
+}
void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* pNew)
{
if (pOld == nullptr && pNew == nullptr)
@@ -408,25 +420,14 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* p
SwTextNode* pTextNd = &mpTextField->GetTextNode();
OSL_ENSURE(pTextNd, "Where is my Node?");
- bool bTriggerNode = false;
+ bool bTriggerNode = pNew != nullptr;
bool bExpand = false;
- const SfxPoolItem* pNodeOld = nullptr;
- const SfxPoolItem* pNodeNew = nullptr;
if(pNew)
{
switch(pNew->Which())
{
- case RES_DOCPOS_UPDATE:
- // handled in SwTextFrame::Modify()
- bTriggerNode = true;
- pNodeOld = pNew;
- pNodeNew = this;
- break;
case RES_ATTRSET_CHG:
case RES_FMT_CHG:
- bTriggerNode = true;
- pNodeOld = pOld;
- pNodeNew = pNew;
break;
case RES_REFMARKFLD_UPDATE:
// update GetRef fields
@@ -441,13 +442,13 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* p
auto pType = mpField->GetTyp();
lcl_EnsureUserFieldValid(*pType);
bTriggerNode = lcl_TriggerNode(pType->Which());
- pNodeNew = pNew;
bExpand = lcl_ExpandField(pType->Which(), pOld && pOld->Which() == RES_HIDDENPARA_PRINT);
+ pOld = nullptr;
}
}
}
if(bTriggerNode)
- pTextNd->TriggerNodeUpdate(sw::LegacyModifyHint(pNodeOld, pNodeNew));
+ pTextNd->TriggerNodeUpdate(sw::LegacyModifyHint(pOld, pNew));
if(bExpand)
mpTextField->ExpandTextField(false);
}
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 63ad3c93bbdd..9a8173833b45 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -5465,6 +5465,12 @@ void SwTextNode::HandleNonLegacyHint(const SfxHint& rHint)
}
}
+void SwTextNode::UpdateDocPos(const SwTwips nDocPos, const sal_uInt32 nIndex)
+{
+ const sw::DocPosUpdateAtIndex aHint(nDocPos, *this, nIndex);
+ CallSwClientNotify(aHint);
+}
+
void SwTextNode::TriggerNodeUpdate(const sw::LegacyModifyHint& rHint)
{
const auto pOldValue = rHint.m_pOld;