Example #1
0
        private static void AddReturnList(SubDialogShadow shadow, XmlElement stateElement)
        {
            List <SubDialogShadow.ReturnPair> list = shadow.GetReturnPairs();

            if (list.Count == 0)
            {
                return;
            }

            XmlElement returnListElement = CreateElement(stateElement, xmlStrings.ReturnList);

            foreach (SubDialogShadow.ReturnPair pair in list)
            {
                XmlElement returnElement = CreateElement(returnListElement, xmlStrings.Return);
                returnElement.SetAttribute(xmlStrings.PreviousState, pair.PreviousState.GetGotoName());
                returnElement.SetAttribute(xmlStrings.ReturnState, GetXmlGotoFromData(pair.Return.GetGotoName()));
            }
        }
Example #2
0
        internal static void LoadSubDialogListBox(ListBox listBox, string currentValue)
        {
            List <ComboBoxItem> list = new List <ComboBoxItem>();

            List <Shadow> shadowList = PathMaker.LookupShadowsByShapeType(ShapeTypes.SubDialog);

            shadowList.Sort(Common.StateIdShadowSorterAlphaNumerical);

            foreach (Shadow shadow in shadowList)
            {
                SubDialogShadow subDialogShadow = shadow as SubDialogShadow;
                list.Add(new ComboBoxItem(subDialogShadow.GetStateId(), subDialogShadow.GetUniqueId()));
            }

            listBox.DataSource    = list;
            listBox.DisplayMember = ComboBoxItem.DisplayMemberName;
            listBox.ValueMember   = ComboBoxItem.ValueMemberName;
            listBox.SelectedValue = currentValue;
        }
Example #3
0
        private static void AddSubDialogElement(XmlDocument xmlDoc, SubDialogShadow shadow)
        {
            XmlElement stateElement = CreateElement(xmlDoc.DocumentElement, xmlStrings.SubDialog);

            stateElement.SetAttribute(xmlStrings.StateId, shadow.GetStateId());

            XmlElement startingStateElement = CreateElement(stateElement, xmlStrings.StartingState);

            Shadow targetShadow = shadow.GetFirstStateTarget();

            if (targetShadow == null)
            {
                startingStateElement.InnerText = Strings.DisconnectedConnectorTarget;
            }
            else
            {
                startingStateElement.InnerText = targetShadow.GetGotoName();
            }

            AddReturnList(shadow, stateElement);
            AddDeveloperNotes(shadow.GetDeveloperNotes(), stateElement);
        }
        // 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 DialogResult ShowDialog(SubDialogShadow shadow)
 {
     this.shadow = shadow;
     return ShowDialog();
 }
        private static void AddSubDialogTable(Document doc, SubDialogShadow subDialogShadow)
        {
            Selection content = doc.Application.Selection;

            doc.Tables[Templates.SubDialog].Range.Copy();
            content.Bookmarks.Add("bm" + Left(AlphaNumericCharsOnly(subDialogShadow.GetStateId()), 38));
            content.Move(WdUnits.wdStory);
            content.Paste();

            Microsoft.Office.Interop.Word.Table wordTable = doc.Tables[doc.Tables.Count];

            wordTable.Range.ParagraphFormat.KeepWithNext = -1;
            wordTable.Cell(1, 1).Range.InsertAfter(subDialogShadow.GetStateId());

            string tmp = CachedGetGotoName(subDialogShadow);

            Cell cell = wordTable.Cell(7, 1);
            Table table = subDialogShadow.GetDeveloperNotes();
            if (!table.IsEmpty()) {
                string notes = table.GetData(0, (int)TableColumns.DeveloperNotes.Text);
                string notesDate = table.GetData(0, (int)TableColumns.DeveloperNotes.TextDateStamp);
                cell.Range.InsertAfter(notes);
                SetCellBackgroundColorIfNecessary(cell, notesDate);
            }

            cell = wordTable.Cell(5, 1);
            string startState = CachedGetGotoName(subDialogShadow.GetFirstStateTarget());
            content.InsertAfter(startState);
            content.set_Style("Hyperlink");
            content.Hyperlinks.Add(Anchor: content.Range, SubAddress: "bm" + Left(AlphaNumericCharsOnly(startState), 38));
            content.Move(WdUnits.wdStory);
            content.MoveStart(WdUnits.wdParagraph, -1);
            content.Cut();
            cell.Range.Paste();

            List<SubDialogShadow.ReturnPair> pairs = subDialogShadow.GetReturnPairs();
            InsertWordTableRows(wordTable, 3, pairs.Count - 1);
            for (int i = 0; i < pairs.Count; i++) {
                cell = wordTable.Cell(i + 3, 1);
                string prev = CachedGetGotoName(pairs[i].PreviousState);
                content.InsertAfter(prev);
                content.set_Style("Hyperlink");
                content.Hyperlinks.Add(Anchor: content.Range, SubAddress: "bm" + Left(AlphaNumericCharsOnly(prev), 38));
                content.Move(WdUnits.wdStory);
                content.MoveStart(WdUnits.wdParagraph, -1);
                content.Cut();
                cell.Range.Paste();

                cell = wordTable.Cell(i + 3, 2);
                cell.Range.InsertAfter(CachedGetGotoName(pairs[i].Return));
                string next = CachedGetGotoName(pairs[i].Return);
                content.InsertAfter(next);
                content.set_Style("Hyperlink");
                content.Hyperlinks.Add(Anchor: content.Range, SubAddress: "bm" + Left(AlphaNumericCharsOnly(next), 38));
                content.Move(WdUnits.wdStory);
                content.MoveStart(WdUnits.wdParagraph, -1);
                content.Cut();
                cell.Range.Paste();
            }

            //SetCellBackgroundColorIfNecessary(wordTable.Cell(1, 1), subDialogShadow.GetLastChangeDate());
            SetCellBackgroundColorIfNecessary(wordTable.Cell(1, 1), subDialogShadow.GetLastChangeVersion());//JDK added

            content.Move(WdUnits.wdStory);
            content.set_Style("Normal");
            content.TypeParagraph();
            content.Move(WdUnits.wdStory);
        }
Example #7
0
        // 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);
        }
Example #8
0
        private static void AddSubDialogElement(XmlDocument xmlDoc, SubDialogShadow shadow)
        {
            XmlElement stateElement = CreateElement(xmlDoc.DocumentElement, xmlStrings.SubDialog);
            stateElement.SetAttribute(xmlStrings.StateId, shadow.GetStateId());

            XmlElement startingStateElement = CreateElement(stateElement, xmlStrings.StartingState);

            Shadow targetShadow = shadow.GetFirstStateTarget();
            if (targetShadow == null)
                startingStateElement.InnerText = Strings.DisconnectedConnectorTarget;
            else
                startingStateElement.InnerText = targetShadow.GetGotoName();

            AddReturnList(shadow, stateElement);
            AddDeveloperNotes(shadow.GetDeveloperNotes(), stateElement);
        }
Example #9
0
        private static void AddReturnList(SubDialogShadow shadow, XmlElement stateElement)
        {
            List<SubDialogShadow.ReturnPair> list = shadow.GetReturnPairs();

            if (list.Count == 0)
                return;

            XmlElement returnListElement = CreateElement(stateElement, xmlStrings.ReturnList);

            foreach (SubDialogShadow.ReturnPair pair in list) {
                XmlElement returnElement = CreateElement(returnListElement, xmlStrings.Return);
                returnElement.SetAttribute(xmlStrings.PreviousState, pair.PreviousState.GetGotoName());
                returnElement.SetAttribute(xmlStrings.ReturnState, GetXmlGotoFromData(pair.Return.GetGotoName()));
            }
        }
Example #10
0
 public DialogResult ShowDialog(SubDialogShadow shadow)
 {
     this.shadow = shadow;
     return(ShowDialog());
 }