summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-20 15:02:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-22 08:27:22 +0200
commit9590c68852177056602342dd874b8818eeb57e82 (patch)
treec74bb114d817d5ceeb682df109dc802f82f06869 /sw
parent66a8ad83d5b8142720c8579bdde046e9332c06ca (diff)
loplugin:useuniqueptr in SwTextAPIObject
Change-Id: I697a8a119fa4ad0a6c50bc6e4a3bc8944435928a Reviewed-on: https://gerrit.libreoffice.org/59364 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/fields/docufld.cxx4
-rw-r--r--sw/source/core/fields/textapi.cxx6
-rw-r--r--sw/source/core/inc/textapi.hxx2
-rw-r--r--sw/source/core/unocore/unofield.cxx6
4 files changed, 9 insertions, 9 deletions
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index de055bb4cfa2..b5c8f083dc70 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1849,8 +1849,8 @@ bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
{
SwPostItFieldType* pGetType = static_cast<SwPostItFieldType*>(GetTyp());
SwDoc* pDoc = pGetType->GetDoc();
- SwTextAPIEditSource* pObj = new SwTextAPIEditSource( pDoc );
- const_cast <SwPostItField*> (this)->m_xTextObject = new SwTextAPIObject( pObj );
+ auto pObj = o3tl::make_unique<SwTextAPIEditSource>( pDoc );
+ const_cast <SwPostItField*> (this)->m_xTextObject = new SwTextAPIObject( std::move(pObj) );
}
if ( mpText )
diff --git a/sw/source/core/fields/textapi.cxx b/sw/source/core/fields/textapi.cxx
index 605b3d06e885..2b10349ba7c5 100644
--- a/sw/source/core/fields/textapi.cxx
+++ b/sw/source/core/fields/textapi.cxx
@@ -53,9 +53,9 @@ static const SvxItemPropertySet* ImplGetSvxTextPortionPropertySet()
return &aSvxTextPortionPropertySet;
}
-SwTextAPIObject::SwTextAPIObject( SwTextAPIEditSource* p )
-: SvxUnoText( p, ImplGetSvxTextPortionPropertySet(), uno::Reference < text::XText >() )
-, pSource(p)
+SwTextAPIObject::SwTextAPIObject( std::unique_ptr<SwTextAPIEditSource> p )
+: SvxUnoText( p.get(), ImplGetSvxTextPortionPropertySet(), uno::Reference < text::XText >() )
+, pSource(std::move(p))
{
}
diff --git a/sw/source/core/inc/textapi.hxx b/sw/source/core/inc/textapi.hxx
index 4c03c8dc62f3..e2d704556993 100644
--- a/sw/source/core/inc/textapi.hxx
+++ b/sw/source/core/inc/textapi.hxx
@@ -55,7 +55,7 @@ class SwTextAPIObject : public SvxUnoText
{
std::unique_ptr<SwTextAPIEditSource> pSource;
public:
- SwTextAPIObject( SwTextAPIEditSource* p);
+ SwTextAPIObject( std::unique_ptr<SwTextAPIEditSource> p);
virtual ~SwTextAPIObject() throw() override;
void DisposeEditSource() { pSource->Dispose(); }
std::unique_ptr<OutlinerParaObject> CreateText() { return pSource->CreateText(); }
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 620143150e8a..03e0fedc064c 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -89,6 +89,7 @@
#include <svl/listener.hxx>
#include <svx/dataaccessdescriptor.hxx>
#include <o3tl/any.hxx>
+#include <o3tl/make_unique.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <textapi.hxx>
@@ -2376,9 +2377,8 @@ uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName)
{
if (!m_pImpl->m_xTextObject.is())
{
- SwTextAPIEditSource* pObj =
- new SwTextAPIEditSource(m_pImpl->m_pDoc);
- m_pImpl->m_xTextObject = new SwTextAPIObject( pObj );
+ m_pImpl->m_xTextObject
+ = new SwTextAPIObject( o3tl::make_unique<SwTextAPIEditSource>(m_pImpl->m_pDoc) );
}
uno::Reference<text::XText> xText(m_pImpl->m_xTextObject.get());