summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-19 12:22:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-25 11:09:41 +0200
commite68520937281cc97542b7eb27e8736148d16fae4 (patch)
treeddfa9c323f823abd11af5ef191b886acb23086e6
parent7658798496b1b3705155d1289f0fc82eab7cab7d (diff)
loplugin:useuniqueptr in CmisPropertiesWindow
Change-Id: I113160675aa7af0a3a425fe0cab4f68ee24adf27 Reviewed-on: https://gerrit.libreoffice.org/60956 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/sfx2/dinfdlg.hxx2
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx16
2 files changed, 5 insertions, 13 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 39a738b3edba..a4b7e680c6e3 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -570,7 +570,7 @@ private:
VclPtr<VclBox> m_pBox;
sal_Int32 m_nItemHeight;
SvNumberFormatter m_aNumberFormatter;
- std::vector< CmisPropertyLine* > m_aCmisPropertiesLines;
+ std::vector< std::unique_ptr<CmisPropertyLine> > m_aCmisPropertiesLines;
public:
CmisPropertiesWindow(SfxTabPage* pParent);
~CmisPropertiesWindow();
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index a42a83f4be62..c68ba3876925 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2278,13 +2278,6 @@ CmisPropertiesWindow::~CmisPropertiesWindow()
void CmisPropertiesWindow::ClearAllLines()
{
- std::vector< CmisPropertyLine* >::iterator pIter;
- for ( pIter = m_aCmisPropertiesLines.begin();
- pIter != m_aCmisPropertiesLines.end(); ++pIter )
- {
- CmisPropertyLine* pLine = *pIter;
- delete pLine;
- }
m_aCmisPropertiesLines.clear();
}
@@ -2293,7 +2286,7 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
const bool bRequired, const bool bMultiValued,
const bool bOpenChoice, Any& /*aChoices*/, Any const & rAny )
{
- CmisPropertyLine* pNewLine = new CmisPropertyLine( m_pBox );
+ std::unique_ptr<CmisPropertyLine> pNewLine(new CmisPropertyLine( m_pBox ));
pNewLine->m_sId = sId;
pNewLine->m_sType = sType;
@@ -2376,7 +2369,7 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
pNewLine->m_aType->SetText( sType );
pNewLine->m_aType->Show();
- m_aCmisPropertiesLines.push_back( pNewLine );
+ m_aCmisPropertiesLines.push_back( std::move(pNewLine) );
}
void CmisPropertiesWindow::DoScroll( sal_Int32 nNewPos )
@@ -2388,11 +2381,10 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
{
Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisPropertiesLines.size() );
sal_Int32 i = 0;
- std::vector< CmisPropertyLine* >::const_iterator pIter;
- for ( pIter = m_aCmisPropertiesLines.begin();
+ for ( auto pIter = m_aCmisPropertiesLines.begin();
pIter != m_aCmisPropertiesLines.end(); ++pIter, ++i )
{
- CmisPropertyLine* pLine = *pIter;
+ CmisPropertyLine* pLine = pIter->get();
aPropertiesSeq[i].Id = pLine->m_sId;
aPropertiesSeq[i].Type = pLine->m_sType;