summaryrefslogtreecommitdiff
path: root/sw/source/filter/html
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-11-10 21:11:39 +0100
committerMichael Stahl <mstahl@redhat.com>2015-11-10 21:48:39 +0100
commit0e819c0ecd039f4a90a784c240c9ec0530601539 (patch)
tree017b544e94392c3968455f6d1ff0919c5fd52f39 /sw/source/filter/html
parent228e3408af85e74023039f17240355fccc0d780f (diff)
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I01504a684805d582c3d9cb7a26acfc185b6eff73
Diffstat (limited to 'sw/source/filter/html')
-rw-r--r--sw/source/filter/html/htmltab.cxx39
1 files changed, 20 insertions, 19 deletions
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 5f207c10adc7..4074b07b19ba 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():