private PageReport PaintInvalid(Page page, PageReport report, string mode) { int invalidCount = 0; Hashtable shapeHandlers = new Hashtable(); CgoConfig[] Cgo = CgoConfigs.Search(); GroupElementTable groupElementTable = new GroupElementTable(); ElementTable elementTable = new ElementTable(); foreach (Shape shape in page.Shapes) { string shapeName = VisioUtils.GetProperty(shape, "User", "ScreenShape"); if (shapeName == null) { continue; } IShapeHandler shapeHandler = GetShapeHandler(shapeHandlers, shape, shapeName, mode); if (shape.Data1 == _INVALID) { shapeHandler.PaintAsInvalid(); } else { if (Cgo != null) { XmlNode shapeProperties = shapeHandler.GetProperties(); XmlNode cgoNode = shapeProperties.SelectSingleNode("cgoName"); if (cgoNode != null) { string cgoCode = cgoNode.InnerText; if (!CgoConfigs.Exists(Cgo, cgoCode)) { } } } } invalidCount++; string groupElementName = VisioUtils.GetProperty(shape, "Prop", "Group"); string elementName = VisioUtils.GetProperty(shape, "Prop", "Element"); if ((groupElementName == null) || (elementName == null)) { continue; } GroupElement groupElement = new GroupElement(groupElementName); groupElementTable.AddGroupElement(groupElement); Element element = new Element(elementName); elementTable.AddElement(element); } report = ShapeGroupValidation.Validate(groupElementTable, elementTable, report); return(report); }
private void MarkInvalid(Page page) { foreach (Shape shape in page.Shapes) { string shapeName = VisioUtils.GetProperty(shape, "User", "ScreenShape"); if (shapeName == null) { continue; } shape.Data1 = _INVALID; } }
/// <summary> /// Handles the marker events. /// </summary> /// <param name="context">Parsed event context.</param> private void HandleMarkerEvent(NameValueCollection context) { Shape shape = VisioUtils.GetShape(_application, context); if (shape == null) { return; } string shapeName = VisioUtils.GetProperty(shape, "User", "Midgard"); if (shapeName == null) { // se for um visio desenhado com a versão antiga (sem os layers) shapeName = VisioUtils.GetShapeType(shape); if (shapeName == null) { return; } } string command = context["cmd"]; if (command == null) { return; } /* * */ string mode = "live";// GetMode(); using (XmlForm form = new XmlForm()) { form.LoadDefinition(shapeName, shape); form.Design(mode, Application.ActivePage); IShapeHandler shapeHandler = (IShapeHandler)form.Tag; DisplaySettings newSettings = shapeHandler.Execute(command, context, _displaySettings, _forceFormChange); if (newSettings != null) { _displaySettings = newSettings; } } }
/// <summary> /// Handles the shape disconnect event. /// </summary> /// <param name="connection">Disconnection event.</param> private void HandleShapeDisconnect(Connects connection) { // connection.FromSheet is always the connector shape. // connection.ToSheet is always the shape to which the connector was previously connected. Shape connect = connection.FromSheet; string shapeName = VisioUtils.GetProperty(connect, "User", VisioUtils.GetShapeType(Application)); if (shapeName == null) { return; } if (shapeName == "Event" || shapeName == "EventProcess") { VisioUtils.PaintShape(connection.FromSheet, "2"); } }