2017-12-30 20:25:16 +00:00
|
|
|
import { XmlComponent } from "file/xml-components";
|
2017-03-27 01:28:52 +01:00
|
|
|
import { RelationshipsAttributes } from "./attributes";
|
2018-05-06 22:23:35 -05:00
|
|
|
import { Relationship, RelationshipType, TargetModeType } from "./relationship/relationship";
|
2017-03-27 01:28:52 +01:00
|
|
|
|
|
|
|
export class Relationships extends XmlComponent {
|
|
|
|
constructor() {
|
|
|
|
super("Relationships");
|
2018-01-23 01:33:12 +00:00
|
|
|
this.root.push(
|
|
|
|
new RelationshipsAttributes({
|
|
|
|
xmlns: "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
|
|
}),
|
|
|
|
);
|
2018-01-10 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public addRelationship(relationship: Relationship): void {
|
|
|
|
this.root.push(relationship);
|
|
|
|
}
|
|
|
|
|
2019-11-08 10:50:18 +01:00
|
|
|
public createRelationship(id: number | string, type: RelationshipType, target: string, targetMode?: TargetModeType): Relationship {
|
2018-05-06 22:23:35 -05:00
|
|
|
const relationship = new Relationship(`rId${id}`, type, target, targetMode);
|
2018-01-10 00:29:17 +00:00
|
|
|
this.addRelationship(relationship);
|
|
|
|
|
|
|
|
return relationship;
|
2017-03-27 01:28:52 +01:00
|
|
|
}
|
2018-01-29 01:55:25 +00:00
|
|
|
|
|
|
|
public get RelationshipCount(): number {
|
|
|
|
return this.root.length - 1;
|
|
|
|
}
|
2017-03-27 01:28:52 +01:00
|
|
|
}
|