summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-21 10:01:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-25 09:12:04 +0200
commit592cbb6cdb1691e205d5bea3dd95d370fd119aa8 (patch)
treebb625870b70c07da661f9c951e980c94eb454b95 /cui
parent9a378c7af1b0ef368f6381c8496369460fa7974d (diff)
loplugin:useuniqueptr in SvxLineTabPage
and move SvxBmpItemInfo inside cui/ since it is only used there. Change-Id: Ic80a8cace9e4664af18baddce3398e826e4c4851 Reviewed-on: https://gerrit.libreoffice.org/56323 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/cuitabline.hxx8
-rw-r--r--cui/source/tabpages/tpline.cxx25
2 files changed, 14 insertions, 19 deletions
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 9f2ccc13ae4e..abce5666f58d 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -78,7 +78,11 @@ public:
/*************************************************************************/
-struct SvxBmpItemInfo;
+struct SvxBmpItemInfo
+{
+ std::unique_ptr<SvxBrushItem> pBrushItem;
+ sal_uInt16 nItemId;
+};
class SvxLineTabPage : public SvxTabPage
{
@@ -132,7 +136,7 @@ private:
VclPtr<MetricField> m_pSymbolHeightMF;
VclPtr<CheckBox> m_pSymbolRatioCB;
std::vector<OUString> m_aGrfNames;
- std::vector< SvxBmpItemInfo* >
+ std::vector< std::unique_ptr<SvxBmpItemInfo> >
m_aGrfBrushItems;
bool m_bLastWidthModified;
Size m_aSymbolLastSize;
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 2dd8adbd01a0..5a633ac06dd1 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -227,11 +227,6 @@ SvxLineTabPage::~SvxLineTabPage()
void SvxLineTabPage::dispose()
{
- for (SvxBmpItemInfo* pInfo : m_aGrfBrushItems)
- {
- delete pInfo->pBrushItem;
- delete pInfo;
- }
m_aGrfBrushItems.clear();
m_pBoxColor.clear();
@@ -294,19 +289,17 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton)
pUIName = &aPhysicalName;
}
- SvxBrushItem* pBrushItem = new SvxBrushItem(grfName, "", GPOS_AREA, SID_ATTR_BRUSH);
-
SvxBmpItemInfo* pInfo = new SvxBmpItemInfo;
- pInfo->pBrushItem = pBrushItem;
+ pInfo->pBrushItem.reset(new SvxBrushItem(grfName, "", GPOS_AREA, SID_ATTR_BRUSH));
pInfo->nItemId = static_cast<sal_uInt16>(MN_GALLERY_ENTRY + i);
if ( i < m_aGrfBrushItems.size() )
{
- m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + i, pInfo );
+ m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + i, std::unique_ptr<SvxBmpItemInfo>(pInfo) );
} else
{
- m_aGrfBrushItems.push_back( pInfo );
+ m_aGrfBrushItems.emplace_back( pInfo );
}
- const Graphic* pGraphic = pBrushItem->GetGraphic();
+ const Graphic* pGraphic = pInfo->pBrushItem->GetGraphic();
if(pGraphic)
{
@@ -393,15 +386,13 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton)
pObj=pPage->RemoveObject(1);
SdrObject::Free(pObj);
- SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH);
-
SvxBmpItemInfo* pInfo = new SvxBmpItemInfo;
- pInfo->pBrushItem = pBrushItem;
+ pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH));
pInfo->nItemId = static_cast<sal_uInt16>(MN_GALLERY_ENTRY + i + m_nNumMenuGalleryItems);
if ( static_cast<size_t>(m_nNumMenuGalleryItems + i) < m_aGrfBrushItems.size() ) {
- m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + m_nNumMenuGalleryItems + i, pInfo );
+ m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + m_nNumMenuGalleryItems + i, std::unique_ptr<SvxBmpItemInfo>(pInfo) );
} else {
- m_aGrfBrushItems.push_back( pInfo );
+ m_aGrfBrushItems.emplace_back( pInfo );
}
Size aSize(aBitmapEx.GetSizePixel());
@@ -448,7 +439,7 @@ void SvxLineTabPage::SymbolSelected(MenuButton const * pButton)
m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
bResetSize = true;
}
- SvxBmpItemInfo* pInfo = m_aGrfBrushItems[ nItemId - MN_GALLERY_ENTRY ];
+ SvxBmpItemInfo* pInfo = m_aGrfBrushItems[ nItemId - MN_GALLERY_ENTRY ].get();
pGraphic = pInfo->pBrushItem->GetGraphic();
}
else switch(nItemId)