diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-12-06 15:00:45 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2016-12-07 13:56:49 +0000 |
commit | 45cd3f505a02ba48171bcbb8e319fedc6f868b10 (patch) | |
tree | 1665ee9e248026fca91438ec79d13652a4e1f9d9 | |
parent | 48a6d928e66e6a6017002670720b25d34b14167f (diff) |
use proper message passing
Change-Id: I8be59568bd98fde7e306e44538ca7d466137e9fd
Reviewed-on: https://gerrit.libreoffice.org/31685
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
-rw-r--r-- | sw/inc/frmfmt.hxx | 9 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentLayoutManager.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/draw/dcontact.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 1 |
4 files changed, 29 insertions, 19 deletions
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 0d3cac0f8f3c..18a5f0a28ce0 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -234,6 +234,8 @@ public: //The DrawFrame-Format + +class SwDrawFrameFormat; namespace sw { enum class DrawFrameFormatHintId { @@ -264,6 +266,13 @@ namespace sw ContactChangedHint(SdrObject** ppObject) : m_ppObject(ppObject) {}; virtual ~ContactChangedHint() override; }; + struct SW_DLLPUBLIC DrawFormatLayoutCopyHint final : SfxHint + { + SwDrawFrameFormat& m_rDestFormat; + SwDoc& m_rDestDoc; + DrawFormatLayoutCopyHint(SwDrawFrameFormat& rDestFormat, SwDoc& rDestDoc) : m_rDestFormat(rDestFormat), m_rDestDoc(rDestDoc) {}; + virtual ~DrawFormatLayoutCopyHint() override; + }; } class SW_DLLPUBLIC SwDrawFrameFormat: public SwFrameFormat diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index 8134c6f2ce98..08e1cff435a7 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -445,28 +445,14 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( { OSL_ENSURE( RES_DRAWFRMFMT == rSource.Which(), "Neither Fly nor Draw." ); // #i52780# - Note: moving object to visible layer not needed. - const SwDrawContact* pSourceContact = static_cast<const SwDrawContact *>(rSource.FindContactObj()); - - SwDrawContact* pContact = new SwDrawContact( static_cast<SwDrawFrameFormat*>(pDest), - m_rDoc.CloneSdrObj( *pSourceContact->GetMaster(), - m_rDoc.IsCopyIsMove() && &m_rDoc == pSrcDoc ) ); - // #i49730# - notify draw frame format that position attributes are - // already set, if the position attributes are already set at the - // source draw frame format. - if ( dynamic_cast<const SwDrawFrameFormat*>( pDest) != nullptr && - dynamic_cast<const SwDrawFrameFormat*>( &rSource) != nullptr && - static_cast<const SwDrawFrameFormat&>(rSource).IsPosAttrSet() ) - { - static_cast<SwDrawFrameFormat*>(pDest)->PosAttrSet(); - } + rSource.CallSwClientNotify(sw::DrawFormatLayoutCopyHint(static_cast<SwDrawFrameFormat&>(*pDest), m_rDoc)); - if( pDest->GetAnchor() == rNewAnchor ) + if(pDest->GetAnchor() == rNewAnchor) { // Do *not* connect to layout, if a <MakeFrames> will not be called. - if ( bMakeFrames ) - { - pContact->ConnectToLayout( &rNewAnchor ); - } + if(bMakeFrames) + pDest->CallSwClientNotify(sw::DrawFrameFormatHint(sw::DrawFrameFormatHintId::MAKE_FRAMES)); + } else pDest->SetFormatAttr( rNewAnchor ); diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 8e4ebb50de86..b8aaa4063f3e 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1525,6 +1525,20 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) auto pObject = *pContactChangedHint->m_ppObject; Changed(*pObject, SdrUserCallType::Delete, pObject->GetLastBoundRect()); } + else if (auto pDrawFormatLayoutCopyHint = dynamic_cast<const sw::DrawFormatLayoutCopyHint*>(&rHint)) + { + const SwDrawFrameFormat& rFormat = static_cast<const SwDrawFrameFormat&>(rMod); + new SwDrawContact( + &pDrawFormatLayoutCopyHint->m_rDestFormat, + pDrawFormatLayoutCopyHint->m_rDestDoc.CloneSdrObj( + *GetMaster(), + pDrawFormatLayoutCopyHint->m_rDestDoc.IsCopyIsMove() && &pDrawFormatLayoutCopyHint->m_rDestDoc == rFormat.GetDoc())); + // #i49730# - notify draw frame format that position attributes are + // already set, if the position attributes are already set at the + // source draw frame format. + if(rFormat.IsPosAttrSet()) + pDrawFormatLayoutCopyHint->m_rDestFormat.PosAttrSet(); + } } // #i26791# diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index f9944e7fb054..7211fc59cd20 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -3331,6 +3331,7 @@ namespace sw DrawFrameFormatHint::~DrawFrameFormatHint() {} CheckDrawFrameFormatLayerHint::~CheckDrawFrameFormatLayerHint() {} ContactChangedHint::~ContactChangedHint() {} + DrawFormatLayoutCopyHint::~DrawFormatLayoutCopyHint() {} } SwDrawFrameFormat::~SwDrawFrameFormat() |