svx/source/dialog/svxruler.cxx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
New commits: commit 0745016139072bfb8dceec840736f64f927deefd Author: Takeshi Abe <t...@fixedpoint.jp> Date: Wed Sep 27 19:26:09 2017 +0900 svx: Simplify SvxRuler_Impl's ctor&dtor with std::unique_ptr Change-Id: I1d663adebaf9c95e12543ab8c2f22e8094632b99 Reviewed-on: https://gerrit.libreoffice.org/42850 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 01b6a2370323..0cded751496f 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -129,7 +129,7 @@ struct SvxRuler_Impl { long lLastLMargin; long lLastRMargin; SvxProtectItem aProtectItem; - SfxBoolItem* pTextRTLItem; + std::unique_ptr<SfxBoolItem> pTextRTLItem; sal_uInt16 nControlerItems; sal_uInt16 nIdx; sal_uInt16 nColLeftPix; @@ -143,22 +143,16 @@ struct SvxRuler_Impl { // false means relative to SvxRuler::GetLeftFrameMargin() SvxRuler_Impl() : - pPercBuf(nullptr), pBlockBuf(nullptr), nPercSize(0), nTotalDist(0), + nPercSize(0), nTotalDist(0), lOldWinPos(0), lMaxLeftLogic(0), lMaxRightLogic(0), lLastLMargin(0), lLastRMargin(0), aProtectItem(SID_RULER_PROTECT), - pTextRTLItem(nullptr), nControlerItems(0), nIdx(0), + nControlerItems(0), nIdx(0), nColLeftPix(0), nColRightPix(0), bIsTableRows(false), bIsTabsRelativeToIndent(true) { } - ~SvxRuler_Impl() - { - nPercSize = 0; nTotalDist = 0; - pPercBuf = nullptr; - delete pTextRTLItem; - } void SetPercSize(sal_uInt16 nSize); }; @@ -754,10 +748,9 @@ void SvxRuler::UpdateTextRTL(const SfxBoolItem* pItem) { if(bActive && bHorz) { - delete mxRulerImpl->pTextRTLItem; - mxRulerImpl->pTextRTLItem = nullptr; + mxRulerImpl->pTextRTLItem.reset(); if(pItem) - mxRulerImpl->pTextRTLItem = new SfxBoolItem(*pItem); + mxRulerImpl->pTextRTLItem.reset(new SfxBoolItem(*pItem)); SetTextRTL(mxRulerImpl->pTextRTLItem && mxRulerImpl->pTextRTLItem->GetValue()); StartListening_Impl(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits