Beispiel #1
0
        public object Clone()
        {
            TOCNode tn = new TOCNode();

            tn.Identifier         = Identifier;
            tn.Resource           = Resource;
            tn.ResourceIdentifier = ResourceIdentifier;
            tn.Title = Title;
            if (Thumbnail != null)
            {
                tn.Thumbnail = (Image)Thumbnail.Clone();
            }
            if (Children != null)
            {
                tn.Children = (TOCList)Children.Clone();
            }

            if (Extension != null)
            {
                if (Extension is ICloneable)
                {
                    tn.Extension = ((ICloneable)Extension).Clone();
                }
            }

            return(tn);
        }
        public void Remove(Guid key)
        {
            TOCNode tn = (TOCNode)hashTable[key];

            arrayList.Remove(tn);
            hashTable.Remove(key);
        }
        public void RemoveAt(int index)
        {
            TOCNode tocNode = (TOCNode)arrayList[index];

            hashTable.Remove(tocNode.Identifier);
            arrayList.RemoveAt(index);
        }
        public static RTDocument PPT2RTDwithSVG(string pptFilename)
        {
            //Pri2: Investigate where BasePath is and where we should be putting it in more depth.
            //      Concerned that we're creating directories there that never get cleaned up...
            if (!Directory.Exists(tfc.BasePath))
                Directory.CreateDirectory(tfc.BasePath);
            // Initialize PowerPoint app
            ApplicationClass ppt = new ApplicationClass();
            ppt.Visible = MsoTriState.msoTrue;

            // Open the PPT file
            Presentation presentation = ppt.Presentations.Open(pptFilename, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
            PrintOptions po = presentation.PrintOptions;
            po.ActivePrinter = @"SVGmaker";
            System.Threading.Thread.Sleep(6000);
            po.OutputType = PpPrintOutputType.ppPrintOutputSlides;
            po.PrintInBackground = MsoTriState.msoFalse;
            Slides slides = presentation.Slides;

            // Set up the document
            RTDocument rtDoc = new RTDocument();
            rtDoc.Identifier = Guid.NewGuid();
            rtDoc.Metadata.Title = GetPresentationProperty(ppt.ActivePresentation, "Title");
            rtDoc.Metadata.Creator = GetPresentationProperty(ppt.ActivePresentation, "Author");

            //Iterate through the pages
            foreach(Slide s in slides)
            {
                // Set the page properties
                Page p = new Page();
                p.Identifier = Guid.NewGuid();
                p.Extension = GetSlideSVG(presentation, s);
                p.MimeType = "image/svg";  // TODO: look up the real value for this
                rtDoc.Resources.Pages.Add(p.Identifier, p);

                // Set the TOCNode properties for the page
                TOCNode tn = new TOCNode();
                tn.Title = GetSlideTitle(s);
                tn.Resource = p;
                tn.ResourceIdentifier = p.Identifier;
                // TODO: Insert thumbnail? (tn.thumbnail)
                rtDoc.Organization.TableOfContents.Add(tn);
            }

            // Close PPT
            presentation.Close();
            if (ppt.Presentations.Count == 0)
            {
                ppt.Quit();
            }
            ppt = null;

            tfc.Delete();

            return rtDoc;
        }
Beispiel #5
0
 public RTPageAdd(Page page)
 {
     TOCNode = new TOCNode();
     TOCNode.ResourceIdentifier = page.Identifier;
     TOCNode.Resource           = page;
     TOCNode.Title = "New Page";
     // Not adding in here for now to keep out RTDocumentHelper dependency
     // Should move GetThumbnailFromImage over to another utility library than RTDocumentUtilities...
     //TOCNode.Thumbnail = RTDocumentHelper.GetThumbnailFromImage(page.Image);
     Page = page;
 }
Beispiel #6
0
 public RTPageAdd(Page page)
 {
     TOCNode = new TOCNode();
     TOCNode.ResourceIdentifier = page.Identifier;
     TOCNode.Resource = page;
     TOCNode.Title = "New Page";
     // Not adding in here for now to keep out RTDocumentHelper dependency
     // Should move GetThumbnailFromImage over to another utility library than RTDocumentUtilities...
     //TOCNode.Thumbnail = RTDocumentHelper.GetThumbnailFromImage(page.Image);
     Page = page;
 }
 public void Insert(int index, TOCNode value)
 {
     arrayList.Insert(index, value);
     hashTable.Add(value.Identifier, value);
 }
 public int IndexOf(TOCNode value)
 {
     return arrayList.IndexOf(value);
 }
 public bool ContainsValue(TOCNode value)
 {
     return hashTable.ContainsValue(value);
 }
 public bool Contains(TOCNode value)
 {
     return arrayList.Contains(value);
 }
 public int Add(TOCNode value)
 {
     hashTable.Add(value.Identifier, value);
     return arrayList.Add(value);
 }
Beispiel #12
0
        public object Clone()
        {
            TOCNode tn = new TOCNode();

            tn.Identifier = Identifier;
            tn.Resource = Resource;
            tn.ResourceIdentifier = ResourceIdentifier;
            tn.Title = Title;
            if (Thumbnail != null)
            {
                tn.Thumbnail = (Image)Thumbnail.Clone();
            }
            if (Children != null)
            {
                tn.Children = (TOCList)Children.Clone();
            }

            if (Extension != null)
            {
                if (Extension is ICloneable)
                {
                    tn.Extension = ((ICloneable)Extension).Clone();
                }
            }

            return tn;
        }
 public void Insert(int index, TOCNode value)
 {
     arrayList.Insert(index, value);
     hashTable.Add(value.Identifier, value);
 }
        private void ConsumeObject( ObjectReceivedEventArgs orea )
        {
            // Create RTDoc with one slide & put it in ON
            if (rtDoc == null && !(orea.Data is RTDocument || orea.Data is RTFrame))
            {
                // Create blank RTDocument
                rtDoc = new RTDocument();
                rtDoc.Identifier = new Guid(constWhiteboardGuid);
                rtDoc.Metadata.Title = "Whiteboard Session " + DateTime.Now.ToString("u");
                rtDoc.Metadata.Creator = Conference.LocalParticipant.Name;

                // Add a blank page
                Page pg = new Page();
                pg.Identifier = new Guid(constWhiteboardGuid);
                TOCNode tn = new TOCNode();
                tn.Title = "Whiteboard 1";
                tn.Resource = pg;
                tn.ResourceIdentifier = pg.Identifier;
                tn.Identifier = new Guid(constWhiteboardGuid);
                rtDoc.Organization.TableOfContents.Add(tn);
                rtDoc.Resources.Pages.Add(pg.Identifier, pg);

                // Add the page to the strokes hash
                strokesPerPage.Add( pg.Identifier, new ArrayList() );

                // Init necessary vars
                this.crntPage = pg.Identifier;
                // Pri2: re-enable this feature (removed due to PS 2063)
                //string folderInON = Options.GetFolderForAuthor("Unknown / Whiteboard Session");
                //this.crntONFile = folderInON + " " + DateTime.Now.ToString("u").Replace(":", ".").Replace("Z","") + ".one";
                this.crntONFile = "Whiteboard - " + DateTime.Now.ToString("u").Replace(":", ".").Replace("Z","") + ".one";

                // Import the page
                this.InsertPageInON( pg, tn.Title, Guid.Empty );

                // Show first page
                System.Threading.Thread.Sleep(50);
                importer.NavigateToPage( crntONFile, crntPage.ToString("B") );
            }

            if (orea.Data is RTStrokeRemove)
            {
                RTStrokeRemoveReceived((RTStrokeRemove)orea.Data);
            }
            else if (orea.Data is RTStroke)
            {
                RTStrokeReceived((RTStroke)orea.Data);
            }
            else if (orea.Data is Page)
            {
                PageReceived((Page)orea.Data);
            }
            else if (orea.Data is RTPageAdd)
            {
                RTPageAddReceived((RTPageAdd)orea.Data);
            }
            else if (orea.Data is RTNodeChanged)
            {
                RTNodeChangedReceived(
                    (RTNodeChanged)orea.Data);
            }
            else if (orea.Data is RTDocument)
            {
                RTDocumentReceived((RTDocument)orea.Data);
            }
            else if (orea.Data is RTFrame)
            {
                RTFrameReceived( (RTFrame)orea.Data );
            }
        }
 public void Remove(TOCNode value)
 {
     arrayList.Remove(value);
     hashTable.Remove(value.Identifier);
 }
 public int Add(TOCNode value)
 {
     hashTable.Add(value.Identifier, value);
     return(arrayList.Add(value));
 }
 public int IndexOf(TOCNode value)
 {
     return(arrayList.IndexOf(value));
 }
 public bool ContainsValue(TOCNode value)
 {
     return(hashTable.ContainsValue(value));
 }
 public bool Contains(TOCNode value)
 {
     return(arrayList.Contains(value));
 }
 public void Remove(TOCNode value)
 {
     arrayList.Remove(value);
     hashTable.Remove(value.Identifier);
 }
Beispiel #21
0
        public static RTDocument PPT2RTDocument(string pptFilename)
        {
            //Pri2: Investigate where BasePath is and where we should be putting it in more depth.
            //      Concerned that we're creating directories there that never get cleaned up...
            if (!Directory.Exists(tfc.BasePath))
                Directory.CreateDirectory(tfc.BasePath);
            // Initialize PowerPoint app
            ApplicationClass ppt = new ApplicationClass();

            // Open the PPT file
            Presentation presentation = ppt.Presentations.Open(pptFilename, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
            Slides slides = presentation.Slides;

            // Set up the document
            RTDocument rtDoc = new RTDocument();
            rtDoc.Identifier = Guid.NewGuid();
            rtDoc.Metadata.Title = GetPresentationProperty(presentation, "Title");
            rtDoc.Metadata.Creator = GetPresentationProperty(presentation, "Author");

            // Create shared MemoryStream to minimize mem usage
            MemoryStream ms = new MemoryStream();

            //Iterate through the pages
            int i = 0;
            foreach(Slide s in slides)
            {
                // Set the page properties
                Page p = new Page();
                p.Identifier = Guid.NewGuid();
                p.Image = GetSlideImage(s, ms);
                if (p.Image is Metafile)
                {
                    p.MimeType = "image/x-wmf";
                }
                if (p.Image is Bitmap)
                {
                    p.MimeType = "image/png";
                }
                rtDoc.Resources.Pages.Add(p.Identifier, p);

                // TODO, slice in RegionBuilder code from Presenter work...

                // Set the TOCNode properties for the page
                TOCNode tn = new TOCNode();
                tn.Title = GetSlideTitle(s);
                tn.Resource = p;
                tn.ResourceIdentifier = p.Identifier;
                //Pri2: Shouldn't this be a byte[] containing the PNG stream instead of a System.Drawing.Image?
                tn.Thumbnail = RTDocumentHelper.GetThumbnailFromImage(p.Image);
                rtDoc.Organization.TableOfContents.Add(tn);
                i++;
            }

            // Close PPT
            presentation.Close();
            if (ppt.Presentations.Count == 0)
            {
                ppt.Quit();
            }

            ppt = null;

            tfc.Delete();

            return rtDoc;
        }
        public override void AddCapability(ICapability capability)
        {
            base.AddCapability (capability);

            if(presentationCapability == null)
            {
                presentationCapability = (PresentationCapability)capability;
                presentationCapability.ObjectReceived += new CapabilityObjectReceivedEventHandler(ObjectReceived);

                // Init StatusBar
                statusBar.SetBusyStatusMessage(Strings.Loading);

                // Init ThumbnailsListView
                this.thumbnailsView.ImageSelected += new System.EventHandler(this.thumbnailsView_SelectedImageChanged);
                this.thumbnailsView.ImageMouseEnter += new EventHandler(thumbnailsView_ImageMouseEnter);
                this.thumbnailsView.ImageMouseLeave +=new EventHandler(thumbnailsView_ImageMouseLeave);
                Size pbSize = new Size(thumbnailsView.ClientRectangle.Width - 55, 0);
                pbSize.Height = (int)( ((float)pbSize.Width)*(3F/4F) );

                // Create blank RTDocument
                this.rtDocument = new RTDocument();
                rtDocument.Identifier = new Guid(constWhiteboardGuid);
                rtDocument.Metadata.Title = Strings.WhiteboardSession;
                rtDocument.Metadata.Creator = Conference.LocalParticipant.Name;
            
                // Add a blank page
                Page pg = new Page();
                pg.Identifier = new Guid(constWhiteboardGuid);
                TOCNode tn = new TOCNode();
                tn.Title = Strings.Whiteboard1;
                tn.Resource = pg;
                tn.ResourceIdentifier = pg.Identifier;
                tn.Identifier = new Guid(constWhiteboardGuid);
                rtDocument.Organization.TableOfContents.Add(tn);
                rtDocument.Resources.Pages.Add(pg.Identifier, pg);

                // Wrap the RTD with a helper & init vars
                rtDocumentHelper = new RTDocumentHelper( presentationCapability, rtDocument );
                rtDocumentHelper.CurrentOrganizationNodeIdentifier = tn.Identifier;
                statusBar.SetMaxPage( 1, rtDocument.Organization.TableOfContents.Count );
                thumbnailsView.InsertThumbnail(null, tn.Title, 0, tn.Identifier);
                thumbnailsView.SelectedIndex = 0;
                this.pageShowing = pg.Identifier;
            }
        }