private static Drawing.Size GetSize(IVisio.Page page) { var query = new ShapeSheet.Query.CellQuery(); var col_height = query.AddCell(ShapeSheet.SRCConstants.PageHeight,"PageHeight"); var col_width = query.AddCell(ShapeSheet.SRCConstants.PageWidth,"PageWidth"); var results = query.GetResults<double>(page.PageSheet); double height = results[col_height]; double width = results[col_width]; var s = new Drawing.Size(width, height); return s; }
private static Drawing.Size GetSize(IVisio.Page page) { var query = new ShapeSheet.Query.CellQuery(); var col_height = query.AddCell(ShapeSheet.SRCConstants.PageHeight, "PageHeight"); var col_width = query.AddCell(ShapeSheet.SRCConstants.PageWidth, "PageWidth"); var results = query.GetResults <double>(page.PageSheet); double height = results[col_height]; double width = results[col_width]; var s = new Drawing.Size(width, height); return(s); }
public Drawing.Size GetSize() { this.Client.Application.AssertApplicationAvailable(); this.Client.Document.AssertDocumentAvailable(); var application = this.Client.Application.Get(); var active_page = application.ActivePage; var query = new ShapeSheet.Query.CellQuery(); var col_height = query.AddCell(ShapeSheet.SRCConstants.PageHeight, "PageHeight"); var col_width = query.AddCell(ShapeSheet.SRCConstants.PageWidth, "PageWidth"); var results = query.GetResults <double>(active_page.PageSheet); double height = results[col_height]; double width = results[col_width]; var s = new Drawing.Size(width, height); return(s); }
/// <summary> /// Caches the resize (the results, not formulas) of a the first currently selected shape /// </summary> public void CopySize() { this.Client.Application.AssertApplicationAvailable(); this.Client.Document.AssertDocumentAvailable(); if (!this.Client.Selection.HasShapes()) { return; } var application = this.Client.Application.Get(); var active_window = application.ActiveWindow; var selection = active_window.Selection; var shape = selection[1]; var query = new ShapeSheet.Query.CellQuery(); var width_col = query.AddCell(ShapeSheet.SRCConstants.Width, "Width"); var height_col = query.AddCell(ShapeSheet.SRCConstants.Height, "Height"); var queryresults = query.GetResults<double>(shape); this.cached_size_width = queryresults[width_col]; this.cached_size_height = queryresults[height_col]; }
/// <summary> /// Caches the resize (the results, not formulas) of a the first currently selected shape /// </summary> public void CopySize() { this.Client.Application.AssertApplicationAvailable(); this.Client.Document.AssertDocumentAvailable(); if (!this.Client.Selection.HasShapes()) { return; } var application = this.Client.Application.Get(); var active_window = application.ActiveWindow; var selection = active_window.Selection; var shape = selection[1]; var query = new ShapeSheet.Query.CellQuery(); var width_col = query.AddCell(ShapeSheet.SRCConstants.Width, "Width"); var height_col = query.AddCell(ShapeSheet.SRCConstants.Height, "Height"); var queryresults = query.GetResults <double>(shape); this.cached_size_width = queryresults[width_col]; this.cached_size_height = queryresults[height_col]; }
public Drawing.Size GetSize() { this.Client.Application.AssertApplicationAvailable(); this.Client.Document.AssertDocumentAvailable(); var application = this.Client.Application.Get(); var active_page = application.ActivePage; var query = new ShapeSheet.Query.CellQuery(); var col_height = query.AddCell(ShapeSheet.SRCConstants.PageHeight, "PageHeight"); var col_width = query.AddCell(ShapeSheet.SRCConstants.PageWidth, "PageWidth"); var results = query.GetResults<double>(active_page.PageSheet); double height = results[col_height]; double width = results[col_width]; var s = new Drawing.Size(width, height); return s; }
/// <summary> /// Returns all the directed,connected pairs of shapes in the page /// </summary> /// <param name="page"></param> /// <param name="flag"></param> /// <returns></returns> public static IList <ConnectorEdge> GetDirectedEdges( IVisio.Page page, ConnectorEdgeHandling flag) { if (page == null) { throw new System.ArgumentNullException(nameof(page)); } var edges = PathAnalysis.GetDirectedEdgesRaw(page); if (flag == ConnectorEdgeHandling.Raw) { return(edges); } // At this point we know we need to analyze the connetor arrows to produce the correct results var connnector_ids = edges.Select(e => e.Connector.ID).ToList(); // Get the arrows for each connector var src_beginarrow = ShapeSheet.SRCConstants.BeginArrow; var src_endarrow = ShapeSheet.SRCConstants.EndArrow; var query = new ShapeSheet.Query.CellQuery(); var col_beginarrow = query.AddCell(src_beginarrow, "BeginArrow"); var col_endarrow = query.AddCell(src_endarrow, "EndArrow"); var arrow_table = query.GetResults <int>(page, connnector_ids); IList <ConnectorEdge> directed_edges = new List <ConnectorEdge>(); int connector_index = 0; foreach (var e in edges) { int beginarrow = arrow_table[connector_index][col_beginarrow]; int endarrow = arrow_table[connector_index][col_endarrow]; if ((beginarrow < 1) && (endarrow < 1)) { // the line has no arrows if (flag == ConnectorEdgeHandling.Arrow_TreatConnectorsWithoutArrowsAsBidirectional) { // in this case treat the connector as pointing in both directions var de1 = new ConnectorEdge(e.Connector, e.To, e.From); var de2 = new ConnectorEdge(e.Connector, e.From, e.To); directed_edges.Add(de1); directed_edges.Add(de2); } else if (flag == ConnectorEdgeHandling.Arrow_ExcludeConnectorsWithoutArrows) { // in this case ignore the connector completely } else { throw new AutomationException("Internal error"); } } else { // The connector has either a from-arrow, a to-arrow, or both // handle if it has a from arrow if (beginarrow > 0) { var de = new ConnectorEdge(e.Connector, e.To, e.From); directed_edges.Add(de); } // handle if it has a to arrow if (endarrow > 0) { var de = new ConnectorEdge(e.Connector, e.From, e.To); directed_edges.Add(de); } } connector_index++; } return(directed_edges); }