[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Mar 5 06:32:46 UTC 2018
lotuswordpro/source/filter/lwpfribsection.cxx | 9 +---
lotuswordpro/source/filter/lwpfribsection.hxx | 2 -
lotuswordpro/source/filter/lwpparaborderoverride.cxx | 36 ++++++-------------
lotuswordpro/source/filter/lwpparaborderoverride.hxx | 14 +++----
4 files changed, 22 insertions(+), 39 deletions(-)
New commits:
commit 9a3e2ce7e0fc87d3ef3e05144460540e3b0d0075
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Mar 1 10:47:48 2018 +0200
loplugin:useuniqueptr in LwpParaBorderOverride
Change-Id: I2c561fe5cebd03f1cd49f5a1ec3451200ad99670
Reviewed-on: https://gerrit.libreoffice.org/50736
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/lotuswordpro/source/filter/lwpparaborderoverride.cxx b/lotuswordpro/source/filter/lwpparaborderoverride.cxx
index 2b1e15f1f0f3..7f886da12c12 100644
--- a/lotuswordpro/source/filter/lwpparaborderoverride.cxx
+++ b/lotuswordpro/source/filter/lwpparaborderoverride.cxx
@@ -67,10 +67,10 @@
LwpParaBorderOverride::LwpParaBorderOverride()
{
- m_pBorderStuff = new LwpBorderStuff();
- m_pBetweenStuff = new LwpBorderStuff();
- m_pShadow = new LwpShadow();
- m_pMargins = new LwpMargins();
+ m_pBorderStuff.reset( new LwpBorderStuff() );
+ m_pBetweenStuff.reset( new LwpBorderStuff() );
+ m_pShadow.reset( new LwpShadow() );
+ m_pMargins.reset( new LwpMargins() );
m_eAboveType = PB_NONE;
m_eBelowType = PB_NONE;
@@ -87,10 +87,6 @@ LwpParaBorderOverride::LwpParaBorderOverride()
LwpParaBorderOverride::LwpParaBorderOverride(LwpParaBorderOverride const& rOther)
: LwpOverride(rOther)
- , m_pBorderStuff(nullptr)
- , m_pBetweenStuff(nullptr)
- , m_pShadow(nullptr)
- , m_pMargins(nullptr)
, m_eAboveType(rOther.m_eAboveType)
, m_eBelowType(rOther.m_eBelowType)
, m_eRightType(rOther.m_eRightType)
@@ -101,22 +97,14 @@ LwpParaBorderOverride::LwpParaBorderOverride(LwpParaBorderOverride const& rOther
, m_nRightWidth(rOther.m_nRightWidth)
, m_nBetweenMargin(rOther.m_nBetweenMargin)
{
- std::unique_ptr<LwpBorderStuff> pBorderStuff(::clone(rOther.m_pBorderStuff));
- std::unique_ptr<LwpBorderStuff> pBetweenStuff(::clone(rOther.m_pBetweenStuff));
- std::unique_ptr<LwpShadow> pShadow(::clone(rOther.m_pShadow));
- std::unique_ptr<LwpMargins> pMargins(::clone(rOther.m_pMargins));
- m_pBorderStuff = pBorderStuff.release();
- m_pBetweenStuff = pBetweenStuff.release();
- m_pShadow = pShadow.release();
- m_pMargins = pMargins.release();
+ m_pBorderStuff.reset( ::clone(rOther.m_pBorderStuff.get()) );
+ m_pBetweenStuff.reset( ::clone(rOther.m_pBetweenStuff.get()) );
+ m_pShadow.reset( ::clone(rOther.m_pShadow.get()) );
+ m_pMargins.reset( ::clone(rOther.m_pMargins.get()) );
}
LwpParaBorderOverride::~LwpParaBorderOverride()
{
- delete m_pBorderStuff;
- delete m_pBetweenStuff;
- delete m_pShadow;
- delete m_pMargins;
}
LwpParaBorderOverride* LwpParaBorderOverride::clone() const
@@ -178,7 +166,7 @@ void LwpParaBorderOverride::Override(LwpParaBorderOverride* pOther)
{
if (IsBorderStuffOverridden())
{
- pOther->OverrideBorderStuff(m_pBorderStuff);
+ pOther->OverrideBorderStuff(m_pBorderStuff.get());
}
else
{
@@ -190,7 +178,7 @@ void LwpParaBorderOverride::Override(LwpParaBorderOverride* pOther)
{
if (IsBetweenStuffOverridden())
{
- pOther->OverrideBetweenStuff(m_pBetweenStuff);
+ pOther->OverrideBetweenStuff(m_pBetweenStuff.get());
}
else
{
@@ -202,7 +190,7 @@ void LwpParaBorderOverride::Override(LwpParaBorderOverride* pOther)
{
if (IsShadowOverridden())
{
- pOther->OverrideShadow(m_pShadow);
+ pOther->OverrideShadow(m_pShadow.get());
}
else
{
@@ -214,7 +202,7 @@ void LwpParaBorderOverride::Override(LwpParaBorderOverride* pOther)
{
if (IsMarginsOverridden())
{
- pOther->OverrideMargins(m_pMargins);
+ pOther->OverrideMargins(m_pMargins.get());
}
else
{
diff --git a/lotuswordpro/source/filter/lwpparaborderoverride.hxx b/lotuswordpro/source/filter/lwpparaborderoverride.hxx
index 5ad9f9745660..7102eae35513 100644
--- a/lotuswordpro/source/filter/lwpparaborderoverride.hxx
+++ b/lotuswordpro/source/filter/lwpparaborderoverride.hxx
@@ -83,9 +83,9 @@ public:
};
virtual void Read(LwpObjectStream *pStrm) override;
- LwpShadow* GetShadow(){ return m_pShadow; }
- LwpBorderStuff* GetBorderStuff(){ return m_pBorderStuff; }
- LwpMargins* GetMargins() { return m_pMargins; };
+ LwpShadow* GetShadow(){ return m_pShadow.get(); }
+ LwpBorderStuff* GetBorderStuff(){ return m_pBorderStuff.get(); }
+ LwpMargins* GetMargins() { return m_pMargins.get(); };
void Override(LwpParaBorderOverride* pOther);
@@ -154,10 +154,10 @@ private:
PBO_RIGHT = 0x1000
};
- LwpBorderStuff *m_pBorderStuff;
- LwpBorderStuff *m_pBetweenStuff;
- LwpShadow *m_pShadow;
- LwpMargins *m_pMargins;
+ std::unique_ptr<LwpBorderStuff> m_pBorderStuff;
+ std::unique_ptr<LwpBorderStuff> m_pBetweenStuff;
+ std::unique_ptr<LwpShadow> m_pShadow;
+ std::unique_ptr<LwpMargins> m_pMargins;
BorderWidthType m_eAboveType;
BorderWidthType m_eBelowType;
commit c801400c476edf719a05a98f96c0559837023dbc
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Mar 1 10:43:03 2018 +0200
loplugin:useuniqueptr in LwpFribSection
Change-Id: I128a2ef532a72b47cd2bedd1ee80f47d892cc527
Reviewed-on: https://gerrit.libreoffice.org/50727
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index 5d0211adf7ff..153e5cf373ee 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -70,18 +70,13 @@
#include <lwpglobalmgr.hxx>
LwpFribSection::LwpFribSection(LwpPara *pPara)
- : LwpFrib(pPara),m_pMasterPage(nullptr)
+ : LwpFrib(pPara)
{
}
LwpFribSection::~LwpFribSection()
{
- if(m_pMasterPage)
- {
- delete m_pMasterPage;
- m_pMasterPage = nullptr;
- }
}
/**
@@ -111,7 +106,7 @@ void LwpFribSection::RegisterSectionStyle()
LwpPageLayout* pLayout = GetPageLayout();
if(pLayout)
{
- m_pMasterPage = new LwpMasterPage(m_pPara, pLayout);
+ m_pMasterPage.reset( new LwpMasterPage(m_pPara, pLayout) );
m_pMasterPage->RegisterMasterPage(this);
}
}
diff --git a/lotuswordpro/source/filter/lwpfribsection.hxx b/lotuswordpro/source/filter/lwpfribsection.hxx
index ce4ac2531e88..58e8c91a3e5f 100644
--- a/lotuswordpro/source/filter/lwpfribsection.hxx
+++ b/lotuswordpro/source/filter/lwpfribsection.hxx
@@ -118,7 +118,7 @@ private:
private:
LwpObjectID m_Section;
- LwpMasterPage* m_pMasterPage;
+ std::unique_ptr<LwpMasterPage> m_pMasterPage;
};
#endif
More information about the Libreoffice-commits
mailing list