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

use unique_ptr in SfxEventConfiguration::ConvertToMacro

Change-Id: I7f96ce55b22212c38972a51c9273c9f9cd241acf
Reviewed-on: https://gerrit.libreoffice.org/66183
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 70d509c9
......@@ -98,7 +98,7 @@ class SFX2_DLLPUBLIC SfxEventConfiguration
{
public:
static void ConfigureEvent( const OUString& aName, const SvxMacro&, SfxObjectShell const * pObjSh);
static SvxMacro* ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc );
static std::unique_ptr<SvxMacro> ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc );
};
#endif
......
......@@ -238,7 +238,7 @@ void SfxEventConfiguration::ConfigureEvent( const OUString& aName, const SvxMacr
}
SvxMacro* SfxEventConfiguration::ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc )
std::unique_ptr<SvxMacro> SfxEventConfiguration::ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc )
{
return SfxEvents_Impl::ConvertToMacro( rElement, pDoc );
}
......
......@@ -79,7 +79,7 @@ public:
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
// convert and normalize
static SvxMacro* ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc );
static std::unique_ptr<SvxMacro> ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc );
static void NormalizeMacro( const css::uno::Any& rIn, css::uno::Any& rOut, SfxObjectShell* pDoc );
static void NormalizeMacro(
const ::comphelper::NamedValueCollection& i_eventDescriptor,
......
......@@ -329,9 +329,9 @@ SfxEvents_Impl::~SfxEvents_Impl()
}
SvxMacro* SfxEvents_Impl::ConvertToMacro( const uno::Any& rElement, SfxObjectShell* pObjShell )
std::unique_ptr<SvxMacro> SfxEvents_Impl::ConvertToMacro( const uno::Any& rElement, SfxObjectShell* pObjShell )
{
SvxMacro* pMacro = nullptr;
std::unique_ptr<SvxMacro> pMacro;
uno::Sequence < beans::PropertyValue > aProperties;
uno::Any aAny;
NormalizeMacro( rElement, aAny, pObjShell );
......@@ -383,10 +383,10 @@ SvxMacro* SfxEvents_Impl::ConvertToMacro( const uno::Any& rElement, SfxObjectShe
aLibrary = SfxGetpApp()->GetName();
else
aLibrary.clear();
pMacro = new SvxMacro( aMacroName, aLibrary, eType );
pMacro.reset(new SvxMacro( aMacroName, aLibrary, eType ));
}
else if ( eType == EXTENDED_STYPE )
pMacro = new SvxMacro( aScriptURL, aType );
pMacro.reset(new SvxMacro( aScriptURL, aType ));
}
return pMacro;
......
......@@ -317,11 +317,10 @@ void SwHTMLWriter::OutBasicBodyEvents()
uno::Reference < container::XNameReplace > xEvents = xSup->getEvents();
for ( sal_Int32 i=0; i<4; i++ )
{
SvxMacro* pMacro = SfxEventConfiguration::ConvertToMacro( xEvents->getByName( OUString::createFromAscii(aEventNames[i]) ), pDocSh );
std::unique_ptr<SvxMacro> pMacro = SfxEventConfiguration::ConvertToMacro( xEvents->getByName( OUString::createFromAscii(aEventNames[i]) ), pDocSh );
if ( pMacro )
{
aDocTable.Insert( aBodyEventTable[i].nEvent, *pMacro );
delete pMacro;
}
}
......
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