[Libreoffice-commits] core.git: 2 commits - chart2/source svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Aug 21 06:36:23 UTC 2018
chart2/source/view/charttypes/NetChart.cxx | 4 ++--
chart2/source/view/charttypes/NetChart.hxx | 2 +-
chart2/source/view/charttypes/VSeriesPlotter.cxx | 4 ++--
svx/source/gallery2/gallery1.cxx | 17 ++++++++---------
4 files changed, 13 insertions(+), 14 deletions(-)
New commits:
commit b4ef23955e11a90b54bce189c3300406e9cf15b0
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 20 11:21:37 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 21 08:36:10 2018 +0200
loplugin:useuniqueptr in NetChart
Change-Id: I095ae98b809c1dc938c12b5fbe4427fb08edc604
Reviewed-on: https://gerrit.libreoffice.org/59353
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx
index d94453ea5e3f..6ebca9bfbebf 100644
--- a/chart2/source/view/charttypes/NetChart.cxx
+++ b/chart2/source/view/charttypes/NetChart.cxx
@@ -52,10 +52,10 @@ using namespace ::com::sun::star::chart2;
NetChart::NetChart( const uno::Reference<XChartType>& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bNoArea
- , PlottingPositionHelper* pPlottingPositionHelper
+ , std::unique_ptr<PlottingPositionHelper> pPlottingPositionHelper
)
: VSeriesPlotter( xChartTypeModel, nDimensionCount, true )
- , m_pMainPosHelper(pPlottingPositionHelper)
+ , m_pMainPosHelper(std::move(pPlottingPositionHelper))
, m_bArea(!bNoArea)
, m_bLine(bNoArea)
, m_xSeriesTarget(nullptr)
diff --git a/chart2/source/view/charttypes/NetChart.hxx b/chart2/source/view/charttypes/NetChart.hxx
index 36d648a4e034..2d948d2e2138 100644
--- a/chart2/source/view/charttypes/NetChart.hxx
+++ b/chart2/source/view/charttypes/NetChart.hxx
@@ -35,7 +35,7 @@ public:
NetChart( const css::uno::Reference< css::chart2::XChartType >& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bNoArea
- , PlottingPositionHelper* pPlottingPositionHelper //takes ownership
+ , std::unique_ptr<PlottingPositionHelper> pPlottingPositionHelper //takes ownership
);
virtual ~NetChart() override;
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index b2af514f763c..bad0d71432da 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2601,9 +2601,9 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter(
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
pRet = new PieChart(xChartTypeModel,nDimensionCount, bExcludingPositioning );
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
- pRet = new NetChart(xChartTypeModel,nDimensionCount,true,new PolarPlottingPositionHelper());
+ pRet = new NetChart(xChartTypeModel,nDimensionCount,true,o3tl::make_unique<PolarPlottingPositionHelper>());
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
- pRet = new NetChart(xChartTypeModel,nDimensionCount,false,new PolarPlottingPositionHelper());
+ pRet = new NetChart(xChartTypeModel,nDimensionCount,false,o3tl::make_unique<PolarPlottingPositionHelper>());
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
pRet = new CandleStickChart(xChartTypeModel,nDimensionCount);
else
commit 5779775c6dd831205a296393a2cca26a9120d2ea
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 20 09:54:35 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 21 08:35:59 2018 +0200
loplugin:useuniqueptr in GalleryThemeCacheEntry
Change-Id: Ib9f3e604ca889a938cd41dbf3f59dfa7131fe4da
Reviewed-on: https://gerrit.libreoffice.org/59352
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 87a8c7d3e611..813eff0a563e 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -242,8 +242,8 @@ private:
public:
- GalleryThemeCacheEntry( const GalleryThemeEntry* pThemeEntry, GalleryTheme* pTheme ) :
- mpThemeEntry( pThemeEntry ), mpTheme( pTheme ) {}
+ GalleryThemeCacheEntry( const GalleryThemeEntry* pThemeEntry, std::unique_ptr<GalleryTheme> pTheme ) :
+ mpThemeEntry( pThemeEntry ), mpTheme( std::move(pTheme) ) {}
const GalleryThemeEntry* GetThemeEntry() const { return mpThemeEntry; }
GalleryTheme* GetTheme() const { return mpTheme.get(); }
@@ -703,6 +703,7 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
+ std::unique_ptr<GalleryTheme> pNewTheme;
if( FileExists( aURL ) )
{
std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ ));
@@ -711,14 +712,11 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
{
try
{
- pTheme = new GalleryTheme( this, const_cast<GalleryThemeEntry*>(pThemeEntry) );
- ReadGalleryTheme( *pIStm, *pTheme );
+ pNewTheme.reset( new GalleryTheme( this, const_cast<GalleryThemeEntry*>(pThemeEntry) ) );
+ ReadGalleryTheme( *pIStm, *pNewTheme );
if( pIStm->GetError() )
- {
- delete pTheme;
- pTheme = nullptr;
- }
+ pNewTheme.reset();
}
catch (const css::ucb::ContentCreationException&)
{
@@ -726,8 +724,9 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
}
}
+ pTheme = pNewTheme.get();
if( pTheme )
- aThemeCache.push_back( new GalleryThemeCacheEntry( pThemeEntry, pTheme ));
+ aThemeCache.push_back( new GalleryThemeCacheEntry( pThemeEntry, std::move(pNewTheme) ));
}
}
More information about the Libreoffice-commits
mailing list