示例#1
0
        private void exportTildaShape_Click(object sender, RibbonControlEventArgs e)
        {
            setUpFolders();

            System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS());

            String js = "";

            PowerPoint.PpSelectionType type = Globals.ThisAddIn.Application.ActiveWindow.Selection.Type;
            if (type == PowerPoint.PpSelectionType.ppSelectionNone ||
                type == PowerPoint.PpSelectionType.ppSelectionText)
            {
                MessageBox.Show("You can only export slides right now via selection");
            }
            else if (type == PowerPoint.PpSelectionType.ppSelectionSlides)
            {
                foreach (PowerPoint.Slide currentSlide in Globals.ThisAddIn.Application.ActiveWindow.Selection.SlideRange)
                {
                    TildaSlide slide = new TildaSlide(currentSlide);
                    js += "preso.slides.push(" + slide.exportSlide() + ");";
                }
                export(js);
            }
            else if (type == PowerPoint.PpSelectionType.ppSelectionShapes)
            {
                /*PowerPoint.Slide currentSlide = Settings.ActiveSlide();
                 * TildaSlide slide = new TildaSlide(currentSlide);
                 * slide.shapesRange = Globals.ThisAddIn.Application.ActiveWindow.Selection;
                 * js += "preso.slides.push(" + slide.exportSlide() + ");";*/

                MessageBox.Show("You can only export slides right now via selection");
            }
            cleanUpFolders();
        }
示例#2
0
        public void backgroundImageExported()
        {
            if (Directory.Exists(Settings.outputPath))
            {
                Directory.Delete(Settings.outputPath, true);
            }
            Directory.CreateDirectory(Settings.outputPath);
            Directory.CreateDirectory(Settings.outputMediaFullPath);

            Slide      slide  = new TildaTests.Mocks.MockSlide();
            TildaSlide target = new TildaSlide(slide);
            String     actual = target.exportSlide();

            bool bgcreated = false;

            foreach (string file in Directory.GetFiles(Settings.outputMediaFullPath))
            {
                if (file.Contains("-bg.png"))
                {
                    bgcreated = true;
                }
            }

            Assert.AreEqual(true, bgcreated);
            Assert.AreEqual(true, actual.Contains("preso.shapes.push(preso.paper.image('assets/"));
            Assert.AreEqual(true, actual.Contains(",0,0,2160,3800));preso.shapes[(preso.shapes.length-1)].toBack();"));

            Directory.Delete(Settings.outputPath, true);
        }
示例#3
0
        private void exportTildaSlide_Click(object sender, RibbonControlEventArgs e)
        {
            setUpFolders();
            PowerPoint.Slide currentSlide = Settings.ActiveSlide();
            TildaSlide       slide        = new TildaSlide(currentSlide);

            System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS());
            export("preso.slides.push(" + slide.exportSlide() + ");");
            cleanUpFolders();
        }
示例#4
0
        private void exportTildaPresentation_Click(object sender, RibbonControlEventArgs e)
        {
            PowerPoint.Presentation currentPreso = Settings.ActivePresentation();

            setUpFolders();
            System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS());
            String js = Settings.PresoSettingsToJS();
            foreach(PowerPoint.Slide currentSlide in currentPreso.Slides) {
                TildaSlide slide = new TildaSlide(currentSlide);
                js += "preso.slides.push(" + slide.exportSlide() + ");";
            }
            export(js);
            cleanUpFolders();
            MessageBox.Show("Saved :)");
        }
示例#5
0
        private void exportTildaPresentation_Click(object sender, RibbonControlEventArgs e)
        {
            PowerPoint.Presentation currentPreso = Settings.ActivePresentation();

            setUpFolders();
            System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS());
            String js = Settings.PresoSettingsToJS();

            foreach (PowerPoint.Slide currentSlide in currentPreso.Slides)
            {
                TildaSlide slide = new TildaSlide(currentSlide);
                js += "preso.slides.push(" + slide.exportSlide() + ");";
            }
            export(js);
            cleanUpFolders();
            MessageBox.Show("Saved :)");
        }
示例#6
0
        public void slideJSExportCode()
        {
            if (Directory.Exists(Settings.outputPath))
            {
                Directory.Delete(Settings.outputPath, true);
            }
            Directory.CreateDirectory(Settings.outputPath);
            Directory.CreateDirectory(Settings.outputMediaFullPath);

            Slide      slide  = new TildaTests.Mocks.MockSlide();
            TildaSlide target = new TildaSlide(slide);
            String     actual = target.exportSlide();

            Assert.AreEqual(true, actual.Contains("function(){"));
            Assert.AreEqual(true, actual[actual.Length - 1] == '}');

            Directory.Delete(Settings.outputPath, true);
        }
示例#7
0
        public void backgroundImageExported()
        {
            if(Directory.Exists(Settings.outputPath))
                Directory.Delete(Settings.outputPath, true);
            Directory.CreateDirectory(Settings.outputPath);
            Directory.CreateDirectory(Settings.outputMediaFullPath);

            Slide slide = new TildaTests.Mocks.MockSlide();
            TildaSlide target = new TildaSlide(slide);
            String actual = target.exportSlide();

            bool bgcreated = false;
            foreach(string file in Directory.GetFiles(Settings.outputMediaFullPath)){
                if(file.Contains("-bg.png"))
                    bgcreated = true;
            }

            Assert.AreEqual(true, bgcreated);
            Assert.AreEqual(true, actual.Contains("preso.shapes.push(preso.paper.image('assets/"));
            Assert.AreEqual(true, actual.Contains(",0,0,2160,3800));preso.shapes[(preso.shapes.length-1)].toBack();"));

            Directory.Delete(Settings.outputPath, true);
        }
示例#8
0
        public void shapesAreOrderedBasedOnZOrderAndVisibilityIsNotConsidered()
        {
            if (Directory.Exists(Settings.outputPath))
            {
                Directory.Delete(Settings.outputPath, true);
            }
            Directory.CreateDirectory(Settings.outputPath);
            Directory.CreateDirectory(Settings.outputMediaFullPath);

            Slide      slide  = new TildaTests.Mocks.MockSlide();
            TildaSlide target = new TildaSlide(slide);
            Shape      tb     = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100);

            tb.TextFrame2.TextRange.Text = "Hello2";

            Shape tb2 = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100);

            tb2.TextFrame2.TextRange.Text = "Hello1";
            tb2.ZOrder(Office.MsoZOrderCmd.msoSendToBack);

            Shape tb3 = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100);

            tb3.TextFrame2.TextRange.Text = "Hello3";
            tb3.ZOrder(Office.MsoZOrderCmd.msoSendToBack);
            tb3.Visible = Office.MsoTriState.msoFalse;

            String actual = target.exportSlide();

            int first  = actual.IndexOf("Hello1");
            int second = actual.IndexOf("Hello2");
            int third  = actual.IndexOf("Hello3");

            Assert.AreEqual(true, first < second);
            Assert.AreEqual(true, third < second);

            Directory.Delete(Settings.outputPath, true);
        }
示例#9
0
        public void shapesAreOrderedBasedOnZOrderAndVisibilityIsNotConsidered()
        {
            if(Directory.Exists(Settings.outputPath))
                Directory.Delete(Settings.outputPath, true);
            Directory.CreateDirectory(Settings.outputPath);
            Directory.CreateDirectory(Settings.outputMediaFullPath);

            Slide slide = new TildaTests.Mocks.MockSlide();
            TildaSlide target = new TildaSlide(slide);
            Shape tb = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100);
            tb.TextFrame2.TextRange.Text = "Hello2";

            Shape tb2 = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100);
            tb2.TextFrame2.TextRange.Text = "Hello1";
            tb2.ZOrder(Office.MsoZOrderCmd.msoSendToBack);

            Shape tb3 = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100);
            tb3.TextFrame2.TextRange.Text = "Hello3";
            tb3.ZOrder(Office.MsoZOrderCmd.msoSendToBack);
            tb3.Visible = Office.MsoTriState.msoFalse;

            String actual = target.exportSlide();

            int first = actual.IndexOf("Hello1");
            int second = actual.IndexOf("Hello2");
            int third = actual.IndexOf("Hello3");

            Assert.AreEqual(true, first < second);
            Assert.AreEqual(true, third < second);

            Directory.Delete(Settings.outputPath, true);
        }
示例#10
0
        public void slideJSExportCode()
        {
            if(Directory.Exists(Settings.outputPath))
                Directory.Delete(Settings.outputPath, true);
            Directory.CreateDirectory(Settings.outputPath);
            Directory.CreateDirectory(Settings.outputMediaFullPath);

            Slide slide = new TildaTests.Mocks.MockSlide();
            TildaSlide target = new TildaSlide(slide);
            String actual = target.exportSlide();

            Assert.AreEqual(true, actual.Contains("function(){"));
            Assert.AreEqual(true, actual[actual.Length-1]=='}');

            Directory.Delete(Settings.outputPath, true);
        }
示例#11
0
        private void exportTildaShape_Click(object sender, RibbonControlEventArgs e)
        {
            setUpFolders();

            System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS());

            String js = "";
            PowerPoint.PpSelectionType type = Globals.ThisAddIn.Application.ActiveWindow.Selection.Type;
            if (type == PowerPoint.PpSelectionType.ppSelectionNone ||
                type == PowerPoint.PpSelectionType.ppSelectionText)
                MessageBox.Show("You can only export slides right now via selection");
            else if(type == PowerPoint.PpSelectionType.ppSelectionSlides) {
                foreach(PowerPoint.Slide currentSlide in Globals.ThisAddIn.Application.ActiveWindow.Selection.SlideRange) {
                    TildaSlide slide = new TildaSlide(currentSlide);
                    js += "preso.slides.push(" + slide.exportSlide() + ");";
                }
                export(js);
            } else if(type == PowerPoint.PpSelectionType.ppSelectionShapes) {
                /*PowerPoint.Slide currentSlide = Settings.ActiveSlide();
                TildaSlide slide = new TildaSlide(currentSlide);
                slide.shapesRange = Globals.ThisAddIn.Application.ActiveWindow.Selection;
                js += "preso.slides.push(" + slide.exportSlide() + ");";*/

                MessageBox.Show("You can only export slides right now via selection");
            }
            cleanUpFolders();
        }
示例#12
0
 private void exportTildaSlide_Click(object sender, RibbonControlEventArgs e)
 {
     setUpFolders();
     PowerPoint.Slide currentSlide = Settings.ActiveSlide();
     TildaSlide slide = new TildaSlide(currentSlide);
     System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS());
     export("preso.slides.push(" + slide.exportSlide() + ");");
     cleanUpFolders();
 }