Kaydet (Commit) 98cc91ef authored tarafından Jochen Nitschke's avatar Jochen Nitschke

cppcheck: useInitializationList in editeng ...

and remove some indirections

Change-Id: I94088030084683c1a24f904da1c42a01f24f47ce
Reviewed-on: https://gerrit.libreoffice.org/61561
Tested-by: Jenkins
Reviewed-by: 's avatarJochen Nitschke <j.nitschke+logerrit@ok.de>
üst 1ab27f9a
...@@ -67,10 +67,10 @@ static std::unique_ptr<XEditAttribute> MakeXEditAttribute( SfxItemPool& rPool, c ...@@ -67,10 +67,10 @@ static std::unique_ptr<XEditAttribute> MakeXEditAttribute( SfxItemPool& rPool, c
} }
XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr, sal_Int32 nS, sal_Int32 nE ) 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() XEditAttribute::~XEditAttribute()
...@@ -90,12 +90,14 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew) ...@@ -90,12 +90,14 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
} }
XParaPortionList::XParaPortionList( XParaPortionList::XParaPortionList(
OutputDevice* pRefDev, sal_uLong nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY) : OutputDevice* pRefDev, sal_uLong nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY)
aRefMapMode(pRefDev->GetMapMode()), nStretchX(_nStretchX), nStretchY(_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) void XParaPortionList::push_back(XParaPortion* p)
...@@ -495,13 +497,14 @@ static EditEngineItemPool* getEditEngineItemPool(SfxItemPool* pPool) ...@@ -495,13 +497,14 @@ static EditEngineItemPool* getEditEngineItemPool(SfxItemPool* pPool)
return pRetval; return pRetval;
} }
EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, SfxItemPool* pP ) : EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, SfxItemPool* pP )
mpFront(pFront) : 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 // #i101239# ensure target is a EditEngineItemPool, else
// fallback to pool ownership. This is needed to ensure that at // fallback to pool ownership. This is needed to ensure that at
// pool destruction time of an alien pool, the pool is still alive. // pool destruction time of an alien pool, the pool is still alive.
...@@ -525,21 +528,17 @@ EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, SfxItemPool* pP ...@@ -525,21 +528,17 @@ EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, SfxItemPool* pP
// it is sure now that the pool is an EditEngineItemPool // it is sure now that the pool is an EditEngineItemPool
pPool->AddSfxItemPoolUser(*mpFront); pPool->AddSfxItemPoolUser(*mpFront);
} }
bVertical = false;
bIsTopToBottomVert = false;
nScriptType = SvtScriptType::NONE;
} }
EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, const EditTextObjectImpl& r ) : EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, const EditTextObjectImpl& r )
mpFront(pFront) : mpFront(pFront)
, nMetric(r.nMetric)
, nUserType(r.nUserType)
, nScriptType(r.nScriptType)
, bVertical(r.bVertical)
, bIsTopToBottomVert(r.bIsTopToBottomVert)
{ {
nMetric = r.nMetric; // Do not copy PortionInfo
nUserType = r.nUserType;
bVertical = r.bVertical;
bIsTopToBottomVert = r.bIsTopToBottomVert;
nScriptType = r.nScriptType;
pPortionInfo = nullptr; // Do not copy PortionInfo
if ( !r.bOwnerOfPool ) if ( !r.bOwnerOfPool )
{ {
......
...@@ -213,15 +213,14 @@ EditUndoConnectParas::EditUndoConnectParas( ...@@ -213,15 +213,14 @@ EditUndoConnectParas::EditUndoConnectParas(
const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs, const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, bool bBkwrd) : const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, bool bBkwrd) :
EditUndo(EDITUNDO_CONNECTPARAS, pEE), EditUndo(EDITUNDO_CONNECTPARAS, pEE),
nNode(nN),
nSepPos(nSP),
aLeftParaAttribs(rLeftParaAttribs), aLeftParaAttribs(rLeftParaAttribs),
aRightParaAttribs(rRightParaAttribs), aRightParaAttribs(rRightParaAttribs),
eLeftStyleFamily(SfxStyleFamily::All), eLeftStyleFamily(SfxStyleFamily::All),
eRightStyleFamily(SfxStyleFamily::All), eRightStyleFamily(SfxStyleFamily::All),
bBackward(bBkwrd) bBackward(bBkwrd)
{ {
nNode = nN;
nSepPos = nSP;
if ( pLeftStyle ) if ( pLeftStyle )
{ {
aLeftStyleName = pLeftStyle->GetName(); aLeftStyleName = pLeftStyle->GetName();
...@@ -370,9 +369,10 @@ void EditUndoRemoveChars::Redo() ...@@ -370,9 +369,10 @@ void EditUndoRemoveChars::Redo()
EditUndoInsertFeature::EditUndoInsertFeature( EditUndoInsertFeature::EditUndoInsertFeature(
EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature) : 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" ); DBG_ASSERT( pFeature, "Feature could not be duplicated: EditUndoInsertFeature" );
} }
...@@ -444,13 +444,13 @@ EditUndoSetStyleSheet::EditUndoSetStyleSheet( ...@@ -444,13 +444,13 @@ EditUndoSetStyleSheet::EditUndoSetStyleSheet(
EditEngine* pEE, sal_Int32 nP, const OUString& rPrevName, SfxStyleFamily ePrevFam, EditEngine* pEE, sal_Int32 nP, const OUString& rPrevName, SfxStyleFamily ePrevFam,
const OUString& rNewName, SfxStyleFamily eNewFam, const SfxItemSet& rPrevParaAttribs) : const OUString& rNewName, SfxStyleFamily eNewFam, const SfxItemSet& rPrevParaAttribs) :
EditUndo(EDITUNDO_STYLESHEET, pEE), EditUndo(EDITUNDO_STYLESHEET, pEE),
nPara(nP),
aPrevName(rPrevName), aPrevName(rPrevName),
aNewName(rNewName), aNewName(rNewName),
ePrevFamily(ePrevFam),
eNewFamily(eNewFam),
aPrevParaAttribs(rPrevParaAttribs) aPrevParaAttribs(rPrevParaAttribs)
{ {
ePrevFamily = ePrevFam;
eNewFamily = eNewFam;
nPara = nP;
} }
EditUndoSetStyleSheet::~EditUndoSetStyleSheet() EditUndoSetStyleSheet::~EditUndoSetStyleSheet()
...@@ -497,15 +497,16 @@ void EditUndoSetParaAttribs::Redo() ...@@ -497,15 +497,16 @@ void EditUndoSetParaAttribs::Redo()
EditUndoSetAttribs::EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel, const SfxItemSet& rNewItems) : EditUndoSetAttribs::EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel, const SfxItemSet& rNewItems) :
EditUndo(EDITUNDO_ATTRIBS, pEE), EditUndo(EDITUNDO_ATTRIBS, pEE),
aESel(rESel), aNewAttribs(rNewItems) aESel(rESel),
{ aNewAttribs(rNewItems),
nSpecial(SetAttribsMode::NONE),
// When EditUndoSetAttribs actually is a RemoveAttribs this could be // When EditUndoSetAttribs actually is a RemoveAttribs this could be
// recognize by the empty itemset, but then it would have to be caught in // 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. // its own place, which possible a setAttribs does with an empty itemset.
bSetIsRemove = false; bSetIsRemove(false),
bRemoveParaAttribs = false; bRemoveParaAttribs(false),
nRemoveWhich = 0; nRemoveWhich(0)
nSpecial = SetAttribsMode::NONE; {
} }
namespace { namespace {
......
...@@ -289,7 +289,7 @@ SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ) : ...@@ -289,7 +289,7 @@ SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ) :
SvxFieldItem::SvxFieldItem( const SvxFieldItem& rItem ) : SvxFieldItem::SvxFieldItem( const SvxFieldItem& rItem ) :
SfxPoolItem ( rItem ) SfxPoolItem ( rItem )
, mpField( rItem.GetField() ? rItem.GetField()->Clone() : nullptr ) , mpField( rItem.mpField ? rItem.mpField->Clone() : nullptr )
{ {
} }
......
...@@ -1344,17 +1344,16 @@ void SvxShadowItem::dumpAsXml(xmlTextWriterPtr pWriter) const ...@@ -1344,17 +1344,16 @@ void SvxShadowItem::dumpAsXml(xmlTextWriterPtr pWriter) const
SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) : SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) :
SfxPoolItem ( 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 ), nTopDist ( rCpy.nTopDist ),
nBottomDist ( rCpy.nBottomDist ), nBottomDist ( rCpy.nBottomDist ),
nLeftDist ( rCpy.nLeftDist ), nLeftDist ( rCpy.nLeftDist ),
nRightDist ( rCpy.nRightDist ), nRightDist ( rCpy.nRightDist ),
bRemoveAdjCellBorder ( rCpy.bRemoveAdjCellBorder ) 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 ) : ...@@ -2252,15 +2251,15 @@ SvxBoxInfoItem::SvxBoxInfoItem( const sal_uInt16 nId ) :
SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCpy ) : SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCpy ) :
SfxPoolItem( rCpy ), SfxPoolItem( rCpy ),
pHori( rCpy.pHori ? new SvxBorderLine( *rCpy.pHori ) : nullptr ),
pVert( rCpy.pVert ? new SvxBorderLine( *rCpy.pVert ) : nullptr ),
mbEnableHor( rCpy.mbEnableHor ), 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 ) : ...@@ -2881,10 +2880,9 @@ SvxLineItem::SvxLineItem( const sal_uInt16 nId ) :
SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) : 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() ) );
} }
......
...@@ -911,9 +911,9 @@ SvxNumBulletItem::SvxNumBulletItem(SvxNumRule const & rRule, sal_uInt16 _nWhich ...@@ -911,9 +911,9 @@ SvxNumBulletItem::SvxNumBulletItem(SvxNumRule const & rRule, sal_uInt16 _nWhich
} }
SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) : SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) :
SfxPoolItem(rCopy) SfxPoolItem(rCopy),
pNumRule(new SvxNumRule(*rCopy.pNumRule))
{ {
pNumRule.reset( new SvxNumRule(*rCopy.pNumRule) );
} }
SvxNumBulletItem::~SvxNumBulletItem() SvxNumBulletItem::~SvxNumBulletItem()
......
...@@ -535,12 +535,13 @@ bool SvxOrphansItem::GetPresentation ...@@ -535,12 +535,13 @@ bool SvxOrphansItem::GetPresentation
// class SvxHyphenZoneItem ----------------------------------------------- // class SvxHyphenZoneItem -----------------------------------------------
SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph, const sal_uInt16 nId ) : 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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment