private static IList <TabStop> GetTabStops(IVisio.Shape shape) { if (shape == null) { throw new System.ArgumentNullException("shape"); } int num_stops = VA.Text.TextFormat.GetTabStopCount(shape); if (num_stops < 1) { return(new List <TabStop>(0)); } const short row = 0; var srcs = new List <VA.ShapeSheet.SRC>(num_stops * 3); for (int stop_index = 0; stop_index < num_stops; stop_index++) { int i = stop_index * 3; var src_tabpos = new VA.ShapeSheet.SRC(tab_section, row, (short)(i + 1)); var src_tabalign = new VA.ShapeSheet.SRC(tab_section, row, (short)(i + 2)); var src_tabother = new VA.ShapeSheet.SRC(tab_section, row, (short)(i + 3)); srcs.Add(src_tabpos); srcs.Add(src_tabalign); srcs.Add(src_tabother); } var surface = new VA.Drawing.DrawingSurface(shape); var stream = VA.ShapeSheet.SRC.ToStream(srcs); var unitcodes = srcs.Select(i => IVisio.VisUnitCodes.visNumber).ToList(); var results = surface.GetResults_3 <double>(stream, unitcodes); var stops_list = new List <TabStop>(num_stops); for (int stop_index = 0; stop_index < num_stops; stop_index++) { var pos = results[(stop_index * 3) + 1]; var align = (VA.Text.TabStopAlignment)((int)results[(stop_index * 3) + 2]); var ts = new VA.Text.TabStop(pos, align); stops_list.Add(ts); } return(stops_list); }
public QueryResult <T> GetResults <T>(IVisio.Shape shape) { this.Freeze(); var surface = new VA.Drawing.DrawingSurface(shape); var srcstream = BuildSRCStream(surface); var unitcodes = this.BuildUnitCodeArray(1); var values = surface.GetResults_3 <T>(srcstream, unitcodes); var r = new QueryResult <T>(shape.ID); FillValuesForShape <T>(values, r, 0, 0); return(r); }
public QueryResult <CellData <T> > GetFormulasAndResults <T>(IVisio.Shape shape) { this.Freeze(); var surface = new VA.Drawing.DrawingSurface(shape); var srcstream = BuildSRCStream(surface); var unitcodes = this.BuildUnitCodeArray(1); var formulas = surface.GetFormulasU_3(srcstream); var results = surface.GetResults_3 <T>(srcstream, unitcodes); var combineddata = new CellData <T> [results.Length]; for (int i = 0; i < results.Length; i++) { combineddata[i] = new CellData <T>(formulas[i], results[i]); } var r = new QueryResult <CellData <T> >(shape.ID16); FillValuesForShape <CellData <T> >(combineddata, r, 0, 0); return(r); }
private static IList<TabStop> GetTabStops(IVisio.Shape shape) { if (shape == null) { throw new System.ArgumentNullException("shape"); } int num_stops = VA.Text.TextFormat.GetTabStopCount(shape); if (num_stops < 1) { return new List<TabStop>(0); } const short row = 0; var srcs = new List<VA.ShapeSheet.SRC>(num_stops*3); for (int stop_index = 0; stop_index < num_stops; stop_index++) { int i = stop_index * 3; var src_tabpos = new VA.ShapeSheet.SRC(tab_section, row, (short)(i + 1)); var src_tabalign = new VA.ShapeSheet.SRC(tab_section, row, (short)(i + 2)); var src_tabother = new VA.ShapeSheet.SRC(tab_section, row, (short)(i + 3)); srcs.Add(src_tabpos); srcs.Add(src_tabalign ); srcs.Add(src_tabother); } var surface = new VA.Drawing.DrawingSurface(shape); var stream = VA.ShapeSheet.SRC.ToStream(srcs); var unitcodes = srcs.Select(i => IVisio.VisUnitCodes.visNumber).ToList(); var results = surface.GetResults_3<double>(stream, unitcodes); var stops_list = new List<TabStop>(num_stops); for (int stop_index = 0; stop_index < num_stops; stop_index++) { var pos = results[(stop_index*3) + 1]; var align = (VA.Text.TabStopAlignment) ((int)results[(stop_index*3) + 2]); var ts = new VA.Text.TabStop(pos, align); stops_list.Add(ts); } return stops_list; }