[Libreoffice-commits] core.git: 4 commits - basctl/source cui/source dbaccess/source include/svtools sc/source sd/source sfx2/source svtools/source svx/source sw/qa sw/source

Michael Stahl mstahl at redhat.com
Mon Jul 20 13:52:28 PDT 2015


 basctl/source/basicide/moduldl2.cxx             |    5 
 cui/source/customize/acccfg.cxx                 |   10 -
 cui/source/customize/cfg.cxx                    |    2 
 cui/source/customize/macropg.cxx                |   10 -
 cui/source/dialogs/thesdlg.cxx                  |    9 -
 cui/source/options/fontsubs.cxx                 |   23 +-
 cui/source/options/optHeaderTabListbox.cxx      |    5 
 cui/source/options/optaboutconfig.cxx           |   87 ++++++----
 cui/source/options/optfltr.cxx                  |   19 +-
 cui/source/options/optlingu.cxx                 |   20 +-
 cui/source/tabpages/autocdlg.cxx                |   27 +--
 cui/source/tabpages/macroass.cxx                |    5 
 dbaccess/source/ui/browser/unodatbr.cxx         |    2 
 dbaccess/source/ui/control/dbtreelistbox.cxx    |    6 
 dbaccess/source/ui/control/tabletree.cxx        |    3 
 dbaccess/source/ui/misc/WNameMatch.cxx          |    4 
 include/svtools/treelist.hxx                    |    2 
 include/svtools/treelistentries.hxx             |    5 
 include/svtools/treelistentry.hxx               |   17 +
 sc/source/ui/miscdlgs/solveroptions.cxx         |   22 +-
 sc/source/ui/navipi/content.cxx                 |    4 
 sc/source/ui/xmlsource/xmlsourcedlg.cxx         |    6 
 sd/source/ui/animations/CustomAnimationList.cxx |   12 -
 sd/source/ui/dlg/dlgassim.cxx                   |   19 +-
 sd/source/ui/dlg/sdtreelb.cxx                   |    4 
 sfx2/source/dialog/templdlg.cxx                 |   10 -
 svtools/source/contnr/svimpbox.cxx              |    2 
 svtools/source/contnr/svtabbx.cxx               |    4 
 svtools/source/contnr/treelist.cxx              |  208 ++++++++++++------------
 svtools/source/contnr/treelistbox.cxx           |   22 +-
 svtools/source/contnr/treelistentry.cxx         |   67 +++----
 svtools/source/uno/treecontrolpeer.cxx          |   11 -
 svx/source/dialog/ctredlin.cxx                  |   15 +
 svx/source/dialog/docrecovery.cxx               |    5 
 svx/source/dialog/fontlb.cxx                    |   10 -
 svx/source/form/filtnav.cxx                     |    9 -
 sw/qa/extras/uiwriter/uiwriter.cxx              |    4 
 sw/source/core/unocore/unoflatpara.cxx          |    8 
 sw/source/uibase/utlui/content.cxx              |    5 
 sw/source/uibase/utlui/glbltree.cxx             |    5 
 40 files changed, 392 insertions(+), 321 deletions(-)

New commits:
commit 0a91e08a46118b495f80f7901b2132b194d6d409
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 20 20:41:43 2015 +0200

    sw: SwXFlatParagraph::isChecked() return value is inverted
    
    It was checked if the flag says it's not dirty.
    Thanks to Varun Dhall for pointing to this problem.
    
    Change-Id: I4aa1fef8b2251f0f3e579930b39d6d5a256c1895

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index bbf8c2c..08158cc 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1074,9 +1074,9 @@ void SwUiWriterTest::testXFlatParagraph()
     //checking modified status
     CPPUNIT_ASSERT(!xFlatPara->isModified());
     //checking "checked" staus, modifying it and asserting the changes
-    CPPUNIT_ASSERT(xFlatPara->isChecked(sal_Int32(text::TextMarkupType::SPELLCHECK)));
-    xFlatPara->setChecked((sal_Int32(text::TextMarkupType::SPELLCHECK)), true);
     CPPUNIT_ASSERT(!xFlatPara->isChecked(sal_Int32(text::TextMarkupType::SPELLCHECK)));
+    xFlatPara->setChecked((sal_Int32(text::TextMarkupType::SPELLCHECK)), true);
+    CPPUNIT_ASSERT(xFlatPara->isChecked(sal_Int32(text::TextMarkupType::SPELLCHECK)));
     //getting other XFlatParagraphs and asserting their contents
     uno::Reference<text::XFlatParagraph> xFlatPara2(xFPIterator->getParaAfter(xFlatPara));
     CPPUNIT_ASSERT_EQUAL(OUString("This is another sample text"), xFlatPara2->getText());
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index 7922c37..4af396a 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -218,14 +218,14 @@ sal_Bool SAL_CALL SwXFlatParagraph::isChecked( ::sal_Int32 nType ) throw (uno::R
     if (GetTextNode())
     {
         if ( text::TextMarkupType::SPELLCHECK == nType )
-            return GetTextNode()->IsWrongDirty();
+            return !GetTextNode()->IsWrongDirty();
         else if ( text::TextMarkupType::PROOFREADING == nType )
-            return GetTextNode()->IsGrammarCheckDirty();
+            return !GetTextNode()->IsGrammarCheckDirty();
         else if ( text::TextMarkupType::SMARTTAG == nType )
-            return GetTextNode()->IsSmartTagDirty();
+            return !GetTextNode()->IsSmartTagDirty();
     }
 
-    return sal_False;
+    return sal_True;
 }
 
 // text::XFlatParagraph:
commit cd74d49de55e87a4e801e8a245d198ea51d0ec34
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 20 21:27:01 2015 +0200

    svtools: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: I895c950c11499afb278b989565f3eae33aaf4a76

diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index a87d809..811976c 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -213,7 +213,7 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUS
     if(bInsertToPrefBox)
         m_pPrefBox->Insert( pEntry, pParentEntry );
     else
-        m_prefBoxEntries.push_back( pEntry );
+        m_prefBoxEntries.push_back(std::unique_ptr<SvTreeListEntry>(pEntry));
 }
 
 void CuiAboutConfigTabPage::Reset()
@@ -308,10 +308,10 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
             // leaf node
             OUString sPropertyName = seqItems[i];
             SvTreeListEntries::iterator it = std::find_if(m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
-              [&sPath, &sPropertyName](SvTreeListEntry &entry) -> bool
+              [&sPath, &sPropertyName](std::unique_ptr<SvTreeListEntry> const& pEntry) -> bool
               {
-                  return static_cast< UserData* >( entry.GetUserData() )->sPropertyPath.equals( sPath ) &&
-                          static_cast< SvLBoxString& >( entry.GetItem(2) ).GetText().equals( sPropertyName );
+                  return static_cast<UserData*>(pEntry->GetUserData())->sPropertyPath.equals(sPath)
+                      && static_cast<SvLBoxString&>(pEntry->GetItem(2)).GetText().equals(sPropertyName);
               }
             );
 
@@ -319,7 +319,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
             OUString sValue;
 
             if (it != m_modifiedPrefBoxEntries.end())
-                sValue = static_cast< SvLBoxString& >( it->GetItem(4) ).GetText();
+                sValue = static_cast< SvLBoxString& >( (*it)->GetItem(4) ).GetText();
             else
             {
                 switch( aNode.getValueType().getTypeClass() )
@@ -772,35 +772,38 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
                 m_pPrefBox->SetEntryText( sDialogValue,  pEntry, 3 );
                 //update m_prefBoxEntries
                 SvTreeListEntries::iterator it = std::find_if(m_prefBoxEntries.begin(), m_prefBoxEntries.end(),
-                  [&pUserData, &sPropertyName](SvTreeListEntry &entry) -> bool
+                  [&pUserData, &sPropertyName](std::unique_ptr<SvTreeListEntry> const& rpEntry) -> bool
                   {
-                      return static_cast< UserData* >( entry.GetUserData() )->sPropertyPath.equals( pUserData->sPropertyPath ) &&
-                              static_cast< SvLBoxString& >( entry.GetItem(2) ).GetText().equals( sPropertyName );
+                      return static_cast<UserData*>(rpEntry->GetUserData())->sPropertyPath.equals(pUserData->sPropertyPath)
+                          && static_cast<SvLBoxString&>(rpEntry->GetItem(2)).GetText().equals(sPropertyName);
                   }
                 );
                 if (it != m_prefBoxEntries.end())
                 {
-                    it->ReplaceItem(std::unique_ptr<SvLBoxString>(
-                        new SvLBoxString( &(*it), 0, sDialogValue)), 4);
+                    (*it)->ReplaceItem(std::unique_ptr<SvLBoxString>(
+                        new SvLBoxString( (*it).get(), 0, sDialogValue)), 4);
 
                     SvTreeListEntries::iterator modifiedIt = std::find_if(
                                 m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
-                                [&pUserData, &sPropertyName](SvTreeListEntry &entry) -> bool
+                                [&pUserData, &sPropertyName](std::unique_ptr<SvTreeListEntry> const& rpEntry) -> bool
                                 {
-                                    return static_cast< UserData* >( entry.GetUserData() )->sPropertyPath.equals( pUserData->sPropertyPath ) &&
-                                            static_cast< SvLBoxString& >( entry.GetItem(2) ).GetText().equals( sPropertyName );
+                                    return static_cast<UserData*>(rpEntry->GetUserData())->sPropertyPath.equals(pUserData->sPropertyPath)
+                                        && static_cast<SvLBoxString&>(rpEntry->GetItem(2)).GetText().equals(sPropertyName);
                                 }
                     );
 
                     if( modifiedIt != m_modifiedPrefBoxEntries.end())
-                        modifiedIt->ReplaceItem(std::unique_ptr<SvLBoxString>(
-                            new SvLBoxString(&(*modifiedIt), 0, sDialogValue)),
+                    {
+                        (*modifiedIt)->ReplaceItem(std::unique_ptr<SvLBoxString>(
+                            new SvLBoxString((*modifiedIt).get(), 0, sDialogValue)),
                             4);
+                    }
                     else
                     {
-                        SvTreeListEntry *pCloneEntry = new SvTreeListEntry;
-                        pCloneEntry->Clone( &(*it));
-                        m_modifiedPrefBoxEntries.push_back( pCloneEntry );
+                        std::unique_ptr<SvTreeListEntry> pCloneEntry(
+                                new SvTreeListEntry);
+                        pCloneEntry->Clone((*it).get());
+                        m_modifiedPrefBoxEntries.push_back(std::move(pCloneEntry));
                     }
                 }
             }
@@ -833,7 +836,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl)
     {
         m_options.searchString = m_pSearchEdit->GetText();
         utl::TextSearch textSearch( m_options );
-        for(auto it = m_prefBoxEntries.begin(); it != m_prefBoxEntries.end(); ++it)
+        for (auto const& it : m_prefBoxEntries)
         {
             sal_Int32 endPos, startPos = 0;
 
@@ -848,7 +851,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl)
                 if( textSearch.SearchForward( scrTxt, &startPos, &endPos ) )
                 {
                     SvTreeListEntry* pEntry = new SvTreeListEntry;
-                    pEntry->Clone( &(*it) );
+                    pEntry->Clone( it.get() );
                     InsertEntry( pEntry );
                     break;
                 }
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 7481d2b..1c5e945 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -3773,7 +3773,7 @@ void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const OUString& _rDataSo
 
     for (; it != itEnd; ++it)
     {
-        SvTreeListEntry* pEntry = &(*it);
+        SvTreeListEntry* pEntry = (*it).get();
         const DBTreeListUserData* pData = static_cast<const DBTreeListUserData*>(pEntry->GetUserData());
         pEntry->SetUserData(NULL);
         delete pData;
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 1944410..77edc1f 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -103,7 +103,7 @@ SvTreeListEntry* DBTreeListBox::GetEntryPosByName( const OUString& aName, SvTree
     SvTreeListEntries::iterator it = aIters.first, itEnd = aIters.second;
     for (; it != itEnd; ++it)
     {
-        pEntry = &(*it);
+        pEntry = (*it).get();
         const SvLBoxString* pItem = static_cast<const SvLBoxString*>(
             pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
 
diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx
index c12cf85..510014a 100644
--- a/include/svtools/treelist.hxx
+++ b/include/svtools/treelist.hxx
@@ -109,7 +109,7 @@ class SVT_DLLPUBLIC SvTreeList
     SVT_DLLPRIVATE void SetAbsolutePositions();
 
     SVT_DLLPRIVATE void CloneChildren(
-        SvTreeListEntries& rDst, sal_uLong& rCloneCount, SvTreeListEntries& rSrc, SvTreeListEntry* pNewParent) const;
+        SvTreeListEntries& rDst, sal_uLong& rCloneCount, SvTreeListEntries& rSrc, SvTreeListEntry& rNewParent) const;
 
     /**
      * Invalidate the cached position data to have them re-generated before
diff --git a/include/svtools/treelistentries.hxx b/include/svtools/treelistentries.hxx
index 051be76..a7880f8 100644
--- a/include/svtools/treelistentries.hxx
+++ b/include/svtools/treelistentries.hxx
@@ -10,10 +10,11 @@
 #ifndef INCLUDED_SVTOOLS_TREELISTENTRIES_HXX
 #define INCLUDED_SVTOOLS_TREELISTENTRIES_HXX
 
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
 
 class SvTreeListEntry;
-typedef boost::ptr_vector<SvTreeListEntry> SvTreeListEntries;
+typedef std::vector<std::unique_ptr<SvTreeListEntry>> SvTreeListEntries;
 
 #endif
 
diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx
index 2fcd628..640aaf3 100644
--- a/include/svtools/treelistentry.hxx
+++ b/include/svtools/treelistentry.hxx
@@ -57,7 +57,7 @@ class SVT_DLLPUBLIC SvTreeListEntry
     typedef std::vector<std::unique_ptr<SvLBoxItem>> ItemsType;
 
     SvTreeListEntry*    pParent;
-    SvTreeListEntries   maChildren;
+    SvTreeListEntries   m_Children;
     sal_uLong           nAbsPos;
     sal_uLong           nListPos;
     ItemsType           m_Items;
@@ -82,8 +82,8 @@ public:
     bool HasChildListPos() const;
     sal_uLong GetChildListPos() const;
 
-    SvTreeListEntries& GetChildEntries() { return maChildren;}
-    const SvTreeListEntries& GetChildEntries() const { return maChildren;}
+    SvTreeListEntries& GetChildEntries() { return m_Children; }
+    const SvTreeListEntries& GetChildEntries() const { return m_Children; }
 
     void Clone(SvTreeListEntry* pSource);
 
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 3ba29ee..3777b5e 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -448,8 +448,7 @@ void ScXMLSourceDlg::SetRangeLinkable()
 void ScXMLSourceDlg::SelectAllChildEntries(SvTreeListEntry& rEntry)
 {
     SvTreeListEntries& rChildren = rEntry.GetChildEntries();
-    SvTreeListEntries::iterator it = rChildren.begin(), itEnd = rChildren.end();
-    for (; it != itEnd; ++it)
+    for (auto const& it : rChildren)
     {
         SvTreeListEntry& r = *it;
         SelectAllChildEntries(r); // select recursively.
@@ -521,8 +520,7 @@ void getFieldLinks(
         // No more children.  We're done.
         return;
 
-    SvTreeListEntries::const_iterator it = rChildren.begin(), itEnd = rChildren.end();
-    for (; it != itEnd; ++it)
+    for (auto const& it : rChildren)
     {
         const SvTreeListEntry& rChild = *it;
         OUString aPath = getXPath(rTree, rChild, rNamespaces);
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 6ef5342..128e172 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -3312,7 +3312,7 @@ void SvImpLBox::FindMostRight_Impl( SvTreeListEntry* pParent, SvTreeListEntry* p
     size_t nCount = rList.size();
     for( size_t nCur = 0; nCur < nCount; nCur++ )
     {
-        SvTreeListEntry* pChild = &rList[nCur];
+        SvTreeListEntry* pChild = rList[nCur].get();
         if( pChild != pEntryToIgnore )
         {
             SetMostRight( pChild );
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 0753495..27520b1 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -162,13 +162,12 @@ bool SvTreeList::IsChild(const SvTreeListEntry* pParent, const SvTreeListEntry*
     if ( !pParent )
         pParent = pRootItem;
 
-    if (pParent->maChildren.empty())
+    if (pParent->m_Children.empty())
         return false;
 
-    SvTreeListEntries::const_iterator it = pParent->maChildren.begin(), itEnd = pParent->maChildren.end();
-    for (; it != itEnd; ++it)
+    for (auto const& it : pParent->m_Children)
     {
-        const SvTreeListEntry* pThis = &(*it);
+        const SvTreeListEntry* pThis = it.get();
         if (pThis == pChild)
             return true;
         else
@@ -189,9 +188,9 @@ class FindByPointer : std::unary_function<SvTreeListEntry, bool>
 public:
     explicit FindByPointer(const SvTreeListEntry* p) : mpEntry(p) {}
 
-    bool operator() (const SvTreeListEntry& rEntry) const
+    bool operator() (std::unique_ptr<SvTreeListEntry> const& rpEntry) const
     {
-        return mpEntry == &rEntry;
+        return mpEntry == rpEntry.get();
     }
 };
 
@@ -223,8 +222,8 @@ sal_uLong SvTreeList::Move(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa
 
     bAbsPositionsValid = false;
 
-    SvTreeListEntries& rDst = pTargetParent->maChildren;
-    SvTreeListEntries& rSrc = pSrcEntry->pParent->maChildren;
+    SvTreeListEntries& rDst = pTargetParent->m_Children;
+    SvTreeListEntries& rSrc = pSrcEntry->pParent->m_Children;
 
     bool bSameParent = pTargetParent == pSrcEntry->pParent;
 
@@ -232,7 +231,7 @@ sal_uLong SvTreeList::Move(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa
     SvTreeListEntries::iterator itSrcPos = rSrc.begin(), itEnd = rSrc.end();
     for (; itSrcPos != itEnd; ++itSrcPos)
     {
-        const SvTreeListEntry* p = &(*itSrcPos);
+        const SvTreeListEntry* p = (*itSrcPos).get();
         if (p == pSrcEntry)
             // Found
             break;
@@ -258,7 +257,10 @@ sal_uLong SvTreeList::Move(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa
             --nListPos;
 
         // Release the original.
-        SvTreeListEntries::auto_type p = rSrc.release(itSrcPos);
+        std::unique_ptr<SvTreeListEntry> pOriginal(std::move(*itSrcPos));
+        assert(pOriginal.get());
+        rSrc.erase(itSrcPos);
+
         // Determine the insertion position.
         SvTreeListEntries::iterator itDstPos = rSrc.end();
         if (nListPos < rSrc.size())
@@ -266,7 +268,7 @@ sal_uLong SvTreeList::Move(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa
             itDstPos = rSrc.begin();
             std::advance(itDstPos, nListPos);
         }
-        rSrc.insert(itDstPos, p.release());
+        rSrc.insert(itDstPos, std::move(pOriginal));
     }
     else
     {
@@ -277,8 +279,10 @@ sal_uLong SvTreeList::Move(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa
             itDstPos = rDst.begin();
             std::advance(itDstPos, nListPos);
         }
-        SvTreeListEntries::auto_type p = rSrc.release(itSrcPos);
-        rDst.insert(itDstPos, p.release());
+        std::unique_ptr<SvTreeListEntry> pOriginal(std::move(*itSrcPos));
+        assert(pOriginal.get());
+        rSrc.erase(itSrcPos);
+        rDst.insert(itDstPos, std::move(pOriginal));
     }
 
     // move parent umsetzen (do this only now, because we need the parent for
@@ -309,7 +313,7 @@ sal_uLong SvTreeList::Copy(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa
     SvTreeListEntry* pClonedEntry = Clone( pSrcEntry, nCloneCount );
     nEntryCount += nCloneCount;
 
-    SvTreeListEntries& rDst = pTargetParent->maChildren;
+    SvTreeListEntries& rDst = pTargetParent->m_Children;
 
     pClonedEntry->pParent = pTargetParent;      // move parent
 
@@ -317,10 +321,10 @@ sal_uLong SvTreeList::Copy(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa
     {
         SvTreeListEntries::iterator itPos = rDst.begin(); // insertion position.
         std::advance(itPos, nListPos);
-        rDst.insert(itPos, pClonedEntry);
+        rDst.insert(itPos, std::unique_ptr<SvTreeListEntry>(pClonedEntry));
     }
     else
-        rDst.push_back(pClonedEntry);
+        rDst.push_back(std::unique_ptr<SvTreeListEntry>(pClonedEntry));
 
     SetListPositions(rDst); // correct list position in target list
 
@@ -364,16 +368,16 @@ void SvTreeList::InsertTree(SvTreeListEntry* pSrcEntry,
     bAbsPositionsValid = false;
 
     pSrcEntry->pParent = pTargetParent; // move parent
-    SvTreeListEntries& rDst = pTargetParent->maChildren;
+    SvTreeListEntries& rDst = pTargetParent->m_Children;
 
     if (nListPos < rDst.size())
     {
         SvTreeListEntries::iterator itPos = rDst.begin();
         std::advance(itPos, nListPos);
-        rDst.insert(itPos, pSrcEntry);
+        rDst.insert(itPos, std::unique_ptr<SvTreeListEntry>(pSrcEntry));
     }
     else
-        rDst.push_back(pSrcEntry);
+        rDst.push_back(std::unique_ptr<SvTreeListEntry>(pSrcEntry));
 
     SetListPositions(rDst); // correct list position in target list
     nEntryCount += GetChildCount( pSrcEntry );
@@ -400,29 +404,29 @@ SvTreeListEntry* SvTreeList::Clone( SvTreeListEntry* pEntry, sal_uLong& nCloneCo
 {
     SvTreeListEntry* pClonedEntry = CloneEntry( pEntry );
     nCloneCount = 1;
-    if (!pEntry->maChildren.empty())
+    if (!pEntry->m_Children.empty())
         // Clone the child entries.
-        CloneChildren(pClonedEntry->maChildren, nCloneCount, pEntry->maChildren, pClonedEntry);
+        CloneChildren(pClonedEntry->m_Children, nCloneCount, pEntry->m_Children, *pClonedEntry);
 
     return pClonedEntry;
 }
 
 void SvTreeList::CloneChildren(
-        SvTreeListEntries& rDst, sal_uLong& rCloneCount, SvTreeListEntries& rSrc, SvTreeListEntry* pNewParent) const
+        SvTreeListEntries& rDst, sal_uLong& rCloneCount, SvTreeListEntries& rSrc, SvTreeListEntry& rNewParent) const
 {
     SvTreeListEntries aClone;
     SvTreeListEntries::iterator it = rSrc.begin(), itEnd = rSrc.end();
     for (; it != itEnd; ++it)
     {
-        SvTreeListEntry& rEntry = *it;
-        SvTreeListEntry* pNewEntry = CloneEntry(&rEntry);
+        SvTreeListEntry& rEntry = **it;
+        std::unique_ptr<SvTreeListEntry> pNewEntry(CloneEntry(&rEntry));
         ++rCloneCount;
-        pNewEntry->pParent = pNewParent;
-        if (!rEntry.maChildren.empty())
+        pNewEntry->pParent = &rNewParent;
+        if (!rEntry.m_Children.empty())
             // Clone entries recursively.
-            CloneChildren(pNewEntry->maChildren, rCloneCount, rEntry.maChildren, pNewEntry);
+            CloneChildren(pNewEntry->m_Children, rCloneCount, rEntry.m_Children, *pNewEntry);
 
-        aClone.push_back(pNewEntry);
+        aClone.push_back(std::move(pNewEntry));
     }
 
     rDst.swap(aClone);
@@ -433,7 +437,7 @@ sal_uLong SvTreeList::GetChildCount( const SvTreeListEntry* pParent ) const
     if ( !pParent )
         return GetEntryCount();
 
-    if (!pParent || pParent->maChildren.empty())
+    if (!pParent || pParent->m_Children.empty())
         return 0;
 
     sal_uLong nCount = 0;
@@ -454,7 +458,7 @@ sal_uLong SvTreeList::GetVisibleChildCount(const SvListView* pView, SvTreeListEn
     if ( !pParent )
         pParent = pRootItem;
 
-    if (!pParent || !pView->IsExpanded(pParent) || pParent->maChildren.empty())
+    if (!pParent || !pView->IsExpanded(pParent) || pParent->m_Children.empty())
         return 0;
 
     sal_uLong nCount = 0;
@@ -475,7 +479,7 @@ sal_uLong SvTreeList::GetChildSelectionCount(const SvListView* pView,SvTreeListE
     if ( !pParent )
         pParent = pRootItem;
 
-    if (!pParent || pParent->maChildren.empty())
+    if (!pParent || pParent->m_Children.empty())
         return 0;
 
     sal_uLong nCount = 0;
@@ -494,7 +498,7 @@ sal_uLong SvTreeList::GetChildSelectionCount(const SvListView* pView,SvTreeListE
 SvTreeListEntry* SvTreeList::First() const
 {
     if ( nEntryCount )
-        return &pRootItem->maChildren[0];
+        return pRootItem->m_Children[0].get();
     else
         return 0;
 }
@@ -514,14 +518,14 @@ SvTreeListEntry* SvTreeList::Next( SvTreeListEntry* pActEntry, sal_uInt16* pDept
     }
 
     // Get the list where the current entry belongs to (from its parent).
-    SvTreeListEntries* pActualList = &pActEntry->pParent->maChildren;
+    SvTreeListEntries* pActualList = &pActEntry->pParent->m_Children;
     sal_uLong nActualPos = pActEntry->GetChildListPos();
 
-    if (!pActEntry->maChildren.empty())
+    if (!pActEntry->m_Children.empty())
     {
         // The current entry has children. Get its first child entry.
         nDepth++;
-        pActEntry = &pActEntry->maChildren[0];
+        pActEntry = pActEntry->m_Children[0].get();
         if ( bWithDepth )
             *pDepth = nDepth;
         return pActEntry;
@@ -530,7 +534,7 @@ SvTreeListEntry* SvTreeList::Next( SvTreeListEntry* pActEntry, sal_uInt16* pDept
     if (pActualList->size() > (nActualPos+1))
     {
         // Get the next sibling of the current entry.
-        pActEntry = &(*pActualList)[nActualPos+1];
+        pActEntry = (*pActualList)[nActualPos+1].get();
         if ( bWithDepth )
             *pDepth = nDepth;
         return pActEntry;
@@ -542,11 +546,11 @@ SvTreeListEntry* SvTreeList::Next( SvTreeListEntry* pActEntry, sal_uInt16* pDept
     while( pParent != pRootItem && pParent != 0 )
     {
         DBG_ASSERT(pParent!=0,"TreeData corrupt!");
-        pActualList = &pParent->pParent->maChildren;
+        pActualList = &pParent->pParent->m_Children;
         nActualPos = pParent->GetChildListPos();
         if (pActualList->size() > (nActualPos+1))
         {
-            pActEntry = &(*pActualList)[nActualPos+1];
+            pActEntry = (*pActualList)[nActualPos+1].get();
             if ( bWithDepth )
                 *pDepth = nDepth;
             return pActEntry;
@@ -569,17 +573,17 @@ SvTreeListEntry* SvTreeList::Prev( SvTreeListEntry* pActEntry, sal_uInt16* pDept
         bWithDepth = true;
     }
 
-    SvTreeListEntries* pActualList = &pActEntry->pParent->maChildren;
+    SvTreeListEntries* pActualList = &pActEntry->pParent->m_Children;
     sal_uLong nActualPos = pActEntry->GetChildListPos();
 
     if ( nActualPos > 0 )
     {
-        pActEntry = &(*pActualList)[nActualPos-1];
-        while (!pActEntry->maChildren.empty())
+        pActEntry = (*pActualList)[nActualPos-1].get();
+        while (!pActEntry->m_Children.empty())
         {
-            pActualList = &pActEntry->maChildren;
+            pActualList = &pActEntry->m_Children;
             nDepth++;
-            pActEntry = &pActualList->back();
+            pActEntry = pActualList->back().get();
         }
         if ( bWithDepth )
             *pDepth = nDepth;
@@ -602,12 +606,12 @@ SvTreeListEntry* SvTreeList::Prev( SvTreeListEntry* pActEntry, sal_uInt16* pDept
 
 SvTreeListEntry* SvTreeList::Last() const
 {
-    SvTreeListEntries* pActList = &pRootItem->maChildren;
+    SvTreeListEntries* pActList = &pRootItem->m_Children;
     SvTreeListEntry* pEntry = NULL;
     while (!pActList->empty())
     {
-        pEntry = &pActList->back();
-        pActList = &pEntry->maChildren;
+        pEntry = pActList->back().get();
+        pActList = &pEntry->m_Children;
     }
     return pEntry;
 }
@@ -671,15 +675,15 @@ SvTreeListEntry* SvTreeList::NextVisible(const SvListView* pView,SvTreeListEntry
         bWithDepth = true;
     }
 
-    SvTreeListEntries* pActualList = &pActEntry->pParent->maChildren;
+    SvTreeListEntries* pActualList = &pActEntry->pParent->m_Children;
     sal_uLong nActualPos = pActEntry->GetChildListPos();
 
     if ( pView->IsExpanded(pActEntry) )
     {
-        OSL_ENSURE(!pActEntry->maChildren.empty(), "Pass entry is supposed to have child entries.");
+        OSL_ENSURE(!pActEntry->m_Children.empty(), "Pass entry is supposed to have child entries.");
 
         nDepth++;
-        pActEntry = &pActEntry->maChildren[0];
+        pActEntry = pActEntry->m_Children[0].get();
         if ( bWithDepth )
             *pActDepth = nDepth;
         return pActEntry;
@@ -688,7 +692,7 @@ SvTreeListEntry* SvTreeList::NextVisible(const SvListView* pView,SvTreeListEntry
     nActualPos++;
     if ( pActualList->size() > nActualPos  )
     {
-        pActEntry = &(*pActualList)[nActualPos];
+        pActEntry = (*pActualList)[nActualPos].get();
         if ( bWithDepth )
             *pActDepth = nDepth;
         return pActEntry;
@@ -698,12 +702,12 @@ SvTreeListEntry* SvTreeList::NextVisible(const SvListView* pView,SvTreeListEntry
     nDepth--;
     while( pParent != pRootItem )
     {
-        pActualList = &pParent->pParent->maChildren;
+        pActualList = &pParent->pParent->m_Children;
         nActualPos = pParent->GetChildListPos();
         nActualPos++;
         if ( pActualList->size() > nActualPos )
         {
-            pActEntry = &(*pActualList)[nActualPos];
+            pActEntry = (*pActualList)[nActualPos].get();
             if ( bWithDepth )
                 *pActDepth = nDepth;
             return pActEntry;
@@ -730,17 +734,17 @@ SvTreeListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvTreeListEntr
         bWithDepth = true;
     }
 
-    SvTreeListEntries* pActualList = &pActEntry->pParent->maChildren;
+    SvTreeListEntries* pActualList = &pActEntry->pParent->m_Children;
     sal_uLong nActualPos = pActEntry->GetChildListPos();
 
     if ( nActualPos > 0 )
     {
-        pActEntry = &(*pActualList)[nActualPos-1];
+        pActEntry = (*pActualList)[nActualPos-1].get();
         while( pView->IsExpanded(pActEntry) )
         {
-            pActualList = &pActEntry->maChildren;
+            pActualList = &pActEntry->m_Children;
             nDepth++;
-            pActEntry = &pActualList->back();
+            pActEntry = pActualList->back().get();
         }
         if ( bWithDepth )
             *pActDepth = nDepth;
@@ -832,8 +836,8 @@ SvTreeListEntry* SvTreeList::FirstChild( SvTreeListEntry* pParent ) const
     if ( !pParent )
         pParent = pRootItem;
     SvTreeListEntry* pResult;
-    if (!pParent->maChildren.empty())
-        pResult = &pParent->maChildren[0];
+    if (!pParent->m_Children.empty())
+        pResult = pParent->m_Children[0].get();
     else
         pResult = 0;
     return pResult;
@@ -845,10 +849,10 @@ SvTreeListEntry* SvTreeList::NextSibling( SvTreeListEntry* pEntry )
     if( !pEntry )
         return 0;
 
-    SvTreeListEntries& rList = pEntry->pParent->maChildren;
+    SvTreeListEntries& rList = pEntry->pParent->m_Children;
     sal_uLong nPos = pEntry->GetChildListPos();
     nPos++;
-    return nPos < rList.size() ? &rList[nPos] : NULL;
+    return (nPos < rList.size()) ? rList[nPos].get() : nullptr;
 }
 
 SvTreeListEntry* SvTreeList::PrevSibling( SvTreeListEntry* pEntry )
@@ -857,12 +861,12 @@ SvTreeListEntry* SvTreeList::PrevSibling( SvTreeListEntry* pEntry )
     if( !pEntry )
         return 0;
 
-    SvTreeListEntries& rList = pEntry->pParent->maChildren;
+    SvTreeListEntries& rList = pEntry->pParent->m_Children;
     sal_uLong nPos = pEntry->GetChildListPos();
     if ( nPos == 0 )
         return 0;
     nPos--;
-    pEntry = &rList[nPos];
+    pEntry = rList[nPos].get();
     return pEntry;
 }
 
@@ -873,8 +877,8 @@ SvTreeListEntry* SvTreeList::LastSibling( SvTreeListEntry* pEntry )
     if( !pEntry )
         return 0;
 
-    SvTreeListEntries& rChildren = pEntry->pParent->maChildren;
-    return rChildren.empty() ? NULL : &rChildren.back();
+    SvTreeListEntries& rChildren = pEntry->pParent->m_Children;
+    return (rChildren.empty()) ? nullptr : rChildren.back().get();
 }
 
 SvTreeListEntry* SvTreeList::NextSelected( const SvListView* pView, SvTreeListEntry* pEntry ) const
@@ -913,7 +917,7 @@ sal_uLong SvTreeList::Insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,s
         pParent = pRootItem;
 
 
-    SvTreeListEntries& rList = pParent->maChildren;
+    SvTreeListEntries& rList = pParent->m_Children;
 
     // take sorting into account
     GetInsertionPos( pEntry, pParent, nPos );
@@ -925,10 +929,10 @@ sal_uLong SvTreeList::Insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,s
     {
         SvTreeListEntries::iterator itPos = rList.begin();
         std::advance(itPos, nPos);
-        rList.insert(itPos, pEntry);
+        rList.insert(itPos, std::unique_ptr<SvTreeListEntry>(pEntry));
     }
     else
-        rList.push_back(pEntry);
+        rList.push_back(std::unique_ptr<SvTreeListEntry>(pEntry));
 
     nEntryCount++;
     if (nPos != TREELIST_APPEND && (nPos != (rList.size()-1)))
@@ -971,7 +975,7 @@ void SvTreeList::Expand( SvListView* pView, SvTreeListEntry* pEntry )
     if ( pView->IsExpanded(pEntry) )
         return;
 
-    DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Expand: We expected to have child entries.");
+    DBG_ASSERT(!pEntry->m_Children.empty(), "SvTreeList::Expand: We expected to have child entries.");
 
     SvViewDataEntry* pViewData = pView->GetViewData(pEntry);
     pViewData->SetExpanded(true);
@@ -990,7 +994,7 @@ void SvTreeList::Collapse( SvListView* pView, SvTreeListEntry* pEntry )
     if ( !pView->IsExpanded(pEntry) )
         return;
 
-    DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Collapse: We expected have child entries.");
+    DBG_ASSERT(!pEntry->m_Children.empty(), "SvTreeList::Collapse: We expected to have child entries.");
 
     SvViewDataEntry* pViewData = pView->GetViewData( pEntry );
     pViewData->SetExpanded(false);
@@ -1048,27 +1052,32 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
     bAbsPositionsValid = false;
 
     SvTreeListEntry* pParent = pEntry->pParent;
-    SvTreeListEntries& rList = pParent->maChildren;
+    SvTreeListEntries& rList = pParent->m_Children;
     bool bLastEntry = false;
 
     // Since we need the live instance of SvTreeListEntry for broadcasting,
     // we first need to pop it from the container, broadcast it, then delete
     // the instance manually at the end.
 
+    std::unique_ptr<SvTreeListEntry> pEntryDeleter;
     if ( pEntry->HasChildListPos() )
     {
         size_t nListPos = pEntry->GetChildListPos();
         bLastEntry = (nListPos == (rList.size()-1));
         SvTreeListEntries::iterator it = rList.begin();
         std::advance(it, nListPos);
-        rList.release(it).release();
+        pEntryDeleter = std::unique_ptr<SvTreeListEntry>(std::move(*it));
+        rList.erase(it);
     }
     else
     {
         SvTreeListEntries::iterator it =
             std::find_if(rList.begin(), rList.end(), FindByPointer(pEntry));
         if (it != rList.end())
-            rList.release(it).release();
+        {
+            pEntryDeleter = std::unique_ptr<SvTreeListEntry>(std::move(*it));
+            rList.erase(it);
+        }
     }
 
     if (!rList.empty() && !bLastEntry)
@@ -1076,7 +1085,6 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
 
     nEntryCount -= nRemoved;
     Broadcast(SvListAction::REMOVED, const_cast<SvTreeListEntry*>(pEntry));
-    delete pEntry;
 
     return true;
 }
@@ -1126,7 +1134,7 @@ void SvTreeList::SetListPositions( SvTreeListEntries& rEntries )
     if (rEntries.empty())
         return;
 
-    SvTreeListEntry& rFirst = rEntries.front();
+    SvTreeListEntry& rFirst = *rEntries.front();
     if (rFirst.pParent)
         rFirst.pParent->InvalidateChildrensListPositions();
 }
@@ -1170,12 +1178,12 @@ std::pair<SvTreeListEntries::iterator, SvTreeListEntries::iterator>
     if (!pParent)
         pParent = pRootItem;
 
-    if (pParent->maChildren.empty())
+    if (pParent->m_Children.empty())
         // This entry has no children.
         return aRet;
 
-    aRet.first = pParent->maChildren.begin();
-    aRet.second = pParent->maChildren.end();
+    aRet.first = pParent->m_Children.begin();
+    aRet.second = pParent->m_Children.end();
 
     return aRet;
 }
@@ -1315,7 +1323,7 @@ void SvListView::Impl::ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry*,sa
 {
     SvTreeListEntry* pParent = pEntry->pParent;
     DBG_ASSERT(pParent,"Model not consistent");
-    if (pParent != m_rThis.pModel->pRootItem && pParent->maChildren.size() == 1)
+    if (pParent != m_rThis.pModel->pRootItem && pParent->m_Children.size() == 1)
     {
         SvViewDataEntry* pViewData = m_DataTable.find( pParent )->second;
         pViewData->SetExpanded(false);
@@ -1373,8 +1381,7 @@ void SvListView::Impl::ActionInsertedTree( SvTreeListEntry* pEntry )
 
 void SvListView::Impl::RemoveViewData( SvTreeListEntry* pParent )
 {
-    SvTreeListEntries::iterator it = pParent->maChildren.begin(), itEnd = pParent->maChildren.end();
-    for (; it != itEnd; ++it)
+    for (auto const& it : pParent->m_Children)
     {
         SvTreeListEntry& rEntry = *it;
         m_DataTable.erase(&rEntry);
@@ -1413,7 +1420,7 @@ void SvListView::Impl::ActionRemoving( SvTreeListEntry* pEntry )
     RemoveViewData( pEntry );
 
     SvTreeListEntry* pCurEntry = pEntry->pParent;
-    if (pCurEntry && pCurEntry != m_rThis.pModel->pRootItem && pCurEntry->maChildren.size() == 1)
+    if (pCurEntry && pCurEntry != m_rThis.pModel->pRootItem && pCurEntry->m_Children.size() == 1)
     {
         pViewData = m_DataTable.find(pCurEntry)->second;
         pViewData->SetExpanded(false);
@@ -1554,9 +1561,10 @@ public:
 
     explicit SortComparator( SvTreeList& rList ) : mrList(rList) {}
 
-    bool operator() ( const SvTreeListEntry& rLeft, const SvTreeListEntry& rRight ) const
+    bool operator() (std::unique_ptr<SvTreeListEntry> const& rpLeft,
+                     std::unique_ptr<SvTreeListEntry> const& rpRight) const
     {
-        return mrList.Compare(&rLeft, &rRight) < 0;
+        return mrList.Compare(rpLeft.get(), rpRight.get()) < 0;
     }
 };
 
@@ -1566,21 +1574,20 @@ void SvTreeList::ResortChildren( SvTreeListEntry* pParent )
 {
     DBG_ASSERT(pParent,"Parent not set");
 
-    if (pParent->maChildren.empty())
+    if (pParent->m_Children.empty())
         return;
 
     SortComparator aComp(*this);
-    pParent->maChildren.sort(aComp);
+    std::sort(pParent->m_Children.begin(), pParent->m_Children.end(), aComp);
 
     // Recursively sort child entries.
-    SvTreeListEntries::iterator it = pParent->maChildren.begin(), itEnd = pParent->maChildren.end();
-    for (; it != itEnd; ++it)
+    for (auto const& it : pParent->m_Children)
     {
         SvTreeListEntry& r = *it;
         ResortChildren(&r);
     }
 
-    SetListPositions(pParent->maChildren); // correct list position in target list
+    SetListPositions(pParent->m_Children); // correct list position in target list
 }
 
 void SvTreeList::Reverse()
@@ -1595,19 +1602,18 @@ void SvTreeList::ReverseChildren( SvTreeListEntry* pParent )
 {
     DBG_ASSERT(pParent,"Parent not set");
 
-    if (pParent->maChildren.empty())
+    if (pParent->m_Children.empty())
         return;
 
-    std::reverse(pParent->maChildren.base().begin(), pParent->maChildren.base().end());
+    std::reverse(pParent->m_Children.begin(), pParent->m_Children.end());
     // Recursively sort child entries.
-    SvTreeListEntries::iterator it = pParent->maChildren.begin(), itEnd = pParent->maChildren.end();
-    for (; it != itEnd; ++it)
+    for (auto const& it : pParent->m_Children)
     {
         SvTreeListEntry& r = *it;
         ReverseChildren(&r);
     }
 
-    SetListPositions(pParent->maChildren); // correct list position in target list
+    SetListPositions(pParent->m_Children); // correct list position in target list
 }
 
 void SvTreeList::GetInsertionPos( SvTreeListEntry* pEntry, SvTreeListEntry* pParent,
@@ -1631,7 +1637,7 @@ void SvTreeList::GetInsertionPos( SvTreeListEntry* pEntry, SvTreeListEntry* pPar
         do
         {
             k = (i+j)/2;
-            const SvTreeListEntry* pTempEntry = &rChildList[k];
+            const SvTreeListEntry* pTempEntry = rChildList[k].get();
             nCompare = Compare( pEntry, pTempEntry );
             if( eSortMode == SortDescending && nCompare != 0 )
             {
@@ -1663,7 +1669,7 @@ bool SvTreeList::HasChildren( const SvTreeListEntry* pEntry ) const
     if ( !pEntry )
         pEntry = pRootItem;
 
-    return !pEntry->maChildren.empty();
+    return !pEntry->m_Children.empty();
 }
 
 bool SvTreeList::HasParent( const SvTreeListEntry* pEntry ) const
@@ -1675,16 +1681,16 @@ SvTreeListEntry* SvTreeList::GetEntry( SvTreeListEntry* pParent, sal_uLong nPos
 {   if ( !pParent )
         pParent = pRootItem;
     SvTreeListEntry* pRet = 0;
-    if (nPos < pParent->maChildren.size())
-        pRet = &pParent->maChildren[nPos];
+    if (nPos < pParent->m_Children.size())
+        pRet = pParent->m_Children[nPos].get();
     return pRet;
 }
 
 SvTreeListEntry* SvTreeList::GetEntry( sal_uLong nRootPos ) const
 {
     SvTreeListEntry* pRet = 0;
-    if ( nEntryCount && nRootPos < pRootItem->maChildren.size())
-        pRet = &pRootItem->maChildren[nRootPos];
+    if (nEntryCount && nRootPos < pRootItem->m_Children.size())
+        pRet = pRootItem->m_Children[nRootPos].get();
     return pRet;
 }
 
@@ -1692,14 +1698,14 @@ const SvTreeListEntries& SvTreeList::GetChildList( SvTreeListEntry* pParent ) co
 {
     if ( !pParent )
         pParent = pRootItem;
-    return pParent->maChildren;
+    return pParent->m_Children;
 }
 
 SvTreeListEntries& SvTreeList::GetChildList( SvTreeListEntry* pParent )
 {
     if ( !pParent )
         pParent = pRootItem;
-    return pParent->maChildren;
+    return pParent->m_Children;
 }
 
 const SvTreeListEntry* SvTreeList::GetParent( const SvTreeListEntry* pEntry ) const
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 24e043a..c7207d4 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -905,9 +905,9 @@ sal_uLong SvTreeListBox::GetLevelChildCount( SvTreeListEntry* _pParent ) const
         return 0;
 
     if( !_pParent )//root and children of root
-        return pEntry->pParent->maChildren.size();
+        return pEntry->pParent->m_Children.size();
 
-    return _pParent->maChildren.size();
+    return _pParent->m_Children.size();
 }
 
 SvViewDataEntry* SvTreeListBox::GetViewDataEntry( SvTreeListEntry* pEntry ) const
diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx
index 29f5976..54d8893 100644
--- a/svtools/source/contnr/treelistentry.cxx
+++ b/svtools/source/contnr/treelistentry.cxx
@@ -27,16 +27,15 @@
 
 void SvTreeListEntry::ClearChildren()
 {
-    maChildren.clear();
+    m_Children.clear();
 }
 
 void SvTreeListEntry::SetListPositions()
 {
-    SvTreeListEntries::iterator it = maChildren.begin(), itEnd = maChildren.end();
     sal_uLong nCur = 0;
-    for (; it != itEnd; ++it)
+    for (auto const& pEntry : m_Children)
     {
-        SvTreeListEntry& rEntry = *it;
+        SvTreeListEntry& rEntry = *pEntry;
         rEntry.nListPos &= 0x80000000;
         rEntry.nListPos |= nCur;
         ++nCur;
@@ -70,9 +69,8 @@ SvTreeListEntry::SvTreeListEntry(const SvTreeListEntry& r)
     , nEntryFlags(r.nEntryFlags)
     , maBackColor(Application::GetSettings().GetStyleSettings().GetWindowColor())
 {
-    SvTreeListEntries::const_iterator it = r.maChildren.begin(), itEnd = r.maChildren.end();
-    for (; it != itEnd; ++it)
-        maChildren.push_back(new SvTreeListEntry(*it));
+    for (auto const& it : r.m_Children)
+        m_Children.push_back(std::unique_ptr<SvTreeListEntry>(new SvTreeListEntry(*it)));
 }
 
 SvTreeListEntry::~SvTreeListEntry()
@@ -81,13 +79,13 @@ SvTreeListEntry::~SvTreeListEntry()
     pParent     = 0;
 #endif
 
-    maChildren.clear();
+    m_Children.clear();
     m_Items.clear();
 }
 
 bool SvTreeListEntry::HasChildren() const
 {
-    return !maChildren.empty();
+    return !m_Children.empty();
 }
 
 bool SvTreeListEntry::HasChildListPos() const
commit 1fc105cec523a081f18ca78fff43e58e3a881232
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 20 17:33:40 2015 +0200

    svtools: change these SvTreeListEntry functions to unique_ptr
    
    ... parameters to make it clear that they take ownership.
    
    Change-Id: I572c5fa6268438a86d0a4fa1d2aef15382cb5607

diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 25bee8a..af0e8d3 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -253,8 +253,9 @@ void CheckBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rTxt,
         for ( sal_uInt16 nCol = 1; nCol < nCount; ++nCol )
         {
             SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nCol ));
-            LibLBoxString* pStr = new LibLBoxString( pEntry, 0, rCol.GetText() );
-            pEntry->ReplaceItem( pStr, nCol );
+            std::unique_ptr<LibLBoxString> pStr(
+                   new LibLBoxString( pEntry, 0, rCol.GetText()));
+            pEntry->ReplaceItem(std::move(pStr), nCol);
         }
     }
 }
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 6db36dc..aed9133 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -911,11 +911,13 @@ void SfxAcceleratorConfigPage::CreateCustomItems(SvTreeListEntry* pEntry,
                                                  const OUString& sCol1 ,
                                                  const OUString& sCol2)
 {
-    SfxAccCfgLBoxString_Impl* pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1);
-    pEntry->ReplaceItem(pStringItem, 1);
+    std::unique_ptr<SfxAccCfgLBoxString_Impl> pStringItem1(
+            new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1));
+    pEntry->ReplaceItem(std::move(pStringItem1), 1);
 
-    pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2);
-    pEntry->ReplaceItem(pStringItem, 2);
+    std::unique_ptr<SfxAccCfgLBoxString_Impl> pStringItem2(
+            new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2));
+    pEntry->ReplaceItem(std::move(pStringItem2), 2);
 }
 
 
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 8e9f094..6ad0193 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2105,7 +2105,7 @@ SvTreeListEntry* SvxConfigPage::InsertEntryIntoUI(
         {
             // add new popup painter, it gets destructed by the entry
             pNewEntry->ReplaceItem(
-                new PopupPainter( pNewEntry, aName ),
+                std::unique_ptr<PopupPainter>(new PopupPainter(pNewEntry, aName)),
                 pNewEntry->ItemCount() - 1 );
         }
     }
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 0e14b0f..812f5fd 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -554,8 +554,9 @@ void _SvxMacroTabPage::DisplayAppEvents( bool appEvents)
         OUString* pEventName = new OUString( sEventName );
         _pE->SetUserData( static_cast<void*>(pEventName) );
         OUString sNew( eventURL );
-        _pE->ReplaceItem( new IconLBoxString( _pE, 0, sNew,
-            &mpImpl->aMacroImg, &mpImpl->aComponentImg ), LB_MACROS_ITEMPOS );
+        _pE->ReplaceItem(std::unique_ptr<IconLBoxString>(new IconLBoxString(
+                _pE, 0, sNew, &mpImpl->aMacroImg, &mpImpl->aComponentImg)),
+            LB_MACROS_ITEMPOS );
         rListBox.GetModel()->InvalidateEntry( _pE );
         rListBox.Select( _pE );
         rListBox.MakeVisible( _pE );
@@ -701,8 +702,9 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton*
 
     // update the listbox entry
     pImpl->pEventLB->SetUpdateMode( false );
-    pE->ReplaceItem( new IconLBoxString( pE, 0, sEventURL,
-            &pImpl->aMacroImg, &pImpl->aComponentImg ), LB_MACROS_ITEMPOS );
+    pE->ReplaceItem(std::unique_ptr<IconLBoxString>(new IconLBoxString(
+                pE, 0, sEventURL, &pImpl->aMacroImg, &pImpl->aComponentImg)),
+        LB_MACROS_ITEMPOS );
 
     rListBox.GetModel()->InvalidateEntry( pE );
     rListBox.Select( pE );
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index c346935..21c9323 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -230,10 +230,13 @@ SvTreeListEntry * ThesaurusAlternativesCtrl::AddEntry( sal_Int32 nVal, const OUS
     {
         aText = OUString::number( nVal ) + ". ";
     }
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, OUString() ) ); // add empty column
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+        new SvLBoxString(pEntry, 0, OUString()))); // add empty column
     aText += rText;
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false ) );  // otherwise crash
-    pEntry->AddItem( new AlternativesString( *this, pEntry, 0, aText ) );
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+        new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false))); // otherwise crash
+    pEntry->AddItem(std::unique_ptr<AlternativesString>(
+        new AlternativesString( *this, pEntry, 0, aText)));
 
     SetExtraData( pEntry, AlternativesExtraData( rText, bIsHeader ) );
     GetModel()->Insert( pEntry );
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index f3888b6..7874a06 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -121,17 +121,18 @@ SvTreeListEntry* SvxFontSubstTabPage::CreateEntry(OUString& rFont1, OUString& rF
     if( !pCheckButtonData )
         pCheckButtonData = new SvLBoxButtonData( m_pCheckLB );
 
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));    // Sonst Puff!
-
-    pEntry->AddItem( new SvLBoxButton( pEntry,
-                                           SvLBoxButtonKind_enabledCheckbox, 0,
-                                           pCheckButtonData ) );
-    pEntry->AddItem( new SvLBoxButton( pEntry,
-                                           SvLBoxButtonKind_enabledCheckbox, 0,
-                                           pCheckButtonData ) );
-
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont1 ) );
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont2 ) );
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+            pEntry, 0, Image(), Image(), false))); // otherwise boom!
+
+    pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry,
+           SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry,
+           SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
+
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+                    pEntry, 0, rFont1)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+                    pEntry, 0, rFont2)));
 
     return pEntry;
 }
diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx
index 09c8e7e..11eacd7 100644
--- a/cui/source/options/optHeaderTabListbox.cxx
+++ b/cui/source/options/optHeaderTabListbox.cxx
@@ -71,8 +71,9 @@ void OptHeaderTabListBox::InitEntry( SvTreeListEntry* pEntry, const OUString& rT
     {
         // initialize all columns with own class (column 0 == Bitmap)
         SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nCol ));
-        OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, rCol.GetText() );
-        pEntry->ReplaceItem( pStr, nCol );
+        std::unique_ptr<OptLBoxString_Impl> pStr(
+                new OptLBoxString_Impl(pEntry, 0, rCol.GetText()));
+        pEntry->ReplaceItem(std::move(pStr), nCol);
     }
 }
 
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 2d74ce2..a87d809 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -202,11 +202,12 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUS
                                         bool bInsertToPrefBox)
 {
     SvTreeListEntry* pEntry = new SvTreeListEntry;
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false)); //It is needed, otherwise causes crash
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, rProp));
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, rStatus));
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, rType));
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, rValue));
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+        new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false))); //It is needed, otherwise causes crash
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, rProp)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, rStatus)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, rType)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, rValue)));
     pEntry->SetUserData( new UserData(rPropertyPath) );
 
     if(bInsertToPrefBox)
@@ -284,13 +285,18 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
             {
                 // not leaf node
                 SvTreeListEntry* pEntry = new SvTreeListEntry;
-                pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(),
-                                                       SvTreeListBox::GetDefaultCollapsedNodeImage(), false));
-                pEntry->AddItem( new SvLBoxString( pEntry, 0, seqItems[i]));
+                pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+                    new SvLBoxContextBmp(pEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(),
+                       SvTreeListBox::GetDefaultCollapsedNodeImage(), false)));
+                pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                    new SvLBoxString( pEntry, 0, seqItems[i])));
                 //It is needed, without this the selection line will be truncated.
-                pEntry->AddItem( new SvLBoxString( pEntry, 0, ""));
-                pEntry->AddItem( new SvLBoxString( pEntry, 0, ""));
-                pEntry->AddItem( new SvLBoxString( pEntry, 0, ""));
+                pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                    new SvLBoxString( pEntry, 0, "")));
+                pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                    new SvLBoxString( pEntry, 0, "")));
+                pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                    new SvLBoxString( pEntry, 0, "")));
 
                 pEntry->SetUserData( new UserData(xNextNameAccess, lineage + 1) );
                 pEntry->EnableChildrenOnDemand();
@@ -774,7 +780,8 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
                 );
                 if (it != m_prefBoxEntries.end())
                 {
-                    it->ReplaceItem( new SvLBoxString( &(*it), 0, sDialogValue ), 4 );
+                    it->ReplaceItem(std::unique_ptr<SvLBoxString>(
+                        new SvLBoxString( &(*it), 0, sDialogValue)), 4);
 
                     SvTreeListEntries::iterator modifiedIt = std::find_if(
                                 m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
@@ -786,7 +793,9 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
                     );
 
                     if( modifiedIt != m_modifiedPrefBoxEntries.end())
-                        modifiedIt->ReplaceItem( new SvLBoxString( &(*modifiedIt), 0, sDialogValue ), 4 );
+                        modifiedIt->ReplaceItem(std::unique_ptr<SvLBoxString>(
+                            new SvLBoxString(&(*modifiedIt), 0, sDialogValue)),
+                            4);
                     else
                     {
                         SvTreeListEntry *pCloneEntry = new SvTreeListEntry;
@@ -883,13 +892,18 @@ void CuiAboutConfigTabPage::InsertEntry( SvTreeListEntry *pEntry)
         if(!hasEntry)
         {
             pParentEntry = new SvTreeListEntry;
-            pParentEntry->AddItem( new SvLBoxContextBmp( pParentEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(),
-                                                   SvTreeListBox::GetDefaultCollapsedNodeImage(), false));
-            pParentEntry->AddItem( new SvLBoxString( pParentEntry, 0, sParentName));
+            pParentEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+                new SvLBoxContextBmp(pParentEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(),
+                   SvTreeListBox::GetDefaultCollapsedNodeImage(), false)));
+            pParentEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                new SvLBoxString(pParentEntry, 0, sParentName)));
             //It is needed, without this the selection line will be truncated.
-            pParentEntry->AddItem( new SvLBoxString( pParentEntry, 0, ""));
-            pParentEntry->AddItem( new SvLBoxString( pParentEntry, 0, ""));
-            pParentEntry->AddItem( new SvLBoxString( pParentEntry, 0, ""));
+            pParentEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                new SvLBoxString(pParentEntry, 0, "")));
+            pParentEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                new SvLBoxString(pParentEntry, 0, "")));
+            pParentEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                new SvLBoxString( pParentEntry, 0, "")));
             pParentEntry->EnableChildrenOnDemand(false);
             m_pPrefBox->Insert( pParentEntry, pGrandParentEntry );
         }
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index 6ee34bf..5ede579 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -339,14 +339,17 @@ void OfaMSFilterTabPage2::InsertEntry( const OUString& _rTxt, sal_IntPtr _nType,
     if( !pCheckButtonData )
         pCheckButtonData = new SvLBoxButtonData( m_pCheckLB );
 
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
-    pEntry->AddItem( new SvLBoxButton( pEntry, loadEnabled? SvLBoxButtonKind_enabledCheckbox :
-                                                            SvLBoxButtonKind_disabledCheckbox,
-                                       0, pCheckButtonData ) );
-    pEntry->AddItem( new SvLBoxButton( pEntry, saveEnabled? SvLBoxButtonKind_enabledCheckbox :
-                                                            SvLBoxButtonKind_disabledCheckbox,
-                                       0, pCheckButtonData ) );
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, _rTxt ) );
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+        new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxButton>(
+        new SvLBoxButton(pEntry, loadEnabled ? SvLBoxButtonKind_enabledCheckbox
+                                             : SvLBoxButtonKind_disabledCheckbox,
+               0, pCheckButtonData)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxButton>(
+        new SvLBoxButton(pEntry, saveEnabled ? SvLBoxButtonKind_enabledCheckbox
+                                             : SvLBoxButtonKind_disabledCheckbox,
+               0, pCheckButtonData)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, _rTxt)));
 
     pEntry->SetUserData( reinterpret_cast<void*>(_nType) );
     m_pCheckLB->Insert( pEntry );
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index ab5bea68..1de1d71 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1813,11 +1813,15 @@ SvTreeListEntry* SvxLinguTabPage::CreateEntry( OUString& rTxt, sal_uInt16 nCol )
 
     OUString sEmpty;
     if (CBCOL_FIRST == nCol)
-        pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(
+            pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
     if (CBCOL_SECOND == nCol)
-        pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );    // empty column
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
-    pEntry->AddItem( new BrwString_Impl( pEntry, 0, rTxt ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+            pEntry, 0, sEmpty)));    // empty column
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+            pEntry, 0, Image(), Image(), false)));
+    pEntry->AddItem(std::unique_ptr<BrwString_Impl>(new BrwString_Impl(
+            pEntry, 0, rTxt)));
 
     return pEntry;
 }
@@ -1944,11 +1948,11 @@ SvTreeListEntry* SvxEditModulesDlg::CreateEntry( OUString& rTxt, sal_uInt16 nCol
 
     OUString sEmpty;
     if (CBCOL_FIRST == nCol)
-        pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
     if (CBCOL_SECOND == nCol)
-        pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );    // empty column
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
-    pEntry->AddItem( new BrwStringDic_Impl( pEntry, 0, rTxt ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));    // empty column
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false)));
+    pEntry->AddItem(std::unique_ptr<BrwStringDic_Impl>(new BrwStringDic_Impl(pEntry, 0, rTxt)));
 
     return pEntry;
 }
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index ca6f668..600f5a4 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -474,19 +474,20 @@ SvTreeListEntry* OfaSwAutoFmtOptionsPage::CreateEntry(OUString& rTxt, sal_uInt16
         m_pCheckLB->SetCheckButtonData( pCheckButtonData );
     }
 
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+                    pEntry, 0, Image(), Image(), false)));
 
     OUString sEmpty;
     if (nCol == CBCOL_SECOND)
-        pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));
     else
-        pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
 
     if (nCol == CBCOL_FIRST)
-        pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));
     else
-        pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
-    pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
+    pEntry->AddItem(std::unique_ptr<OfaImpBrwString>(new OfaImpBrwString( pEntry, 0, rTxt)));
 
     return pEntry;
 }
@@ -1781,20 +1782,22 @@ SvTreeListEntry* OfaQuoteTabPage::CreateEntry(OUString& rTxt, sal_uInt16 nCol)
         m_pSwCheckLB->SetCheckButtonData(pCheckButtonData);
     }
 
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+                new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false)));
 
     OUString sEmpty;
     if (nCol == CBCOL_SECOND)
-        pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));
     else
-        pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
 
     if (nCol == CBCOL_FIRST)
-        pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));
     else
-        pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(
+            pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
 
-    pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) );
+    pEntry->AddItem(std::unique_ptr<OfaImpBrwString>(new OfaImpBrwString(pEntry, 0, rTxt)));
 
     return pEntry;
 }
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index 5bc3697..3d56dbd 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -333,7 +333,7 @@ IMPL_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn )
     }
 
     mpImpl->pEventLB->SetUpdateMode( false );
-    pE->ReplaceItem( new SvLBoxString( pE, 0, sScriptURI ), LB_MACROS_ITEMPOS );
+    pE->ReplaceItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pE, 0, sScriptURI)), LB_MACROS_ITEMPOS);
     rListBox.GetModel()->InvalidateEntry( pE );
     rListBox.Select( pE );
     rListBox.MakeVisible( pE );
@@ -426,7 +426,8 @@ void _SfxMacroTabPage::FillEvents()
 
             if( sOld != sNew )
             {
-                pE->ReplaceItem( new SvLBoxString( pE, 0, sNew ), LB_MACROS_ITEMPOS );
+                pE->ReplaceItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+                                    pE, 0, sNew)), LB_MACROS_ITEMPOS);
                 rListBox.GetModel()->InvalidateEntry( pE );
             }
         }
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 191984d..1944410 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -142,8 +142,8 @@ void DBTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& aStr, co
 {
     SvTreeListBox::InitEntry( _pEntry, aStr, _rCollEntryBmp,_rExpEntryBmp, eButtonKind);
     SvLBoxItem* pTextItem(_pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
-    SvLBoxString* pString = new OBoldListboxString( _pEntry, 0, aStr );
-    _pEntry->ReplaceItem( pString,_pEntry->GetPos(pTextItem));
+    std::unique_ptr<SvLBoxString> pString(new OBoldListboxString(_pEntry, 0, aStr));
+    _pEntry->ReplaceItem(std::move(pString), _pEntry->GetPos(pTextItem));
 }
 
 void DBTreeListBox::implStopSelectionTimer()
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 352b85c..d243412 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -409,7 +409,8 @@ void OTableTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& _rSt
     size_t nTextPos = _pEntry->GetPos(pTextItem);
     OSL_ENSURE(SvTreeListEntry::ITEM_NOT_FOUND != nTextPos, "OTableTreeListBox::InitEntry: no text item pos!");
 
-    _pEntry->ReplaceItem(new OBoldListboxString(_pEntry, 0, _rString), nTextPos);
+    _pEntry->ReplaceItem(std::unique_ptr<OBoldListboxString>(
+                new OBoldListboxString(_pEntry, 0, _rString)), nTextPos);
 }
 
 SvTreeListEntry* OTableTreeListBox::implAddEntry(
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index aa1ba97..f005583 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -382,8 +382,8 @@ VCL_BUILDER_FACTORY(OColumnTreeBox)
 void OColumnTreeBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind)
 {
     DBTreeListBox::InitEntry(pEntry, rStr, rImg1, rImg2, eButtonKind);
-    SvLBoxString* pString = new OColumnString(pEntry, 0, rStr,false);
-    pEntry->ReplaceItem( pString, pEntry->ItemCount() - 1 );
+    std::unique_ptr<SvLBoxString> pString(new OColumnString(pEntry, 0, rStr,false));
+    pEntry->ReplaceItem(std::move(pString), pEntry->ItemCount() - 1);
 }
 
 bool OColumnTreeBox::Select( SvTreeListEntry* pEntry, bool bSelect )
diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx
index a7083de..2fcd628 100644
--- a/include/svtools/treelistentry.hxx
+++ b/include/svtools/treelistentry.hxx
@@ -92,8 +92,8 @@ public:
     // MAY ONLY BE CALLED IF THE ENTRY HAS NOT YET BEEN INSERTED INTO
     // THE MODEL, AS OTHERWISE NO VIEW-DEPENDENT DATA ARE ALLOCATED
     // FOR THE ITEM!
-    void        AddItem( SvLBoxItem* pItem );
-    void ReplaceItem( SvLBoxItem* pNewItem, size_t nPos );
+    void        AddItem(std::unique_ptr<SvLBoxItem> pItem);
+    void ReplaceItem(std::unique_ptr<SvLBoxItem> pNewItem, size_t nPos);
     const SvLBoxItem& GetItem( size_t nPos ) const;
     SvLBoxItem& GetItem( size_t nPos );
     const SvLBoxItem* GetFirstItem( sal_uInt16 nId ) const;
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 579c08c..66446d5 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -264,22 +264,28 @@ void ScSolverOptionsDialog::FillListBox()
         {
             // check box entry
             pEntry = new SvTreeListEntry;
-            SvLBoxButton* pButton = new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, mpCheckButtonData );
+            std::unique_ptr<SvLBoxButton> pButton(new SvLBoxButton(
+                pEntry, SvLBoxButtonKind_enabledCheckbox, 0, mpCheckButtonData));
             if ( ScUnoHelpFunctions::GetBoolFromAny( aValue ) )
                 pButton->SetStateChecked();
             else
                 pButton->SetStateUnchecked();
-            pEntry->AddItem( pButton );
-            pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false ) );
-            pEntry->AddItem( new SvLBoxString( pEntry, 0, aVisName ) );
+            pEntry->AddItem(std::move(pButton));
+            pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+                new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false)));
+            pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                new SvLBoxString( pEntry, 0, aVisName)));
         }
         else
         {
             // value entry
             pEntry = new SvTreeListEntry;
-            pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty ) );                   // empty column
-            pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false ) );
-            ScSolverOptionsString* pItem = new ScSolverOptionsString( pEntry, 0, aVisName );
+            pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+                new SvLBoxString(pEntry, 0, sEmpty))); // empty column
+            pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+                new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false)));
+            std::unique_ptr<ScSolverOptionsString> pItem(
+                new ScSolverOptionsString(pEntry, 0, aVisName));
             if ( eClass == uno::TypeClass_DOUBLE )
             {
                 double fDoubleValue = 0.0;
@@ -292,7 +298,7 @@ void ScSolverOptionsDialog::FillListBox()
                 if ( aValue >>= nIntValue )
                     pItem->SetIntValue( nIntValue );
             }
-            pEntry->AddItem( pItem );
+            pEntry->AddItem(std::move(pItem));
         }
         pModel->Insert( pEntry );
     }
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index c8d8a0f..106cb58 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1681,8 +1681,8 @@ void ScContentTree::InitEntry(SvTreeListEntry* pEntry,
     sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
     SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
     SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite ));
-    SvLBoxString* pStr = new SvLBoxString( pEntry, 0, rCol.GetText() );
-    pEntry->ReplaceItem( pStr, nColToHilite );
+    std::unique_ptr<SvLBoxString> pStr(new SvLBoxString(pEntry, 0, rCol.GetText()));
+    pEntry->ReplaceItem(std::move(pStr), nColToHilite);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 670895a..7789f4b 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -621,11 +621,13 @@ void CustomAnimationList::update()
             if( xShape.is() )
             {
                 SvTreeListEntry* pLBoxEntry = new CustomAnimationListEntry;
-                pLBoxEntry->AddItem( new SvLBoxContextBmp( pLBoxEntry, 0, Image(), Image(), false));
+                pLBoxEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+                    new SvLBoxContextBmp(pLBoxEntry, 0, Image(), Image(), false)));
                 OUString aDescription = SD_RESSTR(STR_CUSTOMANIMATION_TRIGGER);
                 aDescription += ": ";
                 aDescription += getShapeDescription( xShape, false );
-                pLBoxEntry->AddItem( new CustomAnimationTriggerEntryItem( pLBoxEntry, 0, aDescription ) );
+                pLBoxEntry->AddItem(std::unique_ptr<CustomAnimationTriggerEntryItem>(
+                    new CustomAnimationTriggerEntryItem(pLBoxEntry, 0, aDescription)));
                 Insert( pLBoxEntry );
                 SvViewDataEntry* pViewData = GetViewData( pLBoxEntry );
                 if( pViewData )
@@ -729,8 +731,10 @@ void CustomAnimationList::append( CustomAnimationEffectPtr pEffect )
         // create an entry for the effect
         SvTreeListEntry* pEntry = new CustomAnimationListEntry( pEffect );
 
-        pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
-        pEntry->AddItem( new CustomAnimationListEntryItem( pEntry, 0, aDescription, pEffect, this ) );
+        pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+                            pEntry, 0, Image(), Image(), false)));
+        pEntry->AddItem(std::unique_ptr<CustomAnimationListEntryItem>(
+            new CustomAnimationListEntryItem(pEntry, 0, aDescription, pEffect, this)));
 
         if( pParentEntry )
         {
diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx
index fdbf21c..ffc77b8 100644
--- a/sd/source/ui/dlg/dlgassim.cxx
+++ b/sd/source/ui/dlg/dlgassim.cxx
@@ -96,10 +96,12 @@ SvTreeListEntry* SdPageListControl::InsertPage( const OUString& rPageName )
 {
     SvTreeListEntry* pEntry = new SvTreeListEntry;
 
-    pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox,
-                                       0, m_pCheckButton));
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));    // otherwise boom!
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, rPageName ) );
+    pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(
+                pEntry, SvLBoxButtonKind_enabledCheckbox, 0, m_pCheckButton)));
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+                pEntry, 0, Image(), Image(), false)));    // otherwise boom!
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+                pEntry, 0, rPageName)));
 
     GetModel()->Insert( pEntry );
 
@@ -109,9 +111,12 @@ SvTreeListEntry* SdPageListControl::InsertPage( const OUString& rPageName )
 void SdPageListControl::InsertTitle( SvTreeListEntry* pParent, const OUString& rTitle )
 {
     SvTreeListEntry* pEntry = new SvTreeListEntry;
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, OUString() ) );
-    pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));    // otherwise boom!
-    pEntry->AddItem( new SvLBoxString( pEntry, 0, rTitle ) );
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+                    pEntry, 0, OUString())));
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+                    pEntry, 0, Image(), Image(), false)));    // otherwise boom!
+    pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+                    pEntry, 0, rTitle)));
     GetModel()->Insert( pEntry,pParent );
 }
 
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 46493a4..9282a47 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -374,8 +374,8 @@ void SdPageObjsTLB::InitEntry(SvTreeListEntry* pEntry,
     sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
     SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
     SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite ));
-    SvLBoxString* pStr = new SvLBoxString( pEntry, 0, rCol.GetText() );
-    pEntry->ReplaceItem( pStr, nColToHilite );
+    std::unique_ptr<SvLBoxString> pStr(new SvLBoxString(pEntry, 0, rCol.GetText()));
+    pEntry->ReplaceItem(std::move(pStr), nColToHilite );
 }
 
 void SdPageObjsTLB::SaveExpandedTreeItemState(SvTreeListEntry* pEntry, std::vector<OUString>& vectTreeItem)
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index c0d53ad..608a573 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -643,8 +643,9 @@ SvTreeListEntry* FillBox_Impl(SvTreeListBox* pBox,
 
     if (officecfg::Office::Common::StylesAndFormatting::Preview::get())
     {
-        StyleLBoxString* pStyleLBoxString = new StyleLBoxString(pTreeListEntry, 0, pEntry->getName(), eStyleFamily);
-        pTreeListEntry->ReplaceItem(pStyleLBoxString, 1);
+        std::unique_ptr<StyleLBoxString> pStyleLBoxString(
+            new StyleLBoxString(pTreeListEntry, 0, pEntry->getName(), eStyleFamily));
+        pTreeListEntry->ReplaceItem(std::move(pStyleLBoxString), 1);
     }
 
     pBox->GetModel()->InvalidateEntry(pTreeListEntry);
@@ -1263,8 +1264,9 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
                     SvTreeListEntry* pTreeListEntry = aFmtLb->InsertEntry(aStrings[nPos], 0, false, nPos);
                     if (officecfg::Office::Common::StylesAndFormatting::Preview::get())
                     {
-                        StyleLBoxString* pStyleLBoxString = new StyleLBoxString(pTreeListEntry, 0, aStrings[nPos], eFam);
-                        pTreeListEntry->ReplaceItem(pStyleLBoxString, 1);
+                        std::unique_ptr<StyleLBoxString> pStyleLBoxString(
+                            new StyleLBoxString(pTreeListEntry, 0, aStrings[nPos], eFam));
+                        pTreeListEntry->ReplaceItem(std::move(pStyleLBoxString), 1);
                     }
                     aFmtLb->GetModel()->InvalidateEntry(pTreeListEntry);
                 }
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index a1459b9..d15253e 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -83,8 +83,8 @@ void SvTabListBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr,
     for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
     {
         const OUString aToken = GetToken(aCurEntry, nIndex);
-        SvLBoxString* pStr = new SvLBoxString( pEntry, 0, aToken );
-        pEntry->AddItem( pStr );
+        std::unique_ptr<SvLBoxString> pStr(new SvLBoxString(pEntry, 0, aToken));
+        pEntry->AddItem(std::move(pStr));
     }
 }
 SvTabListBox::SvTabListBox( vcl::Window* pParent, WinBits nBits )
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 3ee959a..24e043a 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -1758,21 +1758,19 @@ void SvTreeListBox::InitEntry(SvTreeListEntry* pEntry,
     const OUString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp,
     SvLBoxButtonKind eButtonKind)
 {
-    SvLBoxString* pString;
-    SvLBoxContextBmp* pContextBmp;
-
     if( nTreeFlags & SvTreeFlags::CHKBTN )
     {
-        SvLBoxButton* pButton= new SvLBoxButton( pEntry,eButtonKind,0,pCheckButtonData );
-        pEntry->AddItem( pButton );
+        std::unique_ptr<SvLBoxButton> pButton(
+                new SvLBoxButton(pEntry, eButtonKind, 0, pCheckButtonData));
+        pEntry->AddItem(std::move(pButton));
     }
 
-    pContextBmp= new SvLBoxContextBmp(
-        pEntry,0, aCollEntryBmp,aExpEntryBmp, mbContextBmpExpanded);
-    pEntry->AddItem( pContextBmp );
+    std::unique_ptr<SvLBoxContextBmp> pContextBmp(new SvLBoxContextBmp(
+        pEntry,0, aCollEntryBmp,aExpEntryBmp, mbContextBmpExpanded));
+    pEntry->AddItem(std::move(pContextBmp));
 
-    pString = new SvLBoxString( pEntry, 0, aStr );
-    pEntry->AddItem( pString );
+    std::unique_ptr<SvLBoxString> pString(new SvLBoxString(pEntry, 0, aStr));
+    pEntry->AddItem(std::move(pString));
 }
 
 OUString SvTreeListBox::GetEntryText(SvTreeListEntry* pEntry) const
diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx
index 1293157..29f5976 100644
--- a/svtools/source/contnr/treelistentry.cxx
+++ b/svtools/source/contnr/treelistentry.cxx
@@ -130,9 +130,9 @@ size_t SvTreeListEntry::ItemCount() const
     return m_Items.size();
 }
 
-void SvTreeListEntry::AddItem( SvLBoxItem* pItem )
+void SvTreeListEntry::AddItem(std::unique_ptr<SvLBoxItem> pItem)
 {
-    m_Items.push_back(std::unique_ptr<SvLBoxItem>(pItem));
+    m_Items.push_back(std::move(pItem));
 }
 
 void SvTreeListEntry::EnableChildrenOnDemand( bool bEnable )
@@ -143,18 +143,18 @@ void SvTreeListEntry::EnableChildrenOnDemand( bool bEnable )
         nEntryFlags &= (~SvTLEntryFlags::CHILDREN_ON_DEMAND);
 }
 
-void SvTreeListEntry::ReplaceItem( SvLBoxItem* pNewItem, size_t nPos )
+void SvTreeListEntry::ReplaceItem(std::unique_ptr<SvLBoxItem> pNewItem, size_t const nPos)
 {
     DBG_ASSERT(pNewItem,"ReplaceItem:No Item");
     if (nPos >= m_Items.size())
     {
         // Out of bound. Bail out.
-        delete pNewItem;
+        pNewItem.reset();
         return;
     }
 
     m_Items.erase(m_Items.begin()+nPos);
-    m_Items.insert(m_Items.begin()+nPos, std::unique_ptr<SvLBoxItem>(pNewItem));
+    m_Items.insert(m_Items.begin()+nPos, std::move(pNewItem));
 }
 
 const SvLBoxItem& SvTreeListEntry::GetItem( size_t nPos ) const
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 26cc5b4..4d02dd5 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -237,11 +237,14 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN
     {
         Image aImage;
         pEntry = new UnoTreeListEntry( xNode, this );
-        ImplContextGraphicItem* pContextBmp= new ImplContextGraphicItem(pEntry, 0, aImage, aImage, true);
+        {
+            std::unique_ptr<ImplContextGraphicItem> pContextBmp(
+                new ImplContextGraphicItem(pEntry, 0, aImage, aImage, true));
 
-        pEntry->AddItem( pContextBmp );
+            pEntry->AddItem(std::move(pContextBmp));
+        }
 
-        UnoTreeListItem * pUnoItem = new UnoTreeListItem( pEntry );
+        std::unique_ptr<UnoTreeListItem> pUnoItem(new UnoTreeListItem(pEntry));
 
         if( !xNode->getNodeGraphicURL().isEmpty() )
         {
@@ -252,7 +255,7 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN
             mpTreeImpl->AdjustEntryHeight( aNodeImage );
         }
 
-        pEntry->AddItem( pUnoItem );
+        pEntry->AddItem(std::move(pUnoItem));
 
         mpTreeImpl->insert( pEntry, pParent, nPos );
 
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 1f05706..602a7c2 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -343,18 +343,22 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr,
 {
     if (nTreeFlags & SvTreeFlags::CHKBTN)
     {
-        pEntry->AddItem(new SvLBoxButton(pEntry, eButtonKind, 0, pCheckButtonData));
+        pEntry->AddItem(std::unique_ptr<SvLBoxButton>(
+                new SvLBoxButton(pEntry, eButtonKind, 0, pCheckButtonData)));
     }
 
-    pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, rColl, rExp, true));
+    pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+                new SvLBoxContextBmp(pEntry, 0, rColl, rExp, true)));
 
     // the type of the change
     assert((rStr.isEmpty() && !!maEntryImage) || (!rStr.isEmpty() && !maEntryImage));
 
     if (rStr.isEmpty())
-        pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, maEntryImage, maEntryImage, true));
+        pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+                        pEntry, 0, maEntryImage, maEntryImage, true)));
     else
-        pEntry->AddItem(new SvLBoxColorString(pEntry, 0, rStr, maEntryColor));
+        pEntry->AddItem(std::unique_ptr<SvLBoxColorString>(
+                    new SvLBoxColorString(pEntry, 0, rStr, maEntryColor)));
 
     // the change tracking entries
     sal_Int32 nIndex = 0;
@@ -362,7 +366,8 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr,
     for (sal_uInt16 nToken = 0; nToken < nCount; nToken++)
     {
         const OUString aToken = GetToken(maEntryString, nIndex);
-        pEntry->AddItem(new SvLBoxColorString(pEntry, 0, aToken, maEntryColor));
+        pEntry->AddItem(std::unique_ptr<SvLBoxColorString>(
+                    new SvLBoxColorString(pEntry, 0, aToken, maEntryColor)));
     }
 }
 
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 7b9d2fe..9ca770c 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -848,8 +848,9 @@ void RecovDocList::InitEntry(SvTreeListEntry* pEntry,
     DBG_ASSERT( TabCount() == 2, "*RecovDocList::InitEntry(): structure missmatch" );
 
     SvLBoxString&       rCol = static_cast<SvLBoxString&>(pEntry->GetItem(2));
-    RecovDocListEntry*  p    = new RecovDocListEntry(pEntry, 0, rCol.GetText());
-    pEntry->ReplaceItem(p, 2);
+    std::unique_ptr<RecovDocListEntry> p(
+            new RecovDocListEntry(pEntry, 0, rCol.GetText()));
+    pEntry->ReplaceItem(std::move(p), 2);
 }
 
 
diff --git a/svx/source/dialog/fontlb.cxx b/svx/source/dialog/fontlb.cxx
index 11eab21..60845d9 100644
--- a/svx/source/dialog/fontlb.cxx
+++ b/svx/source/dialog/fontlb.cxx
@@ -136,10 +136,12 @@ void SvxFontListBox::InitEntry(
     if( mbUseFont )
     {
         if( nTreeFlags & SvTreeFlags::CHKBTN )
-            pEntry->AddItem( new SvLBoxButton( pEntry, eButtonKind, 0,
-                                               pCheckButtonData ) );
-        pEntry->AddItem( new SvLBoxContextBmp(pEntry, 0, rCollImg, rExpImg, true) );
-        pEntry->AddItem( new SvLBoxFontString( pEntry, 0, rEntryText, maEntryFont, mpEntryColor ) );
+            pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(
+                        pEntry, eButtonKind, 0, pCheckButtonData)));
+        pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+                        pEntry, 0, rCollImg, rExpImg, true)));
+        pEntry->AddItem(std::unique_ptr<SvLBoxFontString>(new SvLBoxFontString(
+                        pEntry, 0, rEntryText, maEntryFont, mpEntryColor)));
     }
     else
         SvTreeListBox::InitEntry( pEntry, rEntryText, rCollImg, rExpImg,
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 7c0ecce..f601b24 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1411,15 +1411,16 @@ void FmFilterNavigator::InitEntry(SvTreeListEntry* pEntry,
                                   SvLBoxButtonKind eButtonKind)
 {
     SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
-    SvLBoxString* pString = NULL;
+    std::unique_ptr<SvLBoxString> pString;
 
     if (static_cast<FmFilterData*>(pEntry->GetUserData())->ISA(FmFilterItem))
-        pString = new FmFilterString(pEntry, 0, rStr, static_cast<FmFilterItem*>(pEntry->GetUserData())->GetFieldName());
+        pString.reset(new FmFilterString(pEntry, 0, rStr,
+            static_cast<FmFilterItem*>(pEntry->GetUserData())->GetFieldName()));
     else if (static_cast<FmFilterData*>(pEntry->GetUserData())->ISA(FmFilterItems))
-        pString = new FmFilterItemsString(pEntry, 0, rStr );
+        pString.reset(new FmFilterItemsString(pEntry, 0, rStr));
 
     if (pString)
-        pEntry->ReplaceItem( pString, 1 );
+        pEntry->ReplaceItem(std::move(pString), 1 );
 }
 
 
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 388b810..adae6c2 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3461,8 +3461,9 @@ void SwContentTree::InitEntry(SvTreeListEntry* pEntry,
     const size_t nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2"
     SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
     SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite ));
-    SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, rCol.GetText() );
-    pEntry->ReplaceItem( pStr, nColToHilite );
+    std::unique_ptr<SwContentLBoxString> pStr(
+        new SwContentLBoxString(pEntry, 0, rCol.GetText()));
+    pEntry->ReplaceItem(std::move(pStr), nColToHilite);
 }
 
 void SwContentLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index c8c9e0a..0f4e6d6 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1233,8 +1233,9 @@ void SwGlobalTree::InitEntry(SvTreeListEntry* pEntry,
     const size_t nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2"
     SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
     SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite ));
-    SwLBoxString* pStr = new SwLBoxString( pEntry, 0, rCol.GetText() );
-    pEntry->ReplaceItem( pStr, nColToHilite );
+    std::unique_ptr<SwLBoxString> pStr(
+        new SwLBoxString(pEntry, 0, rCol.GetText()));
+    pEntry->ReplaceItem(std::move(pStr), nColToHilite);
 }
 
 void SwLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
commit 63de1888f67dc43c30d5a102651b7c2738243efb
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 20 16:19:44 2015 +0200

    svtools: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: I37cf472e7558ffd7714659436b78851caa187945

diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx
index 839ffd3..a7083de 100644
--- a/include/svtools/treelistentry.hxx
+++ b/include/svtools/treelistentry.hxx
@@ -26,7 +26,8 @@
 #include <svtools/treelistentries.hxx>
 #include <o3tl/typed_flags_set.hxx>
 
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
 
 // flags related to the model
 enum class SvTLEntryFlags
@@ -53,13 +54,13 @@ class SVT_DLLPUBLIC SvTreeListEntry
     friend class SvListView;
     friend class SvTreeListBox;
 
-    typedef boost::ptr_vector<SvLBoxItem> ItemsType;
+    typedef std::vector<std::unique_ptr<SvLBoxItem>> ItemsType;
 
     SvTreeListEntry*    pParent;
     SvTreeListEntries   maChildren;
     sal_uLong           nAbsPos;
     sal_uLong           nListPos;
-    ItemsType           maItems;
+    ItemsType           m_Items;
     bool                bIsMarked;
     void*               pUserData;
     SvTLEntryFlags      nEntryFlags;
diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx
index a78b363..1293157 100644
--- a/svtools/source/contnr/treelistentry.cxx
+++ b/svtools/source/contnr/treelistentry.cxx
@@ -82,7 +82,7 @@ SvTreeListEntry::~SvTreeListEntry()
 #endif
 
     maChildren.clear();
-    maItems.clear();
+    m_Items.clear();
 }
 
 bool SvTreeListEntry::HasChildren() const
@@ -112,14 +112,13 @@ void SvTreeListEntry::Clone(SvTreeListEntry* pSource)
     nListPos |= ( pSource->nListPos & 0x7fffffff);
     nAbsPos     = pSource->nAbsPos;
 
-    maItems.clear();
-    ItemsType::iterator it = pSource->maItems.begin(), itEnd = pSource->maItems.end();
-    for (; it != itEnd; ++it)
+    m_Items.clear();
+    for (auto const& it : pSource->m_Items)
     {
         SvLBoxItem* pItem = &(*it);
-        SvLBoxItem* pNewItem = pItem->Create();
+        std::unique_ptr<SvLBoxItem> pNewItem(pItem->Create());
         pNewItem->Clone(pItem);
-        maItems.push_back(pNewItem);
+        m_Items.push_back(std::move(pNewItem));
     }
 
     pUserData = pSource->GetUserData();
@@ -128,12 +127,12 @@ void SvTreeListEntry::Clone(SvTreeListEntry* pSource)
 
 size_t SvTreeListEntry::ItemCount() const
 {
-    return maItems.size();
+    return m_Items.size();
 }
 
 void SvTreeListEntry::AddItem( SvLBoxItem* pItem )
 {
-    maItems.push_back( pItem );
+    m_Items.push_back(std::unique_ptr<SvLBoxItem>(pItem));
 }
 
 void SvTreeListEntry::EnableChildrenOnDemand( bool bEnable )
@@ -147,25 +146,25 @@ void SvTreeListEntry::EnableChildrenOnDemand( bool bEnable )
 void SvTreeListEntry::ReplaceItem( SvLBoxItem* pNewItem, size_t nPos )
 {
     DBG_ASSERT(pNewItem,"ReplaceItem:No Item");
-    if (nPos >= maItems.size())
+    if (nPos >= m_Items.size())
     {
         // Out of bound. Bail out.
         delete pNewItem;
         return;
     }
 
-    maItems.erase(maItems.begin()+nPos);
-    maItems.insert(maItems.begin()+nPos, pNewItem);
+    m_Items.erase(m_Items.begin()+nPos);
+    m_Items.insert(m_Items.begin()+nPos, std::unique_ptr<SvLBoxItem>(pNewItem));
 }
 
 const SvLBoxItem& SvTreeListEntry::GetItem( size_t nPos ) const
 {
-    return maItems[nPos];
+    return *m_Items[nPos];
 }
 
 SvLBoxItem& SvTreeListEntry::GetItem( size_t nPos )
 {
-    return maItems[nPos];
+    return *m_Items[nPos];
 }
 
 namespace {
@@ -175,9 +174,9 @@ class FindByType : std::unary_function<SvLBoxItem, void>
     sal_uInt16 mnId;
 public:
     explicit FindByType(sal_uInt16 nId) : mnId(nId) {}
-    bool operator() (const SvLBoxItem& rItem) const
+    bool operator() (const std::unique_ptr<SvLBoxItem>& rpItem) const
     {
-        return rItem.GetType() == mnId;
+        return rpItem->GetType() == mnId;
     }
 };
 
@@ -186,9 +185,9 @@ class FindByPointer : std::unary_function<SvLBoxItem, void>
     const SvLBoxItem* mpItem;
 public:
     explicit FindByPointer(const SvLBoxItem* p) : mpItem(p) {}
-    bool operator() (const SvLBoxItem& rItem) const
+    bool operator() (const std::unique_ptr<SvLBoxItem>& rpItem) const
     {
-        return &rItem == mpItem;
+        return rpItem.get() == mpItem;
     }
 };
 
@@ -196,20 +195,20 @@ public:
 
 const SvLBoxItem* SvTreeListEntry::GetFirstItem( sal_uInt16 nId ) const
 {
-    ItemsType::const_iterator it = std::find_if(maItems.begin(), maItems.end(), FindByType(nId));
-    return it == maItems.end() ? NULL : &(*it);
+    ItemsType::const_iterator it = std::find_if(m_Items.begin(), m_Items.end(), FindByType(nId));
+    return (it == m_Items.end()) ? nullptr : (*it).get();
 }
 
 SvLBoxItem* SvTreeListEntry::GetFirstItem( sal_uInt16 nId )
 {
-    ItemsType::iterator it = std::find_if(maItems.begin(), maItems.end(), FindByType(nId));
-    return it == maItems.end() ? NULL : &(*it);
+    ItemsType::iterator it = std::find_if(m_Items.begin(), m_Items.end(), FindByType(nId));
+    return (it == m_Items.end()) ? nullptr : (*it).get();
 }
 
 size_t SvTreeListEntry::GetPos( const SvLBoxItem* pItem ) const
 {
-    ItemsType::const_iterator it = std::find_if(maItems.begin(), maItems.end(), FindByPointer(pItem));
-    return it == maItems.end() ? ITEM_NOT_FOUND : std::distance(maItems.begin(), it);
+    ItemsType::const_iterator it = std::find_if(m_Items.begin(), m_Items.end(), FindByPointer(pItem));
+    return it == m_Items.end() ? ITEM_NOT_FOUND : std::distance(m_Items.begin(), it);
 }
 
 


More information about the Libreoffice-commits mailing list