private static bool SearchRowTotal(Matrix matrix, MatrixMemberCollection rowTotalChildren, IntList hiddenColumns, SearchContext searchContext)
        {
            bool         flag         = false;
            MatrixMember matrixMember = null;
            int          num          = 0;

            while (!flag && num < rowTotalChildren.Count)
            {
                matrixMember = rowTotalChildren[num];
                flag         = matrixMember.ReportItem.Search(searchContext);
                if (!flag)
                {
                    flag = Matrix.SearchRangeCells(matrix, matrixMember.MemberCellIndex, hiddenColumns, searchContext);
                }
                num++;
            }
            return(flag);
        }
 private void CalculateGroupsCellsBeforeRowHeaders()
 {
     this.m_groupsBeforeRowHeaders = ((AspNetCore.ReportingServices.ReportProcessing.Matrix)base.ReportItemDef).GroupsBeforeRowHeaders;
     if (this.m_groupsBeforeRowHeaders > 0 && base.ReportItemInstance != null)
     {
         MatrixHeadingInstanceList columnInstances        = ((MatrixInstance)base.ReportItemInstance).ColumnInstances;
         MatrixMemberCollection    matrixMemberCollection = null;
         int num = -1;
         if (columnInstances != null && 0 < columnInstances.Count)
         {
             num = columnInstances.Count - 1;
             if (columnInstances[0].IsSubtotal || (this.m_groupsBeforeRowHeaders == num && columnInstances[num].IsSubtotal))
             {
                 this.m_groupsBeforeRowHeaders++;
             }
         }
         this.m_cellsBeforeRowHeaders = 0;
         if (this.m_groupsBeforeRowHeaders > num + 1)
         {
             this.m_groupsBeforeRowHeaders = 0;
         }
         else
         {
             matrixMemberCollection = this.ColumnMemberCollection;
         }
         for (int i = 0; i < this.m_groupsBeforeRowHeaders; i++)
         {
             this.m_cellsBeforeRowHeaders += matrixMemberCollection[i].ColumnSpan;
         }
     }
     else
     {
         this.m_groupsBeforeRowHeaders = 0;
         this.m_cellsBeforeRowHeaders  = 0;
     }
 }
        private static bool SearchMatrixColumns(MatrixMemberCollection columns, ref IntList hiddenColumns, SearchContext searchContext)
        {
            if (columns == null)
            {
                return(false);
            }
            bool                   flag                   = false;
            int                    num                    = 0;
            int                    num2                   = columns.Count - 1;
            int                    num3                   = 0;
            MatrixMember           matrixMember           = null;
            MatrixMemberCollection matrixMemberCollection = null;
            SearchContext          searchContext2         = new SearchContext(searchContext);
            int                    index                  = 0;
            int                    count                  = 0;

            num3 = num2 - num + 1;
            int num4 = num;

            while (!flag && num4 <= num2)
            {
                matrixMember = columns[num4];
                if (matrixMember.Hidden)
                {
                    if (matrixMember.IsTotal)
                    {
                        if (hiddenColumns != null)
                        {
                            index = hiddenColumns.Count;
                        }
                        count = matrixMember.ColumnSpan;
                    }
                    Matrix.BuildHiddenColumns(matrixMember, ref hiddenColumns);
                    num3--;
                }
                else
                {
                    flag = matrixMember.ReportItem.Search(searchContext2);
                    if (!flag)
                    {
                        matrixMemberCollection = matrixMember.Children;
                        flag = Matrix.SearchMatrixColumns(matrixMemberCollection, ref hiddenColumns, searchContext2);
                    }
                }
                num4++;
            }
            if (num3 == 0)
            {
                hiddenColumns.RemoveRange(index, count);
                if (!flag)
                {
                    if (!matrixMember.IsTotal)
                    {
                        matrixMember = columns[0];
                    }
                    matrixMemberCollection = matrixMember.Children;
                    if (matrixMemberCollection != null)
                    {
                        int num5 = 0;
                        while (!flag && num5 < matrixMemberCollection.Count)
                        {
                            matrixMember = matrixMemberCollection[num5];
                            flag         = matrixMember.ReportItem.Search(searchContext2);
                            num5++;
                        }
                    }
                }
            }
            return(flag);
        }
        private static bool SearchMatrixRowsContent(Matrix matrix, MatrixMember member, SearchContext searchContext, IntList hiddenColumns)
        {
            bool                   flag                    = false;
            int                    num                     = 0;
            int                    num2                    = 0;
            int                    num3                    = 0;
            MatrixMember           matrixMember            = null;
            MatrixMemberCollection matrixMemberCollection  = null;
            MatrixMemberCollection matrixMemberCollection2 = null;
            SearchContext          searchContext2          = new SearchContext(searchContext);
            bool                   flag2                   = false;

            matrixMemberCollection2 = ((member != null) ? member.Children : matrix.RowMemberCollection);
            if (searchContext.ItemStartPage != searchContext.ItemEndPage)
            {
                if (member == null)
                {
                    matrix.GetRowMembersOnPage(searchContext.SearchPage, out num, out num2);
                }
                else
                {
                    member.GetChildRowMembersOnPage(searchContext.SearchPage, out num, out num2);
                }
                flag2 = true;
            }
            else
            {
                num  = 0;
                num2 = matrixMemberCollection2.Count - 1;
            }
            num3 = num2 - num + 1;
            int num4 = num;

            while (!flag && num4 <= num2)
            {
                matrixMember = matrixMemberCollection2[num4];
                if (matrixMember.Hidden)
                {
                    num3--;
                }
                else
                {
                    matrixMemberCollection = matrixMember.Children;
                    if (matrixMemberCollection != null)
                    {
                        flag = matrixMember.ReportItem.Search(searchContext2);
                        if (!flag)
                        {
                            if (flag2 && (num4 == num || num4 == num2))
                            {
                                int           itemStartPage  = 0;
                                int           itemEndPage    = 0;
                                SearchContext searchContext3 = new SearchContext(searchContext);
                                if (member == null)
                                {
                                    matrix.IsRowMemberOnThisPage(num4, searchContext.SearchPage, out itemStartPage, out itemEndPage);
                                }
                                else
                                {
                                    member.IsRowMemberOnThisPage(num4, searchContext.SearchPage, out itemStartPage, out itemEndPage);
                                }
                                searchContext3.ItemStartPage = itemStartPage;
                                searchContext3.ItemEndPage   = itemEndPage;
                                flag = Matrix.SearchMatrixRowsContent(matrix, matrixMember, searchContext3, hiddenColumns);
                            }
                            else
                            {
                                flag = Matrix.SearchMatrixRowsContent(matrix, matrixMember, searchContext2, hiddenColumns);
                            }
                        }
                    }
                    else
                    {
                        flag = matrixMember.ReportItem.Search(searchContext2);
                        if (!flag)
                        {
                            flag = Matrix.SearchRangeCells(matrix, matrixMember.MemberCellIndex, hiddenColumns, searchContext2);
                        }
                    }
                }
                num4++;
            }
            if (!flag && num3 == 0)
            {
                if (!matrixMember.IsTotal)
                {
                    matrixMember = matrixMemberCollection2[0];
                }
                matrixMemberCollection = matrixMember.Children;
                flag = ((matrixMemberCollection == null) ? Matrix.SearchRangeCells(matrix, matrixMember.MemberCellIndex, hiddenColumns, searchContext2) : Matrix.SearchRowTotal(matrix, matrixMemberCollection, hiddenColumns, searchContext2));
            }
            return(flag);
        }