From b9965ccda9e054525cc9c670b3e5e7a67cf0abdd Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Mon, 19 Aug 2019 12:26:00 -0400 Subject: [PATCH] Improvements to the filesystem behind the XPS format - still not actually doing anything with text yet --- .../XPS/FixedDocument/FDOCDataFormat.cs | 74 ++++++++++ .../XPS/FixedPage/FPAGEDataFormat.cs | 128 ++++++++++++++++++ .../Text/Formatted/XPS/XPSDataFormat.cs | 49 ++++++- .../Text/Formatted/XPS/XPSGenerator.cs | 15 ++ .../Text/Formatted/XPS/XPSSchemaKey.cs | 15 ++ .../Text/Formatted/XPS/XPSSchemaType.cs | 12 ++ .../Text/Formatted/XPS/XPSSchemaVersion.cs | 9 ++ .../Text/Formatted/XPS/XPSSchemas.cs | 32 +++++ .../FixedDocument/FixedDocumentObjectModel.cs | 24 ++++ .../XPS/FixedDocument/PageContent.cs | 24 ++++ .../Formatted/XPS/FixedPage/FixedPageItem.cs | 11 ++ .../XPS/FixedPage/FixedPageObjectModel.cs | 21 +++ .../Text/Formatted/XPS/FixedPage/Glyph.cs | 17 +++ .../Text/Formatted/XPS/FixedPage/Path.cs | 8 ++ .../Text/Formatted/XPS/XPSStyleSimulations.cs | 8 ++ .../UniversalEditor.Plugins.Microsoft.csproj | 22 +++ 16 files changed, 465 insertions(+), 4 deletions(-) create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/FixedDocument/FDOCDataFormat.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/FixedPage/FPAGEDataFormat.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSGenerator.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaKey.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaType.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaVersion.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemas.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedDocument/FixedDocumentObjectModel.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedDocument/PageContent.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/FixedPageItem.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/FixedPageObjectModel.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/Glyph.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/Path.cs create mode 100644 CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/XPSStyleSimulations.cs diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/FixedDocument/FDOCDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/FixedDocument/FDOCDataFormat.cs new file mode 100644 index 00000000..18c6526f --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/FixedDocument/FDOCDataFormat.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using UniversalEditor.DataFormats.Markup.XML; +using UniversalEditor.ObjectModels.Markup; +using UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedDocument; + +namespace UniversalEditor.DataFormats.Text.Formatted.XPS.FixedDocument +{ + public class FDOCDataFormat : XMLDataFormat + { + public FDOCDataFormat() + { + } + public FDOCDataFormat(XPSSchemaVersion schemaVersion) + { + SchemaVersion = schemaVersion; + } + + public XPSSchemaVersion SchemaVersion { get; set; } = XPSSchemaVersion.OpenXPS; + + protected override void BeforeLoadInternal(Stack objectModels) + { + base.BeforeLoadInternal(objectModels); + objectModels.Push(new MarkupObjectModel()); + } + protected override void AfterLoadInternal(Stack objectModels) + { + base.AfterLoadInternal(objectModels); + + MarkupObjectModel mom = (objectModels.Pop() as MarkupObjectModel); + FixedDocumentObjectModel fdoc = (objectModels.Pop() as FixedDocumentObjectModel); + + MarkupTagElement tagFixedDocument = (mom.Elements["FixedDocument"] as MarkupTagElement); + if (tagFixedDocument != null) + { + foreach (MarkupElement el in tagFixedDocument.Elements) + { + MarkupTagElement tag = (el as MarkupTagElement); + if (tag == null) continue; + if (tag.Name != "PageContent") continue; + + MarkupAttribute attSource = tag.Attributes["Source"]; + if (attSource == null) continue; + + PageContent pc = new PageContent(attSource.Value); + fdoc.PageContents.Add(pc); + } + } + } + + protected override void BeforeSaveInternal(Stack objectModels) + { + FixedDocumentObjectModel fdoc = (objectModels.Pop() as FixedDocumentObjectModel); + MarkupObjectModel mom = new MarkupObjectModel(); + + MarkupTagElement tagFixedDocument = new MarkupTagElement(); + tagFixedDocument.FullName = "FixedDocument"; + tagFixedDocument.Attributes.Add("xmlns", XPSSchemas.GetSchema(SchemaVersion, XPSSchemaType.FixedDocument)); + + foreach (PageContent pc in fdoc.PageContents) + { + MarkupTagElement tag = new MarkupTagElement(); + tag.FullName = "PageContent"; + tag.Attributes.Add("Source", pc.Source); + tagFixedDocument.Elements.Add(tag); + } + + mom.Elements.Add(tagFixedDocument); + + objectModels.Push(mom); + base.BeforeSaveInternal(objectModels); + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/FixedPage/FPAGEDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/FixedPage/FPAGEDataFormat.cs new file mode 100644 index 00000000..be22b6da --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/FixedPage/FPAGEDataFormat.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UniversalEditor.DataFormats.Markup.XML; +using UniversalEditor.ObjectModels.Markup; +using UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedPage; + +namespace UniversalEditor.DataFormats.Text.Formatted.XPS.FixedPage +{ + public class FPAGEDataFormat : XMLDataFormat + { + public XPSGenerator Generator { get; set; } = new XPSGenerator(); + public XPSSchemaVersion SchemaVersion { get; set; } = XPSSchemaVersion.OpenXPS; + + protected override void BeforeLoadInternal(Stack objectModels) + { + base.BeforeLoadInternal(objectModels); + objectModels.Push(new MarkupObjectModel()); + } + protected override void AfterLoadInternal(Stack objectModels) + { + base.AfterLoadInternal(objectModels); + + MarkupObjectModel mom = (objectModels.Pop() as MarkupObjectModel); + FixedPageObjectModel fpage = (objectModels.Pop() as FixedPageObjectModel); + + MarkupTagElement tagFixedPage = (mom.Elements["FixedPage"] as MarkupTagElement); + if (tagFixedPage != null) + { + MarkupAttribute attWidth = tagFixedPage.Attributes["Width"]; + MarkupAttribute attHeight = tagFixedPage.Attributes["Height"]; + + foreach (MarkupElement el in tagFixedPage.Elements) + { + MarkupTagElement tag = (el as MarkupTagElement); + if (tag == null) continue; + + switch (tag.Name) + { + case "Glyphs": + { + break; + } + case "Path": + { + break; + } + } + + } + } + } + + protected override void BeforeSaveInternal(Stack objectModels) + { + FixedPageObjectModel fpage = (objectModels.Pop() as FixedPageObjectModel); + MarkupObjectModel mom = new MarkupObjectModel(); + + MarkupTagElement tagFixedPage = new MarkupTagElement(); + tagFixedPage.FullName = "FixedPage"; + tagFixedPage.Attributes.Add("xmlns", XPSSchemas.GetSchema(SchemaVersion, XPSSchemaType.FixedPage)); + + if (!String.IsNullOrEmpty(Generator.Name)) + tagFixedPage.Elements.Add(new MarkupCommentElement(Generator.Name + " Generated! Version: " + Generator.Version.ToString())); + + // TODO: glyphs, paths, etc. + foreach (FixedPageItem item in fpage.Items) + { + if (item is Glyph) + { + Glyph glyph = (item as Glyph); + MarkupTagElement tagGlyph = new MarkupTagElement(); + tagGlyph.FullName = "Glyphs"; + tagGlyph.Attributes.Add("Fill", glyph.FillColor.ToHexadecimalHTML()); + // tagGlyph.Attributes.Add("FontUri", glyph.FontURI); + tagGlyph.Attributes.Add("FontRenderingEmSize", glyph.FontRenderingEmSize.ToString()); + tagGlyph.Attributes.Add("Indices", GetIndices(glyph.Text)); + tagGlyph.Attributes.Add("UnicodeString", glyph.Text); + tagFixedPage.Elements.Add(tagGlyph); + } + else if (item is Path) + { + MarkupTagElement tagPath = new MarkupTagElement(); + tagPath.FullName = "Path"; + tagFixedPage.Elements.Add(tagPath); + } + } + + mom.Elements.Add(tagFixedPage); + + objectModels.Push(mom); + base.BeforeSaveInternal(objectModels); + } + + public static Dictionary _indices = new Dictionary(); + static FPAGEDataFormat() + { + _indices.Add(' ', 3); + for (int i = 0; i < 26; i++) + { + _indices.Add((char)((int)'A' + i), (int)(((int)'A' + i) + 35)); + } + for (int i = 0; i < 26; i++) + { + _indices.Add((char)((int)'a' + i), (int)(((int)'a' + i) + 68)); + } + } + + /// + /// returns the indices associated with the given string + /// + /// The indices. + /// Value. + public string GetIndices(string value) + { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < value.Length; i++) + { + sb.Append(_indices[value[i]].ToString()); + if (i < value.Length - 1) + { + sb.Append(';'); + } + } + return sb.ToString(); + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSDataFormat.cs index 9cfd896d..c5af197a 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSDataFormat.cs @@ -21,11 +21,14 @@ using System; using UniversalEditor.DataFormats.Package.OpenPackagingConvention; +using UniversalEditor.DataFormats.Text.Formatted.XPS.FixedDocument; using UniversalEditor.DataFormats.Text.Formatted.XPS.FixedDocumentSequence; +using UniversalEditor.DataFormats.Text.Formatted.XPS.FixedPage; using UniversalEditor.DataFormats.Text.Formatted.XPS.PrintTicket; using UniversalEditor.ObjectModels.FileSystem; using UniversalEditor.ObjectModels.Package; using UniversalEditor.ObjectModels.Text.Formatted; +using UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedDocument; using UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedDocumentSequence; using UniversalEditor.ObjectModels.Text.Formatted.XPS.PrintTicket; @@ -43,6 +46,13 @@ namespace UniversalEditor.DataFormats.Text.Formatted.XPS } return _dfr; } + + private static System.Collections.Generic.Dictionary Schemas = new System.Collections.Generic.Dictionary(); + static XPSDataFormat() + { + } + + public XPSSchemaVersion SchemaVersion { get; set; } = XPSSchemaVersion.OpenXPS; protected override void BeforeLoadInternal(System.Collections.Generic.Stack objectModels) { @@ -57,17 +67,19 @@ namespace UniversalEditor.DataFormats.Text.Formatted.XPS FormattedTextObjectModel text = (objectModels.Pop() as FormattedTextObjectModel); // we need to get the FixedRepresentation for the XPS document - File[] files = package.GetFilesBySchema("http://schemas.microsoft.com/xps/2005/06/fixedrepresentation"); + File[] files = package.GetFilesBySchema(XPSSchemas.GetSchema(SchemaVersion, XPSSchemaType.FixedRepresentation)); // get the related print tickets - File[] printTickets = package.GetFilesBySchema("http://schemas.microsoft.com/xps/2005/06/printticket", "FixedDocumentSequence.fdseq"); + File[] printTickets = package.GetFilesBySchema(XPSSchemas.GetSchema(SchemaVersion, XPSSchemaType.PrintTicket), "FixedDocumentSequence.fdseq"); PrintTicketObjectModel printTicket = printTickets[0].GetObjectModel(new PrintTicketXMLDataFormat()); FixedDocumentSequenceObjectModel fdom = files[0].GetObjectModel(new FDSEQDataFormat()); - File fdoc = package.FileSystem.FindFile(fdom.DocumentReferences[0].Source.Substring(1)); + File fileFDOC = package.FileSystem.FindFile(fdom.DocumentReferences[0].Source.Substring(1)); + + FixedDocumentObjectModel fdoc = fileFDOC.GetObjectModel(new FDOCDataFormat(SchemaVersion)); + - // FixedDocument fdoc = file.GetObjectModel(new FDOCDataFormat()); } protected override void BeforeSaveInternal(System.Collections.Generic.Stack objectModels) @@ -75,6 +87,35 @@ namespace UniversalEditor.DataFormats.Text.Formatted.XPS FormattedTextObjectModel text = (objectModels.Pop() as FormattedTextObjectModel); PackageObjectModel package = new PackageObjectModel(); + package.DefaultContentTypes.Add("fdseq", "application/vnd.ms-package.xps-fixeddocumentsequence+xml"); + package.DefaultContentTypes.Add("fdoc", "application/vnd.ms-package.xps-fixeddocument+xml"); + package.DefaultContentTypes.Add("fpage", "application/vnd.ms-package.xps-fixedpage+xml"); + package.DefaultContentTypes.Add("odttf", "application/vnd.ms-package.obfuscated-opentype"); + package.DefaultContentTypes.Add("xml", "application/vnd.ms-printing.printticket+xml"); + package.DefaultContentTypes.Add("JPG", "image/jpeg"); + + FixedDocumentObjectModel fdoc = new FixedDocumentObjectModel(); + + Folder fldDocuments = package.FileSystem.Folders.Add("Documents"); + Folder fldDocument1 = fldDocuments.Folders.Add("1"); + + Folder fldDocument1Metadata = fldDocument1.Folders.Add("Metadata"); + + for (int i = 0; i < 1; i++) + { + File fldDocument1MetadataPage1PT = new File(); + fldDocument1MetadataPage1PT.Name = "Page" + (i + 1).ToString() + "_PT.xml"; + + PrintTicketObjectModel pt = new PrintTicketObjectModel(); + fldDocument1MetadataPage1PT.SetObjectModel(new PrintTicketXMLDataFormat(), pt); + + File fldDocument1MetadataPage1Thumbnail = new File(); + fldDocument1MetadataPage1Thumbnail.Name = "Page" + (i + 1).ToString() + "_Thumbnail.JPG"; + } + + FPAGEDataFormat fpageDF = new FPAGEDataFormat(); + fpageDF.Generator = new XPSGenerator("Universal Editor", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); + fpageDF.SchemaVersion = SchemaVersion; objectModels.Push(package); } diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSGenerator.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSGenerator.cs new file mode 100644 index 00000000..a4fd3d52 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSGenerator.cs @@ -0,0 +1,15 @@ +using System; +namespace UniversalEditor.DataFormats.Text.Formatted.XPS +{ + public struct XPSGenerator + { + public string Name; + public Version Version; + + public XPSGenerator(string name, Version version) + { + Name = name; + Version = version; + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaKey.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaKey.cs new file mode 100644 index 00000000..fd517cce --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaKey.cs @@ -0,0 +1,15 @@ +using System; +namespace UniversalEditor.DataFormats.Text.Formatted.XPS +{ + public struct XPSSchemaKey + { + public XPSSchemaVersion Version; + public XPSSchemaType Type; + + public XPSSchemaKey(XPSSchemaVersion version, XPSSchemaType type) + { + Version = version; + Type = type; + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaType.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaType.cs new file mode 100644 index 00000000..d0bcb7b6 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaType.cs @@ -0,0 +1,12 @@ +using System; +namespace UniversalEditor.DataFormats.Text.Formatted.XPS +{ + public enum XPSSchemaType + { + FixedDocument, + FixedRepresentation, + FixedPage, + PrintTicket, + Thumbnail + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaVersion.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaVersion.cs new file mode 100644 index 00000000..51591a5b --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemaVersion.cs @@ -0,0 +1,9 @@ +using System; +namespace UniversalEditor.DataFormats.Text.Formatted.XPS +{ + public enum XPSSchemaVersion + { + XPS, + OpenXPS + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemas.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemas.cs new file mode 100644 index 00000000..9b2c3a98 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/XPS/XPSSchemas.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; + +namespace UniversalEditor.DataFormats.Text.Formatted.XPS +{ + public static class XPSSchemas + { + private static Dictionary _Schema = new Dictionary(); + + public static string GetSchema(XPSSchemaVersion version, XPSSchemaType type) + { + if (_Schema.ContainsKey(new XPSSchemaKey(version, type))) + return _Schema[new XPSSchemaKey(version, type)]; + return null; + } + + static XPSSchemas() + { + _Schema[new XPSSchemaKey(XPSSchemaVersion.XPS, XPSSchemaType.FixedRepresentation)] = "http://schemas.microsoft.com/xps/2005/06/fixedrepresentation"; + _Schema[new XPSSchemaKey(XPSSchemaVersion.XPS, XPSSchemaType.PrintTicket)] = "http://schemas.microsoft.com/xps/2005/06/printticket"; + _Schema[new XPSSchemaKey(XPSSchemaVersion.XPS, XPSSchemaType.Thumbnail)] = "http://schemas.microsoft.com/xps/2005/06/printticket"; + _Schema[new XPSSchemaKey(XPSSchemaVersion.XPS, XPSSchemaType.FixedDocument)] = "http://schemas.microsoft.com/xps/2005/06"; + _Schema[new XPSSchemaKey(XPSSchemaVersion.XPS, XPSSchemaType.FixedPage)] = "http://schemas.microsoft.com/xps/2005/06"; + + _Schema[new XPSSchemaKey(XPSSchemaVersion.OpenXPS, XPSSchemaType.FixedRepresentation)] = "http://schemas.openxps.org/oxps/v1.0/fixedrepresentation"; + _Schema[new XPSSchemaKey(XPSSchemaVersion.OpenXPS, XPSSchemaType.PrintTicket)] = "http://schemas.openxps.org/oxps/v1.0/printticket"; + _Schema[new XPSSchemaKey(XPSSchemaVersion.OpenXPS, XPSSchemaType.Thumbnail)] = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"; //yes this is the same as OpenXPS + _Schema[new XPSSchemaKey(XPSSchemaVersion.OpenXPS, XPSSchemaType.FixedDocument)] = "http://schemas.openxps.org/oxps/v1.0"; + _Schema[new XPSSchemaKey(XPSSchemaVersion.OpenXPS, XPSSchemaType.FixedPage)] = "http://schemas.openxps.org/oxps/v1.0"; + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedDocument/FixedDocumentObjectModel.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedDocument/FixedDocumentObjectModel.cs new file mode 100644 index 00000000..b888a271 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedDocument/FixedDocumentObjectModel.cs @@ -0,0 +1,24 @@ +using System; +namespace UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedDocument +{ + public class FixedDocumentObjectModel : ObjectModel + { + public PageContent.PageContentCollection PageContents { get; } = new PageContent.PageContentCollection(); + + public override void Clear() + { + PageContents.Clear(); + } + + public override void CopyTo(ObjectModel where) + { + FixedDocumentObjectModel clone = (where as FixedDocumentObjectModel); + if (clone == null) return; + + foreach (PageContent pcoc in PageContents) + { + clone.PageContents.Add(pcoc.Clone() as PageContent); + } + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedDocument/PageContent.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedDocument/PageContent.cs new file mode 100644 index 00000000..ccd55b0d --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedDocument/PageContent.cs @@ -0,0 +1,24 @@ +using System; +namespace UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedDocument +{ + public class PageContent : ICloneable + { + public class PageContentCollection + : System.Collections.ObjectModel.Collection + { + } + + public string Source { get; set; } = String.Empty; + + public PageContent(string source) + { + Source = source; + } + + public object Clone() + { + PageContent clone = new PageContent(Source.Clone() as string); + return clone; + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/FixedPageItem.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/FixedPageItem.cs new file mode 100644 index 00000000..20216c47 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/FixedPageItem.cs @@ -0,0 +1,11 @@ +using System; +namespace UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedPage +{ + public abstract class FixedPageItem + { + public class FixedPageItemCollection + : System.Collections.ObjectModel.Collection + { + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/FixedPageObjectModel.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/FixedPageObjectModel.cs new file mode 100644 index 00000000..42155f3c --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/FixedPageObjectModel.cs @@ -0,0 +1,21 @@ +using System; +namespace UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedPage +{ + public class FixedPageObjectModel : ObjectModel + { + // public Measurement Width { get; set; } + // public Measurement Height { get; set; } + + public FixedPageItem.FixedPageItemCollection Items { get; } = new FixedPageItem.FixedPageItemCollection(); + + public override void Clear() + { + throw new NotImplementedException(); + } + + public override void CopyTo(ObjectModel where) + { + throw new NotImplementedException(); + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/Glyph.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/Glyph.cs new file mode 100644 index 00000000..be6c17e5 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/Glyph.cs @@ -0,0 +1,17 @@ +using System; +using MBS.Framework.Drawing; + +namespace UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedPage +{ + public class Glyph : FixedPageItem + { + public Color FillColor { get; set; } = Color.Empty; + public double FontRenderingEmSize { get; set; } = 16.0006; + public XPSStyleSimulations StyleSimulations { get; set; } = XPSStyleSimulations.None; + + public double OriginX { get; set; } = 0.0; + public double OriginY { get; set; } = 0.0; + + public string Text { get; set; } = String.Empty; + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/Path.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/Path.cs new file mode 100644 index 00000000..ce021de2 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/FixedPage/Path.cs @@ -0,0 +1,8 @@ +using System; +namespace UniversalEditor.ObjectModels.Text.Formatted.XPS.FixedPage +{ + public class Path : FixedPageItem + { + + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/XPSStyleSimulations.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/XPSStyleSimulations.cs new file mode 100644 index 00000000..eb660b36 --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Text/Formatted/XPS/XPSStyleSimulations.cs @@ -0,0 +1,8 @@ +using System; +namespace UniversalEditor.ObjectModels.Text.Formatted.XPS +{ + public enum XPSStyleSimulations + { + None + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj index 991eb35f..11b2ecc5 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj @@ -115,6 +115,20 @@ + + + + + + + + + + + + + + @@ -137,6 +151,10 @@ {8622EBC4-8E20-476E-B284-33D472081F5C} UniversalEditor.UserInterface + + {23ACD09E-E096-4B05-A6CE-6853EDDC589A} + MBS.Framework + @@ -151,5 +169,9 @@ + + + + \ No newline at end of file