Kaydet (Commit) 8a304fe8 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in XclEscherEx

Change-Id: I8f56bad91c7128a1907e72cd457d43b5937d743a
Reviewed-on: https://gerrit.libreoffice.org/57527
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 1aff15fa
......@@ -122,10 +122,10 @@ private:
private:
XclExpObjectManager& mrObjMgr;
std::stack< std::pair< XclObj*, XclEscherHostAppData* > > aStack;
std::stack< std::pair< XclObj*, std::unique_ptr<XclEscherHostAppData> > > aStack;
XclObj* pCurrXclObj;
XclEscherHostAppData* pCurrAppData;
XclEscherClientData* pTheClientData; // always the same
std::unique_ptr<XclEscherHostAppData> pCurrAppData;
std::unique_ptr<XclEscherClientData> pTheClientData; // always the same
XclEscherClientTextbox* pAdditionalText;
sal_uInt16 nAdditionalText;
sal_uInt32 mnNextKey;
......
......@@ -110,7 +110,7 @@ XclEscherEx::~XclEscherEx()
{
OSL_ENSURE( aStack.empty(), "~XclEscherEx: stack not empty" );
DeleteCurrAppData();
delete pTheClientData;
pTheClientData.reset();
}
sal_uInt32 XclEscherEx::InitNextDffFragment()
......@@ -199,8 +199,8 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
UpdateDffFragmentEnd();
}
}
aStack.push( std::make_pair( pCurrXclObj, pCurrAppData ) );
pCurrAppData = new XclEscherHostAppData;
aStack.push( std::make_pair( pCurrXclObj, std::move(pCurrAppData) ) );
pCurrAppData.reset( new XclEscherHostAppData );
SdrObject* pObj = GetSdrObjectFromXShape( rxShape );
//added for exporting OCX control
sal_Int16 nMsCtlType = 0;
......@@ -272,7 +272,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
}
else
{
pCurrAppData->SetClientData( pTheClientData );
pCurrAppData->SetClientData( pTheClientData.get() );
if ( nAdditionalText == 0 )
{
if ( pObj )
......@@ -340,7 +340,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
}
if ( !pCurrXclObj )
pCurrAppData->SetDontWriteShape( true );
return pCurrAppData;
return pCurrAppData.get();
}
void XclEscherEx::EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID )
......@@ -382,8 +382,7 @@ void XclEscherEx::EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID )
else
{
pCurrXclObj = aStack.top().first;
pCurrAppData = aStack.top().second;
aStack.pop();
pCurrAppData = std::move(aStack.top().second);
}
if( nAdditionalText == 3 )
nAdditionalText = 0;
......@@ -394,7 +393,7 @@ EscherExHostAppData* XclEscherEx::EnterAdditionalTextGroup()
nAdditionalText = 1;
pAdditionalText = static_cast<XclEscherClientTextbox*>( pCurrAppData->GetClientTextbox() );
pCurrAppData->SetClientTextbox( nullptr );
return pCurrAppData;
return pCurrAppData.get();
}
void XclEscherEx::EndDocument()
......@@ -512,7 +511,7 @@ void XclEscherEx::DeleteCurrAppData()
// delete pCurrAppData->GetClientData();
delete pCurrAppData->GetClientTextbox();
delete pCurrAppData->GetInteractionInfo();
delete pCurrAppData;
pCurrAppData.reset();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment