[Libreoffice-commits] .: 3 commits - sc/inc sc/qa sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 1 13:30:51 PDT 2012


 sc/inc/column.hxx                   |   11 -----------
 sc/inc/document.hxx                 |    3 ---
 sc/inc/table.hxx                    |    4 ----
 sc/qa/unit/ucalc.cxx                |    7 +++++++
 sc/source/core/data/column.cxx      |   15 ---------------
 sc/source/core/data/column3.cxx     |    3 ---
 sc/source/core/data/documen3.cxx    |   12 ------------
 sc/source/core/data/document.cxx    |   16 ----------------
 sc/source/core/data/table1.cxx      |   11 +++--------
 sc/source/core/data/table2.cxx      |   35 -----------------------------------
 sc/source/core/data/table3.cxx      |   12 ------------
 sc/source/core/data/table6.cxx      |    5 -----
 sc/source/filter/excel/colrowst.cxx |    5 -----
 sc/source/ui/docshell/dbdocimp.cxx  |    1 -
 sc/source/ui/docshell/docfunc.cxx   |    8 ++++++++
 sc/source/ui/docshell/docsh.cxx     |   10 ----------
 sc/source/ui/docshell/docsh8.cxx    |    3 ---
 sc/source/ui/docshell/impex.cxx     |    2 --
 sc/source/ui/docshell/olinefun.cxx  |   15 +++------------
 sc/source/ui/undo/undoblk.cxx       |   16 ++++++++++++++++
 sc/source/ui/unoobj/cellsuno.cxx    |    6 ------
 21 files changed, 37 insertions(+), 163 deletions(-)

New commits:
commit 52faa1f933f07ac93752dffdc1a35620029252e3
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Nov 1 16:28:57 2012 -0400

    Explicitly call these methods to init / update note positions.
    
    Since we don't use inc / dec recalc level, we need to do this.
    
    Change-Id: Ia99b4dbfceefd1ed951a61374250c5c61e39a62a

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 1882593..e77f4ca 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1499,6 +1499,8 @@ sal_Bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMa
     itr = aMark.begin();
     for (; itr != itrEnd && nTabCount; ++itr)
     {
+        pDoc->InitializeNoteCaptions(*itr);
+
         i = *itr;
         if( pDoc->HasAttrib( nMergeTestStartX, nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) )
         {
@@ -1721,6 +1723,8 @@ sal_Bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMa
         for (; itr != itrEnd && *itr < nTabCount; ++itr)
         {
             i = *itr;
+            pDoc->SetDrawPageSize(i);
+
             if (bNeedRefresh)
                 pDoc->ExtendMerge( nMergeTestStartX, nMergeTestStartY, nMergeTestEndX, nMergeTestEndY, i, sal_True );
             else
@@ -1904,6 +1908,8 @@ sal_Bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMa
     itr = aMark.begin();
     for (; itr != itrEnd && *itr < nTabCount; ++itr)
     {
+        pDoc->InitializeNoteCaptions(*itr);
+
         SCTAB i = *itr;
         if ( pDoc->HasAttrib( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i, HASATTR_MERGED | HASATTR_OVERLAPPED ))
         {
@@ -2227,6 +2233,8 @@ sal_Bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMa
     itr = aMark.begin(), itrEnd = aMark.end();
     for (; itr != itrEnd && *itr < nTabCount; ++itr)
     {
+        pDoc->SetDrawPageSize(*itr);
+
         if ( eCmd == DEL_DELCOLS || eCmd == DEL_DELROWS )
             pDoc->UpdatePageBreaks( *itr );
 
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 3fe71b1..754aed1 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -284,6 +284,10 @@ void ScUndoInsertCells::Undo()
     BeginUndo();
     DoChange( sal_True );
     EndUndo();
+
+    ScDocument* pDoc = pDocShell->GetDocument();
+    for (SCTAB i = 0; i < nCount; ++i)
+        pDoc->SetDrawPageSize(pTabs[i]);
 }
 
 void ScUndoInsertCells::Redo()
@@ -295,6 +299,10 @@ void ScUndoInsertCells::Redo()
 
     if ( pPasteUndo )
         pPasteUndo->Redo();     // redo paste last
+
+    ScDocument* pDoc = pDocShell->GetDocument();
+    for (SCTAB i = 0; i < nCount; ++i)
+        pDoc->SetDrawPageSize(pTabs[i]);
 }
 
 void ScUndoInsertCells::Repeat(SfxRepeatTarget& rTarget)
@@ -519,6 +527,10 @@ void ScUndoDeleteCells::Undo()
             pViewShell->MarkRange( ScRange(aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i]) );
         }
     }
+
+    ScDocument* pDoc = pDocShell->GetDocument();
+    for (SCTAB i = 0; i < nCount; ++i)
+        pDoc->SetDrawPageSize(pTabs[i]);
 }
 
 void ScUndoDeleteCells::Redo()
@@ -532,6 +544,10 @@ void ScUndoDeleteCells::Redo()
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
         pViewShell->DoneBlockMode();            // current way
+
+    ScDocument* pDoc = pDocShell->GetDocument();
+    for (SCTAB i = 0; i < nCount; ++i)
+        pDoc->SetDrawPageSize(pTabs[i]);
 }
 
 void ScUndoDeleteCells::Repeat(SfxRepeatTarget& rTarget)
commit b10833d4db6046f2d32ea44a60cb19a626d80447
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Nov 1 14:41:51 2012 -0400

    No more "increase / decrease of recalc level" for drawing objects.
    
    That scheme made it extremely hard to determine when the object's
    positions get recalculated.  It's better to figure out when to recalc
    drawing objects' positions, and call SetDrawPageSize() manually at
    that point (and only once!)
    
    Change-Id: I05d9b693cfc9310f5472ed8287c7a2e36646f4d7

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 390002e..f114ecb 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1718,9 +1718,6 @@ public:
     void                SetExpandRefs( bool bVal ) { bExpandRefs = bVal; }
     bool                IsExpandRefs() { return bExpandRefs; }
 
-    SC_DLLPUBLIC void               IncSizeRecalcLevel( SCTAB nTab );
-    SC_DLLPUBLIC void               DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos = true );
-
     sal_uLong               GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; }
     void                IncXMLImportedFormulaCount( sal_uLong nVal )
                             {
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index c630cb7..39c99f1 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -142,7 +142,6 @@ private:
     mutable SCROW nTableAreaY;
 
     SCTAB           nTab;
-    sal_uInt16          nRecalcLvl;             // recursion level Size-Recalc
     ScDocument*     pDocument;
     utl::TextSearch*    pSearchText;
 
@@ -779,9 +778,6 @@ public:
                                        SCCOL nCol,
                                        SCROW nRowStart, SCROW nRowEnd ) const;
 
-    void        IncRecalcLevel();
-    void        DecRecalcLevel( bool bUpdateNoteCaptionPos = true );
-
     bool        IsSortCollatorGlobal() const;
     void        InitSortCollator( const ScSortParam& rPar );
     void        DestroySortCollator();
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b489cb7..247a75f 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4078,19 +4078,23 @@ void Test::testGraphicsInGroup()
 
         //Use a range of rows guaranteed to include all of the square
         m_pDoc->ShowRows(0, 100, 0, false);
+        m_pDoc->SetDrawPageSize(0);
         CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect);
         m_pDoc->ShowRows(0, 100, 0, true);
+        m_pDoc->SetDrawPageSize(0);
         CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect);
 
         ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0);
         CPPUNIT_ASSERT_MESSAGE("That shouldn't change size or positioning", aOrigRect == rNewRect);
 
         m_pDoc->ShowRows(0, 100, 0, false);
+        m_pDoc->SetDrawPageSize(0);
         CPPUNIT_ASSERT_MESSAGE("Left and Right should be unchanged",
             aOrigRect.nLeft == rNewRect.nLeft && aOrigRect.nRight == rNewRect.nRight);
         CPPUNIT_ASSERT_MESSAGE("Height should be minimum allowed height",
             (rNewRect.nBottom - rNewRect.nTop) <= 1);
         m_pDoc->ShowRows(0, 100, 0, true);
+        m_pDoc->SetDrawPageSize(0);
         CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect);
     }
 
@@ -4109,6 +4113,7 @@ void Test::testGraphicsInGroup()
 
         // Insert 2 rows at the top.  This should push the circle object down.
         m_pDoc->InsertRow(0, 0, MAXCOL, 0, 0, 2);
+        m_pDoc->SetDrawPageSize(0);
 
         // Make sure the size of the circle is still identical.
         CPPUNIT_ASSERT_MESSAGE("Size of the circle has changed, but shouldn't!",
@@ -4116,6 +4121,7 @@ void Test::testGraphicsInGroup()
 
         // Delete 2 rows at the top.  This should bring the circle object to its original position.
         m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 2);
+        m_pDoc->SetDrawPageSize(0);
         CPPUNIT_ASSERT_MESSAGE("Failed to move back to its original position.", aOrigRect == rNewRect);
     }
 
@@ -4139,6 +4145,7 @@ void Test::testGraphicsInGroup()
         // Insert 2 rows at the top and delete them immediately.
         m_pDoc->InsertRow(0, 0, MAXCOL, 0, 0, 2);
         m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 2);
+        m_pDoc->SetDrawPageSize(0);
         CPPUNIT_ASSERT_MESSAGE("Size of a line object changed after row insertion and removal.",
                                aOrigRect == rNewRect);
 
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 54ce14f..600bf60 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -2088,16 +2088,4 @@ void ScDocument::ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
         maTabs[nTab]->ExtendPrintArea( pDev, nStartCol, nStartRow, rEndCol, nEndRow );
 }
 
-void ScDocument::IncSizeRecalcLevel( SCTAB nTab )
-{
-    if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
-        maTabs[nTab]->IncRecalcLevel();
-}
-
-void ScDocument::DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos )
-{
-    if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
-        maTabs[nTab]->DecRecalcLevel( bUpdateNoteCaptionPos );
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c8773db..56a574b 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2411,7 +2411,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
                     if ( *itr < aCBFCP.nTabStart )
                         aCBFCP.nTabStart = *itr;
                     aCBFCP.nTabEnd = *itr;
-                    maTabs[*itr]->IncRecalcLevel();
                 }
 
             ScRangeList aLocalRangeList;
@@ -2484,9 +2483,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
             }
 
             itr = rMark.begin();
-            for (; itr != itrEnd && *itr < nMax; ++itr)
-                if (maTabs[*itr] )
-                    maTabs[*itr]->DecRecalcLevel();
 
             bInsertingFromOtherDoc = false;
 
@@ -2554,7 +2550,6 @@ void ScDocument::CopyMultiRangeFromClip(
             if ( *itr < aCBFCP.nTabStart )
                 aCBFCP.nTabStart = *itr;
             aCBFCP.nTabEnd = *itr;
-            maTabs[*itr]->IncRecalcLevel();
         }
     }
 
@@ -2618,9 +2613,6 @@ void ScDocument::CopyMultiRangeFromClip(
     }
 
     itr = rMark.begin();
-    for (; itr != itrEnd && *itr < nMax; ++itr)
-        if (maTabs[*itr])
-            maTabs[*itr]->DecRecalcLevel();
 
     bInsertingFromOtherDoc = false;
 
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 6d61bd7..4da2595 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -160,12 +160,10 @@ struct SetRowHeightRangeFunc : public OptimalHeightsFuncObjBase
     }
 };
 
-bool SetOptimalHeightsToRows( OptimalHeightsFuncObjBase& rFuncObj, ScTable* pTab,
+bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj,
     ScBitMaskCompressedArray<SCROW, sal_uInt8>* pRowFlags, SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
     const vector<sal_uInt16>& aHeights, bool bForce)
 {
-    pTab->IncRecalcLevel();       // #i116460# avoid problems with Excel files
-
     SCSIZE nCount = static_cast<SCSIZE>(nEndRow-nStartRow+1);
     bool bChanged = false;
     SCROW nRngStart = 0;
@@ -222,8 +220,6 @@ bool SetOptimalHeightsToRows( OptimalHeightsFuncObjBase& rFuncObj, ScTable* pTab
     if (nLast)
         bChanged |= rFuncObj(nRngStart, nRngEnd, nLast);
 
-    pTab->DecRecalcLevel();       // #i116460# avoid problems with Excel files
-
     return bChanged;
 }
 
@@ -253,7 +249,6 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const rtl::OUString& rNewName
     pOutlineTable( NULL ),
     pSheetEvents( NULL ),
     nTab( nNewTab ),
-    nRecalcLvl( 0 ),
     pDocument( pDoc ),
     pSearchText ( NULL ),
     pSortCollator( NULL ),
@@ -485,7 +480,7 @@ bool ScTable::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtr
 
     SetRowHeightRangeFunc aFunc(this, nPPTX, nPPTY);
     bool bChanged = SetOptimalHeightsToRows(
-        aFunc, this, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce);
+        aFunc, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce);
 
     if ( pProgress != pOuterProgress )
         delete pProgress;
@@ -516,7 +511,7 @@ void ScTable::SetOptimalHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 n
 
     SetRowHeightOnlyFunc aFunc(this);
     SetOptimalHeightsToRows(
-        aFunc, this, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce);
+        aFunc, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce);
 
     if ( pProgress != pOuterProgress )
         delete pProgress;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 2a51d54..193e7f0 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -134,8 +134,6 @@ bool ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize ) cons
 
 void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize )
 {
-    IncRecalcLevel();
-    InitializeNoteCaptions();
     if (nStartCol==0 && nEndCol==MAXCOL)
     {
         if (mpRowHeights && pRowFlags)
@@ -201,8 +199,6 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
         aNotes.ReleaseNote( nCol, nRow);
     }
 
-    DecRecalcLevel( false );
-
     InvalidatePageBreaks();
 
     if (IsStreamValid())
@@ -215,8 +211,6 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
 void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
                             bool* pUndoOutline )
 {
-    IncRecalcLevel();
-    InitializeNoteCaptions();
     if (nStartCol==0 && nEndCol==MAXCOL)
     {
         if (pRowFlags)
@@ -291,7 +285,6 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
         for (SCCOL j=nStartCol; j<=nEndCol; j++)
             aCol[j].DeleteRow( nStartRow, nSize );
     }
-    DecRecalcLevel();
 
     InvalidatePageBreaks();
 
@@ -321,8 +314,6 @@ bool ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) cons
 
 void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize )
 {
-    IncRecalcLevel();
-    InitializeNoteCaptions();
     if (nStartRow==0 && nEndRow==MAXROW)
     {
         if (pColWidth && pColFlags)
@@ -411,7 +402,6 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
             aCol[nStartCol+i].ClearItems( nStartRow, nEndRow, nWhichArray );
         }
     }
-    DecRecalcLevel();
 
     InvalidatePageBreaks();
 
@@ -425,8 +415,6 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
 void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize,
                             bool* pUndoOutline )
 {
-    IncRecalcLevel();
-    InitializeNoteCaptions();
     if (nStartRow==0 && nEndRow==MAXROW)
     {
         if (pColWidth && pColFlags)
@@ -510,8 +498,6 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
         aNotes.ReleaseNote( nCol, nRow);
     }
 
-    DecRecalcLevel();
-
     InvalidatePageBreaks();
 
     if (IsStreamValid())
@@ -736,7 +722,6 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
 
     if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
     {
-        IncRecalcLevel();
         for ( SCCOL i = nCol1; i <= nCol2; i++)
             aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
 
@@ -783,7 +768,6 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
             // create deep copies for conditional formatting
             CopyConditionalFormat( nCol1, nRow1, nCol2, nRow2, nDx, nDy, pTable);
         }
-        DecRecalcLevel();
     }
 }
 
@@ -1026,8 +1010,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
 
     if (bWidth || bHeight)
     {
-        pDestTab->IncRecalcLevel();
-
         if (bWidth)
         {
             for (SCCOL i = nCol1; i <= nCol2; ++i)
@@ -1092,7 +1074,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
             }
             pDestTab->SetRowManualBreaks( maRowManualBreaks);
         }
-        pDestTab->DecRecalcLevel();
     }
 
     if (bFlagChange)
@@ -1111,9 +1092,6 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
         bool bWidth  = (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth);
         bool bHeight = (nCol1==0 && nCol2==MAXCOL && mpRowHeights && pDestTab->mpRowHeights);
 
-        if (bWidth||bHeight)
-            IncRecalcLevel();
-
         for ( SCCOL i = 0; i <= MAXCOL; i++)
         {
             if ( i >= nCol1 && i <= nCol2 )
@@ -1147,7 +1125,6 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                 pDestTab->CopyRowHeight(*this, nRow1, nRow2, 0);
                 pDestTab->SetRowManualBreaks( maRowManualBreaks);
             }
-            DecRecalcLevel();
         }
     }
 }
@@ -2408,11 +2385,7 @@ void ScTable::SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth )
 
         if ( nNewWidth != pColWidth[nCol] )
         {
-            IncRecalcLevel();
-            InitializeNoteCaptions();
             pColWidth[nCol] = nNewWidth;
-            DecRecalcLevel();
-
             InvalidatePageBreaks();
         }
     }
@@ -2786,11 +2759,7 @@ void ScTable::ShowCol(SCCOL nCol, bool bShow)
         bool bWasVis = !ColHidden(nCol);
         if (bWasVis != bShow)
         {
-            IncRecalcLevel();
-            InitializeNoteCaptions();
-
             SetColHidden(nCol, nCol, !bShow);
-            DecRecalcLevel();
 
             ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
             if ( pCharts )
@@ -2891,8 +2860,6 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
 void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
 {
     SCROW nStartRow = nRow1;
-    IncRecalcLevel();
-    InitializeNoteCaptions();
 
     // #i116164# if there are no drawing objects within the row range, a single HeightChanged call is enough
     ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
@@ -2930,8 +2897,6 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
         if (bShow)
             SetRowFiltered(nRow1, nRow2, false);
     }
-
-    DecRecalcLevel();
 }
 
 bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 8058e0a..d84fe1f 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2306,16 +2306,4 @@ void ScTable::UpdateSelectionFunction( ScFunctionData& rData,
                 aCol[nCol].UpdateAreaFunction( rData, *mpHiddenRows, nStartRow, nEndRow );
 }
 
-void ScTable::IncRecalcLevel()
-{
-    ++nRecalcLvl;
-}
-
-void ScTable::DecRecalcLevel(bool bUpdateNoteCaptionPos)
-{
-     if (!--nRecalcLvl)
-         SetDrawPageSize(true, bUpdateNoteCaptionPos);
-}
-
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index 2b4dc05..f77779f 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -204,7 +204,6 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
         return;
 
     ScDocument& rDoc = GetDoc();
-    rDoc.IncSizeRecalcLevel( nScTab );
 
     // column widths ----------------------------------------------------------
 
@@ -288,13 +287,11 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
     // ------------------------------------------------------------------------
 
     mbDirty = false;
-    rDoc.DecSizeRecalcLevel( nScTab );
 }
 
 void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab )
 {
     ScDocument& rDoc = GetDoc();
-    rDoc.IncSizeRecalcLevel( nScTab );      // #i116460# performance with many hidden rows
 
     // hide the columns
     for( SCCOL nScCol = 0; nScCol <= MAXCOL; ++nScCol )
@@ -355,8 +352,6 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab )
     // #i47438# if default row format is hidden, hide remaining rows
     if( ::get_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ) && (mnLastScRow < MAXROW) )
         rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, false );
-
-    rDoc.DecSizeRecalcLevel( nScTab );      // #i116460# performance with many hidden rows
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 667daf3..aa03211 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -383,8 +383,6 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1
                                     bColumns, nLevel ) );
     }
 
-    pDoc->IncSizeRecalcLevel( nTab );
-
     pDoc->InitializeNoteCaptions(nTab);
     ScSubOutlineIterator aIter( pArray );                   // alle Eintraege
     ScOutlineEntry* pEntry;
@@ -426,7 +424,6 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1
         }
     }
 
-    pDoc->DecSizeRecalcLevel( nTab );
     pDoc->SetDrawPageSize(nTab);
     pDoc->UpdatePageBreaks( nTab );
 
@@ -481,7 +478,7 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b
                                         pUndoDoc, pUndoTab, sal_True ) );
         }
 
-        pDoc->IncSizeRecalcLevel( nTab );
+        pDoc->InitializeNoteCaptions(nTab);
 
         //  Spalten
 
@@ -534,7 +531,6 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b
             i = nFilterEnd;
         }
 
-        pDoc->DecSizeRecalcLevel( nTab );
         pDoc->SetDrawPageSize(nTab);
         pDoc->UpdatePageBreaks( nTab );
 
@@ -601,7 +597,7 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b
                                         pUndoDoc, pUndoTab, false ) );
         }
 
-        pDoc->IncSizeRecalcLevel( nTab );
+        pDoc->InitializeNoteCaptions(nTab);
 
         //  Spalten
 
@@ -629,7 +625,7 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b
                 HideOutline( nTab, false, nRowLevel, i, false, false, bApi );
         }
 
-        pDoc->DecSizeRecalcLevel( nTab );
+        pDoc->SetDrawPageSize(nTab);
         pDoc->UpdatePageBreaks( nTab );
 
         rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
@@ -680,8 +676,6 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1
                                     bColumns, nLevel, nEntry, sal_True ) );
     }
 
-    pDoc->IncSizeRecalcLevel( nTab );
-
     pDoc->InitializeNoteCaptions(nTab);
     pEntry->SetHidden(false);
     SCCOLROW i;
@@ -767,8 +761,6 @@ sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1
                                     bColumns, nLevel, nEntry, false ) );
     }
 
-    pDoc->IncSizeRecalcLevel( nTab );
-
     pDoc->InitializeNoteCaptions(nTab);
     pEntry->SetHidden(true);
     SCCOLROW i;
@@ -780,7 +772,6 @@ sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1
 
     pArray->SetVisibleBelow( nLevel, nEntry, false );
 
-    pDoc->DecSizeRecalcLevel( nTab );
     pDoc->SetDrawPageSize(nTab);
     pDoc->InvalidatePageBreaks(nTab);
     pDoc->UpdatePageBreaks( nTab );
commit cf0a88962f5c7835d417fb272e4792fb921139af
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Nov 1 14:07:09 2012 -0400

    Double allocation switch no longer used since we switched to std::vector...
    
    for cell storage in column.  And std::vector internally does double allocation.
    
    Change-Id: I4363e7593def3feb71100487c7f88c05797596e7

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 3206637..a2aad72 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -117,17 +117,6 @@ friend class ScHorizontalCellIterator;
 friend class ScHorizontalAttrIterator;
 
 public:
-    static bool bDoubleAlloc;                  // for Import: double size for alloc
-
-    class DoubleAllocSwitch
-    {
-    public:
-        DoubleAllocSwitch(bool bNewVal = true);
-        ~DoubleAllocSwitch();
-    private:
-        bool mbOldVal;
-    };
-public:
                 ScColumn();
                 ~ScColumn();
 
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 683f99d..3636f60 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -62,21 +62,6 @@ inline bool IsAmbiguousScriptNonZero( sal_uInt8 nScript )
              nScript != 0 );
 }
 
-// ----------------------------------------------------------------------------
-
-ScColumn::DoubleAllocSwitch::DoubleAllocSwitch(bool bNewVal) :
-    mbOldVal(ScColumn::bDoubleAlloc)
-{
-    ScColumn::bDoubleAlloc = bNewVal;
-}
-
-ScColumn::DoubleAllocSwitch::~DoubleAllocSwitch()
-{
-    ScColumn::bDoubleAlloc = mbOldVal;
-}
-
-// ----------------------------------------------------------------------------
-
 ScColumn::ScColumn() :
     nCol( 0 ),
     pAttrArray( NULL ),
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 9afed9c..f2c4eca 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -65,9 +65,6 @@ extern const ScFormulaCell* pLastFormulaTreeTop;    // in cellform.cxx
 using namespace formula;
 // STATIC DATA -----------------------------------------------------------
 
-bool ScColumn::bDoubleAlloc = false;    // fuer Import: Groesse beim Allozieren verdoppeln
-
-
 void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
 {
     sal_Bool bIsAppended = false;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3715f45..c8773db 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2423,12 +2423,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
 
             bInsertingFromOtherDoc = true;  // kein Broadcast/Listener aufbauen bei Insert
 
-            // bei mindestens 64 Zeilen wird in ScColumn::CopyFromClip voralloziert
-            bool bDoDouble = ( nYw < 64 && nAllRow2 - nAllRow1 > 64);
-            bool bOldDouble = ScColumn::bDoubleAlloc;
-            if (bDoDouble)
-                ScColumn::bDoubleAlloc = true;
-
             SCCOL nClipStartCol = aClipRange.aStart.Col();
             SCROW nClipStartRow = aClipRange.aStart.Row();
             SCROW nClipEndRow = aClipRange.aEnd.Row();
@@ -2489,8 +2483,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
                 } while (nR1 <= nRow2);
             }
 
-            ScColumn::bDoubleAlloc = bOldDouble;
-
             itr = rMark.begin();
             for (; itr != itrEnd && *itr < nMax; ++itr)
                 if (maTabs[*itr] )
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index e198b22..54a1eb8 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -480,10 +480,6 @@ bool ScTable::ReplaceAll(
     const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
     rtl::OUString& rUndoStr, ScDocument* pUndoDoc)
 {
-    bool bOldDouble = ScColumn::bDoubleAlloc;       // sollte immer sal_False sein?
-    OSL_ENSURE(!bOldDouble,"bDoubleAlloc ???");
-    ScColumn::bDoubleAlloc = true;                  // fuer Undo-Doc
-
     SCCOL nCol = 0;
     SCROW nRow = -1;
 
@@ -500,7 +496,6 @@ bool ScTable::ReplaceAll(
         else
             break;
     }
-    ScColumn::bDoubleAlloc = bOldDouble;
     return bEverFound;
 }
 
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index c3be664..8b76aee 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -201,7 +201,6 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
     // ImportDoc - also used for Redo
     ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO );
     pImportDoc->InitUndo( pDoc, nTab, nTab );
-    ScColumn::DoubleAllocSwitch aAllocSwitch(true);
 
     //
     //  get data from database into import document
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 645911d..eab9a74 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -273,9 +273,6 @@ void ScDocShell::BeforeXMLLoading()
     aDocument.EnableUndo( false );
     // prevent unnecessary broadcasts and "half way listeners"
     aDocument.SetInsertingFromOtherDoc( sal_True );
-
-    if (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
-        ScColumn::bDoubleAlloc = sal_True;
 }
 
 void ScDocShell::AfterXMLLoading(sal_Bool bRet)
@@ -358,7 +355,6 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
                 }
             }
         }
-        ScColumn::bDoubleAlloc = false;
     }
     else
         aDocument.SetInsertingFromOtherDoc( false );
@@ -1084,10 +1080,8 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
                 sItStr = ScGlobal::GetCharsetString( RTL_TEXTENCODING_IBM_437 );
             }
 
-            ScColumn::bDoubleAlloc = sal_True;
             FltError eError = ScFormatFilter::Get().ScImportLotus123( rMedium, &aDocument,
                                                 ScGlobal::GetCharsetValue(sItStr));
-            ScColumn::bDoubleAlloc = false;
             if (eError != eERR_OK)
             {
                 if (!GetError())
@@ -1117,9 +1111,7 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
 
             MakeDrawLayer();                //! im Filter
             CalcOutputFactor();             // prepare update of row height
-            ScColumn::bDoubleAlloc = true;
             FltError eError = ScFormatFilter::Get().ScImportExcel( rMedium, &aDocument, eFormat );
-            ScColumn::bDoubleAlloc = false;
             aDocument.UpdateFontCharSet();
             if ( aDocument.IsChartListenerCollectionNeedsUpdate() )
                 aDocument.UpdateChartListenerCollection();              //! fuer alle Importe?
@@ -1316,9 +1308,7 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
         }
         else if (aFltName.EqualsAscii(pFilterQPro6))
         {
-            ScColumn::bDoubleAlloc = sal_True;
             FltError eError = ScFormatFilter::Get().ScImportQuattroPro( rMedium, &aDocument);
-            ScColumn::bDoubleAlloc = false;
             if (eError != eERR_OK)
             {
                 if (!GetError())
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 6453631..f93c255 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -317,7 +317,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet
 
     return ERRCODE_IO_GENERAL;
 #else
-    ScColumn::DoubleAllocSwitch aAllocSwitch(true);
 
     sal_uLong nErr = eERR_OK;
     long i;
@@ -395,7 +394,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet
         //! add type descriptions
 
         aProgress.SetState( 0 );
-        ScColumn::bDoubleAlloc = true;      // row count isn't readily available in advance
 
         vector<long> aScales(nColCount, -1);
         for (i=0; i<nColCount; i++)
@@ -487,7 +485,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet
         nErr = ERRCODE_IO_GENERAL;
     }
 
-    ScColumn::bDoubleAlloc = false;
     if ( nColCount > 0 )
         aDocument.DoColResize( 0, 0, static_cast<SCCOL>(nColCount) - 1, 0 );
 
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index f966630..b56e937 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1273,8 +1273,6 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
     rStrm.Seek( nOldPos );
     rStrm.StartReadingUnicodeText( rStrm.GetStreamCharSet() );
 
-    ScColumn::DoubleAllocSwitch aAllocSwitch(true);
-
     SCCOL nStartCol = aRange.aStart.Col();
     SCCOL nEndCol = aRange.aEnd.Col();
     SCROW nStartRow = aRange.aStart.Row();
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index a5752a7..f74dfdc 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1192,11 +1192,6 @@ static sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
 
     pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
 
-    /*  #164410# Use double allocation, which will speed up import filters
-        using XCellRangeData::setDataArray() significantly. */
-    bool bDoubleAlloc = ScColumn::bDoubleAlloc;
-    ScColumn::bDoubleAlloc = true;
-
     sal_Bool bError = false;
     SCROW nDocRow = nStartRow;
     for (long nRow=0; nRow<nRows; nRow++)
@@ -1247,7 +1242,6 @@ static sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
 
         ++nDocRow;
     }
-    ScColumn::bDoubleAlloc = bDoubleAlloc;
 
     sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
 


More information about the Libreoffice-commits mailing list