pptx-templates 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI-INSTRUCTOR.md +2253 -0
- package/CHANGELOG.md +56 -0
- package/LICENSE +23 -0
- package/README.md +84 -2
- package/dist/automizer.d.ts +224 -0
- package/dist/automizer.js +704 -0
- package/dist/automizer.js.map +1 -0
- package/dist/classes/content-type-registry.d.ts +46 -0
- package/dist/classes/content-type-registry.js +170 -0
- package/dist/classes/content-type-registry.js.map +1 -0
- package/dist/classes/element-importer.d.ts +49 -0
- package/dist/classes/element-importer.js +254 -0
- package/dist/classes/element-importer.js.map +1 -0
- package/dist/classes/has-shapes.d.ts +286 -0
- package/dist/classes/has-shapes.js +385 -0
- package/dist/classes/has-shapes.js.map +1 -0
- package/dist/classes/layout.d.ts +42 -0
- package/dist/classes/layout.js +113 -0
- package/dist/classes/layout.js.map +1 -0
- package/dist/classes/master.d.ts +45 -0
- package/dist/classes/master.js +146 -0
- package/dist/classes/master.js.map +1 -0
- package/dist/classes/placeholder-normalizer.d.ts +42 -0
- package/dist/classes/placeholder-normalizer.js +136 -0
- package/dist/classes/placeholder-normalizer.js.map +1 -0
- package/dist/classes/related-content-copier.d.ts +18 -0
- package/dist/classes/related-content-copier.js +114 -0
- package/dist/classes/related-content-copier.js.map +1 -0
- package/dist/classes/shape.d.ts +62 -0
- package/dist/classes/shape.js +194 -0
- package/dist/classes/shape.js.map +1 -0
- package/dist/classes/slide-master-remover.d.ts +44 -0
- package/dist/classes/slide-master-remover.js +201 -0
- package/dist/classes/slide-master-remover.js.map +1 -0
- package/dist/classes/slide-notes-copier.d.ts +26 -0
- package/dist/classes/slide-notes-copier.js +76 -0
- package/dist/classes/slide-notes-copier.js.map +1 -0
- package/dist/classes/slide.d.ts +91 -0
- package/dist/classes/slide.js +286 -0
- package/dist/classes/slide.js.map +1 -0
- package/dist/classes/template.d.ts +137 -0
- package/dist/classes/template.js +311 -0
- package/dist/classes/template.js.map +1 -0
- package/dist/constants/constants.d.ts +11 -0
- package/dist/constants/constants.js +182 -0
- package/dist/constants/constants.js.map +1 -0
- package/dist/enums/chart-type.d.ts +11 -0
- package/dist/enums/chart-type.js +16 -0
- package/dist/enums/chart-type.js.map +1 -0
- package/dist/enums/content-type-map.d.ts +16 -0
- package/dist/enums/content-type-map.js +23 -0
- package/dist/enums/content-type-map.js.map +1 -0
- package/dist/enums/element-type.d.ts +14 -0
- package/dist/enums/element-type.js +20 -0
- package/dist/enums/element-type.js.map +1 -0
- package/dist/errors.d.ts +81 -0
- package/dist/errors.js +100 -0
- package/dist/errors.js.map +1 -0
- package/dist/extensions/index.d.ts +5 -0
- package/dist/extensions/index.js +31 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.d.ts +5 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.js +9 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/index.d.ts +5 -0
- package/dist/extensions/pptxgenjs-compat/index.js +10 -0
- package/dist/extensions/pptxgenjs-compat/index.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.d.ts +14 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js +139 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js.map +1 -0
- package/dist/extensions/run-merge/index.d.ts +13 -0
- package/dist/extensions/run-merge/index.js +89 -0
- package/dist/extensions/run-merge/index.js.map +1 -0
- package/dist/extensions/template-logic/commands.d.ts +22 -0
- package/dist/extensions/template-logic/commands.js +83 -0
- package/dist/extensions/template-logic/commands.js.map +1 -0
- package/dist/extensions/template-logic/expression.d.ts +61 -0
- package/dist/extensions/template-logic/expression.js +499 -0
- package/dist/extensions/template-logic/expression.js.map +1 -0
- package/dist/extensions/template-logic/images.d.ts +26 -0
- package/dist/extensions/template-logic/images.js +183 -0
- package/dist/extensions/template-logic/images.js.map +1 -0
- package/dist/extensions/template-logic/index.d.ts +14 -0
- package/dist/extensions/template-logic/index.js +64 -0
- package/dist/extensions/template-logic/index.js.map +1 -0
- package/dist/extensions/template-logic/list-commands.d.ts +9 -0
- package/dist/extensions/template-logic/list-commands.js +72 -0
- package/dist/extensions/template-logic/list-commands.js.map +1 -0
- package/dist/extensions/template-logic/renderer.d.ts +85 -0
- package/dist/extensions/template-logic/renderer.js +867 -0
- package/dist/extensions/template-logic/renderer.js.map +1 -0
- package/dist/extensions/template-logic/types.d.ts +62 -0
- package/dist/extensions/template-logic/types.js +3 -0
- package/dist/extensions/template-logic/types.js.map +1 -0
- package/dist/helper/archive/archive-fs.d.ts +45 -0
- package/dist/helper/archive/archive-fs.js +206 -0
- package/dist/helper/archive/archive-fs.js.map +1 -0
- package/dist/helper/archive/archive-jszip.d.ts +31 -0
- package/dist/helper/archive/archive-jszip.js +173 -0
- package/dist/helper/archive/archive-jszip.js.map +1 -0
- package/dist/helper/archive/archive.d.ts +27 -0
- package/dist/helper/archive/archive.js +78 -0
- package/dist/helper/archive/archive.js.map +1 -0
- package/dist/helper/cell-id-helper.d.ts +25 -0
- package/dist/helper/cell-id-helper.js +95 -0
- package/dist/helper/cell-id-helper.js.map +1 -0
- package/dist/helper/compute-src-rect.d.ts +9 -0
- package/dist/helper/compute-src-rect.js +52 -0
- package/dist/helper/compute-src-rect.js.map +1 -0
- package/dist/helper/content-tracker.d.ts +31 -0
- package/dist/helper/content-tracker.js +227 -0
- package/dist/helper/content-tracker.js.map +1 -0
- package/dist/helper/count-helper.d.ts +33 -0
- package/dist/helper/count-helper.js +140 -0
- package/dist/helper/count-helper.js.map +1 -0
- package/dist/helper/css-style-parser.d.ts +52 -0
- package/dist/helper/css-style-parser.js +246 -0
- package/dist/helper/css-style-parser.js.map +1 -0
- package/dist/helper/file-helper.d.ts +36 -0
- package/dist/helper/file-helper.js +150 -0
- package/dist/helper/file-helper.js.map +1 -0
- package/dist/helper/general-helper.d.ts +6 -0
- package/dist/helper/general-helper.js +34 -0
- package/dist/helper/general-helper.js.map +1 -0
- package/dist/helper/generate/generate-pptxgenjs.d.ts +37 -0
- package/dist/helper/generate/generate-pptxgenjs.js +134 -0
- package/dist/helper/generate/generate-pptxgenjs.js.map +1 -0
- package/dist/helper/html-to-multitext-helper.d.ts +84 -0
- package/dist/helper/html-to-multitext-helper.js +490 -0
- package/dist/helper/html-to-multitext-helper.js.map +1 -0
- package/dist/helper/hyperlink-processor.d.ts +54 -0
- package/dist/helper/hyperlink-processor.js +289 -0
- package/dist/helper/hyperlink-processor.js.map +1 -0
- package/dist/helper/image-dimensions.d.ts +21 -0
- package/dist/helper/image-dimensions.js +202 -0
- package/dist/helper/image-dimensions.js.map +1 -0
- package/dist/helper/jszip-helper.d.ts +21 -0
- package/dist/helper/jszip-helper.js +162 -0
- package/dist/helper/jszip-helper.js.map +1 -0
- package/dist/helper/layout-index.d.ts +55 -0
- package/dist/helper/layout-index.js +155 -0
- package/dist/helper/layout-index.js.map +1 -0
- package/dist/helper/logger.d.ts +53 -0
- package/dist/helper/logger.js +73 -0
- package/dist/helper/logger.js.map +1 -0
- package/dist/helper/media-deduplicator.d.ts +42 -0
- package/dist/helper/media-deduplicator.js +88 -0
- package/dist/helper/media-deduplicator.js.map +1 -0
- package/dist/helper/modify-background-helper.d.ts +19 -0
- package/dist/helper/modify-background-helper.js +59 -0
- package/dist/helper/modify-background-helper.js.map +1 -0
- package/dist/helper/modify-chart-helper.d.ts +159 -0
- package/dist/helper/modify-chart-helper.js +642 -0
- package/dist/helper/modify-chart-helper.js.map +1 -0
- package/dist/helper/modify-cleanup-helper.d.ts +69 -0
- package/dist/helper/modify-cleanup-helper.js +343 -0
- package/dist/helper/modify-cleanup-helper.js.map +1 -0
- package/dist/helper/modify-color-helper.d.ts +35 -0
- package/dist/helper/modify-color-helper.js +211 -0
- package/dist/helper/modify-color-helper.js.map +1 -0
- package/dist/helper/modify-helper.d.ts +23 -0
- package/dist/helper/modify-helper.js +61 -0
- package/dist/helper/modify-helper.js.map +1 -0
- package/dist/helper/modify-hyperlink-element.d.ts +9 -0
- package/dist/helper/modify-hyperlink-element.js +34 -0
- package/dist/helper/modify-hyperlink-element.js.map +1 -0
- package/dist/helper/modify-hyperlink-helper.d.ts +42 -0
- package/dist/helper/modify-hyperlink-helper.js +258 -0
- package/dist/helper/modify-hyperlink-helper.js.map +1 -0
- package/dist/helper/modify-image-helper.d.ts +23 -0
- package/dist/helper/modify-image-helper.js +157 -0
- package/dist/helper/modify-image-helper.js.map +1 -0
- package/dist/helper/modify-presentation-helper.d.ts +55 -0
- package/dist/helper/modify-presentation-helper.js +177 -0
- package/dist/helper/modify-presentation-helper.js.map +1 -0
- package/dist/helper/modify-shape-helper.d.ts +111 -0
- package/dist/helper/modify-shape-helper.js +340 -0
- package/dist/helper/modify-shape-helper.js.map +1 -0
- package/dist/helper/modify-table-helper.d.ts +11 -0
- package/dist/helper/modify-table-helper.js +100 -0
- package/dist/helper/modify-table-helper.js.map +1 -0
- package/dist/helper/modify-text-helper.d.ts +62 -0
- package/dist/helper/modify-text-helper.js +244 -0
- package/dist/helper/modify-text-helper.js.map +1 -0
- package/dist/helper/modify-xml-helper.d.ts +52 -0
- package/dist/helper/modify-xml-helper.js +305 -0
- package/dist/helper/modify-xml-helper.js.map +1 -0
- package/dist/helper/multitext-helper.d.ts +116 -0
- package/dist/helper/multitext-helper.js +462 -0
- package/dist/helper/multitext-helper.js.map +1 -0
- package/dist/helper/ppt-paths.d.ts +76 -0
- package/dist/helper/ppt-paths.js +116 -0
- package/dist/helper/ppt-paths.js.map +1 -0
- package/dist/helper/shape-type-detector.d.ts +34 -0
- package/dist/helper/shape-type-detector.js +99 -0
- package/dist/helper/shape-type-detector.js.map +1 -0
- package/dist/helper/text-replace-helper.d.ts +30 -0
- package/dist/helper/text-replace-helper.js +149 -0
- package/dist/helper/text-replace-helper.js.map +1 -0
- package/dist/helper/xml/lnLRTB.d.ts +1 -0
- package/dist/helper/xml/lnLRTB.js +62 -0
- package/dist/helper/xml/lnLRTB.js.map +1 -0
- package/dist/helper/xml/prstGeom.d.ts +1 -0
- package/dist/helper/xml/prstGeom.js +11 -0
- package/dist/helper/xml/prstGeom.js.map +1 -0
- package/dist/helper/xml-elements.d.ts +134 -0
- package/dist/helper/xml-elements.js +538 -0
- package/dist/helper/xml-elements.js.map +1 -0
- package/dist/helper/xml-helper.d.ts +120 -0
- package/dist/helper/xml-helper.js +495 -0
- package/dist/helper/xml-helper.js.map +1 -0
- package/dist/helper/xml-placeholder-helper.d.ts +92 -0
- package/dist/helper/xml-placeholder-helper.js +454 -0
- package/dist/helper/xml-placeholder-helper.js.map +1 -0
- package/dist/helper/xml-pretty-print.d.ts +17 -0
- package/dist/helper/xml-pretty-print.js +88 -0
- package/dist/helper/xml-pretty-print.js.map +1 -0
- package/dist/helper/xml-relationship-helper.d.ts +103 -0
- package/dist/helper/xml-relationship-helper.js +397 -0
- package/dist/helper/xml-relationship-helper.js.map +1 -0
- package/dist/helper/xml-slide-helper.d.ts +107 -0
- package/dist/helper/xml-slide-helper.js +676 -0
- package/dist/helper/xml-slide-helper.js.map +1 -0
- package/dist/helper/xml-template-helper.d.ts +42 -0
- package/dist/helper/xml-template-helper.js +252 -0
- package/dist/helper/xml-template-helper.js.map +1 -0
- package/dist/helper/xmldom-sax-patch.d.ts +18 -0
- package/dist/helper/xmldom-sax-patch.js +58 -0
- package/dist/helper/xmldom-sax-patch.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +177 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/iarchive.d.ts +43 -0
- package/dist/interfaces/iarchive.js +3 -0
- package/dist/interfaces/iarchive.js.map +1 -0
- package/dist/interfaces/ichart.d.ts +7 -0
- package/dist/interfaces/ichart.js +3 -0
- package/dist/interfaces/ichart.js.map +1 -0
- package/dist/interfaces/icounter.d.ts +7 -0
- package/dist/interfaces/icounter.js +3 -0
- package/dist/interfaces/icounter.js.map +1 -0
- package/dist/interfaces/igenerator.d.ts +4 -0
- package/dist/interfaces/igenerator.js +3 -0
- package/dist/interfaces/igenerator.js.map +1 -0
- package/dist/interfaces/iimage.d.ts +7 -0
- package/dist/interfaces/iimage.js +3 -0
- package/dist/interfaces/iimage.js.map +1 -0
- package/dist/interfaces/ilayout.d.ts +14 -0
- package/dist/interfaces/ilayout.js +3 -0
- package/dist/interfaces/ilayout.js.map +1 -0
- package/dist/interfaces/imaster.d.ts +15 -0
- package/dist/interfaces/imaster.js +3 -0
- package/dist/interfaces/imaster.js.map +1 -0
- package/dist/interfaces/imulti-text.d.ts +50 -0
- package/dist/interfaces/imulti-text.js +3 -0
- package/dist/interfaces/imulti-text.js.map +1 -0
- package/dist/interfaces/ipptxgenjs-slide.d.ts +40 -0
- package/dist/interfaces/ipptxgenjs-slide.js +3 -0
- package/dist/interfaces/ipptxgenjs-slide.js.map +1 -0
- package/dist/interfaces/ipresentation-props.d.ts +16 -0
- package/dist/interfaces/ipresentation-props.js +3 -0
- package/dist/interfaces/ipresentation-props.js.map +1 -0
- package/dist/interfaces/ishape-action.d.ts +18 -0
- package/dist/interfaces/ishape-action.js +3 -0
- package/dist/interfaces/ishape-action.js.map +1 -0
- package/dist/interfaces/ishape.d.ts +5 -0
- package/dist/interfaces/ishape.js +3 -0
- package/dist/interfaces/ishape.js.map +1 -0
- package/dist/interfaces/islide.d.ts +71 -0
- package/dist/interfaces/islide.js +3 -0
- package/dist/interfaces/islide.js.map +1 -0
- package/dist/interfaces/itemplate.d.ts +9 -0
- package/dist/interfaces/itemplate.js +3 -0
- package/dist/interfaces/itemplate.js.map +1 -0
- package/dist/interfaces/pres-template.d.ts +9 -0
- package/dist/interfaces/pres-template.js +3 -0
- package/dist/interfaces/pres-template.js.map +1 -0
- package/dist/interfaces/root-pres-template.d.ts +38 -0
- package/dist/interfaces/root-pres-template.js +3 -0
- package/dist/interfaces/root-pres-template.js.map +1 -0
- package/dist/modify/modify-chart.d.ts +74 -0
- package/dist/modify/modify-chart.js +753 -0
- package/dist/modify/modify-chart.js.map +1 -0
- package/dist/modify/modify-table.d.ts +64 -0
- package/dist/modify/modify-table.js +435 -0
- package/dist/modify/modify-table.js.map +1 -0
- package/dist/shapes/chart.d.ts +91 -0
- package/dist/shapes/chart.js +437 -0
- package/dist/shapes/chart.js.map +1 -0
- package/dist/shapes/diagram.d.ts +33 -0
- package/dist/shapes/diagram.js +167 -0
- package/dist/shapes/diagram.js.map +1 -0
- package/dist/shapes/generic.d.ts +27 -0
- package/dist/shapes/generic.js +118 -0
- package/dist/shapes/generic.js.map +1 -0
- package/dist/shapes/hyperlink.d.ts +27 -0
- package/dist/shapes/hyperlink.js +193 -0
- package/dist/shapes/hyperlink.js.map +1 -0
- package/dist/shapes/image.d.ts +47 -0
- package/dist/shapes/image.js +244 -0
- package/dist/shapes/image.js.map +1 -0
- package/dist/shapes/ole.d.ts +30 -0
- package/dist/shapes/ole.js +237 -0
- package/dist/shapes/ole.js.map +1 -0
- package/dist/types/chart-types.d.ts +115 -0
- package/dist/types/chart-types.js +3 -0
- package/dist/types/chart-types.js.map +1 -0
- package/dist/types/modify-types.d.ts +128 -0
- package/dist/types/modify-types.js +3 -0
- package/dist/types/modify-types.js.map +1 -0
- package/dist/types/shape-types.d.ts +40 -0
- package/dist/types/shape-types.js +3 -0
- package/dist/types/shape-types.js.map +1 -0
- package/dist/types/table-types.d.ts +38 -0
- package/dist/types/table-types.js +3 -0
- package/dist/types/table-types.js.map +1 -0
- package/dist/types/types.d.ts +317 -0
- package/dist/types/types.js +16 -0
- package/dist/types/types.js.map +1 -0
- package/dist/types/xml-types.d.ts +168 -0
- package/dist/types/xml-types.js +3 -0
- package/dist/types/xml-types.js.map +1 -0
- package/package.json +92 -4
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type HasShapes from './has-shapes';
|
|
2
|
+
/**
|
|
3
|
+
* Copies a slide's notesSlide part (if any) and remaps the notesSlide
|
|
4
|
+
* numbering: slideNote numbers differ from slide numbers if the source
|
|
5
|
+
* presentation contains slides without notes.
|
|
6
|
+
*
|
|
7
|
+
* Extracted from HasShapes (ROADMAP Phase 2).
|
|
8
|
+
*/
|
|
9
|
+
export declare class SlideNotesCopier {
|
|
10
|
+
private host;
|
|
11
|
+
constructor(host: HasShapes);
|
|
12
|
+
/**
|
|
13
|
+
* Copy the source slide's notes (if present) to the target slide,
|
|
14
|
+
* remap the mutual relationships and register the content type.
|
|
15
|
+
*/
|
|
16
|
+
copySlideNotes(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Find the proper enumeration of the source notesSlide xml file.
|
|
19
|
+
*/
|
|
20
|
+
getSlideNoteSourceNumber(): Promise<number | undefined>;
|
|
21
|
+
copySlideNoteFiles(sourceNotesNumber: number): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Point the copied notesSlide at the target slide and vice versa.
|
|
24
|
+
*/
|
|
25
|
+
updateSlideNoteFile(sourceNotesNumber: number): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SlideNotesCopier = void 0;
|
|
13
|
+
const file_helper_1 = require("../helper/file-helper");
|
|
14
|
+
const ppt_paths_1 = require("../helper/ppt-paths");
|
|
15
|
+
const xml_helper_1 = require("../helper/xml-helper");
|
|
16
|
+
const xml_relationship_helper_1 = require("../helper/xml-relationship-helper");
|
|
17
|
+
/**
|
|
18
|
+
* Copies a slide's notesSlide part (if any) and remaps the notesSlide
|
|
19
|
+
* numbering: slideNote numbers differ from slide numbers if the source
|
|
20
|
+
* presentation contains slides without notes.
|
|
21
|
+
*
|
|
22
|
+
* Extracted from HasShapes (ROADMAP Phase 2).
|
|
23
|
+
*/
|
|
24
|
+
class SlideNotesCopier {
|
|
25
|
+
constructor(host) {
|
|
26
|
+
this.host = host;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Copy the source slide's notes (if present) to the target slide,
|
|
30
|
+
* remap the mutual relationships and register the content type.
|
|
31
|
+
*/
|
|
32
|
+
copySlideNotes() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const sourceNotesNumber = yield this.getSlideNoteSourceNumber();
|
|
35
|
+
if (sourceNotesNumber) {
|
|
36
|
+
yield this.copySlideNoteFiles(sourceNotesNumber);
|
|
37
|
+
yield this.updateSlideNoteFile(sourceNotesNumber);
|
|
38
|
+
yield this.host.contentTypes.appendNotesToContentType(this.host.targetNumber);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Find the proper enumeration of the source notesSlide xml file.
|
|
44
|
+
*/
|
|
45
|
+
getSlideNoteSourceNumber() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const host = this.host;
|
|
48
|
+
const targets = yield xml_relationship_helper_1.XmlRelationshipHelper.getTargetsByRelationshipType(host.sourceArchive, ppt_paths_1.PptPaths.slideRels(host.sourceNumber), 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide');
|
|
49
|
+
if (targets.length) {
|
|
50
|
+
const targetNumber = targets[0].file
|
|
51
|
+
.replace('../notesSlides/notesSlide', '')
|
|
52
|
+
.replace('.xml', '');
|
|
53
|
+
return Number(targetNumber);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
copySlideNoteFiles(sourceNotesNumber) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const host = this.host;
|
|
60
|
+
yield file_helper_1.FileHelper.zipCopy(host.sourceArchive, ppt_paths_1.PptPaths.notesSlide(sourceNotesNumber), host.targetArchive, ppt_paths_1.PptPaths.notesSlide(host.targetNumber));
|
|
61
|
+
yield file_helper_1.FileHelper.zipCopy(host.sourceArchive, ppt_paths_1.PptPaths.notesSlideRels(sourceNotesNumber), host.targetArchive, ppt_paths_1.PptPaths.notesSlideRels(host.targetNumber));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Point the copied notesSlide at the target slide and vice versa.
|
|
66
|
+
*/
|
|
67
|
+
updateSlideNoteFile(sourceNotesNumber) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const host = this.host;
|
|
70
|
+
yield xml_helper_1.XmlHelper.replaceAttribute(host.targetArchive, ppt_paths_1.PptPaths.notesSlideRels(host.targetNumber), 'Relationship', 'Target', ppt_paths_1.PptPaths.relative.slide(host.sourceNumber), ppt_paths_1.PptPaths.relative.slide(host.targetNumber));
|
|
71
|
+
yield xml_helper_1.XmlHelper.replaceAttribute(host.targetArchive, ppt_paths_1.PptPaths.slideRels(host.targetNumber), 'Relationship', 'Target', ppt_paths_1.PptPaths.relative.notesSlide(sourceNotesNumber), ppt_paths_1.PptPaths.relative.notesSlide(host.targetNumber));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.SlideNotesCopier = SlideNotesCopier;
|
|
76
|
+
//# sourceMappingURL=slide-notes-copier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slide-notes-copier.js","sourceRoot":"","sources":["../../src/classes/slide-notes-copier.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAmD;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,aAAa,EAClB,oBAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CACvC,CAAC;YAEF,MAAM,wBAAU,CAAC,OAAO,CACtB,IAAI,CAAC,aAAa,EAClB,oBAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAC1C,IAAI,CAAC,aAAa,EAClB,oBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAC3C,CAAC;QACJ,CAAC;KAAA;IAED;;OAEG;IACG,mBAAmB,CAAC,iBAAyB;;YACjD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACvB,MAAM,sBAAS,CAAC,gBAAgB,CAC9B,IAAI,CAAC,aAAa,EAClB,oBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,EAC1C,cAAc,EACd,QAAQ,EACR,oBAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,EAC1C,oBAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAC3C,CAAC;YAEF,MAAM,sBAAS,CAAC,gBAAgB,CAC9B,IAAI,CAAC,aAAa,EAClB,oBAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,EACrC,cAAc,EACd,QAAQ,EACR,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAC/C,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAChD,CAAC;QACJ,CAAC;KAAA;CACF;AA7ED,4CA6EC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ShapeTargetType, SlideLayoutSelector, SourceIdentifier } from '../types/types';
|
|
2
|
+
import { ISlide } from '../interfaces/islide';
|
|
3
|
+
import { IPresentationProps } from '../interfaces/ipresentation-props';
|
|
4
|
+
import { PresTemplate } from '../interfaces/pres-template';
|
|
5
|
+
import { RootPresTemplate } from '../interfaces/root-pres-template';
|
|
6
|
+
import HasShapes from './has-shapes';
|
|
7
|
+
export declare class Slide extends HasShapes implements ISlide {
|
|
8
|
+
targetType: ShapeTargetType;
|
|
9
|
+
private targetLayoutId;
|
|
10
|
+
constructor(params: {
|
|
11
|
+
presentation: IPresentationProps;
|
|
12
|
+
template: PresTemplate;
|
|
13
|
+
slideIdentifier: SourceIdentifier;
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Appends slide
|
|
17
|
+
* @internal
|
|
18
|
+
* @param targetTemplate
|
|
19
|
+
* @returns append
|
|
20
|
+
*/
|
|
21
|
+
append(targetTemplate: RootPresTemplate): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Additionally flushes the slide's copied notesSlide part, which shares
|
|
24
|
+
* the slide's target number.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
flushTargetXml(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Use another slide layout of the output presentation.
|
|
30
|
+
*
|
|
31
|
+
* - a number: the 1-based layout number in the output
|
|
32
|
+
* - a string: a layout name; the source slide's master is auto-imported
|
|
33
|
+
* first, then the name is looked up among imported layouts and — if
|
|
34
|
+
* not found there — among all layouts of the output (root template
|
|
35
|
+
* included)
|
|
36
|
+
* - a `SlideLayoutSelector` (`{ layout, master?, template? }`): resolved
|
|
37
|
+
* against the masters and layouts of the output at write time, nothing
|
|
38
|
+
* is imported; no match or an ambiguous name rejects `write()` with a
|
|
39
|
+
* `SlideLayoutNotFoundError` (a warning with `continueOnError`)
|
|
40
|
+
* - no argument: import and use the source slide's own layout
|
|
41
|
+
*
|
|
42
|
+
* @param layoutId
|
|
43
|
+
*/
|
|
44
|
+
useSlideLayout(layoutId?: number | string | SlideLayoutSelector): this;
|
|
45
|
+
/**
|
|
46
|
+
* Merges slide content into a specified slide layout by mapping placeholders.
|
|
47
|
+
* This method automatically handles placeholder matching and repositioning of elements
|
|
48
|
+
* that don't have corresponding placeholders in the target layout.
|
|
49
|
+
*
|
|
50
|
+
* @param targetFileName
|
|
51
|
+
* @param targetLayout - Name or identifier of the target slide layout to merge into
|
|
52
|
+
* @returns Promise<this> - Returns the slide instance for method chaining
|
|
53
|
+
*/
|
|
54
|
+
mergeIntoSlideLayout(targetLayout: number | string | SlideLayoutSelector): this;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves information about the source slide layout.
|
|
57
|
+
*
|
|
58
|
+
* @returns Promise<{placeholders: PlaceholderInfo[]}> Source layout information
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
private getSourceLayoutInfo;
|
|
62
|
+
/**
|
|
63
|
+
* Find another slide layout by name.
|
|
64
|
+
* @param targetLayoutName
|
|
65
|
+
*/
|
|
66
|
+
useNamedSlideLayout(targetLayoutName: string): Promise<number>;
|
|
67
|
+
/**
|
|
68
|
+
* Resolve a `SlideLayoutSelector` against the output's masters and
|
|
69
|
+
* layouts. Nothing is imported. Throws `SlideLayoutNotFoundError` on no
|
|
70
|
+
* or ambiguous match; with `continueOnError` it warns and keeps the
|
|
71
|
+
* slide's current layout.
|
|
72
|
+
*/
|
|
73
|
+
useSelectedSlideLayout(selector: SlideLayoutSelector): Promise<number | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Use another slide layout by index or detect original index.
|
|
76
|
+
* @param targetLayoutIndex
|
|
77
|
+
*/
|
|
78
|
+
useIndexedSlideLayout(targetLayoutIndex?: number): Promise<number>;
|
|
79
|
+
autoImportSourceSlideMaster(templateName: string, sourceLayoutId: number): Promise<any>;
|
|
80
|
+
/**
|
|
81
|
+
* Copys slide files
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
copySlideFiles(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Remove a slide from presentation's slide list.
|
|
87
|
+
* ToDo: Find the current count for this slide;
|
|
88
|
+
* ToDo: this.targetNumber is undefined at this point.
|
|
89
|
+
*/
|
|
90
|
+
remove(slide: number): void;
|
|
91
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Slide = void 0;
|
|
16
|
+
const file_helper_1 = require("../helper/file-helper");
|
|
17
|
+
const ppt_paths_1 = require("../helper/ppt-paths");
|
|
18
|
+
const general_helper_1 = require("../helper/general-helper");
|
|
19
|
+
const logger_1 = require("../helper/logger");
|
|
20
|
+
const xml_relationship_helper_1 = require("../helper/xml-relationship-helper");
|
|
21
|
+
const has_shapes_1 = __importDefault(require("./has-shapes"));
|
|
22
|
+
const master_1 = require("./master");
|
|
23
|
+
const modify_presentation_helper_1 = __importDefault(require("../helper/modify-presentation-helper"));
|
|
24
|
+
const xml_placeholder_helper_1 = __importDefault(require("../helper/xml-placeholder-helper"));
|
|
25
|
+
const layout_index_1 = require("../helper/layout-index");
|
|
26
|
+
const errors_1 = require("../errors");
|
|
27
|
+
class Slide extends has_shapes_1.default {
|
|
28
|
+
constructor(params) {
|
|
29
|
+
super(params);
|
|
30
|
+
this.targetType = 'slide';
|
|
31
|
+
this.sourceNumber = this.getSlideNumber(params.template, params.slideIdentifier);
|
|
32
|
+
this.sourcePath = ppt_paths_1.PptPaths.slide(this.sourceNumber);
|
|
33
|
+
this.relsPath = ppt_paths_1.PptPaths.slideRels(this.sourceNumber);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Appends slide
|
|
37
|
+
* @internal
|
|
38
|
+
* @param targetTemplate
|
|
39
|
+
* @returns append
|
|
40
|
+
*/
|
|
41
|
+
append(targetTemplate) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
this.targetTemplate = targetTemplate;
|
|
44
|
+
this.targetArchive = targetTemplate.archive;
|
|
45
|
+
this.targetNumber = targetTemplate.incrementCounter('slides');
|
|
46
|
+
this.targetPath = ppt_paths_1.PptPaths.slide(this.targetNumber);
|
|
47
|
+
this.targetRelsPath = ppt_paths_1.PptPaths.slideRels(this.targetNumber);
|
|
48
|
+
this.sourceArchive = this.sourceTemplate.archive;
|
|
49
|
+
this.status.info = 'Appending slide ' + this.targetNumber;
|
|
50
|
+
yield this.copySlideFiles();
|
|
51
|
+
yield this.copyRelatedContent();
|
|
52
|
+
yield this.addToPresentation();
|
|
53
|
+
yield this.notes.copySlideNotes();
|
|
54
|
+
const placeholderTypes = yield this.parsePlaceholders();
|
|
55
|
+
yield this.applyRelModifications();
|
|
56
|
+
yield this.applyPreparations();
|
|
57
|
+
if (this.importElements.length) {
|
|
58
|
+
yield this.importedSelectedElements();
|
|
59
|
+
}
|
|
60
|
+
yield this.applyModifications();
|
|
61
|
+
const info = this.targetTemplate.automizer.params.showIntegrityInfo;
|
|
62
|
+
const assert = this.targetTemplate.automizer.params.showIntegrityInfo;
|
|
63
|
+
yield this.checkIntegrity(info, assert);
|
|
64
|
+
yield this.cleanSlide(this.targetPath, placeholderTypes);
|
|
65
|
+
yield this.flushTargetXml();
|
|
66
|
+
this.status.increment();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Additionally flushes the slide's copied notesSlide part, which shares
|
|
71
|
+
* the slide's target number.
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
flushTargetXml() {
|
|
75
|
+
const _super = Object.create(null, {
|
|
76
|
+
flushTargetXml: { get: () => super.flushTargetXml }
|
|
77
|
+
});
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
yield _super.flushTargetXml.call(this);
|
|
80
|
+
yield this.targetArchive.flushXml(ppt_paths_1.PptPaths.notesSlide(this.targetNumber));
|
|
81
|
+
yield this.targetArchive.flushXml(ppt_paths_1.PptPaths.notesSlideRels(this.targetNumber));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Use another slide layout of the output presentation.
|
|
86
|
+
*
|
|
87
|
+
* - a number: the 1-based layout number in the output
|
|
88
|
+
* - a string: a layout name; the source slide's master is auto-imported
|
|
89
|
+
* first, then the name is looked up among imported layouts and — if
|
|
90
|
+
* not found there — among all layouts of the output (root template
|
|
91
|
+
* included)
|
|
92
|
+
* - a `SlideLayoutSelector` (`{ layout, master?, template? }`): resolved
|
|
93
|
+
* against the masters and layouts of the output at write time, nothing
|
|
94
|
+
* is imported; no match or an ambiguous name rejects `write()` with a
|
|
95
|
+
* `SlideLayoutNotFoundError` (a warning with `continueOnError`)
|
|
96
|
+
* - no argument: import and use the source slide's own layout
|
|
97
|
+
*
|
|
98
|
+
* @param layoutId
|
|
99
|
+
*/
|
|
100
|
+
useSlideLayout(layoutId) {
|
|
101
|
+
this.relModifications.push((slideRelXml) => __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
let targetLayoutId;
|
|
103
|
+
if (layoutId && typeof layoutId === 'object') {
|
|
104
|
+
targetLayoutId = yield this.useSelectedSlideLayout(layoutId);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
if (typeof layoutId === 'string') {
|
|
108
|
+
targetLayoutId = yield this.useNamedSlideLayout(layoutId);
|
|
109
|
+
if (!targetLayoutId) {
|
|
110
|
+
layoutId = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (!layoutId || typeof layoutId === 'number') {
|
|
114
|
+
targetLayoutId = yield this.useIndexedSlideLayout(layoutId);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (targetLayoutId) {
|
|
118
|
+
this.targetLayoutId = targetLayoutId;
|
|
119
|
+
const slideLayouts = new xml_relationship_helper_1.XmlRelationshipHelper(slideRelXml)
|
|
120
|
+
.readTargets()
|
|
121
|
+
.getTargetsByPrefix('../slideLayouts/slideLayout');
|
|
122
|
+
if (slideLayouts.length) {
|
|
123
|
+
slideLayouts[0].updateTargetIndex(targetLayoutId);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
logger_1.log.warn('Unable to use slide layout ' +
|
|
128
|
+
(typeof layoutId === 'object'
|
|
129
|
+
? JSON.stringify(layoutId)
|
|
130
|
+
: layoutId));
|
|
131
|
+
}
|
|
132
|
+
}));
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Merges slide content into a specified slide layout by mapping placeholders.
|
|
137
|
+
* This method automatically handles placeholder matching and repositioning of elements
|
|
138
|
+
* that don't have corresponding placeholders in the target layout.
|
|
139
|
+
*
|
|
140
|
+
* @param targetFileName
|
|
141
|
+
* @param targetLayout - Name or identifier of the target slide layout to merge into
|
|
142
|
+
* @returns Promise<this> - Returns the slide instance for method chaining
|
|
143
|
+
*/
|
|
144
|
+
mergeIntoSlideLayout(targetLayout) {
|
|
145
|
+
// Disabling concurring cleanup function for this slide:
|
|
146
|
+
this.cleanupPlaceholders = false;
|
|
147
|
+
this.useSlideLayout(targetLayout);
|
|
148
|
+
this.prepare((_) => __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
const slideHelper = yield this.getSlideHelperInstance(this.targetArchive, this.targetPath, this.targetNumber);
|
|
150
|
+
const slideLayout = yield slideHelper.getSlideLayout();
|
|
151
|
+
const targetPlaceholders = slideLayout.placeholders || [];
|
|
152
|
+
const sourceLayoutInfo = yield this.getSourceLayoutInfo();
|
|
153
|
+
const slideElements = yield this.getAllElements([], targetPlaceholders);
|
|
154
|
+
new xml_placeholder_helper_1.default(this, slideElements, sourceLayoutInfo, targetPlaceholders).run();
|
|
155
|
+
}));
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Retrieves information about the source slide layout.
|
|
160
|
+
*
|
|
161
|
+
* @returns Promise<{placeholders: PlaceholderInfo[]}> Source layout information
|
|
162
|
+
* @private
|
|
163
|
+
*/
|
|
164
|
+
getSourceLayoutInfo() {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const slideHelper = yield this.getSlideHelper();
|
|
167
|
+
const sourceLayout = yield slideHelper.getSlideLayout();
|
|
168
|
+
return sourceLayout;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Find another slide layout by name.
|
|
173
|
+
* @param targetLayoutName
|
|
174
|
+
*/
|
|
175
|
+
useNamedSlideLayout(targetLayoutName) {
|
|
176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
const templateName = this.sourceTemplate.name;
|
|
178
|
+
const sourceLayoutId = yield xml_relationship_helper_1.XmlRelationshipHelper.getSlideLayoutNumber(this.sourceArchive, this.sourceNumber);
|
|
179
|
+
yield this.autoImportSourceSlideMaster(templateName, sourceLayoutId);
|
|
180
|
+
const alreadyImported = this.targetTemplate.getNamedMappedContent('slideLayout', targetLayoutName);
|
|
181
|
+
if (alreadyImported) {
|
|
182
|
+
return alreadyImported.targetId;
|
|
183
|
+
}
|
|
184
|
+
// Not among the imported layouts: fall back to the name index of the
|
|
185
|
+
// output, which also covers the root template's own layouts.
|
|
186
|
+
const fallback = layout_index_1.LayoutIndex.select(yield layout_index_1.LayoutIndex.read(this.targetTemplate), { layout: targetLayoutName });
|
|
187
|
+
if (fallback.length) {
|
|
188
|
+
if (fallback.length > 1) {
|
|
189
|
+
logger_1.log.warn(`Slide layout "${targetLayoutName}" is ambiguous, using ` +
|
|
190
|
+
`${layout_index_1.LayoutIndex.describeLayout(fallback[0])}. Pass ` +
|
|
191
|
+
`{ layout, master } to useSlideLayout() to pick one of: ` +
|
|
192
|
+
layout_index_1.LayoutIndex.describeLayouts(fallback));
|
|
193
|
+
}
|
|
194
|
+
return fallback[0].layoutNumber;
|
|
195
|
+
}
|
|
196
|
+
logger_1.log.error('Could not find "' +
|
|
197
|
+
targetLayoutName +
|
|
198
|
+
'"@' +
|
|
199
|
+
templateName +
|
|
200
|
+
'@' +
|
|
201
|
+
'sourceLayoutId:' +
|
|
202
|
+
sourceLayoutId);
|
|
203
|
+
return undefined;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Resolve a `SlideLayoutSelector` against the output's masters and
|
|
208
|
+
* layouts. Nothing is imported. Throws `SlideLayoutNotFoundError` on no
|
|
209
|
+
* or ambiguous match; with `continueOnError` it warns and keeps the
|
|
210
|
+
* slide's current layout.
|
|
211
|
+
*/
|
|
212
|
+
useSelectedSlideLayout(selector) {
|
|
213
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
+
var _a;
|
|
215
|
+
const layouts = yield layout_index_1.LayoutIndex.read(this.targetTemplate);
|
|
216
|
+
try {
|
|
217
|
+
return layout_index_1.LayoutIndex.resolve(layouts, selector).layoutNumber;
|
|
218
|
+
}
|
|
219
|
+
catch (e) {
|
|
220
|
+
if (e instanceof errors_1.SlideLayoutNotFoundError &&
|
|
221
|
+
((_a = this.targetTemplate.automizer) === null || _a === void 0 ? void 0 : _a.params.continueOnError) === true) {
|
|
222
|
+
logger_1.log.warn(e.message);
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
throw e;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Use another slide layout by index or detect original index.
|
|
231
|
+
* @param targetLayoutIndex
|
|
232
|
+
*/
|
|
233
|
+
useIndexedSlideLayout(targetLayoutIndex) {
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
if (!targetLayoutIndex) {
|
|
236
|
+
const sourceLayoutId = yield xml_relationship_helper_1.XmlRelationshipHelper.getSlideLayoutNumber(this.sourceArchive, this.sourceNumber);
|
|
237
|
+
const templateName = this.sourceTemplate.name;
|
|
238
|
+
const alreadyImported = this.targetTemplate.getMappedContent('slideLayout', templateName, sourceLayoutId);
|
|
239
|
+
if (alreadyImported) {
|
|
240
|
+
return alreadyImported.targetId;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
return yield this.autoImportSourceSlideMaster(templateName, sourceLayoutId);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return targetLayoutIndex;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
autoImportSourceSlideMaster(templateName, sourceLayoutId) {
|
|
250
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
+
const sourceMasterId = yield xml_relationship_helper_1.XmlRelationshipHelper.getSlideMasterNumber(this.sourceArchive, sourceLayoutId);
|
|
252
|
+
const key = master_1.Master.getKey(sourceMasterId, templateName);
|
|
253
|
+
if (!this.targetTemplate.masters.find((master) => master.key === key)) {
|
|
254
|
+
yield this.targetTemplate.automizer.addMaster(templateName, sourceMasterId);
|
|
255
|
+
const previouslyAddedMaster = (0, general_helper_1.last)(this.targetTemplate.masters);
|
|
256
|
+
yield this.targetTemplate
|
|
257
|
+
.appendMasterSlide(previouslyAddedMaster)
|
|
258
|
+
.catch((e) => {
|
|
259
|
+
throw e;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
const alreadyImported = this.targetTemplate.getMappedContent('slideLayout', templateName, sourceLayoutId);
|
|
263
|
+
return alreadyImported === null || alreadyImported === void 0 ? void 0 : alreadyImported.targetId;
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Copys slide files
|
|
268
|
+
* @internal
|
|
269
|
+
*/
|
|
270
|
+
copySlideFiles() {
|
|
271
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
272
|
+
yield file_helper_1.FileHelper.zipCopy(this.sourceArchive, ppt_paths_1.PptPaths.slide(this.sourceNumber), this.targetArchive, ppt_paths_1.PptPaths.slide(this.targetNumber));
|
|
273
|
+
yield file_helper_1.FileHelper.zipCopy(this.sourceArchive, ppt_paths_1.PptPaths.slideRels(this.sourceNumber), this.targetArchive, ppt_paths_1.PptPaths.slideRels(this.targetNumber));
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Remove a slide from presentation's slide list.
|
|
278
|
+
* ToDo: Find the current count for this slide;
|
|
279
|
+
* ToDo: this.targetNumber is undefined at this point.
|
|
280
|
+
*/
|
|
281
|
+
remove(slide) {
|
|
282
|
+
this.root.modify(modify_presentation_helper_1.default.removeSlides([slide]));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
exports.Slide = Slide;
|
|
286
|
+
//# sourceMappingURL=slide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slide.js","sourceRoot":"","sources":["../../src/classes/slide.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAAmD;AAEnD,mDAA+C;AAU/C,6DAAgD;AAChD,6CAAuC;AACvC,+EAA0E;AAE1E,8DAAqC;AACrC,qCAAkC;AAClC,sGAA4E;AAC5E,8FAAoE;AACpE,yDAAqD;AACrD,sCAAqD;AAErD,MAAa,KAAM,SAAQ,oBAAS;IAIlC,YAAY,MAIX;QACC,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,eAAU,GAAoB,OAAO,CAAC;QAUpC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,CACrC,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,eAAe,CACvB,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG,oBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC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,uBAAf,eAAe,CAAE,QAAQ,CAAC;QACnC,CAAC;KAAA;IAED;;;OAGG;IACG,cAAc;;YAClB,MAAM,wBAAU,CAAC,OAAO,CACtB,IAAI,CAAC,aAAa,EAClB,oBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,EACjC,IAAI,CAAC,aAAa,EAClB,oBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAClC,CAAC;YAEF,MAAM,wBAAU,CAAC,OAAO,CACtB,IAAI,CAAC,aAAa,EAClB,oBAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,EACrC,IAAI,CAAC,aAAa,EAClB,oBAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CACtC,CAAC;QACJ,CAAC;KAAA;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oCAAwB,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;CACF;AAlWD,sBAkWC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ContentTracker } from '../helper/content-tracker';
|
|
2
|
+
import { ICounter } from '../interfaces/icounter';
|
|
3
|
+
import { ISlide } from '../interfaces/islide';
|
|
4
|
+
import { PresTemplate } from '../interfaces/pres-template';
|
|
5
|
+
import { RootPresTemplate } from '../interfaces/root-pres-template';
|
|
6
|
+
import { ITemplate } from '../interfaces/itemplate';
|
|
7
|
+
import { ContentMap, SlideInfo, XmlDocument } from '../types/xml-types';
|
|
8
|
+
import { MediaDeduplicator } from '../helper/media-deduplicator';
|
|
9
|
+
import IArchive from '../interfaces/iarchive';
|
|
10
|
+
import { ArchiveParams, AutomizerFile, MediaFile } from '../types/types';
|
|
11
|
+
import Automizer from '../automizer';
|
|
12
|
+
import { IMaster } from '../interfaces/imaster';
|
|
13
|
+
import { ILayout } from '../interfaces/ilayout';
|
|
14
|
+
import { IGenerator } from '../interfaces/igenerator';
|
|
15
|
+
/**
|
|
16
|
+
* Shared base for the two template roles: a source template provides
|
|
17
|
+
* importable slides and shapes (`SourceTemplate`), the root template is the
|
|
18
|
+
* output presentation everything is written into (`OutputTemplate`).
|
|
19
|
+
*/
|
|
20
|
+
export declare abstract class Template implements ITemplate {
|
|
21
|
+
/**
|
|
22
|
+
* Path to local file
|
|
23
|
+
* @type string
|
|
24
|
+
*/
|
|
25
|
+
location: string;
|
|
26
|
+
/**
|
|
27
|
+
* Node file buffer or path passed to the archive.
|
|
28
|
+
*/
|
|
29
|
+
file: AutomizerFile;
|
|
30
|
+
/**
|
|
31
|
+
* this.file will be passed to FileProxy
|
|
32
|
+
* @type Archive
|
|
33
|
+
*/
|
|
34
|
+
archive: IArchive;
|
|
35
|
+
protected constructor(file: AutomizerFile, params: ArchiveParams);
|
|
36
|
+
/**
|
|
37
|
+
* Factory: `params.name` decides the role — a named template is a source
|
|
38
|
+
* template containing importable slides; an unnamed one is the root
|
|
39
|
+
* (output) template.
|
|
40
|
+
*/
|
|
41
|
+
static import(file: AutomizerFile, params: ArchiveParams, automizer?: Automizer): SourceTemplate | OutputTemplate;
|
|
42
|
+
getSlideIdList(): Promise<XmlDocument>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A loaded .pptx used as a source of slides, masters and shapes
|
|
46
|
+
* (`Automizer.load()`). Identified by its alias `name`.
|
|
47
|
+
*/
|
|
48
|
+
export declare class SourceTemplate extends Template implements PresTemplate {
|
|
49
|
+
/**
|
|
50
|
+
* An alias name to identify template and simplify
|
|
51
|
+
* @type string
|
|
52
|
+
*/
|
|
53
|
+
name: string;
|
|
54
|
+
creationIds: SlideInfo[];
|
|
55
|
+
useCreationIds?: boolean;
|
|
56
|
+
slideNumbers: number[];
|
|
57
|
+
constructor(file: AutomizerFile, params: ArchiveParams);
|
|
58
|
+
/**
|
|
59
|
+
* Returns the slide numbers of a given template as a sorted array of integers.
|
|
60
|
+
* @returns {Promise<number[]>} - A promise that resolves to a sorted array of slide numbers in the template.
|
|
61
|
+
*/
|
|
62
|
+
getAllSlideNumbers(): Promise<number[]>;
|
|
63
|
+
setCreationIds(): Promise<SlideInfo[]>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The root template: the output presentation that slides, masters and media
|
|
67
|
+
* are appended to (`Automizer.loadRoot()`).
|
|
68
|
+
*/
|
|
69
|
+
export declare class OutputTemplate extends Template implements RootPresTemplate {
|
|
70
|
+
/**
|
|
71
|
+
* Array containing all slides coming from Automizer.addSlide()
|
|
72
|
+
* @type: ISlide[]
|
|
73
|
+
*/
|
|
74
|
+
slides: ISlide[];
|
|
75
|
+
/**
|
|
76
|
+
* Array containing all slideMasters coming from Automizer.addMaster()
|
|
77
|
+
* @type: IMaster[]
|
|
78
|
+
*/
|
|
79
|
+
masters: IMaster[];
|
|
80
|
+
/**
|
|
81
|
+
* Layouts of the root template queued for in-place modification
|
|
82
|
+
* (`Automizer.modifyLayout`).
|
|
83
|
+
*/
|
|
84
|
+
layouts: ILayout[];
|
|
85
|
+
/**
|
|
86
|
+
* Array containing all counters
|
|
87
|
+
* @type: ICounter[]
|
|
88
|
+
*/
|
|
89
|
+
counter: ICounter[];
|
|
90
|
+
existingSlides: number;
|
|
91
|
+
contentMap: ContentMap[];
|
|
92
|
+
mediaFiles: MediaFile[];
|
|
93
|
+
/**
|
|
94
|
+
* Checksum index of the media files of the output archive, used to import
|
|
95
|
+
* each distinct image only once.
|
|
96
|
+
*/
|
|
97
|
+
mediaDeduplicator: MediaDeduplicator;
|
|
98
|
+
content: ContentTracker;
|
|
99
|
+
automizer: Automizer;
|
|
100
|
+
generator: IGenerator;
|
|
101
|
+
constructor(file: AutomizerFile, params: ArchiveParams, automizer?: Automizer);
|
|
102
|
+
private sourceView;
|
|
103
|
+
/**
|
|
104
|
+
* The root template in the role of a source template, sharing this
|
|
105
|
+
* archive: masters and layouts modified in place read their shapes from
|
|
106
|
+
* it (`Automizer.modifyMaster` / `modifyLayout`). Its alias is `'root'`.
|
|
107
|
+
*/
|
|
108
|
+
asSourceTemplate(): PresTemplate;
|
|
109
|
+
mapContents(type: 'slideMaster' | 'slideLayout', key: string, sourceId: number, targetId: number, name?: string): void;
|
|
110
|
+
getNamedMappedContent(type: 'slideMaster' | 'slideLayout', name: string): ContentMap;
|
|
111
|
+
getMappedContent(type: 'slideMaster' | 'slideLayout', key: string, sourceId: number): ContentMap;
|
|
112
|
+
appendMasterSlide(slideMaster: IMaster): Promise<void>;
|
|
113
|
+
appendSlide(slide: ISlide): Promise<void>;
|
|
114
|
+
appendLayout(slideLayout: ILayout): Promise<void>;
|
|
115
|
+
countExistingSlides(): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Remove the slides that came with the root template from the presentation,
|
|
118
|
+
* keeping the slides added by automizer. Used by `removeExistingSlides`.
|
|
119
|
+
*
|
|
120
|
+
* Along with the `p:sldId` entries, the corresponding relationships in
|
|
121
|
+
* ppt/_rels/presentation.xml.rels are dropped: a slide part that is still
|
|
122
|
+
* related to the presentation counts as a slide for anything reading the
|
|
123
|
+
* output (including automizer's own `getInfo()`), even if it is not listed
|
|
124
|
+
* in `p:sldIdLst` (see #166). The slide parts themselves are removed by
|
|
125
|
+
* `ModifyPresentationHelper.removeUnusedFiles` if `cleanup` is enabled.
|
|
126
|
+
*/
|
|
127
|
+
truncate(): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Remove the given relationship ids from ppt/_rels/presentation.xml.rels.
|
|
130
|
+
*/
|
|
131
|
+
removeSlideRelations(removedRelIds: string[]): Promise<void>;
|
|
132
|
+
initializeCounter(): Promise<void>;
|
|
133
|
+
incrementCounter(name: string): number;
|
|
134
|
+
count(name: string): number;
|
|
135
|
+
runExternalGenerator(): Promise<void>;
|
|
136
|
+
cleanupExternalGenerator(): Promise<void>;
|
|
137
|
+
}
|