Commits

Anonymous committed b83ce4e

calcdatatables: use visible area for DataTable stripes if range contains filtered or hidden columns/rows

Comments (0)

Files changed (6)

sc/inc/document.hxx

     ::com::sun::star::uno::Sequence<
         ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData(SCTAB nTab) const;
 
-    SC_DLLPUBLIC bool           RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
-    SC_DLLPUBLIC bool           RowHidden(SCROW nRow, SCTAB nTab, SCROW& rLastRow);
-    SC_DLLPUBLIC bool           HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
-    SC_DLLPUBLIC bool           ColHidden(SCCOL nCol, SCTAB nTab, SCCOL& rLastCol);
-    SC_DLLPUBLIC bool           ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
+    SC_DLLPUBLIC bool           RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
+    SC_DLLPUBLIC bool           RowHidden(SCROW nRow, SCTAB nTab, SCROW& rLastRow) const;
+    SC_DLLPUBLIC bool           HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
+    SC_DLLPUBLIC bool           ColHidden(SCCOL nCol, SCTAB nTab, SCCOL& rLastCol) const;
+    SC_DLLPUBLIC bool           ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
+    SC_DLLPUBLIC bool           HasHiddenCols(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab) const;
     SC_DLLPUBLIC void           SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden);
     SC_DLLPUBLIC void           SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden);
-    SC_DLLPUBLIC SCROW          FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
-    SC_DLLPUBLIC SCROW          LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
-    SCROW                       CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
+    SC_DLLPUBLIC SCROW          FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
+    SC_DLLPUBLIC SCROW          LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
+    SCROW                       CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
 
-    bool                        RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
-    bool                        HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
-    bool                        ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
+    bool                        RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
+    bool                        HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
+    bool                        ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
     SC_DLLPUBLIC void           SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered);
     SC_DLLPUBLIC void           SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bFiltered);
-    SCROW                       FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
-    SCROW                       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
-    SCROW                       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
+    SCROW                       FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
+    SCROW                       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
+    SCROW                       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
 
     /** 
      * Write all column row flags to table's flag data, because not all column 
      * 
      * @return SCROW last row of the range within specified height.
      */
-    SCROW       GetRowForHeight(ULONG nHeight);
+    SCROW       GetRowForHeight(ULONG nHeight) const;
 
 	USHORT		GetOriginalWidth( SCCOL nCol ) const;
 	USHORT		GetOriginalHeight( SCROW nRow ) const;
 
-	USHORT		GetCommonWidth( SCCOL nEndCol );
+	USHORT		GetCommonWidth( SCCOL nEndCol ) const;
 
-	SCROW		GetHiddenRowCount( SCROW nRow );
+	SCROW		GetHiddenRowCount( SCROW nRow ) const;
 
 	void		ShowCol(SCCOL nCol, bool bShow);
 	void		ShowRow(SCROW nRow, bool bShow);
     ::com::sun::star::uno::Sequence<
         ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
 
-    bool        RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
-    bool        RowHidden(SCROW nRow, SCROW& rLastRow);
-    bool        HasHiddenRows(SCROW nStartRow, SCROW nEndRow);
-    bool        ColHidden(SCCOL nCol, SCCOL& rLastCol);
-    bool        ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
+    bool        RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
+    bool        RowHidden(SCROW nRow, SCROW& rLastRow) const;
+    bool        HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
+    bool        ColHidden(SCCOL nCol, SCCOL& rLastCol) const;
+    bool        ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
+    bool        HasHiddenCols(SCCOL nStartCol, SCCOL nEndCol) const;
     void        SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
     void        SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
     void        CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
     void        CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
     void        CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
-    SCROW       FirstVisibleRow(SCROW nStartRow, SCROW nEndRow);
-    SCROW       LastVisibleRow(SCROW nStartRow, SCROW nEndRow);
-    SCROW       CountVisibleRows(SCROW nStartRow, SCROW nEndRow);
-    sal_uInt32  GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow);
+    SCROW       FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
+    SCROW       LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
+    SCROW       CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
+    sal_uInt32  GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const;
 
-    SCCOLROW    LastHiddenColRow(SCCOLROW nPos, bool bCol);
+    SCCOLROW    LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
 
-    bool        RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
-    bool        ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
-    bool        HasFilteredRows(SCROW nStartRow, SCROW nEndRow);
+    bool        RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
+    bool        ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
+    bool        HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
     void        CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
     void        CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
     void        SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
     void        SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
-    SCROW       FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow);
-    SCROW       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow);
-    SCROW       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow);
+    SCROW       FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
+    SCROW       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
+    SCROW       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
 
     void        SyncColRowFlags();
 

sc/source/core/data/datatablestyle.cxx

     // If row stripes are set they take precedence over column stripes.
     if (mbBandedRows)
     {
-        SCROW nOff = (rPos.Row() - maRange.aStart.Row()) % (mnRowsStripe1 + mnRowsStripe2);
+        SCROW nRow = rPos.Row();
+        const SCROW nStartRow = maRange.aStart.Row();
+        if (mpDoc->HasHiddenRows( nStartRow, nRow, maRange.aStart.Tab()))
+        {
+            // Hidden or filtered, use visible area.
+            const SCROW nEndRow = rPos.Row();
+            nRow = nStartRow;
+            SCROW nRowCount = 0;
+            do
+            {
+                /* TODO: this could use an iterator over non-/hidden instead of 
+                 * seeking each segment. */
+                SCROW nLastHiddenRow;
+                if (mpDoc->RowHidden( nRow, maRange.aStart.Tab(), nLastHiddenRow))
+                    nRow = nLastHiddenRow + 1;
+                else
+                {
+                    SCROW nRowMinPlus = ::std::min( nLastHiddenRow, nEndRow) + 1;
+                    nRowCount += nRowMinPlus - nRow;
+                    nRow = nRowMinPlus;
+                }
+            } while (nRow <= nEndRow);
+            DBG_ASSERT( nRowCount > 0, "ScDataTableFormat::GetStyleType: no visible row");
+            nRow = maRange.aStart.Row() + (nRowCount ? nRowCount - 1 : 0);
+        }
+        SCROW nOff = (nRow - nStartRow) % (mnRowsStripe1 + mnRowsStripe2);
         if (nOff < mnRowsStripe1)
         {
             if (maStyleName[ROW_STRIPE_1].Len())
     }
     if (mbBandedCols)
     {
-        SCCOL nOff = (rPos.Col() - maRange.aStart.Col()) % (mnColsStripe1 + mnColsStripe2);
+        SCCOL nCol = rPos.Col();
+        const SCCOL nStartCol = maRange.aStart.Col();
+        if (mpDoc->HasHiddenCols( nStartCol, nCol, maRange.aStart.Tab()))
+        {
+            // Hidden or filtered, use visible area.
+            const SCCOL nEndCol = rPos.Col();
+            nCol = nStartCol;
+            SCCOL nColCount = 0;
+            do
+            {
+                /* TODO: this could use an iterator over non-/hidden instead of 
+                 * seeking each segment. */
+                SCCOL nLastHiddenCol;
+                if (mpDoc->ColHidden( nCol, maRange.aStart.Tab(), nLastHiddenCol))
+                    nCol = nLastHiddenCol + 1;
+                else
+                {
+                    SCCOL nColMinPlus = ::std::min( nLastHiddenCol, nEndCol) + 1;
+                    nColCount += nColMinPlus - nCol;
+                    nCol = nColMinPlus;
+                }
+            } while (nCol <= nEndCol);
+            DBG_ASSERT( nColCount > 0, "ScDataTableFormat::GetStyleType: no visible column");
+            nCol = maRange.aStart.Col() + (nColCount ? nColCount - 1 : 0);
+        }
+        SCCOL nOff = (nCol - nStartCol) % (mnColsStripe1 + mnColsStripe2);
         if (nOff < mnColsStripe1)
         {
             if (maStyleName[COL_STRIPE_1].Len())

sc/source/core/data/document.cxx

     return pTab[nTab]->GetRowBreakData();
 }
 
-bool ScDocument::RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow, SCROW* pLastRow)
+bool ScDocument::RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow, SCROW* pLastRow) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
 		return false;
 	return pTab[nTab]->RowHidden(nRow, pFirstRow, pLastRow);
 }
 
-bool ScDocument::RowHidden(SCROW nRow, SCTAB nTab, SCROW& rLastRow)
+bool ScDocument::RowHidden(SCROW nRow, SCTAB nTab, SCROW& rLastRow) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
 	{
 }
 
 
-bool ScDocument::HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
+bool ScDocument::HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
 		return false;
 	return pTab[nTab]->HasHiddenRows(nStartRow, nEndRow);
 }
 
-bool ScDocument::ColHidden(SCCOL nCol, SCTAB nTab, SCCOL& rLastCol)
+bool ScDocument::ColHidden(SCCOL nCol, SCTAB nTab, SCCOL& rLastCol) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
 	{
 	return pTab[nTab]->ColHidden(nCol, rLastCol);
 }
 
-bool ScDocument::ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol, SCCOL* pLastCol)
+bool ScDocument::ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol, SCCOL* pLastCol) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
 	{
 	return pTab[nTab]->ColHidden(nCol, pFirstCol, pLastCol);
 }
 
+bool ScDocument::HasHiddenCols(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab) const
+{
+    if (!ValidTab(nTab) || !pTab[nTab])
+		return false;
+
+	return pTab[nTab]->HasHiddenCols(nStartCol, nEndCol);
+}
+
+
 void ScDocument::SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden)
 {
 	if (!ValidTab(nTab) || !pTab[nTab])
 	pTab[nTab]->SetColHidden(nStartCol, nEndCol, bHidden);
 }
 
-SCROW ScDocument::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
+SCROW ScDocument::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
 {
 	if (!ValidTab(nTab) || !pTab[nTab])
 		return ::std::numeric_limits<SCROW>::max();;
     return pTab[nTab]->FirstVisibleRow(nStartRow, nEndRow);
 }
 
-SCROW ScDocument::LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
+SCROW ScDocument::LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
 {
 	if (!ValidTab(nTab) || !pTab[nTab])
 		return ::std::numeric_limits<SCROW>::max();;
     return pTab[nTab]->LastVisibleRow(nStartRow, nEndRow);
 }
 
-SCROW ScDocument::CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
+SCROW ScDocument::CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
 {
 	if (!ValidTab(nTab) || !pTab[nTab])
         return 0;
     return pTab[nTab]->CountVisibleRows(nStartRow, nEndRow);
 }
 
-bool ScDocument::RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow, SCROW* pLastRow)
+bool ScDocument::RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow, SCROW* pLastRow) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
 		return false;
 	return pTab[nTab]->RowFiltered(nRow, pFirstRow, pLastRow);
 }
 
-bool ScDocument::HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
+bool ScDocument::HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
 		return false;
 	return pTab[nTab]->HasFilteredRows(nStartRow, nEndRow);
 }
 
-bool ScDocument::ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol, SCCOL* pLastCol)
+bool ScDocument::ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol, SCCOL* pLastCol) const
 {
     if (!ValidTab(nTab) || !pTab[nTab])
 		return false;
 	pTab[nTab]->SetColFiltered(nStartCol, nEndCol, bFiltered);
 }
 
-SCROW ScDocument::FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
+SCROW ScDocument::FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
 {
 	if (!ValidTab(nTab) || !pTab[nTab])
 		return ::std::numeric_limits<SCROW>::max();;
     return pTab[nTab]->FirstNonFilteredRow(nStartRow, nEndRow);
 }
 
-SCROW ScDocument::LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
+SCROW ScDocument::LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
 {
 	if (!ValidTab(nTab) || !pTab[nTab])
 		return ::std::numeric_limits<SCROW>::max();;
     return pTab[nTab]->LastNonFilteredRow(nStartRow, nEndRow);
 }
 
-SCROW ScDocument::CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
+SCROW ScDocument::CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
 {
 	if (!ValidTab(nTab) || !pTab[nTab])
         return 0;

sc/source/core/data/table2.cxx

 }
 
 
-USHORT ScTable::GetCommonWidth( SCCOL nEndCol )
+USHORT ScTable::GetCommonWidth( SCCOL nEndCol ) const
 {
 	//	get the width that is used in the largest continuous column range (up to nEndCol)
 
 //	Spalten-/Zeilen-Flags
 
 
-SCROW ScTable::GetHiddenRowCount( SCROW nRow )
+SCROW ScTable::GetHiddenRowCount( SCROW nRow ) const
 {
     if (!ValidRow(nRow))
         return 0;
 	return n;
 }
 
-SCROW ScTable::GetRowForHeight(ULONG nHeight)
+SCROW ScTable::GetRowForHeight(ULONG nHeight) const
 {
     sal_uInt32 nSum = 0;
 

sc/source/core/data/table5.cxx

     return aSeq;
 }
 
-bool ScTable::RowHidden(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow)
+bool ScTable::RowHidden(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
 {
     if (!ValidRow(nRow))
         return true;
 }
 
 
-bool ScTable::RowHidden(SCROW nRow, SCROW& rLastRow)
+bool ScTable::RowHidden(SCROW nRow, SCROW& rLastRow) const
 {
     rLastRow = nRow;    
     if (!ValidRow(nRow))
     return aData.mbValue;
 }
 
-bool ScTable::HasHiddenRows(SCROW nStartRow, SCROW nEndRow)
+bool ScTable::HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nRow = nStartRow;
     while (nRow <= nEndRow)
     return false;
 }
 
-bool ScTable::ColHidden(SCCOL nCol, SCCOL& rLastCol)
+bool ScTable::ColHidden(SCCOL nCol, SCCOL& rLastCol) const
 {
     rLastCol = nCol;    
     if (!ValidCol(nCol))
     return aData.mbValue;
 }
 
-bool ScTable::ColHidden(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol)
+bool ScTable::ColHidden(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol) const
 {
     if (!ValidCol(nCol))
         return true;
     return aData.mbValue;
 }
 
+bool ScTable::HasHiddenCols(SCCOL nStartCol, SCCOL nEndCol) const
+{
+    SCCOL nCol = nStartCol;
+    while (nCol <= nEndCol)
+    {
+        SCCOL nLastCol = -1;
+        bool bHidden = ColHidden(nCol, nLastCol);
+        if (bHidden)
+            return true;
+
+        nCol = nLastCol + 1;
+    }
+    return false;
+}
+
 void ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden)
 {
     if (bHidden)
     }
 }
 
-SCROW ScTable::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nRow = nStartRow;
     ScFlatBoolRowSegments::RangeData aData;
     return ::std::numeric_limits<SCROW>::max();
 }
 
-SCROW ScTable::LastVisibleRow(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nRow = nEndRow;
     ScFlatBoolRowSegments::RangeData aData;
     return ::std::numeric_limits<SCROW>::max();
 }
 
-SCROW ScTable::CountVisibleRows(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nCount = 0;
     SCROW nRow = nStartRow;
     return nCount;
 }
 
-sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow)
+sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const
 {
     sal_uInt32 nHeight = 0;
     SCROW nRow = nStartRow;
     return nHeight;
 }
 
-SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool bCol)
+SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool bCol) const
 {
     if (bCol)
     {
     return ::std::numeric_limits<SCCOLROW>::max();
 }
 
-bool ScTable::RowFiltered(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow)
+bool ScTable::RowFiltered(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
 {
     if (!ValidRow(nRow))
         return false;
     return aData.mbValue;
 }
 
-bool ScTable::ColFiltered(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol)
+bool ScTable::ColFiltered(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol) const
 {
     if (!ValidCol(nCol))
         return false;
     return aData.mbValue;
 }
 
-bool ScTable::HasFilteredRows(SCROW nStartRow, SCROW nEndRow)
+bool ScTable::HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nRow = nStartRow;
     while (nRow <= nEndRow)
         mpFilteredCols->setFalse(nStartCol, nEndCol);
 }
 
-SCROW ScTable::FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nRow = nStartRow;
     ScFlatBoolRowSegments::RangeData aData;
     return ::std::numeric_limits<SCROW>::max();
 }
 
-SCROW ScTable::LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nRow = nEndRow;
     ScFlatBoolRowSegments::RangeData aData;
     return ::std::numeric_limits<SCROW>::max();
 }
 
-SCROW ScTable::CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const
 {
     SCROW nCount = 0;
     SCROW nRow = nStartRow;