public static bool IsValidSelection(PowerPoint.Selection selection) { if (selection.HasChildShapeRange) { return(IsValidShapeRange(selection.ChildShapeRange)); } if (selection.Type == PowerPoint.PpSelectionType.ppSelectionShapes || selection.Type == PowerPoint.PpSelectionType.ppSelectionText) { return(IsValidShapeRange(selection.ShapeRange)); } EffectsLabUtil.ShowNoSelectionErrorMessage(); return(false); }
public static bool IsValidShapeRange(PowerPoint.ShapeRange shapeRange) { if (shapeRange.Count > 0) { for (int i = 1; i <= shapeRange.Count; i++) { if (shapeRange[i].Type != Office.MsoShapeType.msoPlaceholder && shapeRange[i].Type != Office.MsoShapeType.msoTextBox && shapeRange[i].Type != Office.MsoShapeType.msoAutoShape && shapeRange[i].Type != Office.MsoShapeType.msoFreeform && shapeRange[i].Type != Office.MsoShapeType.msoGroup) { EffectsLabUtil.ShowIncorrectSelectionErrorMessage(); return(false); } } } else { EffectsLabUtil.ShowNoSelectionErrorMessage(); return(false); } return(true); }