Files
docx-js/src/file/styles/style/default-styles.ts

183 lines
4.5 KiB
TypeScript
Raw Normal View History

import { UnderlineType } from "@file/paragraph/run/underline";
2019-10-04 01:20:41 +01:00
import { LineRuleType } from "@file/paragraph";
2021-03-15 19:23:40 +00:00
2020-11-06 00:27:57 +00:00
import { IBaseCharacterStyleOptions, StyleForCharacter } from "./character-style";
import { IBaseParagraphStyleOptions, IParagraphStyleOptions, StyleForParagraph } from "./paragraph-style";
2020-11-06 00:27:57 +00:00
export class HeadingStyle extends StyleForParagraph {
2022-08-31 07:52:27 +01:00
public constructor(options: IParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
basedOn: "Normal",
next: "Normal",
quickFormat: true,
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
export class TitleStyle extends HeadingStyle {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "Title",
name: "Title",
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
export class Heading1Style extends HeadingStyle {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "Heading1",
name: "Heading 1",
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
export class Heading2Style extends HeadingStyle {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "Heading2",
name: "Heading 2",
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
export class Heading3Style extends HeadingStyle {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "Heading3",
name: "Heading 3",
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
export class Heading4Style extends HeadingStyle {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "Heading4",
name: "Heading 4",
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
export class Heading5Style extends HeadingStyle {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "Heading5",
name: "Heading 5",
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
export class Heading6Style extends HeadingStyle {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "Heading6",
name: "Heading 6",
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
2020-12-22 21:08:10 +00:00
export class StrongStyle extends HeadingStyle {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2020-12-22 21:08:10 +00:00
super({
id: "Strong",
name: "Strong",
2023-06-28 21:40:20 +01:00
...options,
2020-12-22 21:08:10 +00:00
});
}
}
2020-11-06 00:27:57 +00:00
export class ListParagraph extends StyleForParagraph {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "ListParagraph",
name: "List Paragraph",
basedOn: "Normal",
quickFormat: true,
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
2020-11-06 00:27:57 +00:00
export class FootnoteText extends StyleForParagraph {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseParagraphStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "FootnoteText",
name: "footnote text",
link: "FootnoteTextChar",
basedOn: "Normal",
uiPriority: 99,
semiHidden: true,
unhideWhenUsed: true,
paragraph: {
spacing: {
after: 0,
line: 240,
2021-03-15 19:23:40 +00:00
lineRule: LineRuleType.AUTO,
2019-10-04 01:20:41 +01:00
},
},
run: {
size: 20,
},
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
2020-11-06 00:27:57 +00:00
export class FootnoteReferenceStyle extends StyleForCharacter {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseCharacterStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "FootnoteReference",
name: "footnote reference",
basedOn: "DefaultParagraphFont",
semiHidden: true,
run: {
superScript: true,
},
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
2020-11-06 00:27:57 +00:00
export class FootnoteTextChar extends StyleForCharacter {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseCharacterStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "FootnoteTextChar",
name: "Footnote Text Char",
basedOn: "DefaultParagraphFont",
link: "FootnoteText",
semiHidden: true,
run: {
size: 20,
},
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}
2020-11-06 00:27:57 +00:00
export class HyperlinkStyle extends StyleForCharacter {
2022-08-31 07:52:27 +01:00
public constructor(options: IBaseCharacterStyleOptions) {
2019-10-04 01:20:41 +01:00
super({
id: "Hyperlink",
name: "Hyperlink",
basedOn: "DefaultParagraphFont",
run: {
color: "0563C1",
underline: {
type: UnderlineType.SINGLE,
},
},
2023-06-28 21:40:20 +01:00
...options,
2019-10-04 01:20:41 +01:00
});
}
}