Example #1
0
		public Box(FlowChart parent) : base(parent)
		{
			pen = (Pen)flowChart.BoxPen.Clone();
			brush = flowChart.BoxBrush;
			brush.AddRef();

			style = parent.BoxStyle;

			fillColor = parent.BoxFillColor;
			frameColor = parent.BoxFrameColor;

			image = null;
			transparent = false;

			text = parent.BoxText;
			ftext = null;
			textFormat = new StringFormat(parent.TextFormat);
			textColor = parent.TextColor;

			customDraw = parent.BoxCustomDraw;

			shapeRotation = flowChart.ShapeOrientation;
			rotationAngle = 0;
			rotateContents = false;
			shapeTemplate = null;
			if (style == BoxStyle.Shape)
				Shape = flowChart.DefaultShape;

			setExpandable(flowChart.BoxesExpandable);
			setExpanded(true);

			picturePos = ImageAlign.Fit;

			selStyle = flowChart.BoxHandlesStyle;

			useTextLayout = flowChart.PolyTextLayout;
			useStyledText = flowChart.EnableStyledText;
			txOptions = new Text.LayoutOptions();
			txLayout = new Text.Layout();
			updateText();
			layoutText();
		}
Example #2
0
			public Cell(Table table)
			{
				this.table = table;

				text = "";
				hyperLink = "";
				textFormat = new StringFormat();
				textFormat.Alignment = StringAlignment.Near;
				textFormat.LineAlignment = StringAlignment.Center;
				textColor = Color.Empty;

				toolTip = "";
				picture = null;
				picturePos = ImageAlign.Fit;
				brush = null;

				txOptions = new Text.LayoutOptions();
				txLayout = new Text.Layout();

				columnSpan = 1;
				rowSpan = 1;
				tag = null;
			}
Example #3
0
		/// <summary>
		/// Methods produces DXF string for text of the Flowchart object
		/// </summary>
		/// <param name="co">Flowchart object to extract text from</param>
		/// <param name="po">Parent object if any exist</param>
		/// <param name="rect">Object's rectangle if applicable</param>
		/// <returns>true if successful otherwise false</returns>
		public bool AddText(object co, object po, RectangleF rect)
		{

			PointF[] pF = null;
			MindFusion.FlowChartX.Text.Layout tl = null;
			MindFusion.FlowChartX.Text.LayoutOptions lo;
			MindFusion.FlowChartX.Text.DrawTextHint dhint = null;
			MindFusion.FlowChartX.Text.PlainText  text = null;
			System.Drawing.SolidBrush br = null;
			int tlen = 0;
			GraphicsPath gr = null;
			Color crText = Color.Transparent;
			string strText = "";
			long TextID = 0;
			RectangleF boundrect = RectangleF.Empty;
			Font oFont = null;
			StringFormat sformat = null;
			float Rotation = 0;
			bool bOk = false;

			try
			{
				gr = new GraphicsPath(FillMode.Winding);

				if ( co is Box )  // if chart object is Box
				{

					Box oBox = co as Box;
					if ( oBox == null )
						return false;

				
					strText = oBox.PlainText;
					crText = oBox.TextColor;
					TextID = oBox.ZIndex;
					boundrect = oBox.BoundingRect;
					oFont = oBox.Font;
					sformat = oBox.TextFormat;
					Rotation = oBox.RotationAngle;

					if (!m_ExportTextAsMultiline)
					{
						TextBox2Path(oBox,0,ref gr);
						pF = (PointF[])gr.PathPoints.Clone();
					}
				
			
				}
				else  if ( co is Table.Cell ) // if chart object is cell in the table
				{
					Table.Cell oCell = co as Table.Cell;

					if ( oCell == null )
						return false;

					Table oTable = po as Table;

					if ( oTable == null )
						return false;


					if ( rect == RectangleF.Empty )
						return false;

					strText = oCell.PlainText;
					crText = oCell.TextColor;
					TextID = NextID();
					oFont = oTable.Font;
					sformat = oCell.TextFormat;
					Rotation = 0;
					if (!m_ExportTextAsMultiline)
					{
						TextRect2Path(rect,ref gr);
						pF = (PointF[])gr.PathPoints.Clone();
					}

					boundrect = rect;
				}
				else  if ( co is Arrow ) // If chart object is arrow
				{

					Arrow oArrow = co as Arrow;
					if ( oArrow == null )
						return false;

					strText = oArrow.Text;
					crText = oArrow.TextColor;
					TextID = oArrow.ZIndex;
					oFont = oArrow.Font;
					sformat = m_FlowChart.TextFormat;

					rect = getTextRect(System.Drawing.Graphics.FromHwnd(GetActiveWindow()), oArrow.Style , oArrow.TextStyle,
						oArrow.ControlPoints, oArrow.TextColor,oArrow.SegmentCount, oArrow.Text, oArrow.Font,
						RectangleF.Empty, ref Rotation);

					
					
					

					boundrect = rect;
					if (!m_ExportTextAsMultiline)
					{
						rect.Width+=1;
						rect.Height+=1;
						boundrect = rect;
						if (Rotation!=0)
							Rotation = 360 -Rotation;
						TextRect2Path(rect,ref gr);
						pF = (PointF[])gr.PathPoints.Clone();
					}
					

				}
				else  if ( co is Table )  // If chart object is table itself
				{
					Table oTable = co as Table;
					if ( oTable == null )
						return false;


					strText = oTable.CaptionPlainText;
					crText = oTable.CaptionColor;
					TextID = NextID();

					rect = new RectangleF(oTable.BoundingRect.X, oTable.BoundingRect.Y,
										  oTable.BoundingRect.Width, oTable.CaptionHeight);
					boundrect = rect;
					oFont = oTable.Font;
					sformat = oTable.CaptionFormat;
					Rotation = 0;
					if (!m_ExportTextAsMultiline)
					{
						TextRect2Path(rect,ref gr);
						pF = (PointF[])gr.PathPoints.Clone();
					}

				}
				else
					return false;
				
				// Preparing for text processing
				if ( strText == "" )
					return true;

				if ( oFont == null )
					oFont = m_FlowChart.Font;

				// If 'Multiline' text mode enabled calling method directly
				if ( m_ExportTextAsMultiline )
					return AddText(TextID,boundrect, strText, crText, oFont , 
						sformat, true, Rotation, false);

				
				if ( gr!=null )
					gr.Dispose();
			
				// If not 'Multiline' isn't allowed processing text word-by word

				tl = new MindFusion.FlowChartX.Text.Layout();
				br = new System.Drawing.SolidBrush(crText);
				lo = new MindFusion.FlowChartX.Text.LayoutOptions();
	
				dhint = new MindFusion.FlowChartX.Text.DrawTextHint(System.Drawing.Graphics.FromHwnd(GetActiveWindow()),
					oFont, br ,sformat, false , null, boundrect, crText, TextID*100, TextID, Rotation );

				
			
				lo.Alignment = sformat.Alignment;
				lo.LineAlignment = sformat.LineAlignment;
				text = new MindFusion.FlowChartX.Text.PlainText();
				text.Setup(strText, System.Drawing.Graphics.FromHwnd(GetActiveWindow()) , oFont);
				tlen = text.PlainText.Length;
				tl.LayoutInPolygon( text, docToLocal(pF, boundrect),lo);
				tl.Draw(0,0,new MindFusion.FlowChartX.Text.RenderTextCallback(___TextCallback),dhint);
			
			}
			catch (	Exception ex )
			{
				bOk = false;
				m_status = ex.Message;
				Trace.WriteLine(String.Format("{0} error {1}\n","AddText",ex.Message));
			}

			return bOk;

		}
Example #4
0
			public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
			{
				toolTip = "";
				hyperLink = "";

				text = reader.ReadString();
				textFormat = ctx.loadStringFormat();
				ctx.loadReference(this);

				if (ctx.FileVersion > 5)
				{
					// new in save format 6
					picturePos = (ImageAlign)reader.ReadInt32();
					picture = ctx.loadImage();

					if (ctx.FileVersion > 13)
					{
						// new in save format 14
						textColor = ctx.loadColor();
						ctx.loadReference(this);	// brush

						if (ctx.FileVersion > 17)
						{
							// new in save format 18
							toolTip = reader.ReadString();

							if (ctx.FileVersion > 18)
							{
								// new in save format 19
								hyperLink = reader.ReadString();

								if (ctx.FileVersion > 21)
								{
									// new in save format 22
									columnSpan = reader.ReadInt32();
									rowSpan = reader.ReadInt32();

									tag = null;
									bool tagAvailable = reader.ReadBoolean();
									if (tagAvailable)
										tag = ctx.loadTag();
								}
							}
						}
					}
				}

				txOptions = new Text.LayoutOptions();
				txLayout = new Text.Layout();
			}
Example #5
0
		public Table(Table prototype) : base(prototype)
		{
			captionBackBrush = prototype.captionBackBrush;
			if (captionBackBrush != null)
				captionBackBrush.AddRef();

			hasSpanningCells = prototype.hasSpanningCells;
			coveredCells = null;
			maxRowSpan = prototype.maxRowSpan;

			this.cells = null;
			this.rowsList = null;
			this.colsList = null;
			columnWidth = prototype.columnWidth;
			rowHeight = prototype.rowHeight;
			redimTable(prototype.ColumnCount, prototype.RowCount);

			caption = prototype.caption;
			captionColor = prototype.captionColor;
			captionFormat = (StringFormat)prototype.captionFormat.Clone();
			captionHeight = prototype.captionHeight;

			picture = prototype.picture;

			cellBorders = prototype.cellBorders;
			setScrollable(prototype.scrollable);
			currScrollRow = prototype.currScrollRow;

			setExpandable(prototype.Expandable);
			setExpanded(prototype.Expanded);

			textColor = prototype.textColor;
			picturePos = prototype.picturePos;

			selStyle = prototype.selStyle;
			style = prototype.style;

			RowAnchorPattern = prototype.RowAnchorPattern;

			customDraw = prototype.CustomDraw;
			cellCustomDraw = prototype.CellCustomDraw;

			linkStyle = prototype.linkStyle;

			for (int c = 0; c < colsList.Count; ++c)
			{
				colsList[c].ColumnStyle = prototype.colsList[c].ColumnStyle;
				colsList[c].Width = prototype.colsList[c].Width;
			}

			for (int r = 0; r < rowsList.Count; ++r)
			{
				rowsList[r].AnchorPattern = prototype.rowsList[r].AnchorPattern;
				rowsList[r].Height = prototype.rowsList[r].Height;
				rowsList[r].setHeader(prototype.rowsList[r].Header);
			}

			for (int c = 0; c < colsList.Count; ++c)
			{
				for (int r = 0; r < rowsList.Count; ++r)
				{
					this[c, r].ToolTip = prototype[c, r].ToolTip;
					this[c, r].TextFormat = prototype[c, r].TextFormat;
					this[c, r].Text = prototype[c, r].Text;
					this[c, r].ImageAlign = prototype[c, r].ImageAlign;
					this[c, r].Image = prototype[c, r].Image;
					this[c, r].ColumnSpan = prototype[c, r].ColumnSpan;
					this[c, r].RowSpan = prototype[c, r].RowSpan;
				}
			}

			hasHeaderRows = prototype.hasHeaderRows;
			offsetHeaderRows = prototype.offsetHeaderRows;

			useStyledText = prototype.EnableStyledText;
			txOptions = new Text.LayoutOptions();
			txLayout = new Text.Layout();

			updateText();
			layoutText();
			updateCellText();
			layoutCellText();
		}
Example #6
0
		public Table(FlowChart parent) : base(parent)
		{
			captionBackBrush = null;
			hasSpanningCells = false;
			coveredCells = null;
			maxRowSpan = 1;

			pen = (Pen)flowChart.TablePen.Clone();
			brush = parent.TableBrush;
			brush.AddRef();

			this.cells = null;
			this.rowsList = null;
			this.colsList = null;
			columnWidth = parent.TableColWidth;
			rowHeight = parent.TableRowHeight;
			redimTable(parent.TableColumnCount, parent.TableRowCount);

			caption = parent.TableCaption;
			captionColor = Color.FromArgb(0, 0, 0);
			fillColor = parent.TableFillColor;
			frameColor = parent.TableFrameColor;
			captionFormat = new StringFormat();
			captionFormat.Alignment = StringAlignment.Center;
			captionFormat.LineAlignment = StringAlignment.Center;
			captionHeight = parent.TableCaptionHeight;

			this.picture = null;

			cellBorders = parent.CellFrameStyle;
			setScrollable(parent.TablesScrollable);
			currScrollRow = 0;

			setExpandable(parent.TablesExpandable);
			setExpanded(true);

			textColor = parent.TextColor;
			picturePos = ImageAlign.Fit;

			selStyle = parent.TableHandlesStyle;
			style = parent.TableStyle;

			rowAnchorPattern = null;

			customDraw = parent.TableCustomDraw;
			cellCustomDraw = parent.CellCustomDraw;

			linkStyle = parent.TableLinkStyle;

			lastAnchorForTable = false;
			lastFoundAnchor = new PointF(0, 0);

			useStyledText = flowChart.EnableStyledText;
			txOptions = new Text.LayoutOptions();
			txLayout = new Text.Layout();
			updateText();
			layoutText();

			hasHeaderRows = false;
			offsetHeaderRows = false;

			if (imageExpand == null)
			{
				lock (typeof(Table))
				{
					if (imageExpand == null)
					{
						ResourceManager rm = new ResourceManager(
							"MindFusion.FlowChartX.Icons", typeof(ChartObject).Assembly);
						imageExpand = rm.GetObject("mnp_rowexpand") as Image;
						imageCollapse = rm.GetObject("mnp_rowcollapse") as Image;
					}
				}
			}
		}
Example #7
0
		public Box(Box prototype) : base(prototype)
		{
			style = prototype.style;

			image = prototype.image;
			transparent = prototype.transparent;

			text = prototype.text;
			ftext = null;
			textFormat = (StringFormat)prototype.textFormat.Clone();
			textColor = prototype.textColor;

			customDraw = prototype.customDraw;

			shapeRotation = prototype.shapeRotation;
			rotationAngle = prototype.rotationAngle;
			rotateContents = prototype.rotateContents;
			Shape = prototype.Shape;

			setExpandable(prototype.Expandable);
			setExpanded(prototype.Expanded);

			picturePos = prototype.picturePos;

			selStyle = prototype.selStyle;

			useTextLayout = prototype.useTextLayout;
			useStyledText = prototype.useStyledText;
			txOptions = new Text.LayoutOptions();
			txLayout = new Text.Layout();

			updateText();
			layoutText();
		}