[Libreoffice-commits] core.git: 2 commits - filter/source include/filter
Noel Grandin
noel.grandin at collabora.co.uk
Mon Mar 5 06:29:18 UTC 2018
filter/source/msfilter/svdfppt.cxx | 55 +++++++++++++++---------------------
include/filter/msfilter/svdfppt.hxx | 6 +--
2 files changed, 27 insertions(+), 34 deletions(-)
New commits:
commit 9110118117d45a6cff1c50f3bd3087f97206ff51
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Feb 28 15:56:09 2018 +0200
loplugin:useuniqueptr in PPTExtParaProv
Change-Id: I8013b0b6c75eca6426389a3d5ac8e4d7bf31ef4d
Reviewed-on: https://gerrit.libreoffice.org/50697
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 57043ed79b30..a5b878ea0769 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -3202,15 +3202,15 @@ bool PPTExtParaProv::GetGraphic( sal_uInt32 nInstance, Graphic& rGraph ) const
PPTBuGraEntry* pPtr = nullptr;
if ( nInstance < aBuGraList.size() )
{
- pPtr = aBuGraList[ nInstance ];
+ pPtr = aBuGraList[ nInstance ].get();
if ( pPtr->nInstance == nInstance )
bRetValue = true;
}
if ( !bRetValue )
{
- for (PPTBuGraEntry* i : aBuGraList)
+ for (std::unique_ptr<PPTBuGraEntry> const & i : aBuGraList)
{
- pPtr = i;
+ pPtr = i.get();
if ( pPtr->nInstance == nInstance )
{
bRetValue = true;
@@ -3277,9 +3277,9 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
}
}
if ( n < nBuGraCount ) {
- aBuGraList.insert( aBuGraList.begin() + n, pBuGra );
+ aBuGraList.emplace( aBuGraList.begin() + n, pBuGra );
} else {
- aBuGraList.push_back( pBuGra );
+ aBuGraList.emplace_back( pBuGra );
}
}
#ifdef DBG_UTIL
@@ -3370,9 +3370,6 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
PPTExtParaProv::~PPTExtParaProv()
{
- for (PPTBuGraEntry* i : aBuGraList)
- delete i;
- aBuGraList.clear();
}
PPTNumberFormatCreator::PPTNumberFormatCreator( PPTExtParaProv* pParaProv )
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 83b06d928e20..233bb6387b41 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -720,7 +720,7 @@ struct PPTBuGraEntry
class PPTExtParaProv
{
- ::std::vector< PPTBuGraEntry* > aBuGraList;
+ ::std::vector< std::unique_ptr<PPTBuGraEntry> > aBuGraList;
public:
bool bStyles;
commit f72b5d4b9af50e2a85ad39eef40f0463f17b7d68
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Feb 28 15:47:11 2018 +0200
loplugin:useuniqueptr in SdrEscherImport
Change-Id: Id37c4cb7a8eb88b2f83ed0bfb4b72fe38a128096
Reviewed-on: https://gerrit.libreoffice.org/50694
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 92380143e9ab..57043ed79b30 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -525,10 +525,6 @@ SdrEscherImport::SdrEscherImport( PowerPointImportParam& rParam, const OUString&
SdrEscherImport::~SdrEscherImport()
{
- for (PPTOleEntry* i : aOleObjectList)
- delete i;
- aOleObjectList.clear();
- delete m_pFonts;
}
const PptSlideLayoutAtom* SdrEscherImport::GetSlideLayoutAtom() const
@@ -1820,12 +1816,12 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
}
}
- for (PPTOleEntry* pOe : const_cast<SdrPowerPointImport*>(this)->aOleObjectList)
+ for (PPTOleEntry& rOe : const_cast<SdrPowerPointImport*>(this)->aOleObjectList)
{
- if ( pOe->nId != nOLEId )
+ if ( rOe.nId != nOLEId )
continue;
- rStCtrl.Seek( pOe->nRecHdOfs );
+ rStCtrl.Seek( rOe.nRecHdOfs );
DffRecordHeader aHd;
ReadDffRecordHeader( rStCtrl, aHd );
@@ -1878,23 +1874,23 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
OUString aNm;
// if ( nSvxMSDffOLEConvFlags )
{
- uno::Reference < embed::XStorage > xDestStorage( pOe->pShell->GetStorage() );
+ uno::Reference < embed::XStorage > xDestStorage( rOe.pShell->GetStorage() );
uno::Reference < embed::XEmbeddedObject > xObj =
CheckForConvertToSOObj(nSvxMSDffOLEConvFlags, *xObjStor, xDestStorage, rGraf, rVisArea, maBaseURL);
if( xObj.is() )
{
- pOe->pShell->getEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aNm );
+ rOe.pShell->getEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aNm );
- svt::EmbeddedObjectRef aObj( xObj, pOe->nAspect );
+ svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
// TODO/LATER: need MediaType for Graphic
aObj.SetGraphic( rGraf, OUString() );
pRet = new SdrOle2Obj( aObj, aNm, rBoundRect );
}
}
- if ( !pRet && ( pOe->nType == PPT_PST_ExControl ) )
+ if ( !pRet && ( rOe.nType == PPT_PST_ExControl ) )
{
- uno::Reference< frame::XModel > xModel( pOe->pShell->GetModel() );
+ uno::Reference< frame::XModel > xModel( rOe.pShell->GetModel() );
PPTConvertOCXControls aPPTConvertOCXControls( this, xModel, eAktPageKind );
css::uno::Reference< css::drawing::XShape > xShape;
if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape ) )
@@ -1903,10 +1899,10 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
}
if ( !pRet )
{
- aNm = pOe->pShell->getEmbeddedObjectContainer().CreateUniqueObjectName();
+ aNm = rOe.pShell->getEmbeddedObjectContainer().CreateUniqueObjectName();
// object is not an own object
- const css::uno::Reference < css::embed::XStorage >& rStorage = pOe->pShell->GetStorage();
+ const css::uno::Reference < css::embed::XStorage >& rStorage = rOe.pShell->GetStorage();
if (rStorage.is())
{
tools::SvRef<SotStorage> xTarget = SotStorage::OpenOLEStorage(rStorage, aNm, StreamMode::READWRITE);
@@ -1920,34 +1916,34 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
}
uno::Reference < embed::XEmbeddedObject > xObj =
- pOe->pShell->getEmbeddedObjectContainer().GetEmbeddedObject( aNm );
+ rOe.pShell->getEmbeddedObjectContainer().GetEmbeddedObject( aNm );
if ( xObj.is() )
{
- if ( pOe->nAspect != embed::Aspects::MSOLE_ICON )
+ if ( rOe.nAspect != embed::Aspects::MSOLE_ICON )
{
//TODO/LATER: keep on hacking?!
// we don't want to be modified
//xInplaceObj->EnableSetModified( sal_False );
if ( rVisArea.IsEmpty() )
{
- MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( pOe->nAspect ) );
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( rOe.nAspect ) );
Size aSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
aGraphic.GetPrefMapMode(), MapMode( aMapUnit ) ) );
awt::Size aSz;
aSz.Width = aSize.Width();
aSz.Height = aSize.Height();
- xObj->setVisualAreaSize( pOe->nAspect, aSz );
+ xObj->setVisualAreaSize( rOe.nAspect, aSz );
}
else
{
awt::Size aSize( rVisArea.GetSize().Width(), rVisArea.GetSize().Height() );
- xObj->setVisualAreaSize( pOe->nAspect, aSize );
+ xObj->setVisualAreaSize( rOe.nAspect, aSize );
}
//xInplaceObj->EnableSetModified( sal_True );
}
- svt::EmbeddedObjectRef aObj( xObj, pOe->nAspect );
+ svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
// TODO/LATER: need MediaType for Graphic
aObj.SetGraphic( aGraphic, OUString() );
@@ -2136,8 +2132,8 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt
if ( aHd.nRecType == DFF_PST_ExOleObjStg )
{
rStCtrl.ReadUInt32( nId );
- aOleObjectList.push_back(
- new PPTOleEntry( aAt.nId, aHd.nFilePos, pShell, nRecType, aAt.nAspect ) );
+ aOleObjectList.emplace_back(
+ aAt.nId, aHd.nFilePos, pShell, nRecType, aAt.nAspect );
}
}
}
@@ -2164,7 +2160,7 @@ bool SdrPowerPointImport::ReadFontCollection()
{
bRet = true;
if (!m_pFonts)
- m_pFonts = new PptFontCollection;
+ m_pFonts.reset( new PptFontCollection );
std::unique_ptr<PptFontEntityAtom> pFont(new PptFontEntityAtom);
ReadPptFontEntityAtom( rStCtrl, *pFont );
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 3c18ec37f607..83b06d928e20 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -460,9 +460,9 @@ protected:
PptDocumentAtom aDocAtom;
DffRecordManager aDocRecManager; // contains all first level container and atoms of the document container
- ::std::vector< PPTOleEntry* > aOleObjectList;
+ ::std::vector< PPTOleEntry > aOleObjectList;
- PptFontCollection* m_pFonts;
+ std::unique_ptr<PptFontCollection> m_pFonts;
sal_uInt32 nStreamLen;
More information about the Libreoffice-commits
mailing list