summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-09-09 12:48:00 +0200
committerDavid Tardon <dtardon@redhat.com>2016-09-09 16:16:45 +0200
commit064a33a3b8e194876a4e368f65d8df2ff86ce381 (patch)
tree480c0cc36b85f47773a0358004ca4bd182cf0c0d /xmloff
parentab028d991a4c9618c59fd71ddcc4c8f64428264c (diff)
use std::unique_ptr
Change-Id: I3d7a8a8296e1d107b1f364b5c0785fc9f19cbed5
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/forms/elementexport.cxx27
-rw-r--r--xmloff/source/forms/elementexport.hxx6
2 files changed, 12 insertions, 21 deletions
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index cd9d89babb8a..f1d1a982b4ca 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -18,6 +18,9 @@
*/
#include "elementexport.hxx"
+
+#include <o3tl/make_unique.hxx>
+
#include "strings.hxx"
#include <xmloff/xmlnmspe.hxx>
#include "eventexport.hxx"
@@ -92,13 +95,11 @@ namespace xmloff
const Sequence< ScriptEventDescriptor >& _rEvents)
:OPropertyExport(_rContext, _rxProps)
,m_aEvents(_rEvents)
- ,m_pXMLElement(nullptr)
{
}
OElementExport::~OElementExport()
{
- delete m_pXMLElement;
}
void OElementExport::doExport()
@@ -142,13 +143,12 @@ namespace xmloff
void OElementExport::implStartElement(const sal_Char* _pName)
{
- m_pXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, _pName, true, true);
+ m_pXMLElement = o3tl::make_unique<SvXMLElementExport>(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, _pName, true, true);
}
void OElementExport::implEndElement()
{
- delete m_pXMLElement;
- m_pXMLElement = nullptr;
+ m_pXMLElement.reset();
}
void OElementExport::exportServiceNameAttribute()
@@ -239,17 +239,10 @@ namespace xmloff
,m_nIncludeSpecial(SCAFlags::NONE)
,m_nIncludeEvents(EAFlags::NONE)
,m_nIncludeBindings(BAFlags::NONE)
- ,m_pOuterElement(nullptr)
{
OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!");
}
- OControlExport::~OControlExport()
- {
- // end the outer element if it exists
- delete m_pOuterElement;
- }
-
void OControlExport::exportOuterAttributes()
{
// the control id
@@ -1407,13 +1400,12 @@ namespace xmloff
{
// before we let the base class start it's outer element, we add a wrapper element
const sal_Char *pOuterElementName = getOuterXMLElementName();
- m_pOuterElement = pOuterElementName
- ? new SvXMLElementExport(
+ if (pOuterElementName)
+ m_pOuterElement = o3tl::make_unique<SvXMLElementExport>(
m_rContext.getGlobalContext(),
XML_NAMESPACE_FORM,
pOuterElementName, true,
- true)
- : nullptr;
+ true);
// add the attributes for the inner element
exportInnerAttributes();
@@ -1428,8 +1420,7 @@ namespace xmloff
OElementExport::implEndElement();
// end the outer element if it exists
- delete m_pOuterElement;
- m_pOuterElement = nullptr;
+ m_pOuterElement.reset();
}
const sal_Char* OControlExport::getOuterXMLElementName() const
diff --git a/xmloff/source/forms/elementexport.hxx b/xmloff/source/forms/elementexport.hxx
index f3b2f0ac03a4..665c0d90d2c7 100644
--- a/xmloff/source/forms/elementexport.hxx
+++ b/xmloff/source/forms/elementexport.hxx
@@ -22,6 +22,7 @@
#include <sal/config.h>
+#include <memory>
#include <set>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -43,7 +44,7 @@ namespace xmloff
css::uno::Sequence< css::script::ScriptEventDescriptor >
m_aEvents;
- SvXMLElementExport* m_pXMLElement; // XML element doing the concrete startElement etc.
+ std::unique_ptr<SvXMLElementExport> m_pXMLElement; // XML element doing the concrete startElement etc.
public:
OElementExport(IFormsExportContext& _rContext,
@@ -100,7 +101,7 @@ namespace xmloff
EAFlags m_nIncludeEvents; // events to include
BAFlags m_nIncludeBindings; // binding attributes to include
- SvXMLElementExport* m_pOuterElement; // XML element doing the concrete startElement etc. for the outer element
+ std::unique_ptr<SvXMLElementExport> m_pOuterElement; // XML element doing the concrete startElement etc. for the outer element
public:
/** constructs an object capable of exporting controls
@@ -119,7 +120,6 @@ namespace xmloff
const OUString& _rControlId,
const OUString& _rReferringControls,
const css::uno::Sequence< css::script::ScriptEventDescriptor >& _rxEvents);
- virtual ~OControlExport();
protected:
/// start the XML element