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

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Feb 14 21:07:07 PST 2011


 sc/inc/segmenttree.hxx              |    1 +
 sc/inc/table.hxx                    |    1 +
 sc/source/core/data/segmenttree.cxx |   12 ++++++++++++
 sc/source/core/data/table2.cxx      |    2 +-
 sc/source/core/data/table3.cxx      |    2 --
 sc/source/core/data/table5.cxx      |   30 ++++++++++++++++++++++++++++++
 6 files changed, 45 insertions(+), 3 deletions(-)

New commits:
commit 02ec2196afa15087d4b8c55a05bd73aa979e8d1b
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Feb 15 00:05:32 2011 -0500

    Let's use a separate method for leaf-node search.
    
    Let's have two separate methods for tree and leaf-node searches.
    It's better this way than turning on and off the tree search via
    boolean before and after the call.

diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx
index 3282398..6878ac5 100644
--- a/sc/inc/segmenttree.hxx
+++ b/sc/inc/segmenttree.hxx
@@ -79,6 +79,7 @@ public:
     bool setFalse(SCROW nRow1, SCROW nRow2);
     bool getValue(SCROW nRow);
     bool getRangeData(SCROW nRow, RangeData& rData);
+    bool getRangeDataLeaf(SCROW nRow, RangeData& rData);
     void removeSegment(SCROW nRow1, SCROW nRow2);
     void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary);
 
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 4d57826..2f03fca 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -727,6 +727,7 @@ public:
         ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
 
     bool        RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
+    bool        RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
     bool        HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
     bool        ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
     bool        SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index fde7cba..fea1c1a 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -397,6 +397,18 @@ bool ScFlatBoolRowSegments::getRangeData(SCROW nRow, RangeData& rData)
     return true;
 }
 
+bool ScFlatBoolRowSegments::getRangeDataLeaf(SCROW nRow, RangeData& rData)
+{
+    ScFlatBoolSegmentsImpl::RangeData aData;
+    if (!mpImpl->getRangeDataLeaf(static_cast<SCCOLROW>(nRow), aData))
+        return false;
+
+    rData.mbValue = aData.mnValue;
+    rData.mnRow1  = static_cast<SCROW>(aData.mnPos1);
+    rData.mnRow2  = static_cast<SCROW>(aData.mnPos2);
+    return true;
+}
+
 void ScFlatBoolRowSegments::removeSegment(SCROW nRow1, SCROW nRow2)
 {
     mpImpl->removeSegment(static_cast<SCCOLROW>(nRow1), static_cast<SCCOLROW>(nRow2));
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 8d91fd8..bc4adfb 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2534,7 +2534,7 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
     while (nStartRow <= nRow2)
     {
         SCROW nEndRow = -1;
-        bool bWasVis = !RowHidden(nStartRow, NULL, &nEndRow);
+        bool bWasVis = !RowHiddenLeaf(nStartRow, NULL, &nEndRow);
         if (nEndRow > nRow2)
             nEndRow = nRow2;
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 5fbbf9d..86fc652 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1614,8 +1614,6 @@ static void lcl_PrepareQuery( ScDocument* pDoc, ScTable* pTab, ScQueryParam& rPa
 
 SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
 {
-    mpHiddenRows->enableTreeSearch(false);
-
     ScQueryParam    aParam( rParamOrg );
     ScStrCollection	aScStrCollection;
     StrData*		pStrData = NULL;
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index af6e786..33aee6a 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -540,6 +540,36 @@ bool ScTable::RowHidden(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
     return aData.mbValue;
 }
 
+bool ScTable::RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
+{
+    if (!ValidRow(nRow))
+    {
+        if (pFirstRow)
+            *pFirstRow = nRow;
+        if (pLastRow)
+            *pLastRow = nRow;
+        return true;
+    }
+
+    ScFlatBoolRowSegments::RangeData aData;
+    if (!mpHiddenRows->getRangeDataLeaf(nRow, aData))
+    {
+        // search failed.
+        if (pFirstRow)
+            *pFirstRow = nRow;
+        if (pLastRow)
+            *pLastRow = nRow;
+        return true;
+    }
+
+    if (pFirstRow)
+        *pFirstRow = aData.mnRow1;
+    if (pLastRow)
+        *pLastRow = aData.mnRow2;
+
+    return aData.mbValue;
+}
+
 bool ScTable::HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nRow = nStartRow;


More information about the Libreoffice-commits mailing list