summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-09-09 12:57:01 +0200
committerDavid Tardon <dtardon@redhat.com>2016-09-09 16:16:45 +0200
commitbbb017f95ec70c8d10dc6e1473f14eeda9ff6144 (patch)
tree00ff0ed59371610ff8d539e7a4ed86b0e7e8cde5 /xmloff
parent66e6278e9ad0537843cfecbfee9bcf808702a141 (diff)
use std::unique_ptr
Change-Id: I52713ea0015a5f0118c337279f37bc38b1121f1e
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/XMLTextFrameContext.cxx13
-rw-r--r--xmloff/source/text/XMLTextFrameContext.hxx5
2 files changed, 6 insertions, 12 deletions
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index bb6ae183b45e..d49df3c237a9 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/make_unique.hxx>
#include <tools/debug.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -1341,7 +1342,6 @@ XMLTextFrameContext::XMLTextFrameContext(
: SvXMLImportContext( rImport, nPrfx, rLName )
, MultiImageImportHelper()
, m_xAttrList( new SvXMLAttributeList( xAttrList ) )
-, m_pHyperlink( nullptr )
// Implement Title/Description Elements UI (#i73249#)
, m_sTitle()
, m_sDesc()
@@ -1391,11 +1391,6 @@ XMLTextFrameContext::XMLTextFrameContext(
}
}
-XMLTextFrameContext::~XMLTextFrameContext()
-{
- delete m_pHyperlink;
-}
-
void XMLTextFrameContext::EndElement()
{
/// solve if multiple image child contexts were imported
@@ -1429,8 +1424,7 @@ void XMLTextFrameContext::EndElement()
{
pImpl->SetHyperlink( m_pHyperlink->GetHRef(), m_pHyperlink->GetName(),
m_pHyperlink->GetTargetFrameName(), m_pHyperlink->GetMap() );
- delete m_pHyperlink;
- m_pHyperlink = nullptr;
+ m_pHyperlink.reset();
}
}
@@ -1651,8 +1645,7 @@ void XMLTextFrameContext::SetHyperlink( const OUString& rHRef,
bool bMap )
{
OSL_ENSURE( !m_pHyperlink, "recursive SetHyperlink call" );
- delete m_pHyperlink;
- m_pHyperlink = new XMLTextFrameContextHyperlink_Impl(
+ m_pHyperlink = o3tl::make_unique<XMLTextFrameContextHyperlink_Impl>(
rHRef, rName, rTargetFrameName, bMap );
}
diff --git a/xmloff/source/text/XMLTextFrameContext.hxx b/xmloff/source/text/XMLTextFrameContext.hxx
index 4e297abfafa8..8f19eda2d70e 100644
--- a/xmloff/source/text/XMLTextFrameContext.hxx
+++ b/xmloff/source/text/XMLTextFrameContext.hxx
@@ -20,6 +20,8 @@
#ifndef INCLUDED_XMLOFF_SOURCE_TEXT_XMLTEXTFRAMECONTEXT_HXX
#define INCLUDED_XMLOFF_SOURCE_TEXT_XMLTEXTFRAMECONTEXT_HXX
+#include <memory>
+
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <xmloff/xmlictxt.hxx>
#include <xmloff/xmlmultiimagehelper.hxx>
@@ -37,7 +39,7 @@ class XMLTextFrameContext : public SvXMLImportContext, public MultiImageImportHe
SvXMLImportContextRef m_xImplContext;
SvXMLImportContextRef m_xReplImplContext;
- XMLTextFrameContextHyperlink_Impl *m_pHyperlink;
+ std::unique_ptr<XMLTextFrameContextHyperlink_Impl> m_pHyperlink;
// Implement Title/Description Elements UI (#i73249#)
OUString m_sTitle;
OUString m_sDesc;
@@ -69,7 +71,6 @@ public:
const css::uno::Reference<
css::xml::sax::XAttributeList > & xAttrList,
css::text::TextContentAnchorType eDfltAnchorType );
- virtual ~XMLTextFrameContext();
virtual void EndElement() override;