From 8c91c04afa2e4219585c412703a78b3cc4ba1d6a Mon Sep 17 00:00:00 2001 From: felipe Date: Fri, 10 Mar 2017 14:30:32 +0100 Subject: [PATCH] clean up latentstyles to use modern attribute implementation --- ts/styles/index.ts | 1 - ts/styles/latent-styles/exceptions.ts | 27 +++++++++++++++ .../latent-styles/exceptions/attributes.ts | 33 ------------------- ts/styles/latent-styles/exceptions/index.ts | 10 ------ 4 files changed, 27 insertions(+), 44 deletions(-) create mode 100644 ts/styles/latent-styles/exceptions.ts delete mode 100644 ts/styles/latent-styles/exceptions/attributes.ts delete mode 100644 ts/styles/latent-styles/exceptions/index.ts diff --git a/ts/styles/index.ts b/ts/styles/index.ts index c0114c1c54..da19782366 100644 --- a/ts/styles/index.ts +++ b/ts/styles/index.ts @@ -3,7 +3,6 @@ import { XmlComponent } from "../docx/xml-components"; import { DocumentDefaults } from "./defaults"; import { LatentStyles } from "./latent-styles"; import { LatentStyleException } from "./latent-styles/exceptions"; -import { LatentStyleExceptionAttributes } from "./latent-styles/exceptions/attributes"; import { ParagraphStyle } from "./style"; export class Styles extends XmlComponent { diff --git a/ts/styles/latent-styles/exceptions.ts b/ts/styles/latent-styles/exceptions.ts new file mode 100644 index 0000000000..83995b0902 --- /dev/null +++ b/ts/styles/latent-styles/exceptions.ts @@ -0,0 +1,27 @@ +import { XmlAttributeComponent, XmlComponent } from "../../docx/xml-components"; + +interface ILatentStyleExceptionAttributesProperties { + name?: string; + uiPriority?: string; + qFormat?: string; + semiHidden?: string; + unhideWhenUsed?: string; +} + +class LatentStyleExceptionAttributes extends XmlAttributeComponent { + protected xmlKeys = { + name: "w:name", + uiPriority: "w:uiPriority", + qFormat: "w:qFormat", + semiHidden: "w:semiHidden", + unhideWhenUsed: "w:unhideWhenUsed", + }; +} + +export class LatentStyleException extends XmlComponent { + + constructor(attributes: ILatentStyleExceptionAttributesProperties) { + super("w:lsdException"); + this.root.push(new LatentStyleExceptionAttributes(attributes)); + } +} diff --git a/ts/styles/latent-styles/exceptions/attributes.ts b/ts/styles/latent-styles/exceptions/attributes.ts deleted file mode 100644 index 37e1d8abc6..0000000000 --- a/ts/styles/latent-styles/exceptions/attributes.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {XmlComponent} from "../../../docx/xml-components"; - -interface ILatentStyleExceptionAttributesProperties { - name?: string; - uiPriority?: string; - qFormat?: string; - semiHidden?: string; - unhideWhenUsed?: string; -} - -export class LatentStyleExceptionAttributes extends XmlComponent { - /* tslint:disable */ - private _attr: ILatentStyleExceptionAttributesProperties; - /* tslint:enable */ - - private xmlKeys = { - name: "w:name", - uiPriority: "w:uiPriority", - qFormat: "w:qFormat", - semiHidden: "w:semiHidden", - unhideWhenUsed: "w:unhideWhenUsed", - }; - - constructor(properties?: ILatentStyleExceptionAttributesProperties) { - super("_attr"); - this._attr = properties; - - if (!properties) { - this._attr = {}; - } - // this._attr.xmlKeys = this.xmlKeys; - } -} diff --git a/ts/styles/latent-styles/exceptions/index.ts b/ts/styles/latent-styles/exceptions/index.ts deleted file mode 100644 index 227ed93318..0000000000 --- a/ts/styles/latent-styles/exceptions/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { XmlComponent } from "../../../docx/xml-components"; -import { LatentStyleExceptionAttributes } from "./attributes"; - -export class LatentStyleException extends XmlComponent { - - constructor(attributes: LatentStyleExceptionAttributes) { - super("w:lsdException"); - this.root.push(attributes); - } -}