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.Goto, shadow.GetUniqueId());
            table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString));
            SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
        }
 public override void OnConnectAddOutput(Shadow shadow)
 {
     if (GetOutputs().Count > 1) {
         Common.ErrorMessage("Incorrectly adding more than one output to a Call SubDialog");
         // get busy cursor without this
         shadow.SelectShape();
     }
 }
Example #3
0
        // NOTE - You can't just add an OnShapeDoubleClick handler to a shadow and get the event
        // You also need to change the shapesheet (in .vss file and in upgrade) to use the
        // double click handler used by others "RUNADDONWARGS(\"QueueMarkerEvent\",\"/PathMaker /CMD=1\")"
        private void OnShapeDoubleClick(Shape shape)
        {
            Shadow shadow = LookupShadowByShape(shape);

            if (shadow != null)
            {
                shadow.OnShapeDoubleClick();
            }
            else
            {
                Common.ErrorMessage("Error - double clicking on unexpected item " + shape.Name);
            }
        }
        public override Shadow GetDestinationTarget()
        {
            Shadow shadow = PathMaker.LookupShadowByUID(GetSubDialogUID());

            if (shadow == null)
            {
                return(this);
            }
            else
            {
                return(shadow);
            }
        }
Example #5
0
        public override Shadow GetDestinationTarget()
        {
            Shadow partner = GetPartnerOnPageRefInShadow();

            if (partner != null)
            {
                return(partner.GetDestinationTarget());
            }
            else
            {
                return(this);
            }
        }
Example #6
0
        // NOTE - You can't just add an OnShapeProperties handler to a shadow and get the event
        // You also need to change the shapesheet (in .vss file and in upgrade) to use the
        // double click handler used by others "RUNADDONWARGS(\"QueueMarkerEvent\",\"/PathMaker /CMD=2\")"
        private void OnShapeProperties(Shape shape)
        {
            Shadow shadow = LookupShadowByShape(shape);

            if (shadow != null)
            {
                shadow.OnShapeProperties();
            }
            else
            {
                Common.ErrorMessage("Error - properties on unexpected item " + shape.Name);
            }
        }
Example #7
0
        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);
        }
Example #8
0
        // this will be an empty list for a connector
        // it doesn't have any connectors pointing to it
        internal List <Shadow> GetOutputs()
        {
            List <Connect> connects = GetShapeOutputs();

            List <Shadow> list = new List <Shadow>();

            foreach (Connect connect in connects)
            {
                // The 1D connector is always the To and 2D shapes are always the From
                Shape  toShape = connect.FromSheet;
                Shadow shadow  = PathMaker.LookupShadowByShape(toShape);
                list.Add(shadow.GetDestinationTarget());
            }
            return(list);
        }
 override public void OnShapeDoubleClick()
 {
     if (shape.Text.Length == 0)
     {
         OnShapeProperties();
     }
     else
     {
         Shadow shadow = PathMaker.LookupShadowByUID(GetSubDialogUID());
         if (shadow != null)
         {
             shadow.SelectShape();
         }
     }
 }
Example #10
0
        public override Shadow GetDestinationTarget()
        {
            Connect c;

            c = GetConnect(true);
            if (c != null)
            {
                Shadow connectedToShadow = PathMaker.LookupShadowByShape(c.ToSheet);
                return(connectedToShadow.GetDestinationTarget());
            }
            else
            {
                return(this);
            }
        }
Example #11
0
        public override Shadow GetDestinationTarget()
        {
            List <Connect> list = GetShapeOutputs();

            System.Diagnostics.Debug.WriteLine("offpage - " + shape.Text + " page - " + shape.ContainingPage.Name);

            if (list.Count == 0 && GetShapeInputs().Count == 0)
            {
                // no in or outbound connectors
                return(this);
            }
            else if (list.Count > 0)
            {
                // find outbound link (should only be one)
                if (list.Count != 1)
                {
                    return(this);
                }

                // the FromSheet is the outgoing connector (always from = 1D, to = 2D)
                Shadow connectedToShadow = PathMaker.LookupShadowByShape(list[0].FromSheet);
                if (connectedToShadow != null)
                {
                    return(connectedToShadow.GetDestinationTarget());
                }
                else
                {
                    return(this);
                }
            }
            else
            {
                OffPageRefShadow partnerShadow = GetPartnerOffPageRefShadow() as OffPageRefShadow;

                if (partnerShadow != null && partnerShadow.GetShapeOutputs().Count > 0)
                {
                    return(partnerShadow.GetDestinationTarget());
                }
                else
                {
                    if (partnerShadow != null && partnerShadow.GetShapeInputs().Count > 0)
                    {
                        Common.ErrorMessage("Off page connector " + shape.Text + " on page " + shape.ContainingPage.Name + " and it's partner both have inputs");
                    }
                    return(this);
                }
            }
        }
Example #12
0
        /**
         * Returns a list of all the nicknames of the input target shapes for
         * this one.  For most shadows, this is the NickName of the shape.  For
         * things like connectors, on and off page refs, etc. this will work
         * backwards to get to the sources.
         */
        virtual public List <string> GetEnteringFromTargetNames()
        {
            List <Connect> connects = GetShapeInputs();
            List <string>  list     = new List <string>();

            foreach (Connect connect in connects)
            {
                Shape  input  = connect.FromSheet;
                Shadow shadow = PathMaker.LookupShadowByShape(input);
                foreach (Shadow s in shadow.GetSourceTargets())
                {
                    list.Add(s.GetGotoName());
                }
            }
            return(list);
        }
        private bool ReadyForConnectorMove(out Cell nonArrowSideCell, out Shape fromShape)
        {
            nonArrowSideCell = null;
            fromShape        = null;

            if (visioControl.Document.Application.ActiveWindow.Selection.Count != 1)
            {
                Common.ErrorMessage("A single connector must be selected");
                return(false);
            }
            Shape      connector = visioControl.Document.Application.ActiveWindow.Selection[1];
            ShapeTypes type      = Common.GetShapeType(connector);

            if (type != ShapeTypes.Connector)
            {
                Common.ErrorMessage("A single connector must be selected");
                return(false);
            }

            Shadow connectorShadow = PathMaker.LookupShadowByShape(connector);

            if (connectorShadow == null)
            {
                Common.ErrorMessage("Connector is not a valid PathMaker shape");
                return(false);
            }

            nonArrowSideCell = connector.get_Cells("BeginX");
            Connect nonArrowSideConnect = null;

            foreach (Connect c in connector.Connects)
            {
                if (c.FromCell.Name.Equals(Strings.BeginConnectionPointCellName))
                {
                    nonArrowSideConnect = c;
                }
            }

            if (nonArrowSideConnect == null)
            {
                Common.ErrorMessage("Connector must be connected on the non-arrow side");
                return(false);
            }

            fromShape = nonArrowSideConnect.ToSheet;
            return(true);
        }
Example #14
0
        public override List <Shadow> GetSourceTargets()
        {
            List <Shadow> list = new List <Shadow>();
            Connect       c;

            c = GetConnect(false);
            if (c != null)
            {
                Shadow connectedToShadow = PathMaker.LookupShadowByShape(c.ToSheet);
                list.AddRange(connectedToShadow.GetSourceTargets());
            }
            else
            {
                list.Add(this);
            }
            return(list);
        }
Example #15
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;
            }
        }
Example #16
0
        // this will be an empty list for a connector
        // it doesn't have any connectors pointing to it
        internal List <Shadow> GetInputs()
        {
            List <Connect> connects = GetShapeInputs();

            List <Shadow> list = new List <Shadow>();

            foreach (Connect connect in connects)
            {
                // The 1D connector is always the To and 2D shapes are always the From
                Shape  fromShape = connect.FromSheet;
                Shadow shadow    = PathMaker.LookupShadowByShape(fromShape);
                foreach (Shadow s in shadow.GetSourceTargets())
                {
                    list.Add(s);
                }
            }
            return(list);
        }
Example #17
0
        /**
         * This returns the partner on page ref in that is associated with this one
         */
        private Shadow GetPartnerOnPageRefInShadow()
        {
            // These are still only held together by name
            Page page = shape.ContainingPage;

            foreach (Shape s in page.Shapes)
            {
                if (shape.Text.Equals(s.Text))
                {
                    Shadow shadow = PathMaker.LookupShadowByShape(s);
                    if (shadow.GetShapeType() == ShapeTypes.OnPageRefIn)
                    {
                        return(shadow);
                    }
                }
            }
            return(null);
        }
Example #18
0
        // returns are special - we need to make sure the keyword gets in there
        private static string GetXmlGotoFromShadow(Shadow targetShadow)
        {
            if (targetShadow == null)
            {
                return(Strings.DisconnectedConnectorTarget);
            }

            ReturnShadow returnShadow = targetShadow as ReturnShadow;

            if (returnShadow != null)
            {
                return(Strings.ReturnKeyword);
            }
            else
            {
                return(targetShadow.GetGotoName());
            }
        }
Example #19
0
        public override void OnConnectAddOutput(Shadow shadow)
        {
            if (IsIllegalLoop())
            {
                Common.ErrorMessage("Incorrectly creating a loop with connector - deleting");
                shape.Delete();
            }
            else
            {
                // if non-arrow side is connected, we should mark the goto transition as changed (datestamp)
                List <Shadow> sources = GetSourceTargets();

                foreach (Shadow s in sources)
                {
                    s.OnConnectorChangeTarget(this);
                }
            }
        }
Example #20
0
        // We need this to handle pasting - when objects are pasted the transitions have the old GUIDs but
        // visio may have assigned new ones to the pasted objects.  We stash the old GUIDs in OnWindowSelectionChange
        // and we make use of them here to get everyone in sync
        private void OnExitScope(Microsoft.Office.Interop.Visio.Application application, string moreInformation)
        {
            // moreInformation is a standard ;-delimited string from the scope events that contains what we need

            // 1344 is the Microsoft Scope Id for GotoPage
            if (moreInformation.StartsWith("1344"))
            {
                string pageName = visioControl.Document.Application.ActivePage.Name;
                int    index    = visioControl.Document.Pages[pageName].Index;
                gotoPageComboBox.SelectedIndex = index - 1;
            }
            // 1022 is the Microsoft Scope Id for Paste
            // 1024 is the Microsoft Scope Id for Duplicate
            else if (moreInformation.StartsWith(((int)VisUICmds.visCmdUFEditPaste).ToString()) ||
                     moreInformation.StartsWith(((int)VisUICmds.visCmdUFEditDuplicate).ToString()))
            {
                // first make a map of old GUIDs to new
                Dictionary <string, string> oldGUIDToNewGUIDMap = new Dictionary <string, string>();
                foreach (Shape shape in visioControl.Document.Application.ActiveWindow.Selection)
                {
                    string oldUID = Common.GetCellString(shape, Strings.CutCopyPasteTempCellName);
                    string newUID = shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID);
                    oldGUIDToNewGUIDMap.Add(oldUID, newUID);
                }

                // now call each shadow to fix itself
                foreach (Shape shape in visioControl.Document.Application.ActiveWindow.Selection)
                {
                    Shadow s = PathMaker.LookupShadowByShape(shape);
                    if (s == null)
                    {
                        continue;
                    }
                    s.FixUIDReferencesAfterPaste(oldGUIDToNewGUIDMap);
                }

                // because we halt this when pasting, we now need to go fix all the ones that were pasted
                foreach (Shape s in visioControl.Document.Application.ActiveWindow.Selection)
                {
                    string uid = s.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID);
                    Common.SetCellString(s, Strings.CutCopyPasteTempCellName, uid);
                }
            }
        }
Example #21
0
        /**
         * Gets the on page ref in that is associated with this one
         * this is done using the name of the shape
         */
        private List <Shadow> GetPartnerOnPageRefOutShadow()
        {
            List <Shadow> list = new List <Shadow>();

            // These are still only held together by name
            Page page = shape.ContainingPage;

            foreach (Shape s in page.Shapes)
            {
                if (shape.Text.Equals(s.Text))
                {
                    Shadow shadow = PathMaker.LookupShadowByShape(s);
                    if (shadow.GetShapeType() == ShapeTypes.OnPageRefOut)
                    {
                        list.Add(shadow);
                    }
                }
            }
            return(list);
        }
Example #22
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);
        }
Example #23
0
        public static int StateIdShadowSorterAlphaNumerical(Shadow a, Shadow b)
        {
            if (a == b)
            {
                return(0);
            }

            StateShadow stateA = a as StateShadow;
            StateShadow stateB = b as StateShadow;

            if (stateA == null)
            {
                return(1);
            }
            if (stateB == null)
            {
                return(-1);
            }

            return(stateA.GetStateId().CompareTo(stateB.GetStateId()));
        }
        public override void OnConnectDeleteOutput(Shadow shadow)
        {
            base.OnConnectDeleteOutput(shadow);
            Table table = GetTransitions();
            for (int r = 0; r < table.GetNumRows(); r++) {
                string data = table.GetData(r, (int)TableColumns.Transitions.Goto);
                string uid = shadow.GetUniqueId();

                if (data.Equals(uid)) {
                    // cleanup the connector label
                    ConnectorShadow connectorShadow = PathMaker.LookupShadowByUID(uid) as ConnectorShadow;
                    if (connectorShadow != null)
                        connectorShadow.SetLabelName(String.Empty);

                    table.DeleteRow(r);
                    SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
                    // only one per link possible
                    return;
                }
            }
        }
        public override string GetGotoName()
        {
            string uid = GetSubDialogUID();

            if (uid == null || uid.Length == 0)
            {
                return(Strings.DisconnectedConnectorTarget);
            }
            else
            {
                Shadow shadow = PathMaker.LookupShadowByUID(GetSubDialogUID());
                if (shadow != null)
                {
                    return(shadow.GetGotoName());
                }
                else
                {
                    return(Strings.DisconnectedConnectorTarget);
                }
            }
        }
Example #26
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 #27
0
        public override Shadow GetDestinationTarget()
        {
            List <Connect> connects = GetShapeOutputs();

            // find outbound link (should only be one)
            if (connects.Count != 1)
            {
                return(this);
            }

            // the FromSheet is the outgoing connector (always from = 1D, to = 2D)
            Shadow connectedToShadow = PathMaker.LookupShadowByShape(connects[0].FromSheet);

            if (connectedToShadow != null)
            {
                return(connectedToShadow.GetDestinationTarget());
            }
            else
            {
                return(this);
            }
        }
Example #28
0
        override public void OnBeforeShapeDelete()
        {
            // clean up our connections to other states - ConnectDelete is not called when the shape is deleted

            Connect c = GetConnect(false);

            if (c == null)
            {
                return;
            }

            // determine which end of the connector is connected to the nonConnectorShadow
            // In this case, it's always the c.FromCell that tells us
            bool arrowSide = false;

            if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName))
            {
                arrowSide = true;
            }

            Shadow connectedToShadow = PathMaker.LookupShadowByShape(c.ToSheet);

            if (connectedToShadow != null)
            {
                if (arrowSide)
                {
                    connectedToShadow.OnConnectDeleteInput(this);
                }
                else
                {
                    connectedToShadow.OnConnectDeleteOutput(this);
                }
            }
            else
            {
                Common.ErrorMessage("Connector goes to unknown shape " + c.ToSheet.Name);
            }
        }
Example #29
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;
            }
        }
Example #30
0
        internal static string GetNewUIDAfterPaste(string oldUID, Dictionary <string, string> oldGUIDToNewGUIDMap, bool checkWholeDocument)
        {
            // first try to find it amongst the pasted items
            string newUID;

            if (oldGUIDToNewGUIDMap.TryGetValue(oldUID, out newUID))
            {
                return(newUID);
            }

            // for max handlers and call subdialogs, we can use older UIDs as long as that shape exists in this document
            if (checkWholeDocument)
            {
                // see if it is amongst the ones in this document, if it is, it can stay the same
                Shadow s = PathMaker.LookupShadowByUID(oldUID);
                if (s != null)
                {
                    return(oldUID);
                }
            }

            return(null);
        }
Example #31
0
        internal static Shadow GetGotoTargetFromData(string gotoData)
        {
            if (gotoData.Length == 0)
            {
                return(null);
            }

            Guid uid;

            if (!Guid.TryParse(gotoData, out uid))
            {
                return(null);
            }
            Shadow shadow = PathMaker.LookupShadowByUID(gotoData);

            if (shadow != null)
            {
                return(shadow.GetDestinationTarget());
            }
            else
            {
                return(null);
            }
        }
Example #32
0
        public static int StateIdShadowSorterNumericalAlpha(Shadow a, Shadow b)
        {
            if (a == b)
            {
                return(0);
            }

            StateShadow stateA = a as StateShadow;
            StateShadow stateB = b as StateShadow;

            if (stateA == null)
            {
                return(1);
            }
            if (stateB == null)
            {
                return(-1);
            }

            string stateAPrefix, stateANumber, stateAName;
            string stateBPrefix, stateBNumber, stateBName;

            StateShadow.DisectStateIdIntoParts(stateA.GetStateId(), out stateAPrefix, out stateANumber, out stateAName);
            StateShadow.DisectStateIdIntoParts(stateB.GetStateId(), out stateBPrefix, out stateBNumber, out stateBName);

            int result = stateANumber.CompareTo(stateBNumber);

            if (result == 0)
            {
                return(stateAPrefix.CompareTo(stateBPrefix));
            }
            else
            {
                return(result);
            }
        }
Example #33
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;
            }
        }
 public override void OnConnectAddInput(Shadow shadow)
 {
     Common.ErrorMessage("Incorrectly adding input to Start");
     // get busy cursor without this
     shadow.SelectShape();
 }
Example #35
0
        // returns are special - we need to make sure the keyword gets in there
        private static string GetXmlGotoFromShadow(Shadow targetShadow)
        {
            if (targetShadow == null)
                return Strings.DisconnectedConnectorTarget;

            ReturnShadow returnShadow = targetShadow as ReturnShadow;
            if (returnShadow != null)
                return Strings.ReturnKeyword;
            else
                return targetShadow.GetGotoName();
        }
        public static int StateIdShadowSorterAlphaNumerical(Shadow a, Shadow b)
        {
            if (a == b)
                return 0;

            StateShadow stateA = a as StateShadow;
            StateShadow stateB = b as StateShadow;
            if (stateA == null)
                return 1;
            if (stateB == null)
                return -1;

            return stateA.GetStateId().CompareTo(stateB.GetStateId());
        }
Example #37
0
 public virtual void OnConnectAddOutput(Shadow shadow)
 {
 }
 public override void OnConnectAddInput(Shadow shadow)
 {
     if (IsIllegalLoop()) {
         Common.ErrorMessage("Incorrectly creating a loop with connector - deleting");
         shape.Delete();
     }
 }
 private static string CachedGetGotoName(Shadow shadow)
 {
     string name;
     if (gotoNameCache.TryGetValue(shadow, out name))
         return name;
     name = shadow.GetGotoName();
     gotoNameCache.Add(shadow, name);
     return name;
 }
 public override void OnConnectAddOutput(Shadow shadow)
 {
     Common.ErrorMessage("Incorrectly adding output to an Outgoing On Page Reference");
     // get busy cursor without this
     shadow.SelectShape();
 }
        public override void OnConnectAddOutput(Shadow shadow)
        {
            if (IsIllegalLoop()) {
                Common.ErrorMessage("Incorrectly creating a loop with connector - deleting");
                shape.Delete();
            }
            else {
                // if non-arrow side is connected, we should mark the goto transition as changed (datestamp)
                List<Shadow> sources = GetSourceTargets();

                foreach (Shadow s in sources)
                    s.OnConnectorChangeTarget(this);
            }
        }
 public ReturnPair(Shadow previous, Shadow next)
 {
     PreviousState = previous; Return = next;
 }
        private static int StateIdShadowSorterVisioHeuristicHelper(Shadow a, Shadow b)
        {
            if (a == b)
                return 0;

            StateShadow stateA = a as StateShadow;
            StateShadow stateB = b as StateShadow;
            if (stateA == null)
                return 1;
            if (stateB == null)
                return -1;

            string stateAPrefix, stateANumber, stateAName;
            string stateBPrefix, stateBNumber, stateBName;

            StateShadow.DisectStateIdIntoParts(stateA.GetStateId(), out stateAPrefix, out stateANumber, out stateAName);
            StateShadow.DisectStateIdIntoParts(stateB.GetStateId(), out stateBPrefix, out stateBNumber, out stateBName);

            int earliestPageA = earliestPageReference[stateAPrefix];
            int earliestPageB = earliestPageReference[stateBPrefix];

            if (earliestPageA != earliestPageB)
                return earliestPageA - earliestPageB;

            return stateA.GetStateId().CompareTo(stateB.GetStateId());
        }
        public static int StateIdShadowSorterNumericalAlpha(Shadow a, Shadow b)
        {
            if (a == b)
                return 0;

            StateShadow stateA = a as StateShadow;
            StateShadow stateB = b as StateShadow;
            if (stateA == null)
                return 1;
            if (stateB == null)
                return -1;

            string stateAPrefix, stateANumber, stateAName;
            string stateBPrefix, stateBNumber, stateBName;

            StateShadow.DisectStateIdIntoParts(stateA.GetStateId(), out stateAPrefix, out stateANumber, out stateAName);
            StateShadow.DisectStateIdIntoParts(stateB.GetStateId(), out stateBPrefix, out stateBNumber, out stateBName);

            int result = stateANumber.CompareTo(stateBNumber);

            if (result == 0)
                return stateAPrefix.CompareTo(stateBPrefix);
            else
                return result;
        }
Example #45
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;
            }
        }
Example #46
0
 public virtual void OnConnectDeleteOutput(Shadow shadow)
 {
 }
Example #47
0
 public override void OnConnectAddOutput(Shadow shadow)
 {
     Common.ErrorMessage("Incorrectly adding output to a Hang up");
     // get busy cursor without this
     shadow.SelectShape();
 }
 public override void OnConnectAddOutput(Shadow shadow)
 {
     if (GetInputs().Count > 0) {
         Common.ErrorMessage("Incorrectly adding output to an Off Page Reference that has inputs");
         // get busy cursor without this
         shadow.SelectShape();
     }
 }