Exemplo n.º 1
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;
			}
Exemplo n.º 2
0
			public Row(Table table)
			{
				height = 22;
				incomingArrows = new ArrowCollection();
				outgoingArrows = new ArrowCollection();
				relatedOneToMany = new TableCollection();
				relatedManyToOne= new TableCollection();
				this.table = table;
				anchorPattern = null;

				header = false;
				expanded = true;
			}
Exemplo n.º 3
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();
		}
Exemplo n.º 4
0
		/// <summary>
		/// Breaks a relationship.
		/// </summary>
		/// <param name="row">The row index.</param>
		/// <param name="rel">The type of the relation to break.</param>
		/// <param name="table">Related table object.</param>
		public void BreakRelation(int row, Relationship rel, Table table)
		{
			if (this.Rows == null) return;
			if (row < 0 || row >= this.Rows.Count) return;

			flowChart.invalidate(getRepaintRect(true));
			flowChart.setDirty();

			this.removeRelation(row, rel, table);
		}
Exemplo n.º 5
0
		public void Insert(int i, Table t)
		{
			List.Insert(i, t);
		}
Exemplo n.º 6
0
			public Column(Table table)
			{
				width = 50;
				columnStyle = ColumnStyle.FixedWidth;
				this.table = table;
			}
Exemplo n.º 7
0
		/// <summary>
		/// Creates a new Arrow instance and adds it to the flowchart.
		/// </summary>
		/// <param name="src">Specifies the origin table.</param>
		/// <param name="srcRow">Specifies the origin row.</param>
		/// <param name="dest">Specifies the destination table.</param>
		/// <param name="destRow">Specifies the destination row.</param>
		/// <returns>A reference to the new arrow.</returns>
		public Arrow CreateArrow(Table src, int srcRow, Table dest, int destRow)
		{
			if (src == null || dest == null) return null;

			if (!src.canHaveArrows(true) && srcRow != -1) return null;
			if (!dest.canHaveArrows(false) && destRow != -1) return null;

			if (srcRow < -1 || srcRow >= src.RowCount) return null;
			if (destRow < -1 || destRow >= dest.RowCount) return null;

			// create the arrow object and store it in the item array
			Arrow newArrow = new Arrow(this);
			newArrow.setOrgAndDest(
				src.createLink(newArrow, false, srcRow),
				dest.createLink(newArrow, true, destRow));

			Add(newArrow, SelectAfterCreate);

			return newArrow;
		}
Exemplo n.º 8
0
		internal void fireTableSectionEvent(Table table, int rowIndex, bool expanded)
		{
			if (expanded && TableSectionExpanded != null)
			{
				RowEventArgs args = new RowEventArgs(table, rowIndex);
				TableSectionExpanded(this, args);
			}

			if (!expanded && TableSectionCollapsed != null)
			{
				RowEventArgs args = new RowEventArgs(table, rowIndex);
				TableSectionCollapsed(this, args);
			}
		}
Exemplo n.º 9
0
		/// <summary>
		/// Processing Visio shape converting it into Flowchart.NET node
		/// </summary>
		/// <param name="shape">Visio shape's XML node</param>
		/// <param name="ShapeType">String value of the shape type</param>
		/// <param name="group">Reference to parent group ( if any exists) </param>
		/// <returns>Returns [true] if successfull [false] otherwise</returns>
		private bool GetShapeRef(XmlNode shape, string ShapeType,MindFusion.FlowChartX.Group group)
		{
			string sShapeName, sUID = "", sType = "",  sNameU= "", sPath="", sTemp = "",
				sStepX = "", sStepY = "";

			long lShapeType = 0, lX = 0, lY =0, lWidth = 0,
				lHeight = 0, lPinY = 0, lPinX = 0, lLineWith = 0,lCount = 1, lPtX = 0,  lPtY = 0 , lStepX = 0, lStepY = 0, lStartX =0 ,
				lStartY = 0,lEndX = 0, lEndY = 0, lBeginX = 0, lBeginY = 0, lBoxX = 0, lBoxY = 0,
				lTemp = 0, lAdjustX = 0, lAdjustY = 0;

			double fAngle2 = 0;
			XmlNode node_temp = null;
			XmlNode xform1d_node = null;
			bool DontHideGroup = false;

			// Incrementing shape's count
			lShapesCount++;
			sUID = shape.Attributes["ID"].Value.ToString();
			sType = shape.Attributes["Type"].Value.ToString();
			sType = sType.ToLower();

			// Getting 'XForm' node root
			XmlNode xform_node = shape.SelectSingleNode("vdx:XForm", ns);
			
			if ( xform_node == null)
				return false;

			
			
			// Getting Master shape's ID if any exist
			sMasterID = "";
			if ( shape.Attributes["Master"] == null )
			{
				if ( shape.Attributes["MasterShape"] != null )
				{
					sMasterID = shape.Attributes["MasterShape"].Value.ToString();
				}
			}
			else
				sMasterID = shape.Attributes["Master"].Value.ToString();

			// Getting shape's 'NameU' tag if any exist
			sNameU = "";
			if ( shape.Attributes["NameU"] != null )
				sNameU = shape.Attributes["NameU"].Value.ToString();
			sShapeName = sNameU;
			sNameU = sNameU.Trim();
			sNameU = sNameU.ToLower();
			
			if ( sNameU == "" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_NO_NAMEU;
			}

			if (( sNameU == "") && (sMasterID!=""))
			{
				sPath = String.Format("vdx:Master[@ID='{0}']",sMasterID);
				sNameU = GetShapeAttr(sPath,"NameU", mastersRoot);
				sShapeName = sNameU;
			}

			if ( sNameU == null )
				sNameU = "";
				
			sNameU = sNameU.Trim();
			sNameU = sNameU.ToLower();
			
			// Shape is GROUP
#if _POST_FIX_2_1
			if (( sType.IndexOf("group")>=0 ) && ( sNameU.IndexOf("connector")<0))
#else
			if ( sType.IndexOf("group")>=0 )
#endif
			{
				lShapeType |= (long) ShapeTypeEnum.ST_GROUP;
			}

			// Shape is 'arrow - like'
			if (( sNameU.IndexOf("connector") >= 0 ) || ( sNameU.IndexOf("link") >= 0 ) || ( sNameU.IndexOf("generalization") >= 0 ) ||
				( sNameU.IndexOf("association") >= 0 ) || ( sNameU.IndexOf("composition")>=0) ||  ( sNameU == "relationship") ||
				( sNameU.IndexOf("parent to category") >= 0 ) || ( sNameU.IndexOf("categorytochild ") >= 0 ) || (sNameU.IndexOf("object flow")>=0) ||
				(sNameU.IndexOf("control flow")>=0) || (sNameU.IndexOf("2-element constraint")>=0) || (sNameU.IndexOf("or constraint")>=0))
				// (sNameU.IndexOf("shared navigable")>=0))
			{
				lShapeType |= (long) ShapeTypeEnum.ST_CONNECTOR;

			}
			else 
			{
				xform1d_node = shape.SelectSingleNode("vdx:XForm1D", ns);
				if ( xform1d_node != null)
				{
					//return true;
				//	??? REMOVED ??? lShapeType |= (long) ShapeTypeEnum.ST_CONNECTOR;
				}
			}

			// Shape is 'entity - like'

			if ( ( sNameU == "entity 1" ) || ( sNameU.IndexOf("entity." )>=0) || ( sNameU == "entity 2" ) || ( sNameU == "entity" ) || ( sNameU =="view"))
			{
				lShapeType |= (long) ShapeTypeEnum.ST_ENTITY;
			}
		

			// Shape  is 'entity2 - like'
			if ( sNameU == "entity 2" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_ENTITY2;
			}

			// Shape  is part of 'entity - like' group
			if ( ShapeType == "entity" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_PART_OF_ENTITY;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}

			// Shape  is part of 'entity2 - like' group
			if ( ShapeType == "entity 2" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_PART_OF_ENTITY;
				lShapeType |= (long) ShapeTypeEnum.ST_PART_OF_ENTITY2;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}

			// Shape  is part of 'arrow - like' group
			if ( ShapeType == "arrow" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_PART_OF_ARROW;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}
			
			if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ENTITY) == ShapeTypeEnum.ST_PART_OF_ENTITY)
			{
				lShapeType |= (long) ShapeTypeEnum.ST_OVAL_PROCESS;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}

			if ( sNameU == "parameters" )
			{
				lShapeType |= (long) ShapeTypeEnum.ST_HIDDEN;
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;
			}

			if (( lShapeType == (long) ShapeTypeEnum.ST_NONE ) || ( lShapeType == (long) ShapeTypeEnum.ST_NO_NAMEU))
				lShapeType |= (long) ShapeTypeEnum.ST_SHAPE;

			// Getting shape's dimensions and converting it to 'Pixels'
			lWidth = Measure2Pix(xform_node, "Width");
			lHeight = Measure2Pix(xform_node, "Height");
			lX = Measure2Pix(xform_node, "PinX");
			lY = Measure2Pix(xform_node, "PinY");
			lPinX = Measure2Pix(xform_node, "LocPinX");
			lPinY = Measure2Pix(xform_node, "LocPinY");
			
			if ((( lWidth == 0 ) || ( lHeight == 0 )) && 
				(((ShapeTypeEnum)lShapeType & ShapeTypeEnum.ST_SHAPE) == ShapeTypeEnum.ST_SHAPE) && 
				(((ShapeTypeEnum)lShapeType & ShapeTypeEnum.ST_CONNECTOR)!=ShapeTypeEnum.ST_CONNECTOR))
			{
				return false;
			}

			if ( sNameU == "separator")
			{
				return false;
			}	

		
			// Getting shape's styles IDs
#if _POST_FIX_2_1
			sLineStyle = GetStyle2(shape, "LineStyle", "vdx:Line/vdx:LineColor");
			sTextStyle = GetStyle2(shape, "TextStyle", "vdx:Char/vdx:Color");
			sFillStyle = GetStyle2(shape, "FillStyle", "vdx:Fill/vdx:FillForegnd");
#else
			sLineStyle = GetStyle(shape, "LineStyle", ref sLineStyle2);
			sTextStyle = GetStyle(shape, "TextStyle", ref sTextStyle2);
			sFillStyle = GetStyle(shape, "FillStyle", ref sFillStyle2);
#endif

			// Getting colors
			crLineColor = Color.Empty;
			crLineColor = GetColor(shape,sLineStyle,"vdx:Line/vdx:LineColor",null,null,sLineStyle2);

			crFillColor = Color.Empty;
			crFillColor = GetColor(shape,sFillStyle,"vdx:Fill/vdx:FillForegnd","vdx:Fill/vdx:FillForegndTrans",null,sFillStyle2);

			crFillColor2 = Color.Empty;
			crFillColor2 = GetColor(shape,sFillStyle,"vdx:Fill/vdx:FillBkgnd",null,null,sFillStyle2);

			crTextColor = Color.Empty;
			crTextColor = GetColor(shape,sTextStyle,"vdx:Char/vdx:Color",null,null,sTextStyle2);

			// Getting fill patterns
			sFillPattern = "";
			sFillPattern = GetShapeAttr("vdx:Fill/vdx:FillPattern","", shape);
			if ( sFillPattern == null)
			{
				sFillPattern = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Fill/vdx:FillPattern", sFillStyle),"",stylesRoot);
				
			}

			sTemp = GetShapeAttr("vdx:Line/vdx:LineWeight","",shape);
			if ( sTemp == null)
			{
				sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:LineWeight", sLineStyle),"",stylesRoot);
				
			}

			// Getting line width
			if ( sTemp!=null )
				lLineWith = (long) this.Unit2Pix(sDL,sDL,sTemp);
			else
				lLineWith = 0;
			
			// Getting rotaton angle
			string sAngle = "0", sAngleUnit = "";
			sAngle = GetShapeAttr("vdx:Angle", "", xform_node);
			sAngleUnit = GetShapeAttr("vdx:Angle", "Unit", xform_node);

			fAngle2 = Angle2Deg(sAngleUnit, sAngle);
			
			/*
			if (( sAngle != "0") && ( sAngle!=null))
			{
				sAngle = sAngle.Replace(".",sSeparator);
				fAngle = Convert.ToDouble(sAngle);

				if ( fAngle!=0 )
				{
					fAngle2 = (fAngle/Math.PI)*180;
					if ( fAngle2>0 )
						fAngle2 = 360 - Math.Abs(fAngle2);
					else
						fAngle2 = Math.Abs(fAngle2);

					
				}


			}
			else
			{
				lAngle = 0;
			}

			*/

			sPenStyle = "";
			sPenStyle =  GetShapeAttr("vdx:Line/vdx:LinePattern","", shape);
			if ( sPenStyle == null )
			{
				sPenStyle =  GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:LinePattern", sLineStyle),"", stylesRoot);
			}

			if ((((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_SHAPE ) ==  ShapeTypeEnum.ST_SHAPE)||
				(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_GROUP ) == ShapeTypeEnum.ST_GROUP)||
				(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ARROW ) == ShapeTypeEnum.ST_PART_OF_ARROW))
			{
				if (group != null)			
				{
					// Getting coordinates of the upper left corner of the group
					lBoxX = lOffsetX + lGroupX - lGroupPinX;
					lBoxY = lOffsetY + lBasedY -  ( lGroupY + lGroupPinY );

					// Getting coordinates of the grouped shape
					if (( (ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY ) == ShapeTypeEnum.ST_ENTITY )
						lPinY = 0;

					lBoxX = lBoxX + lX - lPinX;

			
					// Aplying coordinates adustment is shape is part of 'entity-like' group
					if ((((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY )!=ShapeTypeEnum.ST_ENTITY ) && 
						(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ENTITY ) == ShapeTypeEnum.ST_PART_OF_ENTITY) && 
						(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_NO_NAMEU)== ShapeTypeEnum.ST_NO_NAMEU))
					{

						if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ENTITY2 ) == ShapeTypeEnum.ST_PART_OF_ENTITY2)
							lBoxY = lBoxY + lGroupPinY*2 - lY;

					}
					else
					{
						lBoxY = lBoxY + lGroupPinY*2 - lY - lPinY ;
					}
		

				}
				else // If shape is NOT a part of group
				{


					lBoxX = lOffsetX + lX - lPinX;
					lBoxY = lOffsetY + lBasedY -  ( lY + lPinY );

				}
			
				if  (( bImportEntitiesAsTables ) && ( (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY ) == ShapeTypeEnum.ST_ENTITY) ))
				{
					// If 'entity - like' shape and 'ImportEnitiesAsTables' mode ON
					// then creating group & table instead of group's content

					oTable = pChart.CreateTable( lBoxX  , lBoxY ,lWidth,lHeight);
					if ( oTable == null )
						return false;

					int lRowCount = 0, lCol = 0, lRow = 0;
					bool IsCaption = true;

					XmlNodeList entity_items = shape.SelectNodes("vdx:Shapes/vdx:Shape",ns);
					foreach ( XmlNode entity_node in entity_items )
					{
						if ( entity_node == null)
							continue;
							
						if ( IsCaption )
						{
							sTemp = GetShapeAttr("vdx:Text", "", entity_node);

							if ( sTemp!=null )
								oTable.Caption = sTemp;

							sTemp = GetShapeAttr("vdx:Fill/vdx:FillForegnd", "", entity_node);
							crFillColor = GetColor(entity_node,"","vdx:Fill/vdx:FillForegnd", null, sTemp, null);
							IsCaption = false;
						}
						else
						{
							// Processing Flowchart Table object 
							sTemp = GetShapeAttr("vdx:User[@NameU='LineCount']/vdx:Value", "", entity_node );
							if ( sTemp!=null )
							{
								lRowCount = Convert.ToInt16(sTemp);
								oTable.RowCount = lRowCount;

							}

							if ( lRowCount == 0 )
								lRowCount = 1;

							oTable.RowHeight = lHeight /( lRowCount);
							oTable.CaptionHeight = lHeight /( lRowCount );
							oTable.RedimTable(2, lRowCount );
							XmlNodeList table_list = null;
							table_list = entity_node.SelectNodes("vdx:Text/text()", ns);

							foreach ( XmlNode text_node in table_list )
							{
								// Parsing text using '\n' as separator
								sTemp = text_node.InnerText.ToString();
								sTemp = sTemp.Trim();
								string [] split = sTemp.Split(new Char [] {'\n'});
								foreach ( string text_piece in split )
								{
									if (text_piece!=null)
									{
										if ( oTable.RowCount <= lRow )
											oTable.RowCount++;
												
										oTable[lCol,lRow].Text = text_piece;
									}
											
									lRow++;
								}

							
							
								
								lRow--;
								lRow++;
							
								if (( lRow == 1 ) && (lCol == 0))
								{
									lCol = 1;
									lRow = 0;
								}
							}
								

						}
							
					}

					// Applying table parameters
					//oTable.CaptionColor  = crFillColor;
					oTable.Brush =  new MindFusion.FlowChartX.SolidBrush(Color.White);
					oTable.FillColor = Color.White;
					oTable.CellFrameStyle = CellFrameStyle.Simple;
					oTable.Tag =  sPageID + "_" + sUID;
		
					return true;
				}
				else
					oBox = pChart.CreateBox( lBoxX  , lBoxY ,lWidth,lHeight);
			
				if ( oBox.Equals(null) )
					return false;
			
				oBox.Tag = sPageID + "_" + sUID;

				Trace.WriteLine(String.Format("Box: {0}",sUID));

				if ( sNameU == "" )
					sTemp = sType;
				else
				{
					sTemp = sNameU;
				}

				ShapeTemplate templ1 = 	null;

				if ( ((ShapeTypeEnum)lShapeType & ShapeTypeEnum.ST_PART_OF_ENTITY) == ShapeTypeEnum.ST_PART_OF_ENTITY )
					templ1 = VisioShape2PredefinedShape("Process", ref oBox, ref DontHideGroup, ref crFillColor);
				else
					templ1 = VisioShape2PredefinedShape(sTemp, ref oBox, ref DontHideGroup, ref crFillColor);
		
				if ( templ1 == null )
					return false;

				oBox.Style = BoxStyle.Shape;
				oBox.Shape = templ1;
			
				if ( lHeight == 0 )
				{
					// Getting shape's begin & end coordinates
					lBeginX = Measure2Pix(xform1d_node, "BeginX");
					lBeginY = Measure2Pix(xform1d_node, "BeginY");
					lEndX = Measure2Pix(xform1d_node, "EndX");
					lEndY = Measure2Pix(xform1d_node, "EndY");
				
			
					if ( lEndX != lBeginX)
						lHeight = System.Math.Abs(lEndX - lBeginX);
					else if ( lEndY != lBeginY)
						lHeight = System.Math.Abs(lEndY - lBeginY);
					else
						lHeight = 0;


				}

				/*
				 * 
				 * 
				 * ROTATION
				// If shape has some rotattion then correct Width & Heigh
				if ((lAngle == 90) || ( lAngle == 270))
				{
					long lH =lHeight, lW = lWidth, lDx = Math.Abs(lW-lH);
					lHeight = lW;
					lWidth = lH;
					lBoxX+= lDx/2;
					lBoxY-= lDx/2;
				}
				*/

				// Processing controls & bitmaps

				if ( sType.IndexOf("foreign") >= 0 )
					ProcessForeign(shape);
				// Applying shape's colors, pens etc.

				if ( sFillPattern == "" )
					sFillPattern = "0";
			
				
				if ( System.Convert.ToInt16(sFillPattern) > 1 )
					oBox.Brush = new MindFusion.FlowChartX.LinearGradientBrush(crFillColor, crFillColor2, 90);
				else
					oBox.Brush = new MindFusion.FlowChartX.SolidBrush(crFillColor);
				
				oBox.Pen = new MindFusion.FlowChartX.Pen(crLineColor,lLineWith);

				/*
				 * 
				 * ROTATION
				if ( lAngle!=0 )
					oBox.ShapeOrientation = lAngle;

				*/

				if ( fAngle2!=0)
				{
					oBox.RotateContents = true;
					oBox.RotationAngle = (float) fAngle2;
				}

#if _POST_FIX_2_1
				if (group != null)
				{
					oBox.RotateContents = (group.MainObject as Box).RotateContents;
					oBox.RotationAngle = (group.MainObject as Box).RotationAngle;

				}
#endif

				// set the shape's text
				Font ff = GetFont(shape);
				if ( ff == null )
					oBox.Font = (Font)pChart.Font.Clone();
				else
					oBox.Font = ff;
				sTemp = GetShapeText(shape, oBox);
				if (sTemp != null)
				{
					oBox.PolyTextLayout = true;
					oBox.EnableStyledText = true;
						oBox.Text = sTemp;
					oBox.TextColor = crTextColor;
				}

				if (group!=null)			
				{
					if ( ((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_PART_OF_ARROW ) == ShapeTypeEnum.ST_PART_OF_ARROW)
						//if ( lShapeType & ST_PART_OF_ARROW)
					{
						group.AttachToArrowPoint(oBox,1);
						oBox.Transparent = true;
					}
					else
					{
						group.AttachToCorner(oBox,0);
					}

					oBox.Locked = true;
				}

				if ( sPenStyle!=null )
					oBox.Pen.DashStyle = String2DashStyle(sPenStyle);

				// Raising 'BoxImported' event
				OnBoxImported(oBox, sShapeName, "");
			}
				// If the shape is connector then creating the arrow
			else if ( ((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_CONNECTOR ) == ShapeTypeEnum.ST_CONNECTOR)
			{

				if ( connectRoot == null )
					return false;

				sPath = String.Format("vdx:Connect[@FromSheet='{0}']", sUID);
				XmlNodeList connected_list = connectRoot.SelectNodes(sPath, ns);
					 
				if  (connected_list == null)
					return false;
					 
					

				lTemp = 0;
				string sFrom = "", sTo = "";
				foreach ( XmlNode EachConnection in connected_list)
				{
					if ( EachConnection == null )
						break;
 					
					if ( EachConnection.Attributes["ToSheet"]!=null)
						if ( lTemp == 0 )
							sFrom = EachConnection.Attributes["ToSheet"].Value.ToString();
						else
							sTo = EachConnection.Attributes["ToSheet"].Value.ToString();

					if ( lTemp>0 )
						break;

					lTemp++;

				}
			
				Trace.WriteLine(String.Format("Arrow: {0} - {1}",sFrom,sTo));
				oArrow = CreateFcxLink(sPageID + "_" + sFrom, sPageID + "_" + sTo);
				if ( oArrow == null )
					return false;

				
				// Setting Arrow's ID
				oArrow.Tag = sPageID + "_" + sUID;

				xform1d_node = shape.SelectSingleNode("vdx:XForm1D", ns);
				if ( xform1d_node == null)
					return false;

				// Getting arrow's begin & end coordinates
				lBeginX = Measure2Pix(xform1d_node, "BeginX");
				lBeginY = Measure2Pix(xform1d_node, "BeginY");
				lEndX = Measure2Pix(xform1d_node, "EndX");
				lEndY = Measure2Pix(xform1d_node, "EndY");
				
				// Detecting arrow style
				ArrowStyle stArrow = ArrowStyle.Cascading;

				sTemp = GetShapeAttr("vdx:Layout/vdx:ConLineRouteExt", "", shape);
				if ( sTemp == "2")
					stArrow = ArrowStyle.Bezier;
				else if ( sTemp == "1")
					stArrow = ArrowStyle.Polyline;

				// If arrow is 'line curved' then set 'asBezier' type
				if ( sNameU == "line-curve connector" )
					stArrow = ArrowStyle.Bezier;


			
				// Counting segments arrow consists in
				XmlNodeList segments_list = shape.SelectNodes("vdx:Geom/vdx:LineTo", ns);
				lTemp = segments_list.Count;
				
				if (( stArrow  == ArrowStyle.Cascading) || ( stArrow  == ArrowStyle.Polyline))
				{
					if (lTemp>1)
						stArrow = ArrowStyle.Cascading;
					else
					{
						stArrow = ArrowStyle.Polyline;
					
						
					}
				}

				//Setting arrow style
				oArrow.Style = stArrow;


				if (stArrow == ArrowStyle.Cascading)
				{
					// If the arrow has more than one segment than
					// setting 'asPerpendicular' style for arrow

					oArrow.SegmentCount = (short) lTemp;

					// Setting coordinates of the arrow's origin
					lStartX = lOffsetX + lBeginX ; 
					lStartY = lOffsetY + lBasedY -  ( lBeginY  );
					oArrow.ControlPoints[0]= new PointF(lStartX, lStartX);
					lPtX = lStartX;
					lPtY = lStartY;
					Trace.WriteLine(String.Format("Arrow {0}\tPt:{1}\tX:{2}\tY:{3}",sUID,0,lPtX, lPtY));
                  

					// TODO: If source shape ( pBoxFrom) is non-symmetric ( triangle, pentagon, etc )
					//       arrow base's coordinates need to be adjusted to be source shape's part
					//		 such as follows:
					//		 pArrow->CtrlPtX[0] = ????;
					//		 pArrow->CtrlPtY[0] = ????;

					// Getting arrow segments 'one-by-one' using 'LineTo' XML nodes
					foreach ( XmlNode segment in segments_list )
					{
						if ( segment == null )
							continue;

						// Getting X-coordinate
						node_temp = segment.SelectSingleNode("vdx:X", ns);

						if ( node_temp == null )
						{
							oArrow.Style = ArrowStyle.Polyline;
							break;
						}

						sStepX = node_temp.InnerText;
						lStepX = (long) Unit2Pix(sDL, sDL, sStepX);
						lPtX = lStartX + lStepX;


						// Getting Y-coordinate
						node_temp = segment.SelectSingleNode("vdx:Y", ns);

						if ( node_temp == null )
						{
							oArrow.Style = ArrowStyle.Polyline;
							break;
						}


						sStepY = node_temp.InnerText;
						lStepY = (long) Unit2Pix(sDL, sDL, sStepY);
						lPtY = lStartY - lStepY;

						// Setting new segment for FloChartX arrow
						if ( lCount <= lTemp)
						{
							oArrow.ControlPoints[(int) lCount]= new PointF(lPtX, lPtY);
							Trace.WriteLine(String.Format("Arrow {0}\tPt:{1}\tX:{2}\tY:{3}",sUID,lCount,lPtX, lPtY));
						}
					
						lCount++;
					}
			
			

				}
				else
				{
					// Setting coordinates of the arrow's origin & destination

						
					lAdjustX = 0;
					lAdjustY = 0;
					if ( stArrow == ArrowStyle.Bezier )
					{
						// If curved shape has control points then reflecting adustments
				
						oArrow.SegmentCount = 1;

						if ( sNameU == "line-curve connector" )
						{
				
							node_temp = shape.SelectSingleNode("vdx:Control/vdx:X", ns);
							if ( node_temp != null )
							{
								sTemp = node_temp.InnerText;
								lAdjustX = (long) Unit2Pix(sDL, sDL,sTemp);

							}

							node_temp = shape.SelectSingleNode("vdx:Control/vdx:Y", ns);
							if ( node_temp != null )
							{
								sTemp = node_temp.InnerText;
								lAdjustY = (long) Unit2Pix(sDL, sDL,sTemp);

							}
					
						}

						PointF cpt = oArrow.ControlPoints[0];
						oArrow.ControlPoints[1]= new PointF(cpt.X + lAdjustX , cpt.Y -lAdjustY/2 );
						oArrow.ControlPoints[2]= new PointF(cpt.X + lAdjustX , cpt.Y -lAdjustY/2 );
						oArrow.ControlPoints[3]= new PointF(lOffsetX + lEndX , lOffsetY + lBasedY -  ( lEndY  ));

					}
					else
					{
						oArrow.SegmentCount = 1;
					}
				
				}
				// Setting Begin/End point of the arrow
				oArrow.ControlPoints[0]= new PointF(lOffsetX + lBeginX, lOffsetY + lBasedY -  ( lBeginY  ));	
				oArrow.ControlPoints[oArrow.SegmentCount]= new PointF(lOffsetX + lEndX, lOffsetY + lBasedY -  ( lEndY  ));

				// Updating arrow
				oArrow.UpdateFromPoints();

				// Settiing ArrowBase property
				sTemp = null;
				
				sTemp = GetShapeAttr("vdx:Line/vdx:BeginArrow","",shape);
				if (( sTemp == null ) && ( sLineStyle!=null))
				{
					sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:BeginArrow",sLineStyle),
						"",stylesRoot);
				}

				if ( sTemp!=null )
				{
					oArrow.ArrowBase = String2ArrowType( sTemp, ref crLineColor);
				}


				// Settiing ArrowBaseSize property
				sTemp = null;
				
				sTemp = GetShapeAttr("vdx:Line/vdx:BeginArrowSize","",shape);
				if (( sTemp == null ) && ( sLineStyle!=null))
				{
					sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:BeginArrowSize",sLineStyle),
						"",stylesRoot);
				}

				if ( sTemp!=null )
				{
					oArrow.ArrowBaseSize = System.Convert.ToInt16(sTemp) * 5;
				}

				// Setting ArrowHead
				sTemp = GetShapeAttr("vdx:Line/vdx:EndArrow","",shape);
				if (( sTemp == null ) && ( sLineStyle!=null))
				{
					sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:EndArrow",sLineStyle),
						"",stylesRoot);
				}

				if ( sTemp!=null )
				{
					oArrow.ArrowHead = String2ArrowType( sTemp, ref crLineColor);
				}


				// Settiing ArrowHeadSize property
				sTemp = null;
				
				sTemp = GetShapeAttr("vdx:Line/vdx:EndArrowSize","",shape);
				if (( sTemp == null ) && ( sLineStyle!=null))
				{
					sTemp = GetShapeAttr(String.Format("vdx:StyleSheet[@ID='{0}']/vdx:Line/vdx:EndArrowSize",sLineStyle),
						"",stylesRoot);
				}

				if ( sTemp!=null )
				{
					oArrow.ArrowHeadSize = System.Convert.ToInt16(sTemp) * 5;
				}


			
				// [???] Setting arrow's color
				oArrow.Pen = new MindFusion.FlowChartX.Pen(crLineColor,lLineWith);
				oArrow.HeadPen = oArrow.Pen;
				oArrow.Brush = new MindFusion.FlowChartX.SolidBrush(crFillColor);

				if ( sPenStyle!=null )
					oArrow.Pen.DashStyle = String2DashStyle(sPenStyle);

				// Performing post-processing for special arrow types
				if ( sNameU	== "composition")
				{
					oArrow.ArrowBase = ArrowHead.Rhombus;
					oArrow.ArrowHead =	ArrowHead.None;
				}
				else if	( sNameU ==	"generalization")
				{
					oArrow.ArrowBase =	ArrowHead.Triangle;
					oArrow.ArrowHead = ArrowHead.None;
					oArrow.FillColor =  Color.FromArgb(255,255,255);
				}
				else if ( sNameU == "object flow")
				{
					oArrow.ArrowBase =	ArrowHead.None;
					oArrow.ArrowHead = ArrowHead.Arrow;
					oArrow.Pen.DashStyle = DashStyle.Dash;
				}
				else if ( sNameU == "control flow")
				{
					oArrow.ArrowBase = ArrowHead.None;
					oArrow.ArrowHead = ArrowHead.Arrow;
					oArrow.Pen.DashStyle = DashStyle.Solid;
				}
				else if ( sNameU.IndexOf("association")>=0)
				{
					oArrow.ArrowBase = ArrowHead.None;
					oArrow.ArrowHead = ArrowHead.Arrow;
					//oArrow.FillColor =  Color.FromArgb(255,255,255);
					oArrow.Pen.DashStyle = DashStyle.Solid;
				}
				else if ( sNameU == "2-element constraint")
				{
					oArrow.ArrowBase =	ArrowHead.Arrow;
					oArrow.ArrowHead = ArrowHead.None;
					//oArrow.FillColor =  Color.FromArgb(255,255,255);
					oArrow.Pen.DashStyle = DashStyle.Dot;
				}
				else if ( sNameU == "or constraint")
				{
					oArrow.ArrowBase =	ArrowHead.Arrow;
					oArrow.ArrowHead = ArrowHead.None;
					//oArrow.FillColor =  Color.FromArgb(255,255,255);
					oArrow.Pen.DashStyle = DashStyle.Dot;
				}
				

				// Setting arrow's text

				sTemp = GetShapeText(shape, oArrow);
				if (sTemp != null)
				{
					Font ff = GetFont(shape);
					if ( ff == null )
						oArrow.Font = pChart.Font;
					else
						oArrow.Font = ff;

					oArrow.Text = sTemp;
					oArrow.TextColor = crTextColor;

				}
				fnShape = null;
				fnShape = GetFont(shape);

				// Raising 'ArrowImported' event
				OnArrowImported(oArrow, sShapeName);
			}
			// if the shape is GROUP
			if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_GROUP ) == ShapeTypeEnum.ST_GROUP)
			{
				if ((((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY ) != ShapeTypeEnum.ST_ENTITY) &&
					(((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_OVAL_PROCESS ) != ShapeTypeEnum.ST_OVAL_PROCESS))																					 
				{
					if (!DontHideGroup)
					{
						oBox.Transparent = true;
						oBox.FillColor = Color.FromArgb(255,255,255);
					}
					
				}
		
				oGroup = null;

				if ( oArrow != null )
					oGroup = pChart.CreateGroup(oArrow);
				else
					oGroup = pChart.CreateGroup(oBox);
				// Saving group's measures for future use
				lGroupY = lY;
				lGroupX = lX;
				lGroupPinY = lPinY;
				lGroupPinX = lPinX;

				// Scanning for group members and creating it using recursive call
			
				XmlNodeList grshape_list = null;
				grshape_list = shape.SelectNodes("vdx:Shapes/vdx:Shape", ns);
				foreach ( XmlNode grshape in grshape_list)
				{
					sTemp = String.Format("{0}",ShapeType);

					if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY ) == ShapeTypeEnum.ST_ENTITY)
						//   if ( lShapeType & ST_ENTITY )
						sTemp = "entity";

					if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_ENTITY2 ) == ShapeTypeEnum.ST_ENTITY2)
						//if ( lShapeType & ST_ENTITY2 )
						sTemp = "entity 2";

					if (((ShapeTypeEnum) lShapeType & ShapeTypeEnum.ST_CONNECTOR ) == ShapeTypeEnum.ST_CONNECTOR)
						//   if ( lShapeType & ST_CONNECTOR )
						sTemp = "arrow";
					GetShapeRef(grshape,sTemp,oGroup);
				}

#if _POST_FIX_2_1
				if (DontHideGroup)
				{
					foreach ( Box grBox in oGroup.AttachedObjects )
					{
						grBox.Transparent = true;
					}
				}
#endif

				// Raising 'GroupImported' event
				OnGroupImported(oGroup);
			}

			oBox = null;
			oArrow = null;

			return true;
		}
Exemplo n.º 10
0
		/// <summary>
		/// Creates a new Arrow instance and adds it to the flowchart.
		/// </summary>
		/// <param name="src">Specifies the origin table.</param>
		/// <param name="dest">Specifies the destination table.</param>
		/// <returns>A reference to the new arrow.</returns>
		public Arrow CreateArrow(Table src, Table dest)
		{
			return CreateArrow(src, -1, dest, -1);
		}
Exemplo n.º 11
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.º 12
0
		public override void setReference(int refId, IPersists obj)
		{
			base.setReference(refId,obj);

			if (refId == 2)
				table = (Table)obj;
		}
Exemplo n.º 13
0
		public TableLink(Table table, Arrow arrow, bool incoming, int row)
			: base(arrow, incoming)
		{
			this.table = table;
			this.row = row;
		}
Exemplo n.º 14
0
		public CellTextArgs(Table table, String oldText, String newText, int col, int row) :
			base(table, oldText, newText)
		{
			this.oldText = oldText;
			this.newText = newText;
			this.column = col;
			this.row = row;
		}
Exemplo n.º 15
0
		/// <summary>
		/// Creates a new Arrow instance and adds it to the flowchart.
		/// </summary>
		/// <param name="srcNode">Specifies the origin node.</param>
		/// <param name="destTable">Specifies the destination table.</param>
		/// <param name="destRow">Specifies the destination row.</param>
		/// <returns>A reference to the new arrow.</returns>
		public Arrow CreateArrow(Node srcNode, Table destTable, int destRow)
		{
			if (srcNode == null || destTable == null) return null;

			if (!destTable.canHaveArrows(false) && destRow != -1) return null;

			if (destRow < -1 || destRow >= destTable.RowCount)	return null;

			// create the arrow object and store it in the collection
			Arrow newArrow = new Arrow(this);
			newArrow.setOrgAndDest(
				srcNode.createLink(newArrow, srcNode.getCenter(), false),
				destTable.createLink(newArrow, true, destRow));

			Add(newArrow, SelectAfterCreate);

			return newArrow;
		}
Exemplo n.º 16
0
		internal void fireTableDeleted(Table table)
		{
			if (TableDeleted != null)
				TableDeleted(this, new TableEventArgs(table));
		}
Exemplo n.º 17
0
		/// <summary>
		/// Creates a new Arrow instance and adds it to the flowchart.
		/// </summary>
		/// <param name="srcTable">Specifies the origin table.</param>
		/// <param name="srcRow">Specifies the origin row.</param>
		/// <param name="dstNode">Specifies the destination node.</param>
		/// <returns>A reference to the new arrow.</returns>
		public Arrow CreateArrow(Table srcTable, int srcRow, Node dstNode)
		{
			if (srcTable == null || dstNode == null) return null;

			if (!srcTable.canHaveArrows(true) && srcRow != -1) return null;

			if (srcRow < -1 || srcRow >= srcTable.RowCount) return null;

			// create the arrow object and store it in the item array
			Arrow newArrow = new Arrow(this);
			newArrow.setOrgAndDest(
				srcTable.createLink(newArrow, false, srcRow),
				dstNode.createLink(newArrow, dstNode.getCenter(), true));

			Add(newArrow, SelectAfterCreate);

			return newArrow;
		}
Exemplo n.º 18
0
		public void Add(Table t)
		{
			List.Add(t);
		}
Exemplo n.º 19
0
		private bool confirmTableInplaceEdit(Table tbl, int row, int col)
		{
			if (TableInplaceEditing == null) return true;

			TableConfirmArgs args = new TableConfirmArgs(tbl, row, col);
			TableInplaceEditing(this, args);
			return args.Confirm;
		}
Exemplo n.º 20
0
		public void Remove(Table t)
		{
			List.Remove(t);
		}
Exemplo n.º 21
0
		/// <summary>
		/// Creates a new table at the specified location.
		/// </summary>
		/// <param name="x">Specifies the horizontal position of the table.</param>
		/// <param name="y">Specifies the vertical position of the table.</param>
		/// <param name="width">Specifies the width of the table.</param>
		/// <param name="height">Specifies the height of the table.</param>
		/// <returns>A new Table instance.</returns>
		public Table CreateTable(float x, float y, float width, float height)
		{
			// create the box object and store it in the collection
			Table newTable = new Table(this);
			newTable.setPos(x, y, width, height);

			Add(newTable, SelectAfterCreate);

			return newTable;
		}
Exemplo n.º 22
0
			public virtual void setReference(int refId, IPersists obj)
			{
				table = (Table)obj;
			}
Exemplo n.º 23
0
		/// <summary>
		/// Creates a relation between the specified rows of two tables.
		/// </summary>
		/// <param name="src">The source table.</param>
		/// <param name="srcRow">The source row.</param>
		/// <param name="dest">The destination table.</param>
		/// <param name="destRow">The destination row.</param>
		/// <returns>A new Arrow instance.</returns>
		public Arrow CreateRelation(Table src, int srcRow, Table dest, int destRow)
		{
			return CreateArrow(src, srcRow, dest, destRow);
		}
Exemplo n.º 24
0
/*		public void Destroy()
		{
			cells.Clear();
			rowsList.Clear();
			colsList.Clear();
		}
*/
		/// <summary>
		/// Adds relation to a table field.
		/// </summary>
		/// <param name="row">The row index.</param>
		/// <param name="rel">Desired relation type.</param>
		/// <param name="table">Related table object.</param>
		/// <param name="relRow">Related table row index.</param>
		/// <returns></returns>
		public Arrow AddRelation(int row, Relationship rel, Table table, int relRow)
		{
			if (this.Rows == null) return null;
			if (row < 0 || row >= this.Rows.Count) return null;

			switch (rel)
			{
			case Relationship.OneToMany:
				return flowChart.CreateArrow(table, relRow, this, row);
			case Relationship.ManyToOne:
				return flowChart.CreateArrow(this, row, table, relRow);
			}

			return null;
		}
Exemplo n.º 25
0
		private ItemsAndGroups copySelection(
			FlowChart doc, bool unconnectedArrows, bool copyGroups)
		{
			if (doc.Selection.Objects.Count == 0)
				return null;

			// determine which items and groups to copy
			ChartObjectCollection items = new ChartObjectCollection();
			GroupCollection groups = new GroupCollection();
			Hashtable indexMap = new Hashtable();
			for (int i = 0; i < doc.Selection.Objects.Count; ++i)
			{
				ChartObject item = doc.Selection.Objects[i];

				// do not copy unconncted arrows if specified
				if (!unconnectedArrows && item is Arrow)
				{
					Arrow arrow = item as Arrow;
					if (!arrow.IsConnected) continue;
				}

				indexMap[item] = items.Count;
				items.Add(item);
				
				if (copyGroups && item.SubordinateGroup != null)
					groups.Add(item.SubordinateGroup);
			}

			// add subordinated group items
			foreach (Group group in groups)
			{
				foreach (ChartObject item in group.AttachedObjects)
				{
					if (!items.Contains(item))
					{
						indexMap[item] = items.Count;
						items.Add(item);
					}
				}
			}

			// copy nodes
			for (int i = 0; i < items.Count; ++i)
			{
				ChartObject item = items[i];

				if (item is Box) items[i] = new Box((Box)item);
				if (item is ControlHost) items[i] = new ControlHost((ControlHost)item);
				if (item is Table) items[i] = new Table((Table)item);
			}

			// copy arrows, linking them to node clones
			for (int i = 0; i <  items.Count; ++i)
			{
				if (items[i] is Arrow)
				{
					Arrow arrow = items[i] as Arrow;

					int srcIndex = indexMap.Contains(arrow.Origin) ?
						(int)indexMap[arrow.Origin] : -1;
					int dstIndex = indexMap.Contains(arrow.Destination) ?
						(int)indexMap[arrow.Destination] : -1;

					items[i] = new Arrow(arrow,
						srcIndex == -1 ? Dummy : items[srcIndex] as Node,
						dstIndex == -1 ? Dummy : items[dstIndex] as Node);
				}
			}

			// copy groups
			for (int i = 0; i < groups.Count; ++i)
			{
				Group group = new Group(groups[i]);
				groups[i] = group;
				group.setMainObject(items[(int)indexMap[group.MainObject]]);

				foreach (Attachment atc in group.Attachments)
				{
					atc.node = items[(int)indexMap[atc.node]] as Node;
					atc.node.putInGroup(group);
				}
				group.updateObjCol();
			}

			return new ItemsAndGroups(items, groups);
		}
Exemplo n.º 26
0
		private void removeRelation(int row, Relationship rel, Table table)
		{
			ArrowCollection arrows = null;
			TableCollection	tables = null;

			switch (rel)
			{
			case Relationship.OneToMany:
				arrows = IncomingArrows;
				if (row != -1)
				{
					arrows = ((Row)rowsList[row]).IncomingArrows;
					tables = ((Row)rowsList[row]).RelatedOneToMany;
				}
				break;
			case Relationship.ManyToOne:
				arrows = OutgoingArrows;
				if (row != -1)
				{
					arrows = ((Row)rowsList[row]).OutgoingArrows;
					tables = ((Row)rowsList[row]).RelatedManyToOne;
				}
				break;
			}
			if (tables.Count == 0 && row != -1) return;

			Link link = null;
			ChartObject obj;
			foreach(Arrow a in arrows)
			{
				switch (rel)
				{
					case Relationship.OneToMany:
						link = a.getOrgnLink();
						break;
					case Relationship.ManyToOne:
						link = a.getDestLink();
						break;
				}
				obj = link.getNode();
				if (obj == table)
				{
					flowChart.DeleteObject(a);
					return;
				}
			}
		}
Exemplo n.º 27
0
		internal void drawTable(Graphics g, Table table, bool shadow, RectangleF bounds)
		{
			if (DrawTable != null)
				DrawTable(this, new TableDrawArgs(g, table, shadow, bounds));
		}
Exemplo n.º 28
0
			public virtual void setReference(int refId, IPersists obj)
			{
				switch(refId)
				{
					case 1:
						table = (Table)obj;
						break;
					case 2:
						if (brush != null)
							brush.Release();
						brush = (Brush)obj;
						if (brush != null)
							brush.AddRef();
						break;
					default:
						throw new Exception("Unrecognized reference in Cell.setReference(...)");
				}
			}
Exemplo n.º 29
0
		internal void drawCell(Graphics g, Table table, int col, int row, RectangleF bounds)
		{
			if (DrawCell != null)
				DrawCell(this, new CellDrawArgs(g, table, col, row, bounds));
		}
Exemplo n.º 30
0
			public virtual void setReference(int refId, IPersists obj)
			{
				switch (refId)
				{
				case 1:
					table = (Table)obj;
					break;
				case 2:
					incomingArrows = (ArrowCollection)obj;
					break;
				case 3:
					outgoingArrows = (ArrowCollection)obj;
					break;
				case 4:
					relatedOneToMany = (TableCollection)obj;
					break;
				case 5:
					relatedManyToOne = (TableCollection)obj;
					break;
				}
			}
Exemplo n.º 31
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);
        }