summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2017-04-23 14:56:49 +0200
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2017-04-26 09:48:08 +0200
commit2c8a9d8a6e0933bb717d800e6ddfb2b0c6db1f96 (patch)
treee5d4bdd42b0673eea7838d142dc4b5324d6f3301 /sw
parent8a23c68f58307b7cf2842cd4ce5a9eb93f8b244c (diff)
remove this whole "kill SwFlyDrawContact with last frame" nonsense
- first of all, SwFlyDrawContact is part of the document state/model, not the layout. - SwWW8ImplReader::CreateContactObject() and SwXFrame::GetOrCreateSdrObject() seem to agree as they create SwFlyDrawContacts without caring for frames using them being around. This was inherently fragile as FinitDrawObj would mercilessly kill the SwFlyDrawContact in that case (and thus also modify document state). - SwFlyDrawContact is now entirely owned by SwFlyFrameFormat. Change-Id: I70b716fef63279552b39a18ac143024a460ba785 Reviewed-on: https://gerrit.libreoffice.org/36899 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/frmfmt.hxx9
-rw-r--r--sw/source/core/draw/dcontact.cxx4
-rw-r--r--sw/source/core/inc/frame.hxx1
-rw-r--r--sw/source/core/layout/atrfrm.cxx7
-rw-r--r--sw/source/core/layout/fly.cxx18
-rw-r--r--sw/source/core/layout/wsfrm.cxx10
6 files changed, 0 insertions, 49 deletions
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 6fec965473b1..2dd3c81a52f8 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -244,7 +244,6 @@ public:
DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrameFormat)
SwFlyDrawContact* GetOrCreateContact();
- void ClearContact();
};
//The DrawFrame-Format
@@ -345,14 +344,6 @@ namespace sw
GetObjectConnectedHint(bool& risConnected, const SwRootFrame* pRoot) : m_risConnected(risConnected), m_pRoot(pRoot) {};
virtual ~GetObjectConnectedHint() override;
};
- struct SW_DLLPUBLIC KillDrawHint final : SfxHint
- {
- const SwFrame* m_pKillingFrame;
- bool& m_rbOtherFramesAround;
- SwFlyDrawContact*& m_rpContact;
- KillDrawHint(const SwFrame* pKillingFrame, bool& rbOtherFramesAround, SwFlyDrawContact*& rpContact) : m_pKillingFrame(pKillingFrame), m_rbOtherFramesAround(rbOtherFramesAround), m_rpContact(rpContact) {};
- virtual ~KillDrawHint() override;
- };
}
class SW_DLLPUBLIC SwDrawFrameFormat: public SwFrameFormat
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 6e81be59c157..b989c1fad694 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -650,10 +650,6 @@ 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;
- }
}
// SwDrawContact
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 22a1e6f5375d..a3bb649b2aa2 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -322,7 +322,6 @@ protected:
// draw shadow and borders
void PaintShadow( const SwRect&, SwRect&, const SwBorderAttrs& ) const;
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 0a239eb1e3d0..7661a0511948 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2853,7 +2853,6 @@ SwFlyFrameFormat::~SwFlyFrameFormat()
SwFrame::DestroyFrame(pLast);
} while( nullptr != ( pLast = aIter.Next() ));
- ClearContact();
}
SwFlyDrawContact* SwFlyFrameFormat::GetOrCreateContact()
@@ -2864,11 +2863,6 @@ SwFlyDrawContact* SwFlyFrameFormat::GetOrCreateContact()
return m_pContact.get();
}
-void SwFlyFrameFormat::ClearContact()
-{
- m_pContact.reset(nullptr);
-};
-
/// Creates the Frames if the format describes a paragraph-bound frame.
/// MA: 1994-02-14: creates the Frames also for frames anchored at page.
void SwFlyFrameFormat::MakeFrames()
@@ -3305,7 +3299,6 @@ 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 e2bf037f10af..ab0ded01fb32 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -365,26 +365,8 @@ void SwFlyFrame::FinitDrawObj()
}
}
}
-
- 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.
- // 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(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
- assert(dynamic_cast<SwFlyFrameFormat*>(pFormat));
- if(pContact)
- static_cast<SwFlyFrameFormat*>(pFormat)->ClearContact();
}
void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 6cf82e5fa852..a8ef49dfd3de 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -218,16 +218,6 @@ 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;