private void UpdateMatrixMemberInfoCache(int currentAllocationSize, MatrixMemberInfoCache newMatrixMemberCellIndexes)
        {
            if (!m_isColumn)
            {
                return;
            }
            MatrixMemberInfoCache matrixMemberInfoCache = (m_parent == null) ? null : ((ShimMatrixMember)m_parent).CurrentMatrixMemberCellIndexes;

            if (matrixMemberInfoCache == null)
            {
                if (newMatrixMemberCellIndexes != null)
                {
                    m_currentMatrixMemberCellIndexes = newMatrixMemberCellIndexes;
                }
                return;
            }
            int adjustedRenderCollectionIndex            = ((ShimMatrixMember)m_parent).AdjustedRenderCollectionIndex;
            MatrixMemberInfoCache matrixMemberInfoCache2 = matrixMemberInfoCache.Children[adjustedRenderCollectionIndex];

            if (matrixMemberInfoCache2 == null)
            {
                matrixMemberInfoCache2 = ((m_children == null) ? new MatrixMemberInfoCache(matrixMemberInfoCache.GetCellIndex((ShimMatrixMember)m_parent), -1) : new MatrixMemberInfoCache(-1, currentAllocationSize));
                matrixMemberInfoCache.Children[adjustedRenderCollectionIndex] = matrixMemberInfoCache2;
            }
            m_currentMatrixMemberCellIndexes = matrixMemberInfoCache2;
        }
 internal ShimMatrixMember(IDefinitionPath parentDefinitionPath, Tablix owner, ShimMatrixMember parent, int parentCollectionIndex, bool isColumn, int renderCollectionIndex, ShimRenderGroups renderGroups, MatrixMemberInfoCache matrixMemberCellIndexes)
     : base(parentDefinitionPath, owner, parent, parentCollectionIndex, isColumn)
 {
     m_renderCollectionIndex          = renderCollectionIndex;
     m_currentMatrixMemberCellIndexes = matrixMemberCellIndexes;
     m_definitionStartIndex           = owner.GetCurrentMemberCellDefinitionIndex();
     m_group = new Group(owner, renderGroups, this);
     GenerateInnerHierarchy(owner, parent, isColumn, ((MatrixMember)m_group.CurrentShimRenderGroup).Children);
     m_definitionEndIndex = owner.GetCurrentMemberCellDefinitionIndex();
 }
 internal ShimMatrixMember(IDefinitionPath parentDefinitionPath, Tablix owner, ShimMatrixMember parent, int parentCollectionIndex, bool isColumn, int renderCollectionIndex, MatrixMember staticOrSubtotal, bool isAfterSubtotal, MatrixMemberInfoCache matrixMemberCellIndexes)
     : base(parentDefinitionPath, owner, parent, parentCollectionIndex, isColumn)
 {
     m_renderCollectionIndex          = renderCollectionIndex;
     m_isAfterSubtotal                = isAfterSubtotal;
     m_currentMatrixMemberCellIndexes = matrixMemberCellIndexes;
     m_definitionStartIndex           = owner.GetCurrentMemberCellDefinitionIndex();
     m_staticOrSubtotal               = staticOrSubtotal;
     GenerateInnerHierarchy(owner, parent, isColumn, staticOrSubtotal.Children);
     m_definitionEndIndex = owner.GetCurrentMemberCellDefinitionIndex();
 }
 internal void UpdateContext(MatrixMemberInfoCache matrixMemberCellIndexes)
 {
     if (m_children != null)
     {
         if (m_isColumnGroup)
         {
             ResetContext(base.OwnerTablix.RenderMatrix.ColumnMemberCollection, matrixMemberCellIndexes);
         }
         else
         {
             ResetContext(base.OwnerTablix.RenderMatrix.RowMemberCollection);
         }
     }
 }
 private void GenerateInnerHierarchy(Tablix owner, ShimMatrixMember parent, bool isColumn, MatrixMemberCollection children)
 {
     if (children != null)
     {
         MatrixMemberInfoCache matrixMemberInfoCache = null;
         if (m_isColumn)
         {
             matrixMemberInfoCache = ((children.MatrixHeadingDef.SubHeading == null) ? new MatrixMemberInfoCache((m_staticOrSubtotal != null) ? m_staticOrSubtotal.MemberCellIndex : AdjustedRenderCollectionIndex, -1) : new MatrixMemberInfoCache(-1, children.Count));
             m_currentMatrixMemberCellIndexes.Children[AdjustedRenderCollectionIndex] = matrixMemberInfoCache;
         }
         m_children = new ShimMatrixMemberCollection(this, owner, isColumn, this, children, matrixMemberInfoCache);
     }
     else
     {
         owner.GetAndIncrementMemberCellDefinitionIndex();
     }
 }
        internal void ResetContext(MatrixMemberCollection newRenderMemberCollection, MatrixMemberInfoCache matrixMemberCellIndexes)
        {
            if (m_children == null)
            {
                return;
            }
            MatrixMember     staticOrSubtotal = null;
            int              newAfterSubtotalCollectionIndex = -1;
            ShimRenderGroups renderGroups = null;

            if (newRenderMemberCollection != null)
            {
                renderGroups = new ShimRenderGroups(newRenderMemberCollection, m_subtotalChildIndex == 0, 1 == m_subtotalChildIndex);
                int count = newRenderMemberCollection.Count;
                if (m_subtotalChildIndex == 0)
                {
                    staticOrSubtotal = newRenderMemberCollection[0];
                }
                else if (1 == m_subtotalChildIndex)
                {
                    staticOrSubtotal = newRenderMemberCollection[count - 1];
                    newAfterSubtotalCollectionIndex = count - 1;
                }
            }
            if (m_dynamicSubgroupChildIndex >= 0)
            {
                ((ShimMatrixMember)m_children[m_dynamicSubgroupChildIndex]).ResetContext(null, -1, renderGroups, matrixMemberCellIndexes);
                if (m_subtotalChildIndex >= 0)
                {
                    ((ShimMatrixMember)m_children[m_subtotalChildIndex]).ResetContext(staticOrSubtotal, newAfterSubtotalCollectionIndex, null, matrixMemberCellIndexes);
                }
            }
            else
            {
                for (int i = 0; i < m_children.Length; i++)
                {
                    staticOrSubtotal = newRenderMemberCollection?[i];
                    ((ShimMatrixMember)m_children[i]).ResetContext(staticOrSubtotal, -1, null, matrixMemberCellIndexes);
                }
            }
        }
        internal void ResetContext(bool clearCache)
        {
            if (clearCache)
            {
                OwnerTablix.ResetMemberCellDefinitionIndex(0);
            }
            if (m_members == null || !OwnerTablix.IsOldSnapshot)
            {
                return;
            }
            switch (OwnerTablix.SnapshotTablixType)
            {
            case DataRegion.Type.List:
                if (!m_isColumn)
                {
                    ((ShimListMemberCollection)m_members).UpdateContext(OwnerTablix.RenderList.Contents);
                }
                break;

            case DataRegion.Type.Table:
                if (!m_isColumn)
                {
                    ((ShimTableMemberCollection)m_members).UpdateContext();
                }
                break;

            case DataRegion.Type.Matrix:
            {
                MatrixMemberInfoCache matrixMemberCellIndexes = null;
                if (clearCache && m_isColumn)
                {
                    matrixMemberCellIndexes = CreateMatrixMemberCache();
                }
                ((ShimMatrixMemberCollection)m_members).UpdateContext(matrixMemberCellIndexes);
                break;
            }
            }
        }
        internal ShimMatrixMemberCollection(IDefinitionPath parentDefinitionPath, Tablix owner, bool isColumnGroup, ShimMatrixMember parent, MatrixMemberCollection renderMemberCollection, MatrixMemberInfoCache matrixMemberCellIndexes)
            : base(parentDefinitionPath, owner, isColumnGroup)
        {
            m_definitionStartIndex = owner.GetCurrentMemberCellDefinitionIndex();
            int count = renderMemberCollection.Count;

            if (renderMemberCollection[0].IsStatic)
            {
                m_children = new ShimMatrixMember[count];
                for (int i = 0; i < count; i++)
                {
                    m_children[i] = new ShimMatrixMember(this, owner, parent, i, isColumnGroup, i, renderMemberCollection[i], isAfterSubtotal: false, matrixMemberCellIndexes);
                }
            }
            else
            {
                m_dynamicSubgroupChildIndex = 0;
                bool flag  = renderMemberCollection.MatrixHeadingDef.Subtotal != null;
                bool flag2 = flag && renderMemberCollection.MatrixHeadingDef.Subtotal.Position == Subtotal.PositionType.After;
                m_children = new ShimMatrixMember[(!flag) ? 1 : 2];
                if (flag)
                {
                    m_subtotalChildIndex = 0;
                    if (flag2)
                    {
                        m_subtotalChildIndex++;
                    }
                    else
                    {
                        m_dynamicSubgroupChildIndex++;
                    }
                }
                if (flag)
                {
                    Microsoft.ReportingServices.ReportRendering.ReportItem reportItem = renderMemberCollection[m_subtotalChildIndex].ReportItem;
                    if (reportItem != null)
                    {
                        if (isColumnGroup)
                        {
                            m_sizeDelta += reportItem.Width.ToMillimeters();
                        }
                        else
                        {
                            m_sizeDelta += reportItem.Height.ToMillimeters();
                        }
                    }
                }
                if (flag && !flag2)
                {
                    m_children[m_subtotalChildIndex] = new ShimMatrixMember(this, owner, parent, m_subtotalChildIndex, isColumnGroup, 0, renderMemberCollection[0], flag2, matrixMemberCellIndexes);
                }
                ShimRenderGroups renderGroups     = new ShimRenderGroups(renderMemberCollection, flag && !flag2, flag && flag2);
                ShimMatrixMember shimMatrixMember = (ShimMatrixMember)(m_children[m_dynamicSubgroupChildIndex] = new ShimMatrixMember(this, owner, parent, m_dynamicSubgroupChildIndex, isColumnGroup, m_dynamicSubgroupChildIndex, renderGroups, matrixMemberCellIndexes));
                if (flag && flag2)
                {
                    m_children[m_subtotalChildIndex] = new ShimMatrixMember(this, owner, parent, m_subtotalChildIndex, isColumnGroup, count - 1, renderMemberCollection[count - 1], flag2, matrixMemberCellIndexes);
                }
                m_sizeDelta += shimMatrixMember.SizeDelta;
            }
            m_definitionEndIndex = owner.GetCurrentMemberCellDefinitionIndex();
        }
        internal void ResetContext(MatrixMember staticOrSubtotal, int newAfterSubtotalCollectionIndex, ShimRenderGroups renderGroups, MatrixMemberInfoCache newMatrixMemberCellIndexes)
        {
            int currentAllocationSize = 1;

            if (m_group != null)
            {
                m_group.CurrentRenderGroupIndex = -1;
                if (renderGroups != null)
                {
                    m_group.RenderGroups = renderGroups;
                }
                currentAllocationSize = m_group.RenderGroups.MatrixMemberCollectionCount;
            }
            else if (staticOrSubtotal != null)
            {
                m_staticOrSubtotal = staticOrSubtotal;
                if (m_isAfterSubtotal && newAfterSubtotalCollectionIndex >= 0)
                {
                    m_renderCollectionIndex = newAfterSubtotalCollectionIndex;
                }
            }
            UpdateMatrixMemberInfoCache(currentAllocationSize, newMatrixMemberCellIndexes);
            if (IsStatic)
            {
                UpdateContext(m_staticOrSubtotal);
            }
            else if (!base.OwnerTablix.RenderMatrix.NoRows && m_group.RenderGroups != null && m_group.RenderGroups.Count > 0)
            {
                UpdateContext(m_group.RenderGroups[0] as MatrixMember);
            }
        }