Exemplo n.º 1
0
        // returns true if something was changed
        internal override bool RemoveGotosThatDontUseConnectors(string uidBeingRemoved)
        {
            Table table   = GetMaxHandling();
            bool  changed = false;

            if (!table.IsEmpty())
            {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    if (table.GetData(r, (int)TableColumns.MaxHandling.Goto).Equals(uidBeingRemoved))
                    {
                        table.SetData(r, (int)TableColumns.MaxHandling.Goto, Strings.HangUpKeyword);
                        //table.SetData(r, (int)TableColumns.MaxHandling.GotoDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                        table.SetData(r, (int)TableColumns.MaxHandling.GotoDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added

                        changed = true;
                    }
                }

                if (changed)
                {
                    SetMaxHandling(table);
                }
            }

            table = GetCommandTransitions();

            if (!table.IsEmpty())
            {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    if (table.GetData(r, (int)TableColumns.CommandTransitions.Goto).Equals(uidBeingRemoved))
                    {
                        table.SetData(r, (int)TableColumns.CommandTransitions.Goto, Strings.HangUpKeyword);
                        //table.SetData(r, (int)TableColumns.CommandTransitions.GotoDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                        table.SetData(r, (int)TableColumns.CommandTransitions.GotoDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added

                        changed = true;
                    }
                }

                if (changed)
                {
                    SetCommandTransitions(table);
                }
            }

            return(changed);
        }
Exemplo n.º 2
0
        private static void AddTransitions(StateWithTransitionShadow shadow, XmlElement parentElement)
        {
            Table table = shadow.GetTransitions();

            if (table.IsEmpty())
            {
                return;
            }

            XmlElement transitionListElement = CreateElement(parentElement, xmlStrings.TransitionList);

            for (int r = 0; r < table.GetNumRows(); r++)
            {
                XmlElement transitionElement = CreateElement(transitionListElement, xmlStrings.Transition);
                XmlElement conditionElement  = CreateElement(transitionElement, xmlStrings.Condition);
                XmlElement actionElement     = CreateElement(transitionElement, xmlStrings.Action);
                XmlElement gotoElement       = CreateElement(transitionElement, xmlStrings.Goto);

                conditionElement.InnerText = table.GetData(r, (int)TableColumns.Transitions.Condition);
                conditionElement.SetAttribute(xmlStrings.Level, "0");
                actionElement.InnerText = table.GetData(r, (int)TableColumns.Transitions.Action);
                string gotoString = table.GetData(r, (int)TableColumns.Transitions.Goto);
                gotoString            = GetXmlGotoFromData(gotoString);
                gotoElement.InnerText = gotoString;
            }
        }
Exemplo n.º 3
0
        // parent could be an Interaction or a Start element
        private static void AddPromptTypes(Table table, XmlElement parentElement)
        {
            if (table.IsEmpty())
            {
                return;
            }

            XmlElement promptTypeListElement = CreateElement(parentElement, xmlStrings.PromptTypeList);

            for (int r = 0; r < table.GetNumRows(); r++)
            {
                XmlElement promptTypeElement = CreateElement(promptTypeListElement, xmlStrings.PromptType);
                XmlElement typeElement       = CreateElement(promptTypeElement, xmlStrings.Type);
                XmlElement promptListElement = CreateElement(promptTypeElement, xmlStrings.PromptList);
                XmlElement promptElement     = CreateElement(promptListElement, xmlStrings.Prompt);
                XmlElement conditionElement  = CreateElement(promptElement, xmlStrings.Condition);
                XmlElement wordingElement    = CreateElement(promptElement, xmlStrings.Wording);
                XmlElement promptIdElement   = CreateElement(promptElement, xmlStrings.PromptId);

                string type = table.GetData(r, (int)TableColumns.PromptTypes.Type);
                typeElement.InnerText = type;

                string condition = table.GetData(r, (int)TableColumns.PromptTypes.Condition);
                int    level     = Common.GetConditionLevel(condition);
                condition = condition.Replace(Strings.IndentCharacterString, "");
                CreateCDataSection(conditionElement, condition);
                conditionElement.SetAttribute(xmlStrings.Level, level.ToString());

                string wording = Common.StripBracketLabels(table.GetData(r, (int)TableColumns.PromptTypes.Wording));
                CreateCDataSection(wordingElement, wording);

                string promptId = table.GetData(r, (int)TableColumns.PromptTypes.Id);
                promptIdElement.InnerText = promptId;
            }
        }
Exemplo n.º 4
0
        internal static bool DoVersion6Upgrade(Object arg, ProgressBarForm progressBarForm)
        {
            // Added State Sort Order to DefaultSettings
            Document document = arg as Document;

            int total = 0;

            foreach (Page page in document.Pages)
            {
                total += page.Shapes.Count;
            }

            int count = 0;

            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    if (Common.GetShapeType(shape) == ShapeTypes.Start)
                    {
                        Table table = Common.GetCellTable(shape, ShapeProperties.Start.DefaultSettings);
                        if (!table.IsEmpty())
                        {
                            int row = table.AddRow();
                            table.SetData(row, (int)TableColumns.NameValuePairs.Name, Strings.DefaultSettingsStateSortOrder);
                            table.SetData(row, (int)TableColumns.NameValuePairs.Value, Strings.StateSortOrderAlphaNumerical);
                            Common.SetCellTable(shape, ShapeProperties.Start.DefaultSettings, table);
                        }
                    }
                    count++;
                }
                progressBarForm.SetProgressPercentage(count, total);
            }
            return(true);
        }
Exemplo n.º 5
0
        private static void SwapRowsInCellTable(Shape shape, string cellName, int row1, int row2)
        {
            Table table = Common.GetCellTable(shape, cellName);

            if (!table.IsEmpty())
            {
                table.SwapRows(row1, row2);
                Common.SetCellTable(shape, cellName, table);
            }
        }
Exemplo n.º 6
0
        private static void SwapColumnsInCellTable(Shape shape, string cellName, int col1, int col2)
        {
            Table table = Common.GetCellTable(shape, cellName);

            if (!table.IsEmpty())
            {
                table.SwapColumns(col1, col2);
                Common.SetCellTable(shape, cellName, table);
            }
        }
Exemplo n.º 7
0
        private static void RemoveColumnsFromCellTable(Shape shape, string cellName, int[] columns)
        {
            Table table = Common.GetCellTable(shape, cellName);

            if (!table.IsEmpty())
            {
                table.DeleteColumns(columns);
                Common.SetCellTable(shape, cellName, table);
            }
        }
Exemplo n.º 8
0
        internal string GetFirstChangeVersion()
        {
            Table table = GetChangeLog();

            if (table.IsEmpty())
            {
                return(string.Empty);
            }
            return(table.GetData(0, (int)TableColumns.ChangeLog.Version));
        }
Exemplo n.º 9
0
        public string GetLastLogChangeDate()
        {
            Table table = GetChangeLog();

            if (table.IsEmpty())
            {
                return(string.Empty);
            }
            return(table.GetData(table.GetNumRows() - 1, (int)TableColumns.ChangeLog.Date));
        }
Exemplo n.º 10
0
        private static void AddDeveloperNotes(Table table, XmlElement stateElement)
        {
            if (table.IsEmpty())
            {
                return;
            }

            XmlElement developerNotesElement = CreateElement(stateElement, xmlStrings.DeveloperNotes);

            developerNotesElement.InnerText = table.GetData(0, (int)TableColumns.DeveloperNotes.Text);
        }
Exemplo n.º 11
0
        private static void AddSpecialSettings(Table table, XmlElement stateElement)
        {
            if (table.IsEmpty())
            {
                return;
            }

            XmlElement specialSettingsElement = CreateElement(stateElement, xmlStrings.SpecialSettings);

            specialSettingsElement.InnerText = table.GetData(0, (int)TableColumns.SpecialSettings.Text);
        }
Exemplo n.º 12
0
        private static void EnsureTwoColumns(Shape shape, string cellName)
        {
            Table table = Common.GetCellTable(shape, cellName);

            if (!table.IsEmpty())
            {
                while (table.GetNumColumns() < 2)
                {
                    table.AddColumn();
                }
                Common.SetCellTable(shape, cellName, table);
            }
        }
Exemplo n.º 13
0
        public DateTime GetLastChangeDate()
        {
            Table    table = GetChangeLog();
            DateTime tempDateTime;

            if (table.IsEmpty())
            {
                return(new DateTime(1965, 4, 1));
            }

            DateTime.TryParse(table.GetData(table.GetNumRows() - 1, (int)TableColumns.ChangeLog.Date), out tempDateTime);
            return(tempDateTime);
        }
Exemplo n.º 14
0
 internal static void LoadDesignNotesTextBox(TextBox textBox, Table table)
 {
     if (!table.IsEmpty())
     {
         textBox.Text = table.GetData(0, (int)TableColumns.DesignNotes.Text);
     }
     else
     {
         textBox.Text = string.Empty;
     }
     textBox.KeyDown -= new KeyEventHandler(OnTextBoxKeyDownForEditorHotKey);
     textBox.KeyDown += new KeyEventHandler(OnTextBoxKeyDownForEditorHotKey);
 }
Exemplo n.º 15
0
        internal void SetSpecialSettings(Table table)
        {
            Table tmp = GetSpecialSettings();

            if ((table.GetData(0, 0) == null || table.GetData(0, 0).Length == 0) && tmp.IsEmpty())
            {
                return;
            }

            if (tmp.IsEmpty())
            {
                //table.SetData(0, (int)TableColumns.SpecialSettings.TextDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                table.SetData(0, (int)TableColumns.SpecialSettings.TextDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added

                Common.SetCellTable(shape, ShapeProperties.Play.SpecialSettings, table);
            }
            else if (!tmp.GetData(0, (int)TableColumns.SpecialSettings.Text).Equals(table.GetData(0, (int)TableColumns.SpecialSettings.Text)))
            {
                //table.SetData(0, (int)TableColumns.SpecialSettings.TextDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                table.SetData(0, (int)TableColumns.SpecialSettings.TextDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added

                Common.SetCellTable(shape, ShapeProperties.Play.SpecialSettings, table);
            }
        }
Exemplo n.º 16
0
        internal Table GetMaxHandling()
        {
            Table table = Common.GetCellTable(shape, ShapeProperties.Start.MaxHandling);

            if (table.IsEmpty())
            {
                table = new Table(CommonShadow.MaxHandlingConditions.Length, Enum.GetNames(typeof(TableColumns.MaxHandling)).Length);
                for (int row = 0; row < CommonShadow.MaxHandlingConditions.Length; row++)
                {
                    table.SetData(row, (int)TableColumns.MaxHandling.Condition, CommonShadow.MaxHandlingConditions[row]);
                    table.SetData(row, (int)TableColumns.MaxHandling.Count, CommonShadow.MaxHandlingDefaultCounts[row]);
                    table.SetData(row, (int)TableColumns.MaxHandling.Goto, CommonShadow.MaxHandlingDefaultGotos[row]);
                }
            }
            return(table);
        }
Exemplo n.º 17
0
        // parent could be an Interaction or a Start element
        private static void AddCommandTransitions(Shadow shadow, Table table, XmlElement parentElement)
        {
            if (table.IsEmpty())
            {
                return;
            }

            XmlElement commandListElement = CreateElement(parentElement, xmlStrings.CommandList);

            for (int r = 0; r < table.GetNumRows(); r++)
            {
                XmlElement commandElement    = CreateElement(commandListElement, xmlStrings.Command);
                XmlElement optionElement     = CreateElement(commandElement, xmlStrings.Option);
                XmlElement vocabularyElement = CreateElement(commandElement, xmlStrings.Vocabulary);
                XmlElement dtmfElement       = CreateElement(commandElement, xmlStrings.DTMF);
                XmlElement conditionElement  = CreateElement(commandElement, xmlStrings.Condition);
                XmlElement actionElement     = CreateElement(commandElement, xmlStrings.Action);
                XmlElement gotoElement       = CreateElement(commandElement, xmlStrings.Goto);

                optionElement.InnerText = table.GetData(r, (int)TableColumns.CommandTransitions.Option);

                string confirm = table.GetData(r, (int)TableColumns.CommandTransitions.Confirm);
                if (confirm.Equals(Strings.ConfirmAlways))
                {
                    commandElement.SetAttribute(xmlStrings.Confirm, xmlStrings.ConfirmAlways);
                }
                else if (confirm.Equals(Strings.ConfirmIfNecessary))
                {
                    commandElement.SetAttribute(xmlStrings.Confirm, xmlStrings.ConfirmIfNecessary);
                }
                else
                {
                    commandElement.SetAttribute(xmlStrings.Confirm, xmlStrings.ConfirmNever);
                }

                dtmfElement.InnerText       = table.GetData(r, (int)TableColumns.CommandTransitions.DTMF);
                vocabularyElement.InnerText = table.GetData(r, (int)TableColumns.CommandTransitions.Vocab);
                conditionElement.InnerText  = table.GetData(r, (int)TableColumns.CommandTransitions.Condition);
                conditionElement.SetAttribute(xmlStrings.Level, "0");
                actionElement.InnerText = table.GetData(r, (int)TableColumns.CommandTransitions.Action);
                string gotoString = table.GetData(r, (int)TableColumns.CommandTransitions.Goto);
                gotoString            = GetXmlGotoFromData(gotoString);
                gotoElement.InnerText = gotoString;
            }
        }
Exemplo n.º 18
0
        /**
         * Utility method to build an array of valid versions in the current revTable returns the array
         */
        internal String GetValidVersionString(Table currentRevTable, String targetVersionMarker)
        {
            String validVersionString = "0.0";
            String tempVersionString;

            if (!currentRevTable.IsEmpty())
            {
                for (int i = 0; i < currentRevTable.GetNumRows(); i++)
                {
                    tempVersionString = currentRevTable.GetData(i, (int)TableColumns.ChangeLog.Version);
                    if (tempVersionString.Trim() == targetVersionMarker.Trim())
                    {
                        validVersionString = targetVersionMarker;
                        return(validVersionString);
                    }
                }
            }
            return(validVersionString);
        }
Exemplo n.º 19
0
        internal Table GetDefaultSettings()
        {
            Table table = Common.GetCellTable(shape, ShapeProperties.Start.DefaultSettings);

            if (table.IsEmpty())
            {
                table = new Table(DefaultSettingsLabels.Length, Enum.GetNames(typeof(TableColumns.NameValuePairs)).Length);
                for (int row = 0; row < DefaultSettingsLabels.Length; row++)
                {
                    table.SetData(row, (int)TableColumns.NameValuePairs.Name, DefaultSettingsLabels[row]);
                    table.SetData(row, (int)TableColumns.NameValuePairs.Value, DefaultSettingsValues[row]);
                    table.SetData(row, (int)TableColumns.NameValuePairs.Notes, DefaultSettingsValues[row]);

                    table.SetData(row, (int)TableColumns.NameValuePairs.NameDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());
                    table.SetData(row, (int)TableColumns.NameValuePairs.ValueDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());
                    table.SetData(row, (int)TableColumns.NameValuePairs.NotesDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());
                }
            }
            return(table);
        }
Exemplo n.º 20
0
        public override void OnConnectAddOutput(Shadow shadow)
        {
            base.OnConnectAddOutput(shadow);
            Table table = GetTransitions();

            // make sure it's not already in there - this can happen with undo/redo
            for (int r = 0; r < table.GetNumRows(); r++)
            {
                if (table.GetData(r, (int)TableColumns.Transitions.Goto).Equals(shadow.GetUniqueId()))
                {
                    return;
                }
            }

            if (table.IsEmpty())
            {
                table = new Table(1, Enum.GetNames(typeof(TableColumns.Transitions)).Length);
            }
            else
            {
                table.AddRow();
            }

            ConnectorShadow connector = shadow as ConnectorShadow;

            if (connector != null)
            {
                string label = connector.GetLabelName();
                if (label.Length > 0)
                {
                    table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.Condition, CommonShadow.GetStringWithNewConnectorLabel("", label));
                    //table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.ConditionDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString));
                    table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.ConditionDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());
                }
            }

            table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.Goto, shadow.GetUniqueId());
            //table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString));
            table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());
            SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
        // parent could be an Interaction or a Start element
        private static void AddMaxHandling(Shadow shadow, Table table, XmlElement parentElement)
        {
            if (table.IsEmpty())
            {
                return;
            }

            XmlElement maxHandlingElement = CreateElement(parentElement, xmlStrings.MaxHandling);

            for (int r = 0; r < 4; r++)
            {
                XmlElement rowElement    = CreateElement(maxHandlingElement, xmlStrings.MaxHandlingRows[r]);
                XmlElement countElement  = CreateElement(rowElement, xmlStrings.Count);
                XmlElement actionElement = CreateElement(rowElement, xmlStrings.Action);
                XmlElement gotoElement   = CreateElement(rowElement, xmlStrings.Goto);

                countElement.InnerText  = table.GetData(r, (int)TableColumns.MaxHandling.Count);
                actionElement.InnerText = table.GetData(r, (int)TableColumns.MaxHandling.Action);
                string gotoString = table.GetData(r, (int)TableColumns.MaxHandling.Goto);
                gotoString            = GetXmlGotoFromData(gotoString);
                gotoElement.InnerText = gotoString;
            }
        }
Exemplo n.º 23
0
        // changes fields which are A$$B to be A
        private static void FixDollarDollarTableFields(Shape shape, string cellName)
        {
            const string dataSeparator = "$$";

            Table table = Common.GetCellTable(shape, cellName);

            if (!table.IsEmpty())
            {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    for (int c = 0; c < table.GetNumColumns(); c++)
                    {
                        string data = table.GetData(r, c);
                        if (data.Contains(dataSeparator))
                        {
                            data = data.Substring(0, data.IndexOf(dataSeparator));
                            table.SetData(r, c, data);
                        }
                    }
                }
                Common.SetCellTable(shape, cellName, table);
            }
        }
Exemplo n.º 24
0
        // parent could be an Interaction or a Start element
        private static void AddCommandTransitions(Shadow shadow, Table table, XmlElement parentElement)
        {
            if (table.IsEmpty())
                return;

            XmlElement commandListElement = CreateElement(parentElement, xmlStrings.CommandList);

            for (int r = 0; r < table.GetNumRows(); r++) {
                XmlElement commandElement = CreateElement(commandListElement, xmlStrings.Command);
                XmlElement optionElement = CreateElement(commandElement, xmlStrings.Option);
                XmlElement vocabularyElement = CreateElement(commandElement, xmlStrings.Vocabulary);
                XmlElement dtmfElement = CreateElement(commandElement, xmlStrings.DTMF);
                XmlElement conditionElement = CreateElement(commandElement, xmlStrings.Condition);
                XmlElement actionElement = CreateElement(commandElement, xmlStrings.Action);
                XmlElement gotoElement = CreateElement(commandElement, xmlStrings.Goto);

                optionElement.InnerText = table.GetData(r, (int)TableColumns.CommandTransitions.Option);

                string confirm = table.GetData(r, (int)TableColumns.CommandTransitions.Confirm);
                if (confirm.Equals(Strings.ConfirmAlways))
                    commandElement.SetAttribute(xmlStrings.Confirm, xmlStrings.ConfirmAlways);
                else if (confirm.Equals(Strings.ConfirmIfNecessary))
                    commandElement.SetAttribute(xmlStrings.Confirm, xmlStrings.ConfirmIfNecessary);
                else
                    commandElement.SetAttribute(xmlStrings.Confirm, xmlStrings.ConfirmNever);

                dtmfElement.InnerText = table.GetData(r, (int)TableColumns.CommandTransitions.DTMF);
                vocabularyElement.InnerText = table.GetData(r, (int)TableColumns.CommandTransitions.Vocab);
                conditionElement.InnerText = table.GetData(r, (int)TableColumns.CommandTransitions.Condition);
                conditionElement.SetAttribute(xmlStrings.Level, "0");
                actionElement.InnerText = table.GetData(r, (int)TableColumns.CommandTransitions.Action);
                string gotoString = table.GetData(r, (int)TableColumns.CommandTransitions.Goto);
                gotoString = GetXmlGotoFromData(gotoString);
                gotoElement.InnerText = gotoString;
            }
        }
Exemplo n.º 25
0
        private static void AddDeveloperNotes(Table table, XmlElement stateElement)
        {
            if (table.IsEmpty())
                return;

            XmlElement developerNotesElement = CreateElement(stateElement, xmlStrings.DeveloperNotes);
            developerNotesElement.InnerText = table.GetData(0, (int)TableColumns.DeveloperNotes.Text);
        }
Exemplo n.º 26
0
        // parent could be an Interaction or a Start element
        private static void AddMaxHandling(Shadow shadow, Table table, XmlElement parentElement)
        {
            if (table.IsEmpty())
                return;

            XmlElement maxHandlingElement = CreateElement(parentElement, xmlStrings.MaxHandling);

            for (int r = 0; r < 4; r++) {
                XmlElement rowElement = CreateElement(maxHandlingElement, xmlStrings.MaxHandlingRows[r]);
                XmlElement countElement = CreateElement(rowElement, xmlStrings.Count);
                XmlElement actionElement = CreateElement(rowElement, xmlStrings.Action);
                XmlElement gotoElement = CreateElement(rowElement, xmlStrings.Goto);

                countElement.InnerText = table.GetData(r, (int)TableColumns.MaxHandling.Count);
                actionElement.InnerText = table.GetData(r, (int)TableColumns.MaxHandling.Action);
                string gotoString = table.GetData(r, (int)TableColumns.MaxHandling.Goto);
                gotoString = GetXmlGotoFromData(gotoString);
                gotoElement.InnerText = gotoString;
            }
        }
Exemplo n.º 27
0
        // parent could be an Interaction or a Start element
        private static void AddPromptTypes(Table table, XmlElement parentElement)
        {
            if (table.IsEmpty())
                return;

            XmlElement promptTypeListElement = CreateElement(parentElement, xmlStrings.PromptTypeList);

            for (int r = 0; r < table.GetNumRows(); r++) {
                XmlElement promptTypeElement = CreateElement(promptTypeListElement, xmlStrings.PromptType);
                XmlElement typeElement = CreateElement(promptTypeElement, xmlStrings.Type);
                XmlElement promptListElement = CreateElement(promptTypeElement, xmlStrings.PromptList);
                XmlElement promptElement = CreateElement(promptListElement, xmlStrings.Prompt);
                XmlElement conditionElement = CreateElement(promptElement, xmlStrings.Condition);
                XmlElement wordingElement = CreateElement(promptElement, xmlStrings.Wording);
                XmlElement promptIdElement = CreateElement(promptElement, xmlStrings.PromptId);

                string type = table.GetData(r, (int)TableColumns.PromptTypes.Type);
                typeElement.InnerText = type;

                string condition = table.GetData(r, (int)TableColumns.PromptTypes.Condition);
                int level = Common.GetConditionLevel(condition);
                condition = condition.Replace(Strings.IndentCharacterString, "");
                CreateCDataSection(conditionElement, condition);
                conditionElement.SetAttribute(xmlStrings.Level, level.ToString());

                string wording = Common.StripBracketLabels(table.GetData(r, (int)TableColumns.PromptTypes.Wording));
                CreateCDataSection(wordingElement, wording);

                string promptId = table.GetData(r, (int)TableColumns.PromptTypes.Id);
                promptIdElement.InnerText = promptId;
            }
        }
Exemplo n.º 28
0
        private static void AddSpecialSettings(Table table, XmlElement stateElement)
        {
            if (table.IsEmpty())
                return;

            XmlElement specialSettingsElement = CreateElement(stateElement, xmlStrings.SpecialSettings);
            specialSettingsElement.InnerText = table.GetData(0, (int)TableColumns.SpecialSettings.Text);
        }
Exemplo n.º 29
0
        // Changes AA1000_FooBar to the UID for that state for all rows in a table cell
        private static void ReplaceStateIdsWithUniqueIds(Shape shape, Dictionary <string, List <string> > uniqueIdMap, string cellName, int column)
        {
            Table table = Common.GetCellTable(shape, cellName);

            if (!table.IsEmpty())
            {
                bool needsToBeRepaired   = false;
                bool allNeedToBeRepaired = true;
                for (int i = 0; i < table.GetNumRows(); i++)
                {
                    string gotoShapeName = table.GetData(i, column);
                    string uniqueId      = TranslateGotoToUniqueIdForShapeOrKeyword(shape, gotoShapeName, uniqueIdMap, Common.MakeLabelName(table.GetData(i, 0)));
                    if (uniqueId != null)
                    {
                        if (uniqueId.Equals(NeedsToBeRepairedString))
                        {
                            needsToBeRepaired = true;
                        }
                        else
                        {
                            allNeedToBeRepaired = false;
                        }
                        table.SetData(i, column, uniqueId);
                    }
                }

                if (needsToBeRepaired)
                {
                    // First, see if the label in the first column matches the label on an outbound connector
                    List <Connect> connectList = new List <Connect>();

                    foreach (Connect c in shape.FromConnects)
                    {
                        // determine which end of the connector is connected to the nonConnectorShadow
                        bool arrowSide = false;
                        if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName))
                        {
                            arrowSide = true;
                        }

                        // if we are on the non-arrow side of the connector, that means this is an output connector
                        if (!arrowSide)
                        {
                            connectList.Add(c);  // the c.FromSheet will be the connector shape
                        }
                    }

                    // if they are already in use, remove them from the list
                    for (int i = 0; i < table.GetNumRows(); i++)
                    {
                        string uid = table.GetData(i, column);
                        for (int j = connectList.Count - 1; j >= 0; j--)
                        {
                            Connect c = connectList[j];
                            if (uid.Equals(c.FromSheet.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID)))
                            {
                                connectList.Remove(c);
                            }
                        }
                    }

                    // make sure we don't have two links from the same state with the same label which are both needing repair
                    // very, very remote - but I wouldn't want to have to figure this out after the fact - stop it here
                    List <string> checkList = new List <string>();
                    for (int i = 0; i < table.GetNumRows(); i++)
                    {
                        if (table.GetData(i, column).Equals(NeedsToBeRepairedString))
                        {
                            string label = Common.MakeLabelName(table.GetData(i, 0));
                            if (checkList.Contains(label))
                            {
                                // multiple links messed up with the same label
                                postUpgradeReportString += "Shape " + ShapeDescription(shape) + " has more than one transition with the same label of \"" +
                                                           label + "\". This is a blocking error.  Please go back into CID and make sure all the links coming out of that state have labels. " +
                                                           "Then PathMaker will be able to import it, after which you can put the labels back to the way you want them.\n\n";
                                catastrophicError = true;
                                return;
                            }
                            else
                            {
                                checkList.Add(label);
                            }
                        }
                    }

                    for (int i = table.GetNumRows() - 1; i >= 0; i--)
                    {
                        if (table.GetData(i, column).Equals(NeedsToBeRepairedString))
                        {
                            bool   repaired      = false;
                            string connectorText = Common.MakeLabelName(table.GetData(i, 0)).Trim();

                            foreach (Connect c in connectList)
                            {
                                if (c.FromSheet.Text.Trim().Equals(connectorText))
                                {
                                    table.SetData(i, column, c.FromSheet.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                                    connectList.Remove(c);
                                    repaired = true;
                                    break;
                                }
                            }

                            if (!repaired)
                            {
                                // Something's really messed up - there's a transition and no link...
                                // Sometimes visio renames a connector the same name as a previous but different connector
                                // which means we will have transition A matched up with transition B's connector
                                // Only way to try and fix is mark everything as needing repair and go at it again
                                if (!allNeedToBeRepaired)
                                {
                                    for (int r = 0; r < table.GetNumRows(); r++)
                                    {
                                        table.SetData(r, column, NeedsToBeRepairedString);
                                    }
                                    Common.SetCellTable(shape, cellName, table);
                                    ReplaceStateIdsWithUniqueIds(shape, uniqueIdMap, cellName, column);
                                    return;
                                }
                                else
                                {
                                    postUpgradeReportString += "Trouble upgrading shape " + ShapeDescription(shape) + ". " +
                                                               "Deleting transition " + table.GetData(i, 0) + " without link from " + shape.Text + "." +
                                                               "Please review state to ensure change is correct.\n\n";
                                    table.DeleteRow(i);
                                }
                            }
                        }
                    }
                    if (connectList.Count > 0)
                    {
                        foreach (Connect c in connectList)
                        {
                            postUpgradeReportString += "Trouble upgrading shape " + ShapeDescription(shape) + ". " +
                                                       "Deleting connector " + c.FromSheet.Text.Trim() + " without transition from " + shape.Text + "." +
                                                       "Please review state to ensure change is correct.\n\n";
                            c.FromSheet.Delete();
                        }
                    }
                }

                Common.SetCellTable(shape, cellName, table);
            }
        }
Exemplo n.º 30
0
 internal static void LoadSpecialSettingsTextBox(TextBox textBox, Table table)
 {
     if (!table.IsEmpty())
         textBox.Text = table.GetData(0, (int)TableColumns.SpecialSettings.Text);
     else
         textBox.Text = string.Empty;
     textBox.KeyDown -= new KeyEventHandler(OnTextBoxKeyDownForEditorHotKey);
     textBox.KeyDown += new KeyEventHandler(OnTextBoxKeyDownForEditorHotKey);
 }
 /**
 * Utility method to build an array of valid versions in the current revTable returns the array
 */
 internal String GetValidVersionString(Table currentRevTable, String targetVersionMarker)
 {
     String validVersionString = "0.0";
     String tempVersionString;
     if (!currentRevTable.IsEmpty())
     {
         for (int i = 0; i < currentRevTable.GetNumRows(); i++)
         {
             tempVersionString = currentRevTable.GetData(i, (int)TableColumns.ChangeLog.Version);
             if (tempVersionString.Trim() == targetVersionMarker.Trim())
             {
                 validVersionString = targetVersionMarker;
                 return validVersionString;
             }
         }
     }
     return validVersionString;
 }
Exemplo n.º 32
0
        // tried to do this as a BackgroundWorker - way too slow.  Need to use the ProgressBarForm this way for
        // good performance.
        internal static bool DoVersion1Upgrade(Object arg, ProgressBarForm progressBarForm)
        {
            Document document = arg as Document;

            // these should only ever be used here...
            const string OffPageReferenceShapeName        = "Off-page reference";
            const string DynamicConnectorShapeName        = "Dynamic connector";
            const string OnPageReferenceIncomingShapeName = "On-page reference.Incoming";
            const string OnPageReferenceOutgoingShapeName = "On-page reference.Outgoing";
            const string SubDialogCallShapeName           = "Call Sub-Dialog";
            const string CommentShapeName       = "Comment";
            const string PageShapeName          = "Sheet";
            const string ReturnShapeName        = "Return";
            const string PlaceHolderShapeName   = "Placeholder";
            const string DMTypeCellName         = "Prop.DMType";
            const string DocumentTitleShapeName = "Document Title";
            const string ChangeLogShapeName     = "Change Log";
            const string TransferShapeName      = "Transfer";
            const string TransferShapeName2     = "Terminator";
            const string HangUpShapeName        = "Hang up";

            // most transitions can point to terminals (hangup/transfer/return) but not
            // maxhandlers - so we need a list without terminals to use for maxhandler conversions
            Dictionary <string, List <string> > uniqueIdMap            = new Dictionary <string, List <string> >();
            Dictionary <string, List <string> > uniqueIdMapNoTerminals = new Dictionary <string, List <string> >();

            int total = 0;

            foreach (Page page in document.Pages)
            {
                total += page.Shapes.Count;
            }

            total = total * 4; // add some extra for the stuff done outside of this loop at the end

            int counter = 0;

            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    ShapeTypes shapeType = ShapeTypes.None;

                    progressBarForm.SetProgressPercentage(counter++, total);
                    if (progressBarForm.Cancelled)
                    {
                        return(false);
                    }

                    string dmType = Common.GetCellString(shape, DMTypeCellName);

                    if (dmType.Equals("IA", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Interaction;
                    }
                    else if (dmType.Equals("PP", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Play;
                    }
                    else if (dmType.Equals("DE", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Decision;
                    }
                    else if (dmType.Equals("DR", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Data;
                    }
                    else if (dmType.Equals("SD", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.SubDialog;
                    }
                    else if (dmType.Equals("ST", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Start;
                    }

                    if (shapeType == ShapeTypes.None)
                    {
                        // Figure out what else it could be...
                        if (shape.Name.StartsWith(DocumentTitleShapeName))
                        {
                            shapeType = ShapeTypes.DocTitle;
                        }
                        else if (shape.Name.StartsWith(ChangeLogShapeName))
                        {
                            shapeType = ShapeTypes.ChangeLog;
                        }
                        else if (shape.Name.StartsWith(TransferShapeName) || shape.Name.StartsWith(TransferShapeName2))
                        {
                            shapeType = ShapeTypes.Transfer;
                        }
                        else if (shape.Name.StartsWith(HangUpShapeName))
                        {
                            shapeType = ShapeTypes.HangUp;
                        }
                        else if (shape.Name.StartsWith(OffPageReferenceShapeName))
                        {
                            shapeType = ShapeTypes.OffPageRef;
                        }
                        else if (shape.Name.StartsWith(DynamicConnectorShapeName))
                        {
                            shapeType = ShapeTypes.Connector;
                        }
                        else if (shape.Name.StartsWith(OnPageReferenceIncomingShapeName))
                        {
                            shapeType = ShapeTypes.OnPageRefIn;
                        }
                        else if (shape.Name.StartsWith(OnPageReferenceOutgoingShapeName))
                        {
                            shapeType = ShapeTypes.OnPageRefOut;
                        }
                        else if (shape.Name.StartsWith(SubDialogCallShapeName))
                        {
                            shapeType = ShapeTypes.CallSubDialog;
                        }
                        else if (shape.Name.StartsWith(CommentShapeName))
                        {
                            shapeType = ShapeTypes.Comment;
                        }
                        else if (shape.Name.StartsWith(PageShapeName))
                        {
                            shapeType = ShapeTypes.Page;
                        }
                        else if (shape.Name.StartsWith(ReturnShapeName))
                        {
                            shapeType = ShapeTypes.Return;
                        }
                        else if (shape.Name.StartsWith(PlaceHolderShapeName))
                        {
                            shapeType = ShapeTypes.Placeholder;
                        }
                        else
                        {
                            postUpgradeReportString += "Shape could not be upgraded properly - " + ShapeDescription(shape) + "\n\n";
                            shape.Text = Strings.ToBeDeletedLabel;
                            continue;
                        }
                    }

                    System.Diagnostics.Debug.Assert(shapeType != ShapeTypes.None);

                    // we really don't need to do anything with the page shapes
                    // this also includes the rectangles drawn for revision history
                    if (shapeType == ShapeTypes.Page)
                    {
                        continue;
                    }

                    // remove the action properties on all shapes
                    RemoveRightMouseAction(shape, "P&roperties");

                    // and fix the actions for the ones we care about
                    if (shapeType != ShapeTypes.OffPageRef && shapeType != ShapeTypes.HangUp &&
                        shapeType != ShapeTypes.OnPageRefIn && shapeType != ShapeTypes.OnPageRefOut &&
                        shapeType != ShapeTypes.Return && shapeType != ShapeTypes.Transfer &&
                        shapeType != ShapeTypes.Comment && shapeType != ShapeTypes.Placeholder &&
                        shapeType != ShapeTypes.Connector)
                    {
                        AddRightMouseAction(shape, "P&roperties", "RUNADDONWARGS(\"QueueMarkerEvent\",\"/PathMaker /CMD=2\")",
                                            true, false, false, false);
                    }

                    // delete old rows no longer used
                    DeleteOldPropertyCell(shape, "Prop.TestPlanSetting");
                    DeleteOldPropertyCell(shape, "Prop.CheckPoints");
                    DeleteOldPropertyCell(shape, "Prop.UpdateData");
                    DeleteOldPropertyCell(shape, "Prop.LineName");
                    DeleteOldPropertyCell(shape, "Prop.Input");
                    DeleteOldPropertyCell(shape, "Prop.Output");
                    DeleteOldPropertyCell(shape, "Prop.OSDM");
                    DeleteOldPropertyCell(shape, "Prop.Destination");
                    DeleteOldPropertyCell(shape, "Prop.ColumnData");
                    DeleteOldPropertyCell(shape, "Prop.EnteringFrom");
                    DeleteOldPropertyCell(shape, "Prop.StartingDialogState");
                    DeleteOldPropertyCell(shape, "Prop.StartingDM");
                    DeleteOldPropertyCell(shape, "Prop.ChangeDate");
                    DeleteOldPropertyCell(shape, "Prop.InitialDate");
                    DeleteOldPropertyCell(shape, "Prop.LogoFilePath");
                    DeleteOldPropertyCell(shape, "Prop.LastUpdate");

                    if (shapeType == ShapeTypes.CallSubDialog)
                    {
                        // none of these are used...
                        DeleteOldPropertyCell(shape, "Prop.DMName");
                        DeleteOldPropertyCell(shape, "Prop.EnteringFrom");
                        DeleteOldPropertyCell(shape, "Prop.StartingDialogState");
                        DeleteOldPropertyCell(shape, "Prop.Notes");
                        DeleteOldPropertyCell(shape, "Prop.LastUpdate");
                        DeleteOldPropertyCell(shape, "Prop.Transitions");
                    }
                    else if (shapeType == ShapeTypes.SubDialog)
                    {
                        DeleteOldPropertyCell(shape, "Prop.Transitions");
                    }

                    // Add a new cell containing the name of the subdialog being called
                    // Later it will be converted to a UID
                    if (shapeType == ShapeTypes.CallSubDialog)
                    {
                        Common.SetCellString(shape, ShapeProperties.CallSubDialog.SubDialogUID, shape.Text);
                    }

                    // rename rows that are confusing
                    RenameRow(shape, "Prop.DialogParameters", ShapeProperties.SpecialSettings, "Special Settings");
                    RenameRow(shape, "Prop.DMName", ShapeProperties.StateId, "State Name");
                    RenameRow(shape, "Prop.DMType", ShapeProperties.ShapeType, "Shape Type");
                    RenameRow(shape, "Prop.InputData", ShapeProperties.Start.Initialization, "Initialization");
                    RenameRow(shape, "Prop.GlobalCommands", ShapeProperties.CommandTransitions, "Command Transitions");
                    RenameRow(shape, "Prop.GlobalPrompts", ShapeProperties.PromptTypes, "Prompt Types");
                    RenameRow(shape, "Prop.GlobalConfirmations", ShapeProperties.ConfirmationPrompts, "Confirmation Prompts");
                    RenameRow(shape, "Prop.TitleLine1", ShapeProperties.DocTitle.ClientName, "Client Name");
                    RenameRow(shape, "Prop.TitleLine2", ShapeProperties.DocTitle.ProjectName, "Project Name");
                    if (shapeType == ShapeTypes.Interaction)
                    {
                        RenameRow(shape, "Prop.Transitions", "Prop.CommandTransitions", "Command Transitions");
                        RenameRow(shape, "Prop.Prompts", "Prop.PromptTypes", "Prompt Types");
                    }

                    // undo encoding we'll never use
                    UnencodeProperty(shape, ShapeProperties.ChangeLog.Changes);
                    UnencodeProperty(shape, ShapeProperties.Start.DefaultSettings);
                    UnencodeProperty(shape, ShapeProperties.Start.Initialization);
                    UnencodeProperty(shape, ShapeProperties.MaxHandling);
                    UnencodeProperty(shape, ShapeProperties.Play.Prompts);
                    UnencodeProperty(shape, ShapeProperties.PromptTypes);
                    UnencodeProperty(shape, ShapeProperties.Transitions);
                    UnencodeProperty(shape, ShapeProperties.CommandTransitions);
                    UnencodeProperty(shape, ShapeProperties.SpecialSettings);
                    UnencodeProperty(shape, ShapeProperties.DeveloperNotes);
                    UnencodeProperty(shape, ShapeProperties.ConfirmationPrompts);
                    UnencodeProperty(shape, ShapeProperties.LastUpdate);

                    // make each shape get a GUID
                    string uniqueId = shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID);
                    // off page refs have two shapes with the same name and we don't need them for this
                    if (shapeType != ShapeTypes.OffPageRef)
                    {
                        List <string> list = null;

                        if (uniqueIdMap.TryGetValue(shape.Name, out list))
                        {
                            list.Add(uniqueId);
                        }
                        else
                        {
                            list = new List <string>();
                            list.Add(uniqueId);
                            uniqueIdMap.Add(shape.Name, list);
                        }

                        if (shapeType != ShapeTypes.Placeholder && shapeType != ShapeTypes.HangUp &&
                            shapeType != ShapeTypes.Transfer && shapeType != ShapeTypes.Return)
                        {
                            list = null;
                            if (uniqueIdMapNoTerminals.TryGetValue(shape.Name, out list))
                            {
                                list.Add(uniqueId);
                            }
                            else
                            {
                                list = new List <string>();
                                list.Add(uniqueId);
                                uniqueIdMapNoTerminals.Add(shape.Name, list);
                            }
                        }
                    }

                    // change all double click handlers
                    if (shapeType == ShapeTypes.DocTitle || shapeType == ShapeTypes.ChangeLog ||
                        shapeType == ShapeTypes.Start || shapeType == ShapeTypes.Interaction ||
                        shapeType == ShapeTypes.Play || shapeType == ShapeTypes.Decision ||
                        shapeType == ShapeTypes.Data || shapeType == ShapeTypes.SubDialog ||
                        shapeType == ShapeTypes.CallSubDialog)
                    {
                        Common.SetCellFormula(shape, "EventDblClick", "RUNADDONWARGS(\"QueueMarkerEvent\",\"/PathMaker /CMD=1\")");
                    }

                    // global transitions need a new column to match the interaction transitions
                    if (shapeType == ShapeTypes.Start)
                    {
                        Table table = Common.GetCellTable(shape, ShapeProperties.CommandTransitions);
                        if (!table.IsEmpty())
                        {
                            int newCol = table.AddColumn();
                            System.Diagnostics.Debug.Assert(newCol == 18);
                            // copies the goto column to the line column to match interactions
                            table.CopyColumn(7, 18);
                            Common.SetCellTable(shape, ShapeProperties.CommandTransitions, table);
                        }
                    }

                    // unlock most shape text edits - remember play and interaction are multiple shapes
                    if (shapeType == ShapeTypes.Data || shapeType == ShapeTypes.Decision ||
                        shapeType == ShapeTypes.Interaction || shapeType == ShapeTypes.Play || shapeType == ShapeTypes.SubDialog)
                    {
                        shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                           (short)VisRowIndices.visRowLock,
                                           (short)VisCellIndices.visLockTextEdit).FormulaU = "0";
                    }
                    if (shapeType == ShapeTypes.Interaction || shapeType == ShapeTypes.Play)
                    {
                        shape.Shapes[1].get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                                     (short)VisRowIndices.visRowLock,
                                                     (short)VisCellIndices.visLockTextEdit).FormulaU = "0";
                        // and bring it to front so you are editing the shape name by default
                        shape.Shapes[1].BringToFront();
                    }
                    // the old stuff never locked call sub dialogs - we want to
                    if (shapeType == ShapeTypes.CallSubDialog)
                    {
                        shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                           (short)VisRowIndices.visRowLock,
                                           (short)VisCellIndices.visLockTextEdit).FormulaU = "1";
                    }

                    // normalize/fix all the grid datastore stuff - get rid of unused columns, etc.
                    // remove plus, minus, goto, update_plus, update_minus, cp_idx
                    RemoveColumnsFromCellTable(shape, ShapeProperties.CommandTransitions, new int[6] {
                        3, 5, 7, 12, 14, 19
                    });
                    // remove plus, minus, update_plus, update_minus
                    RemoveColumnsFromCellTable(shape, ShapeProperties.ConfirmationPrompts, new int[4] {
                        1, 3, 7, 9
                    });
                    // remove plus, minus, updateplus, updateminus
                    RemoveColumnsFromCellTable(shape, ShapeProperties.PromptTypes, new int[4] {
                        1, 3, 7, 9
                    });
                    // remove plus, minus, updateplus, updateminus, cp_idx
                    RemoveColumnsFromCellTable(shape, ShapeProperties.Play.Prompts, new int[5] {
                        0, 2, 5, 7, 10
                    });
                    // remove plus, minus, goto, updateplus, updateminus
                    RemoveColumnsFromCellTable(shape, ShapeProperties.Transitions, new int[5] {
                        0, 2, 4, 5, 7
                    });
                    // remove highlight index column
                    RemoveColumnsFromCellTable(shape, ShapeProperties.ChangeLog.Changes, new int[1] {
                        5
                    });

                    // clear any old changelog descriptions from the page itself
                    if (shapeType == ShapeTypes.ChangeLog)
                    {
                        Page changeLogPage = shape.ContainingPage;
                        for (int count = changeLogPage.Shapes.Count; count > 0; count--)
                        {
                            if (changeLogPage.Shapes[count] != shape)
                            {
                                changeLogPage.Shapes[count].Delete();
                            }
                        }
                    }

                    // Start has the max handlers in a different order than the interaction states - fix it here
                    if (shapeType == ShapeTypes.Start)
                    {
                        SwapRowsInCellTable(shape, ShapeProperties.MaxHandling, 0, 1);
                    }

                    // Get rid of expressware checkpoints default setting
                    if (shapeType == ShapeTypes.Start)
                    {
                        Table table = Common.GetCellTable(shape, ShapeProperties.Start.DefaultSettings);
                        for (int r = 0; r < table.GetNumRows(); r++)
                        {
                            if (table.GetData(r, 0).Equals("ExpressWare Checkpoints"))
                            {
                                table.DeleteRow(r);
                                break;
                            }
                        }
                    }

                    // apparently subDialogs developer notes were not written out as a two column entry (one for date of change)
                    if (shapeType == ShapeTypes.SubDialog)
                    {
                        EnsureTwoColumns(shape, ShapeProperties.DeveloperNotes);
                    }

                    // set shape type - this will add it if necessary - make sure to use int value
                    Common.SetCellFormula(shape, ShapeProperties.ShapeType, ((int)shapeType).ToString());
                    SetRowLabel(shape, ShapeProperties.ShapeType, "Shape Type");
                }
            }

            // we remove change log stuff above - need to recount the remaining totals
            total = 0;
            foreach (Page page in document.Pages)
            {
                total += page.Shapes.Count;
            }
            total = counter + (total * 3);  // we'll go through 3 times below

            // The following stuff needed to wait until every state had a GUID

            // change all references from state ids/names to use GUIDs
            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    // column 13 should now be the link column
                    ReplaceStateIdsWithUniqueIds(shape, uniqueIdMap, ShapeProperties.CommandTransitions, 13);
                    // column 5 should be the link column
                    ReplaceStateIdsWithUniqueIds(shape, uniqueIdMap, ShapeProperties.Transitions, 5);
                    // column 3 should be the goto column
                    ReplaceStateIdsWithUniqueIds(shape, uniqueIdMapNoTerminals, ShapeProperties.MaxHandling, 3);
                    // it's a singleton, not a table - only exists on call subdialogs
                    ReplaceStateIdWithUniqueIds(shape, uniqueIdMap, ShapeProperties.CallSubDialog.SubDialogUID);
                    progressBarForm.SetProgressPercentage(counter++, total);
                    if (progressBarForm.Cancelled)
                    {
                        return(false);
                    }
                }
            }

            // fix off page connectors
            Dictionary <string, Shape> offPageShapeNameMap = new Dictionary <string, Shape>();

            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    if (Common.GetShapeType(shape) == ShapeTypes.OffPageRef)
                    {
                        // common fixes
                        // hyperlinks point to pages, not shapes, even if the shape is deleted - drop these
                        short row;
                        if (shape.get_CellExists(ShapeProperties.OffPageRef.HyperLink, (short)VisExistsFlags.visExistsAnywhere) != 0)
                        {
                            row = shape.get_CellsRowIndex(ShapeProperties.OffPageRef.HyperLink);
                            shape.DeleteRow((short)VisSectionIndices.visSectionHyperlink, row);
                        }
                        if (shape.get_CellExists("Hyperlink.PageLinkDest", (short)VisExistsFlags.visExistsAnywhere) != 0)
                        {
                            row = shape.get_CellsRowIndex("Hyperlink.PageLinkDest");
                            shape.DeleteRow((short)VisSectionIndices.visSectionHyperlink, row);
                        }
                        // the standard off-page connector dbl click handler works fine
                        Common.SetCellFormula(shape, ShapeProperties.EventDblClick, Strings.OffPageConnectorDblClickCommand);
                        // the standard off-page connector drop handler works fine
                        Common.SetCellFormula(shape, ShapeProperties.EventDrop, Strings.OffPageConnectorDropCommand);
                        // keep the text synchronized
                        Common.SetCellFormula(shape, ShapeProperties.TheText, Strings.OffPageConnectorTextCommand);
                        // delete actions to change shape to circle/arrow
                        row = shape.get_CellsRowIndex("Actions.Row_3");
                        shape.DeleteRow((short)VisSectionIndices.visSectionAction, row);
                        row = shape.get_CellsRowIndex("Actions.Row_4");
                        shape.DeleteRow((short)VisSectionIndices.visSectionAction, row);

                        Shape target;
                        if (offPageShapeNameMap.TryGetValue(shape.Text, out target))
                        {
                            // we have a pair...
                            Common.SetCellString(shape, ShapeProperties.OffPageConnectorShapeID,
                                                 shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                            Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationPageID,
                                                 target.ContainingPage.PageSheet.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                            Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationShapeID,
                                                 target.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));

                            Common.SetCellString(target, ShapeProperties.OffPageConnectorShapeID,
                                                 target.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                            Common.SetCellString(target, ShapeProperties.OffPageConnectorDestinationPageID,
                                                 shape.ContainingPage.PageSheet.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                            Common.SetCellString(target, ShapeProperties.OffPageConnectorDestinationShapeID,
                                                 shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));

                            offPageShapeNameMap.Remove(shape.Text);
                        }
                        else
                        {
                            offPageShapeNameMap.Add(shape.Text, shape);
                        }
                    }
                    progressBarForm.SetProgressPercentage(counter++, total);
                    if (progressBarForm.Cancelled)
                    {
                        return(false);
                    }
                }
            }

            // In CID you could have on-page connectors backwards - check for them here
            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    if (Common.GetShapeType(shape) == ShapeTypes.OnPageRefIn)
                    {
                        bool arrowSide = false;
                        foreach (Connect c in shape.FromConnects)
                        {
                            // determine which end of the connector is connected to the nonConnectorShadow
                            if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName))
                            {
                                arrowSide = true;
                            }
                        }
                        // if we are on the arrow side of the connector, that means this is an input connector
                        if (arrowSide)
                        {
                            postUpgradeReportString += "On page reference input can't have inputs - " + ShapeDescription(shape) + "\n\n";
                            catastrophicError        = true;
                        }
                    }
                    else if (Common.GetShapeType(shape) == ShapeTypes.OnPageRefOut)
                    {
                        bool arrowSide = true;
                        foreach (Connect c in shape.FromConnects)
                        {
                            // determine which end of the connector is connected to the nonConnectorShadow
                            if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName))
                            {
                                arrowSide = true;
                            }

                            // if we are on the non-arrow side of the connector, that means this is an output connector
                            if (!arrowSide)
                            {
                                postUpgradeReportString += "On page reference output can't have outputs - " + ShapeDescription(shape) + "\n\n";
                                catastrophicError        = true;
                            }
                        }
                    }
                }
            }

            // any left over are not hooked up - this is a problem...
            if (offPageShapeNameMap.Count > 0)
            {
                for (int i = 0; i < offPageShapeNameMap.Count; i++)
                {
                    Shape noMatch = offPageShapeNameMap.Values.ElementAt(i);
                    postUpgradeReportString += "No matching off page connector found for " + ShapeDescription(noMatch) + "\n\n";
                    noMatch.Text             = Strings.ToBeDeletedLabel;
                }
            }

            // Last thing to do - now that we can use all the new column names, we want to find all table fields using $$ and fix them
            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    FixDollarDollarTableFields(shape, ShapeProperties.CommandTransitions);
                    FixDollarDollarTableFields(shape, ShapeProperties.PromptTypes);
                    FixDollarDollarTableFields(shape, ShapeProperties.ConfirmationPrompts);
                    FixDollarDollarTableFields(shape, ShapeProperties.MaxHandling);
                    FixDollarDollarTableFields(shape, ShapeProperties.DeveloperNotes);
                    FixDollarDollarTableFields(shape, ShapeProperties.SpecialSettings);
                    FixDollarDollarTableFields(shape, ShapeProperties.Transitions);
                    FixDollarDollarTableFields(shape, ShapeProperties.Play.Prompts);
                    FixDollarDollarTableFields(shape, ShapeProperties.Start.DefaultSettings);
                    FixDollarDollarTableFields(shape, ShapeProperties.Start.Initialization);
                    progressBarForm.SetProgressPercentage(counter++, total);
                    if (progressBarForm.Cancelled)
                    {
                        return(false);
                    }
                }
            }
            progressBarForm.SetProgressPercentage(100, 100);

            progressBarForm.Hide();
            progressBarForm = null;
            return(true);
        }