[Libreoffice-commits] core.git: include/svl sw/inc sw/source

2023-08-31 Thread Bjoern Michaelsen (via logerrit)
 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: sw/source

2023-08-07 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/table/swtable.cxx |   11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

New commits:
commit 6c3989b3a09c4b43c2c5f548c8ae9248db901dc6
Author: Bjoern Michaelsen 
AuthorDate: Mon Aug 7 10:42:35 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Mon Aug 7 15:19:36 2023 +0200

refactor: remove dead docnode hint code

- the deleted code should not have side effects
- it had been used to find an actual node to return in the hint before
  9b68ce7b0f2326ec540717ec5c8207825403774e, which removed the need to
  return the node

Change-Id: I8f28765a5dd9355e7fdc7a7ff069a76b714287fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155419
Reviewed-by: Noel Grandin 
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 04d58363b97d..c111a86ccd58 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2282,16 +2282,7 @@ bool SwTable::GetInfo( SfxPoolItem& rInfo ) const
 case RES_AUTOFMT_DOCNODE:
 {
 const SwTableNode* pNode = GetTableNode();
-if (pNode && >GetNodes() == 
static_cast(rInfo).pNodes)
-{
-if (!m_TabSortContentBoxes.empty())
-{
-SwNodeIndex aIdx( *m_TabSortContentBoxes[0]->GetSttNd() );
-GetFrameFormat()->GetDoc()->GetNodes().GoNext(  );
-}
-return false;
-}
-break;
+return !(pNode && >GetNodes() == 
static_cast(rInfo).pNodes);
 }
 case RES_FINDNEARESTNODE:
 if( GetFrameFormat() &&


[Libreoffice-commits] core.git: compilerplugins/clang include/svl svl/source sw/inc sw/source

2023-08-03 Thread Bjoern Michaelsen (via logerrit)
 compilerplugins/clang/unusedmethods.results |2 -
 include/svl/hint.hxx|1 
 svl/source/items/poolitem.cxx   |1 
 sw/inc/hintids.hxx  |3 --
 sw/inc/hints.hxx|   42 +---
 sw/source/core/attr/hints.cxx   |   14 ++---
 sw/source/core/inc/pagefrm.hxx  |6 ++--
 sw/source/core/inc/tabfrm.hxx   |1 
 sw/source/core/inc/txtfrm.hxx   |1 
 sw/source/core/layout/pagechg.cxx   |6 ++--
 sw/source/core/layout/tabfrm.cxx|   19 +---
 sw/source/core/layout/trvlfrm.cxx   |   14 -
 sw/source/core/text/txtfrm.cxx  |   20 ++---
 13 files changed, 68 insertions(+), 62 deletions(-)

New commits:
commit 7f85415a2f07d62bf688cb33680054940d4dd7f1
Author: Bjoern Michaelsen 
AuthorDate: Sun Jul 30 09:01:30 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Thu Aug 3 08:01:55 2023 +0200

move SwVirtPageNumInfo to SfxHint

- also remove now obsolete GetInfo overrides

Change-Id: Iaac75ed2e53daead06242ce4620fd2b879909e02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155061
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 77d563e9d719..a4b5e3d3dcd5 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1934,8 +1934,6 @@ include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
-include/svl/typedwhich.hxx:31
- TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 5967d834ceeb..ba230f92b817 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -152,6 +152,7 @@ enum class SfxHintId {
 SwDocPosUpdate,
 SwDocPosUpdateAtIndex,
 SwTableHeadingChange,
+SwVirtPageNumHint,
 
 ThisIsAnSdrHint
 };
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index dfa584f6114a..cb1bec15159c 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -437,7 +437,6 @@
 // class SwTableFormulaUpdate : public SwMsgPoolItem
 // class SwAutoFormatGetDocNode: public SwMsgPoolItem
 // class SwAttrSetChg: public SwMsgPoolItem
-// class SwVirtPageNumInfo: public SwMsgPoolItem
 // class SwFindNearestNode : public SwMsgPoolItem
 // class SwStringMsgPoolItem : public SwMsgPoolItem
 // class SwFormatDrop: public SfxPoolItem, public SwClient
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 1046dab3e1ca..339a73068162 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -141,7 +141,7 @@ class SwTransparencyGrf;
 class SwFormatRuby;
 class SwTableFormulaUpdate;
 class SwAutoFormatGetDocNode;
-class SwVirtPageNumInfo;
+class VirtPageNumHint;
 class SwFindNearestNode;
 class SwFltAnchor;
 class SwFltTOX;
@@ -433,7 +433,6 @@ constexpr TypedWhichId RES_ATTRSET_CHG(169);
 constexpr TypedWhichId RES_UPDATE_ATTR(170);
 constexpr TypedWhichId RES_AUTOFMT_DOCNODE(176);
 constexpr TypedWhichId RES_HIDDENPARA_PRINT(178);
-constexpr TypedWhichId RES_VIRTPAGENUM_INFO(180);
 constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181);
 // empty
 constexpr TypedWhichId RES_FINDNEARESTNODE(184);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 46a3c586771f..eb3ba5a2cdc2 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -261,6 +261,32 @@ class TableHeadingChange final: public SfxHint
 public:
 TableHeadingChange() : SfxHint(SfxHintId::SwTableHeadingChange) {};
 };
+class VirtPageNumHint final: public SfxHint
+{
+const SwPageFrame* m_pPage;
+const SwPageFrame* m_pOrigPage;
+const SwFrame* m_pFrame;
+bool m_bFound;
+/** Multiple attributes can be attached to a single paragraph / table
+ The frame, in the end, has to decide which attribute takes effect and 
which physical page it involves */
+public:
+VirtPageNumHint(const SwPageFrame* pPg);
+const SwPageFrame* GetPage() const
+{ return m_pPage; }
+const SwPageFrame* GetOrigPage() const
+{ return m_pOrigPage; }
+const SwFrame* GetFrame() const
+{ return m_pFrame; }
+void SetInfo(const SwPageFrame* pPg, const SwFrame *pF)
+{ m_pFrame = pF; m_pPage = pPg; }
+void SetFound()
+{
+assert(!m_bFound);
+m_bFound = true;
+}
+bool IsFound()
+{ return m_bFound; }
+};
 }
 
 class SwUpdateAttr final : public SwMsgPoolItem
@@ -359,22 +385,6 @@ public:
 #endif
 };
 
-class 

[Libreoffice-commits] core.git: sw/source

2023-07-18 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/inc/pagefrm.hxx|3 +++
 sw/source/core/layout/pagechg.cxx |   17 +
 sw/source/core/layout/tabfrm.cxx  |   25 +
 sw/source/core/text/txtfrm.cxx|   25 +
 4 files changed, 30 insertions(+), 40 deletions(-)

New commits:
commit 5f2c99839bf041faf5b15aa9d4bb4c73b4b041f0
Author: Bjoern Michaelsen 
AuthorDate: Tue Jul 18 00:29:01 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Jul 18 12:27:08 2023 +0200

deduplicate virtual page info update in SwPageFrame

Change-Id: I2753f080f7751189675007ded8ba050245a8758c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154562
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index cd2f14f5e885..d85ddaecd116 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -36,6 +36,7 @@ class SwAttrSetChg;
 namespace vcl { class Font; }
 class SwSortedObjs;
 class SwAnchoredObject;
+class SwVirtPageNumInfo;
 
 enum class SwPageFrameInvFlags : sal_uInt8
 {
@@ -347,6 +348,8 @@ public:
 const SwHeaderFrame* GetHeaderFrame() const;
 const SwFooterFrame* GetFooterFrame() const;
 
+bool UpdateVirtPageNumInfo(SwVirtPageNumInfo& rHint, const SwFrame* 
pFrame) const;
+
 void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
 };
 
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index 6f11380fc030..042a34d46759 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2598,6 +2598,23 @@ const SwFooterFrame* SwPageFrame::GetFooterFrame() const
 return nullptr;
 }
 
+bool SwPageFrame::UpdateVirtPageNumInfo(SwVirtPageNumInfo& rHint, const 
SwFrame* pFrame) const
+{
+if(this == rHint.GetOrigPage() && !pFrame->GetPrev())
+{
+// Should be the one (can temporarily be different, should we be 
concerned about this possibility?)
+rHint.SetInfo(this, pFrame);
+return false;
+}
+if(GetPhyPageNum() < rHint.GetOrigPage()->GetPhyPageNum() &&
+ (!rHint.GetPage() || GetPhyPageNum() > 
rHint.GetPage()->GetPhyPageNum()))
+{
+// This could be the one.
+rHint.SetInfo(this, pFrame);
+}
+return true;
+}
+
 void SwPageFrame::dumpAsXml(xmlTextWriterPtr writer) const
 {
 (void)xmlTextWriterStartElement(writer, reinterpret_cast("page"));
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 174ff7227628..a7e767a00e3a 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3590,28 +3590,13 @@ void SwTabFrame::UpdateAttr_( const SfxPoolItem *pOld, 
const SfxPoolItem *pNew,
 }
 }
 
-bool SwTabFrame::GetInfo( SfxPoolItem  ) const
+bool SwTabFrame::GetInfo(SfxPoolItem& rHint) const
 {
-if ( RES_VIRTPAGENUM_INFO == rHint.Which() && IsInDocBody() && !IsFollow() 
)
+if(RES_VIRTPAGENUM_INFO == rHint.Which() && IsInDocBody() && !IsFollow())
 {
-SwVirtPageNumInfo  = static_cast(rHint);
-const SwPageFrame *pPage = FindPageFrame();
-if ( pPage  )
-{
-if ( pPage == rInfo.GetOrigPage() && !GetPrev() )
-{
-// Should be the one (can temporarily be different, should we 
be
-//concerned about this possibility?)
-rInfo.SetInfo( pPage, this );
-return false;
-}
-if ( pPage->GetPhyPageNum() < rInfo.GetOrigPage()->GetPhyPageNum() 
&&
- (!rInfo.GetPage() || pPage->GetPhyPageNum() > 
rInfo.GetPage()->GetPhyPageNum()))
-{
-//This could be the one.
-rInfo.SetInfo( pPage, this );
-}
-}
+SwVirtPageNumInfo& rInfo = static_cast(rHint);
+if(const SwPageFrame* pPage = FindPageFrame())
+return pPage->UpdateVirtPageNumInfo(rInfo, this);
 }
 return true;
 }
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 7f1c17691ccf..4bc70a7ae233 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -2746,28 +2746,13 @@ void SwTextFrame::SwClientNotify(SwModify const& 
rModify, SfxHint const& rHint)
 CalcFootnoteFlag();
 }
 
-bool SwTextFrame::GetInfo( SfxPoolItem  ) const
+bool SwTextFrame::GetInfo(SfxPoolItem& rHint) const
 {
-if ( RES_VIRTPAGENUM_INFO == rHint.Which() && IsInDocBody() && ! 
IsFollow() )
+if(RES_VIRTPAGENUM_INFO == rHint.Which() && IsInDocBody() && !IsFollow())
 {
-SwVirtPageNumInfo  = static_cast(rHint);
-const SwPageFrame *pPage = FindPageFrame();
-if ( pPage )
-{
-if ( pPage == rInfo.GetOrigPage() && !GetPrev() )
-{
-// this should be the one
-// (could only differ temporarily; is that disturbing?)
-

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/source

2023-07-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/crsr/crstrvl.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 27c57627fcd28a8f533b535b37ec6376f1505e6f
Author: Bjoern Michaelsen 
AuthorDate: Fri Jul 14 01:03:56 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Jul 14 18:35:46 2023 +0200

tdf#153866: Fix TOX crash

Im not sure why it should be valid that the ContentFrame should ever be
nullptr here, but a simple check prevents the immediate crash.

Change-Id: I19a2d04e41271ae6a5b6a3a79c31c3efd5db7875
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154404
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit d86a6d2b47c6a22d185dc631388ca3f2c0386a35)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154416

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index d5e430bb8711..3face1677c13 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -368,6 +368,8 @@ void SwCursorShell::GotoTOXMarkBase()
 // Take the 1. and get the index type. Ask it for the actual index.
 const SwTOXType* pType = aMarks[0]->GetTOXType();
 auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout());
+if(!pContentFrame)
+return;
 SwCallLink aLk(*this); // watch Cursor-Moves
 SwCursorSaveState aSaveState(*m_pCurrentCursor);
 assert(pContentFrame->IsTextFrame());


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source

2023-07-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/crsr/crstrvl.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 30933ad497fe0e8dd6af36721561706886ed0281
Author: Bjoern Michaelsen 
AuthorDate: Fri Jul 14 01:03:56 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Jul 14 15:09:58 2023 +0200

tdf#153866: Fix TOX crash

Im not sure why it should be valid that the ContentFrame should ever be
nullptr here, but a simple check prevents the immediate crash.

Change-Id: I19a2d04e41271ae6a5b6a3a79c31c3efd5db7875
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154404
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit d86a6d2b47c6a22d185dc631388ca3f2c0386a35)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154417

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 0cf968a3d7e9..a1916c6cf691 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -365,6 +365,8 @@ void SwCursorShell::GotoTOXMarkBase()
 // Take the 1. and get the index type. Ask it for the actual index.
 const SwTOXType* pType = aMarks[0]->GetTOXType();
 auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout());
+if(!pContentFrame)
+return;
 SwCallLink aLk(*this); // watch Cursor-Moves
 SwCursorSaveState aSaveState(*m_pCurrentCursor);
 assert(pContentFrame->IsTextFrame());


[Libreoffice-commits] core.git: sw/source

2023-07-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/crsr/crstrvl.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit d86a6d2b47c6a22d185dc631388ca3f2c0386a35
Author: Bjoern Michaelsen 
AuthorDate: Fri Jul 14 01:03:56 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Jul 14 11:11:04 2023 +0200

tdf#153866: Fix TOX crash

Im not sure why it should be valid that the ContentFrame should ever be
nullptr here, but a simple check prevents the immediate crash.

Change-Id: I19a2d04e41271ae6a5b6a3a79c31c3efd5db7875
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154404
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index d5e430bb8711..3face1677c13 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -368,6 +368,8 @@ void SwCursorShell::GotoTOXMarkBase()
 // Take the 1. and get the index type. Ask it for the actual index.
 const SwTOXType* pType = aMarks[0]->GetTOXType();
 auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout());
+if(!pContentFrame)
+return;
 SwCallLink aLk(*this); // watch Cursor-Moves
 SwCursorSaveState aSaveState(*m_pCurrentCursor);
 assert(pContentFrame->IsTextFrame());


[Libreoffice-commits] core.git: bin/find-can-be-private-symbols.functions.results compilerplugins/clang sw/inc sw/source

2023-05-01 Thread Bjoern Michaelsen (via logerrit)
 bin/find-can-be-private-symbols.functions.results |   16 --
 compilerplugins/clang/unusedmethods.results   |6 -
 sw/inc/dbgoutsw.hxx   |3 
 sw/inc/doc.hxx|6 -
 sw/inc/frameformats.hxx   |   91 ---
 sw/inc/frmfmt.hxx |3 
 sw/inc/textboxhelper.hxx  |1 
 sw/source/core/doc/dbgoutsw.cxx   |6 -
 sw/source/core/doc/docedt.cxx |2 
 sw/source/core/doc/docfmt.cxx |  126 --
 sw/source/core/doc/docglbl.cxx|5 
 sw/source/core/doc/doclay.cxx |2 
 sw/source/core/doc/docnew.cxx |2 
 sw/source/core/inc/frmtool.hxx|1 
 sw/source/core/layout/atrfrm.cxx  |9 -
 sw/source/filter/basflt/shellio.cxx   |2 
 sw/source/uibase/app/docstyle.cxx |6 -
 17 files changed, 19 insertions(+), 268 deletions(-)

New commits:
commit 1dc1595824509c58f86f819673719096f771f417
Author: Bjoern Michaelsen 
AuthorDate: Sun Apr 16 14:06:24 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Mon May 1 20:51:02 2023 +0200

replace SwFrameFormats with sw::FrameFormats

- SwFrameFormats is now completely replaced by stronger typed
  sw::FrameFormats<>, thus remove it

Change-Id: I7e655a83ba8cf01d1e68dccd1804c167e8daca9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150455
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/bin/find-can-be-private-symbols.functions.results 
b/bin/find-can-be-private-symbols.functions.results
index 1acff353035d..e3cb6f130544 100644
--- a/bin/find-can-be-private-symbols.functions.results
+++ b/bin/find-can-be-private-symbols.functions.results
@@ -13279,21 +13279,6 @@ SwFrameFormat::dumpAsXml(_xmlTextWriter*) const
 SwFrameFormat::getSdrAllFillAttributesHelper() const
 SwFrameFormat::supportsFullDrawingLayerFillAttributeSet() const
 SwFrameFormat::~SwFrameFormat()
-SwFrameFormats::ContainsFormat(SwFrameFormat const&) const
-SwFrameFormats::DeleteAndDestroyAll(bool)
-SwFrameFormats::FindFormatByName(rtl::OUString const&) const
-SwFrameFormats::IsAlive(SwFrameFormat const*) const
-SwFrameFormats::SwFrameFormats()
-SwFrameFormats::dumpAsXml(_xmlTextWriter*, char const*) const
-SwFrameFormats::erase(SwFrameFormat* const&)
-SwFrameFormats::erase(boost::multi_index::detail::rnd_node_iterator > > > > const&)
-SwFrameFormats::erase(unsigned long)
-SwFrameFormats::findByTypeAndName(unsigned short, rtl::OUString const&) const
-SwFrameFormats::findRangeByName(rtl::OUString const&) const
-SwFrameFormats::newDefault(SwFrameFormat* const&)
-SwFrameFormats::newDefault(boost::multi_index::detail::rnd_node_iterator > > > > const&)
-SwFrameFormats::push_back(SwFrameFormat* const&)
-SwFrameFormats::~SwFrameFormats()
 SwGammaGrf::Clone(SfxItemPool*) const
 SwGammaGrf::GetPresentation(SfxItemPresentation, MapUnit, MapUnit, 
rtl::OUString&, IntlWrapper const&) const
 SwGammaGrf::PutValue(com::sun::star::uno::Any const&, unsigned char)
@@ -14368,7 +14353,6 @@ 
SwTextBoxHelper::isTextBoxShapeHasValidTextFrame(SwFrameFormat const*)
 SwTextBoxHelper::mapAnchorType(RndStdIds const&)
 SwTextBoxHelper::queryInterface(SwFrameFormat const*, 
com::sun::star::uno::Type const&)
 SwTextBoxHelper::restoreLinks(std::set, 
std::allocator >&, std::vector >&, std::map, std::allocator > >&)
-SwTextBoxHelper::saveLinks(SwFrameFormats const&, std::map, 
std::allocator > >&)
 SwTextBoxHelper::setWrapThrough(SwFrameFormat*)
 SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat&, SfxItemSet const&, 
SdrObject*)
 SwTextBoxHelper::syncProperty(SwFrameFormat*, std::basic_string_view >, com::sun::star::uno::Any const&, SdrObject*)
diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index bdac66f71d72..6af7aa1e9480 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -2976,8 +2976,6 @@ sw/inc/dbgoutsw.hxx:72
 const char * dbg_out(const SwNumRule &)
 sw/inc/dbgoutsw.hxx:73
 const char * dbg_out(const SwTextFormatColl &)
-sw/inc/dbgoutsw.hxx:74
-const char * dbg_out(const SwFrameFormats &)
 sw/inc/dbgoutsw.hxx:75
 const char * dbg_out(const SwNumRuleTable &)
 sw/inc/dbgoutsw.hxx:76
@@ -3012,10 +3010,6 @@ sw/inc/extinput.hxx:48
 const SwExtTextInput * SwExtTextInput::GetPrev() const
 sw/inc/formatcontentcontrol.hxx:82
 SwFormatContentControl * 
SwFormatContentControl::CreatePoolDefault(unsigned short)
-sw/inc/frameformats.hxx:80
-void SwFrameFormats::erase(unsigned long)
-sw/inc/frameformats.hxx:97
-SwFrameFormat *const & SwFrameFormats::back() const
 sw/inc/IDocumentLinksAdministration.hxx:54
 _Bool IDocumentLinksAdministration::GetData(const rtl::OUString &,const 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-04-28 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/doc.hxx  |6 -
 sw/inc/frameformats.hxx |   14 
 sw/inc/frmfmt.hxx   |   52 +++-
 sw/inc/textboxhelper.hxx|7 +-
 sw/qa/core/attr/attr.cxx|4 -
 sw/qa/core/doc/doc.cxx  |   13 +---
 sw/qa/core/draw/draw.cxx|2 
 sw/qa/core/layout/flycnt.cxx|4 -
 sw/qa/core/txtnode/txtnode.cxx  |4 -
 sw/qa/core/undo/undo.cxx|2 
 sw/qa/core/view/view.cxx|6 -
 sw/qa/extras/htmlimport/htmlimport.cxx  |2 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|4 -
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx  |2 
 sw/qa/extras/rtfexport/rtfexport4.cxx   |2 
 sw/qa/extras/uiwriter/uiwriter2.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter5.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter8.cxx |   12 +--
 sw/qa/extras/ww8export/ww8export.cxx|4 -
 sw/qa/filter/html/html.cxx  |8 +-
 sw/qa/filter/ww8/ww8.cxx|4 -
 sw/qa/uibase/docvw/docvw.cxx|4 -
 sw/qa/uibase/uno/uno.cxx|4 -
 sw/source/core/crsr/crstrvl.cxx |5 -
 sw/source/core/doc/CntntIdxStore.cxx|4 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 -
 sw/source/core/doc/DocumentLayoutManager.cxx|   11 +--
 sw/source/core/doc/dbgoutsw.cxx |   13 +---
 sw/source/core/doc/docbasic.cxx |   12 +--
 sw/source/core/doc/doccomp.cxx  |   10 +--
 sw/source/core/doc/docedt.cxx   |   30 -
 sw/source/core/doc/docfly.cxx   |   23 +--
 sw/source/core/doc/docfmt.cxx   |   11 +--
 sw/source/core/doc/doclay.cxx   |   11 +--
 sw/source/core/doc/docnew.cxx   |4 -
 sw/source/core/doc/docsort.cxx  |2 
 sw/source/core/doc/tblcpy.cxx   |2 
 sw/source/core/doc/textboxhelper.cxx|5 -
 sw/source/core/docnode/ndtbl.cxx|3 
 sw/source/core/docnode/node.cxx |   20 ++
 sw/source/core/draw/dcontact.cxx|9 +-
 sw/source/core/frmedt/fecopy.cxx|   12 +--
 sw/source/core/frmedt/fefly1.cxx|6 -
 sw/source/core/frmedt/tblsel.cxx|2 
 sw/source/core/inc/frmtool.hxx  |8 +-
 sw/source/core/inc/rolbck.hxx   |9 +-
 sw/source/core/layout/atrfrm.cxx|   29 ++--
 sw/source/core/layout/frmtool.cxx   |   18 ++---
 sw/source/core/layout/pagechg.cxx   |   29 
 sw/source/core/layout/tabfrm.cxx|6 -
 sw/source/core/layout/wsfrm.cxx |4 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 -
 sw/source/core/text/itratr.cxx  |6 -
 sw/source/core/undo/rolbck.cxx  |   10 +--
 sw/source/core/undo/undel.cxx   |   24 ++-
 sw/source/core/undo/undobj.cxx  |4 -
 sw/source/core/undo/undobj1.cxx |8 +-
 sw/source/core/undo/undraw.cxx  |   28 
 sw/source/core/undo/untbl.cxx   |4 -
 sw/source/core/unocore/unocoll.cxx  |   10 ---
 sw/source/core/unocore/unoobj2.cxx  |9 --
 sw/source/core/view/viewsh.cxx  |9 --
 sw/source/filter/html/htmlforw.cxx  |   10 +--
 sw/source/filter/html/htmlgrin.cxx  |5 -
 sw/source/filter/html/swhtml.cxx|4 -
 sw/source/filter/ww8/wrtw8esh.cxx   |2 
 66 files changed, 290 insertions(+), 324 deletions(-)

New commits:
commit 6fab79859ec97a9153e033fe00fd01e4e46620ce
Author: Bjoern Michaelsen 
AuthorDate: Thu Apr 27 22:57:09 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Apr 28 14:53:45 2023 +0200

Revert "Revert "introduce sw::SpzFrameFormat ...""

apparently, in SwHistoryChangeFlyAnchor::SetInDoc, m_rFormat might
actually reference a DrawFormat, not a FlyFormat, and that is likely
fundamentally broken. But for now, lets just make m_rFormat a

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-04-24 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/doc.hxx  |6 -
 sw/inc/frameformats.hxx |   14 
 sw/inc/frmfmt.hxx   |   52 +++-
 sw/inc/textboxhelper.hxx|7 +-
 sw/qa/core/attr/attr.cxx|4 -
 sw/qa/core/doc/doc.cxx  |   13 +---
 sw/qa/core/draw/draw.cxx|2 
 sw/qa/core/layout/flycnt.cxx|4 -
 sw/qa/core/txtnode/txtnode.cxx  |4 -
 sw/qa/core/undo/undo.cxx|2 
 sw/qa/core/view/view.cxx|6 -
 sw/qa/extras/htmlimport/htmlimport.cxx  |2 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|4 -
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx  |2 
 sw/qa/extras/rtfexport/rtfexport4.cxx   |2 
 sw/qa/extras/uiwriter/uiwriter2.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter5.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter8.cxx |   12 +--
 sw/qa/extras/ww8export/ww8export.cxx|4 -
 sw/qa/filter/html/html.cxx  |8 +-
 sw/qa/filter/ww8/ww8.cxx|4 -
 sw/qa/uibase/docvw/docvw.cxx|4 -
 sw/qa/uibase/uno/uno.cxx|4 -
 sw/source/core/crsr/crstrvl.cxx |5 -
 sw/source/core/doc/CntntIdxStore.cxx|4 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 -
 sw/source/core/doc/DocumentLayoutManager.cxx|   11 +--
 sw/source/core/doc/dbgoutsw.cxx |   13 +---
 sw/source/core/doc/docbasic.cxx |   12 +--
 sw/source/core/doc/doccomp.cxx  |   10 +--
 sw/source/core/doc/docedt.cxx   |   30 -
 sw/source/core/doc/docfly.cxx   |   23 +--
 sw/source/core/doc/docfmt.cxx   |   11 +--
 sw/source/core/doc/doclay.cxx   |   11 +--
 sw/source/core/doc/docnew.cxx   |4 -
 sw/source/core/doc/docsort.cxx  |2 
 sw/source/core/doc/tblcpy.cxx   |2 
 sw/source/core/doc/textboxhelper.cxx|5 -
 sw/source/core/docnode/ndtbl.cxx|3 
 sw/source/core/docnode/node.cxx |   20 ++
 sw/source/core/draw/dcontact.cxx|9 +-
 sw/source/core/frmedt/fecopy.cxx|   12 +--
 sw/source/core/frmedt/fefly1.cxx|6 -
 sw/source/core/frmedt/tblsel.cxx|2 
 sw/source/core/inc/frmtool.hxx  |8 +-
 sw/source/core/layout/atrfrm.cxx|   29 ++--
 sw/source/core/layout/frmtool.cxx   |   18 ++---
 sw/source/core/layout/pagechg.cxx   |   29 
 sw/source/core/layout/tabfrm.cxx|6 -
 sw/source/core/layout/wsfrm.cxx |4 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 -
 sw/source/core/text/itratr.cxx  |6 -
 sw/source/core/undo/rolbck.cxx  |2 
 sw/source/core/undo/undel.cxx   |   24 ++-
 sw/source/core/undo/undobj.cxx  |4 -
 sw/source/core/undo/undobj1.cxx |8 +-
 sw/source/core/undo/undraw.cxx  |   28 
 sw/source/core/undo/untbl.cxx   |4 -
 sw/source/core/unocore/unocoll.cxx  |   10 ---
 sw/source/core/unocore/unoobj2.cxx  |9 --
 sw/source/core/view/viewsh.cxx  |9 --
 sw/source/filter/html/htmlforw.cxx  |   10 +--
 sw/source/filter/html/htmlgrin.cxx  |5 -
 sw/source/filter/html/swhtml.cxx|4 -
 sw/source/filter/ww8/wrtw8esh.cxx   |2 
 65 files changed, 279 insertions(+), 318 deletions(-)

New commits:
commit 09cdcb5f37bb4e42da7b28db6e757b9f2affed14
Author: Bjoern Michaelsen 
AuthorDate: Sat Apr 15 20:51:52 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Mon Apr 24 21:59:04 2023 +0200

introduce sw::SpzFrameFormat ...

- ... as a base class of frame formats allowed into the
  spz frame format container
- with a private ctor and friends SwDrawFrameFormat and SwFlyFrameFormat
  so only these two classes derive from it
- with that, switch over the SpzFrameFormats to only ever allow these
  types into the 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-04-19 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/doc.hxx  |   10 +
 sw/inc/docary.hxx   |1 
 sw/inc/frameformats.hxx |  200 
 sw/inc/frmfmt.hxx   |6 -
 sw/inc/swtblfmt.hxx |3 
 sw/qa/extras/layout/layout3.cxx |2 
 sw/qa/filter/html/html.cxx  |2 
 sw/source/core/doc/docchart.cxx |8 -
 sw/source/core/doc/docfmt.cxx   |   21 ++-
 sw/source/core/doc/docnew.cxx   |2 
 sw/source/core/doc/doctxm.cxx   |3 
 sw/source/core/docnode/ndcopy.cxx   |4 
 sw/source/core/docnode/ndtbl.cxx|8 -
 sw/source/core/edit/edglss.cxx  |2 
 sw/source/core/fields/cellfml.cxx   |4 
 sw/source/core/layout/atrfrm.cxx|   10 -
 sw/source/core/undo/unattr.cxx  |3 
 sw/source/core/unocore/unocoll.cxx  |2 
 sw/source/core/unocore/unostyle.cxx |2 
 sw/source/core/unocore/unotbl.cxx   |4 
 sw/source/uibase/utlui/content.cxx  |   17 +--
 21 files changed, 258 insertions(+), 56 deletions(-)

New commits:
commit b12ff94a771db17843f642a82820b2864bec4744
Author: Bjoern Michaelsen 
AuthorDate: Tue Apr 11 21:20:41 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Thu Apr 20 07:33:22 2023 +0200

introduce sw::FrameFormats<>

- a drop-in replacement for SwFrameFormats
- ... but strongly typed sw::FrameFormats returns
  SwTableFormats
- replace in SwDoc for GetTableFormats

- also: use tags to name indices, lose the references to them as members
- add an explicit Rename() member to allow both SwFrameFormats and
  sw::FrameFormat<> to be updated if a format is rename. This should be
  removed once all SwFrameFormats have been moved to sw::FrameFormats<>.

- Ultimately it seems like a few linear iterations of the table formats
  can be replaced with an index-based accesss by name (in a follow-up).

Change-Id: I1c49d64621104c964c95c6da0c84e01ee7f97028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150243
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index df07fbae0043..1296fbaa866d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -34,6 +34,7 @@
 #include 
 #include "tox.hxx"
 #include "frmfmt.hxx"
+#include "frameformats.hxx"
 #include "charfmt.hxx"
 #include "docary.hxx"
 #include "charformats.hxx"
@@ -163,6 +164,7 @@ namespace sw {
 class DocumentLayoutManager;
 class DocumentStylePoolManager;
 class DocumentExternalDataManager;
+template class FrameFormats;
 class GrammarContact;
 class OnlineAccessibilityCheck;
 }
@@ -248,7 +250,7 @@ class SW_DLLPUBLIC SwDoc final
 std::unique_ptr mpCharFormatTable;
 std::unique_ptrmpSpzFrameFormatTable;
 std::unique_ptr  mpSectionFormatTable;
-std::unique_ptrmpTableFrameFormatTable; //< For tables
+std::unique_ptrmpTableFrameFormatTable; //< For 
tables
 std::unique_ptr mpTextFormatCollTable;   //< 
FormatCollections
 std::unique_ptr  mpGrfFormatCollTable;
 
@@ -819,10 +821,10 @@ public:
 SwGrfFormatColl *pDerivedFrom);
 
 // Table formatting
-const SwFrameFormats* GetTableFrameFormats() const  { return 
mpTableFrameFormatTable.get(); }
-  SwFrameFormats* GetTableFrameFormats(){ return 
mpTableFrameFormatTable.get(); }
+const sw::TableFrameFormats* GetTableFrameFormats() const  { return 
mpTableFrameFormatTable.get(); }
+  sw::TableFrameFormats* GetTableFrameFormats(){ return 
mpTableFrameFormatTable.get(); }
 size_t GetTableFrameFormatCount( bool bUsed ) const;
-SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
+SwTableFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
 SwTableFormat* MakeTableFrameFormat(const OUString , 
SwFrameFormat *pDerivedFrom);
 voidDelTableFrameFormat( SwTableFormat* pFormat );
 SwTableFormat* FindTableFormatByName( const OUString& rName, bool bAll = 
false ) const;
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 98c84cbbd270..64f251957a06 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -49,6 +49,7 @@ public:
 
 // default linear search implementation, some subclasses will override 
with a more efficient search
 virtual SwFormat* FindFormatByName(const OUString& rName) const;
+virtual void Rename(const SwFrameFormat&, const OUString&) {};
 
 SwFormatsBase() = default;
 SwFormatsBase(SwFormatsBase const &) = default;
diff --git a/sw/inc/frameformats.hxx b/sw/inc/frameformats.hxx
index 4e06efe44b04..97c86408e867 100644
--- a/sw/inc/frameformats.hxx
+++ b/sw/inc/frameformats.hxx
@@ -19,12 +19,17 @@
 #pragma once
 
 #include "docary.hxx"
+#include "swtblfmt.hxx"
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+
+class SwFrameFormat;
+class SwTableFormat;
 
 // Like o3tl::find_partialorder_ptrequals

[Libreoffice-commits] core.git: sw/inc sw/source

2023-04-11 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/frmfmt.hxx  |3 --
 sw/inc/hintids.hxx |1 
 sw/inc/section.hxx |2 +
 sw/source/core/docnode/node.cxx|   18 ---
 sw/source/core/docnode/section.cxx |   42 ++---
 sw/source/core/inc/doctxm.hxx  |3 --
 sw/source/core/layout/atrfrm.cxx   |   24 -
 sw/source/core/table/swtable.cxx   |4 ---
 sw/source/uibase/utlui/content.cxx |   10 ++--
 sw/source/uibase/wrtsh/wrtsh1.cxx  |9 +--
 10 files changed, 36 insertions(+), 80 deletions(-)

New commits:
commit b614797a34d25b35c06e20153495795ecfe4e4fe
Author: Bjoern Michaelsen 
AuthorDate: Wed Apr 5 08:28:14 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Tue Apr 11 08:13:17 2023 +0200

introduce SwFrameFormat::IsVisible()

- as a replacement for RES_CONTENT_VISIBLE
- broadly: if a FrameFormat has at least one Frame, it is visible
- however, sections are special and need to recurse into their childs
- SwFlyFrameFormat::GetInfo then does not need to override anymore

Change-Id: I01c469e7330a7daaccd2be0541af1d83c7d1a424
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150038
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index eb97de392d15..ec67847247f8 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -183,6 +183,7 @@ public:
 
 virtual void SetFormatName( const OUString& rNewName, bool 
bBroadcast=false ) override;
 void MoveTableBox(SwTableBox& rTableBox, const SwFrameFormat* pOldFormat);
+virtual bool IsVisible() const;
 };
 
 // The FlyFrame-Format
@@ -219,8 +220,6 @@ public:
 
 virtual Graphic MakeGraphic( ImageMap* pMap = nullptr, const sal_uInt32 
nMaximumQuadraticPixels = 50, const std::optional& rTargetDPI = 
std::nullopt ) override;
 
-virtual bool GetInfo( SfxPoolItem& rInfo ) const override;
-
 OUString GetObjTitle() const;
 void SetObjTitle( const OUString& rTitle, bool bBroadcast = false );
 
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 0673e724552c..0428d5e1258a 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -438,7 +438,6 @@ constexpr TypedWhichId 
RES_VIRTPAGENUM_INFO(180);
 constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181);
 // empty
 constexpr TypedWhichId RES_FINDNEARESTNODE(184);
-constexpr TypedWhichId RES_CONTENT_VISIBLE(185);
 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/section.hxx b/sw/inc/section.hxx
index 9e29e952cdec..f75c68b13f80 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -299,6 +299,8 @@ public:
 // Get information from Format.
 virtual bool GetInfo( SfxPoolItem& ) const override;
 
+virtual bool IsVisible() const override;
+
 SwSection* GetSection() const;
 inline SwSectionFormat* GetParent() const;
 inline SwSection* GetParentSection() const;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 6002830a2525..91ac1697ea30 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1564,31 +1564,23 @@ SwContentNode *SwContentNode::JoinNext()
 return this;
 }
 
+
 /// Get info from Modify
 bool SwContentNode::GetInfo( SfxPoolItem& rInfo ) const
 {
 switch( rInfo.Which() )
 {
-case RES_AUTOFMT_DOCNODE:
-if( () == static_cast(rInfo).pNodes )
-{
-return false;
-}
-break;
-
 case RES_FINDNEARESTNODE:
 if( GetAttr( RES_PAGEDESC ).GetPageDesc() )
 static_cast(rInfo).CheckNode( *this );
 return true;
-
-case RES_CONTENT_VISIBLE:
+case RES_AUTOFMT_DOCNODE:
+if( () == static_cast(rInfo).pNodes )
 {
-static_cast(rInfo).pObject =
-SwIterator(*this).First();
+return false;
 }
-return false;
+break;
 }
-
 return sw::BroadcastingModify::GetInfo( rInfo );
 }
 
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index 46ac8308abd5..bce8f371f9ee 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -810,39 +810,31 @@ void 
SwSectionFormat::SetXTextSection(rtl::Reference const& xTex
 m_wXTextSection = xTextSection.get();
 }
 
+bool SwSectionFormat::IsVisible() const
+{
+if(SwFrameFormat::IsVisible())
+return true;
+SwIterator aFormatIter(*this);
+for(SwSectionFormat* pChild = aFormatIter.First(); pChild; pChild = 
aFormatIter.Next())
+if(pChild->IsVisible())
+return true;
+return false;
+}
+
 // Get info from the Format
-bool SwSectionFormat::GetInfo( SfxPoolItem& rInfo ) const
+bool SwSectionFormat::GetInfo(SfxPoolItem& rInfo) const
 {
-switch( rInfo.Which() )
+if(rInfo.Which() == RES_FINDNEARESTNODE)
 {
-case 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-04-04 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/IDocumentFieldsAccess.hxx |2 +-
 sw/inc/SwUndoField.hxx   |8 
 sw/inc/fmtfld.hxx|2 +-
 sw/inc/hintids.hxx   |1 -
 sw/source/core/doc/DocumentFieldsManager.cxx |   13 +
 sw/source/core/edit/edfld.cxx|6 --
 sw/source/core/inc/DocumentFieldsManager.hxx |2 +-
 sw/source/core/txtnode/atrfld.cxx|   20 
 sw/source/core/undo/SwUndoField.cxx  |7 +++
 sw/source/uibase/docvw/AnnotationWin.cxx |4 ++--
 10 files changed, 25 insertions(+), 40 deletions(-)

New commits:
commit 309469a3863c1ce7a2d463f3a62f5101c39ac89c
Author: Bjoern Michaelsen 
AuthorDate: Mon Apr 3 21:12:14 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Apr 4 11:27:40 2023 +0200

RES_REFMARKFLD_UPDATE no more (lots of zombie code)

- RES_REFMARKFLD_UPDATE is only instantiated in SwEditShell::UpdateOneField
- ... which passes it to DocumentFieldsManager::UpdateField, which
  * puts it in an SwUndoFieldFromDoc into the undo stack
  * and passes it to UpdateTextNode
- SwUndoFieldFromDoc::UpdateField only uses it to pass it back again to
  DocumentFieldsManager::UpdateField
- in UpdateTextNode RES_REFMARKFLD_UPDATE does not trigger any specific
  code

thus:
- replace UpdateTextNode with ForceUpdateTextNode
- remove the message item from the SwUndoFieldFromDoc ctor
- remove the message item as a parameter to
  DocumentFieldsManager::UpdateField as it was only ever used for
  RES_REFMARKFLD_UPDATE
- remove the instantiation in SwEditShell::UpdateOneField
- and finally: remove RES_REFMARKFLD_UPDATE itself

Change-Id: I3f7e27a555a24630d6d5a2c1a40db9096195b826
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150004
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx
index d0bdfe34589b..4664ae3bc846 100644
--- a/sw/inc/IDocumentFieldsAccess.hxx
+++ b/sw/inc/IDocumentFieldsAccess.hxx
@@ -92,7 +92,7 @@ namespace com::sun::star::uno { class Any; }
 @retval true update was successful
 @retval falseelse
 */
-virtual bool UpdateField(SwTextField * rDstFormatField, SwField & 
rSrcField, const SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0;
+virtual bool UpdateField(SwTextField * rDstFormatField, SwField & 
rSrcField, bool bUpdateTableFields) = 0;
 
 virtual void UpdateRefFields() = 0;
 
diff --git a/sw/inc/SwUndoField.hxx b/sw/inc/SwUndoField.hxx
index 95cb676c5de2..dcdc57b0b9bd 100644
--- a/sw/inc/SwUndoField.hxx
+++ b/sw/inc/SwUndoField.hxx
@@ -44,15 +44,15 @@ public:
 class SwUndoFieldFromDoc final : public SwUndoField
 {
 std::unique_ptr m_pOldField, m_pNewField;
-const SwMsgPoolItem * m_pHint;
 bool m_bUpdate;
 
 void DoImpl();
 
 public:
-SwUndoFieldFromDoc(const SwPosition & rPos, const SwField & aOldField,
-   const SwField & aNewField,
-   const SwMsgPoolItem * pHint, bool bUpdate);
+SwUndoFieldFromDoc(const SwPosition& rPos,
+const SwField& aOldField,
+const SwField& aNewField,
+bool bUpdate);
 
 virtual ~SwUndoFieldFromDoc() override;
 
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 4bbd6d4cdf05..6f5811539b17 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -168,7 +168,7 @@ public:
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
 void ForceUpdateTextNode();
-void UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* pNew);
+void UpdateTextNode(const SfxHint& rHint);
 void UpdateDocPos(const SwTwips nDocPos);
 };
 
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 17c1fe545136..0673e724552c 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -432,7 +432,6 @@ constexpr TypedWhichId 
RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN);
 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_AUTOFMT_DOCNODE(176);
 constexpr TypedWhichId RES_HIDDENPARA_PRINT(178);
 constexpr TypedWhichId RES_VIRTPAGENUM_INFO(180);
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index cff26818dd34..c8703e7f06ef 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -491,10 +491,9 @@ void DocumentFieldsManager::PutValueToField(const 
SwPosition & rPos,
 pField->PutValue(rVal, nWhich);
 }
 
-bool DocumentFieldsManager::UpdateField(SwTextField * pDstTextField, SwField & 
rSrcField,
-  const SwMsgPoolItem * pMsgHint,
-  bool bUpdateFields)
+bool 

[Libreoffice-commits] core.git: include/svl sw/inc sw/source

2023-04-04 Thread Bjoern Michaelsen (via logerrit)
 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: sw/inc sw/source

2023-04-01 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/hintids.hxx   |1 -
 sw/source/core/fields/ddefld.cxx |7 ---
 sw/source/core/fields/ddetbl.cxx |   10 +-
 3 files changed, 1 insertion(+), 17 deletions(-)

New commits:
commit 383f70fa9ed0ec7acd6fbc4e921bb5b91fde4689
Author: Bjoern Michaelsen 
AuthorDate: Tue Mar 28 00:39:39 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Sat Apr 1 20:02:38 2023 +0200

RES_UPDATEDDETBL no more

- SwDDETable doesnt handle the hint anymore (it used to do a
  ChangeContent triggered by it)
- SwDDEFieldType::UpdateDDE doesnt create the hint anymore -- it used
  to send it via UpdateTextNode, which would call
  SwTextNode::TriggerNodeUpdate for some types, but not for SwFieldIds::Dde
- ... so the hint sent is never received by anyone who cares

- SwDDEFieldType::UpdateDDE calls ChangeContent on all DDETables
  directly in UpdateDDE anyway, so the dead code is likely just
  obsolete.

Change-Id: I85301ef89998508031833f35c4a2c93e7acb112e

Change-Id: Iaef54e27869947fb7f57d1575e9e0f59f903befd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149656
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index a8418566f5ec..5e84921ec832 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_UPDATEDDETBL(174);
 constexpr TypedWhichId RES_TBLHEADLINECHG(175);
 constexpr TypedWhichId RES_AUTOFMT_DOCNODE(176);
 constexpr TypedWhichId RES_HIDDENPARA_PRINT(178);
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index cf4c93c97122..46ac3d504955 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -315,13 +315,6 @@ void SwDDEFieldType::UpdateDDE(const bool bNotifyShells)
 pSh->StartAction();
 }
 
-// DDE fields attribute in the text
-SwMsgPoolItem aUpdateDDE(RES_UPDATEDDETBL);
-for(auto pFormatField: vFields)
-{
-if(pFormatField->GetTextField())
-pFormatField->UpdateTextNode(nullptr, );
-}
 // a DDE tables in the text
 for(auto pTable: vTables)
 pTable->ChangeContent();
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 01bfa5209dd6..7324c24c5db9 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -87,15 +87,7 @@ void SwDDETable::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
 {
 if (rHint.GetId() == SfxHintId::SwLegacyModify)
 {
-auto pLegacy = static_cast();
-switch(pLegacy->GetWhich())
-{
-case RES_UPDATEDDETBL:
-ChangeContent();
-break;
-default:
-SwTable::SwClientNotify(rModify, rHint);
-}
+SwTable::SwClientNotify(rModify, rHint);
 }
 else if (rHint.GetId() == SfxHintId::SwField)
 {


[Libreoffice-commits] core.git: sw/inc sw/source

2023-03-30 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/IDocumentFieldsAccess.hxx |3 +-
 sw/inc/cellatr.hxx   |   15 +-
 sw/inc/hintids.hxx   |1 
 sw/inc/hints.hxx |2 -
 sw/source/core/attr/cellatr.cxx  |   39 ---
 sw/source/core/attr/hints.cxx|9 +++---
 sw/source/core/doc/DocumentFieldsManager.cxx |   31 ++---
 sw/source/core/docnode/ndtbl.cxx |3 --
 sw/source/core/edit/edtab.cxx|3 --
 sw/source/core/inc/DocumentFieldsManager.hxx |2 -
 sw/source/core/table/swtable.cxx |4 --
 sw/source/core/undo/untbl.cxx|3 --
 sw/source/core/unocore/unotbl.cxx|6 +---
 13 files changed, 39 insertions(+), 82 deletions(-)

New commits:
commit 1bdd92bceb5997d5d0ed27b59734c88f7546a4da
Author: Bjoern Michaelsen 
AuthorDate: Wed Mar 22 23:18:27 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Thu Mar 30 21:49:59 2023 +

SwTableFormulaUpdate: SwMsgPoolItem no more

- get rid of legacy call with unused WhichId (TABLEFML_UPDATE)
- simplify and inlune ChangeSate, by now only handling TBL_CALC
- simplify params for UpdateTableFields (explictly just one SwTable*)

Change-Id: Ie356c2a17eab0b557efb54719d33e278b887eef5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149591
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx
index c31e6a646ed0..d0bdfe34589b 100644
--- a/sw/inc/IDocumentFieldsAccess.hxx
+++ b/sw/inc/IDocumentFieldsAccess.hxx
@@ -38,6 +38,7 @@ class SwMsgPoolItem;
 class DateTime;
 class SetGetExpField;
 class SwNode;
+class SwTable;
 enum class SwFieldIds : sal_uInt16;
 template  class SwHashTable;
 struct HashStr;
@@ -95,7 +96,7 @@ namespace com::sun::star::uno { class Any; }
 
 virtual void UpdateRefFields() = 0;
 
-virtual void UpdateTableFields(SfxPoolItem* pHt) = 0;
+virtual void UpdateTableFields(const SwTable* pTable) = 0;
 
 virtual void UpdateExpFields(SwTextField* pField, bool bUpdateRefFields) = 
0;
 
diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx
index 2d85015a8901..05b1e965ef0b 100644
--- a/sw/inc/cellatr.hxx
+++ b/sw/inc/cellatr.hxx
@@ -26,6 +26,7 @@
 #include "format.hxx"
 #include "hintids.hxx"
 #include "cellfml.hxx"
+#include "node.hxx"
 
 class SwHistory;
 
@@ -75,7 +76,19 @@ public:
 
 void TryBoxNmToPtr();
 void ToSplitMergeBoxNmWithHistory(SwTableFormulaUpdate& rUpdate, 
SwHistory* pHistory);
-void ChangeState( const SfxPoolItem* pItem );
+void ChangeState()
+{
+if(!m_pDefinedIn)
+return;
+// detect table that contains this attribute
+const SwNode* pNd = GetNodeOfFormula();
+if(!pNd) // || >GetNodes() != >GetDoc().GetNodes())
+return;
+const SwTableNode* pTableNd = pNd->FindTableNode();
+if(pTableNd == nullptr)
+return;
+ChgValid(false);
+}
 void Calc( SwTableCalcPara& rCalcPara, double& rValue );
 };
 
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 330b0042b3a9..a8418566f5ec 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_TABLEFML_UPDATE(173);
 constexpr TypedWhichId RES_UPDATEDDETBL(174);
 constexpr TypedWhichId RES_TBLHEADLINECHG(175);
 constexpr TypedWhichId RES_AUTOFMT_DOCNODE(176);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 2b870373dcf1..6b993795c058 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -299,7 +299,7 @@ enum TableFormulaUpdateFlags { TBL_CALC = 0,
  TBL_MERGETBL,
  TBL_SPLITTBL
};
-class SwTableFormulaUpdate final : public SwMsgPoolItem
+class SwTableFormulaUpdate final
 {
 public:
 const SwTable* m_pTable; ///< Pointer to the current table
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index 1c445bb03067..9023cca2f793 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -126,45 +126,6 @@ void 
SwTableBoxFormula::ToSplitMergeBoxNmWithHistory(SwTableFormulaUpdate& rUpda
 pNd->FindTableBoxStartNode()->GetIndex());
 }
 }
-void SwTableBoxFormula::ChangeState( const SfxPoolItem* pItem )
-{
-if( !m_pDefinedIn )
-return ;
-
-SwTableFormulaUpdate* pUpdateField;
-if( !pItem || RES_TABLEFML_UPDATE != pItem->Which() )
-{
-// reset value flag
-ChgValid( false );
-return ;
-}
-
-pUpdateField = const_cast(static_cast(pItem));
-
-// detect table that contains this attribute
-const SwTableNode* pTableNd;
-

[Libreoffice-commits] core.git: sw/inc sw/source

2023-03-27 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/cellatr.hxx   |3 +
 sw/inc/cellfml.hxx   |2 
 sw/inc/swtable.hxx   |3 -
 sw/source/core/attr/cellatr.cxx  |   55 +
 sw/source/core/doc/DocumentFieldsManager.cxx |2 
 sw/source/core/docnode/ndtbl.cxx |   23 ++---
 sw/source/core/table/swtable.cxx |   68 +--
 7 files changed, 80 insertions(+), 76 deletions(-)

New commits:
commit 31690100461d42fd93b9a1a6546b1e17a8d31720
Author: Bjoern Michaelsen 
AuthorDate: Fri Mar 17 00:26:42 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Mar 27 07:15:40 2023 +

refactor table split

Change-Id: Ifd7e77b29205fa505ed2fe41d08b4253f50a99a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149185
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx
index d1de3bbb9136..2d85015a8901 100644
--- a/sw/inc/cellatr.hxx
+++ b/sw/inc/cellatr.hxx
@@ -27,6 +27,8 @@
 #include "hintids.hxx"
 #include "cellfml.hxx"
 
+class SwHistory;
+
 /** The number formatter's default locale's @ Text format.
 Not necessarily system locale, but the locale the formatter was constructed
 with. For this SvNumberFormatter::IsTextFormat() always returns true.
@@ -72,6 +74,7 @@ public:
 { return const_cast(this)->GetTableBox(); }
 
 void TryBoxNmToPtr();
+void ToSplitMergeBoxNmWithHistory(SwTableFormulaUpdate& rUpdate, 
SwHistory* pHistory);
 void ChangeState( const SfxPoolItem* pItem );
 void Calc( SwTableCalcPara& rCalcPara, double& rValue );
 };
diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx
index 16ca387305b8..f99c8f87041b 100644
--- a/sw/inc/cellfml.hxx
+++ b/sw/inc/cellfml.hxx
@@ -109,7 +109,6 @@ protected:
 *rCalcPara.m_pTable,  );
 }
 
-static sal_uInt16 GetLnPosInTable( const SwTable& rTable, const 
SwTableBox* pBox );
 
 public:
 
@@ -146,6 +145,7 @@ public:
 void GetBoxesOfFormula(const SwTable& rTable, SwSelBoxes& rBoxes);
 // are all boxes valid which this formula relies on?
 bool HasValidBoxes() const;
+static sal_uInt16 GetLnPosInTable( const SwTable& rTable, const 
SwTableBox* pBox );
 };
 
 #endif
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index f40059e3c986..3015223ef451 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -176,9 +176,9 @@ private:
 void ConvertSubtableBox(sal_uInt16 const nRow, sal_uInt16 const nBox);
 // Only used for TBL_BOXNAME and TBL_RELBOXNAME for now
 void UpdateFields(TableFormulaUpdateFlags eFlags);
+void GatherFormulas(std::vector& rvFormulas);
 
 public:
-
 SwHTMLTableLayout *GetHTMLTableLayout() { return m_xHTMLLayout.get(); }
 const SwHTMLTableLayout *GetHTMLTableLayout() const { return 
m_xHTMLLayout.get(); }
 void SetHTMLTableLayout(std::shared_ptr const& r);
//Change of property!
@@ -366,6 +366,7 @@ public:
 void SwitchFormulasToInternalRepresentation()
 { UpdateFields(TBL_BOXPTR); }
 void Merge(SwTable& rTable, SwHistory* pHistory);
+void Split(OUString sNewTableName, sal_uInt16 nSplitLine, SwHistory* 
pHistory);
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index 02b2923b9f88..1c445bb03067 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -104,6 +104,28 @@ void SwTableBoxFormula::TryBoxNmToPtr()
 BoxNmToPtr(>GetTable());
 }
 }
+void SwTableBoxFormula::ToSplitMergeBoxNmWithHistory(SwTableFormulaUpdate& 
rUpdate, SwHistory* pHistory)
+{
+if(!pHistory)
+{
+ToSplitMergeBoxNm(rUpdate);
+return;
+}
+auto pNd = GetNodeOfFormula();
+// for a history record the unchanged formula is needed
+SwTableBoxFormula aCopy(*this);
+rUpdate.m_bModified = false;
+ToSplitMergeBoxNm(rUpdate);
+if(rUpdate.m_bModified)
+{
+// external rendering
+aCopy.PtrToBoxNm(>FindTableNode()->GetTable());
+pHistory->Add(
+,
+,
+pNd->FindTableBoxStartNode()->GetIndex());
+}
+}
 void SwTableBoxFormula::ChangeState( const SfxPoolItem* pItem )
 {
 if( !m_pDefinedIn )
@@ -137,40 +159,9 @@ void SwTableBoxFormula::ChangeState( const SfxPoolItem* 
pItem )
 case TBL_BOXPTR:
 case TBL_RELBOXNAME:
 case TBL_BOXNAME:
-assert(false); // PtrToBoxNm, ToRelBoxNm and BoxNmToPtr are all public 
-- use just them directly
-break;
-
 case TBL_SPLITTBL:
-if( >GetTable() == pUpdateField->m_pTable )
-{
-sal_uInt16 nLnPos = SwTableFormula::GetLnPosInTable(
-pTableNd->GetTable(), GetTableBox() );
-pUpdateField->m_bBehindSplitLine = USHRT_MAX != nLnPos &&
-pUpdateField->m_nSplitLine <= 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-03-27 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/swtable.hxx   |1 
 sw/source/core/doc/DocumentFieldsManager.cxx |2 -
 sw/source/core/docnode/ndtbl.cxx |6 
 sw/source/core/table/swtable.cxx |   35 +++
 4 files changed, 38 insertions(+), 6 deletions(-)

New commits:
commit 7c680a96122f7f90114932ef5fdb48328c327268
Author: Bjoern Michaelsen 
AuthorDate: Tue Mar 7 01:28:56 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Mar 27 06:20:28 2023 +

refactor table merge

Change-Id: Ia4d5b3fc04cc032a182b4bf7f7570fc250ed8504
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148739
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 39e54edb2f33..f40059e3c986 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -365,6 +365,7 @@ public:
 { UpdateFields(TBL_RELBOXNAME); };
 void SwitchFormulasToInternalRepresentation()
 { UpdateFields(TBL_BOXPTR); }
+void Merge(SwTable& rTable, SwHistory* pHistory);
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index a395dc352392..3ba8c6314cea 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -602,7 +602,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* 
pHt )
 if(pHt && RES_TABLEFML_UPDATE == pHt->Which())
 pUpdateField = static_cast(pHt);
 assert(!pHt || pUpdateField);
-assert(!pUpdateField || pUpdateField->m_eFlags == TBL_CALC || 
pUpdateField->m_eFlags == TBL_SPLITTBL || pUpdateField->m_eFlags == 
TBL_MERGETBL);
+assert(!pUpdateField || pUpdateField->m_eFlags == TBL_CALC || 
pUpdateField->m_eFlags == TBL_SPLITTBL);
 auto pFieldType = GetFieldType( SwFieldIds::Table, OUString(), false );
 if(pFieldType && (!pUpdateField || pUpdateField->m_eFlags == TBL_CALC))
 {
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 9f0a89ccad51..4526721a3250 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -3471,11 +3471,7 @@ bool SwDoc::MergeTable( const SwPosition& rPos, bool 
bWithPrev )
 }
 
 // Adapt all "TableFormulas"
-SwTableFormulaUpdate aMsgHint( >GetTable() );
-aMsgHint.m_aData.pDelTable = >GetTable();
-aMsgHint.m_eFlags = TBL_MERGETBL;
-aMsgHint.m_pHistory = pHistory.get();
-getIDocumentFieldsAccess().UpdateTableFields(  );
+pTableNd->GetTable().Merge(pDelTableNd->GetTable(), pHistory.get());
 
 // The actual merge
 bool bRet = rNds.MergeTable( bWithPrev ? *pTableNd : *pDelTableNd, 
!bWithPrev );
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 867e76deed1c..96d3b4903255 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -62,6 +62,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef DBG_UTIL
 #define CHECK_TABLE(t) (t).CheckConsistency();
@@ -1613,6 +1614,40 @@ bool SwTable::IsDeleted() const
 return true;
 }
 
+void SwTable::Merge(SwTable& rTable, SwHistory* pHistory)
+{
+SwTableFormulaUpdate aHint(this);
+aHint.m_aData.pDelTable = 
+aHint.m_eFlags = TBL_MERGETBL;
+aHint.m_pHistory = pHistory;
+// process all table box formulas
+for(SfxPoolItem* pItem : 
GetFrameFormat()->GetDoc()->GetAttrPool().GetItemSurrogates(RES_BOXATR_FORMULA))
+{
+auto pBoxFormula = pItem->DynamicWhichCast(RES_BOXATR_FORMULA);
+assert(pBoxFormula);
+if(pBoxFormula->GetDefinedIn())
+{
+const SwNode* pNd = pBoxFormula->GetNodeOfFormula();
+// for a history record the unchanged formula is needed
+SwTableBoxFormula aCopy(*pBoxFormula);
+aHint.m_bModified = false;
+pBoxFormula->ToSplitMergeBoxNm(aHint);
+
+if(aHint.m_bModified)
+{
+// external rendering
+aCopy.PtrToBoxNm(this);
+aHint.m_pHistory->Add(
+,
+,
+pNd->FindTableBoxStartNode()->GetIndex());
+}
+}
+else
+pBoxFormula->ToSplitMergeBoxNm(aHint);
+}
+}
+
 void SwTable::UpdateFields(TableFormulaUpdateFlags eFlags)
 {
 auto pDoc = GetFrameFormat()->GetDoc();


[Libreoffice-commits] core.git: sw/source

2023-03-22 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/doc/DocumentFieldsManager.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 7f4b53b1c7c192ecfef35913133239b670070062
Author: Bjoern Michaelsen 
AuthorDate: Mon Mar 20 00:07:49 2023 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 22 10:58:54 2023 +

UpdateTableFields: stronger assertions

- And use {Static,Dynamic}WhichCast where possible

Change-Id: Ie5097d360ddb0a5cd9980392a9106b9586861001
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149121
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index 3503ba053e68..a395dc352392 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -598,12 +598,11 @@ void DocumentFieldsManager::UpdateRefFields()
 
 void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt )
 {
-OSL_ENSURE( !pHt || RES_TABLEFML_UPDATE  == pHt->Which(),
-"What MessageItem is this?" );
 SwTableFormulaUpdate* pUpdateField = nullptr;
 if(pHt && RES_TABLEFML_UPDATE == pHt->Which())
 pUpdateField = static_cast(pHt);
-assert(!pUpdateField || pUpdateField->m_eFlags != TBL_BOXPTR); // use 
SwTable::SwitchFormulasToInternalRepresentation
+assert(!pHt || pUpdateField);
+assert(!pUpdateField || pUpdateField->m_eFlags == TBL_CALC || 
pUpdateField->m_eFlags == TBL_SPLITTBL || pUpdateField->m_eFlags == 
TBL_MERGETBL);
 auto pFieldType = GetFieldType( SwFieldIds::Table, OUString(), false );
 if(pFieldType && (!pUpdateField || pUpdateField->m_eFlags == TBL_CALC))
 {
@@ -640,7 +639,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* 
pHt )
 }
 
 // all fields/boxes are now invalid, so we can start to calculate
-if(pHt && ( RES_TABLEFML_UPDATE != pHt->Which() || TBL_CALC != 
static_cast(pHt)->m_eFlags))
+if(pHt && pUpdateField->m_eFlags != TBL_CALC)
 return;
 
 std::optional oCalc;
@@ -730,7 +729,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* 
pHt )
 // calculate the formula at the boxes
 for (const SfxPoolItem* pItem : 
m_rDoc.GetAttrPool().GetItemSurrogates(RES_BOXATR_FORMULA))
 {
-auto pFormula = const_cast(dynamic_cast(pItem));
+auto pFormula = 
const_cast(pItem->DynamicWhichCast(RES_BOXATR_FORMULA));
 if(!pFormula || !pFormula->GetDefinedIn() || pFormula->IsValid())
 continue;
 SwTableBox* pBox = pFormula->GetTableBox();


[Libreoffice-commits] core.git: sw/source

2023-03-20 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/doc/DocumentFieldsManager.cxx |  308 ---
 1 file changed, 139 insertions(+), 169 deletions(-)

New commits:
commit 64d1a735b2b371495bfd56faf7070fb3274533ad
Author: Bjoern Michaelsen 
AuthorDate: Sat Mar 4 18:44:28 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Mar 20 21:35:46 2023 +

DocumentFieldsManager::UpdateFields refactoring

- flatten preconditions
- flatten conditionals

Change-Id: I477220d66ff9fb4e05980a978dda8a7fab85caa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148252
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index 6c983e891544..3503ba053e68 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -600,51 +600,28 @@ void DocumentFieldsManager::UpdateTableFields( 
SfxPoolItem* pHt )
 {
 OSL_ENSURE( !pHt || RES_TABLEFML_UPDATE  == pHt->Which(),
 "What MessageItem is this?" );
-
 SwTableFormulaUpdate* pUpdateField = nullptr;
-if( pHt && RES_TABLEFML_UPDATE == pHt->Which() )
+if(pHt && RES_TABLEFML_UPDATE == pHt->Which())
 pUpdateField = static_cast(pHt);
 assert(!pUpdateField || pUpdateField->m_eFlags != TBL_BOXPTR); // use 
SwTable::SwitchFormulasToInternalRepresentation
 auto pFieldType = GetFieldType( SwFieldIds::Table, OUString(), false );
-if(pFieldType)
+if(pFieldType && (!pUpdateField || pUpdateField->m_eFlags == TBL_CALC))
 {
 std::vector vFields;
 pFieldType->GatherFields(vFields);
 for(auto pFormatField : vFields)
 {
+if(!pFormatField->GetTextField()->GetTextNode().FindTableNode())
+continue;
 SwTableField* pField = 
static_cast(pFormatField->GetField());
-if( pUpdateField )
-{
-// table where this field is located
-const SwTableNode* pTableNd;
-const SwTextNode& rTextNd = 
pFormatField->GetTextField()->GetTextNode();
-pTableNd = rTextNd.FindTableNode();
-if (pTableNd == nullptr)
-continue;
-
-switch( pUpdateField->m_eFlags )
-{
-case TBL_CALC:
-// re-set the value flag
-// JP 17.06.96: internal representation of all formulas
-//  (reference to other table!!!)
-if( nsSwExtendedSubType::SUB_CMD & pField->GetSubType() )
-pField->PtrToBoxNm( pUpdateField->m_pTable );
-else
-pField->ChgValid( false );
-break;
-case TBL_BOXPTR:
-case TBL_BOXNAME:
-case TBL_RELBOXNAME:
-assert(false); // use SwTable::SwitchTo...
-break;
-default:
-break;
-}
-}
+// re-set the value flag
+// JP 17.06.96: internal representation of all formulas
+//  (reference to other table!!!)
+if(pUpdateField && nsSwExtendedSubType::SUB_CMD & 
pField->GetSubType())
+pField->PtrToBoxNm(pUpdateField->m_pTable);
 else
 // reset the value flag for all
-pField->ChgValid( false );
+pField->ChgValid(false);
 }
 }
 // process all table box formulas
@@ -663,9 +640,8 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* 
pHt )
 }
 
 // all fields/boxes are now invalid, so we can start to calculate
-if( pHt && ( RES_TABLEFML_UPDATE != pHt->Which() ||
-TBL_CALC != static_cast(pHt)->m_eFlags 
))
-return ;
+if(pHt && ( RES_TABLEFML_UPDATE != pHt->Which() || TBL_CALC != 
static_cast(pHt)->m_eFlags))
+return;
 
 std::optional oCalc;
 
@@ -675,80 +651,79 @@ void DocumentFieldsManager::UpdateTableFields( 
SfxPoolItem* pHt )
 pFieldType->GatherFields(vFields);
 for(SwFormatField* pFormatField: vFields)
 {
-// start calculation at the end
-// new fields are inserted at the beginning of the modify chain
-// that gives faster calculation on import
-// mba: do we really need this "optimization"? Is it still 
valid?
-SwTableField *const 
pField(static_cast(pFormatField->GetField()));
-if (nsSwExtendedSubType::SUB_CMD & pField->GetSubType())
+// start calculation at the end
+// new fields are inserted at the beginning of the modify chain
+// that gives faster calculation on import
+// mba: do we really need this "optimization"? Is it still valid?
+SwTableField *const 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-03-15 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/cellatr.hxx   |1 
 sw/inc/swtable.hxx   |3 +-
 sw/source/core/attr/cellatr.cxx  |   17 +++
 sw/source/core/doc/DocumentFieldsManager.cxx |   20 ++
 sw/source/core/docnode/ndtbl.cxx |   29 +--
 sw/source/core/layout/frmtool.cxx|4 ---
 sw/source/core/table/swtable.cxx |   15 +++--
 sw/source/core/undo/untbl.cxx|   23 -
 8 files changed, 46 insertions(+), 66 deletions(-)

New commits:
commit 7c954d09f70d262d44b2c63fff3376dc89722c60
Author: Bjoern Michaelsen 
AuthorDate: Sat Mar 4 16:51:32 2023 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 15 11:07:23 2023 +

Add SwTable::SwitchFormulasToInternalRepresentation

- and get rid of most of the TBL_BOXPTR stuff it replaces
- instead of using a TBL_BOXPTR on UpdateTableFields
  SwTable::SwitchFormulasToInternalRepresentation should
  be used
- TBL_BOXPTR is not used via UpdateTableFields anymore and
  an assert assures it will never be

Change-Id: I56eca0e339e0d87a60009ea4dd53f4fe96fe639a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148249
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx
index f5d4909fd1b6..d1de3bbb9136 100644
--- a/sw/inc/cellatr.hxx
+++ b/sw/inc/cellatr.hxx
@@ -71,6 +71,7 @@ public:
 const SwTableBox* GetTableBox() const
 { return const_cast(this)->GetTableBox(); }
 
+void TryBoxNmToPtr();
 void ChangeState( const SfxPoolItem* pItem );
 void Calc( SwTableCalcPara& rCalcPara, double& rValue );
 };
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index ee63cf1972e0..39e54edb2f33 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -363,7 +363,8 @@ public:
 { UpdateFields(TBL_BOXNAME); };
 void SwitchFormulasToRelativeRepresentation()
 { UpdateFields(TBL_RELBOXNAME); };
-
+void SwitchFormulasToInternalRepresentation()
+{ UpdateFields(TBL_BOXPTR); }
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index 4e4e9440463f..02b2923b9f88 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -94,6 +94,16 @@ SwTableBox* SwTableBoxFormula::GetTableBox()
 return m_pDefinedIn ? 
static_cast(m_pDefinedIn)->GetTableBox() : nullptr;
 }
 
+void SwTableBoxFormula::TryBoxNmToPtr()
+{
+const SwNode* pNd = GetNodeOfFormula();
+if (!pNd || >GetNodes() != >GetDoc().GetNodes())
+return;
+if(const SwTableNode* pTableNd = pNd->FindTableNode())
+{
+BoxNmToPtr(>GetTable());
+}
+}
 void SwTableBoxFormula::ChangeState( const SfxPoolItem* pItem )
 {
 if( !m_pDefinedIn )
@@ -124,13 +134,10 @@ void SwTableBoxFormula::ChangeState( const SfxPoolItem* 
pItem )
 // reset value flag
 ChgValid( false );
 break;
+case TBL_BOXPTR:
 case TBL_RELBOXNAME:
 case TBL_BOXNAME:
-assert(false); // PtrToBoxNm and ToRelBoxNm are both public -- use 
just them directly
-break;
-case TBL_BOXPTR:
-// internal rendering
-BoxNmToPtr( >GetTable() );
+assert(false); // PtrToBoxNm, ToRelBoxNm and BoxNmToPtr are all public 
-- use just them directly
 break;
 
 case TBL_SPLITTBL:
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index 3ccbbfe00ca4..6c983e891544 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -601,14 +601,15 @@ void DocumentFieldsManager::UpdateTableFields( 
SfxPoolItem* pHt )
 OSL_ENSURE( !pHt || RES_TABLEFML_UPDATE  == pHt->Which(),
 "What MessageItem is this?" );
 
+SwTableFormulaUpdate* pUpdateField = nullptr;
+if( pHt && RES_TABLEFML_UPDATE == pHt->Which() )
+pUpdateField = static_cast(pHt);
+assert(!pUpdateField || pUpdateField->m_eFlags != TBL_BOXPTR); // use 
SwTable::SwitchFormulasToInternalRepresentation
 auto pFieldType = GetFieldType( SwFieldIds::Table, OUString(), false );
 if(pFieldType)
 {
 std::vector vFields;
 pFieldType->GatherFields(vFields);
-SwTableFormulaUpdate* pUpdateField = nullptr;
-if( pHt && RES_TABLEFML_UPDATE == pHt->Which() )
-pUpdateField = static_cast(pHt);
 for(auto pFormatField : vFields)
 {
 SwTableField* pField = 
static_cast(pFormatField->GetField());
@@ -633,11 +634,6 @@ void DocumentFieldsManager::UpdateTableFields( 
SfxPoolItem* pHt )
 pField->ChgValid( false );
 break;
 case TBL_BOXPTR:
-// to the internal representation
-// JP 17.06.96: internal representation on all 

[Libreoffice-commits] core.git: sw/source

2023-03-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/attr/cellatr.cxx |   10 ++
 sw/source/core/undo/rolbck.cxx  |8 ++--
 sw/source/core/undo/untbl.cxx   |4 +---
 3 files changed, 5 insertions(+), 17 deletions(-)

New commits:
commit 8a3dc12a13a3b9e99dbd5000ca6a1d541cf472f7
Author: Bjoern Michaelsen 
AuthorDate: Sat Mar 4 02:18:58 2023 +0100
Commit: Michael Stahl 
CommitDate: Tue Mar 14 10:25:01 2023 +

remove support for TBL_BOXNAME TBL_RELBOXNAME in ChangeState

* PtrToBoxNm and ToRelBoxNm are both public -- use just them directly
  instead.

Change-Id: I7b0e377a13f00a3e0ab90e1cd12325672a83d16f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148213
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index 3fdfb0772c6a..4e4e9440463f 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -124,20 +124,14 @@ void SwTableBoxFormula::ChangeState( const SfxPoolItem* 
pItem )
 // reset value flag
 ChgValid( false );
 break;
+case TBL_RELBOXNAME:
 case TBL_BOXNAME:
-if( >GetTable() == pUpdateField->m_pTable )
-// use external rendering
-PtrToBoxNm( pUpdateField->m_pTable );
+assert(false); // PtrToBoxNm and ToRelBoxNm are both public -- use 
just them directly
 break;
 case TBL_BOXPTR:
 // internal rendering
 BoxNmToPtr( >GetTable() );
 break;
-case TBL_RELBOXNAME:
-if( >GetTable() == pUpdateField->m_pTable )
-// relative rendering
-ToRelBoxNm( pUpdateField->m_pTable );
-break;
 
 case TBL_SPLITTBL:
 if( >GetTable() == pUpdateField->m_pTable )
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 78547546fb08..642e2ed77d62 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -105,9 +105,7 @@ SwHistorySetFormat::SwHistorySetFormat( const SfxPoolItem* 
pFormatHt, SwNodeOffs
 auto pCpyTable = 
const_cast(>GetTable());
 pCpyTable->SwitchFormulasToExternalRepresentation();
 rNew.ChgDefinedIn(rOld.GetDefinedIn());
-SwTableFormulaUpdate aMsgHint(pCpyTable);
-aMsgHint.m_eFlags = TBL_RELBOXNAME;
-rNew.ChangeState();
+rNew.ToRelBoxNm(pCpyTable);
 }
 }
 }
@@ -883,9 +881,7 @@ SwHistorySetAttrSet::SwHistorySetAttrSet( const SfxItemSet& 
rSet,
 auto pCpyTable = 
const_cast(>GetTable());
 
pCpyTable->SwitchFormulasToExternalRepresentation();
 rNew.ChgDefinedIn(rOld.GetDefinedIn());
-SwTableFormulaUpdate aMsgHint(pCpyTable);
-aMsgHint.m_eFlags = TBL_BOXNAME;
-rNew.ChangeState();
+rNew.PtrToBoxNm(pCpyTable);
 }
 }
 }
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index ba3446f3c162..1d135cef7d28 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -919,9 +919,7 @@ sal_uInt16 SaveTable::AddFormat( SwFrameFormat* pFormat, 
bool bIsLine )
 
const_cast(m_pSwTable)->SwitchFormulasToExternalRepresentation();
 SwTableBoxFormula* pFormulaItem = 
const_cast(pItem);
 pFormulaItem->ChgDefinedIn(pFormat);
-SwTableFormulaUpdate aMsgHint(m_pSwTable);
-aMsgHint.m_eFlags = TBL_RELBOXNAME;
-pFormulaItem->ChangeState();
+pFormulaItem->ToRelBoxNm(m_pSwTable);
 pFormulaItem->ChgDefinedIn(nullptr);
 }
 }


[Libreoffice-commits] core.git: sw/inc sw/source

2023-03-02 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/swtable.hxx   |7 
 sw/source/core/doc/DocumentFieldsManager.cxx |   12 +-
 sw/source/core/doc/docsort.cxx   |5 --
 sw/source/core/doc/tblcpy.cxx|   17 +
 sw/source/core/doc/tblrwcl.cxx   |   14 +---
 sw/source/core/docnode/ndtbl.cxx |4 --
 sw/source/core/edit/edtab.cxx|5 --
 sw/source/core/table/swtable.cxx |   47 +++
 sw/source/core/undo/rolbck.cxx   |   21 ++--
 sw/source/core/undo/untbl.cxx|   11 +++---
 10 files changed, 82 insertions(+), 61 deletions(-)

New commits:
commit b9716112219469fa4e0af33a6edb7eec0ff33026
Author: Bjoern Michaelsen 
AuthorDate: Wed Mar 1 23:15:47 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Fri Mar 3 07:55:45 2023 +

Refactor TBL_{REL,}BOXNAME to SwTable

- because those only modify the fields of that one table
- also add lots of const_cast unfortunately, but not because it makes
  things worse:
  * this was modifying the table before (thus non-const)
  * at least now this is a bit more explicit

Change-Id: I0174daecabcc6de9b7c9867b24c94659c0dbcafe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148080
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 3858c55217be..ee63cf1972e0 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -174,6 +174,8 @@ private:
 void NewSetTabCols( Parm , const SwTabCols , const SwTabCols ,
 const SwTableBox *pStart, bool bCurRowOnly );
 void ConvertSubtableBox(sal_uInt16 const nRow, sal_uInt16 const nBox);
+// Only used for TBL_BOXNAME and TBL_RELBOXNAME for now
+void UpdateFields(TableFormulaUpdateFlags eFlags);
 
 public:
 
@@ -357,6 +359,11 @@ public:
 // it doesn't contain box content (except single empty nested tables of 
the boxes
 // which could remain after deletion of text content of the selected table)
 bool IsEmpty() const;
+void SwitchFormulasToExternalRepresentation()
+{ UpdateFields(TBL_BOXNAME); };
+void SwitchFormulasToRelativeRepresentation()
+{ UpdateFields(TBL_RELBOXNAME); };
+
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index 62ed40812160..3ccbbfe00ca4 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -632,23 +632,15 @@ void DocumentFieldsManager::UpdateTableFields( 
SfxPoolItem* pHt )
 else
 pField->ChgValid( false );
 break;
-case TBL_BOXNAME:
-// is this the wanted table?
-if( >GetTable() == pUpdateField->m_pTable )
-// to the external representation
-pField->PtrToBoxNm( pUpdateField->m_pTable );
-break;
 case TBL_BOXPTR:
 // to the internal representation
 // JP 17.06.96: internal representation on all formulas
 //  (reference to other table!!!)
 pField->BoxNmToPtr( >GetTable() );
 break;
+case TBL_BOXNAME:
 case TBL_RELBOXNAME:
-// is this the wanted table?
-if( >GetTable() == pUpdateField->m_pTable )
-// to the relative representation
-pField->ToRelBoxNm( pUpdateField->m_pTable );
+assert(false); // use SwTable::SwitchTo...
 break;
 default:
 break;
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index f4693871c3e3..3601c119bbb3 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -506,10 +506,7 @@ bool SwDoc::SortTable(const SwSelBoxes& rBoxes, const 
SwSortOptions& rOpt)
 nStart = 0;
 }
 
-// Switch to relative Formulas
-SwTableFormulaUpdate aMsgHint( >GetTable() );
-aMsgHint.m_eFlags = TBL_RELBOXNAME;
-getIDocumentFieldsAccess().UpdateTableFields(  );
+pTableNd->GetTable().SwitchFormulasToRelativeRepresentation();
 
 // Table as a flat array structure
 FlatFndBox aFlatBox(this, aFndBox);
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 0343c9c35b27..c39d9c387a3c 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -673,10 +673,7 @@ bool SwTable::InsNewTable( const SwTable& rCpyTable, const 
SwSelBoxes& rSelBoxes
 aTarget.assignBoxes( aCopyStruct );
 
 {
-// Change table formulas into relative representation
-

[Libreoffice-commits] core.git: include/svl svl/source sw/inc sw/IwyuFilter_sw.yaml sw/source

2023-02-25 Thread Bjoern Michaelsen (via logerrit)
 include/svl/hint.hxx |2 +
 svl/source/items/poolitem.cxx|1 
 sw/IwyuFilter_sw.yaml|1 
 sw/inc/fldbas.hxx|2 +
 sw/inc/fmtfld.hxx|2 +
 sw/inc/hintids.hxx   |2 -
 sw/inc/hints.hxx |   33 +++
 sw/inc/ndtxt.hxx |1 
 sw/source/core/attr/hints.cxx|5 
 sw/source/core/doc/DocumentFieldsManager.cxx |4 ---
 sw/source/core/fields/ddefld.cxx |2 -
 sw/source/core/fields/expfld.cxx |   10 +---
 sw/source/core/fields/fldbas.cxx |4 +++
 sw/source/core/text/txtfrm.cxx   |   31 +++--
 sw/source/core/txtnode/atrfld.cxx|   29 ---
 sw/source/core/txtnode/ndtxt.cxx |6 
 16 files changed, 74 insertions(+), 61 deletions(-)

New commits:
commit 0f959ba9e8feef69ac0435795defd5f092147182
Author: Bjoern Michaelsen 
AuthorDate: Mon Feb 20 02:38:11 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sat Feb 25 11:45:06 2023 +

refactor DocPosUpdate, part 2

- separate the message send from the field manager to the fields
  containing no start index from those send from the field to the
  frames containing an index
- use member functions where possible: SwFieldType, SwFormatField,
  SwTextNode

Change-Id: I488e4003b75bf7b0ae700f39e2364d6e34a8bbfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147490
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

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 
 #include "swdllapi.h"
+#include "swtypes.hxx"
 #include "calbck.hxx"
 #include "nodeoffset.hxx"
 
@@ -283,6 +284,7 @@ public:
 void GatherRefFields(std::vector& rvRFields, const 
sal_uInt16 nTyp);
 void GatherFields(std::vector& rvFormatFields, bool 
bCollectOnlyInDocNodes=true) const;
 void GatherDdeTables(std::vector& 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 
 
 #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 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_DOCPOS_UPDATE(172);
 constexpr TypedWhichId RES_TABLEFML_UPDATE(173);
 constexpr TypedWhichId RES_UPDATEDDETBL(174);
 constexpr TypedWhichId RES_TBLHEADLINECHG(175);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 5530ce7922f3..2b870373dcf1 100644
--- 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-02-23 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/IDocumentFieldsAccess.hxx |3 ++-
 sw/source/core/doc/DocumentFieldsManager.cxx |   12 +++-
 sw/source/core/inc/DocumentFieldsManager.hxx |2 +-
 sw/source/core/layout/newfrm.cxx |3 +--
 sw/source/core/layout/pagechg.cxx|9 +++--
 sw/source/core/layout/tabfrm.cxx |3 +--
 sw/source/core/layout/wsfrm.cxx  |3 +--
 sw/source/core/view/viewsh.cxx   |3 +--
 8 files changed, 17 insertions(+), 21 deletions(-)

New commits:
commit b4b3f281443fc64b420156eed11af773f80a4e2a
Author: Bjoern Michaelsen 
AuthorDate: Sun Feb 19 17:45:41 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Fri Feb 24 07:33:59 2023 +

Use just plain straight-forward params for UpdatePageFields

- dont wrap parameters in a useless hint as superfluous indirection
- note: SwDocPosUpdate receives a special kind of abuse here:
  * it is used as pNew with pOld being nullptr when send to the
document field manager
  * it is sneakily modified to be the pOld when it is forwarded by
the field to the frame via the node
- full path of the message before this change:
  -> passed to the UpdatePageFields as parameter
  -> wrapped as the pNew there and send to the field types
  -> passed by the fieldtypes to the fields
  -> tweaked to be the pOld with pNew being the field itselfby the
 fields when passed from the field to the node
  -> passed from the node to the frames

Change-Id: I084c3a1abe6871abdb82655cc413902dd16071cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147302
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx
index ee3e2536b921..c31e6a646ed0 100644
--- a/sw/inc/IDocumentFieldsAccess.hxx
+++ b/sw/inc/IDocumentFieldsAccess.hxx
@@ -23,6 +23,7 @@
 
 #include 
 #include 
+#include "swtypes.hxx"
 #include "nodeoffset.hxx"
 
 class SwFieldTypes;
@@ -100,7 +101,7 @@ namespace com::sun::star::uno { class Any; }
 
 virtual void UpdateUsrFields() = 0;
 
-virtual void UpdatePageFields(SfxPoolItem*) = 0;
+virtual void UpdatePageFields(const SwTwips) = 0;
 
 virtual void LockExpFields() = 0;
 
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index 79852fa52ce0..4d6486bca262 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1335,18 +1335,20 @@ sal_Int32 
DocumentFieldsManager::GetRecordsPerDocument() const
 return nRecords;
 }
 
-void DocumentFieldsManager::UpdatePageFields( SfxPoolItem* pMsgHint )
+void DocumentFieldsManager::UpdatePageFields(const SwTwips nDocPos)
 {
-for( SwFieldTypes::size_type i = 0; i < INIT_FLDTYPES; ++i )
+SwDocPosUpdate aDosPosUpdate(nDocPos);
+sw::LegacyModifyHint aHint(nullptr, );
+for(SwFieldTypes::size_type i = 0; i < INIT_FLDTYPES; ++i)
 {
-SwFieldType* pFieldType = (*mpFieldTypes)[ i ].get();
-switch( pFieldType->Which() )
+SwFieldType* pFieldType = (*mpFieldTypes)[i].get();
+switch(pFieldType->Which())
 {
 case SwFieldIds::PageNumber:
 case SwFieldIds::Chapter:
 case SwFieldIds::GetExp:
 case SwFieldIds::RefPageGet:
-pFieldType->CallSwClientNotify(sw::LegacyModifyHint(nullptr, 
pMsgHint));
+pFieldType->CallSwClientNotify(aHint);
 break;
 case SwFieldIds::DocStat:
 pFieldType->CallSwClientNotify(sw::LegacyModifyHint(nullptr, 
nullptr));
diff --git a/sw/source/core/inc/DocumentFieldsManager.hxx 
b/sw/source/core/inc/DocumentFieldsManager.hxx
index 2b661604b8de..0f1aede584cb 100644
--- a/sw/source/core/inc/DocumentFieldsManager.hxx
+++ b/sw/source/core/inc/DocumentFieldsManager.hxx
@@ -48,7 +48,7 @@ public:
 virtual void UpdateTableFields(SfxPoolItem* pHt) override;
 virtual void UpdateExpFields(SwTextField* pField, bool bUpdateRefFields) 
override;
 virtual void UpdateUsrFields() override;
-virtual void UpdatePageFields(SfxPoolItem*) override;
+virtual void UpdatePageFields(const SwTwips) override;
 virtual void LockExpFields() override;
 virtual void UnlockExpFields() override;
 virtual bool IsExpFieldsLocked() const override;
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 5ca11e34138b..95af08baa6e3 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -512,8 +512,7 @@ void SwRootFrame::Init( SwFrameFormat* pFormat )
 //b6433357: Update page fields after loading
 if ( !mpCurrShell || !mpCurrShell->Imp()->IsUpdateExpFields() )
 {
-SwDocPosUpdate aMsgHint( pPage->getFrameArea().Top() );
-rFieldsAccess.UpdatePageFields(  );
+rFieldsAccess.UpdatePageFields(pPage->getFrameArea().Top());
 }
 
 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-02-23 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/fmtfld.hxx|1 
 sw/inc/usrfld.hxx|1 
 sw/source/core/doc/DocumentFieldsManager.cxx |4 
 sw/source/core/doc/docfld.cxx|4 
 sw/source/core/fields/docufld.cxx|2 
 sw/source/core/fields/usrfld.cxx |8 +
 sw/source/core/txtnode/atrfld.cxx|  173 +++
 sw/source/core/unocore/unofield.cxx  |2 
 8 files changed, 117 insertions(+), 78 deletions(-)

New commits:
commit a10d0ce37be8a9f7fe4270d8b4d61567a9418c24
Author: Bjoern Michaelsen 
AuthorDate: Sat Feb 18 00:30:09 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Thu Feb 23 10:35:13 2023 +

refactor SwFormatField again

- strip out some helper functions
- split of the "forced update" special case
- extract ensuring user fields to be valid

Change-Id: Iee9aa5b25ab7d8e7c102f0c0950c47a46966bb19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147269
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 5807ed8fba70..1efb7665c953 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -166,6 +166,7 @@ public:
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
+void ForceUpdateTextNode();
 void UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* pNew);
 };
 
diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
index d9ea9e407440..faedb80671a8 100644
--- a/sw/inc/usrfld.hxx
+++ b/sw/inc/usrfld.hxx
@@ -69,6 +69,7 @@ public:
 
 virtual voidQueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) 
const override;
 virtual voidPutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) 
override;
+void EnsureValid();
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
 private:
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index 0c5bcfb375d6..79852fa52ce0 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1264,7 +1264,7 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
 pInputField->UnlockNotifyContentChange();
 }
 });
-pFormatField->UpdateTextNode(nullptr, nullptr); // trigger 
formatting
+pFormatField->ForceUpdateTextNode();
 }
 
 if (pUpdateField == pTextField) // if only this one is updated
@@ -1519,7 +1519,7 @@ void DocumentFieldsManager::SetFixFields( const DateTime* 
pNewDateTime )
 
 // Trigger formatting
 if( bChgd )
-pFormatField->UpdateTextNode(nullptr, nullptr);
+pFormatField->ForceUpdateTextNode();
 }
 }
 }
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 5cae8a66f8ee..45feaca8d581 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -984,7 +984,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int 
eGetMode )
 
 sFormula.clear();
 // trigger formatting
-
const_cast(pFormatField)->UpdateTextNode( nullptr, nullptr );
+
const_cast(pFormatField)->ForceUpdateTextNode();
 }
 break;
 
@@ -1004,7 +1004,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int 
eGetMode )
 // evaluate field
 const_cast(static_cast(pField))->Evaluate(rDoc);
 // trigger formatting
-
const_cast(pFormatField)->UpdateTextNode(nullptr, nullptr);
+
const_cast(pFormatField)->ForceUpdateTextNode();
 }
 break;
 
diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index 28d239de2a1e..e604985e7d0f 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2363,7 +2363,7 @@ void SwRefPageGetFieldType::UpdateField( SwTextField 
const * pTextField,
 }
 }
 // start formatting
-
const_cast(pTextField->GetFormatField()).UpdateTextNode(nullptr,
 nullptr);
+
const_cast(pTextField->GetFormatField()).ForceUpdateTextNode();
 }
 
 // queries for relative page numbering
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 0067d3b6d7c4..33a5e7096dc4 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -371,6 +371,14 @@ void SwUserFieldType::PutValue( const uno::Any& rAny, 
sal_uInt16 nWhichId )
 }
 }
 
+void SwUserFieldType::EnsureValid()
+{
+if(IsValid())
+return;
+SwCalc aCalc(*GetDoc());
+GetValue(aCalc);
+}
+
 void SwUserFieldType::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 

[Libreoffice-commits] core.git: include/svl sw/inc sw/source

2023-02-21 Thread Bjoern Michaelsen (via logerrit)
 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: sw/source

2023-02-19 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/doc/acmplwrd.cxx |   51 +++-
 1 file changed, 35 insertions(+), 16 deletions(-)

New commits:
commit 0b44a7760dc2093564bbded0afce6c749dd307ae
Author: Bjoern Michaelsen 
AuthorDate: Thu Feb 16 08:18:50 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sun Feb 19 17:45:41 2023 +

SwAutoCompleteClient: SwClient no more

Change-Id: Id6e13fdf037bd1a910ecd127344b46393a190d55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147138
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index d566f188d7cc..38011750bd29 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-class SwAutoCompleteClient : public SwClient
+class SwAutoCompleteClient : public SvtListener
 {
 SwAutoCompleteWord* m_pAutoCompleteWord;
 SwDoc*  m_pDoc;
@@ -54,7 +54,9 @@ public:
 static sal_uLong GetElementCount() {return s_nSwAutoCompleteClientCount;}
 #endif
 protected:
-virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
+virtual void Notify(const SfxHint&) override;
+private:
+void DocumentDying();
 };
 
 class SwAutoCompleteWord_Impl
@@ -96,18 +98,18 @@ 
SwAutoCompleteClient::SwAutoCompleteClient(SwAutoCompleteWord& rToTell, SwDoc& r
 m_pAutoCompleteWord(),
 m_pDoc()
 {
-
m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+
StartListening(m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier());
 #if OSL_DEBUG_LEVEL > 0
 ++s_nSwAutoCompleteClientCount;
 #endif
 }
 
 SwAutoCompleteClient::SwAutoCompleteClient(const SwAutoCompleteClient& 
rClient) :
-SwClient(),
+SvtListener(),
 m_pAutoCompleteWord(rClient.m_pAutoCompleteWord),
 m_pDoc(rClient.m_pDoc)
 {
-
m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+
StartListening(m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier());
 #if OSL_DEBUG_LEVEL > 0
 ++s_nSwAutoCompleteClientCount;
 #endif
@@ -126,21 +128,38 @@ SwAutoCompleteClient& 
SwAutoCompleteClient::operator=(const SwAutoCompleteClient
 {
 m_pAutoCompleteWord = rClient.m_pAutoCompleteWord;
 m_pDoc = rClient.m_pDoc;
-StartListeningToSameModifyAs(rClient);
+CopyAllBroadcasters(rClient);
 return *this;
 }
 
-void SwAutoCompleteClient::SwClientNotify(const SwModify&, const SfxHint& 
rHint)
+void SwAutoCompleteClient::DocumentDying()
 {
-if (rHint.GetId() != SfxHintId::SwLegacyModify)
-return;
-auto pLegacy = static_cast();
-switch(pLegacy->GetWhich())
+EndListeningAll();
+m_pAutoCompleteWord->DocumentDying(*m_pDoc);
+}
+
+void SwAutoCompleteClient::Notify(const SfxHint& rHint)
+{
+switch(rHint.GetId())
 {
-case RES_REMOVE_UNO_OBJECT:
-case RES_OBJECTDYING:
-EndListeningAll();
-m_pAutoCompleteWord->DocumentDying(*m_pDoc);
+case SfxHintId::Dying:
+DocumentDying();
+return;
+case SfxHintId::SwLegacyModify:
+{
+auto pLegacy = static_cast();
+switch(pLegacy->GetWhich())
+{
+case RES_REMOVE_UNO_OBJECT:
+case RES_OBJECTDYING:
+DocumentDying();
+return;
+default:
+return;
+}
+}
+default:
+return;
 }
 }
 


[Libreoffice-commits] core.git: sw/inc sw/source

2023-02-15 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/hintids.hxx |   12 
 sw/source/core/crsr/crsrsh.cxx |9 +
 2 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit 94eea5aed7b3a0bea2b41e4a9e0b677cf495d2c8
Author: Bjoern Michaelsen 
AuthorDate: Tue Feb 14 22:08:44 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Wed Feb 15 21:50:11 2023 +

dont use RES_MSG_{BEGIN,END} outside hintids.hxx

Change-Id: Iee08120ec4ebfd39f03a949f4a759eaa415ca894
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147029
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 4766d0799375..1119ca70dc8e 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -417,8 +417,8 @@ constexpr TypedWhichId 
RES_CONDTXTFMTCOLL(160);
 constexpr sal_uInt16 RES_FMT_END(161);
 
 // ID's for Messages in the Formats
-constexpr sal_uInt16 RES_MSG_BEGIN(RES_FMT_END);
-constexpr TypedWhichId RES_OBJECTDYING(RES_MSG_BEGIN); // 161
+constexpr sal_uInt16 RES_FORMAT_MSG_BEGIN(RES_FMT_END);
+constexpr TypedWhichId 
RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN); // 161
 constexpr TypedWhichId RES_FMT_CHG(162);
 constexpr TypedWhichId RES_ATTRSET_CHG(163);
 constexpr TypedWhichId RES_UPDATE_ATTR(167);
@@ -436,13 +436,13 @@ 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_MSG_END(190);
+constexpr sal_uInt16 RES_FORMAT_MSG_END(190);
 
 // An ID for the RTF-reader. The stylesheets are treated like attributes,
 // i.e. there is a StyleSheet-attribute. To avoid collision with other
 // Which()-values, the value is listed here. (The help system too defines
 // new attributes!)
-constexpr sal_uInt16 RES_FLTRATTR_BEGIN(RES_MSG_END);
+constexpr sal_uInt16 RES_FLTRATTR_BEGIN(RES_FORMAT_MSG_END);
 constexpr TypedWhichId RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN);
 constexpr TypedWhichId RES_FLTR_ANCHOR(191);
 constexpr TypedWhichId RES_FLTR_NUMRULE(192);
@@ -508,6 +508,10 @@ inline bool isUNKNOWNATR(const sal_uInt16 nWhich)
 {
 return (RES_UNKNOWNATR_BEGIN <= nWhich) && (RES_UNKNOWNATR_END > nWhich);
 }
+inline bool isFormatMessage(const sal_uInt16 nWhich)
+{
+return (RES_FORMAT_MSG_BEGIN <= nWhich) && (RES_FORMAT_MSG_END > nWhich);
+}
 
 // Take the respective default attribute from the statistical default
 // attributes table over the Which-value.
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 6aef2801b0b7..132a3cd7c9db 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2525,11 +2525,12 @@ void SwCursorShell::SwClientNotify(const SwModify&, 
const SfxHint& rHint)
 auto pLegacy = static_cast();
 auto nWhich = pLegacy->GetWhich();
 if(!nWhich)
-nWhich = sal::static_int_cast(RES_MSG_BEGIN);
+nWhich = RES_OBJECTDYING;
 if( m_bCallChgLnk &&
-( nWhich < RES_MSG_BEGIN || nWhich >= RES_MSG_END ||
-nWhich == RES_FMT_CHG || nWhich == RES_UPDATE_ATTR ||
-nWhich == RES_ATTRSET_CHG ))
+( !isFormatMessage(nWhich)
+|| nWhich == RES_FMT_CHG
+|| nWhich == RES_UPDATE_ATTR
+|| nWhich == RES_ATTRSET_CHG ))
 // messages are not forwarded
 // #i6681#: RES_UPDATE_ATTR is implicitly unset in
 // SwTextNode::Insert(SwTextHint*, sal_uInt16); we react here and thus 
do


[Libreoffice-commits] core.git: compilerplugins/clang svl/source sw/inc sw/source

2023-02-15 Thread Bjoern Michaelsen (via logerrit)
 compilerplugins/clang/unusedmethods.results  |2 --
 svl/source/items/poolitem.cxx|1 -
 sw/inc/IDocumentFieldsAccess.hxx |2 +-
 sw/inc/SwUndoField.hxx   |4 ++--
 sw/inc/hintids.hxx   |3 +--
 sw/inc/hints.hxx |   15 ---
 sw/source/core/attr/hints.cxx|7 ---
 sw/source/core/doc/DocumentFieldsManager.cxx |2 +-
 sw/source/core/edit/edfld.cxx|   25 -
 sw/source/core/inc/DocumentFieldsManager.hxx |2 +-
 sw/source/core/undo/SwUndoField.cxx  |2 +-
 11 files changed, 23 insertions(+), 42 deletions(-)

New commits:
commit 4f4f2f0502881fc1a26c600e84c94c62808169eb
Author: Bjoern Michaelsen 
AuthorDate: Tue Feb 14 23:38:29 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Wed Feb 15 18:56:41 2023 +

clean up SwRefMarkFieldUpdate a bit

- remove SwRefMarkFieldUpdate:
  * it has only one unused field
  * replace with a plain SwPtrMsgPoolItem
- hint constness:
  * SwUndoFieldFromDoc: make ctor arg hint const
  * DocumentFieldsManager: make UpdateField arg hint const
  * however, seeing this hint is:
a/ constructed on the stack, but
b/ stored as pointer in undo
likely it would be best to remove it altogether. For now, make it at
least static, so that there is no use after free.

Change-Id: Ica51a2a2ce19e1938c3a367e9b4a9e01bbb75374
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147030
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 1c4f2a4119dd..bdac66f71d72 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1762,8 +1762,6 @@ include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
-include/svl/typedwhich.hxx:31
- TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 225678340a1c..cac0e80a3a6f 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 SwRefMarkFieldUpdate : public SwMsgPoolItem
 // class SwDocPosUpdate : public SwMsgPoolItem
 // class SwTableFormulaUpdate : public SwMsgPoolItem
 // class SwAutoFormatGetDocNode: public SwMsgPoolItem
diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx
index 237af065ae7c..ee3e2536b921 100644
--- a/sw/inc/IDocumentFieldsAccess.hxx
+++ b/sw/inc/IDocumentFieldsAccess.hxx
@@ -90,7 +90,7 @@ namespace com::sun::star::uno { class Any; }
 @retval true update was successful
 @retval falseelse
 */
-virtual bool UpdateField(SwTextField * rDstFormatField, SwField & 
rSrcField, SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0;
+virtual bool UpdateField(SwTextField * rDstFormatField, SwField & 
rSrcField, const SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0;
 
 virtual void UpdateRefFields() = 0;
 
diff --git a/sw/inc/SwUndoField.hxx b/sw/inc/SwUndoField.hxx
index 5c12c50356ce..95cb676c5de2 100644
--- a/sw/inc/SwUndoField.hxx
+++ b/sw/inc/SwUndoField.hxx
@@ -44,7 +44,7 @@ public:
 class SwUndoFieldFromDoc final : public SwUndoField
 {
 std::unique_ptr m_pOldField, m_pNewField;
-SwMsgPoolItem * m_pHint;
+const SwMsgPoolItem * m_pHint;
 bool m_bUpdate;
 
 void DoImpl();
@@ -52,7 +52,7 @@ class SwUndoFieldFromDoc final : public SwUndoField
 public:
 SwUndoFieldFromDoc(const SwPosition & rPos, const SwField & aOldField,
const SwField & aNewField,
-   SwMsgPoolItem * pHint, bool bUpdate);
+   const SwMsgPoolItem * pHint, bool bUpdate);
 
 virtual ~SwUndoFieldFromDoc() override;
 
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 891815c3cd1a..4766d0799375 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -134,7 +134,6 @@ class SwTableBoxNumFormat;
 class SwTextGridItem;
 class SwTransparencyGrf;
 class SwFormatRuby;
-class SwRefMarkFieldUpdate;
 class SwTableFormulaUpdate;
 class SwAutoFormatGetDocNode;
 class SwVirtPageNumInfo;
@@ -423,7 +422,7 @@ constexpr TypedWhichId 
RES_OBJECTDYING(RES_MSG_BEGIN); // 161
 constexpr TypedWhichId RES_FMT_CHG(162);
 constexpr TypedWhichId 

[Libreoffice-commits] core.git: include/svl sw/inc sw/source

2023-02-15 Thread Bjoern Michaelsen (via logerrit)
 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: sw/source

2023-02-15 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/node.cxx |   13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

New commits:
commit ef0d23e6b7a8330e070c93a59c33b0ce4a8896d5
Author: Bjoern Michaelsen 
AuthorDate: Tue Feb 14 00:47:59 2023 +0100
Commit: Michael Stahl 
CommitDate: Wed Feb 15 10:41:46 2023 +

SwContentNode: assert on dead code

Change-Id: Id094b0c244a55581fe3db1773788b4dd31698a24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146963
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index c50435e076fb..6002830a2525 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1143,15 +1143,10 @@ void SwContentNode::SwClientNotify( const SwModify&, 
const SfxHint& rHint)
 // Do not mangle pointers if it is the upper-most format!
 if(pFormat && GetRegisteredIn() == pFormat)
 {
-if(pFormat->GetRegisteredIn())
-{
-// If Parent, register anew in the new Parent
-pFormat->GetRegisteredIn()->Add(this);
-pFormatColl = GetFormatColl();
-}
-else
-EndListeningAll();
-bSetParent = true;
+// As ~SwFormat calls CheckRegistrationFormat before
+// ~SwModify, which sends the RES_OBJECTDYING, we 
should never
+// reach this point.
+assert(false);
 }
 }
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/fields/docufld.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 77f447190396ca9b1bd77e3cf3b99f24116049ef
Author: Bjoern Michaelsen 
AuthorDate: Sat Feb 11 23:52:01 2023 +0100
Commit: Michael Stahl 
CommitDate: Tue Feb 14 14:49:21 2023 +

tdf#134283: MakeSetList should iterate Setters, not Getters

Change-Id: I811a3b562ead942c98705da29774b77c593eabc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146828
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 75a863ee7fea133ae6bcd010d1aac46815fa49e2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146978

diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index 289061a283e5..45793b4928bf 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2227,7 +2227,7 @@ bool SwRefPageGetFieldType::MakeSetList(SetGetExpFields& 
rTmpLst,
 {
 IDocumentRedlineAccess const& rIDRA(m_rDoc.getIDocumentRedlineAccess());
 std::vector vFields;
-GatherFields(vFields);
+
m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::RefPageSet)->GatherFields(vFields);
 for(auto pFormatField: vFields)
 {
 // update only the GetRef fields


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source

2023-02-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/fields/docufld.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 24c05688ad0db805196765a409c49f9ac6f2b6e7
Author: Bjoern Michaelsen 
AuthorDate: Sat Feb 11 23:52:01 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Feb 14 13:21:55 2023 +

tdf#134283: MakeSetList should iterate Setters, not Getters

Change-Id: I811a3b562ead942c98705da29774b77c593eabc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146828
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 75a863ee7fea133ae6bcd010d1aac46815fa49e2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146977
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index 2015216f2a91..dffc35132fca 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2224,7 +2224,7 @@ bool SwRefPageGetFieldType::MakeSetList(SetGetExpFields& 
rTmpLst,
 {
 IDocumentRedlineAccess const& rIDRA(m_rDoc.getIDocumentRedlineAccess());
 std::vector vFields;
-GatherFields(vFields);
+
m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::RefPageSet)->GatherFields(vFields);
 for(auto pFormatField: vFields)
 {
 // update only the GetRef fields


[Libreoffice-commits] core.git: sw/source

2023-02-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/fields/docufld.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 75a863ee7fea133ae6bcd010d1aac46815fa49e2
Author: Bjoern Michaelsen 
AuthorDate: Sat Feb 11 23:52:01 2023 +0100
Commit: Michael Stahl 
CommitDate: Tue Feb 14 10:12:00 2023 +

tdf#134283: MakeSetList should iterate Setters, not Getters

Change-Id: I811a3b562ead942c98705da29774b77c593eabc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146828
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index 09ffdc4437e3..28d239de2a1e 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2271,7 +2271,7 @@ bool SwRefPageGetFieldType::MakeSetList(SetGetExpFields& 
rTmpLst,
 {
 IDocumentRedlineAccess const& rIDRA(m_rDoc.getIDocumentRedlineAccess());
 std::vector vFields;
-GatherFields(vFields);
+
m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::RefPageSet)->GatherFields(vFields);
 for(auto pFormatField: vFields)
 {
 // update only the GetRef fields


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source

2022-10-04 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/node.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 84fde6fb3151aae8506fc66554a4fa2983127e87
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 25 04:34:54 2022 +0200
Commit: Caolán McNamara 
CommitDate: Tue Oct 4 14:57:34 2022 +0200

tdf#144939: fix chapter numbering updates

Change-Id: Icd29a380663a1c5f70e3a8ee86db64ec4eae8d86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140558
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 
(cherry picked from commit 2aed71fa9e8a36ff2dc9f48897092c26ab89ea9e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140594
Reviewed-by: Michael Stahl 
(cherry picked from commit cb43334ee9938d7b8e250f9ddbdc81e53779f8d0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140883
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 12be064f370b..8a319c03e7aa 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1266,7 +1266,7 @@ SwFormatColl *SwContentNode::ChgFormatColl( SwFormatColl 
*pNewColl )
 ChkCondColl(static_cast(pNewColl));
 SwFormatChg aTmp1( pOldColl );
 SwFormatChg aTmp2( pNewColl );
-SwClientNotify( *this, sw::LegacyModifyHint(, ) );
+CallSwClientNotify( sw::LegacyModifyHint(, ) );
 }
 }
 InvalidateInSwCache(RES_ATTRSET_CHG);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-09-26 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/node.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cb43334ee9938d7b8e250f9ddbdc81e53779f8d0
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 25 04:34:54 2022 +0200
Commit: Michael Stahl 
CommitDate: Mon Sep 26 15:16:22 2022 +0200

tdf#144939: fix chapter numbering updates

Change-Id: Icd29a380663a1c5f70e3a8ee86db64ec4eae8d86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140558
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 
(cherry picked from commit 2aed71fa9e8a36ff2dc9f48897092c26ab89ea9e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140594
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 444e6dda6613..d95b18ceeded 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1257,7 +1257,7 @@ SwFormatColl *SwContentNode::ChgFormatColl( SwFormatColl 
*pNewColl )
 ChkCondColl(static_cast(pNewColl));
 SwFormatChg aTmp1( pOldColl );
 SwFormatChg aTmp2( pNewColl );
-SwClientNotify( *this, sw::LegacyModifyHint(, ) );
+CallSwClientNotify( sw::LegacyModifyHint(, ) );
 }
 }
 InvalidateInSwCache(RES_ATTRSET_CHG);


[Libreoffice-commits] core.git: include/svl sw/inc sw/source

2022-09-26 Thread Bjoern Michaelsen (via logerrit)
 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: compilerplugins/clang include/svl svl/source sw/inc sw/source

2022-09-25 Thread Bjoern Michaelsen (via logerrit)
 compilerplugins/clang/unusedmethods.results |2 -
 include/svl/hint.hxx|1 
 svl/source/items/poolitem.cxx   |1 
 sw/inc/hintids.hxx  |2 -
 sw/inc/hints.hxx|   15 
 sw/source/core/attr/hints.cxx   |   10 ++---
 sw/source/core/text/txtfrm.cxx  |   47 ++--
 sw/source/core/txtnode/ndtxt.cxx|   13 +++
 8 files changed, 45 insertions(+), 46 deletions(-)

New commits:
commit eb1294a60783ceb450cefd6891d6eafa0021aadc
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 25 11:34:10 2022 +0200
Commit: Bjoern Michaelsen 
CommitDate: Sun Sep 25 20:01:53 2022 +0200

unwrap SwDelChr to plain SfxHint

Change-Id: Ief37a8025181b6cc8a6e484e2726d8a8d92f57ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140567
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index be732177c36b..524af6ade80c 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1592,8 +1592,6 @@ include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
-include/svl/typedwhich.hxx:31
- TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 4b4677cd768d..22f0bb8eb7e2 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -142,6 +142,7 @@ enum class SfxHintId {
 SwNameChanged, // this can possibly be replaced by the generic NameChanged 
above
 SwInsertText,
 SwDeleteText,
+SwDeleteChar,
 
 ThisIsAnSdrHint
 };
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 32dfebb51747..225678340a1c 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -434,7 +434,6 @@
 // class SwMsgPoolItem : public SfxPoolItem
 // class SwPtrMsgPoolItem : public SwMsgPoolItem
 // class SwFormatChg: public SwMsgPoolItem
-// class SwDelChr: public SwMsgPoolItem
 // class SwUpdateAttr : public SwMsgPoolItem
 // class SwRefMarkFieldUpdate : public SwMsgPoolItem
 // class SwDocPosUpdate : public SwMsgPoolItem
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index afe2df275aaa..497635f71f5b 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -133,7 +133,6 @@ class SwTableBoxNumFormat;
 class SwTextGridItem;
 class SwTransparencyGrf;
 class SwFormatRuby;
-class SwDelChr;
 class SwRefMarkFieldUpdate;
 class SwTableFormulaUpdate;
 class SwAutoFormatGetDocNode;
@@ -422,7 +421,6 @@ constexpr sal_uInt16 RES_MSG_BEGIN(RES_FMT_END);
 constexpr TypedWhichId RES_OBJECTDYING(RES_MSG_BEGIN); // 161
 constexpr TypedWhichId RES_FMT_CHG(162);
 constexpr TypedWhichId RES_ATTRSET_CHG(163);
-constexpr TypedWhichId RES_DEL_CHR(165);
 constexpr TypedWhichId RES_UPDATE_ATTR(167);
 constexpr TypedWhichId RES_REFMARKFLD_UPDATE(168);
 constexpr TypedWhichId RES_DOCPOS_UPDATE(169);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 78952b288193..777825ae4969 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -76,13 +76,6 @@ public:
 SwFormatChg( SwFormat *pFormat );
 };
 
-class SwDelChr final : public SwMsgPoolItem
-{
-public:
-sal_Int32 nPos;
-
-SwDelChr( sal_Int32 nP );
-};
 
 
 namespace sw {
@@ -119,6 +112,14 @@ public:
 DeleteText( sal_Int32 nS, sal_Int32 nL );
 };
 
+class DeleteChar final : public SfxHint
+{
+public:
+const sal_Int32 m_nPos;
+
+DeleteChar( const sal_Int32 nPos );
+};
+
 /// new delete redline is created
 class RedlineDelText final : public SfxHint
 {
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 76a5113eed46..3257d5736900 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -33,11 +33,6 @@ SwFormatChg::SwFormatChg( SwFormat* pFormat )
 }
 
 
-SwDelChr::SwDelChr( sal_Int32 nP )
-: SwMsgPoolItem( RES_DEL_CHR ), nPos( nP )
-{
-}
-
 
 namespace sw {
 
@@ -59,6 +54,11 @@ DeleteText::DeleteText( const sal_Int32 nS, const sal_Int32 
nL )
 {
 }
 
+DeleteChar::DeleteChar( const sal_Int32 nPos )
+: SfxHint( SfxHintId::SwDeleteChar ), m_nPos( nPos )
+{
+}
+
 RedlineDelText::RedlineDelText(sal_Int32 const nS, sal_Int32 const nL)
 : nStart(nS), nLen(nL)
 {
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 1de6c91cc633..22a8a0bc0ae1 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1977,6 +1977,7 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, 
SfxHint 

[Libreoffice-commits] core.git: sw/source

2022-09-25 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/node.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2aed71fa9e8a36ff2dc9f48897092c26ab89ea9e
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 25 04:34:54 2022 +0200
Commit: Bjoern Michaelsen 
CommitDate: Sun Sep 25 10:43:00 2022 +0200

tdf#144939: fix chapter numbering updates

Change-Id: Icd29a380663a1c5f70e3a8ee86db64ec4eae8d86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140558
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 34586965475a..f15d069f3095 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1277,7 +1277,7 @@ SwFormatColl *SwContentNode::ChgFormatColl( SwFormatColl 
*pNewColl )
 ChkCondColl(static_cast(pNewColl));
 SwFormatChg aTmp1( pOldColl );
 SwFormatChg aTmp2( pNewColl );
-SwClientNotify( *this, sw::LegacyModifyHint(, ) );
+CallSwClientNotify( sw::LegacyModifyHint(, ) );
 }
 }
 InvalidateInSwCache(RES_ATTRSET_CHG);


[Libreoffice-commits] core.git: compilerplugins/clang include/svl svl/source sw/inc sw/source

2022-09-25 Thread Bjoern Michaelsen (via logerrit)
 compilerplugins/clang/unusedmethods.results |2 
 include/svl/hint.hxx|1 
 svl/source/items/poolitem.cxx   |1 
 sw/inc/hintids.hxx  |2 
 sw/inc/hints.hxx|   27 
 sw/inc/ndtxt.hxx|3 
 sw/source/core/attr/hints.cxx   |   17 ++---
 sw/source/core/doc/docbm.cxx|6 -
 sw/source/core/inc/txtfrm.hxx   |4 -
 sw/source/core/text/txtfrm.cxx  |   94 ++--
 sw/source/core/txtnode/ndtxt.cxx|   21 +++---
 sw/source/core/txtnode/txtedt.cxx   |7 +-
 12 files changed, 94 insertions(+), 91 deletions(-)

New commits:
commit eea9f1ee27db98617871b9ecf80e9b3a62a4e723
Author: Bjoern Michaelsen 
AuthorDate: Sat Sep 24 19:28:17 2022 +0200
Commit: Bjoern Michaelsen 
CommitDate: Sun Sep 25 10:42:33 2022 +0200

unwrap SwInsText to a plain SfxHint

- also add some constnesss and move some things to private

Change-Id: I67a45e1326361b5a8f7e320b3525e74e93b1ef12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140556
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 2624f69422ef..be732177c36b 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1696,8 +1696,6 @@ include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, 
int>::type)
-include/svl/typedwhich.hxx:31
- TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index b22e9c789f3f..4b4677cd768d 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -140,6 +140,7 @@ enum class SfxHintId {
 SwGatherRefFields,
 SwGatherFields,
 SwNameChanged, // this can possibly be replaced by the generic NameChanged 
above
+SwInsertText,
 SwDeleteText,
 
 ThisIsAnSdrHint
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 5aada9d9d08b..32dfebb51747 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -434,7 +434,6 @@
 // class SwMsgPoolItem : public SfxPoolItem
 // class SwPtrMsgPoolItem : public SwMsgPoolItem
 // class SwFormatChg: public SwMsgPoolItem
-// class SwInsText: public SwMsgPoolItem
 // class SwDelChr: public SwMsgPoolItem
 // class SwUpdateAttr : public SwMsgPoolItem
 // class SwRefMarkFieldUpdate : public SwMsgPoolItem
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index a2529f935d00..afe2df275aaa 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -133,7 +133,6 @@ class SwTableBoxNumFormat;
 class SwTextGridItem;
 class SwTransparencyGrf;
 class SwFormatRuby;
-class SwInsText;
 class SwDelChr;
 class SwRefMarkFieldUpdate;
 class SwTableFormulaUpdate;
@@ -423,7 +422,6 @@ constexpr sal_uInt16 RES_MSG_BEGIN(RES_FMT_END);
 constexpr TypedWhichId RES_OBJECTDYING(RES_MSG_BEGIN); // 161
 constexpr TypedWhichId RES_FMT_CHG(162);
 constexpr TypedWhichId RES_ATTRSET_CHG(163);
-constexpr TypedWhichId RES_INS_TXT(164);
 constexpr TypedWhichId RES_DEL_CHR(165);
 constexpr TypedWhichId RES_UPDATE_ATTR(167);
 constexpr TypedWhichId RES_REFMARKFLD_UPDATE(168);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 63c25b90b4e0..78952b288193 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -76,17 +76,6 @@ public:
 SwFormatChg( SwFormat *pFormat );
 };
 
-class SwInsText final : public SwMsgPoolItem
-{
-public:
-sal_Int32 nPos;
-sal_Int32 nLen;
-bool isInsideFieldmarkCommand;
-bool isInsideFieldmarkResult;
-
-SwInsText(sal_Int32 nP, sal_Int32 nL, bool isInFMCommand, bool 
isInFMResult);
-};
-
 class SwDelChr final : public SwMsgPoolItem
 {
 public:
@@ -110,14 +99,26 @@ public:
 MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL);
 };
 
+class InsertText final : public SfxHint
+{
+public:
+const sal_Int32 nPos;
+const sal_Int32 nLen;
+const bool isInsideFieldmarkCommand;
+const bool isInsideFieldmarkResult;
+
+InsertText(sal_Int32 nP, sal_Int32 nL, bool isInFMCommand, bool 
isInFMResult);
+};
+
 class DeleteText final : public SfxHint
 {
 public:
-sal_Int32 nStart;
-sal_Int32 nLen;
+const sal_Int32 nStart;
+const sal_Int32 nLen;
 
 DeleteText( sal_Int32 nS, sal_Int32 nL );
 };
+
 /// new delete redline is created
 class RedlineDelText final : public SfxHint
 {
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 3a2b4d65e41d..12b823a52f7c 100644
--- a/sw/inc/ndtxt.hxx

[Libreoffice-commits] core.git: compilerplugins/clang include/svl svl/source sw/inc sw/source

2022-09-24 Thread Bjoern Michaelsen (via logerrit)
 compilerplugins/clang/unusedmethods.results |2 
 include/svl/hint.hxx|1 
 svl/source/items/poolitem.cxx   |1 
 sw/inc/hintids.hxx  |2 
 sw/inc/hints.hxx|   16 +-
 sw/inc/ndtxt.hxx|8 +
 sw/source/core/attr/hints.cxx   |9 -
 sw/source/core/text/txtfrm.cxx  |   62 +-
 sw/source/core/txtnode/ndtxt.cxx|  161 
 sw/source/core/txtnode/txtedt.cxx   |3 
 10 files changed, 148 insertions(+), 117 deletions(-)

New commits:
commit aace38f9bf702ecbe8de7cafc0979754eaa178c1
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 18 12:46:01 2022 +0200
Commit: Bjoern Michaelsen 
CommitDate: Sat Sep 24 18:28:07 2022 +0200

unwrap SwDelText to a plain SfxHint

Change-Id: I559f8f1e837830426e820dace6226618c5e0fc62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140210
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 98c1d36bd64a..2624f69422ef 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1594,8 +1594,6 @@ include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
-include/svl/typedwhich.hxx:31
- TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index a5cbc1913e2e..b22e9c789f3f 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -140,6 +140,7 @@ enum class SfxHintId {
 SwGatherRefFields,
 SwGatherFields,
 SwNameChanged, // this can possibly be replaced by the generic NameChanged 
above
+SwDeleteText,
 
 ThisIsAnSdrHint
 };
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 205f75b89bcd..5aada9d9d08b 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -436,7 +436,6 @@
 // class SwFormatChg: public SwMsgPoolItem
 // class SwInsText: public SwMsgPoolItem
 // class SwDelChr: public SwMsgPoolItem
-// class SwDelText: public SwMsgPoolItem
 // class SwUpdateAttr : public SwMsgPoolItem
 // class SwRefMarkFieldUpdate : public SwMsgPoolItem
 // class SwDocPosUpdate : public SwMsgPoolItem
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index b4fddf911179..a2529f935d00 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -135,7 +135,6 @@ class SwTransparencyGrf;
 class SwFormatRuby;
 class SwInsText;
 class SwDelChr;
-class SwDelText;
 class SwRefMarkFieldUpdate;
 class SwTableFormulaUpdate;
 class SwAutoFormatGetDocNode;
@@ -426,7 +425,6 @@ constexpr TypedWhichId RES_FMT_CHG(162);
 constexpr TypedWhichId RES_ATTRSET_CHG(163);
 constexpr TypedWhichId RES_INS_TXT(164);
 constexpr TypedWhichId RES_DEL_CHR(165);
-constexpr TypedWhichId RES_DEL_TXT(166);
 constexpr TypedWhichId RES_UPDATE_ATTR(167);
 constexpr TypedWhichId RES_REFMARKFLD_UPDATE(168);
 constexpr TypedWhichId RES_DOCPOS_UPDATE(169);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 8c15ed64ced6..63c25b90b4e0 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -95,14 +95,6 @@ public:
 SwDelChr( sal_Int32 nP );
 };
 
-class SwDelText final : public SwMsgPoolItem
-{
-public:
-sal_Int32 nStart;
-sal_Int32 nLen;
-
-SwDelText( sal_Int32 nS, sal_Int32 nL );
-};
 
 namespace sw {
 
@@ -118,6 +110,14 @@ public:
 MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL);
 };
 
+class DeleteText final : public SfxHint
+{
+public:
+sal_Int32 nStart;
+sal_Int32 nLen;
+
+DeleteText( sal_Int32 nS, sal_Int32 nL );
+};
 /// new delete redline is created
 class RedlineDelText final : public SfxHint
 {
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index feaa6c4c1bc2..3a2b4d65e41d 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -68,7 +68,11 @@ enum class ExpandMode;
 enum class SwFieldIds : sal_uInt16;
 class SwField;
 
-namespace sw::mark { enum class RestoreMode; }
+namespace sw {
+class TextNodeNotificationSuppressor;
+class DeleteText;
+namespace mark { enum class RestoreMode; }
+}
 
 namespace com::sun::star {
 namespace uno {
@@ -90,6 +94,7 @@ class SW_DLLPUBLIC SwTextNode final
 friend class SwNodes;
 friend class SwTextFrame;
 friend class SwScriptInfo;
+friend class sw::TextNodeNotificationSuppressor;
 
 /** May be 0. It is only then not 0 if it contains hard attributes.
Therefore: never access directly! */
@@ -216,6 +221,7 @@ public:
 
 public:
 

[Libreoffice-commits] core.git: include/svl sw/inc sw/source

2022-09-24 Thread Bjoern Michaelsen (via logerrit)
 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: sw/inc sw/source

2022-09-23 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/hintids.hxx |1 -
 sw/source/core/crsr/crsrsh.cxx |9 ++---
 2 files changed, 2 insertions(+), 8 deletions(-)

New commits:
commit 5895fb9dac86ecf0cca42dbbb414f69caceae52e
Author: Bjoern Michaelsen 
AuthorDate: Sat Sep 17 18:05:00 2022 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Sep 23 22:48:40 2022 +0200

remove RES_GRAPHIC_SWAPIN, it is never created

Change-Id: I9e7546d3f8bf5a3c0cefbdd3a4925467d7439856
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140105
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 7c6a18723af2..80aa40b9fd8a 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_GRAPHIC_SWAPIN(186);
 constexpr TypedWhichId RES_NAME_CHANGED(187);
 constexpr TypedWhichId RES_TITLE_CHANGED(188);
 constexpr TypedWhichId RES_DESCRIPTION_CHANGED(189);
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 8f3840f22fcc..d0a71e136d33 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2516,14 +2516,9 @@ void SwCursorShell::SwClientNotify(const SwModify&, 
const SfxHint& rHint)
 // SwTextNode::Insert(SwTextHint*, sal_uInt16); we react here and thus 
do
 // not need to send the expensive RES_FMT_CHG in Insert.
 CallChgLnk();
-switch(nWhich)
+if( nWhich == RES_OBJECTDYING )
 {
-case RES_OBJECTDYING:
-EndListeningAll();
-break;
-case RES_GRAPHIC_SWAPIN:
-if(m_aGrfArrivedLnk.IsSet())
-m_aGrfArrivedLnk.Call(*this);
+EndListeningAll();
 }
 
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-09-13 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/unocore/unoportenum.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 51c558930a261a5bd63569965fe360f316b9f3f4
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 11 17:30:32 2022 +0200
Commit: Caolán McNamara 
CommitDate: Tue Sep 13 20:54:10 2022 +0200

tdf#129163: GC cursor table at the end of the life of an portion enumeration

Change-Id: I864c0ba9ec43a5b164bb9a118911e0507f2a538a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139778
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 2bb92469c9f6074f7d969ebe0323b623631dd3e8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139836
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index 30a24721b031..be3ee4491e9e 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -337,7 +337,11 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
 SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
 {
 SolarMutexGuard aGuard;
-m_pUnoCursor.reset(nullptr);
+if( m_pUnoCursor )
+{
+m_pUnoCursor->GetDoc().cleanupUnoCursorTable();
+m_pUnoCursor.reset(nullptr);
+}
 }
 
 sal_Bool SwXTextPortionEnumeration::hasMoreElements()


[Libreoffice-commits] core.git: sw/source

2022-09-13 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/unocore/unoportenum.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 769cefd9c49652f28ba58cd371bc60b9e1bd5bd0
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 11 17:30:32 2022 +0200
Commit: Michael Stahl 
CommitDate: Tue Sep 13 14:11:00 2022 +0200

tdf#129163: GC cursor table at the end of the life of an portion enumeration

Change-Id: I864c0ba9ec43a5b164bb9a118911e0507f2a538a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139778
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index be697524c11c..0e1e95053a3f 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -337,7 +337,11 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
 SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
 {
 SolarMutexGuard aGuard;
-m_pUnoCursor.reset(nullptr);
+if( m_pUnoCursor )
+{
+m_pUnoCursor->GetDoc().cleanupUnoCursorTable();
+m_pUnoCursor.reset(nullptr);
+}
 }
 
 sal_Bool SwXTextPortionEnumeration::hasMoreElements()


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

2021-11-05 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/node.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c255482f1712d539e4be7d581512b21c526af809
Author: Bjoern Michaelsen 
AuthorDate: Sun Oct 31 21:01:39 2021 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 5 17:48:39 2021 +0100

tdf#134294: fix Chapter heading updates

A quick manual recheck seems to confirm, that this does not regress
tdf#118735, tdf#118049. I couldnt quite recheck tdf#118833, the "steps
to reproduce" dont quite work on master -- but I did find any obvious
regression there.

Change-Id: I407ac8c0a8222e3f8c74449a4ec2b9b27e8a3a20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124532
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 4a7022c199addb1fbc7445708c0f4801fbf1e47f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124695

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index b8f946bc2871..d2e845d5d200 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1262,6 +1262,8 @@ SwFormatColl *SwContentNode::ChgFormatColl( SwFormatColl 
*pNewColl )
 
 if( !IsModifyLocked() )
 {
+assert(dynamic_cast(pNewColl));
+ChkCondColl(static_cast(pNewColl));
 SwFormatChg aTmp1( pOldColl );
 SwFormatChg aTmp2( pNewColl );
 SwClientNotify( *this, sw::LegacyModifyHint(, ) );


[Libreoffice-commits] core.git: sw/source

2021-11-05 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/node.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 4a7022c199addb1fbc7445708c0f4801fbf1e47f
Author: Bjoern Michaelsen 
AuthorDate: Sun Oct 31 21:01:39 2021 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 5 10:48:52 2021 +0100

tdf#134294: fix Chapter heading updates

A quick manual recheck seems to confirm, that this does not regress
tdf#118735, tdf#118049. I couldnt quite recheck tdf#118833, the "steps
to reproduce" dont quite work on master -- but I did find any obvious
regression there.

Change-Id: I407ac8c0a8222e3f8c74449a4ec2b9b27e8a3a20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124532
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 20fa89f3fb70..c9b4a41f42fe 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1262,6 +1262,8 @@ SwFormatColl *SwContentNode::ChgFormatColl( SwFormatColl 
*pNewColl )
 
 if( !IsModifyLocked() )
 {
+assert(dynamic_cast(pNewColl));
+ChkCondColl(static_cast(pNewColl));
 SwFormatChg aTmp1( pOldColl );
 SwFormatChg aTmp2( pNewColl );
 SwClientNotify( *this, sw::LegacyModifyHint(, ) );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

2021-11-03 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/edit/edfld.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 31613f1ade01a68b170adc6f9245b777671ba62d
Author: Bjoern Michaelsen 
AuthorDate: Sat Oct 30 01:38:21 2021 +0200
Commit: Xisco Fauli 
CommitDate: Wed Nov 3 13:20:19 2021 +0100

tdf#145326: fix breaking DDE links

Change-Id: Ib80a83ed1e4c87ee6af2f8ef55309ad9779aac66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124455
Tested-by: Jenkins
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 
(cherry picked from commit 68cea95423818f6ae19b735e2029284c5fc9397b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124481

diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index b6bb9055f23d..eda748efd303 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -131,7 +131,7 @@ void SwEditShell::FieldToText( SwFieldType const * pType )
 Push();
 SwPaM* pPaM = GetCursor();
 const SwFieldHint aHint(pPaM, GetLayout());
-CallSwClientNotify(aHint);
+pType->CallSwClientNotify(aHint);
 
 Pop(PopMode::DeleteCurrent);
 EndAllAction();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/qa sw/source

2021-11-03 Thread Bjoern Michaelsen (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx   |   18 +-
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |2 
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx  |   10 -
 sw/qa/extras/uiwriter/uiwriter3.cxx|   10 -
 sw/source/core/frmedt/fecopy.cxx   |  254 ++---
 sw/source/core/layout/flycnt.cxx   |3 
 6 files changed, 150 insertions(+), 147 deletions(-)

New commits:
commit 84c8adb703906b0fe2c7f9a5e7174e00139a08f3
Author: Bjoern Michaelsen 
AuthorDate: Mon Oct 25 20:50:26 2021 +0200
Commit: Xisco Fauli 
CommitDate: Wed Nov 3 11:55:30 2021 +0100

tdf#140798, tdf#143815, tdf#141659: fix fly content hint handling

Also revert most of the test changes in
188ec34cf157ffee8c63f03f420ca9daafb5ff29, except in mailmerge, where
3bc8f90e9693f710f12632f69b9348c1c833c906 seems to have done some
research and the old state wasnt particulary well-justified.

In testSmartArtAnchoredInline the order of elements has changed.

This exposes a bug in SwFEShell::Paste, which stops copying
SpzFrameFormats (aka FlyFrameFormats and DrawFrameFormats) after having
copied the first FlyFrameFormat, claiming other Flys will have been
copied via FlyInFly. If there are DrawFrameFormats behind the
FlyFrameFormats, they will be forgotten.

So instead:
- first copy the DrawFrameFormats
- then copy the first FlyFrameFormat

to not forget any Draw Formats. Also, give the format copying its own
function, at 100 lines its annoying enough all by itself.

Change-Id: I301e27ff94fb82cf0502457630acdcbfa342a566
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124162
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124438

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a9e21389009f..81629a8b03c4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -464,31 +464,31 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testMsoPosition, 
"bnc884615-mso-position.doc
 // We write the frames out in different order than they were read, so 
check it's the correct
 // textbox first by checking width. These tests may need reordering if 
that gets fixed.
 OUString style1 = getXPath(doc, 
"/w:ftr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style1.indexOf( ";width:36pt;" ) >= 0 );
-CPPUNIT_ASSERT( style1.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
-CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( ";width:531pt;" ) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" 
) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( 
";mso-position-horizontal-relative:page" ) >= 0 );
 OUString style2 = getXPath(doc, 
"/w:ftr/w:p/w:r[4]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
 CPPUNIT_ASSERT( style2.indexOf( ";width:549pt;" ) >= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal:center" ) >= 
0 );
 CPPUNIT_ASSERT( style2.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
 OUString style3 = getXPath(doc, 
"/w:ftr/w:p/w:r[5]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style3.indexOf( ";width:531pt;" ) >= 0 );
-CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:page" 
) >= 0 );
-CPPUNIT_ASSERT( style3.indexOf( 
";mso-position-horizontal-relative:page" ) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( ";width:36pt;" ) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
 }
 
 xmlDocUniquePtr doc = parseExport("word/header1.xml");
 OUString style1 = getXPath(doc, 
"/w:hdr/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style1.indexOf( ";width:138.15pt;" ) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( ";width:335.75pt;" ) >= 0 );
 CPPUNIT_ASSERT( style1.indexOf( ";mso-position-horizontal-relative:page" ) 
>= 0 );
 CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" ) 
>= 0 );
 OUString style2 = getXPath(doc, 
"/w:hdr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style2.indexOf( ";width:163.8pt;" ) >= 0 );
+CPPUNIT_ASSERT( style2.indexOf( ";width:138.15pt;" ) >= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal-relative:page" ) 
>= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:page" ) 
>= 0 );
  

[Libreoffice-commits] core.git: sw/source

2021-11-03 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/edit/edfld.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 68cea95423818f6ae19b735e2029284c5fc9397b
Author: Bjoern Michaelsen 
AuthorDate: Sat Oct 30 01:38:21 2021 +0200
Commit: Xisco Fauli 
CommitDate: Wed Nov 3 11:00:16 2021 +0100

tdf#145326: fix breaking DDE links

Change-Id: Ib80a83ed1e4c87ee6af2f8ef55309ad9779aac66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124455
Tested-by: Jenkins
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index bef3f2b286fb..33089ef827bc 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -132,7 +132,7 @@ void SwEditShell::FieldToText( SwFieldType const * pType )
 Push();
 SwPaM* pPaM = GetCursor();
 const SwFieldHint aHint(pPaM, GetLayout());
-CallSwClientNotify(aHint);
+pType->CallSwClientNotify(aHint);
 
 Pop(PopMode::DeleteCurrent);
 EndAllAction();


[Libreoffice-commits] core.git: sw/qa sw/source

2021-10-29 Thread Bjoern Michaelsen (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   18 +-
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |   10 -
 sw/qa/extras/uiwriter/uiwriter3.cxx   |3 
 sw/source/core/frmedt/fecopy.cxx  |  254 +++---
 sw/source/core/layout/flycnt.cxx  |3 
 5 files changed, 145 insertions(+), 143 deletions(-)

New commits:
commit 3cfd63cb55ab1a7e6df53eaeb2a7623be05983d0
Author: Bjoern Michaelsen 
AuthorDate: Mon Oct 25 20:50:26 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Oct 29 13:24:01 2021 +0200

tdf#140798, tdf#143815, tdf#141659: fix fly content hint handling

Also revert most of the test changes in
188ec34cf157ffee8c63f03f420ca9daafb5ff29, except in mailmerge, where
3bc8f90e9693f710f12632f69b9348c1c833c906 seems to have done some
research and the old state wasnt particulary well-justified.

In testSmartArtAnchoredInline the order of elements has changed.

This exposes a bug in SwFEShell::Paste, which stops copying
SpzFrameFormats (aka FlyFrameFormats and DrawFrameFormats) after having
copied the first FlyFrameFormat, claiming other Flys will have been
copied via FlyInFly. If there are DrawFrameFormats behind the
FlyFrameFormats, they will be forgotten.

So instead:
- first copy the DrawFrameFormats
- then copy the first FlyFrameFormat

to not forget any Draw Formats. Also, give the format copying its own
function, at 100 lines its annoying enough all by itself.

Change-Id: I301e27ff94fb82cf0502457630acdcbfa342a566
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124162
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index fcc5d6aebd4d..ce5092e01585 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -481,31 +481,31 @@ CPPUNIT_TEST_FIXTURE(Test, testMsoPosition)
 // We write the frames out in different order than they were read, so 
check it's the correct
 // textbox first by checking width. These tests may need reordering if 
that gets fixed.
 OUString style1 = getXPath(doc, 
"/w:ftr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style1.indexOf( ";width:36pt;" ) >= 0 );
-CPPUNIT_ASSERT( style1.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
-CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( ";width:531pt;" ) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" 
) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( 
";mso-position-horizontal-relative:page" ) >= 0 );
 OUString style2 = getXPath(doc, 
"/w:ftr/w:p/w:r[4]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
 CPPUNIT_ASSERT( style2.indexOf( ";width:549pt;" ) >= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal:center" ) >= 
0 );
 CPPUNIT_ASSERT( style2.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
 OUString style3 = getXPath(doc, 
"/w:ftr/w:p/w:r[5]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style3.indexOf( ";width:531pt;" ) >= 0 );
-CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:page" 
) >= 0 );
-CPPUNIT_ASSERT( style3.indexOf( 
";mso-position-horizontal-relative:page" ) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( ";width:36pt;" ) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
 }
 
 xmlDocUniquePtr doc = parseExport("word/header1.xml");
 OUString style1 = getXPath(doc, 
"/w:hdr/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style1.indexOf( ";width:138.15pt;" ) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( ";width:335.75pt;" ) >= 0 );
 CPPUNIT_ASSERT( style1.indexOf( ";mso-position-horizontal-relative:page" ) 
>= 0 );
 CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" ) 
>= 0 );
 OUString style2 = getXPath(doc, 
"/w:hdr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style2.indexOf( ";width:163.8pt;" ) >= 0 );
+CPPUNIT_ASSERT( style2.indexOf( ";width:138.15pt;" ) >= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal-relative:page" ) 
>= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:page" ) 
>= 0 );
 OUString style3 = getXPath(doc, 
"/w:hdr/w:p/w:r[4]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style3.indexOf( ";width:335.75pt;" ) >= 0 );
+

[Libreoffice-commits] core.git: sw/inc sw/source

2021-10-28 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/dbfld.hxx |5 +--
 sw/inc/ddefld.hxx|8 +++-
 sw/inc/docufld.hxx   |8 +++-
 sw/inc/expfld.hxx|7 +++-
 sw/inc/fldbas.hxx|1 
 sw/inc/reffld.hxx|1 
 sw/source/core/doc/DocumentFieldsManager.cxx |   44 ---
 sw/source/core/fields/fldbas.cxx |5 +++
 8 files changed, 33 insertions(+), 46 deletions(-)

New commits:
commit 86d11097cd4a2ae4a6b4e6b35e28a6075376d67a
Author: Bjoern Michaelsen 
AuthorDate: Mon Oct 25 02:02:09 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Oct 29 03:00:47 2021 +0200

use virtual function call for dynamic dispatch

... as it is around since the dawn of C++ and should be stable --
certainly more stable and less errorprone that manual typetagging.

Change-Id: I5dfe2ce40c2334dc8fe60705d358779fa4bf1586
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124131
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx
index 4fabaff6c253..8904575f319b 100644
--- a/sw/inc/dbfld.hxx
+++ b/sw/inc/dbfld.hxx
@@ -47,8 +47,9 @@ public:
 const OUString& GetColumnName() const {return m_sColumn;}
 const SwDBData& GetDBData() const {return m_aDBData;}
 
-virtual voidQueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) 
const override;
-virtual voidPutValue( const css::uno::Any& rVal, sal_uInt16 nWhich 
) override;
+virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const 
override;
+virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) 
override;
+virtual void UpdateFields() override {};
 };
 
 // Classes derived from SwFields. They overlay the expand-function.
diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx
index ccb72ff25b24..c96f0bdaa659 100644
--- a/sw/inc/ddefld.hxx
+++ b/sw/inc/ddefld.hxx
@@ -99,6 +99,8 @@ public:
 void DecRefCnt() {  if( !--m_nRefCount && m_pDoc ) RefCntChgd(); }
 
 void SetCRLFDelFlag( bool bFlag ){ m_bCRLFFlag = bFlag; }
+virtual void UpdateFields() override
+{ UpdateDDE(false); };
 void UpdateDDE(const bool bNotifyShells = true);
 };
 
@@ -115,11 +117,11 @@ public:
 
 /** Get parameter via types.
  Name cannot be changed. */
-virtual OUString  GetPar1() const override;
+virtual OUString GetPar1() const override;
 
 // Command
-virtual OUString  GetPar2() const override;
-virtual voidSetPar2(const OUString& rStr) override;
+virtual OUString GetPar2() const override;
+virtual void SetPar2(const OUString& rStr) override;
 };
 
 #endif // INCLUDED_SW_INC_DDEFLD_HXX
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 1b76fe7bf83b..9cad6b71f77c 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -288,9 +288,10 @@ public:
 SwHiddenTextFieldType(bool bSetHidden = true);
 
 virtual std::unique_ptr Copy() const override;
+virtual void UpdateFields() override {};
 
-voidSetHiddenFlag( bool bSetHidden );
-bool GetHiddenFlag() const { return m_bHidden; }
+void SetHiddenFlag( bool bSetHidden );
+bool GetHiddenFlag() const { return m_bHidden; }
 };
 
 class SW_DLLPUBLIC SwHiddenTextField final : public SwField
@@ -357,6 +358,7 @@ public:
 SwHiddenParaFieldType();
 
 virtual std::unique_ptr Copy() const override;
+virtual void UpdateFields() override {};
 };
 
 class SwHiddenParaField final : public SwField
@@ -577,6 +579,7 @@ public:
 SwRefPageSetFieldType();
 
 virtual std::unique_ptr Copy() const override;
+virtual void UpdateFields() override {};
 
 private:
 /// noop, there is nothing to update!
@@ -652,6 +655,7 @@ class SwJumpEditFieldType final : public SwFieldType
 public:
 SwJumpEditFieldType( SwDoc& rDoc );
 virtual std::unique_ptr Copy() const override;
+virtual void UpdateFields() override {};
 
 SwCharFormat* GetCharFormat();
 };
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index e82f9b23772f..25d442ee107a 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -72,6 +72,7 @@ class SAL_DLLPUBLIC_RTTI SwGetExpFieldType final : public 
SwValueFieldType
 public:
 SwGetExpFieldType(SwDoc* pDoc);
 virtual std::unique_ptr Copy() const override;
+virtual void UpdateFields() override {};
 
 /** Overlay, because get-field cannot be changed and therefore
  does not need to be updated. Update at changing of set-values! */
@@ -180,8 +181,9 @@ public:
 void SetOutlineLvl( sal_uInt8 n )   { m_nLevel = n; }
 void SetChapter(SwSetExpField& rField, const SwNode& rNd, SwRootFrame 
const* pLayout);
 
-virtual voidQueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) 
const override;
-virtual voidPutValue( const css::uno::Any& rVal, sal_uInt16 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-10-28 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/ddefld.hxx|1 
 sw/source/core/doc/DocumentFieldsManager.cxx |6 +
 sw/source/core/fields/ddefld.cxx |  100 ++-
 3 files changed, 57 insertions(+), 50 deletions(-)

New commits:
commit cae107bab822acc198569750ae5b9a272f7ae996
Author: Bjoern Michaelsen 
AuthorDate: Mon Oct 25 00:52:32 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Oct 29 02:59:36 2021 +0200

consolidate DDE updates in FieldType

Change-Id: I70243dad4cd62ab1f601d010e0bcf441831ec556
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124130
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx
index a9ca4db81b52..ccb72ff25b24 100644
--- a/sw/inc/ddefld.hxx
+++ b/sw/inc/ddefld.hxx
@@ -99,6 +99,7 @@ public:
 void DecRefCnt() {  if( !--m_nRefCount && m_pDoc ) RefCntChgd(); }
 
 void SetCRLFDelFlag( bool bFlag ){ m_bCRLFFlag = bFlag; }
+void UpdateDDE(const bool bNotifyShells = true);
 };
 
 // DDE-field
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index b15e043aa795..530f4ea22bec 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -405,8 +406,9 @@ void DocumentFieldsManager::UpdateFields( bool bCloseDB )
 
 case SwFieldIds::Dde:
 {
-SwMsgPoolItem aUpdateDDE( RES_UPDATEDDETBL );
-pFieldType->CallSwClientNotify(sw::LegacyModifyHint(nullptr, 
));
+assert(dynamic_cast(pFieldType.get()));
+auto pDDEFieldType = 
static_cast(pFieldType.get());
+pDDEFieldType->UpdateDDE(false);
 break;
 }
 case SwFieldIds::GetExp:
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 590fcef86cad..8b326d02cd62 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -97,54 +97,8 @@ public:
 return SUCCESS;
 }
 
-OSL_ENSURE(m_rFieldType.GetDoc(), "no pDoc");
-
-// no dependencies left?
-if (!m_rFieldType.IsModifyLocked() && !ChkNoDataFlag())
-{
-SwViewShell* pSh = 
m_rFieldType.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
-SwEditShell* pESh = m_rFieldType.GetDoc()->GetEditShell();
-
-// Search for fields. If no valid found, disconnect.
-SwMsgPoolItem aUpdateDDE( RES_UPDATEDDETBL );
-m_rFieldType.LockModify();
-
-std::vector vFields;
-std::vector vTables;
-m_rFieldType.GatherFields(vFields, false);
-m_rFieldType.GatherDdeTables(vTables);
-const bool bDoAction = vFields.size() || vTables.size();
-if(bDoAction)
-{
-if(pESh)
-pESh->StartAllAction();
-else if(pSh)
-pSh->StartAction();
-}
-
-// DDE fields attribute in the text
-for(auto pFormatField: vFields)
-{
-if(pFormatField->GetTextField())
-pFormatField->UpdateTextNode( nullptr,  );
-}
-// a DDE tables in the text
-for(auto pTable: vTables)
-pTable->ChangeContent();
-
-m_rFieldType.UnlockModify();
-
-if(bDoAction)
-{
-if(pESh)
-pESh->EndAllAction();
-else if(pSh)
-pSh->EndAction();
-
-if(pSh)
-pSh->GetDoc()->getIDocumentState().SetModified();
-}
-}
+if(!ChkNoDataFlag())
+m_rFieldType.UpdateDDE();
 
 return SUCCESS;
 }
@@ -332,6 +286,56 @@ void SwDDEFieldType::PutValue( const uno::Any& rVal, 
sal_uInt16 nWhichId )
 SetCmd( sNewCmd.makeStringAndClear() );
 }
 
+void SwDDEFieldType::UpdateDDE(const bool bNotifyShells)
+{
+auto pDoc = GetDoc();
+assert(pDoc);
+if(IsModifyLocked())
+return;
+SwViewShell* pSh = bNotifyShells ? 
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() : nullptr;
+SwEditShell* pESh = bNotifyShells ? pDoc->GetEditShell() : nullptr;
+
+// Search for fields. If no valid found, disconnect.
+LockModify();
+
+std::vector vFields;
+std::vector vTables;
+GatherFields(vFields, false);
+GatherDdeTables(vTables);
+const bool bDoAction = vFields.size() || vTables.size();
+if(bDoAction)
+{
+if(pESh)
+pESh->StartAllAction();
+else if(pSh)
+pSh->StartAction();
+}
+
+// DDE fields attribute in the text
+SwMsgPoolItem aUpdateDDE(RES_UPDATEDDETBL);
+for(auto pFormatField: vFields)
+{
+if(pFormatField->GetTextField())
+pFormatField->UpdateTextNode( nullptr,  );
+}
+// a DDE tables in the text
+for(auto pTable: vTables)
+pTable->ChangeContent();
+
+UnlockModify();
+
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-1-7' - sw/inc sw/source

2021-10-26 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/fldbas.hxx|2 ++
 sw/inc/fmtfld.hxx|5 +
 sw/source/core/fields/ddefld.cxx |   15 +++
 sw/source/core/fields/ddetbl.cxx |4 
 sw/source/core/fields/fldbas.cxx |5 +
 5 files changed, 27 insertions(+), 4 deletions(-)

New commits:
commit c34dd19ef0729504e89c8b2523c6228fbb716fda
Author: Bjoern Michaelsen 
AuthorDate: Sun Oct 24 23:17:24 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Tue Oct 26 10:36:01 2021 +0200

tdf#138531: Also update DDE tables, not only fields

Change-Id: I0cbf8ce355b460b2f7ea73c8fae653641c980979
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124129
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 98247b039baea4697e6c387025afcf6a2963c043)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124020
(cherry picked from commit a4f9fba0ba49ae6e27c2f1fa2ef9b21d0ae7c522)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124024
Reviewed-by: Adolfo Jayme Barrientos 
Reviewed-by: Xisco Fauli 
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 847e9d2ef356..c13cff3e2a23 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -32,6 +32,7 @@
 class SwDoc;
 class SwField;
 class SwFormatField;
+class SwDDETable;
 class SwRootFrame;
 class SvNumberFormatter;
 class IDocumentRedlineAccess;
@@ -281,6 +282,7 @@ public:
 void GatherNodeIndex(std::vector& rvNodeIndex);
 void GatherRefFields(std::vector& rvRFields, const 
sal_uInt16 nTyp);
 void GatherFields(std::vector& rvFormatFields, bool 
bCollectOnlyInDocNodes=true) const;
+void GatherDdeTables(std::vector& rvTables) const;
 };
 
 /** Base class of all fields.
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index f65f7d437464..4c0b3c58b11e 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -33,6 +33,7 @@ class SwField;
 class SwTextField;
 class SwView;
 class SwFieldType;
+class SwDDETable;
 class SwFormatField;
 class IDocumentRedlineAccess;
 namespace com::sun::star::text { class XTextField; }
@@ -72,6 +73,10 @@ namespace sw {
 std::vector& m_rvFields;
 GatherFieldsHint(std::vector& rvFields, bool 
bCollectOnlyInDocNodes = true) : 
m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), m_rvFields(rvFields) {};
 };
+struct GatherDdeTablesHint final : SfxHint {
+std::vector& m_rvTables;
+GatherDdeTablesHint(std::vector& rvTables) : 
m_rvTables(rvTables) {};
+};
 }
 
 
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 9c4ba9c762cb..fb417375df5f 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,7 +103,7 @@ public:
 OSL_ENSURE(m_rFieldType.GetDoc(), "no pDoc");
 
 // no dependencies left?
-if (m_rFieldType.HasWriterListeners() && !m_rFieldType.IsModifyLocked() && 
!ChkNoDataFlag())
+if (!m_rFieldType.IsModifyLocked() && !ChkNoDataFlag())
 {
 SwViewShell* pSh = 
m_rFieldType.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
 SwEditShell* pESh = m_rFieldType.GetDoc()->GetEditShell();
@@ -112,8 +113,11 @@ public:
 m_rFieldType.LockModify();
 
 std::vector vFields;
+std::vector vTables;
 m_rFieldType.GatherFields(vFields, false);
-if(vFields.size())
+m_rFieldType.GatherDdeTables(vTables);
+const bool bDoAction = vFields.size() || vTables.size();
+if(bDoAction)
 {
 if(pESh)
 pESh->StartAllAction();
@@ -121,16 +125,19 @@ public:
 pSh->StartAction();
 }
 
+// DDE fields attribute in the text
 for(auto pFormatField: vFields)
 {
-// a DDE table or a DDE field attribute in the text
 if(pFormatField->GetTextField())
 pFormatField->UpdateTextNode( nullptr,  );
 }
+// a DDE tables in the text
+for(auto pTable: vTables)
+pTable->ChangeContent();
 
 m_rFieldType.UnlockModify();
 
-if(vFields.size())
+if(bDoAction)
 {
 if(pESh)
 pESh->EndAllAction();
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 53f6c2c3f7e7..7954e18f5d4c 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -116,6 +117,9 @@ void SwDDETable::SwClientNotify( const SwModify& rModify, 
const SfxHint& rHint )
 pInRangeHint->m_nSttNd < pTableNd->EndOfSectionIndex() &&
 pInRangeHint->m_nEndNd > pTableNd->GetIndex() )
 pInRangeHint->m_rIsInRange = true;
+} else if (const auto 

[Libreoffice-commits] core.git: Changes to 'refs/tags/co-21.06.5-1'

2021-10-26 Thread Bjoern Michaelsen (via logerrit)
Tag 'co-21.06.5-1' created by Andras Timar  at 
2021-10-26 07:12 +

co-21.06.5-1

Changes since cp-21.06.5-1-43:
---
 0 files changed
---


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 2 commits - sw/inc sw/source xmlsecurity/qa

2021-10-26 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/fldbas.hxx   |2 ++
 sw/inc/fmtfld.hxx   |5 +
 sw/source/core/fields/ddefld.cxx|   15 +++
 sw/source/core/fields/ddetbl.cxx|4 
 sw/source/core/fields/fldbas.cxx|5 +
 xmlsecurity/qa/unit/signing/signing.cxx |8 ++--
 6 files changed, 33 insertions(+), 6 deletions(-)

New commits:
commit c4a6d96cfa427a1b8b443ea2664ec5b6ab964f18
Author: Bjoern Michaelsen 
AuthorDate: Sun Oct 24 23:17:24 2021 +0200
Commit: Andras Timar 
CommitDate: Tue Oct 26 09:12:25 2021 +0200

tdf#138531: Also update DDE tables, not only fields

Change-Id: I0cbf8ce355b460b2f7ea73c8fae653641c980979
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124129
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 98247b039baea4697e6c387025afcf6a2963c043)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124020

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 847e9d2ef356..c13cff3e2a23 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -32,6 +32,7 @@
 class SwDoc;
 class SwField;
 class SwFormatField;
+class SwDDETable;
 class SwRootFrame;
 class SvNumberFormatter;
 class IDocumentRedlineAccess;
@@ -281,6 +282,7 @@ public:
 void GatherNodeIndex(std::vector& rvNodeIndex);
 void GatherRefFields(std::vector& rvRFields, const 
sal_uInt16 nTyp);
 void GatherFields(std::vector& rvFormatFields, bool 
bCollectOnlyInDocNodes=true) const;
+void GatherDdeTables(std::vector& rvTables) const;
 };
 
 /** Base class of all fields.
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index f65f7d437464..4c0b3c58b11e 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -33,6 +33,7 @@ class SwField;
 class SwTextField;
 class SwView;
 class SwFieldType;
+class SwDDETable;
 class SwFormatField;
 class IDocumentRedlineAccess;
 namespace com::sun::star::text { class XTextField; }
@@ -72,6 +73,10 @@ namespace sw {
 std::vector& m_rvFields;
 GatherFieldsHint(std::vector& rvFields, bool 
bCollectOnlyInDocNodes = true) : 
m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), m_rvFields(rvFields) {};
 };
+struct GatherDdeTablesHint final : SfxHint {
+std::vector& m_rvTables;
+GatherDdeTablesHint(std::vector& rvTables) : 
m_rvTables(rvTables) {};
+};
 }
 
 
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 9c4ba9c762cb..fb417375df5f 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,7 +103,7 @@ public:
 OSL_ENSURE(m_rFieldType.GetDoc(), "no pDoc");
 
 // no dependencies left?
-if (m_rFieldType.HasWriterListeners() && !m_rFieldType.IsModifyLocked() && 
!ChkNoDataFlag())
+if (!m_rFieldType.IsModifyLocked() && !ChkNoDataFlag())
 {
 SwViewShell* pSh = 
m_rFieldType.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
 SwEditShell* pESh = m_rFieldType.GetDoc()->GetEditShell();
@@ -112,8 +113,11 @@ public:
 m_rFieldType.LockModify();
 
 std::vector vFields;
+std::vector vTables;
 m_rFieldType.GatherFields(vFields, false);
-if(vFields.size())
+m_rFieldType.GatherDdeTables(vTables);
+const bool bDoAction = vFields.size() || vTables.size();
+if(bDoAction)
 {
 if(pESh)
 pESh->StartAllAction();
@@ -121,16 +125,19 @@ public:
 pSh->StartAction();
 }
 
+// DDE fields attribute in the text
 for(auto pFormatField: vFields)
 {
-// a DDE table or a DDE field attribute in the text
 if(pFormatField->GetTextField())
 pFormatField->UpdateTextNode( nullptr,  );
 }
+// a DDE tables in the text
+for(auto pTable: vTables)
+pTable->ChangeContent();
 
 m_rFieldType.UnlockModify();
 
-if(vFields.size())
+if(bDoAction)
 {
 if(pESh)
 pESh->EndAllAction();
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 53f6c2c3f7e7..7954e18f5d4c 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -116,6 +117,9 @@ void SwDDETable::SwClientNotify( const SwModify& rModify, 
const SfxHint& rHint )
 pInRangeHint->m_nSttNd < pTableNd->EndOfSectionIndex() &&
 pInRangeHint->m_nEndNd > pTableNd->GetIndex() )
 pInRangeHint->m_rIsInRange = true;
+} else if (const auto pGatherDdeTablesHint = dynamic_cast())
+{
+pGatherDdeTablesHint->m_rvTables.push_back(this);
 }
 else if (auto pModifyChangedHint = dynamic_cast())
 {
diff --git 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/inc sw/source

2021-10-25 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/fldbas.hxx|2 ++
 sw/inc/fmtfld.hxx|5 +
 sw/source/core/fields/ddefld.cxx |   15 +++
 sw/source/core/fields/ddetbl.cxx |4 
 sw/source/core/fields/fldbas.cxx |5 +
 5 files changed, 27 insertions(+), 4 deletions(-)

New commits:
commit a4f9fba0ba49ae6e27c2f1fa2ef9b21d0ae7c522
Author: Bjoern Michaelsen 
AuthorDate: Sun Oct 24 23:17:24 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Oct 25 15:08:40 2021 +0200

tdf#138531: Also update DDE tables, not only fields

Change-Id: I0cbf8ce355b460b2f7ea73c8fae653641c980979
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124129
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 98247b039baea4697e6c387025afcf6a2963c043)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124020

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 847e9d2ef356..c13cff3e2a23 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -32,6 +32,7 @@
 class SwDoc;
 class SwField;
 class SwFormatField;
+class SwDDETable;
 class SwRootFrame;
 class SvNumberFormatter;
 class IDocumentRedlineAccess;
@@ -281,6 +282,7 @@ public:
 void GatherNodeIndex(std::vector& rvNodeIndex);
 void GatherRefFields(std::vector& rvRFields, const 
sal_uInt16 nTyp);
 void GatherFields(std::vector& rvFormatFields, bool 
bCollectOnlyInDocNodes=true) const;
+void GatherDdeTables(std::vector& rvTables) const;
 };
 
 /** Base class of all fields.
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index f65f7d437464..4c0b3c58b11e 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -33,6 +33,7 @@ class SwField;
 class SwTextField;
 class SwView;
 class SwFieldType;
+class SwDDETable;
 class SwFormatField;
 class IDocumentRedlineAccess;
 namespace com::sun::star::text { class XTextField; }
@@ -72,6 +73,10 @@ namespace sw {
 std::vector& m_rvFields;
 GatherFieldsHint(std::vector& rvFields, bool 
bCollectOnlyInDocNodes = true) : 
m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), m_rvFields(rvFields) {};
 };
+struct GatherDdeTablesHint final : SfxHint {
+std::vector& m_rvTables;
+GatherDdeTablesHint(std::vector& rvTables) : 
m_rvTables(rvTables) {};
+};
 }
 
 
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 9c4ba9c762cb..fb417375df5f 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,7 +103,7 @@ public:
 OSL_ENSURE(m_rFieldType.GetDoc(), "no pDoc");
 
 // no dependencies left?
-if (m_rFieldType.HasWriterListeners() && !m_rFieldType.IsModifyLocked() && 
!ChkNoDataFlag())
+if (!m_rFieldType.IsModifyLocked() && !ChkNoDataFlag())
 {
 SwViewShell* pSh = 
m_rFieldType.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
 SwEditShell* pESh = m_rFieldType.GetDoc()->GetEditShell();
@@ -112,8 +113,11 @@ public:
 m_rFieldType.LockModify();
 
 std::vector vFields;
+std::vector vTables;
 m_rFieldType.GatherFields(vFields, false);
-if(vFields.size())
+m_rFieldType.GatherDdeTables(vTables);
+const bool bDoAction = vFields.size() || vTables.size();
+if(bDoAction)
 {
 if(pESh)
 pESh->StartAllAction();
@@ -121,16 +125,19 @@ public:
 pSh->StartAction();
 }
 
+// DDE fields attribute in the text
 for(auto pFormatField: vFields)
 {
-// a DDE table or a DDE field attribute in the text
 if(pFormatField->GetTextField())
 pFormatField->UpdateTextNode( nullptr,  );
 }
+// a DDE tables in the text
+for(auto pTable: vTables)
+pTable->ChangeContent();
 
 m_rFieldType.UnlockModify();
 
-if(vFields.size())
+if(bDoAction)
 {
 if(pESh)
 pESh->EndAllAction();
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 53f6c2c3f7e7..7954e18f5d4c 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -116,6 +117,9 @@ void SwDDETable::SwClientNotify( const SwModify& rModify, 
const SfxHint& rHint )
 pInRangeHint->m_nSttNd < pTableNd->EndOfSectionIndex() &&
 pInRangeHint->m_nEndNd > pTableNd->GetIndex() )
 pInRangeHint->m_rIsInRange = true;
+} else if (const auto pGatherDdeTablesHint = dynamic_cast())
+{
+pGatherDdeTablesHint->m_rvTables.push_back(this);
 }
 else if (auto pModifyChangedHint = dynamic_cast())
 {
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index b1220181df54..cbc73b27bcfb 100644
--- 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/inc sw/source

2021-10-25 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/fldbas.hxx|2 ++
 sw/inc/fmtfld.hxx|5 +
 sw/source/core/fields/ddefld.cxx |   15 +++
 sw/source/core/fields/ddetbl.cxx |4 
 sw/source/core/fields/fldbas.cxx |5 +
 5 files changed, 27 insertions(+), 4 deletions(-)

New commits:
commit 5380e47db7ad968c442026f7d2e8ede79bc55564
Author: Bjoern Michaelsen 
AuthorDate: Sun Oct 24 23:17:24 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Oct 25 15:07:44 2021 +0200

tdf#138531: Also update DDE tables, not only fields

Change-Id: I0cbf8ce355b460b2f7ea73c8fae653641c980979
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124129
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 98247b039baea4697e6c387025afcf6a2963c043)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124019

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index e38122ec390d..b25908f35d2a 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -32,6 +32,7 @@
 class SwDoc;
 class SwField;
 class SwFormatField;
+class SwDDETable;
 class SwRootFrame;
 class SvNumberFormatter;
 class IDocumentRedlineAccess;
@@ -281,6 +282,7 @@ public:
 void GatherNodeIndex(std::vector& rvNodeIndex);
 void GatherRefFields(std::vector& rvRFields, const 
sal_uInt16 nTyp);
 void GatherFields(std::vector& rvFormatFields, bool 
bCollectOnlyInDocNodes=true) const;
+void GatherDdeTables(std::vector& rvTables) const;
 };
 
 /** Base class of all fields.
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 706026120aaa..04284a30ad87 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -32,6 +32,7 @@ class SwField;
 class SwTextField;
 class SwView;
 class SwFieldType;
+class SwDDETable;
 class SwFormatField;
 class IDocumentRedlineAccess;
 namespace com::sun::star::text { class XTextField; }
@@ -71,6 +72,10 @@ namespace sw {
 std::vector& m_rvFields;
 GatherFieldsHint(std::vector& rvFields, bool 
bCollectOnlyInDocNodes = true) : 
m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), m_rvFields(rvFields) {};
 };
+struct GatherDdeTablesHint final : SfxHint {
+std::vector& m_rvTables;
+GatherDdeTablesHint(std::vector& rvTables) : 
m_rvTables(rvTables) {};
+};
 }
 
 
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 9e07a8afa9bf..ec5eddcffac3 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -99,7 +100,7 @@ public:
 OSL_ENSURE(m_rFieldType.GetDoc(), "no pDoc");
 
 // no dependencies left?
-if (m_rFieldType.HasWriterListeners() && !m_rFieldType.IsModifyLocked() && 
!ChkNoDataFlag())
+if (!m_rFieldType.IsModifyLocked() && !ChkNoDataFlag())
 {
 SwViewShell* pSh = 
m_rFieldType.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
 SwEditShell* pESh = m_rFieldType.GetDoc()->GetEditShell();
@@ -109,8 +110,11 @@ public:
 m_rFieldType.LockModify();
 
 std::vector vFields;
+std::vector vTables;
 m_rFieldType.GatherFields(vFields, false);
-if(vFields.size())
+m_rFieldType.GatherDdeTables(vTables);
+const bool bDoAction = vFields.size() || vTables.size();
+if(bDoAction)
 {
 if(pESh)
 pESh->StartAllAction();
@@ -118,16 +122,19 @@ public:
 pSh->StartAction();
 }
 
+// DDE fields attribute in the text
 for(auto pFormatField: vFields)
 {
-// a DDE table or a DDE field attribute in the text
 if(pFormatField->GetTextField())
 pFormatField->UpdateTextNode( nullptr,  );
 }
+// a DDE tables in the text
+for(auto pTable: vTables)
+pTable->ChangeContent();
 
 m_rFieldType.UnlockModify();
 
-if(vFields.size())
+if(bDoAction)
 {
 if(pESh)
 pESh->EndAllAction();
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index f4b959014575..a131515eaa0e 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -118,6 +119,9 @@ void SwDDETable::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
 pInRangeHint->m_nSttNd < pTableNd->EndOfSectionIndex() &&
 pInRangeHint->m_nEndNd > pTableNd->GetIndex() )
 pInRangeHint->m_rIsInRange = true;
+} else if (const auto pGatherDdeTablesHint = dynamic_cast())
+{
+pGatherDdeTablesHint->m_rvTables.push_back(this);
 }
 else if (auto pModifyChangedHint = dynamic_cast())
 {
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index cf3a41460ba3..ad2914c390c1 100644
--- 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-10-25 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/fldbas.hxx|2 ++
 sw/inc/fmtfld.hxx|5 +
 sw/source/core/fields/ddefld.cxx |   15 +++
 sw/source/core/fields/ddetbl.cxx |4 
 sw/source/core/fields/fldbas.cxx |5 +
 5 files changed, 27 insertions(+), 4 deletions(-)

New commits:
commit 98247b039baea4697e6c387025afcf6a2963c043
Author: Bjoern Michaelsen 
AuthorDate: Sun Oct 24 23:17:24 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Oct 25 11:17:34 2021 +0200

tdf#138531: Also update DDE tables, not only fields

Change-Id: I0cbf8ce355b460b2f7ea73c8fae653641c980979
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124129
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 5e0dc3378ee4..03a410834219 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -33,6 +33,7 @@
 class SwDoc;
 class SwField;
 class SwFormatField;
+class SwDDETable;
 class SwRootFrame;
 class SvNumberFormatter;
 class IDocumentRedlineAccess;
@@ -282,6 +283,7 @@ public:
 void GatherNodeIndex(std::vector& rvNodeIndex);
 void GatherRefFields(std::vector& rvRFields, const 
sal_uInt16 nTyp);
 void GatherFields(std::vector& rvFormatFields, bool 
bCollectOnlyInDocNodes=true) const;
+void GatherDdeTables(std::vector& rvTables) const;
 };
 
 /** Base class of all fields.
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index fdceaeacb73b..32a81303c3eb 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -33,6 +33,7 @@ class SwField;
 class SwTextField;
 class SwView;
 class SwFieldType;
+class SwDDETable;
 class SwFormatField;
 class IDocumentRedlineAccess;
 namespace com::sun::star::text { class XTextField; }
@@ -72,6 +73,10 @@ namespace sw {
 std::vector& m_rvFields;
 GatherFieldsHint(std::vector& rvFields, bool 
bCollectOnlyInDocNodes = true) : 
m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), m_rvFields(rvFields) {};
 };
+struct GatherDdeTablesHint final : SfxHint {
+std::vector& m_rvTables;
+GatherDdeTablesHint(std::vector& rvTables) : 
m_rvTables(rvTables) {};
+};
 }
 
 
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 2e060e4ae377..590fcef86cad 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -99,7 +100,7 @@ public:
 OSL_ENSURE(m_rFieldType.GetDoc(), "no pDoc");
 
 // no dependencies left?
-if (m_rFieldType.HasWriterListeners() && !m_rFieldType.IsModifyLocked() && 
!ChkNoDataFlag())
+if (!m_rFieldType.IsModifyLocked() && !ChkNoDataFlag())
 {
 SwViewShell* pSh = 
m_rFieldType.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
 SwEditShell* pESh = m_rFieldType.GetDoc()->GetEditShell();
@@ -109,8 +110,11 @@ public:
 m_rFieldType.LockModify();
 
 std::vector vFields;
+std::vector vTables;
 m_rFieldType.GatherFields(vFields, false);
-if(vFields.size())
+m_rFieldType.GatherDdeTables(vTables);
+const bool bDoAction = vFields.size() || vTables.size();
+if(bDoAction)
 {
 if(pESh)
 pESh->StartAllAction();
@@ -118,16 +122,19 @@ public:
 pSh->StartAction();
 }
 
+// DDE fields attribute in the text
 for(auto pFormatField: vFields)
 {
-// a DDE table or a DDE field attribute in the text
 if(pFormatField->GetTextField())
 pFormatField->UpdateTextNode( nullptr,  );
 }
+// a DDE tables in the text
+for(auto pTable: vTables)
+pTable->ChangeContent();
 
 m_rFieldType.UnlockModify();
 
-if(vFields.size())
+if(bDoAction)
 {
 if(pESh)
 pESh->EndAllAction();
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 5feda6df9769..b1576e1a1589 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -119,6 +120,9 @@ void SwDDETable::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
 pInRangeHint->m_nSttNd < pTableNd->EndOfSectionIndex() &&
 pInRangeHint->m_nEndNd > pTableNd->GetIndex() )
 pInRangeHint->m_rIsInRange = true;
+} else if (const auto pGatherDdeTablesHint = dynamic_cast())
+{
+pGatherDdeTablesHint->m_rvTables.push_back(this);
 }
 else if (auto pModifyChangedHint = dynamic_cast())
 {
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 8fbbf1596034..7bcbef589b0a 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -210,6 +210,11 @@ void 
SwFieldType::GatherFields(std::vector& 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-08-12 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/swtblfmt.hxx  |3 +++
 sw/source/core/attr/cellatr.cxx  |   16 
 sw/source/core/table/swtable.cxx |   16 ++--
 sw/source/core/undo/unattr.cxx   |8 
 4 files changed, 21 insertions(+), 22 deletions(-)

New commits:
commit 422150be82ed892ecf31a8ab76c1d1ca801dcda8
Author: Bjoern Michaelsen 
AuthorDate: Sat Aug 7 12:08:07 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Thu Aug 12 13:10:12 2021 +0200

Capsulate TableBox<>TableBoxFormat relation in a function

Change-Id: I731e9bae04147f7453721661228e78a16ed585db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120160
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index e61049919df1..a8ba7d31f630 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -60,6 +60,9 @@ class SAL_DLLPUBLIC_RTTI SwTableBoxFormat final: public 
SwFrameFormat
 
 public:
 virtual bool supportsFullDrawingLayerFillAttributeSet() const override;
+SwTableBox* GetTableBox();
+const SwTableBox* GetTableBox() const
+{ return const_cast(this)->GetTableBox(); };
 };
 
 #endif
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index 09003a7fff64..3fdfb0772c6a 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -84,22 +84,14 @@ SwTableBoxFormula* SwTableBoxFormula::Clone( SfxItemPool* ) 
const
 */
 const SwNode* SwTableBoxFormula::GetNodeOfFormula() const
 {
-const SwNode* pRet = nullptr;
-if( m_pDefinedIn )
-{
-SwTableBox* pBox = SwIterator( 
*m_pDefinedIn ).First();
-if( pBox )
-pRet = pBox->GetSttNd();
-}
-return pRet;
+auto pTableBox = GetTableBox();
+return pTableBox ? pTableBox->GetSttNd() : nullptr;
 }
 
 SwTableBox* SwTableBoxFormula::GetTableBox()
 {
-SwTableBox* pBox = nullptr;
-if( m_pDefinedIn )
-pBox = SwIterator( *m_pDefinedIn 
).First();
-return pBox;
+assert(!m_pDefinedIn || dynamic_cast(m_pDefinedIn));
+return m_pDefinedIn ? 
static_cast(m_pDefinedIn)->GetTableBox() : nullptr;
 }
 
 void SwTableBoxFormula::ChangeState( const SfxPoolItem* pItem )
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 5f633ef65546..3d595e2d614d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2273,6 +2273,15 @@ void SwTableBoxFormat::BoxAttributeChanged(SwTableBox& 
rBox, const SwTableBoxNum
 ChgNumToText(rBox, nNewFormat);
 }
 
+SwTableBox* SwTableBoxFormat::SwTableBoxFormat::GetTableBox()
+{
+SwIterator aIter(*this);
+auto pBox = aIter.First();
+SAL_INFO_IF(!pBox, "sw.core", "no box found at format");
+SAL_WARN_IF(pBox && aIter.Next(), "sw.core", "more than one box found at 
format");
+return pBox;
+}
+
 // for detection of modifications (mainly TableBoxAttribute)
 void SwTableBoxFormat::SwClientNotify(const SwModify& rMod, const SfxHint& 
rHint)
 {
@@ -2321,12 +2330,7 @@ void SwTableBoxFormat::SwClientNotify(const SwModify& 
rMod, const SfxHint& rHint
SfxItemState::SET == GetItemState(RES_BOXATR_VALUE, false) ||
SfxItemState::SET == GetItemState(RES_BOXATR_FORMULA, false) )
 {
-// fetch the box
-SwIterator aIter(*this);
-SwTableBox* pBox = aIter.First();
-SAL_INFO_IF(!pBox, "sw.core", "no box found at format");
-SAL_WARN_IF(pBox && aIter.Next(), "sw.core", "more than one box 
found at format");
-if(pBox)
+if(auto pBox = GetTableBox())
 BoxAttributeChanged(*pBox, pNewFormat, pNewFormula, pNewVal, 
nOldFormat);
 }
 }
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index cbd9fe52cd99..5329f1c00c59 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -141,11 +141,11 @@ void SwUndoFormatAttr::Init( const SwFormat & rFormat )
 }
 } else if (dynamic_cast()) {
 m_nNodeIndex = rFormat.GetContent().GetContentIdx()->GetIndex();
-} else if ( dynamic_cast< const SwTableBoxFormat* >(  ) !=  
nullptr ) {
-SwTableBox * pTableBox = SwIterator( rFormat 
).First();
-if ( pTableBox ) {
+} else if(auto pBoxFormat = dynamic_cast())
+{
+auto pTableBox = pBoxFormat->GetTableBox();
+if(pTableBox)
 m_nNodeIndex = pTableBox->GetSttIdx();
-}
 }
 }
 }


[Libreoffice-commits] core.git: sw/inc sw/source

2021-08-10 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/swtblfmt.hxx  |7 
 sw/source/core/table/swtable.cxx |  312 ++-
 2 files changed, 155 insertions(+), 164 deletions(-)

New commits:
commit fa5202f746b25ea444d120d746a0dc35b8f8cca5
Author: Bjoern Michaelsen 
AuthorDate: Sat Aug 7 11:38:03 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Tue Aug 10 08:29:55 2021 +0200

give SwTableBoxFormat::TableBoxAttributeChanged its own function

- ... because at somewhere around growing past 100 LOC it deserved that.
- also make the box a reference there as it should never be a nullptr

Change-Id: Ia14cfb7a88e14fdd02f6011a745c2b008d94bc10
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120159
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 14b200164b5d..e61049919df1 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -46,16 +46,17 @@ public:
 virtual bool supportsFullDrawingLayerFillAttributeSet() const override;
 };
 
-class SAL_DLLPUBLIC_RTTI SwTableBoxFormat final : public SwFrameFormat
+class SAL_DLLPUBLIC_RTTI SwTableBoxFormat final: public SwFrameFormat
 {
 friend class SwDoc;
 
-SwTableBoxFormat( SwAttrPool& rPool, SwFrameFormat *pDrvdFrame )
-: SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, 
aTableBoxSetRange )
+SwTableBoxFormat(SwAttrPool& rPool, SwFrameFormat* pDrvdFrame)
+: SwFrameFormat(rPool, OUString(), pDrvdFrame, RES_FRMFMT, 
aTableBoxSetRange)
 {}
 
 // For recognition of changes (especially TableBoxAttribute).
 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
+void BoxAttributeChanged(SwTableBox& rBox, const SwTableBoxNumFormat* 
pNewFormat, const SwTableBoxFormula* pNewFormula, const SwTableBoxValue* 
pNewValue, const sal_uLong nOldFormat);
 
 public:
 virtual bool supportsFullDrawingLayerFillAttributeSet() const override;
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index c750aa3d75f9..c17d6882b019 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2116,11 +2116,153 @@ static void ChgNumToText( SwTableBox& rBox, sal_uLong 
nFormat )
 }
 
 }
+void SwTableBoxFormat::BoxAttributeChanged(SwTableBox& rBox, const 
SwTableBoxNumFormat* pNewFormat, const SwTableBoxFormula* pNewFormula, const 
SwTableBoxValue* pNewValue, sal_uLong nOldFormat)
+{
+sal_uLong nNewFormat;
+if(pNewFormat)
+{
+nNewFormat = pNewFormat->GetValue();
+// new formatting
+// is it newer or has the current been removed?
+if( SfxItemState::SET != GetItemState(RES_BOXATR_VALUE, false))
+pNewFormat = nullptr;
+}
+else
+{
+// fetch the current Item
+(void)GetItemState(RES_BOXATR_FORMAT, false, reinterpret_cast());
+nOldFormat = GetTableBoxNumFormat().GetValue();
+nNewFormat = pNewFormat ? pNewFormat->GetValue() : nOldFormat;
+}
+
+// is it newer or has the current been removed?
+if(pNewValue)
+{
+if(GetDoc()->GetNumberFormatter()->IsTextFormat(nNewFormat))
+nOldFormat = 0;
+else
+{
+if(SfxItemState::SET == GetItemState(RES_BOXATR_VALUE, false))
+nOldFormat = getSwDefaultTextFormat();
+else
+nNewFormat = getSwDefaultTextFormat();
+}
+}
+
+// Logic:
+// Value change: -> "simulate" a format change!
+// Format change:
+// Text -> !Text or format change:
+//  - align right for horizontal alignment, if LEFT or JUSTIFIED
+//  - align bottom for vertical alignment, if TOP is set, or 
default
+//  - replace text (color? negative numbers RED?)
+// !Text -> Text:
+//  - align left for horizontal alignment, if RIGHT
+//  - align top for vertical alignment, if BOTTOM is set
+SvNumberFormatter* pNumFormatr = GetDoc()->GetNumberFormatter();
+bool bNewIsTextFormat = pNumFormatr->IsTextFormat(nNewFormat);
+
+if((!bNewIsTextFormat && nOldFormat != nNewFormat) || pNewFormula)
+{
+bool bIsNumFormat = false;
+OUString aOrigText;
+bool bChgText = true;
+double fVal = 0;
+if(!pNewValue && SfxItemState::SET != GetItemState(RES_BOXATR_VALUE, 
false, reinterpret_cast()))
+{
+// so far, no value has been set, so try to evaluate the content
+sal_uLong nNdPos = rBox.IsValidNumTextNd();
+if(ULONG_MAX != nNdPos)
+{
+sal_uInt32 nTmpFormatIdx = nNewFormat;
+OUString aText(GetDoc()->GetNodes()[nNdPos] 
->GetTextNode()->GetRedlineText());
+aOrigText = aText;
+if(aText.isEmpty())
+bChgText = false;
+else
+{
+// Keep Tabs
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-1-5' - sw/source

2021-07-12 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 8d894294fa4cb006d1ddca846f8e44ed2b57d063
Author: Bjoern Michaelsen 
AuthorDate: Sun Jul 4 11:58:07 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 12 11:48:44 2021 +0200

tdf#140506: fix repeated table header switching

this fixes regression from f899c28f210c6565b7227d7665d449f194d2af8e,
which asssumed all frames to be listening to the Notifier of the
format. That is not (yet) the case.

Change-Id: Ib684842c571823eeb72824196ccfdb1df8179e85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118370
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 25e09087d8e2c5cecca1d548c69a263c7bf8b7ca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118418
(cherry picked from commit dd4d221f77501eb36c816ade48869d385462f18c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118423
Reviewed-by: Xisco Fauli 
Reviewed-by: Thorsten Behrens 
Tested-by: Michael Stahl 

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index acca43916522..13ea311ea84f 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2897,9 +2897,9 @@ void SwDoc::SetRowsToRepeat( SwTable , sal_uInt16 
nSet )
 std::make_unique(rTable, 
rTable.GetRowsToRepeat(), nSet) );
 }
 
+rTable.SetRowsToRepeat(nSet);
 const SwMsgPoolItem aChg(RES_TBLHEADLINECHG);
-rTable.SetRowsToRepeat( nSet );
-
rTable.GetFrameFormat()->GetNotifier().Broadcast(sw::LegacyModifyHint(, 
));
+rTable.GetFrameFormat()->CallSwClientNotify(sw::LegacyModifyHint(, 
));
 getIDocumentState().SetModified();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/inc sw/source

2021-07-09 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/hints.hxx |9 
 sw/source/core/layout/tabfrm.cxx |   25 +++-
 sw/source/core/table/swtable.cxx |   40 +--
 3 files changed, 39 insertions(+), 35 deletions(-)

New commits:
commit 56d7965b6c24915359f39f45f1696c6f1dc3d3c9
Author: Bjoern Michaelsen 
AuthorDate: Mon Jul 5 02:34:18 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Jul 9 23:28:43 2021 +0200

Remove some iterator abuse

Change-Id: I9279a1729e1715ac44c600c930f50c6e8704e676
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118393
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 8f978d886c2a..afaf1d9022d9 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -34,6 +34,8 @@ class SwHistory;
 class SwTextNode;
 class SwTextFormatColl;
 class SwFrameFormat;
+class SwTableBox;
+class SwTableBoxFormat;
 class SwTableLine;
 class SwTableLineFormat;
 class SwTableBox;
@@ -179,6 +181,13 @@ public:
 const SwTableLine& m_rTabLine;
 TableLineFormatChanged(const SwTableLineFormat& rNewFormat, const 
SwTableLine& rTabLine) : m_rNewFormat(rNewFormat), m_rTabLine(rTabLine) {};
 };
+class TableBoxFormatChanged final : public SfxHint
+{
+public:
+const SwTableBoxFormat& m_rNewFormat;
+const SwTableBox& m_rTableBox;
+TableBoxFormatChanged(const SwTableBoxFormat& rNewFormat, const 
SwTableBox& rTableBox) : m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
+};
 }
 
 class SwUpdateAttr final : public SwMsgPoolItem
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c50f4d4873eb..36c5ba5faf1e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -5459,7 +5459,30 @@ void SwCellFrame::Format( vcl::RenderContext* 
/*pRenderContext*/, const SwBorder
 
 void SwCellFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 {
-if(auto pMoveTableBoxHint = dynamic_cast())
+if(auto pNewFormatHint = dynamic_cast())
+{
+if(GetTabBox() != >m_rTableBox)
+return;
+
RegisterToFormat(const_cast(pNewFormatHint->m_rNewFormat));
+InvalidateSize();
+InvalidatePrt_();
+SetCompletePaint();
+SetDerivedVert(false);
+CheckDirChange();
+
+// #i47489#
+// make sure that the row will be formatted, in order
+// to have the correct Get(Top|Bottom)MarginForLowers values
+// set at the row.
+const SwTabFrame* pTab = FindTabFrame();
+if(pTab && pTab->IsCollapsingBorders())
+{
+SwFrame* pRow = GetUpper();
+pRow->InvalidateSize_();
+pRow->InvalidatePrt_();
+}
+}
+else if(auto pMoveTableBoxHint = dynamic_cast())
 {
 if(GetTabBox() != >m_rTableBox)
 return;
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index fe6a221daa0c..1da79f960545 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1689,45 +1689,17 @@ SwFrameFormat* SwTableBox::ClaimFrameFormat()
 return pRet;
 }
 
-void SwTableBox::ChgFrameFormat( SwTableBoxFormat* pNewFormat, bool 
bNeedToReregister )
+void SwTableBox::ChgFrameFormat(SwTableBoxFormat* pNewFormat, bool 
bNeedToReregister)
 {
-SwFrameFormat *pOld = GetFrameFormat();
-SwIterator aIter( *pOld );
-
+SwFrameFormat* pOld = GetFrameFormat();
 // tdf#84635 We set bNeedToReregister=false to avoid a quadratic slowdown 
on loading large tables,
 // and since we are creating the table for the first time, no 
re-registration is necessary.
-
 // First, re-register the Frames.
-if (bNeedToReregister)
-for( SwCellFrame* pCell = aIter.First(); pCell; pCell = aIter.Next() )
-{
-if( pCell->GetTabBox() == this )
-{
-pCell->RegisterToFormat( *pNewFormat );
-pCell->InvalidateSize();
-pCell->InvalidatePrt_();
-pCell->SetCompletePaint();
-pCell->SetDerivedVert( false );
-pCell->CheckDirChange();
-
-// #i47489#
-// make sure that the row will be formatted, in order
-// to have the correct Get(Top|Bottom)MarginForLowers values
-// set at the row.
-const SwTabFrame* pTab = pCell->FindTabFrame();
-if ( pTab && pTab->IsCollapsingBorders() )
-{
-SwFrame* pRow = pCell->GetUpper();
-pRow->InvalidateSize_();
-pRow->InvalidatePrt_();
-}
-}
-}
-
+if(bNeedToReregister)
+pOld->CallSwClientNotify(sw::TableBoxFormatChanged(*pNewFormat, 
*this));
 // Now, re-register self.
-pNewFormat->Add( this );
-
-if( !pOld->HasWriterListeners() )
+pNewFormat->Add(this);
+

[Libreoffice-commits] core.git: sw/inc sw/source

2021-07-09 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/hints.hxx |9 +++
 sw/source/core/layout/tabfrm.cxx |   29 -
 sw/source/core/table/swtable.cxx |   44 ---
 3 files changed, 42 insertions(+), 40 deletions(-)

New commits:
commit 0c8f364421014486c4e35a78a6dabca5b6a5dd26
Author: Bjoern Michaelsen 
AuthorDate: Mon Jul 5 01:53:48 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Jul 9 23:28:08 2021 +0200

remove some SwIterator abuse

Change-Id: Ic95562ebb57106c733d919059ff9d042fef28f3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118392
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index e83d42251882..8f978d886c2a 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -35,6 +35,7 @@ class SwTextNode;
 class SwTextFormatColl;
 class SwFrameFormat;
 class SwTableLine;
+class SwTableLineFormat;
 class SwTableBox;
 
 // Base class for all Message-Hints:
@@ -170,6 +171,14 @@ public:
 class DocumentDyingHint final : public SfxHint
 {
 };
+
+class TableLineFormatChanged final : public SfxHint
+{
+public:
+const SwTableLineFormat& m_rNewFormat;
+const SwTableLine& m_rTabLine;
+TableLineFormatChanged(const SwTableLineFormat& rNewFormat, const 
SwTableLine& rTabLine) : m_rNewFormat(rNewFormat), m_rTabLine(rTabLine) {};
+};
 }
 
 class SwUpdateAttr final : public SwMsgPoolItem
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c54b24d59e3d..c50f4d4873eb 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3919,7 +3919,34 @@ void SwRowFrame::OnFrameSize(const SfxPoolItem& rSize)
 
 void SwRowFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
 {
-if(auto pMoveTableLineHint = dynamic_cast())
+if(auto pNewFormatHint = dynamic_cast())
+{
+if(GetTabLine() != >m_rTabLine)
+return;
+
RegisterToFormat(const_cast(pNewFormatHint->m_rNewFormat));
+InvalidateSize();
+InvalidatePrt_();
+SetCompletePaint();
+ReinitializeFrameSizeAttrFlags();
+
+// #i35063#
+// consider 'split row allowed' attribute
+SwTabFrame* pTab = FindTabFrame();
+bool bInFollowFlowRow = false;
+const bool bInFirstNonHeadlineRow = pTab->IsFollow() && this == 
pTab->GetFirstNonHeadlineRow();
+if(bInFirstNonHeadlineRow ||
+ !GetNext() ||
+ (bInFollowFlowRow = IsInFollowFlowRow()) ||
+ nullptr != IsInSplitTableRow() )
+{
+if(bInFirstNonHeadlineRow || bInFollowFlowRow)
+pTab = pTab->FindMaster();
+
+pTab->SetRemoveFollowFlowLinePending(true);
+pTab->InvalidatePos();
+}
+}
+else if(auto pMoveTableLineHint = dynamic_cast())
 {
 
 if(GetTabLine() != >m_rTableLine)
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index c2f3b3bd9764..fe6a221daa0c 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1496,47 +1496,13 @@ SwFrameFormat* SwTableLine::ClaimFrameFormat()
 return pRet;
 }
 
-void SwTableLine::ChgFrameFormat( SwTableLineFormat *pNewFormat )
+void SwTableLine::ChgFrameFormat(SwTableLineFormat* pNewFormat)
 {
-SwFrameFormat *pOld = GetFrameFormat();
-SwIterator aIter( *pOld );
-
-// First, re-register the Frames.
-for( SwRowFrame* pRow = aIter.First(); pRow; pRow = aIter.Next() )
-{
-if( pRow->GetTabLine() == this )
-{
-pRow->RegisterToFormat( *pNewFormat );
-
-pRow->InvalidateSize();
-pRow->InvalidatePrt_();
-pRow->SetCompletePaint();
-pRow->ReinitializeFrameSizeAttrFlags();
-
-// #i35063#
-// consider 'split row allowed' attribute
-SwTabFrame* pTab = pRow->FindTabFrame();
-bool bInFollowFlowRow = false;
-const bool bInFirstNonHeadlineRow = pTab->IsFollow() &&
-pRow == 
pTab->GetFirstNonHeadlineRow();
-if ( bInFirstNonHeadlineRow ||
- !pRow->GetNext() ||
- ( bInFollowFlowRow = pRow->IsInFollowFlowRow() ) ||
- nullptr != pRow->IsInSplitTableRow() )
-{
-if ( bInFirstNonHeadlineRow || bInFollowFlowRow )
-pTab = pTab->FindMaster();
-
-pTab->SetRemoveFollowFlowLinePending( true );
-pTab->InvalidatePos();
-}
-}
-}
-
+auto pOld = GetFrameFormat();
+pOld->CallSwClientNotify(sw::TableLineFormatChanged(*pNewFormat, *this));
 // Now, re-register self.
-pNewFormat->Add( this );
-
-if ( !pOld->HasWriterListeners() )
+pNewFormat->Add(this);
+if(!pOld->HasWriterListeners())
 delete pOld;
 }
 

[Libreoffice-commits] core.git: sw/source

2021-07-09 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/inc/frmtool.hxx |   14 --
 sw/source/core/layout/frmtool.cxx  |   27 ++-
 sw/source/core/layout/laycache.cxx |5 +
 sw/source/core/layout/tabfrm.cxx   |   21 -
 sw/source/core/layout/wsfrm.cxx|8 
 5 files changed, 47 insertions(+), 28 deletions(-)

New commits:
commit debfdcfc0b2c07319e4a754decab18a292dc227c
Author: Bjoern Michaelsen 
AuthorDate: Sun Jul 4 13:00:03 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Jul 9 23:27:26 2021 +0200

remove global bDontCreateObjects bit

Wrapping this in a scope based helper is mostly lipstick on a pig, but
at least one cant forget toggling back this way. Apparently, this flag
was already toggled in recursive calls without checking previous state,
which is likely buggy.

In the long run, this should a/ never be used recursively or better b/
not be a global flag at all.

Change-Id: Id3554d2acb94d565611701c046ca4d8669594cea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118371
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 1974338f7936..4e328ca32af9 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -150,9 +150,6 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex ,
 
 extern bool bObjsDirect;
 
-// prevent creation of Flys in InsertCnt_, e.g. for table headlines
-extern bool bDontCreateObjects;
-
 // for FlyCnts, see SwFlyAtContentFrame::MakeAll()
 extern bool bSetCompletePaintOnInvalidate;
 
@@ -161,9 +158,14 @@ SwTwips CalcRowRstHeight( SwLayoutFrame *pRow );
 tools::Long CalcHeightWithFlys( const SwFrame *pFrame );
 
 namespace sw {
-
-bool IsRightPageByNumber(SwRootFrame const& rLayout, sal_uInt16 nPageNum);
-
+bool IsRightPageByNumber(SwRootFrame const& rLayout, sal_uInt16 nPageNum);
+class FlyCreationSuppressor
+{
+const bool m_wasAlreadySuppressed;
+public:
+FlyCreationSuppressor(bool isAlreadySuppressedAllowed = true);
+~FlyCreationSuppressor();
+};
 } // namespace sw
 
 SwPageFrame *InsertNewPage( SwPageDesc , SwFrame *pUpper,
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index c50061bcf68e..59429f55ddf2 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -79,8 +79,25 @@
 
 using namespace ::com::sun::star;
 
+namespace {
+// FIXME: would likely better be a member of SwRootFrame instead of a 
global flag
+bool isFlyCreationSuppressed = false;
+}
+namespace sw {
+FlyCreationSuppressor::FlyCreationSuppressor(bool 
wasAlreadySuppressedAllowed)
+: m_wasAlreadySuppressed(isFlyCreationSuppressed)
+{
+(void)wasAlreadySuppressedAllowed;
+assert(wasAlreadySuppressedAllowed || !isFlyCreationSuppressed);
+isFlyCreationSuppressed = true;
+}
+FlyCreationSuppressor::~FlyCreationSuppressor()
+{
+isFlyCreationSuppressed = m_wasAlreadySuppressed;
+}
+}
+
 bool bObjsDirect = true;
-bool bDontCreateObjects = false;
 bool bSetCompletePaintOnInvalidate = false;
 
 sal_uInt8 StackHack::s_nCnt = 0;
@@ -1588,7 +1605,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
 lcl_SetPos( *pFrame, *pLay );
 pPrv = pFrame;
 
-if ( !pTable->empty() && bObjsDirect && !bDontCreateObjects )
+if ( !pTable->empty() && bObjsDirect && !isFlyCreationSuppressed )
 AppendObjs( pTable, nIndex, pFrame, pPage, pDoc );
 }
 else if ( pNd->IsTableNode() )
@@ -1893,7 +1910,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
 assert(false); // actually a fly-section can't be deleted?
 continue; // skip it
 }
-if ( !pTable->empty() && bObjsDirect && !bDontCreateObjects )
+if ( !pTable->empty() && bObjsDirect && !isFlyCreationSuppressed )
 {
 SwFlyFrame* pFly = pLay->FindFlyFrame();
 if( pFly )
@@ -1922,7 +1939,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
 
 if ( bPages ) // let the Flys connect to each other
 {
-if ( !bDontCreateObjects )
+if ( !isFlyCreationSuppressed )
 AppendAllObjs( pTable, pLayout );
 bObjsDirect = true;
 }
@@ -2110,7 +2127,7 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex ,
   nEndIdx, pPrv, eMode );
 // OD 23.06.2003 #108784# - correction: append objects doesn't
 // depend on value of 
-if( !bDontCreateObjects )
+if( !isFlyCreationSuppressed )
 {
 const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
 if( !pTable->empty() )
diff --git a/sw/source/core/layout/laycache.cxx 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

2021-07-05 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3d98d35cfab126764ae5a35cee0a4da56baab648
Author: Bjoern Michaelsen 
AuthorDate: Sun Jul 4 11:58:07 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jul 5 15:41:20 2021 +0200

tdf#140506: fix repeated table header switching

this fixes regression from f899c28f210c6565b7227d7665d449f194d2af8e,
which asssumed all frames to be listening to the Notifier of the
format. That is not (yet) the case.

Change-Id: Ib684842c571823eeb72824196ccfdb1df8179e85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118370
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 25e09087d8e2c5cecca1d548c69a263c7bf8b7ca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118417
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index a17ce9b3e041..3ddfd2019d17 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2904,9 +2904,9 @@ void SwDoc::SetRowsToRepeat( SwTable , sal_uInt16 
nSet )
 std::make_unique(rTable, 
rTable.GetRowsToRepeat(), nSet) );
 }
 
+rTable.SetRowsToRepeat(nSet);
 const SwMsgPoolItem aChg(RES_TBLHEADLINECHG);
-rTable.SetRowsToRepeat( nSet );
-
rTable.GetFrameFormat()->GetNotifier().Broadcast(sw::LegacyModifyHint(, 
));
+rTable.GetFrameFormat()->CallSwClientNotify(sw::LegacyModifyHint(, 
));
 getIDocumentState().SetModified();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source

2021-07-05 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit dd4d221f77501eb36c816ade48869d385462f18c
Author: Bjoern Michaelsen 
AuthorDate: Sun Jul 4 11:58:07 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jul 5 14:12:22 2021 +0200

tdf#140506: fix repeated table header switching

this fixes regression from f899c28f210c6565b7227d7665d449f194d2af8e,
which asssumed all frames to be listening to the Notifier of the
format. That is not (yet) the case.

Change-Id: Ib684842c571823eeb72824196ccfdb1df8179e85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118370
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 25e09087d8e2c5cecca1d548c69a263c7bf8b7ca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118418

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index acca43916522..13ea311ea84f 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2897,9 +2897,9 @@ void SwDoc::SetRowsToRepeat( SwTable , sal_uInt16 
nSet )
 std::make_unique(rTable, 
rTable.GetRowsToRepeat(), nSet) );
 }
 
+rTable.SetRowsToRepeat(nSet);
 const SwMsgPoolItem aChg(RES_TBLHEADLINECHG);
-rTable.SetRowsToRepeat( nSet );
-
rTable.GetFrameFormat()->GetNotifier().Broadcast(sw::LegacyModifyHint(, 
));
+rTable.GetFrameFormat()->CallSwClientNotify(sw::LegacyModifyHint(, 
));
 getIDocumentState().SetModified();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2021-07-05 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 25e09087d8e2c5cecca1d548c69a263c7bf8b7ca
Author: Bjoern Michaelsen 
AuthorDate: Sun Jul 4 11:58:07 2021 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 5 12:09:42 2021 +0200

tdf#140506: fix repeated table header switching

this fixes regression from f899c28f210c6565b7227d7665d449f194d2af8e,
which asssumed all frames to be listening to the Notifier of the
format. That is not (yet) the case.

Change-Id: Ib684842c571823eeb72824196ccfdb1df8179e85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118370
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index d6c37d252d36..6e44077c5614 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2904,9 +2904,9 @@ void SwDoc::SetRowsToRepeat( SwTable , sal_uInt16 
nSet )
 std::make_unique(rTable, 
rTable.GetRowsToRepeat(), nSet) );
 }
 
+rTable.SetRowsToRepeat(nSet);
 const SwMsgPoolItem aChg(RES_TBLHEADLINECHG);
-rTable.SetRowsToRepeat( nSet );
-
rTable.GetFrameFormat()->GetNotifier().Broadcast(sw::LegacyModifyHint(, 
));
+rTable.GetFrameFormat()->CallSwClientNotify(sw::LegacyModifyHint(, 
));
 getIDocumentState().SetModified();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source

2021-05-12 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/access/accnotextframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b129ce4426d460963ace6c9e69c4b44e2a3615c2
Author: Bjoern Michaelsen 
AuthorDate: Sun May 9 01:30:40 2021 +0200
Commit: Caolán McNamara 
CommitDate: Wed May 12 18:34:22 2021 +0200

tdf#141307: adapt null-check

- if we check pNd for nullptr, we need to expect it to be nullptr
- in that case we shouldnt use the pointer before the null check

Change-Id: Ia9d11abe32fac10f36fdbfcefeadd51891f1834e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115264
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 
(cherry picked from commit b0ae5fd236663f7e81af06a567ade8a2a745)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115287
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/access/accnotextframe.cxx 
b/sw/source/core/access/accnotextframe.cxx
index 3dfed9ea3303..d8f37887b4a4 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -63,11 +63,11 @@ SwAccessibleNoTextFrame::SwAccessibleNoTextFrame(
 msDesc()
 {
 const SwNoTextNode* pNd = GetNoTextNode();
-StartListening(const_cast(pNd)->GetNotifier());
 // #i73249#
 // consider new attributes Title and Description
 if( pNd )
 {
+StartListening(const_cast(pNd)->GetNotifier());
 msTitle = pNd->GetTitle();
 
 msDesc = pNd->GetDescription();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2021-05-12 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/access/accnotextframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b0ae5fd236663f7e81af06a567ade8a2a745
Author: Bjoern Michaelsen 
AuthorDate: Sun May 9 01:30:40 2021 +0200
Commit: Bjoern Michaelsen 
CommitDate: Wed May 12 17:19:20 2021 +0200

tdf#141307: adapt null-check

- if we check pNd for nullptr, we need to expect it to be nullptr
- in that case we shouldnt use the pointer before the null check

Change-Id: Ia9d11abe32fac10f36fdbfcefeadd51891f1834e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115264
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/access/accnotextframe.cxx 
b/sw/source/core/access/accnotextframe.cxx
index 3dfed9ea3303..d8f37887b4a4 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -63,11 +63,11 @@ SwAccessibleNoTextFrame::SwAccessibleNoTextFrame(
 msDesc()
 {
 const SwNoTextNode* pNd = GetNoTextNode();
-StartListening(const_cast(pNd)->GetNotifier());
 // #i73249#
 // consider new attributes Title and Description
 if( pNd )
 {
+StartListening(const_cast(pNd)->GetNotifier());
 msTitle = pNd->GetTitle();
 
 msDesc = pNd->GetDescription();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source

2021-03-31 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/section.cxx |   44 ++---
 1 file changed, 17 insertions(+), 27 deletions(-)

New commits:
commit 296c1b3b7e2fca6d54e3e61684d70d12f7989624
Author: Bjoern Michaelsen 
AuthorDate: Sun Nov 22 10:47:20 2020 +0100
Commit: Xisco Fauli 
CommitDate: Wed Mar 31 16:26:26 2021 +0200

tdf#140863: section.cxx: Remove remaining SwClientNotifyCalls

Change-Id: I569c5952a7491c37c677ad6b6d5f803a50b2e701
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106341
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 
(cherry picked from commit 5fc6a601d7a1978db291fd0f7dcec638a7c25651)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113361
Reviewed-by: Michael Stahl 
Tested-by: Xisco Fauli 

diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index a3dad1262b23..00adf5a40f47 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -66,13 +66,6 @@
 using namespace ::com::sun::star;
 
 namespace {
-
-void lcl_SwClientNotify(sw::BroadcastingModify& rModify, const 
SfxPoolItem* pOldNew)
-{
-const sw::LegacyModifyHint aHint(pOldNew, pOldNew);
-rModify.SwClientNotifyCall(rModify, aHint);
-}
-
 class SwIntrnlSectRefLink : public SwBaseLink
 {
 SwSectionFormat& m_rSectFormat;
@@ -318,8 +311,8 @@ void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, 
bool const bCondition)
 // This should be shown by the bHiddenFlag.
 
 // Tell all Children that they are hidden
-SwMsgPoolItem aMsgItem( RES_SECTION_HIDDEN );
-lcl_SwClientNotify(*pFormat, );
+const SwMsgPoolItem aMsgItem( RES_SECTION_HIDDEN );
+pFormat->CallSwClientNotify(sw::LegacyModifyHint(, 
));
 
 // Delete all Frames
 pFormat->DelFrames();
@@ -333,8 +326,8 @@ void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, 
bool const bCondition)
 if( !pParentSect || !pParentSect->IsHiddenFlag() )
 {
 // Tell all Children that the Parent is not hidden anymore
-SwMsgPoolItem aMsgItem( RES_SECTION_NOT_HIDDEN );
-lcl_SwClientNotify(*pFormat, );
+const SwMsgPoolItem aMsgItem( RES_SECTION_NOT_HIDDEN );
+pFormat->CallSwClientNotify(sw::LegacyModifyHint(, 
));
 
 pFormat->MakeFrames();
 }
@@ -719,8 +712,8 @@ void SwSectionFormat::DelFrames()
 SwContentNode* pCNd = GetDoc()->GetNodes().GoNextSection( , true, 
false );
 if( pCNd )
 {
-const SfxPoolItem& rItem = pCNd->GetSwAttrSet().Get( RES_PAGEDESC );
-lcl_SwClientNotify(*pCNd, );
+const SfxPoolItem& rItem = pCNd->GetSwAttrSet().Get(RES_PAGEDESC);
+pCNd->CallSwClientNotify(sw::LegacyModifyHint(, ));
 }
 }
 
@@ -945,22 +938,19 @@ void SwSectionFormat::UpdateParent()
 bIsHidden = pPS->IsHiddenFlag();
 }
 SwIterator aIter(*this);
-for(SwSectionFormat* pLast = aIter.First(); pLast; pLast = aIter.Next())
-{
-if(!pProtect->IsContentProtected() != !pSection->IsProtectFlag())
-lcl_SwClientNotify(*static_cast(pLast), 
static_cast(pProtect));
+if(!pProtect->IsContentProtected() != !pSection->IsProtectFlag())
+CallSwClientNotify(sw::LegacyModifyHint(pProtect, pProtect));
 
-// edit in readonly sections
-if(!pEditInReadonly->GetValue() != !pSection->IsEditInReadonlyFlag())
-lcl_SwClientNotify(*static_cast(pLast), 
static_cast(pEditInReadonly));
+// edit in readonly sections
+if(!pEditInReadonly->GetValue() != !pSection->IsEditInReadonlyFlag())
+CallSwClientNotify(sw::LegacyModifyHint(pEditInReadonly, 
pEditInReadonly));
 
-if(bIsHidden == pSection->IsHiddenFlag())
-{
-SwMsgPoolItem aMsgItem( static_cast(bIsHidden
-? RES_SECTION_HIDDEN
-: RES_SECTION_NOT_HIDDEN ) );
-lcl_SwClientNotify(*static_cast(pLast), 
);
-}
+if(bIsHidden == pSection->IsHiddenFlag())
+{
+SwMsgPoolItem aMsgItem(static_cast(bIsHidden
+? RES_SECTION_HIDDEN
+: RES_SECTION_NOT_HIDDEN));
+CallSwClientNotify(sw::LegacyModifyHint(, ));
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/inc

2021-02-23 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/swevent.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a3f83ecbeab33244b526ec68ca0f2034745a6371
Author: Bjoern Michaelsen 
AuthorDate: Mon Feb 22 20:20:54 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Tue Feb 23 17:20:42 2021 +0100

tdf#140226: use StaticWhichCast

Change-Id: I7f1345da0e67bfe14b119b92f32faa926b2ab603
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111356
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx
index 425db6b6e3f6..e18020320544 100644
--- a/sw/inc/swevent.hxx
+++ b/sw/inc/swevent.hxx
@@ -127,10 +127,10 @@ struct SwCallMouseEvent final
 switch(pLegacy->GetWhich())
 {
 case RES_FMT_CHG:
-bClear |= static_cast(pLegacy->m_pOld)->pChangedFormat == PTR.pFormat;
+bClear |= 
pLegacy->m_pOld->StaticWhichCast(RES_FMT_CHG).pChangedFormat == PTR.pFormat;
 break;
 case RES_REMOVE_UNO_OBJECT:
-bClear |= static_cast(pLegacy->m_pOld)->pObject == PTR.pFormat;
+bClear |= 
pLegacy->m_pOld->StaticWhichCast(RES_REMOVE_UNO_OBJECT).pObject == PTR.pFormat;
 }
 if(bClear)
 Clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2021-02-16 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/txtnode/SwGrammarContact.cxx |  103 ++--
 1 file changed, 53 insertions(+), 50 deletions(-)

New commits:
commit 837a40ec436ab9425a663a96597ac4ecf6390712
Author: Bjoern Michaelsen 
AuthorDate: Sun Feb 14 20:27:41 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Tue Feb 16 12:04:15 2021 +0100

Revert "Revert "replace SwClient by SvtListener in SwGrammarContact""

- This reverts commit 89d770f9727b9e7eddf933c96771df98082b3efb.
- ... and replaces the old Notify() with a simpler check for the 
Broadcaster.
- note however, that the ASAN use-after-free reported in the revert
  was not reproducable locally even with a hundred runs of unoapi_1, so
  cant claim to have removed what was not there. The fix is just a guess
  of what might have happened (namely: that the TextNode was locked on
  destruction and therefore do not send a RES_OBJECTDYING message).

Change-Id: I3ff53d8f8537470573cf06314947d9b23bdf578b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110885
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx 
b/sw/source/core/txtnode/SwGrammarContact.cxx
index 7b061bdaf9ba..162e0af09479 100644
--- a/sw/source/core/txtnode/SwGrammarContact.cxx
+++ b/sw/source/core/txtnode/SwGrammarContact.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace {
 
@@ -37,45 +38,50 @@ namespace {
  * will replace the old list. If the grammar checker has completed the 
paragraph ('setChecked')
  * then a timer is setup which replaces the old list as well.
  */
-class SwGrammarContact : public IGrammarContact, public SwClient
+class SwGrammarContact final : public IGrammarContact, public SvtListener
 {
-Timer aTimer;
-std::unique_ptr mpProxyList;
-bool mbFinished;
-SwTextNode* getMyTextNode() { return 
static_cast(GetRegisteredIn()); }
-  DECL_LINK( TimerRepaint, Timer *, void );
+Timer m_aTimer;
+std::unique_ptr m_pProxyList;
+bool m_isFinished;
+SwTextNode* m_pTextNode;
+DECL_LINK( TimerRepaint, Timer *, void );
 
 public:
 SwGrammarContact();
-virtual ~SwGrammarContact() override { aTimer.Stop(); }
+virtual ~SwGrammarContact() override { m_aTimer.Stop(); }
 
 // (pure) virtual functions of IGrammarContact
 virtual void updateCursorPosition( const SwPosition& rNewPos ) override;
 virtual SwGrammarMarkUp* getGrammarCheck( SwTextNode& rTextNode, bool 
bCreate ) override;
 virtual void finishGrammarCheck( SwTextNode& rTextNode ) override;
-protected:
-// virtual function of SwClient
-virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) 
override;
+void CheckBroadcaster()
+{
+if(HasBroadcaster())
+return;
+m_pTextNode = nullptr;
+m_pProxyList.reset();
+}
 };
 
 }
 
-SwGrammarContact::SwGrammarContact() : mbFinished( false )
+SwGrammarContact::SwGrammarContact() : m_isFinished( false ), 
m_pTextNode(nullptr)
 {
-aTimer.SetTimeout( 2000 );  // Repaint of grammar check after 'setChecked'
-aTimer.SetInvokeHandler( LINK(this, SwGrammarContact, TimerRepaint) );
-aTimer.SetDebugName( "sw::SwGrammarContact TimerRepaint" );
+m_aTimer.SetTimeout( 2000 );  // Repaint of grammar check after 
'setChecked'
+m_aTimer.SetInvokeHandler( LINK(this, SwGrammarContact, TimerRepaint) );
+m_aTimer.SetDebugName( "sw::SwGrammarContact TimerRepaint" );
 }
 
 IMPL_LINK( SwGrammarContact, TimerRepaint, Timer *, pTimer, void )
 {
+CheckBroadcaster();
 if( pTimer )
 {
 pTimer->Stop();
-if( GetRegisteredIn() )
+if( m_pTextNode )
 {   //Replace the old wrong list by the proxy list and repaint all 
frames
-getMyTextNode()->SetGrammarCheck( mpProxyList.release() );
-SwTextFrame::repaintTextFrames( *getMyTextNode() );
+m_pTextNode->SetGrammarCheck( m_pProxyList.release() );
+SwTextFrame::repaintTextFrames( *m_pTextNode );
 }
 }
 }
@@ -83,49 +89,55 @@ IMPL_LINK( SwGrammarContact, TimerRepaint, Timer *, pTimer, 
void )
 /* I'm always a client of the current paragraph */
 void SwGrammarContact::updateCursorPosition( const SwPosition& rNewPos )
 {
+CheckBroadcaster();
 SwTextNode* pTextNode = rNewPos.nNode.GetNode().GetTextNode();
-if( pTextNode == GetRegisteredIn() ) // paragraph has been changed
+if( pTextNode == m_pTextNode ) // paragraph has been changed
 return;
 
-aTimer.Stop();
-if( GetRegisteredIn() ) // My last paragraph has been left
+m_aTimer.Stop();
+if( m_pTextNode ) // My last paragraph has been left
 {
-if( mpProxyList )
+if( m_pProxyList )
 {   // replace old list by the proxy list and repaint
-getMyTextNode()->SetGrammarCheck( mpProxyList.release() );
-SwTextFrame::repaintTextFrames( *getMyTextNode() );
+  

[Libreoffice-commits] core.git: sw/inc

2021-02-08 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/calbck.hxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit dae4b159f628915e1ab8841e6bb66961ce4ea800
Author: Bjoern Michaelsen 
AuthorDate: Mon Feb 8 20:46:01 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Tue Feb 9 00:41:07 2021 +0100

Remove deadcode SwModify::CheckCaching()

Change-Id: I0048b211fa9b458456fbb408bcc82dbbe81a9504
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110595
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 0cd8efbee0ed..11a62033c5cc 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -195,6 +195,7 @@ public:
 void Add(SwClient *pDepend);
 SwClient* Remove(SwClient *pDepend);
 bool HasWriterListeners() const { return m_pWriterListeners; }
+bool HasOnlyOneListener() const { return m_pWriterListeners && 
m_pWriterListeners->IsLast(); }
 
 // get information about attribute
 virtual bool GetInfo( SfxPoolItem& ) const override;
@@ -202,9 +203,6 @@ public:
 void LockModify()   { m_bModifyLocked = true;  }
 void UnlockModify() { m_bModifyLocked = false; }
 bool IsModifyLocked() const { return m_bModifyLocked;  }
-
-void CheckCaching( const sal_uInt16 nWhich );
-bool HasOnlyOneListener() const { return m_pWriterListeners && 
m_pWriterListeners->IsLast(); }
 };
 
 template 
class SwIterator;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/inc sw/source

2021-02-08 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/calbck.hxx  |1 -
 sw/inc/hints.hxx   |4 
 sw/inc/tox.hxx |   23 +++
 sw/source/core/attr/calbck.cxx |   11 ---
 sw/source/core/doc/docnew.cxx  |   13 +++--
 5 files changed, 22 insertions(+), 30 deletions(-)

New commits:
commit dc1b416c684c4e2525978e48252d55d78adcfca8
Author: Bjoern Michaelsen 
AuthorDate: Mon Feb 8 20:21:12 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Feb 8 23:05:39 2021 +0100

Remove SwModify::SetInDocDTOR ...

... its only used once in SwTOXType and has no place in SwModify, which
is the base of ~everything in Writer still.

Change-Id: I07007f08723f8db2dd09bb7c07cb0ebfc2a6506a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110594
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 32b0d35b4c1d..0cd8efbee0ed 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -201,7 +201,6 @@ public:
 
 void LockModify()   { m_bModifyLocked = true;  }
 void UnlockModify() { m_bModifyLocked = false; }
-void SetInDocDTOR();
 bool IsModifyLocked() const { return m_bModifyLocked;  }
 
 void CheckCaching( const sal_uInt16 nWhich );
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 25fed4c87783..e83d42251882 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -166,6 +166,10 @@ public:
 const SwTableBox& m_rTableBox;
 MoveTableBoxHint(const SwFrameFormat& rNewFormat, const SwTableBox& 
rTableBox): m_rNewFormat(rNewFormat), m_rTableBox(rTableBox) {};
 };
+
+class DocumentDyingHint final : public SfxHint
+{
+};
 }
 
 class SwUpdateAttr final : public SwMsgPoolItem
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index c7bcaacf036a..f1b496091246 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -19,20 +19,20 @@
 #ifndef INCLUDED_SW_INC_TOX_HXX
 #define INCLUDED_SW_INC_TOX_HXX
 
-#include 
-#include 
+#include 
 
+#include 
+#include 
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 
-#include 
+#include "calbck.hxx"
+#include "hints.hxx"
 #include "swtypes.hxx"
 #include "toxe.hxx"
-#include "calbck.hxx"
-#include 
-
-#include 
 
 namespace com::sun::star {
 namespace text { class XDocumentIndexMark; }
@@ -467,6 +467,13 @@ public:
 SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = nullptr );
 virtual ~SwTOXBase() override;
 
+virtual void SwClientNotify(const SwModify& rMod, const SfxHint& rHint) 
override
+{
+if(dynamic_cast())
+GetRegisteredIn()->Remove(this);
+else
+SwClient::SwClientNotify(rMod, rHint);
+}
 // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc.
 // If not, so create it and copy all other used things.
 voidCopyTOXBase( SwDoc*, const SwTOXBase& );
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 0efc4ada197e..ae840edff48e 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -138,17 +138,6 @@ void SwClient::EndListeningAll()
 m_pRegisteredIn->Remove(this);
 }
 
-void SwModify::SetInDocDTOR()
-{
-// If the document gets destroyed anyway, just tell clients to
-// forget me so that they don't try to get removed from my list
-// later when they also get destroyed
-SwIterator aIter(*this);
-for(SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next())
-pClient->m_pRegisteredIn = nullptr;
-m_pWriterListeners = nullptr;
-}
-
 SwModify::~SwModify()
 {
 DBG_TESTSOLARMUTEX();
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 575980cac40c..9c789deb66b7 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -466,16 +466,9 @@ SwDoc::~SwDoc()
 delete pTmp;
 }
 
-// Old - deletion without a Flag is expensive, because we send a Modify
-// aTOXTypes.DeleteAndDestroy( 0, aTOXTypes.Count() );
-{
-for( auto n = mpTOXTypes->size(); n; )
-{
-(*mpTOXTypes)[ --n ]->SetInDocDTOR();
-(*mpTOXTypes)[ n ].reset();
-}
-mpTOXTypes->clear();
-}
+for(auto& pType : *mpTOXTypes)
+pType->CallSwClientNotify(sw::DocumentDyingHint());
+mpTOXTypes->clear();
 mpDefTOXBases.reset();
 
 // Any of the FrameFormats can still have indices registered.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2021-02-06 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/txtnode/SwGrammarContact.cxx |   89 ++--
 1 file changed, 46 insertions(+), 43 deletions(-)

New commits:
commit dcae40491eea2534c30ba96f10bc45035d073a46
Author: Bjoern Michaelsen 
AuthorDate: Sat Feb 6 00:54:46 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sat Feb 6 21:27:58 2021 +0100

replace SwClient by SvtListener in SwGrammarContact

Change-Id: I9bc31ac6a3990418c11a2f40ec0cc84f79f93d53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110495
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx 
b/sw/source/core/txtnode/SwGrammarContact.cxx
index 7b061bdaf9ba..e296cc7375e6 100644
--- a/sw/source/core/txtnode/SwGrammarContact.cxx
+++ b/sw/source/core/txtnode/SwGrammarContact.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace {
 
@@ -37,34 +38,32 @@ namespace {
  * will replace the old list. If the grammar checker has completed the 
paragraph ('setChecked')
  * then a timer is setup which replaces the old list as well.
  */
-class SwGrammarContact : public IGrammarContact, public SwClient
+class SwGrammarContact : public IGrammarContact, public SvtListener
 {
-Timer aTimer;
-std::unique_ptr mpProxyList;
-bool mbFinished;
-SwTextNode* getMyTextNode() { return 
static_cast(GetRegisteredIn()); }
-  DECL_LINK( TimerRepaint, Timer *, void );
+Timer m_aTimer;
+std::unique_ptr m_pProxyList;
+bool m_isFinished;
+SwTextNode* m_pTextNode;
+DECL_LINK( TimerRepaint, Timer *, void );
 
 public:
 SwGrammarContact();
-virtual ~SwGrammarContact() override { aTimer.Stop(); }
+virtual ~SwGrammarContact() override { m_aTimer.Stop(); }
 
 // (pure) virtual functions of IGrammarContact
 virtual void updateCursorPosition( const SwPosition& rNewPos ) override;
 virtual SwGrammarMarkUp* getGrammarCheck( SwTextNode& rTextNode, bool 
bCreate ) override;
 virtual void finishGrammarCheck( SwTextNode& rTextNode ) override;
-protected:
-// virtual function of SwClient
-virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) 
override;
+virtual void Notify( const SfxHint& rHint) override;
 };
 
 }
 
-SwGrammarContact::SwGrammarContact() : mbFinished( false )
+SwGrammarContact::SwGrammarContact() : m_isFinished( false ), 
m_pTextNode(nullptr)
 {
-aTimer.SetTimeout( 2000 );  // Repaint of grammar check after 'setChecked'
-aTimer.SetInvokeHandler( LINK(this, SwGrammarContact, TimerRepaint) );
-aTimer.SetDebugName( "sw::SwGrammarContact TimerRepaint" );
+m_aTimer.SetTimeout( 2000 );  // Repaint of grammar check after 
'setChecked'
+m_aTimer.SetInvokeHandler( LINK(this, SwGrammarContact, TimerRepaint) );
+m_aTimer.SetDebugName( "sw::SwGrammarContact TimerRepaint" );
 }
 
 IMPL_LINK( SwGrammarContact, TimerRepaint, Timer *, pTimer, void )
@@ -72,10 +71,10 @@ IMPL_LINK( SwGrammarContact, TimerRepaint, Timer *, pTimer, 
void )
 if( pTimer )
 {
 pTimer->Stop();
-if( GetRegisteredIn() )
+if( m_pTextNode )
 {   //Replace the old wrong list by the proxy list and repaint all 
frames
-getMyTextNode()->SetGrammarCheck( mpProxyList.release() );
-SwTextFrame::repaintTextFrames( *getMyTextNode() );
+m_pTextNode->SetGrammarCheck( m_pProxyList.release() );
+SwTextFrame::repaintTextFrames( *m_pTextNode );
 }
 }
 }
@@ -84,48 +83,51 @@ IMPL_LINK( SwGrammarContact, TimerRepaint, Timer *, pTimer, 
void )
 void SwGrammarContact::updateCursorPosition( const SwPosition& rNewPos )
 {
 SwTextNode* pTextNode = rNewPos.nNode.GetNode().GetTextNode();
-if( pTextNode == GetRegisteredIn() ) // paragraph has been changed
+if( pTextNode == m_pTextNode ) // paragraph has been changed
 return;
 
-aTimer.Stop();
-if( GetRegisteredIn() ) // My last paragraph has been left
+m_aTimer.Stop();
+if( m_pTextNode ) // My last paragraph has been left
 {
-if( mpProxyList )
+if( m_pProxyList )
 {   // replace old list by the proxy list and repaint
-getMyTextNode()->SetGrammarCheck( mpProxyList.release() );
-SwTextFrame::repaintTextFrames( *getMyTextNode() );
+m_pTextNode->SetGrammarCheck( m_pProxyList.release() );
+SwTextFrame::repaintTextFrames( *m_pTextNode );
 }
 EndListeningAll();
 }
 if( pTextNode )
-pTextNode->Add( this ); // welcome new paragraph
+{
+m_pTextNode = pTextNode;
+StartListening(pTextNode->GetNotifier()); // welcome new paragraph
+}
 }
 
 /* deliver a grammar check list for the given text node */
 SwGrammarMarkUp* SwGrammarContact::getGrammarCheck( SwTextNode& rTextNode, 
bool bCreate )
 {
 SwGrammarMarkUp *pRet = nullptr;
-if( GetRegisteredIn() ==  ) // hey, that's my current paragraph!
+if( m_pTextNode ==  ) // 

[Libreoffice-commits] core.git: sw/source

2021-02-03 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/attr/format.cxx  |8 
 sw/source/core/attr/swatrset.cxx|   32 +--
 sw/source/core/crsr/crstrvl.cxx |8 
 sw/source/core/crsr/findattr.cxx|   14 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |4 
 sw/source/core/doc/docfly.cxx   |   34 +--
 sw/source/core/doc/docfmt.cxx   |   23 +-
 sw/source/core/text/atrstck.cxx |  156 +++-
 sw/source/filter/ww8/ww8atr.cxx |   53 +++--
 sw/source/uibase/utlui/uitool.cxx   |   20 +-
 10 files changed, 177 insertions(+), 175 deletions(-)

New commits:
commit e89ff1a6378d3910f9026e5c4e797b74e20f7ce3
Author: Bjoern Michaelsen 
AuthorDate: Sun Jan 31 01:03:24 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Thu Feb 4 01:15:45 2021 +0100

use more StaticWhichCast

- because it uses TypedWhichIds well-defined mapping of id to type
- ... and assert, if the content found doesnt match up expectations

Change-Id: Idda58ccda47c5d074326537dcc6670ef0cfcabf1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110233
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 9224a61f2ab2..b668c8e24e6e 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -244,7 +244,7 @@ void SwFormat::SwClientNotify(const SwModify&, const 
SfxHint& rHint)
 break;
 // If the dying object is the parent format of this format so
 // attach this to the parent of the parent
-SwFormat* pFormat = static_cast(static_cast(pLegacy->m_pNew)->pObject);
+SwFormat* pFormat = 
static_cast(pLegacy->m_pNew->StaticWhichCast(RES_OBJECTDYING).pObject);
 
 // do not move if this is the topmost format
 if(GetRegisteredIn() && GetRegisteredIn() == pFormat)
@@ -442,7 +442,7 @@ SfxItemState 
SwFormat::GetBackgroundState(std::unique_ptr& rItem)
 const SfxPoolItem* pItem = nullptr;
 SfxItemState eRet = m_aSet.GetItemState(RES_BACKGROUND, true, );
 if (pItem)
-rItem.reset(static_cast(pItem->Clone()));
+rItem.reset(>Clone()->StaticWhichCast(RES_BACKGROUND));
 return eRet;
 }
 
@@ -459,7 +459,7 @@ bool SwFormat::SetFormatAttr( const SfxPoolItem& rAttr )
 // FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST 
.. XATTR_FILL_LAST]
 SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in 
place and used)");
 SfxItemSet aTempSet(*m_aSet.GetPool(), svl::Items{});
-const SvxBrushItem& rSource = static_cast< const SvxBrushItem& 
>(rAttr);
+const SvxBrushItem& rSource = rAttr.StaticWhichCast(RES_BACKGROUND);
 
 // fill a local ItemSet with the attributes corresponding as good as 
possible
 // to the new fill properties [XATTR_FILL_FIRST .. XATTR_FILL_LAST] 
and set these
@@ -559,7 +559,7 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet )
 // copy all items to be set anyways to a local ItemSet with is 
also prepared for the new
 // fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. 
Add the attributes
 // corresponding as good as possible to the new fill properties 
and set the whole ItemSet
-const SvxBrushItem& rSource(static_cast< const SvxBrushItem& 
>(*pSource));
+const SvxBrushItem& 
rSource(pSource->StaticWhichCast(RES_BACKGROUND));
 setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
 
 if(IsModifyLocked())
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index 90343c31e19f..aae6df77112b 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -253,32 +253,32 @@ bool SwAttrSet::SetModifyAtAttr( const 
sw::BroadcastingModify* pModify )
 
 const SfxPoolItem* pItem;
 if( SfxItemState::SET == GetItemState( RES_PAGEDESC, false,  ) &&
-static_cast(pItem)->GetDefinedIn() != pModify 
 )
+pItem->StaticWhichCast(RES_PAGEDESC).GetDefinedIn() != pModify  )
 {
-const_cast(static_cast(pItem))->ChgDefinedIn( pModify );
+
const_cast(pItem->StaticWhichCast(RES_PAGEDESC)).ChgDefinedIn(
 pModify );
 bSet = true;
 }
 
 if(SfxItemState::SET == GetItemState( RES_PARATR_DROP, false,  ))
 {
 auto pDropDefiner = dynamic_cast(pModify);
-auto pFormatDrop = const_cast(static_cast(pItem));
+SwFormatDrop& rFormatDrop = 
const_cast(pItem->StaticWhichCast(RES_PARATR_DROP));
 // If CharFormat is set and it is set in different attribute pools then
 // the CharFormat has to be copied.
-SwCharFormat* 

[Libreoffice-commits] core.git: sw/inc sw/Library_sw.mk sw/source

2021-01-29 Thread Bjoern Michaelsen (via logerrit)
 sw/Library_sw.mk |1 
 sw/inc/BorderCacheOwner.hxx  |   49 +++
 sw/inc/calbck.hxx|7 +---
 sw/inc/format.hxx|6 ++-
 sw/inc/node.hxx  |3 +
 sw/source/core/attr/BorderCacheOwner.cxx |   45 
 sw/source/core/attr/calbck.cxx   |   30 --
 sw/source/core/attr/format.cxx   |   47 ++---
 sw/source/core/bastyp/swcache.cxx|2 -
 sw/source/core/docnode/node.cxx  |   48 ++
 sw/source/core/inc/frmtool.hxx   |3 +
 sw/source/core/layout/frmtool.cxx|   20 ++--
 sw/source/core/txtnode/ndtxt.cxx |   17 +++---
 sw/source/core/undo/untbl.cxx|   12 +--
 14 files changed, 146 insertions(+), 144 deletions(-)

New commits:
commit d77552970af7ffb9d06bcd57315979f317e94e2f
Author: Bjoern Michaelsen 
AuthorDate: Sat Jan 23 01:09:49 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Fri Jan 29 23:10:59 2021 +0100

remove SwCache bookkeeping from SwModify

- only very few classes (SwNode, SwFormat) are the "owners"
  of SwBorderAttrs in the SwCache
- this bookkeeping should not be in such a fundamental class of writer
- also: encapsulate most of the interaction with the cache in the new
  sw::BorderCacheOwner. This is mostly to protect the innocent user:
  * As interacting with the SwCache directly is very errorprone, because
its glorious idea of using void* of the "owners" as keys to the
entries.
  * In C++, reinterpret_cast(this) might be different along the
class heirachy. This might easily slip under the radar of a casual
user.

Change-Id: I0da774b47885abf52f63aab8d93ebbf41dcf8040
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110112
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 65f4154bf12e..85fd37e2b150 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -124,6 +124,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/core/access/acctextframe \
 sw/source/core/access/parachangetrackinginfo \
 sw/source/core/access/textmarkuphelper \
+sw/source/core/attr/BorderCacheOwner \
 sw/source/core/attr/calbck \
 sw/source/core/attr/cellatr \
 sw/source/core/attr/fmtfollowtextflow \
diff --git a/sw/inc/BorderCacheOwner.hxx b/sw/inc/BorderCacheOwner.hxx
new file mode 100644
index ..6819aed3a8ca
--- /dev/null
+++ b/sw/inc/BorderCacheOwner.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SW_INC_CACHEOWNER_HXX
+#define INCLUDED_SW_INC_CACHEOWNER_HXX
+
+#include 
+#include "swdllapi.h"
+
+class SwBorderAttrs;
+class SwBorderAttrAccess;
+
+namespace sw
+{
+/// Bookkeeping helper for SwCache caching writer borders.
+class SW_DLLPUBLIC BorderCacheOwner
+{
+private:
+friend SwBorderAttrs;
+friend SwBorderAttrAccess;
+bool m_bInCache;
+
+public:
+BorderCacheOwner()
+: m_bInCache(false)
+{
+}
+BorderCacheOwner(BorderCacheOwner&)
+: m_bInCache(false)
+{
+}
+BorderCacheOwner& operator=(const BorderCacheOwner&)
+{
+m_bInCache = false;
+return *this;
+}
+~BorderCacheOwner();
+bool IsInCache() const { return m_bInCache; }
+void InvalidateInSwCache(const sal_uInt16);
+};
+}
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index b5b6ff9a3e30..32b0d35b4c1d 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -176,8 +176,7 @@ class SW_DLLPUBLIC SwModify: public SwClient
 friend void sw::ClientNotifyAttrChg(SwModify&, const SwAttrSet&, 
SwAttrSet&, SwAttrSet&);
 template friend class SwIterator;
 sw::WriterListener* m_pWriterListeners;// the start of the 
linked list of clients
-bool m_bModifyLocked : 1; // don't broadcast changes now
-bool m_bInCache   : 1;
+bool m_bModifyLocked; // don't broadcast changes now
 
 SwModify(SwModify const &) = delete;
 SwModify  =(const SwModify&) = delete;
@@ -185,7 +184,7 @@ protected:
 virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override;
 public:
 SwModify()
-: SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), 
m_bInCache(false)
+: SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false)
 {}
 
 // broadcasting mechanism
@@ 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-01-24 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/fmtcol.hxx  |   24 
 sw/inc/format.hxx  |   21 +
 sw/source/core/attr/format.cxx |   26 +-
 sw/source/core/doc/fmtcol.cxx  |   21 ++---
 4 files changed, 48 insertions(+), 44 deletions(-)

New commits:
commit 6c8a6b6aa2f962bd2fadbdf27405bfcd7d167fec
Author: Bjoern Michaelsen 
AuthorDate: Tue Jan 19 23:39:17 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Jan 25 00:43:49 2021 +0100

SwFntCache: move down from SwFormat to SwTextFormatCol where possible

Change-Id: Ia5dcc3b1145c6bd65253577499da3bb80d82e926
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109659
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 07f157f13bf2..10a41b9d9b78 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -66,6 +66,8 @@ class SW_DLLPUBLIC SwTextFormatColl
 
 bool mbAssignedToOutlineStyle;
 
+bool m_bInSwFntCache;
+
 SwTextFormatColl *mpNextTextFormatColl;
 
 protected:
@@ -75,6 +77,7 @@ protected:
 : SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, 
pDerFrom, nFormatWh)
 , mbStayAssignedToListLevelOfOutlineStyle(false)
 , mbAssignedToOutlineStyle(false)
+, m_bInSwFntCache(false)
 {
 mpNextTextFormatColl = this;
 }
@@ -85,6 +88,7 @@ protected:
 : SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, 
pDerFrom, nFormatWh)
 , mbStayAssignedToListLevelOfOutlineStyle(false)
 , mbAssignedToOutlineStyle(false)
+, m_bInSwFntCache(false)
 {
 mpNextTextFormatColl = this;
 }
@@ -93,6 +97,7 @@ protected:
 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 
 public:
+virtual ~SwTextFormatColl();
 inline void SetNextTextFormatColl(SwTextFormatColl& rNext);
 SwTextFormatColl& GetNextTextFormatColl() const { return 
*mpNextTextFormatColl; }
 
@@ -138,6 +143,25 @@ public:
 if(HasWriterListeners() && !IsModifyLocked())
 CallSwClientNotify(sw::LegacyModifyHint(, ));
 };
+bool IsInSwFntCache() const { return m_bInSwFntCache; };
+void SetInSwFntCache() { m_bInSwFntCache = true; };
+virtual void InvalidateInSwFntCache(sal_uInt16 nWhich) override
+{
+if(isCHRATR(nWhich))
+{
+m_bInSwFntCache = false;
+}
+else
+{
+switch(nWhich)
+{
+case RES_OBJECTDYING:
+case RES_FMT_CHG:
+case RES_ATTRSET_CHG:
+m_bInSwFntCache = false;
+}
+}
+};
 };
 
 class SwGrfFormatColl final : public SwFormatColl
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 96e03b342eec..f1e301ba50d0 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -60,25 +60,8 @@ class SW_DLLPUBLIC SwFormat : public sw::BroadcastingModify
 bool   m_bAutoUpdateFormat : 1;/**< TRUE: Set attributes of a whole 
paragraph
at format (UI-side!). */
 bool m_bHidden : 1;
-bool m_bInSwFntCache : 1;
 std::shared_ptr m_pGrabBagItem; ///< Style InteropGrabBag.
-void InvalidateInSwFntCache(sal_uInt16 nWhich)
-{
-if(isCHRATR(nWhich))
-{
-m_bInSwFntCache = false;
-}
-else
-{
-switch(nWhich)
-{
-case RES_OBJECTDYING:
-case RES_FMT_CHG:
-case RES_ATTRSET_CHG:
-m_bInSwFntCache = false;
-}
-}
-};
+virtual void InvalidateInSwFntCache(sal_uInt16) {};
 
 protected:
 SwFormat( SwAttrPool& rPool, const char* pFormatNm,
@@ -95,8 +78,6 @@ public:
 
 /// for Querying of Writer-functions.
 sal_uInt16 Which() const { return m_nWhichId; };
-bool IsInSwFntCache() const { return m_bInSwFntCache; };
-void SetInSwFntCache() { m_bInSwFntCache = true; };
 
 /// Copy attributes even among documents.
 void CopyAttrs( const SwFormat& );
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index cb36ad574e67..4c29d313424a 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 
 using namespace com::sun::star;
 
@@ -49,7 +48,7 @@ SwFormat::SwFormat( SwAttrPool& rPool, const char* pFormatNm,
 {
 m_bAutoUpdateFormat = false; // LAYER_IMPL
 m_bAutoFormat = true;
-m_bFormatInDTOR = m_bHidden = m_bInSwFntCache = false;
+m_bFormatInDTOR = m_bHidden = false;
 
 if( pDrvdFrame )
 {
@@ -70,7 +69,7 @@ SwFormat::SwFormat( SwAttrPool& rPool, const OUString& 
rFormatNm,
 {
 m_bAutoUpdateFormat = false; // LAYER_IMPL
 m_bAutoFormat = true;
-m_bFormatInDTOR = m_bHidden = m_bInSwFntCache = false;
+m_bFormatInDTOR = m_bHidden = false;
 
 if( 

[Libreoffice-commits] core.git: sw/source

2021-01-24 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/txtnode/ndtxt.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 013d6da8737ec074f9e398ec27cb91926572b2b4
Author: Bjoern Michaelsen 
AuthorDate: Fri Jan 22 22:08:36 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sun Jan 24 23:36:17 2021 +0100

Dont double clear caches

- NumRuleChg calls sw::BroadcastMixin::CallSwClientNotify
- which always calls SwModify::CallSwClientNotify
- which always clears caches

Change-Id: Iaf00e90bb7db9bd20ec08718043ce5b4025abecc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109153
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 64a7f2a5da85..57b30d59cb45 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2827,12 +2827,6 @@ void SwTextNode::NumRuleChgd()
 }
 }
 
-if( IsInCache() )
-{
-SwFrame::GetCache().Delete( this );
-SetInCache( false );
-}
-
 // Sending "noop" modify in order to cause invalidations of registered
 //  instances to get the list style change respectively the 
change
 // in the list tree reflected in the layout.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/inc sw/source

2021-01-18 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/calbck.hxx   |5 --
 sw/inc/format.hxx   |   23 -
 sw/source/core/attr/calbck.cxx  |   35 ++--
 sw/source/core/attr/format.cxx  |   62 
 sw/source/core/txtnode/ndtxt.cxx|1 
 sw/source/core/txtnode/swfntcch.cxx |2 -
 6 files changed, 71 insertions(+), 57 deletions(-)

New commits:
commit 1e60f69b24578714284bc3318427d0e64f342462
Author: Bjoern Michaelsen 
AuthorDate: Sat Jan 16 02:41:58 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Jan 18 18:10:18 2021 +0100

Revert "Revert "Move SwFntCache link from SwModify down to SwFormat""

- SwFormat::SwClientNotify calls SwModfiy::SwClientNotify explicitly
  and used the sideeffect of cache invalidation
- this is now fixed

This reverts commit 2e29dc20b96f2d96f5b64e9ed5efb79e342b3f54.

Change-Id: I5b3cf516cdfcdaffef7bb1eac20185ba713f33fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109478
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 31df9791291b..b5b6ff9a3e30 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -178,7 +178,6 @@ class SW_DLLPUBLIC SwModify: public SwClient
 sw::WriterListener* m_pWriterListeners;// the start of the 
linked list of clients
 bool m_bModifyLocked : 1; // don't broadcast changes now
 bool m_bInCache   : 1;
-bool m_bInSwFntCache : 1;
 
 SwModify(SwModify const &) = delete;
 SwModify  =(const SwModify&) = delete;
@@ -186,7 +185,7 @@ protected:
 virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override;
 public:
 SwModify()
-: SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), 
m_bInCache(false), m_bInSwFntCache(false)
+: SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), 
m_bInCache(false)
 {}
 
 // broadcasting mechanism
@@ -204,11 +203,9 @@ public:
 void LockModify()   { m_bModifyLocked = true;  }
 void UnlockModify() { m_bModifyLocked = false; }
 void SetInCache( bool bNew ){ m_bInCache = bNew;   }
-void SetInSwFntCache( bool bNew )   { m_bInSwFntCache = bNew;  }
 void SetInDocDTOR();
 bool IsModifyLocked() const { return m_bModifyLocked;  }
 bool IsInCache()  const { return m_bInCache;   }
-bool IsInSwFntCache() const { return m_bInSwFntCache;  }
 
 void CheckCaching( const sal_uInt16 nWhich );
 bool HasOnlyOneListener() const { return m_pWriterListeners && 
m_pWriterListeners->IsLast(); }
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index e596a26bb882..96e03b342eec 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -22,6 +22,7 @@
 #include "swdllapi.h"
 #include "swatrset.hxx"
 #include "calbck.hxx"
+#include "hintids.hxx"
 #include 
 
 class IDocumentSettingAccess;
@@ -59,7 +60,25 @@ class SW_DLLPUBLIC SwFormat : public sw::BroadcastingModify
 bool   m_bAutoUpdateFormat : 1;/**< TRUE: Set attributes of a whole 
paragraph
at format (UI-side!). */
 bool m_bHidden : 1;
+bool m_bInSwFntCache : 1;
 std::shared_ptr m_pGrabBagItem; ///< Style InteropGrabBag.
+void InvalidateInSwFntCache(sal_uInt16 nWhich)
+{
+if(isCHRATR(nWhich))
+{
+m_bInSwFntCache = false;
+}
+else
+{
+switch(nWhich)
+{
+case RES_OBJECTDYING:
+case RES_FMT_CHG:
+case RES_ATTRSET_CHG:
+m_bInSwFntCache = false;
+}
+}
+};
 
 protected:
 SwFormat( SwAttrPool& rPool, const char* pFormatNm,
@@ -75,7 +94,9 @@ public:
 SwFormat =(const SwFormat&);
 
 /// for Querying of Writer-functions.
-sal_uInt16 Which() const { return m_nWhichId; }
+sal_uInt16 Which() const { return m_nWhichId; };
+bool IsInSwFntCache() const { return m_bInSwFntCache; };
+void SetInSwFntCache() { m_bInSwFntCache = true; };
 
 /// Copy attributes even among documents.
 void CopyAttrs( const SwFormat& );
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 1c86c75fc992..a4fff2809f72 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -17,15 +17,17 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
+
+#include 
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
 #include 
-#include 
 #include 
-#include 
-#include 
+
 #ifdef DBG_UTIL
 #include 
 #endif
@@ -156,9 +158,6 @@ SwModify::~SwModify()
 if ( IsInCache() )
 SwFrame::GetCache().Delete( this );
 
-if ( IsInSwFntCache() )
-pSwFontCache->Delete( this );
-
 // notify all clients that they shall remove themselves
 SwPtrMsgPoolItem aDyObject( 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-01-13 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/calbck.hxx   |5 
 sw/inc/format.hxx   |   23 +-
 sw/source/core/attr/calbck.cxx  |   35 +---
 sw/source/core/attr/format.cxx  |   45 
 sw/source/core/txtnode/ndtxt.cxx|1 
 sw/source/core/txtnode/swfntcch.cxx |2 -
 6 files changed, 62 insertions(+), 49 deletions(-)

New commits:
commit 8dd78873a9de028c0d9f1f1aee537e85f74d2300
Author: Bjoern Michaelsen 
AuthorDate: Tue Jan 12 01:37:29 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Wed Jan 13 18:20:37 2021 +0100

Move SwFntCache link from SwModify down to SwFormat

- apparently only SwTextFormatColls are ever in the SwFntCache
- however lots of SwFormat members need to clear the cache
- so for now, only move it down to SwFormat
- this should make SwModify less of a kitchen sink

Change-Id: I389fc9f0a9d9b18b5914f24ae62c5d4119bc468f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109154
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 31df9791291b..b5b6ff9a3e30 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -178,7 +178,6 @@ class SW_DLLPUBLIC SwModify: public SwClient
 sw::WriterListener* m_pWriterListeners;// the start of the 
linked list of clients
 bool m_bModifyLocked : 1; // don't broadcast changes now
 bool m_bInCache   : 1;
-bool m_bInSwFntCache : 1;
 
 SwModify(SwModify const &) = delete;
 SwModify  =(const SwModify&) = delete;
@@ -186,7 +185,7 @@ protected:
 virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override;
 public:
 SwModify()
-: SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), 
m_bInCache(false), m_bInSwFntCache(false)
+: SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), 
m_bInCache(false)
 {}
 
 // broadcasting mechanism
@@ -204,11 +203,9 @@ public:
 void LockModify()   { m_bModifyLocked = true;  }
 void UnlockModify() { m_bModifyLocked = false; }
 void SetInCache( bool bNew ){ m_bInCache = bNew;   }
-void SetInSwFntCache( bool bNew )   { m_bInSwFntCache = bNew;  }
 void SetInDocDTOR();
 bool IsModifyLocked() const { return m_bModifyLocked;  }
 bool IsInCache()  const { return m_bInCache;   }
-bool IsInSwFntCache() const { return m_bInSwFntCache;  }
 
 void CheckCaching( const sal_uInt16 nWhich );
 bool HasOnlyOneListener() const { return m_pWriterListeners && 
m_pWriterListeners->IsLast(); }
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index e596a26bb882..96e03b342eec 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -22,6 +22,7 @@
 #include "swdllapi.h"
 #include "swatrset.hxx"
 #include "calbck.hxx"
+#include "hintids.hxx"
 #include 
 
 class IDocumentSettingAccess;
@@ -59,7 +60,25 @@ class SW_DLLPUBLIC SwFormat : public sw::BroadcastingModify
 bool   m_bAutoUpdateFormat : 1;/**< TRUE: Set attributes of a whole 
paragraph
at format (UI-side!). */
 bool m_bHidden : 1;
+bool m_bInSwFntCache : 1;
 std::shared_ptr m_pGrabBagItem; ///< Style InteropGrabBag.
+void InvalidateInSwFntCache(sal_uInt16 nWhich)
+{
+if(isCHRATR(nWhich))
+{
+m_bInSwFntCache = false;
+}
+else
+{
+switch(nWhich)
+{
+case RES_OBJECTDYING:
+case RES_FMT_CHG:
+case RES_ATTRSET_CHG:
+m_bInSwFntCache = false;
+}
+}
+};
 
 protected:
 SwFormat( SwAttrPool& rPool, const char* pFormatNm,
@@ -75,7 +94,9 @@ public:
 SwFormat =(const SwFormat&);
 
 /// for Querying of Writer-functions.
-sal_uInt16 Which() const { return m_nWhichId; }
+sal_uInt16 Which() const { return m_nWhichId; };
+bool IsInSwFntCache() const { return m_bInSwFntCache; };
+void SetInSwFntCache() { m_bInSwFntCache = true; };
 
 /// Copy attributes even among documents.
 void CopyAttrs( const SwFormat& );
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 1c86c75fc992..ef6008f3ce77 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -17,15 +17,17 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
+#include 
+
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
 #include 
-#include 
 #include 
-#include 
-#include 
+
 #ifdef DBG_UTIL
 #include 
 #endif
@@ -156,9 +158,6 @@ SwModify::~SwModify()
 if ( IsInCache() )
 SwFrame::GetCache().Delete( this );
 
-if ( IsInSwFntCache() )
-pSwFontCache->Delete( this );
-
 // notify all clients that they shall remove themselves
 SwPtrMsgPoolItem aDyObject( 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-01-11 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/calbck.hxx|6 -
 sw/source/core/attr/calbck.cxx   |   32 +++
 sw/source/core/attr/format.cxx   |2 -
 sw/source/core/doc/CntntIdxStore.cxx |6 ++---
 sw/source/core/docnode/node.cxx  |4 +--
 sw/source/core/edit/editsh.cxx   |4 +--
 sw/source/core/fields/reffld.cxx |4 +--
 sw/source/core/layout/anchoredobject.cxx |8 +++
 sw/source/core/layout/pagechg.cxx|4 +--
 sw/source/core/layout/pagedesc.cxx   |2 -
 sw/source/core/tox/tox.cxx   |2 -
 sw/source/core/txtnode/atrfld.cxx|2 -
 sw/source/core/txtnode/atrftn.cxx|2 -
 sw/source/core/txtnode/atrref.cxx|2 -
 sw/source/core/txtnode/ndtxt.cxx |   18 -
 sw/source/core/txtnode/thints.cxx|6 ++---
 sw/source/core/txtnode/txtedt.cxx|8 +++
 sw/source/core/unocore/unoobj.cxx|2 -
 18 files changed, 51 insertions(+), 63 deletions(-)

New commits:
commit 8addde21e0e182a2e64f705a372869f39e98483e
Author: Bjoern Michaelsen 
AuthorDate: Sat Jan 9 12:06:50 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Jan 11 21:43:59 2021 +0100

Revert "Revert "NotifyClients no more""

- ... and ensure caching gets checked in SwFormat this time.

This reverts commit d988b0cdeb54d84a0347a036a277c21c12544ab9.

Change-Id: Iea887f841c47cde4a025a305eb0984392e3bb5cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109037
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index ae4d3bd0b8fd..31df9791291b 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -189,11 +189,7 @@ public:
 : SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), 
m_bInCache(false), m_bInSwFntCache(false)
 {}
 
-// broadcasting: send notifications to all clients
-// DO NOT USE IN NEW CODE! use CallSwClientNotify instead.
-void NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem 
*pNewValue );
-
-// a more universal broadcasting mechanism
+// broadcasting mechanism
 virtual void CallSwClientNotify( const SfxHint& rHint ) const;
 
 virtual ~SwModify() override;
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 7450afad6c3f..1c86c75fc992 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -161,7 +161,7 @@ SwModify::~SwModify()
 
 // notify all clients that they shall remove themselves
 SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
-NotifyClients( ,  );
+SwModify::SwClientNotify(*this, sw::LegacyModifyHint(, 
));
 
 const bool hasListenersOnDeath = m_pWriterListeners;
 (void)hasListenersOnDeath;
@@ -173,24 +173,6 @@ SwModify::~SwModify()
 assert(!hasListenersOnDeath);
 }
 
-void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* 
pNewValue )
-{
-DBG_TESTSOLARMUTEX();
-if ( IsInCache() || IsInSwFntCache() )
-{
-const sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
-pNewValue ? pNewValue->Which() : 0;
-CheckCaching( nWhich );
-}
-
-if ( !m_pWriterListeners || IsModifyLocked() )
-return;
-
-LockModify();
-CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } );
-UnlockModify();
-}
-
 bool SwModify::GetInfo( SfxPoolItem& rInfo ) const
 {
 if(!m_pWriterListeners)
@@ -368,7 +350,17 @@ sw::ClientIteratorBase* 
sw::ClientIteratorBase::s_pClientIters = nullptr;
 void SwModify::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
 if(auto pLegacyHint = dynamic_cast())
-NotifyClients(pLegacyHint->m_pOld, pLegacyHint->m_pNew);
+{
+DBG_TESTSOLARMUTEX();
+if(IsInCache() || IsInSwFntCache())
+CheckCaching(pLegacyHint->GetWhich());
+if(IsModifyLocked())
+return;
+
+LockModify();
+CallSwClientNotify(rHint);
+UnlockModify();
+}
 }
 
 void SwModify::CallSwClientNotify( const SfxHint& rHint ) const
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 1f83d913be38..6e0f55ef8da0 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -320,7 +320,7 @@ void SwFormat::SwClientNotify(const SwModify&, const 
SfxHint& rHint)
 }
 }
 if(bPassToDepends)
-NotifyClients(aDependArgs.first, aDependArgs.second);
+SwModify::SwClientNotify(*this, 
sw::LegacyModifyHint(aDependArgs.first, aDependArgs.second));
 }
 
 bool SwFormat::SetDerivedFrom(SwFormat *pDerFrom)
diff --git a/sw/source/core/doc/CntntIdxStore.cxx 
b/sw/source/core/doc/CntntIdxStore.cxx
index c37221e189e8..989fae5b4abe 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-01-08 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/ndgrf.hxx |2 +-
 sw/inc/ndole.hxx |2 +-
 sw/inc/ndtxt.hxx |6 ++
 sw/source/core/attr/calbck.cxx   |   12 
 sw/source/core/attr/format.cxx   |3 ++-
 sw/source/core/crsr/crsrsh.cxx   |   11 +--
 sw/source/core/graphic/ndgrf.cxx |1 +
 sw/source/core/layout/atrfrm.cxx |   32 ++--
 sw/source/core/ole/ndole.cxx |1 +
 sw/source/core/txtnode/ndtxt.cxx |1 +
 10 files changed, 36 insertions(+), 35 deletions(-)

New commits:
commit d656da9bc4f2df0bb99c65a288847e3fdd43a37c
Author: Bjoern Michaelsen 
AuthorDate: Sun Jan 3 23:27:49 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sat Jan 9 03:59:46 2021 +0100

~SwModify: do not silently tolerate clients registered past death

- Make SwFormat/SwContentNode explicitly resetting the page desc. before
  death instead of SwFormatPageDesc trying to do that on the dying hint:
  * the dying hints is send _after_ the SwFormat/SwContentNode dtor are
completed, so the RTTI magic did not work anyway
  * simply resetting the attribute in a final dtor and make
SwFormatPageDesc just check to never get a dying hint (because it
should have been destructed by reset) is a lot less errorprone.

Change-Id: I231f1729729491ba7544e5ba93d81192b212e2ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108648
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 82be71429780..d9fd29e5c2eb 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -31,7 +31,7 @@ class SwGrfFormatColl;
 class SwDoc;
 
 // SwGrfNode
-class SW_DLLPUBLIC SwGrfNode: public SwNoTextNode
+class SW_DLLPUBLIC SwGrfNode final: public SwNoTextNode
 {
 friend class SwNodes;
 
diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index e54be15a22dd..39060d62501b 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -82,7 +82,7 @@ public:
 
 // SwOLENode
 
-class SW_DLLPUBLIC SwOLENode: public SwNoTextNode
+class SW_DLLPUBLIC SwOLENode final: public SwNoTextNode
 {
 friend class SwNodes;
 mutable SwOLEObj maOLEObj;
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 7692dc5b6470..f83bab3cebba 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -77,7 +77,7 @@ namespace com::sun::star {
 typedef o3tl::sorted_vector< sal_Int32 > SwSoftPageBreakList;
 
 /// SwTextNode is a paragraph in the document model.
-class SW_DLLPUBLIC SwTextNode
+class SW_DLLPUBLIC SwTextNode final
 : public SwContentNode
 , public ::sfx2::Metadatable
 , public sw::FormatDropDefiner
@@ -127,7 +127,7 @@ class SW_DLLPUBLIC SwTextNode
 
 SAL_DLLPRIVATE SwTextNode( const SwNodeIndex , SwTextFormatColl 
*pTextColl,
  const SfxItemSet* pAutoAttr = nullptr );
-
+virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
 /// Copies the attributes at nStart to pDest.
 SAL_DLLPRIVATE void CopyAttr( SwTextNode *pDest, const sal_Int32 nStart, 
const sal_Int32 nOldPos);
 
@@ -202,8 +202,6 @@ public:
 
 /// End: Data collected during idle time
 
-protected:
-virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
 
 public:
 using SwContentNode::GetAttr;
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 6acee52c9231..7450afad6c3f 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -163,10 +163,14 @@ SwModify::~SwModify()
 SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
 NotifyClients( ,  );
 
-// remove all clients that have not done themselves
-// mba: possibly a hotfix for forgotten base class calls?!
-while( m_pWriterListeners )
-static_cast(m_pWriterListeners)->CheckRegistration( 
 );
+const bool hasListenersOnDeath = m_pWriterListeners;
+(void)hasListenersOnDeath;
+while(m_pWriterListeners)
+{
+SAL_WARN("sw.core", "lost a client of type: " << 
typeid(*m_pWriterListeners).name() << " at " << m_pWriterListeners << " still 
registered on type: " << typeid(*this).name() << " at " << this << ".");
+
static_cast(m_pWriterListeners)->CheckRegistration();
+}
+assert(!hasListenersOnDeath);
 }
 
 void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* 
pNewValue )
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 4b0529d2f253..1f83d913be38 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -219,9 +219,10 @@ SwFormat::~SwFormat()
 return;
 
 m_bFormatInDTOR = true;
-
+
 if(!DerivedFrom())
 {
+SwFormat::ResetFormatAttr(RES_PAGEDESC);
 SAL_WARN("sw.core", "~SwFormat: format still has clients on death, but 
parent format is missing: " << GetName());
 return;
 }
diff --git a/sw/source/core/crsr/crsrsh.cxx 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-01-04 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/calbck.hxx  |   15 ---
 sw/source/core/attr/calbck.cxx |   22 ++
 sw/source/core/attr/format.cxx |   27 ---
 3 files changed, 34 insertions(+), 30 deletions(-)

New commits:
commit bf81aa59d86ef749dc37cdd49c6fc745376f857d
Author: Bjoern Michaelsen 
AuthorDate: Mon Jan 4 00:40:32 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Tue Jan 5 08:33:46 2021 +0100

SwClientNotifyCall no more

- SwClientNotify calls really shouldnt happen from outside the class in
  the future
- the few remaining legacy exceptions have been marked as friend --
  admittedly ugly, but it reduces the scope of call being triggered from
  anywhere to a welldefined set.

Change-Id: I46d5f755b0cf5de013a4c345a04e2c67447a99aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108651
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index b10058322813..31df9791291b 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -32,6 +32,7 @@
 #include 
 
 class SwModify;
+class SwFormat;
 class SfxPoolItem;
 class SwAttrSet;
 
@@ -62,6 +63,8 @@ class SwAttrSet;
 namespace sw
 {
 class ClientIteratorBase;
+class ListenerEntry;
+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) {};
@@ -125,6 +128,7 @@ class SW_DLLPUBLIC SwClient : public ::sw::WriterListener
 // avoids making the details of the linked list and the callback method 
public
 friend class SwModify;
 friend class sw::ClientIteratorBase;
+friend class sw::ListenerEntry;
 template friend class SwIterator;
 
 SwModify *m_pRegisteredIn;///< event source
@@ -148,12 +152,9 @@ public:
 // in case an SwModify object is destroyed that itself is registered in 
another SwModify,
 // its SwClient objects can decide to get registered to the latter instead 
by calling this method
 std::unique_ptr CheckRegistration( const 
SfxPoolItem* pOldValue );
-
-// DO NOT USE IN NEW CODE! Used to directly call the event handler from
-// outside the class. It is generally wrong to call the message handler
-// directly: either it should be a proper stand-alone member function
-// or by the observed object sending the hint properly itself.
-void SwClientNotifyCall( const SwModify& rModify, const SfxHint& rHint ) { 
SwClientNotify( rModify, rHint ); }
+// SwFormat wants to die different than the rest: It wants to reparent 
every client to its parent
+// and then send a SwFormatChg hint.
+void CheckRegistrationFormat(SwFormat& rOld);
 
 const SwModify* GetRegisteredIn() const { return m_pRegisteredIn; }
 SwModify* GetRegisteredIn() { return m_pRegisteredIn; }
@@ -172,6 +173,7 @@ public:
 class SW_DLLPUBLIC SwModify: public SwClient
 {
 friend class sw::ClientIteratorBase;
+friend void sw::ClientNotifyAttrChg(SwModify&, const SwAttrSet&, 
SwAttrSet&, SwAttrSet&);
 template friend class SwIterator;
 sw::WriterListener* m_pWriterListeners;// the start of the 
linked list of clients
 bool m_bModifyLocked : 1; // don't broadcast changes now
@@ -216,7 +218,6 @@ template class
 
 namespace sw
 {
-void ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, 
SwAttrSet& aOld, SwAttrSet& aNew);
 
 // this class is part of the migration: it still forwards the "old"
 // SwModify events and announces them both to the old SwClients still
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 25c19a6d2015..11235aeac02a 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -41,13 +42,13 @@ namespace sw
 {
 auto pModifyChanged = CheckRegistration(pLegacyHint->m_pOld);
 if (pModifyChanged)
-m_pToTell->SwClientNotifyCall(rModify, *pModifyChanged);
+m_pToTell->SwClientNotify(rModify, *pModifyChanged);
 }
 else if (m_pToTell)
-m_pToTell->SwClientNotifyCall(rModify, rHint);
+m_pToTell->SwClientNotify(rModify, rHint);
 }
 else if (m_pToTell)
-m_pToTell->SwClientNotifyCall(rModify, rHint);
+m_pToTell->SwClientNotify(rModify, rHint);
 }
 }
 
@@ -103,6 +104,19 @@ std::unique_ptr 
SwClient::CheckRegistration( const SfxPoo
 return std::unique_ptr(new 
sw::ModifyChangedHint(pAbove));
 }
 
+void SwClient::CheckRegistrationFormat(SwFormat& rOld)
+{
+assert(GetRegisteredIn() == );
+auto pNew = rOld.DerivedFrom();
+SAL_INFO("sw.core", "reparenting " << 

[Libreoffice-commits] core.git: sw/inc sw/source

2021-01-03 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/anchoredobject.hxx|2 +
 sw/inc/calbck.hxx|6 -
 sw/source/core/attr/calbck.cxx   |   33 +++
 sw/source/core/attr/format.cxx   |2 -
 sw/source/core/doc/CntntIdxStore.cxx |6 ++---
 sw/source/core/docnode/node.cxx  |4 +--
 sw/source/core/edit/editsh.cxx   |4 +--
 sw/source/core/fields/reffld.cxx |4 +--
 sw/source/core/layout/anchoredobject.cxx |   11 ++
 sw/source/core/layout/pagechg.cxx|4 +--
 sw/source/core/layout/pagedesc.cxx   |2 -
 sw/source/core/tox/tox.cxx   |2 -
 sw/source/core/txtnode/atrfld.cxx|2 -
 sw/source/core/txtnode/atrftn.cxx|2 -
 sw/source/core/txtnode/atrref.cxx|2 -
 sw/source/core/txtnode/ndtxt.cxx |   18 
 sw/source/core/txtnode/thints.cxx|6 ++---
 sw/source/core/txtnode/txtedt.cxx|8 +++
 sw/source/core/unocore/unoobj.cxx|2 -
 19 files changed, 56 insertions(+), 64 deletions(-)

New commits:
commit 96bafa464ebdbce3ef04bec9beae5e745bb37794
Author: Bjoern Michaelsen 
AuthorDate: Sat Jan 2 16:11:30 2021 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sun Jan 3 22:47:00 2021 +0100

NotifyClients no more

... and prevent recursive invalidation in SwAnchoredObject.

Change-Id: I6f386f3ffded29663fcc74c2679b76c1b839f367
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108604
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx
index 5309602f9ef0..50391e966bae 100644
--- a/sw/inc/anchoredobject.hxx
+++ b/sw/inc/anchoredobject.hxx
@@ -107,6 +107,8 @@ class SW_DLLPUBLIC SwAnchoredObject
 // The boolean is reset to , when the layout process for a
 // page frame starts.
 bool mbTmpConsiderWrapInfluence;
+// tdf#128198: prevent recursive invalidation
+bool mbInvalidatingObjects;
 
 mutable SwRect maObjRectWithSpaces;
 mutable bool mbObjRectWithSpacesValid;
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index e469c3dd4134..b10058322813 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -187,11 +187,7 @@ public:
 : SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), 
m_bInCache(false), m_bInSwFntCache(false)
 {}
 
-// broadcasting: send notifications to all clients
-// DO NOT USE IN NEW CODE! use CallSwClientNotify instead.
-void NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem 
*pNewValue );
-
-// a more universal broadcasting mechanism
+// broadcasting mechanism
 virtual void CallSwClientNotify( const SfxHint& rHint ) const;
 
 virtual ~SwModify() override;
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index c14baebc7f22..25c19a6d2015 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -145,9 +145,8 @@ SwModify::~SwModify()
 if ( IsInSwFntCache() )
 pSwFontCache->Delete( this );
 
-// notify all clients that they shall remove themselves
 SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
-NotifyClients( ,  );
+SwModify::SwClientNotify(*this, sw::LegacyModifyHint(, 
));
 
 // remove all clients that have not done themselves
 // mba: possibly a hotfix for forgotten base class calls?!
@@ -155,24 +154,6 @@ SwModify::~SwModify()
 static_cast(m_pWriterListeners)->CheckRegistration( 
 );
 }
 
-void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* 
pNewValue )
-{
-DBG_TESTSOLARMUTEX();
-if ( IsInCache() || IsInSwFntCache() )
-{
-const sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
-pNewValue ? pNewValue->Which() : 0;
-CheckCaching( nWhich );
-}
-
-if ( !m_pWriterListeners || IsModifyLocked() )
-return;
-
-LockModify();
-CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } );
-UnlockModify();
-}
-
 bool SwModify::GetInfo( SfxPoolItem& rInfo ) const
 {
 if(!m_pWriterListeners)
@@ -350,7 +331,17 @@ sw::ClientIteratorBase* 
sw::ClientIteratorBase::s_pClientIters = nullptr;
 void SwModify::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
 if(auto pLegacyHint = dynamic_cast())
-NotifyClients(pLegacyHint->m_pOld, pLegacyHint->m_pNew);
+{
+if(IsInCache() || IsInSwFntCache())
+CheckCaching(pLegacyHint->GetWhich());
+
+if(IsModifyLocked())
+return;
+
+LockModify();
+CallSwClientNotify(rHint);
+UnlockModify();
+}
 }
 
 void SwModify::CallSwClientNotify( const SfxHint& rHint ) const
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index ddcf20638356..13e3f7c48d9a 100644
--- a/sw/source/core/attr/format.cxx
+++ 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2021-01-02 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/accmap.hxx|2 -
 sw/inc/calbck.hxx|   13 +---
 sw/qa/core/uwriter.cxx   |9 +++---
 sw/source/core/access/accmap.cxx |2 -
 sw/source/core/attr/calbck.cxx   |   22 +-
 sw/source/core/inc/frame.hxx |2 -
 sw/source/core/layout/wsfrm.cxx  |   58 ++-
 7 files changed, 51 insertions(+), 57 deletions(-)

New commits:
commit ac624ef10a4620c2a12ea688e313a8d5173052cf
Author: Bjoern Michaelsen 
AuthorDate: Thu Dec 31 23:03:01 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sat Jan 2 21:56:11 2021 +0100

SwFrame: Modify no more

Change-Id: I8e2c89f2c897535013d64720b6c2c5bbac602b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108551
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 58f758706cbf..979fac964823 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -61,7 +61,7 @@ namespace com::sun::star::accessibility { class XAccessible; }
 // There are two reason for this. First of all, a new accessible shape
 // for the XShape might be created soon. It's then cheaper if the XShape
 // still exists. The other reason are situations where an accessible shape
-// is destroyed within an SwFrameFormat::Modify. In this case, destroying
+// is destroyed within an SwFrameFormat::SwClientNotify. In this case, 
destroying
 // the XShape at the same time (indirectly by destroying the accessible
 // shape) leads to an assert, because a client of the Modify is destroyed
 // within a Modify call.
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 8fbb2e87e0b2..e469c3dd4134 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -143,11 +143,6 @@ public:
 SwClient() : m_pRegisteredIn(nullptr) {}
 SwClient(SwClient&&) noexcept;
 virtual ~SwClient() override;
-// callbacks received from SwModify (friend class - so these methods can 
be private)
-// should be called only from SwModify the client is registered in
-// mba: IMHO this method should be pure virtual
-// DO NOT USE IN NEW CODE! use SwClientNotify instead.
-virtual void Modify(const SfxPoolItem*, const SfxPoolItem*);
 
 
 // in case an SwModify object is destroyed that itself is registered in 
another SwModify,
@@ -183,13 +178,10 @@ class SW_DLLPUBLIC SwModify: public SwClient
 bool m_bInCache   : 1;
 bool m_bInSwFntCache : 1;
 
-// mba: IMHO this method should be pure virtual
-// DO NOT USE IN NEW CODE! use CallSwClientNotify instead.
-virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) 
override
-{ NotifyClients( pOld, pNew ); };
-
 SwModify(SwModify const &) = delete;
 SwModify  =(const SwModify&) = delete;
+protected:
+virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override;
 public:
 SwModify()
 : SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), 
m_bInCache(false), m_bInSwFntCache(false)
@@ -268,7 +260,6 @@ namespace sw
 /** get Client information */
 virtual bool GetInfo( SfxPoolItem& rInfo) const override;
 private:
-virtual void Modify(const SfxPoolItem* pOldValue, const SfxPoolItem 
*pNewValue) override;
 virtual void SwClientNotify(const SwModify& rModify, const SfxHint& 
rHint) override;
 };
 
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 9da61561f3ff..db2422fed04b 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1827,8 +1827,6 @@ namespace
 int m_nModifyChangedCount;
 const SwModify* m_pLastChangedModify;
 TestClient() : m_nModifyCount(0), m_nNotifyCount(0), 
m_nModifyChangedCount(0), m_pLastChangedModify(nullptr) {};
-virtual void Modify( const SfxPoolItem*, const SfxPoolItem*) override
-{ assert(false); }
 virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override
 {
 if(typeid(TestHint) == typeid(rHint))
@@ -1846,8 +1844,11 @@ namespace
 {
 int m_nModifyCount;
 OtherTestClient() : m_nModifyCount(0) {};
-virtual void Modify( const SfxPoolItem*, const SfxPoolItem*) override
-{ ++m_nModifyCount; }
+virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override
+{
+if(dynamic_cast())
+++m_nModifyCount;
+}
 };
 struct TestListener : SvtListener
 {
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 8f3543dcd4df..4771f4c8e903 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -2293,7 +2293,7 @@ void SwAccessibleMap::A11yDispose( const SwFrame *pFrame,
 (xParentAccImpl.is() || xShapeAccImpl.is()) )
 {
 // Keep a reference to the XShape to avoid that it
-// is deleted with a SwFrameFormat::Modify.
+

[Libreoffice-commits] core.git: sw/source

2021-01-01 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/layout/fly.cxx |7 +--
 sw/source/core/layout/pagechg.cxx |9 ++---
 sw/source/core/layout/sectfrm.cxx |7 +--
 sw/source/core/layout/tabfrm.cxx  |   13 -
 4 files changed, 24 insertions(+), 12 deletions(-)

New commits:
commit 5cda343212d086b5e1f06e9d4eba16d254a56628
Author: Bjoern Michaelsen 
AuthorDate: Thu Dec 31 22:34:00 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sat Jan 2 04:21:14 2021 +0100

Fix: Move remaining direct calls to SwLayoutFrame::Modify out of the way

Change-Id: I544cc42845d346eb0901ca86621a563d1173e2b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108550
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 02b7c724eaef..299932e8fa7c 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -675,7 +675,7 @@ void SwFlyFrame::SwClientNotify(const SwModify& rMod, const 
SfxHint& rHint)
 pOItem = aOIter.NextItem();
 } while(pNItem);
 if(aOldSet.Count() || aNewSet.Count())
-SwLayoutFrame::Modify(, );
+SwLayoutFrame::SwClientNotify(rMod, 
sw::LegacyModifyHint(, ));
 }
 else
 UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
@@ -1057,7 +1057,10 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, 
const SfxPoolItem *pNew,
 pNewSet->ClearItem( nWhich );
 }
 else
-SwLayoutFrame::Modify( pOld, pNew );
+{
+SwModify aMod;
+SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, 
pNew));
+}
 }
 }
 
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index 611b63753bc1..95321684de87 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -531,7 +531,7 @@ void SwPageFrame::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
 pNItem = aNIter.NextItem();
 } while(pNItem);
 if(aOldSet.Count() || aNewSet.Count())
-SwLayoutFrame::Modify(, );
+SwLayoutFrame::SwClientNotify(rModify, 
sw::LegacyModifyHint(, ));
 }
 else
 UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
@@ -629,7 +629,7 @@ void SwPageFrame::UpdateAttr_( const SfxPoolItem *pOld, 
const SfxPoolItem *pNew,
 // Calculation of the page is not necessary, because its size 
is
 // invalidated here and further invalidation is done in the
 // calling method  and probably by 
calling
-//  at the end.
+//  at the end.
 // It can also causes inconsistences, because the lowers are
 // adjusted, but not calculated, and a 
 of
 // a next page is called. This is performed on the switch to 
the
@@ -708,7 +708,10 @@ void SwPageFrame::UpdateAttr_( const SfxPoolItem *pOld, 
const SfxPoolItem *pNew,
 pNewSet->ClearItem( nWhich );
 }
 else
-SwLayoutFrame::Modify( pOld, pNew );
+{
+SwModify aMod;
+SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, 
pNew));
+}
 }
 }
 
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index aab18463fe06..0de0d2a5f296 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2588,7 +2588,7 @@ void SwSectionFrame::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
 pOItem = aOIter.NextItem();
 } while (pNItem);
 if(aOldSet.Count() || aNewSet.Count())
-SwLayoutFrame::Modify(, );
+SwLayoutFrame::SwClientNotify(rMod, 
sw::LegacyModifyHint(, ));
 }
 else
 UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
@@ -2725,7 +2725,10 @@ void SwSectionFrame::UpdateAttr_( const SfxPoolItem 
*pOld, const SfxPoolItem *pN
 pNewSet->ClearItem( nWhich );
 }
 else
-SwLayoutFrame::Modify( pOld, pNew );
+{
+SwModify aMod;
+SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, 
pNew));
+}
 }
 }
 
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 88033e3ee9b6..6eb3ccfd1627 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3257,7 +3257,7 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, 
bool bInfo )
 return nDist;
 }
 
-void SwTabFrame::SwClientNotify(const SwModify&, const SfxHint& rHint)
+void SwTabFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 {
 auto pLegacy = dynamic_cast();
 if(!pLegacy)
@@ -3282,7 +3282,7 @@ void SwTabFrame::SwClientNotify(const 

[Libreoffice-commits] core.git: sw/Module_sw.mk sw/qa sw/source

2020-12-31 Thread Bjoern Michaelsen (via logerrit)
 sw/Module_sw.mk   |2 
 sw/qa/uitest/writer_tests4/spellDialog.py |2 
 sw/source/core/inc/flyfrm.hxx |1 
 sw/source/core/layout/fly.cxx |  126 ++
 sw/source/core/layout/flycnt.cxx  |4 
 sw/source/core/layout/flylay.cxx  |4 
 6 files changed, 67 insertions(+), 72 deletions(-)

New commits:
commit 5a94a20229a1bd82a39006012694cdc9f02ffa31
Author: Bjoern Michaelsen 
AuthorDate: Wed Dec 30 00:47:52 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Thu Dec 31 21:15:08 2020 +0100

SwFlyFrame: Modify no more

Also, make the uitest output a bit more explicit.

Change-Id: I41fa08a6fc02d95ad3337129eb93f8a569cf3cbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108491
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 65acc6c7b744..85a0a7a23e13 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -164,6 +164,7 @@ $(eval $(call gb_Module_add_screenshot_targets,sw,\
 ))
 
 $(eval $(call gb_Module_add_uicheck_targets,sw,\
+   UITest_librelogo \
UITest_writer_tests \
UITest_writer_tests2 \
UITest_writer_tests3 \
@@ -176,7 +177,6 @@ $(eval $(call gb_Module_add_uicheck_targets,sw,\
UITest_sw_findReplace \
UITest_sw_findSimilarity \
UITest_chapterNumbering \
-   UITest_librelogo \
UITest_sw_navigator \
UITest_sw_options \
UITest_sw_styleInspector \
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py 
b/sw/qa/uitest/writer_tests4/spellDialog.py
index 3b9e4c31f3da..560bbb76e227 100644
--- a/sw/qa/uitest/writer_tests4/spellDialog.py
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -129,5 +129,5 @@ frog, dogg, catt"""
 # "good" is an insertion by fixing the first misspelling),
 # but now "goood" is not a misspelling because it is accepted
 # correctly without the redline containing a deleted "o"
-self.assertTrue(output_text == 'goood baaadbaaed eeend')
+self.assertEqual(output_text, 'goood baaadbaaed eeend')
 
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index 52295f340c28..13629ecfed14 100644
--- a/sw/source/core/inc/flyfrm.hxx
+++ b/sw/source/core/inc/flyfrm.hxx
@@ -141,7 +141,6 @@ protected:
 virtual bool SetObjLeft_( const SwTwips _nLeft ) override;
 
 virtual SwRect GetObjBoundRect() const override;
-virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
 virtual void SwClientNotify(const SwModify& rMod, const SfxHint& rHint) 
override;
 
 virtual const IDocumentDrawModelAccess& getIDocumentDrawModelAccess( ) 
override;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index b45509d295de..02b7c724eaef 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -657,8 +657,67 @@ bool SwFlyFrame::FrameSizeChg( const SwFormatFrameSize 
 )
 
 void SwFlyFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 {
-SwFrame::SwClientNotify(rMod, rHint);
-if (auto pGetZOrdnerHint = dynamic_cast())
+if(auto pLegacy = dynamic_cast())
+{
+sal_uInt8 nInvFlags = 0;
+if(pLegacy->m_pNew && pLegacy->m_pOld && RES_ATTRSET_CHG == 
pLegacy->m_pNew->Which())
+{
+SfxItemIter aNIter(*static_cast(pLegacy->m_pNew)->GetChgSet());
+SfxItemIter aOIter(*static_cast(pLegacy->m_pOld)->GetChgSet());
+const SfxPoolItem* pNItem = aNIter.GetCurItem();
+const SfxPoolItem* pOItem = aOIter.GetCurItem();
+SwAttrSetChg aOldSet(*static_cast(pLegacy->m_pOld));
+SwAttrSetChg aNewSet(*static_cast(pLegacy->m_pNew));
+do
+{
+UpdateAttr_(pOItem, pNItem, nInvFlags, , );
+pNItem = aNIter.NextItem();
+pOItem = aOIter.NextItem();
+} while(pNItem);
+if(aOldSet.Count() || aNewSet.Count())
+SwLayoutFrame::Modify(, );
+}
+else
+UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
+
+if(nInvFlags == 0)
+return;
+
+Invalidate_();
+if(nInvFlags & 0x01)
+{
+InvalidatePos_();
+// #i68520#
+InvalidateObjRectWithSpaces();
+}
+if(nInvFlags & 0x02)
+{
+InvalidateSize_();
+// #i68520#
+InvalidateObjRectWithSpaces();
+}
+if(nInvFlags & 0x04)
+InvalidatePrt_();
+if(nInvFlags & 0x08)
+SetNotifyBack();
+if(nInvFlags & 0x10)
+SetCompletePaint();
+if((nInvFlags & 0x40) && Lower() && Lower()->IsNoTextFrame())
+ClrContourCache( GetVirtDrawObj() );
+SwRootFrame *pRoot;
+if(nInvFlags & 0x20 && nullptr != (pRoot = getRootFrame()))
+

[Libreoffice-commits] core.git: sw/qa sw/source

2020-12-30 Thread Bjoern Michaelsen (via logerrit)
 sw/qa/core/txtnode/txtnode.cxx   |2 
 sw/qa/extras/mailmerge/mailmerge.cxx |2 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   18 +-
 sw/source/core/inc/flyfrm.hxx|1 
 sw/source/core/inc/flyfrms.hxx   |5 
 sw/source/core/layout/fly.cxx|   12 +
 sw/source/core/layout/flycnt.cxx |  196 ++-
 sw/source/core/layout/flyincnt.cxx   |4 
 sw/source/core/layout/flylay.cxx |   14 --
 sw/source/core/layout/wsfrm.cxx  |2 
 sw/source/core/txtnode/atrflyin.cxx  |2 
 11 files changed, 122 insertions(+), 136 deletions(-)

New commits:
commit 188ec34cf157ffee8c63f03f420ca9daafb5ff29
Author: Bjoern Michaelsen 
AuthorDate: Sat Dec 12 23:44:26 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Wed Dec 30 10:47:05 2020 +0100

atrflyin.cxx Modify no more

the fragile tests depending on specific order of objects any a bit
unfortunate ...

Change-Id: Ib74ec2a69c95e6ca859d7c75796081ac889ac32d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107647
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index 1c4d48b04598..3874f0f858c7 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -80,7 +80,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxNodeSplit)
 SwWrtShell* pWrtShell = pShell->GetWrtShell();
 pWrtShell->SttEndDoc(/*bStart=*/false);
 // Without the accompanying fix in place, this would have crashed in
-// SwFlyAtContentFrame::Modify().
+// SwFlyAtContentFrame::SwClientNotify().
 pWrtShell->SplitNode();
 }
 
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index 17d92d3789ac..824c4bbd60e5 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -397,7 +397,7 @@ DECLARE_FILE_MAILMERGE_TEST(testMissingDefaultLineColor, 
"missing-default-line-c
 executeMailMerge();
 // The document was created by LO version which didn't write out the 
default value for line color
 // (see XMLGraphicsDefaultStyle::SetDefaults()).
-uno::Reference xPropertySet(getShape(1), 
uno::UNO_QUERY);
+uno::Reference xPropertySet(getShape(4), 
uno::UNO_QUERY);
 // Lines do not have a line color.
 CPPUNIT_ASSERT( !xPropertySet->getPropertySetInfo()->hasPropertyByName( 
"LineColor" ));
 SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 26151ebcc0c9..6275ee8948d4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -467,31 +467,31 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testMsoPosition, 
"bnc884615-mso-position.doc
 // We write the frames out in different order than they were read, so 
check it's the correct
 // textbox first by checking width. These tests may need reordering if 
that gets fixed.
 OUString style1 = getXPath(doc, 
"/w:ftr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style1.indexOf( ";width:531pt;" ) >= 0 );
-CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" 
) >= 0 );
-CPPUNIT_ASSERT( style1.indexOf( 
";mso-position-horizontal-relative:page" ) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( ";width:36pt;" ) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
+CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
 OUString style2 = getXPath(doc, 
"/w:ftr/w:p/w:r[4]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
 CPPUNIT_ASSERT( style2.indexOf( ";width:549pt;" ) >= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
 CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal:center" ) >= 
0 );
 CPPUNIT_ASSERT( style2.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
 OUString style3 = getXPath(doc, 
"/w:ftr/w:p/w:r[5]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( style3.indexOf( ";width:36pt;" ) >= 0 );
-CPPUNIT_ASSERT( style3.indexOf( 
";mso-position-horizontal-relative:text" ) >= 0 );
-CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:text" 
) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( ";width:531pt;" ) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:page" 
) >= 0 );
+CPPUNIT_ASSERT( style3.indexOf( 
";mso-position-horizontal-relative:page" ) >= 0 );
 }
 
 xmlDocUniquePtr doc = parseExport("word/header1.xml");
 OUString style1 = getXPath(doc, 
"/w:hdr/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
-CPPUNIT_ASSERT( 

[Libreoffice-commits] core.git: sw/source

2020-12-13 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/inc/cntfrm.hxx   |2 -
 sw/source/core/layout/wsfrm.cxx |   63 
 sw/source/core/text/txtfrm.cxx  |8 ++---
 3 files changed, 38 insertions(+), 35 deletions(-)

New commits:
commit d6bb7239d8746cae0b0868f4cb0925db7fcaeb53
Author: Bjoern Michaelsen 
AuthorDate: Sun Dec 13 23:53:04 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Dec 14 00:58:09 2020 +0100

SwContentFrame: Modify no more

Change-Id: I934e5f096b7e650fe95d62b0030cbbe3a90daf6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107667
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index 3b85365d3668..937f40c1751e 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -56,7 +56,7 @@ class SAL_DLLPUBLIC_RTTI SwContentFrame: public SwFrame, 
public SwFlowFrame
 protected:
 void MakePrtArea( const SwBorderAttrs & );
 
-virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
+virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = 
false ) override;
 virtual SwTwips GrowFrame  ( SwTwips, bool bTst = false, bool bInfo = 
false ) override;
 
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 472c0bf619e8..8d64d23fc7dd 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2322,76 +2322,79 @@ SwTwips SwContentFrame::ShrinkFrame( SwTwips nDist, 
bool bTst, bool bInfo )
 return nReal;
 }
 
-void SwContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew 
)
+void SwContentFrame::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
+auto pLegacy = dynamic_cast();
+if(!pLegacy)
+return;
 sal_uInt8 nInvFlags = 0;
-
-if( pNew && RES_ATTRSET_CHG == pNew->Which() && pOld )
+if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which() && 
pLegacy->m_pOld)
 {
-SfxItemIter aNIter( *static_cast(pNew)->GetChgSet() );
-SfxItemIter aOIter( *static_cast(pOld)->GetChgSet() );
+auto& rOldSetChg = *static_cast(pLegacy->m_pOld);
+auto& rNewSetChg = *static_cast(pLegacy->m_pNew);
+SfxItemIter aOIter(*rOldSetChg.GetChgSet());
+SfxItemIter aNIter(*rNewSetChg.GetChgSet());
 const SfxPoolItem* pNItem = aNIter.GetCurItem();
 const SfxPoolItem* pOItem = aOIter.GetCurItem();
-SwAttrSetChg aOldSet( *static_cast(pOld) );
-SwAttrSetChg aNewSet( *static_cast(pNew) );
+SwAttrSetChg aOldSet(rOldSetChg);
+SwAttrSetChg aNewSet(rNewSetChg);
 do
 {
 UpdateAttr_(pOItem, pNItem, nInvFlags, , );
 pNItem = aNIter.NextItem();
 pOItem = aOIter.NextItem();
-} while (pNItem);
-if ( aOldSet.Count() || aNewSet.Count() )
-SwFrame::Modify( ,  );
+} while(pNItem);
+if(aOldSet.Count() || aNewSet.Count())
+SwFrame::Modify(, );
 }
 else
-UpdateAttr_( pOld, pNew, nInvFlags );
+UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
 
-if ( nInvFlags == 0 )
+if(nInvFlags == 0)
 return;
 
-SwPageFrame *pPage = FindPageFrame();
-InvalidatePage( pPage );
-if ( nInvFlags & 0x01 )
+SwPageFrame* pPage = FindPageFrame();
+InvalidatePage(pPage);
+if(nInvFlags & 0x01)
 SetCompletePaint();
-if ( nInvFlags & 0x02 )
+if(nInvFlags & 0x02)
 InvalidatePos_();
-if ( nInvFlags & 0x04 )
+if(nInvFlags & 0x04 )
 InvalidateSize_();
-if ( nInvFlags & 0x88 )
+if(nInvFlags & 0x88)
 {
-if( IsInSct() && !GetPrev() )
+if(IsInSct() && !GetPrev())
 {
-SwSectionFrame *pSect = FindSctFrame();
-if( pSect->ContainsAny() == this )
+SwSectionFrame* pSect = FindSctFrame();
+if(pSect->ContainsAny() == this)
 {
 pSect->InvalidatePrt_();
-pSect->InvalidatePage( pPage );
+pSect->InvalidatePage(pPage);
 }
 }
 InvalidatePrt_();
 }
 SwFrame* pNextFrame = GetIndNext();
-if ( pNextFrame && nInvFlags & 0x10)
+if(pNextFrame && nInvFlags & 0x10)
 {
 pNextFrame->InvalidatePrt_();
-pNextFrame->InvalidatePage( pPage );
+pNextFrame->InvalidatePage(pPage);
 }
-if ( pNextFrame && nInvFlags & 0x80 )
+if(pNextFrame && nInvFlags & 0x80)
 {
 pNextFrame->SetCompletePaint();
 }
-if ( nInvFlags & 0x20 )
+if(nInvFlags & 0x20)
 {
 SwFrame* pPrevFrame = GetPrev();
-if ( pPrevFrame )
+if(pPrevFrame)
 {
 pPrevFrame->InvalidatePrt_();
-pPrevFrame->InvalidatePage( pPage );
+

[Libreoffice-commits] core.git: sw/source

2020-12-13 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/inc/sectfrm.hxx|4 --
 sw/source/core/layout/sectfrm.cxx |   75 +++---
 2 files changed, 39 insertions(+), 40 deletions(-)

New commits:
commit 504fb3362dae5040d06c9223c4b9feb9936a07ef
Author: Bjoern Michaelsen 
AuthorDate: Sun Dec 13 21:23:23 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sun Dec 13 22:46:51 2020 +0100

sectfrm: Modify no more

Change-Id: Ie4aaa1a6ced60db3d812107d567af571c6a4d2e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107664
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 3b890b385e2a..47e7f27424be 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -33,7 +33,7 @@ enum class SwFindMode
 None = 0, EndNote = 1, LastCnt = 2, MyLast = 4
 };
 
-class SwSectionFrame: public SwLayoutFrame, public SwFlowFrame
+class SwSectionFrame final: public SwLayoutFrame, public SwFlowFrame
 {
 SwSection* m_pSection;
 bool m_bFootnoteAtEnd; // footnotes at the end of section
@@ -56,11 +56,9 @@ class SwSectionFrame: public SwLayoutFrame, public 
SwFlowFrame
 virtual void DestroyImpl() override;
 virtual ~SwSectionFrame() override;
 
-protected:
 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
 virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool  ) 
override;
 virtual void Format( vcl::RenderContext* pRenderContext, const 
SwBorderAttrs *pAttrs = nullptr ) override;
-virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
 virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
 
 public:
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index aa2af7d515f7..aab18463fe06 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2566,49 +2566,50 @@ void SwSectionFrame::CalcEndAtEndFlag()
 }
 }
 
-void SwSectionFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew 
)
+void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 {
-sal_uInt8 nInvFlags = 0;
+if(const auto pLegacy = dynamic_cast())
+{
+sal_uInt8 nInvFlags = 0;
+if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
+{
+auto& rOldSetChg = *static_cast(pLegacy->m_pOld);
+auto& rNewSetChg = *static_cast(pLegacy->m_pNew);
+SfxItemIter aOIter(*rOldSetChg.GetChgSet());
+SfxItemIter aNIter(*rNewSetChg.GetChgSet());
+const SfxPoolItem* pOItem = aOIter.GetCurItem();
+const SfxPoolItem* pNItem = aNIter.GetCurItem();
+SwAttrSetChg aOldSet(rOldSetChg);
+SwAttrSetChg aNewSet(rNewSetChg);
+do
+{
+UpdateAttr_(pOItem, pNItem, nInvFlags, , );
+pNItem = aNIter.NextItem();
+pOItem = aOIter.NextItem();
+} while (pNItem);
+if(aOldSet.Count() || aNewSet.Count())
+SwLayoutFrame::Modify(, );
+}
+else
+UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
 
-if( pNew && RES_ATTRSET_CHG == pNew->Which() )
-{
-SfxItemIter aNIter( *static_cast(pNew)->GetChgSet() );
-SfxItemIter aOIter( *static_cast(pOld)->GetChgSet() );
-const SfxPoolItem* pNItem = aNIter.GetCurItem();
-const SfxPoolItem* pOItem = aOIter.GetCurItem();
-SwAttrSetChg aOldSet( *static_cast(pOld) );
-SwAttrSetChg aNewSet( *static_cast(pNew) );
-do
+if(nInvFlags != 0)
 {
-UpdateAttr_(pOItem, pNItem, nInvFlags, , );
-pNItem = aNIter.NextItem();
-pOItem = aOIter.NextItem();
-} while (pNItem);
-if ( aOldSet.Count() || aNewSet.Count() )
-SwLayoutFrame::Modify( ,  );
+if(nInvFlags & 0x01)
+InvalidateSize();
+if(nInvFlags & 0x10)
+SetCompletePaint();
+}
 }
-else
-UpdateAttr_( pOld, pNew, nInvFlags );
-
-if ( nInvFlags != 0 )
+else if(const auto pHint = dynamic_cast())
 {
-if ( nInvFlags & 0x01 )
-InvalidateSize();
-if ( nInvFlags & 0x10 )
-SetCompletePaint();
+// #i117863#
+if( != GetDep())
+return;
+SwSectionFrame::MoveContentAndDelete(this, pHint->IsSaveContent());
 }
-}
-
-void SwSectionFrame::SwClientNotify( const SwModify& rMod, const SfxHint& 
rHint )
-{
-SwFrame::SwClientNotify(rMod, rHint);
-// #i117863#
-if( != GetDep())
-return;
-const auto pHint = dynamic_cast();
-if(!pHint)
-return;
-SwSectionFrame::MoveContentAndDelete( this, pHint->IsSaveContent() );
+else
+SwFrame::SwClientNotify(rMod, rHint);
 }
 
 void SwSectionFrame::UpdateAttr_( const 

[Libreoffice-commits] core.git: sw/source

2020-12-13 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/inc/tabfrm.hxx|5 +--
 sw/source/core/layout/tabfrm.cxx |   61 +--
 2 files changed, 35 insertions(+), 31 deletions(-)

New commits:
commit af0009ec5a60af83762e7df49e17e02f0f2be193
Author: Bjoern Michaelsen 
AuthorDate: Sun Dec 13 18:45:12 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sun Dec 13 20:07:27 2020 +0100

tabfrm:Modify no more

Change-Id: Ie54bea8a8c60b0a74f745630f9cddfc4bd4b0ac7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107656
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index d0eb807297a1..88bd6a82b0fb 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -27,7 +27,7 @@ class SwBorderAttrs;
 class SwAttrSetChg;
 
 /// SwTabFrame is one table in the document layout, containing rows (which 
contain cells).
-class SwTabFrame: public SwLayoutFrame, public SwFlowFrame
+class SwTabFrame final: public SwLayoutFrame, public SwFlowFrame
 {
 friend void CalcContent( SwLayoutFrame *pLay, bool bNoColl );
 
@@ -105,10 +105,9 @@ class SwTabFrame: public SwLayoutFrame, public SwFlowFrame
 virtual void DestroyImpl() override;
 virtual ~SwTabFrame() override;
 
-protected:
 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
 virtual void Format( vcl::RenderContext* pRenderContext, const 
SwBorderAttrs *pAttrs = nullptr ) override;
-virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
+virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 // only changes the Framesize, not the PrtArea size
 virtual SwTwips GrowFrame  ( SwTwips, bool bTst = false, bool bInfo = 
false ) override;
 
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index ed54f255c052..88033e3ee9b6 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3257,64 +3257,69 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool 
bTst, bool bInfo )
 return nDist;
 }
 
-void SwTabFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
+void SwTabFrame::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
+auto pLegacy = dynamic_cast();
+if(!pLegacy)
+return;
 sal_uInt8 nInvFlags = 0;
-bool bAttrSetChg = pNew && RES_ATTRSET_CHG == pNew->Which();
+bool bAttrSetChg = pLegacy->m_pNew && RES_ATTRSET_CHG == 
pLegacy->m_pNew->Which();
 
-if( bAttrSetChg )
+if(bAttrSetChg)
 {
-SfxItemIter aNIter( *static_cast(pNew)->GetChgSet() );
-SfxItemIter aOIter( *static_cast(pOld)->GetChgSet() );
-const SfxPoolItem* pNItem = aNIter.GetCurItem();
+auto& rOldSetChg = *static_cast(pLegacy->m_pOld);
+auto& rNewSetChg = *static_cast(pLegacy->m_pNew);
+SfxItemIter aOIter(*rOldSetChg.GetChgSet());
+SfxItemIter aNIter(*rNewSetChg.GetChgSet());
 const SfxPoolItem* pOItem = aOIter.GetCurItem();
-SwAttrSetChg aOldSet( *static_cast(pOld) );
-SwAttrSetChg aNewSet( *static_cast(pNew) );
+const SfxPoolItem* pNItem = aNIter.GetCurItem();
+SwAttrSetChg aOldSet(rOldSetChg);
+SwAttrSetChg aNewSet(rNewSetChg);
 do
 {
 UpdateAttr_(pOItem, pNItem, nInvFlags, , );
 pNItem = aNIter.NextItem();
 pOItem = aOIter.NextItem();
-} while (pNItem);
-if ( aOldSet.Count() || aNewSet.Count() )
-SwLayoutFrame::Modify( ,  );
+} while(pNItem);
+if(aOldSet.Count() || aNewSet.Count())
+SwLayoutFrame::Modify(, );
 }
 else
-UpdateAttr_( pOld, pNew, nInvFlags );
+UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
 
-if ( nInvFlags == 0 )
+if(nInvFlags == 0)
 return;
 
-SwPageFrame *pPage = FindPageFrame();
-InvalidatePage( pPage );
-if ( nInvFlags & 0x02 )
+SwPageFrame* pPage = FindPageFrame();
+InvalidatePage(pPage);
+if(nInvFlags & 0x02)
 InvalidatePrt_();
-if ( nInvFlags & 0x40 )
+if(nInvFlags & 0x40)
 InvalidatePos_();
-SwFrame *pTmp = GetIndNext();
-if ( nullptr != pTmp )
+SwFrame* pTmp = GetIndNext();
+if(nullptr != pTmp)
 {
-if ( nInvFlags & 0x04 )
+if(nInvFlags & 0x04)
 {
 pTmp->InvalidatePrt_();
-if ( pTmp->IsContentFrame() )
-pTmp->InvalidatePage( pPage );
+if(pTmp->IsContentFrame())
+pTmp->InvalidatePage(pPage);
 }
-if ( nInvFlags & 0x10 )
+if(nInvFlags & 0x10)
 pTmp->SetCompletePaint();
 }
-if ( nInvFlags & 0x08 && nullptr != (pTmp = GetPrev()) )
+if(nInvFlags & 0x08 && nullptr != (pTmp = GetPrev()))
 {
 pTmp->InvalidatePrt_();
-if ( pTmp->IsContentFrame() )
+if(pTmp->IsContentFrame())
 

[Libreoffice-commits] core.git: sw/source

2020-12-13 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/inc/pagefrm.hxx|5 --
 sw/source/core/layout/pagechg.cxx |   92 ++
 2 files changed, 46 insertions(+), 51 deletions(-)

New commits:
commit 1d9f243a39169256ebb923afb32fffecf04ac427
Author: Bjoern Michaelsen 
AuthorDate: Sun Dec 13 01:07:42 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Sun Dec 13 11:16:23 2020 +0100

pagechg: Modify no more

Change-Id: I571813d6e4fd3c465f77eb7acca9d656440a136a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107648
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 24c6ba554d45..c5ad094e46a8 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -38,7 +38,7 @@ class SwAnchoredObject;
 
 /// A page of the document layout. Upper frame is expected to be an SwRootFrame
 /// instance. At least an SwBodyFrame lower is expected.
-class SAL_DLLPUBLIC_RTTI SwPageFrame: public SwFootnoteBossFrame
+class SAL_DLLPUBLIC_RTTI SwPageFrame final: public SwFootnoteBossFrame
 {
 friend class SwFrame;
 
@@ -99,10 +99,7 @@ class SAL_DLLPUBLIC_RTTI SwPageFrame: public 
SwFootnoteBossFrame
 
 virtual void DestroyImpl() override;
 virtual ~SwPageFrame() override;
-
-protected:
 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
-virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 
 /// Calculate the content height of a page (without columns).
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index f1e2c35f52f1..611b63753bc1 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -495,52 +495,6 @@ void SwPageFrame::PreparePage( bool bFootnote )
 }
 }
 
-void SwPageFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
-{
-SwViewShell *pSh = getRootFrame()->GetCurrShell();
-if ( pSh )
-pSh->SetFirstVisPageInvalid();
-sal_uInt8 nInvFlags = 0;
-
-if( pNew && RES_ATTRSET_CHG == pNew->Which() )
-{
-SfxItemIter aNIter( *static_cast(pNew)->GetChgSet() );
-SfxItemIter aOIter( *static_cast(pOld)->GetChgSet() );
-const SfxPoolItem* pNItem = aNIter.GetCurItem();
-const SfxPoolItem* pOItem = aOIter.GetCurItem();
-SwAttrSetChg aOldSet( *static_cast(pOld) );
-SwAttrSetChg aNewSet( *static_cast(pNew) );
-do
-{
-UpdateAttr_(pOItem, pNItem, nInvFlags, , );
-pNItem = aNIter.NextItem();
-pOItem = aOIter.NextItem();
-} while (pNItem);
-if ( aOldSet.Count() || aNewSet.Count() )
-SwLayoutFrame::Modify( ,  );
-}
-else
-UpdateAttr_( pOld, pNew, nInvFlags );
-
-if ( nInvFlags == 0 )
-return;
-
-InvalidatePage( this );
-if ( nInvFlags & 0x01 )
-InvalidatePrt_();
-if ( nInvFlags & 0x02 )
-SetCompletePaint();
-if ( nInvFlags & 0x04 && GetNext() )
-GetNext()->InvalidatePos();
-if ( nInvFlags & 0x08 )
-PrepareHeader();
-if ( nInvFlags & 0x10 )
-PrepareFooter();
-if ( nInvFlags & 0x20 )
-CheckGrid( nInvFlags & 0x40 );
-}
-
-
 void SwPageFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
 {
 if(typeid(sw::PageFootnoteHint) == typeid(rHint))
@@ -554,7 +508,51 @@ void SwPageFrame::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
 // here, the page might be destroyed:
 static_cast(GetUpper())->RemoveFootnotes(nullptr, false, 
true);
 }
-else
+else if(auto pLegacy = dynamic_cast())
+{
+if(auto pSh = getRootFrame()->GetCurrShell())
+pSh->SetFirstVisPageInvalid();
+
+sal_uInt8 nInvFlags = 0;
+if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
+{
+auto& rOldSetChg = *static_cast(pLegacy->m_pOld);
+auto& rNewSetChg = *static_cast(pLegacy->m_pNew);
+SfxItemIter aOIter(*rOldSetChg.GetChgSet());
+SfxItemIter aNIter(*rNewSetChg.GetChgSet());
+const SfxPoolItem* pOItem = aOIter.GetCurItem();
+const SfxPoolItem* pNItem = aNIter.GetCurItem();
+SwAttrSetChg aOldSet(rOldSetChg);
+SwAttrSetChg aNewSet(rNewSetChg);
+do
+{
+UpdateAttr_(pOItem, pNItem, nInvFlags, , );
+pOItem = aOIter.NextItem();
+pNItem = aNIter.NextItem();
+} while(pNItem);
+if(aOldSet.Count() || aNewSet.Count())
+SwLayoutFrame::Modify(, );
+}
+else
+UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
+
+if (nInvFlags == 0)
+return;
+
+InvalidatePage( this );
+if(nInvFlags & 0x01)
+

[Libreoffice-commits] core.git: sw/source

2020-12-10 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/inc/flyfrms.hxx |8 +---
 sw/source/core/layout/flyincnt.cxx |   67 +++--
 2 files changed, 39 insertions(+), 36 deletions(-)

New commits:
commit 4d6f00a097e68715c63c3388b1183bf08fa8cdbb
Author: Bjoern Michaelsen 
AuthorDate: Thu Dec 10 00:09:32 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Thu Dec 10 09:25:47 2020 +0100

flyincnt: Modify no more

Change-Id: I1500f5944a5a9504ef8c9c48c2d43da710de3fa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107512
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index 160ca2bb85ca..a401e4abf0af 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -191,18 +191,16 @@ public:
 };
 
 // Flys that are bound to a character in Content
-class SwFlyInContentFrame : public SwFlyFrame
+class SwFlyInContentFrame final: public SwFlyFrame
 {
 Point m_aRef;  // relative to this point AbsPos is being calculated
 
 virtual void DestroyImpl() override;
 virtual ~SwFlyInContentFrame() override;
 
-protected:
-virtual void NotifyBackground( SwPageFrame *pPage,
-   const SwRect& rRect, PrepareHint eHint) 
override;
+virtual void NotifyBackground(SwPageFrame *pPage, const SwRect& rRect, 
PrepareHint eHint) override;
 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
-virtual void  Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
+virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 
 public:
 // #i28701#
diff --git a/sw/source/core/layout/flyincnt.cxx 
b/sw/source/core/layout/flyincnt.cxx
index daeaaf314f17..be7b5722a593 100644
--- a/sw/source/core/layout/flyincnt.cxx
+++ b/sw/source/core/layout/flyincnt.cxx
@@ -90,45 +90,50 @@ void SwFlyInContentFrame::SetRefPoint( const Point& rPoint,
 }
 }
 
-void SwFlyInContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem 
*pNew )
+void SwFlyInContentFrame::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
-bool bCallPrepare = false;
-const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
-if (RES_ATTRSET_CHG == nWhich && pNew)
+auto pLegacy = dynamic_cast();
+if(!pLegacy)
+return;
+std::pair, std::unique_ptr> 
aTweakedChgs;
+std::pair aSuperArgs(nullptr, 
nullptr);
+switch(pLegacy->GetWhich())
 {
-if(pOld &&
-(SfxItemState::SET == static_cast(pNew)->GetChgSet()->
-GetItemState(RES_SURROUND, false) ||
-SfxItemState::SET == static_cast(pNew)->GetChgSet()->
-GetItemState(RES_FRMMACRO, false)) )
+case RES_ATTRSET_CHG:
 {
-SwAttrSetChg aOld( *static_cast(pOld) );
-SwAttrSetChg aNew( *static_cast(pNew) );
-
-aOld.ClearItem( RES_SURROUND );
-aNew.ClearItem( RES_SURROUND );
-aOld.ClearItem( RES_FRMMACRO );
-aNew.ClearItem( RES_FRMMACRO );
-if( aNew.Count() )
+auto pOldAttrSetChg = static_cast(pLegacy->m_pOld);
+auto pNewAttrSetChg = static_cast(pLegacy->m_pNew);
+if(pOldAttrSetChg
+&& pNewAttrSetChg
+&& ((SfxItemState::SET == 
pNewAttrSetChg->GetChgSet()->GetItemState(RES_SURROUND, false))
+|| (SfxItemState::SET == 
pNewAttrSetChg->GetChgSet()->GetItemState(RES_FRMMACRO, false
 {
-SwFlyFrame::Modify( ,  );
-bCallPrepare = true;
-}
-}
-else if( static_cast(pNew)->GetChgSet()->Count())
-{
-SwFlyFrame::Modify( pOld, pNew );
-bCallPrepare = true;
+aTweakedChgs.second = 
std::make_unique(*pOldAttrSetChg);
+aTweakedChgs.second->ClearItem(RES_SURROUND);
+aTweakedChgs.second->ClearItem(RES_FRMMACRO);
+if(aTweakedChgs.second->Count())
+{
+aTweakedChgs.first = 
std::make_unique(*pOldAttrSetChg);
+aTweakedChgs.first->ClearItem(RES_SURROUND);
+aTweakedChgs.first->ClearItem(RES_FRMMACRO);
+aSuperArgs = std::pair(aTweakedChgs.first.get(), aTweakedChgs.second.get());
+}
+} else if(pNewAttrSetChg->GetChgSet()->Count())
+aSuperArgs = std::pair(pLegacy->m_pOld, pLegacy->m_pNew);
+break;
 }
+case RES_SURROUND:
+case RES_FRMMACRO:
+break;
+default:
+aSuperArgs = std::pair(pLegacy->m_pOld, pLegacy->m_pNew);
 }
-else if( nWhich != RES_SURROUND && RES_FRMMACRO != nWhich )
+if(aSuperArgs.second)
 {
-SwFlyFrame::Modify( pOld, pNew );
-bCallPrepare = true;
+SwFlyFrame::Modify(aSuperArgs.first, aSuperArgs.second);
+

[Libreoffice-commits] core.git: sw/source

2020-12-09 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/inc/flyfrms.hxx   |6 --
 sw/source/core/layout/flylay.cxx |  113 ++-
 2 files changed, 56 insertions(+), 63 deletions(-)

New commits:
commit d79a578c200ff30134cf5ec7ad5c66f3e5d2d4c9
Author: Bjoern Michaelsen 
AuthorDate: Tue Dec 8 23:50:27 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Thu Dec 10 00:17:43 2020 +0100

flylay: Modify no more

Change-Id: I1b001b71cf313b804960d91dd96bef036c610303
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107444
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index 82a67b9b5342..160ca2bb85ca 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -144,15 +144,13 @@ public:
 };
 
 // Flys that are bound to LayoutFrames and not to Content
-class SwFlyLayFrame : public SwFlyFreeFrame
+class SwFlyLayFrame final: public SwFlyFreeFrame
 {
 public:
 // #i28701#
 
 SwFlyLayFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor );
-
-protected:
-virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
+virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 };
 
 // Flys that are bound to Content but not in Content
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 2f96c72c4170..4d25fe00d1fa 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -725,80 +725,75 @@ SwFlyLayFrame::SwFlyLayFrame( SwFlyFrameFormat *pFormat, 
SwFrame* pSib, SwFrame
 
 // #i28701#
 
-void SwFlyLayFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
+void SwFlyLayFrame::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
-const SwFormatAnchor *pAnch = nullptr;
-
-if (pNew)
+auto pLegacy = dynamic_cast();
+if(!pLegacy)
+return;
+const SwFormatAnchor* pAnch = nullptr;
+switch(pLegacy->GetWhich())
 {
-const sal_uInt16 nWhich = pNew->Which();
-if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET ==
-static_cast(pNew)->GetChgSet()->GetItemState( 
RES_ANCHOR, false,
-reinterpret_cast() ))
-; // GetItemState sets the anchor pointer!
-
-else if( RES_ANCHOR == nWhich )
+case RES_ATTRSET_CHG:
 {
-// Change of anchor. I'm attaching myself to the new place.
-// It's not allowed to change the anchor type. This is only
-// possible via SwFEShell.
-pAnch = static_cast(pNew);
+pAnch = static_cast(pLegacy->m_pNew)->GetChgSet()->GetItem(RES_ANCHOR, false);
+break;
 }
+case RES_ANCHOR:
+pAnch = static_cast(pLegacy->m_pNew);
 }
 
-if( pAnch )
+if(!pAnch)
 {
-OSL_ENSURE( pAnch->GetAnchorId() ==
-GetFormat()->GetAnchor().GetAnchorId(),
-"8-) Invalid change of anchor type." );
+SwFlyFrame::Modify(pLegacy->m_pOld, pLegacy->m_pNew);
+return;
+}
+SAL_WARN_IF(pAnch->GetAnchorId() == 
GetFormat()->GetAnchor().GetAnchorId(), "sw.core", "Invalid change of anchor 
type.");
 
-// Unregister, get hold of the page, attach to the corresponding 
LayoutFrame.
-SwRect aOld( GetObjRectWithSpaces() );
-// #i28701# - use new method 
-SwPageFrame *pOldPage = GetPageFrame();
-AnchorFrame()->RemoveFly( this );
+// Unregister, get hold of the page, attach to the corresponding 
LayoutFrame.
+SwRect aOld(GetObjRectWithSpaces());
+// #i28701# - use new method 
+SwPageFrame* pOldPage = GetPageFrame();
+AnchorFrame()->RemoveFly(this);
 
-if ( RndStdIds::FLY_AT_PAGE == pAnch->GetAnchorId() )
+if(RndStdIds::FLY_AT_PAGE == pAnch->GetAnchorId())
+{
+SwRootFrame* pRoot = getRootFrame();
+SwPageFrame* pTmpPage = static_cast(pRoot->Lower());
+sal_uInt16 nPagesToFlip = pAnch->GetPageNum()-1;
+while(pTmpPage && nPagesToFlip)
 {
-sal_uInt16 nPgNum = pAnch->GetPageNum();
-SwRootFrame *pRoot = getRootFrame();
-SwPageFrame *pTmpPage = static_cast(pRoot->Lower());
-for ( sal_uInt16 i = 1; (i <= nPgNum) && pTmpPage; ++i,
-pTmpPage = 
static_cast(pTmpPage->GetNext()) )
-{
-if ( i == nPgNum )
-{
-// #i50432# - adjust synopsis of 
-pTmpPage->PlaceFly( this, nullptr );
-}
-}
-if( !pTmpPage )
-{
-pRoot->SetAssertFlyPages();
-pRoot->AssertFlyPages();
-}
+pTmpPage = static_cast(pTmpPage->GetNext());
+--nPagesToFlip;
 }
-else
+if(!nPagesToFlip)
 {
-SwNodeIndex aIdx( pAnch->GetContentAnchor()->nNode );
-

[Libreoffice-commits] core.git: sw/inc sw/source

2020-12-07 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/usrfld.hxx|2 +-
 sw/source/core/fields/usrfld.cxx |   12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 43d07ddf487fae1b966abf00a36612b109ed01fc
Author: Bjoern Michaelsen 
AuthorDate: Sun Dec 6 22:56:14 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Dec 7 11:40:54 2020 +0100

SwUserFieldType: Modify no more

Change-Id: I1194225011380bf63d854f8054d063e93a832744
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107322
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
index 589c379a5d1c..3592c6834380 100644
--- a/sw/inc/usrfld.hxx
+++ b/sw/inc/usrfld.hxx
@@ -73,7 +73,7 @@ public:
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
 private:
-virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) 
override;
+virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 };
 
 inline bool SwUserFieldType::IsValid() const
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 07a75a42608f..431a3ba0675f 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -213,18 +213,18 @@ OUString SwUserFieldType::GetName() const
 return m_aName;
 }
 
-void SwUserFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew 
)
+void SwUserFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
-if( !pOld && !pNew )
+auto pLegacy = dynamic_cast();
+if(!pLegacy->m_pOld && !pLegacy->m_pNew)
 m_bValidValue = false;
 
-NotifyClients( pOld, pNew );
-
+CallSwClientNotify(rHint);
 // update input fields that might be connected to the user field
-if ( !IsModifyLocked() )
+if (!IsModifyLocked())
 {
 LockModify();
-GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( 
SwFieldIds::Input )->UpdateFields();
+
GetDoc()->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Input)->UpdateFields();
 UnlockModify();
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/inc sw/source

2020-12-07 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/expfld.hxx|4 ++--
 sw/source/core/fields/expfld.cxx |   10 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 70110bf540449c7a71b6404d576479fededf7172
Author: Bjoern Michaelsen 
AuthorDate: Sun Dec 6 22:44:27 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Dec 7 11:40:30 2020 +0100

Sw{Get,Set}ExpFieldType: Modify no more

Change-Id: Id0daf2aa04663127dcbd78d2206d81aab6a783f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107321
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index 7517afc34715..465379112c58 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -76,7 +76,7 @@ public:
 /** Overlay, because get-field cannot be changed and therefore
  does not need to be updated. Update at changing of set-values! */
 private:
-virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) 
override;
+virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 };
 
 class SW_DLLPUBLIC SwGetExpField final : public SwFormulaField
@@ -149,7 +149,7 @@ class SW_DLLPUBLIC SwSetExpFieldType final : public 
SwValueFieldType
 sal_uInt8   m_nLevel;
 boolm_bDeleted;
 
-virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) 
override;
+virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 
 public:
 SwSetExpFieldType( SwDoc* pDoc, const OUString& rName,
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 6384010b9bde..ceea88941ddb 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -271,11 +271,13 @@ std::unique_ptr SwGetExpFieldType::Copy() 
const
 return std::make_unique(GetDoc());
 }
 
-void SwGetExpFieldType::Modify( const SfxPoolItem*, const SfxPoolItem* pNew )
+void SwGetExpFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
-if( pNew && RES_DOCPOS_UPDATE == pNew->Which() )
-NotifyClients( nullptr, pNew );
+auto pLegacy = dynamic_cast();
 // do not expand anything else
+if(!pLegacy || (pLegacy->GetWhich() != RES_DOCPOS_UPDATE))
+return;
+CallSwClientNotify(rHint);
 }
 
 SwGetExpField::SwGetExpField(SwGetExpFieldType* pTyp, const OUString& rFormel,
@@ -546,7 +548,7 @@ void SwSetExpField::ChgExpStr(const OUString& rExpand, 
SwRootFrame const*const p
 }
 }
 
-void SwSetExpFieldType::Modify( const SfxPoolItem*, const SfxPoolItem* )
+void SwSetExpFieldType::SwClientNotify(const SwModify&, const SfxHint&)
 {
 // do not expand further
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/inc sw/source

2020-12-07 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/authfld.hxx|2 +-
 sw/source/core/fields/authfld.cxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 995b06bd0fb824c5717791c627746a5fb38cb656
Author: Bjoern Michaelsen 
AuthorDate: Sun Dec 6 22:02:58 2020 +0100
Commit: Bjoern Michaelsen 
CommitDate: Mon Dec 7 11:39:10 2020 +0100

SwAuthorityFieldType: Modify no more

Change-Id: I59f1e5d25c0defa3b551061fccfeea625d0df3aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107319
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 05921ad7a454..6ea5612f3164 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -69,7 +69,7 @@ class SW_DLLPUBLIC SwAuthorityFieldType final : public 
SwFieldType
 LanguageTypem_eLanguage;
 OUStringm_sSortAlgorithm;
 
-virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) 
override;
+virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 
 public:
 SwAuthorityFieldType(SwDoc* pDoc);
diff --git a/sw/source/core/fields/authfld.cxx 
b/sw/source/core/fields/authfld.cxx
index 7efac3af55f3..e00c727962cc 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -411,11 +411,11 @@ void SwAuthorityFieldType::PutValue( const Any& rAny, 
sal_uInt16 nWhichId )
 }
 }
 
-void SwAuthorityFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem 
*pNew )
+void SwAuthorityFieldType::SwClientNotify(const SwModify&, const SfxHint& 
rHint)
 {
 //re-generate positions of the fields
 DelSequenceArray();
-NotifyClients( pOld, pNew );
+CallSwClientNotify(rHint);
 }
 
 sal_uInt16 SwAuthorityFieldType::GetSortKeyCount() const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   3   >