コード例 #1
0
        internal void ApplyTopMargin()
        {
            SlideProperties.Instance.Height = SlideHeight;
            SlideProperties.Instance.Width  = SlideWidth;
            SlideProperties.Instance.Theme  = currentTheme;

            foreach (Shape item in AddedShapes)
            {
                item.Top = SolidBar.GetTopMargin();
            }
        }
コード例 #2
0
        internal void GenerateProgressBar()
        {
            if (PresentationSlides.Count == 0 || HiddenSlidesCount >= PresentationSlides.Count)
            {
                TreatNoSlidesFoundError();
                return;
            }

            Microsoft.Office.Core.MsoAutoShapeType shapeBackground = Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle;
            Microsoft.Office.Core.MsoAutoShapeType shapeForeground = Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle;

            int stepCounter = 1;

            SolidBar.Instance.CountOfSteps = PresentationSlides.Count - HiddenSlidesCount;
            SolidBar.Instance.SetStepWidth(SlideWidth);
            SlideProperties.Instance.Height = SlideHeight;
            SlideProperties.Instance.Width  = SlideWidth;
            float stepWidth = SolidBar.Instance.StepWidth;
            float topMargin = SolidBar.GetTopMargin();

            if (currentTheme == ProgressBar.DataStructs.Theme.DOTTED)
            {
                if (SolidBar.Instance.Alignment == BarAlign.TOP)
                {
                    topMargin = topMargin + 5;
                }
                else
                {
                    topMargin = topMargin - 5;
                }
            }

            foreach (Slide oneSlide in PresentationSlides)
            {
                Shape addedShapeBackground, addedShapeForeground;

                if (SolidBar.DisableOnFirstSlide &&
                    stepCounter == 1 &&
                    oneSlide.SlideShowTransition.Hidden == Microsoft.Office.Core.MsoTriState.msoFalse)
                {
                    stepCounter++;
                    continue;
                }

                if (oneSlide.SlideShowTransition.Hidden == Microsoft.Office.Core.MsoTriState.msoTrue)
                {
                    continue;
                }

                if (currentTheme == ProgressBar.DataStructs.Theme.DOTTED)
                {
                    int margin = ((int)SlideWidth - (int)(SolidBar.Instance.CountOfSteps * SolidBar.Instance.Height)) / SolidBar.Instance.CountOfSteps;

                    for (int i = 0; i < SolidBar.Instance.CountOfSteps; i++)
                    {
                        if ((stepCounter - 1) == i)
                        {
                            addedShapeBackground = oneSlide.Shapes.AddShape(shapeForeground,
                                                                            5 + (5 * i) + (i * SolidBar.Instance.Height), topMargin,
                                                                            SolidBar.Instance.Height,
                                                                            SolidBar.Instance.Height);


                            addedShapeBackground.Fill.ForeColor.RGB = SolidBar.BackgroundOLE;
                            addedShapeBackground.Line.Weight        = 0;
                            addedShapeBackground.Line.Visible       = Microsoft.Office.Core.MsoTriState.msoFalse;
                            addedShapeBackground.Name = SolidBar.SHAPE_NAME + SolidBar.BG_SUFFIX;
                        }
                        else
                        {
                            addedShapeForeground = oneSlide.Shapes.AddShape(shapeForeground,
                                                                            5 + (5 * i) + (i * SolidBar.Instance.Height), topMargin,
                                                                            SolidBar.Instance.Height,
                                                                            SolidBar.Instance.Height);

                            addedShapeForeground.Fill.ForeColor.RGB = SolidBar.ForegroundOLE;
                            addedShapeForeground.Line.Weight        = 0;
                            addedShapeForeground.Line.Visible       = Microsoft.Office.Core.MsoTriState.msoFalse;
                            addedShapeForeground.Name = SolidBar.SHAPE_NAME + SolidBar.BAR_SUFFIX;
                        }
                    }
                }
                else
                {
                    addedShapeBackground = oneSlide.Shapes.AddShape(shapeBackground,
                                                                    0,
                                                                    topMargin,
                                                                    SlideWidth,
                                                                    SolidBar.Instance.Height);

                    addedShapeForeground = oneSlide.Shapes.AddShape(shapeForeground,
                                                                    0,
                                                                    topMargin,
                                                                    stepWidth * stepCounter,
                                                                    SolidBar.Instance.Height);

                    addedShapeBackground.Name = SolidBar.SHAPE_NAME + SolidBar.BG_SUFFIX;
                    addedShapeForeground.Name = SolidBar.SHAPE_NAME + SolidBar.BAR_SUFFIX;

                    addedShapeBackground.Line.Weight  = addedShapeForeground.Line.Weight = 0;
                    addedShapeBackground.Line.Visible = addedShapeForeground.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;

                    addedShapeBackground.Fill.ForeColor.RGB = SolidBar.BackgroundOLE;
                    addedShapeForeground.Fill.ForeColor.RGB = SolidBar.ForegroundOLE;
                }

                stepCounter++;
            }

            HasProgressBar = true;
        }