editeng/source/editeng/editobj.cxx  |   51 +++++++++++++++++-------------------
 editeng/source/editeng/editundo.cxx |   29 ++++++++++----------
 editeng/source/items/flditem.cxx    |    2 -
 editeng/source/items/frmitems.cxx   |   28 +++++++++----------
 editeng/source/items/numitem.cxx    |    4 +-
 editeng/source/items/paraitem.cxx   |   11 ++++---
 6 files changed, 62 insertions(+), 63 deletions(-)

New commits:
commit 98cc91efd7862d39b3c33b85b744721bec935938
Author:     Jochen Nitschke <j.nitschke+loger...@ok.de>
AuthorDate: Mon Oct 8 21:16:07 2018 +0200
Commit:     Jochen Nitschke <j.nitschke+loger...@ok.de>
CommitDate: Tue Oct 9 08:23:34 2018 +0200

    cppcheck: useInitializationList in editeng ...
    
    and remove some indirections
    
    Change-Id: I94088030084683c1a24f904da1c42a01f24f47ce
    Reviewed-on: https://gerrit.libreoffice.org/61561
    Tested-by: Jenkins
    Reviewed-by: Jochen Nitschke <j.nitschke+loger...@ok.de>

diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 78f3364ac350..7ff6af5bead3 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -67,10 +67,10 @@ static std::unique_ptr<XEditAttribute> MakeXEditAttribute( 
SfxItemPool& rPool, c
 }
 
 XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr, sal_Int32 nS, 
sal_Int32 nE )
+    : pItem(&rAttr)
+    , nStart(nS)
+    , nEnd(nE)
 {
-    pItem = &rAttr;
-    nStart = nS;
-    nEnd = nE;
 }
 
 XEditAttribute::~XEditAttribute()
@@ -90,12 +90,14 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-    OutputDevice* pRefDev, sal_uLong nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY) :
-    aRefMapMode(pRefDev->GetMapMode()), nStretchX(_nStretchX), 
nStretchY(_nStretchY)
+    OutputDevice* pRefDev, sal_uLong nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+    : nRefDevPtr(pRefDev)
+    , eRefDevType(pRefDev->GetOutDevType())
+    , aRefMapMode(pRefDev->GetMapMode())
+    , nStretchX(_nStretchX)
+    , nStretchY(_nStretchY)
+    , nPaperWidth(nPW)
 {
-    nRefDevPtr = pRefDev;
-    nPaperWidth = nPW;
-    eRefDevType = pRefDev->GetOutDevType();
 }
 
 void XParaPortionList::push_back(XParaPortion* p)
@@ -495,13 +497,14 @@ static EditEngineItemPool* 
getEditEngineItemPool(SfxItemPool* pPool)
     return pRetval;
 }
 
-EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, SfxItemPool* 
pP ) :
-    mpFront(pFront)
+EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, SfxItemPool* 
pP )
+    : mpFront(pFront)
+    , nMetric(0xFFFF)
+    , nUserType(OutlinerMode::DontKnow)
+    , nScriptType(SvtScriptType::NONE)
+    , bVertical(false)
+    , bIsTopToBottomVert(false)
 {
-    nMetric = 0xFFFF;
-    nUserType = OutlinerMode::DontKnow;
-    pPortionInfo = nullptr;
-
     // #i101239# ensure target is a EditEngineItemPool, else
     // fallback to pool ownership. This is needed to ensure that at
     // pool destruction time of an alien pool, the pool is still alive.
@@ -525,21 +528,17 @@ EditTextObjectImpl::EditTextObjectImpl( EditTextObject* 
pFront, SfxItemPool* pP
         // it is sure now that the pool is an EditEngineItemPool
         pPool->AddSfxItemPoolUser(*mpFront);
     }
-
-    bVertical = false;
-    bIsTopToBottomVert = false;
-    nScriptType = SvtScriptType::NONE;
 }
 
-EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, const 
EditTextObjectImpl& r ) :
-    mpFront(pFront)
+EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, const 
EditTextObjectImpl& r )
+    : mpFront(pFront)
+    , nMetric(r.nMetric)
+    , nUserType(r.nUserType)
+    , nScriptType(r.nScriptType)
+    , bVertical(r.bVertical)
+    , bIsTopToBottomVert(r.bIsTopToBottomVert)
 {
-    nMetric = r.nMetric;
-    nUserType = r.nUserType;
-    bVertical = r.bVertical;
-    bIsTopToBottomVert = r.bIsTopToBottomVert;
-    nScriptType = r.nScriptType;
-    pPortionInfo = nullptr;    // Do not copy PortionInfo
+    // Do not copy PortionInfo
 
     if ( !r.bOwnerOfPool )
     {
diff --git a/editeng/source/editeng/editundo.cxx 
b/editeng/source/editeng/editundo.cxx
index af97ad0cc6f0..95d6db4c85b3 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -213,15 +213,14 @@ EditUndoConnectParas::EditUndoConnectParas(
     const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
     const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, bool 
bBkwrd) :
     EditUndo(EDITUNDO_CONNECTPARAS, pEE),
+    nNode(nN),
+    nSepPos(nSP),
     aLeftParaAttribs(rLeftParaAttribs),
     aRightParaAttribs(rRightParaAttribs),
     eLeftStyleFamily(SfxStyleFamily::All),
     eRightStyleFamily(SfxStyleFamily::All),
     bBackward(bBkwrd)
 {
-    nNode   = nN;
-    nSepPos = nSP;
-
     if ( pLeftStyle )
     {
         aLeftStyleName = pLeftStyle->GetName();
@@ -370,9 +369,10 @@ void EditUndoRemoveChars::Redo()
 
 EditUndoInsertFeature::EditUndoInsertFeature(
     EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature) :
-    EditUndo(EDITUNDO_INSERTFEATURE, pEE), aEPaM(rEPaM)
+    EditUndo(EDITUNDO_INSERTFEATURE, pEE),
+    aEPaM(rEPaM),
+    pFeature(rFeature.Clone())
 {
-    pFeature.reset( rFeature.Clone() );
     DBG_ASSERT( pFeature, "Feature could not be duplicated: 
EditUndoInsertFeature" );
 }
 
@@ -444,13 +444,13 @@ EditUndoSetStyleSheet::EditUndoSetStyleSheet(
     EditEngine* pEE, sal_Int32 nP, const OUString& rPrevName, SfxStyleFamily 
ePrevFam,
     const OUString& rNewName, SfxStyleFamily eNewFam, const SfxItemSet& 
rPrevParaAttribs) :
     EditUndo(EDITUNDO_STYLESHEET, pEE),
+    nPara(nP),
     aPrevName(rPrevName),
     aNewName(rNewName),
+    ePrevFamily(ePrevFam),
+    eNewFamily(eNewFam),
     aPrevParaAttribs(rPrevParaAttribs)
 {
-    ePrevFamily = ePrevFam;
-    eNewFamily = eNewFam;
-    nPara = nP;
 }
 
 EditUndoSetStyleSheet::~EditUndoSetStyleSheet()
@@ -497,15 +497,16 @@ void EditUndoSetParaAttribs::Redo()
 
 EditUndoSetAttribs::EditUndoSetAttribs(EditEngine* pEE, const ESelection& 
rESel, const SfxItemSet& rNewItems) :
     EditUndo(EDITUNDO_ATTRIBS, pEE),
-    aESel(rESel), aNewAttribs(rNewItems)
-{
+    aESel(rESel),
+    aNewAttribs(rNewItems),
+    nSpecial(SetAttribsMode::NONE),
     // When EditUndoSetAttribs actually is a RemoveAttribs this could be
     // recognize by the empty itemset, but then it would have to be caught in
     // its own place, which possible a setAttribs does with an empty itemset.
-    bSetIsRemove = false;
-    bRemoveParaAttribs = false;
-    nRemoveWhich = 0;
-    nSpecial = SetAttribsMode::NONE;
+    bSetIsRemove(false),
+    bRemoveParaAttribs(false),
+    nRemoveWhich(0)
+{
 }
 
 namespace {
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 09100d98f021..ca06b8af1532 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -289,7 +289,7 @@ SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, 
const sal_uInt16 nId ) :
 
 SvxFieldItem::SvxFieldItem( const SvxFieldItem& rItem ) :
     SfxPoolItem ( rItem )
-    , mpField( rItem.GetField() ? rItem.GetField()->Clone() : nullptr )
+    , mpField( rItem.mpField ? rItem.mpField->Clone() : nullptr )
 {
 }
 
diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index d34b797bc7a2..ba9791f31a52 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -1344,17 +1344,16 @@ void SvxShadowItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) :
 
     SfxPoolItem ( rCpy ),
+    pTop        ( rCpy.pTop     ? new SvxBorderLine( *rCpy.pTop )    : nullptr 
),
+    pBottom     ( rCpy.pBottom  ? new SvxBorderLine( *rCpy.pBottom ) : nullptr 
),
+    pLeft       ( rCpy.pLeft    ? new SvxBorderLine( *rCpy.pLeft )   : nullptr 
),
+    pRight      ( rCpy.pRight   ? new SvxBorderLine( *rCpy.pRight )  : nullptr 
),
     nTopDist    ( rCpy.nTopDist ),
     nBottomDist ( rCpy.nBottomDist ),
     nLeftDist   ( rCpy.nLeftDist ),
     nRightDist  ( rCpy.nRightDist ),
     bRemoveAdjCellBorder ( rCpy.bRemoveAdjCellBorder )
-
 {
-    pTop.reset(    rCpy.GetTop()     ? new SvxBorderLine( *rCpy.GetTop() )    
: nullptr );
-    pBottom.reset( rCpy.GetBottom()  ? new SvxBorderLine( *rCpy.GetBottom() ) 
: nullptr );
-    pLeft.reset(   rCpy.GetLeft()    ? new SvxBorderLine( *rCpy.GetLeft() )   
: nullptr );
-    pRight.reset(  rCpy.GetRight()   ? new SvxBorderLine( *rCpy.GetRight() )  
: nullptr );
 }
 
 
@@ -2252,15 +2251,15 @@ SvxBoxInfoItem::SvxBoxInfoItem( const sal_uInt16 nId ) :
 
 SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCpy ) :
     SfxPoolItem( rCpy ),
+    pHori( rCpy.pHori ? new SvxBorderLine( *rCpy.pHori ) : nullptr ),
+    pVert( rCpy.pVert ? new SvxBorderLine( *rCpy.pVert ) : nullptr ),
     mbEnableHor( rCpy.mbEnableHor ),
-    mbEnableVer( rCpy.mbEnableVer )
+    mbEnableVer( rCpy.mbEnableVer ),
+    bDist( rCpy.bDist ),
+    bMinDist ( rCpy.bMinDist ),
+    nValidFlags( rCpy.nValidFlags ),
+    nDefDist( rCpy.nDefDist )
 {
-    pHori.reset( rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : 
nullptr );
-    pVert.reset( rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : 
nullptr );
-    bDist       = rCpy.IsDist();
-    bMinDist    = rCpy.IsMinDist();
-    nValidFlags = rCpy.nValidFlags;
-    nDefDist    = rCpy.GetDefDist();
 }
 
 
@@ -2881,10 +2880,9 @@ SvxLineItem::SvxLineItem( const sal_uInt16 nId ) :
 
 
 SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) :
-    SfxPoolItem ( rCpy )
+    SfxPoolItem ( rCpy ),
+    pLine(rCpy.pLine ? new SvxBorderLine( *rCpy.pLine ) : nullptr)
 {
-    if (rCpy.GetLine())
-        pLine.reset( new SvxBorderLine( *rCpy.GetLine() ) );
 }
 
 
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 3b636c608aaf..b674d2685246 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -911,9 +911,9 @@ SvxNumBulletItem::SvxNumBulletItem(SvxNumRule const & 
rRule, sal_uInt16 _nWhich
 }
 
 SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) :
-    SfxPoolItem(rCopy)
+    SfxPoolItem(rCopy),
+    pNumRule(new SvxNumRule(*rCopy.pNumRule))
 {
-    pNumRule.reset( new SvxNumRule(*rCopy.pNumRule) );
 }
 
 SvxNumBulletItem::~SvxNumBulletItem()
diff --git a/editeng/source/items/paraitem.cxx 
b/editeng/source/items/paraitem.cxx
index b1c1105f58b7..f216c93b354e 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -535,12 +535,13 @@ bool SvxOrphansItem::GetPresentation
 // class SvxHyphenZoneItem -----------------------------------------------
 
 SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph, const sal_uInt16 nId ) 
:
-    SfxPoolItem( nId )
+    SfxPoolItem( nId ),
+    bHyphen(bHyph),
+    bPageEnd(true),
+    nMinLead(0),
+    nMinTrail(0),
+    nMaxHyphens(255)
 {
-    bHyphen = bHyph;
-    bPageEnd = true;
-    nMinLead = nMinTrail = 0;
-    nMaxHyphens = 255;
 }
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to