summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-19 09:10:43 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-19 08:33:10 +0000
commitd4d2fc24793960a07275e49706b90928b4a0c764 (patch)
tree3d5bd19190426cee18730893ac9ff292caf2566e /sw/source/core
parent71b74f8fd1fc84cf92dddeab02647b8b765d0d4a (diff)
clang-tidy modernize-make-unique
Change-Id: I550bb69ddcef69906027516ccde62cf8e87c295b Reviewed-on: https://gerrit.libreoffice.org/25138 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/crsr/bookmrk.cxx5
-rw-r--r--sw/source/core/doc/docbm.cxx5
-rw-r--r--sw/source/core/doc/tblafmt.cxx3
-rw-r--r--sw/source/core/fields/authfld.cxx3
-rw-r--r--sw/source/core/frmedt/fetab.cxx3
-rw-r--r--sw/source/core/tox/ToxLinkProcessor.cxx5
-rw-r--r--sw/source/core/unocore/unoportenum.cxx3
-rw-r--r--sw/source/core/unocore/unostyle.cxx5
8 files changed, 20 insertions, 12 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 2f3002167b77..08594bc3d0e8 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -32,6 +32,7 @@
#include <UndoBookmark.hxx>
#include <unobookmark.hxx>
#include <rtl/random.h>
+#include <o3tl/make_unique.hxx>
#include <xmloff/odffields.hxx>
#include <libxml/xmlwriter.h>
#include <comphelper/anytostring.hxx>
@@ -167,13 +168,13 @@ namespace sw { namespace mark
void MarkBase::SetMarkPos(const SwPosition& rNewPos)
{
- std::unique_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos1);
+ o3tl::make_unique<SwPosition>(rNewPos).swap(m_pPos1);
m_pPos1->nContent.SetMark(this);
}
void MarkBase::SetOtherMarkPos(const SwPosition& rNewPos)
{
- std::unique_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos2);
+ o3tl::make_unique<SwPosition>(rNewPos).swap(m_pPos2);
m_pPos2->nContent.SetMark(this);
}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 2c79ac1bdad9..89252fb447cf 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -40,6 +40,7 @@
#include <pam.hxx>
#include <redline.hxx>
#include <rolbck.hxx>
+#include <o3tl/make_unique.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
@@ -135,7 +136,7 @@ namespace
return lcl_PositionFromContentNode( pNode, bPosAtEndOfNode );
}
- return ::std::unique_ptr<SwPosition>(new SwPosition(rOtherPosition));
+ return o3tl::make_unique<SwPosition>(rOtherPosition);
}
IMark* lcl_getMarkAfter(const IDocumentMarkAccess::container_t& rMarks, const SwPosition& rPos)
@@ -756,7 +757,7 @@ namespace sw { namespace mark
{
if ( pEndIdx != nullptr )
{
- pNewPos = ::std::unique_ptr< SwPosition >( new SwPosition( rEnd, *pEndIdx ) );
+ pNewPos = o3tl::make_unique< SwPosition >( rEnd, *pEndIdx );
}
else
{
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 414895b13e1d..c27194c40ee4 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/make_unique.hxx>
#include <tools/resid.hxx>
#include <tools/stream.hxx>
#include <vcl/svapp.hxx>
@@ -1032,7 +1033,7 @@ void SwTableAutoFormatTable::AddAutoFormat(const SwTableAutoFormat& rTableStyle)
if (FindAutoFormat(rTableStyle.GetName()))
return;
- InsertAutoFormat(size(), std::unique_ptr<SwTableAutoFormat>(new SwTableAutoFormat(rTableStyle)));
+ InsertAutoFormat(size(), o3tl::make_unique<SwTableAutoFormat>(rTableStyle));
}
void SwTableAutoFormatTable::InsertAutoFormat(size_t const i, std::unique_ptr<SwTableAutoFormat> pFormat)
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 8f65c6abffc1..9339aa28dea4 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -21,6 +21,7 @@
#include <comphelper/string.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/langitem.hxx>
+#include <o3tl/make_unique.hxx>
#include <swtypes.hxx>
#include <tools/resid.hxx>
#include <comcore.hrc>
@@ -217,7 +218,7 @@ sal_uInt16 SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert )
}
//if it is a new Entry - insert
- m_DataArr.push_back(std::unique_ptr<SwAuthEntry>(new SwAuthEntry(rInsert)));
+ m_DataArr.push_back(o3tl::make_unique<SwAuthEntry>(rInsert));
return m_DataArr.size()-1;
}
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index de56b8c6c606..d0fd94d7282b 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -19,6 +19,7 @@
#include <hintids.hxx>
+#include <o3tl/make_unique.hxx>
#include <tools/errinf.hxx>
#include <vcl/svapp.hxx>
#include <basegfx/vector/b2dvector.hxx>
@@ -91,7 +92,7 @@ class TableWait
{ return our_kLineLimit < nCnt || our_kLineLimit < nCnt2 || (pFrame && our_kLineLimit < pFrame->ImplFindTabFrame()->GetTable()->GetTabLines().size()); }
public:
TableWait(size_t nCnt, SwFrame *pFrame, SwDocShell &rDocShell, size_t nCnt2 = 0)
- : m_pWait( ShouldWait(nCnt, pFrame, nCnt2) ? ::std::unique_ptr<SwWait>(new SwWait( rDocShell, true )) : nullptr )
+ : m_pWait( ShouldWait(nCnt, pFrame, nCnt2) ? o3tl::make_unique<SwWait>( rDocShell, true ) : nullptr )
{ }
};
diff --git a/sw/source/core/tox/ToxLinkProcessor.cxx b/sw/source/core/tox/ToxLinkProcessor.cxx
index cbb7275ca42f..1ef40d271625 100644
--- a/sw/source/core/tox/ToxLinkProcessor.cxx
+++ b/sw/source/core/tox/ToxLinkProcessor.cxx
@@ -11,6 +11,7 @@
#include "SwStyleNameMapper.hxx"
#include "ndtxt.hxx"
+#include <o3tl/make_unique.hxx>
#include <poolfmt.hrc>
#include <stdexcept>
@@ -20,8 +21,8 @@ namespace sw {
void
ToxLinkProcessor::StartNewLink(sal_Int32 startPosition, const OUString& characterStyle)
{
- m_StartedLinks.push_back(std::unique_ptr<StartedLink>(
- new StartedLink(startPosition, characterStyle)));
+ m_StartedLinks.push_back(o3tl::make_unique<StartedLink>(
+ startPosition, characterStyle));
}
void
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 1f0db3dfda0c..920f3b70b8f6 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -62,6 +62,7 @@
#include <comphelper/string.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/make_unique.hxx>
#include <algorithm>
#include <memory>
#include <set>
@@ -160,7 +161,7 @@ namespace
else if (pCrossRefMark)
{
// Crossrefbookmarks only remember the start position but have to span the whole paragraph
- pCrossRefEndPos = unique_ptr<SwPosition>(new SwPosition(rEndPos));
+ pCrossRefEndPos = o3tl::make_unique<SwPosition>(rEndPos);
pCrossRefEndPos->nContent = pCrossRefEndPos->nNode.GetNode().GetTextNode()->Len();
pEndPos = pCrossRefEndPos.get();
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index e4b67d816697..7b7a4676082a 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -72,6 +72,7 @@
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx>
+#include <o3tl/make_unique.hxx>
//UUUU
#include <svx/unobrushitemhelper.hxx>
@@ -1180,8 +1181,8 @@ SwXStyle::SwXStyle(SwDoc* pDoc, SfxStyleFamily eFamily, bool bConditional)
assert(!m_bIsConditional || m_rEntry.m_eFamily == SfxStyleFamily::Para); // only paragraph styles are conditional
// Register ourselves as a listener to the document (via the page descriptor)
pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
- m_pPropertiesImpl = std::unique_ptr<SwStyleProperties_Impl>(
- new SwStyleProperties_Impl(aSwMapProvider.GetPropertySet(m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.m_nPropMapType)->getPropertyMap()));
+ m_pPropertiesImpl = o3tl::make_unique<SwStyleProperties_Impl>(
+ aSwMapProvider.GetPropertySet(m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.m_nPropMapType)->getPropertyMap());
}
SwXStyle::SwXStyle(SfxStyleSheetBasePool* pPool, SfxStyleFamily eFamily, SwDoc* pDoc, const OUString& rStyleName)