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; }