Exemplo n.º 1
0
		/// <summary>
		/// Creates a MAP tag HTML source
		/// </summary>
		public string CreateImageMap(string mapName)
		{
			// image map coordinate system starts from 0, 0, so we might have
			// to offset the AREA coordinates to make them match the diagram items
			docOffsetX = flowChart.DocExtents.X;
			docOffsetY = flowChart.DocExtents.Y;

			string html = TAB + "<MAP NAME=\"" + mapName + "\">\r\n";

			// create an AREA tag for each node
			for (int i = flowChart.Objects.Count - 1; i >= 0; i--)
			{
				ChartObject item = flowChart.Objects[i];
				if (!item.Visible)
					continue;

				Node node = item as Node;
				if (item.HyperLink != "")
				{
					html += TAB + TAB;
					string areaTag = "<AREA SHAPE=";

					if (node != null)
					{
						if (node is Box)
						{
							Box b = node as Box;
							switch(b.Style)
							{
								case BoxStyle.Rectangle:
								case BoxStyle.RoundedRectangle:
									// SHAPE="RECT"
									areaTag += createRectArea(b.BoundingRect);
									break;
								case BoxStyle.Shape:
								case BoxStyle.Ellipse:
								case BoxStyle.Delay:
								case BoxStyle.Rhombus:
									// SHAPE="POLY"
									areaTag += createPolyArea(b.getOutlinePoly());
									break;
							}
						}

						if (node is ControlHost)
						{
							// SHAPE="RECT"
							areaTag = areaTag + createRectArea(node.BoundingRect);
						}

						if (node is Table)
						{
							Table t = node as Table;

							// use whole bounding rect if cell AREAs won't be generated
							RectangleF rect = t.BoundingRect;
							if (areasForTableCells)
								rect.Height = t.CaptionHeight;

							areaTag = areaTag + createRectArea(rect);
						}
					}
					else
					{
						areaTag += createPolyArea(item.getOutlinePoly());
					}

					areaTag += "\r\n";

					areaTag += TAB + TAB + TAB + "HREF=\"" + item.HyperLink + "\" ";
					areaTag += "TARGET=\"" + linkTarget + "\" ";
					areaTag += "TITLE=\"" + item.ToolTip + "\">";

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

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

				if (node != null)
				{
					if (areasForTableCells && node is Table)
						html += createCellAreas(node as Table);

					if (node.Expandable && expandBtnHyperLink != "")
						html += createExpBtnArea(node);
				}
			}

			html += TAB + "</MAP>\r\n";

			return html;
		}
Exemplo n.º 2
0
        /// <summary>
        /// Creates a MAP tag HTML source
        /// </summary>
        public string CreateImageMap(string mapName)
        {
            // image map coordinate system starts from 0, 0, so we might have
            // to offset the AREA coordinates to make them match the diagram items
            docOffsetX = flowChart.DocExtents.X;
            docOffsetY = flowChart.DocExtents.Y;

            string html = TAB + "<MAP NAME=\"" + mapName + "\">\r\n";

            // create an AREA tag for each node
            for (int i = flowChart.Objects.Count - 1; i >= 0; i--)
            {
                ChartObject item = flowChart.Objects[i];
                if (!item.Visible)
                {
                    continue;
                }

                Node node = item as Node;
                if (item.HyperLink != "")
                {
                    html += TAB + TAB;
                    string areaTag = "<AREA SHAPE=";

                    if (node != null)
                    {
                        if (node is Box)
                        {
                            Box b = node as Box;
                            switch (b.Style)
                            {
                            case BoxStyle.Rectangle:
                            case BoxStyle.RoundedRectangle:
                                // SHAPE="RECT"
                                areaTag += createRectArea(b.BoundingRect);
                                break;

                            case BoxStyle.Shape:
                            case BoxStyle.Ellipse:
                            case BoxStyle.Delay:
                            case BoxStyle.Rhombus:
                                // SHAPE="POLY"
                                areaTag += createPolyArea(b.getOutlinePoly());
                                break;
                            }
                        }

                        if (node is ControlHost)
                        {
                            // SHAPE="RECT"
                            areaTag = areaTag + createRectArea(node.BoundingRect);
                        }

                        if (node is Table)
                        {
                            Table t = node as Table;

                            // use whole bounding rect if cell AREAs won't be generated
                            RectangleF rect = t.BoundingRect;
                            if (areasForTableCells)
                            {
                                rect.Height = t.CaptionHeight;
                            }

                            areaTag = areaTag + createRectArea(rect);
                        }
                    }
                    else
                    {
                        areaTag += createPolyArea(item.getOutlinePoly());
                    }

                    areaTag += "\r\n";

                    areaTag += TAB + TAB + TAB + "HREF=\"" + item.HyperLink + "\" ";
                    areaTag += "TARGET=\"" + linkTarget + "\" ";
                    areaTag += "TITLE=\"" + item.ToolTip + "\">";

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

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

                if (node != null)
                {
                    if (areasForTableCells && node is Table)
                    {
                        html += createCellAreas(node as Table);
                    }

                    if (node.Expandable && expandBtnHyperLink != "")
                    {
                        html += createExpBtnArea(node);
                    }
                }
            }

            html += TAB + "</MAP>\r\n";

            return(html);
        }
Exemplo n.º 3
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;
		}
Exemplo n.º 4
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);
        }