Esempio n. 1
0
 public Cell(Table.Cell input) : this(RakNetPINVOKE.new_Table_Cell__SWIG_2(Table.Cell.getCPtr(input)), true)
 {
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 2
0
 public Table.Cell CopyData(Table.Cell input)
 {
     Table.Cell ret = new Table.Cell(RakNetPINVOKE.Table_Cell_CopyData(swigCPtr, Table.Cell.getCPtr(input)), false);
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
     return(ret);
 }
Esempio n. 3
0
 public FilterQuery(uint column, Table.Cell cell, Table.FilterQueryType op) : this(RakNetPINVOKE.new_Table_FilterQuery__SWIG_1(column, Table.Cell.getCPtr(cell), (int)op), true)
 {
 }
      private Table.ICell GetCell(DataGridViewCell cell)
      {
        var result = new Table.Cell(cell.OwningColumn.DataPropertyName ?? cell.OwningColumn.Name, GetStyle(cell.InheritedStyle));
        try
        {
          result.FormattedValue = cell.FormattedValue;
        }
        catch (Exception)
        {
          result.FormattedValue = cell.Value;
        }
        result.Value = cell.Value;

        if (_processor != null)
        {
          _processor.Invoke(result, cell);
        }

        return result;
      }
Esempio n. 5
0
        private string createCellAreas(Table table)
        {
            string     html = "";
            RectangleF rc   = table.BoundingRect;

            bool[,] coveredCells =
                table.getHasSpanningCells() ? table.getCoveredCells() : null;
            RectangleF cellsRect = RectangleF.FromLTRB(rc.Left,
                                                       rc.Top + table.CaptionHeight, rc.Right, rc.Bottom);

            int rowFrom = table.CurrentRow - table.getMaxRowSpan() + 1;

            if (rowFrom < 0)
            {
                rowFrom = 0;
            }

            float h = rc.Top + table.CaptionHeight;

            for (int r = rowFrom; r < table.RowCount; r++)
            {
                RectangleF cellRect = rc;
                cellRect.Y = h;
                if (cellRect.Top >= rc.Bottom - 1)
                {
                    break;
                }

                cellRect.Height = (table.Rows[r]).Height;

                if (cellRect.Bottom >= rc.Bottom)
                {
                    break;
                }

                // If it is a hidden row below a collapsed header row, skip it
                if (table.isRowCollapsed(r))
                {
                    continue;
                }

                if (rowFrom >= table.CurrScrollRow)
                {
                    h += (table.Rows[r]).Height;
                }

                for (int c = 0; c < table.ColumnCount; ++c)
                {
                    cellRect = table.getSpannedCellRect(r, c);

                    if (cellRect.Height == 0 ||
                        cellRect.Width == 0 ||
                        cellRect.Bottom <= cellsRect.Top)
                    {
                        continue;
                    }

                    Table.Cell cell = table[c, r];

                    // If the cell is covered by a spanned cell
                    // and is not a span cell itself, do not process it
                    if (!table.getHasSpanningCells() ||
                        (coveredCells != null && !coveredCells[c, r]) ||
                        (cell.RowSpan != 1 || cell.ColumnSpan != 1))
                    {
                        if (cell.RowSpan != 1 || cell.ColumnSpan != 1)
                        {
                            cellRect = RectangleF.Intersect(cellRect, cellsRect);
                        }

                        html += TAB + TAB;

                        // generate rect AREA for the cell
                        string areaTag = "<AREA SHAPE=";
                        areaTag += createRectArea(cellRect);
                        areaTag += "\r\n";
                        areaTag += TAB + TAB + TAB + "HREF=\"" + cell.HyperLink + "\" ";
                        areaTag += "TARGET=\"" + linkTarget + "\" ";
                        areaTag += "TITLE=\"" + cell.ToolTip + "\">";

                        if (CreatingArea != null)
                        {
                            AreaEventArgs args = new AreaEventArgs(areaTag, table, c, r);
                            CreatingArea(this, args);
                            areaTag = args.AreaTag;
                        }

                        html += areaTag + "\r\n";
                    }

                    cellRect.X = cellRect.Right;
                    if (cellRect.Left >= rc.Right)
                    {
                        break;
                    }
                }
            }

            return(html);
        }
Esempio n. 6
0
        /// <summary>
        /// Converts Flowchart.NET table into SVG
        /// </summary>
        /// <param name="newTable">Table reference</param>
        /// <returns>TRUE if successfull otherwise FALSE</returns>
        private bool CreateTable(MindFusion.FlowChartX.Table newTable)
        {
            bool      bOk = false;
            float     fX = 0, fY = 0, fW = 0, fH = 0, fLine = 0;
            long      lLine        = 0;
            XmlNode   last_node    = null;
            ArrayList spannedCells = new ArrayList();

            try
            {
                fX    = newTable.BoundingRect.X;
                fY    = newTable.BoundingRect.Y;
                fW    = newTable.BoundingRect.Width;
                fH    = newTable.BoundingRect.Height;
                fLine = newTable.Pen.Width;

                lLine = Unit2Pix(fLine);
                if (lLine == 0)
                {
                    lLine = 1;
                }


                last_node = sMan.AddRect(String.Format("{0}px", Unit2Pix(fX)),
                                         String.Format("{0}px", Unit2Pix(fY)),
                                         String.Format("{0}px", Unit2Pix(fW)),
                                         String.Format("{0}px", Unit2Pix(newTable.CaptionHeight)),
                                         String.Format("{0}px", lLine),
                                         newTable.FillColor,
                                         newTable.FrameColor,
                                         null,
                                         null,
                                         newTable.Image);

                sMan.AddGradient(last_node, newTable.Brush);

                sMan.AddText(null, newTable.Caption,
                             newTable.Font,
                             new RectangleF(fX, fY, fW, newTable.CaptionHeight),
                             newTable.CaptionColor, pChart.TextFormat, newTable.EnableStyledText);


                last_node = sMan.AddRect(String.Format("{0}px", Unit2Pix(fX)),
                                         String.Format("{0}px", Unit2Pix(fY + newTable.CaptionHeight)),
                                         String.Format("{0}px", Unit2Pix(fW)),
                                         String.Format("{0}px", Unit2Pix(fH - newTable.CaptionHeight)),
                                         String.Format("{0}px", lLine),
                                         newTable.FillColor,
                                         newTable.FrameColor,
                                         null,
                                         null,
                                         newTable.Image);

                sMan.AddGradient(last_node, newTable.Brush);

                fW = 0;
                fH = 0;
                int   RowCount = newTable.CurrScrollRow, ColCount = 0, AutoColls = 0;
                float fCellW = 0, fCellH = 0, fCellX = 0, fCellY = 0, rh = 0, fStepW = 0, fSumW = 0;
                bool  CellIsSpanned = false;
                fCellX = fX;
                fCellY = fY + newTable.CaptionHeight;

                AutoColls = 0;
                fSumW     = 0;
                foreach (Table.Column col in newTable.Columns)
                {
                    if (col.ColumnStyle == MindFusion.FlowChartX.ColumnStyle.AutoWidth)
                    {
                        AutoColls++;
                    }
                    else
                    {
                        fSumW += col.Width;
                    }
                }

                while (RowCount < newTable.Rows.Count)
                {
                    if (RowCount != newTable.CurrScrollRow)
                    {
                        rh = newTable.Rows[RowCount - 1].Height;
                    }
                    else
                    {
                        rh = 0;
                    }

                    fCellY += rh;
                    if (fCellY > newTable.BoundingRect.Bottom - rh)
                    {
                        break;
                    }

                    while (ColCount < newTable.Columns.Count)
                    {
                        if (ColCount != 0)
                        {
                            fCellX += newTable.Columns[ColCount - 1].Width;
                        }

                        Table.Cell cell = newTable[ColCount, RowCount];

                        if (!spannedCells.Contains(cell))
                        {
                            fCellH = 0;
                            for (int i = RowCount; i < RowCount + cell.RowSpan; i++)
                            {
                                fCellH += newTable.Rows[i].Height;
                                fCellW  = 0;
                                bool bPass = true;
                                for (int j = ColCount; j < ColCount + cell.ColumnSpan; j++)
                                {
                                    if ((newTable.Columns[ColCount].ColumnStyle == MindFusion.FlowChartX.ColumnStyle.AutoWidth) && bPass)
                                    {
                                        fStepW = (newTable.BoundingRect.Width - fSumW) / AutoColls;
                                        bPass  = false;
                                    }
                                    else
                                    {
                                        fStepW = newTable.Columns[j].Width;
                                    }

                                    fCellW += fStepW;
                                    spannedCells.Add(newTable[j, i]);
                                    //Trace.WriteLine(String.Format("Pos ({0}, {1} ) Spanned ({2},{3})", RowCount, ColCount, i,j));
                                }
                            }


                            if (AutoColls == 0)
                            {
                                if (ColCount == (newTable.Columns.Count - 1))
                                {
                                    fCellW += (newTable.BoundingRect.Width - fSumW);
                                }
                                //fCellW = newTable.BoundingRect.Right - fCellX + ( cell.Text == "" ? 0 : 15) ;
                            }

                            RectangleF cellRect = new RectangleF(fCellX,
                                                                 fCellY,
                                                                 fCellW,
                                                                 fCellH);



                            CellIsSpanned = ((cell.ColumnSpan > 1) || (cell.RowSpan > 1));
                            sMan.AddText(CellIsSpanned ? null : newTable, cell.Text,
                                         newTable.Font,
                                         cellRect,
                                         newTable.TextColor, cell.TextFormat, newTable.EnableStyledText);


                            sMan.AddRect(Unit2PixStr(cellRect.X), Unit2PixStr(cellRect.Y), Unit2PixStr(cellRect.Width), Unit2PixStr(cellRect.Height), "1px", Color.Transparent, Color.Transparent, null, null, cell.Image, newTable.FillColor, cell.ImageAlign, cellRect);
                            if (newTable.CellFrameStyle != CellFrameStyle.None)
                            {
                                sMan.AddRect(Unit2PixStr(cellRect.X), Unit2PixStr(cellRect.Y), Unit2PixStr(cellRect.Width), Unit2PixStr(cellRect.Height), "1px", Color.Transparent, newTable.FrameColor);
                            }
                        }
                        ColCount++;
                    }

                    fCellX   = fX;
                    ColCount = 0;
                    RowCount++;
                }


                bOk = true;
            }
            catch (Exception ex)
            {
                Trace.WriteLine(String.Format("{0} error {1}\n", "CreateTable", ex.Message));
                bOk = false;
            }

            return(bOk);
        }