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>
This commit is contained in:
committed by
Björn Michaelsen
parent
e4a84c625f
commit
2f01d2a42a
@@ -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:
|
||||
|
@@ -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
|
||||
|
@@ -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.
|
||||
|
@@ -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#
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -3324,6 +3324,7 @@ namespace sw
|
||||
CreatePortionHint::~CreatePortionHint() {}
|
||||
FindSdrObjectHint::~FindSdrObjectHint() {}
|
||||
CollectTextObjectsHint::~CollectTextObjectsHint() {}
|
||||
GetZOrderHint::~GetZOrderHint() {}
|
||||
}
|
||||
|
||||
SwDrawFrameFormat::~SwDrawFrameFormat()
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user