summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2017-02-06 18:27:47 +0100
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2017-02-09 20:23:02 +0000
commit1bc10ebd32513e5a497f229d9e76e4509a6a366f (patch)
tree92e1794a3f328af7053a2b83ef844e0f0329822b /sw/source
parentdca6eefc211cc36b5e3ba7157d45e12ee6b9f5f8 (diff)
use proper message passing
Change-Id: Ic41c7acc73c2d275dfdb6b2ffcbb24fba5f8be72 Reviewed-on: https://gerrit.libreoffice.org/33980 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/draw/dcontact.cxx4
-rw-r--r--sw/source/core/inc/frame.hxx3
-rw-r--r--sw/source/core/layout/atrfrm.cxx1
-rw-r--r--sw/source/core/layout/fly.cxx58
-rw-r--r--sw/source/core/layout/pagechg.cxx2
-rw-r--r--sw/source/core/layout/sectfrm.cxx2
-rw-r--r--sw/source/core/layout/wsfrm.cxx10
7 files changed, 42 insertions, 38 deletions
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 266adadcdd82..66abcfc49dac 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -590,6 +590,10 @@ void SwFlyDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint
if (pFormat && pFormat->Which() == RES_FLYFRMFMT && !pFormat->getIDocumentLayoutAccess().GetCurrentViewShell())
pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum();
}
+ else if (auto pKillDrawHint = dynamic_cast<const sw::KillDrawHint*>(&rHint))
+ {
+ pKillDrawHint->m_rpContact = this;
+ }
else if (auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
{
switch(pDrawFrameFormatHint->m_eId)
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index f2aa34c4edfe..47c7835d8738 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -321,7 +321,8 @@ protected:
// draw shadow and borders
void PaintShadow( const SwRect&, SwRect&, const SwBorderAttrs& ) const;
- virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
+ virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
+ virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) override;
virtual const IDocumentDrawModelAccess& getIDocumentDrawModelAccess( );
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 7cd673487961..1b420b73d0ba 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -3317,6 +3317,7 @@ namespace sw
CollectTextObjectsHint::~CollectTextObjectsHint() {}
GetZOrderHint::~GetZOrderHint() {}
GetObjectConnectedHint::~GetObjectConnectedHint() {}
+ KillDrawHint::~KillDrawHint() {}
}
SwDrawFrameFormat::~SwDrawFrameFormat()
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index be4c7e593a38..55f1ac2d5c8d 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -420,55 +420,46 @@ void SwFlyFrame::InitDrawObj()
void SwFlyFrame::FinitDrawObj()
{
- if ( !GetVirtDrawObj() )
+ if(!GetVirtDrawObj() )
return;
-
+ SwFormat* pFormat = GetFormat();
// Deregister from SdrPageViews if the Objects is still selected there.
- if ( !GetFormat()->GetDoc()->IsInDtor() )
+ if(!pFormat->GetDoc()->IsInDtor())
{
- SwViewShell *p1St = getRootFrame()->GetCurrShell();
- if ( p1St )
+ SwViewShell* p1St = getRootFrame()->GetCurrShell();
+ if(p1St)
{
for(SwViewShell& rCurrentShell : p1St->GetRingContainer())
{ // At the moment the Drawing can do just do an Unmark on everything,
// as the Object was already removed
- if( rCurrentShell.HasDrawView() )
+ if(rCurrentShell.HasDrawView() )
rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
}
}
}
+ if(!pFormat)
+ {
+ GetVirtDrawObj()->SetUserCall(nullptr);
+ delete GetVirtDrawObj();
+ return;
+ }
+ bool bOtherFramesAround(false);
+ SwFlyDrawContact* pContact(nullptr);
+ pFormat->CallSwClientNotify(sw::KillDrawHint(this, bOtherFramesAround, pContact));
// Take VirtObject to the grave.
// If the last VirtObject is destroyed, the DrawObject and the DrawContact
// also need to be destroyed.
- SwFlyDrawContact *pMyContact = nullptr;
- if ( GetFormat() )
- {
- bool bContinue = true;
- SwIterator<SwFrame,SwFormat> aFrameIter( *GetFormat() );
- for ( SwFrame* pFrame = aFrameIter.First(); pFrame; pFrame = aFrameIter.Next() )
- if ( pFrame != this )
- {
- // don't delete Contact if there is still a Frame
- bContinue = false;
- break;
- }
-
- if ( bContinue )
- // no Frame left, find Contact object to destroy
- pMyContact = SwIterator<SwFlyDrawContact,SwFormat>( *GetFormat() ).First();
- }
-
// OD, OS 2004-03-31 #116203# - clear user call of Writer fly frame 'master'
// <SdrObject> to assure, that a <SwXFrame::dispose()> doesn't delete the
// Writer fly frame again.
- if ( pMyContact )
- {
- pMyContact->GetMaster()->SetUserCall( nullptr );
- }
- GetVirtDrawObj()->SetUserCall( nullptr ); // Else calls delete of the ContactObj
+ if(bOtherFramesAround)
+ pContact = nullptr;
+ if(pContact)
+ pContact->GetMaster()->SetUserCall(nullptr);
+ GetVirtDrawObj()->SetUserCall(nullptr); // Else calls delete of the ContactObj
delete GetVirtDrawObj(); // Deregisters itself at the Master
- delete pMyContact; // Destroys the Master itself
+ delete pContact; // Destroys the Master itself
}
void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow )
@@ -675,11 +666,8 @@ bool SwFlyFrame::FrameSizeChg( const SwFormatFrameSize &rFrameSize )
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))
+ SwFrame::SwClientNotify(rMod, rHint);
+ 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#
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 6ced59ba0fa3..12e286880810 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -533,7 +533,7 @@ void SwPageFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
static_cast<SwRootFrame*>(GetUpper())->RemoveFootnotes(nullptr, false, true);
}
else
- SwClient::SwClientNotify(rModify, rHint);
+ SwFrame::SwClientNotify(rModify, rHint);
}
void SwPageFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index db1e0e9bcd6f..0662ee6c0664 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2294,7 +2294,7 @@ void SwSectionFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
void SwSectionFrame::SwClientNotify( const SwModify& rMod, const SfxHint& rHint )
{
- SwClient::SwClientNotify(rMod, rHint);
+ SwFrame::SwClientNotify(rMod, rHint);
// #i117863#
const SwSectionFrameMoveAndDeleteHint* pHint =
dynamic_cast<const SwSectionFrameMoveAndDeleteHint*>(&rHint);
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 0ae2350a2028..050c00e6f878 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -218,6 +218,16 @@ void SwTextFrame::CheckDirection( bool bVert )
true, bBrowseMode );
}
+void SwFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
+{
+ SwClient::SwClientNotify(rMod, rHint);
+ if (auto pKillDrawHint = dynamic_cast<const sw::KillDrawHint*>(&rHint))
+ {
+ if(this != pKillDrawHint->m_pKillingFrame)
+ pKillDrawHint->m_rbOtherFramesAround = true;
+ }
+}
+
void SwFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
{
sal_uInt8 nInvFlags = 0;