summaryrefslogtreecommitdiff
path: root/chart2/source/view
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-22 19:44:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-23 07:30:22 +0100
commit9861aaad25f3e9bf5d78c56143c3f3b727c73007 (patch)
treee4d06cede2c1c1387fd22848087ee5a6b2ddaced /chart2/source/view
parent9a61e9a3356874a23a697ace57a53e3ada505d87 (diff)
loplugin:refcounting in chart2
Change-Id: I4949e67aae74631acc138a3a52621705cda0dd77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111353 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/view')
-rw-r--r--chart2/source/view/main/ChartView.cxx28
1 files changed, 9 insertions, 19 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 93bf35672123..41a9aaa00393 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1178,26 +1178,16 @@ uno::Any SAL_CALL ChartView::getTransferData( const datatransfer::DataFlavor& aF
update();
SvMemoryStream aStream( 1024, 1024 );
- utl::OStreamWrapper* pStreamWrapper = new utl::OStreamWrapper( aStream );
+ rtl::Reference<utl::OStreamWrapper> pStreamWrapper = new utl::OStreamWrapper( aStream );
- uno::Reference< io::XOutputStream > xOutStream( pStreamWrapper );
- uno::Reference< io::XInputStream > xInStream( pStreamWrapper );
- uno::Reference< io::XSeekable > xSeekable( pStreamWrapper );
+ this->getMetaFile( pStreamWrapper, bHighContrastMetaFile );
- if( xOutStream.is() )
- {
- this->getMetaFile( xOutStream, bHighContrastMetaFile );
-
- if( xInStream.is() && xSeekable.is() )
- {
- xSeekable->seek(0);
- sal_Int32 nBytesToRead = xInStream->available();
- uno::Sequence< sal_Int8 > aSeq( nBytesToRead );
- xInStream->readBytes( aSeq, nBytesToRead);
- aRet <<= aSeq;
- xInStream->closeInput();
- }
- }
+ pStreamWrapper->seek(0);
+ sal_Int32 nBytesToRead = pStreamWrapper->available();
+ uno::Sequence< sal_Int8 > aSeq( nBytesToRead );
+ pStreamWrapper->readBytes( aSeq, nBytesToRead);
+ aRet <<= aSeq;
+ pStreamWrapper->closeInput();
return aRet;
}
@@ -3117,7 +3107,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
com_sun_star_comp_chart2_ChartView_get_implementation(css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- ::chart::ChartModel *pChartModel = new ::chart::ChartModel(context);
+ rtl::Reference<::chart::ChartModel> pChartModel = new ::chart::ChartModel(context);
return cppu::acquire(new ::chart::ChartView(context, *pChartModel));
}