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

Michael Stahl mstahl at redhat.com
Mon Oct 5 14:29:45 PDT 2015


 sw/source/ui/dbui/dbinsdlg.cxx       |   58 +++++++++++++++----------------
 sw/source/ui/envelp/label1.cxx       |   30 +++++++---------
 sw/source/ui/envelp/labfmt.cxx       |    2 -
 sw/source/uibase/cctrl/swlbox.cxx    |   35 +++++++++----------
 sw/source/uibase/config/uinums.cxx   |   18 ++++++---
 sw/source/uibase/envelp/labelcfg.cxx |    4 +-
 sw/source/uibase/inc/dbinsdlg.hxx    |   11 +++---
 sw/source/uibase/inc/label.hxx       |    6 +--
 sw/source/uibase/inc/labrec.hxx      |    6 ++-
 sw/source/uibase/inc/redlndlg.hxx    |   11 +++---
 sw/source/uibase/inc/swlbox.hxx      |   11 +++---
 sw/source/uibase/inc/uinums.hxx      |    6 ++-
 sw/source/uibase/misc/redlndlg.cxx   |   64 ++++++++++++++++++-----------------
 13 files changed, 138 insertions(+), 124 deletions(-)

New commits:
commit f03417389e70a6312a42468baaf55b2080a61675
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Oct 5 23:12:03 2015 +0200

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

diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 2e818a1..5777bfc 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -90,6 +90,8 @@
 #include <unomid.h>
 #include <IDocumentMarkAccess.hxx>
 
+#include <o3tl/make_unique.hxx>
+
 #include <boost/noncopyable.hpp>
 #include <memory>
 #include <swuiexp.hxx>
@@ -856,23 +858,19 @@ IMPL_LINK_TYPED( SwInsertDBColAutoPilot, HeaderHdl, Button*, pButton, void )
 
 static void lcl_InsTextInArr( const OUString& rText, DB_Columns& rColArr )
 {
-    DB_Column* pNew;
     sal_Int32 nSttPos = 0, nFndPos;
     while( -1 != ( nFndPos = rText.indexOf( '\x0A', nSttPos )) )
     {
         if( 1 < nFndPos )
         {
-            pNew = new DB_Column( rText.copy( nSttPos, nFndPos -1 ) );
-            rColArr.push_back( pNew );
+            rColArr.push_back(o3tl::make_unique<DB_Column>(rText.copy(nSttPos, nFndPos -1)));
         }
-        pNew = new DB_Column;
-        rColArr.push_back( pNew );
+        rColArr.push_back(o3tl::make_unique<DB_Column>());
         nSttPos = nFndPos + 1;
     }
     if( nSttPos < rText.getLength() )
     {
-        pNew = new DB_Column( rText.copy( nSttPos ) );
-        rColArr.push_back( pNew );
+        rColArr.push_back(o3tl::make_unique<DB_Column>(rText.copy(nSttPos)));
     }
 }
 
@@ -940,7 +938,7 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rText,
                 else
                     pNew = new DB_Column( rFndCol, nFormat );
 
-                rColArr.push_back( pNew );
+                rColArr.push_back( std::unique_ptr<DB_Column>(pNew) );
             }
         }
     }
@@ -1276,7 +1274,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
 
                 for( size_t n = 0; n < nCols; ++n )
                 {
-                    DB_Column* pDBCol = &aColArr[ n ];
+                    DB_Column* pDBCol = aColArr[ n ].get();
                     OUString sIns;
                     switch( pDBCol->eColType )
                     {
diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx
index 7f25de9..55d5105 100644
--- a/sw/source/uibase/inc/dbinsdlg.hxx
+++ b/sw/source/uibase/inc/dbinsdlg.hxx
@@ -33,9 +33,11 @@
 #include <swdbdata.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/Sequence.h>
-#include <boost/ptr_container/ptr_vector.hpp>
 #include <o3tl/sorted_vector.hxx>
 
+#include <memory>
+#include <vector>
+
 namespace com{namespace sun{namespace star{
     namespace sdbcx{
     class XColumnsSupplier;
@@ -52,7 +54,8 @@ class SwView;
 class SfxItemSet;
 class SwTableRep;
 struct DB_Column;
-typedef boost::ptr_vector<DB_Column> DB_Columns;
+
+typedef std::vector<std::unique_ptr<DB_Column>> DB_Columns;
 
 struct SwInsDBColumn
 {
commit 6e3188efd513b2447dd8335567742c013fd6c265
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Oct 5 22:52:11 2015 +0200

    sw: let's try to write a C++ program, stop using reserved identifiers
    
    Change-Id: I8810ca647af7b376b1c2bb1c4d866eb081718145

diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 8d2f1dc..2e818a1 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -108,7 +108,7 @@ const char cDBFieldStart  = '<';
 const char cDBFieldEnd    = '>';
 
 // Helper structure for adding database rows as fields or text
-struct _DB_Column
+struct DB_Column
 {
     enum ColType { DB_FILLTEXT, DB_COL_FIELD, DB_COL_TEXT, DB_SPLITPARA } eColType;
 
@@ -119,35 +119,35 @@ struct _DB_Column
     } DB_ColumnData;
     const SwInsDBColumn* pColInfo;
 
-    _DB_Column()
+    DB_Column()
     {
         pColInfo = 0;
         DB_ColumnData.pText = 0;
         eColType = DB_SPLITPARA;
     }
 
-    explicit _DB_Column( const OUString& rText )
+    explicit DB_Column( const OUString& rText )
     {
         pColInfo = 0;
         DB_ColumnData.pText = new OUString( rText );
         eColType = DB_FILLTEXT;
     }
 
-    _DB_Column( const SwInsDBColumn& rInfo, sal_uLong nFormat )
+    DB_Column( const SwInsDBColumn& rInfo, sal_uLong nFormat )
     {
         pColInfo = &rInfo;
         DB_ColumnData.nFormat = nFormat;
         eColType = DB_COL_TEXT;
     }
 
-    _DB_Column( const SwInsDBColumn& rInfo, SwDBField& rField )
+    DB_Column( const SwInsDBColumn& rInfo, SwDBField& rField )
     {
         pColInfo = &rInfo;
         DB_ColumnData.pField = &rField;
         eColType = DB_COL_FIELD;
     }
 
-    ~_DB_Column()
+    ~DB_Column()
     {
         if( DB_COL_FIELD == eColType )
             delete DB_ColumnData.pField;
@@ -156,7 +156,7 @@ struct _DB_Column
     }
 };
 
-struct _DB_ColumnConfigData: private boost::noncopyable
+struct DB_ColumnConfigData: private boost::noncopyable
 {
     SwInsDBColumns aDBColumns;
     OUString sSource;
@@ -170,13 +170,13 @@ struct _DB_ColumnConfigData: private boost::noncopyable
          bIsHeadlineOn : 1,
          bIsEmptyHeadln : 1;
 
-    _DB_ColumnConfigData()
+    DB_ColumnConfigData()
     {
         bIsTable = bIsHeadlineOn = true;
         bIsField = bIsEmptyHeadln = false;
     }
 
-    ~_DB_ColumnConfigData();
+    ~DB_ColumnConfigData();
 };
 
 bool SwInsDBColumn::operator<( const SwInsDBColumn& rCmp ) const
@@ -854,30 +854,30 @@ IMPL_LINK_TYPED( SwInsertDBColAutoPilot, HeaderHdl, Button*, pButton, void )
     }
 }
 
-static void lcl_InsTextInArr( const OUString& rText, _DB_Columns& rColArr )
+static void lcl_InsTextInArr( const OUString& rText, DB_Columns& rColArr )
 {
-    _DB_Column* pNew;
+    DB_Column* pNew;
     sal_Int32 nSttPos = 0, nFndPos;
     while( -1 != ( nFndPos = rText.indexOf( '\x0A', nSttPos )) )
     {
         if( 1 < nFndPos )
         {
-            pNew = new _DB_Column( rText.copy( nSttPos, nFndPos -1 ) );
+            pNew = new DB_Column( rText.copy( nSttPos, nFndPos -1 ) );
             rColArr.push_back( pNew );
         }
-        pNew = new _DB_Column;
+        pNew = new DB_Column;
         rColArr.push_back( pNew );
         nSttPos = nFndPos + 1;
     }
     if( nSttPos < rText.getLength() )
     {
-        pNew = new _DB_Column( rText.copy( nSttPos ) );
+        pNew = new DB_Column( rText.copy( nSttPos ) );
         rColArr.push_back( pNew );
     }
 }
 
 bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rText,
-                                _DB_Columns& rColArr,
+                                DB_Columns& rColArr,
                                 bool bInsField )
 {
     // create each of the database columns from the text again
@@ -900,7 +900,7 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rText,
                 // so surely the text "before":
                 const SwInsDBColumn& rFndCol = **it;
 
-                _DB_Column* pNew;
+                DB_Column* pNew;
 
                 if( 1 < nSttPos )
                 {
@@ -931,14 +931,14 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rText,
                     SwWrtShell& rSh = pView->GetWrtShell();
                     SwDBFieldType aFieldType( rSh.GetDoc(), aSrch.sColumn,
                                             aDBData );
-                    pNew = new _DB_Column( rFndCol, *new SwDBField(
+                    pNew = new DB_Column( rFndCol, *new SwDBField(
                             static_cast<SwDBFieldType*>(rSh.InsertFieldType( aFieldType )),
                                                             nFormat ) );
                     if( nSubType )
                         pNew->DB_ColumnData.pField->SetSubType( nSubType );
                 }
                 else
-                    pNew = new _DB_Column( rFndCol, nFormat );
+                    pNew = new DB_Column( rFndCol, nFormat );
 
                 rColArr.push_back( pNew );
             }
@@ -1185,7 +1185,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
     }
     else                            // add data as fields/text
     {
-        _DB_Columns aColArr;
+        DB_Columns aColArr;
         if( SplitTextToColArr( m_pEdDbText->GetText(), aColArr, m_pRbAsField->IsChecked() ) )
         {
             // now for each data set, we can iterate over the array
@@ -1276,15 +1276,15 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
 
                 for( size_t n = 0; n < nCols; ++n )
                 {
-                    _DB_Column* pDBCol = &aColArr[ n ];
+                    DB_Column* pDBCol = &aColArr[ n ];
                     OUString sIns;
                     switch( pDBCol->eColType )
                     {
-                    case _DB_Column::DB_FILLTEXT:
+                    case DB_Column::DB_FILLTEXT:
                         sIns =  *pDBCol->DB_ColumnData.pText;
                         break;
 
-                    case _DB_Column::DB_SPLITPARA:
+                    case DB_Column::DB_SPLITPARA:
                         rSh.SplitNode();
                         // when the template is not the same as the follow template,
                         // the selected has to be set newly
@@ -1292,7 +1292,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
                             rSh.SetTextFormatColl( pColl );
                         break;
 
-                    case _DB_Column::DB_COL_FIELD:
+                    case DB_Column::DB_COL_FIELD:
                         {
                             std::unique_ptr<SwDBField> pField(static_cast<SwDBField *>(
                                 pDBCol->DB_ColumnData.pField->CopyField()));
@@ -1329,7 +1329,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
                         }
                         break;
 
-                    case _DB_Column::DB_COL_TEXT:
+                    case DB_Column::DB_COL_TEXT:
                         {
                             double nValue = DBL_MAX;
                             Reference< XPropertySet > xColumnProps;
@@ -1471,7 +1471,7 @@ void SwInsertDBColAutoPilot::SetTabSet()
     rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() );
 }
 
-_DB_ColumnConfigData::~_DB_ColumnConfigData() {}
+DB_ColumnConfigData::~DB_ColumnConfigData() {}
 
 static Sequence<OUString> lcl_createSourceNames(const OUString& rNodeName)
 {
@@ -1658,7 +1658,7 @@ void SwInsertDBColAutoPilot::Load()
         pDataSourceProps[2] >>= nCommandType;
         if(sSource.equals(aDBData.sDataSource) && sCommand.equals(aDBData.sCommand))
         {
-            std::unique_ptr<_DB_ColumnConfigData> pNewData(new _DB_ColumnConfigData);
+            std::unique_ptr<DB_ColumnConfigData> pNewData(new DB_ColumnConfigData);
             pNewData->sSource = sSource;
             pNewData->sTable = sCommand;
 
diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx
index ef41573..7f25de9 100644
--- a/sw/source/uibase/inc/dbinsdlg.hxx
+++ b/sw/source/uibase/inc/dbinsdlg.hxx
@@ -51,8 +51,8 @@ class SwTableAutoFormat;
 class SwView;
 class SfxItemSet;
 class SwTableRep;
-struct _DB_Column;
-typedef boost::ptr_vector<_DB_Column> _DB_Columns;
+struct DB_Column;
+typedef boost::ptr_vector<DB_Column> DB_Columns;
 
 struct SwInsDBColumn
 {
@@ -142,7 +142,7 @@ class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
     DECL_LINK_TYPED( DblClickHdl, ListBox&, void );
     DECL_LINK_TYPED( HeaderHdl, Button*, void );
 
-    bool SplitTextToColArr( const OUString& rText, _DB_Columns& rColArr, bool bInsField );
+    bool SplitTextToColArr( const OUString& rText, DB_Columns& rColArr, bool bInsField );
         using SfxModalDialog::Notify;
     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
     virtual void            ImplCommit() SAL_OVERRIDE;
commit 3bcb74175b959809d1dd85a4f6a9f636366b81c1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Oct 5 22:48:53 2015 +0200

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

diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 9b27a7c..90f6497 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -68,8 +68,8 @@ void SwLabRec::FillItem( SwLabItem& rItem ) const
 void SwLabDlg::_ReplaceGroup( const OUString &rMake )
 {
     // Remove old entries
-    pRecs->erase(pRecs->begin() + 1, pRecs->end());
-    aLabelsCfg.FillLabels(rMake, *pRecs);
+    m_pRecs->erase(m_pRecs->begin() + 1, m_pRecs->end());
+    aLabelsCfg.FillLabels(rMake, *m_pRecs);
     aLstGroup = rMake;
 }
 
@@ -96,7 +96,7 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet,
     , pDBManager(pDBManager_)
     , pPrtPage(0)
     , aTypeIds(50, 10)
-    , pRecs(new SwLabRecs())
+    , m_pRecs(new SwLabRecs)
     , m_bLabel(bLabel)
     , m_nFormatId(0)
     , m_nOptionsId(0)
@@ -131,16 +131,16 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet,
     }
     // Read user label from writer.cfg
     SwLabItem aItem(static_cast<const SwLabItem&>(rSet.Get( FN_LABEL )));
-    SwLabRec* pRec = new SwLabRec;
+    std::unique_ptr<SwLabRec> pRec(new SwLabRec);
     pRec->aMake = pRec->aType = SW_RESSTR( STR_CUSTOM );
     pRec->SetFromItem( aItem );
 
     bool bDouble = false;
 
-    for (size_t nRecPos = 0; nRecPos < pRecs->size(); ++nRecPos)
+    for (size_t nRecPos = 0; nRecPos < m_pRecs->size(); ++nRecPos)
     {
-        if (pRec->aMake == (*pRecs)[nRecPos].aMake &&
-            pRec->aType == (*pRecs)[nRecPos].aType)
+        if (pRec->aMake == (*m_pRecs)[nRecPos]->aMake &&
+            pRec->aType == (*m_pRecs)[nRecPos]->aType)
         {
             bDouble = true;
             break;
@@ -148,9 +148,7 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet,
     }
 
     if (!bDouble)
-        pRecs->insert( pRecs->begin(), pRec );
-    else
-        delete pRec;
+        m_pRecs->insert( m_pRecs->begin(), std::move(pRec));
 
     size_t nLstGroup = 0;
     const std::vector<OUString>& rMan = aLabelsCfg.GetManufacturers();
@@ -175,7 +173,7 @@ SwLabDlg::~SwLabDlg()
 
 void SwLabDlg::dispose()
 {
-    delete pRecs;
+    delete m_pRecs;
     pPrtPage.clear();
     SfxTabDialog::dispose();
 }
@@ -210,7 +208,7 @@ SwLabRec* SwLabDlg::GetRecord(const OUString &rRecName, bool bCont)
     const size_t nCount = Recs().size();
     for (size_t i = 0; i < nCount; ++i)
     {
-        pRec = &Recs()[i];
+        pRec = Recs()[i].get();
         if (pRec->aType != sCustom &&
             rRecName == pRec->aType && bCont == pRec->bCont)
         {
@@ -219,7 +217,7 @@ SwLabRec* SwLabDlg::GetRecord(const OUString &rRecName, bool bCont)
         }
     }
     if (!bFound)    // User defined
-        pRec = &Recs()[0];
+        pRec = Recs()[0].get();
 
     return pRec;
 }
@@ -388,14 +386,14 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl)
     //insert the entries into the sorted list box
     for ( size_t i = 0; i < nCount; ++i )
     {
-        const OUString aType ( GetParentSwLabDlg()->Recs()[i].aType );
+        const OUString aType(GetParentSwLabDlg()->Recs()[i]->aType);
         bool bInsert = false;
-        if ( GetParentSwLabDlg()->Recs()[i].aType == sCustom )
+        if (GetParentSwLabDlg()->Recs()[i]->aType == sCustom)
         {
             bInsert = true;
             m_pTypeBox->InsertEntry(aType );
         }
-        else if ( GetParentSwLabDlg()->Recs()[i].bCont == bCont )
+        else if (GetParentSwLabDlg()->Recs()[i]->bCont == bCont)
         {
             if ( m_pHiddenSortTypeBox->GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND )
             {
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index 7d721c2..48a4f21 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -509,7 +509,7 @@ void SwLabFormatPage::FillItem(SwLabItem& rItem)
     {
         rItem.aMake = rItem.aType = SW_RESSTR(STR_CUSTOM);
 
-        SwLabRec& rRec = GetParentSwLabDlg()->Recs()[0];
+        SwLabRec& rRec = *GetParentSwLabDlg()->Recs()[0];
         rItem.lHDist  = rRec.lHDist  = static_cast< long >(GETFLDVAL(*m_pHDistField ));
         rItem.lVDist  = rRec.lVDist  = static_cast< long >(GETFLDVAL(*m_pVDistField ));
         rItem.lWidth  = rRec.lWidth  = static_cast< long >(GETFLDVAL(*m_pWidthField ));
diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx
index e9197ab..a29ee6c 100644
--- a/sw/source/uibase/envelp/labelcfg.cxx
+++ b/sw/source/uibase/envelp/labelcfg.cxx
@@ -173,9 +173,9 @@ void SwLabelConfig::ImplCommit() {}
 
 void SwLabelConfig::Notify( const ::com::sun::star::uno::Sequence< OUString >& ) {}
 
-static SwLabRec* lcl_CreateSwLabRec(const OUString& rType, const OUString& rMeasure, const OUString& rManufacturer)
+static std::unique_ptr<SwLabRec> lcl_CreateSwLabRec(const OUString& rType, const OUString& rMeasure, const OUString& rManufacturer)
 {
-    SwLabRec* pNewRec = new SwLabRec;
+    std::unique_ptr<SwLabRec> pNewRec(new SwLabRec);
     pNewRec->aMake = rManufacturer;
     pNewRec->lPWidth = 0;
     pNewRec->lPHeight = 0;
diff --git a/sw/source/uibase/inc/label.hxx b/sw/source/uibase/inc/label.hxx
index bb23e44..d9ffa02 100644
--- a/sw/source/uibase/inc/label.hxx
+++ b/sw/source/uibase/inc/label.hxx
@@ -38,7 +38,7 @@ class SwLabDlg : public SfxTabDialog
     std::vector<sal_uInt16> aTypeIds;
     std::vector<OUString> aMakes;
 
-    SwLabRecs* pRecs;
+    SwLabRecs* m_pRecs;
     OUString   aLstGroup;
     OUString   m_sBusinessCardDlg;
     bool       m_bLabel;
@@ -61,8 +61,8 @@ public:
     SwLabRec*   GetRecord(const OUString &rRecName, bool bCont);
     void        GetLabItem(SwLabItem &rItem);
 
-          SwLabRecs &Recs()           { return *pRecs;   }
-    const SwLabRecs &Recs()     const { return *pRecs;   }
+          SwLabRecs &Recs()           { return *m_pRecs; }
+    const SwLabRecs &Recs()     const { return *m_pRecs; }
 
           std::vector<sal_uInt16> &TypeIds()       { return aTypeIds; }
     const std::vector<sal_uInt16> &TypeIds() const { return aTypeIds; }
diff --git a/sw/source/uibase/inc/labrec.hxx b/sw/source/uibase/inc/labrec.hxx
index 3e5f124..1a133ed 100644
--- a/sw/source/uibase/inc/labrec.hxx
+++ b/sw/source/uibase/inc/labrec.hxx
@@ -19,7 +19,9 @@
 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_LABREC_HXX
 #define INCLUDED_SW_SOURCE_UIBASE_INC_LABREC_HXX
 
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
+#include <vector>
+
 
 class SwLabItem;
 
@@ -46,7 +48,7 @@ public:
     bool        bCont;
 };
 
-typedef boost::ptr_vector<SwLabRec> SwLabRecs;
+typedef std::vector<std::unique_ptr<SwLabRec>> SwLabRecs;
 
 #endif
 
commit 89ed0427bdaa74efbde698b81ceb39b1be0c1e3d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Oct 5 22:39:30 2015 +0200

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

diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx
index ea78d64..6153634 100644
--- a/sw/source/uibase/inc/redlndlg.hxx
+++ b/sw/source/uibase/inc/redlndlg.hxx
@@ -30,7 +30,6 @@
 #include <sfx2/dispatch.hxx>
 #include <svx/ctredlin.hxx>
 #include <svx/postattr.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
 #include <o3tl/sorted_vector.hxx>
 
 #include <memory>
@@ -60,13 +59,13 @@ struct SwRedlineDataParent
 
 class SwRedlineDataParentSortArr : public o3tl::sorted_vector<SwRedlineDataParent*, o3tl::less_ptr_to<SwRedlineDataParent> > {};
 
-typedef boost::ptr_vector<SwRedlineDataChild> SwRedlineDataChildArr;
+typedef std::vector<std::unique_ptr<SwRedlineDataChild>> SwRedlineDataChildArr;
 
 class SW_DLLPUBLIC SwRedlineAcceptDlg
 {
     VclPtr<vcl::Window>     pParentDlg;
     std::vector<std::unique_ptr<SwRedlineDataParent>> m_RedlineParents;
-    SwRedlineDataChildArr   aRedlineChildren;
+    SwRedlineDataChildArr   m_RedlineChildren;
     SwRedlineDataParentSortArr aUsedSeqNo;
     VclPtr<SvxAcceptChgCtr>    aTabPagesCTRL;
     PopupMenu               aPopup;
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 0b143b2..322718f 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -235,7 +235,7 @@ void SwRedlineAcceptDlg::Init(sal_uInt16 nStart)
     else
     {
         pTable->Clear();
-        aRedlineChildren.clear();
+        m_RedlineChildren.clear();
         m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.end());
     }
 
@@ -504,13 +504,15 @@ sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild)
             if (pBackupData->pTLBChild)
                 pTable->RemoveEntry(pBackupData->pTLBChild);
 
-            for( SwRedlineDataChildArr::iterator it = aRedlineChildren.begin();
-                 it != aRedlineChildren.end(); ++it)
-                if (&*it == pBackupData)
+            for (SwRedlineDataChildArr::iterator it = m_RedlineChildren.begin();
+                 it != m_RedlineChildren.end(); ++it)
+            {
+                if (it->get() == pBackupData)
                 {
-                    aRedlineChildren.erase(it);
+                    m_RedlineChildren.erase(it);
                     break;
                 }
+            }
             pBackupData = pNext;
         }
         pParent->pNext = 0;
@@ -594,7 +596,7 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa
 
         SwRedlineDataChild* pRedlineChild = new SwRedlineDataChild;
         pRedlineChild->pChild = pRedlineData;
-        aRedlineChildren.push_back(pRedlineChild);
+        m_RedlineChildren.push_back(std::unique_ptr<SwRedlineDataChild>(pRedlineChild));
 
         if ( pLastRedlineChild )
             pLastRedlineChild->pNext = pRedlineChild;
@@ -674,9 +676,10 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
         {
             SwRedlineDataChild * pChildPtr =
                 const_cast<SwRedlineDataChild*>(m_RedlineParents[i]->pNext);
-            for( SwRedlineDataChildArr::iterator it = aRedlineChildren.begin();
-                 it != aRedlineChildren.end(); ++it)
-                if (&*it == pChildPtr)
+            for (SwRedlineDataChildArr::iterator it = m_RedlineChildren.begin();
+                 it != m_RedlineChildren.end(); ++it)
+            {
+                if (it->get() == pChildPtr)
                 {
                     sal_uInt16 nChildren = 0;
                     while (pChildPtr)
@@ -685,10 +688,11 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
                         nChildren++;
                     }
 
-                    aRedlineChildren.erase(it, it + nChildren);
+                    m_RedlineChildren.erase(it, it + nChildren);
                     bChildrenRemoved = true;
                     break;
                 }
+            }
         }
         SvTreeListEntry *const pEntry = m_RedlineParents[i]->pTLBParent;
         if (pEntry)
commit 68daf1e8ebf44af3f5bf86306e592f6d03a07dab
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Oct 5 22:32:50 2015 +0200

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

diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx
index db8128f..ea78d64 100644
--- a/sw/source/uibase/inc/redlndlg.hxx
+++ b/sw/source/uibase/inc/redlndlg.hxx
@@ -33,6 +33,9 @@
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <o3tl/sorted_vector.hxx>
 
+#include <memory>
+#include <vector>
+
 class SwChildWinWrapper;
 
 struct SwRedlineDataChild
@@ -62,8 +65,7 @@ typedef boost::ptr_vector<SwRedlineDataChild> SwRedlineDataChildArr;
 class SW_DLLPUBLIC SwRedlineAcceptDlg
 {
     VclPtr<vcl::Window>     pParentDlg;
-    boost::ptr_vector<SwRedlineDataParent>
-                            aRedlineParents;
+    std::vector<std::unique_ptr<SwRedlineDataParent>> m_RedlineParents;
     SwRedlineDataChildArr   aRedlineChildren;
     SwRedlineDataParentSortArr aUsedSeqNo;
     VclPtr<SvxAcceptChgCtr>    aTabPagesCTRL;
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index adc80f5..0b143b2 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -231,12 +231,12 @@ void SwRedlineAcceptDlg::Init(sal_uInt16 nStart)
     aUsedSeqNo.clear();
 
     if (nStart)
-        RemoveParents(nStart, aRedlineParents.size() - 1);
+        RemoveParents(nStart, m_RedlineParents.size() - 1);
     else
     {
         pTable->Clear();
         aRedlineChildren.clear();
-        aRedlineParents.erase(aRedlineParents.begin() + nStart, aRedlineParents.end());
+        m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.end());
     }
 
     // insert parents
@@ -400,21 +400,20 @@ void SwRedlineAcceptDlg::Activate()
     sal_uInt16 nCount = pSh->GetRedlineCount();
 
     // check the number of pointers
-    SwRedlineDataParent *pParent = 0;
     sal_uInt16 i;
 
     for ( i = 0; i < nCount; i++)
     {
         const SwRangeRedline& rRedln = pSh->GetRedline(i);
 
-        if (i >= aRedlineParents.size())
+        if (i >= m_RedlineParents.size())
         {
             // new entries have been appended
             Init(i);
             return;
         }
 
-        pParent = &aRedlineParents[i];
+        SwRedlineDataParent *const pParent = m_RedlineParents[i].get();
         if (&rRedln.GetRedlineData() != pParent->pData)
         {
             // Redline-Parents were inserted, changed or deleted
@@ -450,7 +449,7 @@ void SwRedlineAcceptDlg::Activate()
         }
     }
 
-    if (nCount != aRedlineParents.size())
+    if (nCount != m_RedlineParents.size())
     {
         // Redlines were deleted at the end
         Init(nCount);
@@ -461,7 +460,7 @@ void SwRedlineAcceptDlg::Activate()
     for (i = 0; i < nCount; i++)
     {
         const SwRangeRedline& rRedln = pSh->GetRedline(i);
-        pParent = &aRedlineParents[i];
+        SwRedlineDataParent *const pParent = m_RedlineParents[i].get();
 
         if(rRedln.GetComment() != pParent->sComment)
         {
@@ -490,7 +489,7 @@ sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild)
     SwView *pView   = ::GetActiveView();
     SwWrtShell* pSh = pView->GetWrtShellPtr();
     sal_uInt16 nAutoFormat = HasRedlineAutoFormat() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
-    SwRedlineDataParent *pParent = &aRedlineParents[nStart];
+    SwRedlineDataParent *const pParent = m_RedlineParents[nStart].get();
     const SwRangeRedline& rRedln = pSh->GetRedline(nStart);
 
     if (bChild)     // should actually never happen, but just in case...
@@ -525,10 +524,9 @@ sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild)
 
     // have entries been deleted?
     const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
-    sal_uInt16 i;
-    for ( i = nStart + 1; i < aRedlineParents.size(); i++)
+    for (sal_uInt16 i = nStart + 1; i < m_RedlineParents.size(); i++)
     {
-        if (aRedlineParents[i].pData == pRedlineData)
+        if (m_RedlineParents[i]->pData == pRedlineData)
         {
             // remove entries from nStart to i-1
             RemoveParents(nStart, i - 1);
@@ -539,9 +537,9 @@ sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild)
 
     // entries been inserted?
     sal_uInt16 nCount = pSh->GetRedlineCount();
-    pRedlineData = aRedlineParents[nStart].pData;
+    pRedlineData = m_RedlineParents[nStart]->pData;
 
-    for (i = nStart + 1; i < nCount; i++)
+    for (sal_uInt16 i = nStart + 1; i < nCount; i++)
     {
         if (&pSh->GetRedline(i).GetRedlineData() == pRedlineData)
         {
@@ -657,12 +655,12 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
 
     // set the cursor after the last entry because otherwise performance problem in TLB.
     // TLB would otherwise reset the cursor at every Remove (expensive)
-    sal_uInt16 nPos = std::min((sal_uInt16)nCount, (sal_uInt16)aRedlineParents.size());
+    sal_uInt16 nPos = std::min((sal_uInt16)nCount, (sal_uInt16)m_RedlineParents.size());
     SvTreeListEntry *pCurEntry = NULL;
     while( ( pCurEntry == NULL ) && ( nPos > 0 ) )
     {
         --nPos;
-        pCurEntry = aRedlineParents[nPos].pTLBParent;
+        pCurEntry = m_RedlineParents[nPos]->pTLBParent;
     }
 
     if (pCurEntry)
@@ -672,9 +670,10 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
 
     for (sal_uInt16 i = nStart; i <= nEnd; i++)
     {
-        if (!bChildrenRemoved && aRedlineParents[i].pNext)
+        if (!bChildrenRemoved && m_RedlineParents[i]->pNext)
         {
-            SwRedlineDataChild* pChildPtr = const_cast<SwRedlineDataChild*>(aRedlineParents[i].pNext);
+            SwRedlineDataChild * pChildPtr =
+                const_cast<SwRedlineDataChild*>(m_RedlineParents[i]->pNext);
             for( SwRedlineDataChildArr::iterator it = aRedlineChildren.begin();
                  it != aRedlineChildren.end(); ++it)
                 if (&*it == pChildPtr)
@@ -691,7 +690,7 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
                     break;
                 }
         }
-        SvTreeListEntry *pEntry = aRedlineParents[i].pTLBParent;
+        SvTreeListEntry *const pEntry = m_RedlineParents[i]->pTLBParent;
         if (pEntry)
         {
             long nIdx = aLBoxArr.size() - 1L;
@@ -713,7 +712,7 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
     // unfortunately by Remove it was selected from the TLB always again ...
     pTable->SelectAll(false);
 
-    aRedlineParents.erase( aRedlineParents.begin() + nStart, aRedlineParents.begin() + nEnd + 1);
+    m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.begin() + nEnd + 1);
 }
 
 void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)
@@ -756,7 +755,8 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)
         pRedlineParent->pNext    = 0;
         OUString sComment(rRedln.GetComment());
         pRedlineParent->sComment = sComment.replace('\n', ' ');
-        aRedlineParents.insert(aRedlineParents.begin() + i, pRedlineParent);
+        m_RedlineParents.insert(m_RedlineParents.begin() + i,
+                std::unique_ptr<SwRedlineDataParent>(pRedlineParent));
 
         RedlinData *pData = new RedlinData;
         pData->pData = pRedlineParent;
commit b6b3251683d5a3bfbf038127f8bd226e23698bce
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Oct 5 21:44:48 2015 +0200

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

diff --git a/sw/source/uibase/cctrl/swlbox.cxx b/sw/source/uibase/cctrl/swlbox.cxx
index b17e28a..7d04816 100644
--- a/sw/source/uibase/cctrl/swlbox.cxx
+++ b/sw/source/uibase/cctrl/swlbox.cxx
@@ -58,8 +58,7 @@ void SwComboBox::Init()
     sal_Int32 nSize = GetEntryCount();
     for( sal_Int32 i=0; i < nSize; ++i )
     {
-        SwBoxEntry* pTmp = new SwBoxEntry(ComboBox::GetEntry(i), i);
-        aEntryLst.push_back(pTmp);
+        m_EntryList.push_back(SwBoxEntry(ComboBox::GetEntry(i), i));
     }
 }
 
@@ -70,7 +69,7 @@ SwComboBox::~SwComboBox()
 
 void SwComboBox::InsertSwEntry(const SwBoxEntry& rEntry)
 {
-    InsertSorted(new SwBoxEntry(rEntry));
+    InsertSorted(rEntry);
 }
 
 sal_Int32 SwComboBox::InsertEntry(const OUString& rStr, sal_Int32)
@@ -81,23 +80,23 @@ sal_Int32 SwComboBox::InsertEntry(const OUString& rStr, sal_Int32)
 
 void SwComboBox::RemoveEntryAt(sal_Int32 const nPos)
 {
-    if(nPos < 0 || static_cast<size_t>(nPos) >= aEntryLst.size())
+    if (nPos < 0 || static_cast<size_t>(nPos) >= m_EntryList.size())
         return;
 
     // Remove old element
-    SwBoxEntry* pEntry = &aEntryLst[nPos];
+    SwBoxEntry const& rEntry = m_EntryList[nPos];
     ComboBox::RemoveEntryAt(nPos);
 
     // Don't add new entries to the list
-    if(pEntry->bNew)
+    if (rEntry.bNew)
     {
-        aEntryLst.erase(aEntryLst.begin() + nPos);
+        m_EntryList.erase(m_EntryList.begin() + nPos);
     }
     else
     {
         // add to DelEntryLst
-        aDelEntryLst.transfer(aDelEntryLst.end(),
-                aEntryLst.begin() + nPos, aEntryLst);
+        m_DelEntryList.push_back(m_EntryList[nPos]);
+        m_EntryList.erase(m_EntryList.begin() + nPos);
     }
 }
 
@@ -108,30 +107,30 @@ sal_Int32 SwComboBox::GetSwEntryPos(const SwBoxEntry& rEntry) const
 
 const SwBoxEntry& SwComboBox::GetSwEntry(sal_Int32 const nPos) const
 {
-    if(0 <= nPos && static_cast<size_t>(nPos) < aEntryLst.size())
-        return aEntryLst[nPos];
+    if (0 <= nPos && static_cast<size_t>(nPos) < m_EntryList.size())
+        return m_EntryList[nPos];
 
     return aDefault;
 }
 
 sal_Int32 SwComboBox::GetRemovedCount() const
 {
-    return static_cast<sal_Int32>(aDelEntryLst.size());
+    return static_cast<sal_Int32>(m_DelEntryList.size());
 }
 
 const SwBoxEntry& SwComboBox::GetRemovedEntry(sal_Int32 nPos) const
 {
-    if(0 <= nPos && static_cast<size_t>(nPos) < aDelEntryLst.size())
-        return aDelEntryLst[nPos];
+    if (0 <= nPos && static_cast<size_t>(nPos) < m_DelEntryList.size())
+        return m_DelEntryList[nPos];
 
     return aDefault;
 }
 
-void SwComboBox::InsertSorted(SwBoxEntry* pEntry)
+void SwComboBox::InsertSorted(SwBoxEntry const& rEntry)
 {
-    ComboBox::InsertEntry(pEntry->aName);
-    sal_Int32 nPos = ComboBox::GetEntryPos(pEntry->aName);
-    aEntryLst.insert( aEntryLst.begin() + nPos, pEntry );
+    ComboBox::InsertEntry(rEntry.aName);
+    sal_Int32 nPos = ComboBox::GetEntryPos(rEntry.aName);
+    m_EntryList.insert(m_EntryList.begin() + nPos, rEntry);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/swlbox.hxx b/sw/source/uibase/inc/swlbox.hxx
index a845479..d07472f 100644
--- a/sw/source/uibase/inc/swlbox.hxx
+++ b/sw/source/uibase/inc/swlbox.hxx
@@ -22,12 +22,13 @@
 #include <vcl/lstbox.hxx>
 #include <vcl/combobox.hxx>
 #include "swdllapi.h"
-#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <vector>
 
 class SwBoxEntry;
 namespace vcl { class Window; }
 
-typedef boost::ptr_vector<SwBoxEntry> SwEntryLst;
+typedef std::vector<SwBoxEntry> SwEntryList;
 
 class SW_DLLPUBLIC SwBoxEntry
 {
@@ -50,11 +51,11 @@ public:
 // for combo boxes
 class SW_DLLPUBLIC SwComboBox : public ComboBox
 {
-    SwEntryLst              aEntryLst;
-    SwEntryLst              aDelEntryLst;
+    SwEntryList             m_EntryList;
+    SwEntryList             m_DelEntryList;
     SwBoxEntry              aDefault;
 
-    SAL_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry);
+    SAL_DLLPRIVATE void InsertSorted(SwBoxEntry const& rEntry);
     SAL_DLLPRIVATE void Init();
 
 public:
commit 63b0a1fe18ac38cded0774a0119c2aea4ff01593
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Oct 5 21:37:51 2015 +0200

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

diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index ac8ce7a..427c085 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -190,7 +190,7 @@ void SwNumRulesWithName::SetNumFormat(
     aFormats[nIndex] = new _SwNumFormatGlobal(rNumFormat);
     aFormats[nIndex]->sCharFormatName = rName;
     aFormats[nIndex]->nCharPoolId = USHRT_MAX;
-    aFormats[nIndex]->aItems.clear();
+    aFormats[nIndex]->m_Items.clear();
 }
 
 SwNumRulesWithName::_SwNumFormatGlobal::_SwNumFormatGlobal( const SwNumFormat& rFormat )
@@ -209,7 +209,7 @@ SwNumRulesWithName::_SwNumFormatGlobal::_SwNumFormatGlobal( const SwNumFormat& r
             const SfxPoolItem *pCurr = aIter.GetCurItem();
             while( true )
             {
-                aItems.push_back( pCurr->Clone() );
+                m_Items.push_back(std::unique_ptr<SfxPoolItem>(pCurr->Clone()));
                 if( aIter.IsAtEnd() )
                     break;
                 pCurr = aIter.NextItem();
@@ -226,8 +226,10 @@ SwNumRulesWithName::_SwNumFormatGlobal::_SwNumFormatGlobal( const _SwNumFormatGl
     sCharFormatName( rFormat.sCharFormatName ),
     nCharPoolId( rFormat.nCharPoolId )
 {
-    for( sal_uInt16 n = rFormat.aItems.size(); n; )
-        aItems.push_back( rFormat.aItems[ --n ].Clone() );
+    for (size_t n = rFormat.m_Items.size(); n; )
+    {
+        m_Items.push_back(std::unique_ptr<SfxPoolItem>(rFormat.m_Items[ --n ]->Clone()));
+    }
 }
 
 SwNumRulesWithName::_SwNumFormatGlobal::~_SwNumFormatGlobal()
@@ -262,8 +264,12 @@ void SwNumRulesWithName::_SwNumFormatGlobal::ChgNumFormat( SwWrtShell& rSh,
                 pFormat = rSh.GetCharFormatFromPool( nCharPoolId );
 
             if( !pFormat->HasWriterListeners() )       // set attributes
-                for( sal_uInt16 n = aItems.size(); n; )
-                    pFormat->SetFormatAttr( aItems[ --n ] );
+            {
+                for (size_t n = m_Items.size(); n; )
+                {
+                    pFormat->SetFormatAttr( *m_Items[ --n ] );
+                }
+            }
         }
     }
     const_cast<SwNumFormat&>(aFormat).SetCharFormat( pFormat );
diff --git a/sw/source/uibase/inc/uinums.hxx b/sw/source/uibase/inc/uinums.hxx
index b6205c0..e03e033 100644
--- a/sw/source/uibase/inc/uinums.hxx
+++ b/sw/source/uibase/inc/uinums.hxx
@@ -21,7 +21,9 @@
 
 #include <numrule.hxx>
 #include "swdllapi.h"
-#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <memory>
+#include <vector>
 
 class SfxPoolItem;
 class SwWrtShell;
@@ -42,7 +44,7 @@ class SW_DLLPUBLIC SwNumRulesWithName
         SwNumFormat aFormat;
         OUString sCharFormatName;
         sal_uInt16 nCharPoolId;
-        boost::ptr_vector<SfxPoolItem> aItems;
+        std::vector<std::unique_ptr<SfxPoolItem>> m_Items;
 
         _SwNumFormatGlobal& operator=( const _SwNumFormatGlobal& ) SAL_DELETED_FUNCTION;
 


More information about the Libreoffice-commits mailing list