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

Michael Stahl mstahl at redhat.com
Tue Nov 10 12:50:31 PST 2015


 sw/source/filter/html/htmltab.cxx |  181 +++++++++++++++++++-------------------
 sw/source/filter/html/svxcss1.cxx |   14 +-
 sw/source/filter/html/svxcss1.hxx |    7 -
 3 files changed, 105 insertions(+), 97 deletions(-)

New commits:
commit 35854bc3ade4875f801da907d69b168b97a56101
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 10 21:24:08 2015 +0100

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

diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 987340c..5e1fc09 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -57,8 +57,6 @@
 #include "swcss1.hxx"
 #include <numrule.hxx>
 
-#include <boost/ptr_container/ptr_vector.hpp>
-
 #define NETSCAPE_DFLT_BORDER 1
 #define NETSCAPE_DFLT_CELLSPACING 2
 
@@ -362,7 +360,7 @@ public:
 // HTML table
 typedef std::vector<std::unique_ptr<HTMLTableRow>> HTMLTableRows;
 
-typedef boost::ptr_vector<HTMLTableColumn> HTMLTableColumns;
+typedef std::vector<std::unique_ptr<HTMLTableColumn>> HTMLTableColumns;
 
 typedef std::vector<SdrObject *> SdrObjects;
 
@@ -377,7 +375,7 @@ class HTMLTable
     std::vector<sal_uInt16> *pDrawObjPrcWidths;   // column of draw object and its rel. width
 
     HTMLTableRows *m_pRows;         ///< table rows
-    HTMLTableColumns *pColumns;     // table columns
+    HTMLTableColumns *m_pColumns;   ///< table columns
 
     sal_uInt16 nRows;                   // number of rows
     sal_uInt16 nCols;                   // number of columns
@@ -929,7 +927,7 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions )
     pDrawObjPrcWidths = nullptr;
 
     m_pRows = new HTMLTableRows;
-    pColumns = new HTMLTableColumns;
+    m_pColumns = new HTMLTableColumns;
     nRows = 0;
     nCurRow = 0; nCurCol = 0;
 
@@ -1080,7 +1078,7 @@ HTMLTable::HTMLTable( SwHTMLParser* pPars, HTMLTable *pTopTab,
     InitCtor( pOptions );
 
     for( sal_uInt16 i=0; i<nCols; i++ )
-        pColumns->push_back( new HTMLTableColumn );
+        m_pColumns->push_back(o3tl::make_unique<HTMLTableColumn>());
 }
 
 HTMLTable::~HTMLTable()
@@ -1089,7 +1087,7 @@ HTMLTable::~HTMLTable()
     delete pDrawObjPrcWidths;
 
     delete m_pRows;
-    delete pColumns;
+    delete m_pColumns;
     delete pBGBrush;
     delete pInhBGBrush;
 
@@ -1105,7 +1103,7 @@ SwHTMLTableLayout *HTMLTable::CreateLayoutInfo()
 
     sal_uInt16 nBorderWidth = GetBorderWidth( aBorderLine, true );
     sal_uInt16 nLeftBorderWidth =
-        ((*pColumns)[0]).bLeftBorder ? GetBorderWidth( aLeftBorderLine, true ) : 0;
+        (*m_pColumns)[0]->bLeftBorder ? GetBorderWidth(aLeftBorderLine, true) : 0;
     sal_uInt16 nRightBorderWidth =
         bRightBorder ? GetBorderWidth( aRightBorderLine, true ) : 0;
     sal_uInt16 nInhLeftBorderWidth = 0;
@@ -1146,7 +1144,7 @@ SwHTMLTableLayout *HTMLTable::CreateLayoutInfo()
     pLayoutInfo->SetExportable( bExportable );
 
     for( i=0; i<nCols; i++ )
-        pLayoutInfo->SetColumn( ((*pColumns)[i]).CreateLayoutInfo(), i );
+        pLayoutInfo->SetColumn( ((*m_pColumns)[i])->CreateLayoutInfo(), i );
 
     return pLayoutInfo;
 }
@@ -1345,7 +1343,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
     sal_uInt32 nNumFormat = 0;
     double nValue = 0.0;
 
-    HTMLTableColumn *pColumn = &(*pColumns)[nCol];
+    HTMLTableColumn *const pColumn = (*m_pColumns)[nCol].get();
 
     if( pBox->GetSttNd() )
     {
@@ -1450,7 +1448,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
                 }
                 bSet = true;
             }
-            if( ((*pColumns)[nCol]).bLeftBorder )
+            if (((*m_pColumns)[nCol])->bLeftBorder)
             {
                 const SvxBorderLine& rBorderLine =
                     0==nCol ? aLeftBorderLine : aBorderLine;
@@ -1934,7 +1932,7 @@ void HTMLTable::InheritVertBorders( const HTMLTable *pParent,
             GetBorderWidth( aInhRightBorderLine, true ) + MIN_BORDER_DIST;
     }
 
-    if( ((*pParent->pColumns)[nCol]).bLeftBorder )
+    if (((*pParent->m_pColumns)[nCol])->bLeftBorder)
     {
         bInhLeftBorder = true;  // erstmal nur merken
         aInhLeftBorderLine = 0==nCol ? pParent->aLeftBorderLine
@@ -1952,7 +1950,7 @@ void HTMLTable::InheritVertBorders( const HTMLTable *pParent,
 
     bRightAlwd = ( pParent->bRightAlwd &&
                   (nCol+nColSpan==pParent->nCols ||
-                   !((*pParent->pColumns)[nCol+nColSpan]).bLeftBorder) );
+                   !((*pParent->m_pColumns)[nCol+nColSpan])->bLeftBorder) );
 }
 
 void HTMLTable::SetBorders()
@@ -1961,8 +1959,10 @@ void HTMLTable::SetBorders()
     for( i=1; i<nCols; i++ )
         if( HTML_TR_ALL==eRules || HTML_TR_COLS==eRules ||
             ((HTML_TR_ROWS==eRules || HTML_TR_GROUPS==eRules) &&
-             ((*pColumns)[i-1]).IsEndOfGroup()) )
-            ((*pColumns)[i]).bLeftBorder = true;
+             ((*m_pColumns)[i-1])->IsEndOfGroup()))
+        {
+            ((*m_pColumns)[i])->bLeftBorder = true;
+        }
 
     for( i=0; i<nRows-1; i++ )
         if( HTML_TR_ALL==eRules || HTML_TR_ROWS==eRules ||
@@ -1984,7 +1984,9 @@ void HTMLTable::SetBorders()
                       HTML_TF_BOX==eFrame) )
         bRightBorder = true;
     if( HTML_TF_LHS==eFrame || HTML_TF_VSIDES==eFrame || HTML_TF_BOX==eFrame )
-        ((*pColumns)[0]).bLeftBorder = true;
+    {
+        ((*m_pColumns)[0])->bLeftBorder = true;
+    }
 
     for( i=0; i<nRows; i++ )
     {
@@ -2042,7 +2044,7 @@ inline HTMLTableCell *HTMLTable::GetCell( sal_uInt16 nRow,
 
 SvxAdjust HTMLTable::GetInheritedAdjust() const
 {
-    SvxAdjust eAdjust = (nCurCol<nCols ? ((*pColumns)[nCurCol]).GetAdjust()
+    SvxAdjust eAdjust = (nCurCol<nCols ? ((*m_pColumns)[nCurCol])->GetAdjust()
                                        : SVX_ADJUST_END );
     if( SVX_ADJUST_END==eAdjust )
         eAdjust = (*m_pRows)[nCurRow]->GetAdjust();
@@ -2055,7 +2057,7 @@ sal_Int16 HTMLTable::GetInheritedVertOri() const
     // text::VertOrientation::TOP ist der default!
     sal_Int16 eVOri = (*m_pRows)[nCurRow]->GetVertOri();
     if( text::VertOrientation::TOP==eVOri && nCurCol<nCols )
-        eVOri = ((*pColumns)[nCurCol]).GetVertOri();
+        eVOri = ((*m_pColumns)[nCurCol])->GetVertOri();
     if( text::VertOrientation::TOP==eVOri )
         eVOri = eVertOri;
 
@@ -2086,11 +2088,11 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
     if( nCols < nColsReq )
     {
         for( i=nCols; i<nColsReq; i++ )
-            pColumns->push_back( new HTMLTableColumn );
+            m_pColumns->push_back(o3tl::make_unique<HTMLTableColumn>());
         for( i=0; i<nRows; i++ )
             (*m_pRows)[i]->Expand( nColsReq, i<nCurRow );
         nCols = nColsReq;
-        OSL_ENSURE(pColumns->size() == nCols,
+        OSL_ENSURE(m_pColumns->size() == nCols,
                 "wrong number of columns after expanding");
     }
     if( nColsReq > nFilledCols )
@@ -2266,7 +2268,7 @@ inline void HTMLTable::CloseColGroup( sal_uInt16 nSpan, sal_uInt16 _nWidth,
 
     OSL_ENSURE( nCurCol<=nCols, "ungueltige Spalte" );
     if( nCurCol>0 && nCurCol<=nCols )
-        ((*pColumns)[nCurCol-1]).SetEndOfGroup();
+        ((*m_pColumns)[nCurCol-1])->SetEndOfGroup();
 }
 
 void HTMLTable::InsertCol( sal_uInt16 nSpan, sal_uInt16 nColWidth, bool bRelWidth,
@@ -2286,7 +2288,7 @@ void HTMLTable::InsertCol( sal_uInt16 nSpan, sal_uInt16 nColWidth, bool bRelWidt
     if( nCols < nColsReq )
     {
         for( i=nCols; i<nColsReq; i++ )
-            pColumns->push_back( new HTMLTableColumn );
+            m_pColumns->push_back(o3tl::make_unique<HTMLTableColumn>());
         nCols = nColsReq;
     }
 
@@ -2299,7 +2301,7 @@ void HTMLTable::InsertCol( sal_uInt16 nSpan, sal_uInt16 nColWidth, bool bRelWidt
 
     for( i=nCurCol; i<nColsReq; i++ )
     {
-        HTMLTableColumn *pCol = &(*pColumns)[i];
+        HTMLTableColumn *const pCol = (*m_pColumns)[i].get();
         sal_uInt16 nTmp = bRelWidth ? nColWidth : (sal_uInt16)aTwipSz.Width();
         pCol->SetWidth( nTmp, bRelWidth );
         pCol->SetAdjust( eAdjust );
@@ -2338,7 +2340,7 @@ void HTMLTable::CloseTable()
     // falls die Tabelle keine Spalte hat, muessen wir eine hinzufuegen
     if( 0==nCols )
     {
-        pColumns->push_back( new HTMLTableColumn );
+        m_pColumns->push_back(o3tl::make_unique<HTMLTableColumn>());
         for( i=0; i<nRows; i++ )
             (*m_pRows)[i]->Expand(1);
         nCols = 1;
@@ -2355,7 +2357,7 @@ void HTMLTable::CloseTable()
 
     if( nFilledCols < nCols )
     {
-        pColumns->erase( pColumns->begin() + nFilledCols, pColumns->begin() + nCols );
+        m_pColumns->erase(m_pColumns->begin() + nFilledCols, m_pColumns->begin() + nCols);
         for( i=0; i<nRows; i++ )
             (*m_pRows)[i]->Shrink( nFilledCols );
         nCols = nFilledCols;
@@ -2462,11 +2464,11 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
         }
 
         if( pLayoutInfo->GetRelLeftFill() == 0 &&
-            !((*pColumns)[0]).bLeftBorder &&
+            !((*m_pColumns)[0])->bLeftBorder &&
             bInhLeftBorder )
         {
             // ggf. rechte Umrandung von auesserer Tabelle uebernehmen
-            ((*pColumns)[0]).bLeftBorder = true;
+            ((*m_pColumns)[0])->bLeftBorder = true;
             aLeftBorderLine = aInhLeftBorderLine;
         }
     }
commit 000b2521df063dd3d7072242b803a374eeef6b58
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 10 21:19:53 2015 +0100

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

diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 4074b07..987340c 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -360,7 +360,7 @@ public:
 };
 
 // HTML table
-typedef boost::ptr_vector<HTMLTableRow> HTMLTableRows;
+typedef std::vector<std::unique_ptr<HTMLTableRow>> HTMLTableRows;
 
 typedef boost::ptr_vector<HTMLTableColumn> HTMLTableColumns;
 
@@ -376,7 +376,7 @@ class HTMLTable
     SdrObjects *pResizeDrawObjs;// SDR objects
     std::vector<sal_uInt16> *pDrawObjPrcWidths;   // column of draw object and its rel. width
 
-    HTMLTableRows *pRows;           // table rows
+    HTMLTableRows *m_pRows;         ///< table rows
     HTMLTableColumns *pColumns;     // table columns
 
     sal_uInt16 nRows;                   // number of rows
@@ -928,7 +928,7 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions )
     pResizeDrawObjs = nullptr;
     pDrawObjPrcWidths = nullptr;
 
-    pRows = new HTMLTableRows;
+    m_pRows = new HTMLTableRows;
     pColumns = new HTMLTableColumns;
     nRows = 0;
     nCurRow = 0; nCurCol = 0;
@@ -1088,7 +1088,7 @@ HTMLTable::~HTMLTable()
     delete pResizeDrawObjs;
     delete pDrawObjPrcWidths;
 
-    delete pRows;
+    delete m_pRows;
     delete pColumns;
     delete pBGBrush;
     delete pInhBGBrush;
@@ -1124,7 +1124,7 @@ SwHTMLTableLayout *HTMLTable::CreateLayoutInfo()
     sal_uInt16 i;
     for( i=0; i<nRows; i++ )
     {
-        HTMLTableRow *pRow = &(*pRows)[i];
+        HTMLTableRow *const pRow = (*m_pRows)[i].get();
         for( sal_uInt16 j=0; j<nCols; j++ )
         {
             SwHTMLTableLayoutCell *pLayoutCell =
@@ -1202,7 +1202,7 @@ const SwStartNode* HTMLTable::GetPrevBoxStartNode( sal_uInt16 nRow, sal_uInt16 n
     else
     {
         sal_uInt16 i;
-        HTMLTableRow *pPrevRow = &(*pRows)[nRow-1];
+        HTMLTableRow *const pPrevRow = (*m_pRows)[nRow-1].get();
 
         // evtl. eine Zelle in der aktuellen Zeile
         i = nCol;
@@ -1273,7 +1273,7 @@ sal_uInt16 HTMLTable::GetTopCellSpace( sal_uInt16 nRow, sal_uInt16 nRowSpan,
                 nSpace = nTopBorderWidth;
         }
     }
-    else if( bSwBorders && (*pRows)[nRow+nRowSpan-1].bBottomBorder &&
+    else if (bSwBorders && (*m_pRows)[nRow+nRowSpan-1]->bBottomBorder &&
              nSpace < MIN_BORDER_DIST )
     {
         OSL_ENSURE( !nCellPadding, "GetTopCellSpace: CELLPADDING!=0" );
@@ -1306,7 +1306,7 @@ sal_uInt16 HTMLTable::GetBottomCellSpace( sal_uInt16 nRow, sal_uInt16 nRowSpan,
     }
     else if( bSwBorders )
     {
-        if( (*pRows)[nRow+nRowSpan+1].bBottomBorder )
+        if ((*m_pRows)[nRow+nRowSpan+1]->bBottomBorder)
         {
             sal_uInt16 nBorderWidth = GetBorderWidth( aBorderLine, true );
             if( nSpace < nBorderWidth )
@@ -1364,7 +1364,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
             // die Line von der GC (zu Recht) wegoptimiert wird.
             if( nRowSpan > 1 || (this != pTopTable && nRowSpan==nRows) )
             {
-                pBGBrushItem = (*pRows)[nRow].GetBGBrush();
+                pBGBrushItem = (*m_pRows)[nRow]->GetBGBrush();
                 if( !pBGBrushItem && this != pTopTable )
                 {
                     pBGBrushItem = GetBGBrush();
@@ -1375,9 +1375,9 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
         }
 
         bTopLine = 0==nRow && bTopBorder && bFirstPara;
-        if( (*pRows)[nRow+nRowSpan-1].bBottomBorder && bLastPara )
+        if ((*m_pRows)[nRow+nRowSpan-1]->bBottomBorder && bLastPara)
         {
-            nEmptyRows = (*pRows)[nRow+nRowSpan-1].GetEmptyRows();
+            nEmptyRows = (*m_pRows)[nRow+nRowSpan-1]->GetEmptyRows();
             if( nRow+nRowSpan == nRows )
                 bLastBottomLine = true;
             else
@@ -1638,7 +1638,7 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
                                                      : pLineFormat,
                                  0, pUpper );
 
-    HTMLTableRow *pTopRow = &(*pRows)[nTopRow];
+    HTMLTableRow *pTopRow = (*m_pRows)[nTopRow].get();
     sal_uInt16 nRowHeight = pTopRow->GetHeight();
     const SvxBrushItem *pBGBrushItem = nullptr;
     if( this == pTopTable || nTopRow>0 || nBottomRow<nRows )
@@ -1884,9 +1884,9 @@ void HTMLTable::InheritBorders( const HTMLTable *pParent,
         bFillerTopBorder = true; // auch Filler bekommt eine Umrandung
         aTopBorderLine = pParent->aTopBorderLine;
     }
-    if( (*pParent->pRows)[nRow+nRowSpan-1].bBottomBorder && bLastPara )
+    if ((*pParent->m_pRows)[nRow+nRowSpan-1]->bBottomBorder && bLastPara)
     {
-        (*pRows)[nRows-1].bBottomBorder = true;
+        (*m_pRows)[nRows-1]->bBottomBorder = true;
         bFillerBottomBorder = true; // auch Filler bekommt eine Umrandung
         aBottomBorderLine =
             nRow+nRowSpan==pParent->nRows ? pParent->aBottomBorderLine
@@ -1898,7 +1898,7 @@ void HTMLTable::InheritBorders( const HTMLTable *pParent,
     // Sie darf jedoch immer einen oberen Rand bekommen, wenn die Tabelle
     // nicht der erste Absatz in der Zelle ist.
     bTopAlwd = ( !bFirstPara || (pParent->bTopAlwd &&
-                 (0==nRow || !((*pParent->pRows)[nRow-1]).bBottomBorder)) );
+                 (0==nRow || !((*pParent->m_pRows)[nRow-1])->bBottomBorder)) );
 
     // die Child-Tabelle muss die Farbe der Zelle erben, in der sie
     // vorkommt, wenn sie keine eigene besitzt
@@ -1910,7 +1910,7 @@ void HTMLTable::InheritBorders( const HTMLTable *pParent,
         // und besteht nur aus einer Line, die bei der GC (zu Recht)
         // wegoptimiert wird. Deshalb muss der Hintergrund der Line in
         // diese Tabelle uebernommen werden.
-        pInhBG = (*pParent->pRows)[nRow].GetBGBrush();
+        pInhBG = (*pParent->m_pRows)[nRow]->GetBGBrush();
         if( !pInhBG )
             pInhBG = pParent->GetBGBrush();
         if( !pInhBG )
@@ -1967,15 +1967,19 @@ void HTMLTable::SetBorders()
     for( i=0; i<nRows-1; i++ )
         if( HTML_TR_ALL==eRules || HTML_TR_ROWS==eRules ||
             ((HTML_TR_COLS==eRules || HTML_TR_GROUPS==eRules) &&
-             (*pRows)[i].IsEndOfGroup()) )
-            (*pRows)[i].bBottomBorder = true;
+             (*m_pRows)[i]->IsEndOfGroup()))
+        {
+            (*m_pRows)[i]->bBottomBorder = true;
+        }
 
     if( bTopAlwd && (HTML_TF_ABOVE==eFrame || HTML_TF_HSIDES==eFrame ||
                      HTML_TF_BOX==eFrame) )
         bTopBorder = true;
     if( HTML_TF_BELOW==eFrame || HTML_TF_HSIDES==eFrame ||
         HTML_TF_BOX==eFrame )
-        (*pRows)[nRows-1].bBottomBorder = true;
+    {
+        (*m_pRows)[nRows-1]->bBottomBorder = true;
+    }
     if( (HTML_TF_RHS==eFrame || HTML_TF_VSIDES==eFrame ||
                       HTML_TF_BOX==eFrame) )
         bRightBorder = true;
@@ -1984,7 +1988,7 @@ void HTMLTable::SetBorders()
 
     for( i=0; i<nRows; i++ )
     {
-        HTMLTableRow *pRow = &(*pRows)[i];
+        HTMLTableRow *const pRow = (*m_pRows)[i].get();
         for( sal_uInt16 j=0; j<nCols; j++ )
         {
             HTMLTableCell *pCell = pRow->GetCell(j);
@@ -2032,8 +2036,8 @@ sal_uInt16 HTMLTable::GetBorderWidth( const SvxBorderLine& rBLine,
 inline HTMLTableCell *HTMLTable::GetCell( sal_uInt16 nRow,
                                           sal_uInt16 nCell ) const
 {
-    OSL_ENSURE(nRow < pRows->size(), "invalid row index in HTML table");
-    return (*pRows)[nRow].GetCell( nCell );
+    OSL_ENSURE(nRow < m_pRows->size(), "invalid row index in HTML table");
+    return (*m_pRows)[nRow]->GetCell( nCell );
 }
 
 SvxAdjust HTMLTable::GetInheritedAdjust() const
@@ -2041,7 +2045,7 @@ SvxAdjust HTMLTable::GetInheritedAdjust() const
     SvxAdjust eAdjust = (nCurCol<nCols ? ((*pColumns)[nCurCol]).GetAdjust()
                                        : SVX_ADJUST_END );
     if( SVX_ADJUST_END==eAdjust )
-        eAdjust = (*pRows)[nCurRow].GetAdjust();
+        eAdjust = (*m_pRows)[nCurRow]->GetAdjust();
 
     return eAdjust;
 }
@@ -2049,7 +2053,7 @@ SvxAdjust HTMLTable::GetInheritedAdjust() const
 sal_Int16 HTMLTable::GetInheritedVertOri() const
 {
     // text::VertOrientation::TOP ist der default!
-    sal_Int16 eVOri = (*pRows)[nCurRow].GetVertOri();
+    sal_Int16 eVOri = (*m_pRows)[nCurRow]->GetVertOri();
     if( text::VertOrientation::TOP==eVOri && nCurCol<nCols )
         eVOri = ((*pColumns)[nCurCol]).GetVertOri();
     if( text::VertOrientation::TOP==eVOri )
@@ -2084,7 +2088,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
         for( i=nCols; i<nColsReq; i++ )
             pColumns->push_back( new HTMLTableColumn );
         for( i=0; i<nRows; i++ )
-            (*pRows)[i].Expand( nColsReq, i<nCurRow );
+            (*m_pRows)[i]->Expand( nColsReq, i<nCurRow );
         nCols = nColsReq;
         OSL_ENSURE(pColumns->size() == nCols,
                 "wrong number of columns after expanding");
@@ -2097,9 +2101,9 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
     if( nRows < nRowsReq )
     {
         for( i=nRows; i<nRowsReq; i++ )
-            pRows->push_back( new HTMLTableRow(nCols) );
+            m_pRows->push_back(o3tl::make_unique<HTMLTableRow>(nCols));
         nRows = nRowsReq;
-        OSL_ENSURE(nRows == pRows->size(), "wrong number of rows in Insert");
+        OSL_ENSURE(nRows == m_pRows->size(), "wrong number of rows in Insert");
     }
 
     // Testen, ob eine Ueberschneidung vorliegt und diese
@@ -2107,7 +2111,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
     sal_uInt16 nSpanedCols = 0;
     if( nCurRow>0 )
     {
-        HTMLTableRow *pCurRow = &(*pRows)[nCurRow];
+        HTMLTableRow *const pCurRow = (*m_pRows)[nCurRow].get();
         for( i=nCurCol; i<nColsReq; i++ )
         {
             HTMLTableCell *pCell = pCurRow->GetCell(i);
@@ -2166,7 +2170,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
     {
         if( nCellHeight < MINLAY )
             nCellHeight = MINLAY;
-        (*pRows)[nCurRow].SetHeight( (sal_uInt16)aTwipSz.Height() );
+        (*m_pRows)[nCurRow]->SetHeight(static_cast<sal_uInt16>(aTwipSz.Height()));
     }
 
     // den Spaltenzaehler hinter die neuen Zellen setzen
@@ -2184,7 +2188,7 @@ inline void HTMLTable::CloseSection( bool bHead )
     // die vorhergende Section beenden, falls es schon eine Zeile gibt
     OSL_ENSURE( nCurRow<=nRows, "ungeultige aktuelle Zeile" );
     if( nCurRow>0 && nCurRow<=nRows )
-        (*pRows)[nCurRow-1].SetEndOfGroup();
+        (*m_pRows)[nCurRow-1]->SetEndOfGroup();
     if( bHead )
         nHeadlineRepeat = nCurRow;
 }
@@ -2198,17 +2202,17 @@ void HTMLTable::OpenRow( SvxAdjust eAdjust, sal_Int16 eVertOrient,
     if( nRows<nRowsReq )
     {
         for( sal_uInt16 i=nRows; i<nRowsReq; i++ )
-            pRows->push_back( new HTMLTableRow(nCols) );
+            m_pRows->push_back(o3tl::make_unique<HTMLTableRow>(nCols));
         nRows = nRowsReq;
-        OSL_ENSURE( nRows==pRows->size(),
+        OSL_ENSURE( nRows == m_pRows->size(),
                 "Zeilenzahl in OpenRow stimmt nicht" );
     }
 
-    HTMLTableRow *pCurRow = &((*pRows)[nCurRow]);
+    HTMLTableRow *const pCurRow = (*m_pRows)[nCurRow].get();
     pCurRow->SetAdjust( eAdjust );
     pCurRow->SetVertOri( eVertOrient );
     if( pBGBrushItem )
-        (*pRows)[nCurRow].SetBGBrush( pBGBrushItem );
+        (*m_pRows)[nCurRow]->SetBGBrush( pBGBrushItem );
 
     // den Spaltenzaehler wieder an den Anfang setzen
     nCurCol=0;
@@ -2226,11 +2230,11 @@ void HTMLTable::CloseRow( bool bEmpty )
     if( bEmpty )
     {
         if( nCurRow > 0 )
-            (*pRows)[nCurRow-1].IncEmptyRows();
+            (*m_pRows)[nCurRow-1]->IncEmptyRows();
         return;
     }
 
-    HTMLTableRow *pRow = &(*pRows)[nCurRow];
+    HTMLTableRow *const pRow = (*m_pRows)[nCurRow].get();
 
     // den COLSPAN aller leeren Zellen am Zeilenende so anpassen, dass
     // eine Zelle daraus wird. Das kann man hier machen (und auf keinen
@@ -2318,16 +2322,16 @@ void HTMLTable::CloseTable()
     // anpassen.
     if( nRows>nCurRow )
     {
-        HTMLTableRow *pPrevRow = &(*pRows)[nCurRow-1];
+        HTMLTableRow *const pPrevRow = (*m_pRows)[nCurRow-1].get();
         HTMLTableCell *pCell;
         for( i=0; i<nCols; i++ )
             if( ( (pCell=(pPrevRow->GetCell(i))), (pCell->GetRowSpan()) > 1 ) )
             {
                 FixRowSpan( nCurRow-1, i, pCell->GetContents() );
-                ProtectRowSpan( nCurRow, i, (*pRows)[nCurRow].GetCell(i)->GetRowSpan() );
+                ProtectRowSpan(nCurRow, i, (*m_pRows)[nCurRow]->GetCell(i)->GetRowSpan());
             }
         for( i=nRows-1; i>=nCurRow; i-- )
-            pRows->erase(pRows->begin() + i);
+            m_pRows->erase(m_pRows->begin() + i);
         nRows = nCurRow;
     }
 
@@ -2336,7 +2340,7 @@ void HTMLTable::CloseTable()
     {
         pColumns->push_back( new HTMLTableColumn );
         for( i=0; i<nRows; i++ )
-            (*pRows)[i].Expand(1);
+            (*m_pRows)[i]->Expand(1);
         nCols = 1;
         nFilledCols = 1;
     }
@@ -2344,7 +2348,7 @@ void HTMLTable::CloseTable()
     // falls die Tabelle keine Zeile hat, muessen wir eine hinzufuegen
     if( 0==nRows )
     {
-        pRows->push_back( new HTMLTableRow(nCols) );
+        m_pRows->push_back(o3tl::make_unique<HTMLTableRow>(nCols));
         nRows = 1;
         nCurRow = 1;
     }
@@ -2353,7 +2357,7 @@ void HTMLTable::CloseTable()
     {
         pColumns->erase( pColumns->begin() + nFilledCols, pColumns->begin() + nCols );
         for( i=0; i<nRows; i++ )
-            (*pRows)[i].Shrink( nFilledCols );
+            (*m_pRows)[i]->Shrink( nFilledCols );
         nCols = nFilledCols;
     }
 }
commit 0e819c0ecd039f4a90a784c240c9ec0530601539
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 10 21:11:39 2015 +0100

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

diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 5f207c1..4074b07 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -31,6 +31,7 @@
 #include <svtools/htmltokn.h>
 #include <svtools/htmlkywd.hxx>
 #include <svl/urihelper.hxx>
+#include <o3tl/make_unique.hxx>
 
 #include <fmtornt.hxx>
 #include <frmfmt.hxx>
@@ -267,11 +268,11 @@ public:
 };
 
 // Row of a HTML table
-typedef boost::ptr_vector<HTMLTableCell> HTMLTableCells;
+typedef std::vector<std::unique_ptr<HTMLTableCell>> HTMLTableCells;
 
 class HTMLTableRow
 {
-    HTMLTableCells *pCells;             // cells of the row
+    HTMLTableCells *m_pCells;   ///< cells of the row
 
     bool bIsEndOfGroup : 1;
 
@@ -770,8 +771,8 @@ SwHTMLTableLayoutCell *HTMLTableCell::CreateLayoutInfo()
                                       bRelWidth, bNoWrap );
 }
 
-HTMLTableRow::HTMLTableRow( sal_uInt16 nCells ):
-    pCells(new HTMLTableCells),
+HTMLTableRow::HTMLTableRow(sal_uInt16 const nCells)
+    : m_pCells(new HTMLTableCells),
     bIsEndOfGroup(false),
     nHeight(0),
     nEmptyRows(0),
@@ -782,16 +783,16 @@ HTMLTableRow::HTMLTableRow( sal_uInt16 nCells ):
 {
     for( sal_uInt16 i=0; i<nCells; i++ )
     {
-        pCells->push_back( new HTMLTableCell );
+        m_pCells->push_back(o3tl::make_unique<HTMLTableCell>());
     }
 
-    OSL_ENSURE(nCells == pCells->size(),
+    OSL_ENSURE(nCells == m_pCells->size(),
             "wrong Cell count in new HTML table row");
 }
 
 HTMLTableRow::~HTMLTableRow()
 {
-    delete pCells;
+    delete m_pCells;
     delete pBGBrush;
 }
 
@@ -803,9 +804,9 @@ inline void HTMLTableRow::SetHeight( sal_uInt16 nHght )
 
 inline HTMLTableCell *HTMLTableRow::GetCell( sal_uInt16 nCell ) const
 {
-    OSL_ENSURE( nCell<pCells->size(),
+    OSL_ENSURE( nCell < m_pCells->size(),
         "ungueltiger Zellen-Index in HTML-Tabellenzeile" );
-    return &(*pCells)[nCell];
+    return (*m_pCells)[nCell].get();
 }
 
 void HTMLTableRow::Expand( sal_uInt16 nCells, bool bOneCell )
@@ -814,34 +815,34 @@ void HTMLTableRow::Expand( sal_uInt16 nCells, bool bOneCell )
     // bOneCell gesetzt ist. Das geht, nur fuer Zeilen, in die keine
     // Zellen mehr eingefuegt werden!
 
-    sal_uInt16 nColSpan = nCells-pCells->size();
-    for( sal_uInt16 i=pCells->size(); i<nCells; i++ )
+    sal_uInt16 nColSpan = nCells - m_pCells->size();
+    for (sal_uInt16 i = m_pCells->size(); i < nCells; ++i)
     {
-        HTMLTableCell *pCell = new HTMLTableCell;
+        std::unique_ptr<HTMLTableCell> pCell(new HTMLTableCell);
         if( bOneCell )
             pCell->SetColSpan( nColSpan );
 
-        pCells->push_back( pCell );
+        m_pCells->push_back(std::move(pCell));
         nColSpan--;
     }
 
-    OSL_ENSURE(nCells == pCells->size(),
+    OSL_ENSURE(nCells == m_pCells->size(),
             "wrong Cell count in expanded HTML table row");
 }
 
 void HTMLTableRow::Shrink( sal_uInt16 nCells )
 {
-    OSL_ENSURE(nCells < pCells->size(), "number of cells too large");
+    OSL_ENSURE(nCells < m_pCells->size(), "number of cells too large");
 
 #if OSL_DEBUG_LEVEL > 0
-     sal_uInt16 nEnd = pCells->size();
+     sal_uInt16 const nEnd = m_pCells->size();
 #endif
     // The colspan of empty cells at the end has to be fixed to the new
     // number of cells.
     sal_uInt16 i=nCells;
     while( i )
     {
-        HTMLTableCell *pCell = &(*pCells)[--i];
+        HTMLTableCell *pCell = (*m_pCells)[--i].get();
         if( !pCell->GetContents() )
         {
 #if OSL_DEBUG_LEVEL > 0
@@ -856,7 +857,7 @@ void HTMLTableRow::Shrink( sal_uInt16 nCells )
 #if OSL_DEBUG_LEVEL > 0
     for( i=nCells; i<nEnd; i++ )
     {
-        HTMLTableCell *pCell = &(*pCells)[i];
+        HTMLTableCell *pCell = (*m_pCells)[i].get();
         OSL_ENSURE( pCell->GetRowSpan() == 1,
                 "RowSpan von zu loesender Zelle ist falsch" );
         OSL_ENSURE( pCell->GetColSpan() == nEnd - i,
@@ -865,7 +866,7 @@ void HTMLTableRow::Shrink( sal_uInt16 nCells )
     }
 #endif
 
-    pCells->erase( pCells->begin() + nCells, pCells->end() );
+    m_pCells->erase( m_pCells->begin() + nCells, m_pCells->end() );
 }
 
 HTMLTableColumn::HTMLTableColumn():
commit 228e3408af85e74023039f17240355fccc0d780f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 10 21:05:57 2015 +0100

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

diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 53cb06b..5f207c1 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -56,6 +56,8 @@
 #include "swcss1.hxx"
 #include <numrule.hxx>
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 #define NETSCAPE_DFLT_BORDER 1
 #define NETSCAPE_DFLT_CELLSPACING 2
 
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 23919cc..7cfe02d 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -664,18 +664,18 @@ bool SvxCSS1Parser::SelectorParsed( CSS1Selector *pSelector, bool bFirst )
     {
         OSL_ENSURE( pSheetItemSet, "Where is the Item-Set for Style-Sheets?" );
 
-        for (size_t i = 0; i < aSelectors.size(); ++i)
+        for (size_t i = 0; i < m_Selectors.size(); ++i)
         {
-            StyleParsed( &aSelectors[i], *pSheetItemSet, *pSheetPropInfo );
+            StyleParsed(m_Selectors[i].get(), *pSheetItemSet, *pSheetPropInfo);
         }
         pSheetItemSet->ClearItem();
         pSheetPropInfo->Clear();
 
         // und die naechste Rule vorbereiten
-        aSelectors.clear();
+        m_Selectors.clear();
     }
 
-    aSelectors.push_back(pSelector);
+    m_Selectors.push_back(std::unique_ptr<CSS1Selector>(pSelector));
 
     return false; // den Selektor haben wir gespeichert. Loeschen toedlich!
 }
@@ -828,13 +828,13 @@ bool SvxCSS1Parser::ParseStyleSheet( const OUString& rIn )
 
     bool bSuccess = CSS1Parser::ParseStyleSheet( rIn );
 
-    for (size_t i = 0; i < aSelectors.size(); ++i)
+    for (size_t i = 0; i < m_Selectors.size(); ++i)
     {
-        StyleParsed( &aSelectors[i], *pSheetItemSet, *pSheetPropInfo );
+        StyleParsed(m_Selectors[i].get(), *pSheetItemSet, *pSheetPropInfo);
     }
 
     // und etwas aufrauemen
-    aSelectors.clear();
+    m_Selectors.clear();
     pSheetItemSet->ClearItem();
     pSheetPropInfo->Clear();
 
diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx
index 47619ad..56cc280 100644
--- a/sw/source/filter/html/svxcss1.hxx
+++ b/sw/source/filter/html/svxcss1.hxx
@@ -24,9 +24,8 @@
 #include <rtl/textenc.h>
 #include "parcss1.hxx"
 
-#include <boost/ptr_container/ptr_vector.hpp>
-
 #include <memory>
+#include <vector>
 #include <map>
 
 class SfxItemPool;
@@ -178,9 +177,9 @@ public:
 
 class SvxCSS1Parser : public CSS1Parser
 {
-    typedef ::boost::ptr_vector<CSS1Selector> CSS1Selectors;
+    typedef ::std::vector<std::unique_ptr<CSS1Selector>> CSS1Selectors;
     typedef ::std::map<OUString, std::unique_ptr<SvxCSS1MapEntry>> CSS1Map;
-    CSS1Selectors aSelectors;   // Liste der "offenen" Selectoren
+    CSS1Selectors m_Selectors;   // List of "open" Selectors
 
     CSS1Map m_Ids;
     CSS1Map m_Classes;


More information about the Libreoffice-commits mailing list