summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-01 12:41:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-03-01 12:56:04 +0000
commit79d93c7d1195cca3afcb0c5241efa458fddf5134 (patch)
tree5f2bca63f9c6465b9d6775f6b66da45782c75e1d /lotuswordpro
parent3dcde4bb979b0f7685c1ab0029aa7274cd92c904 (diff)
fix leak
Change-Id: I985d422f4c0b41937e4df616fb3154bb7cbad28d
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpcelllayout.cxx39
-rw-r--r--lotuswordpro/source/filter/lwpcelllayout.hxx6
-rw-r--r--lotuswordpro/source/filter/lwprowlayout.cxx40
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx53
-rw-r--r--lotuswordpro/source/filter/xfilter/xfrow.cxx24
-rw-r--r--lotuswordpro/source/filter/xfilter/xfrow.hxx5
-rw-r--r--lotuswordpro/source/filter/xfilter/xftable.cxx41
-rw-r--r--lotuswordpro/source/filter/xfilter/xftable.hxx4
8 files changed, 98 insertions, 114 deletions
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index 18587889d9d6..f09630ebd181 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -310,7 +310,7 @@ OUString const & LwpCellLayout::GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCo
* @param bIsRightCol - whether current cell is the rightest column
* @return XFCell*
*/
-XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
+rtl::Reference<XFCell> LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
{
// if cell layout is aTableID's default cell layout
// it can't have any content, bypass these code
@@ -320,7 +320,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI
assert(false);
return nullptr;
}
- XFCell * pXFCell = new XFCell();
+ rtl::Reference<XFCell> xXFCell(new XFCell);
OUString aStyleName = m_StyleName;
// if cell layout is aTableID's default cell layout
@@ -334,12 +334,12 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI
LwpStory* pStory = dynamic_cast<LwpStory*>(m_Content.obj().get());
if (pStory)
{
- pStory->XFConvert(pXFCell);
+ pStory->XFConvert(xXFCell.get());
}
- ApplyProtect(pXFCell, aTableID);
- pXFCell->SetStyleName(aStyleName);
- return pXFCell;
+ ApplyProtect(xXFCell.get(), aTableID);
+ xXFCell->SetStyleName(aStyleName);
+ return xXFCell;
}
LwpPara* LwpCellLayout::GetLastParaOfPreviousStory()
@@ -824,21 +824,20 @@ void LwpConnectedCellLayout::Read()
m_pObjStrm->SkipExtra();
}
-XFCell* LwpConnectedCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
+
+rtl::Reference<XFCell> LwpConnectedCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
{
- XFCell * pXFCell = LwpCellLayout::ConvertCell(aTableID, nRow, nCol);
- pXFCell->SetColumnSpaned(cnumcols);
-// if(!m_bSplitFlag)
-// {
-// }
- return pXFCell;
+ rtl::Reference<XFCell> xXFCell = LwpCellLayout::ConvertCell(aTableID, nRow, nCol);
+ xXFCell->SetColumnSpaned(cnumcols);
+ return xXFCell;
}
+
/**
* @short parse connected cell layout
* @param pOutputStream - output stream
* @return
*/
- void LwpConnectedCellLayout::Parse(IXFStream* /*pOutputStream*/)
+void LwpConnectedCellLayout::Parse(IXFStream* /*pOutputStream*/)
{
}
@@ -876,7 +875,7 @@ void LwpHiddenCellLayout::Read()
* @return XFCell * - pointer to converted cell
*/
-XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
+rtl::Reference<XFCell> LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
{
if (!cconnectedlayout.obj().is())
return nullptr;
@@ -886,26 +885,26 @@ XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow,
return nullptr;
// if the hidden cell should be displayed for limit of SODC
// use the default cell layout
- XFCell* pXFCell = nullptr;
+ rtl::Reference<XFCell> xXFCell;
LwpTable *pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
if (pTable)
{
LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle().obj().get());
if (pDefault)
{
- pXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
+ xXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
}
else
{
- pXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol);
+ xXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol);
}
- pXFCell->SetColumnSpaned(pConnCell->GetNumcols());
+ xXFCell->SetColumnSpaned(pConnCell->GetNumcols());
}
else
{
assert(false);
}
- return pXFCell;
+ return xXFCell;
}
/**
* @short parse hidden cell layout
diff --git a/lotuswordpro/source/filter/lwpcelllayout.hxx b/lotuswordpro/source/filter/lwpcelllayout.hxx
index f1d87609f49e..7ad790747189 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.hxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.hxx
@@ -89,7 +89,7 @@ public:
LwpCellLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
virtual ~LwpCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CELL_LAYOUT;}
- virtual XFCell* ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol);
+ virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol);
sal_uInt16 GetRowID(){return crowid;}
sal_uInt8 GetColID(){return ccolid;}
void RegisterStyle() override;
@@ -147,7 +147,7 @@ public:
virtual ~LwpHiddenCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HIDDEN_CELL_LAYOUT;}
virtual void Parse(IXFStream* pOutputStream) override;
- virtual XFCell* ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
+ virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
void RegisterStyle() override {}
virtual void SetCellMap() override;
protected:
@@ -166,7 +166,7 @@ public:
virtual ~LwpConnectedCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CONNECTED_CELL_LAYOUT;}
virtual void Parse(IXFStream* pOutputStream) override;
- virtual XFCell* ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
+ virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
sal_uInt16 GetNumrows(){return m_nRealrowspan;}
sal_uInt8 GetNumcols(){return m_nRealcolspan;}
virtual void SetCellMap() override;
diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index 8d0441b89b1c..3ca645d88473 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -194,13 +194,13 @@ void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8
//register connect row style
sal_uInt16 nRowMark = crowid + GetCurMaxSpannedRows(nStartCol,nEndCol);
- XFRow* pXFRow = new XFRow;
- RegisterCurRowStyle(pXFRow,nRowMark);
+ rtl::Reference<XFRow> xXFRow(new XFRow);
+ RegisterCurRowStyle(xXFRow.get(), nRowMark);
//if there is connected cell
for (sal_uInt8 i=nStartCol; i<nEndCol; )
{
- XFCell* pXFCell;
+ rtl::Reference<XFCell> xXFCell;
sal_uInt8 nColMark;
if (nMarkConnCell == -1)
@@ -210,18 +210,18 @@ void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8
if (nColMark > i)//create subtable
{
- pXFCell = new XFCell;
- pXFCell->SetColumnSpaned(nColMark-i);
+ xXFCell.set(new XFCell);
+ xXFCell->SetColumnSpaned(nColMark-i);
XFTable* pSubTable = new XFTable;
pTableLayout->ConvertTable(pSubTable,crowid,nRowMark,i,nColMark);
- pXFCell->Add(pSubTable);
+ xXFCell->Add(pSubTable);
i = nColMark;
}
else
{
sal_uInt8 nColID = m_ConnCellList[nMarkConnCell]->GetColID()
+m_ConnCellList[nMarkConnCell]->GetNumcols()-1;
- pXFCell = m_ConnCellList[nMarkConnCell]->ConvertCell(
+ xXFCell = m_ConnCellList[nMarkConnCell]->ConvertCell(
pTable->GetObjectID(),
crowid+m_ConnCellList[nMarkConnCell]->GetNumrows()-1,
m_ConnCellList[nMarkConnCell]->GetColID());
@@ -229,16 +229,16 @@ void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8
//set all cell in this merge cell to cellsmap
for (sal_uInt16 nRowLoop = crowid;nRowLoop<nRowMark ;nRowLoop++)
for (sal_uInt8 nColLoop = i;nColLoop<nColID+1;nColLoop++)
- pTableLayout->SetCellsMap(nRowLoop,nColLoop,pXFCell);
+ pTableLayout->SetCellsMap(nRowLoop,nColLoop, xXFCell.get());
i += m_ConnCellList[nMarkConnCell]->GetNumcols();
nMarkConnCell = FindNextMarkConnCell(static_cast<sal_uInt16>(nMarkConnCell),nEndCol);
}
- if (pXFCell)
- pXFRow->AddCell(pXFCell);
+ if (xXFCell)
+ xXFRow->AddCell(xXFCell);
}
- pXFTable->AddRow(pXFRow);
+ pXFTable->AddRow(xXFRow);
}
/**
@@ -367,10 +367,9 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
if (!pTableLayout)
return;
- XFRow* pRow = new XFRow;
- pRow->SetStyleName(m_StyleName);
+ rtl::Reference<XFRow> xRow(new XFRow);
+ xRow->SetStyleName(m_StyleName);
- XFCell * pCell = nullptr;
LwpTable* pTable = pTableLayout->GetTable();
sal_uInt8 nCellStartCol,nCellEndCol;
@@ -381,6 +380,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
nCellStartCol = i;//mark the begin position of cell
nCellEndCol = i;//mark the end position of cell
+ rtl::Reference<XFCell> xCell;
while(pCellLayout)
{
if (pCellLayout->GetColID() == i)
@@ -391,7 +391,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
nCellEndCol = i+pConnCell->GetNumcols()-1;
i = nCellEndCol;
}
- pCell = pCellLayout->ConvertCell(pTable->GetObjectID(),crowid,i);
+ xCell = pCellLayout->ConvertCell(pTable->GetObjectID(),crowid,i);
break;
}
rCellID = pCellLayout->GetNext();
@@ -404,21 +404,21 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
LwpCellLayout * pDefaultCell = pTableLayout->GetDefaultCellLayout();
if (pDefaultCell)
{
- pCell = pDefaultCell->ConvertCell(
+ xCell = pDefaultCell->ConvertCell(
pTable->GetObjectID(),crowid, i);
}
else
{
- pCell = new XFCell;
+ xCell.set(new XFCell);
}
}
- pRow->AddCell(pCell);
+ xRow->AddCell(xCell);
for (sal_uInt8 j=nCellStartCol;j<=nCellEndCol;j++)
- pTableLayout->SetCellsMap(crowid,j,pCell);//set to cellsmap
+ pTableLayout->SetCellsMap(crowid,j, xCell.get());//set to cellsmap
}
- pXFTable->AddRow(pRow);
+ pXFTable->AddRow(xRow);
}
/**
* @short collect merge cell info when register row styles
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 7973803ec016..6914cf4a8342 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -918,49 +918,48 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable, rtl::Reference<XFTable>
pXFRow->SetStyleName(pXFStyleManager->AddStyle(pRowStyle).m_pStyle->GetStyleName());
//construct heading row
- XFCell* pXFCell1 = new XFCell;
- XFCell* pXFCell2 = new XFCell;
+ rtl::Reference<XFCell> xXFCell1(new XFCell);
+ rtl::Reference<XFCell> xXFCell2(new XFCell);
XFTable* pSubTable1 = new XFTable;
XFTable* pSubTable2 = new XFTable;
- XFRow* pNewRow;
XFRow* pOldRow;
- XFCell* pNewCell;
+ rtl::Reference<XFCell> xNewCell;
for (i=1;i<=nRowNum;i++)
{
pOldRow = pTmpTable->GetRow(i);
- pNewRow = new XFRow;
- pNewRow->SetStyleName(pOldRow->GetStyleName());
+ rtl::Reference<XFRow> xNewRow(new XFRow);
+ xNewRow->SetStyleName(pOldRow->GetStyleName());
for (j=1;j<=pCellMark[i];j++)
{
- pNewCell = pOldRow->GetCell(j);
- pNewRow->AddCell(pNewCell);
+ xNewCell = pOldRow->GetCell(j);
+ xNewRow->AddCell(xNewCell);
}
- pSubTable1->AddRow(pNewRow);
+ pSubTable1->AddRow(xNewRow);
}
ConvertColumn(pSubTable1,0,nFirstColSpann);//add column info
- pXFCell1->Add(pSubTable1);
- pXFCell1->SetColumnSpaned(nFirstColSpann);
- pXFRow->AddCell(pXFCell1);
+ xXFCell1->Add(pSubTable1);
+ xXFCell1->SetColumnSpaned(nFirstColSpann);
+ pXFRow->AddCell(xXFCell1);
for (i=1;i<=nRowNum;i++)
{
pOldRow = pTmpTable->GetRow(i);
- pNewRow = new XFRow;
- pNewRow->SetStyleName(pOldRow->GetStyleName());
+ rtl::Reference<XFRow> xNewRow(new XFRow);
+ xNewRow->SetStyleName(pOldRow->GetStyleName());
for(j=pCellMark[i]+1;j<=pOldRow->GetCellCount();j++)
{
- pNewCell = pOldRow->GetCell(j);
- pNewRow->AddCell(pNewCell);
+ xNewCell = pOldRow->GetCell(j);
+ xNewRow->AddCell(xNewCell);
}
- pSubTable2->AddRow(pNewRow);
+ pSubTable2->AddRow(xNewRow);
}
ConvertColumn(pSubTable2,nFirstColSpann,nCol);//add column info
- pXFCell2->Add(pSubTable2);
- pXFCell2->SetColumnSpaned(nCol-nFirstColSpann);
- pXFRow->AddCell(pXFCell2);
+ xXFCell2->Add(pSubTable2);
+ xXFCell2->SetColumnSpaned(nCol-nFirstColSpann);
+ pXFRow->AddCell(xXFCell2);
pXFTable->AddHeaderRow(pXFRow);
@@ -1341,27 +1340,27 @@ void LwpTableLayout::ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable,
sal_uInt8 nEndCol, sal_uInt16 nRowID)
{
// current row doesn't exist in the file
- XFRow * pRow = new XFRow();
- pRow->SetStyleName(m_DefaultRowStyleName);
+ rtl::Reference<XFRow> xRow(new XFRow);
+ xRow->SetStyleName(m_DefaultRowStyleName);
for (sal_uInt16 j =0;j < nEndCol-nStartCol; j++)
{
// if table has default cell layout, use it to ConvertCell
// otherwise use blank cell
- XFCell * pCell = nullptr;
+ rtl::Reference<XFCell> xCell;
if (m_pDefaultCellLayout)
{
- pCell = m_pDefaultCellLayout->ConvertCell(
+ xCell = m_pDefaultCellLayout->ConvertCell(
GetTable()->GetObjectID(),nRowID,j+nStartCol);
}
else
{
- pCell = new XFCell();
+ xCell.set(new XFCell);
}
- pRow->AddCell(pCell);
+ xRow->AddCell(xCell);
}
- pXFTable->AddRow(pRow);
+ pXFTable->AddRow(xRow);
}
/**
* @short set cell map info
diff --git a/lotuswordpro/source/filter/xfilter/xfrow.cxx b/lotuswordpro/source/filter/xfilter/xfrow.cxx
index 4c2736b0ea9f..b4e7f7357800 100644
--- a/lotuswordpro/source/filter/xfilter/xfrow.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfrow.cxx
@@ -75,25 +75,19 @@ XFRow::XFRow()
XFRow::~XFRow()
{
- std::map<sal_Int32,XFCell*>::iterator it;
- for( it=m_aCells.begin(); it!=m_aCells.end(); ++it )
- {
- XFCell *pCell = (*it).second;
- delete pCell;
- }
}
-void XFRow::AddCell(XFCell *pCell)
+void XFRow::AddCell(rtl::Reference<XFCell>& rCell)
{
- if( !pCell )
+ if (!rCell)
return;
sal_Int32 col = m_aCells.size()+1;
- pCell->SetCol(col);
- pCell->SetOwnerRow(this);
- m_aCells[col]=pCell;
+ rCell->SetCol(col);
+ rCell->SetOwnerRow(this);
+ m_aCells[col] = rCell;
}
-sal_Int32 XFRow::GetCellCount() const
+sal_Int32 XFRow::GetCellCount() const
{
return m_aCells.size();
}
@@ -103,7 +97,7 @@ XFCell* XFRow::GetCell(sal_Int32 col) const
if( m_aCells.find(col) == m_aCells.end() )
return nullptr;
else
- return m_aCells.find(col)->second;
+ return m_aCells.find(col)->second.get();
}
void XFRow::ToXml(IXFStream *pStrm)
@@ -118,11 +112,11 @@ void XFRow::ToXml(IXFStream *pStrm)
pAttrList->AddAttribute( "table:number-rows-repeated", OUString::number(m_nRepeat) );
pStrm->StartElement( "table:table-row" );
- std::map<sal_Int32,XFCell*>::iterator it = m_aCells.begin();
+ auto it = m_aCells.begin();
for( ; it!=m_aCells.end(); ++it )
{
int col = (*it).first;
- XFCell *pCell = (*it).second;
+ XFCell *pCell = (*it).second.get();
if( !pCell )
continue;
if( col>lastCol+1 )
diff --git a/lotuswordpro/source/filter/xfilter/xfrow.hxx b/lotuswordpro/source/filter/xfilter/xfrow.hxx
index 340b8b47d7e9..a154b5358403 100644
--- a/lotuswordpro/source/filter/xfilter/xfrow.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfrow.hxx
@@ -61,6 +61,7 @@
#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFROW_HXX
#include "xfcontent.hxx"
+#include <rtl/ref.hxx>
#include <map>
class XFCell;
@@ -73,7 +74,7 @@ public:
virtual ~XFRow() override;
public:
- void AddCell(XFCell *pCell);
+ void AddCell(rtl::Reference<XFCell>& rCell);
void SetRepeated(sal_Int32 repeat);
@@ -95,7 +96,7 @@ public:
private:
XFTable *m_pOwnerTable;
- std::map<sal_Int32,XFCell*> m_aCells;
+ std::map<sal_Int32, rtl::Reference<XFCell>> m_aCells;
sal_Int32 m_nRepeat;
sal_Int32 m_nRow;
};
diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx
index dadb43467210..13ced4af2b77 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.cxx
@@ -72,12 +72,6 @@ XFTable::XFTable()
XFTable::~XFTable()
{
- std::map<sal_uInt16, XFRow*>::iterator it;
- for( it=m_aRows.begin(); it!=m_aRows.end(); ++it )
- {
- XFRow *pRow = (*it).second;
- delete pRow;
- }
m_aRows.clear();
m_aColumns.clear();
}
@@ -87,28 +81,26 @@ void XFTable::SetColumnStyle(sal_Int32 col, const OUString& style)
m_aColumns[col] = style;
}
-void XFTable::AddRow(XFRow *pRow)
+void XFTable::AddRow(rtl::Reference<XFRow>& rRow)
{
- assert(pRow);
+ assert(rRow.get());
- for (sal_Int32 i = 0; i < pRow->GetCellCount(); ++i)
+ for (sal_Int32 i = 0; i < rRow->GetCellCount(); ++i)
{
- XFCell* pFirstCell = pRow->GetCell(i + 1); //starts at 1, not 0
+ XFCell* pFirstCell = rRow->GetCell(i + 1); //starts at 1, not 0
if (pFirstCell->GetSubTable() == this)
throw std::runtime_error("table is a subtable of itself");
}
- int row = pRow->GetRow();
+ int row = rRow->GetRow();
if( row<1 )
- pRow->SetRow(m_aRows.size()+1);
+ rRow->SetRow(m_aRows.size()+1);
- row = pRow->GetRow();
- if( m_aRows.find(row) != m_aRows.end() )
- delete m_aRows[row];
+ row = rRow->GetRow();
- pRow->SetOwnerTable(this);
- m_aRows[row] = pRow;
+ rRow->SetOwnerTable(this);
+ m_aRows[row] = rRow;
}
void XFTable::AddHeaderRow(XFRow *pRow)
@@ -133,8 +125,7 @@ OUString XFTable::GetTableName()
sal_uInt16 XFTable::GetRowCount()
{
sal_uInt16 rowMax = 0;
- std::map<sal_uInt16, XFRow*>::iterator it;
- for( it=m_aRows.begin(); it!=m_aRows.end(); ++it )
+ for(auto it=m_aRows.begin(); it!=m_aRows.end(); ++it )
{
if (it->first > rowMax)
rowMax = it->first;
@@ -145,7 +136,7 @@ sal_uInt16 XFTable::GetRowCount()
XFRow* XFTable::GetRow(sal_Int32 row)
{
- return m_aRows[row];
+ return m_aRows[row].get();
}
sal_Int32 XFTable::GetColumnCount()
@@ -226,11 +217,11 @@ void XFTable::ToXml(IXFStream *pStrm)
{
int lastRow = 0;
- std::map<sal_uInt16, XFRow* >::iterator it = m_aRows.begin();
+ auto it = m_aRows.begin();
for( ; it!=m_aRows.end(); ++it )
{
int row = (*it).first;
- XFRow *pRow = (*it).second;
+ XFRow *pRow = (*it).second.get();
//null row repeated:
if( row>lastRow+1 )
@@ -239,9 +230,9 @@ void XFTable::ToXml(IXFStream *pStrm)
pNullRow->SetStyleName(m_strDefRowStyle);
if( row>lastRow+2)
pNullRow->SetRepeated(row-lastRow-1);
- XFCell *pCell = new XFCell();
- pCell->SetStyleName(m_strDefCellStyle);
- pNullRow->AddCell(pCell);
+ rtl::Reference<XFCell> xCell(new XFCell);
+ xCell->SetStyleName(m_strDefCellStyle);
+ pNullRow->AddCell(xCell);
pNullRow->ToXml(pStrm);
}
pRow->ToXml(pStrm);
diff --git a/lotuswordpro/source/filter/xfilter/xftable.hxx b/lotuswordpro/source/filter/xfilter/xftable.hxx
index 52a7862d9c3a..02a07d41182f 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.hxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.hxx
@@ -79,7 +79,7 @@ public:
void SetColumnStyle(sal_Int32 col, const OUString& style);
- void AddRow(XFRow *pRow);
+ void AddRow(rtl::Reference<XFRow>& rRow);
void AddHeaderRow(XFRow *pRow);
@@ -110,7 +110,7 @@ private:
bool m_bSubTable;
XFCell *m_pOwnerCell;
rtl::Reference<XFContentContainer> m_aHeaderRows;
- std::map<sal_uInt16, XFRow*> m_aRows;
+ std::map<sal_uInt16, rtl::Reference<XFRow>> m_aRows;
std::map<sal_Int32,OUString> m_aColumns;
OUString m_strDefCellStyle;
OUString m_strDefRowStyle;