public static void BlackWhiteBackgroundEffect(PowerPointSlide curSlide, Selection selection)
        {
            var effectSlide = EffectsLabUtil.GenerateEffectSlide(curSlide, selection, false);

            if (effectSlide == null)
            {
                return;
            }

            effectSlide.BlackWhiteBackground();
            effectSlide.GetNativeSlide().Select();
        }
示例#2
0
        public static void ExecuteBlurBackground(Models.PowerPointSlide slide, PowerPoint.Selection selection, int percentage)
        {
            Models.PowerPointBgEffectSlide effectSlide = EffectsLabUtil.GenerateEffectSlide(slide, selection, false);

            if (effectSlide == null)
            {
                return;
            }

            effectSlide.BlurBackground(percentage, EffectsLabSettings.IsTintBackground);
            effectSlide.GetNativeSlide().Select();
        }
        public static void SepiaRemainderEffect(PowerPointSlide curSlide, Selection selection)
        {
            var effectSlide = EffectsLabUtil.GenerateEffectSlide(curSlide, selection, true);

            if (effectSlide == null)
            {
                return;
            }

            effectSlide.SepiaBackground();
            effectSlide.GetNativeSlide().Select();
        }
示例#4
0
        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);
        }
示例#5
0
        public static PowerPoint.ShapeRange BlurSelected(Models.PowerPointSlide slide, PowerPoint.Selection selection, int percentage)
        {
            var shapeRange = selection.ShapeRange;

            if (selection.HasChildShapeRange)
            {
                shapeRange = selection.ChildShapeRange;
            }

            try
            {
                var hasManyShapes = shapeRange.Count > 1;
                var shape         = hasManyShapes ? shapeRange.Group() : shapeRange[1];
                var left          = shape.Left;
                var top           = shape.Top;
                shapeRange.Cut();

                Utils.GraphicsUtil.ExportSlide(slide, BlurPicture);
                BlurImage(BlurPicture, percentage);

                shapeRange      = slide.Shapes.Paste();
                shapeRange.Left = left;
                shapeRange.Top  = top;
                if (hasManyShapes)
                {
                    shapeRange = shapeRange.Ungroup();
                }

                var ungroupedRange  = EffectsLabUtil.UngroupAllShapeRange(slide, shapeRange);
                var shapeGroupNames = ApplyBlurEffect(slide, BlurPicture, ungroupedRange);
                var range           = slide.Shapes.Range(shapeGroupNames.ToArray());

                return(range);
            }
            catch (Exception e)
            {
                ActionFramework.Common.Log.Logger.LogException(e, "BlurSelectedEffect");

                EffectsLabUtil.ShowErrorMessageBox(e.Message, e);
                return(null);
            }
        }
示例#6
0
        public static PowerPoint.ShapeRange BlurSelected(Models.PowerPointSlide slide, PowerPoint.Selection selection, int percentage)
        {
            PowerPoint.ShapeRange shapeRange = ShapeUtil.GetShapeRange(selection);

            try
            {
                bool             hasManyShapes = shapeRange.Count > 1;
                PowerPoint.Shape shape         = hasManyShapes ? shapeRange.Group() : shapeRange[1];
                float            left          = shape.Left;
                float            top           = shape.Top;

                PPLClipboard.Instance.LockAndRelease(() =>
                {
                    shapeRange.Cut();

                    Utils.GraphicsUtil.ExportSlide(slide, BlurPicture);
                    BlurImage(BlurPicture, percentage);

                    shapeRange = slide.Shapes.Paste();
                });

                shapeRange.Left = left;
                shapeRange.Top  = top;
                if (hasManyShapes)
                {
                    shapeRange = shapeRange.Ungroup();
                }

                PowerPoint.ShapeRange ungroupedRange  = EffectsLabUtil.UngroupAllShapeRange(slide, shapeRange);
                List <string>         shapeGroupNames = ApplyBlurEffect(slide, BlurPicture, ungroupedRange);
                PowerPoint.ShapeRange range           = slide.Shapes.Range(shapeGroupNames.ToArray());

                return(range);
            }
            catch (Exception e)
            {
                ActionFramework.Common.Log.Logger.LogException(e, "BlurSelectedEffect");

                EffectsLabUtil.ShowErrorMessageBox(e.Message, e);
                return(null);
            }
        }
示例#7
0
        private static string ApplyBlurEffectShape(Models.PowerPointSlide slide, string imageFile, PowerPoint.Shape shape)
        {
            List <string> shapeNames = new List <string>();

            shapeNames.Add(shape.Name);

            if (!string.IsNullOrWhiteSpace(shape.TextFrame2.TextRange.Text))
            {
                shape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);

                PowerPoint.Shape textBox = EffectsLabUtil.DuplicateShapeInPlace(shape);
                textBox.Fill.Visible = Office.MsoTriState.msoFalse;
                textBox.Line.Visible = Office.MsoTriState.msoFalse;
                Utils.ShapeUtil.MoveZToJustInFront(textBox, shape);
                shapeNames.Add(textBox.Name);
            }

            shape.TextFrame2.DeleteText();
            CropToShape.FillInShapeWithImage(slide, imageFile, shape, isInPlace: true);

            if (EffectsLabSettings.IsTintSelected)
            {
                PowerPoint.Shape overlayShape = GenerateOverlayShape(slide, shape);
                shapeNames.Add(overlayShape.Name);
            }

            if (shapeNames.Count > 1)
            {
                PowerPoint.ShapeRange subRange     = slide.Shapes.Range(shapeNames.ToArray());
                PowerPoint.Shape      groupedShape = subRange.Group();

                return(groupedShape.Name);
            }

            return(shapeNames[0]);
        }
示例#8
0
 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);
 }