diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-21 10:01:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-25 09:12:04 +0200 |
commit | 592cbb6cdb1691e205d5bea3dd95d370fd119aa8 (patch) | |
tree | bb625870b70c07da661f9c951e980c94eb454b95 | |
parent | 9a378c7af1b0ef368f6381c8496369460fa7974d (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>
-rw-r--r-- | cui/source/inc/cuitabline.hxx | 8 | ||||
-rw-r--r-- | cui/source/tabpages/tpline.cxx | 25 | ||||
-rw-r--r-- | include/svx/numvset.hxx | 5 |
3 files changed, 14 insertions, 24 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) diff --git a/include/svx/numvset.hxx b/include/svx/numvset.hxx index 2485a1476a38..63eae7cd77c1 100644 --- a/include/svx/numvset.hxx +++ b/include/svx/numvset.hxx @@ -41,11 +41,6 @@ namespace com{namespace sun{ namespace star{ class SvxBrushItem; class SvxNumRule; -struct SvxBmpItemInfo -{ - SvxBrushItem* pBrushItem; - sal_uInt16 nItemId; -}; enum class NumberingPageType { |