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