/// <summary> /// Creates collection of the shapes from sdk shape tree. /// </summary> /// <param name="sdkShapeTree"></param> /// <returns></returns> public IList <ShapeEx> FromTree(P.ShapeTree sdkShapeTree) { var sldPhFontService = new SlidePlaceholderFontService(_sdkSldPart); var phService = new PlaceholderService(_sdkSldPart.SlideLayoutPart); var transformFactory = new InnerTransformFactory(phService); var shapeBuilder = new ShapeEx.Builder(); var sdkShapeHandler = new SdkShapeHandler(_preSettings, sldPhFontService, _sdkSldPart, transformFactory, shapeBuilder); var sdkGroupShapeHandler = new SdkGroupShapeHandler(_preSettings, sldPhFontService, _sdkSldPart, transformFactory, shapeBuilder); var oleGrFrameHandler = new OleGraphicFrameHandler(_preSettings, sldPhFontService, _sdkSldPart, transformFactory, shapeBuilder); var pictureHandler = new PictureHandler(_preSettings, sldPhFontService, _sdkSldPart, transformFactory, shapeBuilder); var chartGrFrameHandler = new ChartGraphicFrameHandler(_preSettings, sldPhFontService, _sdkSldPart, transformFactory, shapeBuilder); var tableGrFrameHandler = new TableGraphicFrameHandler(_preSettings, sldPhFontService, _sdkSldPart, transformFactory, shapeBuilder); sdkShapeHandler.Successor = sdkGroupShapeHandler; sdkGroupShapeHandler.Successor = oleGrFrameHandler; // OLE objects handler must be before pictures handler, cause OLE container can contain p:pic elements, thereby defining OLE as a picture oleGrFrameHandler.Successor = pictureHandler; pictureHandler.Successor = chartGrFrameHandler; chartGrFrameHandler.Successor = tableGrFrameHandler; var shapes = new List <ShapeEx>(sdkShapeTree.Count()); foreach (var openXmlElement in sdkShapeTree) { var shape = sdkShapeHandler.Create(openXmlElement); if (shape != null) { shapes.Add(shape); } } return(shapes); }
public IList <ShapeEx> FromSldPart(SlidePart sdkSldPart) { var sldPhFontService = new PlaceholderFontService(sdkSldPart); //TODO: make DI var phService = new PlaceholderLocationService(sdkSldPart.SlideLayoutPart); var transformFactory = new InnerTransformFactory(phService); var geometryFactory = new GeometryFactory(phService); var shapeContextBuilder = new ShapeContext.Builder(_preSettings, sldPhFontService, sdkSldPart); var chartGrFrameHandler = new ChartGraphicFrameHandler(shapeContextBuilder, transformFactory); var tableGrFrameHandler = new TableGraphicFrameHandler(shapeContextBuilder, transformFactory); var oleGrFrameHandler = new OleGraphicFrameHandler(shapeContextBuilder, transformFactory); var sdkShapeHandler = new SdkShapeHandler(shapeContextBuilder, transformFactory, geometryFactory); var pictureHandler = new PictureHandler(shapeContextBuilder, transformFactory, geometryFactory, sdkSldPart); var sdkGroupShapeHandler = new SdkGroupShapeHandler(shapeContextBuilder, transformFactory, geometryFactory, sdkSldPart); sdkShapeHandler.Successor = sdkGroupShapeHandler; sdkGroupShapeHandler.Successor = oleGrFrameHandler; // OLE objects handler must be before pictures handler, cause OLE container can contain p:pic elements, // thereby defining OLE as a picture oleGrFrameHandler.Successor = pictureHandler; pictureHandler.Successor = chartGrFrameHandler; chartGrFrameHandler.Successor = tableGrFrameHandler; var sdkShapeTree = sdkSldPart.Slide.CommonSlideData.ShapeTree; var shapes = new List <ShapeEx>(sdkShapeTree.Count()); foreach (var openXmlElement in sdkShapeTree) { var shape = sdkShapeHandler.Create(openXmlElement); if (shape != null) { shapes.Add(shape); } } return(shapes); }