Example #1
0
 public Builder(IPreSettings preSettings, PlaceholderFontService fontService, SlidePart sdkSldPart, IPlaceholderService placeholderService)
 {
     _preSettings        = preSettings ?? throw new ArgumentNullException(nameof(preSettings));
     _fontService        = fontService ?? throw new ArgumentNullException(nameof(fontService));
     _sdkSldPart         = sdkSldPart ?? throw new ArgumentNullException(nameof(sdkSldPart));
     _placeholderService = placeholderService;
 }
Example #2
0
 public ShapeContext(IPreSettings preSettings, SlidePlaceholderFontService fontService, OpenXmlElement xmlElement, SlidePart xmlSldPart)
 {
     PreSettings            = preSettings ?? throw new ArgumentNullException(nameof(preSettings));
     PlaceholderFontService = fontService ?? throw new ArgumentNullException(nameof(fontService));
     SdkElement             = xmlElement ?? throw new ArgumentNullException(nameof(xmlElement));
     SkdSlidePart           = xmlSldPart ?? throw new ArgumentNullException(nameof(xmlSldPart));
     _masterOtherFonts      = new Lazy <Dictionary <int, int> >(InitMasterOtherFonts);
 }
Example #3
0
        /// <summary>
        /// Initialize a new instance of the <see cref="Slide"/> class.
        /// </summary>
        public Slide(SlidePart xmlSldPart, SlideNumber sldNum, IPreSettings preSettings)
        {
            _xmlSldPart   = xmlSldPart ?? throw new ArgumentNullException(nameof(xmlSldPart));
            _sldNumEntity = sldNum ?? throw new ArgumentNullException(nameof(SlideNumber));
            _preSettings  = preSettings ?? throw new ArgumentNullException(nameof(preSettings));

            _shapes          = new Lazy <List <ShapeEx> >(GetShapes);
            _backgroundImage = new Lazy <ImageEx>(TryGetBackground);
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Slide"/> class.
        /// </summary>
        public Slide(SlidePart sdkSldPart, SlideNumber sldNum, IPreSettings preSettings)
        {
            _sdkSldPart   = sdkSldPart ?? throw new ArgumentNullException(nameof(sdkSldPart));
            _sldNumEntity = sldNum ?? throw new ArgumentNullException(nameof(SlideNumber));
            _preSettings  = preSettings ?? throw new ArgumentNullException(nameof(preSettings));

            _shapes          = new Lazy <ShapeCollection>(GetShapeCollection);
            _backgroundImage = new Lazy <ImageEx>(TryGetBackground);
        }
Example #5
0
 public PictureHandler(IPreSettings preSettings,
                       SlidePlaceholderFontService sldFontService,
                       SlidePart sdkSldPart,
                       InnerTransformFactory transformFactory,
                       IShapeBuilder shapeBuilder)
 {
     _preSettings      = preSettings ?? throw new ArgumentNullException(nameof(preSettings));
     _sldFontService   = sldFontService ?? throw new ArgumentNullException(nameof(sldFontService));
     _sdkSldPart       = sdkSldPart ?? throw new ArgumentNullException(nameof(sdkSldPart));
     _transformFactory = transformFactory ?? throw new ArgumentNullException(nameof(transformFactory));
     _shapeBuilder     = shapeBuilder;
 }
Example #6
0
        /// <summary>
        /// Creates slides collection.
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <param name="preSettings"></param>
        /// <returns></returns>
        public static SlideCollection Create(PresentationDocument xmlDoc, IPreSettings preSettings)
        {
            var xmlPrePart      = xmlDoc.PresentationPart;
            var slideCollection = new List <Slide>();
            var sldNumDic       = new Dictionary <Slide, SlideNumber>();

            for (var sldIndex = 0; sldIndex < xmlPrePart.SlideParts.Count(); sldIndex++)
            {
                var xmlSldPart   = xmlPrePart.GetSlidePartByIndex(sldIndex);
                var sldNumEntity = new SlideNumber(sldIndex + 1);
                var newSlide     = new Slide(xmlSldPart, sldNumEntity, preSettings);
                sldNumDic.Add(newSlide, sldNumEntity);
                slideCollection.Add(newSlide);
            }

            return(new SlideCollection(slideCollection, xmlDoc, sldNumDic));
        }
Example #7
0
        /// <summary>
        /// Creates slides collection.
        /// </summary>
        /// <returns></returns>
        public static SlideCollection Create(PresentationPart sdkPrePart, IPreSettings preSettings)
        {
            Check.NotNull(sdkPrePart, nameof(sdkPrePart));
            Check.NotNull(preSettings, nameof(preSettings));

            var numSlides       = sdkPrePart.SlideParts.Count();
            var slideCollection = new List <Slide>(numSlides);
            var sldNumDic       = new Dictionary <Slide, SlideNumber>(numSlides);

            for (var sldIndex = 0; sldIndex < numSlides; sldIndex++)
            {
                var sdkSldPart   = sdkPrePart.GetSlidePartByIndex(sldIndex);
                var sldNumEntity = new SlideNumber(sldIndex + 1);
                var newSlide     = new Slide(sdkSldPart, sldNumEntity, preSettings);
                sldNumDic.Add(newSlide, sldNumEntity);
                slideCollection.Add(newSlide);
            }

            return(new SlideCollection(slideCollection, sdkPrePart, sldNumDic));
        }
Example #8
0
 public ShapeFactory(IPreSettings preSettings)
 {
     _preSettings = preSettings ?? throw new ArgumentNullException(nameof(preSettings));
 }
Example #9
0
 public Builder(IPreSettings preSettings, PlaceholderFontService fontService, SlidePart sdkSldPart) :
     this(preSettings, fontService, sdkSldPart, new PlaceholderService(sdkSldPart.SlideLayoutPart))
 {
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance by default <see cref="ShapeFactory"/> instance.
 /// </summary>
 /// <param name="sdkSldPart"></param>
 /// <param name="preSettings"></param>
 public ShapeCollection(SlidePart sdkSldPart, IPreSettings preSettings) :
     this(sdkSldPart, new ShapeFactory(preSettings))
 {
 }
Example #11
0
 public ShapeFactory(SlidePart sdkSldPart, IPreSettings preSettings)
 {
     _sdkSldPart  = sdkSldPart ?? throw new ArgumentNullException(nameof(sdkSldPart));
     _preSettings = preSettings ?? throw new ArgumentNullException(nameof(preSettings));
 }
Example #12
0
 public Builder(IPreSettings preSettings, PlaceholderFontService fontService, SlidePart sdkSldPart)
 {
     _preSettings = preSettings;
     _fontService = fontService;
     _sdkSldPart  = sdkSldPart;
 }