diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2017-01-03 02:01:48 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2017-01-03 10:52:00 +0000 |
commit | 2f01d2a42a5afecd7827a939cd0f5d6793cba47e (patch) | |
tree | 24b6f257955efa2fde5abcfd3d84847e8a1b4930 /sw | |
parent | e4a84c625f28b947816b07654fbe912a466b824a (diff) |
use proper message passing
Change-Id: Id0ac2e87344fdab4db97357158c5cc60eed70898
Reviewed-on: https://gerrit.libreoffice.org/32663
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/dcontact.hxx | 3 | ||||
-rw-r--r-- | sw/inc/frmfmt.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/docdraw.cxx | 39 | ||||
-rw-r--r-- | sw/source/core/draw/dcontact.cxx | 19 | ||||
-rw-r--r-- | sw/source/core/inc/flyfrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 14 |
7 files changed, 49 insertions, 34 deletions
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index ae84eee82acf..36f2410321de 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -186,10 +186,11 @@ public: /** ContactObject for connection between frames (or their formats respectively) in SwClient and the drawobjects of Drawing (DsrObjUserCall). */ -class SW_DLLPUBLIC SwFlyDrawContact : public SwContact +class SW_DLLPUBLIC SwFlyDrawContact final : public SwContact { private: SwFlyDrawObj* mpMasterObj; + void SwClientNotify(const SwModify&, const SfxHint& rHint) override; public: diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index c9f869e6e1cd..6c1e2daa1b90 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -329,6 +329,12 @@ namespace sw CollectTextObjectsHint(std::list<SdrTextObj*>& rTextObjects) : m_rTextObjects(rTextObjects) {}; virtual ~CollectTextObjectsHint() override; }; + struct SW_DLLPUBLIC GetZOrderHint final : SfxHint + { + sal_uInt32& m_rnZOrder; + GetZOrderHint(sal_uInt32& rnZOrder) : m_rnZOrder(rnZOrder) {}; + virtual ~GetZOrderHint() override; + }; } class SW_DLLPUBLIC SwDrawFrameFormat: public SwFrameFormat diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index f628efd2733f..fad1edbe5a10 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -478,40 +478,13 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) return bCallBase; } -ZSortFly::ZSortFly( const SwFrameFormat* pFrameFormat, const SwFormatAnchor* pFlyAn, - sal_uInt32 nArrOrdNum ) - : pFormat( pFrameFormat ), pAnchor( pFlyAn ), nOrdNum( nArrOrdNum ) +ZSortFly::ZSortFly(const SwFrameFormat* pFrameFormat, const SwFormatAnchor* pFlyAn, sal_uInt32 nArrOrdNum) + : pFormat(pFrameFormat) + , pAnchor(pFlyAn) + , nOrdNum(nArrOrdNum) { - // #i11176# - // This also needs to work when no layout exists. Thus, for - // FlyFrames an alternative method is used now in that case. - if( RES_FLYFRMFMT == pFormat->Which() ) - { - if( pFormat->getIDocumentLayoutAccess().GetCurrentViewShell() ) - { - // See if there is an SdrObject for it - SwFlyFrame* pFly = SwIterator<SwFlyFrame,SwFormat>( *pFrameFormat ).First(); - if( pFly ) - nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum(); - } - else - { - // See if there is an SdrObject for it - SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFormat>( *pFrameFormat ).First(); - if( pContact ) - nOrdNum = pContact->GetMaster()->GetOrdNum(); - } - } - else if( RES_DRAWFRMFMT == pFormat->Which() ) - { - // See if there is an SdrObject for it - SwDrawContact* pContact = SwIterator<SwDrawContact,SwFormat>( *pFrameFormat ).First(); - if( pContact ) - nOrdNum = pContact->GetMaster()->GetOrdNum(); - } - else { - OSL_ENSURE( false, "what kind of format is this?" ); - } + SAL_WARN_IF(pFormat->Which() != RES_FLYFRMFMT && pFormat->Which() != RES_DRAWFRMFMT, "sw.core", "What kind of format is this?"); + pFormat->CallSwClientNotify(sw::GetZOrderHint(nOrdNum)); } /// In the Outliner, set a link to the method for field display in edit objects. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index fcc98d3aa246..dab09e890ec7 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -578,6 +578,19 @@ void SwFlyDrawContact::GetAnchoredObjs( std::list<SwAnchoredObject*>& _roAnchore const SwFrameFormat* pFormat = GetFormat(); SwFlyFrame::GetAnchoredObjects( _roAnchoredObjs, *pFormat ); } +void SwFlyDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) +{ + SwContact::SwClientNotify(rMod, rHint); + if(auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint)) + { + // #i11176# + // This also needs to work when no layout exists. Thus, for + // FlyFrames an alternative method is used now in that case. + auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod)); + if(pFormat->Which() == RES_FLYFRMFMT && !pFormat->getIDocumentLayoutAccess().GetCurrentViewShell()) + pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum(); + } +} // SwDrawContact @@ -1590,6 +1603,12 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj); } } + else if (auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint)) + { + auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod)); + if(pFormat->Which() == RES_DRAWFRMFMT) + pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum(); + } } // #i26791# diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 808b14a04842..12a3ec80b8ba 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -141,6 +141,7 @@ protected: virtual const 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/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index fe18ee452214..8df92d3b6486 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -3324,6 +3324,7 @@ namespace sw CreatePortionHint::~CreatePortionHint() {} FindSdrObjectHint::~FindSdrObjectHint() {} CollectTextObjectsHint::~CollectTextObjectsHint() {} + GetZOrderHint::~GetZOrderHint() {} } SwDrawFrameFormat::~SwDrawFrameFormat() diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 30d693044c78..651dbcc409ae 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -673,6 +673,20 @@ bool SwFlyFrame::FrameSizeChg( const SwFormatFrameSize &rFrameSize ) return bRet; } +void SwFlyFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) +{ + if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint)) + { + Modify(pLegacyHint->m_pOld, pLegacyHint->m_pNew); + } + else if(auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint)) + { + auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod)); + if(pFormat->Which() == RES_FLYFRMFMT && pFormat->getIDocumentLayoutAccess().GetCurrentViewShell()) // #i11176# + pGetZOrdnerHint->m_rnZOrder = GetVirtDrawObj()->GetOrdNum(); + } +}; + void SwFlyFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew ) { sal_uInt8 nInvFlags = 0; |