summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-19 12:20:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-25 11:03:56 +0200
commit80f28ef95e7c74c8df799a47fa90ff90bfd13f61 (patch)
tree6fff80c722b2de1507b32cb4af453989fc732977
parent72c191e046112df73c66be8dc8d1bec5a546fa60 (diff)
loplugin:useuniqueptr in CmisPropertyLine
Change-Id: If54a2c546cb3c65417c1ebcc4957cce41597dd07 Reviewed-on: https://gerrit.libreoffice.org/60955 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/sfx2/dinfdlg.hxx6
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx54
2 files changed, 18 insertions, 42 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 66c5726e8eca..d7894172753a 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -554,9 +554,9 @@ struct CmisPropertyLine : public VclBuilderContainer
bool m_bOpenChoice;
VclPtr<FixedText> m_aName;
VclPtr<FixedText> m_aType;
- std::vector< CmisValue* > m_aValues;
- std::vector< CmisDateTime* > m_aDateTimes;
- std::vector< CmisYesNo* > m_aYesNos;
+ std::vector< std::unique_ptr<CmisValue> > m_aValues;
+ std::vector< std::unique_ptr<CmisDateTime> > m_aDateTimes;
+ std::vector< std::unique_ptr<CmisYesNo> > m_aYesNos;
long getItemHeight() const;
CmisPropertyLine( vcl::Window* pParent );
virtual ~CmisPropertyLine() override;
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index c015edebeff6..6fad98d00222 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2260,33 +2260,9 @@ CmisPropertyLine::CmisPropertyLine(vcl::Window* pParent)
CmisPropertyLine::~CmisPropertyLine( )
{
- std::vector< CmisValue* >::iterator pIter;
- for ( pIter = m_aValues.begin();
- pIter != m_aValues.end(); ++pIter )
- {
- CmisValue* pValue = *pIter;
- delete pValue;
- }
m_aValues.clear();
-
- std::vector< CmisYesNo* >::iterator pIterYesNo;
- for ( pIterYesNo = m_aYesNos.begin();
- pIterYesNo != m_aYesNos.end(); ++pIterYesNo )
- {
- CmisYesNo* pYesNo = *pIterYesNo;
- delete pYesNo;
- }
m_aYesNos.clear();
-
- std::vector< CmisDateTime* >::iterator pIterDateTime;
- for ( pIterDateTime = m_aDateTimes.begin();
- pIterDateTime != m_aDateTimes.end(); ++pIterDateTime )
- {
- CmisDateTime* pDateTime = *pIterDateTime;
- delete pDateTime;
- }
m_aDateTimes.clear();
-
}
long CmisPropertyLine::getItemHeight() const
@@ -2346,9 +2322,9 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
{
OUString sValue;
m_aNumberFormatter.GetInputLineString( seqValue[i], nIndex, sValue );
- CmisValue* pValue = new CmisValue( m_pBox, sValue );
+ std::unique_ptr<CmisValue> pValue(new CmisValue( m_pBox, sValue ));
pValue->m_aValueEdit->SetReadOnly( !bUpdatable );
- pNewLine->m_aValues.push_back( pValue );
+ pNewLine->m_aValues.push_back( std::move(pValue) );
}
}
else if ( sType == CMIS_TYPE_DECIMAL )
@@ -2361,9 +2337,9 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
{
OUString sValue;
m_aNumberFormatter.GetInputLineString( seqValue[i], nIndex, sValue );
- CmisValue* pValue = new CmisValue( m_pBox, sValue );
+ std::unique_ptr<CmisValue> pValue(new CmisValue( m_pBox, sValue ));
pValue->m_aValueEdit->SetReadOnly( !bUpdatable );
- pNewLine->m_aValues.push_back( pValue );
+ pNewLine->m_aValues.push_back( std::move(pValue) );
}
}
@@ -2374,10 +2350,10 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
sal_Int32 nNumValue = seqValue.getLength( );
for ( sal_Int32 i = 0; i < nNumValue; ++i )
{
- CmisYesNo* pYesNo = new CmisYesNo( m_pBox, seqValue[i] );
+ std::unique_ptr<CmisYesNo> pYesNo(new CmisYesNo( m_pBox, seqValue[i] ));
pYesNo->m_aYesButton->Enable( bUpdatable );
pYesNo->m_aNoButton->Enable( bUpdatable );
- pNewLine->m_aYesNos.push_back( pYesNo );
+ pNewLine->m_aYesNos.push_back( std::move(pYesNo) );
}
}
else if ( sType == CMIS_TYPE_STRING )
@@ -2387,9 +2363,9 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
sal_Int32 nNumValue = seqValue.getLength( );
for ( sal_Int32 i = 0; i < nNumValue; ++i )
{
- CmisValue* pValue = new CmisValue( m_pBox, seqValue[i] );
+ std::unique_ptr<CmisValue> pValue(new CmisValue( m_pBox, seqValue[i] ));
pValue->m_aValueEdit->SetReadOnly( !bUpdatable );
- pNewLine->m_aValues.push_back( pValue );
+ pNewLine->m_aValues.push_back( std::move(pValue) );
}
}
else if ( sType == CMIS_TYPE_DATETIME )
@@ -2399,10 +2375,10 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
sal_Int32 nNumValue = seqValue.getLength( );
for ( sal_Int32 i = 0; i < nNumValue; ++i )
{
- CmisDateTime* pDateTime = new CmisDateTime( m_pBox, seqValue[i]);
+ std::unique_ptr<CmisDateTime> pDateTime(new CmisDateTime( m_pBox, seqValue[i]));
pDateTime->m_aDateField->SetReadOnly( !bUpdatable );
pDateTime->m_aTimeField->SetReadOnly( !bUpdatable );
- pNewLine->m_aDateTimes.push_back( pDateTime );
+ pNewLine->m_aDateTimes.push_back( std::move(pDateTime) );
}
}
pNewLine->m_aName->SetText( sName );
@@ -2446,7 +2422,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
Sequence< double > seqValue( pLine->m_aValues.size( ) );
sal_Int32 k = 0;
- for ( std::vector< CmisValue*>::const_iterator it = pLine->m_aValues.begin();
+ for ( auto it = pLine->m_aValues.begin();
it != pLine->m_aValues.end(); ++it, ++k)
{
double dValue = 0.0;
@@ -2464,7 +2440,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
Sequence< sal_Int64 > seqValue( pLine->m_aValues.size( ) );
sal_Int32 k = 0;
- for ( std::vector< CmisValue*>::const_iterator it = pLine->m_aValues.begin();
+ for ( auto it = pLine->m_aValues.begin();
it != pLine->m_aValues.end(); ++it, ++k)
{
double dValue = 0;
@@ -2480,7 +2456,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
{
Sequence<sal_Bool> seqValue( pLine->m_aYesNos.size( ) );
sal_Int32 k = 0;
- for ( std::vector< CmisYesNo*>::const_iterator it = pLine->m_aYesNos.begin();
+ for ( auto it = pLine->m_aYesNos.begin();
it != pLine->m_aYesNos.end(); ++it, ++k)
{
bool bValue = (*it)->m_aYesButton->IsChecked();
@@ -2493,7 +2469,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
{
Sequence< util::DateTime > seqValue( pLine->m_aDateTimes.size( ) );
sal_Int32 k = 0;
- for ( std::vector< CmisDateTime*>::const_iterator it = pLine->m_aDateTimes.begin();
+ for ( auto it = pLine->m_aDateTimes.begin();
it != pLine->m_aDateTimes.end(); ++it, ++k)
{
Date aTmpDate = (*it)->m_aDateField->GetDate();
@@ -2510,7 +2486,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
{
Sequence< OUString > seqValue( pLine->m_aValues.size( ) );
sal_Int32 k = 0;
- for ( std::vector< CmisValue*>::const_iterator it = pLine->m_aValues.begin();
+ for ( auto it = pLine->m_aValues.begin();
it != pLine->m_aValues.end(); ++it, ++k)
{
OUString sValue( (*it)->m_aValueEdit->GetText() );