Beispiel #1
0
        public IDictionary <IVisio.Shape, IList <VA.Shapes.ConnectionPointCells> > GetConnectionPoints(TargetShapes targetshapes)
        {
            targetshapes = targetshapes.Resolve(this._client);

            if (targetshapes.Shapes.Count < 1)
            {
                return(new Dictionary <IVisio.Shape, IList <VA.Shapes.ConnectionPointCells> >());
            }

            var dicof_shape_to_cxnpoint = new Dictionary <IVisio.Shape, IList <VA.Shapes.ConnectionPointCells> >();

            foreach (var shape in targetshapes.Shapes)
            {
                var cp = VisioAutomation.Shapes.ConnectionPointCells.GetCells(shape, VASS.CellValueType.Formula);
                dicof_shape_to_cxnpoint[shape] = cp;
            }

            return(dicof_shape_to_cxnpoint);
        }
        public IDictionary <IVisio.Shape, CustomPropertyDictionary> GetCustomPropertiesAsShapeDictionary(TargetShapes targetshapes, VASS.CellValueType type)
        {
            targetshapes = targetshapes.ResolveToShapes(this._client);
            var dicof_shape_to_cpdic = new Dictionary <IVisio.Shape, CustomPropertyDictionary>();
            var listof_cpdic         = GetCustomProperties(targetshapes, type);

            for (int i = 0; i < listof_cpdic.Count; i++)
            {
                var shape = targetshapes.Shapes[i];
                var cpdic = listof_cpdic[i];
                dicof_shape_to_cpdic[shape] = cpdic;
            }

            return(dicof_shape_to_cpdic);
        }
Beispiel #3
0
        public void Scripting_CustomProps_Scenarios()
        {
            var client = this.GetScriptingClient();

            client.Document.New();
            client.Page.New(new VA.Drawing.Size(4, 4), false);

            var s1 = client.Draw.Rectangle(1, 1, 1.25, 1.5);
            var s2 = client.Draw.Rectangle(2, 3, 2.5, 3.5);
            var s3 = client.Draw.Rectangle(4.5, 2.5, 6, 3.5);

            client.Selection.SelectNone();
            client.Selection.Select(s1);
            client.Selection.Select(s2);
            client.Selection.Select(s3);

            var targets   = new TargetShapes();
            var prop_dic0 = client.CustomProp.Get(targets);

            Assert.AreEqual(3, prop_dic0.Count);
            Assert.AreEqual(0, prop_dic0[s1].Count);
            Assert.AreEqual(0, prop_dic0[s2].Count);
            Assert.AreEqual(0, prop_dic0[s3].Count);

            var cp = new CustomPropertyCells();

            cp.Value = "BAR";
            client.CustomProp.Set(targets, "FOO", cp);

            var prop_dic1 = client.CustomProp.Get(targets);

            Assert.AreEqual(3, prop_dic1.Count);
            Assert.AreEqual(1, prop_dic1[s1].Count);
            Assert.AreEqual(1, prop_dic1[s2].Count);
            Assert.AreEqual(1, prop_dic1[s3].Count);

            var cp1 = prop_dic1[s1]["FOO"];
            var cp2 = prop_dic1[s2]["FOO"];
            var cp3 = prop_dic1[s3]["FOO"];

            Assert.AreEqual("\"BAR\"", cp1.Value.Formula);
            Assert.AreEqual("\"BAR\"", cp2.Value.Formula);
            Assert.AreEqual("\"BAR\"", cp3.Value.Formula);


            var hasprops0 = client.CustomProp.Contains(targets, "FOO");

            Assert.IsTrue(hasprops0.All(v => v == true));

            client.CustomProp.Delete(targets, "FOO");

            var prop_dic2 = client.CustomProp.Get(targets);

            Assert.AreEqual(3, prop_dic2.Count);
            Assert.AreEqual(0, prop_dic2[s1].Count);
            Assert.AreEqual(0, prop_dic2[s2].Count);
            Assert.AreEqual(0, prop_dic2[s3].Count);

            var hasprops1 = client.CustomProp.Contains(targets, "FOO");

            Assert.IsTrue(hasprops1.All(v => v == false));

            client.Document.Close(true);
        }
        public IDictionary <IVisio.Shape, CustomPropertyDictionary> GetCustomProperties(TargetShapes targetshapes)
        {
            var cmdtarget = this._client.GetCommandTargetPage();

            var dicof_shape_to_cpdic = new Dictionary <IVisio.Shape, CustomPropertyDictionary>();

            targetshapes = targetshapes.Resolve(this._client);

            if (targetshapes.Shapes.Count < 1)
            {
                return(dicof_shape_to_cpdic);
            }

            var shapeidpairs = targetshapes.ToShapeIDPairs();
            var listof_cpdic = CustomPropertyHelper.GetCellsAsDictionary(cmdtarget.ActivePage, shapeidpairs, CellValueType.Formula);


            for (int i = 0; i < targetshapes.Shapes.Count; i++)
            {
                var shape = targetshapes.Shapes[i];
                var cpdic = listof_cpdic[i];
                dicof_shape_to_cpdic[shape] = cpdic;
            }

            return(dicof_shape_to_cpdic);
        }
Beispiel #5
0
        public Dictionary <IVisio.Shape, VA.Shapes.UserDefinedCellDictionary> GetUserDefinedCellsAsShapeDictionary(TargetShapes targetshapes, VASS.CellValueType cvt)
        {
            targetshapes = targetshapes.ResolveToShapes(this._client);
            var listof_udcelldic = GetUserDefinedCells(targetshapes, cvt);

            var dicof_shape_to_udcelldic = new Dictionary <IVisio.Shape, VA.Shapes.UserDefinedCellDictionary>();

            for (int i = 0; i < listof_udcelldic.Count; i++)
            {
                var shape = targetshapes.Shapes[i];
                var props = listof_udcelldic[i];
                dicof_shape_to_udcelldic[shape] = props;
            }

            return(dicof_shape_to_udcelldic);
        }
Beispiel #6
0
        protected override void ProcessRecord()
        {
            var targets = new TargetShapes(this.Shapes);

            this.Client.Grouping.Ungroup(targets);
        }
Beispiel #7
0
        protected override void ProcessRecord()
        {
            var targets = new TargetShapes(this.Shapes);

            this.Client.Text.Set(targets, this.Text);
        }
Beispiel #8
0
        protected override void ProcessRecord()
        {
            var targets = new TargetShapes(this.Shapes);

            this.Client.Selection.Duplicate(targets);
        }
Beispiel #9
0
        protected override void ProcessRecord()
        {
            var targets = new TargetShapes(this.Shapes);

            this.Client.Hyperlink.Delete(targets, this.Index);
        }
        public Dictionary <IVisio.Shape, VA.Shapes.UserDefinedCellDictionary> GetUserDefinedCells(TargetShapes targetshapes, VASS.CellValueType cvt)
        {
            var cmdtarget = this._client.GetCommandTargetPage();
            var dicof_shape_to_udcelldic = new Dictionary <IVisio.Shape, VA.Shapes.UserDefinedCellDictionary>();

            targetshapes = targetshapes.Resolve(this._client);

            if (targetshapes.Shapes.Count < 1)
            {
                return(dicof_shape_to_udcelldic);
            }

            var page             = cmdtarget.ActivePage;
            var shapeidpairs     = targetshapes.ToShapeIDPairs();
            var listof_udcelldic = VA.Shapes.UserDefinedCellHelper.GetCellsAsDictionary((IVisio.Page)page, shapeidpairs, cvt);

            for (int i = 0; i < targetshapes.Shapes.Count; i++)
            {
                var shape = targetshapes.Shapes[i];
                var props = listof_udcelldic[i];
                dicof_shape_to_udcelldic[shape] = props;
            }

            return(dicof_shape_to_udcelldic);
        }
Beispiel #11
0
        protected override void ProcessRecord()
        {
            var targets = new TargetShapes(this.Shapes);

            this.Client.UserDefinedCell.Delete(targets, this.Name);
        }
Beispiel #12
0
        protected override void ProcessRecord()
        {
            var targets = new TargetShapes(this.Shapes);

            this.Client.CustomProp.Delete(targets, this.Name);
        }