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

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Jan 19 09:57:19 PST 2011


 sc/inc/drwlayer.hxx              |    2 -
 sc/inc/table.hxx                 |   13 --------
 sc/source/core/data/drwlayer.cxx |    6 +---
 sc/source/core/data/table2.cxx   |   45 ++++++------------------------
 sc/source/core/data/table3.cxx   |   57 +++------------------------------------
 sc/source/filter/xml/xmlrowi.cxx |   17 ++---------
 6 files changed, 22 insertions(+), 118 deletions(-)

New commits:
commit 5745a72b0359bac41d63c85c94b0a538148c3be2
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Jan 19 12:54:02 2011 -0500

    Reapplied 8839ada2ba12033f1c7d7ab23f59353e036dbbb2.
    
    The above referenced commit, which originated from OOo's calc64 cws,
    was applied before but the latest merging of the libreoffice-3-3
    branch reverted this.

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 24c6c39..26d7707 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -882,13 +882,29 @@ public:
     USHORT			GetErrCode( const ScAddress& ) const;
 
                     /** Shrink a range to only include data area.
+
                         This is not the actually used area within the
                         selection, but the bounds of the sheet's data area
-                        instead. */
+                        instead.
+
+                        @returns TRUE if the area passed intersected the data
+                                 area, FALSE if not, in which case the values
+                                 obtained may be out of bounds, not in order or
+                                 unmodified. TRUE does not mean that there
+                                 actually is any data within the selection.
+                     */
     bool            ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
 
-                    /** Shrink a range to only include used data area. */
-    bool            ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
+                    /** Shrink a range to only include used data area.
+
+                        @param o_bShrunk
+                               Out parameter, TRUE if area was shrunk, FALSE if not.
+
+                        @returns TRUE if there is any data, FALSE if not.
+                     */
+    bool            ShrinkToUsedDataArea( bool& o_bShrunk,
+                                          SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
+                                          SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
 
     void            GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
                                  SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index d02b689..45abc7c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -422,7 +422,8 @@ public:
     void        GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
                              BOOL bIncludeOld, bool bOnlyDown ) const;
 
-    bool		ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
+    bool        ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
+                                      SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
 
     SCSIZE	    GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
                                         SCCOL nEndCol, SCROW nEndRow, ScDirection eDir );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 09b5506..d8187f5 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -720,12 +720,15 @@ bool ScDocument::ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow
     return true;  // success!
 }
 
-bool ScDocument::ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol,
+bool ScDocument::ShrinkToUsedDataArea( bool& o_bShrunk, SCTAB nTab, SCCOL& rStartCol,
         SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
+    {
+        o_bShrunk = false;
         return false;
-    return pTab[nTab]->ShrinkToUsedDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly);
+    }
+    return pTab[nTab]->ShrinkToUsedDataArea( o_bShrunk, rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly);
 }
 
 // connected area
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7479af5..036dae0 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -835,18 +835,28 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
 }
 
 
-bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
+bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
         SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const
 {
-    bool bRet = false;
-    bool bChanged;
+    o_bShrunk = false;
+
+    PutInOrder( rStartCol, rEndCol);
+    PutInOrder( rStartRow, rEndRow);
+    if (rStartCol < 0)
+        rStartCol = 0, o_bShrunk = true;
+    if (rStartRow < 0)
+        rStartRow = 0, o_bShrunk = true;
+    if (rEndCol > MAXCOL)
+        rEndCol = MAXCOL, o_bShrunk = true;
+    if (rEndRow > MAXROW)
+        rEndRow = MAXROW, o_bShrunk = true;
 
+    bool bChanged;
     do
     {
         bChanged = false;
 
-        bool bCont = true;
-        while (rEndCol > 0 && bCont && rStartCol < rEndCol)
+        while (rStartCol < rEndCol)
         {
             if (aCol[rEndCol].IsEmptyBlock( rStartRow, rEndRow))
             {
@@ -854,11 +864,10 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
                 bChanged = true;
             }
             else
-                bCont = false;
+                break;  // while
         }
 
-        bCont = true;
-        while (rStartCol < MAXCOL && bCont && rStartCol < rEndCol)
+        while (rStartCol < rEndCol)
         {
             if (aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow))
             {
@@ -866,12 +875,12 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
                 bChanged = true;
             }
             else
-                bCont = false;
+                break;  // while
         }
 
         if (!bColumnsOnly)
         {
-            if (rStartRow < MAXROW && rStartRow < rEndRow)
+            if (rStartRow < rEndRow)
             {
                 bool bFound = false;
                 for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++)
@@ -884,7 +893,7 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
                 }
             }
 
-            if (rEndRow > 0 && rStartRow < rEndRow)
+            if (rStartRow < rEndRow)
             {
                 bool bFound = false;
                 for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++)
@@ -899,9 +908,12 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
         }
 
         if (bChanged)
-            bRet = true;
+            o_bShrunk = true;
     } while( bChanged );
-    return bRet;
+
+    return rStartCol != rEndCol || (bColumnsOnly ? 
+            !aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow) :
+            (rStartRow != rEndRow || aCol[rStartCol].HasDataAt( rStartRow)));
 }
 
 
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 58611d6..9ea76b0 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1119,10 +1119,16 @@ ScBaseCell* ScTable::GetCell( SCCOL nCol, SCROW nRow ) const
 void ScTable::GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const
 {
     rCol = 0;
-    rRow = 0;
+    rRow = MAXROW+1;
     while (aCol[rCol].IsEmptyData() && rCol < MAXCOL)
         ++rCol;
-    rRow = aCol[rCol].GetFirstDataPos();
+    SCCOL nCol = rCol;
+    while (nCol <= MAXCOL && rRow > 0)
+    {
+        if (!aCol[nCol].IsEmptyData())
+            rRow = ::std::min( rRow, aCol[nCol].GetFirstDataPos());
+        ++nCol;
+    }
 }
 
 void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
@@ -1132,11 +1138,8 @@ void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
     while (aCol[rCol].IsEmptyData() && (rCol > 0))
         rCol--;
     SCCOL nCol = rCol;
-    while ((SCsCOL)nCol >= 0)
-    {
-        rRow = Max(rRow, aCol[nCol].GetLastDataPos());
-        nCol--;
-    }
+    while (nCol >= 0 && rRow < MAXROW)
+        rRow = ::std::max( rRow, aCol[nCol--].GetLastDataPos());
 }
 
 
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 741837b..e4f5276 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1351,7 +1351,8 @@ static ScTokenArray* lcl_convertToTokenArray(const ScDocument* pSrcDoc, ScRange&
         // Only loop within the data area.
         SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2;
         SCROW nDataRow1 = nRow1, nDataRow2 = nRow2;
-        if (!pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2))
+        bool bShrunk;
+        if (!pSrcDoc->ShrinkToUsedDataArea( bShrunk, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, false))
             // no data within specified range.
             continue;
 
@@ -1686,8 +1687,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
 
     SCCOL nDataCol1 = 0, nDataCol2 = MAXCOL;
     SCROW nDataRow1 = 0, nDataRow2 = MAXROW;
-    pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2);
-    if (rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row())
+    bool bData = pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2);
+    if (!bData || rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row())
     {
         // requested cell is outside the data area.  Don't even bother caching
         // this data, but add it to the cached range to prevent accessing the
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index f9e854e..b959cf5 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -155,7 +155,10 @@ ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, ScGetDBSelection e
                     ScDocument* pDoc = pDocSh->GetDocument();
                     SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col();
                     SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row();
-                    if (pDoc->ShrinkToUsedDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly))
+                    bool bShrunk;
+                    pDoc->ShrinkToUsedDataArea( bShrunk, aRange.aStart.Tab(), 
+                            nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly);
+                    if (bShrunk)
                     {
                         aRange.aStart.SetCol(nCol1);
                         aRange.aEnd.SetCol(nCol2);
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index ac0ca96..2d6def3 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -98,7 +98,9 @@ String ScTabViewShell::GetSelectionText( BOOL bWholeWord )
                 SCROW nRow1, nRow2;
                 SCTAB nTab1, nTab2;
                 aRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
-                if (pDoc->ShrinkToUsedDataArea( nTab1, nCol1, nRow1, nCol2, nRow2, false))
+                bool bShrunk;
+                pDoc->ShrinkToUsedDataArea( bShrunk, nTab1, nCol1, nRow1, nCol2, nRow2, false);
+                if (bShrunk)
                 {
                     aRange.aStart.SetCol( nCol1 );
                     aRange.aStart.SetRow( nRow1 );
commit 25e6b6cba03a72d472a74768c00053e886859a93
Merge: 1459e2b... af63319...
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Jan 19 11:45:03 2011 -0500

    Merge remote branch 'origin/libreoffice-3-3'
    
    Conflicts:
    	sc/inc/document.hxx
    	sc/source/core/data/drwlayer.cxx
    	sc/source/core/data/table2.cxx
    	sc/source/core/data/table3.cxx

diff --cc sc/inc/document.hxx
index 26d7707,3dc346c..24c6c39
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@@ -882,29 -930,13 +882,13 @@@ public
      USHORT			GetErrCode( const ScAddress& ) const;
  
                      /** Shrink a range to only include data area.
- 
 -                        This is not the actually used area within the 
 -                        selection, but the bounds of the sheet's data area 
 +                        This is not the actually used area within the
 +                        selection, but the bounds of the sheet's data area
-                         instead.
- 
-                         @returns TRUE if the area passed intersected the data
-                                  area, FALSE if not, in which case the values
-                                  obtained may be out of bounds, not in order or
-                                  unmodified. TRUE does not mean that there
-                                  actually is any data within the selection.
-                      */
+                         instead. */
      bool            ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
  
-                     /** Shrink a range to only include used data area.
- 
-                         @param o_bShrunk
-                                Out parameter, TRUE if area was shrunk, FALSE if not.
- 
-                         @returns TRUE if there is any data, FALSE if not.
-                      */
-     bool            ShrinkToUsedDataArea( bool& o_bShrunk,
-                                           SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
-                                           SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
+                     /** Shrink a range to only include used data area. */
+     bool            ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
  
      void            GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
                                   SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) const;
diff --cc sc/inc/drwlayer.hxx
index 17b5aa0,c6025ff..51a0916
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@@ -152,8 -157,10 +152,8 @@@ public
  
      void			MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
                                  SCsCOL nDx,SCsROW nDy, BOOL bInsDel, bool bUpdateNoteCaptionPos = true );
 -    void			WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips );
 -    void			HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips );
  
-     BOOL            HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes = true );
+     BOOL			HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow );
  
      void			DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
                                              SCCOL nCol2,SCROW nRow2 );
diff --cc sc/source/core/data/drwlayer.cxx
index ef3ab18,7ad749b..133e158
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@@ -999,7 -1084,73 +999,7 @@@ void ScDrawLayer::MoveArea( SCTAB nTab
      MoveCells( nTab, nCol1,nRow1, nCol2,nRow2, nDx,nDy, bUpdateNoteCaptionPos );
  }
  
- BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes )
 -void ScDrawLayer::WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips )
 -{
 -    DBG_ASSERT( pDoc, "ScDrawLayer::WidthChanged without document" );
 -    if ( !pDoc )
 -        return;
 -
 -    if (!bAdjustEnabled)
 -        return;
 -
 -    Rectangle aRect;
 -    Point aTopLeft;
 -
 -    for (SCCOL i=0; i<nCol; i++)
 -        aRect.Left() += pDoc->GetColWidth(i,nTab);
 -    aTopLeft.X() = aRect.Left();
 -    aRect.Left() += pDoc->GetColWidth(nCol,nTab);
 -
 -    aRect.Right() = MAXMM;
 -    aRect.Top() = 0;
 -    aRect.Bottom() = MAXMM;
 -
 -    //!	aTopLeft ist falsch, wenn mehrere Spalten auf einmal ausgeblendet werden
 -
 -    BOOL bNegativePage = pDoc->IsNegativePage( nTab );
 -    if ( bNegativePage )
 -    {
 -        MirrorRectRTL( aRect );
 -        aTopLeft.X() = -aTopLeft.X();
 -        nDifTwips = -nDifTwips;
 -    }
 -
 -    MoveAreaTwips( nTab, aRect, Point( nDifTwips,0 ), aTopLeft );
 -}
 -
 -void ScDrawLayer::HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips )
 -{
 -    DBG_ASSERT( pDoc, "ScDrawLayer::HeightChanged without document" );
 -    if ( !pDoc )
 -        return;
 -
 -    if (!bAdjustEnabled)
 -        return;
 -
 -    Rectangle aRect;
 -    Point aTopLeft;
 -
 -    aRect.Top() += pDoc->GetRowHeight( 0, nRow-1, nTab);
 -    aTopLeft.Y() = aRect.Top();
 -    aRect.Top() += pDoc->GetRowHeight(nRow, nTab);
 -
 -    aRect.Bottom() = MAXMM;
 -    aRect.Left() = 0;
 -    aRect.Right() = MAXMM;
 -
 -    //!	aTopLeft ist falsch, wenn mehrere Zeilen auf einmal ausgeblendet werden
 -
 -    BOOL bNegativePage = pDoc->IsNegativePage( nTab );
 -    if ( bNegativePage )
 -    {
 -        MirrorRectRTL( aRect );
 -        aTopLeft.X() = -aTopLeft.X();
 -    }
 -
 -    MoveAreaTwips( nTab, aRect, Point( 0,nDifTwips ), aTopLeft );
 -}
 -
+ BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
  {
      DBG_ASSERT( pDoc, "ScDrawLayer::HasObjectsInRows without document" );
      if ( !pDoc )
diff --cc sc/source/core/data/table2.cxx
index e177dac,a852f7c..58611d6
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@@ -2571,14 -2626,21 +2551,9 @@@ void ScTable::DBShowRows(SCROW nRow1, S
              nEndRow = nRow2;
  
          BOOL bChanged = ( bWasVis != bShow );
 -        if ( bChanged )
 -        {
 -            ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
 -            if (pDrawLayer)
 -            {
 -                long nHeight = static_cast<long>(mpRowHeights->getSumValue(nStartRow, nEndRow));
 -                if (bShow)
 -                    pDrawLayer->HeightChanged( nTab, nStartRow, nHeight );
 -                else
 -                    pDrawLayer->HeightChanged( nTab, nStartRow, -nHeight );
 -            }
 -        }
  
-         // #i116164# Directly modify the flags only if there are drawing objects within the area.
-         // Otherwise, all modifications are made together in ScTable::Query, so the tree isn't constantly rebuilt.
-         if ( bSetFlags )
-         {
-             SetRowHidden(nStartRow, nEndRow, !bShow);
-             SetRowFiltered(nStartRow, nEndRow, !bShow);
-         }
+         SetRowHidden(nStartRow, nEndRow, !bShow);
+         SetRowFiltered(nStartRow, nEndRow, !bShow);
  
          if ( bChanged )
          {
@@@ -2603,11 -2665,6 +2578,11 @@@ void ScTable::ShowRows(SCROW nRow1, SCR
      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();
-     bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, nRow1, nRow2, false );
++    bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, nRow1, nRow2 );
 +
      while (nStartRow <= nRow2)
      {
          SCROW nEndRow = -1;
@@@ -2616,15 -2673,22 +2591,10 @@@
              nEndRow = nRow2;
  
          BOOL bChanged = ( bWasVis != bShow );
 -        if ( bChanged )
 -        {
 -            ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
 -            if (pDrawLayer)
 -            {
 -                long nHeight = static_cast<long>(mpRowHeights->getSumValue(nStartRow, nEndRow));
 -                if (bShow)
 -                    pDrawLayer->HeightChanged( nTab, nStartRow, nHeight );
 -                else
 -                    pDrawLayer->HeightChanged( nTab, nStartRow, -nHeight );
 -            }
 -        }
  
-         // #i116164# Directly modify the flags only if there are drawing objects within the area.
-         // Otherwise, all rows are modified together after the loop, so the tree isn't constantly rebuilt.
-         if ( bHasObjects )
-         {
-             SetRowHidden(nStartRow, nEndRow, !bShow);
-             if (bShow)
-                 SetRowFiltered(nStartRow, nEndRow, false);
-         }
+         SetRowHidden(nStartRow, nEndRow, !bShow);
+         if (bShow)
+             SetRowFiltered(nStartRow, nEndRow, false);
  
          if ( bChanged )
          {
diff --cc sc/source/core/data/table3.cxx
index 579fabe,c02939c..5fbbf9d
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@@ -60,8 -60,6 +60,7 @@@
  #include "cellform.hxx"
  #include "postit.hxx"
  #include "queryparam.hxx"
 +#include "segmenttree.hxx"
- #include "drwlayer.hxx"
  
  #include <vector>
  
@@@ -1642,16 -1643,8 +1641,13 @@@ SCSIZE ScTable::Query(ScQueryParam& rPa
                              aParam.nDestCol, aParam.nDestRow, aParam.nDestTab );
      }
  
+     InitializeNoteCaptions();
 -    for (SCROW j=aParam.nRow1 + nHeader; j<=nEndRow; j++)
++
 +    if (aParam.bInplace)
 +        IncRecalcLevel();       // #i116164# once for all entries
 +
-     // #i116164# If there are no drawing objects within the area, call SetRowHidden/SetRowFiltered for all rows at the end
-     std::vector<ScShowRowsEntry> aEntries;
-     ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
-     bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, aParam.nRow1 + nHeader, aParam.nRow2, false );
- 
 +    SCROW nRealRow2 = aParam.bUseDynamicRange ? aParam.nDynamicEndRow : aParam.nRow2;
 +    for (SCROW j = aParam.nRow1 + nHeader; j <= nRealRow2; ++j)
      {
          BOOL bResult;									// Filterergebnis
          BOOL bValid = ValidQuery(j, aParam, pSpecial);
commit af63319fcdeea3f9b5018eab83ef5a9e64905446
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Jan 13 11:18:07 2011 -0500

    Reverting the merge commit 0fe55349b05fae496a86a3fa958d184f0453916c.
    
    I created a patch between before and after the merge commit, and
    reverse-applied it.  This is because if you revert a merge commit
    in git you are denying all future merges from that branch.  I wasn't
    sure if we really wanted that.
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 07cabf9..3dc346c 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -930,29 +930,13 @@ public:
     USHORT			GetErrCode( const ScAddress& ) const;
 
                     /** Shrink a range to only include data area.
-
                         This is not the actually used area within the 
                         selection, but the bounds of the sheet's data area 
-                        instead.
-
-                        @returns TRUE if the area passed intersected the data
-                                 area, FALSE if not, in which case the values
-                                 obtained may be out of bounds, not in order or
-                                 unmodified. TRUE does not mean that there
-                                 actually is any data within the selection.
-                     */
+                        instead. */
     bool            ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
 
-                    /** Shrink a range to only include used data area.
-
-                        @param o_bShrunk
-                               Out parameter, TRUE if area was shrunk, FALSE if not.
-
-                        @returns TRUE if there is any data, FALSE if not.
-                     */
-    bool            ShrinkToUsedDataArea( bool& o_bShrunk,
-                                          SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
-                                          SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
+                    /** Shrink a range to only include used data area. */
+    bool            ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
 
     void            GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
                                  SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) const;
diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 8e623ef..c6025ff 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -160,7 +160,7 @@ public:
     void			WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips );
     void			HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips );
 
-    BOOL            HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes = true );
+    BOOL			HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow );
 
     void			DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
                                             SCCOL nCol2,SCROW nRow2 );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 66a64c7..8edec9f 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -92,17 +92,6 @@ struct ScColWidthParam;
 
 typedef std::hash_map< ::rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToNameMap;
 
-struct ScShowRowsEntry
-{
-    SCROW   mnRow1;
-    SCROW   mnRow2;
-    bool    mbShow;
-
-    ScShowRowsEntry( SCROW nR1, SCROW nR2, bool bS ) :
-        mnRow1(nR1), mnRow2(nR2), mbShow(bS) {}
-};
-
-
 class ScTable
 {
 private:
@@ -434,8 +423,7 @@ public:
     void        GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
                              BOOL bIncludeOld, bool bOnlyDown ) const;
 
-    bool        ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
-                                      SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
+    bool		ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
 
     SCSIZE	    GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
                                         SCCOL nEndCol, SCROW nEndRow, ScDirection eDir );
@@ -682,7 +670,7 @@ public:
     void		DBShowRow(SCROW nRow, bool bShow);
 
     void		ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
-    void        DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags);   // if bSetFlags=false, no SetRowHidden/SetRowFiltered
+    void		DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
 
     void		SetColFlags( SCCOL nCol, BYTE nNewFlags );
     void		SetRowFlags( SCROW nRow, BYTE nNewFlags );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index eb4af87..2a66a64 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -708,15 +708,12 @@ bool ScDocument::ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow
     return true;  // success!
 }
 
-bool ScDocument::ShrinkToUsedDataArea( bool& o_bShrunk, SCTAB nTab, SCCOL& rStartCol,
+bool ScDocument::ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol,
         SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
-    {
-        o_bShrunk = false;
         return false;
-    }
-    return pTab[nTab]->ShrinkToUsedDataArea( o_bShrunk, rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly);
+    return pTab[nTab]->ShrinkToUsedDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly);
 }
 
 // connected area
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index bea08a6..7ad749b 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1150,7 +1150,7 @@ void ScDrawLayer::HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips )
     MoveAreaTwips( nTab, aRect, Point( 0,nDifTwips ), aTopLeft );
 }
 
-BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes )
+BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
 {
     DBG_ASSERT( pDoc, "ScDrawLayer::HasObjectsInRows without document" );
     if ( !pDoc )
@@ -1191,9 +1191,7 @@ BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
     while ( pObject && !bFound )
     {
         aObjRect = pObject->GetSnapRect();	//! GetLogicRect ?
-        // #i116164# note captions are handled separately, don't have to be included for each single row height change
-        if ( (aTestRect.IsInside(aObjRect.TopLeft()) || aTestRect.IsInside(aObjRect.BottomLeft())) &&
-             (bIncludeNotes || !IsNoteCaption(pObject)) )
+        if (aTestRect.IsInside(aObjRect.TopLeft()) || aTestRect.IsInside(aObjRect.BottomLeft()))
             bFound = TRUE;
 
         pObject = aIter.Next();
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index cf9b21c..68904d2 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -855,28 +855,18 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
 }
 
 
-bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
+bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
         SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const
 {
-    o_bShrunk = false;
-
-    PutInOrder( rStartCol, rEndCol);
-    PutInOrder( rStartRow, rEndRow);
-    if (rStartCol < 0)
-        rStartCol = 0, o_bShrunk = true;
-    if (rStartRow < 0)
-        rStartRow = 0, o_bShrunk = true;
-    if (rEndCol > MAXCOL)
-        rEndCol = MAXCOL, o_bShrunk = true;
-    if (rEndRow > MAXROW)
-        rEndRow = MAXROW, o_bShrunk = true;
-
+    bool bRet = false;
     bool bChanged;
+
     do
     {
         bChanged = false;
 
-        while (rStartCol < rEndCol)
+        bool bCont = true;
+        while (rEndCol > 0 && bCont && rStartCol < rEndCol)
         {
             if (aCol[rEndCol].IsEmptyBlock( rStartRow, rEndRow))
             {
@@ -884,10 +874,11 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS
                 bChanged = true;
             }
             else
-                break;  // while
+                bCont = false;
         }
 
-        while (rStartCol < rEndCol)
+        bCont = true;
+        while (rStartCol < MAXCOL && bCont && rStartCol < rEndCol)
         {
             if (aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow))
             {
@@ -895,12 +886,12 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS
                 bChanged = true;
             }
             else
-                break;  // while
+                bCont = false;
         }
 
         if (!bColumnsOnly)
         {
-            if (rStartRow < rEndRow)
+            if (rStartRow < MAXROW && rStartRow < rEndRow)
             {
                 bool bFound = false;
                 for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++)
@@ -913,7 +904,7 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS
                 }
             }
 
-            if (rStartRow < rEndRow)
+            if (rEndRow > 0 && rStartRow < rEndRow)
             {
                 bool bFound = false;
                 for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++)
@@ -928,12 +919,9 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS
         }
 
         if (bChanged)
-            o_bShrunk = true;
+            bRet = true;
     } while( bChanged );
-
-    return rStartCol != rEndCol || (bColumnsOnly ? 
-            !aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow) :
-            (rStartRow != rEndRow || aCol[rStartCol].HasDataAt( rStartRow)));
+    return bRet;
 }
 
 
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 752208f..a852f7c 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -775,9 +775,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                     pDestTab->pRowFlags->CopyFrom(*pRowFlags, nRow1, nRow2);
 
                     // Hidden flags.
-                    // #i116164# Collect information first, then apply the changes,
-                    // so RowHidden doesn't rebuild the tree for each row range.
-                    std::vector<ScShowRowsEntry> aEntries;
                     for (SCROW i = nRow1; i <= nRow2; ++i)
                     {
                         SCROW nThisLastRow, nDestLastRow;
@@ -790,8 +787,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                             // the last row shouldn't exceed the upper bound the caller specified.
                             nLastRow = nRow2;
     
-                        //pDestTab->SetRowHidden(i, nLastRow, bThisHidden);
-                        aEntries.push_back(ScShowRowsEntry(i, nLastRow, bThisHidden));
+                        pDestTab->SetRowHidden(i, nLastRow, bThisHidden);
 
                         bool bThisHiddenChange = (bThisHidden != bDestHidden);
                         if (bThisHiddenChange && pCharts)
@@ -807,19 +803,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                         i = nLastRow;
                     }
 
-                    std::vector<ScShowRowsEntry>::const_iterator aEnd = aEntries.end();
-                    std::vector<ScShowRowsEntry>::const_iterator aIter = aEntries.begin();
-                    if ( aIter != aEnd )
-                    {
-                        pDestTab->mpHiddenRows->setInsertFromBack(true);    // important for undo document
-                        while (aIter != aEnd)
-                        {
-                            pDestTab->SetRowHidden(aIter->mnRow1, aIter->mnRow2, !aIter->mbShow);
-                            ++aIter;
-                        }
-                        pDestTab->mpHiddenRows->setInsertFromBack(false);
-                    }
-
                     // Filtered flags.
                     for (SCROW i = nRow1; i <= nRow2; ++i)
                     {
@@ -1144,16 +1127,10 @@ ScBaseCell* ScTable::GetCell( SCCOL nCol, SCROW nRow ) const
 void ScTable::GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const
 {
     rCol = 0;
-    rRow = MAXROW+1;
+    rRow = 0;
     while (aCol[rCol].IsEmptyData() && rCol < MAXCOL)
         ++rCol;
-    SCCOL nCol = rCol;
-    while (nCol <= MAXCOL && rRow > 0)
-    {
-        if (!aCol[nCol].IsEmptyData())
-            rRow = ::std::min( rRow, aCol[nCol].GetFirstDataPos());
-        ++nCol;
-    }
+    rRow = aCol[rCol].GetFirstDataPos();
 }
 
 void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
@@ -1163,8 +1140,11 @@ void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
     while (aCol[rCol].IsEmptyData() && (rCol > 0))
         rCol--;
     SCCOL nCol = rCol;
-    while (nCol >= 0 && rRow < MAXROW)
-        rRow = ::std::max( rRow, aCol[nCol--].GetLastDataPos());
+    while ((SCsCOL)nCol >= 0)
+    {
+        rRow = Max(rRow, aCol[nCol].GetLastDataPos());
+        nCol--;
+    }
 }
 
 
@@ -2635,9 +2615,8 @@ void ScTable::DBShowRow(SCROW nRow, bool bShow)
 }
 
 
-void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags)
+void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
 {
-    // #i116164# IncRecalcLevel/DecRecalcLevel is in ScTable::Query
     SCROW nStartRow = nRow1;
     while (nStartRow <= nRow2)
     {
@@ -2647,7 +2626,7 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags)
             nEndRow = nRow2;
 
         BOOL bChanged = ( bWasVis != bShow );
-        if ( bChanged && bSetFlags )
+        if ( bChanged )
         {
             ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
             if (pDrawLayer)
@@ -2660,13 +2639,8 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags)
             }
         }
 
-        // #i116164# Directly modify the flags only if there are drawing objects within the area.
-        // Otherwise, all modifications are made together in ScTable::Query, so the tree isn't constantly rebuilt.
-        if ( bSetFlags )
-        {
-            SetRowHidden(nStartRow, nEndRow, !bShow);
-            SetRowFiltered(nStartRow, nEndRow, !bShow);
-        }
+        SetRowHidden(nStartRow, nEndRow, !bShow);
+        SetRowFiltered(nStartRow, nEndRow, !bShow);
 
         if ( bChanged )
         {
@@ -2691,14 +2665,6 @@ 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();
-    bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, nRow1, nRow2, false );
-    long nOldHeight = 0;
-    if ( pDrawLayer && !bHasObjects )
-        nOldHeight = static_cast<long>(GetRowHeight(nRow1, nRow2));
-
     while (nStartRow <= nRow2)
     {
         SCROW nEndRow = -1;
@@ -2707,8 +2673,9 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
             nEndRow = nRow2;
 
         BOOL bChanged = ( bWasVis != bShow );
-        if ( bChanged && bHasObjects )
+        if ( bChanged )
         {
+            ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
             if (pDrawLayer)
             {
                 long nHeight = static_cast<long>(mpRowHeights->getSumValue(nStartRow, nEndRow));
@@ -2719,14 +2686,9 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
             }
         }
 
-        // #i116164# Directly modify the flags only if there are drawing objects within the area.
-        // Otherwise, all rows are modified together after the loop, so the tree isn't constantly rebuilt.
-        if ( bHasObjects )
-        {
-            SetRowHidden(nStartRow, nEndRow, !bShow);
-            if (bShow)
-                SetRowFiltered(nStartRow, nEndRow, false);
-        }
+        SetRowHidden(nStartRow, nEndRow, !bShow);
+        if (bShow)
+            SetRowFiltered(nStartRow, nEndRow, false);
 
         if ( bChanged )
         {
@@ -2739,25 +2701,6 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
 
         nStartRow = nEndRow + 1;
     }
-
-    if ( !bHasObjects )
-    {
-        // #i116164# set the flags for the whole range at once
-        SetRowHidden(nRow1, nRow2, !bShow);
-        if (bShow)
-            SetRowFiltered(nRow1, nRow2, false);
-
-        if ( pDrawLayer )
-        {
-            // if there are no objects in the range, a single HeightChanged call is enough
-            long nNewHeight = 0;
-            if ( bShow )
-                nNewHeight = static_cast<long>(GetRowHeight(nRow1, nRow2));
-            if ( nNewHeight != nOldHeight )
-                pDrawLayer->HeightChanged( nTab, nRow1, nNewHeight - nOldHeight );
-        }
-    }
-
     DecRecalcLevel();
 }
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index d92c2a8..c02939c 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -60,8 +60,6 @@
 #include "cellform.hxx"
 #include "postit.hxx"
 #include "queryparam.hxx"
-#include "segmenttree.hxx"
-#include "drwlayer.hxx"
 
 #include <vector>
 
@@ -1646,15 +1644,7 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
     }
 
     InitializeNoteCaptions();
-    if (aParam.bInplace)
-        IncRecalcLevel();       // #i116164# once for all entries
-
-    // #i116164# If there are no drawing objects within the area, call SetRowHidden/SetRowFiltered for all rows at the end
-    std::vector<ScShowRowsEntry> aEntries;
-    ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
-    bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, aParam.nRow1 + nHeader, aParam.nRow2, false );
-
-    for (SCROW j=aParam.nRow1 + nHeader; j<=aParam.nRow2; j++)
+    for (SCROW j=aParam.nRow1 + nHeader; j<=nEndRow; j++)
     {
         BOOL bResult;									// Filterergebnis
         BOOL bValid = ValidQuery(j, aParam, pSpecial);
@@ -1709,11 +1699,7 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
             else
             {
                 if (bStarted)
-                {
-                    DBShowRows(nOldStart,nOldEnd, bOldResult, bHasObjects);
-                    if (!bHasObjects)
-                        aEntries.push_back(ScShowRowsEntry(nOldStart, nOldEnd, bOldResult));
-                }
+                    DBShowRows(nOldStart,nOldEnd, bOldResult);
                 nOldStart = nOldEnd = j;
                 bOldResult = bResult;
             }
@@ -1732,58 +1718,7 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
     }
 
     if (aParam.bInplace && bStarted)
-    {
-        DBShowRows(nOldStart,nOldEnd, bOldResult, bHasObjects);
-        if (!bHasObjects)
-            aEntries.push_back(ScShowRowsEntry(nOldStart, nOldEnd, bOldResult));
-    }
-
-    // #i116164# execute the collected SetRowHidden/SetRowFiltered calls
-    if (!bHasObjects)
-    {
-        std::vector<ScShowRowsEntry>::const_iterator aEnd = aEntries.end();
-        std::vector<ScShowRowsEntry>::const_iterator aIter = aEntries.begin();
-        if ( aIter != aEnd )
-        {
-            // do only one HeightChanged call with the final difference in heights
-            long nOldHeight = 0;
-            if ( pDrawLayer )
-                nOldHeight = static_cast<long>(GetRowHeight(aParam.nRow1 + nHeader, aParam.nRow2));
-
-            // clear the range first instead of many changes in the middle of the filled array
-            SetRowHidden(aParam.nRow1 + nHeader, aParam.nRow2, false);
-            SetRowFiltered(aParam.nRow1 + nHeader, aParam.nRow2, false);
-
-            // insert from back, in case the filter range is large
-            mpHiddenRows->setInsertFromBack(true);
-            mpFilteredRows->setInsertFromBack(true);
-
-            while (aIter != aEnd)
-            {
-                if (!aIter->mbShow)
-                {
-                    SCROW nStartRow = aIter->mnRow1;
-                    SCROW nEndRow = aIter->mnRow2;
-                    SetRowHidden(nStartRow, nEndRow, true);
-                    SetRowFiltered(nStartRow, nEndRow, true);
-                }
-                ++aIter;
-            }
-
-            mpHiddenRows->setInsertFromBack(false);
-            mpFilteredRows->setInsertFromBack(false);
-
-            if ( pDrawLayer )
-            {
-                // if there are no objects in the filtered range, a single HeightChanged call is enough
-                long nNewHeight = static_cast<long>(GetRowHeight(aParam.nRow1 + nHeader, aParam.nRow2));
-                pDrawLayer->HeightChanged( nTab, aParam.nRow1 + nHeader, nNewHeight - nOldHeight );
-            }
-        }
-    }
-
-    if (aParam.bInplace)
-        DecRecalcLevel();
+        DBShowRows(nOldStart,nOldEnd, bOldResult);
 
     delete[] pSpecial;
     SetDrawPageSize();
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index a67b147..91bf4dd 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -172,7 +172,6 @@ void ScXMLTableRowContext::EndElement()
     sal_Int32 nSheet = rXMLImport.GetTables().GetCurrentSheet();
     sal_Int32 nCurrentRow(rXMLImport.GetTables().GetCurrentRow());
     uno::Reference<sheet::XSpreadsheet> xSheet(rXMLImport.GetTables().GetCurrentXSheet());
-    ScDocument* pDoc = rXMLImport.GetDocument();
     if(xSheet.is())
     {
         sal_Int32 nFirstRow(nCurrentRow - nRepeatedRows + 1);
@@ -220,18 +219,10 @@ void ScXMLTableRowContext::EndElement()
                         bVisible = sal_False;
                         bFiltered = sal_True;
                     }
-
-                    // #i116164# call SetRowHidden/SetRowFiltered directly, so the tree doesn't have to be rebuilt
-                    // to compare with existing hidden flags.
-                    if (!bVisible && pDoc)
-                        pDoc->SetRowHidden((SCROW)nFirstRow, (SCROW)nCurrentRow, (SCTAB)nSheet, true);
-                    if (bFiltered && pDoc)
-                        pDoc->SetRowFiltered((SCROW)nFirstRow, (SCROW)nCurrentRow, (SCTAB)nSheet, true);
-
-                    //if (!bVisible)
-                    //    xRowProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ISVISIBLE)), uno::makeAny(bVisible));
-                    //if (bFiltered)
-                    //    xRowProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ISFILTERED)), uno::makeAny(bFiltered));
+                    if (!bVisible)
+                        xRowProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ISVISIBLE)), uno::makeAny(bVisible));
+                    if (bFiltered)
+                        xRowProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ISFILTERED)), uno::makeAny(bFiltered));
                 }
             }
         }
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index ee7a8a6..c0fc2fb 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1393,8 +1393,7 @@ static ScTokenArray* lcl_convertToTokenArray(const ScDocument* pSrcDoc, ScRange&
         // Only loop within the data area.
         SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2;
         SCROW nDataRow1 = nRow1, nDataRow2 = nRow2;
-        bool bShrunk;
-        if (!pSrcDoc->ShrinkToUsedDataArea( bShrunk, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, false))
+        if (!pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2))
             // no data within specified range.
             continue;
 
@@ -1721,8 +1720,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
 
     SCCOL nDataCol1 = 0, nDataCol2 = MAXCOL;
     SCROW nDataRow1 = 0, nDataRow2 = MAXROW;
-    bool bData = pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2);
-    if (!bData || rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row())
+    pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2);
+    if (rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row())
     {
         // requested cell is outside the data area.  Don't even bother caching
         // this data, but add it to the cached range to prevent accessing the
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index b959cf5..f9e854e 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -155,10 +155,7 @@ ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, ScGetDBSelection e
                     ScDocument* pDoc = pDocSh->GetDocument();
                     SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col();
                     SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row();
-                    bool bShrunk;
-                    pDoc->ShrinkToUsedDataArea( bShrunk, aRange.aStart.Tab(), 
-                            nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly);
-                    if (bShrunk)
+                    if (pDoc->ShrinkToUsedDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly))
                     {
                         aRange.aStart.SetCol(nCol1);
                         aRange.aEnd.SetCol(nCol2);
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index 6b15f51..554611b 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -98,9 +98,7 @@ String __EXPORT ScTabViewShell::GetSelectionText( BOOL bWholeWord )
                 SCROW nRow1, nRow2;
                 SCTAB nTab1, nTab2;
                 aRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
-                bool bShrunk;
-                pDoc->ShrinkToUsedDataArea( bShrunk, nTab1, nCol1, nRow1, nCol2, nRow2, false);
-                if (bShrunk)
+                if (pDoc->ShrinkToUsedDataArea( nTab1, nCol1, nRow1, nCol2, nRow2, false))
                 {
                     aRange.aStart.SetCol( nCol1 );
                     aRange.aStart.SetRow( nRow1 );
commit 5ada5635cff38af87830b091b36159cf80e4cf5d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Jan 13 11:04:14 2011 -0500

    Revert "This is also part of the merge."
    
    This reverts commit 0fe55349b05fae496a86a3fa958d184f0453916c.
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 55974e2..d92c2a8 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1645,6 +1645,7 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
                             aParam.nDestCol, aParam.nDestRow, aParam.nDestTab );
     }
 
+    InitializeNoteCaptions();
     if (aParam.bInplace)
         IncRecalcLevel();       // #i116164# once for all entries
 
@@ -1785,7 +1786,7 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
         DecRecalcLevel();
 
     delete[] pSpecial;
-
+    SetDrawPageSize();
     return nCount;
 }
 
commit c900e3db767518b7a60eaf24bdf298c94315f685
Author: Petr Mladek <pmladek at suse.cz>
Date:   Tue Jan 11 23:05:56 2011 +0100

    Please, ignore the previous message; it was for the libreoffice-3-3-0 branch
    
    This is 'libreoffice-3-3' - the stable branch for the 3.3.x releases.
    Only safe changes, reviewed by anoter person are allowed.
    
    If you want to build something cool, unstable, and risky, use master.
commit 15d298ba7c4e89b043b3077e17747ba027a62c43
Author: Petr Mladek <pmladek at suse.cz>
Date:   Tue Jan 11 22:39:06 2011 +0100

    Branch libreoffice-3-3-0
    
    This is 'libreoffice-3-3-0' - the stable branch for the 3.3.0 release.
    Only very safe changes, reviewed by three people are allowed.
    
    If you want to commit more complicated fix for the next 3.3.x release,
    please use the 'libreoffice-3-3' branch.
    
    If you want to build something cool, unstable, and risky, use master.


More information about the Libreoffice-commits mailing list