diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-09-27 19:26:09 +0900 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-09-27 17:09:47 +0200 |
commit | 0745016139072bfb8dceec840736f64f927deefd (patch) | |
tree | e447e8ec52f5097474e53a4843f703ee2787becf /svx/source/dialog/svxruler.cxx | |
parent | 1880373663888bfefcb9beb48f71ac14a9da2f34 (diff) |
svx: Simplify SvxRuler_Impl's ctor&dtor with std::unique_ptr
Change-Id: I1d663adebaf9c95e12543ab8c2f22e8094632b99
Reviewed-on: https://gerrit.libreoffice.org/42850
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'svx/source/dialog/svxruler.cxx')
-rw-r--r-- | svx/source/dialog/svxruler.cxx | 17 |
1 files changed, 5 insertions, 12 deletions
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(); } |