public override Bitmap DisplayImage(Shape formatShape) { return(SyncFormatUtil.GetTextDisplay( Math.Round(formatShape.Fill.Transparency * 100).ToString() + "%", SyncFormatConstants.DisplayImageFont, SyncFormatConstants.DisplayImageSize)); }
public static Bitmap DisplayImage(Shape formatShape) { return(SyncFormatUtil.GetTextDisplay( Math.Max(formatShape.Line.Weight, 0).ToString(".#"), SyncFormatConstants.DisplayImageFont, SyncFormatConstants.DisplayImageSize)); }
public override Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddShape( MsoAutoShapeType.msoShapeRectangle, 0, 0, SyncFormatConstants.DisplayImageSize.Width, SyncFormatConstants.DisplayImageSize.Height); shape.Line.Visible = MsoTriState.msoFalse; shape.ThreeD.Depth = SyncFormatConstants.DisplayImageDepth; shape.ThreeD.BevelTopType = SyncFormatConstants.DisplayBevelType; shape.ThreeD.BevelTopDepth = SyncFormatConstants.DisplayBevelHeight; shape.ThreeD.BevelTopInset = SyncFormatConstants.DisplayBevelWidth; shape.ThreeD.BevelBottomType = SyncFormatConstants.DisplayBevelType; shape.ThreeD.BevelBottomDepth = SyncFormatConstants.DisplayBevelHeight; shape.ThreeD.BevelBottomInset = SyncFormatConstants.DisplayBevelWidth; // setting mixed throws an exception // show flat type instead, which looks very similar if (formatShape.ThreeD.PresetMaterial == MsoPresetMaterial.msoPresetMaterialMixed) { shape.ThreeD.PresetMaterial = MsoPresetMaterial.msoMaterialFlat; } else { shape.ThreeD.PresetMaterial = formatShape.ThreeD.PresetMaterial; } shape.ThreeD.SetPresetCamera(SyncFormatConstants.DisplayCameraPreset); Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape)); shape.Delete(); return(image); }
public override Bitmap DisplayImage(Shape formatShape) { return(SyncFormatUtil.GetTextDisplay( $"{formatShape.ThreeD.LightAngle}{SyncFormatConstants.DisplayDegreeSymbol}", SyncFormatConstants.DisplayImageFont, SyncFormatConstants.DisplayImageSize)); }
public override Bitmap DisplayImage(Shape formatShape) { return(SyncFormatUtil.GetTextDisplay( Math.Round(formatShape.Left).ToString(), SyncFormatConstants.DisplayImageFont, SyncFormatConstants.DisplayImageSize)); }
public SyncFormatDialog(Shape shape, string formatName, FormatTreeNode[] formats) { InitializeComponent(); this.shape = shape; formatName = formatName.Trim(); if (SyncFormatUtil.IsValidFormatName(formatName)) { originalName = formatName; } else { originalName = SyncLabText.DefaultFormatName; } originalName = formatName; ObjectName = originalName; this.Formats = formats; foreach (FormatTreeNode format in formats) { Object treeItem = DialogItemFromFormatTree(shape, format); if (treeItem != null) { treeView.Items.Add(treeItem); } } ScrollToTop(); }
private Bitmap[] ShapeTypesToBitmaps(Array types, string shapeType) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Bitmap[] bitmaps = new Bitmap[types.Length]; for (int i = 0; i < types.Length; i++) { if (!((MsoAutoShapeType)types.GetValue(i)).ToString().Contains(shapeType)) { continue; } try { Shape shape = shapes.AddShape( (MsoAutoShapeType)types.GetValue(i), 0, 0, TooltipsLabConstants.DisplayImageSize.Width, TooltipsLabConstants.DisplayImageSize.Height); ShapeUtil.FormatCalloutToDefaultStyle(shape); bitmaps[i] = new Bitmap(GraphicsUtil.ShapeToBitmap(shape)); shape.SafeDelete(); } catch { } } return(bitmaps); }
public override Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddShape( MsoAutoShapeType.msoShapeRectangle, 0, 0, SyncFormatConstants.DisplayImageSize.Width, SyncFormatConstants.DisplayImageSize.Height); shape.Line.Visible = MsoTriState.msoFalse; shape.ThreeD.Depth = SyncFormatConstants.DisplayImageDepth; shape.ThreeD.BevelTopType = SyncFormatConstants.DisplayBevelType; shape.ThreeD.BevelTopDepth = SyncFormatConstants.DisplayBevelHeight; shape.ThreeD.BevelTopInset = SyncFormatConstants.DisplayBevelWidth; shape.ThreeD.BevelBottomType = SyncFormatConstants.DisplayBevelType; shape.ThreeD.BevelBottomDepth = SyncFormatConstants.DisplayBevelHeight; shape.ThreeD.BevelBottomInset = SyncFormatConstants.DisplayBevelWidth; // setting mixed throws an exception if (formatShape.ThreeD.PresetLighting != MsoLightRigType.msoLightRigMixed) { shape.ThreeD.PresetLighting = formatShape.ThreeD.PresetLighting; } shape.ThreeD.SetPresetCamera(SyncFormatConstants.DisplayCameraPreset); Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape)); shape.Delete(); return(image); }
public override Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddShape( MsoAutoShapeType.msoShapeRectangle, 0, 0, SyncFormatConstants.DisplayImageSize.Width, SyncFormatConstants.DisplayImageSize.Height); shape.Line.Visible = MsoTriState.msoFalse; shape.ThreeD.Depth = SyncFormatConstants.DisplayImageDepth; // don't set type if type is TypeMixed, it throws an exception if (formatShape.ThreeD.BevelTopType != MsoBevelType.msoBevelTypeMixed) { shape.ThreeD.BevelTopType = formatShape.ThreeD.BevelTopType; // set depth & inset only if type is not none, // adjusting these 2 will automatically set type from None to Round if (shape.ThreeD.BevelTopType != MsoBevelType.msoBevelNone) { shape.ThreeD.BevelTopDepth = SyncFormatConstants.DisplayBevelHeight; shape.ThreeD.BevelTopInset = SyncFormatConstants.DisplayBevelWidth; } } shape.ThreeD.BevelBottomType = MsoBevelType.msoBevelNone; shape.ThreeD.SetPresetCamera(MsoPresetCamera.msoCameraPerspectiveAbove); shape.ThreeD.PresetLighting = MsoLightRigType.msoLightRigBalanced; Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape)); shape.Delete(); return(image); }
public static Bitmap DisplayImage(Shape formatShape) { return(SyncFormatUtil.GetTextDisplay( Math.Round(formatShape.Width).ToString(), SyncFormatConstants.DisplayImageFont, SyncFormatConstants.DisplayImageSize)); }
public override Bitmap DisplayImage(Shape formatShape) { return(SyncFormatUtil.GetTextDisplay( $"{Math.Round(formatShape.ThreeD.ContourWidth, 1)} {SyncFormatConstants.DisplaySizeUnit}", SyncFormatConstants.DisplayImageFont, SyncFormatConstants.DisplayImageSize)); }
public override Bitmap DisplayImage(Shape formatShape) { return(SyncFormatUtil.GetTextDisplay( SyncFormatConstants.DisplayFontString, new System.Drawing.Font(formatShape.TextEffect.FontName, SyncFormatConstants.DisplayImageFontSize), SyncFormatConstants.DisplayImageSize)); }
public override Bitmap DisplayImage(Shape formatShape) { // transparency is a float from 0-1, multiply by 100 to get percentage return(SyncFormatUtil.GetTextDisplay( Math.Round(formatShape.Reflection.Transparency * 100).ToString() + "%", SyncFormatConstants.DisplayImageFont, SyncFormatConstants.DisplayImageSize)); }
public static bool IsPlaceholderSyncable(this Shape shape) { if (shape.Type != MsoShapeType.msoPlaceholder) { return(false); } Microsoft.Office.Interop.PowerPoint.Shapes templateShapes = SyncFormatUtil.GetTemplateShapes(); return(ShapeUtil.CanCopyMsoPlaceHolder(shape, templateShapes)); }
private void CopyButton_Click(object sender, RoutedEventArgs e) { Selection selection = this.GetCurrentSelection(); if ((selection.Type != PpSelectionType.ppSelectionShapes && selection.Type != PpSelectionType.ppSelectionText) || selection.ShapeRange.Count != 1) { MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle); return; } Shape shape = selection.ShapeRange[1]; if (shape.Type == MsoShapeType.msoSmartArt) { MessageBox.Show(SyncLabText.ErrorSmartArtUnsupported, SyncLabText.ErrorDialogTitle); return; } if (selection.HasChildShapeRange) { if (selection.ChildShapeRange.Count != 1) { MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle); return; } shape = selection.ChildShapeRange[1]; } bool canSyncPlaceHolder = shape.Type == MsoShapeType.msoPlaceholder && ShapeUtil.CanCopyMsoPlaceHolder(shape, SyncFormatUtil.GetTemplateShapes()); if (shape.Type != MsoShapeType.msoAutoShape && shape.Type != MsoShapeType.msoLine && shape.Type != MsoShapeType.msoPicture && shape.Type != MsoShapeType.msoTextBox && !canSyncPlaceHolder) { MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle); return; } Dialog = new SyncFormatDialog(shape); Dialog.ObjectName = shape.Name; bool?result = Dialog.ShowDialog(); if (!result.HasValue || !(bool)result) { return; } AddFormatToList(shape, Dialog.ObjectName, Dialog.Formats); Dialog = null; }
public override Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddLine( 0, SyncFormatConstants.DisplayImageSize.Height, SyncFormatConstants.DisplayImageSize.Width, 0); SyncFormat(formatShape, shape); Bitmap image = GraphicsUtil.ShapeToBitmap(shape); shape.Delete(); return(image); }
public override Bitmap DisplayImage(Shape formatShape) { string spacingArt = "--------\n" + "____\n"; return(SyncFormatUtil.GetTextDisplay( spacingArt, new System.Drawing.Font(formatShape.TextEffect.FontName, SyncFormatConstants.DisplayImageFontSize, FontStyle.Bold), SyncFormatConstants.DisplayImageSize)); }
public override Bitmap DisplayImage(Shape formatShape) { float depth = formatShape.ThreeD.Depth; if (HasErrorneousDepth(formatShape)) { depth = 0f; } return(SyncFormatUtil.GetTextDisplay( $"{Math.Round(depth, 1)} {SyncFormatConstants.DisplaySizeUnit}", SyncFormatConstants.DisplayImageFont, SyncFormatConstants.DisplayImageSize)); }
public static Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddShape( Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0, SyncFormatConstants.DisplayImageSize.Width, SyncFormatConstants.DisplayImageSize.Height); shape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse; SyncFormat(formatShape, shape); Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape)); shape.Delete(); return(image); }
public static Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddLine( 0, SyncFormatConstants.DisplayImageSize.Height, SyncFormatConstants.DisplayImageSize.Width, 0); SyncFormat(formatShape, shape); shape.Line.ForeColor.RGB = SyncFormatConstants.ColorBlack; shape.Line.Weight = SyncFormatConstants.DisplayLineWeight; Bitmap image = GraphicsUtil.ShapeToBitmap(shape); shape.Delete(); return(image); }
public override Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddShape( Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0, SyncFormatConstants.DisplayImageSize.Width, SyncFormatConstants.DisplayImageSize.Height); shape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse; shape.Fill.ForeColor = formatShape.Line.ForeColor; Bitmap image = GraphicsUtil.ShapeToBitmap(shape); shape.SafeDelete(); return(image); }
public override Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddShape( MsoAutoShapeType.msoShapeRectangle, 0, 0, SyncFormatConstants.DisplayImageSize.Width, SyncFormatConstants.DisplayImageSize.Height); // do not sync extrusion theme color with forecolor, it throws an exception shape.Fill.ForeColor.RGB = formatShape.ThreeD.ExtrusionColor.RGB; shape.Fill.ForeColor.TintAndShade = formatShape.ThreeD.ExtrusionColor.TintAndShade; shape.Line.Visible = MsoTriState.msoFalse; Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape)); shape.SafeDelete(); return(image); }
public override Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddShape( MsoAutoShapeType.msoShapeRectangle, 0, 0, SyncFormatConstants.DisplayImageSize.Width, SyncFormatConstants.DisplayImageSize.Height); shape.Fill.ForeColor.RGB = formatShape.ThreeD.ContourColor.RGB; shape.Fill.ForeColor.TintAndShade = formatShape.ThreeD.ContourColor.TintAndShade; shape.Line.Visible = MsoTriState.msoFalse; Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape)); shape.Delete(); return(image); }
public static Bitmap DisplayImage(Shape formatShape) { Shapes shapes = SyncFormatUtil.GetTemplateShapes(); Shape shape = shapes.AddShape( Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0, SyncFormatConstants.DisplayImageSize.Width, SyncFormatConstants.DisplayImageSize.Height); shape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse; shape.Fill.ForeColor.RGB = formatShape.TextFrame.TextRange.Font.Color.RGB; shape.Fill.BackColor.RGB = formatShape.TextFrame.TextRange.Font.Color.RGB; shape.Fill.Solid(); Bitmap image = GraphicsUtil.ShapeToBitmap(shape); shape.Delete(); return(image); }
public static Bitmap DisplayImage(Shape formatShape) { System.Drawing.Font font = SyncFormatConstants.DisplayImageFont; Microsoft.Office.Interop.PowerPoint.Font formatFont = formatShape.TextFrame.TextRange.Font; FontStyle style = 0; if (formatFont.Underline == Microsoft.Office.Core.MsoTriState.msoTrue) { style |= FontStyle.Underline; } if (formatFont.Bold == Microsoft.Office.Core.MsoTriState.msoTrue) { style |= FontStyle.Bold; } if (formatFont.Italic == Microsoft.Office.Core.MsoTriState.msoTrue) { style |= FontStyle.Italic; } font = new System.Drawing.Font(font.FontFamily, font.Size, style); return(SyncFormatUtil.GetTextDisplay(SyncFormatConstants.DisplayFontString, font, SyncFormatConstants.DisplayImageSize)); }