Beispiel #1
0
        public IList <int> Add(
            string fx,
            string fy,
            CONS.ConnectionPointType type)
        {
            this.AssertApplicationAvailable();

            return(this.Add(null, fx, fy, type));
        }
        public IList <int> Add(IList <IVisio.Shape> target_shapes,
                               string fx,
                               string fy,
                               CONS.ConnectionPointType type)
        {
            this.Client.Application.AssertApplicationAvailable();
            this.Client.Document.AssertDocumentAvailable();

            var shapes = this.GetTargetShapes(target_shapes);

            if (shapes.Count < 1)
            {
                return(new List <int>(0));
            }

            int dirx = 0;
            int diry = 0;

            var indices = new List <int>(shapes.Count);

            var app = this.Client.Application.Get();

            using (var undoscope = this.Client.Application.NewUndoScope("Add Connection Point"))
            {
                var cp = new CONS.ConnectionPointCells();
                cp.X    = fx;
                cp.Y    = fy;
                cp.DirX = dirx;
                cp.DirY = diry;
                cp.Type = (int)type;

                foreach (var shape in shapes)
                {
                    int index = CONS.ConnectionPointHelper.Add(shape, cp);
                    indices.Add(index);
                }
            }

            return(indices);
        }