Merge branch 'master' of https://github.com/h4buli/docx into feat/h4-update
# Conflicts: # package.json # src/file/drawing/drawing.ts # src/file/media/media.ts # src/file/paragraph/run/picture-run.ts # src/file/styles/external-styles-factory.ts # src/file/xml-components/imported-xml-component.ts
This commit is contained in:
@ -1,15 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IDocPropertiesAttributes {
|
||||
id?: number;
|
||||
name?: string;
|
||||
descr?: string;
|
||||
}
|
||||
|
||||
export class DocPropertiesAttributes extends XmlAttributeComponent<IDocPropertiesAttributes> {
|
||||
protected xmlKeys = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
descr: "descr",
|
||||
};
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { DocPropertiesAttributes } from "./doc-properties-attributes";
|
||||
|
||||
export class DocProperties extends XmlComponent {
|
||||
constructor() {
|
||||
super("wp:docPr");
|
||||
|
||||
this.root.push(
|
||||
new DocPropertiesAttributes({
|
||||
id: 0,
|
||||
name: "",
|
||||
descr: "",
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IEffectExtentAttributes {
|
||||
b?: number;
|
||||
l?: number;
|
||||
r?: number;
|
||||
t?: number;
|
||||
}
|
||||
|
||||
export class EffectExtentAttributes extends XmlAttributeComponent<IEffectExtentAttributes> {
|
||||
protected xmlKeys = {
|
||||
b: "b",
|
||||
l: "l",
|
||||
r: "r",
|
||||
t: "t",
|
||||
};
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { EffectExtentAttributes } from "./effect-extent-attributes";
|
||||
|
||||
export class EffectExtent extends XmlComponent {
|
||||
constructor() {
|
||||
super("wp:effectExtent");
|
||||
|
||||
this.root.push(
|
||||
new EffectExtentAttributes({
|
||||
b: 0,
|
||||
l: 0,
|
||||
r: 0,
|
||||
t: 0,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IExtentAttributes {
|
||||
cx?: number;
|
||||
cy?: number;
|
||||
}
|
||||
|
||||
export class ExtentAttributes extends XmlAttributeComponent<IExtentAttributes> {
|
||||
protected xmlKeys = {
|
||||
cx: "cx",
|
||||
cy: "cy",
|
||||
};
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { ExtentAttributes } from "./extent-attributes";
|
||||
|
||||
export class Extent extends XmlComponent {
|
||||
private attributes: ExtentAttributes;
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super("wp:extent");
|
||||
|
||||
this.attributes = new ExtentAttributes({
|
||||
cx: x,
|
||||
cy: y,
|
||||
});
|
||||
|
||||
this.root.push(this.attributes);
|
||||
}
|
||||
|
||||
public setXY(x: number, y: number): void {
|
||||
this.attributes.set({
|
||||
cx: x,
|
||||
cy: y,
|
||||
});
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IGraphicFrameLockAttributes {
|
||||
xmlns?: string;
|
||||
noChangeAspect?: number;
|
||||
}
|
||||
|
||||
export class GraphicFrameLockAttributes extends XmlAttributeComponent<IGraphicFrameLockAttributes> {
|
||||
protected xmlKeys = {
|
||||
xmlns: "xmlns:a",
|
||||
noChangeAspect: "noChangeAspect",
|
||||
};
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { GraphicFrameLockAttributes } from "./graphic-frame-lock-attributes";
|
||||
|
||||
export class GraphicFrameLocks extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:graphicFrameLocks");
|
||||
|
||||
this.root.push(
|
||||
new GraphicFrameLockAttributes({
|
||||
xmlns: "http://schemas.openxmlformats.org/drawingml/2006/main",
|
||||
noChangeAspect: 1,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { GraphicFrameLocks } from "./graphic-frame-locks/graphic-frame-locks";
|
||||
|
||||
export class GraphicFrameProperties extends XmlComponent {
|
||||
constructor() {
|
||||
super("wp:cNvGraphicFramePr");
|
||||
|
||||
this.root.push(new GraphicFrameLocks());
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IGraphicDataAttributes {
|
||||
uri?: string;
|
||||
}
|
||||
|
||||
export class GraphicDataAttributes extends XmlAttributeComponent<IGraphicDataAttributes> {
|
||||
protected xmlKeys = {
|
||||
uri: "uri",
|
||||
};
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { GraphicDataAttributes } from "./graphic-data-attribute";
|
||||
import { Pic } from "./pic";
|
||||
|
||||
export class GraphicData extends XmlComponent {
|
||||
private pic: Pic;
|
||||
|
||||
constructor(referenceId: number, x: number, y: number) {
|
||||
super("a:graphicData");
|
||||
|
||||
this.root.push(
|
||||
new GraphicDataAttributes({
|
||||
uri: "http://schemas.openxmlformats.org/drawingml/2006/picture",
|
||||
}),
|
||||
);
|
||||
|
||||
this.pic = new Pic(referenceId, x, y);
|
||||
|
||||
this.root.push(this.pic);
|
||||
}
|
||||
|
||||
public setXY(x: number, y: number): void {
|
||||
this.pic.setXY(x, y);
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
export * from "./graphic-data";
|
@ -1,13 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { Blip } from "./blip";
|
||||
import { SourceRectangle } from "./source-rectangle";
|
||||
import { Stretch } from "./stretch";
|
||||
|
||||
export class BlipFill extends XmlComponent {
|
||||
constructor(referenceId: number) {
|
||||
super("pic:blipFill");
|
||||
this.root.push(new Blip(referenceId));
|
||||
this.root.push(new SourceRectangle());
|
||||
this.root.push(new Stretch());
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
interface IBlipProperties {
|
||||
embed: string;
|
||||
cstate: string;
|
||||
}
|
||||
|
||||
class BlipAttributes extends XmlAttributeComponent<IBlipProperties> {
|
||||
protected xmlKeys = {
|
||||
embed: "r:embed",
|
||||
cstate: "cstate",
|
||||
};
|
||||
}
|
||||
|
||||
export class Blip extends XmlComponent {
|
||||
constructor(referenceId: number) {
|
||||
super("a:blip");
|
||||
this.root.push(
|
||||
new BlipAttributes({
|
||||
embed: `rId${referenceId}`,
|
||||
cstate: "none",
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class SourceRectangle extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:srcRect");
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
class FillRectangle extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:fillRect");
|
||||
}
|
||||
}
|
||||
|
||||
export class Stretch extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:stretch");
|
||||
this.root.push(new FillRectangle());
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
export * from "./pic";
|
@ -1,10 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { PicLocks } from "./pic-locks/pic-locks";
|
||||
|
||||
export class ChildNonVisualProperties extends XmlComponent {
|
||||
constructor() {
|
||||
super("pic:cNvPicPr");
|
||||
|
||||
this.root.push(new PicLocks());
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IPicLocksAttributes {
|
||||
noChangeAspect?: number;
|
||||
noChangeArrowheads?: number;
|
||||
}
|
||||
|
||||
export class PicLocksAttributes extends XmlAttributeComponent<IPicLocksAttributes> {
|
||||
protected xmlKeys = {
|
||||
noChangeAspect: "noChangeAspect",
|
||||
noChangeArrowheads: "noChangeArrowheads",
|
||||
};
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { PicLocksAttributes } from "./pic-locks-attributes";
|
||||
|
||||
export class PicLocks extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:picLocks");
|
||||
this.root.push(
|
||||
new PicLocksAttributes({
|
||||
noChangeAspect: 1,
|
||||
noChangeArrowheads: 1,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { ChildNonVisualProperties } from "./child-non-visual-pic-properties/child-non-visual-pic-properties";
|
||||
import { NonVisualProperties } from "./non-visual-properties/non-visual-properties";
|
||||
|
||||
export class NonVisualPicProperties extends XmlComponent {
|
||||
constructor() {
|
||||
super("pic:nvPicPr");
|
||||
|
||||
this.root.push(new NonVisualProperties());
|
||||
this.root.push(new ChildNonVisualProperties());
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface INonVisualPropertiesAttributes {
|
||||
id?: number;
|
||||
name?: string;
|
||||
descr?: string;
|
||||
}
|
||||
|
||||
export class NonVisualPropertiesAttributes extends XmlAttributeComponent<INonVisualPropertiesAttributes> {
|
||||
protected xmlKeys = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
descr: "desc",
|
||||
};
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { NonVisualPropertiesAttributes } from "./non-visual-properties-attributes";
|
||||
|
||||
export class NonVisualProperties extends XmlComponent {
|
||||
constructor() {
|
||||
super("pic:cNvPr");
|
||||
|
||||
this.root.push(
|
||||
new NonVisualPropertiesAttributes({
|
||||
id: 0,
|
||||
name: "",
|
||||
descr: "",
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IPicAttributes {
|
||||
xmlns?: string;
|
||||
}
|
||||
|
||||
export class PicAttributes extends XmlAttributeComponent<IPicAttributes> {
|
||||
protected xmlKeys = {
|
||||
xmlns: "xmlns:pic",
|
||||
};
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
// http://officeopenxml.com/drwPic.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { BlipFill } from "./blip/blip-fill";
|
||||
import { NonVisualPicProperties } from "./non-visual-pic-properties/non-visual-pic-properties";
|
||||
import { PicAttributes } from "./pic-attributes";
|
||||
import { ShapeProperties } from "./shape-properties/shape-properties";
|
||||
|
||||
export class Pic extends XmlComponent {
|
||||
private shapeProperties: ShapeProperties;
|
||||
|
||||
constructor(referenceId: number, x: number, y: number) {
|
||||
super("pic:pic");
|
||||
|
||||
this.root.push(
|
||||
new PicAttributes({
|
||||
xmlns: "http://schemas.openxmlformats.org/drawingml/2006/picture",
|
||||
}),
|
||||
);
|
||||
|
||||
this.shapeProperties = new ShapeProperties(x, y);
|
||||
|
||||
this.root.push(new NonVisualPicProperties());
|
||||
this.root.push(new BlipFill(referenceId));
|
||||
this.root.push(new ShapeProperties(x, y));
|
||||
}
|
||||
|
||||
public setXY(x: number, y: number): void {
|
||||
this.shapeProperties.setXY(x, y);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IExtentsAttributes {
|
||||
cx?: number;
|
||||
cy?: number;
|
||||
}
|
||||
|
||||
export class ExtentsAttributes extends XmlAttributeComponent<IExtentsAttributes> {
|
||||
protected xmlKeys = {
|
||||
cx: "cx",
|
||||
cy: "cy",
|
||||
};
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
// http://officeopenxml.com/drwSp-size.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { ExtentsAttributes } from "./extents-attributes";
|
||||
|
||||
export class Extents extends XmlComponent {
|
||||
private attributes: ExtentsAttributes;
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super("a:ext");
|
||||
|
||||
this.attributes = new ExtentsAttributes({
|
||||
cx: x,
|
||||
cy: y,
|
||||
});
|
||||
|
||||
this.root.push(this.attributes);
|
||||
}
|
||||
|
||||
public setXY(x: number, y: number): void {
|
||||
this.attributes.set({
|
||||
cx: x,
|
||||
cy: y,
|
||||
});
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
// http://officeopenxml.com/drwSp-size.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { Extents } from "./extents/extents";
|
||||
import { Offset } from "./offset/off";
|
||||
|
||||
export class Form extends XmlComponent {
|
||||
private extents: Extents;
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super("a:xfrm");
|
||||
|
||||
this.extents = new Extents(x, y);
|
||||
|
||||
this.root.push(this.extents);
|
||||
this.root.push(new Offset());
|
||||
}
|
||||
|
||||
public setXY(x: number, y: number): void {
|
||||
this.extents.setXY(x, y);
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
export * from "./form";
|
@ -1,13 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IOffsetAttributes {
|
||||
x?: number;
|
||||
y?: number;
|
||||
}
|
||||
|
||||
export class OffsetAttributes extends XmlAttributeComponent<IOffsetAttributes> {
|
||||
protected xmlKeys = {
|
||||
x: "x",
|
||||
y: "y",
|
||||
};
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
// http://officeopenxml.com/drwSp-size.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { OffsetAttributes } from "./off-attributes";
|
||||
|
||||
export class Offset extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:off");
|
||||
|
||||
this.root.push(
|
||||
new OffsetAttributes({
|
||||
x: 0,
|
||||
y: 0,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class NoFill extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:noFill");
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class NoFill extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:noFill");
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
// http://officeopenxml.com/drwSp-outline.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { NoFill } from "./no-fill";
|
||||
|
||||
export class Outline extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:ln");
|
||||
|
||||
this.root.push(new NoFill());
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
// http://officeopenxml.com/drwSp-prstGeom.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class AdjustmentValues extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:avLst");
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IPresetGeometryAttributes {
|
||||
prst?: string;
|
||||
}
|
||||
|
||||
export class PresetGeometryAttributes extends XmlAttributeComponent<IPresetGeometryAttributes> {
|
||||
protected xmlKeys = {
|
||||
prst: "prst",
|
||||
};
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
// http://officeopenxml.com/drwSp-prstGeom.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { AdjustmentValues } from "./adjustment-values/adjustment-values";
|
||||
import { PresetGeometryAttributes } from "./preset-geometry-attributes";
|
||||
|
||||
export class PresetGeometry extends XmlComponent {
|
||||
constructor() {
|
||||
super("a:prstGeom");
|
||||
|
||||
this.root.push(
|
||||
new PresetGeometryAttributes({
|
||||
prst: "rect",
|
||||
}),
|
||||
);
|
||||
|
||||
this.root.push(new AdjustmentValues());
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IShapePropertiesAttributes {
|
||||
bwMode?: string;
|
||||
}
|
||||
|
||||
export class ShapePropertiesAttributes extends XmlAttributeComponent<IShapePropertiesAttributes> {
|
||||
protected xmlKeys = {
|
||||
bwMode: "bwMode",
|
||||
};
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
// http://officeopenxml.com/drwSp-SpPr.php
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { Form } from "./form";
|
||||
// import { NoFill } from "./no-fill";
|
||||
// import { Outline } from "./outline/outline";
|
||||
import { PresetGeometry } from "./preset-geometry/preset-geometry";
|
||||
import { ShapePropertiesAttributes } from "./shape-properties-attributes";
|
||||
|
||||
export class ShapeProperties extends XmlComponent {
|
||||
private form: Form;
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super("pic:spPr");
|
||||
|
||||
this.root.push(
|
||||
new ShapePropertiesAttributes({
|
||||
bwMode: "auto",
|
||||
}),
|
||||
);
|
||||
|
||||
this.form = new Form(x, y);
|
||||
|
||||
this.root.push(this.form);
|
||||
this.root.push(new PresetGeometry());
|
||||
// this.root.push(new NoFill());
|
||||
// this.root.push(new Outline());
|
||||
}
|
||||
|
||||
public setXY(x: number, y: number): void {
|
||||
this.form.setXY(x, y);
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
export * from "./graphic";
|
@ -1,11 +1,7 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
import { Distance } from "../drawing";
|
||||
|
||||
export interface IInlineAttributes {
|
||||
distT?: number;
|
||||
distB?: number;
|
||||
distL?: number;
|
||||
distR?: number;
|
||||
}
|
||||
export interface IInlineAttributes extends Distance {}
|
||||
|
||||
export class InlineAttributes extends XmlAttributeComponent<IInlineAttributes> {
|
||||
protected xmlKeys = {
|
||||
|
@ -1,11 +1,11 @@
|
||||
// http://officeopenxml.com/drwPicInline.php
|
||||
import { IMediaDataDimensions } from "file/media";
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { DocProperties } from "./doc-properties/doc-properties";
|
||||
import { EffectExtent } from "./effect-extent/effect-extent";
|
||||
import { Extent } from "./extent/extent";
|
||||
import { Graphic } from "./graphic";
|
||||
import { GraphicFrameProperties } from "./graphic-frame/graphic-frame-properties";
|
||||
import { DocProperties } from "./../doc-properties/doc-properties";
|
||||
import { EffectExtent } from "./../effect-extent/effect-extent";
|
||||
import { Extent } from "./../extent/extent";
|
||||
import { Graphic } from "./../graphic";
|
||||
import { GraphicFrameProperties } from "./../graphic-frame/graphic-frame-properties";
|
||||
import { InlineAttributes } from "./inline-attributes";
|
||||
|
||||
export class Inline extends XmlComponent {
|
||||
|
Reference in New Issue
Block a user