コード例 #1
0
        void FillMatrixCorner()
        {
            XmlNode corner = _Draw.GetNamedChildNode(_MatrixNode, "Corner");

            if (corner == null)
            {
                return;
            }

            XmlNode    ris = DesignXmlDraw.FindNextInHierarchy(corner, "ReportItems");
            MatrixItem mi  = new MatrixItem(ris);

            _MatrixView[0, 0] = mi;
        }
コード例 #2
0
        void FillMatrixWidths()
        {
            // fill out the widths for each column
            this._Width = 0;
            for (int col = 0; col < this.Columns; col++)
            {
                float width = 0;
                for (int row = 0; row < this.Rows; row++)
                {
                    MatrixItem mi = _MatrixView[row, col];
                    width = Math.Max(width, mi.Width);
                }
                for (int row = 0; row < this.Rows; row++)
                {
                    _MatrixView[row, col].Width = width;
                }

                this._Width += width;
            }
        }
コード例 #3
0
        void FillMatrixHeights()
        {
            // fill out the heights for each row
            this._Height = 0;
            for (int row = 0; row < this.Rows; row++)
            {
                float height = 0;
                for (int col = 0; col < this.Columns; col++)
                {
                    MatrixItem mi = _MatrixView[row, col];
                    height = Math.Max(height, mi.Height);
                }
                for (int col = 0; col < this.Columns; col++)
                {
                    _MatrixView[row, col].Height = height;
                }

                this._Height += height;
            }
        }
コード例 #4
0
        void FillMatrixCornerHeightWidth()
        {
            if (this.Columns == 0 || this.Rows == 0)
            {
                return;
            }

            // set the height and width for the corner
            MatrixItem mi = _MatrixView[0, 0];

            mi.Height = 0;
            for (int row = 0; row < this._HeaderRows; row++)
            {
                mi.Height += _MatrixView[row, 1].Height;
            }
            mi.Width = 0;
            for (int col = 0; col < this._HeaderColumns; col++)
            {
                mi.Width += _MatrixView[1, col].Width;
            }
        }
コード例 #5
0
        void FillMatrixRowGroupings()
        {
            XmlNode rGroupings = _Draw.GetNamedChildNode(_MatrixNode, "RowGroupings");

            if (rGroupings == null)
            {
                return;
            }
            float height = _Draw.GetSize(
                DesignXmlDraw.FindNextInHierarchy(_MatrixNode, "MatrixRows", "MatrixRow"),
                "Height");
            int        cols         = 0;
            int        staticRows   = this.CountMatrixRows();
            int        subtotalrows = DesignXmlDraw.CountChildren(rGroupings, "RowGrouping", "DynamicRows", "Subtotal");
            MatrixItem mi;

            foreach (XmlNode c in rGroupings.ChildNodes)
            {
                if (c.Name != "RowGrouping")
                {
                    continue;
                }

                XmlNode srow = DesignXmlDraw.FindNextInHierarchy(c, "StaticRows");
                if (srow != null)
                {                       // Static rows
                    int ri = 0;
                    foreach (XmlNode sr in srow.ChildNodes)
                    {
                        if (sr.Name != "StaticRow")
                        {
                            continue;
                        }
                        XmlNode ris = DesignXmlDraw.FindNextInHierarchy(sr, "ReportItems");
                        mi        = new MatrixItem(ris);
                        mi.Width  = _Draw.GetSize(c, "Width");
                        mi.Height = GetMatrixRowHeight(ri);
                        _MatrixView[_HeaderRows + ri, cols] = mi;
                        ri++;
                    }
                }
                else
                {
                    XmlNode ris = DesignXmlDraw.FindNextInHierarchy(c, "DynamicRows", "ReportItems");
                    mi        = new MatrixItem(ris);
                    mi.Width  = _Draw.GetSize(c, "Width");
                    mi.Height = height;
                    _MatrixView[_HeaderRows, cols] = mi;

                    XmlNode subtotal = DesignXmlDraw.FindNextInHierarchy(c, "DynamicRows", "Subtotal");
                    if (subtotal != null)
                    {
                        ris       = DesignXmlDraw.FindNextInHierarchy(subtotal, "ReportItems");
                        mi        = new MatrixItem(ris);
                        mi.Width  = _Draw.GetSize(c, "Width");
                        mi.Height = height;
                        _MatrixView[_HeaderRows + (staticRows - 1) + subtotalrows, cols] = mi;
                        subtotalrows--;                         // these go backwards
                    }
                }
                cols++;                         // add a column per RowGrouping
            }
        }
コード例 #6
0
        void FillMatrixColumnGroupings()
        {
            XmlNode cGroupings = _Draw.GetNamedChildNode(_MatrixNode, "ColumnGroupings");

            if (cGroupings == null)
            {
                return;
            }

            int        rows = 0;
            int        cols = this._HeaderColumns;
            MatrixItem mi;

            XmlNode ris;                                // work variable to hold reportitems
            int     staticCols = this.CountMatrixColumns();

            int subTotalCols = DesignXmlDraw.CountChildren(cGroupings, "ColumnGrouping", "DynamicColumns", "Subtotal");

            foreach (XmlNode c in cGroupings.ChildNodes)
            {
                if (c.Name != "ColumnGrouping")
                {
                    continue;
                }
                XmlNode scol = DesignXmlDraw.FindNextInHierarchy(c, "StaticColumns");
                if (scol != null)
                {                       // Static columns
                    int ci = 0;
                    foreach (XmlNode sc in scol.ChildNodes)
                    {
                        if (sc.Name != "StaticColumn")
                        {
                            continue;
                        }
                        ris       = DesignXmlDraw.FindNextInHierarchy(sc, "ReportItems");
                        mi        = new MatrixItem(ris);
                        mi.Height = _Draw.GetSize(c, "Height");
                        mi.Width  = GetMatrixColumnWidth(ci);
                        _MatrixView[rows, _HeaderColumns + ci] = mi;
                        ci++;
                    }
                }
                else
                {                       // Dynamic Columns
                    ris       = DesignXmlDraw.FindNextInHierarchy(c, "DynamicColumns", "ReportItems");
                    mi        = new MatrixItem(ris);
                    mi.Height = _Draw.GetSize(c, "Height");
                    mi.Width  = GetMatrixColumnWidth(0);
                    _MatrixView[rows, _HeaderColumns] = mi;

                    XmlNode subtotal = DesignXmlDraw.FindNextInHierarchy(c, "DynamicColumns", "Subtotal");
                    if (subtotal != null)
                    {
                        ris       = DesignXmlDraw.FindNextInHierarchy(subtotal, "ReportItems");
                        mi        = new MatrixItem(ris);
                        mi.Height = _Draw.GetSize(c, "Height");
                        mi.Width  = GetMatrixColumnWidth(0);                                    // TODO this is wrong!! should be total of all static widths
                        _MatrixView[rows, _HeaderColumns + (staticCols - 1) + subTotalCols] = mi;
                        subTotalCols--;
                    }
                }
                rows++;                         // add a row per ColumnGrouping
            }
        }
コード例 #7
0
        void FillMatrixCells()
        {
            // get a collection with the matrix cells
            int staticRows = this.CountMatrixRows();
            int staticCols = this.CountMatrixColumns();

            XmlNode[,] rc = new XmlNode[staticRows, staticCols];

            XmlNode mrows = DesignXmlDraw.FindNextInHierarchy(_MatrixNode, "MatrixRows");
            int     ri    = 0;

            foreach (XmlNode mrow in mrows.ChildNodes)
            {
                int     ci     = 0;
                XmlNode mcells = DesignXmlDraw.FindNextInHierarchy(mrow, "MatrixCells");
                foreach (XmlNode mcell in mcells.ChildNodes)
                {
                    // obtain the matrix cell
                    XmlNode repi = DesignXmlDraw.FindNextInHierarchy(mcell, "ReportItems");
                    rc[ri, ci] = repi;
                    ci++;
                }
                ri++;
            }
            // now fill out the rest of the matrix with empty entries
            MatrixItem mi;

            // Fill the middle (MatrixCells) with the contents of MatrixCells repeated
            for (int row = _HeaderRows; row < this.Rows; row++)
            {
                int rowcell    = staticRows == 0? 0: (row - _HeaderRows) % staticRows;
                int mcellCount = 0;
                for (int col = _HeaderColumns; col < this.Columns; col++)
                {
                    if (_MatrixView[row, col] == null)
                    {
                        float   width  = GetMatrixColumnWidth(mcellCount);
                        float   height = GetMatrixRowHeight(rowcell);
                        XmlNode n      = rc[rowcell, mcellCount++] as XmlNode;
                        if (mcellCount >= staticCols)
                        {
                            mcellCount = 0;
                        }
                        mi                    = new MatrixItem(n);
                        mi.Width              = width;
                        mi.Height             = height;
                        _MatrixView[row, col] = mi;
                    }
                }
            }

            // Make sure we have no null entries
            for (int row = 0; row < this.Rows; row++)
            {
                for (int col = 0; col < this.Columns; col++)
                {
                    if (_MatrixView[row, col] == null)
                    {
                        mi = new MatrixItem(null);
                        _MatrixView[row, col] = mi;
                    }
                }
            }
        }