Kaydet (Commit) 19111e1d authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Remove unnecessary auto_ptr complexity

This is a precursor patch to converting this code from
tools/table.hxx to std::map
üst fcc96117
...@@ -717,8 +717,6 @@ void Chart2Positioner::createPositionMap() ...@@ -717,8 +717,6 @@ void Chart2Positioner::createPositionMap()
bool bNoGlue = (meGlue == GLUETYPE_NONE); bool bNoGlue = (meGlue == GLUETYPE_NONE);
SAL_WNODEPRECATED_DECLARATIONS_PUSH SAL_WNODEPRECATED_DECLARATIONS_PUSH
auto_ptr<Table> pCols(new Table); auto_ptr<Table> pCols(new Table);
auto_ptr<FormulaToken> pNewAddress;
auto_ptr<Table> pNewRowTable(new Table);
SAL_WNODEPRECATED_DECLARATIONS_POP SAL_WNODEPRECATED_DECLARATIONS_POP
Table* pCol = NULL; Table* pCol = NULL;
SCROW nNoGlueRow = 0; SCROW nNoGlueRow = 0;
...@@ -750,25 +748,11 @@ void Chart2Positioner::createPositionMap() ...@@ -750,25 +748,11 @@ void Chart2Positioner::createPositionMap()
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol) for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol)
{ {
if (bNoGlue || meGlue == GLUETYPE_ROWS) pCol = static_cast<Table*>(pCols->Get(nInsCol));
if (!pCol)
{ {
pCol = static_cast<Table*>(pCols->Get(nInsCol)); pCol = new Table;
if (!pCol) pCols->Insert(nInsCol, pCol);
{
pCol = pNewRowTable.get();
pCols->Insert(nInsCol, pNewRowTable.release());
pNewRowTable.reset(new Table);
}
}
else
{
if (pCols->Insert(nInsCol, pNewRowTable.get()))
{
pCol = pNewRowTable.release();
pNewRowTable.reset(new Table);
}
else
pCol = static_cast<Table*>(pCols->Get(nInsCol));
} }
sal_uInt32 nInsRow = static_cast<sal_uInt32>(bNoGlue ? nNoGlueRow : nRow1); sal_uInt32 nInsRow = static_cast<sal_uInt32>(bNoGlue ? nNoGlueRow : nRow1);
...@@ -784,20 +768,18 @@ void Chart2Positioner::createPositionMap() ...@@ -784,20 +768,18 @@ void Chart2Positioner::createPositionMap()
aCellData.nRow = nRow; aCellData.nRow = nRow;
aCellData.nTab = nTab; aCellData.nTab = nTab;
if (bExternal) if (!pCol->Get(nInsRow))
pNewAddress.reset(new ScExternalSingleRefToken(nFileId, aTabName, aCellData)); {
else if (bExternal)
pNewAddress.reset(new ScSingleRefToken(aCellData)); pCol->Insert(nInsRow, new ScExternalSingleRefToken(nFileId, aTabName, aCellData));
else
if (pCol->Insert(nInsRow, pNewAddress.get())) pCol->Insert(nInsRow, new ScSingleRefToken(aCellData));
pNewAddress.release(); // To prevent the instance from being destroyed. }
} }
} }
} }
nNoGlueRow += nRow2 - nRow1 + 1; nNoGlueRow += nRow2 - nRow1 + 1;
} }
pNewAddress.reset(NULL);
pNewRowTable.reset(NULL);
bool bFillRowHeader = mbRowHeaders; bool bFillRowHeader = mbRowHeaders;
bool bFillColumnHeader = mbColHeaders; bool bFillColumnHeader = mbColHeaders;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment