From d4d2fc24793960a07275e49706b90928b4a0c764 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 19 May 2016 09:10:43 +0200 Subject: clang-tidy modernize-make-unique Change-Id: I550bb69ddcef69906027516ccde62cf8e87c295b Reviewed-on: https://gerrit.libreoffice.org/25138 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/dialogs/scriptdlg.cxx | 11 ++++++----- cui/source/options/optaboutconfig.cxx | 12 ++++++------ cui/source/options/optfltr.cxx | 19 ++++++++++--------- 3 files changed, 22 insertions(+), 20 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 7ae62e46f231..ec995eeffaf3 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -242,7 +243,7 @@ void SFTreeListBox::Init( const OUString& language ) getLangNodeFromRootNode( children[ n ], lang ); insertEntry( uiName, app ? RID_CUIIMG_HARDDISK : RID_CUIIMG_DOC, - nullptr, true, std::unique_ptr< SFEntry >(new SFEntry( OBJTYPE_SFROOT, langEntries, xDocumentModel )), factoryURL ); + nullptr, true, o3tl::make_unique< SFEntry >( OBJTYPE_SFROOT, langEntries, xDocumentModel ), factoryURL ); } SetUpdateMode( true ); @@ -323,11 +324,11 @@ void SFTreeListBox:: RequestSubEntries( SvTreeListEntry* pRootEntry, Reference< OUString name( children[ n ]->getName() ); if ( children[ n ]->getType() != browse::BrowseNodeTypes::SCRIPT) { - insertEntry( name, RID_CUIIMG_LIB, pRootEntry, true, std::unique_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, children[ n ],model ))); + insertEntry( name, RID_CUIIMG_LIB, pRootEntry, true, o3tl::make_unique< SFEntry >( OBJTYPE_SCRIPTCONTAINER, children[ n ],model )); } else { - insertEntry( name, RID_CUIIMG_MACRO, pRootEntry, false, std::unique_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, children[ n ],model ))); + insertEntry( name, RID_CUIIMG_MACRO, pRootEntry, false, o3tl::make_unique< SFEntry >( OBJTYPE_METHOD, children[ n ],model )); } } } @@ -964,12 +965,12 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry ) if ( aChildNode->getType() == browse::BrowseNodeTypes::SCRIPT ) { pNewEntry = m_pScriptsBox->insertEntry( aChildName, - RID_CUIIMG_MACRO, pEntry, false, std::unique_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, aChildNode,xDocumentModel ) ) ); + RID_CUIIMG_MACRO, pEntry, false, o3tl::make_unique< SFEntry >( OBJTYPE_METHOD, aChildNode,xDocumentModel ) ); } else { pNewEntry = m_pScriptsBox->insertEntry( aChildName, - RID_CUIIMG_LIB, pEntry, false, std::unique_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, aChildNode,xDocumentModel ) ) ); + RID_CUIIMG_LIB, pEntry, false, o3tl::make_unique< SFEntry >( OBJTYPE_SCRIPTCONTAINER, aChildNode,xDocumentModel ) ); // If the Parent is not loaded then set to // loaded, this will prevent RequestingChildren ( called diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 3661856620b3..15d354472bf0 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -204,12 +204,12 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUS bool bInsertToPrefBox) { SvTreeListEntry* pEntry = new SvTreeListEntry; - pEntry->AddItem(std::unique_ptr( - new SvLBoxContextBmp( Image(), Image(), false))); //It is needed, otherwise causes crash - pEntry->AddItem(std::unique_ptr(new SvLBoxString(rProp))); - pEntry->AddItem(std::unique_ptr(new SvLBoxString(rStatus))); - pEntry->AddItem(std::unique_ptr(new SvLBoxString(rType))); - pEntry->AddItem(std::unique_ptr(new SvLBoxString(rValue))); + pEntry->AddItem(o3tl::make_unique( + Image(), Image(), false)); //It is needed, otherwise causes crash + pEntry->AddItem(o3tl::make_unique(rProp)); + pEntry->AddItem(o3tl::make_unique(rStatus)); + pEntry->AddItem(o3tl::make_unique(rType)); + pEntry->AddItem(o3tl::make_unique(rValue)); pEntry->SetUserData( new UserData(rPropertyPath) ); if(bInsertToPrefBox) diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index 2bf67f94d639..0602cef6ae78 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include "optfltr.hxx" @@ -336,16 +337,16 @@ void OfaMSFilterTabPage2::InsertEntry( const OUString& _rTxt, sal_IntPtr _nType, if( !pCheckButtonData ) pCheckButtonData = new SvLBoxButtonData( m_pCheckLB ); - pEntry->AddItem(std::unique_ptr( - new SvLBoxContextBmp(Image(), Image(), false))); - pEntry->AddItem(std::unique_ptr( - new SvLBoxButton(SvLBoxButtonKind::EnabledCheckbox, - pCheckButtonData))); - pEntry->AddItem(std::unique_ptr( - new SvLBoxButton(saveEnabled ? SvLBoxButtonKind::EnabledCheckbox + pEntry->AddItem(o3tl::make_unique( + Image(), Image(), false)); + pEntry->AddItem(o3tl::make_unique( + SvLBoxButtonKind::EnabledCheckbox, + pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique( + saveEnabled ? SvLBoxButtonKind::EnabledCheckbox : SvLBoxButtonKind::DisabledCheckbox, - pCheckButtonData))); - pEntry->AddItem(std::unique_ptr(new SvLBoxString(_rTxt))); + pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique(_rTxt)); pEntry->SetUserData( reinterpret_cast(_nType) ); m_pCheckLB->Insert( pEntry ); -- cgit