summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2017-04-23 03:21:19 +0200
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2017-04-25 00:44:51 +0200
commit6bf8d7bb5df3a29b6540e0ff057c667dad61d907 (patch)
tree9f0b37a71fbcfddd8335c25e07a49c82b8857b4d /sw
parent3190f83bf11560c4908a6b3ea3e82a8354648523 (diff)
use a unique_ptr to track the SwFlyDrawContact
Change-Id: I1b9058b41d1708efa4069e737c2247c6600403f5 Reviewed-on: https://gerrit.libreoffice.org/36897 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/layout/atrfrm.cxx23
2 files changed, 13 insertions, 19 deletions
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index c0da19b899a6..caad71fc14cd 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -186,18 +186,13 @@ class SW_DLLPUBLIC SwFlyFrameFormat: public SwFrameFormat
so it can be used to move frames of non-resizable objects to align them correctly
when they get borders (this is done in SwWrtShell::CalcAndGetScale) */
Point m_aLastFlyFramePrtRectPos;
- SwFlyDrawContact* m_pContact;
+ std::unique_ptr<SwFlyDrawContact> m_pContact;
SwFlyFrameFormat( const SwFlyFrameFormat &rCpy ) = delete;
SwFlyFrameFormat &operator=( const SwFlyFrameFormat &rCpy ) = delete;
protected:
- SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm,
- SwFrameFormat *pDrvdFrame )
- : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FLYFRMFMT )
- , m_pContact(nullptr)
- {}
-
+ SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, SwFrameFormat *pDrvdFrame );
public:
virtual ~SwFlyFrameFormat() override;
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index c000dc0c8ea8..e8ae3f185a9d 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -78,6 +78,7 @@
#include <calbck.hxx>
#include <pagedeschint.hxx>
#include <drawdoc.hxx>
+#include <dcontact.hxx>
#ifndef NDEBUG
#include <ndtxt.hxx>
@@ -2835,6 +2836,13 @@ void SwFrameFormats::dumpAsXml(xmlTextWriterPtr pWriter, const char* pName) cons
IMPL_FIXEDMEMPOOL_NEWDEL( SwFlyFrameFormat )
+
+
+SwFlyFrameFormat::SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, SwFrameFormat *pDrvdFrame )
+ : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FLYFRMFMT )
+ , m_pContact(nullptr)
+{}
+
SwFlyFrameFormat::~SwFlyFrameFormat()
{
SwIterator<SwFlyFrame,SwFormat> aIter( *this );
@@ -2852,23 +2860,14 @@ SwFlyFrameFormat::~SwFlyFrameFormat()
SwFlyDrawContact* SwFlyFrameFormat::GetOrCreateContact()
{
IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess();
-#ifdef DBG_UTIL
- SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFormat>( *this ).First();
- assert(pContact == m_pContact);
-#endif
if(!m_pContact)
- m_pContact = new SwFlyDrawContact(this, rIDDMA.GetOrCreateDrawModel());
- return m_pContact;
+ m_pContact.reset(new SwFlyDrawContact(this, rIDDMA.GetOrCreateDrawModel()));
+ return m_pContact.get();
}
void SwFlyFrameFormat::ClearContact()
{
-#ifdef DBG_UTIL
- SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFormat>( *this ).First();
- assert(pContact == m_pContact);
-#endif
- delete m_pContact;
- m_pContact = nullptr;
+ m_pContact.reset(nullptr);
};
/// Creates the Frames if the format describes a paragraph-bound frame.