public void SetSize(IList <IVisio.Shape> target_shapes, double?w, double?h) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var shapes = GetTargetShapes(target_shapes); if (shapes.Count < 1) { return; } var shapeids = shapes.Select(s => s.ID).ToList(); var update = new VA.ShapeSheet.Update(); foreach (int shapeid in shapeids) { if (w.HasValue && w.Value >= 0) { update.SetFormula((short)shapeid, VA.ShapeSheet.SRCConstants.Width, w.Value); } if (h.HasValue && h.Value >= 0) { update.SetFormula((short)shapeid, VA.ShapeSheet.SRCConstants.Height, h.Value); } } var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Set Shape Size")) { var active_page = application.ActivePage; update.Execute(active_page); } }
public void SetLock(IList <IVisio.Shape> target_shapes, VA.Shapes.LockCells lockcells) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var shapes = GetTargetShapes(target_shapes); if (shapes.Count < 1) { return; } var selection = this.Client.Selection.Get(); var shapeids = selection.GetIDs(); var update = new VA.ShapeSheet.Update(); foreach (int shapeid in shapeids) { update.SetFormulas((short)shapeid, lockcells); } var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Set Shape Lock Properties")) { var active_page = application.ActivePage; update.Execute(active_page); } }
public void SnapSize(IList <IVisio.Shape> target_shapes, double w, double h) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var shapes = GetTargetShapes(target_shapes); if (shapes.Count < 1) { return; } var shapes_2d = shapes.Where(s => s.OneD == 0).ToList(); var shapeids = shapes_2d.Select(s => s.ID).ToList(); var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Snape Shape Sizes")) { var active_page = application.ActivePage; var snapsize = new VA.Drawing.Size(w, h); var minsize = new VA.Drawing.Size(w, h); SnapSize(active_page, shapeids, snapsize, minsize); } }
public void Nudge(IList <IVisio.Shape> target_shapes, double dx, double dy) { if (dx == 0.0 && dy == 0.0) { return; } this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); int shape_count = this.GetTargetSelection(target_shapes); if (shape_count < 1) { return; } var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Nudge Shapes")) { var selection = this.Client.Selection.Get(); var unitcode = IVisio.VisUnitCodes.visInches; // Move method: http://msdn.microsoft.com/en-us/library/ms367549.aspx selection.Move(dx, dy, unitcode); } }
public void SnapCorner(double w, double h, VA.Arrange.SnapCornerPosition corner) { if (!this.Client.HasSelectedShapes()) { return; } var shapes_2d = Client.Selection.EnumShapes2D().ToList(); var shapeids = shapes_2d.Select(s => s.ID).ToList(); var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(application, "SnapCorner")) { var active_page = application.ActivePage; ArrangeHelper.SnapCorner(active_page, shapeids, new VA.Drawing.Size(w, h), corner); } }
public void Distribute(IList <IVisio.Shape> target_shapes, VA.Drawing.Axis axis) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); int shape_count = this.GetTargetSelection(target_shapes); if (shape_count < 1) { return; } var cmd = _map_axis_to_uicmd(axis); using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Distribute Shapes")) { this.Client.VisioApplication.DoCmd((short)cmd); } }
public void Align(IList<IVisio.Shape> target_shapes, VA.Drawing.AlignmentHorizontal align) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); int shape_count = this.GetTargetSelection(target_shapes); if (shape_count < 2) { return; } using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication,"Align Shapes")) { bool glue_to_guide = false; var selection = Client.Selection.Get(); var halign = _map_isd_halign_to_visio_halign(align); var valign = IVisio.VisVerticalAlignTypes.visVertAlignNone; selection.Align(halign, valign, glue_to_guide); } }
public void Align(IList <IVisio.Shape> target_shapes, VA.Drawing.AlignmentHorizontal align) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); int shape_count = this.GetTargetSelection(target_shapes); if (shape_count < 2) { return; } using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Align Shapes")) { bool glue_to_guide = false; var selection = Client.Selection.Get(); var halign = _map_isd_halign_to_visio_halign(align); var valign = IVisio.VisVerticalAlignTypes.visVertAlignNone; selection.Align(halign, valign, glue_to_guide); } }
public void Stack(Drawing.Axis axis, double space) { if (!this.Client.HasSelectedShapes(2)) { return; } if (space < 0.0) { throw new System.ArgumentOutOfRangeException("space", "must be non-negative"); } var application = this.Client.VisioApplication; using (var undoscope = new UndoScope(application,"Stack")) { if (axis == VA.Drawing.Axis.YAxis) { Align(null,VA.Drawing.AlignmentHorizontal.Center); } else { Align(null,VA.Drawing.AlignmentVertical.Center); } Distribute(axis, space); } }
public void SnapSize(IList<IVisio.Shape> target_shapes, double w, double h) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var shapes = GetTargetShapes(target_shapes); if (shapes.Count < 1) { return; } var shapes_2d = shapes.Where(s=>s.OneD==0).ToList(); var shapeids = shapes_2d.Select(s => s.ID).ToList(); var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication,"Snape Shape Sizes")) { var active_page = application.ActivePage; var snapsize = new VA.Drawing.Size(w, h); var minsize = new VA.Drawing.Size(w, h); SnapSize(active_page, shapeids, snapsize, minsize); } }
public void SnapCorner(double w, double h, VA.Arrange.SnapCornerPosition corner) { if (!this.Client.HasSelectedShapes()) { return; } var shapes_2d = Client.Selection.EnumShapes2D().ToList(); var shapeids = shapes_2d.Select(s => s.ID).ToList(); var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(application,"SnapCorner")) { var active_page = application.ActivePage; ArrangeHelper.SnapCorner(active_page, shapeids, new VA.Drawing.Size(w, h), corner); } }
public void SetSize(IList<IVisio.Shape> target_shapes, double? w, double? h) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var shapes = GetTargetShapes(target_shapes); if (shapes.Count < 1) { return; } var shapeids = shapes.Select(s=>s.ID).ToList(); var update = new VA.ShapeSheet.Update(); foreach (int shapeid in shapeids) { if (w.HasValue && w.Value>=0) { update.SetFormula((short)shapeid, VA.ShapeSheet.SRCConstants.Width, w.Value); } if (h.HasValue && h.Value >= 0) { update.SetFormula((short)shapeid, VA.ShapeSheet.SRCConstants.Height, h.Value); } } var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication,"Set Shape Size")) { var active_page = application.ActivePage; update.Execute(active_page); } }
public void SetLock(IList<IVisio.Shape> target_shapes, VA.Shapes.LockCells lockcells) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); var shapes = GetTargetShapes(target_shapes); if (shapes.Count < 1) { return; } var selection = this.Client.Selection.Get(); var shapeids = selection.GetIDs(); var update = new VA.ShapeSheet.Update(); foreach (int shapeid in shapeids) { update.SetFormulas((short)shapeid, lockcells); } var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication,"Set Shape Lock Properties")) { var active_page = application.ActivePage; update.Execute(active_page); } }
public void Nudge(IList<IVisio.Shape> target_shapes, double dx, double dy) { if (dx == 0.0 && dy == 0.0) { return; } this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); int shape_count = this.GetTargetSelection(target_shapes); if (shape_count < 1) { return; } var application = this.Client.VisioApplication; using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication,"Nudge Shapes")) { var selection = this.Client.Selection.Get(); var unitcode = IVisio.VisUnitCodes.visInches; // Move method: http://msdn.microsoft.com/en-us/library/ms367549.aspx selection.Move(dx, dy, unitcode); } }
public void Distribute(VA.Drawing.Axis axis, double d) { if (!this.Client.HasActiveDocument) { return; } var application = this.Client.VisioApplication; var selection = this.Client.Selection.Get(); var shapeids = selection.GetIDs(); using (var undoscope = new UndoScope(application,"Distribute")) { ArrangeHelper.DistributeWithSpacing(application.ActivePage, shapeids, axis, d); } }
public void Distribute(IList<IVisio.Shape> target_shapes, VA.Drawing.Axis axis) { this.AssertApplicationAvailable(); this.AssertDocumentAvailable(); int shape_count = this.GetTargetSelection(target_shapes); if (shape_count < 1) { return; } var cmd = _map_axis_to_uicmd(axis); using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication,"Distribute Shapes")) { this.Client.VisioApplication.DoCmd((short)cmd); } }