use initializer list ...

... for default pool item arrays and item infos

Change-Id: I79db1b4e4a78471d81409dd976a912eeccf1065b
Reviewed-on: https://gerrit.libreoffice.org/29540
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
Jochen Nitschke 2016-10-05 15:26:43 +02:00 committed by Markus Mohrhard
parent 99e3cf1ce9
commit 810e664de0
3 changed files with 10 additions and 16 deletions

View file

@ -37,13 +37,13 @@ namespace chart
{
ChartItemPool::ChartItemPool():
SfxItemPool( "ChartItemPool" , SCHATTR_START, SCHATTR_END, nullptr, nullptr )
SfxItemPool( "ChartItemPool" , SCHATTR_START, SCHATTR_END, nullptr, nullptr ),
pItemInfos(new SfxItemInfo[SCHATTR_END - SCHATTR_START + 1])
{
/**************************************************************************
* PoolDefaults
**************************************************************************/
SfxPoolItem** ppPoolDefaults = new SfxPoolItem*[SCHATTR_END - SCHATTR_START + 1];
ppPoolDefaults[SCHATTR_DATADESCR_SHOW_NUMBER - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_NUMBER);
ppPoolDefaults[SCHATTR_DATADESCR_SHOW_PERCENTAGE- SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_PERCENTAGE);
ppPoolDefaults[SCHATTR_DATADESCR_SHOW_CATEGORY - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_CATEGORY);
@ -164,8 +164,6 @@ ChartItemPool::ChartItemPool():
/**************************************************************************
* ItemInfos
**************************************************************************/
pItemInfos = new SfxItemInfo[SCHATTR_END - SCHATTR_START + 1];
const sal_uInt16 nMax = SCHATTR_END - SCHATTR_START + 1;
for( sal_uInt16 i = 0; i < nMax; i++ )
{

View file

@ -55,10 +55,11 @@ ScMessagePool::ScMessagePool()
aGlobalUserListItem ( ScUserListItem ( SCITEM_USERLIST ) ),
aPrintWarnItem ( SfxBoolItem ( SCITEM_PRINTWARN, false ) ),
aCondFormatDlgItem ( ScCondFormatDlgItem ( nullptr, -1, false ) )
{
ppPoolDefaults = new SfxPoolItem*[MSGPOOL_END - MSGPOOL_START + 1];
aCondFormatDlgItem ( ScCondFormatDlgItem ( nullptr, -1, false ) ),
ppPoolDefaults(new SfxPoolItem*[MSGPOOL_END - MSGPOOL_START + 1]),
pDocPool(new ScDocumentPool)
{
ppPoolDefaults[SCITEM_STRING - MSGPOOL_START] = &aGlobalStringItem;
ppPoolDefaults[SCITEM_SEARCHDATA - MSGPOOL_START] = &aGlobalSearchItem;
ppPoolDefaults[SCITEM_SORTDATA - MSGPOOL_START] = &aGlobalSortItem;
@ -73,8 +74,6 @@ ScMessagePool::ScMessagePool()
SetDefaults( ppPoolDefaults );
pDocPool = new ScDocumentPool;
SetSecondaryPool( pDocPool );
}

View file

@ -24,10 +24,10 @@
#include <svx/svxids.hrc>
#include <svl/itemset.hxx>
XOutdevItemPool::XOutdevItemPool(
SfxItemPool* _pMaster,
bool bLoadRefCounts)
: SfxItemPool("XOutdevItemPool", SDRATTR_START, SDRATTR_END, nullptr, nullptr, bLoadRefCounts)
XOutdevItemPool::XOutdevItemPool(SfxItemPool* _pMaster, bool bLoadRefCounts)
: SfxItemPool("XOutdevItemPool", SDRATTR_START, SDRATTR_END, nullptr, nullptr, bLoadRefCounts)
, mppLocalPoolDefaults(new SfxPoolItem*[SDRATTR_END - SDRATTR_START + 1])
, mpLocalItemInfos(new SfxItemInfo[SDRATTR_END - SDRATTR_START + 1])
{
// prepare some defaults
const OUString aNullStr;
@ -58,8 +58,6 @@ XOutdevItemPool::XOutdevItemPool(
}
// prepare PoolDefaults
mppLocalPoolDefaults = new SfxPoolItem*[GetLastWhich() - GetFirstWhich() + 1];
mppLocalPoolDefaults[XATTR_LINESTYLE -XATTR_START] = new XLineStyleItem;
mppLocalPoolDefaults[XATTR_LINEDASH -XATTR_START] = new XLineDashItem(this,aNullDash);
mppLocalPoolDefaults[XATTR_LINEWIDTH -XATTR_START] = new XLineWidthItem;
@ -113,7 +111,6 @@ XOutdevItemPool::XOutdevItemPool(
mppLocalPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(pSet);
// create ItemInfos
mpLocalItemInfos = new SfxItemInfo[GetLastWhich() - GetFirstWhich() + 1];
for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++)
{
mpLocalItemInfos[i - XATTR_START]._nSID = 0;