[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source
Bjoern Michaelsen (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 2 14:06:34 UTC 2020
sw/inc/fldbas.hxx | 8 ++------
sw/inc/format.hxx | 1 +
sw/source/core/attr/format.cxx | 5 +++++
sw/source/core/docnode/ndsect.cxx | 8 ++------
sw/source/core/docnode/section.cxx | 3 +--
sw/source/core/fields/fldbas.cxx | 12 ++++++++++++
sw/source/core/tox/tox.cxx | 5 ++---
sw/source/core/txtnode/atrfld.cxx | 5 ++---
sw/source/core/undo/undobj1.cxx | 5 +----
sw/source/core/undo/undraw.cxx | 30 ++++++++----------------------
sw/source/core/undo/untbl.cxx | 2 +-
sw/source/core/view/viewsh.cxx | 11 +++--------
12 files changed, 40 insertions(+), 55 deletions(-)
New commits:
commit 4839756fcb381e37f7c4cc65e392d772b325c8b4
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Mon Nov 2 12:18:46 2020 +0100
Commit: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Mon Nov 2 15:06:04 2020 +0100
SwFieldType: ModifyNotification no more ...
Change-Id: Idb6c0a6cca5df729037067f6def5594eed2cca19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105178
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 68cd955f97c0..82461033fe1b 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -271,7 +271,8 @@ public:
SwFieldIds Which() const { return m_nWhich; }
- inline void UpdateFields() const;
+ void UpdateFields() const;
+ void PrintHiddenPara();
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
SwFormatField* FindFormatForField(const SwField*) const;
SwFormatField* FindFormatForPostItId(sal_uInt32 nPostItId) const;
@@ -282,11 +283,6 @@ public:
void GatherFields(std::vector<SwFormatField*>& rvFormatFields, bool bCollectOnlyInDocNodes=true) const;
};
-inline void SwFieldType::UpdateFields() const
-{
- const_cast<SwFieldType*>(this)->ModifyNotification( nullptr, nullptr );
-}
-
/** Base class of all fields.
Type of field is queried via Which.
Expanded content of field is queried via ExpandField(). */
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index ce63d378f3fd..2a8da69042cb 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -40,6 +40,7 @@
#include <authfld.hxx>
#include <calbck.hxx>
#include <viewsh.hxx>
+#include <hints.hxx>
using namespace ::com::sun::star;
using namespace nsSwDocInfoSubType;
@@ -144,6 +145,17 @@ void SwFieldType::PutValue( const uno::Any& , sal_uInt16 )
{
}
+void SwFieldType::UpdateFields() const
+{
+ const_cast<SwFieldType*>(this)->SwClientNotify(*this, sw::LegacyModifyHint(nullptr, nullptr));
+}
+
+void SwFieldType::PrintHiddenPara()
+{
+ const SwMsgPoolItem aHint(RES_HIDDENPARA_PRINT);
+ SwClientNotify(*this, sw::LegacyModifyHint(&aHint, nullptr));
+}
+
void SwFieldType::dumpAsXml(xmlTextWriterPtr pWriter) const
{
std::vector<SwFormatField*> vFields;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index cac98fffaace..95129e6b90dc 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -940,10 +940,8 @@ void SwViewShell::SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara)
GetDoc()->getIDocumentState().SetModified();
for (auto const & pFieldType : *GetDoc()->getIDocumentFieldsAccess().GetFieldTypes())
{
- if (pFieldType->Which() == SwFieldIds::Database)
- {
- pFieldType->ModifyNotification(nullptr, nullptr);
- }
+ if(pFieldType->Which() == SwFieldIds::Database)
+ pFieldType->UpdateFields();
}
EndAction();
}
@@ -2172,10 +2170,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
SwHiddenParaFieldType* pFieldType = static_cast<SwHiddenParaFieldType*>(GetDoc()->
getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::HiddenPara));
if( pFieldType && pFieldType->HasWriterListeners() )
- {
- SwMsgPoolItem aHint( RES_HIDDENPARA_PRINT );
- pFieldType->ModifyNotification( &aHint, nullptr);
- }
+ pFieldType->PrintHiddenPara();
bReformat = true;
}
if ( !bReformat && mpOpt->IsShowHiddenChar() != rOpt.IsShowHiddenChar() )
commit d0292dd0a3bd241ab073bea6f5a985b8be154d78
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Mon Nov 2 10:41:44 2020 +0100
Commit: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Mon Nov 2 15:05:55 2020 +0100
sw/source/core/undo: ModifyNotification no more ...
- also: introduce SwFormat::RemoveAllUnos() as a member function,
because that is where this belongs ...
- ... and then also use it elsewhere if possible.
Change-Id: I9cc073a41ef1077429f648309806fa433bdcec99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105173
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index de607a382da3..d04799bcf7fd 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -250,6 +250,7 @@ public:
// Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
virtual bool supportsFullDrawingLayerFillAttributeSet() const;
+ void RemoveAllUnos();
};
#endif // INCLUDED_SW_INC_FORMAT_HXX
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 6713ae28f065..22430f84b125 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -779,4 +779,9 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFormat::getSdrAllFillAt
return drawinglayer::attribute::SdrAllFillAttributesHelperPtr();
}
+void SwFormat::RemoveAllUnos()
+{
+ SwPtrMsgPoolItem aMsgHint(RES_REMOVE_UNO_OBJECT, this);
+ SwClientNotify(*this, sw::LegacyModifyHint(&aMsgHint, &aMsgHint));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 415334221392..19ab45f846db 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -561,10 +561,7 @@ void SwDoc::DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes )
return ;
}
- {
- SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat );
- pFormat->ModifyNotification( &aMsgHint, &aMsgHint );
- }
+ pFormat->RemoveAllUnos();
// A ClearRedo could result in a recursive call of this function and delete some section
// formats, thus the position inside the SectionFormatTable could have changed
@@ -1309,8 +1306,7 @@ void SwSectionNode::NodesArrChgd()
if( !rNds.IsDocNodes() )
{
- SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat );
- pFormat->ModifyNotification( &aMsgHint, &aMsgHint );
+ pFormat->RemoveAllUnos();
}
pFormat->LockModify();
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 55bc3aee8fe7..430e696c8ab1 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -258,8 +258,7 @@ SwSection::~SwSection()
}
// If the Section is the last Client in the Format we can delete it
- SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat );
- lcl_SwClientNotify(*pFormat, &aMsgHint);
+ pFormat->RemoveAllUnos();
if( !pFormat->HasWriterListeners() )
{
// Do not add to the Undo. This should've happened earlier.
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 0f9526488cb8..c94aa5dde16a 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -185,9 +185,8 @@ void SwTOXMark::Notify(const SfxHint& rHint)
void SwTOXMark::InvalidateTOXMark()
{
- SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
- &static_cast<SwModify&>(*this) ); // cast to base class!
- NotifyClients(&aMsgHint, &aMsgHint);
+ const SwPtrMsgPoolItem aMsgHint(RES_REMOVE_UNO_OBJECT, &static_cast<SwModify&>(*this));
+ CallSwClientNotify(sw::LegacyModifyHint(&aMsgHint, &aMsgHint));
}
OUString SwTOXMark::GetText(SwRootFrame const*const pLayout) const
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index da3ef375c304..19114a8f4712 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -215,9 +215,8 @@ SwFormatField* SwFormatField::Clone( SfxItemPool* ) const
void SwFormatField::InvalidateField()
{
- SwPtrMsgPoolItem const item(RES_REMOVE_UNO_OBJECT,
- &static_cast<SwModify&>(*this)); // cast to base class (void*)
- CallSwClientNotify(sw::LegacyModifyHint{ &item, &item });
+ const SwPtrMsgPoolItem aItem(RES_REMOVE_UNO_OBJECT, &static_cast<SwModify&>(*this));
+ CallSwClientNotify(sw::LegacyModifyHint{ &aItem, &aItem });
}
void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 7e9233759240..15801bca46e2 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -202,10 +202,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc )
}
// all Uno objects should now log themselves off
- {
- SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, m_pFrameFormat );
- m_pFrameFormat->ModifyNotification( &aMsgHint, &aMsgHint );
- }
+ m_pFrameFormat->RemoveAllUnos();
if ( RES_DRAWFRMFMT != m_pFrameFormat->Which() )
{
diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx
index 9ed78bd680a3..1a2ad32bb0e8 100644
--- a/sw/source/core/undo/undraw.cxx
+++ b/sw/source/core/undo/undraw.cxx
@@ -96,12 +96,6 @@ OUString SwSdrUndo::GetComment() const
return m_pSdrUndo->GetComment();
}
-static void lcl_SendRemoveToUno( SwFormat& rFormat )
-{
- SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, &rFormat );
- rFormat.ModifyNotification( &aMsgHint, &aMsgHint );
-}
-
static void lcl_SaveAnchor( SwFrameFormat* pFormat, sal_uLong& rNodePos )
{
const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
@@ -205,8 +199,7 @@ void SwUndoDrawGroup::UndoImpl(::sw::UndoRedoContext &)
::lcl_SaveAnchor( pFormat, m_pObjArray[0].nNodeIdx );
- // notify UNO objects to decouple
- ::lcl_SendRemoveToUno( *pFormat );
+ pFormat->RemoveAllUnos();
// remove from array
SwDoc* pDoc = pFormat->GetDoc();
@@ -259,8 +252,7 @@ void SwUndoDrawGroup::RedoImpl(::sw::UndoRedoContext &)
::lcl_SaveAnchor( rSave.pFormat, rSave.nNodeIdx );
- // notify UNO objects to decouple
- ::lcl_SendRemoveToUno( *rSave.pFormat );
+ rSave.pFormat->RemoveAllUnos();
rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), rSave.pFormat ));
}
@@ -291,8 +283,7 @@ void SwUndoDrawGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat, SdrOb
rSave.pFormat = pFormat;
::lcl_SaveAnchor( pFormat, rSave.nNodeIdx );
- // notify UNO objects to decouple
- ::lcl_SendRemoveToUno( *pFormat );
+ pFormat->RemoveAllUnos();
// remove from array
SwFrameFormats& rFlyFormats = *pFormat->GetDoc()->GetSpzFrameFormats();
@@ -323,8 +314,7 @@ SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup* pObj, const SwDoc& rDoc )
::lcl_SaveAnchor( pFormat, m_pObjArray[0].nNodeIdx );
- // notify UNO objects to decouple
- ::lcl_SendRemoveToUno( *pFormat );
+ pFormat->RemoveAllUnos();
// remove from array
SwFrameFormats& rFlyFormats = *pFormat->GetDoc()->GetSpzFrameFormats();
@@ -357,8 +347,7 @@ void SwUndoDrawUnGroup::UndoImpl(::sw::UndoRedoContext & rContext)
::lcl_SaveAnchor( rSave.pFormat, rSave.nNodeIdx );
- // notify UNO objects to decouple
- ::lcl_SendRemoveToUno( *rSave.pFormat );
+ rSave.pFormat->RemoveAllUnos();
rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), rSave.pFormat ));
}
@@ -392,8 +381,7 @@ void SwUndoDrawUnGroup::RedoImpl(::sw::UndoRedoContext &)
::lcl_SaveAnchor( pFormat, m_pObjArray[0].nNodeIdx );
- // notify UNO objects to decouple
- ::lcl_SendRemoveToUno( *pFormat );
+ pFormat->RemoveAllUnos();
// remove from array
SwDoc* pDoc = pFormat->GetDoc();
@@ -529,8 +517,7 @@ void SwUndoDrawDelete::RedoImpl(::sw::UndoRedoContext & rContext)
pContact->Changed( *pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() );
pObj->SetUserCall( nullptr );
- // notify UNO objects to decouple
- ::lcl_SendRemoveToUno( *pFormat );
+ pFormat->RemoveAllUnos();
rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat ));
::lcl_SaveAnchor( pFormat, rSave.nNodeIdx );
@@ -545,8 +532,7 @@ void SwUndoDrawDelete::AddObj( SwDrawFrameFormat* pFormat,
rSave.pFormat = pFormat;
::lcl_SaveAnchor( pFormat, rSave.nNodeIdx );
- // notify UNO objects to decouple
- ::lcl_SendRemoveToUno( *pFormat );
+ pFormat->RemoveAllUnos();
// remove from array
SwDoc* pDoc = pFormat->GetDoc();
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 21706baa9daa..8710d3148a5a 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1117,7 +1117,7 @@ void SaveTable::NewFrameFormat( const SwTableLine* pTableLn, const SwTableBox* p
const SfxPoolItem& rOld = pOldFormat->GetFormatAttr( RES_BOXATR_FORMAT ),
& rNew = pFormat->GetFormatAttr( RES_BOXATR_FORMAT );
if( rOld != rNew )
- pFormat->ModifyNotification( &rOld, &rNew );
+ pFormat->SwClientNotify(*pFormat, sw::LegacyModifyHint(&rOld, &rNew));
}
if( !pOldFormat->HasWriterListeners() )
More information about the Libreoffice-commits
mailing list