Ejemplo n.º 1
0
        //Growth Rates
        public void TSCP_Callback51(Office.IRibbonControl rib)
        {
            PowerPoint.Application ppApp    = Globals.ThisAddIn.Application;
            pptfunctions           funObj   = new pptfunctions();
            Shapecheck             shpObj   = new Shapecheck();
            frmChartcalc           chartObj = new frmChartcalc();
            //frmCalculator frmObj = new frmCalculator();
            Shapecheck    PPTshpchk      = new Shapecheck();
            List <string> SelectedCharts = new List <string>();

            SelectedCharts = PPTshpchk.FindSelectedCharts();
            PowerPoint.Presentation ActivePPT = Globals.ThisAddIn.Application.ActivePresentation;
            int numSelCht = SelectedCharts.Count;

            if (numSelCht == 0)
            {
                MessageBox.Show("Please select a chart for CAGR/AAGR calculation.", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            int sld_num = ppApp.ActiveWindow.Selection.SlideRange.SlideNumber;

            PowerPoint.Chart myChart = ActivePPT.Slides[sld_num].Shapes[SelectedCharts[0]].Chart;
            string           chType  = shpObj.chartType(myChart);

            if (funObj.TSCThemeLoaded())
            {
                if (numSelCht == 0)
                {
                    //frmObj.Show();
                    MessageBox.Show("Please select a chart CAGR/AAGR calculation.", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (numSelCht > 1)
                {
                    MessageBox.Show("Please select a single chart CAGR/AAGR calculation.", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (numSelCht == 1)
                {
                    //PPT.Chart myChart =
                    //string chType = PPTshpchk.chartType();
                    if (chType != "Pie")
                    {
                        chartObj.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Please select a column chart for CAGR/AAGR Calculation.", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                MessageBox.Show("This functionality works with TSC Theme. Please Load TSC theme and try again. Thanks", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            PPTAttribute.UserTracker(rib);
        }