diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-10 12:30:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-10 13:07:41 +0100 |
commit | 175a2063effa1c5a3eab896c6c4b0d07f3588edb (patch) | |
tree | 4a252a7e9e6e714343e9ff21c3d78c8e41086009 | |
parent | ddf901664d3dd12191f98b77182652a6889f2b26 (diff) |
use more std::make_shared
found using 'git grep', I tried using clang-tidy, but it only
successfully found a tiny fraction of these
Change-Id: I61c7d85105ff7a911722750e759d6641d578da33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86526
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
153 files changed, 381 insertions, 428 deletions
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 79c809927fb2..d614dfc560ce 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -745,9 +745,9 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) case SID_BASICIDE_MANAGE_LANG: { - std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + auto pRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more - std::shared_ptr<ManageLanguageDialog> xDlg(new ManageLanguageDialog(pCurWin ? pCurWin->GetFrameWeld() : nullptr, m_pCurLocalizationMgr)); + auto xDlg = std::make_shared<ManageLanguageDialog>(pCurWin ? pCurWin->GetFrameWeld() : nullptr, m_pCurLocalizationMgr); weld::DialogController::runAsync(xDlg, [=](sal_Int32 /*nResult*/){ pRequest->Done(); }); diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 0783d697b1ba..48bbe0838f37 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -595,8 +595,8 @@ void LibPage::InsertLib() // file URLs Sequence< OUString > aFiles = xFP->getSelectedFiles(); INetURLObject aURLObj( aFiles[0] ); - std::shared_ptr<INetURLObject> xModURLObj(new INetURLObject(aURLObj)); - std::shared_ptr<INetURLObject> xDlgURLObj(new INetURLObject(aURLObj)); + auto xModURLObj = std::make_shared<INetURLObject>(aURLObj); + auto xDlgURLObj = std::make_shared<INetURLObject>(aURLObj); OUString aBase = aURLObj.getBase(); OUString aModBase( "script" ); diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index 1d87ab94039f..193dce11dd68 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -138,7 +138,7 @@ void ManageLanguageDialog::ClearLanguageBox() IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl, weld::Button&, void) { - std::shared_ptr<SetDefaultLanguageDialog> xDlg(new SetDefaultLanguageDialog(m_xDialog.get(), m_xLocalizationMgr)); + auto xDlg = std::make_shared<SetDefaultLanguageDialog>(m_xDialog.get(), m_xLocalizationMgr); weld::DialogController::runAsync(xDlg, [xDlg,this](sal_Int32 nResult) { if (!nResult ) diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 3a9cb95264d5..0f9f3dfc4fc1 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -405,8 +405,8 @@ std::shared_ptr<SvNumberFormatter> SbiInstance::PrepareNumberFormatter( sal_uInt eDate = aSysLocale.GetLocaleData().getDateOrder(); } - std::shared_ptr<SvNumberFormatter> pNumberFormatter( - new SvNumberFormatter( comphelper::getProcessComponentContext(), eLangType )); + std::shared_ptr<SvNumberFormatter> pNumberFormatter = + std::make_shared<SvNumberFormatter>( comphelper::getProcessComponentContext(), eLangType ); // Several parser methods pass SvNumberFormatter::IsNumberFormat() a number // format index to parse against. Tell the formatter the proper date diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index ea650b9f9f5f..7f058a2a45bc 100644 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -471,8 +471,7 @@ namespace dxcanvas ::basegfx::B2IVector aPageSize(maPageSize); while(true) { - mpTexture = std::shared_ptr<canvas::ISurface>( - new DXSurface(*this,aPageSize)); + mpTexture = std::make_shared<DXSurface>(*this,aPageSize); if(mpTexture->isValid()) break; @@ -950,7 +949,7 @@ namespace dxcanvas if(mpTexture.use_count() == 1) return mpTexture; - return std::shared_ptr<canvas::ISurface>( new DXSurface(*this,aSize) ); + return std::make_shared<DXSurface>(*this,aSize); } diff --git a/canvas/source/tools/surfaceproxymanager.cxx b/canvas/source/tools/surfaceproxymanager.cxx index ef70b824e9e0..126e1bd8c2ad 100644 --- a/canvas/source/tools/surfaceproxymanager.cxx +++ b/canvas/source/tools/surfaceproxymanager.cxx @@ -55,7 +55,7 @@ namespace canvas // not much to do for now, simply allocate a new surface // proxy from our internal pool and initialize this thing // properly. we *don't* create a hardware surface for now. - return std::shared_ptr<ISurfaceProxy>(new SurfaceProxy(pBuffer,mpPageManager)); + return std::make_shared<SurfaceProxy>(pBuffer,mpPageManager); } private: @@ -66,9 +66,7 @@ namespace canvas std::shared_ptr<ISurfaceProxyManager> createSurfaceProxyManager( const std::shared_ptr<IRenderModule>& rRenderModule ) { - return std::shared_ptr<ISurfaceProxyManager>( - new SurfaceProxyManager( - rRenderModule)); + return std::make_shared<SurfaceProxyManager>(rRenderModule); } } diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index d5146749cd4d..7d293852857f 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -652,7 +652,7 @@ void DataBrowser::RenewTable() for (auto const& elemHeader : aHeaders) { - std::shared_ptr< impl::SeriesHeader > spHeader( new impl::SeriesHeader( m_pColumnsWin, m_pColorsWin )); + auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, m_pColorsWin ); Reference< beans::XPropertySet > xSeriesProp( elemHeader.m_xDataSeries, uno::UNO_QUERY ); sal_Int32 nColor = 0; // @todo: Set "DraftColor", i.e. interpolated colors for gradients, bitmaps, etc. @@ -1287,7 +1287,7 @@ void DataBrowser::RenewSeriesHeaders() for (auto const& elemHeader : aHeaders) { - std::shared_ptr< impl::SeriesHeader > spHeader( new impl::SeriesHeader( m_pColumnsWin, m_pColorsWin )); + auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, m_pColorsWin ); Reference< beans::XPropertySet > xSeriesProp(elemHeader.m_xDataSeries, uno::UNO_QUERY); sal_Int32 nColor = 0; if( xSeriesProp.is() && diff --git a/chart2/source/controller/main/UndoActions.cxx b/chart2/source/controller/main/UndoActions.cxx index 812e059e7980..301bef28279c 100644 --- a/chart2/source/controller/main/UndoActions.cxx +++ b/chart2/source/controller/main/UndoActions.cxx @@ -65,7 +65,7 @@ OUString SAL_CALL UndoElement::getTitle() void UndoElement::impl_toggleModelState() { // get a snapshot of the current state of our model - std::shared_ptr< ChartModelClone > pNewClone( new ChartModelClone( m_xDocumentModel, m_pModelClone->getFacet() ) ); + auto pNewClone = std::make_shared<ChartModelClone>( m_xDocumentModel, m_pModelClone->getFacet() ); // apply the previous snapshot to our model m_pModelClone->applyToModel( m_xDocumentModel ); // remember the new snapshot, for the next toggle diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index 61050a12500f..e7fe42a87124 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -156,7 +156,7 @@ void VCartesianCoordinateSystem::createVAxisList( if(aAxisProperties.m_bDisplayLabels) aAxisProperties.m_nNumberFormatKey = getNumberFormatKeyForAxis(xAxis, xChartDoc); - std::shared_ptr< VAxisBase > apVAxis( new VCartesianAxis(aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount) ); + auto apVAxis = std::make_shared<VCartesianAxis>(aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount); tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex ); m_aAxisMap[aFullAxisIndex] = apVAxis; apVAxis->set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, m_eBottomPos ); diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index df5ca49cea74..54958c11281e 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -796,7 +796,7 @@ std::vector<std::shared_ptr<VButton>> lcl_createButtons( const css::uno::Sequence<chart2::data::PivotTableFieldEntry> aPivotFieldEntries = xPivotTableDataProvider->getColumnFields(); for (chart2::data::PivotTableFieldEntry const & sColumnFieldEntry : aPivotFieldEntries) { - std::shared_ptr<VButton> pButton(new VButton); + auto pButton = std::make_shared<VButton>(); aButtons.push_back(pButton); pButton->init(xLegendContainer, xShapeFactory); awt::Point aNewPosition(x, y); diff --git a/configmgr/source/lock.cxx b/configmgr/source/lock.cxx index 3c0e25d432c5..40a7536b8ab7 100644 --- a/configmgr/source/lock.cxx +++ b/configmgr/source/lock.cxx @@ -27,7 +27,7 @@ namespace configmgr { std::shared_ptr<osl::Mutex> const & lock() { - static std::shared_ptr<osl::Mutex> theLock(new osl::Mutex); + static std::shared_ptr<osl::Mutex> theLock = std::make_shared<osl::Mutex>(); return theLock; } diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx index d158994d5b5a..b970d93f5a9a 100644 --- a/connectivity/source/commontools/RowFunctionParser.cxx +++ b/connectivity/source/commontools/RowFunctionParser.cxx @@ -157,7 +157,7 @@ public: void operator()( StringIteratorT rFirst,StringIteratorT rSecond) const { OUString sVal( rFirst, rSecond - rFirst, RTL_TEXTENCODING_UTF8 ); - mpContext->maOperandStack.push( std::shared_ptr<ExpressionNode>( new ConstantValueExpression( new ORowSetValueDecorator( sVal ) ) ) ); + mpContext->maOperandStack.push( std::make_shared<ConstantValueExpression>( new ORowSetValueDecorator( sVal ) ) ); } }; @@ -174,7 +174,7 @@ public: } void operator()( sal_Int32 n ) const { - mpContext->maOperandStack.push( std::shared_ptr<ExpressionNode>( new ConstantValueExpression( new ORowSetValueDecorator( n ) ) ) ); + mpContext->maOperandStack.push( std::make_shared<ConstantValueExpression>( new ORowSetValueDecorator( n ) ) ); } }; @@ -212,7 +212,7 @@ public: rNodeStack.pop(); // create combined ExpressionNode - std::shared_ptr<ExpressionNode> pNode( new BinaryFunctionExpression( meFunct, pFirstArg, pSecondArg ) ); + auto pNode = std::make_shared<BinaryFunctionExpression>( meFunct, pFirstArg, pSecondArg ); // check for constness rNodeStack.push( pNode ); } @@ -260,7 +260,7 @@ public: std::shared_ptr<ExpressionNode> pArg( std::move(rNodeStack.top()) ); rNodeStack.pop(); - rNodeStack.push( std::shared_ptr<ExpressionNode>( new UnaryFunctionExpression( pArg ) ) ); + rNodeStack.push( std::make_shared<UnaryFunctionExpression>( pArg ) ); } }; diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx index f9e91f180763..5086f7e8500a 100644 --- a/connectivity/source/commontools/TTableHelper.cxx +++ b/connectivity/source/commontools/TTableHelper.cxx @@ -317,7 +317,7 @@ void OTableHelper::refreshPrimaryKeys(::std::vector< OUString>& _rNames) if ( xResult.is() ) { - std::shared_ptr<sdbcx::KeyProperties> pKeyProps(new sdbcx::KeyProperties(OUString(),KeyType::PRIMARY,0,0)); + auto pKeyProps = std::make_shared<sdbcx::KeyProperties>(OUString(),KeyType::PRIMARY,0,0); OUString aPkName; bool bAlreadyFetched = false; const Reference< XRow > xRow(xResult,UNO_QUERY); diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.cxx b/cppcanvas/source/mtfrenderer/bitmapaction.cxx index 94489145faed..84946014ef0b 100644 --- a/cppcanvas/source/mtfrenderer/bitmapaction.cxx +++ b/cppcanvas/source/mtfrenderer/bitmapaction.cxx @@ -201,10 +201,7 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr<Action>( new BitmapAction(rBmpEx, - rDstPoint, - rCanvas, - rState ) ); + return std::make_shared<BitmapAction>(rBmpEx, rDstPoint, rCanvas, rState ); } std::shared_ptr<Action> BitmapActionFactory::createBitmapAction( const ::BitmapEx& rBmpEx, @@ -213,11 +210,11 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr<Action>( new BitmapAction(rBmpEx, - rDstPoint, - rDstSize, - rCanvas, - rState ) ); + return std::make_shared<BitmapAction>(rBmpEx, + rDstPoint, + rDstSize, + rCanvas, + rState ); } } } diff --git a/cppcanvas/source/mtfrenderer/lineaction.cxx b/cppcanvas/source/mtfrenderer/lineaction.cxx index 7b0ba2080cf3..e032432e6848 100644 --- a/cppcanvas/source/mtfrenderer/lineaction.cxx +++ b/cppcanvas/source/mtfrenderer/lineaction.cxx @@ -145,10 +145,10 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr<Action>( new LineAction( rStartPoint, - rEndPoint, - rCanvas, - rState) ); + return std::make_shared<LineAction>( rStartPoint, + rEndPoint, + rCanvas, + rState); } } diff --git a/cppcanvas/source/mtfrenderer/pointaction.cxx b/cppcanvas/source/mtfrenderer/pointaction.cxx index 03000f85b329..38896151b52e 100644 --- a/cppcanvas/source/mtfrenderer/pointaction.cxx +++ b/cppcanvas/source/mtfrenderer/pointaction.cxx @@ -160,7 +160,7 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr<Action>( new PointAction( rPoint, rCanvas, rState ) ); + return std::make_shared<PointAction>( rPoint, rCanvas, rState ); } std::shared_ptr<Action> PointActionFactory::createPointAction( const ::basegfx::B2DPoint& rPoint, @@ -168,7 +168,7 @@ namespace cppcanvas const OutDevState& rState, const ::Color& rColor ) { - return std::shared_ptr<Action>( new PointAction( rPoint, rCanvas, rState, rColor ) ); + return std::make_shared<PointAction>( rPoint, rCanvas, rState, rColor ); } } } diff --git a/cppcanvas/source/mtfrenderer/polypolyaction.cxx b/cppcanvas/source/mtfrenderer/polypolyaction.cxx index 8fa1582b82c9..15fa4f5bc776 100644 --- a/cppcanvas/source/mtfrenderer/polypolyaction.cxx +++ b/cppcanvas/source/mtfrenderer/polypolyaction.cxx @@ -454,9 +454,9 @@ namespace cppcanvas { OSL_ENSURE( rState.isLineColorSet || rState.isFillColorSet, "PolyPolyActionFactory::createPolyPolyAction() with empty line and fill color" ); - return std::shared_ptr<Action>( new PolyPolyAction( rPoly, rCanvas, rState, - rState.isFillColorSet, - rState.isLineColorSet ) ); + return std::make_shared<PolyPolyAction>( rPoly, rCanvas, rState, + rState.isFillColorSet, + rState.isLineColorSet ); } std::shared_ptr<Action> PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, @@ -464,7 +464,7 @@ namespace cppcanvas const OutDevState& rState, const rendering::Texture& rTexture ) { - return std::shared_ptr<Action>( new TexturedPolyPolyAction( rPoly, rCanvas, rState, rTexture ) ); + return std::make_shared<TexturedPolyPolyAction>( rPoly, rCanvas, rState, rTexture ); } std::shared_ptr<Action> PolyPolyActionFactory::createLinePolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, @@ -474,9 +474,9 @@ namespace cppcanvas OSL_ENSURE( rState.isLineColorSet, "PolyPolyActionFactory::createLinePolyPolyAction() called with empty line color" ); - return std::shared_ptr<Action>( new PolyPolyAction( rPoly, rCanvas, rState, - false, - rState.isLineColorSet ) ); + return std::make_shared<PolyPolyAction>( rPoly, rCanvas, rState, + false, + rState.isLineColorSet ); } std::shared_ptr<Action> PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, @@ -486,7 +486,7 @@ namespace cppcanvas { OSL_ENSURE( rState.isLineColorSet, "PolyPolyActionFactory::createPolyPolyAction() for strokes called with empty line color" ); - return std::shared_ptr<Action>( new StrokedPolyPolyAction( rPoly, rCanvas, rState, rStrokeAttributes ) ); + return std::make_shared<StrokedPolyPolyAction>( rPoly, rCanvas, rState, rStrokeAttributes ); } std::shared_ptr<Action> PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, @@ -496,10 +496,10 @@ namespace cppcanvas { OSL_ENSURE( rState.isLineColorSet || rState.isFillColorSet, "PolyPolyActionFactory::createPolyPolyAction() with empty line and fill color" ); - return std::shared_ptr<Action>( new PolyPolyAction( rPoly, rCanvas, rState, - rState.isFillColorSet, - rState.isLineColorSet, - nTransparency ) ); + return std::make_shared<PolyPolyAction>( rPoly, rCanvas, rState, + rState.isFillColorSet, + rState.isLineColorSet, + nTransparency ); } } diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index f2b50e198606..93e54c11dba5 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -2075,8 +2075,7 @@ namespace cppcanvas if( rParms.maTextTransformation ) { - return std::shared_ptr<Action>( - new OutlineAction( + return std::make_shared<OutlineAction>( rStartPoint, rReliefOffset, rReliefColor, @@ -2088,12 +2087,11 @@ namespace cppcanvas rVDev, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); } else { - return std::shared_ptr<Action>( - new OutlineAction( + return std::make_shared<OutlineAction>( rStartPoint, rReliefOffset, rReliefColor, @@ -2104,7 +2102,7 @@ namespace cppcanvas aCharWidthSeq, rVDev, rCanvas, - rState ) ); + rState ); } } @@ -2192,31 +2190,31 @@ namespace cppcanvas // nope if( rParms.maTextTransformation ) { - ret = std::shared_ptr<Action>( new TextAction( + ret = std::make_shared<TextAction>( aStartPoint, rText, nStartPos, nLen, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); } else { - ret = std::shared_ptr<Action>( new TextAction( + ret = std::make_shared<TextAction>( aStartPoint, rText, nStartPos, nLen, rCanvas, - rState ) ); + rState ); } } else { // at least one of the effects requested if( rParms.maTextTransformation ) - ret = std::shared_ptr<Action>( new EffectTextAction( + ret = std::make_shared<EffectTextAction>( aStartPoint, aReliefOffset, rReliefColor, @@ -2229,9 +2227,9 @@ namespace cppcanvas rVDev, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); else - ret = std::shared_ptr<Action>( new EffectTextAction( + ret = std::make_shared<EffectTextAction>( aStartPoint, aReliefOffset, rReliefColor, @@ -2243,7 +2241,7 @@ namespace cppcanvas nLen, rVDev, rCanvas, - rState ) ); + rState ); } } else @@ -2258,7 +2256,7 @@ namespace cppcanvas { // nope if( rParms.maTextTransformation ) - ret = std::shared_ptr<Action>( new TextArrayAction( + ret = std::make_shared<TextArrayAction>( aStartPoint, rText, nStartPos, @@ -2266,22 +2264,22 @@ namespace cppcanvas aCharWidths, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); else - ret = std::shared_ptr<Action>( new TextArrayAction( + ret = std::make_shared<TextArrayAction>( aStartPoint, rText, nStartPos, nLen, aCharWidths, rCanvas, - rState ) ); + rState ); } else { // at least one of the effects requested if( rParms.maTextTransformation ) - ret = std::shared_ptr<Action>( new EffectTextArrayAction( + ret = std::make_shared<EffectTextArrayAction>( aStartPoint, aReliefOffset, rReliefColor, @@ -2295,9 +2293,9 @@ namespace cppcanvas rVDev, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); else - ret = std::shared_ptr<Action>( new EffectTextArrayAction( + ret = std::make_shared<EffectTextArrayAction>( aStartPoint, aReliefOffset, rReliefColor, @@ -2310,7 +2308,7 @@ namespace cppcanvas aCharWidths, rVDev, rCanvas, - rState ) ); + rState ); } } return ret; diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx index 09e5c200d04d..48be63ed8702 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx @@ -465,12 +465,12 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr<Action>( new TransparencyGroupAction(std::move(rGroupMtf), - std::move(rAlphaGradient), - rDstPoint, - rDstSize, - rCanvas, - rState ) ); + return std::make_shared<TransparencyGroupAction>(std::move(rGroupMtf), + std::move(rAlphaGradient), + rDstPoint, + rDstSize, + rCanvas, + rState ); } } diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 9f4f541b1388..e9c0ce9907f2 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -1391,11 +1391,11 @@ bool cppuhelper::ServiceManager::readLegacyRdbFile(OUString const & uri) { assert(implKey.getName().match("/IMPLEMENTATIONS/")); OUString name( implKey.getName().copy(RTL_CONSTASCII_LENGTH("/IMPLEMENTATIONS/"))); - std::shared_ptr< Data::Implementation > impl( - new Data::Implementation( + std::shared_ptr< Data::Implementation > impl = + std::make_shared<Data::Implementation>( name, readLegacyRdbString(uri, implKey, "UNO/ACTIVATOR"), readLegacyRdbString(uri, implKey, "UNO/LOCATION"), "", "", "", - css::uno::Reference< css::uno::XComponentContext >(), uri)); + css::uno::Reference< css::uno::XComponentContext >(), uri); if (!data_.namedImplementations.emplace(name, impl).second) { throw css::registry::InvalidRegistryException( @@ -1520,8 +1520,8 @@ void cppuhelper::ServiceManager::insertLegacyFactory( } css::uno::Reference< css::lang::XComponent > comp( factoryInfo, css::uno::UNO_QUERY); - std::shared_ptr< Data::Implementation > impl( - new Data::Implementation(name, f1, f2, comp)); + std::shared_ptr< Data::Implementation > impl = + std::make_shared<Data::Implementation>(name, f1, f2, comp); Data extra; if (!name.isEmpty()) { extra.namedImplementations.emplace(name, impl); diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 265ee489912e..21726bb73c7c 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -793,7 +793,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFileTypeHdl, weld::ComboBox&, vo void TPGalleryThemeProperties::SearchFiles() { - std::shared_ptr<SearchProgress> xProgress(new SearchProgress(GetFrameWeld(), this, aURL)); + auto xProgress = std::make_shared<SearchProgress>(GetFrameWeld(), this, aURL); aFoundList.clear(); m_xLbxFound->clear(); @@ -846,7 +846,7 @@ void TPGalleryThemeProperties::TakeFiles() { if (m_xLbxFound->count_selected_rows() || (bTakeAll && bEntriesFound)) { - std::shared_ptr<TakeProgress> xTakeProgress(new TakeProgress(GetFrameWeld(), this)); + auto xTakeProgress = std::make_shared<TakeProgress>(GetFrameWeld(), this); xTakeProgress->LaunchThread(); weld::DialogController::runAsync(xTakeProgress, [=](sal_Int32 /*nResult*/) { /* no postprocessing needed, pTakeProgress diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 728c3c68d258..bb1b4fbc196b 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -577,7 +577,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void ) OUString sPropertyType = m_xPrefBox->get_text(*m_xScratchIter, 2); OUString sPropertyValue = m_xPrefBox->get_text(*m_xScratchIter, 3); - std::shared_ptr< Prop_Impl > pProperty (new Prop_Impl( pUserData->sPropertyPath, sPropertyName, Any( sPropertyValue ) ) ); + auto pProperty = std::make_shared<Prop_Impl>( pUserData->sPropertyPath, sPropertyName, Any( sPropertyValue ) ); bool bSaveChanges = false; bool bOpenDialog = true; diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 06e7b1c9976a..17cd3780ee77 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -927,7 +927,7 @@ bool OTableController::checkColumns(bool _bNew) { case RET_YES: { - std::shared_ptr<OTableRow> pNewRow(new OTableRow()); + auto pNewRow = std::make_shared<OTableRow>(); TOTypeInfoSP pTypeInfo = ::dbaui::queryPrimaryKeyType(m_aTypeInfo); if ( !pTypeInfo.get() ) break; @@ -1503,7 +1503,7 @@ sal_Int32 OTableController::getFirstEmptyRowPosition() if (!bFoundElem) { bool bReadRow = !isAddAllowed(); - std::shared_ptr<OTableRow> pTabEdRow(new OTableRow()); + auto pTabEdRow = std::make_shared<OTableRow>(); pTabEdRow->SetReadOnly(bReadRow); nRet = m_vRowList.size(); m_vRowList.push_back( pTabEdRow); diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 7b4aafb3b083..baa5e716f4bd 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -78,8 +78,7 @@ struct UnoRc : public rtl::StaticWithInit< std::shared_ptr<rtl::Bootstrap> operator () () { OUString unorc( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("louno") ); ::rtl::Bootstrap::expandMacros( unorc ); - std::shared_ptr< ::rtl::Bootstrap > ret( - new ::rtl::Bootstrap( unorc ) ); + auto ret = std::make_shared<::rtl::Bootstrap>( unorc ); OSL_ASSERT( ret->getHandle() != nullptr ); return ret; } diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 9d49d871193c..c2fda0f6c0cf 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -218,7 +218,7 @@ std::shared_ptr<editeng::SharedVclResources> EditDLL::GetSharedVclResources() SolarMutexGuard g; auto pLocked(pSharedVcl.lock()); if(!pLocked) - pSharedVcl = pLocked = std::shared_ptr<editeng::SharedVclResources>(new editeng::SharedVclResources()); + pSharedVcl = pLocked = std::make_shared<editeng::SharedVclResources>(); return pLocked; } diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index f50f41a83717..669585526918 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -2109,7 +2109,7 @@ namespace emfio void MtfTools::Push() // !! to be able to access the original ClipRegion it { // is not allowed to use the MetaPushAction() UpdateClipRegion(); // (the original clip region is on top of the stack) (SJ) - std::shared_ptr<SaveStruct> pSave( new SaveStruct ); + auto pSave = std::make_shared<SaveStruct>(); pSave->aLineStyle = maLineStyle; pSave->aFillStyle = maFillStyle; @@ -2149,7 +2149,7 @@ namespace emfio if( !mvSaveStack.empty() ) { // Backup the current data on the stack - std::shared_ptr<SaveStruct> pSave( mvSaveStack.back() ); + std::shared_ptr<SaveStruct>& pSave( mvSaveStack.back() ); maLineStyle = pSave->aLineStyle; maFillStyle = pSave->aFillStyle; diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index 83df6c32d5d2..bd261d694c85 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -217,7 +217,7 @@ Sequence< ScannerContext > ScannerManager::getAvailableScanners() if( rSanes.empty() ) { - std::shared_ptr<SaneHolder> pSaneHolder(new SaneHolder); + auto pSaneHolder = std::make_shared<SaneHolder>(); if( Sane::IsSane() ) rSanes.push_back( pSaneHolder ); } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 97577199628c..dca72ee06689 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4962,8 +4962,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r // otherwise, just finalize here if (size_t(nCalledByGroup) > maPendingGroupData.size()) { - std::shared_ptr<DffRecordHeader> rHdClone(new DffRecordHeader(aObjData.rSpHd)); - maPendingGroupData.emplace_back(DffObjData(rHdClone, aObjData), rHdClone ); + auto xHdClone = std::make_shared<DffRecordHeader>(aObjData.rSpHd); + maPendingGroupData.emplace_back(DffObjData(xHdClone, aObjData), xHdClone ); } else { @@ -5374,8 +5374,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, // the object with a frame, otherwise if( bTextFrame ) { - std::shared_ptr<SvxMSDffShapeInfo> const pTmpRec( - new SvxMSDffShapeInfo(0, pImpRec->nShapeId)); + auto const pTmpRec = std::make_shared<SvxMSDffShapeInfo>(0, pImpRec->nShapeId); SvxMSDffShapeInfos_ById::const_iterator const it = m_xShapeInfosById->find(pTmpRec); @@ -6374,8 +6373,7 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt, bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape, SvxMSDffImportData& rData) { - std::shared_ptr<SvxMSDffShapeInfo> const pTmpRec( - new SvxMSDffShapeInfo(0, nId)); + auto const pTmpRec = std::make_shared<SvxMSDffShapeInfo>(0, nId); SvxMSDffShapeInfos_ById::const_iterator const it = m_xShapeInfosById->find(pTmpRec); diff --git a/include/oox/ole/axcontrol.hxx b/include/oox/ole/axcontrol.hxx index 0be97b5043f3..ec2555a4dfed 100644 --- a/include/oox/ole/axcontrol.hxx +++ b/include/oox/ole/axcontrol.hxx @@ -938,7 +938,7 @@ private: template< typename ModelType > inline ModelType& EmbeddedControl::createModel() { - std::shared_ptr< ModelType > xModel( new ModelType ); + auto xModel = std::make_shared<ModelType>(); mxModel = xModel; xModel->setFormComponentMode(); return *xModel; @@ -947,7 +947,7 @@ inline ModelType& EmbeddedControl::createModel() template< typename ModelType, typename ParamType > inline ModelType& EmbeddedControl::createModel( const ParamType& rParam ) { - std::shared_ptr< ModelType > xModel( new ModelType( rParam ) ); + auto xModel = std::make_shared<ModelType>( rParam ); mxModel = xModel; xModel->setFormComponentMode(); return *xModel; diff --git a/include/oox/vml/vmlshapecontainer.hxx b/include/oox/vml/vmlshapecontainer.hxx index ff39d5f7212c..6be9020051c2 100644 --- a/include/oox/vml/vmlshapecontainer.hxx +++ b/include/oox/vml/vmlshapecontainer.hxx @@ -125,7 +125,7 @@ private: template< typename ShapeT > std::shared_ptr<ShapeT> ShapeContainer::createShape() { - std::shared_ptr< ShapeT > xShape( new ShapeT( mrDrawing ) ); + auto xShape = std::make_shared<ShapeT>( mrDrawing ); maShapes.push_back( xShape ); return xShape; } diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index f86847008cab..6ede806a526e 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -678,7 +678,7 @@ void HyphenatorDispatcher::SetServiceList( const Locale &rLocale, } else { - std::shared_ptr< LangSvcEntries_Hyph > pTmpEntry( new LangSvcEntries_Hyph( rSvcImplNames[0] ) ); + auto pTmpEntry = std::make_shared<LangSvcEntries_Hyph>( rSvcImplNames[0] ); pTmpEntry->aSvcRefs = Sequence< Reference < XHyphenator > >( 1 ); aSvcMap[ nLanguage ] = pTmpEntry; } diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 42ae281fd917..a1390c916c77 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -779,7 +779,7 @@ void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale, } else { - std::shared_ptr< LangSvcEntries_Spell > pTmpEntry( new LangSvcEntries_Spell( rSvcImplNames ) ); + auto pTmpEntry = std::make_shared<LangSvcEntries_Spell>( rSvcImplNames ); pTmpEntry->aSvcRefs = Sequence< Reference < XSpellChecker > >( nLen ); m_aSvcMap[ nLanguage ] = pTmpEntry; } diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx index 968136898cc0..284673d641a7 100644 --- a/linguistic/source/thesdsp.cxx +++ b/linguistic/source/thesdsp.cxx @@ -212,7 +212,7 @@ void ThesaurusDispatcher::SetServiceList( const Locale &rLocale, } else { - std::shared_ptr< LangSvcEntries_Thes > pTmpEntry( new LangSvcEntries_Thes( rSvcImplNames ) ); + auto pTmpEntry = std::make_shared<LangSvcEntries_Thes>( rSvcImplNames ); pTmpEntry->aSvcRefs = Sequence< Reference < XThesaurus > >( nLen ); aSvcMap[ nLanguage ] = pTmpEntry; } diff --git a/oox/source/drawingml/diagram/constraintlistcontext.cxx b/oox/source/drawingml/diagram/constraintlistcontext.cxx index cc71c89b226a..42cefee41d28 100644 --- a/oox/source/drawingml/diagram/constraintlistcontext.cxx +++ b/oox/source/drawingml/diagram/constraintlistcontext.cxx @@ -49,7 +49,7 @@ ConstraintListContext::onCreateContext( ::sal_Int32 aElement, { case DGM_TOKEN( constr ): { - std::shared_ptr< ConstraintAtom > pNode( new ConstraintAtom(mpNode->getLayoutNode()) ); + auto pNode = std::make_shared<ConstraintAtom>(mpNode->getLayoutNode()); LayoutAtom::connect(mpNode, pNode); Constraint& rConstraint = pNode->getConstraint(); diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx index ab1659d8ada9..219128c7f6e0 100644 --- a/oox/source/drawingml/textbody.cxx +++ b/oox/source/drawingml/textbody.cxx @@ -45,7 +45,7 @@ TextBody::TextBody( const TextBodyPtr& pBody ) TextParagraph& TextBody::addParagraph() { - std::shared_ptr< TextParagraph > xPara( new TextParagraph ); + auto xPara = std::make_shared<TextParagraph>(); maParagraphs.push_back( xPara ); return *xPara; } diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx index 0f8c90ab4c89..d0f8769cc962 100644 --- a/oox/source/drawingml/textbodycontext.cxx +++ b/oox/source/drawingml/textbodycontext.cxx @@ -84,7 +84,7 @@ ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken } case A_TOKEN( fld ): // "CT_TextField" Text Field. { - std::shared_ptr< TextField > pField( new TextField ); + auto pField = std::make_shared<TextField>(); mrParagraph.addRun( pField ); return new TextFieldContext( *this, rAttribs, *pField ); } diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index 251fff8ab78e..b445a3eec703 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -101,7 +101,7 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken return new PPTShapeGroupContext( *this, mpSlidePersistPtr, meShapeLocation, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) ) ); case PPT_TOKEN( sp ): // Shape { - std::shared_ptr<PPTShape> pShape( new PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) ); + auto pShape = std::make_shared<PPTShape>( meShapeLocation, "com.sun.star.drawing.CustomShape" ); bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false); pShape->setUseBgFill(bUseBgFill); if (bUseBgFill) diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 23041d6cee48..acc8624af602 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -123,9 +123,8 @@ uno::Reference<xml::sax::XFastContextHandler> const & ShapeContextHandler::getWp *rFragmentHandler, xShape, pMasterShape, - ShapePtr( - new oox::drawingml::Shape( - "com.sun.star.drawing.CustomShape")))); + std::make_shared<oox::drawingml::Shape>( + "com.sun.star.drawing.CustomShape"))); break; default: break; @@ -160,8 +159,7 @@ ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element ) { if (! mxGraphicShapeContext.is()) { - std::shared_ptr<ContextHandler2Helper> pFragmentHandler - (new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath)); + auto pFragmentHandler = std::make_shared<ShapeFragmentHandler>(*mxFilterBase, msRelationFragmentPath); ShapePtr pMasterShape; switch (Element & 0xffff) @@ -216,7 +214,7 @@ ShapeContextHandler::getDiagramShapeContext() { if (!mxDiagramShapeContext.is()) { - std::shared_ptr<ContextHandler2Helper> pFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath)); + auto pFragmentHandler = std::make_shared<ShapeFragmentHandler>(*mxFilterBase, msRelationFragmentPath); mpShape.reset(new Shape()); mxDiagramShapeContext.set(new DiagramGraphicDataContext(*pFragmentHandler, mpShape)); } diff --git a/oox/source/vml/vmlshapecontainer.cxx b/oox/source/vml/vmlshapecontainer.cxx index e8008a1f4638..71713d3e7120 100644 --- a/oox/source/vml/vmlshapecontainer.cxx +++ b/oox/source/vml/vmlshapecontainer.cxx @@ -61,7 +61,7 @@ ShapeContainer::~ShapeContainer() std::shared_ptr<ShapeType> ShapeContainer::createShapeType() { - std::shared_ptr< ShapeType > xShape( new ShapeType( mrDrawing ) ); + auto xShape = std::make_shared<ShapeType>( mrDrawing ); maTypes.push_back( xShape ); return xShape; } diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 0c132a93be48..64399bd9117c 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -251,7 +251,7 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) { static TPropertyNamePair s_aNameMap = [&]() { - std::shared_ptr<AnyConverter> aNoConverter(new AnyConverter); + auto aNoConverter = std::make_shared<AnyConverter>(); TPropertyNamePair tmp; tmp.emplace(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)); tmp.emplace(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)); @@ -265,7 +265,7 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) { static TPropertyNamePair s_aNameMap = [&]() { - std::shared_ptr<AnyConverter> aNoConverter(new AnyConverter); + auto aNoConverter = std::make_shared<AnyConverter>(); TPropertyNamePair tmp; tmp.emplace(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter)); tmp.emplace(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)); @@ -277,7 +277,7 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) tmp.emplace(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)); tmp.emplace(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)); - std::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust); + auto aParaAdjust = std::make_shared<ParaAdjust>(); tmp.emplace(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust)); return tmp; }(); @@ -287,7 +287,7 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) { static TPropertyNamePair s_aNameMap = [&]() { - std::shared_ptr<AnyConverter> aNoConverter(new AnyConverter); + auto aNoConverter = std::make_shared<AnyConverter>(); TPropertyNamePair tmp; tmp.emplace(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter)); tmp.emplace(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)); @@ -298,7 +298,7 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) tmp.emplace(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter)); tmp.emplace(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)); tmp.emplace(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)); - std::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust); + auto aParaAdjust = std::make_shared<ParaAdjust>(); tmp.emplace(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust)); return tmp; }(); @@ -309,7 +309,7 @@ const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId) { static TPropertyNamePair s_aNameMap = [&]() { - std::shared_ptr<AnyConverter> aNoConverter(new AnyConverter); + auto aNoConverter = std::make_shared<AnyConverter>(); TPropertyNamePair tmp; tmp.emplace(OUString("FillColor"),TPropertyConverter(PROPERTY_CONTROLBACKGROUND,aNoConverter)); tmp.emplace(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter)); diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx index 90123eef170e..c6ed5b1836d9 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -146,7 +146,7 @@ void SAL_CALL DataProviderHandler::inspect(const uno::Reference< uno::XInterface m_xReportComponent.set( xNameCont->getByName("ReportComponent"), uno::UNO_QUERY ); if ( m_xDataProvider.is() ) { - std::shared_ptr<AnyConverter> aNoConverter(new AnyConverter); + auto aNoConverter = std::make_shared<AnyConverter>(); TPropertyNamePair aPropertyMediation; aPropertyMediation.emplace( PROPERTY_MASTERFIELDS, TPropertyConverter(PROPERTY_MASTERFIELDS,aNoConverter) ); aPropertyMediation.emplace( PROPERTY_DETAILFIELDS, TPropertyConverter(PROPERTY_DETAILFIELDS,aNoConverter) ); diff --git a/reportdesign/source/ui/misc/FunctionHelper.cxx b/reportdesign/source/ui/misc/FunctionHelper.cxx index 9002e4b8cfb1..f42e65cc204b 100644 --- a/reportdesign/source/ui/misc/FunctionHelper.cxx +++ b/reportdesign/source/ui/misc/FunctionHelper.cxx @@ -63,7 +63,7 @@ const formula::IFunctionCategory* FunctionManager::getCategory(sal_uInt32 _nPos) if ( _nPos >= m_aCategoryIndex.size() ) { uno::Reference< report::meta::XFunctionCategory> xCategory = m_xMgr->getCategory(_nPos); - std::shared_ptr< FunctionCategory > pCategory(new FunctionCategory(this,_nPos + 1,xCategory)); + auto pCategory = std::make_shared<FunctionCategory>(this,_nPos + 1,xCategory); m_aCategoryIndex.push_back( m_aCategories.emplace(xCategory->getName(),pCategory).first ); } return m_aCategoryIndex[_nPos]->second.get(); diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index dd938af56233..1fe36c88effb 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -1077,7 +1077,7 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula uno::Reference< report::meta::XFunctionManager> xMgr(xFactory->createInstanceWithContext("org.libreoffice.report.pentaho.SOFunctionManager",_xContext),uno::UNO_QUERY); if ( xMgr.is() ) { - std::shared_ptr< formula::IFunctionManager > pFormulaManager(new FunctionManager(xMgr) ); + auto pFormulaManager = std::make_shared<FunctionManager>(xMgr); ReportFormula aFormula( _in_out_rFormula ); LanguageTag aLangTag(LANGUAGE_SYSTEM); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 231898b54b4e..21f1a1021a9f 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -2953,7 +2953,7 @@ uno::Reference< sdbc::XRowSet > const & OReportController::getRowSet() xRowSetProp->setPropertyValue( PROPERTY_ACTIVECONNECTION, uno::makeAny( getConnection() ) ); xRowSetProp->setPropertyValue( PROPERTY_APPLYFILTER, uno::makeAny( true ) ); - std::shared_ptr<AnyConverter> aNoConverter(new AnyConverter); + auto aNoConverter = std::make_shared<AnyConverter>(); TPropertyNamePair aPropertyMediation; aPropertyMediation.emplace( PROPERTY_COMMAND, TPropertyConverter(PROPERTY_COMMAND,aNoConverter) ); aPropertyMediation.emplace( PROPERTY_COMMANDTYPE, TPropertyConverter(PROPERTY_COMMANDTYPE,aNoConverter) ); diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index cd07e7425c71..5a846cf516b7 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -478,13 +478,13 @@ namespace sax_fastparser { { if (rOrder.hasElements()) { - std::shared_ptr< ForMerge > pSort( new ForSort(nTag, rOrder) ); + auto pSort = std::make_shared<ForSort>(nTag, rOrder); maMarkStack.push( pSort ); maCachedOutputStream.setOutput( pSort ); } else { - std::shared_ptr< ForMerge > pMerge( new ForMerge(nTag) ); + auto pMerge = std::make_shared<ForMerge>(nTag); maMarkStack.push( pMerge ); maCachedOutputStream.setOutput( pMerge ); } diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx index 5629ee010b89..070721dcd091 100644 --- a/sc/qa/extras/scpdfexport.cxx +++ b/sc/qa/extras/scpdfexport.cxx @@ -146,7 +146,7 @@ std::shared_ptr<utl::TempFile> ScPDFExportTest::exportToPDF(const uno::Reference<frame::XModel>& xModel, const ScRange& range) { // create temp file name - std::shared_ptr<utl::TempFile> pTempFile(new utl::TempFile()); + auto pTempFile = std::make_shared<utl::TempFile>(); pTempFile->EnableKillingFile(); OUString sFileURL = pTempFile->GetURL(); // Note: under Windows path path should be with "/" delimiters instead of "\\" diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 73540c9a4233..cc675cdb593d 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -573,11 +573,11 @@ ScDocShellRef ScBootstrapFixture::load( bool bReadWrite, const OUString& rTypeName, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, sal_uIntPtr nFilterVersion, const OUString* pPassword ) { - std::shared_ptr<const SfxFilter> pFilter(new SfxFilter( + auto pFilter = std::make_shared<SfxFilter>( rFilter, OUString(), nFilterFlags, nClipboardID, rTypeName, OUString(), - rUserData, "private:factory/scalc")); - const_cast<SfxFilter*>(pFilter.get())->SetVersion(nFilterVersion); + rUserData, "private:factory/scalc"); + pFilter->SetVersion(nFilterVersion); ScDocShellRef xDocShRef = new ScDocShell; xDocShRef->GetDocument().EnableUserInteraction(false); @@ -668,11 +668,11 @@ ScDocShellRef ScBootstrapFixture::saveAndReload( SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (nFormatType == ODS_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARCHART_8; - std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter( + auto pExportFilter = std::make_shared<SfxFilter>( rFilter, OUString(), nFormatType, nExportFormat, rTypeName, OUString(), - rUserData, "private:factory/scalc*" )); - const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + rUserData, "private:factory/scalc*" ); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); aStoreMedium.SetFilter(pExportFilter); pShell->DoSaveAs( aStoreMedium ); pShell->DoClose(); @@ -707,18 +707,18 @@ std::shared_ptr<utl::TempFile> ScBootstrapFixture::saveAs( ScDocShell* pShell, s OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); - std::shared_ptr<utl::TempFile> pTempFile(new utl::TempFile()); + auto pTempFile = std::make_shared<utl::TempFile>(); pTempFile->EnableKillingFile(); SfxMedium aStoreMedium( pTempFile->GetURL(), StreamMode::STD_WRITE ); SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; SfxFilterFlags nFormatType = aFileFormats[nFormat].nFormatType; if (nFormatType == ODS_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARCHART_8; - std::shared_ptr<SfxFilter> pExportFilter(new SfxFilter( + auto pExportFilter = std::make_shared<SfxFilter>( aFilterName, OUString(), nFormatType, nExportFormat, aFilterType, OUString(), - OUString(), "private:factory/scalc*" )); - pExportFilter.get()->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + OUString(), "private:factory/scalc*" ); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); aStoreMedium.SetFilter(pExportFilter); pShell->DoSaveAs( aStoreMedium ); diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index d10dc4244a0e..1fe48fb464c3 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -417,11 +417,11 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const OUSt SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (nFormatType == ODS_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARCHART_8; - std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter( + auto pExportFilter = std::make_shared<SfxFilter>( rFilter, OUString(), nFormatType, nExportFormat, rTypeName, OUString(), - rUserData, "private:factory/scalc*" )); - const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + rUserData, "private:factory/scalc*" ); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); aStoreMedium.SetFilter(pExportFilter); SfxItemSet* pExportSet = aStoreMedium.GetItemSet(); uno::Sequence< beans::NamedValue > aEncryptionData = comphelper::OStorageHelper::CreatePackageEncryptionData( "test" ); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index e3c7bfae4d82..5c15ee25b470 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1628,13 +1628,13 @@ void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase) createFileURL(aFileNameBase, aFileExtension, aFileName); OUString aFilterType(getFileFormats()[0].pTypeName, strlen(getFileFormats()[0].pTypeName), RTL_TEXTENCODING_UTF8); - std::shared_ptr<const SfxFilter> pFilter(new SfxFilter( + auto pFilter = std::make_shared<SfxFilter>( aFilterName, OUString(), getFileFormats()[0].nFormatType, SotClipboardFormatId::STARCALC_8, aFilterType, OUString(), - OUString(), "private:factory/scalc*" )); - const_cast<SfxFilter*>(pFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + OUString(), "private:factory/scalc*" ); + pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); ScDocShellRef xDocSh = new ScDocShell; SfxMedium* pMedium = new SfxMedium(aFileName, StreamMode::STD_READWRITE); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 268475df4d1c..5d3cbcbd99e7 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2278,8 +2278,7 @@ class UpdateRefOnNonCopy // Make sure that the start and end listening contexts share the // same block position set, else an invalid iterator may ensue. - std::shared_ptr<sc::ColumnBlockPositionSet> pPosSet( - new sc::ColumnBlockPositionSet(mpCxt->mrDoc)); + auto pPosSet = std::make_shared<sc::ColumnBlockPositionSet>(mpCxt->mrDoc); sc::StartListeningContext aStartCxt(mpCxt->mrDoc, pPosSet); sc::EndListeningContext aEndCxt(mpCxt->mrDoc, pPosSet, pOldCode.get()); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index f417b63d4b0a..29eb7d51a90f 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -345,7 +345,7 @@ void ScColumn::StartListeningUnshared( const std::vector<SCROW>& rNewSharedRows ScDocument* pDoc = GetDoc(); if (!rNewSharedRows.empty() && !pDoc->IsDelayedFormulaGrouping()) { - std::shared_ptr<sc::ColumnBlockPositionSet> pPosSet(new sc::ColumnBlockPositionSet(*pDoc)); + auto pPosSet = std::make_shared<sc::ColumnBlockPositionSet>(*pDoc); sc::StartListeningContext aStartCxt(*pDoc, pPosSet); sc::EndListeningContext aEndCxt(*pDoc, pPosSet); if (rNewSharedRows.size() >= 2) @@ -621,7 +621,7 @@ void ScColumn::AttachNewFormulaCell( { case sc::ConvertToGroupListening: { - std::shared_ptr<sc::ColumnBlockPositionSet> pPosSet(new sc::ColumnBlockPositionSet(*pDocument)); + auto pPosSet = std::make_shared<sc::ColumnBlockPositionSet>(*pDocument); sc::StartListeningContext aStartCxt(*pDocument, pPosSet); sc::EndListeningContext aEndCxt(*pDocument, pPosSet); SCROW nStartRow, nEndRow; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3f87a7f24a98..a7071416eb6e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2576,8 +2576,7 @@ void ScDocument::StartListeningFromClip( SCCOL nCol1, SCROW nRow1, { if (nInsFlag & InsertDeleteFlags::CONTENTS) { - std::shared_ptr<sc::ColumnBlockPositionSet> pSet( - new sc::ColumnBlockPositionSet(*this)); + auto pSet = std::make_shared<sc::ColumnBlockPositionSet>(*this); sc::StartListeningContext aStartCxt(*this, pSet); sc::EndListeningContext aEndCxt(*this, pSet, nullptr); @@ -2701,7 +2700,7 @@ void ScDocument::CopyBlockFromClip( /* TODO: holding the ColumnSet in a shared_ptr at * RefUpdateContext would eliminate the need of * copying it here. */ - std::shared_ptr<const sc::ColumnSet> pColSet( new sc::ColumnSet( aRefCxt.maRegroupCols)); + auto pColSet = std::make_shared<sc::ColumnSet>( aRefCxt.maRegroupCols); StartNeededListeners( pColSet); } diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index 2cdc71b3374a..8b1496943081 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -226,7 +226,7 @@ void ScDocument::SwapNonEmpty( sc::TableValues& rValues ) if (!rRange.IsValid()) return; - std::shared_ptr<sc::ColumnBlockPositionSet> pPosSet(new sc::ColumnBlockPositionSet(*this)); + auto pPosSet = std::make_shared<sc::ColumnBlockPositionSet>(*this); sc::StartListeningContext aStartCxt(*this, pPosSet); sc::EndListeningContext aEndCxt(*this, pPosSet); @@ -501,7 +501,7 @@ void ScDocument::StartAllListeners( const ScRange& rRange ) if (IsClipOrUndo() || GetNoListening()) return; - std::shared_ptr<sc::ColumnBlockPositionSet> pPosSet(new sc::ColumnBlockPositionSet(*this)); + auto pPosSet = std::make_shared<sc::ColumnBlockPositionSet>(*this); sc::StartListeningContext aStartCxt(*this, pPosSet); sc::EndListeningContext aEndCxt(*this, pPosSet); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 8f1756b23e1b..73b236df1f48 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -717,7 +717,7 @@ ScDPTableData* ScDPObject::GetTableData() // grouping (for cell or database data) if (pData && pDimData) { - shared_ptr<ScDPGroupTableData> pGroupData(new ScDPGroupTableData(pData, pDoc)); + auto pGroupData = std::make_shared<ScDPGroupTableData>(pData, pDoc); pDimData->WriteToData(*pGroupData); pData = pGroupData; } @@ -839,14 +839,14 @@ void ScDPObject::ReloadGroupTableData() // This is already a group table data. Salvage the source data and // re-create a new group data. const shared_ptr<ScDPTableData>& pSource = pData->GetSourceTableData(); - shared_ptr<ScDPGroupTableData> pGroupData(new ScDPGroupTableData(pSource, pDoc)); + auto pGroupData = std::make_shared<ScDPGroupTableData>(pSource, pDoc); pDimData->WriteToData(*pGroupData); mpTableData = pGroupData; } else { // This is a source data. Create a group data based on it. - shared_ptr<ScDPGroupTableData> pGroupData(new ScDPGroupTableData(mpTableData, pDoc)); + auto pGroupData = std::make_shared<ScDPGroupTableData>(mpTableData, pDoc); pDimData->WriteToData(*pGroupData); mpTableData = pGroupData; } diff --git a/sc/source/core/data/dpresfilter.cxx b/sc/source/core/data/dpresfilter.cxx index 1e6da5ee3410..6a1cef68b5a9 100644 --- a/sc/source/core/data/dpresfilter.cxx +++ b/sc/source/core/data/dpresfilter.cxx @@ -124,7 +124,7 @@ void ScDPResultTree::add( if (itMem == rMembersValueNames.end()) { // New member. Insert it. - std::shared_ptr<MemberNode> pNode( new MemberNode); + auto pNode = std::make_shared<MemberNode>(); std::pair<MembersType::iterator, bool> r = rMembersValueNames.emplace(aUpperName, pNode); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 5aab834a1fed..b18752ca3a8a 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -1243,7 +1243,7 @@ void ScTable::FillFormulaVertical( aCol[nCol].DeleteRanges(aSpans, InsertDeleteFlags::VALUE | InsertDeleteFlags::DATETIME | InsertDeleteFlags::STRING | InsertDeleteFlags::FORMULA | InsertDeleteFlags::OUTLINE); aCol[nCol].CloneFormulaCell(rSrcCell, sc::CellTextAttr(), aSpans); - std::shared_ptr<sc::ColumnBlockPositionSet> pSet(new sc::ColumnBlockPositionSet(*pDocument)); + auto pSet = std::make_shared<sc::ColumnBlockPositionSet>(*pDocument); sc::StartListeningContext aStartCxt(*pDocument, pSet); sc::EndListeningContext aEndCxt(*pDocument, pSet); diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 4d9975d034cc..35e333fc4a7f 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -431,7 +431,7 @@ void ExcTable::FillAsTableBinary( SCTAB nCodeNameIdx ) } // WSBOOL needs data from page settings, create it here, add it later - std::shared_ptr< XclExpPageSettings > xPageSett( new XclExpPageSettings( GetRoot() ) ); + auto xPageSett = std::make_shared<XclExpPageSettings>( GetRoot() ); bool bFitToPages = xPageSett->GetPageData().mbFitToPages; if( eBiff <= EXC_BIFF5 ) @@ -572,7 +572,7 @@ void ExcTable::FillAsTableXml() } // WSBOOL needs data from page settings, create it here, add it later - std::shared_ptr< XclExpPageSettings > xPageSett( new XclExpPageSettings( GetRoot() ) ); + auto xPageSett = std::make_shared<XclExpPageSettings>( GetRoot() ); XclExtLstRef xExtLst( new XclExtLst( GetRoot() ) ); bool bFitToPages = xPageSett->GetPageData().mbFitToPages; diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 65fa3f896e31..5bb9d0bb61f8 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1122,7 +1122,7 @@ void XclExpChartObj::SaveXml( XclExpXmlStream& rStrm ) { XclObjAny::WriteFromTo( rStrm, mxShape, GetTab() ); ChartExport aChartExport(XML_xdr, pDrawing, mxChartDoc, &rStrm, drawingml::DOCUMENT_XLSX); - std::shared_ptr<oox::drawingml::URLTransformer> pURLTransformer(new ScURLTransformer(*mpDoc)); + auto pURLTransformer = std::make_shared<ScURLTransformer>(*mpDoc); aChartExport.SetURLTranslator(pURLTransformer); static sal_Int32 nChartCount = 0; nChartCount++; @@ -1489,7 +1489,7 @@ XclExpDffAnchorBase* XclExpObjectManager::CreateDffAnchor() const std::shared_ptr< XclExpRecordBase > XclExpObjectManager::CreateDrawingGroup() { - return std::shared_ptr< XclExpRecordBase >( new XclExpMsoDrawingGroup( *mxEscherEx ) ); + return std::make_shared<XclExpMsoDrawingGroup>( *mxEscherEx ); } void XclExpObjectManager::StartSheet() diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index d654f38ab133..82e4ac0ddccb 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -4204,7 +4204,7 @@ void XclImpSheetDrawing::ReadNote( XclImpStream& rStrm ) void XclImpSheetDrawing::ReadTabChart( XclImpStream& rStrm ) { OSL_ENSURE_BIFF( GetBiff() >= EXC_BIFF5 ); - std::shared_ptr< XclImpChartObj > xChartObj( new XclImpChartObj( GetRoot(), true ) ); + auto xChartObj = std::make_shared<XclImpChartObj>( GetRoot(), true ); xChartObj->ReadChartSubStream( rStrm ); // insert the chart as raw object without connected DFF data AppendRawObject( xChartObj ); diff --git a/sc/source/filter/oox/worksheetbuffer.cxx b/sc/source/filter/oox/worksheetbuffer.cxx index 59872603cb7f..ade90452d21f 100644 --- a/sc/source/filter/oox/worksheetbuffer.cxx +++ b/sc/source/filter/oox/worksheetbuffer.cxx @@ -221,7 +221,7 @@ void WorksheetBuffer::insertSheet( const SheetInfoModel& rModel ) { sal_Int32 nWorksheet = static_cast< sal_Int32 >( maSheetInfos.size() ); IndexNamePair aIndexName = createSheet( rModel.maName, nWorksheet ); - std::shared_ptr< SheetInfo > xSheetInfo( new SheetInfo( rModel, aIndexName.first, aIndexName.second ) ); + auto xSheetInfo = std::make_shared<SheetInfo>( rModel, aIndexName.first, aIndexName.second ); maSheetInfos.push_back( xSheetInfo ); maSheetInfosByName[ rModel.maName ] = xSheetInfo; maSheetInfosByName[ lclQuoteName( rModel.maName ) ] = xSheetInfo; diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index 5a58fa68d4bd..3cc4881b23c2 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -85,7 +85,7 @@ SvStream* XclEscherExGlobal::ImplQueryPictureStream() } XclEscherEx::XclEscherEx( const XclExpRoot& rRoot, XclExpObjectManager& rObjMgr, SvStream& rStrm, const XclEscherEx* pParent ) : - EscherEx( pParent ? pParent->mxGlobal : std::shared_ptr<EscherExGlobal>( new XclEscherExGlobal( rRoot ) ), &rStrm ), + EscherEx( pParent ? pParent->mxGlobal : std::make_shared<XclEscherExGlobal>( rRoot ), &rStrm ), XclExpRoot( rRoot ), mrObjMgr( rObjMgr ), pCurrXclObj( nullptr ), diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index c880da8ab417..dfbe894ab4f8 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1187,7 +1187,7 @@ void XclObjAny::SaveXml( XclExpXmlStream& rStrm ) sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream(); ShapeExport aDML(XML_xdr, pDrawing, nullptr, &rStrm, drawingml::DOCUMENT_XLSX); - std::shared_ptr<oox::drawingml::URLTransformer> pURLTransformer(new ScURLTransformer(*mpDoc)); + auto pURLTransformer = std::make_shared<ScURLTransformer>(*mpDoc); aDML.SetURLTranslator(pURLTransformer); pDrawing->startElement( FSNS( XML_xdr, XML_twoCellAnchor ), // OOXTODO: oneCellAnchor, absoluteAnchor diff --git a/sc/source/ui/dataprovider/dataprovider.cxx b/sc/source/ui/dataprovider/dataprovider.cxx index e75fb326a64c..737cbdc0af4d 100644 --- a/sc/source/ui/dataprovider/dataprovider.cxx +++ b/sc/source/ui/dataprovider/dataprovider.cxx @@ -279,13 +279,13 @@ std::shared_ptr<DataProvider> DataProviderFactory::getDataProvider(ScDocument* p if (bInternal) { if (rDataProvider == "org.libreoffice.calc.csv") - return std::shared_ptr<DataProvider>(new CSVDataProvider(pDoc, rDataSource)); + return std::make_shared<CSVDataProvider>(pDoc, rDataSource); else if (rDataProvider == "org.libreoffice.calc.html") - return std::shared_ptr<DataProvider>(new HTMLDataProvider(pDoc, rDataSource)); + return std::make_shared<HTMLDataProvider>(pDoc, rDataSource); else if (rDataProvider == "org.libreoffice.calc.xml") - return std::shared_ptr<DataProvider>(new XMLDataProvider(pDoc, rDataSource)); + return std::make_shared<XMLDataProvider>(pDoc, rDataSource); else if (rDataProvider == "org.libreoffice.calc.sql") - return std::shared_ptr<DataProvider>(new SQLDataProvider(pDoc, rDataSource)); + return std::make_shared<SQLDataProvider>(pDoc, rDataSource); } else { diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 9ccbf096fc10..0d7724a97b0a 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1689,7 +1689,7 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller, VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg(GetActiveDialogParent(), *pStyleSheet, true)); - std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + auto pRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync([this, pDlg, pRequest, pStyleSheet, aOldData, aOldName, &rStyleSet, nCurTab, &rCaller, bUndo](sal_Int32 nResult){ if ( nResult == RET_OK ) @@ -1849,7 +1849,7 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller, rStyleSet, aStr, nResId)); - std::shared_ptr<SfxRequest> xRequest(new SfxRequest(rReq)); + auto xRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync([this, pDlg, pStyleSheet, xRequest](sal_Int32 nResult){ if ( nResult == RET_OK ) diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index ec69d43f0eb8..e99f410b239d 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -789,7 +789,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal { // show progress dialog - std::shared_ptr<ScSolverProgressDialog> xProgress(new ScSolverProgressDialog(m_xDialog.get())); + auto xProgress = std::make_shared<ScSolverProgressDialog>(m_xDialog.get()); sal_Int32 nTimeout = 0; if ( FindTimeout( nTimeout ) ) xProgress->SetTimeLimit( nTimeout ); diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index f0a042a702f3..9095a7aa2c2d 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -888,13 +888,13 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) // cell range picker vcl::Window* pWin = GetViewData()->GetActiveWin(); weld::Window* pParentWin = pWin ? pWin->GetFrameWeld() : nullptr; - std::shared_ptr<SfxDialogController> xDlg(new ScValidationDlg(pParentWin, &aArgSet, pTabViewShell)); + auto xDlg = std::make_shared<ScValidationDlg>(pParentWin, &aArgSet, pTabViewShell); ScValidationRegisteredDlg aRegisterThatDlgExists(pParentWin, xDlg); short nResult = xDlg->run(); if ( nResult == RET_OK ) { - const SfxItemSet* pOutSet = static_cast<ScValidationDlg*>(xDlg.get())->GetOutputItemSet(); + const SfxItemSet* pOutSet = xDlg->GetOutputItemSet(); if ( pOutSet->GetItemState( FID_VALID_MODE, true, &pItem ) == SfxItemState::SET ) eMode = static_cast<ScValidationMode>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index c6833d7fe2aa..cc9c29661cbb 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5156,7 +5156,7 @@ std::shared_ptr<ScFieldEditEngine> createEditEngine( ScDocShell* pDocSh, const S { ScDocument& rDoc = pDocSh->GetDocument(); - std::shared_ptr<ScFieldEditEngine> pEngine(new ScFieldEditEngine(&rDoc, rDoc.GetEditPool())); + auto pEngine = std::make_shared<ScFieldEditEngine>(&rDoc, rDoc.GetEditPool()); ScSizeDeviceProvider aProv(pDocSh); pEngine->SetRefDevice(aProv.GetDevice()); pEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM)); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 9af78a03f5fa..605057ef91e0 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -1022,7 +1022,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); Color aProtectedColor( rColorCfg.GetColorValue( svtools::CALCPROTECTEDBACKGROUND ).nColor ); - std::shared_ptr<SvxBrushItem> pProtectedBackground( new SvxBrushItem( aProtectedColor, ATTR_BACKGROUND ) ); + auto pProtectedBackground = std::make_shared<SvxBrushItem>( aProtectedColor, ATTR_BACKGROUND ); // iterate through the rows to show for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 37d7fc1e2100..9ec10e64cbf5 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -475,7 +475,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName const ScPatternAttr* pOldAttrs = GetSelectionPattern(); - std::shared_ptr<SfxItemSet> pOldSet(new SfxItemSet(pOldAttrs->GetItemSet())); + auto pOldSet = std::make_shared<SfxItemSet>(pOldAttrs->GetItemSet()); std::shared_ptr<SvxNumberInfoItem> pNumberInfoItem; pOldSet->MergeRange(XATTR_FILLSTYLE, XATTR_FILLCOLOR); @@ -542,7 +542,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName if (!rName.isEmpty()) pDlg->SetCurPageId(rName); - std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + auto pRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync([pDlg, pOldSet, pRequest, this](sal_Int32 nResult){ diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 0e61a2a8a072..a682420fb071 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -295,11 +295,11 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, else { ScAddress aCellPos( nPosX, nPosY, GetViewData().GetTabNo() ); - std::shared_ptr<ScImportExport> pObj(new ScImportExport(GetViewData().GetDocument(), aCellPos)); + auto pObj = std::make_shared<ScImportExport>(GetViewData().GetDocument(), aCellPos); pObj->SetOverwriting( true ); - std::shared_ptr<OUString> pStrBuffer(new OUString()); + auto pStrBuffer = std::make_shared<OUString>(); tools::SvRef<SotStorageStream> xStream; if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.is() ) { @@ -341,7 +341,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, { vcl::Window* pParent = GetActiveWin(); - std::shared_ptr<ScImportStringStream> pStrm(new ScImportStringStream(*pStrBuffer)); + auto pStrm = std::make_shared<ScImportStringStream>(*pStrBuffer); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); VclPtr<AbstractScImportAsciiDlg> pDlg( diff --git a/sd/qa/unit/filters-test.cxx b/sd/qa/unit/filters-test.cxx index 52fc6f9d7050..707f8c85110e 100644 --- a/sd/qa/unit/filters-test.cxx +++ b/sd/qa/unit/filters-test.cxx @@ -51,11 +51,11 @@ bool SdFiltersTest::load(const OUString &rFilter, const OUString &rURL, const OUString &rUserData, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) { - std::shared_ptr<const SfxFilter> pFilter(new SfxFilter( + auto pFilter = std::make_shared<SfxFilter>( rFilter, OUString(), nFilterFlags, nClipboardID, OUString(), OUString(), - rUserData, OUString() )); - const_cast<SfxFilter*>(pFilter.get())->SetVersion(nFilterVersion); + rUserData, OUString() ); + pFilter->SetVersion(nFilterVersion); ::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::EMBEDDED, false, DocumentType::Impress); SfxMedium* pSrcMed = new SfxMedium(rURL, StreamMode::STD_READ); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index 8fef3182ee3e..bdb800953e01 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -207,15 +207,15 @@ protected: SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (pFormat->nFormatType == ODG_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARDRAW_8; - std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter( + auto pExportFilter = std::make_shared<SfxFilter>( OUString::createFromAscii(pFormat->pFilterName), OUString(), pFormat->nFormatType, nExportFormat, OUString::createFromAscii(pFormat->pTypeName), OUString(), OUString::createFromAscii(pFormat->pUserData), - "private:factory/sdraw*" )); + "private:factory/sdraw*" ); - const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); aStoreMedium.SetFilter(pExportFilter); } else // Impress @@ -223,15 +223,15 @@ protected: SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (pFormat->nFormatType == ODP_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARIMPRESS_8; - std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter( + auto pExportFilter = std::make_shared<SfxFilter>( OUString::createFromAscii(pFormat->pFilterName), OUString(), pFormat->nFormatType, nExportFormat, OUString::createFromAscii(pFormat->pTypeName), OUString(), OUString::createFromAscii(pFormat->pUserData), - "private:factory/simpress*" )); + "private:factory/simpress*" ); - const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); aStoreMedium.SetFilter(pExportFilter); } pShell->ConvertTo(aStoreMedium); @@ -247,14 +247,14 @@ protected: SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (pFormat->nFormatType == ODG_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARDRAW_8; - std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter( + auto pExportFilter = std::make_shared<SfxFilter>( OUString::createFromAscii(pFormat->pFilterName), OUString(), pFormat->nFormatType, nExportFormat, OUString::createFromAscii(pFormat->pTypeName), OUString(), OUString::createFromAscii(pFormat->pUserData), - "private:factory/sdraw*" )); - const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + "private:factory/sdraw*" ); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); aStoreMedium.SetFilter(pExportFilter); } else // Impress @@ -262,14 +262,14 @@ protected: SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (pFormat->nFormatType == ODP_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARCHART_8; - std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter( + auto pExportFilter = std::make_shared<SfxFilter>( OUString::createFromAscii(pFormat->pFilterName), OUString(), pFormat->nFormatType, nExportFormat, OUString::createFromAscii(pFormat->pTypeName), OUString(), OUString::createFromAscii(pFormat->pUserData), - "private:factory/simpress*" )); - const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + "private:factory/simpress*" ); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); aStoreMedium.SetFilter(pExportFilter); } pShell->DoSaveAs(aStoreMedium); diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index f4de034d7877..32c8a3e1d1df 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -1636,7 +1636,7 @@ void CustomAnimationPane::showOptions(const OString& rPage) { std::unique_ptr<STLPropertySet> xSet = createSelectionSet(); - std::shared_ptr<CustomAnimationDialog> xDlg(new CustomAnimationDialog(GetFrameWeld(), std::move(xSet), rPage)); + auto xDlg = std::make_shared<CustomAnimationDialog>(GetFrameWeld(), std::move(xSet), rPage); weld::DialogController::runAsync(xDlg, [xDlg, this](sal_Int32 nResult){ if (nResult ) diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 6cd3de93bfa7..a60238eb9273 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -275,7 +275,7 @@ std::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::CreateView ( FrameView* pFrameView, const bool bIsCenterPane) { - std::shared_ptr<ViewDescriptor> pDescriptor (new ViewDescriptor); + auto pDescriptor = std::make_shared<ViewDescriptor>(); pDescriptor->mpViewShell = CreateViewShell( rxViewId, diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx index 96a805040cb9..4984c675ec4c 100644 --- a/sd/source/ui/func/futransf.cxx +++ b/sd/source/ui/func/futransf.cxx @@ -109,7 +109,7 @@ void FuTransform::DoExecute( SfxRequest& rReq ) if (!pDlg) return; - std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + auto pRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync([bWelded, pDlg, pRequest, this](sal_Int32 nResult){ diff --git a/sd/source/ui/presenter/PresenterPreviewCache.cxx b/sd/source/ui/presenter/PresenterPreviewCache.cxx index 42617e9bd133..b62794a7e929 100644 --- a/sd/source/ui/presenter/PresenterPreviewCache.cxx +++ b/sd/source/ui/presenter/PresenterPreviewCache.cxx @@ -277,7 +277,7 @@ const SdrPage* PresenterPreviewCache::PresenterCacheContext::GetPage (CacheKey a std::shared_ptr<std::vector<CacheKey> > PresenterPreviewCache::PresenterCacheContext::GetEntryList (bool bVisible) { - std::shared_ptr<std::vector<CacheKey> > pKeys (new std::vector<CacheKey>); + auto pKeys = std::make_shared<std::vector<CacheKey>>(); if ( ! mxSlides.is()) return pKeys; diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx index bf5d0fdc5392..1828b72960b5 100644 --- a/sd/source/ui/remotecontrol/Server.cxx +++ b/sd/source/ui/remotecontrol/Server.cxx @@ -128,10 +128,10 @@ void RemoteServer::execute() pSocket->getPeerAddr( aClientAddr ); MutexGuard aGuard( sDataMutex ); - std::shared_ptr< ClientInfoInternal > pClient( - new ClientInfoInternal( + std::shared_ptr< ClientInfoInternal > pClient = + std::make_shared<ClientInfoInternal>( OStringToOUString( aName, RTL_TEXTENCODING_UTF8 ), - pSocket, OStringToOUString( aPin, RTL_TEXTENCODING_UTF8 ) ) ); + pSocket, OStringToOUString( aPin, RTL_TEXTENCODING_UTF8 ) ); mAvailableClients.push_back( pClient ); // Read off any additional non-empty lines diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx index 1020cde8a4e8..725cc61a6dad 100644 --- a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx @@ -83,7 +83,7 @@ VclPtr<vcl::Window> AllMasterPagesSelector::Create ( if (pDocument == nullptr) return nullptr; - std::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + auto pContainer = std::make_shared<MasterPageContainer>(); VclPtrInstance<AllMasterPagesSelector> pSelector( pParent, diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx index 835a4532a294..013f84516ebe 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -46,7 +46,7 @@ VclPtr<vcl::Window> CurrentMasterPagesSelector::Create ( if (pDocument == nullptr) return nullptr; - std::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + auto pContainer = std::make_shared<MasterPageContainer>(); VclPtrInstance<CurrentMasterPagesSelector> pSelector( pParent, @@ -137,8 +137,8 @@ void CurrentMasterPagesSelector::Fill (ItemList& rItemList) pMasterPage->GetName(), OUString(), pMasterPage->IsPrecious(), - std::shared_ptr<PageObjectProvider>(new ExistingPageProvider(pMasterPage)), - std::shared_ptr<PreviewProvider>(new PagePreviewProvider()))); + std::make_shared<ExistingPageProvider>(pMasterPage), + std::make_shared<PagePreviewProvider>())); aToken = mpContainer->PutMasterPage(pDescriptor); } diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx index 18ad57d14a3c..95f68f316ca6 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.cxx +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -521,7 +521,7 @@ void MasterPageContainer::Implementation::LateInit() std::shared_ptr<MasterPageContainerQueue::ContainerAdapter>(Instance()))); mpFillerTask = ::sd::tools::TimerBasedTaskExecution::Create( - std::shared_ptr<tools::AsynchronousTask>(new MasterPageContainerFiller(*this)), + std::make_shared<MasterPageContainerFiller>(*this), 5, 50); diff --git a/sd/source/ui/sidebar/MasterPageContainerFiller.cxx b/sd/source/ui/sidebar/MasterPageContainerFiller.cxx index d007e524f969..5dc90ac29491 100644 --- a/sd/source/ui/sidebar/MasterPageContainerFiller.cxx +++ b/sd/source/ui/sidebar/MasterPageContainerFiller.cxx @@ -46,8 +46,8 @@ MasterPageContainerFiller::MasterPageContainerFiller (ContainerAdapter& rpAdapte OUString(), OUString(), false, - std::shared_ptr<PageObjectProvider>(new DefaultPageObjectProvider()), - std::shared_ptr<PreviewProvider>(new PagePreviewProvider()))); + std::make_shared<DefaultPageObjectProvider>(), + std::make_shared<PagePreviewProvider>())); mrContainerAdapter.PutMasterPage(pDescriptor); } @@ -147,18 +147,15 @@ MasterPageContainerFiller::State MasterPageContainerFiller::AddTemplate() mpLastAddedEntry->msTitle, OUString(), false, - std::shared_ptr<PageObjectProvider>( - new TemplatePageObjectProvider(mpLastAddedEntry->msPath)), - std::shared_ptr<PreviewProvider>( - new TemplatePreviewProvider(mpLastAddedEntry->msPath)))); + std::make_shared<TemplatePageObjectProvider>(mpLastAddedEntry->msPath), + std::make_shared<TemplatePreviewProvider>(mpLastAddedEntry->msPath))); // For user supplied templates we use a different preview provider: // The preview in the document shows not only shapes on the master // page but also shapes on the foreground. This is misleading and // therefore these previews are discarded and created directly from // the page objects. if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER) - pDescriptor->mpPreviewProvider = std::shared_ptr<PreviewProvider>( - new PagePreviewProvider()); + pDescriptor->mpPreviewProvider = std::make_shared<PagePreviewProvider>(); mrContainerAdapter.PutMasterPage(pDescriptor); ++mnIndex; diff --git a/sd/source/ui/sidebar/MasterPageDescriptor.cxx b/sd/source/ui/sidebar/MasterPageDescriptor.cxx index 0f9d21a81c2c..2d77511f067e 100644 --- a/sd/source/ui/sidebar/MasterPageDescriptor.cxx +++ b/sd/source/ui/sidebar/MasterPageDescriptor.cxx @@ -176,7 +176,7 @@ int MasterPageDescriptor::UpdatePageObject ( // will create the real one. maSmallPreview = Image(); maLargePreview = Image(); - mpPreviewProvider = std::shared_ptr<PreviewProvider>(new PagePreviewProvider()); + mpPreviewProvider = std::make_shared<PagePreviewProvider>(); } else { diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx index 4e846dad20aa..7a2568375f99 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx @@ -37,7 +37,7 @@ VclPtr<vcl::Window> RecentMasterPagesSelector::Create ( if (pDocument == nullptr) return nullptr; - std::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + auto pContainer = std::make_shared<MasterPageContainer>(); VclPtrInstance<RecentMasterPagesSelector> pSelector( pParent, diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx index c6f0b02b07a4..d1f4ab532d82 100644 --- a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx @@ -144,10 +144,8 @@ void RecentlyUsedMasterPages::LoadPersistentValues() OUString(), sName, false, - std::shared_ptr<PageObjectProvider>( - new TemplatePageObjectProvider(sURL)), - std::shared_ptr<PreviewProvider>( - new TemplatePreviewProvider(sURL)))); + std::make_shared<TemplatePageObjectProvider>(sURL), + std::make_shared<TemplatePreviewProvider>(sURL))); // For user supplied templates we use a different // preview provider: The preview in the document shows // not only shapes on the master page but also shapes on @@ -155,8 +153,7 @@ void RecentlyUsedMasterPages::LoadPersistentValues() // these previews are discarded and created directly // from the page objects. if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER) - pDescriptor->mpPreviewProvider = std::shared_ptr<PreviewProvider>( - new PagePreviewProvider()); + pDescriptor->mpPreviewProvider = std::make_shared<PagePreviewProvider>(); MasterPageContainer::Token aToken (mpContainer->PutMasterPage(pDescriptor)); mvMasterPages.emplace_back(aToken,sURL,sName); } diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx index d276384985c9..a117b33e0ecc 100644 --- a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx +++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx @@ -44,7 +44,7 @@ public: std::shared_ptr<BitmapReplacement> NoBitmapCompression::Compress (const BitmapEx& rBitmap) const { - return std::shared_ptr<BitmapReplacement>(new DummyReplacement(rBitmap)); + return std::make_shared<DummyReplacement>(rBitmap); } BitmapEx NoBitmapCompression::Decompress (const BitmapReplacement& rBitmapData) const diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index d6ed54ad5d33..ce7d0533085e 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -104,14 +104,14 @@ Animator::AnimationId Animator::AddAnimation ( if (mbIsDisposed) return -1; - std::shared_ptr<Animation> pAnimation ( - new Animation( + std::shared_ptr<Animation> pAnimation = + std::make_shared<Animation>( rAnimation, 0, 300 / 1000.0, maElapsedTime.getElapsedTime(), ++mnNextAnimationId, - rFinishFunctor)); + rFinishFunctor); maAnimations.push_back(pAnimation); RequestNextFrame(); diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index 94a17a4dd903..133be4020ec7 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -539,10 +539,10 @@ std::shared_ptr<SdTransferable::UserData> Clipboard::CreateTransferableUserData rOtherClipboard.maPagesToRemove.push_back(pDescriptor->GetPage()); // Create the new transferable. - std::shared_ptr<SdTransferable::UserData> pNewTransferable ( - new TransferableData( + std::shared_ptr<SdTransferable::UserData> pNewTransferable = + std::make_shared<TransferableData>( pSlideSorterViewShell, - aRepresentatives)); + aRepresentatives); pTransferable->SetWorkDocument(pTreeListBoxTransferable->GetSourceDoc()->AllocSdDrawDocument()); // pTransferable->SetView(&mrSlideSorter.GetView()); diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx index f169c205f810..26498f913979 100644 --- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx +++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx @@ -263,7 +263,7 @@ void PageSelector::DisableBroadcasting() std::shared_ptr<PageSelector::PageSelection> PageSelector::GetPageSelection() const { - std::shared_ptr<PageSelection> pSelection (new PageSelection); + auto pSelection = std::make_shared<PageSelection>(); pSelection->reserve(GetSelectedPageCount()); int nPageCount = GetPageCount(); diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index d54b09a91a90..162053697bf5 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -655,8 +655,7 @@ static bool Match ( void SelectionFunction::SwitchToNormalMode() { if (mpModeHandler->GetMode() != NormalMode) - SwitchMode(std::shared_ptr<ModeHandler>( - new NormalModeHandler(mrSlideSorter, *this))); + SwitchMode(std::make_shared<NormalModeHandler>(mrSlideSorter, *this)); } void SelectionFunction::SwitchToDragAndDropMode (const Point& rMousePosition) @@ -664,8 +663,7 @@ void SelectionFunction::SwitchToDragAndDropMode (const Point& rMousePosition) if (mpModeHandler->GetMode() == DragAndDropMode) return; - SwitchMode(std::shared_ptr<ModeHandler>( - new DragAndDropModeHandler(mrSlideSorter, *this, rMousePosition, mpWindow))); + SwitchMode(std::make_shared<DragAndDropModeHandler>(mrSlideSorter, *this, rMousePosition, mpWindow)); } void SelectionFunction::SwitchToMultiSelectionMode ( @@ -673,8 +671,7 @@ void SelectionFunction::SwitchToMultiSelectionMode ( const sal_uInt32 nEventCode) { if (mpModeHandler->GetMode() != MultiSelectionMode) - SwitchMode(std::shared_ptr<ModeHandler>( - new MultiSelectionModeHandler(mrSlideSorter, *this, rMousePosition, nEventCode))); + SwitchMode(std::make_shared<MultiSelectionModeHandler>(mrSlideSorter, *this, rMousePosition, nEventCode)); } void SelectionFunction::SwitchMode (const std::shared_ptr<ModeHandler>& rpHandler) diff --git a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx index 5017cf9b5bec..14762979466f 100644 --- a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx +++ b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx @@ -29,7 +29,7 @@ SdTransferable* TransferableData::CreateTransferable ( const ::std::vector<Representative>& rRepresentatives) { SdTransferable* pTransferable = new SdTransferable (pSrcDoc, nullptr, false/*bInitOnGetData*/); - std::shared_ptr<TransferableData> pData (new TransferableData(pViewShell, rRepresentatives)); + auto pData = std::make_shared<TransferableData>(pViewShell, rRepresentatives); pTransferable->AddUserData(pData); return pTransferable; } diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx index 0202b4d8b798..578a611a8f2c 100644 --- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx +++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx @@ -77,7 +77,7 @@ const SdrPage* ViewCacheContext::GetPage (cache::CacheKey aKey) std::shared_ptr<std::vector<cache::CacheKey> > ViewCacheContext::GetEntryList (bool bVisible) { - std::shared_ptr<std::vector<cache::CacheKey> > pKeys (new std::vector<cache::CacheKey>); + auto pKeys = std::make_shared<std::vector<cache::CacheKey>>(); model::PageEnumeration aPageEnumeration ( bVisible diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 17e225e7c1c8..b649c4c22484 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1745,15 +1745,14 @@ private: if ( CheckForFrontBackPages( nIndex ) ) { maPrinterPages.push_back( - std::shared_ptr<PrinterPage>( - new OutlinerPrinterPage( + std::make_shared<OutlinerPrinterPage>( pOutliner->CreateParaObject(), aMap, rInfo.msTimeDate, aPageOfs, rInfo.mnDrawMode, rInfo.meOrientation, - rInfo.mpPrinter->GetPaperBin()))); + rInfo.mpPrinter->GetPaperBin())); } } @@ -1863,8 +1862,7 @@ private: && (aPageIndices.size() == nShapeCount || bLastLoop) ) { maPrinterPages.push_back( - std::shared_ptr<PrinterPage>( - new HandoutPrinterPage( + std::make_shared<HandoutPrinterPage>( nPrinterPageIndex++, aPageIndices, aMap, @@ -1872,7 +1870,7 @@ private: aPageOfs, rInfo.mnDrawMode, rInfo.meOrientation, - nPaperBin))); + nPaperBin)); aPageIndices.clear(); } } @@ -2090,8 +2088,7 @@ private: else aSecondOffset.AdjustY( aAdjustedPrintSize.Height() / 2 ); maPrinterPages.push_back( - std::shared_ptr<PrinterPage>( - new BookletPrinterPage( + std::make_shared<BookletPrinterPage>( aPair.first, aPair.second, aOffset, @@ -2101,7 +2098,7 @@ private: rInfo.mbPrintMarkedOnly, rInfo.mnDrawMode, rInfo.meOrientation, - rInfo.mpPrinter->GetPaperBin()))); + rInfo.mpPrinter->GetPaperBin())); } } @@ -2126,8 +2123,7 @@ private: return; maPrinterPages.push_back( - std::shared_ptr<PrinterPage>( - new TiledPrinterPage( + std::make_shared<TiledPrinterPage>( sal::static_int_cast<sal_uInt16>(nPageIndex), ePageKind, rInfo.mbPrintMarkedOnly, @@ -2135,7 +2131,7 @@ private: rInfo.mpPrinter->GetPageOffset(), rInfo.mnDrawMode, rInfo.meOrientation, - nPaperBin))); + nPaperBin)); } /** Print one standard slide or notes page on one to many printer @@ -2173,8 +2169,7 @@ private: // if CutPage is set then do not move it, otherwise move the // scaled page to printable area maPrinterPages.push_back( - std::shared_ptr<PrinterPage>( - new RegularPrinterPage( + std::make_shared<RegularPrinterPage>( sal::static_int_cast<sal_uInt16>(nPageIndex), ePageKind, aMap, @@ -2183,7 +2178,7 @@ private: aPageOffset, rInfo.mnDrawMode, rInfo.meOrientation, - nPaperBin))); + nPaperBin)); } else { @@ -2211,8 +2206,7 @@ private: { aMap.SetOrigin(aPageOrigin); maPrinterPages.push_back( - std::shared_ptr<PrinterPage>( - new RegularPrinterPage( + std::make_shared<RegularPrinterPage>( sal::static_int_cast<sal_uInt16>(nPageIndex), ePageKind, aMap, @@ -2221,7 +2215,7 @@ private: aPageOffset, rInfo.mnDrawMode, rInfo.meOrientation, - nPaperBin))); + nPaperBin)); } } } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 6970fe0aeb28..248092c06416 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1608,7 +1608,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_CLASSIFICATION_DIALOG: { - std::shared_ptr<svx::ClassificationDialog> xDialog(new svx::ClassificationDialog(GetFrameWeld(), false, [](){} )); + auto xDialog = std::make_shared<svx::ClassificationDialog>(GetFrameWeld(), false, [](){} ); ClassificationCollector aCollector(*this); aCollector.collect(); diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index c5e1450f70e2..6f1607aefc10 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -294,7 +294,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = GetActiveWindow(); VclPtr<AbstractHeaderFooterDialog> pDlg(pFact->CreateHeaderFooterDialog(this, pWin ? pWin->GetFrameWeld() : nullptr, GetDoc(), mpActualPage)); - std::shared_ptr<SfxRequest> xRequest(new SfxRequest(rReq)); + auto xRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync([this, pDlg, xRequest](sal_Int32 /*nResult*/){ GetActiveWindow()->Invalidate(); diff --git a/sdext/source/pdfimport/pdfiadaptor.cxx b/sdext/source/pdfimport/pdfiadaptor.cxx index 4d12474f0edf..a496736dca78 100644 --- a/sdext/source/pdfimport/pdfiadaptor.cxx +++ b/sdext/source/pdfimport/pdfiadaptor.cxx @@ -227,8 +227,7 @@ bool PDFIRawAdaptor::parse( const uno::Reference<io::XInputStream>& xInput const OUString& rFilterOptions ) { // container for metaformat - std::shared_ptr<PDFIProcessor> pSink( - new PDFIProcessor(xStatus, m_xContext)); + auto pSink = std::make_shared<PDFIProcessor>(xStatus, m_xContext); bool bSuccess=false; diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index 0cf64eeec424..128352ad2e72 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -450,7 +450,7 @@ namespace void testXPDFParser() { #if HAVE_FEATURE_POPPLER - std::shared_ptr<TestSink> pSink( new TestSink() ); + auto pSink = std::make_shared<TestSink>(); CPPUNIT_ASSERT( pdfi::xpdf_ImportFromFile( m_directories.getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), diff --git a/sdext/source/pdfimport/tree/treevisitorfactory.cxx b/sdext/source/pdfimport/tree/treevisitorfactory.cxx index a9cf73cc2aa8..6131014e92bd 100644 --- a/sdext/source/pdfimport/tree/treevisitorfactory.cxx +++ b/sdext/source/pdfimport/tree/treevisitorfactory.cxx @@ -32,19 +32,19 @@ namespace pdfi virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override { - return std::shared_ptr<ElementTreeVisitor>(new WriterXmlOptimizer(rProc)); + return std::make_shared<WriterXmlOptimizer>(rProc); } virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( StyleContainer& rStyles, PDFIProcessor& rProc ) const override { - return std::shared_ptr<ElementTreeVisitor>(new WriterXmlFinalizer(rStyles,rProc)); + return std::make_shared<WriterXmlFinalizer>(rStyles,rProc); } virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override { - return std::shared_ptr<ElementTreeVisitor>(new WriterXmlEmitter(rEmitContext)); + return std::make_shared<WriterXmlEmitter>(rEmitContext); } }; @@ -54,21 +54,19 @@ namespace pdfi virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc)); + return std::make_shared<DrawXmlOptimizer>(rProc); } virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( StyleContainer& rStyles, PDFIProcessor& rProc ) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc)); + return std::make_shared<DrawXmlFinalizer>(rStyles,rProc); } virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext, - DrawXmlEmitter::IMPRESS_DOC - )); + return std::make_shared<DrawXmlEmitter>(rEmitContext, DrawXmlEmitter::IMPRESS_DOC); } }; @@ -78,21 +76,19 @@ namespace pdfi virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc)); + return std::make_shared<DrawXmlOptimizer>(rProc); } virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( StyleContainer& rStyles, PDFIProcessor& rProc ) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc)); + return std::make_shared<DrawXmlFinalizer>(rStyles,rProc); } virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext, - DrawXmlEmitter::DRAW_DOC - )); + return std::make_shared<DrawXmlEmitter>(rEmitContext, DrawXmlEmitter::DRAW_DOC); } }; diff --git a/sdext/source/presenter/PresenterPaneBorderPainter.cxx b/sdext/source/presenter/PresenterPaneBorderPainter.cxx index e8ff0a50958d..d729ee06bae5 100644 --- a/sdext/source/presenter/PresenterPaneBorderPainter.cxx +++ b/sdext/source/presenter/PresenterPaneBorderPainter.cxx @@ -563,8 +563,7 @@ std::shared_ptr<RendererPaneStyle> sPaneStyleName = sStyleName; // Create a new pane style object and initialize it with bitmaps. - std::shared_ptr<RendererPaneStyle> pStyle ( - new RendererPaneStyle(mpTheme,sPaneStyleName)); + auto pStyle = std::make_shared<RendererPaneStyle>(mpTheme,sPaneStyleName); iStyle = maRendererPaneStyles.emplace(rsResourceURL, pStyle).first; } if (iStyle != maRendererPaneStyles.end()) diff --git a/sdext/source/presenter/PresenterTheme.cxx b/sdext/source/presenter/PresenterTheme.cxx index cd82d1dcd90d..6c512fce61a8 100644 --- a/sdext/source/presenter/PresenterTheme.cxx +++ b/sdext/source/presenter/PresenterTheme.cxx @@ -339,11 +339,10 @@ std::shared_ptr<PresenterConfigurationAccess> PresenterTheme::GetNodeForViewStyl return std::shared_ptr<PresenterConfigurationAccess>(); // Open configuration for writing. - std::shared_ptr<PresenterConfigurationAccess> pConfiguration ( - new PresenterConfigurationAccess( + auto pConfiguration = std::make_shared<PresenterConfigurationAccess>( mxContext, "/org.openoffice.Office.PresenterScreen/", - PresenterConfigurationAccess::READ_WRITE)); + PresenterConfigurationAccess::READ_WRITE); // Get configuration node for the view style container of the current // theme. @@ -700,8 +699,7 @@ PresenterTheme::SharedFontDescriptor ReadContext::ReadFont ( const Reference<beans::XPropertySet>& rxProperties, const PresenterTheme::SharedFontDescriptor& rpDefault) { - std::shared_ptr<PresenterTheme::FontDescriptor> pDescriptor ( - new PresenterTheme::FontDescriptor(rpDefault)); + auto pDescriptor = std::make_shared<PresenterTheme::FontDescriptor>(rpDefault); PresenterConfigurationAccess::GetProperty(rxProperties, "FamilyName") >>= pDescriptor->msFamilyName; PresenterConfigurationAccess::GetProperty(rxProperties, "Style") >>= pDescriptor->msStyleName; @@ -831,7 +829,7 @@ void PaneStyleContainer::ProcessPaneStyle( if (rValues.size() != 6) return; - std::shared_ptr<PaneStyle> pStyle (new PaneStyle()); + auto pStyle = std::make_shared<PaneStyle>(); rValues[0] >>= pStyle->msStyleName; @@ -946,7 +944,7 @@ void ViewStyleContainer::ProcessViewStyle( ReadContext const & rReadContext, const Reference<beans::XPropertySet>& rxProperties) { - std::shared_ptr<ViewStyle> pStyle (new ViewStyle()); + auto pStyle = std::make_shared<ViewStyle>(); PresenterConfigurationAccess::GetProperty(rxProperties, "StyleName") >>= pStyle->msStyleName; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index f5675528a956..4adfe5986c70 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -130,7 +130,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const pFrame->GetViewShell()->GetPrinter()->IsPrinting() ) return std::shared_ptr<GDIMetaFile>(); - std::shared_ptr<GDIMetaFile> xFile(new GDIMetaFile); + auto xFile = std::make_shared<GDIMetaFile>(); ScopedVclPtrInstance< VirtualDevice > pDevice; pDevice->EnableOutput( false ); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 85a708de3290..3d531a91ce90 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3760,7 +3760,7 @@ void SAL_CALL SfxBaseModel::storeToStorage( const Reference< embed::XStorage >& if ( !m_pData->m_pObjectShell.is() ) throw io::IOException(); // TODO: - std::shared_ptr<SfxAllItemSet> xSet( new SfxAllItemSet(m_pData->m_pObjectShell->GetPool()) ); + auto xSet = std::make_shared<SfxAllItemSet>(m_pData->m_pObjectShell->GetPool()); TransformParameters( SID_SAVEASDOC, aMediaDescriptor, *xSet ); // TODO/LATER: maybe a special URL "private:storage" should be used diff --git a/slideshow/source/engine/expressionnodefactory.cxx b/slideshow/source/engine/expressionnodefactory.cxx index 74cfd96f8406..f82e09ac2f7e 100644 --- a/slideshow/source/engine/expressionnodefactory.cxx +++ b/slideshow/source/engine/expressionnodefactory.cxx @@ -192,48 +192,48 @@ namespace slideshow std::shared_ptr<ExpressionNode> ExpressionNodeFactory::createConstantValueExpression( double rConstantValue ) { - return std::shared_ptr<ExpressionNode>( new ConstantValueExpression(rConstantValue) ); + return std::make_shared<ConstantValueExpression>(rConstantValue); } std::shared_ptr<ExpressionNode> ExpressionNodeFactory::createValueTExpression() { - return std::shared_ptr<ExpressionNode>( new TValueExpression() ); + return std::make_shared<TValueExpression>(); } std::shared_ptr<ExpressionNode> ExpressionNodeFactory::createPlusExpression( const std::shared_ptr<ExpressionNode>& rLHS, const std::shared_ptr<ExpressionNode>& rRHS ) { - return std::shared_ptr<ExpressionNode>( new PlusExpression(rLHS, rRHS) ); + return std::make_shared<PlusExpression>(rLHS, rRHS); } std::shared_ptr<ExpressionNode> ExpressionNodeFactory::createMinusExpression( const std::shared_ptr<ExpressionNode>& rLHS, const std::shared_ptr<ExpressionNode>& rRHS ) { - return std::shared_ptr<ExpressionNode>( new MinusExpression(rLHS, rRHS) ); + return std::make_shared<MinusExpression>(rLHS, rRHS); } std::shared_ptr<ExpressionNode> ExpressionNodeFactory::createMultipliesExpression( const std::shared_ptr<ExpressionNode>& rLHS, const std::shared_ptr<ExpressionNode>& rRHS ) { - return std::shared_ptr<ExpressionNode>( new MultipliesExpression(rLHS, rRHS) ); + return std::make_shared<MultipliesExpression>(rLHS, rRHS); } std::shared_ptr<ExpressionNode> ExpressionNodeFactory::createDividesExpression( const std::shared_ptr<ExpressionNode>& rLHS, const std::shared_ptr<ExpressionNode>& rRHS ) { - return std::shared_ptr<ExpressionNode>( new DividesExpression(rLHS, rRHS) ); + return std::make_shared<DividesExpression>(rLHS, rRHS); } std::shared_ptr<ExpressionNode> ExpressionNodeFactory::createMinExpression ( const std::shared_ptr<ExpressionNode>& rOuterFunction, const std::shared_ptr<ExpressionNode>& rInnerFunction ) { - return std::shared_ptr<ExpressionNode>( new MinExpression(rOuterFunction, rInnerFunction) ); + return std::make_shared<MinExpression>(rOuterFunction, rInnerFunction); } std::shared_ptr<ExpressionNode> ExpressionNodeFactory::createMaxExpression ( const std::shared_ptr<ExpressionNode>& rOuterFunction, const std::shared_ptr<ExpressionNode>& rInnerFunction ) { - return std::shared_ptr<ExpressionNode>( new MaxExpression(rOuterFunction, rInnerFunction) ); + return std::make_shared<MaxExpression>(rOuterFunction, rInnerFunction); } } diff --git a/slideshow/source/engine/screenupdater.cxx b/slideshow/source/engine/screenupdater.cxx index cc609fecf97d..1053770d5b5c 100644 --- a/slideshow/source/engine/screenupdater.cxx +++ b/slideshow/source/engine/screenupdater.cxx @@ -213,7 +213,7 @@ namespace internal ::std::shared_ptr<ScreenUpdater::UpdateLock> ScreenUpdater::createLock() { - return ::std::shared_ptr<ScreenUpdater::UpdateLock>(new ::UpdateLock(*this)); + return ::std::make_shared<::UpdateLock>(*this); } diff --git a/slideshow/source/engine/shapes/appletshape.cxx b/slideshow/source/engine/shapes/appletshape.cxx index f3b8edc9c02c..37f7b22be047 100644 --- a/slideshow/source/engine/shapes/appletshape.cxx +++ b/slideshow/source/engine/shapes/appletshape.cxx @@ -275,15 +275,12 @@ namespace slideshow std::size_t nNumPropEntries, const SlideShowContext& rContext ) { - std::shared_ptr< AppletShape > pAppletShape( - new AppletShape(xShape, + return std::make_shared<AppletShape>(xShape, nPrio, rServiceName, pPropCopyTable, nNumPropEntries, - rContext) ); - - return pAppletShape; + rContext); } } } diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index b8b500936557..0e377c8b855b 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -910,9 +910,8 @@ std::shared_ptr<Activity> createDrawingLayerAnimActivity( try { - std::shared_ptr<WakeupEvent> const pWakeupEvent( - new WakeupEvent( rContext.mrEventQueue.getTimer(), - rContext.mrActivitiesQueue ) ); + auto const pWakeupEvent = std::make_shared<WakeupEvent>( rContext.mrEventQueue.getTimer(), + rContext.mrActivitiesQueue ); pActivity.reset( new ActivityImpl( rContext, pWakeupEvent, pDrawShape ) ); pWakeupEvent->setActivity( pActivity ); } diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index a85a9cdc796c..19ea3d4f51b7 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -142,7 +142,7 @@ public: return xMtf; } - return GDIMetaFileSharedPtr(new GDIMetaFile(aGraphic.GetGDIMetaFile())); + return std::make_shared<GDIMetaFile>(aGraphic.GetGDIMetaFile()); } private: diff --git a/slideshow/source/engine/shapes/mediashape.cxx b/slideshow/source/engine/shapes/mediashape.cxx index 9aa9009a9002..bd2522899156 100644 --- a/slideshow/source/engine/shapes/mediashape.cxx +++ b/slideshow/source/engine/shapes/mediashape.cxx @@ -241,10 +241,7 @@ namespace slideshow double nPrio, const SlideShowContext& rContext) { - std::shared_ptr< MediaShape > pMediaShape( - new MediaShape(xShape, nPrio, rContext)); - - return pMediaShape; + return std::make_shared<MediaShape>(xShape, nPrio, rContext); } } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index c164f1e82a61..f58cca2128e6 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -1087,15 +1087,15 @@ SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) { - std::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue, - rEventMultiplexer, rScreenUpdater, - rActivitiesQueue, rUserEventQueue, - rCursorManager, rMediaFileManager, rViewContainer, - xComponentContext, rShapeListenerMap, - rShapeCursorMap, rPolyPolygonVector, rUserPaintColor, - dUserPaintStrokeWidth, bUserPaintEnabled, - bIntrinsicAnimationsAllowed, - bDisableAnimationZOrder )); + auto pRet = std::make_shared<SlideImpl>( xDrawPage, xDrawPages, xRootNode, rEventQueue, + rEventMultiplexer, rScreenUpdater, + rActivitiesQueue, rUserEventQueue, + rCursorManager, rMediaFileManager, rViewContainer, + xComponentContext, rShapeListenerMap, + rShapeCursorMap, rPolyPolygonVector, rUserPaintColor, + dUserPaintStrokeWidth, bUserPaintEnabled, + bIntrinsicAnimationsAllowed, + bDisableAnimationZOrder ); rEventMultiplexer.addViewHandler( pRet ); diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index 9878bab7797f..21f382220eb9 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -823,11 +823,11 @@ ViewLayerSharedPtr SlideView::createViewLayer( const basegfx::B2DRange& rLayerBo if( nNumLayers > LAYER_ULLAGE ) pruneLayers(); - std::shared_ptr<SlideViewLayer> xViewLayer( new SlideViewLayer(mpCanvas, - getTransformation(), - rLayerBounds, - maUserSize, - this) ); + auto xViewLayer = std::make_shared<SlideViewLayer>(mpCanvas, + getTransformation(), + rLayerBounds, + maUserSize, + this); maViewLayers.push_back(xViewLayer); return xViewLayer; diff --git a/slideshow/source/engine/smilfunctionparser.cxx b/slideshow/source/engine/smilfunctionparser.cxx index 2ec3d8dc4d3c..a2da99a4f29e 100644 --- a/slideshow/source/engine/smilfunctionparser.cxx +++ b/slideshow/source/engine/smilfunctionparser.cxx @@ -247,10 +247,9 @@ namespace slideshow { // push complex node, that calcs the value on demand rNodeStack.push( - std::shared_ptr<ExpressionNode>( - new UnaryFunctionExpression( + std::make_shared<UnaryFunctionExpression>( maFunctor, - pArg ) ) ); + pArg ) ); } } diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index ac9649258054..e455e60d84db 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -56,14 +56,14 @@ private: { // Cf. // filter/source/config/fragments/filters/MathML_XML__Math_.xcu - std::shared_ptr<SfxFilter> pFilter(new SfxFilter(MATHML_XML, + auto pFilter = std::make_shared<SfxFilter>(MATHML_XML, OUString(), SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::TEMPLATE, SotClipboardFormatId::STARCALC_8, "MathML 2.0", OUString(), OUString(), - "private:factory/smath*")); + "private:factory/smath*"); pFilter->SetVersion(SOFFICE_FILEFORMAT_60); mxDocShell = new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT | diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 6d72a1219a50..ea3007e502d5 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -191,7 +191,7 @@ namespace svt { namespace uno weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); auto xPage = std::make_unique<EmptyPage>(pPageContainer, this); - std::shared_ptr< WizardPageController > pController(new WizardPageController(xPage->GetContainer(), m_xController, nPageId)); + auto pController = std::make_shared<WizardPageController>(xPage->GetContainer(), m_xController, nPageId); m_aPageControllers[xPage.get()] = pController; diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx index 9f92a93ae909..a4d2ee39b2c2 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx @@ -763,7 +763,7 @@ public: } void operator()( double n ) const { - mxContext->maOperandStack.push( std::shared_ptr<ExpressionNode>( new ConstantValueExpression( n ) ) ); + mxContext->maOperandStack.push( std::make_shared<ConstantValueExpression>( n ) ); } }; @@ -787,17 +787,17 @@ public: case ExpressionFunct::EnumAdjustment : { OUString aVal( rFirst + 1, rSecond - rFirst, RTL_TEXTENCODING_UTF8 ); - mxContext->maOperandStack.push( std::shared_ptr<ExpressionNode>( new AdjustmentExpression( *mxContext->mpCustoShape, aVal.toInt32() ) ) ); + mxContext->maOperandStack.push( std::make_shared<AdjustmentExpression>( *mxContext->mpCustoShape, aVal.toInt32() ) ); } break; case ExpressionFunct::EnumEquation : { OUString aVal( rFirst + 1, rSecond - rFirst, RTL_TEXTENCODING_UTF8 ); - mxContext->maOperandStack.push( std::shared_ptr<ExpressionNode>( new EquationExpression( *mxContext->mpCustoShape, aVal.toInt32() ) ) ); + mxContext->maOperandStack.push( std::make_shared<EquationExpression>( *mxContext->mpCustoShape, aVal.toInt32() ) ); } break; default: - mxContext->maOperandStack.push( std::shared_ptr<ExpressionNode>( new EnumValueExpression( *mxContext->mpCustoShape, meFunct ) ) ); + mxContext->maOperandStack.push( std::make_shared<EnumValueExpression>( *mxContext->mpCustoShape, meFunct ) ); } } }; @@ -826,9 +826,9 @@ public: rNodeStack.pop(); if( pArg->isConstant() ) // check for constness - rNodeStack.push( std::shared_ptr<ExpressionNode>( new ConstantValueExpression( UnaryFunctionExpression::getValue( meFunct, pArg ) ) ) ); + rNodeStack.push( std::make_shared<ConstantValueExpression>( UnaryFunctionExpression::getValue( meFunct, pArg ) ) ); else // push complex node, that calcs the value on demand - rNodeStack.push( std::shared_ptr<ExpressionNode>( new UnaryFunctionExpression( meFunct, pArg ) ) ); + rNodeStack.push( std::make_shared<UnaryFunctionExpression>( meFunct, pArg ) ); } }; @@ -866,10 +866,10 @@ public: rNodeStack.pop(); // create combined ExpressionNode - std::shared_ptr<ExpressionNode> pNode( new BinaryFunctionExpression( meFunct, pFirstArg, pSecondArg ) ); + auto pNode = std::make_shared<BinaryFunctionExpression>( meFunct, pFirstArg, pSecondArg ); // check for constness if( pFirstArg->isConstant() && pSecondArg->isConstant() ) // call the operator() at pNode, store result in constant value ExpressionNode. - rNodeStack.push( std::shared_ptr<ExpressionNode>( new ConstantValueExpression( (*pNode)() ) ) ); + rNodeStack.push( std::make_shared<ConstantValueExpression>( (*pNode)() ) ); else // push complex node, that calcs the value on demand rNodeStack.push( pNode ); } @@ -901,10 +901,10 @@ public: rNodeStack.pop(); // create combined ExpressionNode - std::shared_ptr<ExpressionNode> pNode( new IfExpression( pFirstArg, pSecondArg, pThirdArg ) ); + auto pNode = std::make_shared<IfExpression>( pFirstArg, pSecondArg, pThirdArg ); // check for constness if( pFirstArg->isConstant() && pSecondArg->isConstant() && pThirdArg->isConstant() ) - rNodeStack.push( std::shared_ptr<ExpressionNode>( new ConstantValueExpression( (*pNode)() ) ) ); // call the operator() at pNode, store result in constant value ExpressionNode. + rNodeStack.push( std::make_shared<ConstantValueExpression>( (*pNode)() ) ); // call the operator() at pNode, store result in constant value ExpressionNode. else rNodeStack.push( pNode ); // push complex node, that calcs the value on demand } diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index d136104b5e50..ff323461cfa5 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -827,8 +827,8 @@ svx::SvxShowCharSetItem* SvxShowCharSet::ImplGetItem( int _nPos ) if ( aFind == m_aItems.end() ) { OSL_ENSURE(m_xAccessible.is(), "Who wants to create a child of my table without a parent?"); - std::shared_ptr<svx::SvxShowCharSetItem> xItem(new svx::SvxShowCharSetItem(*this, - m_xAccessible.get(), sal::static_int_cast< sal_uInt16 >(_nPos))); + auto xItem = std::make_shared<svx::SvxShowCharSetItem>(*this, + m_xAccessible.get(), sal::static_int_cast< sal_uInt16 >(_nPos)); aFind = m_aItems.emplace(_nPos, xItem).first; OUStringBuffer buf; buf.appendUtf32( mxFontCharMap->GetCharFromIndex( _nPos ) ); diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index f8224e3d75b8..5bb302707769 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -71,7 +71,7 @@ static const char cRubyCharStyleName[] = "RubyCharStyleName"; SvxRubyChildWindow::SvxRubyChildWindow(vcl::Window* _pParent, sal_uInt16 nId,SfxBindings* pBindings, SfxChildWinInfo const * pInfo) : SfxChildWindow(_pParent, nId) { - std::shared_ptr<SvxRubyDialog> xDlg(new SvxRubyDialog(pBindings, this, _pParent->GetFrameWeld())); + auto xDlg = std::make_shared<SvxRubyDialog>(pBindings, this, _pParent->GetFrameWeld()); SetController(xDlg); xDlg->Initialize(pInfo); } diff --git a/svx/source/dialog/searchcharmap.cxx b/svx/source/dialog/searchcharmap.cxx index 115ca8b36ba7..09868195aa66 100644 --- a/svx/source/dialog/searchcharmap.cxx +++ b/svx/source/dialog/searchcharmap.cxx @@ -404,8 +404,8 @@ svx::SvxShowCharSetItem* SvxSearchCharSet::ImplGetItem( int _nPos ) if ( aFind == m_aItems.end() ) { OSL_ENSURE(m_xAccessible.is(), "Who wants to create a child of my table without a parent?"); - std::shared_ptr<svx::SvxShowCharSetItem> xItem(new svx::SvxShowCharSetItem(*this, - m_xAccessible.get(), sal::static_int_cast< sal_uInt16 >(_nPos))); + auto xItem = std::make_shared<svx::SvxShowCharSetItem>(*this, + m_xAccessible.get(), sal::static_int_cast< sal_uInt16 >(_nPos)); aFind = m_aItems.emplace(_nPos, xItem).first; OUStringBuffer buf; std::unordered_map<sal_Int32,sal_UCS4>::const_iterator got = m_aItemList.find (_nPos); diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx index d465036d1edf..b8856fdd53b1 100644 --- a/svx/source/unodraw/unobrushitemhelper.cxx +++ b/svx/source/unodraw/unobrushitemhelper.cxx @@ -189,7 +189,7 @@ static std::shared_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& r aFillColor.SetTransparency(aTargetTrans); } - return std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aFillColor, nBackgroundID)); + return std::make_shared<SvxBrushItem>(aFillColor, nBackgroundID); } std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack) @@ -207,10 +207,10 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo aFillColor.SetTransparency(0xff); - return std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aFillColor, nBackgroundID)); + return std::make_shared<SvxBrushItem>(aFillColor, nBackgroundID); } - std::shared_ptr<SvxBrushItem> aRetval(new SvxBrushItem(nBackgroundID)); + auto aRetval = std::make_shared<SvxBrushItem>(nBackgroundID); switch(pXFillStyleItem->GetValue()) { @@ -249,7 +249,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo aMixedColor.SetTransparency(aTargetTrans); } - aRetval = std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aMixedColor, nBackgroundID)); + aRetval = std::make_shared<SvxBrushItem>(aMixedColor, nBackgroundID); break; } case drawing::FillStyle_HATCH: @@ -281,7 +281,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); aHatchColor.SetTransparency(aTargetTrans); - aRetval = std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aHatchColor, nBackgroundID)); + aRetval = std::make_shared<SvxBrushItem>(aHatchColor, nBackgroundID); } break; @@ -324,7 +324,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo } // create with given graphic and position - aRetval = std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aGraphic, aSvxGraphicPosition, nBackgroundID)); + aRetval = std::make_shared<SvxBrushItem>(aGraphic, aSvxGraphicPosition, nBackgroundID); // get evtl. mixed transparence const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 37283fa085f6..835c2e61d6d6 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -320,9 +320,9 @@ svx::PropertyChangeNotifier& SvxShape::getShapePropertyChangeNotifier() void SvxShape::impl_construct() { mpImpl->maPropertyNotifier.registerProvider( svx::ShapeProperty::Position, - std::shared_ptr<svx::IPropertyValueProvider>( new ShapePositionProvider( *mpImpl ) ) ); + std::make_shared<ShapePositionProvider>( *mpImpl ) ); mpImpl->maPropertyNotifier.registerProvider( svx::ShapeProperty::Size, - std::shared_ptr<svx::IPropertyValueProvider>( new ShapeSizeProvider( *mpImpl ) ) ); + std::make_shared<ShapeSizeProvider>( *mpImpl ) ); if ( HasSdrObject() ) { diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index 14aa0aa39c56..5db4e52fcb9e 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -75,11 +75,11 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, const OUString &rUserData, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, unsigned int nFilterVersion, bool bExport) { - std::shared_ptr<const SfxFilter> pFilter(new SfxFilter( + auto pFilter = std::make_shared<SfxFilter>( rFilter, OUString(), nFilterFlags, nClipboardID, OUString(), OUString(), - rUserData, OUString())); - const_cast<SfxFilter*>(pFilter.get())->SetVersion(nFilterVersion); + rUserData, OUString()); + pFilter->SetVersion(nFilterVersion); SwDocShellRef xDocShRef = new SwDocShell; SfxMedium* pSrcMed = new SfxMedium(rURL, StreamMode::STD_READ); diff --git a/sw/qa/core/filters-test2.cxx b/sw/qa/core/filters-test2.cxx index 6ce9376f681c..e2c3e7e7766f 100644 --- a/sw/qa/core/filters-test2.cxx +++ b/sw/qa/core/filters-test2.cxx @@ -74,10 +74,9 @@ bool SwFiltersTest2::filter(const OUString& rFilter, const OUString& rURL, SotClipboardFormatId nClipboardID, unsigned int nFilterVersion, bool bExport) { - std::shared_ptr<const SfxFilter> pFilter(new SfxFilter(rFilter, OUString(), nFilterFlags, - nClipboardID, OUString(), OUString(), - rUserData, OUString())); - const_cast<SfxFilter*>(pFilter.get())->SetVersion(nFilterVersion); + auto pFilter = std::make_shared<SfxFilter>(rFilter, OUString(), nFilterFlags, nClipboardID, + OUString(), OUString(), rUserData, OUString()); + pFilter->SetVersion(nFilterVersion); SwDocShellRef xDocShRef = new SwDocShell; SfxMedium* pSrcMed = new SfxMedium(rURL, StreamMode::STD_READ); diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 22cd289c7f27..1d7c131c4d5a 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -208,10 +208,10 @@ void SwDocTest::testFileNameFields() OUString sFileURL = aTempFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); SfxMedium aDstMed(sFileURL, StreamMode::STD_READWRITE); - std::shared_ptr<SfxFilter> pFilter(new SfxFilter( + auto pFilter = std::make_shared<SfxFilter>( "Text", OUString(), SfxFilterFlags::NONE, SotClipboardFormatId::NONE, OUString(), OUString(), - "TEXT", OUString() )); + "TEXT", OUString() ); aDstMed.SetFilter(pFilter); m_xDocShRef->DoSaveAs(aDstMed); diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx index d5795458ca8f..67887904e891 100644 --- a/sw/source/core/tox/ToxTextGenerator.cxx +++ b/sw/source/core/tox/ToxTextGenerator.cxx @@ -275,7 +275,7 @@ ToxTextGenerator::GenerateText(SwDoc* pDoc, const std::vector<std::unique_ptr<Sw /*static*/ std::shared_ptr<SfxItemSet> ToxTextGenerator::CollectAttributesForTox(const SwTextAttr& hint, SwAttrPool& pool) { - std::shared_ptr<SfxItemSet> retval(new SfxItemSet(pool)); + auto retval = std::make_shared<SfxItemSet>(pool); if (hint.Which() != RES_TXTATR_AUTOFMT) { return retval; } diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index a5b68cd902d6..8c212feb8962 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -891,8 +891,8 @@ sal_uInt16 SaveTable::AddFormat( SwFrameFormat* pFormat, bool bIsLine ) if( SIZE_MAX == nRet ) { // Create copy of ItemSet - std::shared_ptr<SfxItemSet> pSet( new SfxItemSet( *pFormat->GetAttrSet().GetPool(), - bIsLine ? aTableLineSetRange : aTableBoxSetRange ) ); + auto pSet = std::make_shared<SfxItemSet>( *pFormat->GetAttrSet().GetPool(), + bIsLine ? aTableLineSetRange : aTableBoxSetRange ); pSet->Put( pFormat->GetAttrSet() ); // When a formula is set, never save the value. It possibly must be // recalculated. @@ -1418,8 +1418,7 @@ SwUndoTableAutoFormat::~SwUndoTableAutoFormat() void SwUndoTableAutoFormat::SaveBoxContent( const SwTableBox& rBox ) { - std::shared_ptr<SwUndoTableNumFormat> const p(new SwUndoTableNumFormat(rBox)); - m_Undos.push_back(p); + m_Undos.push_back(std::make_shared<SwUndoTableNumFormat>(rBox)); } void diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index 365736807059..cd1315b59cd0 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -142,8 +142,8 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys, if( !m_pFrameFormats || m_pFrameFormats->end() == ( it = std::find( m_pFrameFormats->begin(), m_pFrameFormats->end(), pFormat ) ) ) { - std::shared_ptr<SwUndoInsLayFormat> const pFlyUndo( - new SwUndoInsLayFormat(pFormat, 0, 0)); + std::shared_ptr<SwUndoInsLayFormat> const pFlyUndo = + std::make_shared<SwUndoInsLayFormat>(pFormat, 0, 0); m_FlyUndos.push_back(pFlyUndo); } else diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index e6a7cfa6c3ea..685f29fbd1da 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -865,7 +865,7 @@ namespace { void lcl_addShapePropertyEventFactories( SdrObject& _rObj, SwXShape& _rShape ) { - std::shared_ptr<svx::IPropertyValueProvider> pProvider( new svx::PropertyValueProvider( _rShape, "AnchorType" ) ); + auto pProvider = std::make_shared<svx::PropertyValueProvider>( _rShape, "AnchorType" ); _rObj.getShapePropertyChangeNotifier().registerProvider( svx::ShapeProperty::TextDocAnchor, pProvider ); } } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 6793e74602f0..0b0e1536f34a 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -3782,7 +3782,7 @@ SwAutoStylesEnumImpl::SwAutoStylesEnumImpl( SwDoc* pInitDoc, IStyleAccess::SwAut std::pair< sal_uInt16, text::RubyAdjust > aPair( pRubyItem->GetPosition(), pRubyItem->GetAdjustment() ); if ( aRubyMap.insert( aPair ).second ) { - std::shared_ptr<SfxItemSet> pItemSet( new SfxItemSet( rAttrPool, svl::Items<RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY>{} ) ); + auto pItemSet = std::make_shared<SfxItemSet>( rAttrPool, svl::Items<RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY>{} ); pItemSet->Put( *pRubyItem ); mAutoStyles.push_back( pItemSet ); } diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx index 93cda1a66982..f13127fcabd7 100644 --- a/sw/source/filter/docx/swdocxreader.cxx +++ b/sw/source/filter/docx/swdocxreader.cxx @@ -50,7 +50,7 @@ ErrCode SwDOCXReader::Read(SwDoc& rDoc, const OUString& /* rBaseURL */, SwPaM& r return ERR_SWG_READ_ERROR; // We want to work in an empty paragraph. - std::shared_ptr<SwNodeIndex> pSttNdIdx(new SwNodeIndex(rDoc.GetNodes())); + auto pSttNdIdx = std::make_shared<SwNodeIndex>(rDoc.GetNodes()); const SwPosition* pPos = rPam.GetPoint(); rDoc.getIDocumentContentOperations().SplitNode(*pPos, false); rDoc.SetTextFormatColl(rPam, rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, false)); diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 6d5fadbde1a6..dc9c5a7e9180 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -1616,8 +1616,8 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper, const SwStartNode* pPrevStartNd = GetPrevBoxStartNode( nTopRow, nStartCol ); - std::shared_ptr<HTMLTableCnts> xCnts(new HTMLTableCnts( - m_pParser->InsertTableSection(pPrevStartNd))); + auto xCnts = std::make_shared<HTMLTableCnts>( + m_pParser->InsertTableSection(pPrevStartNd)); const std::shared_ptr<SwHTMLTableLayoutCnts> xCntsLayoutInfo = xCnts->CreateLayoutInfo(); diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 394da93ad3a0..11fa1ea8744b 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -60,7 +60,7 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam // the end position. const uno::Reference<text::XTextRange> xInsertPosition = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr); - std::shared_ptr<SwNodeIndex> pSttNdIdx(new SwNodeIndex(rDoc.GetNodes())); + auto pSttNdIdx = std::make_shared<SwNodeIndex>(rDoc.GetNodes()); const SwPosition* pPos = rPam.GetPoint(); // Step 2: Split once and remember the node that has been split. @@ -69,7 +69,7 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam // Step 3: Split again. rDoc.getIDocumentContentOperations().SplitNode(*pPos, false); - std::shared_ptr<SwNodeIndex> pSttNdIdx2(new SwNodeIndex(rDoc.GetNodes())); + auto pSttNdIdx2 = std::make_shared<SwNodeIndex>(rDoc.GetNodes()); *pSttNdIdx2 = pPos->nNode.GetIndex(); // Step 4: Insert all content into the new node diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 4001977502c3..b01944d89467 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1513,7 +1513,7 @@ SvStream* SwEscherExGlobal::ImplQueryPictureStream() } SwBasicEscherEx::SwBasicEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) - : EscherEx( std::shared_ptr<EscherExGlobal>( new SwEscherExGlobal ), pStrm), rWrt(rWW8Wrt), pEscherStrm(pStrm) + : EscherEx( std::make_shared<SwEscherExGlobal>(), pStrm), rWrt(rWW8Wrt), pEscherStrm(pStrm) { Init(); } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index b0dd924a1aa7..40a4729a2286 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1792,7 +1792,7 @@ bool WW8_WrPlcSepx::WriteKFText( WW8Export& rWrt ) for (const WW8_SepInfo & rSepInfo : aSects) { - std::shared_ptr<WW8_PdAttrDesc> const pAttrDesc(new WW8_PdAttrDesc); + auto pAttrDesc = std::make_shared<WW8_PdAttrDesc>(); m_SectionAttributes.push_back(pAttrDesc); rWrt.SectionProperties( rSepInfo, pAttrDesc.get() ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 97dd8ae286d2..12315b438d3e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -801,8 +801,8 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, // with a Frame, else if( bIsSimpleDrawingTextBox ) { - std::shared_ptr<SvxMSDffShapeInfo> const xTmpRec( - new SvxMSDffShapeInfo(0, pImpRec->nShapeId)); + std::shared_ptr<SvxMSDffShapeInfo> const xTmpRec = + std::make_shared<SvxMSDffShapeInfo>(0, pImpRec->nShapeId); SvxMSDffShapeInfos_ById::const_iterator const it = GetShapeInfos()->find(xTmpRec); diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 19047d79f974..c271f1435632 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -619,7 +619,7 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void) } SwView* pSourceView = xConfigItem->GetSourceView(); - std::shared_ptr<SaveMonitor> xSaveMonitor(new SaveMonitor(m_xDialog.get())); + auto xSaveMonitor = std::make_shared<SaveMonitor>(m_xDialog.get()); xSaveMonitor->m_xDocName->set_label(pSourceView->GetDocShell()->GetTitle(22)); xSaveMonitor->m_xPrinter->set_label( INetURLObject( sPath ).getFSysPath( FSysStyle::Detect ) ); m_bCancelSaving = false; diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index c784e0bb6b99..cb6f6ea800be 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -401,8 +401,8 @@ class BuiltInIndexHelper public: explicit BuiltInIndexHelper( const uno::Reference< frame::XModel >& xModel ) { - std::shared_ptr< PropertGetSetHelper > aStandardHelper( new BuiltinPropertyGetSetHelper( xModel ) ); - std::shared_ptr< PropertGetSetHelper > aUsingStatsHelper( new StatisticPropertyGetSetHelper( xModel ) ); + auto aStandardHelper = std::make_shared<BuiltinPropertyGetSetHelper>( xModel ); + auto aUsingStatsHelper = std::make_shared<StatisticPropertyGetSetHelper>( xModel ); m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", aStandardHelper ); m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", aStandardHelper ); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index d20e923f2584..95f13f4cfd03 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1211,7 +1211,7 @@ void SwDocShell::Execute(SfxRequest& rReq) break; case SID_CLASSIFICATION_DIALOG: { - std::shared_ptr<svx::ClassificationDialog> xDialog(new svx::ClassificationDialog(GetView()->GetFrameWeld(), false)); + auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), false); SwWrtShell* pShell = GetWrtShell(); std::vector<svx::ClassificationResult> aInput = pShell->CollectAdvancedClassification(); @@ -1226,10 +1226,10 @@ void SwDocShell::Execute(SfxRequest& rReq) case SID_PARAGRAPH_SIGN_CLASSIFY_DLG: { SwWrtShell* pShell = GetWrtShell(); - std::shared_ptr<svx::ClassificationDialog> xDialog(new svx::ClassificationDialog(GetView()->GetFrameWeld(), true, [pShell]() + auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), true, [pShell]() { pShell->SignParagraph(); - })); + }); std::vector<svx::ClassificationResult> aInput = pShell->CollectParagraphClassification(); xDialog->setupValues(aInput); @@ -1265,8 +1265,8 @@ void SwDocShell::Execute(SfxRequest& rReq) { SfxViewShell* pViewShell = GetView() ? GetView() : SfxViewShell::Current(); SfxBindings& rBindings( pViewShell->GetViewFrame()->GetBindings() ); - std::shared_ptr<SwWatermarkDialog> xDlg(new SwWatermarkDialog(pViewShell->GetViewFrame()->GetWindow().GetFrameWeld(), - rBindings)); + auto xDlg = std::make_shared<SwWatermarkDialog>(pViewShell->GetViewFrame()->GetWindow().GetFrameWeld(), + rBindings); weld::DialogController::runAsync(xDlg, [](sal_Int32 /*nResult*/){}); } } diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 61cb6a0df6cd..249b549dcb0e 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -890,7 +890,7 @@ void SwDocShell::Edit( SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); VclPtr<SfxAbstractApplyTabDialog> pDlg(pFact->CreateTemplateDialog(GetView()->GetFrameWeld(), *xTmp, nFamily, sPage, pCurrShell, bNew)); - std::shared_ptr<ApplyStyle> pApplyStyleHelper(new ApplyStyle(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified)); + auto pApplyStyleHelper = std::make_shared<ApplyStyle>(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified); pDlg->SetApplyHdl(LINK(pApplyStyleHelper.get(), ApplyStyle, ApplyHdl)); std::shared_ptr<SfxRequest> pRequest; diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 9ee2f5784703..c6e1ae74877f 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -593,7 +593,7 @@ void SwTableShell::Execute(SfxRequest &rReq) if (pItem) pDlg->SetCurPageId(OUStringToOString(static_cast<const SfxStringItem *>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8)); - std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + auto pRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync([pDlg, pRequest, pTableRep, &rBindings, &rSh](sal_Int32 nResult){ diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 08097faf0205..ee09143f510e 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -113,7 +113,7 @@ static void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, { FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &rWrtSh.GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); - std::shared_ptr<SfxItemSet> pCoreSet(new SfxItemSet( + auto pCoreSet = std::make_shared<SfxItemSet>( rWrtSh.GetView().GetPool(), svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END - 1, @@ -123,7 +123,7 @@ static void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, SID_HTML_MODE, SID_HTML_MODE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, - FN_PARAM_SELECTION, FN_PARAM_SELECTION>{})); + FN_PARAM_SELECTION, FN_PARAM_SELECTION>{}); rWrtSh.GetCurAttr(*pCoreSet); bool bSel = rWrtSh.HasSelection(); @@ -1069,7 +1069,7 @@ void SwTextShell::Execute(SfxRequest &rReq) } else if (pDlg) { - std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + auto pRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync([pDlg, &rWrtSh, pRequest, nDefDist](sal_Int32 nResult){ diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx index 3b2fb5ab1457..aadc698ac024 100644 --- a/sw/source/uibase/shells/txtnum.cxx +++ b/sw/source/uibase/shells/txtnum.cxx @@ -185,7 +185,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) if ( pPageItem ) pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) ); - std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + auto pRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync([aSet, pDlg, pNumRuleAtCurrentSelection, pRequest, this](sal_Int32 nResult){ diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 2eb278b0ea4d..39db47b51b99 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -2137,12 +2137,12 @@ librdf_TypeConverter::extractResource_NoLock( const OString label( OUStringToOString(xBlankNode->getStringValue(), RTL_TEXTENCODING_UTF8) ); - return std::shared_ptr<Resource>(new BlankNode(label)); + return std::make_shared<BlankNode>(label); } else { // assumption: everything else is URI const OString uri( OUStringToOString(i_xResource->getStringValue(), RTL_TEXTENCODING_UTF8) ); - return std::shared_ptr<Resource>(new URI(uri)); + return std::make_shared<URI>(uri); } } @@ -2225,7 +2225,7 @@ librdf_TypeConverter::extractNode_NoLock( type = OUStringToOString(xType->getStringValue(), RTL_TEXTENCODING_UTF8); } - return std::shared_ptr<Node>(new Literal(val, lang, type)); + return std::make_shared<Literal>(val, lang, type); } // extract blank or URI or literal node - call without Mutex locked diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx index dd5c9895273e..e2ccd1ffc6af 100644 --- a/vcl/qt5/Qt5Menu.cxx +++ b/vcl/qt5/Qt5Menu.cxx @@ -195,7 +195,7 @@ void Qt5Menu::ReinitializeActionGroup(unsigned nPos) && (pPrevItem->mpActionGroup == pNextItem->mpActionGroup)) { std::shared_ptr<QActionGroup> pFirstActionGroup = pPrevItem->mpActionGroup; - std::shared_ptr<QActionGroup> pSecondActionGroup(new QActionGroup(nullptr)); + auto pSecondActionGroup = std::make_shared<QActionGroup>(nullptr); pSecondActionGroup->setExclusive(true); auto actions = pFirstActionGroup->actions(); diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index 9fbcabb95cc1..43ca203ff2d2 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -870,7 +870,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co std::shared_ptr<PhysicalFontCollection> PhysicalFontCollection::Clone() const { - std::shared_ptr<PhysicalFontCollection> xClonedCollection(new PhysicalFontCollection); + auto xClonedCollection = std::make_shared<PhysicalFontCollection>(); xClonedCollection->mpPreMatchHook = mpPreMatchHook; xClonedCollection->mpFallbackHook = mpFallbackHook; diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index f5f70e30e725..d02a73016cd1 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1345,7 +1345,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<BorderHandler> pBorderHandler( new BorderHandler( true ) ); + auto pBorderHandler = std::make_shared<BorderHandler>( true ); pProperties->resolve(*pBorderHandler); PropertyIds eBorderId = PropertyIds( 0 ); PropertyIds eBorderDistId = PropertyIds( 0 ); @@ -1400,7 +1400,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<CellColorHandler> pCellColorHandler( new CellColorHandler ); + auto pCellColorHandler = std::make_shared<CellColorHandler>(); pCellColorHandler->setOutputFormat( CellColorHandler::Paragraph ); bool bEnableTempGrabBag = !pCellColorHandler->isInteropGrabBagEnabled(); if( bEnableTempGrabBag ) @@ -1797,7 +1797,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<CellColorHandler> pCellColorHandler( new CellColorHandler ); + auto pCellColorHandler = std::make_shared<CellColorHandler>(); pCellColorHandler->setOutputFormat( CellColorHandler::Character ); pProperties->resolve(*pCellColorHandler); rContext->InsertProps(pCellColorHandler->getProperties().get()); @@ -1900,7 +1900,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<BorderHandler> pBorderHandler( new BorderHandler( true ) ); + auto pBorderHandler = std::make_shared<BorderHandler>( true ); pProperties->resolve(*pBorderHandler); rContext->Insert( PROP_CHAR_TOP_BORDER, uno::makeAny( pBorderHandler->getBorderLine())); @@ -2397,7 +2397,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get( ) ) { - std::shared_ptr<OLEHandler> pOLEHandler( new OLEHandler(*this) ); + auto pOLEHandler = std::make_shared<OLEHandler>(*this); pProperties->resolve(*pOLEHandler); if ( pOLEHandler->isOLEObject( ) ) { diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 63a0e7491fb4..bf2ffb859ab6 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1080,7 +1080,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Anchor_positionH: // 90976; { // Use a special handler for the positioning - std::shared_ptr<PositionHandler> pHandler( new PositionHandler( m_pImpl->m_rPositionOffsets, m_pImpl->m_rAligns )); + auto pHandler = std::make_shared<PositionHandler>( m_pImpl->m_rPositionOffsets, m_pImpl->m_rAligns ); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get( ) ) { @@ -1107,7 +1107,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Anchor_positionV: // 90977; { // Use a special handler for the positioning - std::shared_ptr<PositionHandler> pHandler( new PositionHandler( m_pImpl->m_rPositionOffsets, m_pImpl->m_rAligns)); + auto pHandler = std::make_shared<PositionHandler>( m_pImpl->m_rPositionOffsets, m_pImpl->m_rAligns); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get( ) ) { diff --git a/writerfilter/source/dmapper/PageBordersHandler.cxx b/writerfilter/source/dmapper/PageBordersHandler.cxx index 585e9619f710..1cecd891e738 100644 --- a/writerfilter/source/dmapper/PageBordersHandler.cxx +++ b/writerfilter/source/dmapper/PageBordersHandler.cxx @@ -94,7 +94,7 @@ void PageBordersHandler::lcl_sprm( Sprm& rSprm ) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<BorderHandler> pBorderHandler( new BorderHandler( true ) ); + auto pBorderHandler = std::make_shared<BorderHandler>( true ); pProperties->resolve(*pBorderHandler); BorderPosition ePos = BorderPosition( 0 ); switch( rSprm.getId( ) ) diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 034807149afb..9927f253ed4d 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -578,7 +578,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get() && m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE) { - std::shared_ptr<TblStylePrHandler> pTblStylePrHandler(new TblStylePrHandler(m_pImpl->m_rDMapper)); + auto pTblStylePrHandler = std::make_shared<TblStylePrHandler>(m_pImpl->m_rDMapper); pProperties->resolve(*pTblStylePrHandler); StyleSheetEntry* pEntry = m_pImpl->m_pCurrentEntry.get(); TableStyleSheetEntry& rTableEntry = dynamic_cast<TableStyleSheetEntry&>(*pEntry); @@ -652,7 +652,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<TblStylePrHandler> pTblStylePrHandler( new TblStylePrHandler( m_pImpl->m_rDMapper ) ); + auto pTblStylePrHandler = std::make_shared<TblStylePrHandler>( m_pImpl->m_rDMapper ); pProperties->resolve( *pTblStylePrHandler ); // Add the properties to the table style @@ -716,7 +716,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<BorderHandler> pBorderHandler( new BorderHandler(m_pImpl->m_rDMapper.IsOOXMLImport()) ); + auto pBorderHandler = std::make_shared<BorderHandler>(m_pImpl->m_rDMapper.IsOOXMLImport()); pProperties->resolve(*pBorderHandler); m_pImpl->m_pCurrentEntry->pProperties->InsertProps( pBorderHandler->getProperties()); diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index 339727689782..91a31800c740 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -101,7 +101,7 @@ namespace dmapper { nToken = XML_tableRowDelete; break; } - std::shared_ptr<TrackChangesHandler> pTrackChangesHandler( new TrackChangesHandler( nToken ) ); + auto pTrackChangesHandler = std::make_shared<TrackChangesHandler>( nToken ); pProperties->resolve(*pTrackChangesHandler); TablePropertyMapPtr pPropMap( new TablePropertyMap ); @@ -132,7 +132,7 @@ namespace dmapper { throw lang::IllegalArgumentException("illegal redline token type", nullptr, 0); break; } - std::shared_ptr<TrackChangesHandler> pTrackChangesHandler( new TrackChangesHandler( nToken ) ); + auto pTrackChangesHandler = std::make_shared<TrackChangesHandler>( nToken ); pProperties->resolve(*pTrackChangesHandler); TablePropertyMapPtr pPropMap( new TablePropertyMap ); @@ -190,7 +190,7 @@ namespace dmapper { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<BorderHandler> pBorderHandler(new BorderHandler(true)); + auto pBorderHandler = std::make_shared<BorderHandler>(true); if (m_pCurrentInteropGrabBag) pBorderHandler->enableInteropGrabBag("tblBorders"); pProperties->resolve(*pBorderHandler); @@ -238,7 +238,7 @@ namespace dmapper { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if (pProperties.get()) { - std::shared_ptr<CellMarginHandler> pCellMarginHandler(new CellMarginHandler); + auto pCellMarginHandler = std::make_shared<CellMarginHandler>(); if (m_pCurrentInteropGrabBag) pCellMarginHandler->enableInteropGrabBag("tcMar"); pProperties->resolve(*pCellMarginHandler); @@ -278,7 +278,7 @@ namespace dmapper { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<CellColorHandler> pCellColorHandler( new CellColorHandler ); + auto pCellColorHandler = std::make_shared<CellColorHandler>(); pCellColorHandler->enableInteropGrabBag("shd"); //enable to store shd unsupported props in grab bag pProperties->resolve( *pCellColorHandler ); TablePropertyMapPtr pPropertyMap = pCellColorHandler->getProperties(); @@ -298,7 +298,7 @@ namespace dmapper { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) { - std::shared_ptr<CellMarginHandler> pCellMarginHandler( new CellMarginHandler ); + auto pCellMarginHandler = std::make_shared<CellMarginHandler>(); if (m_pCurrentInteropGrabBag) pCellMarginHandler->enableInteropGrabBag("tblCellMar"); pProperties->resolve( *pCellMarginHandler ); diff --git a/writerfilter/source/dmapper/TblStylePrHandler.cxx b/writerfilter/source/dmapper/TblStylePrHandler.cxx index beff017d19a8..3d403d483b55 100644 --- a/writerfilter/source/dmapper/TblStylePrHandler.cxx +++ b/writerfilter/source/dmapper/TblStylePrHandler.cxx @@ -175,7 +175,7 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm) writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if ( pProperties.get() ) { - std::shared_ptr<CellMarginHandler> pCellMarginHandler(new CellMarginHandler); + auto pCellMarginHandler = std::make_shared<CellMarginHandler>(); pCellMarginHandler->enableInteropGrabBag("tblCellMar"); pProperties->resolve( *pCellMarginHandler ); m_aInteropGrabBag.push_back(pCellMarginHandler->getInteropGrabBag()); diff --git a/writerperfect/qa/unit/WPXSvStreamTest.cxx b/writerperfect/qa/unit/WPXSvStreamTest.cxx index b13fc91e0e7c..cbd0899b54bd 100644 --- a/writerperfect/qa/unit/WPXSvStreamTest.cxx +++ b/writerperfect/qa/unit/WPXSvStreamTest.cxx @@ -97,7 +97,7 @@ shared_ptr<RVNGInputStream> lcl_createStreamForURL(const OUString& rURL) const Reference<io::XInputStream> xInputStream(xFileAccess->openFileRead(rURL), css::uno::UNO_SET_THROW); - return shared_ptr<RVNGInputStream>(new WPXSvInputStream(xInputStream)); + return std::make_shared<WPXSvInputStream>(xInputStream); } void lcl_testSubStreams(const shared_ptr<RVNGInputStream>& pInput) diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx index ec4a4f18af2c..d83f8acea431 100644 --- a/writerperfect/source/impress/KeynoteImportFilter.cxx +++ b/writerperfect/source/impress/KeynoteImportFilter.cxx @@ -105,7 +105,8 @@ KeynoteImportFilter::detect(css::uno::Sequence<css::beans::PropertyValue>& Descr if (!xInputStream.is()) return OUString(); - std::shared_ptr<librevenge::RVNGInputStream> input(new WPXSvInputStream(xInputStream)); + std::shared_ptr<librevenge::RVNGInputStream> input + = std::make_shared<WPXSvInputStream>(xInputStream); /* Apple Keynote documents come in two variants: * * actual files (zip), only produced by Keynote 5 (at least with diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index 2b9480a96842..db34766a09cb 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -209,7 +209,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) if( !mbExportTables ) return; - std::shared_ptr< XMLTableInfo > xTableInfo( new XMLTableInfo ); + auto xTableInfo = std::make_shared<XMLTableInfo>(); maTableInfoMap[xColumnRowRange] = xTableInfo; try diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index 0da1812c7d58..6caa85c9afbb 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -237,7 +237,7 @@ SvXMLStyleContext* XMLTableImport::CreateTableTemplateContext( sal_uInt16 nPrfx, void XMLTableImport::addTableTemplate( const OUString& rsStyleName, XMLTableTemplate& xTableTemplate ) { - std::shared_ptr< XMLTableTemplate > xPtr( new XMLTableTemplate ); + auto xPtr = std::make_shared<XMLTableTemplate>(); xPtr->swap( xTableTemplate ); maTableTemplates[rsStyleName] = xPtr; } @@ -370,7 +370,7 @@ SvXMLImportContextRef XMLTableImportContext::ImportColumn( sal_uInt16 nPrefix, c { if( mxColumns.is() && (mnCurrentRow == -1) ) try { - std::shared_ptr< ColumnInfo > xInfo ( new ColumnInfo ); + auto xInfo = std::make_shared<ColumnInfo>(); sal_Int32 nRepeated = 1; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index ee6a32f031b8..791976b55c5e 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -1762,8 +1762,8 @@ Reference< xml::sax::XDocumentHandler > importDialogModel( Reference< XModel > const & xDocument ) { // single set of styles and stylenames apply to all containers - std::shared_ptr< std::vector< OUString > > pStyleNames( new std::vector< OUString > ); - std::shared_ptr< std::vector< css::uno::Reference< css::xml::input::XElement > > > pStyles( new std::vector< css::uno::Reference< css::xml::input::XElement > > ); + auto pStyleNames = std::make_shared<std::vector< OUString >>(); + auto pStyles = std::make_shared<std::vector< css::uno::Reference< css::xml::input::XElement > >>(); return ::xmlscript::createDocumentHandler( new DialogImport(xContext, xDialogModel, pStyleNames, pStyles, xDocument)); } |