diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-19 09:10:43 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-19 08:33:10 +0000 |
commit | d4d2fc24793960a07275e49706b90928b4a0c764 (patch) | |
tree | 3d5bd19190426cee18730893ac9ff292caf2566e | |
parent | 71b74f8fd1fc84cf92dddeab02647b8b765d0d4a (diff) |
clang-tidy modernize-make-unique
Change-Id: I550bb69ddcef69906027516ccde62cf8e87c295b
Reviewed-on: https://gerrit.libreoffice.org/25138
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
35 files changed, 121 insertions, 91 deletions
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index 3eb9e6f4fb72..cc26051c7125 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/make_unique.hxx> #include <tools/debug.hxx> #include <tools/stream.hxx> #include <vcl/svapp.hxx> @@ -305,7 +306,7 @@ SbxInfo::~SbxInfo() void SbxInfo::AddParam(const OUString& rName, SbxDataType eType, SbxFlagBits nFlags) { - m_Params.push_back(std::unique_ptr<SbxParamInfo>(new SbxParamInfo(rName, eType, nFlags))); + m_Params.push_back(o3tl::make_unique<SbxParamInfo>(rName, eType, nFlags)); } const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const 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 <vcl/svapp.hxx> #include <vcl/layout.hxx> #include <vcl/builderfactory.hxx> +#include <o3tl/make_unique.hxx> #include <osl/mutex.hxx> #include <cuires.hrc> @@ -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<SvLBoxContextBmp>( - new SvLBoxContextBmp( Image(), Image(), false))); //It is needed, otherwise causes crash - pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(rProp))); - pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(rStatus))); - pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(rType))); - pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(rValue))); + pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>( + Image(), Image(), false)); //It is needed, otherwise causes crash + pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rProp)); + pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rStatus)); + pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rType)); + pEntry->AddItem(o3tl::make_unique<SvLBoxString>(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 <o3tl/make_unique.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/fltrcfg.hxx> #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<SvLBoxContextBmp>( - new SvLBoxContextBmp(Image(), Image(), false))); - pEntry->AddItem(std::unique_ptr<SvLBoxButton>( - new SvLBoxButton(SvLBoxButtonKind::EnabledCheckbox, - pCheckButtonData))); - pEntry->AddItem(std::unique_ptr<SvLBoxButton>( - new SvLBoxButton(saveEnabled ? SvLBoxButtonKind::EnabledCheckbox + pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>( + Image(), Image(), false)); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>( + SvLBoxButtonKind::EnabledCheckbox, + pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>( + saveEnabled ? SvLBoxButtonKind::EnabledCheckbox : SvLBoxButtonKind::DisabledCheckbox, - pCheckButtonData))); - pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(_rTxt))); + pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique<SvLBoxString>(_rTxt)); pEntry->SetUserData( reinterpret_cast<void*>(_nType) ); m_pCheckLB->Insert( pEntry ); diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx index 2ce57971a904..04202aa54a9b 100644 --- a/editeng/source/uno/unoedhlp.cxx +++ b/editeng/source/uno/unoedhlp.cxx @@ -20,6 +20,7 @@ #include <editeng/unoedhlp.hxx> #include <editeng/editdata.hxx> #include <editeng/editeng.hxx> +#include <o3tl/make_unique.hxx> #include <svl/itemset.hxx> #include <osl/diagnose.h> @@ -91,7 +92,7 @@ sal_uLong SvxEditSourceHint::GetValue() const } } - return ::std::unique_ptr<SfxHint>( new SfxHint() ); + return o3tl::make_unique<SfxHint>( ); } bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell ) diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index dae59b1f46d8..1728f90553a0 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -139,6 +139,7 @@ #include <rtl/ustring.hxx> #include <svtools/embedhlp.hxx> #include <memory> +#include <o3tl/make_unique.hxx> using namespace ::com::sun::star ; using namespace ::com::sun::star::drawing; @@ -6186,8 +6187,8 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt, } m_xShapeInfosByTxBxComp->insert(std::make_shared<SvxMSDffShapeInfo>( aInfo)); - m_pShapeOrders->push_back(std::unique_ptr<SvxMSDffShapeOrder>( - new SvxMSDffShapeOrder( aInfo.nShapeId ))); + m_pShapeOrders->push_back(o3tl::make_unique<SvxMSDffShapeOrder>( + aInfo.nShapeId )); } // and position the Stream correctly again diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 1a2c0191fe4d..8708a3306d04 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -119,6 +119,7 @@ #include <vcl/virdev.hxx> #include <svtools/embedhlp.hxx> #include <o3tl/enumrange.hxx> +#include <o3tl/make_unique.hxx> #include <algorithm> #include <cassert> @@ -5886,7 +5887,7 @@ PPTParagraphObj::~PPTParagraphObj() void PPTParagraphObj::AppendPortion( PPTPortionObj& rPPTPortion ) { m_PortionList.push_back( - std::unique_ptr<PPTPortionObj>(new PPTPortionObj(rPPTPortion))); + o3tl::make_unique<PPTPortionObj>(rPPTPortion)); if ( !mbTab ) { mbTab = m_PortionList.back()->HasTabulator(); diff --git a/formula/source/core/api/FormulaOpCodeMapperObj.cxx b/formula/source/core/api/FormulaOpCodeMapperObj.cxx index ceb934c0aa19..55bdc9e3807b 100644 --- a/formula/source/core/api/FormulaOpCodeMapperObj.cxx +++ b/formula/source/core/api/FormulaOpCodeMapperObj.cxx @@ -25,6 +25,7 @@ #include "formula/opcode.hxx" #include <comphelper/sequence.hxx> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/make_unique.hxx> namespace formula { @@ -107,7 +108,7 @@ uno::Sequence< OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNa uno::Reference< uno::XInterface > SAL_CALL FormulaOpCodeMapperObj::create( uno::Reference< uno::XComponentContext > const & /*_xContext*/) { - return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(::std::unique_ptr<FormulaCompiler>(new FormulaCompiler()))); + return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(o3tl::make_unique<FormulaCompiler>())); } } // formula diff --git a/sc/source/core/data/cellvalues.cxx b/sc/source/core/data/cellvalues.cxx index d6536879c3e1..867bac4fca2a 100644 --- a/sc/source/core/data/cellvalues.cxx +++ b/sc/source/core/data/cellvalues.cxx @@ -10,6 +10,7 @@ #include <cellvalues.hxx> #include <column.hxx> #include <cellvalue.hxx> +#include <o3tl/make_unique.hxx> #include <cassert> @@ -265,10 +266,10 @@ struct TableValues::Impl for (size_t nTab = 0; nTab < nTabs; ++nTab) { - m_Tables.push_back(std::unique_ptr<TableType>(new TableType)); + m_Tables.push_back(o3tl::make_unique<TableType>()); std::unique_ptr<TableType>& rTab2 = m_Tables.back(); for (size_t nCol = 0; nCol < nCols; ++nCol) - rTab2.get()->push_back(std::unique_ptr<CellValues>(new CellValues)); + rTab2.get()->push_back(o3tl::make_unique<CellValues>()); } } diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index fd5c203701ef..0ef57f5990c4 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -320,7 +320,7 @@ ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleForma { for(ScColorScaleEntries::const_iterator itr = rFormat.begin(); itr != rFormat.end(); ++itr) { - maColorScales.push_back(std::unique_ptr<ScColorScaleEntry>(new ScColorScaleEntry(pDoc, **itr))); + maColorScales.push_back(o3tl::make_unique<ScColorScaleEntry>(pDoc, **itr)); } } diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 64934400d6c9..7206a2e8a315 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -72,6 +72,7 @@ #include <vector> #include <boost/checked_delete.hpp> #include <mdds/flat_segment_tree.hpp> +#include <o3tl/make_unique.hxx> using namespace ::com::sun::star; @@ -722,7 +723,7 @@ void fillSortedColumnArray( // In the sorted column container, element positions and row // positions must match, else formula cells may mis-behave during // grouping. - aSortedCols.push_back(std::unique_ptr<SortedColumn>(new SortedColumn(nRow1))); + aSortedCols.push_back(o3tl::make_unique<SortedColumn>(nRow1)); } for (size_t i = 0; i < pRows->size(); ++i) diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index fcf56eaaffbd..1d62a479981b 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -35,6 +35,7 @@ #include "brdcst.hxx" #include <comphelper/stl_types.hxx> +#include <o3tl/make_unique.hxx> #include <memory> #include <utility> @@ -1279,7 +1280,7 @@ ScDBCollection::AnonDBs::AnonDBs(AnonDBs const& r) m_DBs.reserve(r.m_DBs.size()); for (auto const& it : r.m_DBs) { - m_DBs.push_back(std::unique_ptr<ScDBData>(new ScDBData(*it))); + m_DBs.push_back(o3tl::make_unique<ScDBData>(*it)); } } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index c3970749c9f4..a094f04512f6 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -2356,7 +2356,7 @@ bool ScHTMLTable::IsSpaceCharInfo( const ImportInfo& rInfo ) ScHTMLTable::ScHTMLEntryPtr ScHTMLTable::CreateEntry() const { - return ScHTMLEntryPtr( new ScHTMLEntry( GetCurrItemSet() ) ); + return o3tl::make_unique<ScHTMLEntry>( GetCurrItemSet() ); } void ScHTMLTable::CreateNewEntry( const ImportInfo& rInfo ) diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index c3242c53bdac..1632fd067d81 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/make_unique.hxx> #include <sfx2/app.hxx> #include <sfx2/objface.hxx> #include <sfx2/request.hxx> @@ -164,8 +165,8 @@ void ScGraphicShell::ExecuteExternalEdit( SfxRequest& ) if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { GraphicObject aGraphicObject( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() ); - m_ExternalEdits.push_back( std::unique_ptr<SdrExternalToolEdit>( - new SdrExternalToolEdit(pView, pObj))); + m_ExternalEdits.push_back( o3tl::make_unique<SdrExternalToolEdit>( + pView, pObj)); m_ExternalEdits.back()->Edit( &aGraphicObject ); } } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 40606950f007..bbfe30b33207 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -38,6 +38,7 @@ #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> #include <editeng/editeng.hxx> +#include <o3tl/make_unique.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> @@ -970,8 +971,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { GraphicObject aGraphicObject( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() ); m_ExternalEdits.push_back( - std::unique_ptr<SdrExternalToolEdit>( - new SdrExternalToolEdit(mpDrawView, pObj))); + o3tl::make_unique<SdrExternalToolEdit>( + mpDrawView, pObj)); m_ExternalEdits.back()->Edit( &aGraphicObject ); } } diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 045fbb1dac48..0506b77ba85c 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -44,6 +44,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/namedvaluecollection.hxx> +#include <o3tl/make_unique.hxx> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -117,7 +118,7 @@ SidebarController::SidebarController ( mpResourceManager() { // Decks and panel collections for this sidebar - mpResourceManager = std::unique_ptr<ResourceManager>(new ResourceManager()); + mpResourceManager = o3tl::make_unique<ResourceManager>(); registerSidebarForFrame(this, mxFrame->getController()); // Listen for window events. diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index d0c2428930e0..8559edb97194 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -35,6 +35,7 @@ #include <unotools/syslocale.hxx> #include <algorithm> #include <comphelper/servicehelper.hxx> +#include <o3tl/make_unique.hxx> #include <string.h> @@ -283,7 +284,7 @@ SfxItemSet& SfxStyleSheetBase::GetItemSet() std::unique_ptr<SfxItemSet> SfxStyleSheetBase::GetItemSetForPreview() { - return std::unique_ptr<SfxItemSet>(new SfxItemSet(GetItemSet())); + return o3tl::make_unique<SfxItemSet>(GetItemSet()); } /** diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx index 19c0b0df419c..5d6105f38725 100644 --- a/svtools/source/contnr/treelistentry.cxx +++ b/svtools/source/contnr/treelistentry.cxx @@ -19,7 +19,7 @@ #include <svtools/treelistentry.hxx> #include <svtools/treelist.hxx> - +#include <o3tl/make_unique.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -70,7 +70,7 @@ SvTreeListEntry::SvTreeListEntry(const SvTreeListEntry& r) , maBackColor(Application::GetSettings().GetStyleSettings().GetWindowColor()) { for (auto const& it : r.m_Children) - m_Children.push_back(std::unique_ptr<SvTreeListEntry>(new SvTreeListEntry(*it))); + m_Children.push_back(o3tl::make_unique<SvTreeListEntry>(*it)); } SvTreeListEntry::~SvTreeListEntry() diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index a74418260c86..7003011bad7a 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/make_unique.hxx> #include <vcl/dialog.hxx> #include <vcl/layout.hxx> #include <vcl/svapp.hxx> @@ -335,22 +336,22 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, { if (nTreeFlags & SvTreeFlags::CHKBTN) { - pEntry->AddItem(std::unique_ptr<SvLBoxButton>( - new SvLBoxButton(eButtonKind, pCheckButtonData))); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>( + eButtonKind, pCheckButtonData)); } - pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>( - new SvLBoxContextBmp(rColl, rExp, true))); + pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>( + rColl, rExp, true)); // the type of the change assert((rStr.isEmpty() && !!maEntryImage) || (!rStr.isEmpty() && !maEntryImage)); if (rStr.isEmpty()) - pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp( - maEntryImage, maEntryImage, true))); + pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>( + maEntryImage, maEntryImage, true)); else - pEntry->AddItem(std::unique_ptr<SvLBoxColorString>( - new SvLBoxColorString(rStr, maEntryColor))); + pEntry->AddItem(o3tl::make_unique<SvLBoxColorString>( + rStr, maEntryColor)); // the change tracking entries sal_Int32 nIndex = 0; @@ -358,8 +359,8 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, for (sal_uInt16 nToken = 0; nToken < nCount; nToken++) { const OUString aToken = GetToken(maEntryString, nIndex); - pEntry->AddItem(std::unique_ptr<SvLBoxColorString>( - new SvLBoxColorString(aToken, maEntryColor))); + pEntry->AddItem(o3tl::make_unique<SvLBoxColorString>( + aToken, maEntryColor)); } } diff --git a/svx/source/dialog/fontlb.cxx b/svx/source/dialog/fontlb.cxx index 65f41e2e6649..265e5c1c2b60 100644 --- a/svx/source/dialog/fontlb.cxx +++ b/svx/source/dialog/fontlb.cxx @@ -18,6 +18,7 @@ */ #include "svx/fontlb.hxx" +#include <o3tl/make_unique.hxx> #include <vcl/builderfactory.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -133,12 +134,12 @@ void SvxFontListBox::InitEntry( if( mbUseFont ) { if( nTreeFlags & SvTreeFlags::CHKBTN ) - pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton( - eButtonKind, pCheckButtonData))); - pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp( - rCollImg, rExpImg, true))); - pEntry->AddItem(std::unique_ptr<SvLBoxFontString>(new SvLBoxFontString( - rEntryText, maEntryFont, mpEntryColor))); + pEntry->AddItem(o3tl::make_unique<SvLBoxButton>( + eButtonKind, pCheckButtonData)); + pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>( + rCollImg, rExpImg, true)); + pEntry->AddItem(o3tl::make_unique<SvLBoxFontString>( + rEntryText, maEntryFont, mpEntryColor)); } else SvTreeListBox::InitEntry( pEntry, rEntryText, rCollImg, rExpImg, diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 6ca782c34fdf..b14cdd18e14a 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -52,6 +52,7 @@ #include <connectivity/formattedcolumnvalue.hxx> #include <cppuhelper/typeprovider.hxx> #include <i18nlangtag/lang.h> +#include <o3tl/make_unique.hxx> #include <rtl/math.hxx> #include <svtools/calendar.hxx> @@ -1787,8 +1788,8 @@ OUString DbPatternField::GetFormatText(const Reference< css::sdb::XColumn >& _rx if ( !rpFormatter.get() ) { - rpFormatter = ::std::unique_ptr< FormattedColumnValue> ( - new FormattedColumnValue(m_xContext, getCursor(), Reference< XPropertySet >( _rxField, UNO_QUERY ) ) ); + rpFormatter = o3tl::make_unique< FormattedColumnValue> ( + m_xContext, getCursor(), Reference< XPropertySet >( _rxField, UNO_QUERY ) ); OSL_ENSURE( rpFormatter.get(), "DbPatternField::Init: no value formatter!" ); } else diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 2f3002167b77..08594bc3d0e8 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -32,6 +32,7 @@ #include <UndoBookmark.hxx> #include <unobookmark.hxx> #include <rtl/random.h> +#include <o3tl/make_unique.hxx> #include <xmloff/odffields.hxx> #include <libxml/xmlwriter.h> #include <comphelper/anytostring.hxx> @@ -167,13 +168,13 @@ namespace sw { namespace mark void MarkBase::SetMarkPos(const SwPosition& rNewPos) { - std::unique_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos1); + o3tl::make_unique<SwPosition>(rNewPos).swap(m_pPos1); m_pPos1->nContent.SetMark(this); } void MarkBase::SetOtherMarkPos(const SwPosition& rNewPos) { - std::unique_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos2); + o3tl::make_unique<SwPosition>(rNewPos).swap(m_pPos2); m_pPos2->nContent.SetMark(this); } diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 2c79ac1bdad9..89252fb447cf 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -40,6 +40,7 @@ #include <pam.hxx> #include <redline.hxx> #include <rolbck.hxx> +#include <o3tl/make_unique.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/ustring.hxx> #include <sal/types.h> @@ -135,7 +136,7 @@ namespace return lcl_PositionFromContentNode( pNode, bPosAtEndOfNode ); } - return ::std::unique_ptr<SwPosition>(new SwPosition(rOtherPosition)); + return o3tl::make_unique<SwPosition>(rOtherPosition); } IMark* lcl_getMarkAfter(const IDocumentMarkAccess::container_t& rMarks, const SwPosition& rPos) @@ -756,7 +757,7 @@ namespace sw { namespace mark { if ( pEndIdx != nullptr ) { - pNewPos = ::std::unique_ptr< SwPosition >( new SwPosition( rEnd, *pEndIdx ) ); + pNewPos = o3tl::make_unique< SwPosition >( rEnd, *pEndIdx ); } else { diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 414895b13e1d..c27194c40ee4 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/make_unique.hxx> #include <tools/resid.hxx> #include <tools/stream.hxx> #include <vcl/svapp.hxx> @@ -1032,7 +1033,7 @@ void SwTableAutoFormatTable::AddAutoFormat(const SwTableAutoFormat& rTableStyle) if (FindAutoFormat(rTableStyle.GetName())) return; - InsertAutoFormat(size(), std::unique_ptr<SwTableAutoFormat>(new SwTableAutoFormat(rTableStyle))); + InsertAutoFormat(size(), o3tl::make_unique<SwTableAutoFormat>(rTableStyle)); } void SwTableAutoFormatTable::InsertAutoFormat(size_t const i, std::unique_ptr<SwTableAutoFormat> pFormat) diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 8f65c6abffc1..9339aa28dea4 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -21,6 +21,7 @@ #include <comphelper/string.hxx> #include <editeng/unolingu.hxx> #include <editeng/langitem.hxx> +#include <o3tl/make_unique.hxx> #include <swtypes.hxx> #include <tools/resid.hxx> #include <comcore.hrc> @@ -217,7 +218,7 @@ sal_uInt16 SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert ) } //if it is a new Entry - insert - m_DataArr.push_back(std::unique_ptr<SwAuthEntry>(new SwAuthEntry(rInsert))); + m_DataArr.push_back(o3tl::make_unique<SwAuthEntry>(rInsert)); return m_DataArr.size()-1; } diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index de56b8c6c606..d0fd94d7282b 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -19,6 +19,7 @@ #include <hintids.hxx> +#include <o3tl/make_unique.hxx> #include <tools/errinf.hxx> #include <vcl/svapp.hxx> #include <basegfx/vector/b2dvector.hxx> @@ -91,7 +92,7 @@ class TableWait { return our_kLineLimit < nCnt || our_kLineLimit < nCnt2 || (pFrame && our_kLineLimit < pFrame->ImplFindTabFrame()->GetTable()->GetTabLines().size()); } public: TableWait(size_t nCnt, SwFrame *pFrame, SwDocShell &rDocShell, size_t nCnt2 = 0) - : m_pWait( ShouldWait(nCnt, pFrame, nCnt2) ? ::std::unique_ptr<SwWait>(new SwWait( rDocShell, true )) : nullptr ) + : m_pWait( ShouldWait(nCnt, pFrame, nCnt2) ? o3tl::make_unique<SwWait>( rDocShell, true ) : nullptr ) { } }; diff --git a/sw/source/core/tox/ToxLinkProcessor.cxx b/sw/source/core/tox/ToxLinkProcessor.cxx index cbb7275ca42f..1ef40d271625 100644 --- a/sw/source/core/tox/ToxLinkProcessor.cxx +++ b/sw/source/core/tox/ToxLinkProcessor.cxx @@ -11,6 +11,7 @@ #include "SwStyleNameMapper.hxx" #include "ndtxt.hxx" +#include <o3tl/make_unique.hxx> #include <poolfmt.hrc> #include <stdexcept> @@ -20,8 +21,8 @@ namespace sw { void ToxLinkProcessor::StartNewLink(sal_Int32 startPosition, const OUString& characterStyle) { - m_StartedLinks.push_back(std::unique_ptr<StartedLink>( - new StartedLink(startPosition, characterStyle))); + m_StartedLinks.push_back(o3tl::make_unique<StartedLink>( + startPosition, characterStyle)); } void diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 1f0db3dfda0c..920f3b70b8f6 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -62,6 +62,7 @@ #include <comphelper/string.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/make_unique.hxx> #include <algorithm> #include <memory> #include <set> @@ -160,7 +161,7 @@ namespace else if (pCrossRefMark) { // Crossrefbookmarks only remember the start position but have to span the whole paragraph - pCrossRefEndPos = unique_ptr<SwPosition>(new SwPosition(rEndPos)); + pCrossRefEndPos = o3tl::make_unique<SwPosition>(rEndPos); pCrossRefEndPos->nContent = pCrossRefEndPos->nNode.GetNode().GetTextNode()->Len(); pEndPos = pCrossRefEndPos.get(); } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index e4b67d816697..7b7a4676082a 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -72,6 +72,7 @@ #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/sequence.hxx> +#include <o3tl/make_unique.hxx> //UUUU #include <svx/unobrushitemhelper.hxx> @@ -1180,8 +1181,8 @@ SwXStyle::SwXStyle(SwDoc* pDoc, SfxStyleFamily eFamily, bool bConditional) assert(!m_bIsConditional || m_rEntry.m_eFamily == SfxStyleFamily::Para); // only paragraph styles are conditional // Register ourselves as a listener to the document (via the page descriptor) pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); - m_pPropertiesImpl = std::unique_ptr<SwStyleProperties_Impl>( - new SwStyleProperties_Impl(aSwMapProvider.GetPropertySet(m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.m_nPropMapType)->getPropertyMap())); + m_pPropertiesImpl = o3tl::make_unique<SwStyleProperties_Impl>( + aSwMapProvider.GetPropertySet(m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.m_nPropMapType)->getPropertyMap()); } SwXStyle::SwXStyle(SfxStyleSheetBasePool* pPool, SfxStyleFamily eFamily, SwDoc* pDoc, const OUString& rStyleName) diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 96915cd1de80..0e65d2fcd444 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/table/XCellRange.hpp> #include <o3tl/numeric.hxx> +#include <o3tl/make_unique.hxx> #include <svl/itemset.hxx> #include <svl/zformat.hxx> #include <sax/tools/converter.hxx> @@ -338,7 +339,7 @@ SwXMLTableRow_Impl::SwXMLTableRow_Impl( const OUString& rStyleName, for( sal_uInt32 i=0U; i<nCells; ++i ) { - m_Cells.push_back(std::unique_ptr<SwXMLTableCell_Impl>(new SwXMLTableCell_Impl)); + m_Cells.push_back(o3tl::make_unique<SwXMLTableCell_Impl>()); } } @@ -362,8 +363,8 @@ void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, bool bOneCell ) sal_uInt32 nColSpan = nCells - m_Cells.size(); for (size_t i = m_Cells.size(); i < nCells; ++i) { - m_Cells.push_back(std::unique_ptr<SwXMLTableCell_Impl>( - new SwXMLTableCell_Impl(1UL, (bOneCell) ? nColSpan : 1UL))); + m_Cells.push_back(o3tl::make_unique<SwXMLTableCell_Impl>( + 1UL, (bOneCell) ? nColSpan : 1UL)); nColSpan--; } @@ -1635,8 +1636,8 @@ void SwXMLTableContext::InsertCell( const OUString& rStyleName, if (m_pRows->size() < nRowsReq) { for (size_t i = m_pRows->size(); i < nRowsReq; ++i) - m_pRows->push_back(std::unique_ptr<SwXMLTableRow_Impl>( - new SwXMLTableRow_Impl("", GetColumnCount()))); + m_pRows->push_back(o3tl::make_unique<SwXMLTableRow_Impl>( + "", GetColumnCount())); } OUString sStyleName( rStyleName ); @@ -1694,9 +1695,9 @@ void SwXMLTableContext::InsertRow( const OUString& rStyleName, else { // add a new row - m_pRows->push_back(std::unique_ptr<SwXMLTableRow_Impl>( - new SwXMLTableRow_Impl(rStyleName, GetColumnCount(), - &rDfltCellStyleName, i_rXmlId))); + m_pRows->push_back(o3tl::make_unique<SwXMLTableRow_Impl>( + rStyleName, GetColumnCount(), + &rDfltCellStyleName, i_rXmlId)); } // We start at the first column ... diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 43362f444017..a056e9af88e8 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -19,6 +19,7 @@ #include <cmdid.h> #include <hintids.hxx> +#include <o3tl/make_unique.hxx> #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> #include <svl/stritem.hxx> @@ -195,8 +196,8 @@ void SwGrfShell::Execute(SfxRequest &rReq) GraphicObject const*const pGraphicObject(rSh.GetGraphicObj()); if(nullptr != pGraphicObject) { - m_ExternalEdits.push_back(std::unique_ptr<SwExternalToolEdit>( - new SwExternalToolEdit(&rSh))); + m_ExternalEdits.push_back(o3tl::make_unique<SwExternalToolEdit>( + &rSh)); m_ExternalEdits.back()->Edit(pGraphicObject); } } diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index a6532d604250..4125dd337ef5 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -19,6 +19,7 @@ #include <hintids.hxx> +#include <o3tl/make_unique.hxx> #include <vcl/msgbox.hxx> #include <svl/whiter.hxx> #include <svl/stritem.hxx> @@ -231,7 +232,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq) { // must create new one, otherwise document is without pam SwPaM* pPaM = rWrtSh.GetCursor(); - vItems.push_back( std::make_pair( pSize, std::unique_ptr<SwPaM>(new SwPaM( *(pPaM->GetMark()), *(pPaM->GetPoint()))) ) ); + vItems.push_back( std::make_pair( pSize, o3tl::make_unique<SwPaM>( *(pPaM->GetMark()), *(pPaM->GetPoint())) ) ); } else vItems = rWrtSh.GetItemWithPaM( RES_CHRATR_FONTSIZE ); diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx index 68005354adce..2dc12033bd12 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx @@ -40,6 +40,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/documentconstants.hxx> #include <comphelper/string.hxx> +#include <o3tl/make_unique.hxx> namespace sw { namespace sidebar { @@ -182,7 +183,7 @@ void StylePresetsPanel::RefreshList() OUString aURL = aTemplates.GetPath(i,j); BitmapEx aPreview = CreatePreview(aURL, aName); mpValueSet->InsertItem(j, Image(aPreview), aName); - maTemplateEntries.push_back(std::unique_ptr<TemplateEntry>(new TemplateEntry(aURL))); + maTemplateEntries.push_back(o3tl::make_unique<TemplateEntry>(aURL)); mpValueSet->SetItemData(j, maTemplateEntries.back().get()); } } diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index e317004c9470..946a35fb7136 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -30,6 +30,7 @@ #include "vcleventlisteners.hxx" #include <vcl/lazydelete.hxx> +#include <o3tl/make_unique.hxx> #include <o3tl/make_shared.hxx> #include "opengl/zone.hxx" @@ -396,11 +397,11 @@ void lclInstantiateTexture(OpenGLTexture& rTexture, const int nWidth, const int TextureAtlasVector &sTextureAtlases = *gTextureAtlases.get(); if (sTextureAtlases.empty()) { - sTextureAtlases.push_back(std::unique_ptr<FixedTextureAtlasManager>(new FixedTextureAtlasManager(8, 8, 16))); - sTextureAtlases.push_back(std::unique_ptr<FixedTextureAtlasManager>(new FixedTextureAtlasManager(8, 8, 24))); - sTextureAtlases.push_back(std::unique_ptr<FixedTextureAtlasManager>(new FixedTextureAtlasManager(8, 8, 32))); - sTextureAtlases.push_back(std::unique_ptr<FixedTextureAtlasManager>(new FixedTextureAtlasManager(8, 8, 48))); - sTextureAtlases.push_back(std::unique_ptr<FixedTextureAtlasManager>(new FixedTextureAtlasManager(8, 8, 64))); + sTextureAtlases.push_back(o3tl::make_unique<FixedTextureAtlasManager>(8, 8, 16)); + sTextureAtlases.push_back(o3tl::make_unique<FixedTextureAtlasManager>(8, 8, 24)); + sTextureAtlases.push_back(o3tl::make_unique<FixedTextureAtlasManager>(8, 8, 32)); + sTextureAtlases.push_back(o3tl::make_unique<FixedTextureAtlasManager>(8, 8, 48)); + sTextureAtlases.push_back(o3tl::make_unique<FixedTextureAtlasManager>(8, 8, 64)); } for (std::unique_ptr<FixedTextureAtlasManager> & pTextureAtlas : sTextureAtlases) { diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx index 8d2305aeca4d..f35b09862a76 100644 --- a/xmloff/source/style/impastpl.cxx +++ b/xmloff/source/style/impastpl.cxx @@ -508,8 +508,8 @@ bool SvXMLAutoStylePoolP_Impl::Add( if (it2 == rFamily.m_ParentSet.end()) { std::pair<XMLAutoStyleFamily::ParentSetType::iterator,bool> r = - rFamily.m_ParentSet.insert(std::unique_ptr<XMLAutoStylePoolParent>( - new XMLAutoStylePoolParent(rParentName))); + rFamily.m_ParentSet.insert(o3tl::make_unique<XMLAutoStylePoolParent>( + rParentName)); it2 = r.first; } @@ -542,8 +542,8 @@ bool SvXMLAutoStylePoolP_Impl::AddNamed( if (it2 == rFamily.m_ParentSet.end()) { std::pair<XMLAutoStyleFamily::ParentSetType::iterator,bool> r = - rFamily.m_ParentSet.insert(std::unique_ptr<XMLAutoStylePoolParent>( - new XMLAutoStylePoolParent(rParentName))); + rFamily.m_ParentSet.insert(o3tl::make_unique<XMLAutoStylePoolParent>( + rParentName)); it2 = r.first; } |