diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Package/OpenPackagingConvention/OPCDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Package/OpenPackagingConvention/OPCDataFormat.cs index 71779515..838c6f42 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Package/OpenPackagingConvention/OPCDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Package/OpenPackagingConvention/OPCDataFormat.cs @@ -46,7 +46,11 @@ namespace UniversalEditor.DataFormats.Package.OpenPackagingConvention RelationshipsObjectModel rels = file.GetObjectModel(new OPCRelationshipsDataFormat()); if (relatedFileName != null) { - + foreach (Relationship rel in rels.Relationships) + { + rel.Source = relatedFileName; + package.Relationships.Add(rel); + } } else { diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/PackageObjectModel.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/PackageObjectModel.cs index 1a8b4c13..fce239c6 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/PackageObjectModel.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/PackageObjectModel.cs @@ -41,10 +41,10 @@ namespace UniversalEditor.ObjectModels.Package private FileSystemObjectModel mvarFileSystem = new FileSystemObjectModel(); public FileSystemObjectModel FileSystem { get { return mvarFileSystem; } } - public File[] GetFilesBySchema(string p) + public File[] GetFilesBySchema(string schema, string relationshipSource = null) { List files = new List(); - Relationship[] rels = mvarRelationships.GetBySchema(p); + Relationship[] rels = mvarRelationships.GetBySchema(schema, relationshipSource); foreach (Relationship rel in rels) { if (rel.Target.StartsWith("/")) diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/Relationships/Relationship.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/Relationships/Relationship.cs index f1c989af..c70efc99 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/Relationships/Relationship.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/Relationships/Relationship.cs @@ -15,12 +15,15 @@ namespace UniversalEditor.ObjectModels.Package.Relationships /// /// The schema to search for. /// Array of objects whose Schema property is set to the specified value. - public Relationship[] GetBySchema(string schema) + public Relationship[] GetBySchema(string schema, string source = null) { List rels = new List(); foreach (Relationship rel in this) { - if (rel.Schema == schema) rels.Add(rel); + if (rel.Schema == schema && rel.Source == source) + { + rels.Add(rel); + } } return rels.ToArray(); } @@ -35,11 +38,15 @@ namespace UniversalEditor.ObjectModels.Package.Relationships private string mvarTarget = String.Empty; public string Target { get { return mvarTarget; } set { mvarTarget = value; } } + private string mvarSource = null; + public string Source { get { return mvarSource; } set { mvarSource = value; } } + public object Clone() { Relationship clone = new Relationship(); clone.ID = (mvarID.Clone() as string); clone.Schema = (mvarSchema.Clone() as string); + clone.Source = (mvarSource.Clone() as string); clone.Target = (mvarTarget.Clone() as string); return clone; }