[Libreoffice-commits] .: 11 commits - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Dec 5 16:24:59 PST 2011


 sc/inc/chart2uno.hxx              |  161 ------------
 sc/source/ui/unoobj/chart2uno.cxx |  478 ++++++++++----------------------------
 2 files changed, 146 insertions(+), 493 deletions(-)

New commits:
commit c81b005921b39c54b33777af126b87e9f4e92860
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Dec 5 19:20:53 2011 -0500

    fdo#39847: Shrink chart's source ranges to data area.
    
    Otherwise setting data area to e.g. the entire sheet, or even just
    entire columns would freeze Calc as it tries to parse the entire data
    range faithfully.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 7a5c520..6e54996 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -601,6 +601,10 @@ void Chart2Positioner::glueState()
 
 void Chart2Positioner::calcGlueState(SCCOL nColSize, SCROW nRowSize)
 {
+    // TODO: This code can use some space optimization.  Using an array to
+    // store individual cell's states is terribly inefficient esp for large
+    // data ranges; let's use flat_segment_tree to reduce memory usage here.
+
     sal_uInt32 nCR = static_cast<sal_uInt32>(nColSize*nRowSize);
 
     enum State { Hole = 0, Occupied = 1, Free = 2, Glue = 3 };
@@ -1386,6 +1390,53 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
     return true;
 }
 
+class ShrinkRefTokenToDataRange : std::unary_function<ScTokenRef, void>
+{
+    ScDocument* mpDoc;
+public:
+    ShrinkRefTokenToDataRange(ScDocument* pDoc) : mpDoc(pDoc) {}
+    void operator() (ScTokenRef& rRef)
+    {
+        if (ScRefTokenHelper::isExternalRef(rRef))
+            return;
+
+        ScComplexRefData& rData = rRef->GetDoubleRef();
+        ScSingleRefData& s = rData.Ref1;
+        ScSingleRefData& e = rData.Ref2;
+
+        SCCOL nMinCol = MAXCOL, nMaxCol = 0;
+        SCROW nMinRow = MAXROW, nMaxRow = 0;
+
+        // Determine the smallest range that encompasses the data ranges of all sheets.
+        SCTAB nTab1 = s.nTab, nTab2 = e.nTab;
+        for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
+        {
+            SCCOL nCol1 = 0, nCol2 = MAXCOL;
+            SCROW nRow1 = 0, nRow2 = MAXROW;
+            mpDoc->ShrinkToDataArea(nTab, nCol1, nRow1, nCol2, nRow2);
+            nMinCol = std::min(nMinCol, nCol1);
+            nMinRow = std::min(nMinRow, nRow1);
+            nMaxCol = std::max(nMaxCol, nCol2);
+            nMaxRow = std::max(nMaxRow, nRow2);
+        }
+
+        // Shrink range to the data range if applicable.
+        if (s.nCol < nMinCol)
+            s.nCol = nMinCol;
+        if (s.nRow < nMinRow)
+            s.nRow = nMinRow;
+        if (e.nCol > nMaxCol)
+            e.nCol = nMaxCol;
+        if (e.nRow > nMaxRow)
+            e.nRow = nMaxRow;
+    }
+};
+
+void shrinkToDataRange(ScDocument* pDoc, vector<ScTokenRef>& rRefTokens)
+{
+    std::for_each(rRefTokens.begin(), rRefTokens.end(), ShrinkRefTokenToDataRange(pDoc));
+}
+
 }
 
 uno::Reference< chart2::data::XDataSource> SAL_CALL
@@ -1443,6 +1494,8 @@ ScChart2DataProvider::createDataSource(
         // Invalid range representation.  Bail out.
         throw lang::IllegalArgumentException();
 
+    shrinkToDataRange(m_pDocument, aRefTokens);
+
     if (bLabel)
         lcl_addUpperLeftCornerIfMissing(aRefTokens); //#i90669#
 
@@ -2028,6 +2081,8 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL
     if (aRefTokens.empty())
         return xResult;
 
+    shrinkToDataRange(m_pDocument, aRefTokens);
+
     // ScChart2DataSequence manages the life cycle of pRefTokens.
     vector<ScTokenRef>* pRefTokens = new vector<ScTokenRef>();
     pRefTokens->swap(aRefTokens);
commit b5dfff9d34d1011ec552b35f223e75ca253bbd78
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Dec 5 17:06:48 2011 -0500

    A little more annotation.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 71ab28c..7a5c520 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -740,9 +740,12 @@ void Chart2Positioner::createPositionMap()
 
         for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
         {
-            // What's this for ???
+            // columns on secondary sheets are appended; we treat them as if
+            // all columns are on the same sheet.  TODO: We can't assume that
+            // the column range is 16-bit; remove that restriction.
             sal_uInt32 nInsCol = (static_cast<sal_uInt32>(nTab) << 16) |
                 (bNoGlue ? 0 : static_cast<sal_uInt32>(nCol1));
+
             for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol)
             {
                 if (bNoGlue || meGlue == GLUETYPE_ROWS)
commit f12221dcb70874db0a2f9fc8316bb500d89ee390
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Dec 5 16:29:58 2011 -0500

    Added comment describing what we are doing here...
    
    It's not very obvious from the code alone.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index df43323..71ab28c 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -599,13 +599,15 @@ void Chart2Positioner::glueState()
     calcGlueState(nC, nR);
 }
 
-void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
+void Chart2Positioner::calcGlueState(SCCOL nColSize, SCROW nRowSize)
 {
-    sal_uInt32 nCR = static_cast<sal_uInt32>(nCols*nRows);
+    sal_uInt32 nCR = static_cast<sal_uInt32>(nColSize*nRowSize);
 
     enum State { Hole = 0, Occupied = 1, Free = 2, Glue = 3 };
 
     vector<State> aCellStates(nCR, Hole);
+
+    // Mark all referenced cells "occupied".
     for (vector<ScTokenRef>::const_iterator itr = mrRefTokens.begin(), itrEnd = mrRefTokens.end();
           itr != itrEnd; ++itr)
     {
@@ -618,62 +620,69 @@ void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
         for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
             for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
             {
-                size_t i = nCol*nRows + nRow;
+                size_t i = nCol*nRowSize + nRow;
                 aCellStates[i] = Occupied;
             }
     }
-    bool bGlue = true;
 
-    size_t i = 0;
+    // If at least one cell in either the first column or first row is empty,
+    // we don't glue at all unless the whole column or row is empty; we expect
+    // all cells in the first column / row to be fully populated.  If we have
+    // empty column or row, then we do glue by the column or row,
+    // respectively.
+
+    bool bGlue = true;
     bool bGlueCols = false;
-    for (SCCOL nCol = 0; bGlue && nCol < nCols; ++nCol)
+    for (SCCOL nCol = 0; bGlue && nCol < nColSize; ++nCol)
     {
-        for (SCROW nRow = 0; bGlue && nRow < nRows; ++nRow)
+        for (SCROW nRow = 0; bGlue && nRow < nRowSize; ++nRow)
         {
-            i = nCol*nRows + nRow;
+            size_t i = nCol*nRowSize + nRow;
             if (aCellStates[i] == Occupied)
             {
-                if (nCol > 0 && nRow > 0)
-                    bGlue = false;
-                else
-                    nRow = nRows;
+                if (nCol == 0 || nRow == 0)
+                    break;
+
+                bGlue = false;
             }
             else
                 aCellStates[i] = Free;
         }
-        i = (nCol+1)*nRows - 1; // index for the last cell in the column.
-        if (bGlue && (aCellStates[i] == Free))
+        size_t nLast = (nCol+1)*nRowSize - 1; // index for the last cell in the column.
+        if (bGlue && aCellStates[nLast] == Free)
         {
-            aCellStates[i] = Glue;
+            // Whole column is empty.
+            aCellStates[nLast] = Glue;
             bGlueCols = true;
         }
     }
 
     bool bGlueRows = false;
-    for (SCROW nRow = 0; bGlue && nRow < nRows; ++nRow)
+    for (SCROW nRow = 0; bGlue && nRow < nRowSize; ++nRow)
     {
-        i = nRow;
-        for (SCCOL nCol = 0; bGlue && nCol < nCols; ++nCol, i += nRows)
+        size_t i = nRow;
+        for (SCCOL nCol = 0; bGlue && nCol < nColSize; ++nCol, i += nRowSize)
         {
             if (aCellStates[i] == Occupied)
             {
-                if (nCol > 0 && nRow > 0)
-                    bGlue = false;
-                else
-                    nCol = nCols;
+                if (nCol == 0 || nRow == 0)
+                    break;
+
+                bGlue = false;
             }
             else
                 aCellStates[i] = Free;
         }
-        i = (nCols-1)*nRows + nRow; // index for the row position in the last column.
+        i = (nColSize-1)*nRowSize + nRow; // index for the row position in the last column.
         if (bGlue && aCellStates[i] == Free)
         {
+            // Whole row is empty.
             aCellStates[i] = Glue;
             bGlueRows = true;
         }
     }
 
-    i = 1;
+    size_t i = 1;
     for (sal_uInt32 n = 1; bGlue && n < nCR; ++n, ++i)
         if (aCellStates[i] == Hole)
             bGlue = false;
commit 2641accc23c794a4a7438b4bc69f2f299755eae5
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Dec 5 15:17:33 2011 -0500

    Use enum over integer constant for type safety.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index f4d6355..df43323 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -603,12 +603,9 @@ void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
 {
     sal_uInt32 nCR = static_cast<sal_uInt32>(nCols*nRows);
 
-    const sal_uInt8 nHole = 0;
-    const sal_uInt8 nOccu = 1;
-    const sal_uInt8 nFree = 2;
-    const sal_uInt8 nGlue = 3;
+    enum State { Hole = 0, Occupied = 1, Free = 2, Glue = 3 };
 
-    vector<sal_uInt8> aCellStates(nCR);
+    vector<State> aCellStates(nCR, Hole);
     for (vector<ScTokenRef>::const_iterator itr = mrRefTokens.begin(), itrEnd = mrRefTokens.end();
           itr != itrEnd; ++itr)
     {
@@ -622,7 +619,7 @@ void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
             for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
             {
                 size_t i = nCol*nRows + nRow;
-                aCellStates[i] = nOccu;
+                aCellStates[i] = Occupied;
             }
     }
     bool bGlue = true;
@@ -634,7 +631,7 @@ void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
         for (SCROW nRow = 0; bGlue && nRow < nRows; ++nRow)
         {
             i = nCol*nRows + nRow;
-            if (aCellStates[i] == nOccu)
+            if (aCellStates[i] == Occupied)
             {
                 if (nCol > 0 && nRow > 0)
                     bGlue = false;
@@ -642,12 +639,12 @@ void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
                     nRow = nRows;
             }
             else
-                aCellStates[i] = nFree;
+                aCellStates[i] = Free;
         }
         i = (nCol+1)*nRows - 1; // index for the last cell in the column.
-        if (bGlue && (aCellStates[i] == nFree))
+        if (bGlue && (aCellStates[i] == Free))
         {
-            aCellStates[i] = nGlue;
+            aCellStates[i] = Glue;
             bGlueCols = true;
         }
     }
@@ -658,7 +655,7 @@ void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
         i = nRow;
         for (SCCOL nCol = 0; bGlue && nCol < nCols; ++nCol, i += nRows)
         {
-            if (aCellStates[i] == nOccu)
+            if (aCellStates[i] == Occupied)
             {
                 if (nCol > 0 && nRow > 0)
                     bGlue = false;
@@ -666,19 +663,19 @@ void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
                     nCol = nCols;
             }
             else
-                aCellStates[i] = nFree;
+                aCellStates[i] = Free;
         }
         i = (nCols-1)*nRows + nRow; // index for the row position in the last column.
-        if (bGlue && aCellStates[i] == nFree)
+        if (bGlue && aCellStates[i] == Free)
         {
-            aCellStates[i] = nGlue;
+            aCellStates[i] = Glue;
             bGlueRows = true;
         }
     }
 
     i = 1;
     for (sal_uInt32 n = 1; bGlue && n < nCR; ++n, ++i)
-        if (aCellStates[i] == nHole)
+        if (aCellStates[i] == Hole)
             bGlue = false;
 
     if (bGlue)
@@ -689,7 +686,7 @@ void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
             meGlue = GLUETYPE_ROWS;
         else
             meGlue = GLUETYPE_COLS;
-        if (aCellStates.front() != nOccu)
+        if (aCellStates.front() != Occupied)
             mbDummyUpperLeft = true;
     }
     else
commit 3e4488fdbb9a6383cd0260bcd592c245c3e6563a
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Dec 5 15:13:44 2011 -0500

    Separate method for code that determins glue state from referenced cells.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 11820a6..f4d6355 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -482,6 +482,7 @@ private:
 
     void invalidateGlue();
     void glueState();
+    void calcGlueState(SCCOL nCols, SCROW nRows);
     void createPositionMap();
 
 private:
@@ -594,7 +595,13 @@ void Chart2Positioner::glueState()
         mnStartRow = 0;
         return;
     }
-    sal_uInt32 nCR = static_cast<sal_uInt32>(nC*nR);
+
+    calcGlueState(nC, nR);
+}
+
+void Chart2Positioner::calcGlueState(SCCOL nCols, SCROW nRows)
+{
+    sal_uInt32 nCR = static_cast<sal_uInt32>(nCols*nRows);
 
     const sal_uInt8 nHole = 0;
     const sal_uInt8 nOccu = 1;
@@ -605,6 +612,7 @@ void Chart2Positioner::glueState()
     for (vector<ScTokenRef>::const_iterator itr = mrRefTokens.begin(), itrEnd = mrRefTokens.end();
           itr != itrEnd; ++itr)
     {
+        ScComplexRefData aData;
         ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr);
         SCCOL nCol1 = static_cast<SCCOL>(aData.Ref1.nCol) - mnStartCol;
         SCCOL nCol2 = static_cast<SCCOL>(aData.Ref2.nCol) - mnStartCol;
@@ -613,7 +621,7 @@ void Chart2Positioner::glueState()
         for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
             for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
             {
-                size_t i = nCol*nR + nRow;
+                size_t i = nCol*nRows + nRow;
                 aCellStates[i] = nOccu;
             }
     }
@@ -621,22 +629,22 @@ void Chart2Positioner::glueState()
 
     size_t i = 0;
     bool bGlueCols = false;
-    for (SCCOL nCol = 0; bGlue && nCol < nC; ++nCol)
+    for (SCCOL nCol = 0; bGlue && nCol < nCols; ++nCol)
     {
-        for (SCROW nRow = 0; bGlue && nRow < nR; ++nRow)
+        for (SCROW nRow = 0; bGlue && nRow < nRows; ++nRow)
         {
-            i = nCol*nR + nRow;
+            i = nCol*nRows + nRow;
             if (aCellStates[i] == nOccu)
             {
                 if (nCol > 0 && nRow > 0)
                     bGlue = false;
                 else
-                    nRow = nR;
+                    nRow = nRows;
             }
             else
                 aCellStates[i] = nFree;
         }
-        i = (nCol+1)*nR - 1; // index for the last cell in the column.
+        i = (nCol+1)*nRows - 1; // index for the last cell in the column.
         if (bGlue && (aCellStates[i] == nFree))
         {
             aCellStates[i] = nGlue;
@@ -645,22 +653,22 @@ void Chart2Positioner::glueState()
     }
 
     bool bGlueRows = false;
-    for (SCROW nRow = 0; bGlue && nRow < nR; ++nRow)
+    for (SCROW nRow = 0; bGlue && nRow < nRows; ++nRow)
     {
         i = nRow;
-        for (SCCOL nCol = 0; bGlue && nCol < nC; ++nCol, i += nR)
+        for (SCCOL nCol = 0; bGlue && nCol < nCols; ++nCol, i += nRows)
         {
             if (aCellStates[i] == nOccu)
             {
                 if (nCol > 0 && nRow > 0)
                     bGlue = false;
                 else
-                    nCol = nC;
+                    nCol = nCols;
             }
             else
                 aCellStates[i] = nFree;
         }
-        i = (nC-1)*nR + nRow; // index for the row position in the last column.
+        i = (nCols-1)*nRows + nRow; // index for the row position in the last column.
         if (bGlue && aCellStates[i] == nFree)
         {
             aCellStates[i] = nGlue;
commit e8c5565485fee0b7b7fcdafa7d09e55635e1061f
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Dec 5 14:56:34 2011 -0500

    Annotated code and a little cleanup to improve readability.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index ecfe9fa..11820a6 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -149,7 +149,7 @@ uno::Reference< sheet::XSpreadsheetDocument > lcl_GetSpreadSheetDocument( ScDocu
     return uno::Reference< sheet::XSpreadsheetDocument >( lcl_GetXModel( pDoc ), uno::UNO_QUERY );
 }
 
-struct TokenTable
+struct TokenTable : boost::noncopyable
 {
     SCROW mnRowCount;
     SCCOL mnColCount;
@@ -510,6 +510,7 @@ void Chart2Positioner::glueState()
     mbDummyUpperLeft = false;
     if (mrRefTokens.size() <= 1)
     {
+        // Source data consists of only one data range.
         const ScTokenRef& p = mrRefTokens.front();
         ScComplexRefData aData;
         if (ScRefTokenHelper::getDoubleRefDataFromToken(aData, p))
@@ -535,8 +536,8 @@ void Chart2Positioner::glueState()
     mnStartCol = aData.Ref1.nCol;
     mnStartRow = aData.Ref1.nRow;
 
-    SCCOL nMaxCols = 0, nEndCol = 0;
-    SCROW nMaxRows = 0, nEndRow = 0;
+    SCCOL nEndCol = 0;
+    SCROW nEndRow = 0;
     for (vector<ScTokenRef>::const_iterator itr = mrRefTokens.begin(), itrEnd = mrRefTokens.end()
          ; itr != itrEnd; ++itr)
     {
@@ -547,13 +548,10 @@ void Chart2Positioner::glueState()
             n1 = MAXCOL;
         if (n2 > MAXCOL)
             n2 = MAXCOL;
-        SCCOLROW nTmp = n2 - n1 + 1;
         if (n1 < mnStartCol)
             mnStartCol = static_cast<SCCOL>(n1);
         if (n2 > nEndCol)
             nEndCol = static_cast<SCCOL>(n2);
-        if (nTmp > nMaxCols)
-            nMaxCols = static_cast<SCCOL>(nTmp);
 
         n1 = aData.Ref1.nRow;
         n2 = aData.Ref2.nRow;
@@ -561,30 +559,33 @@ void Chart2Positioner::glueState()
             n1 = MAXROW;
         if (n2 > MAXROW)
             n2 = MAXROW;
-        nTmp = n2 - n1 + 1;
 
         if (n1 < mnStartRow)
             mnStartRow = static_cast<SCROW>(n1);
         if (n2 > nEndRow)
             nEndRow = static_cast<SCROW>(n2);
-        if (nTmp > nMaxRows)
-            nMaxRows = static_cast<SCROW>(nTmp);
     }
 
-    // total column size ?
-    SCCOL nC = nEndCol - mnStartCol + 1;
-    if (nC == 1)
+    if (mnStartCol == nEndCol)
     {
+        // All source data is in a single column.
         meGlue = GLUETYPE_ROWS;
         return;
     }
-    // total row size ?
-    SCROW nR = nEndRow - mnStartRow + 1;
-    if (nR == 1)
+
+    if (mnStartRow == nEndRow)
     {
+        // All source data is in a single row.
         meGlue = GLUETYPE_COLS;
         return;
     }
+
+    // total column size
+    SCCOL nC = nEndCol - mnStartCol + 1;
+
+    // total row size
+    SCROW nR = nEndRow - mnStartRow + 1;
+
     // #i103540# prevent invalid vector size
     if ((nC <= 0) || (nR <= 0))
     {
commit 793432143e95f746348a495961da8b73464a862a
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Dec 5 14:51:24 2011 -0500

    Empty data sequence backend no longer used. Let's purge it.

diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx
index 2f92349..544ab9b 100644
--- a/sc/inc/chart2uno.hxx
+++ b/sc/inc/chart2uno.hxx
@@ -64,8 +64,6 @@
 #include <boost/noncopyable.hpp>
 #include <boost/scoped_ptr.hpp>
 
-#define USE_CHART2_EMPTYDATASEQUENCE 0
-
 class ScDocument;
 
 // DataProvider ==============================================================
@@ -471,144 +469,6 @@ private:
     bool                        m_bExtDataRebuildQueued;
 };
 
-#if USE_CHART2_EMPTYDATASEQUENCE
-// DataSequence ==============================================================
-
-class ScChart2EmptyDataSequence : public
-                ::cppu::WeakImplHelper6<
-                    ::com::sun::star::chart2::data::XDataSequence,
-                    ::com::sun::star::chart2::data::XTextualDataSequence,
-                    ::com::sun::star::util::XCloneable,
-                    ::com::sun::star::util::XModifyBroadcaster,
-                    ::com::sun::star::beans::XPropertySet,
-//                     ::com::sun::star::lang::XUnoTunnel,
-                    ::com::sun::star::lang::XServiceInfo>,
-                SfxListener
-{
-public:
-
-    explicit ScChart2EmptyDataSequence( ScDocument* pDoc,
-            const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP,
-            const ScRangeListRef& rRangeList, sal_Bool bColumn );
-    virtual ~ScChart2EmptyDataSequence();
-    virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-
-    // XDataSequence ---------------------------------------------------------
-
-    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
-        SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
-    virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation()
-        throw (::com::sun::star::uno::RuntimeException);
-    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
-        SAL_CALL generateLabel(::com::sun::star::chart2::data::LabelOrigin nOrigin)
-        throw (::com::sun::star::uno::RuntimeException);
-    virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
-        throw (::com::sun::star::lang::IndexOutOfBoundsException,
-               ::com::sun::star::uno::RuntimeException);
-
-    // XTextualDataSequence --------------------------------------------------
-
-    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
-        SAL_CALL getTextualData(  ) throw (::com::sun::star::uno::RuntimeException);
-
-    // XPropertySet ----------------------------------------------------------
-
-    virtual ::com::sun::star::uno::Reference<
-        ::com::sun::star::beans::XPropertySetInfo> SAL_CALL
-        getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException);
-
-    virtual void SAL_CALL setPropertyValue(
-            const ::rtl::OUString& rPropertyName,
-            const ::com::sun::star::uno::Any& rValue)
-        throw( ::com::sun::star::beans::UnknownPropertyException,
-                ::com::sun::star::beans::PropertyVetoException,
-                ::com::sun::star::lang::IllegalArgumentException,
-                ::com::sun::star::lang::WrappedTargetException,
-                ::com::sun::star::uno::RuntimeException);
-
-    virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
-            const ::rtl::OUString& rPropertyName)
-        throw( ::com::sun::star::beans::UnknownPropertyException,
-                ::com::sun::star::lang::WrappedTargetException,
-                ::com::sun::star::uno::RuntimeException);
-
-    virtual void SAL_CALL addPropertyChangeListener(
-            const ::rtl::OUString& rPropertyName,
-            const ::com::sun::star::uno::Reference<
-            ::com::sun::star::beans::XPropertyChangeListener>& xListener)
-        throw( ::com::sun::star::beans::UnknownPropertyException,
-                ::com::sun::star::lang::WrappedTargetException,
-                ::com::sun::star::uno::RuntimeException);
-
-    virtual void SAL_CALL removePropertyChangeListener(
-            const ::rtl::OUString& rPropertyName,
-            const ::com::sun::star::uno::Reference<
-            ::com::sun::star::beans::XPropertyChangeListener>& rListener)
-        throw( ::com::sun::star::beans::UnknownPropertyException,
-                ::com::sun::star::lang::WrappedTargetException,
-                ::com::sun::star::uno::RuntimeException);
-
-    virtual void SAL_CALL addVetoableChangeListener(
-            const ::rtl::OUString& rPropertyName,
-            const ::com::sun::star::uno::Reference<
-            ::com::sun::star::beans::XVetoableChangeListener>& rListener)
-        throw( ::com::sun::star::beans::UnknownPropertyException,
-                ::com::sun::star::lang::WrappedTargetException,
-                ::com::sun::star::uno::RuntimeException);
-
-    virtual void SAL_CALL removeVetoableChangeListener(
-            const ::rtl::OUString& rPropertyName,
-            const ::com::sun::star::uno::Reference<
-            ::com::sun::star::beans::XVetoableChangeListener>& rListener)
-        throw( ::com::sun::star::beans::UnknownPropertyException,
-                ::com::sun::star::lang::WrappedTargetException,
-                ::com::sun::star::uno::RuntimeException);
-
-    // XCloneable ------------------------------------------------------------
-
-    virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
-        throw (::com::sun::star::uno::RuntimeException);
-
-    // XModifyBroadcaster ----------------------------------------------------
-
-    virtual void SAL_CALL addModifyListener(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
-        throw (::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL removeModifyListener(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
-        throw (::com::sun::star::uno::RuntimeException);
-
-    // XServiceInfo ----------------------------------------------------------
-
-    virtual ::rtl::OUString SAL_CALL getImplementationName() throw(
-            ::com::sun::star::uno::RuntimeException);
-
-    virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString&
-            rServiceName) throw( ::com::sun::star::uno::RuntimeException);
-
-    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
-        getSupportedServiceNames() throw(
-                ::com::sun::star::uno::RuntimeException);
-
-    // Implementation --------------------------------------------------------
-
-    ScRangeListRef GetRangeList() { return m_xRanges; }
-
-private:
-
-    // properties
-    ::com::sun::star::chart2::data::DataSequenceRole  m_aRole;
-    sal_Bool                    m_bIncludeHiddenCells;
-    // internals
-    ScRangeListRef              m_xRanges;
-    ScDocument*                 m_pDocument;
-    com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
-    SfxItemPropertySet          m_aPropSet;
-    sal_Bool                    m_bColumn; // defines the orientation to create the right labels
-
-};
-#endif
-
 #endif // SC_CHART2UNO_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 0b7aaa0..ecfe9fa 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -63,10 +63,6 @@ SC_SIMPLE_SERVICE_INFO( ScChart2DataSource, "ScChart2DataSource",
         "com.sun.star.chart2.data.DataSource")
 SC_SIMPLE_SERVICE_INFO( ScChart2DataSequence, "ScChart2DataSequence",
         "com.sun.star.chart2.data.DataSequence")
-#if USE_CHART2_EMPTYDATASEQUENCE
-SC_SIMPLE_SERVICE_INFO( ScChart2EmptyDataSequence, "ScChart2EmptyDataSequence",
-        "com.sun.star.chart2.data.DataSequence")
-#endif
 
 using namespace ::com::sun::star;
 using namespace ::formula;
@@ -3379,275 +3375,4 @@ void ScChart2DataSequence::setDataChangedHint(bool b)
     m_bGotDataChangedHint = b;
 }
 
-
-#if USE_CHART2_EMPTYDATASEQUENCE
-// DataSequence ==============================================================
-
-ScChart2EmptyDataSequence::ScChart2EmptyDataSequence( ScDocument* pDoc,
-        const uno::Reference < chart2::data::XDataProvider >& xDP,
-        const ScRangeListRef& rRangeList,
-        sal_Bool bColumn)
-    : m_bIncludeHiddenCells( sal_True)
-    , m_xRanges( rRangeList)
-    , m_pDocument( pDoc)
-    , m_xDataProvider( xDP)
-    , m_aPropSet(lcl_GetDataSequencePropertyMap())
-    , m_bColumn(bColumn)
-{
-    if ( m_pDocument )
-        m_pDocument->AddUnoObject( *this);
-    // FIXME: real implementation of identifier and it's mapping to ranges.
-    // Reuse ScChartListener?
-
-    // BM: don't use names of named ranges but the UI range strings
-//  String  aStr;
-//  rRangeList->Format( aStr, SCR_ABS_3D, m_pDocument );
-//    m_aIdentifier = ::rtl::OUString( aStr );
-
-//      m_aIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ID_"));
-//      static sal_Int32 nID = 0;
-//      m_aIdentifier += ::rtl::OUString::valueOf( ++nID);
-}
-
-
-ScChart2EmptyDataSequence::~ScChart2EmptyDataSequence()
-{
-    if ( m_pDocument )
-        m_pDocument->RemoveUnoObject( *this);
-}
-
-
-void ScChart2EmptyDataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
-{
-    if ( rHint.ISA( SfxSimpleHint ) &&
-            ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
-    {
-        m_pDocument = NULL;
-    }
-}
-
-
-uno::Sequence< uno::Any> SAL_CALL ScChart2EmptyDataSequence::getData()
-            throw ( uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-    if ( !m_pDocument)
-        throw uno::RuntimeException();
-    return uno::Sequence< uno::Any>();
-}
-
-// XTextualDataSequence --------------------------------------------------
-
-uno::Sequence< rtl::OUString > SAL_CALL ScChart2EmptyDataSequence::getTextualData(  ) throw (uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-    if ( !m_pDocument)
-        throw uno::RuntimeException();
-
-    sal_Int32 nCount = 0;
-    ScRange* p;
-
-    OSL_ENSURE(m_xRanges->Count() == 1, "not handled count of ranges");
-
-    for ( p = m_xRanges->First(); p; p = m_xRanges->Next())
-    {
-        p->Justify();
-        // TODO: handle overlaping ranges?
-        nCount += m_bColumn ? p->aEnd.Col() - p->aStart.Col() + 1 : p->aEnd.Row() - p->aStart.Row() + 1;
-    }
-    uno::Sequence< rtl::OUString > aSeq( nCount);
-    rtl::OUString* pArr = aSeq.getArray();
-    nCount = 0;
-    for ( p = m_xRanges->First(); p; p = m_xRanges->Next())
-    {
-        if (m_bColumn)
-        {
-            for (SCCOL nCol = p->aStart.Col(); nCol <= p->aEnd.Col(); ++nCol)
-            {
-                String aString = ScGlobal::GetRscString(STR_COLUMN);
-                aString += ' ';
-                ScAddress aPos( nCol, 0, 0 );
-                String aColStr;
-                aPos.Format( aColStr, SCA_VALID_COL, NULL );
-                aString += aColStr;
-                pArr[nCount] = aString;
-                ++nCount;
-            }
-        }
-        else
-        {
-            sal_Int32 n = p->aEnd.Row() - p->aStart.Row() + 1;
-            for (sal_Int32 i = 0; i < n; ++i)
-                pArr[nCount++] = String::CreateFromInt32( i+1 );
-        }
-    }
-    return aSeq;
-}
-
-::rtl::OUString SAL_CALL ScChart2EmptyDataSequence::getSourceRangeRepresentation()
-            throw ( uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-    String  aStr;
-    OSL_ENSURE( m_pDocument, "No Document -> no SourceRangeRepresentation" );
-    if( m_pDocument )
-        m_xRanges->Format( aStr, SCR_ABS_3D, m_pDocument, m_pDocument->GetAddressConvention() );
-    return aStr;
-}
-
-uno::Sequence< ::rtl::OUString > SAL_CALL ScChart2EmptyDataSequence::generateLabel(chart2::data::LabelOrigin /*nOrigin*/)
-        throw (uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-    uno::Sequence< ::rtl::OUString > aRet;
-    return aRet;
-}
-
-::sal_Int32 SAL_CALL ScChart2EmptyDataSequence::getNumberFormatKeyByIndex( ::sal_Int32 /*nIndex*/ )
-    throw (lang::IndexOutOfBoundsException,
-           uno::RuntimeException)
-{
-    sal_Int32 nResult = 0;
-
-    SolarMutexGuard aGuard;
-    if ( !m_pDocument)
-        return nResult;
-
-    return nResult;
-}
-
-// XCloneable ================================================================
-
-uno::Reference< util::XCloneable > SAL_CALL ScChart2EmptyDataSequence::createClone()
-    throw (uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-    if (m_xDataProvider.is())
-    {
-        // copy properties
-        uno::Reference < util::XCloneable > xClone(new ScChart2EmptyDataSequence(m_pDocument, m_xDataProvider, new ScRangeList(*m_xRanges), m_bColumn));
-        uno::Reference< beans::XPropertySet > xProp( xClone, uno::UNO_QUERY );
-        if( xProp.is())
-        {
-            xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ROLE )),
-                                     uno::makeAny( m_aRole ));
-            xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS )),
-                                     uno::makeAny( m_bIncludeHiddenCells ));
-        }
-        return xClone;
-    }
-    return uno::Reference< util::XCloneable >();
-}
-
-// XModifyBroadcaster ========================================================
-
-void SAL_CALL ScChart2EmptyDataSequence::addModifyListener( const uno::Reference< util::XModifyListener >& /*aListener*/ )
-    throw (uno::RuntimeException)
-{
-    // TODO: Implement
-}
-
-void SAL_CALL ScChart2EmptyDataSequence::removeModifyListener( const uno::Reference< util::XModifyListener >& /*aListener*/ )
-    throw (uno::RuntimeException)
-{
-    // TODO: Implement
-}
-
-// DataSequence XPropertySet -------------------------------------------------
-
-uno::Reference< beans::XPropertySetInfo> SAL_CALL
-ScChart2EmptyDataSequence::getPropertySetInfo() throw( uno::RuntimeException)
-{
-    SolarMutexGuard aGuard;
-    static uno::Reference<beans::XPropertySetInfo> aRef =
-        new SfxItemPropertySetInfo( m_aPropSet.getPropertyMap() );
-    return aRef;
-}
-
-
-void SAL_CALL ScChart2EmptyDataSequence::setPropertyValue(
-        const ::rtl::OUString& rPropertyName, const uno::Any& rValue)
-            throw( beans::UnknownPropertyException,
-                    beans::PropertyVetoException,
-                    lang::IllegalArgumentException,
-                    lang::WrappedTargetException, uno::RuntimeException)
-{
-    if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ROLE)))
-    {
-        if ( !(rValue >>= m_aRole))
-            throw lang::IllegalArgumentException();
-    }
-    else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS)))
-    {
-        if ( !(rValue >>= m_bIncludeHiddenCells))
-            throw lang::IllegalArgumentException();
-    }
-    else
-        throw beans::UnknownPropertyException();
-    // TODO: support optional properties
-}
-
-
-uno::Any SAL_CALL ScChart2EmptyDataSequence::getPropertyValue(
-        const ::rtl::OUString& rPropertyName)
-            throw( beans::UnknownPropertyException,
-                    lang::WrappedTargetException, uno::RuntimeException)
-{
-    uno::Any aRet;
-    if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ROLE)))
-        aRet <<= m_aRole;
-    else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS)))
-        aRet <<= m_bIncludeHiddenCells;
-    else
-        throw beans::UnknownPropertyException();
-    // TODO: support optional properties
-    return aRet;
-}
-
-
-void SAL_CALL ScChart2EmptyDataSequence::addPropertyChangeListener(
-        const ::rtl::OUString& /*rPropertyName*/,
-        const uno::Reference< beans::XPropertyChangeListener>& /*xListener*/)
-            throw( beans::UnknownPropertyException,
-                    lang::WrappedTargetException, uno::RuntimeException)
-{
-    // FIXME: real implementation
-    OSL_FAIL( "Not yet implemented" );
-}
-
-
-void SAL_CALL ScChart2EmptyDataSequence::removePropertyChangeListener(
-        const ::rtl::OUString& /*rPropertyName*/,
-        const uno::Reference< beans::XPropertyChangeListener>& /*rListener*/)
-            throw( beans::UnknownPropertyException,
-                    lang::WrappedTargetException, uno::RuntimeException)
-{
-    // FIXME: real implementation
-    OSL_FAIL( "Not yet implemented" );
-}
-
-
-void SAL_CALL ScChart2EmptyDataSequence::addVetoableChangeListener(
-        const ::rtl::OUString& /*rPropertyName*/,
-        const uno::Reference< beans::XVetoableChangeListener>& /*rListener*/)
-            throw( beans::UnknownPropertyException,
-                    lang::WrappedTargetException, uno::RuntimeException)
-{
-    // FIXME: real implementation
-    OSL_FAIL( "Not yet implemented" );
-}
-
-
-void SAL_CALL ScChart2EmptyDataSequence::removeVetoableChangeListener(
-        const ::rtl::OUString& /*rPropertyName*/,
-        const uno::Reference< beans::XVetoableChangeListener>& /*rListener*/ )
-            throw( beans::UnknownPropertyException,
-                    lang::WrappedTargetException, uno::RuntimeException)
-{
-    // FIXME: real implementation
-    OSL_FAIL( "Not yet implemented" );
-}
-
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4ea9d4daf7a2e79a0b78701f1a5f76b447d132ed
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Dec 5 14:49:09 2011 -0500

    Use boost::scoped_ptr in lieu of std::auto_ptr (where we can).

diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx
index a670f10..2f92349 100644
--- a/sc/inc/chart2uno.hxx
+++ b/sc/inc/chart2uno.hxx
@@ -56,11 +56,13 @@
 #include <rtl/ustring.hxx>
 #include <svl/itemprop.hxx>
 
-#include <boost/unordered_set.hpp>
 #include <list>
 #include <vector>
 #include <memory>
 #include <boost/shared_ptr.hpp>
+#include <boost/unordered_set.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
 
 #define USE_CHART2_EMPTYDATASEQUENCE 0
 
@@ -246,9 +248,9 @@ class ScChart2DataSequence : public
                     ::com::sun::star::util::XCloneable,
                     ::com::sun::star::util::XModifyBroadcaster,
                     ::com::sun::star::beans::XPropertySet,
-//                     ::com::sun::star::lang::XUnoTunnel,
                     ::com::sun::star::lang::XServiceInfo>,
-                SfxListener
+                SfxListener,
+                boost::noncopyable
 {
 public:
     explicit ScChart2DataSequence( ScDocument* pDoc,
@@ -448,11 +450,9 @@ private:
     sal_Bool                    m_bIncludeHiddenCells;
 
     // internals
-    SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    typedef ::std::auto_ptr< ::std::vector<ScTokenRef> >  TokenListPtr;
-    typedef ::std::auto_ptr< ::std::vector<sal_uInt32> >        RangeIndexMapPtr;
-    typedef ::std::auto_ptr<ExternalRefListener>                ExtRefListenerPtr;
-    SAL_WNODEPRECATED_DECLARATIONS_POP
+    typedef boost::scoped_ptr<std::vector<ScTokenRef> >  TokenListPtr;
+    typedef boost::scoped_ptr<std::vector<sal_uInt32> >  RangeIndexMapPtr;
+    typedef boost::scoped_ptr<ExternalRefListener>       ExtRefListenerPtr;
 
     sal_Int64                   m_nObjectId;
     ScDocument*                 m_pDocument;
@@ -462,9 +462,8 @@ private:
     com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
     SfxItemPropertySet          m_aPropSet;
 
-    SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    ::std::auto_ptr<HiddenRangeListener> m_pHiddenListener;
-    SAL_WNODEPRECATED_DECLARATIONS_POP
+    boost::scoped_ptr<HiddenRangeListener> m_pHiddenListener;
+
     ScLinkListener*             m_pValueListener;
     XModifyListenerArr_Impl     m_aValueListeners;
 
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 5ebef6f..0b7aaa0 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -55,12 +55,8 @@
 #include <comphelper/extract.hxx>
 #include <comphelper/processfactory.hxx>
 
-#include <vector>
-#include <list>
 #include <rtl/math.hxx>
 
-#include <boost/scoped_ptr.hpp>
-
 SC_SIMPLE_SERVICE_INFO( ScChart2DataProvider, "ScChart2DataProvider",
         "com.sun.star.chart2.data.DataProvider")
 SC_SIMPLE_SERVICE_INFO( ScChart2DataSource, "ScChart2DataSource",
commit 1e169828b1fdd50a09540cf4927b3c64639bbca7
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Sat Dec 3 11:55:21 2011 -0500

    Make the class officially non-copyable.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index e77f7e0..5ebef6f 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -443,7 +443,7 @@ vector<ScTokenRef>* Chart2PositionMap::getDataRowRanges(SCROW nRow) const
  * Designed to be a drop-in replacement for ScChartPositioner, in order to
  * handle external references.
  */
-class Chart2Positioner
+class Chart2Positioner : boost::noncopyable
 {
     enum GlueType
     {
commit 73544acaee60655edf90be72a0c05cd7187c051b
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Dec 2 22:49:52 2011 -0500

    std::auto_ptr is deprecated.  Let's use boost::scoped_ptr.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 2dc8b36..e77f7e0 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -59,6 +59,8 @@
 #include <list>
 #include <rtl/math.hxx>
 
+#include <boost/scoped_ptr.hpp>
+
 SC_SIMPLE_SERVICE_INFO( ScChart2DataProvider, "ScChart2DataProvider",
         "com.sun.star.chart2.data.DataProvider")
 SC_SIMPLE_SERVICE_INFO( ScChart2DataSource, "ScChart2DataSource",
@@ -492,9 +494,7 @@ private:
 
 private:
     const vector<ScTokenRef>& mrRefTokens;
-    SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    auto_ptr<Chart2PositionMap>             mpPositionMap;
-    SAL_WNODEPRECATED_DECLARATIONS_POP
+    boost::scoped_ptr<Chart2PositionMap> mpPositionMap;
     GlueType    meGlue;
     SCCOL       mnStartCol;
     SCROW       mnStartRow;
commit a39ed5f75577af80fc77650f1185b326e07b2059
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Dec 2 21:43:05 2011 -0500

    Let's not create unnecessary duplidate.
    
    These ref tokens are only read, not modified.  Taking a const reference
    is sufficient.

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 53ffed8..2dc8b36 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -454,7 +454,7 @@ class Chart2Positioner
 
 public:
     Chart2Positioner(ScDocument* pDoc, const vector<ScTokenRef>& rRefTokens) :
-        mpRefTokens(new vector<ScTokenRef>(rRefTokens)),
+        mrRefTokens(rRefTokens),
         mpPositionMap(NULL),
         meGlue(GLUETYPE_NA),
         mpDoc(pDoc),
@@ -491,7 +491,7 @@ private:
     void createPositionMap();
 
 private:
-    shared_ptr< vector<ScTokenRef> >  mpRefTokens;
+    const vector<ScTokenRef>& mrRefTokens;
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     auto_ptr<Chart2PositionMap>             mpPositionMap;
     SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -516,9 +516,9 @@ void Chart2Positioner::glueState()
         return;
 
     mbDummyUpperLeft = false;
-    if (mpRefTokens->size() <= 1)
+    if (mrRefTokens.size() <= 1)
     {
-        const ScTokenRef& p = mpRefTokens->front();
+        const ScTokenRef& p = mrRefTokens.front();
         ScComplexRefData aData;
         if (ScRefTokenHelper::getDoubleRefDataFromToken(aData, p))
         {
@@ -539,13 +539,13 @@ void Chart2Positioner::glueState()
     }
 
     ScComplexRefData aData;
-    ScRefTokenHelper::getDoubleRefDataFromToken(aData, mpRefTokens->front());
+    ScRefTokenHelper::getDoubleRefDataFromToken(aData, mrRefTokens.front());
     mnStartCol = aData.Ref1.nCol;
     mnStartRow = aData.Ref1.nRow;
 
     SCCOL nMaxCols = 0, nEndCol = 0;
     SCROW nMaxRows = 0, nEndRow = 0;
-    for (vector<ScTokenRef>::const_iterator itr = mpRefTokens->begin(), itrEnd = mpRefTokens->end()
+    for (vector<ScTokenRef>::const_iterator itr = mrRefTokens.begin(), itrEnd = mrRefTokens.end()
          ; itr != itrEnd; ++itr)
     {
         ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr);
@@ -609,7 +609,7 @@ void Chart2Positioner::glueState()
     const sal_uInt8 nGlue = 3;
 
     vector<sal_uInt8> aCellStates(nCR);
-    for (vector<ScTokenRef>::const_iterator itr = mpRefTokens->begin(), itrEnd = mpRefTokens->end();
+    for (vector<ScTokenRef>::const_iterator itr = mrRefTokens.begin(), itrEnd = mrRefTokens.end();
           itr != itrEnd; ++itr)
     {
         ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr);
@@ -713,7 +713,7 @@ void Chart2Positioner::createPositionMap()
     SAL_WNODEPRECATED_DECLARATIONS_POP
     Table* pCol = NULL;
     SCROW nNoGlueRow = 0;
-    for (vector<ScTokenRef>::const_iterator itr = mpRefTokens->begin(), itrEnd = mpRefTokens->end();
+    for (vector<ScTokenRef>::const_iterator itr = mrRefTokens.begin(), itrEnd = mrRefTokens.end();
           itr != itrEnd; ++itr)
     {
         const ScTokenRef& pToken = *itr;


More information about the Libreoffice-commits mailing list