changed to xml component

This commit is contained in:
Dolan Miu
2016-03-29 22:55:37 +01:00
parent 4a62975516
commit 7e91d7be4d
3 changed files with 24 additions and 24 deletions

View File

@ -1,10 +1,10 @@
import {P, Attributes} from "./xml-components"; import {XmlComponent, Attributes} from "./xml-components";
class Border implements P { class Border implements XmlComponent {
private bottom: Array<P>; private bottom: Array<XmlComponent>;
constructor() { constructor() {
this.bottom = new Array<P>(); this.bottom = new Array<XmlComponent>();
this.bottom.push(new Attributes({ this.bottom.push(new Attributes({
color: "auto", color: "auto",
space: "1", space: "1",
@ -15,10 +15,10 @@ class Border implements P {
} }
export class ThematicBreak { export class ThematicBreak {
private pBdr: Array<P>; private pBdr: Array<XmlComponent>;
constructor() { constructor() {
this.pBdr = new Array<P>(); this.pBdr = new Array<XmlComponent>();
this.pBdr.push(new Border()); this.pBdr.push(new Border());
} }
} }

View File

@ -1,11 +1,11 @@
import {P, Attributes, ParagraphProperties, Run} from "./xml-components"; import {XmlComponent, Attributes, ParagraphProperties, Run} from "./xml-components";
import {ThematicBreak} from "./border"; import {ThematicBreak} from "./border";
class Style { class Style {
private pStyle: Array<P>; private pStyle: Array<XmlComponent>;
constructor(type: string) { constructor(type: string) {
this.pStyle = new Array<P>(); this.pStyle = new Array<XmlComponent>();
this.pStyle.push(new Attributes({ this.pStyle.push(new Attributes({
val: type val: type
})); }));
@ -13,10 +13,10 @@ class Style {
} }
class Alignment { class Alignment {
private jc: Array<P>; private jc: Array<XmlComponent>;
constructor(type: string) { constructor(type: string) {
this.jc = new Array<P>(); this.jc = new Array<XmlComponent>();
this.jc.push(new Attributes({ this.jc.push(new Attributes({
val: type val: type
})); }));
@ -24,11 +24,11 @@ class Alignment {
} }
export class Paragraph { export class Paragraph {
private p: Array<P>; private p: Array<XmlComponent>;
private properties: ParagraphProperties; private properties: ParagraphProperties;
constructor(text?: string) { constructor(text?: string) {
this.p = new Array<P>(); this.p = new Array<XmlComponent>();
this.p.push(new Attributes()); this.p.push(new Attributes());
this.properties = new ParagraphProperties(); this.properties = new ParagraphProperties();
this.p.push(this.properties); this.p.push(this.properties);

View File

@ -1,4 +1,4 @@
export interface P { export interface XmlComponent {
} }
@ -9,42 +9,42 @@ interface AttributesProperties {
sz?: string; sz?: string;
} }
export class Attributes implements P { export class Attributes implements XmlComponent {
private _attrs: Object; private _attrs: Object;
constructor(properties?: AttributesProperties) { constructor(properties?: AttributesProperties) {
this._attrs = properties this._attrs = properties
if (!properties) { if (!properties) {
this._attrs = {}; this._attrs = {};
} }
} }
} }
export class ParagraphProperties implements P { export class ParagraphProperties implements XmlComponent {
private pPr: Array<P>; private pPr: Array<XmlComponent>;
constructor() { constructor() {
this.pPr = new Array<P>(); this.pPr = new Array<XmlComponent>();
this.pPr.push(new Attributes()); this.pPr.push(new Attributes());
} }
push(item: P) { push(item: XmlComponent) {
this.pPr.push(item); this.pPr.push(item);
} }
} }
export class Run implements P { export class Run implements XmlComponent {
private r: Array<P>; private r: Array<XmlComponent>;
constructor(text: string) { constructor(text: string) {
this.r = new Array<P>(); this.r = new Array<XmlComponent>();
this.r.push(new ParagraphProperties()); this.r.push(new ParagraphProperties());
this.r.push(new Text(text)); this.r.push(new Text(text));
} }
} }
export class Text implements P { export class Text implements XmlComponent {
private t: string; private t: string;
constructor(text: string) { constructor(text: string) {