2022-06-26 23:26:42 +01:00
|
|
|
import { IMediaData } from "@file/media";
|
|
|
|
import { XmlComponent } from "@file/xml-components";
|
2018-06-08 16:03:04 +02:00
|
|
|
import { Anchor } from "./anchor";
|
2018-06-09 23:49:01 +01:00
|
|
|
import { IFloating } from "./floating";
|
|
|
|
import { Inline } from "./inline";
|
2018-06-08 16:03:04 +02:00
|
|
|
|
2018-06-09 23:49:01 +01:00
|
|
|
export interface IDistance {
|
2018-11-02 02:51:57 +00:00
|
|
|
readonly distT?: number;
|
|
|
|
readonly distB?: number;
|
|
|
|
readonly distL?: number;
|
|
|
|
readonly distR?: number;
|
2018-06-08 16:03:04 +02:00
|
|
|
}
|
|
|
|
|
2018-06-09 23:49:01 +01:00
|
|
|
export interface IDrawingOptions {
|
2018-11-02 02:51:57 +00:00
|
|
|
readonly floating?: IFloating;
|
2018-06-08 16:03:04 +02:00
|
|
|
}
|
|
|
|
|
2021-05-26 09:28:31 +03:00
|
|
|
// <xsd:complexType name="CT_Drawing">
|
|
|
|
// <xsd:choice minOccurs="1" maxOccurs="unbounded">
|
|
|
|
// <xsd:element ref="wp:anchor" minOccurs="0"/>
|
|
|
|
// <xsd:element ref="wp:inline" minOccurs="0"/>
|
|
|
|
// </xsd:choice>
|
|
|
|
// </xsd:complexType>
|
|
|
|
|
2017-12-30 20:59:05 +00:00
|
|
|
export class Drawing extends XmlComponent {
|
2018-08-07 01:38:15 +01:00
|
|
|
private readonly inline: Inline;
|
2018-06-09 23:33:52 +01:00
|
|
|
|
2019-01-09 01:16:47 +00:00
|
|
|
constructor(imageData: IMediaData, drawingOptions: IDrawingOptions = {}) {
|
2017-12-30 20:59:05 +00:00
|
|
|
super("w:drawing");
|
|
|
|
|
2019-01-09 01:16:47 +00:00
|
|
|
if (!drawingOptions.floating) {
|
2021-03-15 02:41:37 +00:00
|
|
|
this.inline = new Inline(imageData, imageData.transformation);
|
2018-06-09 23:33:52 +01:00
|
|
|
this.root.push(this.inline);
|
2019-01-09 01:16:47 +00:00
|
|
|
} else {
|
2021-03-15 02:41:37 +00:00
|
|
|
this.root.push(new Anchor(imageData, imageData.transformation, drawingOptions));
|
2018-06-08 16:03:04 +02:00
|
|
|
}
|
2017-12-30 20:59:05 +00:00
|
|
|
}
|
|
|
|
}
|