loplugin:useuniqueptr in SwTextSizeInfo::GetMultiCreator

Change-Id: I5cc13b33f46eee9a770049c1127e5de47fecea84
Reviewed-on: https://gerrit.libreoffice.org/60455
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 1156e11..d788183 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -201,7 +201,7 @@ public:
    // GetMultiAttr returns the text attribute of the multiportion,
    // if rPos is inside any multi-line part.
    // rPos will set to the end of the multi-line part.
    SwMultiCreator* GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const* pM) const;
    std::unique_ptr<SwMultiCreator> GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const* pM) const;

    bool OnWin() const { return m_bOnWin; }
    void SetOnWin( const bool bNew ) { m_bOnWin = bNew; }
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 2df29c9..a092360 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1250,7 +1250,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
            // We open a multiportion part, if we enter a multi-line part
            // of the paragraph.
            TextFrameIndex nEnd = rInf.GetIdx();
            SwMultiCreator* pCreate = rInf.GetMultiCreator( nEnd, pMulti );
            std::unique_ptr<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, pMulti );
            if( pCreate )
            {
                SwMultiPortion* pTmp = nullptr;
@@ -1269,7 +1269,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
                else
                    pTmp = new SwDoubleLinePortion( *pCreate, nEnd );

                delete pCreate;
                pCreate.reset();
                CalcFlyWidth( rInf );

                return pTmp;
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index aaebf66..578d7643c 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -905,7 +905,7 @@ namespace sw {
// interrupts the first attribute.
// E.g. a ruby portion interrupts a 2-line-attribute, a 2-line-attribute
// with different brackets interrupts another 2-line-attribute.
SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
                                                SwMultiPortion const * pMulti ) const
{
    SwScriptInfo& rSI = const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
@@ -938,7 +938,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
        rPos = bFieldBidi ? rPos + TextFrameIndex(1) : rSI.NextDirChg(rPos, &nCurrLevel);
        if (TextFrameIndex(COMPLETE_STRING) == rPos)
            return nullptr;
        SwMultiCreator *pRet = new SwMultiCreator;
        std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
        pRet->pItem = nullptr;
        pRet->pAttr = nullptr;
        pRet->nId = SwMultiCreatorId::Bidi;
@@ -1043,7 +1043,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
    {   // The winner is ... a ruby attribute and so
        // the end of the multiportion is the end of the ruby attribute.
        rPos = m_pFrame->MapModelToView(startPos.first, *pRuby->End());
        SwMultiCreator *pRet = new SwMultiCreator;
        std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
        pRet->pItem = nullptr;
        pRet->pAttr = pRuby;
        pRet->nId = SwMultiCreatorId::Ruby;
@@ -1055,7 +1055,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
         rPos < TextFrameIndex(GetText().getLength())))
    {   // The winner is a 2-line-attribute,
        // the end of the multiportion depends on the following attributes...
        SwMultiCreator *pRet = new SwMultiCreator;
        std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);

        // We note the endpositions of the 2-line attributes in aEnd as stack
        std::deque<TextFrameIndex> aEnd;
@@ -1202,7 +1202,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
         rPos < TextFrameIndex(GetText().getLength())))
    {   // The winner is a rotate-attribute,
        // the end of the multiportion depends on the following attributes...
        SwMultiCreator *pRet = new SwMultiCreator;
        std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
        pRet->nId = SwMultiCreatorId::Rotate;

        // We note the endpositions of the 2-line attributes in aEnd as stack
@@ -2430,7 +2430,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
        return pRest;

    nPosition = nMultiPos + pHelpMulti->GetLen();
    SwMultiCreator* pCreate = GetInfo().GetMultiCreator( nMultiPos, nullptr );
    std::unique_ptr<SwMultiCreator> pCreate = GetInfo().GetMultiCreator( nMultiPos, nullptr );

    if ( !pCreate )
    {
@@ -2462,10 +2462,9 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
            pTmp = new SwRotatedPortion( nMultiPos, pHelpMulti->GetDirection() );
        else
        {
            delete pCreate;
            return pRest;
        }
        delete pCreate;
        pCreate.reset();
        pTmp->SetFollowField();
        if( pRest )
        {
@@ -2479,7 +2478,6 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
        }
        return pTmp;
    }
    delete pCreate;
    return pRest;
}