summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/hints.hxx9
-rw-r--r--sw/source/core/layout/tabfrm.cxx25
-rw-r--r--sw/source/core/table/swtable.cxx40
3 files changed, 39 insertions, 35 deletions
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<const sw::MoveTableBoxHint*>(&rHint))
+ if(auto pNewFormatHint = dynamic_cast<const sw::TableBoxFormatChanged*>(&rHint))
+ {
+ if(GetTabBox() != &pNewFormatHint->m_rTableBox)
+ return;
+ RegisterToFormat(const_cast<SwTableBoxFormat&>(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<const sw::MoveTableBoxHint*>(&rHint))
{
if(GetTabBox() != &pMoveTableBoxHint->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<SwCellFrame,SwFormat> 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);
+ if(!pOld->HasWriterListeners())
delete pOld;
}