示例#1
0
        private void model_BarCreated(IBar createdBar)
        {
            int          slideCounter  = 1;
            List <Slide> visibleSlides = _powerpointAdapter.VisibleSlides();

            PresentationInfo presentationInfo = CreateInfo(visibleSlides);

            foreach (Slide slide in visibleSlides)
            {
                foreach (IBasicShape shape in createdBar.Render(slideCounter, presentationInfo))
                {
                    Shape addedShape = slide.Shapes.AddShape(
                        shape.Type,
                        shape.Left,
                        shape.Top,
                        shape.Width,
                        shape.Height
                        );

                    switch (shape.ColorType)
                    {
                    case ShapeType.Inactive:
                        addedShape.Fill.ForeColor.RGB = GetSelectedBackgroundColor();
                        addedShape.Name = _nameHelper.GetBackgroundShapeName();
                        break;

                    case ShapeType.Active:
                        addedShape.Fill.ForeColor.RGB = GetSelectedForegroundColor();
                        addedShape.Name = _nameHelper.GetForegroundShapeName();
                        break;

                    default:
                        string message = String.Format("Unknown shape type \"{0}\".", shape.ColorType);
                        _log.Fatal(message);

                        throw new InvalidStateException(message);
                    }

                    addedShape.Line.Weight  = 0;
                    addedShape.Line.Visible = MsoTriState.msoFalse;
                }

                slideCounter++;
            }

            _hasBar = true;
        }
        private void model_BarCreated(IBar createdBar)
        {
            int slideCounter = 1;
            List<Slide> visibleSlides = _powerpointAdapter.VisibleSlides();

            PresentationInfo presentationInfo = CreateInfo(visibleSlides);

            foreach (Slide slide in visibleSlides)
            {
                foreach (IBasicShape shape in createdBar.Render(slideCounter, presentationInfo))
                {
                    Shape addedShape = slide.Shapes.AddShape(
                        shape.Type,
                        shape.Left,
                        shape.Top,
                        shape.Width,
                        shape.Height
                        );

                    switch (shape.ColorType)
                    {
                        case ShapeType.Inactive:
                            addedShape.Fill.ForeColor.RGB = GetSelectedBackgroundColor();
                            addedShape.Name = _nameHelper.GetBackgroundShapeName();
                            break;

                        case ShapeType.Active:
                            addedShape.Fill.ForeColor.RGB = GetSelectedForegroundColor();
                            addedShape.Name = _nameHelper.GetForegroundShapeName();
                            break;

                        default:
                            string message = String.Format("Unknown shape type \"{0}\".", shape.ColorType);
                            _log.Fatal(message);

                            throw new InvalidStateException(message);
                    }

                    addedShape.Line.Weight = 0;
                    addedShape.Line.Visible = MsoTriState.msoFalse;
                }

                slideCounter++;
            }

            _hasBar = true;
        }