public static void RedoAllPromptIds() { List <Shadow> shadowList = PathMaker.LookupAllShadows(); int count = 100; StartShadow startShadow = PathMaker.LookupStartShadow(); if (startShadow == null) { Common.ErrorMessage("No start shape available to determine prompt id format"); return; } string promptIdFormat = startShadow.GetDefaultSetting(Strings.DefaultSettingsPromptIDFormat); startShadow.RedoPromptIds(count, promptIdFormat); foreach (Shadow s in shadowList) { StateShadow stateShadow = s as StateShadow; if (stateShadow != null) { count += stateShadow.RedoPromptIds(count, promptIdFormat); } } }
public static StartShadow LookupStartShadow() { foreach (Shadow shadow in shadowShapeMap.Values) { StartShadow startShadow = shadow as StartShadow; if (startShadow != null) { return(shadow as StartShadow); } } return(null); }
public override void OnShapeExitTextEdit() { base.OnShapeExitTextEdit(); string prefix, number, name, errorMessage; string newName = StateIdForDisplay(shape.Text); DisectStateIdIntoParts(newName, out prefix, out number, out name); // always use uppercase prefixes prefix = prefix.ToUpper(); // They can enter anything in the shape text - here we make sure it's a good stateid // and, if not, we make it one. if (!ValidateStateIdTextBoxStrings(prefix, number, name, out errorMessage)) { if (GetStateId().Length > 0) { string oldPrefix, oldNumber, oldName; DisectStateIdIntoParts(GetStateId(), out oldPrefix, out oldNumber, out oldName); newName = oldPrefix.ToUpper() + oldNumber + Strings.StateIdWordDisplayDelimiter + newName; } else { newName = StatePrefixAndNumberManager.GetCurrentStateIdPrefix() + StatePrefixAndNumberManager.GetNextAvailableNumber() + Strings.StateIdWordDisplayDelimiter + newName; } } else { // make sure we pick up the uppercase prefix newName = prefix + number + Strings.StateIdWordDisplayDelimiter + name; } string oldStateId = GetStateId(); string newStateId = StateIdForStorage(newName); SetStateId(newStateId); StartShadow shadowStart = PathMaker.LookupStartShadow(); if (shadowStart != null && !oldStateId.Equals(newStateId)) { string promptIdFormat = shadowStart.GetDefaultSetting(Strings.DefaultSettingsPromptIDFormat); if (promptIdFormat.Equals(Strings.PromptIdFormatFull) || promptIdFormat.Equals(Strings.PromptIdFormatPartial)) { RedoPromptIds(0, promptIdFormat); } } }
private static void AddStartElement(XmlDocument xmlDoc, StartShadow shadow) { XmlElement startElement = CreateElement(xmlDoc.DocumentElement, xmlStrings.Start); AddNameValuePairs(shadow.GetDefaultSettings(), startElement, xmlStrings.DefaultSettings); XmlElement globalBehaviorElement = CreateElement(startElement, xmlStrings.GlobalBehavior); AddPromptTypes(shadow.GetPromptTypes(), globalBehaviorElement); AddCommandTransitions(shadow, shadow.GetCommandTransitions(), globalBehaviorElement); AddConfirmationList(shadow.GetConfirmationPrompts(), globalBehaviorElement); AddNameValuePairs(shadow.GetInitialization(), startElement, xmlStrings.Initialization); XmlElement firstStateElement = CreateElement(startElement, xmlStrings.FirstState); firstStateElement.InnerText = GetXmlGotoFromShadow(shadow.GetFirstStateGotoTarget()); AddMaxHandling(shadow, shadow.GetMaxHandling(), startElement); }
internal Table GetPrompts() { Table table = Common.GetCellTable(shape, ShapeProperties.Play.Prompts); string promptText = shape.Shapes[promptShapeIndex].Text; if (table.IsEmpty() && promptText.Length > 0) { table = new Table(1, Enum.GetNames(typeof(TableColumns.Prompts)).Length); table.SetData(0, (int)TableColumns.Prompts.Wording, promptText); StartShadow shadowStart = PathMaker.LookupStartShadow(); if (shadowStart != null) { string promptIdFormat = shadowStart.GetDefaultSetting(Strings.DefaultSettingsPromptIDFormat); if (promptIdFormat.Equals(Strings.PromptIdFormatFull) || promptIdFormat.Equals(Strings.PromptIdFormatPartial)) { RedoPromptIds(0, promptIdFormat, table); } } } return(table); }
public static void StateIdShadowSorterVisioPageGrouping(List<Shadow> shadowList, Document doc, StartShadow startShadow) { // Try to create a group of states per Visio page then // sort alphanumerically so the printing order matches the pages //string firstPrefix = String.Empty; //Shadow firstShadow = startShadow.GetFirstStateGotoTarget(); //if (firstShadow != null) //{ //StateShadow firstState = firstShadow as StateShadow; //string firstNumber, firstName; //StateShadow.DisectStateIdIntoParts(firstState.GetStateId(), out firstPrefix, out firstNumber, out firstName); //} // make a list of first page references of each alpha prefix stateToPageReference = new Dictionary<string, int>(); foreach (Shadow s in shadowList) { StateShadow sState = s as StateShadow; if (sState == null) continue; //int firstPageNumber; int pageNumber = s.GetPageNumber(); string statePrefix, stateNumber, stateName; StateShadow.DisectStateIdIntoParts(sState.GetStateId(), out statePrefix, out stateNumber, out stateName); // always make this highest priority //if (sState.GetStateId().Equals(firstState.GetStateId())) //firstPageNumber = pageNumber; int earliest; if (stateToPageReference.TryGetValue(statePrefix + stateNumber, out earliest)) { if (pageNumber < earliest) stateToPageReference[statePrefix + stateNumber] = pageNumber; } else { stateToPageReference.Add(statePrefix + stateNumber, pageNumber); } } shadowList.Sort(StateIdShadowSorterVisioPageGroupHelper); }
public static void StateIdShadowSorterVisioHeuristic(List<Shadow> shadowList, Document doc, StartShadow startShadow) { // group by alpha prefix, then by number within that // then sort groups by first visio page reference // if both on same page, startPrefix is first, the sort alphanumerically string firstPrefix = String.Empty; Shadow firstShadow = startShadow.GetFirstStateGotoTarget(); if (firstShadow != null) { StateShadow firstState = firstShadow as StateShadow; string firstNumber, firstName; StateShadow.DisectStateIdIntoParts(firstState.GetStateId(), out firstPrefix, out firstNumber, out firstName); } // make a list of first page references of each alpha prefix earliestPageReference = new Dictionary<string, int>(); foreach (Shadow s in shadowList) { StateShadow sState = s as StateShadow; if (sState == null) continue; int pageNumber = s.GetPageNumber(); string statePrefix, stateNumber, stateName; StateShadow.DisectStateIdIntoParts(sState.GetStateId(), out statePrefix, out stateNumber, out stateName); // always make this highest priority if (statePrefix.Equals(firstPrefix)) pageNumber = -1; int earliest; if (earliestPageReference.TryGetValue(statePrefix, out earliest)) { if (pageNumber < earliest) earliestPageReference[statePrefix] = pageNumber; } else { earliestPageReference.Add(statePrefix, pageNumber); } } shadowList.Sort(StateIdShadowSorterVisioHeuristicHelper); }
// Creates a shadow from a shape. Should only be called from PathMaker // event handlers when things are loaded, added, etc. public static Shadow MakeShapeShadow(Shape shape) { ShapeTypes shapeType = Common.GetShapeType(shape); Shadow shadow = null; switch (shapeType) { case ShapeTypes.CallSubDialog: shadow = new CallSubDialogShadow(shape); break; case ShapeTypes.ChangeLog: shadow = new ChangeLogShadow(shape); break; case ShapeTypes.AppDesc: shadow = new AppDescShadow(shape); break; case ShapeTypes.PrefixList: shadow = new PrefixListShadow(shape); break; case ShapeTypes.Comment: shadow = new IgnoredShadow(shape); break; case ShapeTypes.Connector: shadow = new ConnectorShadow(shape); break; case ShapeTypes.Data: shadow = new DataShadow(shape); break; case ShapeTypes.Decision: shadow = new DecisionShadow(shape); break; case ShapeTypes.DocTitle: shadow = new DocTitleShadow(shape); break; case ShapeTypes.HangUp: shadow = new HangUpShadow(shape); break; case ShapeTypes.Interaction: shadow = new InteractionShadow(shape); break; case ShapeTypes.None: break; case ShapeTypes.OffPageRef: shadow = new OffPageRefShadow(shape); break; case ShapeTypes.OnPageRefIn: shadow = new OnPageRefInShadow(shape); break; case ShapeTypes.OnPageRefOut: shadow = new OnPageRefOutShadow(shape); break; case ShapeTypes.Page: break; case ShapeTypes.Placeholder: shadow = new IgnoredShadow(shape); break; case ShapeTypes.Play: shadow = new PlayShadow(shape); break; case ShapeTypes.Return: shadow = new ReturnShadow(shape); break; case ShapeTypes.Start: shadow = new StartShadow(shape); break; case ShapeTypes.SubDialog: shadow = new SubDialogShadow(shape); break; case ShapeTypes.Transfer: shadow = new TransferShadow(shape); break; } return shadow; }
internal static string ExportFastPathXML(AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl visioControl, bool useTmpFile) { DocTitleShadow docTitleShadow = PathMaker.LookupDocTitleShadow(); if (docTitleShadow == null) { Common.ErrorMessage("Missing Document Title shape"); return(null); } StartShadow startShadow = PathMaker.LookupStartShadow(); if (startShadow == null) { Common.ErrorMessage("Missing Start shape"); return(null); } changeLogShadow = PathMaker.LookupChangeLogShadow(); if (changeLogShadow == null) { Common.ErrorMessage("Missing Change Log shape"); return(null); } if (saveFileDialog == null) { saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = Common.GetResourceString(Strings.SaveFastPathXMLTitleRes); saveFileDialog.Filter = Common.GetResourceString(Strings.SaveFastPathXMLFilterRes); saveFileDialog.FilterIndex = 1; } saveFileDialog.InitialDirectory = PathMaker.getCurrentFileDirectory(visioControl); saveFileDialog.RestoreDirectory = true; targetFilename = visioControl.Src; currentFileName = System.IO.Path.GetFileName(targetFilename); saveFileDialog.FileName = Common.StripExtensionFileName(currentFileName) + ".xml"; if (!useTmpFile) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { targetFilename = saveFileDialog.FileName; } else { return(null); } } else { targetFilename = saveFileDialog.FileName + ".tmp"; } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.XmlResolver = null; xmlDoc.LoadXml(xmlStrings.Header); xmlDoc.DocumentElement.SetAttribute(xmlStrings.Project, docTitleShadow.GetProjectName()); xmlDoc.DocumentElement.SetAttribute(xmlStrings.Client, docTitleShadow.GetClientName()); xmlDoc.DocumentElement.SetAttribute(xmlStrings.LastModified, changeLogShadow.GetLastLogChangeDate()); xmlDoc.DocumentElement.SetAttribute(xmlStrings.Version, changeLogShadow.GetLastChangeVersion()); AddStartElement(xmlDoc, startShadow); List <Shadow> shadowList = PathMaker.LookupAllShadows(); // sorting them here helps the Missed statements in PathRunner come out in order string stateSortOrder = startShadow.GetDefaultSetting(Strings.DefaultSettingsStateSortOrder); if (stateSortOrder.Equals(Strings.StateSortOrderAlphaNumerical)) { shadowList.Sort(Common.StateIdShadowSorterAlphaNumerical); } else if (stateSortOrder.Equals(Strings.StateSortOrderNumericalOnly)) { shadowList.Sort(Common.StateIdShadowSorterNumericalAlpha); } else { Common.StateIdShadowSorterVisioHeuristic(shadowList, visioControl.Document, startShadow); } foreach (Shadow shadow in shadowList) { switch (shadow.GetShapeType()) { case ShapeTypes.Interaction: AddInteractionElement(xmlDoc, shadow as InteractionShadow); break; case ShapeTypes.Play: AddPlayElement(xmlDoc, shadow as PlayShadow); break; case ShapeTypes.Decision: AddDecisionElement(xmlDoc, shadow as DecisionShadow); break; case ShapeTypes.Data: AddDataElement(xmlDoc, shadow as DataShadow); break; case ShapeTypes.SubDialog: AddSubDialogElement(xmlDoc, shadow as SubDialogShadow); break; default: break; } } xmlDoc.Save(targetFilename); return(targetFilename); }
private static void AddStartTables(Document doc, StartShadow startShadow) { Selection content = doc.Application.Selection; // always work bottom of table to top so we can add rows and not move the row starts for later actions content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "GlobalCommands"); doc.Tables[Templates.GlobalCommands].Range.Copy(); content.Paste(); Table table = startShadow.GetConfirmationPrompts(); Microsoft.Office.Interop.Word.Table globalCommandTable = doc.Tables[doc.Tables.Count]; //was doc.Tables.Count - 4 FillConfirmationPromptTable(globalCommandTable, 5, table); table = startShadow.GetCommandTransitions(); FillCommandTransitionTable(globalCommandTable, 2, table); content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "GlobalPrompts"); doc.Tables[Templates.GlobalPromptTypes].Range.Copy(); content.Paste(); table = startShadow.GetPromptTypes(); Microsoft.Office.Interop.Word.Table globalPromptTypesTable = doc.Tables[doc.Tables.Count];//was doc.Tables.Count - 3 FillPromptTypesTable(globalPromptTypesTable, 3, table); content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "DefaultSettings"); doc.Tables[Templates.DefaultSettings].Range.Copy(); content.Paste(); table = startShadow.GetDefaultSettings(); Microsoft.Office.Interop.Word.Table defaultSettingsTable = doc.Tables[doc.Tables.Count];//was doc.Tables.Count - 2 FillNameValuePairs(defaultSettingsTable, 2, table); content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "MaxHandling"); doc.Tables[Templates.GlobalMaxHandler].Range.Copy(); content.Paste(); table = startShadow.GetMaxHandling(); Microsoft.Office.Interop.Word.Table maxHandlingTable = doc.Tables[doc.Tables.Count];//was doc.Tables.Count - 1 FillMaxHandling(maxHandlingTable, 2, table); content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "DialogStatesNextLine"); Shadow firstShadow = startShadow.GetFirstStateGotoTarget(); if (addMSWordMapMarkers) { content.Font.Name = "Arial"; content.Font.Size = 2; content.Font.Color = WdColor.wdColorWhite;//change this to white late to make it more hidden content.TypeText("Start"); content.set_Style(WdBuiltinStyle.wdStyleHeading3); content.TypeParagraph(); content = doc.Application.Selection;//re-read all current content } doc.Tables[Templates.Start].Range.Copy(); content.Bookmarks.Add("bmStart"); content.Paste(); Microsoft.Office.Interop.Word.Table startTable = doc.Tables[doc.Tables.Count]; if (firstShadow != null) { Selection sel = startTable.Cell(3, 1).Application.Selection; sel.InsertAfter(CachedGetGotoName(firstShadow)); sel.set_Style("HyperLink"); string link = "bm" + Left(AlphaNumericCharsOnly(CachedGetGotoName(firstShadow)), 38); sel.Document.Hyperlinks.Add(Anchor: sel.Range, SubAddress: link); sel.set_Style("TableNormalCell"); sel.MoveStart(WdUnits.wdWord, -1); sel.Cut(); Range range = startTable.Cell(3, 1).Range; range.Paste(); } table = startShadow.GetInitialization(); FillNameValueNotesPairs(startTable, 6, table); startTable.Range.ParagraphFormat.KeepTogether = -1; // = true //SetCellBackgroundColorIfNecessary(startTable.Cell(1, 1), startShadow.GetLastChangeDate()); SetCellBackgroundColorIfNecessary(startTable.Cell(1, 1), startShadow.GetLastChangeVersion());//JDK added content.Move(WdUnits.wdStory); content.set_Style("Normal"); content.TypeParagraph(); content.Move(WdUnits.wdStory); }
// Creates a shadow from a shape. Should only be called from PathMaker // event handlers when things are loaded, added, etc. public static Shadow MakeShapeShadow(Shape shape) { ShapeTypes shapeType = Common.GetShapeType(shape); Shadow shadow = null; switch (shapeType) { case ShapeTypes.CallSubDialog: shadow = new CallSubDialogShadow(shape); break; case ShapeTypes.ChangeLog: shadow = new ChangeLogShadow(shape); break; case ShapeTypes.AppDesc: shadow = new AppDescShadow(shape); break; case ShapeTypes.PrefixList: shadow = new PrefixListShadow(shape); break; case ShapeTypes.Comment: shadow = new IgnoredShadow(shape); break; case ShapeTypes.Connector: shadow = new ConnectorShadow(shape); break; case ShapeTypes.Data: shadow = new DataShadow(shape); break; case ShapeTypes.Decision: shadow = new DecisionShadow(shape); break; case ShapeTypes.DocTitle: shadow = new DocTitleShadow(shape); break; case ShapeTypes.HangUp: shadow = new HangUpShadow(shape); break; case ShapeTypes.Interaction: shadow = new InteractionShadow(shape); break; case ShapeTypes.None: break; case ShapeTypes.OffPageRef: shadow = new OffPageRefShadow(shape); break; case ShapeTypes.OnPageRefIn: shadow = new OnPageRefInShadow(shape); break; case ShapeTypes.OnPageRefOut: shadow = new OnPageRefOutShadow(shape); break; case ShapeTypes.Page: break; case ShapeTypes.Placeholder: shadow = new IgnoredShadow(shape); break; case ShapeTypes.Play: shadow = new PlayShadow(shape); break; case ShapeTypes.Return: shadow = new ReturnShadow(shape); break; case ShapeTypes.Start: shadow = new StartShadow(shape); break; case ShapeTypes.SubDialog: shadow = new SubDialogShadow(shape); break; case ShapeTypes.Transfer: shadow = new TransferShadow(shape); break; } return(shadow); }
public static void StateIdShadowSorterVisioPageGrouping(List <Shadow> shadowList, Document doc, StartShadow startShadow) { // Try to create a group of states per Visio page then // sort alphanumerically so the printing order matches the pages //string firstPrefix = String.Empty; //Shadow firstShadow = startShadow.GetFirstStateGotoTarget(); //if (firstShadow != null) //{ //StateShadow firstState = firstShadow as StateShadow; //string firstNumber, firstName; //StateShadow.DisectStateIdIntoParts(firstState.GetStateId(), out firstPrefix, out firstNumber, out firstName); //} // make a list of first page references of each alpha prefix stateToPageReference = new Dictionary <string, int>(); foreach (Shadow s in shadowList) { StateShadow sState = s as StateShadow; if (sState == null) { continue; } //int firstPageNumber; int pageNumber = s.GetPageNumber(); string statePrefix, stateNumber, stateName; StateShadow.DisectStateIdIntoParts(sState.GetStateId(), out statePrefix, out stateNumber, out stateName); // always make this highest priority //if (sState.GetStateId().Equals(firstState.GetStateId())) //firstPageNumber = pageNumber; int earliest; if (stateToPageReference.TryGetValue(statePrefix + stateNumber, out earliest)) { if (pageNumber < earliest) { stateToPageReference[statePrefix + stateNumber] = pageNumber; } } else { stateToPageReference.Add(statePrefix + stateNumber, pageNumber); } } shadowList.Sort(StateIdShadowSorterVisioPageGroupHelper); }
public static void StateIdShadowSorterVisioHeuristic(List <Shadow> shadowList, Document doc, StartShadow startShadow) { // group by alpha prefix, then by number within that // then sort groups by first visio page reference // if both on same page, startPrefix is first, the sort alphanumerically string firstPrefix = String.Empty; Shadow firstShadow = startShadow.GetFirstStateGotoTarget(); if (firstShadow != null) { StateShadow firstState = firstShadow as StateShadow; string firstNumber, firstName; StateShadow.DisectStateIdIntoParts(firstState.GetStateId(), out firstPrefix, out firstNumber, out firstName); } // make a list of first page references of each alpha prefix earliestPageReference = new Dictionary <string, int>(); foreach (Shadow s in shadowList) { StateShadow sState = s as StateShadow; if (sState == null) { continue; } int pageNumber = s.GetPageNumber(); string statePrefix, stateNumber, stateName; StateShadow.DisectStateIdIntoParts(sState.GetStateId(), out statePrefix, out stateNumber, out stateName); // always make this highest priority if (statePrefix.Equals(firstPrefix)) { pageNumber = -1; } int earliest; if (earliestPageReference.TryGetValue(statePrefix, out earliest)) { if (pageNumber < earliest) { earliestPageReference[statePrefix] = pageNumber; } } else { earliestPageReference.Add(statePrefix, pageNumber); } } shadowList.Sort(StateIdShadowSorterVisioHeuristicHelper); }
void OnShapeAdd(Shape shape) { ShapeTypes type = Common.GetShapeType(shape); bool is1D = shape.OneD != 0; // Tricky - when pasting, Visio gives out new uids to the shapes if there are duplicates // in this document. So, we are going to stash the original ones - unless we are pasting. // If we are pasting, the paste end will fix the ones that were added. if (!visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditPaste) && !visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditDuplicate)) { string uid = shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID); string cached = Common.GetCellString(shape, Strings.CutCopyPasteTempCellName); // when undoing a delete page, you can't write this yet so this check will ignore it if (!uid.Equals(cached)) { Common.SetCellString(shape, Strings.CutCopyPasteTempCellName, uid); } } else if (Common.GetShapeType(shape) == ShapeTypes.OffPageRef) { Common.ErrorMessage("Pasted off-page reference needs to be connected. Double click on it to repair."); // Because these can be cut and pasted from a single document, clearing these fields // allows us to avoid having more than one off page connector pointing to a single other one // which causes issues with tracking things in the shadows. This way here, double clicking // on the connector will ask which page to connect it to. Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationPageID, ""); Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationShapeID, ""); } if (type == ShapeTypes.None && is1D) { // rogue connector - need to make it conform Common.SetCellString(shape, ShapeProperties.ShapeType, ((int)ShapeTypes.Connector).ToString()); shape.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowLine, (short)VisCellIndices.visLineEndArrow).FormulaU = "13"; shape.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowLine, (short)VisCellIndices.visLineRounding).FormulaU = "0.25 in"; shape.get_CellsSRC((short)VisSectionIndices.visSectionObject, (short)VisRowIndices.visRowLock, (short)VisCellIndices.visLockTextEdit).FormulaU = "1"; // just in case Common.FixConnectorTextControl(shape); // make every row in the shape data section invisible short row = (short)VisRowIndices.visRowFirst; while (shape.get_CellsSRCExists((short)VisSectionIndices.visSectionProp, row, (short)VisCellIndices.visCustPropsInvis, (short)VisExistsFlags.visExistsAnywhere) != 0) { shape.get_CellsSRC((short)VisSectionIndices.visSectionProp, row++, (short)VisCellIndices.visCustPropsInvis).FormulaU = "TRUE"; } } // when a shape is copied and pasted, it will be an exact copy of the previous shape // we need fix the duplicate name issue before we do anything else string oldPastedStateName = String.Empty; if (visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditPaste) || visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditDuplicate)) { string stateId = Common.GetCellString(shape, ShapeProperties.StateId); if (stateId.Length > 0) { if (!StatePrefixAndNumberManager.IsStateIdOkayForUse(stateId)) { oldPastedStateName = stateId; // NEVER, NEVER do this without going through the shadow except here, before the shadow is made Common.SetCellString(shape, ShapeProperties.StateId, String.Empty); } } } Shadow shadow = Common.MakeShapeShadow(shape); if (shadow != null) { // if we have a pasted name that conflicted, this will reuse the name portion // but get us a new prefix and number and then renumber any prompts if (oldPastedStateName.Length > 0) { string prefix, number, name; StateShadow.DisectStateIdIntoParts(oldPastedStateName, out prefix, out number, out name); shape.Text = StateShadow.StateIdForDisplay(name).Trim(); // this just pretends we just typed the name portion into the shape itself shadow.OnShapeExitTextEdit(); // and now let's renumber any prompts if we're not using the "number" option List <Shadow> shadowList = LookupShadowsByShapeType(ShapeTypes.Start); if (shadowList.Count > 0) { StartShadow startShadow = shadowList[0] as StartShadow; string promptIdFormat = startShadow.GetDefaultSetting(Strings.DefaultSettingsPromptIDFormat); if (promptIdFormat.Equals(Strings.PromptIdFormatFull) || promptIdFormat.Equals(Strings.PromptIdFormatPartial)) { StateShadow stateShadow = shadow as StateShadow; if (stateShadow != null) { stateShadow.RedoPromptIds(0, promptIdFormat); } } } } shadowShapeMap.Add(shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID), shadow); shadow.OnShapeAdd(); if (shadow.GetShapeType() == ShapeTypes.DocTitle || shadow.GetShapeType() == ShapeTypes.ChangeLog || shadow.GetShapeType() == ShapeTypes.AppDesc || shadow.GetShapeType() == ShapeTypes.PrefixList || shadow.GetShapeType() == ShapeTypes.Start) { if (LookupShadowsByShapeType(shadow.GetShapeType()).Count > 1) { Common.ErrorMessage("Cannot have two Start, Change Log, or Document Title, App Description or Prefix List shapes"); Common.ForcedSetShapeText(shape, Strings.ToBeDeletedLabel); } } } else { Common.ErrorMessage("Invalid non-PathMaker shape added"); try { Common.ForcedSetShapeText(shape, Strings.ToBeDeletedLabel); } catch { // it may be a shape with two subshapes (play/interaction) so try this too try { Common.ForcedSetShapeText(shape.Shapes[0], Strings.ToBeDeletedLabel); } catch { // copying from non-PathMaker visios can cause this to fail depending on shape sheets, locks, etc. // We did our best - we can ignore these } } } }
public DialogResult ShowDialog(StartShadow shadow) { this.shadow = shadow; return ShowDialog(); }
public DialogResult ShowDialog(StartShadow shadow) { this.shadow = shadow; return(ShowDialog()); }