Esempio n. 1
0
            public static List <XForm> Get(IVisio.Page page, TargetShapeIDs target)
            {
                if (query == null)
                {
                    query      = new VisioAutomation.ShapeSheet.Queries.Query();
                    ColPinX    = query.AddCell(VisioAutomation.ShapeSheet.SRCConstants.PinX, "PinX");
                    ColPinY    = query.AddCell(VisioAutomation.ShapeSheet.SRCConstants.PinY, "PinY");
                    ColLocPinX = query.AddCell(VisioAutomation.ShapeSheet.SRCConstants.LocPinX, "LocPinX");
                    ColLocPinY = query.AddCell(VisioAutomation.ShapeSheet.SRCConstants.LocPinY, "LocPinY");
                    ColWidth   = query.AddCell(VisioAutomation.ShapeSheet.SRCConstants.Width, "Width");
                    ColHeight  = query.AddCell(VisioAutomation.ShapeSheet.SRCConstants.Height, "Height");
                }

                var surface = new VisioAutomation.ShapeSheet.ShapeSheetSurface(page);
                var results = query.GetResults <double>(surface, target.ShapeIDs);

                if (results.Count != target.ShapeIDs.Count)
                {
                    throw new VisioAutomation.Exceptions.InternalAssertionException("Didn't get as many rows back as expected");
                }
                var list = new List <XForm>(target.ShapeIDs.Count);

                foreach (var row in results)
                {
                    var xform = new XForm();
                    xform.PinX    = row.Cells[ColPinX];
                    xform.PinY    = row.Cells[ColPinY];
                    xform.LocPinX = row.Cells[ColLocPinX];
                    xform.LocPinY = row.Cells[ColLocPinY];
                    xform.Width   = row.Cells[ColWidth];
                    xform.Height  = row.Cells[ColHeight];
                    list.Add(xform);
                }
                return(list);
            }
 protected override void ProcessRecord()
 {
     var cellmap = CellSRCDictionary.GetCellMapForPages();
     if (this.Cells == null || this.Cells.Length < 1 || this.Cells.Contains("*"))
     {
         this.Cells = cellmap.GetNames().ToArray();
     }
     Get_VisioPageCell.EnsureEnoughCellNames(this.Cells);
     var target_page = this.Page ?? this.client.Page.Get();
     this.WriteVerbose("Valid Names: " + string.Join(",", cellmap.GetNames()));
     var query = cellmap.CreateQueryFromCellNames(this.Cells);
     var surface = new VA.ShapeSheet.ShapeSheetSurface(target_page);
     var target_shapeids = new[] { surface.Target.Page.PageSheet.ID };
     var dt = Helpers.QueryToDataTable(query, this.GetResults, this.ResultType, target_shapeids, surface);
     this.WriteObject(dt);
 }
Esempio n. 3
0
        protected override void ProcessRecord()
        {
            var cellmap = CellSRCDictionary.GetCellMapForPages();

            if (this.Cells == null || this.Cells.Length < 1 || this.Cells.Contains("*"))
            {
                this.Cells = cellmap.GetNames().ToArray();
            }
            Get_VisioPageCell.EnsureEnoughCellNames(this.Cells);
            var target_page = this.Page ?? this.client.Page.Get();

            this.WriteVerbose("Valid Names: " + string.Join(",", cellmap.GetNames()));
            var query           = cellmap.CreateQueryFromCellNames(this.Cells);
            var surface         = new VA.ShapeSheet.ShapeSheetSurface(target_page);
            var target_shapeids = new[] { surface.Target.Page.PageSheet.ID };
            var dt = Helpers.QueryToDataTable(query, this.GetResults, this.ResultType, target_shapeids, surface);

            this.WriteObject(dt);
        }
Esempio n. 4
0
        public static DataTable QueryToDataTable(VisioAutomation.ShapeSheet.Query.CellQuery cellQuery, bool getresults, Model.ResultType ResultType, IList <int> shapeids, VisioAutomation.ShapeSheet.ShapeSheetSurface surface)
        {
            if (!getresults)
            {
                var output = cellQuery.GetFormulas(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }

            switch (ResultType)
            {
            case Model.ResultType.String:
            {
                var output = cellQuery.GetResults <string>(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }

            case Model.ResultType.Boolean:
            {
                var output = cellQuery.GetResults <bool>(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }

            case Model.ResultType.Double:
            {
                var output = cellQuery.GetResults <double>(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }

            case Model.ResultType.Integer:
            {
                var output = cellQuery.GetResults <int>(surface, shapeids);
                return(Helpers.querytable_to_datatable(cellQuery, output));
            }
            }

            throw new VisioAutomation.Scripting.VisioApplicationException("Unsupported Result type");
        }
Esempio n. 5
0
 public ShapeSheetWriter(Client client, Microsoft.Office.Interop.Visio.Page page)
 {
     this.Client  = client;
     this.Surface = new VisioAutomation.ShapeSheet.ShapeSheetSurface(page);
     this.writer  = new SidSrcWriter();
 }
Esempio n. 6
0
 public void Commit(VisioAutomation.ShapeSheet.ShapeSheetSurface surface)
 {
     this.CommitFormulas(surface);
     this.CommitResults(surface);
 }
Esempio n. 7
0
        public void Commit(IVisio.Master shape)
        {
            var surface = new VisioAutomation.ShapeSheet.ShapeSheetSurface(shape);

            this._commit_to_surface(surface);
        }
Esempio n. 8
0
 public void Commit(VisioAutomation.ShapeSheet.ShapeSheetSurface surface)
 {
     this._commit_to_surface(surface);
 }
Esempio n. 9
0
 protected abstract void _commit_to_surface(VisioAutomation.ShapeSheet.ShapeSheetSurface surface);