summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-12-23 16:03:53 +0200
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2016-12-26 18:35:59 +0000
commit833e6ca9d284bca536d09f6a30b1a8cfbb1c86d8 (patch)
treebd620398e39c9b2b84bb6127fa58575440193a80 /dbaccess
parentd6a7f7fe98af19b43d8e82555a10bf1e835d0533 (diff)
use std::vector instead of naked array in SfxItemPool
Change-Id: I2d4ac010ff5818e673567cee05700872588918e4 Reviewed-on: https://gerrit.libreoffice.org/32384 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx14
-rw-r--r--dbaccess/source/ui/inc/dbadmin.hxx4
-rw-r--r--dbaccess/source/ui/inc/unoadmin.hxx3
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx4
4 files changed, 13 insertions, 12 deletions
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 32abe730db98..b63b4d816e40 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -295,17 +295,17 @@ void ODbAdminDialog::clearPassword()
m_pImpl->clearPassword();
}
-SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
+SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
{
// just to be sure ....
_rpSet = nullptr;
_rpPool = nullptr;
- _rppDefaults = nullptr;
+ _rpDefaults = nullptr;
const OUString sFilterAll( "%", 1, RTL_TEXTENCODING_ASCII_US );
// create and initialize the defaults
- _rppDefaults = new SfxPoolItem*[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1];
- SfxPoolItem** pCounter = _rppDefaults; // want to modify this without affecting the out param _rppDefaults
+ _rpDefaults = new std::vector<SfxPoolItem*>(DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1);
+ SfxPoolItem** pCounter = _rpDefaults->data(); // want to modify this without affecting the out param _rppDefaults
*pCounter++ = new SfxStringItem(DSID_NAME, OUString());
*pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, OUString());
*pCounter++ = new SfxStringItem(DSID_CONNECTURL, OUString());
@@ -436,7 +436,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
OSL_ENSURE(SAL_N_ELEMENTS(aItemInfos) == DSID_LAST_ITEM_ID,"Invalid Ids!");
_rpPool = new SfxItemPool(OUString("DSAItemPool"), DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID,
- aItemInfos, _rppDefaults);
+ aItemInfos, _rpDefaults);
_rpPool->FreezeIdRanges();
// and, finally, the set
@@ -445,7 +445,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
return _rpSet;
}
-void ODbAdminDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults)
+void ODbAdminDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
{
// _first_ delete the set (referring the pool)
if (_rpSet)
@@ -464,7 +464,7 @@ void ODbAdminDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool,
}
// reset the defaults ptr
- _rppDefaults = nullptr;
+ _rpDefaults = nullptr;
// no need to explicitly delete the defaults, this has been done by the ReleaseDefaults
}
diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx
index eb92a0652205..64fe97afc2c1 100644
--- a/dbaccess/source/ui/inc/dbadmin.hxx
+++ b/dbaccess/source/ui/inc/dbadmin.hxx
@@ -72,10 +72,10 @@ public:
@param _pTypeCollection pointer to an <type>ODatasourceMap</type>. May be NULL, in this case
the pool will not contain a typecollection default.
*/
- static SfxItemSet* createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
+ static SfxItemSet* createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
/** destroy and item set / item pool / pool defaults previously created by <method>createItemSet</method>
*/
- static void destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults);
+ static void destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
/** selects the DataSource
@param _rName
diff --git a/dbaccess/source/ui/inc/unoadmin.hxx b/dbaccess/source/ui/inc/unoadmin.hxx
index 49271328e413..4629cb6419d0 100644
--- a/dbaccess/source/ui/inc/unoadmin.hxx
+++ b/dbaccess/source/ui/inc/unoadmin.hxx
@@ -41,7 +41,8 @@ class ODatabaseAdministrationDialog
protected:
SfxItemSet* m_pDatasourceItems; // item set for the dialog
SfxItemPool* m_pItemPool; // item pool for the item set for the dialog
- SfxPoolItem** m_pItemPoolDefaults; // pool defaults
+ std::vector<SfxPoolItem*>*
+ m_pItemPoolDefaults; // pool defaults
::dbaccess::ODsnTypeCollection*
m_pCollection; // datasource type collection
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index b1788d888755..4c95c57feb74 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -809,7 +809,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
0
};
- SfxPoolItem* pDefaults[] =
+ std::vector<SfxPoolItem*> pDefaults
{
new SfxRangeItem(SBA_DEF_RANGEFORMAT, SBA_DEF_FMTVALUE, SBA_ATTR_ALIGN_HOR_JUSTIFY),
new SfxUInt32Item(SBA_DEF_FMTVALUE),
@@ -818,7 +818,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
new SvxNumberInfoItem(SID_ATTR_NUMBERFORMAT_INFO)
};
- SfxItemPool* pPool = new SfxItemPool(OUString("GridBrowserProperties"), SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, pDefaults);
+ SfxItemPool* pPool = new SfxItemPool(OUString("GridBrowserProperties"), SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults);
pPool->SetDefaultMetric( MapUnit::MapTwip ); // ripped, don't understand why
pPool->FreezeIdRanges(); // the same