diff options
author | Noel Grandin <noel@peralex.com> | 2012-04-14 01:33:26 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-04-18 15:30:01 +0200 |
commit | 19111e1da5acc428c0a82f95eb539c5606a1b6b8 (patch) | |
tree | 66f42cfdedefaef6cf6808af9c8f5bb61230a5b2 /sc | |
parent | fcc9611770e55b0c6ff0f23d2345f3e4f0ef7838 (diff) |
Remove unnecessary auto_ptr complexity
This is a precursor patch to converting this code from
tools/table.hxx to std::map
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index bbfdce78d04a..ae4b61bcb029 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -717,8 +717,6 @@ void Chart2Positioner::createPositionMap() bool bNoGlue = (meGlue == GLUETYPE_NONE); SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr<Table> pCols(new Table); - auto_ptr<FormulaToken> pNewAddress; - auto_ptr<Table> pNewRowTable(new Table); SAL_WNODEPRECATED_DECLARATIONS_POP Table* pCol = NULL; SCROW nNoGlueRow = 0; @@ -750,25 +748,11 @@ void Chart2Positioner::createPositionMap() 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)); - if (!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)); + pCol = new Table; + pCols->Insert(nInsCol, pCol); } sal_uInt32 nInsRow = static_cast<sal_uInt32>(bNoGlue ? nNoGlueRow : nRow1); @@ -784,20 +768,18 @@ void Chart2Positioner::createPositionMap() aCellData.nRow = nRow; aCellData.nTab = nTab; - if (bExternal) - pNewAddress.reset(new ScExternalSingleRefToken(nFileId, aTabName, aCellData)); - else - pNewAddress.reset(new ScSingleRefToken(aCellData)); - - if (pCol->Insert(nInsRow, pNewAddress.get())) - pNewAddress.release(); // To prevent the instance from being destroyed. + if (!pCol->Get(nInsRow)) + { + if (bExternal) + pCol->Insert(nInsRow, new ScExternalSingleRefToken(nFileId, aTabName, aCellData)); + else + pCol->Insert(nInsRow, new ScSingleRefToken(aCellData)); + } } } } nNoGlueRow += nRow2 - nRow1 + 1; } - pNewAddress.reset(NULL); - pNewRowTable.reset(NULL); bool bFillRowHeader = mbRowHeaders; bool bFillColumnHeader = mbColHeaders; |