Kaydet (Commit) 2088dac0 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in ODbAdminDialog

Change-Id: I4487552b2936cdfcc38055bf16e114fb6b54a3ed
Reviewed-on: https://gerrit.libreoffice.org/59013
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 3d5fde20
......@@ -286,7 +286,7 @@ void ODbAdminDialog::clearPassword()
m_pImpl->clearPassword();
}
SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
{
// just to be sure ....
_rpSet = nullptr;
......@@ -431,19 +431,13 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
_rpPool->FreezeIdRanges();
// and, finally, the set
_rpSet = new SfxItemSet(*_rpPool);
return _rpSet;
_rpSet.reset(new SfxItemSet(*_rpPool));
}
void ODbAdminDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
void ODbAdminDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
{
// _first_ delete the set (referring the pool)
if (_rpSet)
{
delete _rpSet;
_rpSet = nullptr;
}
_rpSet.reset();
// delete the pool
if (_rpPool)
......
......@@ -69,10 +69,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, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
static void createItemSet(std::unique_ptr<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, std::vector<SfxPoolItem*>*& _rpDefaults);
static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
/** selects the DataSource
@param _rName
......
......@@ -37,7 +37,7 @@ class ODatabaseAdministrationDialog
:public ODatabaseAdministrationDialogBase
{
protected:
SfxItemSet* m_pDatasourceItems; // item set for the dialog
std::unique_ptr<SfxItemSet> m_pDatasourceItems; // item set for the dialog
SfxItemPool* m_pItemPool; // item pool for the item set for the dialog
std::vector<SfxPoolItem*>*
m_pItemPoolDefaults; // pool defaults
......
......@@ -124,7 +124,7 @@ namespace dbaui
svt::OGenericUnoDialog::Dialog OAdvancedSettingsDialog::createDialog(vcl::Window* _pParent)
{
return svt::OGenericUnoDialog::Dialog(VclPtr<AdvancedSettingsDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection));
return svt::OGenericUnoDialog::Dialog(VclPtr<AdvancedSettingsDialog>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection));
}
} // namespace dbaui
......
......@@ -93,7 +93,7 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo()
svt::OGenericUnoDialog::Dialog ODBTypeWizDialog::createDialog(vcl::Window* _pParent)
{
return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection));
return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialog>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection));
}
} // namespace dbaui
......
......@@ -106,7 +106,7 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo(
svt::OGenericUnoDialog::Dialog ODBTypeWizDialogSetup::createDialog(vcl::Window* _pParent)
{
return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialogSetup>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection));
return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialogSetup>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection));
}
void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult)
......
......@@ -93,7 +93,7 @@ Reference<XPropertySetInfo> SAL_CALL OTableFilterDialog::getPropertySetInfo()
svt::OGenericUnoDialog::Dialog OTableFilterDialog::createDialog(vcl::Window* _pParent)
{
return svt::OGenericUnoDialog::Dialog(VclPtr<OTableSubscriptionDialog>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection));
return svt::OGenericUnoDialog::Dialog(VclPtr<OTableSubscriptionDialog>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection));
}
} // namespace dbaui
......
......@@ -93,7 +93,7 @@ Reference<XPropertySetInfo> SAL_CALL OUserSettingsDialog::getPropertySetInfo()
svt::OGenericUnoDialog::Dialog OUserSettingsDialog::createDialog(vcl::Window* _pParent)
{
return svt::OGenericUnoDialog::Dialog(VclPtr<OUserAdminDlg>::Create(_pParent, m_pDatasourceItems, m_aContext, m_aInitialSelection, m_xActiveConnection));
return svt::OGenericUnoDialog::Dialog(VclPtr<OUserAdminDlg>::Create(_pParent, m_pDatasourceItems.get(), m_aContext, m_aInitialSelection, m_xActiveConnection));
}
} // namespace dbaui
......
......@@ -93,7 +93,7 @@ Reference<XPropertySetInfo> SAL_CALL ODataSourcePropertyDialog::getPropertySetI
svt::OGenericUnoDialog::Dialog ODataSourcePropertyDialog::createDialog(vcl::Window* _pParent)
{
VclPtrInstance<ODbAdminDialog> pDialog(_pParent, m_pDatasourceItems, m_aContext);
VclPtrInstance<ODbAdminDialog> pDialog(_pParent, m_pDatasourceItems.get(), m_aContext);
// the initial selection
if ( m_aInitialSelection.hasValue() )
......
......@@ -38,7 +38,6 @@ namespace dbaui
ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XComponentContext >& _rxORB)
:ODatabaseAdministrationDialogBase(_rxORB)
,m_pDatasourceItems(nullptr)
,m_pItemPool(nullptr)
,m_pItemPoolDefaults(nullptr)
{
......
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