From 810e664de088721b6452016d83fb3ef3e6ca5eb1 Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Wed, 5 Oct 2016 15:26:43 +0200 Subject: [PATCH] use initializer list ... ... for default pool item arrays and item infos Change-Id: I79db1b4e4a78471d81409dd976a912eeccf1065b Reviewed-on: https://gerrit.libreoffice.org/29540 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- chart2/source/view/main/ChartItemPool.cxx | 6 ++---- sc/source/ui/app/msgpool.cxx | 9 ++++----- svx/source/xoutdev/xpool.cxx | 11 ++++------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 4ec9554a3c96..acf180e0412f 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -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++ ) { diff --git a/sc/source/ui/app/msgpool.cxx b/sc/source/ui/app/msgpool.cxx index b981f01d7570..37d5d9c9e039 100644 --- a/sc/source/ui/app/msgpool.cxx +++ b/sc/source/ui/app/msgpool.cxx @@ -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 ); } diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index d427aa07e164..a0bab6876ed8 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -24,10 +24,10 @@ #include #include -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;