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

Michael Stahl mstahl at redhat.com
Wed Oct 21 08:57:28 PDT 2015


 sw/source/core/doc/DocumentContentOperationsManager.cxx |   27 ++++++--------
 sw/source/core/fields/reffld.cxx                        |   12 +++---
 sw/source/ui/index/cnttab.cxx                           |   29 ++++++++--------
 sw/source/uibase/dochdl/gloshdl.cxx                     |   12 ++----
 4 files changed, 36 insertions(+), 44 deletions(-)

New commits:
commit fcc2415ade6ae93710bbbda9f7e163045e323105
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 21 17:38:29 2015 +0200

    sw: replace boost::ptr_vector with std::vector
    
    Change-Id: I5c011939ec492e0ae2cf136554b8b1f42e1253e9

diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 6050cf6..4ac121b 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -59,8 +59,6 @@
 
 #include <IDocumentFieldsAccess.hxx>
 
-#include <boost/ptr_container/ptr_vector.hpp>
-
 #include <memory>
 
 using namespace ::com::sun::star;
@@ -72,6 +70,8 @@ struct TextBlockInfo_Impl
     OUString sTitle;
     OUString sLongName;
     OUString sGroupName;
+    TextBlockInfo_Impl(OUString const& rTitle, OUString const& rLongName, OUString const& rGroupName)
+        : sTitle(rTitle), sLongName(rLongName), sGroupName(rGroupName) {}
 };
 
 // Dialog for edit templates
@@ -395,7 +395,7 @@ bool SwGlossaryHdl::Expand( const OUString& rShortName,
                             SwGlossaries *pGlossaries,
                             SwTextBlocks *pGlossary  )
 {
-    boost::ptr_vector<TextBlockInfo_Impl> aFoundArr;
+    std::vector<TextBlockInfo_Impl> aFoundArr;
     OUString aShortName( rShortName );
     bool bCancel = false;
     // search for text block
@@ -424,11 +424,7 @@ bool SwGlossaryHdl::Expand( const OUString& rShortName,
                     const OUString sShortName(pGlossaryList->GetBlockShortName(i, j));
                     if( rSCmp.isEqual( rShortName, sShortName ))
                     {
-                        TextBlockInfo_Impl* pData = new TextBlockInfo_Impl;
-                        pData->sTitle = sTitle;
-                        pData->sLongName = sLongName;
-                        pData->sGroupName = sGroupName;
-                        aFoundArr.push_back(pData);
+                        aFoundArr.push_back(TextBlockInfo_Impl(sTitle, sLongName, sGroupName));
                     }
                 }
             }
commit 2f5748afa7841ef65476d3656009cff4bc8e1150
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 21 17:12:37 2015 +0200

    sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: If476381b05b046443facc9dd220d273133bda651

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 529d04b..b779796 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -79,7 +79,8 @@
 
 #include <unomid.h>
 
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
+#include <vector>
 #include <numeric>
 
 
@@ -157,7 +158,7 @@ class SwEntryBrowseBox : public SwEntryBrowseBox_Base
     OUString  sYes;
     OUString  sNo;
 
-    boost::ptr_vector<AutoMarkEntry> aEntryArr;
+    std::vector<std::unique_ptr<AutoMarkEntry>> m_Entries;
 
     ::svt::CellControllerRef    xController;
     ::svt::CellControllerRef    xCheckController;
@@ -3964,9 +3965,9 @@ bool SwEntryBrowseBox::SeekRow( long nRow )
 OUString SwEntryBrowseBox::GetCellText(long nRow, sal_uInt16 nColumn) const
 {
     const OUString* pRet = &aEmptyOUStr;
-    if (aEntryArr.size() > static_cast<size_t>(nRow))
+    if (static_cast<size_t>(nRow) < m_Entries.size())
     {
-        const AutoMarkEntry* pEntry = &aEntryArr[ nRow ];
+        const AutoMarkEntry* pEntry = m_Entries[ nRow ].get();
         switch(nColumn)
         {
             case  ITEM_SEARCH       :pRet = &pEntry->sSearch; break;
@@ -4012,8 +4013,8 @@ bool SwEntryBrowseBox::SaveModified()
         pController = xCheckController;
         bVal = static_cast< ::svt::CheckBoxCellController*>(pController)->GetCheckBox().IsChecked();
     }
-    AutoMarkEntry* pEntry = nRow >= aEntryArr.size() ? new AutoMarkEntry
-                                                      : &aEntryArr[nRow];
+    AutoMarkEntry* pEntry = (nRow >= m_Entries.size()) ? new AutoMarkEntry
+                                                       : m_Entries[nRow].get();
     switch(nCol)
     {
         case  ITEM_SEARCH       : pEntry->sSearch = sNew; break;
@@ -4024,9 +4025,9 @@ bool SwEntryBrowseBox::SaveModified()
         case  ITEM_CASE         : pEntry->bCase = bVal; break;
         case  ITEM_WORDONLY     : pEntry->bWord = bVal; break;
     }
-    if(nRow >= aEntryArr.size())
+    if (nRow >= m_Entries.size())
     {
-        aEntryArr.push_back( pEntry );
+        m_Entries.push_back(std::unique_ptr<AutoMarkEntry>(pEntry));
         RowInserted(nRow, 1, true, true);
         if(nCol < ITEM_WORDONLY)
         {
@@ -4090,21 +4091,21 @@ void SwEntryBrowseBox::ReadEntries(SvStream& rInStr)
                 sStr = sLine.getToken(0, ';', nSttPos );
                 pToInsert->bWord = !sStr.isEmpty() && sStr != "0";
 
-                aEntryArr.push_back( pToInsert );
+                m_Entries.push_back(std::unique_ptr<AutoMarkEntry>(pToInsert));
                 pToInsert = 0;
             }
             else
             {
                 if(pToInsert)
-                    aEntryArr.push_back(pToInsert);
+                    m_Entries.push_back(std::unique_ptr<AutoMarkEntry>(pToInsert));
                 pToInsert = new AutoMarkEntry;
                 pToInsert->sComment = sLine.copy(1);
             }
         }
     }
     if( pToInsert )
-        aEntryArr.push_back(pToInsert);
-    RowInserted(0, aEntryArr.size() + 1);
+        m_Entries.push_back(std::unique_ptr<AutoMarkEntry>(pToInsert));
+    RowInserted(0, m_Entries.size() + 1);
 }
 
 void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr)
@@ -4120,9 +4121,9 @@ void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr)
         GoToColumnId(nCol + (nCol < ITEM_CASE ? 1 : -1 ));
 
     rtl_TextEncoding  eTEnc = osl_getThreadTextEncoding();
-    for(size_t i = 0; i < aEntryArr.size(); i++)
+    for(size_t i = 0; i < m_Entries.size(); i++)
     {
-        AutoMarkEntry* pEntry = &aEntryArr[i];
+        AutoMarkEntry* pEntry = m_Entries[i].get();
         if(!pEntry->sComment.isEmpty())
         {
             rOutStr.WriteByteStringLine( "#" + pEntry->sComment, eTEnc );
commit 618fe3366591902f88217c7f90d17e84ec527bf3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 21 17:05:44 2015 +0200

    sw: replace boost::ptr_vector with std::vector
    
    Change-Id: Ic31f92dba347017c4e25f210728d63a4048c5a25

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index b7bdda2..8eba107 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -74,7 +74,6 @@
 #include <editeng/formatbreakitem.hxx>
 #include <com/sun/star/i18n/Boundary.hpp>
 
-#include <boost/ptr_container/ptr_vector.hpp>
 
 using namespace ::com::sun::star::i18n;
 
@@ -620,9 +619,9 @@ namespace
         }
     };
 
-    typedef boost::ptr_vector< _SaveRedline > _SaveRedlines;
+    typedef std::vector< _SaveRedline > SaveRedlines_t;
 
-    static void lcl_SaveRedlines( const SwPaM& aPam, _SaveRedlines& rArr )
+    static void lcl_SaveRedlines(const SwPaM& aPam, SaveRedlines_t& rArr)
     {
         SwDoc* pDoc = aPam.GetNode().GetDoc();
 
@@ -680,8 +679,7 @@ namespace
                 }
 
                 // save the current redline
-                _SaveRedline* pSave = new _SaveRedline( pCurrent, *pStart );
-                rArr.push_back( pSave );
+                rArr.push_back(_SaveRedline( pCurrent, *pStart ));
             }
         }
 
@@ -689,7 +687,7 @@ namespace
         pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
     }
 
-    static void lcl_RestoreRedlines( SwDoc* pDoc, const SwPosition& rPos, _SaveRedlines& rArr )
+    static void lcl_RestoreRedlines(SwDoc* pDoc, const SwPosition& rPos, SaveRedlines_t& rArr)
     {
         RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
         pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
@@ -703,7 +701,7 @@ namespace
         pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
     }
 
-    static void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
+    static void lcl_SaveRedlines(const SwNodeRange& rRg, SaveRedlines_t& rArr)
     {
         SwDoc* pDoc = rRg.aStart.GetNode().GetDoc();
         sal_uInt16 nRedlPos;
@@ -737,8 +735,7 @@ namespace
                     pTmpPos->nContent.Assign(
                                 pTmpPos->nNode.GetNode().GetContentNode(), 0 );
 
-                    _SaveRedline* pSave = new _SaveRedline( pNewRedl, rRg.aStart );
-                    rArr.push_back( pSave );
+                    rArr.push_back(_SaveRedline(pNewRedl, rRg.aStart));
 
                     pTmpPos = pTmp->End();
                     pTmpPos->nNode = rRg.aEnd;
@@ -760,8 +757,7 @@ namespace
                     ( pREnd->nNode == rRg.aEnd && !pREnd->nContent.GetIndex()) )
                 {
                     // move everything
-                    _SaveRedline* pSave = new _SaveRedline( pTmp, rRg.aStart );
-                    rArr.push_back( pSave );
+                    rArr.push_back(_SaveRedline( pTmp, rRg.aStart ));
                 }
                 else
                 {
@@ -772,8 +768,7 @@ namespace
                     pTmpPos->nContent.Assign(
                                 pTmpPos->nNode.GetNode().GetContentNode(), 0 );
 
-                    _SaveRedline* pSave = new _SaveRedline( pNewRedl, rRg.aStart );
-                    rArr.push_back( pSave );
+                    rArr.push_back(_SaveRedline( pNewRedl, rRg.aStart ));
 
                     pTmpPos = pTmp->Start();
                     pTmpPos->nNode = rRg.aEnd;
@@ -789,7 +784,7 @@ namespace
         pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
     }
 
-    static void lcl_RestoreRedlines( SwDoc* pDoc, sal_uInt32 nInsPos, _SaveRedlines& rArr )
+    static void lcl_RestoreRedlines(SwDoc *const pDoc, sal_uInt32 const nInsPos, SaveRedlines_t& rArr)
     {
         RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
         pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
@@ -1904,7 +1899,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos,
     _SaveFlyInRange( rPaM, rPos.nNode, aSaveFlyArr, bool( SwMoveFlags::ALLFLYS & eMvFlags ) );
 
     // save redlines (if DOC_MOVEREDLINES is used)
-    _SaveRedlines aSaveRedl;
+    SaveRedlines_t aSaveRedl;
     if( SwMoveFlags::REDLINES & eMvFlags && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() )
     {
         lcl_SaveRedlines( rPaM, aSaveRedl );
@@ -2179,7 +2174,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod
                                     m_rDoc.GetFootnoteIdxs(), aTmpFntIdx );
     }
 
-    _SaveRedlines aSaveRedl;
+    SaveRedlines_t aSaveRedl;
     std::vector<SwRangeRedline*> aSavRedlInsPosArr;
     if( SwMoveFlags::REDLINES & eMvFlags && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() )
     {
commit 8bee34a7db41df4147a60a2fa32de143cd5e6b84
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 21 16:55:41 2015 +0200

    sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: I12b440e445cb94c27a33e52646157b04add6b26a

diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index f403d4a..ceffe04 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -60,8 +60,8 @@
 
 #include <sfx2/childwin.hxx>
 
-#include <boost/ptr_container/ptr_vector.hpp>
-
+#include <memory>
+#include <vector>
 #include <set>
 #include <map>
 #include <algorithm>
@@ -1096,7 +1096,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc )
         // then there are RefFields in the DescDox - so all RefFields in the SourceDoc
         // need to be converted to have unique IDs for both documents
         _RefIdsMap aFntMap( aEmptyOUStr );
-        boost::ptr_vector<_RefIdsMap> aFieldMap;
+        std::vector<std::unique_ptr<_RefIdsMap>> aFieldMap;
 
         SwIterator<SwFormatField,SwFieldType> aIter( *this );
         for( SwFormatField* pField = aIter.First(); pField; pField = aIter.Next() )
@@ -1109,16 +1109,16 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc )
                     _RefIdsMap* pMap = 0;
                     for( auto n = aFieldMap.size(); n; )
                     {
-                        if( aFieldMap[ --n ].GetName()==rRefField.GetSetRefName() )
+                        if (aFieldMap[ --n ]->GetName() == rRefField.GetSetRefName())
                         {
-                            pMap = &aFieldMap[ n ];
+                            pMap = aFieldMap[ n ].get();
                             break;
                         }
                     }
                     if( !pMap )
                     {
                         pMap = new _RefIdsMap( rRefField.GetSetRefName() );
-                        aFieldMap.push_back( pMap );
+                        aFieldMap.push_back(std::unique_ptr<_RefIdsMap>(pMap));
                     }
 
                     pMap->Check( *pDoc, rDestDoc, rRefField, true );


More information about the Libreoffice-commits mailing list