summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-13 14:21:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-15 08:39:24 +0200
commitbeb0637b4e1516b12dc934a177a58a2c53d2872f (patch)
tree141d97b8a4ef21ab1a4acee4a58ca7b5a45cabdd /extensions
parentd9c312d1917bc039bb0354c8c3f5c9dbbb758cf1 (diff)
loplugin:useuniqueptr in extensions/propctrlr
Change-Id: I08564e76ed667d158bd885a66b994b421ae9b426 Reviewed-on: https://gerrit.libreoffice.org/59015 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/propctrlr/controlfontdialog.cxx2
-rw-r--r--extensions/source/propctrlr/controlfontdialog.hxx2
-rw-r--r--extensions/source/propctrlr/fontdialog.cxx14
-rw-r--r--extensions/source/propctrlr/fontdialog.hxx4
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx4
5 files changed, 10 insertions, 16 deletions
diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx
index a9cf32d93ab4..b320830ebe7d 100644
--- a/extensions/source/propctrlr/controlfontdialog.cxx
+++ b/extensions/source/propctrlr/controlfontdialog.cxx
@@ -144,7 +144,7 @@ namespace pcr
OSL_ENSURE(m_xControlModel.is(), "OControlFontDialog::createDialog: no introspectee set!");
if (m_xControlModel.is())
- ControlCharacterDialog::translatePropertiesToItems(m_xControlModel, m_pFontItems);
+ ControlCharacterDialog::translatePropertiesToItems(m_xControlModel, m_pFontItems.get());
// TODO: we need a mechanism to prevent that somebody creates us, sets an introspectee, executes us,
// sets a new introspectee and re-executes us. In this case, the dialog returned here (upon the first
// execute) will be re-used upon the second execute, and thus it won't be initialized correctly.
diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx
index d5fb90d0b67f..8a110b99db35 100644
--- a/extensions/source/propctrlr/controlfontdialog.hxx
+++ b/extensions/source/propctrlr/controlfontdialog.hxx
@@ -45,7 +45,7 @@ namespace pcr
m_xControlModel;
// </properties>
- SfxItemSet* m_pFontItems; // item set for the dialog
+ std::unique_ptr<SfxItemSet> m_pFontItems; // item set for the dialog
SfxItemPool* m_pItemPool; // item pool for the item set for the dialog
std::vector<SfxPoolItem*>*
m_pItemPoolDefaults; // pool defaults
diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx
index 47c2fcfe982d..c901bf7c2c7b 100644
--- a/extensions/source/propctrlr/fontdialog.cxx
+++ b/extensions/source/propctrlr/fontdialog.cxx
@@ -474,7 +474,7 @@ namespace pcr
}
- SfxItemSet* ControlCharacterDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
+ void ControlCharacterDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
{
// just to be sure ....
_rpSet = nullptr;
@@ -541,24 +541,18 @@ namespace pcr
_rpPool->FreezeIdRanges();
// and, finally, the set
- _rpSet = new SfxItemSet(*_rpPool);
-
- return _rpSet;
+ _rpSet.reset(new SfxItemSet(*_rpPool));
}
- void ControlCharacterDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
+ void ControlCharacterDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
{
// from the pool, get and remember the font list (needs to be deleted)
const SvxFontListItem& rFontListItem = static_cast<const SvxFontListItem&>(_rpPool->GetDefaultItem(CFID_FONTLIST));
const FontList* pFontList = rFontListItem.GetFontList();
// _first_ delete the set (referring the pool)
- if (_rpSet)
- {
- delete _rpSet;
- _rpSet = nullptr;
- }
+ _rpSet.reset();
// delete the pool
_rpPool->ReleaseDefaults(true);
diff --git a/extensions/source/propctrlr/fontdialog.hxx b/extensions/source/propctrlr/fontdialog.hxx
index d014e376c074..92407401cda2 100644
--- a/extensions/source/propctrlr/fontdialog.hxx
+++ b/extensions/source/propctrlr/fontdialog.hxx
@@ -38,10 +38,10 @@ namespace pcr
virtual ~ControlCharacterDialog() override;
/// creates an item set to be used with this dialog
- static SfxItemSet* createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
+ static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
/// destroys an item previously created with <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);
/// fills the given item set with values obtained from the given property set
static void translatePropertiesToItems(
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 48965b871eac..1abe2f2c8237 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2779,11 +2779,11 @@ namespace pcr
bool bSuccess = false;
// create an item set for use with the dialog
- SfxItemSet* pSet = nullptr;
+ std::unique_ptr<SfxItemSet> pSet;
SfxItemPool* pPool = nullptr;
std::vector<SfxPoolItem*>* pDefaults = nullptr;
ControlCharacterDialog::createItemSet(pSet, pPool, pDefaults);
- ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet);
+ ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet.get());
{ // do this in an own block. The dialog needs to be destroyed before we call
// destroyItemSet