private static void Scramble(StringBuilder sb, IVisio.Shape shape) { sb.Clear(); string text = shape.Text; string text_trimmed = text.Trim(); if (text_trimmed.Length >= 1) { shape.Text = VPTRibbon.Scramble(sb, shape.Text); } }
private void cmd_import_colors() { var form = new FormImportColors(); var result = form.ShowDialog(); if (result == DialogResult.OK) { var colors = form.Colors; VPTRibbon.draw_colors(colors); } }
private void buttonScrambleText_Click(object sender, RibbonControlEventArgs e) { var app = Globals.ThisAddIn.Application; var doc = app.ActiveDocument; if (doc == null) { return; } if (doc.Type != IVisio.VisDocumentTypes.visTypeDrawing) { MessageBox.Show("Currently Active Document is not a Drawing"); return; } var activewindow = app.ActiveWindow; var sb = new StringBuilder(); var pages = doc.Pages.AsEnumerable().ToList(); using (var scope = new VA.Application.UndoScope(app, "Scramble Text")) { // Begin Undo Scope doc.Company = VPTRibbon.Scramble(sb, doc.Company); doc.Category = VPTRibbon.Scramble(sb, doc.Category); doc.Title = VPTRibbon.Scramble(sb, doc.Title); doc.Subject = VPTRibbon.Scramble(sb, doc.Subject); doc.Creator = VPTRibbon.Scramble(sb, doc.Creator); doc.Manager = VPTRibbon.Scramble(sb, doc.Manager); doc.Keywords = VPTRibbon.Scramble(sb, doc.Keywords); foreach (var page in pages) { activewindow.Page = page; var shapes = page.Shapes.AsEnumerable().ToList(); foreach (var shape in shapes) { VPTRibbon.Scramble(sb, shape); var shape_shapes = shape.Shapes; if (shape_shapes != null && shape_shapes.Count > 0) { foreach (var nested_shape in VA.Shapes.ShapeHelper.GetNestedShapes(shape)) { VPTRibbon.Scramble(sb, nested_shape); } } } } // End Undo Scope } }