internal override void LoadDataFromXml(XmlElement element) { Clear(); CheckTagName(element); XmlNodeList childList = element.ChildNodes; if (childList == null || childList.Count <= 0) { return; } // Just load page guid and name foreach (XmlElement childElement in childList) { DocumentPage page = null; if (_document.DocumentType == DocumentType.Library) { page = new CustomObjectPage(_document, ""); } else { page = new StandardPage(_document, ""); } page.PageData.Clear(); // Page data is cleared now. page.LoadDataFromXml(childElement); Add(page.Guid, page); page.OnAddToDocument(); } }
public IDocumentPage DuplicatePage(Guid pageGuid) { CheckOpen(); if (!Pages.Contains(pageGuid)) { throw new ArgumentException("pageGuid"); } Serializer writer = new Serializer(_workingDirectoryGuid, Guid.Empty, _workingImagesDirectory); if (_documentData.DocumentType == DocumentType.Library) { CustomObjectPage sourcePage = Pages[pageGuid] as CustomObjectPage; writer.AddCustomObjectPage(sourcePage); } else { StandardPage sourcePage = Pages[pageGuid] as StandardPage; writer.AddStandardPage(sourcePage); } IDocumentPage newPage = null; using (Stream stream = writer.WriteToStream()) { IObjectContainer container = AddPages(stream); if (_documentData.DocumentType == DocumentType.Library) { if (container.CustomObjectPageList.Count > 0) { newPage = container.CustomObjectPageList[0]; } } else { if (container.StandardPageList.Count > 0) { newPage = container.StandardPageList[0]; } } } return(newPage); }
public IDocumentPage CreatePage(string pageName) { CheckOpen(); DocumentPage page = null; if (_documentData.DocumentType == DocumentType.Library) { page = new CustomObjectPage(this, pageName); } else { page = new StandardPage(this, pageName); } AddPage(page); return(page); }
internal static CustomObjectPage CreateCustomObject(Document document, ISerializeWriter writer, string objectName, Stream icon, Stream thumbnail) { CustomObjectPage objectPage = document.CreatePage(objectName) as CustomObjectPage; // Create a new node in the page tree. ITreeNode node = document.DocumentSettings.LayoutSetting.PageTree.AddChild(TreeNodeType.Page); node.AttachedObject = objectPage; objectPage.Open(); // Add to base view. PageView baseView = objectPage.PageViews[document.AdaptiveViewSet.Base.Guid] as PageView; IObjectContainer container = baseView.AddObjects(writer.WriteToStream()); // Adjust widgets position from coordinate (0,0); baseView.PageViewStyle.X = 0; baseView.PageViewStyle.Y = 0; if (icon != null) { objectPage.Icon = icon; } if (thumbnail != null) { objectPage.Thumbnail = thumbnail; } // Page must be closed after setting icon and thumbnail, so that they can be saved into the file. // Document.save() only call save() on opened pages. objectPage.Close(); document.UpdateLastAccessTime(); return(objectPage); }
internal CustomObjectPageData(CustomObjectPage page, string tagName) : base(page, tagName) { }