new loplugin: useuniqueptr: sd
Change-Id: I2fc8a2fa57cc00edf2edab9e3722c824e75cb7e5 Reviewed-on: https://gerrit.libreoffice.org/33204 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
c06ca5e183
commit
f3a90d1305
@ -92,7 +92,7 @@ public:
|
||||
virtual void Redo() override;
|
||||
|
||||
private:
|
||||
SfxUndoAction* mpUndoAnimation;
|
||||
std::unique_ptr<SfxUndoAction> mpUndoAnimation;
|
||||
bool mbNewEmptyPresObj;
|
||||
SdrObjectWeakRef mxSdrObject;
|
||||
};
|
||||
|
@ -186,14 +186,13 @@ UndoObjectSetText::UndoObjectSetText( SdrObject& rObject, sal_Int32 nText )
|
||||
css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY );
|
||||
if( pPage->getMainSequence()->hasEffect( xShape ) )
|
||||
{
|
||||
mpUndoAnimation = new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage );
|
||||
mpUndoAnimation.reset( new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UndoObjectSetText::~UndoObjectSetText()
|
||||
{
|
||||
delete mpUndoAnimation;
|
||||
}
|
||||
|
||||
void UndoObjectSetText::Undo()
|
||||
|
@ -135,12 +135,7 @@ struct PPTExOleObjEntry
|
||||
|
||||
struct TextRuleEntry
|
||||
{
|
||||
SvMemoryStream* pOut;
|
||||
|
||||
explicit TextRuleEntry() :
|
||||
pOut ( nullptr ){};
|
||||
|
||||
~TextRuleEntry() { delete pOut; };
|
||||
std::unique_ptr<SvMemoryStream> pOut;
|
||||
};
|
||||
|
||||
class TextObjBinary : public TextObj
|
||||
|
@ -120,7 +120,8 @@ class PPTExBulletProvider
|
||||
SvMemoryStream aBuExOutlineStream;
|
||||
SvMemoryStream aBuExMasterStream;
|
||||
|
||||
EscherGraphicProvider* pGraphicProv;
|
||||
std::unique_ptr<EscherGraphicProvider>
|
||||
pGraphicProv;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -97,13 +97,12 @@ using namespace ::com::sun::star;
|
||||
#define FIXED_PITCH 0x01
|
||||
|
||||
PPTExBulletProvider::PPTExBulletProvider()
|
||||
: pGraphicProv( new EscherGraphicProvider( EscherGraphicProviderFlags::UseInstances ) )
|
||||
{
|
||||
pGraphicProv = new EscherGraphicProvider( EscherGraphicProviderFlags::UseInstances );
|
||||
}
|
||||
|
||||
PPTExBulletProvider::~PPTExBulletProvider()
|
||||
{
|
||||
delete pGraphicProv;
|
||||
}
|
||||
|
||||
sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicSize )
|
||||
@ -1266,7 +1265,10 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
|
||||
{
|
||||
SvStream* pRuleOut = &rOut;
|
||||
if ( pTextRule )
|
||||
pRuleOut = pTextRule->pOut = new SvMemoryStream( 0x100, 0x100 );
|
||||
{
|
||||
pTextRule->pOut.reset( new SvMemoryStream( 0x100, 0x100 ) );
|
||||
pRuleOut = pTextRule->pOut.get();
|
||||
}
|
||||
|
||||
sal_uInt32 nRulePos = pRuleOut->Tell();
|
||||
pRuleOut->WriteUInt32( EPP_TextRulerAtom << 16 ).WriteUInt32( 0 );
|
||||
@ -2763,12 +2765,11 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
|
||||
ImplGetText();
|
||||
ImplWriteTextStyleAtom( *pClientTextBox, nTextType, nPObjects, &aTextRule, aExtBu, nullptr );
|
||||
ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, nPageNumber + 0x100 );
|
||||
SvMemoryStream* pOut = aTextRule.pOut;
|
||||
SvMemoryStream* pOut = aTextRule.pOut.get();
|
||||
if ( pOut )
|
||||
{
|
||||
pClientTextBox->WriteBytes(pOut->GetData(), pOut->Tell());
|
||||
delete pOut;
|
||||
aTextRule.pOut = nullptr;
|
||||
aTextRule.pOut.reset();
|
||||
}
|
||||
if ( aExtBu.Tell() )
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotSt
|
||||
}
|
||||
}
|
||||
|
||||
pFilter = new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam );
|
||||
pFilter.reset( new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam ) );
|
||||
}
|
||||
|
||||
bool SdPPTImport::Import()
|
||||
@ -165,7 +165,6 @@ bool SdPPTImport::Import()
|
||||
|
||||
SdPPTImport::~SdPPTImport()
|
||||
{
|
||||
delete pFilter;
|
||||
}
|
||||
|
||||
ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SotStorage& rStorage_, SfxMedium& rMedium, PowerPointImportParam& rParam )
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
|
||||
class SdPPTImport
|
||||
{
|
||||
ImplSdPPTImport* pFilter;
|
||||
std::unique_ptr<ImplSdPPTImport> pFilter;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -28,7 +28,7 @@ PropEntry::PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize
|
||||
mnSize ( nBufSize ),
|
||||
mpBuf ( new sal_uInt8[ nBufSize ] )
|
||||
{
|
||||
memcpy( static_cast<void*>(mpBuf), static_cast<void const *>(pBuf), nBufSize );
|
||||
memcpy( mpBuf.get(), pBuf, nBufSize );
|
||||
};
|
||||
|
||||
PropEntry::PropEntry( const PropEntry& rProp ) :
|
||||
@ -36,18 +36,17 @@ PropEntry::PropEntry( const PropEntry& rProp ) :
|
||||
mnSize ( rProp.mnSize ),
|
||||
mpBuf ( new sal_uInt8[ mnSize ] )
|
||||
{
|
||||
memcpy( static_cast<void*>(mpBuf), static_cast<void const *>(rProp.mpBuf), mnSize );
|
||||
memcpy( mpBuf.get(), rProp.mpBuf.get(), mnSize );
|
||||
};
|
||||
|
||||
PropEntry& PropEntry::operator=(const PropEntry& rPropEntry)
|
||||
{
|
||||
if ( this != &rPropEntry )
|
||||
{
|
||||
delete[] mpBuf;
|
||||
mnId = rPropEntry.mnId;
|
||||
mnSize = rPropEntry.mnSize;
|
||||
mpBuf = new sal_uInt8[ mnSize ];
|
||||
memcpy( static_cast<void*>(mpBuf), static_cast<void const *>(rPropEntry.mpBuf), mnSize );
|
||||
mpBuf.reset( new sal_uInt8[ mnSize ] );
|
||||
memcpy( mpBuf.get(), rPropEntry.mpBuf.get(), mnSize );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -235,7 +234,7 @@ bool Section::GetProperty( sal_uInt32 nId, PropItem& rPropItem )
|
||||
{
|
||||
rPropItem.Clear();
|
||||
rPropItem.SetTextEncoding( mnTextEnc );
|
||||
rPropItem.WriteBytes( (*iter)->mpBuf, (*iter)->mnSize );
|
||||
rPropItem.WriteBytes( (*iter)->mpBuf.get(), (*iter)->mnSize );
|
||||
rPropItem.Seek( STREAM_SEEK_TO_BEGIN );
|
||||
return true;
|
||||
}
|
||||
@ -280,7 +279,7 @@ void Section::GetDictionary(Dictionary& rDict)
|
||||
if (iter == maEntries.end())
|
||||
return;
|
||||
|
||||
SvMemoryStream aStream( (*iter)->mpBuf, (*iter)->mnSize, StreamMode::READ );
|
||||
SvMemoryStream aStream( (*iter)->mpBuf.get(), (*iter)->mnSize, StreamMode::READ );
|
||||
aStream.Seek( STREAM_SEEK_TO_BEGIN );
|
||||
sal_uInt32 nDictCount(0);
|
||||
aStream.ReadUInt32( nDictCount );
|
||||
|
@ -85,13 +85,13 @@ typedef std::map<OUString,sal_uInt32> Dictionary;
|
||||
|
||||
struct PropEntry
|
||||
{
|
||||
sal_uInt32 mnId;
|
||||
sal_uInt32 mnSize;
|
||||
sal_uInt8* mpBuf;
|
||||
sal_uInt32 mnId;
|
||||
sal_uInt32 mnSize;
|
||||
std::unique_ptr<sal_uInt8[]> mpBuf;
|
||||
|
||||
PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize );
|
||||
PropEntry( const PropEntry& rProp );
|
||||
~PropEntry() { delete[] mpBuf; } ;
|
||||
~PropEntry() {}
|
||||
|
||||
PropEntry& operator=(const PropEntry& rPropEntry);
|
||||
};
|
||||
|
@ -159,7 +159,6 @@ void FuPage::DoExecute( SfxRequest& )
|
||||
|
||||
FuPage::~FuPage()
|
||||
{
|
||||
delete mpBackgroundObjUndoAction;
|
||||
}
|
||||
|
||||
void FuPage::Activate()
|
||||
@ -386,8 +385,8 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent )
|
||||
|
||||
if( mbPageBckgrdDeleted )
|
||||
{
|
||||
mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
|
||||
*mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
|
||||
mpBackgroundObjUndoAction.reset( new SdBackgroundObjUndoAction(
|
||||
*mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()) );
|
||||
|
||||
if(!mpPage->IsMasterPage())
|
||||
{
|
||||
@ -609,9 +608,8 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
|
||||
if( !mbMasterPage && !mbPageBckgrdDeleted )
|
||||
{
|
||||
// Only this page
|
||||
delete mpBackgroundObjUndoAction;
|
||||
mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
|
||||
*mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
|
||||
mpBackgroundObjUndoAction.reset( new SdBackgroundObjUndoAction(
|
||||
*mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()) );
|
||||
SfxItemSet aSet( *pArgs );
|
||||
sdr::properties::CleanupFillProperties(aSet);
|
||||
mpPage->getSdrPageProperties().ClearItem();
|
||||
@ -623,7 +621,7 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
|
||||
if( mpBackgroundObjUndoAction )
|
||||
{
|
||||
// set merge flag, because a SdUndoGroupAction could have been inserted before
|
||||
mpDocSh->GetUndoManager()->AddUndoAction( mpBackgroundObjUndoAction, true );
|
||||
mpDocSh->GetUndoManager()->AddUndoAction( mpBackgroundObjUndoAction.get(), true );
|
||||
mpBackgroundObjUndoAction = nullptr;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,8 @@ private:
|
||||
|
||||
SfxRequest& mrReq;
|
||||
const SfxItemSet* mpArgs;
|
||||
SdBackgroundObjUndoAction* mpBackgroundObjUndoAction;
|
||||
std::unique_ptr<SdBackgroundObjUndoAction>
|
||||
mpBackgroundObjUndoAction;
|
||||
Size maSize;
|
||||
bool mbPageBckgrdDeleted;
|
||||
bool mbMasterPage;
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
class SdUnoSearchReplaceDescriptor : public ::cppu::WeakImplHelper< css::lang::XUnoTunnel, css::util::XReplaceDescriptor > // public css::util::XSearchDescriptor, css::beans::XPropertySet
|
||||
{
|
||||
protected:
|
||||
SvxItemPropertySet* mpPropSet;
|
||||
std::unique_ptr<SvxItemPropertySet> mpPropSet;
|
||||
|
||||
bool mbBackwards;
|
||||
bool mbCaseSensitive;
|
||||
|
@ -704,7 +704,7 @@ UNO3_GETIMPLEMENTATION_IMPL( SdUnoSearchReplaceDescriptor );
|
||||
|
||||
SdUnoSearchReplaceDescriptor::SdUnoSearchReplaceDescriptor( bool bReplace ) throw (css::uno::RuntimeException)
|
||||
{
|
||||
mpPropSet = new SvxItemPropertySet(ImplGetSearchPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool());
|
||||
mpPropSet.reset( new SvxItemPropertySet(ImplGetSearchPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool()) );
|
||||
|
||||
mbBackwards = false;
|
||||
mbCaseSensitive = false;
|
||||
@ -715,7 +715,6 @@ SdUnoSearchReplaceDescriptor::SdUnoSearchReplaceDescriptor( bool bReplace ) thro
|
||||
|
||||
SdUnoSearchReplaceDescriptor::~SdUnoSearchReplaceDescriptor() throw()
|
||||
{
|
||||
delete mpPropSet;
|
||||
}
|
||||
|
||||
// XSearchDescriptor
|
||||
|
Loading…
x
Reference in New Issue
Block a user