public void TestInsertImageReference() { // constructor for producing preview image var ed = new EffectsDesigner( _processingSlide, _contentSlide, Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight, new ImageItem { ImageFile = "some images", Tooltip = "some tooltips" }); ed.ApplyImageReference(Link); Assert.IsTrue( PpOperations.GetNotesPageText(_processingSlide) .Contains(Link)); ed.ApplyImageReferenceInsertion(Link, "Calibri", "#000000"); var refShape = PpOperations.SelectShapesByPrefix( EffectsDesigner.ShapeNamePrefix + "_" + EffectName.ImageReference); Assert.IsTrue( refShape.TextFrame2.TextRange.Text.Contains(Link)); }
/// <summary> /// process how to handle a style based on the given source and style option /// </summary> /// <param name="designer"></param> /// <param name="source"></param> /// <param name="isActualSize"></param> private void ApplyStyle(EffectsDesigner designer, ImageItem source, bool isActualSize) { if (Options.IsUseBannerStyle && (Options.TextBoxPosition == 4/*left*/ || Options.TextBoxPosition == 5/*centered*/ || Options.TextBoxPosition == 6/*right*/)) { designer.ApplyTextWrapping(); } else if (Options.IsUseCircleStyle || Options.IsUseOutlineStyle) { designer.ApplyTextWrapping(); } else { designer.RecoverTextWrapping(); } ApplyTextEffect(designer); // store style options information into original image shape // return original image and cropped image var metaImages = designer.EmbedStyleOptionsInformation( source.OriginalImageFile, source.FullSizeImageFile, source.ContextLink, source.Rect, Options); Shape originalImage = null; Shape croppedImage = null; if (metaImages.Count == 2) { originalImage = metaImages[0]; croppedImage = metaImages[1]; } Shape imageShape; if (Options.IsUseSpecialEffectStyle) { imageShape = designer.ApplySpecialEffectEffect(Options.GetSpecialEffect(), isActualSize, Options.ImageOffset); } else // Direct Text style { imageShape = designer.ApplyBackgroundEffect(Options.ImageOffset); } Shape backgroundOverlayShape = null; if (Options.IsUseOverlayStyle) { backgroundOverlayShape = designer.ApplyOverlayEffect(Options.OverlayColor, Options.Transparency); } Shape blurImageShape = null; if (Options.IsUseBlurStyle) { blurImageShape = Options.IsUseSpecialEffectStyle ? designer.ApplyBlurEffect(source.SpecialEffectImageFile, Options.BlurDegree, Options.ImageOffset) : designer.ApplyBlurEffect(degree: Options.BlurDegree, offset: Options.ImageOffset); } Shape bannerOverlayShape = null; if (Options.IsUseBannerStyle) { bannerOverlayShape = ApplyBannerStyle(designer, imageShape); } if (Options.IsUseTextBoxStyle) { designer.ApplyTextboxEffect(Options.TextBoxColor, Options.TextBoxTransparency); } Shape outlineOverlayShape = null; if (Options.IsUseOutlineStyle) { outlineOverlayShape = designer.ApplyRectOutlineEffect(imageShape, Options.FontColor, 0); } Shape frameOverlayShape = null; if (Options.IsUseFrameStyle) { frameOverlayShape = designer.ApplyAlbumFrameEffect(Options.FrameColor, Options.FrameTransparency); } Shape circleOverlayShape = null; if (Options.IsUseCircleStyle) { circleOverlayShape = designer.ApplyCircleRingsEffect(Options.CircleColor, Options.CircleTransparency); } Shape triangleOverlayShape = null; if (Options.IsUseTriangleStyle) { triangleOverlayShape = designer.ApplyTriangleEffect(Options.TriangleColor, Options.FontColor, Options.TriangleTransparency); } SendToBack( triangleOverlayShape, circleOverlayShape, frameOverlayShape, outlineOverlayShape, bannerOverlayShape, backgroundOverlayShape, blurImageShape, imageShape, croppedImage, originalImage); designer.ApplyImageReference(source.ContextLink); if (Options.IsInsertReference) { designer.ApplyImageReferenceInsertion(source.ContextLink, Options.GetFontFamily(), Options.FontColor); } }