[Libreoffice-commits] core.git: sw/inc sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 16 07:01:54 UTC 2018


 sw/inc/ToxTextGenerator.hxx             |    2 
 sw/source/core/access/accpara.cxx       |    2 
 sw/source/core/doc/doctxm.cxx           |   90 +++++++++++++-------------------
 sw/source/core/fields/authfld.cxx       |   23 +++-----
 sw/source/core/inc/doctxm.hxx           |    8 +-
 sw/source/core/tox/ToxTextGenerator.cxx |    2 
 6 files changed, 52 insertions(+), 75 deletions(-)

New commits:
commit 5a6d2392e02294721ef26e38d7c174d9b7faf93e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 14 14:03:58 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 16 09:01:26 2018 +0200

    loplugin:useuniqueptr in SwTOXBaseSection
    
    Change-Id: I1c4d9cb4189073d83ea2872b87475b8bf79e43db
    Reviewed-on: https://gerrit.libreoffice.org/59030
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/ToxTextGenerator.hxx b/sw/inc/ToxTextGenerator.hxx
index 556519701583..6540843f086b 100644
--- a/sw/inc/ToxTextGenerator.hxx
+++ b/sw/inc/ToxTextGenerator.hxx
@@ -63,7 +63,7 @@ public:
      * process @p numberOfEntriesToProcess entries.
      */
     void
-    GenerateText(SwDoc *doc, const std::vector<SwTOXSortTabBase*>& entries,
+    GenerateText(SwDoc *doc, const std::vector<std::unique_ptr<SwTOXSortTabBase>>& entries,
                       sal_uInt16 indexOfEntryToProcess, sal_uInt16 numberOfEntriesToProcess);
 
 private:
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 68e9d7502722..bdd27f7ad03b 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -681,7 +681,7 @@ SwTOXSortTabBase* SwAccessibleParagraph::GetTOXSortTabBase()
 
                 for(size_t nIndex = 0; nIndex<nSize; nIndex++ )
                 {
-                    pSortBase = pTOXBaseSect->GetTOXSortTabBases()[nIndex];
+                    pSortBase = pTOXBaseSect->GetTOXSortTabBases()[nIndex].get();
                     if( pSortBase->pTOXNd == pTextNd )
                         break;
                 }
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 889e3027bf30..274d3eebe2c6 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -70,6 +70,7 @@
 #include <calbck.hxx>
 #include <ToxTextGenerator.hxx>
 #include <ToxTabStopTokenHandler.hxx>
+#include <o3tl/make_unique.hxx>
 #include <tools/datetimeutils.hxx>
 #include <tools/globname.hxx>
 
@@ -722,8 +723,6 @@ SwTOXBaseSection::SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFormat & rFo
 
 SwTOXBaseSection::~SwTOXBaseSection()
 {
-    for (SwTOXSortTabBases::const_iterator it = aSortArr.begin(); it != aSortArr.end(); ++it)
-        delete *it;
 }
 
 bool SwTOXBaseSection::SetPosAtStartEnd( SwPosition& rPos ) const
@@ -831,8 +830,6 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
                                GetOptions() : SwTOIOptions::NONE,
                                GetSortAlgorithm() );
 
-    for (SwTOXSortTabBases::const_iterator it = aSortArr.begin(); it != aSortArr.end(); ++it)
-        delete *it;
     aSortArr.clear();
 
     // find the first layout node for this TOX, if it only find the content
@@ -941,7 +938,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
     // Sort the List of all TOC Marks and TOC Sections
     std::vector<SwTextFormatColl*> aCollArr( GetTOXForm().GetFormMax(), nullptr );
     SwNodeIndex aInsPos( *pFirstEmptyNd, 1 );
-    for( SwTOXSortTabBases::size_type nCnt = 0; nCnt < aSortArr.size(); ++nCnt )
+    for( size_t nCnt = 0; nCnt < aSortArr.size(); ++nCnt )
     {
         ::SetProgressState( 0, pDoc->GetDocShell() );
 
@@ -1035,7 +1032,7 @@ void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl )
 {
     SwDoc* pDoc = GetFormat()->GetDoc();
     OUString sLastDeli;
-    SwTOXSortTabBases::size_type i = 0;
+    size_t i = 0;
     while( i < aSortArr.size() )
     {
         ::SetProgressState( 0, pDoc->GetDocShell() );
@@ -1055,10 +1052,10 @@ void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl )
             // We skip all that are less than a small Blank (these are special characters)
             if( ' ' <= sDeli[0] )
             {
-                SwTOXCustom* pCst = new SwTOXCustom( TextAndReading(sDeli, OUString()),
+                std::unique_ptr<SwTOXCustom> pCst(new SwTOXCustom( TextAndReading(sDeli, OUString()),
                                                      FORM_ALPHA_DELIMITTER,
-                                                     rIntl, aSortArr[i]->GetLocale() );
-                aSortArr.insert( aSortArr.begin() + i, pCst);
+                                                     rIntl, aSortArr[i]->GetLocale() ));
+                aSortArr.insert( aSortArr.begin() + i, std::move(pCst));
                 i++;
             }
             sLastDeli = sDeli;
@@ -1154,27 +1151,23 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl,
                !pTOXSrc->IsHiddenByParaField() &&
                !SwScriptInfo::IsInHiddenRange( *pTOXSrc, pTextMark->GetStart() ) )
             {
-                SwTOXSortTabBase* pBase = nullptr;
                 if(TOX_INDEX == eTOXTyp)
                 {
                     // index entry mark
                     assert(g_pBreakIt);
                     lang::Locale aLocale = g_pBreakIt->GetLocale(pTOXSrc->GetLang(pTextMark->GetStart()));
 
-                    pBase = new SwTOXIndex( *pTOXSrc, pTextMark,
-                                            GetOptions(), FORM_ENTRY, rIntl, aLocale );
-                    InsertSorted(pBase);
+                    InsertSorted(o3tl::make_unique<SwTOXIndex>( *pTOXSrc, pTextMark,
+                                            GetOptions(), FORM_ENTRY, rIntl, aLocale ));
                     if(GetOptions() & SwTOIOptions::KeyAsEntry &&
                         !pTextMark->GetTOXMark().GetPrimaryKey().isEmpty())
                     {
-                        pBase = new SwTOXIndex( *pTOXSrc, pTextMark,
-                                                GetOptions(), FORM_PRIMARY_KEY, rIntl, aLocale );
-                        InsertSorted(pBase);
+                        InsertSorted(o3tl::make_unique<SwTOXIndex>( *pTOXSrc, pTextMark,
+                                                GetOptions(), FORM_PRIMARY_KEY, rIntl, aLocale ));
                         if (!pTextMark->GetTOXMark().GetSecondaryKey().isEmpty())
                         {
-                            pBase = new SwTOXIndex( *pTOXSrc, pTextMark,
-                                                    GetOptions(), FORM_SECONDARY_KEY, rIntl, aLocale );
-                            InsertSorted(pBase);
+                            InsertSorted(o3tl::make_unique<SwTOXIndex>( *pTOXSrc, pTextMark,
+                                                    GetOptions(), FORM_SECONDARY_KEY, rIntl, aLocale ));
                         }
                     }
                 }
@@ -1182,8 +1175,7 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl,
                     pMark->GetLevel() <= GetLevel())
                 {   // table of content mark
                     // also used for user marks
-                    pBase = new SwTOXContent( *pTOXSrc, pTextMark, rIntl );
-                    InsertSorted(pBase);
+                    InsertSorted(o3tl::make_unique<SwTOXContent>( *pTOXSrc, pTextMark, rIntl ));
                 }
             }
         }
@@ -1209,8 +1201,7 @@ void SwTOXBaseSection::UpdateOutline( const SwTextNode* pOwnChapterNode )
             ( !IsFromChapter() ||
                ::lcl_FindChapterNode( *pTextNd ) == pOwnChapterNode ))
         {
-            SwTOXPara * pNew = new SwTOXPara( *pTextNd, SwTOXElement::OutlineLevel );
-            InsertSorted( pNew );
+            InsertSorted( o3tl::make_unique<SwTOXPara>( *pTextNd, SwTOXElement::OutlineLevel ) );
         }
     }
 }
@@ -1248,8 +1239,7 @@ void SwTOXBaseSection::UpdateTemplate( const SwTextNode* pOwnChapterNode )
                     ( !IsFromChapter() || pOwnChapterNode ==
                         ::lcl_FindChapterNode( *pTextNd ) ) )
                 {
-                    SwTOXPara * pNew = new SwTOXPara( *pTextNd, SwTOXElement::Template, i + 1 );
-                    InsertSorted(pNew);
+                    InsertSorted( o3tl::make_unique<SwTOXPara>( *pTextNd, SwTOXElement::Template, i + 1 ) );
                 }
             }
         }
@@ -1283,7 +1273,7 @@ void SwTOXBaseSection::UpdateSequence( const SwTextNode* pOwnChapterNode )
             const OUString sName = GetSequenceName()
                 + OUStringLiteral1(cSequenceMarkSeparator)
                 + OUString::number( rSeqField.GetSeqNumber() );
-            SwTOXPara * pNew = new SwTOXPara( rTextNode, SwTOXElement::Sequence, 1, sName );
+            std::unique_ptr<SwTOXPara> pNew(new SwTOXPara( rTextNode, SwTOXElement::Sequence, 1, sName ));
             // set indexes if the number or the reference text are to be displayed
             if( GetCaptionDisplay() == CAPTION_TEXT )
             {
@@ -1294,7 +1284,7 @@ void SwTOXBaseSection::UpdateSequence( const SwTextNode* pOwnChapterNode )
             {
                 pNew->SetEndIndex(pTextField->GetStart() + 1);
             }
-            InsertSorted(pNew);
+            InsertSorted(std::move(pNew));
         }
     }
 }
@@ -1328,9 +1318,8 @@ void SwTOXBaseSection::UpdateAuthorities( const SwTOXInternational& rIntl )
                 pTextNode = GetBodyTextNode( *pDoc, aFieldPos, *pFrame );
             if(!pTextNode)
                 pTextNode = &rTextNode;
-            SwTOXAuthority* pNew = new SwTOXAuthority( *pTextNode, *pFormatField, rIntl );
 
-            InsertSorted(pNew);
+            InsertSorted(o3tl::make_unique<SwTOXAuthority>( *pTextNode, *pFormatField, rIntl ));
         }
     }
 }
@@ -1467,11 +1456,11 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType,
             if( pCNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && ( !IsFromChapter() ||
                     ::lcl_FindChapterNode( *pCNd ) == pOwnChapterNode ))
             {
-                SwTOXPara * pNew = new SwTOXPara( *pCNd, eMyType,
+                std::unique_ptr<SwTOXPara> pNew( new SwTOXPara( *pCNd, eMyType,
                             ( USHRT_MAX != nSetLevel )
                             ? static_cast<sal_uInt16>(nSetLevel)
-                            : FORM_ALPHA_DELIMITTER );
-                InsertSorted( pNew );
+                            : FORM_ALPHA_DELIMITTER ) );
+                InsertSorted( std::move(pNew) );
             }
         }
 
@@ -1505,7 +1494,7 @@ void SwTOXBaseSection::UpdateTable( const SwTextNode* pOwnChapterNode )
                 if( pCNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && (!IsFromChapter() ||
                     ::lcl_FindChapterNode( *pCNd ) == pOwnChapterNode ))
                 {
-                    SwTOXTable * pNew = new SwTOXTable( *pCNd );
+                    std::unique_ptr<SwTOXTable> pNew(new SwTOXTable( *pCNd ));
                     if( IsLevelFromChapter() && TOX_TABLES != SwTOXBase::GetType())
                     {
                         const SwTextNode* pOutlNd =
@@ -1519,7 +1508,7 @@ void SwTOXBaseSection::UpdateTable( const SwTextNode* pOwnChapterNode )
                             }
                         }
                     }
-                    InsertSorted(pNew);
+                    InsertSorted(std::move(pNew));
                     break;
                 }
             }
@@ -1543,12 +1532,12 @@ void SwTOXBaseSection::UpdatePageNum()
                               GetOptions() : SwTOIOptions::NONE,
                               GetSortAlgorithm() );
 
-    for( SwTOXSortTabBases::size_type nCnt = 0; nCnt < aSortArr.size(); ++nCnt )
+    for( size_t nCnt = 0; nCnt < aSortArr.size(); ++nCnt )
     {
         // Loop over all SourceNodes
 
         // process run in lines
-        SwTOXSortTabBases::size_type nRange = 0;
+        size_t nRange = 0;
         if(GetTOXForm().IsCommaSeparated() &&
                 aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
         {
@@ -1566,12 +1555,12 @@ void SwTOXBaseSection::UpdatePageNum()
         else
             nRange = 1;
 
-        for(SwTOXSortTabBases::size_type nRunInEntry = nCnt; nRunInEntry < nCnt + nRange; ++nRunInEntry)
+        for(size_t nRunInEntry = nCnt; nRunInEntry < nCnt + nRange; ++nRunInEntry)
         {
             std::vector<sal_uInt16> aNums; // the PageNumber
             std::vector<SwPageDesc*> aDescs; // The PageDescriptors matching the PageNumbers
             std::vector<sal_uInt16> aMainNums; // contains page numbers of main entries
-            SwTOXSortTabBase* pSortBase = aSortArr[nRunInEntry];
+            SwTOXSortTabBase* pSortBase = aSortArr[nRunInEntry].get();
             size_t nSize = pSortBase->aTOXSources.size();
             for (size_t j = 0; j < nSize; ++j)
             {
@@ -1622,7 +1611,7 @@ void SwTOXBaseSection::UpdatePageNum()
                 }
             }
             // Insert the PageNumber into the TOC TextNode
-            const SwTOXSortTabBase* pBase = aSortArr[ nCnt ];
+            const SwTOXSortTabBase* pBase = aSortArr[ nCnt ].get();
             if(pBase->pTOXNd)
             {
                 const SwTextNode* pTextNd = pBase->pTOXNd->GetTextNode();
@@ -1634,8 +1623,6 @@ void SwTOXBaseSection::UpdatePageNum()
         }
     }
     // Delete the mapping array after setting the right PageNumber
-    for (SwTOXSortTabBases::const_iterator it = aSortArr.begin(); it != aSortArr.end(); ++it)
-        delete *it;
     aSortArr.clear();
 }
 
@@ -1811,7 +1798,7 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
     }
 }
 
-void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
+void SwTOXBaseSection::InsertSorted(std::unique_ptr<SwTOXSortTabBase> pNew)
 {
     Range aRange(0, aSortArr.size());
     if( TOX_INDEX == SwTOXBase::GetType() && pNew->pTextMark )
@@ -1837,18 +1824,16 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
     {
         for(short i = static_cast<short>(aRange.Min()); i < static_cast<short>(aRange.Max()); ++i)
         {
-            SwTOXSortTabBase* pOld = aSortArr[i];
+            SwTOXSortTabBase* pOld = aSortArr[i].get();
             if(*pOld == *pNew)
             {
                 if(*pOld < *pNew)
                 {
-                    delete pNew;
                     return;
                 }
                 else
                 {
                     // remove the old content
-                    delete aSortArr[i];
                     aSortArr.erase( aSortArr.begin() + i );
                     aRange.Max()--;
                     break;
@@ -1862,7 +1847,7 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
 
     for( i = aRange.Min(); i < aRange.Max(); ++i)
     {   // Only check for same level
-        SwTOXSortTabBase* pOld = aSortArr[i];
+        SwTOXSortTabBase* pOld = aSortArr[i].get();
         if(*pOld == *pNew)
         {
             if(TOX_AUTHORITIES != SwTOXBase::GetType())
@@ -1874,13 +1859,12 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
 
                 if(!(SwTOXSortTabBase::GetOptions() & SwTOIOptions::SameEntry))
                 {   // Own entry
-                    aSortArr.insert(aSortArr.begin() + i, pNew);
+                    aSortArr.insert(aSortArr.begin() + i, std::move(pNew));
                     return;
                 }
                 // If the own entry is already present, add it to the references list
                 pOld->aTOXSources.push_back(pNew->aTOXSources[0]);
 
-                delete pNew;
                 return;
             }
 #if OSL_DEBUG_LEVEL > 0
@@ -1897,7 +1881,7 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
         i++;
 
     // Insert at position i
-    aSortArr.insert(aSortArr.begin()+i, pNew);
+    aSortArr.insert(aSortArr.begin()+i, std::move(pNew));
 }
 
 /// Find Key Range and insert if possible
@@ -1923,7 +1907,7 @@ Range SwTOXBaseSection::GetKeyRange(const OUString& rStr, const OUString& rStrRe
 
     for( i = nMin; i < nMax; ++i)
     {
-        SwTOXSortTabBase* pBase = aSortArr[i];
+        SwTOXSortTabBase* pBase = aSortArr[i].get();
 
         if( rIntl.IsEqual( pBase->GetText(), pBase->GetLocale(),
                            aToCompare, rNew.GetLocale() )  &&
@@ -1932,14 +1916,14 @@ Range SwTOXBaseSection::GetKeyRange(const OUString& rStr, const OUString& rStrRe
     }
     if(i == nMax)
     {   // If not already present, create and insert
-        SwTOXCustom* pKey = new SwTOXCustom( aToCompare, nLevel, rIntl,
-                                             rNew.GetLocale() );
+        std::unique_ptr<SwTOXCustom> pKey(new SwTOXCustom( aToCompare, nLevel, rIntl,
+                                             rNew.GetLocale() ));
         for(i = nMin; i < nMax; ++i)
         {
             if(nLevel == aSortArr[i]->GetLevel() &&  *pKey < *(aSortArr[i]))
                 break;
         }
-        aSortArr.insert(aSortArr.begin() + i, pKey);
+        aSortArr.insert(aSortArr.begin() + i, std::move(pKey));
     }
     const long nStart = i+1;
     const long nEnd   = aSortArr.size();
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 2cd6afe06cc4..9f5983b03fca 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -241,7 +241,7 @@ sal_uInt16  SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
         DelSequenceArray();
     if(m_SequArr.empty())
     {
-        SwTOXSortTabBases aSortArr;
+        std::vector<std::unique_ptr<SwTOXSortTabBase>> aSortArr;
         SwIterator<SwFormatField,SwFieldType> aIter( *this );
 
         SwTOXInternational aIntl(m_eLanguage, SwTOIOptions::NONE, m_sSortAlgorithm);
@@ -275,9 +275,9 @@ sal_uInt16  SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
                 std::unique_ptr<SwTOXAuthority> pNew(
                     new SwTOXAuthority(*pTextNode, *pFormatField, aIntl));
 
-                for(SwTOXSortTabBases::size_type i = 0; i < aSortArr.size(); ++i)
+                for(size_t i = 0; i < aSortArr.size(); ++i)
                 {
-                    SwTOXSortTabBase* pOld = aSortArr[i];
+                    SwTOXSortTabBase* pOld = aSortArr[i].get();
                     if(*pOld == *pNew)
                     {
                         //only the first occurrence in the document
@@ -285,39 +285,34 @@ sal_uInt16  SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
                         if(*pOld < *pNew)
                             pNew.reset();
                         else // remove the old content
-                        {
                             aSortArr.erase(aSortArr.begin() + i);
-                            delete pOld;
-                        }
                         break;
                     }
                 }
                 //if it still exists - insert at the correct position
                 if(pNew)
                 {
-                    SwTOXSortTabBases::size_type j {0};
+                    size_t j {0};
 
                     while(j < aSortArr.size())
                     {
-                        SwTOXSortTabBase* pOld = aSortArr[j];
+                        SwTOXSortTabBase* pOld = aSortArr[j].get();
                         if(*pNew < *pOld)
                             break;
                         ++j;
                     }
-                    aSortArr.insert(aSortArr.begin() + j, pNew.release());
+                    aSortArr.insert(aSortArr.begin() + j, std::move(pNew));
                 }
             }
         }
 
-        for(const auto *pBase : aSortArr)
+        for(auto & pBase : aSortArr)
         {
-            const SwTOXSortTabBase& rBase = *pBase;
-            SwFormatField& rFormatField = const_cast<SwTOXAuthority&>(static_cast<const SwTOXAuthority&>(rBase)).GetFieldFormat();
+            SwTOXSortTabBase& rBase = *pBase;
+            SwFormatField& rFormatField = static_cast<SwTOXAuthority&>(rBase).GetFieldFormat();
             SwAuthorityField* pAField = static_cast<SwAuthorityField*>(rFormatField.GetField());
             m_SequArr.push_back(pAField->GetHandle());
         }
-        for (SwTOXSortTabBases::const_iterator it = aSortArr.begin(); it != aSortArr.end(); ++it)
-            delete *it;
         aSortArr.clear();
     }
     //find nHandle
diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx
index 39826f2eb8ec..9eba84b25630 100644
--- a/sw/source/core/inc/doctxm.hxx
+++ b/sw/source/core/inc/doctxm.hxx
@@ -31,11 +31,9 @@ class  SwTextFormatColl;
 struct SwPosition;
 struct SwTOXSortTabBase;
 
-typedef std::vector<SwTOXSortTabBase*> SwTOXSortTabBases;
-
 class SwTOXBaseSection : public SwTOXBase, public SwSection
 {
-    SwTOXSortTabBases aSortArr;
+    std::vector<std::unique_ptr<SwTOXSortTabBase>> aSortArr;
 
     void UpdateMarks( const SwTOXInternational& rIntl,
                       const SwTextNode* pOwnChapterNode );
@@ -48,7 +46,7 @@ class SwTOXBaseSection : public SwTOXBase, public SwSection
     void UpdateAuthorities( const SwTOXInternational& rIntl );
 
     // insert sorted into array for creation
-    void InsertSorted(SwTOXSortTabBase* pBase);
+    void InsertSorted(std::unique_ptr<SwTOXSortTabBase> pBase);
 
     // insert alpha delimiter at creation
     void InsertAlphaDelimitter( const SwTOXInternational& rIntl );
@@ -78,7 +76,7 @@ public:
                  const bool        _bNewTOX = false );
     void UpdatePageNum();               // insert page numbering
 
-    const SwTOXSortTabBases& GetTOXSortTabBases() const { return aSortArr; }
+    const std::vector<std::unique_ptr<SwTOXSortTabBase>>& GetTOXSortTabBases() const { return aSortArr; }
 
     bool SetPosAtStartEnd( SwPosition& rPos ) const;
 };
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx
index ae3bc73cfbef..7ec515e7aae4 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -157,7 +157,7 @@ ToxTextGenerator::GenerateTextForChapterToken(const SwFormToken& chapterToken, c
 // Add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc> in order to control,
 // which page description is used, no appropriate one is found.
 void
-ToxTextGenerator::GenerateText(SwDoc* pDoc, const std::vector<SwTOXSortTabBase*> &entries,
+ToxTextGenerator::GenerateText(SwDoc* pDoc, const std::vector<std::unique_ptr<SwTOXSortTabBase>> &entries,
         sal_uInt16 indexOfEntryToProcess, sal_uInt16 numberOfEntriesToProcess)
 {
     // pTOXNd is only set at the first mark


More information about the Libreoffice-commits mailing list