Ejemplo n.º 1
0
        private static void RunSerializationTestFlow <TVal>(
            string defaultTypedVal,
            Converter <string, TVal> stringToTVal,
            Converter <TVal, string> tValToString,
            Func <TVal, Task <TVal> > send
            )
        {
            var inputVal =
                DocumentUtil.GetHashParameterOrNull(MagicsForTests.ValueToSend)
                ??
                defaultTypedVal;

            var clientVal = stringToTVal(inputVal);
            var btn       = new HTMLButtonElement {
                Id = MagicsForTests.RunClientSideTestBtnId, TextContent = "Click to test"
            };
            var resultSpan = new HTMLSpanElement {
                Id = MagicsForTests.ResultSpanId
            };

            btn.OnClick += async e => {
                var result = await send(clientVal);

                resultSpan.TextContent = tValToString(result);
            };

            Document.Body.AppendChild(btn);
            Document.Body.AppendChild(resultSpan);
        }
Ejemplo n.º 2
0
        Document DocumentHelper.ParseNewDocument(String path, ProcessingProgress pp)
        {
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.OverallOperationName          = "Document";
            pp.OverallOperationTotalElements = 2;
            pp.OverallOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //directory where all the data will be saved
            String folderName   = DocumentUtil.GenerateDirectoryName();
            String documentPath = System.IO.Path.Combine(DocumentService.TEMP_DIRECTORY, folderName);

            System.IO.Directory.CreateDirectory(documentPath);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.OverallOperationElement       = 1;
            pp.CurrentOperationName          = "Opening";
            pp.CurrentOperationTotalElements = 2;
            pp.CurrentOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            Document document = new Document();

            document.Name     = path.Substring(path.LastIndexOf(DD) + 1);
            document.Location = folderName;

            //write directory for pages
            String pagesPath = System.IO.Path.Combine(documentPath + DD + DOC_FILES);

            System.IO.Directory.CreateDirectory(pagesPath);

            Page page = new Page();

            page.Name = document.Name;

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 1;
            pp.OverallOperationElement = 1;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //location where the page is generated
            page.Location = WriteTextDocument(path, documentPath + DD + DOC_FILES + DD + DOCUMENT_HTML);
            document.Pages.Add(page);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 2;
            pp.OverallOperationElement = 2;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //return the built document
            return(document);
        }
Ejemplo n.º 3
0
        public Program(EnvironmentType env)
        {
            _di = new PhillyContainer();

            Services.Register(_di); //registers discovered services from model
            _di.RegisterAlias <IHttpRequester, BridgeHttpRequester>(LifeStyle.Singleton);
            _di.Register <MainMenuFlow>(LifeStyle.Transient);

            Toolkit.InitializeToolkit(null, x => _di.Resolve <ISomeService>().DataGridToSpreadsheet(x));

            var forcedCulture = DocumentUtil.GetQueryParameterOrNull("forcedCulture");

            I18n.ConfigureImplementation(() => new ToStringLocalization(forcedCulture));

            _renderer = Toolkit.DefaultFormRenderer();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// ブログフォルダを自動作成する
        /// </summary>
        public void CreateHolder()
        {
            if (!this.IsValid())
            {
                return;
            }

            Node parentNode = new Node(this.holderTop.Id);

            // 年フォルダ、月フォルダの作成
            if (this.folderNameSetting == VelstandConstant.BlogHolderNameYM1 ||
                this.folderNameSetting == VelstandConstant.BlogHolderNameYM2 ||
                this.folderNameSetting == VelstandConstant.BlogHolderNameYMD1 ||
                this.folderNameSetting == VelstandConstant.BlogHolderNameYMD2)
            {
                parentNode = DocumentUtil.PublishOnNotExist(
                    BlogHolder(this.releaseDate.Year.ToString(), parentNode.Id, this.node.WriterId),
                    parentNode);

                string mm = "MMMM";
                if (this.folderNameSetting == VelstandConstant.BlogHolderNameYM2 ||
                    this.folderNameSetting == VelstandConstant.BlogHolderNameYMD2)
                {
                    mm = "MM";
                }
                parentNode = DocumentUtil.PublishOnNotExist(
                    BlogHolder(this.releaseDate.ToString(mm), parentNode.Id, this.node.WriterId),
                    parentNode);
                this.node.ParentId = parentNode.Id;
            }

            // 日フォルダを作成する
            if (this.folderNameSetting == VelstandConstant.BlogHolderNameYMD1 ||
                this.folderNameSetting == VelstandConstant.BlogHolderNameYMD2)
            {
                parentNode = DocumentUtil.PublishOnNotExist(
                    BlogHolder(this.releaseDate.Day.ToString("00"), parentNode.Id, this.node.WriterId),
                    parentNode);
                this.node.ParentId = parentNode.Id;
            }

            // 年月フォルダを作成する
            if (this.folderNameSetting == VelstandConstant.BlogHolderNameYM3)
            {
                parentNode = DocumentUtil.PublishOnNotExist(
                    BlogHolder(this.releaseDate.ToString("yyyyMM"), parentNode.Id, this.node.WriterId),
                    parentNode);
                this.node.ParentId = parentNode.Id;
            }

            // ドキュメントを公開する
            if (node.Published)
            {
                contentService.SaveAndPublishWithStatus(this.node, this.node.WriterId, false);
            }
            else
            {
                contentService.Save(this.node, this.node.WriterId, false);
            }

            return;
        }
Ejemplo n.º 5
0
        public static void OnReady()
        {
            var di = new PhillyContainer();

            di.RegisterAlias <IHttpRequester, BridgeHttpRequester>(LifeStyle.Singleton);
            Services.Register(di); //registers discovered services from model
            di.Register <HelloWorldFlow>(LifeStyle.Transient);

            Toolkit.InitializeToolkit();

            var testOrNull = DocumentUtil.GetHashParameterOrNull(MagicsForTests.TestChoiceParamName);

            if (testOrNull == null)
            {
                Document.Body.AppendChild(new HTMLSpanElement {
                    TextContent = "no test selected"
                });
            }

            switch (EnumExtensions.GetEnumByLabel <MagicsForTests.ClientSideFlows>(testOrNull))
            {
            case MagicsForTests.ClientSideFlows.ServerSentEvents: {
                IServerSentEventsService_RegisterListener_SseSubscriber listener = null;
                var service = di.Resolve <IServerSentEventsService>();

                var log = new HTMLDivElement {
                    Id = MagicsForTests.RunClientSideTestLogSpanId
                };
                log.Style.WhiteSpace = WhiteSpace.Pre;

                void LogWriteLine(string x)
                {
                    Logger.Debug(typeof(Program), "adding log line: {0}", x);
                    log.TextContent = log.TextContent + x + "\n";
                }

                void DoConnect()
                {
                    if (listener != null)
                    {
                        throw new Exception("already connected");
                    }

                    var notifScopeRaw = DocumentUtil.GetHashParameterOrNull(MagicsForTests.ValueToSend);
                    var notifScope    = JsonConvert.DeserializeObject <SomeNotifFilter>(notifScopeRaw);

                    listener = new IServerSentEventsService_RegisterListener_SseSubscriber(
                        () => notifScope, false);

                    listener.OnConnOpen += () => LogWriteLine("connected");
                    listener.OnError    += (ev, crs) => LogWriteLine($"connection error {(int)crs}");
                    listener.OnMessage  += x => LogWriteLine($"received: {x}");

                    listener.Connect();
                }

                var sendMsg = new HTMLButtonElement {
                    TextContent = "send", Id = MagicsForTests.RunClientSideTestSendBtnId
                };
                sendMsg.OnClick += async _ => {
                    var msgRaw = DocumentUtil.GetHashParameterOrNull(MagicsForTests.ValueToSend);
                    var msg    = JsonConvert.DeserializeObject <SomeNotif>(msgRaw);

                    await service.Publish(msg);
                };

                var connectAction = new HTMLButtonElement {
                    TextContent = "connect", Id = MagicsForTests.RunClientSideTestConnectId
                };
                connectAction.OnClick += _ => DoConnect();

                var disconnectAction = new HTMLButtonElement {
                    TextContent = "disconnect", Id = MagicsForTests.RunClientSideTestDisconnectId
                };
                disconnectAction.OnClick += _ => {
                    listener.Dispose();
                    listener = null;
                };

                Document.Body.AppendChild(log);
                Document.Body.AppendChild(sendMsg);
                Document.Body.AppendChild(connectAction);
                Document.Body.AppendChild(disconnectAction);
                //TODO add disconnect
            }
            break;

            case MagicsForTests.ClientSideFlows.HelloWorld:
                var renderer = Toolkit.DefaultFormRenderer();

                di.Resolve <HelloWorldFlow>().Run(renderer);
                break;

            case MagicsForTests.ClientSideFlows.SerializationTest_String:
                RunSerializationTestFlow(
                    MagicsForTests.Serialization.String.DefaultTypedVal,
                    s => s,
                    d => d,
                    val => di.Resolve <ISerDeserService>().ProcessString(val));
                break;


            case MagicsForTests.ClientSideFlows.SerializationTest_Int:
                RunSerializationTestFlow(
                    MagicsForTests.Serialization.Int.DefaultTypedVal,
                    s => int.Parse(s),
                    d => d.ToString(),
                    val => di.Resolve <ISerDeserService>().ProcessInt(val));
                break;


            case MagicsForTests.ClientSideFlows.SerializationTest_DateTimeUtc:
                RunSerializationTestFlow(
                    MagicsForTests.Serialization.DateTimeUTC.DefaultTypedVal,
                    s => Convert.ToDateTime(s),
                    d => d.ToStringYyyyMmDdHhMm(),
                    val => di
                    .Resolve <ISerDeserService>()
                    .ProcessDateTime(DateTime.SpecifyKind(val, DateTimeKind.Utc), true));
                break;

            case MagicsForTests.ClientSideFlows.SerializationTest_DateTimeLocal:
                RunSerializationTestFlow(
                    MagicsForTests.Serialization.DateTimeLocal.DefaultTypedVal,
                    s => Convert.ToDateTime(s),
                    d => d.ToStringYyyyMmDdHhMm(),
                    val => di
                    .Resolve <ISerDeserService>()
                    .ProcessDateTime(DateTime.SpecifyKind(val, DateTimeKind.Local), false));
                break;

            case MagicsForTests.ClientSideFlows.SerializationTest_Long:
                RunSerializationTestFlow(
                    MagicsForTests.Serialization.Long.DefaultTypedVal,
                    s => long.Parse(s),
                    d => d.ToString(),
                    val => di.Resolve <ISerDeserService>().ProcessLong(val));
                break;

            case MagicsForTests.ClientSideFlows.SerializationTest_Decimal:
                RunSerializationTestFlow(
                    MagicsForTests.Serialization.Decimal.DefaultTypedVal,
                    s => decimal.Parse(s, CultureInfo.InvariantCulture),
                    d => d.ToString(CultureInfo.InvariantCulture),
                    val => di.Resolve <ISerDeserService>().ProcessDecimal(val));
                break;

            default:
                Document.Body.AppendChild(new HTMLSpanElement {
                    TextContent = "unsupported test selected"
                });
                break;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// parse an excel document and build a kinesis document model
        /// </summary>
        /// <param name="path">full path of the excel document</param>
        /// <returns>equivalent kinesis document model</returns>
        Document DocumentHelper.ParseNewDocument(String path, ProcessingProgress pp)
        {
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.OverallOperationName = "All Document Pages";
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            OpenOfficeApplication();

            //directory where all the data will be saved
            String folderName   = DocumentUtil.GenerateDirectoryName();
            String documentPath = System.IO.Path.Combine(DocumentService.TEMP_DIRECTORY, folderName);

            System.IO.Directory.CreateDirectory(documentPath);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationName          = "Opening MS Office";
            pp.CurrentOperationTotalElements = 2;
            pp.CurrentOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //open the given excel document
            Workbook workbook = excelApplication.Workbooks.Open(path, ReadOnly: true);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 1;
            pp.CurrentOperationName    = "Saving pages";
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //create a new internal document
            Document document = new Document();

            document.Name = workbook.Name;

            //save excel document as html
            workbook.SaveAs(System.IO.Path.Combine(documentPath, "document.html"), XlFileFormat.xlHtml);

            //original document location
            document.Location = folderName;

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement       = 2;
            pp.OverallOperationTotalElements = workbook.Sheets.Count + 1;
            pp.OverallOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //for every sheet
            for (int i = 1; i <= workbook.Sheets.Count; i++)
            {
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
                pp.CurrentOperationName          = "Page " + i;
                pp.CurrentOperationTotalElements = 1;
                pp.CurrentOperationElement       = 0;
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

                Worksheet worksheet = workbook.Sheets[i];

                //create a new page
                KineSis.ContentManagement.Model.Page page = new KineSis.ContentManagement.Model.Page();
                page.Name = worksheet.Name;

                //standard export location of ms excel when exporting as html
                page.Location = documentPath + DD + DOC_FILES + DD + "sheet" + GetSheetNumber(i) + ".html";


                //add page to the document
                document.Pages.Add(page);

                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
                pp.CurrentOperationElement = 1;
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            }

            //close workbook without saving any possible changes (this way the "Are you sure?" or "Save changes?" dialogs will be supressed)
            workbook.Close(SaveChanges: false);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.OverallOperationElement++;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //every generated page contains several javascript functions which facilitate navigation between sheets and other unnecessary stuff
            //this is an impediment for kinesis web browser, because will block the programatic scrolling
            //get every generated page and remove javascripts

            int pageNumber = 1;

            foreach (KineSis.ContentManagement.Model.Page p in document.Pages)
            {
                ProcessSheet(p.Location, pp, pageNumber++);
            }

            //return the built document
            return(document);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// parse a picture
        /// </summary>
        /// <param name="path">full path of the picture</param>
        /// <returns>an equivalent kinesis document model</returns>
        Document DocumentHelper.ParseNewDocument(String path, ProcessingProgress pp)
        {
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.OverallOperationName          = "Document";
            pp.OverallOperationTotalElements = 2;
            pp.OverallOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //directory where all the data will be saved
            String folderName   = DocumentUtil.GenerateDirectoryName();
            String documentPath = System.IO.Path.Combine(DocumentService.TEMP_DIRECTORY, folderName);

            System.IO.Directory.CreateDirectory(documentPath);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.OverallOperationElement       = 1;
            pp.CurrentOperationName          = "Opening";
            pp.CurrentOperationTotalElements = 3;
            pp.CurrentOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            Document document = new Document();

            document.Name     = path.Substring(path.LastIndexOf(DD) + 1); //only the filename alone
            document.Location = folderName;

            //write directory for pages
            String pagesPath = documentPath + DD + DOC_FILES;

            System.IO.Directory.CreateDirectory(pagesPath);

            //new page
            Page page = new Page();

            page.Name = document.Name;

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 1;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //location of the page content
            page.Location = WritePictureDocument(path, pagesPath);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 2;
            pp.OverallOperationElement = 1;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            page.LocationNoZoom = WritePictureDocumentNoZoom(path, pagesPath);

            //add page to the document
            document.Pages.Add(page);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 3;
            pp.OverallOperationElement = 2;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //return the built document model
            return(document);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// parse a word document and build a kinesis document model
        /// </summary>
        /// <param name="path">full path of the word document</param>
        /// <returns>equivalent kinesis document model</returns>
        KineSis.ContentManagement.Model.Document DocumentHelper.ParseNewDocument(String path, ProcessingProgress pp)
        {
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.OverallOperationName = "All Document Pages";
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            OpenOfficeApplication();


            //directory where all the data will be saved
            String folderName   = DocumentUtil.GenerateDirectoryName();
            String documentPath = System.IO.Path.Combine(DocumentService.TEMP_DIRECTORY, folderName);

            System.IO.Directory.CreateDirectory(documentPath);

            // Make this instance of word invisible (Can still see it in the taskmgr).
            wordApplication.Visible = false;

            // Interop requires objects.
            object oMissing  = System.Reflection.Missing.Value;
            object isVisible = false;
            object readOnly  = false;
            object oInput    = path;
            object oOutput   = documentPath + DD + DOC_FILES + DD + "document.xps";
            object oFormat   = WdSaveFormat.wdFormatXPS;

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationName          = "Opening MS Office";
            pp.CurrentOperationTotalElements = 1;
            pp.CurrentOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            // Load a document into our instance of word.exe
            Microsoft.Office.Interop.Word._Document wdoc = wordApplication.Documents.Open(ref oInput, ref oMissing, ref readOnly, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref isVisible, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

            // Make this document the active document.
            wdoc.Activate();

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 1;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            KineSis.ContentManagement.Model.Document document = new KineSis.ContentManagement.Model.Document();
            document.Name     = wdoc.Name;
            document.Location = folderName;

            //write directory for pages
            String pagesPath = documentPath + DD + DOC_FILES;

            System.IO.Directory.CreateDirectory(pagesPath);

            //create a new page
            KineSis.ContentManagement.Model.Page page = new KineSis.ContentManagement.Model.Page();
            page.Name     = wdoc.Name;
            page.Location = documentPath + DD + DOC_FILES + DD + "document.html";

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationName          = "Saving document";
            pp.CurrentOperationTotalElements = 2;
            pp.CurrentOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            // Save this document in XPS format.
            wdoc.SaveAs(ref oOutput, ref oFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 1;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            wdoc.Close(SaveChanges: false);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement = 2;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            try
            {
                wdoc.Close(SaveChanges: false);
            }
            catch (Exception)
            {
            }
            //CloseOfficeApplication();
            //wordApplication.Quit(ref oMissing, ref oMissing, ref oMissing);

            BuildDocumentHTMLArgs args = new BuildDocumentHTMLArgs(documentPath + DD + DOC_FILES, pp);

            Thread thread = new Thread(new ParameterizedThreadStart(BuildDocumentHTML));

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start(args);
            thread.Join();

            //build a html page from saved xps
            //BuildDocumentHTML(documentPath + DD + DOC_FILES, pp);

            //add page to document model
            document.Pages.Add(page);

            //delete the generated xps file
            FileInfo fi = new FileInfo(documentPath + DD + DOC_FILES + DD + "document.xps");

            fi.Delete();

            //return built document
            return(document);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// parse a power point document and build a kinesis document model
        /// </summary>
        /// <param name="path">full path of the power point document</param>
        /// <param name="pp">processing progress reporter</param>
        /// <returns>equivalent kinesis document model</returns>
        Document DocumentHelper.ParseNewDocument(String path, ProcessingProgress pp)
        {
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.OverallOperationName = "All Document Pages";
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            OpenOfficeApplication();

            //directory where all the data will be saved
            String folderName   = DocumentUtil.GenerateDirectoryName();
            String documentPath = System.IO.Path.Combine(DocumentService.TEMP_DIRECTORY, folderName);

            System.IO.Directory.CreateDirectory(documentPath);

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationName          = "Opening MS Office";
            pp.CurrentOperationTotalElements = 1;
            pp.CurrentOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //open the presentation
            Presentation presentation = powerPointApplication.Presentations.Open(path, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse);

            Document document = new Document();

            document.Name     = presentation.Name;
            document.Location = folderName;

            //write directory for pages
            String pagesPath = System.IO.Path.Combine(documentPath + DD + DOC_FILES);

            System.IO.Directory.CreateDirectory(pagesPath);

            int H = (int)(DocumentService.SLIDE_WIDTH * presentation.SlideMaster.Height / presentation.SlideMaster.Width);
            int W = DocumentService.SLIDE_WIDTH;

            int T_H = (int)(DocumentService.THUMB_WIDTH * H / W);
            int T_W = DocumentService.THUMB_WIDTH;

            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            pp.CurrentOperationElement       = 1;
            pp.OverallOperationTotalElements = presentation.Slides.Count;
            pp.OverallOperationElement       = 0;
            //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

            //for every slide
            for (int i = 1; i <= presentation.Slides.Count; i++)
            {
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
                pp.CurrentOperationName          = "Page " + i;
                pp.CurrentOperationTotalElements = 4;
                pp.CurrentOperationElement       = 0;
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

                //get slide
                Slide slide = presentation.Slides[i];

                //create a new page
                KineSis.ContentManagement.Model.Page page = new KineSis.ContentManagement.Model.Page();
                page.Name = slide.Name;

                //export the slide as image
                slide.Export(documentPath + DD + DOC_FILES + DD + SLIDE + i + ImageUtil.PNG_EXTENSION, ImageUtil.PNG_FILTER, W, H);

                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
                pp.CurrentOperationElement = 1;
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

                //export the slide as image
                slide.Export(documentPath + DD + DOC_FILES + DD + SLIDE + i + "_thumb" + ImageUtil.PNG_EXTENSION, ImageUtil.PNG_FILTER, T_W, T_H);

                page.SetThumbnailUrl(documentPath + DD + DOC_FILES + DD + SLIDE + i + "_thumb" + ImageUtil.PNG_EXTENSION);

                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
                pp.CurrentOperationElement = 2;
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

                //html page location, including the no-zoom version
                page.Location = GenerateHtmlPage(documentPath + DD + DOC_FILES + DD + SLIDE + i);

                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
                pp.CurrentOperationElement = 3;
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

                page.LocationNoZoom = GenerateHtmlPageNoZoom(documentPath + DD + DOC_FILES + DD + SLIDE + i);

                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
                pp.CurrentOperationElement = 4;
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//

                //add page to document model
                document.Pages.Add(page);

                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
                pp.OverallOperationElement = i;
                //~~~~~~~~~~~~~progress~~~~~~~~~~~~~//
            }

            //close presentation
            presentation.Close();

            //return built document
            return(document);
        }