pptxgenjs-plus 4.4.0 → 4.4.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/dist/pptxgen.bundle.js +27 -26
- package/dist/pptxgen.cjs.js +850 -720
- package/dist/pptxgen.es.js +850 -720
- package/dist/pptxgen.min.js +20 -19
- package/package.json +3 -3
- package/types/core.d.ts +45 -3
package/dist/pptxgen.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* PptxGenJS 4.4.
|
|
1
|
+
/* PptxGenJS 4.4.1 @ 2026-12-05T03:04:14.739Z */
|
|
2
2
|
|
|
3
3
|
import { JSZip } from "@node-projects/jszip";
|
|
4
4
|
import { parseXml } from "@rgrove/parse-xml";
|
|
@@ -3136,10 +3136,15 @@ function imageDimensions(bytes) {
|
|
|
3136
3136
|
// Media bytes for path-based images are now loaded; deduplicate identical raster payloads deck-wide
|
|
3137
3137
|
// before slide/layout `.rels` and zip parts are emitted.
|
|
3138
3138
|
dedupeSlideMediaRels(layout);
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3139
|
+
const imageObjects = [];
|
|
3140
|
+
for (const obj of layout._slideObjects){
|
|
3141
|
+
var _obj_options, _obj__fallbackImage, _obj__fallbackImage_options;
|
|
3142
|
+
if (obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.image */"image") && ((_obj_options = obj.options) === null || _obj_options === void 0 ? void 0 : _obj_options._sizeFromImage)) imageObjects.push(obj);
|
|
3143
|
+
if (((_obj__fallbackImage = obj._fallbackImage) === null || _obj__fallbackImage === void 0 ? void 0 : _obj__fallbackImage._type) === (/* inlined export .SLIDE_OBJECT_TYPES.image */"image") && ((_obj__fallbackImage_options = obj._fallbackImage.options) === null || _obj__fallbackImage_options === void 0 ? void 0 : _obj__fallbackImage_options._sizeFromImage)) {
|
|
3144
|
+
imageObjects.push(obj._fallbackImage);
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
imageObjects.forEach((obj)=>{
|
|
3143
3148
|
var _layout__relsMedia_find;
|
|
3144
3149
|
const strData = (_layout__relsMedia_find = layout._relsMedia.find((rel)=>rel.rId === obj.imageRid)) === null || _layout__relsMedia_find === void 0 ? void 0 : _layout__relsMedia_find.data;
|
|
3145
3150
|
if (!obj.options || typeof strData !== 'string' || !strData || strData === IMG_BROKEN) return;
|
|
@@ -3965,10 +3970,9 @@ const MC_NS = 'http://schemas.openxmlformats.org/markup-compatibility/2006';
|
|
|
3965
3970
|
const P14_NS = 'http://schemas.microsoft.com/office/powerpoint/2010/main';
|
|
3966
3971
|
const P1710_NS = 'http://schemas.microsoft.com/office/powerpoint/2017/10/main';
|
|
3967
3972
|
/**
|
|
3968
|
-
* Normalize caller-supplied OMML for PowerPoint.
|
|
3969
|
-
* - Ensures
|
|
3970
|
-
* -
|
|
3971
|
-
* @see MS-ODRAWXML Math / mc:AlternateContent; proven via PowerPoint 16 COM round-trip.
|
|
3973
|
+
* Normalize caller-supplied OMML for PowerPoint (`[MS-ODRAWXML]` `CT_TextMath`).
|
|
3974
|
+
* - Ensures `<m:oMathPara>` wrapping `<m:oMath>` inside `<a14:m>` (`CT_TextMath` allows only `m:oMathPara`).
|
|
3975
|
+
* - Declares `xmlns:m` (and `xmlns:w` when `w:` elements appear) on `<m:oMathPara>`.
|
|
3972
3976
|
*/ function normalizeOmml(omml) {
|
|
3973
3977
|
// Control characters in math text (`<m:t>`) are a data defect, not a markup
|
|
3974
3978
|
// one - drop them instead of failing the whole export over a single run.
|
|
@@ -3980,15 +3984,79 @@ const P1710_NS = 'http://schemas.microsoft.com/office/powerpoint/2017/10/main';
|
|
|
3980
3984
|
if (problem) {
|
|
3981
3985
|
throw new Error(`ERROR: text run 'omml' option is not a well-formed XML fragment: ${problem}. Escape all '<', '&' in math text (e.g. <m:t>a<b</m:t>).`);
|
|
3982
3986
|
}
|
|
3983
|
-
//
|
|
3984
|
-
if (/^<a14:m[
|
|
3985
|
-
|
|
3986
|
-
if (
|
|
3987
|
-
trimmed =
|
|
3988
|
-
|
|
3989
|
-
|
|
3987
|
+
// Unwrap pre-wrapped <a14:m> so we can still enforce <m:oMathPara> inside
|
|
3988
|
+
if (/^<a14:m(?:\s[^>]*)?\/>$/i.test(trimmed)) return '';
|
|
3989
|
+
const a14Match = /^<a14:m(?:\s[^>]*)?>([\s\S]*)<\/a14:m>$/i.exec(trimmed);
|
|
3990
|
+
if (a14Match) {
|
|
3991
|
+
trimmed = a14Match[1].trim();
|
|
3992
|
+
if (!trimmed) return '';
|
|
3993
|
+
}
|
|
3994
|
+
// Ensure <m:oMathPara> root (wrapping bare <m:oMath> or inner math fragments)
|
|
3995
|
+
if (/^<m:oMathPara[\s/>]/i.test(trimmed)) {
|
|
3996
|
+
const openTagEnd = trimmed.indexOf('>');
|
|
3997
|
+
const openTag = openTagEnd >= 0 ? trimmed.slice(0, openTagEnd) : trimmed;
|
|
3998
|
+
let extraNs = '';
|
|
3999
|
+
if (!/\bxmlns:m=/i.test(openTag)) extraNs += ` xmlns:m="${MATH_NS}"`;
|
|
4000
|
+
if (!/\bxmlns:w=/i.test(openTag) && /\bw:/i.test(trimmed)) extraNs += ` xmlns:w="${W_NS}"`;
|
|
4001
|
+
if (extraNs) {
|
|
4002
|
+
trimmed = trimmed.replace(/^<m:oMathPara/i, `<m:oMathPara${extraNs}`);
|
|
4003
|
+
}
|
|
4004
|
+
} else {
|
|
4005
|
+
const innerMath = /^<m:oMath[\s/>]/i.test(trimmed) ? trimmed : `<m:oMath>${trimmed}</m:oMath>`;
|
|
4006
|
+
const needsW = /\bw:/i.test(innerMath) && !/\bxmlns:w=/i.test(innerMath.slice(0, 180));
|
|
4007
|
+
trimmed = `<m:oMathPara xmlns:m="${MATH_NS}"${needsW ? ` xmlns:w="${W_NS}"` : ''}>${innerMath}</m:oMathPara>`;
|
|
4008
|
+
}
|
|
4009
|
+
return `<a14:m>${trimmed}</a14:m>`;
|
|
4010
|
+
}
|
|
4011
|
+
const OMML_FALLBACK_INHERITED_KEYS = [
|
|
4012
|
+
'lang',
|
|
4013
|
+
'color',
|
|
4014
|
+
'fontSize',
|
|
4015
|
+
'fontFace',
|
|
4016
|
+
'fontFaceEa',
|
|
4017
|
+
'fontFaceCs',
|
|
4018
|
+
'fontFaceSym',
|
|
4019
|
+
'bold',
|
|
4020
|
+
'italic',
|
|
4021
|
+
'transparency'
|
|
4022
|
+
];
|
|
4023
|
+
const EMPTY_OMML_FALLBACK = '<a:r><a:rPr dirty="0"/><a:t/></a:r>';
|
|
4024
|
+
/**
|
|
4025
|
+
* Build `<mc:Fallback>` run XML for an inline `omml` run so consumers that do not advertise `a14`
|
|
4026
|
+
* (e.g. LibreOffice Impress) render readable inline text instead of dropping the equation.
|
|
4027
|
+
*/ function genXmlOmmlFallback(textObj) {
|
|
4028
|
+
var _textObj_options;
|
|
4029
|
+
const opts = (_textObj_options = textObj.options) !== null && _textObj_options !== void 0 ? _textObj_options : {};
|
|
4030
|
+
const fallback = opts.ommlFallback;
|
|
4031
|
+
if (Array.isArray(fallback)) {
|
|
4032
|
+
const runsXml = fallback.map((fbRun)=>{
|
|
4033
|
+
var _fbRun_options;
|
|
4034
|
+
const merged = text_object_spread({}, (_fbRun_options = fbRun.options) !== null && _fbRun_options !== void 0 ? _fbRun_options : {});
|
|
4035
|
+
delete merged.omml;
|
|
4036
|
+
delete merged.ommlFallback;
|
|
4037
|
+
delete merged.fallbackImage;
|
|
4038
|
+
for (const key of OMML_FALLBACK_INHERITED_KEYS){
|
|
4039
|
+
if (merged[key] === undefined && opts[key] !== undefined) {
|
|
4040
|
+
;
|
|
4041
|
+
merged[key] = opts[key];
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
return genXmlTextRun({
|
|
4045
|
+
text: fbRun.text,
|
|
4046
|
+
options: merged
|
|
4047
|
+
});
|
|
4048
|
+
}).filter(Boolean).join('');
|
|
4049
|
+
return runsXml || EMPTY_OMML_FALLBACK;
|
|
3990
4050
|
}
|
|
3991
|
-
|
|
4051
|
+
const fallbackText = typeof fallback === 'string' && fallback.length > 0 ? fallback : typeof textObj.text === 'string' && textObj.text.length > 0 ? textObj.text : '';
|
|
4052
|
+
if (fallbackText) {
|
|
4053
|
+
const runOpts = text_object_spread({}, opts);
|
|
4054
|
+
delete runOpts.omml;
|
|
4055
|
+
delete runOpts.ommlFallback;
|
|
4056
|
+
delete runOpts.fallbackImage;
|
|
4057
|
+
return `<a:r>${genXmlTextRunProperties(runOpts, false)}<a:t>${encodeXmlEntities(fallbackText)}</a:t></a:r>`;
|
|
4058
|
+
}
|
|
4059
|
+
return EMPTY_OMML_FALLBACK;
|
|
3992
4060
|
}
|
|
3993
4061
|
/**
|
|
3994
4062
|
* A stable GUID for a field, derived from its type and cached value
|
|
@@ -4009,10 +4077,13 @@ function textRunsHaveOmml(text) {
|
|
|
4009
4077
|
function genXmlTextRun(textObj) {
|
|
4010
4078
|
var _textObj_options;
|
|
4011
4079
|
var _textObj_options1, _textObj_options2;
|
|
4012
|
-
// Native Office Math run —
|
|
4080
|
+
// Native Office Math run — wrapped in spec-valid MCE AlternateContent so PowerPoint renders
|
|
4081
|
+
// editable `<a14:m><m:oMathPara>…</m:oMathPara></a14:m>` and consumers without `a14` render `<mc:Fallback>`.
|
|
4013
4082
|
const omml = (_textObj_options1 = textObj.options) === null || _textObj_options1 === void 0 ? void 0 : _textObj_options1.omml;
|
|
4014
4083
|
if (typeof omml === 'string' && omml.trim()) {
|
|
4015
|
-
|
|
4084
|
+
const normalized = normalizeOmml(omml);
|
|
4085
|
+
if (!normalized) return '';
|
|
4086
|
+
return '<mc:AlternateContent>' + `<mc:Choice Requires="a14">${normalized}</mc:Choice>` + `<mc:Fallback>${genXmlOmmlFallback(textObj)}</mc:Fallback>` + '</mc:AlternateContent>';
|
|
4016
4087
|
}
|
|
4017
4088
|
// NOTE: Dont create full rPr runProps for empty [lineBreak] runs
|
|
4018
4089
|
// Why? The size of the lineBreak wont match (eg: below it will be 18px instead of the correct 36px)
|
|
@@ -4105,11 +4176,15 @@ function genXmlTextRun(textObj) {
|
|
|
4105
4176
|
var _slideObject_options_fit;
|
|
4106
4177
|
// NOTE: Use of '<a:noAutofit/>' instead of '' causes issues in PPT-2013!
|
|
4107
4178
|
if (slideObject.options.fit === 'none') bodyProperties += '';
|
|
4108
|
-
else if (slideObject.options.fit === 'shrink')
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
const
|
|
4112
|
-
|
|
4179
|
+
else if (slideObject.options.fit === 'shrink' || typeof slideObject.options.fit === 'object' && ((_slideObject_options_fit = slideObject.options.fit) === null || _slideObject_options_fit === void 0 ? void 0 : _slideObject_options_fit.type) === 'shrink') {
|
|
4180
|
+
// ECMA-376 §5.1.5.1.3 CT_TextNormalAutofit: fontScale (1..100% -> 1000..100000)
|
|
4181
|
+
// and lnSpcReduction (0..100% -> 0..100000) in 1000ths of a percent.
|
|
4182
|
+
const fitObj = typeof slideObject.options.fit === 'object' ? slideObject.options.fit : undefined;
|
|
4183
|
+
const fs = typeof (fitObj === null || fitObj === void 0 ? void 0 : fitObj.fontScale) === 'number' ? fitObj.fontScale : slideObject.options.fontScale;
|
|
4184
|
+
const ls = typeof (fitObj === null || fitObj === void 0 ? void 0 : fitObj.lnSpcReduction) === 'number' ? fitObj.lnSpcReduction : slideObject.options.lnSpcReduction;
|
|
4185
|
+
const fsAttr = typeof fs === 'number' && Number.isFinite(fs) ? ` fontScale="${clampInt(Math.round(fs * 1000), 1000, 100000)}"` : '';
|
|
4186
|
+
const lsAttr = typeof ls === 'number' && Number.isFinite(ls) ? ` lnSpcReduction="${clampInt(Math.round(ls * 1000), 0, 100000)}"` : '';
|
|
4187
|
+
bodyProperties += `<a:normAutofit${fsAttr}${lsAttr}/>`;
|
|
4113
4188
|
} else if (slideObject.options.fit === 'resize') bodyProperties += '<a:spAutoFit/>';
|
|
4114
4189
|
}
|
|
4115
4190
|
//
|
|
@@ -4214,6 +4289,7 @@ function genXmlTextRun(textObj) {
|
|
|
4214
4289
|
delete runOpts.shadow;
|
|
4215
4290
|
delete runOpts.fillOverlay;
|
|
4216
4291
|
delete runOpts.effectDag;
|
|
4292
|
+
delete runOpts.fallbackImage;
|
|
4217
4293
|
itext.options = runOpts;
|
|
4218
4294
|
}
|
|
4219
4295
|
if (idx === 0 && itext.options && !itext.options.bullet && opts.bullet) itext.options.bullet = opts.bullet;
|
|
@@ -4330,8 +4406,8 @@ function genXmlTextRun(textObj) {
|
|
|
4330
4406
|
// if (textOpts.hyperlink && key === 'color') null
|
|
4331
4407
|
// NOTE: This loop will pick up unecessary keys (`x`, etc.), but it doesnt hurt anything
|
|
4332
4408
|
// `glow` / softEdge / reflection belong on the shape effectLst (not per-run), unless set on the run itself
|
|
4333
|
-
// `omml`
|
|
4334
|
-
if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'fillOverlay' || key === 'effectDag' || key === 'omml') return;
|
|
4409
|
+
// `omml` / `ommlFallback` / `fallbackImage` must not inherit from shape options onto sibling plain-text runs
|
|
4410
|
+
if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'fillOverlay' || key === 'effectDag' || key === 'omml' || key === 'ommlFallback' || key === 'fallbackImage') return;
|
|
4335
4411
|
if (key !== 'bullet' && textOpts[key] === undefined) textOpts[key] = val;
|
|
4336
4412
|
});
|
|
4337
4413
|
// D: Add formatted textrun
|
|
@@ -5298,7 +5374,7 @@ function resolveObjectImageFills(target, options) {
|
|
|
5298
5374
|
if (options.fill) resolveImageFill(target, options.fill);
|
|
5299
5375
|
if ((_options_fillOverlay = options.fillOverlay) === null || _options_fillOverlay === void 0 ? void 0 : _options_fillOverlay.fill) resolveImageFill(target, options.fillOverlay.fill);
|
|
5300
5376
|
}
|
|
5301
|
-
function
|
|
5377
|
+
function buildImageSlideObject(target, opt) {
|
|
5302
5378
|
var _opt_fillOverlay;
|
|
5303
5379
|
if ((_opt_fillOverlay = opt.fillOverlay) === null || _opt_fillOverlay === void 0 ? void 0 : _opt_fillOverlay.fill) resolveImageFill(target, opt.fillOverlay.fill);
|
|
5304
5380
|
const newObject = {
|
|
@@ -5323,16 +5399,16 @@ function addImageDefinition(target, opt) {
|
|
|
5323
5399
|
// REALITY-CHECK:
|
|
5324
5400
|
if (!strImagePath && !strImageData) {
|
|
5325
5401
|
console.error('ERROR: addImage() requires either \'data\' or \'path\' parameter!');
|
|
5326
|
-
return;
|
|
5402
|
+
return undefined;
|
|
5327
5403
|
} else if (strImagePath && typeof strImagePath !== 'string') {
|
|
5328
5404
|
console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(strImagePath)}`);
|
|
5329
|
-
return;
|
|
5405
|
+
return undefined;
|
|
5330
5406
|
} else if (strImageData && typeof strImageData !== 'string') {
|
|
5331
5407
|
console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(strImageData)}`);
|
|
5332
|
-
return;
|
|
5408
|
+
return undefined;
|
|
5333
5409
|
} else if (strImageData && typeof strImageData === 'string' && !strImageData.toLowerCase().includes('base64,')) {
|
|
5334
5410
|
console.error('ERROR: Image `data` value lacks a base64 header! Ex: \'image/png;base64,NMP[...]\')');
|
|
5335
|
-
return;
|
|
5411
|
+
return undefined;
|
|
5336
5412
|
}
|
|
5337
5413
|
// STEP 1: Set extension
|
|
5338
5414
|
// Honor explicit `opt.extn` (for extensionless signed CDN URLs); otherwise parse from path safely.
|
|
@@ -5362,6 +5438,7 @@ function addImageDefinition(target, opt) {
|
|
|
5362
5438
|
rounding: typeof opt.rounding === 'boolean' ? opt.rounding : false,
|
|
5363
5439
|
rectRadius: opt.rectRadius,
|
|
5364
5440
|
sizing: sizing !== null && sizing !== void 0 ? sizing : undefined,
|
|
5441
|
+
crop: opt.crop,
|
|
5365
5442
|
placeholder: opt.placeholder,
|
|
5366
5443
|
rotate: opt.rotate || 0,
|
|
5367
5444
|
flipV: opt.flipV || false,
|
|
@@ -5475,8 +5552,11 @@ function addImageDefinition(target, opt) {
|
|
|
5475
5552
|
resolveHyperlinkRels(target, opt.hyperlinkHover);
|
|
5476
5553
|
newObject.hyperlinkHover = opt.hyperlinkHover;
|
|
5477
5554
|
}
|
|
5478
|
-
|
|
5479
|
-
|
|
5555
|
+
return newObject;
|
|
5556
|
+
}
|
|
5557
|
+
function addImageDefinition(target, opt) {
|
|
5558
|
+
const newObject = buildImageSlideObject(target, opt);
|
|
5559
|
+
if (newObject) target._slideObjects.push(newObject);
|
|
5480
5560
|
}
|
|
5481
5561
|
/**
|
|
5482
5562
|
* Adds a media object to a slide definition.
|
|
@@ -6426,6 +6506,7 @@ function addShapeDefinition(target, shapeName, opts) {
|
|
|
6426
6506
|
var // STEP 2: Create/Clean text options
|
|
6427
6507
|
_newObject_text, _newObject_options1, _newObject_options2, _newObject_text1;
|
|
6428
6508
|
resolveObjectImageFills(target, opts);
|
|
6509
|
+
const rawObjectName = opts === null || opts === void 0 ? void 0 : opts.objectName;
|
|
6429
6510
|
const newObject = {
|
|
6430
6511
|
_type: isPlaceholder ? (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder") : (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"),
|
|
6431
6512
|
shape: (opts === null || opts === void 0 ? void 0 : opts.shape) || core_enums_SHAPE_TYPE.RECTANGLE,
|
|
@@ -6568,6 +6649,25 @@ function addShapeDefinition(target, shapeName, opts) {
|
|
|
6568
6649
|
if ((_item_options1 = item.options) === null || _item_options1 === void 0 ? void 0 : (_item_options_hyperlink = _item_options1.hyperlink) === null || _item_options_hyperlink === void 0 ? void 0 : _item_options_hyperlink.sound) resolveHyperlinkRels(target, item.options.hyperlink);
|
|
6569
6650
|
resolveBulletImage(target, item.options);
|
|
6570
6651
|
});
|
|
6652
|
+
// STEP 4: Optional slide-level `<mc:Fallback><p:pic>` image (e.g. display math SVG/PNG fallback).
|
|
6653
|
+
// Register media/relationships via the normal image pipeline without adding a second top-level slide object.
|
|
6654
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.fallbackImage) && !isPlaceholder) {
|
|
6655
|
+
var _opts_fallbackImage_x, _opts_fallbackImage_y, _opts_fallbackImage_w, _opts_fallbackImage_h, _opts_fallbackImage_rotate, _opts_fallbackImage_altText, _opts_fallbackImage_objectName;
|
|
6656
|
+
const rawBaseName = rawObjectName !== null && rawObjectName !== void 0 ? rawObjectName : `Text ${target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.text */"text")).length}`;
|
|
6657
|
+
const fbOpt = gen_objects_object_spread_props(gen_objects_object_spread({}, opts.fallbackImage), {
|
|
6658
|
+
x: (_opts_fallbackImage_x = opts.fallbackImage.x) !== null && _opts_fallbackImage_x !== void 0 ? _opts_fallbackImage_x : newObject.options.x,
|
|
6659
|
+
y: (_opts_fallbackImage_y = opts.fallbackImage.y) !== null && _opts_fallbackImage_y !== void 0 ? _opts_fallbackImage_y : newObject.options.y,
|
|
6660
|
+
w: (_opts_fallbackImage_w = opts.fallbackImage.w) !== null && _opts_fallbackImage_w !== void 0 ? _opts_fallbackImage_w : newObject.options.w,
|
|
6661
|
+
h: (_opts_fallbackImage_h = opts.fallbackImage.h) !== null && _opts_fallbackImage_h !== void 0 ? _opts_fallbackImage_h : newObject.options.h,
|
|
6662
|
+
rotate: (_opts_fallbackImage_rotate = opts.fallbackImage.rotate) !== null && _opts_fallbackImage_rotate !== void 0 ? _opts_fallbackImage_rotate : newObject.options.rotate,
|
|
6663
|
+
altText: (_opts_fallbackImage_altText = opts.fallbackImage.altText) !== null && _opts_fallbackImage_altText !== void 0 ? _opts_fallbackImage_altText : newObject.options.altText,
|
|
6664
|
+
objectName: (_opts_fallbackImage_objectName = opts.fallbackImage.objectName) !== null && _opts_fallbackImage_objectName !== void 0 ? _opts_fallbackImage_objectName : `${rawBaseName} Fallback`
|
|
6665
|
+
});
|
|
6666
|
+
const fallbackObj = buildImageSlideObject(target, fbOpt);
|
|
6667
|
+
if (fallbackObj) {
|
|
6668
|
+
newObject._fallbackImage = fallbackObj;
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6571
6671
|
// LAST: Add object to Slide
|
|
6572
6672
|
target._slideObjects.push(newObject);
|
|
6573
6673
|
}
|
|
@@ -6888,6 +6988,7 @@ function slide_object_spread(target) {
|
|
|
6888
6988
|
delete runOpts.blur;
|
|
6889
6989
|
delete runOpts.fillOverlay;
|
|
6890
6990
|
delete runOpts.effectDag;
|
|
6991
|
+
delete runOpts.fallbackImage;
|
|
6891
6992
|
return runOpts;
|
|
6892
6993
|
}
|
|
6893
6994
|
class Slide {
|
|
@@ -21369,7 +21470,7 @@ const ImageSizingXml = {
|
|
|
21369
21470
|
const height = isBoxBased ? boxDim.h : boxDim.w * imgRatio;
|
|
21370
21471
|
const hzPerc = Math.round(1e5 * 0.5 * (1 - boxDim.w / width));
|
|
21371
21472
|
const vzPerc = Math.round(1e5 * 0.5 * (1 - boxDim.h / height));
|
|
21372
|
-
return `<a:srcRect l="${hzPerc}" r="${hzPerc}" t="${vzPerc}" b="${vzPerc}"/><a:stretch
|
|
21473
|
+
return `<a:srcRect l="${hzPerc}" r="${hzPerc}" t="${vzPerc}" b="${vzPerc}"/><a:stretch><a:fillRect/></a:stretch>`;
|
|
21373
21474
|
},
|
|
21374
21475
|
contain: function(imgSize, boxDim) {
|
|
21375
21476
|
const imgRatio = imgSize.h / imgSize.w;
|
|
@@ -21379,7 +21480,7 @@ const ImageSizingXml = {
|
|
|
21379
21480
|
const height = widthBased ? boxDim.w * imgRatio : boxDim.h;
|
|
21380
21481
|
const hzPerc = Math.round(1e5 * 0.5 * (1 - boxDim.w / width));
|
|
21381
21482
|
const vzPerc = Math.round(1e5 * 0.5 * (1 - boxDim.h / height));
|
|
21382
|
-
return `<a:srcRect l="${hzPerc}" r="${hzPerc}" t="${vzPerc}" b="${vzPerc}"/><a:stretch
|
|
21483
|
+
return `<a:srcRect l="${hzPerc}" r="${hzPerc}" t="${vzPerc}" b="${vzPerc}"/><a:stretch><a:fillRect/></a:stretch>`;
|
|
21383
21484
|
},
|
|
21384
21485
|
crop: function(imgSize, boxDim) {
|
|
21385
21486
|
const l = boxDim.x;
|
|
@@ -21390,7 +21491,7 @@ const ImageSizingXml = {
|
|
|
21390
21491
|
const rPerc = Math.round(1e5 * (r / imgSize.w));
|
|
21391
21492
|
const tPerc = Math.round(1e5 * (t / imgSize.h));
|
|
21392
21493
|
const bPerc = Math.round(1e5 * (b / imgSize.h));
|
|
21393
|
-
return `<a:srcRect l="${lPerc}" r="${rPerc}" t="${tPerc}" b="${bPerc}"/><a:stretch
|
|
21494
|
+
return `<a:srcRect l="${lPerc}" r="${rPerc}" t="${tPerc}" b="${bPerc}"/><a:stretch><a:fillRect/></a:stretch>`;
|
|
21394
21495
|
}
|
|
21395
21496
|
};
|
|
21396
21497
|
/**
|
|
@@ -21838,168 +21939,168 @@ function slideObjectToXml(slide) {
|
|
|
21838
21939
|
// STEP 3: Loop over all Slide.data objects and add them to this slide
|
|
21839
21940
|
const usedShapeIds = new Set();
|
|
21840
21941
|
const shapeCoordinates = [];
|
|
21841
|
-
const
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
|
|
21860
|
-
|
|
21861
|
-
|
|
21862
|
-
|
|
21863
|
-
|
|
21864
|
-
}
|
|
21865
|
-
});
|
|
21866
|
-
let intColCnt = 0;
|
|
21867
|
-
let cellOpts;
|
|
21868
|
-
let strXml = '';
|
|
21869
|
-
const sizing = (_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.sizing;
|
|
21870
|
-
const rounding = (_slideItemObj_options1 = slideItemObj.options) === null || _slideItemObj_options1 === void 0 ? void 0 : _slideItemObj_options1.rounding;
|
|
21871
|
-
if ('_slideLayout' in slide && ((_slide__slideLayout = slide._slideLayout) === null || _slide__slideLayout === void 0 ? void 0 : _slide__slideLayout._slideObjects) !== undefined && slideItemObj.options && slideItemObj.options.placeholder) {
|
|
21872
|
-
placeholderObj = slide._slideLayout._slideObjects.filter((object)=>{
|
|
21873
|
-
var _object_options, _slideItemObj_options;
|
|
21874
|
-
return ((_object_options = object.options) === null || _object_options === void 0 ? void 0 : _object_options.placeholder) === ((_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.placeholder);
|
|
21875
|
-
})[0];
|
|
21876
|
-
}
|
|
21877
|
-
// A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
|
|
21878
|
-
if ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) {
|
|
21879
|
-
resolveConnectorObjectNames(slideItemObj.options.line, shapeCoordinates);
|
|
21880
|
-
}
|
|
21881
|
-
const connectorLayout = ((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector) ? applyConnectorAutoLayout(slideItemObj.options.line, shapeCoordinates, slide._presLayout) : undefined;
|
|
21882
|
-
if (connectorLayout) {
|
|
21883
|
-
x = connectorLayout.x;
|
|
21884
|
-
y = connectorLayout.y;
|
|
21885
|
-
cx = connectorLayout.cx;
|
|
21886
|
-
cy = connectorLayout.cy;
|
|
21887
|
-
slideItemObj.options.flipH = connectorLayout.flipH;
|
|
21888
|
-
slideItemObj.options.flipV = connectorLayout.flipV;
|
|
21889
|
-
} else {
|
|
21890
|
-
if (typeof slideItemObj.options.x !== 'undefined') x = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout);
|
|
21891
|
-
if (typeof slideItemObj.options.y !== 'undefined') y = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout);
|
|
21892
|
-
if (typeof slideItemObj.options.w !== 'undefined') cx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout);
|
|
21893
|
-
if (typeof slideItemObj.options.h !== 'undefined') cy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout);
|
|
21894
|
-
}
|
|
21895
|
-
// Set w/h now that smart parse is done.
|
|
21896
|
-
// `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes EMU
|
|
21897
|
-
// and inches. The sizing fns only use imgSize for a *ratio*, so normalize to a common unit before they
|
|
21898
|
-
// corrupt `srcRect` with a garbage aspect (issue #1286). Frame `cx`/`cy` below keep their own values.
|
|
21899
|
-
let imgWidth = cx;
|
|
21900
|
-
let imgHeight = cy;
|
|
21901
|
-
if ((_slideItemObj_options2 = slideItemObj.options) === null || _slideItemObj_options2 === void 0 ? void 0 : (_slideItemObj_options_sizing = _slideItemObj_options2.sizing) === null || _slideItemObj_options_sizing === void 0 ? void 0 : _slideItemObj_options_sizing.type) {
|
|
21902
|
-
// `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes
|
|
21903
|
-
// EMU and inches and corrupts the sizing aspect/`srcRect` (issue #1286). boxDim is always EMU, so
|
|
21904
|
-
// coerce both image dims to EMU: whichever raw value was taken as inches (<100) is re-read as EMU.
|
|
21905
|
-
const rawW = slideItemObj.options.w;
|
|
21906
|
-
const rawH = slideItemObj.options.h;
|
|
21907
|
-
if (typeof rawW === 'number' && rawW < 100 && typeof rawH === 'number' && rawH >= 100) imgWidth = rawW;
|
|
21908
|
-
else if (typeof rawH === 'number' && rawH < 100 && typeof rawW === 'number' && rawW >= 100) imgHeight = rawH;
|
|
21942
|
+
const renderObject = (slideItemObj, idx)=>{
|
|
21943
|
+
var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_line1, _slideItemObj_options_sizing, _slideItemObj_options2;
|
|
21944
|
+
let strSlideXml = '';
|
|
21945
|
+
let x = 0;
|
|
21946
|
+
let y = 0;
|
|
21947
|
+
let cx = getSmartParseNumber('75%', 'X', slide._presLayout);
|
|
21948
|
+
let cy = 0;
|
|
21949
|
+
let placeholderObj;
|
|
21950
|
+
let locationAttr = '';
|
|
21951
|
+
let arrTabRows = [];
|
|
21952
|
+
let objTabOpts = {};
|
|
21953
|
+
slideItemObj.options = slideItemObj.options || {};
|
|
21954
|
+
const shapeId = resolveShapeId(slideItemObj.options, idx, usedShapeIds);
|
|
21955
|
+
// Keep resolved id on options so animations / later passes can target the same cNvPr id
|
|
21956
|
+
slideItemObj.options.sId = shapeId;
|
|
21957
|
+
shapeCoordinates.push({
|
|
21958
|
+
id: shapeId,
|
|
21959
|
+
objectName: slideItemObj.options.objectName,
|
|
21960
|
+
position: {
|
|
21961
|
+
x: slideItemObj.options.x,
|
|
21962
|
+
y: slideItemObj.options.y,
|
|
21963
|
+
w: slideItemObj.options.w,
|
|
21964
|
+
h: slideItemObj.options.h
|
|
21909
21965
|
}
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
|
|
21920
|
-
|
|
21921
|
-
|
|
21922
|
-
|
|
21923
|
-
|
|
21924
|
-
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
if (
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
|
|
21940
|
-
|
|
21941
|
-
|
|
21942
|
-
|
|
21943
|
-
|
|
21944
|
-
|
|
21945
|
-
|
|
21946
|
-
|
|
21947
|
-
|
|
21948
|
-
|
|
21949
|
-
|
|
21950
|
-
|
|
21951
|
-
|
|
21952
|
-
|
|
21953
|
-
|
|
21954
|
-
|
|
21955
|
-
|
|
21956
|
-
|
|
21957
|
-
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
|
|
21967
|
-
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21986
|
-
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
|
|
21991
|
-
|
|
21992
|
-
|
|
21993
|
-
|
|
21994
|
-
|
|
21966
|
+
});
|
|
21967
|
+
let intColCnt = 0;
|
|
21968
|
+
let cellOpts;
|
|
21969
|
+
let strXml = '';
|
|
21970
|
+
const sizing = (_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.sizing;
|
|
21971
|
+
const rounding = (_slideItemObj_options1 = slideItemObj.options) === null || _slideItemObj_options1 === void 0 ? void 0 : _slideItemObj_options1.rounding;
|
|
21972
|
+
if ('_slideLayout' in slide && ((_slide__slideLayout = slide._slideLayout) === null || _slide__slideLayout === void 0 ? void 0 : _slide__slideLayout._slideObjects) !== undefined && slideItemObj.options && slideItemObj.options.placeholder) {
|
|
21973
|
+
placeholderObj = slide._slideLayout._slideObjects.filter((object)=>{
|
|
21974
|
+
var _object_options, _slideItemObj_options;
|
|
21975
|
+
return ((_object_options = object.options) === null || _object_options === void 0 ? void 0 : _object_options.placeholder) === ((_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.placeholder);
|
|
21976
|
+
})[0];
|
|
21977
|
+
}
|
|
21978
|
+
// A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
|
|
21979
|
+
if ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) {
|
|
21980
|
+
resolveConnectorObjectNames(slideItemObj.options.line, shapeCoordinates);
|
|
21981
|
+
}
|
|
21982
|
+
const connectorLayout = ((_slideItemObj_options_line1 = slideItemObj.options.line) === null || _slideItemObj_options_line1 === void 0 ? void 0 : _slideItemObj_options_line1.isConnector) ? applyConnectorAutoLayout(slideItemObj.options.line, shapeCoordinates, slide._presLayout) : undefined;
|
|
21983
|
+
if (connectorLayout) {
|
|
21984
|
+
x = connectorLayout.x;
|
|
21985
|
+
y = connectorLayout.y;
|
|
21986
|
+
cx = connectorLayout.cx;
|
|
21987
|
+
cy = connectorLayout.cy;
|
|
21988
|
+
slideItemObj.options.flipH = connectorLayout.flipH;
|
|
21989
|
+
slideItemObj.options.flipV = connectorLayout.flipV;
|
|
21990
|
+
} else {
|
|
21991
|
+
if (typeof slideItemObj.options.x !== 'undefined') x = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout);
|
|
21992
|
+
if (typeof slideItemObj.options.y !== 'undefined') y = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout);
|
|
21993
|
+
if (typeof slideItemObj.options.w !== 'undefined') cx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout);
|
|
21994
|
+
if (typeof slideItemObj.options.h !== 'undefined') cy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout);
|
|
21995
|
+
}
|
|
21996
|
+
// Set w/h now that smart parse is done.
|
|
21997
|
+
// `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes EMU
|
|
21998
|
+
// and inches. The sizing fns only use imgSize for a *ratio*, so normalize to a common unit before they
|
|
21999
|
+
// corrupt `srcRect` with a garbage aspect (issue #1286). Frame `cx`/`cy` below keep their own values.
|
|
22000
|
+
let imgWidth = cx;
|
|
22001
|
+
let imgHeight = cy;
|
|
22002
|
+
if ((_slideItemObj_options2 = slideItemObj.options) === null || _slideItemObj_options2 === void 0 ? void 0 : (_slideItemObj_options_sizing = _slideItemObj_options2.sizing) === null || _slideItemObj_options_sizing === void 0 ? void 0 : _slideItemObj_options_sizing.type) {
|
|
22003
|
+
// `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes
|
|
22004
|
+
// EMU and inches and corrupts the sizing aspect/`srcRect` (issue #1286). boxDim is always EMU, so
|
|
22005
|
+
// coerce both image dims to EMU: whichever raw value was taken as inches (<100) is re-read as EMU.
|
|
22006
|
+
const rawW = slideItemObj.options.w;
|
|
22007
|
+
const rawH = slideItemObj.options.h;
|
|
22008
|
+
if (typeof rawW === 'number' && rawW < 100 && typeof rawH === 'number' && rawH >= 100) imgWidth = rawW;
|
|
22009
|
+
else if (typeof rawH === 'number' && rawH < 100 && typeof rawW === 'number' && rawW >= 100) imgHeight = rawH;
|
|
22010
|
+
}
|
|
22011
|
+
// Inherit placeholder geometry only for axes the caller did not set (fujita-h d7e3e93).
|
|
22012
|
+
// addImage always writes x/y/w/h defaults, so `_explicit*` distinguishes unset vs explicit.
|
|
22013
|
+
if (placeholderObj) {
|
|
22014
|
+
var _placeholderObj_options, _placeholderObj_options1, _placeholderObj_options2, _placeholderObj_options3, _placeholderObj_options4, _placeholderObj_options5, _placeholderObj_options6, _placeholderObj_options7, _placeholderObj_options8, _placeholderObj_options9, _placeholderObj_options10, _placeholderObj_options11;
|
|
22015
|
+
if (!slideItemObj.options._explicitX && (((_placeholderObj_options = placeholderObj.options) === null || _placeholderObj_options === void 0 ? void 0 : _placeholderObj_options.x) || ((_placeholderObj_options1 = placeholderObj.options) === null || _placeholderObj_options1 === void 0 ? void 0 : _placeholderObj_options1.x) === 0)) x = getSmartParseNumber((_placeholderObj_options2 = placeholderObj.options) === null || _placeholderObj_options2 === void 0 ? void 0 : _placeholderObj_options2.x, 'X', slide._presLayout);
|
|
22016
|
+
if (!slideItemObj.options._explicitY && (((_placeholderObj_options3 = placeholderObj.options) === null || _placeholderObj_options3 === void 0 ? void 0 : _placeholderObj_options3.y) || ((_placeholderObj_options4 = placeholderObj.options) === null || _placeholderObj_options4 === void 0 ? void 0 : _placeholderObj_options4.y) === 0)) y = getSmartParseNumber((_placeholderObj_options5 = placeholderObj.options) === null || _placeholderObj_options5 === void 0 ? void 0 : _placeholderObj_options5.y, 'Y', slide._presLayout);
|
|
22017
|
+
if (!slideItemObj.options._explicitW && (((_placeholderObj_options6 = placeholderObj.options) === null || _placeholderObj_options6 === void 0 ? void 0 : _placeholderObj_options6.w) || ((_placeholderObj_options7 = placeholderObj.options) === null || _placeholderObj_options7 === void 0 ? void 0 : _placeholderObj_options7.w) === 0)) cx = getSmartParseNumber((_placeholderObj_options8 = placeholderObj.options) === null || _placeholderObj_options8 === void 0 ? void 0 : _placeholderObj_options8.w, 'X', slide._presLayout);
|
|
22018
|
+
if (!slideItemObj.options._explicitH && (((_placeholderObj_options9 = placeholderObj.options) === null || _placeholderObj_options9 === void 0 ? void 0 : _placeholderObj_options9.h) || ((_placeholderObj_options10 = placeholderObj.options) === null || _placeholderObj_options10 === void 0 ? void 0 : _placeholderObj_options10.h) === 0)) cy = getSmartParseNumber((_placeholderObj_options11 = placeholderObj.options) === null || _placeholderObj_options11 === void 0 ? void 0 : _placeholderObj_options11.h, 'Y', slide._presLayout);
|
|
22019
|
+
// Re-sync the image frame: imgWidth/imgHeight were snapshotted from cx/cy before this block, so a
|
|
22020
|
+
// placeholder's w/h would otherwise be lost and the frame stay at the 1x1 default (issue #996).
|
|
22021
|
+
imgWidth = cx;
|
|
22022
|
+
imgHeight = cy;
|
|
22023
|
+
}
|
|
22024
|
+
let flipH = !!slideItemObj.options.flipH;
|
|
22025
|
+
let flipV = !!slideItemObj.options.flipV;
|
|
22026
|
+
if (slideItemObj.shape === core_enums_SHAPE_TYPE.LINE) {
|
|
22027
|
+
const line = normalizeLineExtents(x, y, cx, cy, flipH, flipV);
|
|
22028
|
+
x = line.x;
|
|
22029
|
+
y = line.y;
|
|
22030
|
+
cx = line.cx;
|
|
22031
|
+
cy = line.cy;
|
|
22032
|
+
flipH = line.flipH;
|
|
22033
|
+
flipV = line.flipV;
|
|
22034
|
+
}
|
|
22035
|
+
// Clamp extents to ST_PositiveCoordinate (>= 0) after line flip so lines keep negative endpoint deltas
|
|
22036
|
+
if (cx < 0 || cy < 0) {
|
|
22037
|
+
console.warn(`[pptxgenjs] negative size on ${slideItemObj._type}${slideItemObj.options.objectName ? ` "${slideItemObj.options.objectName}"` : ''} - w/h cannot be negative, clamped to 0`);
|
|
22038
|
+
}
|
|
22039
|
+
cx = positiveExtent(cx);
|
|
22040
|
+
cy = positiveExtent(cy);
|
|
22041
|
+
imgWidth = positiveExtent(imgWidth);
|
|
22042
|
+
imgHeight = positiveExtent(imgHeight);
|
|
22043
|
+
if (flipH) locationAttr += ' flipH="1"';
|
|
22044
|
+
if (flipV) locationAttr += ' flipV="1"';
|
|
22045
|
+
if (slideItemObj.options.rotate) locationAttr += ` rot="${convertRotationDegrees(slideItemObj.options.rotate)}"`;
|
|
22046
|
+
// B: Add OBJECT to the current Slide
|
|
22047
|
+
switch(slideItemObj._type){
|
|
22048
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.table */"table"):
|
|
22049
|
+
{
|
|
22050
|
+
var _slideItemObj_arrTabRows, _slideItemObj_options_objectName;
|
|
22051
|
+
arrTabRows = (_slideItemObj_arrTabRows = slideItemObj.arrTabRows) !== null && _slideItemObj_arrTabRows !== void 0 ? _slideItemObj_arrTabRows : [];
|
|
22052
|
+
objTabOpts = slideItemObj.options;
|
|
22053
|
+
intColCnt = 0;
|
|
22054
|
+
// Calc number of columns
|
|
22055
|
+
// NOTE: Cells may have a colspan, so merely taking the length of the [0] (or any other) row is not
|
|
22056
|
+
// ....: sufficient to determine column count. Therefore, check each cell for a colspan and total cols as reqd
|
|
22057
|
+
arrTabRows[0].forEach((cell)=>{
|
|
22058
|
+
cellOpts = cell.options;
|
|
22059
|
+
intColCnt += (cellOpts === null || cellOpts === void 0 ? void 0 : cellOpts.colspan) ? Number(cellOpts.colspan) : 1;
|
|
22060
|
+
});
|
|
22061
|
+
// STEP 1: Start Table XML
|
|
22062
|
+
// NOTE: Non-numeric cNvPr id values will trigger "presentation needs repair" type warning in MS-PPT-2013
|
|
22063
|
+
// Use the shared slide allocator — `intTableNum * slideNum + 1` collided with `idx + 2` (gitbrent/PptxGenJS#1532)
|
|
22064
|
+
strXml = '<p:graphicFrame><p:nvGraphicFramePr>' + genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName !== void 0 ? _slideItemObj_options_objectName : ''), slideItemObj.options);
|
|
22065
|
+
// When the table binds to a master/layout placeholder, emit `<p:ph type="tbl"/>` (ECMA-376 §4.4.1.33, issue #856)
|
|
22066
|
+
const tblPh = placeholderObj ? genXmlPlaceholder(placeholderObj, slideItemObj.options) : '';
|
|
22067
|
+
// MS-PPTX §2.3.1.19: each p14:modId must be unique on the slide (not a constant).
|
|
22068
|
+
const tableModId = typeof slideItemObj.options.modId === 'number' ? slideItemObj.options.modId : TABLE_MOD_ID_BASE + idx;
|
|
22069
|
+
strXml += `<p:cNvGraphicFramePr>${genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock, ' noGrp="1"')}</p:cNvGraphicFramePr>` + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
|
|
22070
|
+
nvPrModIdExt(tableModId)
|
|
22071
|
+
])}` + '</p:nvGraphicFramePr>';
|
|
22072
|
+
strXml += `<p:xfrm><a:off x="${x || (x === 0 ? 0 : (/* inlined export .EMU */914400))}" y="${y || (y === 0 ? 0 : (/* inlined export .EMU */914400))}"/><a:ext cx="${cx || (cx === 0 ? 0 : (/* inlined export .EMU */914400))}" cy="${cy || (/* inlined export .EMU */914400)}"/></p:xfrm>`;
|
|
22073
|
+
strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">';
|
|
22074
|
+
// NOTE: banding/emphasis only renders when a table style is applied - either `tableStyleId` here or a theme default
|
|
22075
|
+
strXml += `<a:tbl>${genXmlTblPr(objTabOpts)}`;
|
|
22076
|
+
// STEP 2: Set column widths
|
|
22077
|
+
// Evenly distribute cols/rows across size provided when applicable (calc them if only overall dimensions were provided)
|
|
22078
|
+
// A: Col widths provided?
|
|
22079
|
+
// B: Table Width provided without colW? Then distribute cols
|
|
22080
|
+
if (Array.isArray(objTabOpts.colW)) {
|
|
22081
|
+
strXml += '<a:tblGrid>';
|
|
22082
|
+
for(let col = 0; col < intColCnt; col++){
|
|
22083
|
+
let w = inch2Emu(objTabOpts.colW[col]);
|
|
22084
|
+
if (w == null || isNaN(w)) {
|
|
22085
|
+
w = (typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt;
|
|
21995
22086
|
}
|
|
21996
|
-
strXml +=
|
|
22087
|
+
strXml += `<a:gridCol w="${positiveExtent(w)}"/>`;
|
|
22088
|
+
}
|
|
22089
|
+
strXml += '</a:tblGrid>';
|
|
22090
|
+
} else {
|
|
22091
|
+
let intColW = objTabOpts.colW ? objTabOpts.colW : (/* inlined export .EMU */914400);
|
|
22092
|
+
if (slideItemObj.options.w && !objTabOpts.colW) intColW = Math.round((typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt);
|
|
22093
|
+
strXml += '<a:tblGrid>';
|
|
22094
|
+
for(let colw = 0; colw < intColCnt; colw++){
|
|
22095
|
+
strXml += `<a:gridCol w="${positiveExtent(intColW)}"/>`;
|
|
21997
22096
|
}
|
|
21998
|
-
|
|
21999
|
-
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
|
|
22097
|
+
strXml += '</a:tblGrid>';
|
|
22098
|
+
}
|
|
22099
|
+
// STEP 3: Build our row arrays into an actual grid to match the XML we will be building next (ISSUE #36)
|
|
22100
|
+
// Note row arrays can arrive "lopsided" as in row1:[1,2,3] row2:[3] when first two cols rowspan!,
|
|
22101
|
+
// so a simple loop below in XML building wont suffice to build table correctly.
|
|
22102
|
+
// We have to build an actual grid now
|
|
22103
|
+
/*
|
|
22003
22104
|
EX: (A0:rowspan=3, B1:rowspan=2, C1:colspan=2)
|
|
22004
22105
|
|
|
22005
22106
|
/------|------|------|------\
|
|
@@ -22008,318 +22109,323 @@ function slideObjectToXml(slide) {
|
|
|
22008
22109
|
| | | C2 | D2 |
|
|
22009
22110
|
\------|------|------|------/
|
|
22010
22111
|
*/ // A: add _hmerge cell for colspan. should reserve rowspan
|
|
22011
|
-
|
|
22012
|
-
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
22016
|
-
|
|
22017
|
-
|
|
22018
|
-
|
|
22019
|
-
|
|
22020
|
-
_type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
|
|
22021
|
-
options: {
|
|
22022
|
-
rowspan
|
|
22023
|
-
},
|
|
22024
|
-
_hmerge: true
|
|
22025
|
-
};
|
|
22026
|
-
});
|
|
22027
|
-
cells.splice(cIdx + 1, 0, ...vMergeCells);
|
|
22028
|
-
cIdx += colspan;
|
|
22029
|
-
} else {
|
|
22030
|
-
cIdx += 1;
|
|
22031
|
-
}
|
|
22032
|
-
}
|
|
22033
|
-
});
|
|
22034
|
-
// B: add _vmerge cell for rowspan. should reserve colspan/_hmerge
|
|
22035
|
-
arrTabRows.forEach((cells, rIdx)=>{
|
|
22036
|
-
const nextRow = arrTabRows[rIdx + 1];
|
|
22037
|
-
if (!nextRow) return;
|
|
22038
|
-
cells.forEach((cell, cIdx)=>{
|
|
22039
|
-
var _cell_options, _cell_options1;
|
|
22040
|
-
const rowspan = cell._rowContinue || ((_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan);
|
|
22041
|
-
const colspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.colspan;
|
|
22042
|
-
const _hmerge = cell._hmerge;
|
|
22043
|
-
if (rowspan && rowspan > 1) {
|
|
22044
|
-
const hMergeCell = {
|
|
22112
|
+
arrTabRows.forEach((cells)=>{
|
|
22113
|
+
for(let cIdx = 0; cIdx < cells.length;){
|
|
22114
|
+
var _cell_options, _cell_options1;
|
|
22115
|
+
const cell = cells[cIdx];
|
|
22116
|
+
const colspan = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.colspan;
|
|
22117
|
+
const rowspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan;
|
|
22118
|
+
if (colspan && colspan > 1) {
|
|
22119
|
+
const vMergeCells = new Array(colspan - 1).fill(undefined).map(()=>{
|
|
22120
|
+
return {
|
|
22045
22121
|
_type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
|
|
22046
22122
|
options: {
|
|
22047
|
-
|
|
22123
|
+
rowspan
|
|
22048
22124
|
},
|
|
22049
|
-
|
|
22050
|
-
_vmerge: true,
|
|
22051
|
-
_hmerge
|
|
22125
|
+
_hmerge: true
|
|
22052
22126
|
};
|
|
22053
|
-
|
|
22054
|
-
|
|
22055
|
-
|
|
22056
|
-
|
|
22057
|
-
|
|
22058
|
-
arrTabRows.forEach((cells, rIdx)=>{
|
|
22059
|
-
var _slideItemObj_options;
|
|
22060
|
-
const itemOpts = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
|
|
22061
|
-
// A: Table Height provided without rowH? Then distribute rows
|
|
22062
|
-
let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
|
|
22063
|
-
;
|
|
22064
|
-
// `rowH` is either one value for every row or a per-row array; `inch2Emu` resolves inches, EMU and unit-suffixed strings alike
|
|
22065
|
-
const rowHOpt = Array.isArray(objTabOpts.rowH) ? objTabOpts.rowH[rIdx] : objTabOpts.rowH;
|
|
22066
|
-
const rowHEmu = rowHOpt ? inch2Emu(rowHOpt) : NaN;
|
|
22067
|
-
if (!isNaN(rowHEmu)) intRowH = rowHEmu;
|
|
22068
|
-
else if (itemOpts.cy || itemOpts.h) {
|
|
22069
|
-
intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
|
|
22127
|
+
});
|
|
22128
|
+
cells.splice(cIdx + 1, 0, ...vMergeCells);
|
|
22129
|
+
cIdx += colspan;
|
|
22130
|
+
} else {
|
|
22131
|
+
cIdx += 1;
|
|
22070
22132
|
}
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
22075
|
-
|
|
22076
|
-
|
|
22077
|
-
|
|
22078
|
-
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
|
|
22133
|
+
}
|
|
22134
|
+
});
|
|
22135
|
+
// B: add _vmerge cell for rowspan. should reserve colspan/_hmerge
|
|
22136
|
+
arrTabRows.forEach((cells, rIdx)=>{
|
|
22137
|
+
const nextRow = arrTabRows[rIdx + 1];
|
|
22138
|
+
if (!nextRow) return;
|
|
22139
|
+
cells.forEach((cell, cIdx)=>{
|
|
22140
|
+
var _cell_options, _cell_options1;
|
|
22141
|
+
const rowspan = cell._rowContinue || ((_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan);
|
|
22142
|
+
const colspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.colspan;
|
|
22143
|
+
const _hmerge = cell._hmerge;
|
|
22144
|
+
if (rowspan && rowspan > 1) {
|
|
22145
|
+
const hMergeCell = {
|
|
22146
|
+
_type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
|
|
22147
|
+
options: {
|
|
22148
|
+
colspan
|
|
22149
|
+
},
|
|
22150
|
+
_rowContinue: rowspan - 1,
|
|
22151
|
+
_vmerge: true,
|
|
22152
|
+
_hmerge
|
|
22083
22153
|
};
|
|
22084
|
-
|
|
22085
|
-
|
|
22086
|
-
|
|
22087
|
-
|
|
22088
|
-
|
|
22089
|
-
|
|
22090
|
-
|
|
22091
|
-
|
|
22092
|
-
|
|
22093
|
-
|
|
22094
|
-
|
|
22095
|
-
|
|
22096
|
-
|
|
22097
|
-
|
|
22098
|
-
|
|
22099
|
-
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
|
|
22103
|
-
|
|
22104
|
-
|
|
22105
|
-
|
|
22106
|
-
|
|
22107
|
-
|
|
22108
|
-
|
|
22109
|
-
|
|
22110
|
-
|
|
22111
|
-
|
|
22112
|
-
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
|
|
22119
|
-
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
|
|
22123
|
-
|
|
22124
|
-
|
|
22125
|
-
|
|
22126
|
-
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22154
|
+
nextRow.splice(cIdx, 0, hMergeCell);
|
|
22155
|
+
}
|
|
22156
|
+
});
|
|
22157
|
+
});
|
|
22158
|
+
// STEP 4: Build table rows/cells
|
|
22159
|
+
arrTabRows.forEach((cells, rIdx)=>{
|
|
22160
|
+
var _slideItemObj_options;
|
|
22161
|
+
const itemOpts = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
|
|
22162
|
+
// A: Table Height provided without rowH? Then distribute rows
|
|
22163
|
+
let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
|
|
22164
|
+
;
|
|
22165
|
+
// `rowH` is either one value for every row or a per-row array; `inch2Emu` resolves inches, EMU and unit-suffixed strings alike
|
|
22166
|
+
const rowHOpt = Array.isArray(objTabOpts.rowH) ? objTabOpts.rowH[rIdx] : objTabOpts.rowH;
|
|
22167
|
+
const rowHEmu = rowHOpt ? inch2Emu(rowHOpt) : NaN;
|
|
22168
|
+
if (!isNaN(rowHEmu)) intRowH = rowHEmu;
|
|
22169
|
+
else if (itemOpts.cy || itemOpts.h) {
|
|
22170
|
+
intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
|
|
22171
|
+
}
|
|
22172
|
+
// B: Start row
|
|
22173
|
+
strXml += `<a:tr h="${positiveExtent(intRowH)}">`;
|
|
22174
|
+
// C: Loop over each CELL
|
|
22175
|
+
cells.forEach((cellObj)=>{
|
|
22176
|
+
var _ref, _ref1;
|
|
22177
|
+
var _cell_options, _cell_options1, _cell_options2, _cell_options3, _cell__optImp_fill, _cell__optImp, _cell__optImp1;
|
|
22178
|
+
const cell = cellObj;
|
|
22179
|
+
const cellSpanAttrs = {
|
|
22180
|
+
rowSpan: ((_ref = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan) !== null && _ref !== void 0 ? _ref : 0) > 1 ? (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan : undefined,
|
|
22181
|
+
gridSpan: ((_ref1 = (_cell_options2 = cell.options) === null || _cell_options2 === void 0 ? void 0 : _cell_options2.colspan) !== null && _ref1 !== void 0 ? _ref1 : 0) > 1 ? (_cell_options3 = cell.options) === null || _cell_options3 === void 0 ? void 0 : _cell_options3.colspan : undefined,
|
|
22182
|
+
vMerge: cell._vmerge ? 1 : undefined,
|
|
22183
|
+
hMerge: cell._hmerge ? 1 : undefined
|
|
22184
|
+
};
|
|
22185
|
+
let cellSpanAttrStr = Object.keys(cellSpanAttrs).map((k)=>[
|
|
22186
|
+
k,
|
|
22187
|
+
cellSpanAttrs[k]
|
|
22188
|
+
]).filter(([, v])=>!!v).map(([k, v])=>`${String(k)}="${String(v)}"`).join(' ');
|
|
22189
|
+
if (cellSpanAttrStr) cellSpanAttrStr = ' ' + cellSpanAttrStr;
|
|
22190
|
+
// 1: COLSPAN/ROWSPAN: Add dummy cells for any active colspan/rowspan
|
|
22191
|
+
if (cell._hmerge || cell._vmerge) {
|
|
22192
|
+
strXml += `<a:tc${cellSpanAttrStr}><a:tcPr/></a:tc>`;
|
|
22193
|
+
return;
|
|
22194
|
+
}
|
|
22195
|
+
// 2: OPTIONS: Build/set cell options
|
|
22196
|
+
const cellOpts = cell.options || {};
|
|
22197
|
+
cell.options = cellOpts;
|
|
22198
|
+
[
|
|
22199
|
+
'align',
|
|
22200
|
+
'bold',
|
|
22201
|
+
'border',
|
|
22202
|
+
'color',
|
|
22203
|
+
'fill',
|
|
22204
|
+
'fontFace',
|
|
22205
|
+
'fontSize',
|
|
22206
|
+
'lang',
|
|
22207
|
+
'margin',
|
|
22208
|
+
'textDirection',
|
|
22209
|
+
'vert',
|
|
22210
|
+
'underline',
|
|
22211
|
+
'valign'
|
|
22212
|
+
].forEach((name)=>{
|
|
22213
|
+
if (objTabOpts[name] && !cellOpts[name] && cellOpts[name] !== 0) cellOpts[name] = objTabOpts[name];
|
|
22214
|
+
});
|
|
22215
|
+
const cellValign = cellOpts.valign ? ` anchor="${cellOpts.valign.replace(/^c$/i, 'ctr').replace(/^m(id(dle)?)?$/i, 'ctr').replace(/^center$/i, 'ctr').replace(/^top$/i, 't').replace(/^b(tm|ottom)$/i, 'b')}"` : '';
|
|
22216
|
+
// `vert` = Martin-N alias of `textDirection`
|
|
22217
|
+
const cellDir = cellOpts.textDirection || cellOpts.vert;
|
|
22218
|
+
const cellTextDir = cellDir && cellDir !== 'horz' ? ` vert="${cellDir}"` : '';
|
|
22219
|
+
let fillColor = ((_cell__optImp = cell._optImp) === null || _cell__optImp === void 0 ? void 0 : (_cell__optImp_fill = _cell__optImp.fill) === null || _cell__optImp_fill === void 0 ? void 0 : _cell__optImp_fill.color) ? cell._optImp.fill.color : ((_cell__optImp1 = cell._optImp) === null || _cell__optImp1 === void 0 ? void 0 : _cell__optImp1.fill) && typeof cell._optImp.fill === 'string' ? cell._optImp.fill : '';
|
|
22220
|
+
fillColor = fillColor || cellOpts.fill ? cellOpts.fill : '';
|
|
22221
|
+
let cellFill;
|
|
22222
|
+
if (cellOpts._fillRid) {
|
|
22223
|
+
const fillRel = (slide._relsMedia || []).find((rel)=>rel.rId === cellOpts._fillRid);
|
|
22224
|
+
if ((fillRel === null || fillRel === void 0 ? void 0 : fillRel.extn) === 'svg') {
|
|
22225
|
+
var _cellOpts__fillRid;
|
|
22226
|
+
const pngRid = ((_cellOpts__fillRid = cellOpts._fillRid) !== null && _cellOpts__fillRid !== void 0 ? _cellOpts__fillRid : 0) - 1;
|
|
22227
|
+
cellFill = `<a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${pngRid}"><a:extLst><a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}"><asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId${cellOpts._fillRid}"/></a:ext></a:extLst></a:blip><a:stretch><a:fillRect/></a:stretch></a:blipFill>`;
|
|
22130
22228
|
} else {
|
|
22131
|
-
cellFill =
|
|
22229
|
+
cellFill = `<a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${cellOpts._fillRid}"/><a:stretch><a:fillRect/></a:stretch></a:blipFill>`;
|
|
22132
22230
|
}
|
|
22133
|
-
|
|
22134
|
-
|
|
22135
|
-
|
|
22136
|
-
|
|
22137
|
-
|
|
22138
|
-
|
|
22139
|
-
|
|
22140
|
-
|
|
22141
|
-
|
|
22142
|
-
|
|
22143
|
-
|
|
22231
|
+
} else {
|
|
22232
|
+
cellFill = fillColor ? genXmlColorSelection(fillColor) : '';
|
|
22233
|
+
}
|
|
22234
|
+
let cellMargin = cellOpts.margin === 0 || cellOpts.margin ? cellOpts.margin : DEF_CELL_MARGIN_IN;
|
|
22235
|
+
if (!Array.isArray(cellMargin) && typeof cellMargin === 'number') cellMargin = [
|
|
22236
|
+
cellMargin,
|
|
22237
|
+
cellMargin,
|
|
22238
|
+
cellMargin,
|
|
22239
|
+
cellMargin
|
|
22240
|
+
];
|
|
22241
|
+
// Guard against non-number/non-array margins (e.g. object/string) which otherwise yield marL="NaN" and trigger PowerPoint repair
|
|
22242
|
+
if (!Array.isArray(cellMargin)) cellMargin = DEF_CELL_MARGIN_IN;
|
|
22243
|
+
cellMargin = cellMargin.map((v)=>typeof v === 'number' && isFinite(v) ? v : 0);
|
|
22244
|
+
/** FUTURE: DEPRECATED:
|
|
22144
22245
|
* - Backwards-Compat: Oops! Discovered we were still using points for cell margin before v3.8.0 (UGH!)
|
|
22145
22246
|
* - We cant introduce a breaking change before v4.0, so...
|
|
22146
22247
|
*/ const cellMarginXml = cellMargin[0] >= 1 ? ` marL="${valToPts(cellMargin[3])}" marR="${valToPts(cellMargin[1])}" marT="${valToPts(cellMargin[0])}" marB="${valToPts(cellMargin[2])}"` : ` marL="${inch2Emu(cellMargin[3])}" marR="${inch2Emu(cellMargin[1])}" marT="${inch2Emu(cellMargin[0])}" marB="${inch2Emu(cellMargin[2])}"`;
|
|
22147
|
-
|
|
22148
|
-
|
|
22149
|
-
|
|
22150
|
-
|
|
22151
|
-
|
|
22152
|
-
|
|
22153
|
-
|
|
22154
|
-
|
|
22155
|
-
|
|
22156
|
-
|
|
22157
|
-
|
|
22158
|
-
|
|
22159
|
-
|
|
22160
|
-
|
|
22161
|
-
|
|
22162
|
-
|
|
22163
|
-
|
|
22164
|
-
|
|
22165
|
-
|
|
22166
|
-
|
|
22167
|
-
|
|
22168
|
-
|
|
22169
|
-
|
|
22170
|
-
|
|
22171
|
-
|
|
22172
|
-
|
|
22173
|
-
|
|
22174
|
-
|
|
22175
|
-
|
|
22176
|
-
|
|
22177
|
-
|
|
22178
|
-
|
|
22179
|
-
|
|
22180
|
-
|
|
22181
|
-
|
|
22182
|
-
|
|
22183
|
-
|
|
22184
|
-
|
|
22185
|
-
|
|
22186
|
-
|
|
22187
|
-
|
|
22188
|
-
|
|
22189
|
-
|
|
22190
|
-
|
|
22191
|
-
|
|
22192
|
-
|
|
22193
|
-
|
|
22194
|
-
|
|
22195
|
-
|
|
22196
|
-
|
|
22197
|
-
|
|
22198
|
-
|
|
22199
|
-
|
|
22200
|
-
|
|
22201
|
-
|
|
22202
|
-
});
|
|
22203
|
-
// D: Complete row
|
|
22204
|
-
strXml += '</a:tr>';
|
|
22248
|
+
const cellOverflow = cellOpts.horzOverflow === 'overflow' || cellOpts.horzOverflow === 'clip' ? ` horzOverflow="${cellOpts.horzOverflow}"` : '';
|
|
22249
|
+
const cellAnchorCtr = cellOpts.anchorCtr === true ? ' anchorCtr="1"' : '';
|
|
22250
|
+
// 4: Set CELL content and properties ==================================
|
|
22251
|
+
strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}${cellAnchorCtr}${cellOverflow}>`;
|
|
22252
|
+
// strXml += `<a:tc${cellColspan}${cellRowspan}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`
|
|
22253
|
+
// FIXME: 20200525: ^^^
|
|
22254
|
+
// <a:tcPr marL="38100" marR="38100" marT="38100" marB="38100" vert="vert270">
|
|
22255
|
+
// 5: Borders: Add any borders
|
|
22256
|
+
if (cellOpts.border && Array.isArray(cellOpts.border)) {
|
|
22257
|
+
const border = cellOpts.border;
|
|
22258
|
+
[
|
|
22259
|
+
{
|
|
22260
|
+
idx: 3,
|
|
22261
|
+
name: 'lnL'
|
|
22262
|
+
},
|
|
22263
|
+
{
|
|
22264
|
+
idx: 1,
|
|
22265
|
+
name: 'lnR'
|
|
22266
|
+
},
|
|
22267
|
+
{
|
|
22268
|
+
idx: 0,
|
|
22269
|
+
name: 'lnT'
|
|
22270
|
+
},
|
|
22271
|
+
{
|
|
22272
|
+
idx: 2,
|
|
22273
|
+
name: 'lnB'
|
|
22274
|
+
}
|
|
22275
|
+
].forEach((obj)=>{
|
|
22276
|
+
strXml += genXmlCellBorder(obj.name, border[obj.idx]);
|
|
22277
|
+
});
|
|
22278
|
+
}
|
|
22279
|
+
// 5b: Diagonals follow the four edges in the CT_TableCellProperties sequence, and are
|
|
22280
|
+
// written only when asked for - unlike the edges, which are always emitted as a set
|
|
22281
|
+
if (cellOpts.borderDiagonalDown) strXml += genXmlCellBorder('lnTlToBr', cellOpts.borderDiagonalDown);
|
|
22282
|
+
if (cellOpts.borderDiagonalUp) strXml += genXmlCellBorder('lnBlToTr', cellOpts.borderDiagonalUp);
|
|
22283
|
+
// 5c: `a:cell3D` follows the diagonals and precedes the fill
|
|
22284
|
+
if (cellOpts.cell3D) {
|
|
22285
|
+
var _cell3D_bevel;
|
|
22286
|
+
var _cell3D_lightRig;
|
|
22287
|
+
const cell3D = cellOpts.cell3D;
|
|
22288
|
+
const bevel = (_cell3D_bevel = cell3D.bevel) !== null && _cell3D_bevel !== void 0 ? _cell3D_bevel : {};
|
|
22289
|
+
let bevelAttrs = '';
|
|
22290
|
+
if (typeof bevel.width === 'number' && isFinite(bevel.width) && bevel.width >= 0) bevelAttrs += ` w="${inch2Emu(bevel.width)}"`;
|
|
22291
|
+
if (typeof bevel.height === 'number' && isFinite(bevel.height) && bevel.height >= 0) bevelAttrs += ` h="${inch2Emu(bevel.height)}"`;
|
|
22292
|
+
if (bevel.preset) bevelAttrs += ` prst="${bevel.preset}"`;
|
|
22293
|
+
// `rig` and `dir` are both required on CT_LightRig, so a partial rig is dropped rather
|
|
22294
|
+
// than emitted as an element PowerPoint would refuse to open
|
|
22295
|
+
const lightRig = ((_cell3D_lightRig = cell3D.lightRig) === null || _cell3D_lightRig === void 0 ? void 0 : _cell3D_lightRig.rig) && cell3D.lightRig.dir ? `<a:lightRig rig="${cell3D.lightRig.rig}" dir="${cell3D.lightRig.dir}"/>` : '';
|
|
22296
|
+
// `a:bevel` is required by the schema, so it is always written
|
|
22297
|
+
strXml += `<a:cell3D${cell3D.material ? ` prstMaterial="${cell3D.material}"` : ''}><a:bevel${bevelAttrs}/>${lightRig}</a:cell3D>`;
|
|
22298
|
+
}
|
|
22299
|
+
// 6: Close cell Properties & Cell
|
|
22300
|
+
strXml += cellFill;
|
|
22301
|
+
strXml += ' </a:tcPr>';
|
|
22302
|
+
strXml += ' </a:tc>';
|
|
22205
22303
|
});
|
|
22206
|
-
//
|
|
22207
|
-
strXml += '
|
|
22208
|
-
|
|
22209
|
-
|
|
22210
|
-
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
|
|
22304
|
+
// D: Complete row
|
|
22305
|
+
strXml += '</a:tr>';
|
|
22306
|
+
});
|
|
22307
|
+
// STEP 5: Complete table
|
|
22308
|
+
strXml += ' </a:tbl>';
|
|
22309
|
+
strXml += ' </a:graphicData>';
|
|
22310
|
+
strXml += ' </a:graphic>';
|
|
22311
|
+
strXml += '</p:graphicFrame>';
|
|
22312
|
+
// STEP 6: Set table XML
|
|
22313
|
+
strSlideXml += strXml;
|
|
22314
|
+
break;
|
|
22315
|
+
}
|
|
22316
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"):
|
|
22317
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder"):
|
|
22318
|
+
{
|
|
22319
|
+
var _slideItemObj_options_line2, _slideItemObj_options_styleRef;
|
|
22320
|
+
const isConnector = !!((_slideItemObj_options_line2 = slideItemObj.options.line) === null || _slideItemObj_options_line2 === void 0 ? void 0 : _slideItemObj_options_line2.isConnector);
|
|
22321
|
+
// Lines can have zero cy, but text should not
|
|
22322
|
+
if (!slideItemObj.options.line && cy === 0) cy = (/* inlined export .EMU */914400) * 0.3;
|
|
22323
|
+
// Text margins are applied in addTextDefinition → `_bodyProp` (TRBL)
|
|
22324
|
+
// A: Start SHAPE / CONNECTOR ============================================
|
|
22325
|
+
if (isConnector) {
|
|
22326
|
+
var _slideItemObj_options_objectName1, _ref, _ref1;
|
|
22327
|
+
var _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5, _slideItemObj_options_line6;
|
|
22328
|
+
strSlideXml += '<p:cxnSp>';
|
|
22329
|
+
strSlideXml += `<p:nvCxnSpPr>${genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName1 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName1 !== void 0 ? _slideItemObj_options_objectName1 : ''), slideItemObj.options)}`;
|
|
22330
|
+
const cxnLocks = genXmlLocks('a:cxnSpLocks', slideItemObj.options.lock);
|
|
22331
|
+
const stId = (_slideItemObj_options_line3 = slideItemObj.options.line) === null || _slideItemObj_options_line3 === void 0 ? void 0 : _slideItemObj_options_line3.sourceId;
|
|
22332
|
+
const endId = (_slideItemObj_options_line4 = slideItemObj.options.line) === null || _slideItemObj_options_line4 === void 0 ? void 0 : _slideItemObj_options_line4.targetId;
|
|
22333
|
+
strSlideXml += `<p:cNvCxnSpPr>${cxnLocks}`;
|
|
22334
|
+
if (stId != null) strSlideXml += `<a:stCxn id="${stId}" idx="${(_ref = (_slideItemObj_options_line5 = slideItemObj.options.line) === null || _slideItemObj_options_line5 === void 0 ? void 0 : _slideItemObj_options_line5.sourceAnchorPos) !== null && _ref !== void 0 ? _ref : 0}"/>`;
|
|
22335
|
+
if (endId != null) strSlideXml += `<a:endCxn id="${endId}" idx="${(_ref1 = (_slideItemObj_options_line6 = slideItemObj.options.line) === null || _slideItemObj_options_line6 === void 0 ? void 0 : _slideItemObj_options_line6.targetAnchorPos) !== null && _ref1 !== void 0 ? _ref1 : 0}"/>`;
|
|
22336
|
+
strSlideXml += '</p:cNvCxnSpPr>';
|
|
22337
|
+
strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
|
|
22338
|
+
nvPrModIdExt(slideItemObj.options.modId)
|
|
22339
|
+
])}</p:nvCxnSpPr><p:spPr>`;
|
|
22340
|
+
} else {
|
|
22341
|
+
var _slideItemObj_options_objectName2;
|
|
22342
|
+
var _slideItemObj_options3;
|
|
22343
|
+
strSlideXml += '<p:sp>';
|
|
22344
|
+
// B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
|
|
22345
|
+
strSlideXml += '<p:nvSpPr>' + genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName2 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName2 !== void 0 ? _slideItemObj_options_objectName2 : ''), slideItemObj.options, '', genXmlCNvPrLinks(slideItemObj.options.hyperlink, slideItemObj.options.hyperlinkHover));
|
|
22346
|
+
// PowerPoint math zones are authored in text boxes; force txBox when OMML is present
|
|
22347
|
+
const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
|
|
22348
|
+
strSlideXml += genXmlCNvSpPr(slide_object_spread_props(xml_slide_object_spread({}, slideItemObj.options), {
|
|
22349
|
+
isTextBox: useTxBox
|
|
22350
|
+
}));
|
|
22351
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
|
|
22352
|
+
nvPrModIdExt(slideItemObj.options.modId)
|
|
22353
|
+
]);
|
|
22354
|
+
strSlideXml += '</p:nvSpPr><p:spPr>';
|
|
22214
22355
|
}
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
{
|
|
22218
|
-
|
|
22219
|
-
|
|
22220
|
-
|
|
22221
|
-
|
|
22222
|
-
|
|
22223
|
-
//
|
|
22224
|
-
|
|
22225
|
-
|
|
22226
|
-
|
|
22227
|
-
|
|
22228
|
-
|
|
22229
|
-
|
|
22230
|
-
|
|
22231
|
-
|
|
22232
|
-
|
|
22233
|
-
if (stId != null) strSlideXml += `<a:stCxn id="${stId}" idx="${(_ref = (_slideItemObj_options_line5 = slideItemObj.options.line) === null || _slideItemObj_options_line5 === void 0 ? void 0 : _slideItemObj_options_line5.sourceAnchorPos) !== null && _ref !== void 0 ? _ref : 0}"/>`;
|
|
22234
|
-
if (endId != null) strSlideXml += `<a:endCxn id="${endId}" idx="${(_ref1 = (_slideItemObj_options_line6 = slideItemObj.options.line) === null || _slideItemObj_options_line6 === void 0 ? void 0 : _slideItemObj_options_line6.targetAnchorPos) !== null && _ref1 !== void 0 ? _ref1 : 0}"/>`;
|
|
22235
|
-
strSlideXml += '</p:cNvCxnSpPr>';
|
|
22236
|
-
strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
|
|
22237
|
-
nvPrModIdExt(slideItemObj.options.modId)
|
|
22238
|
-
])}</p:nvCxnSpPr><p:spPr>`;
|
|
22239
|
-
} else {
|
|
22240
|
-
var _slideItemObj_options_objectName2;
|
|
22241
|
-
var _slideItemObj_options3;
|
|
22242
|
-
strSlideXml += '<p:sp>';
|
|
22243
|
-
// B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
|
|
22244
|
-
strSlideXml += '<p:nvSpPr>' + genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName2 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName2 !== void 0 ? _slideItemObj_options_objectName2 : ''), slideItemObj.options, '', genXmlCNvPrLinks(slideItemObj.options.hyperlink, slideItemObj.options.hyperlinkHover));
|
|
22245
|
-
// PowerPoint math zones are authored in text boxes; force txBox when OMML is present
|
|
22246
|
-
const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
|
|
22247
|
-
strSlideXml += genXmlCNvSpPr(slide_object_spread_props(xml_slide_object_spread({}, slideItemObj.options), {
|
|
22248
|
-
isTextBox: useTxBox
|
|
22249
|
-
}));
|
|
22250
|
-
strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
|
|
22251
|
-
nvPrModIdExt(slideItemObj.options.modId)
|
|
22252
|
-
]);
|
|
22253
|
-
strSlideXml += '</p:nvSpPr><p:spPr>';
|
|
22254
|
-
}
|
|
22255
|
-
strSlideXml += `<a:xfrm${locationAttr}>`;
|
|
22256
|
-
strSlideXml += `<a:off x="${x}" y="${y}"/>`;
|
|
22257
|
-
strSlideXml += `<a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22258
|
-
if (!isConnector && slideItemObj.shape === 'custGeom') {
|
|
22259
|
-
strSlideXml += genCustGeomXml(slideItemObj, cx, cy, slide);
|
|
22260
|
-
} else {
|
|
22261
|
-
var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line7;
|
|
22262
|
-
strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
|
|
22263
|
-
// `rectRadius` adj is a 0..50000 fraction of the shorter side; clamp out-of-range / zero-extent results.
|
|
22264
|
-
// `round2SameRect` uses two handles (`adj1` top corners, `adj2` bottom corners) — single `adj` is ignored.
|
|
22265
|
-
if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius)) {
|
|
22266
|
-
const minDim = Math.min(cx, cy);
|
|
22267
|
-
const rawAdj = minDim > 0 ? slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / minDim : slideItemObj.options.rectRadius > 0 ? 50000 : 0;
|
|
22268
|
-
const adjVal = clampInt(rawAdj, 0, 50000);
|
|
22269
|
-
if (slideItemObj.shape === core_enums_SHAPE_TYPE.ROUND_2_SAME_RECTANGLE) {
|
|
22270
|
-
strSlideXml += `<a:gd name="adj1" fmla="val ${adjVal}"/><a:gd name="adj2" fmla="val 0"/>`;
|
|
22271
|
-
} else {
|
|
22272
|
-
strSlideXml += `<a:gd name="adj" fmla="val ${adjVal}"/>`;
|
|
22273
|
-
}
|
|
22274
|
-
} else if (slideItemObj.options.angleRange) {
|
|
22275
|
-
for(let i = 0; i < 2; i++){
|
|
22276
|
-
const angle = slideItemObj.options.angleRange[i];
|
|
22277
|
-
strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${convertRotationDegrees(angle)}" />`;
|
|
22278
|
-
}
|
|
22279
|
-
if (slideItemObj.options.arcThicknessRatio) {
|
|
22280
|
-
strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
|
|
22281
|
-
}
|
|
22356
|
+
strSlideXml += `<a:xfrm${locationAttr}>`;
|
|
22357
|
+
strSlideXml += `<a:off x="${x}" y="${y}"/>`;
|
|
22358
|
+
strSlideXml += `<a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22359
|
+
if (!isConnector && slideItemObj.shape === 'custGeom') {
|
|
22360
|
+
strSlideXml += genCustGeomXml(slideItemObj, cx, cy, slide);
|
|
22361
|
+
} else {
|
|
22362
|
+
var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line7;
|
|
22363
|
+
strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
|
|
22364
|
+
// `rectRadius` adj is a 0..50000 fraction of the shorter side; clamp out-of-range / zero-extent results.
|
|
22365
|
+
// `round2SameRect` uses two handles (`adj1` top corners, `adj2` bottom corners) — single `adj` is ignored.
|
|
22366
|
+
if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius)) {
|
|
22367
|
+
const minDim = Math.min(cx, cy);
|
|
22368
|
+
const rawAdj = minDim > 0 ? slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / minDim : slideItemObj.options.rectRadius > 0 ? 50000 : 0;
|
|
22369
|
+
const adjVal = clampInt(rawAdj, 0, 50000);
|
|
22370
|
+
if (slideItemObj.shape === core_enums_SHAPE_TYPE.ROUND_2_SAME_RECTANGLE) {
|
|
22371
|
+
strSlideXml += `<a:gd name="adj1" fmla="val ${adjVal}"/><a:gd name="adj2" fmla="val 0"/>`;
|
|
22372
|
+
} else {
|
|
22373
|
+
strSlideXml += `<a:gd name="adj" fmla="val ${adjVal}"/>`;
|
|
22282
22374
|
}
|
|
22283
|
-
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
})
|
|
22375
|
+
} else if (slideItemObj.options.angleRange) {
|
|
22376
|
+
for(let i = 0; i < 2; i++){
|
|
22377
|
+
const angle = slideItemObj.options.angleRange[i];
|
|
22378
|
+
strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${convertRotationDegrees(angle)}" />`;
|
|
22379
|
+
}
|
|
22380
|
+
if (slideItemObj.options.arcThicknessRatio) {
|
|
22381
|
+
strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
|
|
22287
22382
|
}
|
|
22288
|
-
strSlideXml += '</a:avLst></a:prstGeom>';
|
|
22289
22383
|
}
|
|
22290
|
-
|
|
22291
|
-
|
|
22292
|
-
|
|
22293
|
-
|
|
22294
|
-
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
|
|
22298
|
-
|
|
22299
|
-
|
|
22300
|
-
|
|
22301
|
-
|
|
22302
|
-
|
|
22303
|
-
|
|
22304
|
-
|
|
22305
|
-
|
|
22306
|
-
|
|
22307
|
-
|
|
22308
|
-
|
|
22309
|
-
|
|
22310
|
-
|
|
22311
|
-
|
|
22312
|
-
|
|
22313
|
-
|
|
22314
|
-
|
|
22315
|
-
|
|
22316
|
-
|
|
22317
|
-
|
|
22318
|
-
|
|
22384
|
+
if (isConnector && ((_slideItemObj_options_line7 = slideItemObj.options.line) === null || _slideItemObj_options_line7 === void 0 ? void 0 : (_slideItemObj_options_line_curveadjust = _slideItemObj_options_line7.curveadjust) === null || _slideItemObj_options_line_curveadjust === void 0 ? void 0 : _slideItemObj_options_line_curveadjust.length)) {
|
|
22385
|
+
slideItemObj.options.line.curveadjust.forEach((adj, i)=>{
|
|
22386
|
+
strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${Math.round(Number(adj))}"/>`;
|
|
22387
|
+
});
|
|
22388
|
+
}
|
|
22389
|
+
strSlideXml += '</a:avLst></a:prstGeom>';
|
|
22390
|
+
}
|
|
22391
|
+
// Option: FILL
|
|
22392
|
+
// With a fillRef and no explicit fill, omit the fill element so the theme inherits
|
|
22393
|
+
if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
|
|
22394
|
+
else if (!((_slideItemObj_options_styleRef = slideItemObj.options.styleRef) === null || _slideItemObj_options_styleRef === void 0 ? void 0 : _slideItemObj_options_styleRef.fill)) strSlideXml += '<a:noFill/>';
|
|
22395
|
+
// shape Type: LINE: line color
|
|
22396
|
+
if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
|
|
22397
|
+
// EFFECTS: shadow / glow / softEdge / reflection / fillOverlay / blur
|
|
22398
|
+
// REF: @see http://officeopenxml.com/drwSp-effects.php
|
|
22399
|
+
strSlideXml += genXmlEffectLst({
|
|
22400
|
+
shadow: slideItemObj.options.shadow,
|
|
22401
|
+
glow: slideItemObj.options.glow,
|
|
22402
|
+
softEdge: slideItemObj.options.softEdge,
|
|
22403
|
+
reflection: slideItemObj.options.reflection,
|
|
22404
|
+
blur: slideItemObj.options.blur,
|
|
22405
|
+
fillOverlay: slideItemObj.options.fillOverlay,
|
|
22406
|
+
effectDag: slideItemObj.options.effectDag
|
|
22407
|
+
});
|
|
22408
|
+
// B: Close shape Properties
|
|
22409
|
+
strSlideXml += '</p:spPr>';
|
|
22410
|
+
// `p:style` follows `p:spPr` in CT_Shape / CT_Connector
|
|
22411
|
+
strSlideXml += genXmlShapeStyle(slideItemObj.options.styleRef);
|
|
22412
|
+
if (isConnector) {
|
|
22413
|
+
// Connectors have no text body
|
|
22414
|
+
strSlideXml += '</p:cxnSp>';
|
|
22415
|
+
} else {
|
|
22416
|
+
// C: Add formatted text (text body "bodyPr")
|
|
22417
|
+
strSlideXml += genXmlTextBody(slideItemObj);
|
|
22418
|
+
// LAST: Close SHAPE =======================================================
|
|
22419
|
+
strSlideXml += '</p:sp>';
|
|
22420
|
+
if (slideItemObj._fallbackImage) {
|
|
22421
|
+
const fallbackXml = renderObject(slideItemObj._fallbackImage, idx);
|
|
22422
|
+
strSlideXml = `<mc:AlternateContent><mc:Choice Requires="a14">${strSlideXml}</mc:Choice><mc:Fallback>${fallbackXml}</mc:Fallback></mc:AlternateContent>`;
|
|
22319
22423
|
}
|
|
22320
|
-
break;
|
|
22321
22424
|
}
|
|
22322
|
-
|
|
22425
|
+
break;
|
|
22426
|
+
}
|
|
22427
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"):
|
|
22428
|
+
{
|
|
22323
22429
|
var _slideItemObj_options_objectName3;
|
|
22324
22430
|
var _slideItemObj_options_lock;
|
|
22325
22431
|
strSlideXml += '<p:pic>';
|
|
@@ -22348,7 +22454,16 @@ function slideObjectToXml(slide) {
|
|
|
22348
22454
|
strSlideXml += genXmlBlipEffects(slideItemObj.options.transparency, slideItemObj.options.alphaEffects, slideItemObj.options.recolor);
|
|
22349
22455
|
strSlideXml += '</a:blip>';
|
|
22350
22456
|
}
|
|
22351
|
-
|
|
22457
|
+
const crop = slideItemObj.options.crop;
|
|
22458
|
+
const hasCrop = crop && (typeof crop.l === 'number' && Number.isFinite(crop.l) || typeof crop.t === 'number' && Number.isFinite(crop.t) || typeof crop.r === 'number' && Number.isFinite(crop.r) || typeof crop.b === 'number' && Number.isFinite(crop.b));
|
|
22459
|
+
if (hasCrop) {
|
|
22460
|
+
// ECMA-376 §5.1.10.55 CT_RelativeRect: 0..100% -> 0..100000 in 1000ths of a percent; keeps exact box w/h on <a:ext>.
|
|
22461
|
+
const lAttr = typeof crop.l === 'number' && Number.isFinite(crop.l) ? ` l="${clampInt(Math.round(crop.l * 1000), 0, 100000)}"` : '';
|
|
22462
|
+
const tAttr = typeof crop.t === 'number' && Number.isFinite(crop.t) ? ` t="${clampInt(Math.round(crop.t * 1000), 0, 100000)}"` : '';
|
|
22463
|
+
const rAttr = typeof crop.r === 'number' && Number.isFinite(crop.r) ? ` r="${clampInt(Math.round(crop.r * 1000), 0, 100000)}"` : '';
|
|
22464
|
+
const bAttr = typeof crop.b === 'number' && Number.isFinite(crop.b) ? ` b="${clampInt(Math.round(crop.b * 1000), 0, 100000)}"` : '';
|
|
22465
|
+
strSlideXml += `<a:srcRect${lAttr}${tAttr}${rAttr}${bAttr}/><a:stretch><a:fillRect/></a:stretch>`;
|
|
22466
|
+
} else if (sizing === null || sizing === void 0 ? void 0 : sizing.type) {
|
|
22352
22467
|
const boxW = sizing.w ? getSmartParseNumber(sizing.w, 'X', slide._presLayout) : cx;
|
|
22353
22468
|
const boxH = sizing.h ? getSmartParseNumber(sizing.h, 'Y', slide._presLayout) : cy;
|
|
22354
22469
|
const boxX = getSmartParseNumber(sizing.x || 0, 'X', slide._presLayout);
|
|
@@ -22421,237 +22536,239 @@ function slideObjectToXml(slide) {
|
|
|
22421
22536
|
strSlideXml += genXmlShapeStyle(slideItemObj.options.styleRef);
|
|
22422
22537
|
strSlideXml += '</p:pic>';
|
|
22423
22538
|
break;
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
}
|
|
22439
|
-
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:wavAudioFile r:embed="rId${slideItemObj.mediaRid}"${slideItemObj.options.objectName ? ` name="${slideItemObj.options.objectName}"` : ''}/>`);
|
|
22440
|
-
}
|
|
22441
|
-
strSlideXml += ' </p:nvPicPr>';
|
|
22442
|
-
strSlideXml += ` <p:blipFill><a:blip r:embed="rId${coverRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
|
|
22443
|
-
strSlideXml += ' <p:spPr>';
|
|
22444
|
-
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22445
|
-
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22446
|
-
strSlideXml += ' </p:spPr>';
|
|
22447
|
-
strSlideXml += '</p:pic>';
|
|
22448
|
-
} else if (slideItemObj.mtype === 'online') {
|
|
22449
|
-
var _slideItemObj_mediaRid;
|
|
22450
|
-
const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
|
|
22451
|
-
strSlideXml += '<p:pic>';
|
|
22452
|
-
strSlideXml += ' <p:nvPicPr>';
|
|
22453
|
-
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"/>`;
|
|
22454
|
-
strSlideXml += ' <p:cNvPicPr/>';
|
|
22455
|
-
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"${contentType}/>`);
|
|
22456
|
-
strSlideXml += ' </p:nvPicPr>';
|
|
22457
|
-
// NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
|
|
22458
|
-
strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid !== void 0 ? _slideItemObj_mediaRid : 0) + 1}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
|
|
22459
|
-
strSlideXml += ' <p:spPr>';
|
|
22460
|
-
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22461
|
-
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22462
|
-
strSlideXml += ' </p:spPr>';
|
|
22463
|
-
strSlideXml += '</p:pic>';
|
|
22539
|
+
}
|
|
22540
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.media */"media"):
|
|
22541
|
+
if (slideItemObj.mtype === 'audioCd' || slideItemObj.mtype === 'wav') {
|
|
22542
|
+
var _slideItemObj__coverRid;
|
|
22543
|
+
// EG_Media is a choice, so these carry exactly one media element and no `p14:media`:
|
|
22544
|
+
// `a:audioCd` references the listener's drive and `a:wavAudioFile` is the legacy
|
|
22545
|
+
// embedded-WAV element, so neither has an embedded media part to point at
|
|
22546
|
+
const coverRid = (_slideItemObj__coverRid = slideItemObj._coverRid) !== null && _slideItemObj__coverRid !== void 0 ? _slideItemObj__coverRid : 2;
|
|
22547
|
+
strSlideXml += '<p:pic>';
|
|
22548
|
+
strSlideXml += ' <p:nvPicPr>';
|
|
22549
|
+
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
|
|
22550
|
+
strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
|
|
22551
|
+
if (slideItemObj.mtype === 'audioCd') {
|
|
22552
|
+
const cd = slideItemObj.options.audioCd;
|
|
22553
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:audioCd>${genXmlAudioCdTime('a:st', cd === null || cd === void 0 ? void 0 : cd.start)}${genXmlAudioCdTime('a:end', cd === null || cd === void 0 ? void 0 : cd.end)}</a:audioCd>`);
|
|
22464
22554
|
} else {
|
|
22465
|
-
|
|
22466
|
-
// ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
|
|
22467
|
-
const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
|
|
22468
|
-
const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
|
|
22469
|
-
strSlideXml += '<p:pic>';
|
|
22470
|
-
strSlideXml += ' <p:nvPicPr>';
|
|
22471
|
-
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
|
|
22472
|
-
strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
|
|
22473
|
-
const mediaExtras = genXmlMediaExtras(slideItemObj.options);
|
|
22474
|
-
const mediaExt = '<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">' + (mediaExtras ? ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid1 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid1 !== void 0 ? _slideItemObj_mediaRid1 : 0) + 1}">${mediaExtras} </p14:media>` : ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid2 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid2 !== void 0 ? _slideItemObj_mediaRid2 : 0) + 1}"/>`) + '</p:ext>';
|
|
22475
|
-
const narrationExt = slideItemObj.options.isNarration ? '<p:ext uri="{42D2F446-02D8-4167-A562-619A0277C38B}"><p15:isNarration xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main" val="1"/></p:ext>' : '';
|
|
22476
|
-
strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"${contentType}/>`, narrationExt ? [
|
|
22477
|
-
mediaExt,
|
|
22478
|
-
narrationExt
|
|
22479
|
-
] : [
|
|
22480
|
-
mediaExt
|
|
22481
|
-
]);
|
|
22482
|
-
strSlideXml += ' </p:nvPicPr>';
|
|
22483
|
-
strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid3 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid3 !== void 0 ? _slideItemObj_mediaRid3 : 0) + 2}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
|
|
22484
|
-
strSlideXml += ' <p:spPr>';
|
|
22485
|
-
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22486
|
-
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22487
|
-
strSlideXml += ' </p:spPr>';
|
|
22488
|
-
strSlideXml += '</p:pic>';
|
|
22555
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:wavAudioFile r:embed="rId${slideItemObj.mediaRid}"${slideItemObj.options.objectName ? ` name="${slideItemObj.options.objectName}"` : ''}/>`);
|
|
22489
22556
|
}
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
|
|
22494
|
-
|
|
22495
|
-
|
|
22496
|
-
|
|
22497
|
-
|
|
22498
|
-
|
|
22499
|
-
|
|
22500
|
-
|
|
22501
|
-
|
|
22502
|
-
|
|
22503
|
-
|
|
22504
|
-
|
|
22505
|
-
|
|
22506
|
-
|
|
22507
|
-
|
|
22508
|
-
|
|
22509
|
-
|
|
22510
|
-
|
|
22511
|
-
|
|
22512
|
-
|
|
22513
|
-
|
|
22514
|
-
|
|
22515
|
-
|
|
22516
|
-
|
|
22517
|
-
|
|
22518
|
-
|
|
22519
|
-
|
|
22520
|
-
|
|
22521
|
-
|
|
22522
|
-
|
|
22523
|
-
|
|
22524
|
-
|
|
22525
|
-
|
|
22526
|
-
|
|
22527
|
-
|
|
22528
|
-
|
|
22529
|
-
|
|
22530
|
-
|
|
22531
|
-
|
|
22532
|
-
|
|
22533
|
-
|
|
22534
|
-
|
|
22535
|
-
|
|
22536
|
-
|
|
22537
|
-
|
|
22538
|
-
|
|
22539
|
-
|
|
22540
|
-
|
|
22541
|
-
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
22546
|
-
|
|
22547
|
-
|
|
22548
|
-
|
|
22549
|
-
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22570
|
-
|
|
22571
|
-
|
|
22572
|
-
|
|
22573
|
-
|
|
22574
|
-
|
|
22575
|
-
|
|
22576
|
-
|
|
22577
|
-
locationAttr,
|
|
22578
|
-
coverRid: (_slideItemObj_coverRid = slideItemObj.coverRid) !== null && _slideItemObj_coverRid !== void 0 ? _slideItemObj_coverRid : 0
|
|
22579
|
-
});
|
|
22580
|
-
break;
|
|
22581
|
-
}
|
|
22582
|
-
case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
|
|
22583
|
-
{
|
|
22584
|
-
var _slideItemObj_options_objectName4;
|
|
22585
|
-
var _slideItemObj_options4;
|
|
22586
|
-
const chartType = (_slideItemObj_options4 = slideItemObj.options) === null || _slideItemObj_options4 === void 0 ? void 0 : _slideItemObj_options4._type;
|
|
22587
|
-
const isChartex = isChartexType(chartType);
|
|
22588
|
-
const graphicDataUri = isChartex ? OOXML_CHARTEX.ns : 'http://schemas.openxmlformats.org/drawingml/2006/chart';
|
|
22589
|
-
const chartRef = isChartex ? `<cx:chart xmlns:cx="${OOXML_CHARTEX.ns}" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId${slideItemObj.chartRid}"/>` : `<c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
|
|
22590
|
-
const chartLocks = genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock);
|
|
22591
|
-
let frameXml = '<p:graphicFrame>';
|
|
22592
|
-
frameXml += ' <p:nvGraphicFramePr>';
|
|
22593
|
-
frameXml += genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName4 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName4 !== void 0 ? _slideItemObj_options_objectName4 : ''), slideItemObj.options, slideItemObj.options.altText || '');
|
|
22594
|
-
frameXml += chartLocks ? ` <p:cNvGraphicFramePr>${chartLocks}</p:cNvGraphicFramePr>` : ' <p:cNvGraphicFramePr/>';
|
|
22595
|
-
frameXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
|
|
22596
|
-
nvPrModIdExt(slideItemObj.options.modId)
|
|
22597
|
-
]);
|
|
22598
|
-
frameXml += ' </p:nvGraphicFramePr>';
|
|
22599
|
-
frameXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
|
|
22600
|
-
frameXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
|
|
22601
|
-
frameXml += ` <a:graphicData uri="${graphicDataUri}">`;
|
|
22602
|
-
frameXml += ` ${chartRef}`;
|
|
22603
|
-
frameXml += ' </a:graphicData>';
|
|
22604
|
-
frameXml += ' </a:graphic>';
|
|
22605
|
-
frameXml += '</p:graphicFrame>';
|
|
22606
|
-
// A chartex frame replaces a standard graphic frame, so MS-PPTX 2.2 requires it be offered
|
|
22607
|
-
// through `mc:AlternateContent`. PowerPoint's own fallback is a rendered preview image, which
|
|
22608
|
-
// cannot be produced here - a locked text shape carrying the same message is the honest
|
|
22609
|
-
// equivalent for a consumer that does not understand the chartex namespace.
|
|
22610
|
-
strSlideXml += isChartex ? `<mc:AlternateContent xmlns:mc="${MC_NS}">` + `<mc:Choice xmlns:cx1="${chartExRequiresNs(chartType)}" Requires="cx1">` + frameXml + '</mc:Choice>' + `<mc:Fallback>${genXmlChartExFallback(shapeId, slideItemObj, {
|
|
22611
|
-
x,
|
|
22612
|
-
y,
|
|
22613
|
-
cx,
|
|
22614
|
-
cy
|
|
22615
|
-
})}</mc:Fallback>` + '</mc:AlternateContent>' : frameXml;
|
|
22616
|
-
break;
|
|
22557
|
+
strSlideXml += ' </p:nvPicPr>';
|
|
22558
|
+
strSlideXml += ` <p:blipFill><a:blip r:embed="rId${coverRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
|
|
22559
|
+
strSlideXml += ' <p:spPr>';
|
|
22560
|
+
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22561
|
+
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22562
|
+
strSlideXml += ' </p:spPr>';
|
|
22563
|
+
strSlideXml += '</p:pic>';
|
|
22564
|
+
} else if (slideItemObj.mtype === 'online') {
|
|
22565
|
+
var _slideItemObj_mediaRid;
|
|
22566
|
+
const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
|
|
22567
|
+
strSlideXml += '<p:pic>';
|
|
22568
|
+
strSlideXml += ' <p:nvPicPr>';
|
|
22569
|
+
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"/>`;
|
|
22570
|
+
strSlideXml += ' <p:cNvPicPr/>';
|
|
22571
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"${contentType}/>`);
|
|
22572
|
+
strSlideXml += ' </p:nvPicPr>';
|
|
22573
|
+
// NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
|
|
22574
|
+
strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid !== void 0 ? _slideItemObj_mediaRid : 0) + 1}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
|
|
22575
|
+
strSlideXml += ' <p:spPr>';
|
|
22576
|
+
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22577
|
+
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22578
|
+
strSlideXml += ' </p:spPr>';
|
|
22579
|
+
strSlideXml += '</p:pic>';
|
|
22580
|
+
} else {
|
|
22581
|
+
var _slideItemObj_mediaRid1, _slideItemObj_mediaRid2, _slideItemObj_mediaRid3;
|
|
22582
|
+
// ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
|
|
22583
|
+
const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
|
|
22584
|
+
const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
|
|
22585
|
+
strSlideXml += '<p:pic>';
|
|
22586
|
+
strSlideXml += ' <p:nvPicPr>';
|
|
22587
|
+
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
|
|
22588
|
+
strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
|
|
22589
|
+
const mediaExtras = genXmlMediaExtras(slideItemObj.options);
|
|
22590
|
+
const mediaExt = '<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">' + (mediaExtras ? ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid1 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid1 !== void 0 ? _slideItemObj_mediaRid1 : 0) + 1}">${mediaExtras} </p14:media>` : ` <p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId${((_slideItemObj_mediaRid2 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid2 !== void 0 ? _slideItemObj_mediaRid2 : 0) + 1}"/>`) + '</p:ext>';
|
|
22591
|
+
const narrationExt = slideItemObj.options.isNarration ? '<p:ext uri="{42D2F446-02D8-4167-A562-619A0277C38B}"><p15:isNarration xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main" val="1"/></p:ext>' : '';
|
|
22592
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"${contentType}/>`, narrationExt ? [
|
|
22593
|
+
mediaExt,
|
|
22594
|
+
narrationExt
|
|
22595
|
+
] : [
|
|
22596
|
+
mediaExt
|
|
22597
|
+
]);
|
|
22598
|
+
strSlideXml += ' </p:nvPicPr>';
|
|
22599
|
+
strSlideXml += ` <p:blipFill><a:blip r:embed="rId${((_slideItemObj_mediaRid3 = slideItemObj.mediaRid) !== null && _slideItemObj_mediaRid3 !== void 0 ? _slideItemObj_mediaRid3 : 0) + 2}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`; // NOTE: Preview image is required!
|
|
22600
|
+
strSlideXml += ' <p:spPr>';
|
|
22601
|
+
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22602
|
+
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22603
|
+
strSlideXml += ' </p:spPr>';
|
|
22604
|
+
strSlideXml += '</p:pic>';
|
|
22605
|
+
}
|
|
22606
|
+
break;
|
|
22607
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.zoom */"zoom"):
|
|
22608
|
+
{
|
|
22609
|
+
var _slideItemObj_zoomKind, _slideItemObj_zoomRid;
|
|
22610
|
+
// MS-PPTX §2.2.15: mc:AlternateContent { Choice p16:{sldZm|sectionZm|summaryZm} | Fallback }.
|
|
22611
|
+
const zOpts = slideItemObj.options;
|
|
22612
|
+
const zKind = (_slideItemObj_zoomKind = slideItemObj.zoomKind) !== null && _slideItemObj_zoomKind !== void 0 ? _slideItemObj_zoomKind : 'slide';
|
|
22613
|
+
const zRid = (_slideItemObj_zoomRid = slideItemObj.zoomRid) !== null && _slideItemObj_zoomRid !== void 0 ? _slideItemObj_zoomRid : 0;
|
|
22614
|
+
const zId = getUuid('{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}');
|
|
22615
|
+
const zRet = zOpts.returnToParent === false ? '0' : '1';
|
|
22616
|
+
const zShowBg = zOpts.showBg === false ? '0' : '1';
|
|
22617
|
+
const zDur = typeof zOpts.transitionDur === 'number' ? ` p14:transitionDur="${Math.round(zOpts.transitionDur)}"` : '';
|
|
22618
|
+
const zGeom = `<a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom>`;
|
|
22619
|
+
const zFill = `<p:blipFill><a:blip r:embed="rId${zRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
|
|
22620
|
+
const zmPr = `<p166:zmPr id="${zId}" returnToParent="${zRet}" showBg="${zShowBg}" imageType="preview"${zDur}>${zFill}<p:spPr>${zGeom}</p:spPr></p166:zmPr>`;
|
|
22621
|
+
const nsMap = {
|
|
22622
|
+
slide: 'http://schemas.microsoft.com/office/powerpoint/2016/slidezoom',
|
|
22623
|
+
section: 'http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom',
|
|
22624
|
+
summary: 'http://schemas.microsoft.com/office/powerpoint/2016/summaryzoom'
|
|
22625
|
+
};
|
|
22626
|
+
const zNs = nsMap[zKind];
|
|
22627
|
+
strSlideXml += '<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">';
|
|
22628
|
+
strSlideXml += `<mc:Choice Requires="p16" xmlns:p16="${zNs}" xmlns:p166="http://schemas.microsoft.com/office/powerpoint/2016/6/main" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">`;
|
|
22629
|
+
if (zKind === 'slide') {
|
|
22630
|
+
var _slideItemObj_zoomSlideNum;
|
|
22631
|
+
const zSldId = 255 + ((_slideItemObj_zoomSlideNum = slideItemObj.zoomSlideNum) !== null && _slideItemObj_zoomSlideNum !== void 0 ? _slideItemObj_zoomSlideNum : 1);
|
|
22632
|
+
strSlideXml += `<p16:sldZm><p16:sldZmObj sldId="${zSldId}">${zmPr}</p16:sldZmObj></p16:sldZm>`;
|
|
22633
|
+
} else if (zKind === 'section') {
|
|
22634
|
+
strSlideXml += `<p16:sectionZm><p16:sectionZmObj sectionId="${slideItemObj.zoomSectionId}">${zmPr}</p16:sectionZmObj></p16:sectionZm>`;
|
|
22635
|
+
} else {
|
|
22636
|
+
var _slideItemObj_zoomSectionIds;
|
|
22637
|
+
// §2.11 CT_SummaryZoom: summaryZmObj(s) + required layout choice (gridLayout/fixedLayout).
|
|
22638
|
+
const szTitle = zOpts.zoomTitle ? ` title="${encodeXmlEntities(zOpts.zoomTitle)}"` : '';
|
|
22639
|
+
const szDescr = zOpts.zoomDescr ? ` descr="${encodeXmlEntities(zOpts.zoomDescr)}"` : '';
|
|
22640
|
+
const szOff = (typeof zOpts.offsetFactorX === 'number' ? ` offsetFactorX="${Math.round(zOpts.offsetFactorX)}"` : '') + (typeof zOpts.offsetFactorY === 'number' ? ` offsetFactorY="${Math.round(zOpts.offsetFactorY)}"` : '');
|
|
22641
|
+
const szScale = (typeof zOpts.scaleFactorX === 'number' ? ` scaleFactorX="${Math.round(zOpts.scaleFactorX)}"` : '') + (typeof zOpts.scaleFactorY === 'number' ? ` scaleFactorY="${Math.round(zOpts.scaleFactorY)}"` : '');
|
|
22642
|
+
const extraZm = ((_slideItemObj_zoomSectionIds = slideItemObj.zoomSectionIds) !== null && _slideItemObj_zoomSectionIds !== void 0 ? _slideItemObj_zoomSectionIds : []).map((id)=>`<p16:summaryZmObj sectionId="${id}">${zmPr}</p16:summaryZmObj>`).join('');
|
|
22643
|
+
strSlideXml += `<p16:summaryZm><p16:summaryZmObj sectionId="${slideItemObj.zoomSectionId}"${szTitle}${szDescr}${szOff}${szScale}>${zmPr}</p16:summaryZmObj>${extraZm}<p16:gridLayout/></p16:summaryZm>`;
|
|
22617
22644
|
}
|
|
22618
|
-
|
|
22619
|
-
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
|
|
22623
|
-
strSlideXml += '<p:
|
|
22624
|
-
strSlideXml += `<p:
|
|
22625
|
-
|
|
22626
|
-
strSlideXml +=
|
|
22627
|
-
strSlideXml +=
|
|
22628
|
-
strSlideXml += `<a:xfrm${locationAttr}>`;
|
|
22629
|
-
strSlideXml += `<a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/>`;
|
|
22630
|
-
strSlideXml += `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/>`;
|
|
22631
|
-
strSlideXml += '</a:xfrm>';
|
|
22632
|
-
if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
|
|
22633
|
-
strSlideXml += genXmlEffectLst({
|
|
22634
|
-
shadow: slideItemObj.options.shadow,
|
|
22635
|
-
glow: slideItemObj.options.glow,
|
|
22636
|
-
softEdge: slideItemObj.options.softEdge,
|
|
22637
|
-
reflection: slideItemObj.options.reflection,
|
|
22638
|
-
blur: slideItemObj.options.blur,
|
|
22639
|
-
fillOverlay: slideItemObj.options.fillOverlay,
|
|
22640
|
-
effectDag: slideItemObj.options.effectDag
|
|
22641
|
-
});
|
|
22642
|
-
strSlideXml += '</p:grpSpPr>';
|
|
22643
|
-
renderObjectList((_slideItemObj__objects = slideItemObj._objects) !== null && _slideItemObj__objects !== void 0 ? _slideItemObj__objects : []);
|
|
22644
|
-
strSlideXml += '</p:grpSp>';
|
|
22645
|
-
break;
|
|
22645
|
+
strSlideXml += '</mc:Choice>';
|
|
22646
|
+
// Fallback for older readers: pic for slide/section zoom; grpSp for summary zoom (§2.2.15).
|
|
22647
|
+
if (zKind === 'summary') {
|
|
22648
|
+
strSlideXml += `<mc:Fallback><p:grpSp><p:nvGrpSpPr><p:cNvPr id="${shapeId}" name="${zOpts.objectName}"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:grpSp></mc:Fallback>`;
|
|
22649
|
+
} else {
|
|
22650
|
+
strSlideXml += '<mc:Fallback><p:pic><p:nvPicPr>';
|
|
22651
|
+
strSlideXml += `<p:cNvPr id="${shapeId}" name="${zOpts.objectName}" descr="${encodeXmlEntities(zOpts.altText || '')}"/>`;
|
|
22652
|
+
strSlideXml += '<p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr><p:nvPr/></p:nvPicPr>';
|
|
22653
|
+
strSlideXml += zFill;
|
|
22654
|
+
strSlideXml += `<p:spPr>${zGeom}</p:spPr></p:pic></mc:Fallback>`;
|
|
22646
22655
|
}
|
|
22647
|
-
|
|
22648
|
-
strSlideXml += '';
|
|
22656
|
+
strSlideXml += '</mc:AlternateContent>';
|
|
22649
22657
|
break;
|
|
22650
|
-
|
|
22651
|
-
|
|
22658
|
+
}
|
|
22659
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.contentPart */"contentPart"):
|
|
22660
|
+
{
|
|
22661
|
+
var _slideItemObj_contentPartRid;
|
|
22662
|
+
// MS-PPTX §2.2.3 / §2.2.3.1: mc:AlternateContent { Choice contentPart | Fallback sp|pic }.
|
|
22663
|
+
const cpKind = slideItemObj.contentPartKind === 'ink' ? 'ink' : 'content';
|
|
22664
|
+
strSlideXml += genXmlContentPartAlternate({
|
|
22665
|
+
kind: cpKind,
|
|
22666
|
+
rId: (_slideItemObj_contentPartRid = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid !== void 0 ? _slideItemObj_contentPartRid : 0,
|
|
22667
|
+
shapeId,
|
|
22668
|
+
name: slideItemObj.options.objectName || (cpKind === 'ink' ? 'Ink 1' : 'Content Part 1'),
|
|
22669
|
+
altText: slideItemObj.options.altText || '',
|
|
22670
|
+
x,
|
|
22671
|
+
y,
|
|
22672
|
+
cx,
|
|
22673
|
+
cy,
|
|
22674
|
+
locationAttr,
|
|
22675
|
+
bwMode: slideItemObj.contentPartBwMode,
|
|
22676
|
+
coverRid: slideItemObj.coverRid
|
|
22677
|
+
});
|
|
22678
|
+
break;
|
|
22679
|
+
}
|
|
22680
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.officeApp */"officeApp"):
|
|
22681
|
+
{
|
|
22682
|
+
var _slideItemObj_contentPartRid1, _slideItemObj_coverRid;
|
|
22683
|
+
// MS-PPTX §2.2.13: mc:AlternateContent { Choice we:webextensionref | Fallback pic }.
|
|
22684
|
+
strSlideXml += genXmlOfficeAppAlternate({
|
|
22685
|
+
rId: (_slideItemObj_contentPartRid1 = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid1 !== void 0 ? _slideItemObj_contentPartRid1 : 0,
|
|
22686
|
+
shapeId,
|
|
22687
|
+
name: slideItemObj.options.objectName || 'Office App 1',
|
|
22688
|
+
altText: slideItemObj.options.altText || '',
|
|
22689
|
+
x,
|
|
22690
|
+
y,
|
|
22691
|
+
cx,
|
|
22692
|
+
cy,
|
|
22693
|
+
locationAttr,
|
|
22694
|
+
coverRid: (_slideItemObj_coverRid = slideItemObj.coverRid) !== null && _slideItemObj_coverRid !== void 0 ? _slideItemObj_coverRid : 0
|
|
22695
|
+
});
|
|
22696
|
+
break;
|
|
22697
|
+
}
|
|
22698
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
|
|
22699
|
+
{
|
|
22700
|
+
var _slideItemObj_options_objectName4;
|
|
22701
|
+
var _slideItemObj_options4;
|
|
22702
|
+
const chartType = (_slideItemObj_options4 = slideItemObj.options) === null || _slideItemObj_options4 === void 0 ? void 0 : _slideItemObj_options4._type;
|
|
22703
|
+
const isChartex = isChartexType(chartType);
|
|
22704
|
+
const graphicDataUri = isChartex ? OOXML_CHARTEX.ns : 'http://schemas.openxmlformats.org/drawingml/2006/chart';
|
|
22705
|
+
const chartRef = isChartex ? `<cx:chart xmlns:cx="${OOXML_CHARTEX.ns}" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId${slideItemObj.chartRid}"/>` : `<c:chart r:id="rId${slideItemObj.chartRid}" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"/>`;
|
|
22706
|
+
const chartLocks = genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock);
|
|
22707
|
+
let frameXml = '<p:graphicFrame>';
|
|
22708
|
+
frameXml += ' <p:nvGraphicFramePr>';
|
|
22709
|
+
frameXml += genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName4 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName4 !== void 0 ? _slideItemObj_options_objectName4 : ''), slideItemObj.options, slideItemObj.options.altText || '');
|
|
22710
|
+
frameXml += chartLocks ? ` <p:cNvGraphicFramePr>${chartLocks}</p:cNvGraphicFramePr>` : ' <p:cNvGraphicFramePr/>';
|
|
22711
|
+
frameXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
|
|
22712
|
+
nvPrModIdExt(slideItemObj.options.modId)
|
|
22713
|
+
]);
|
|
22714
|
+
frameXml += ' </p:nvGraphicFramePr>';
|
|
22715
|
+
frameXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
|
|
22716
|
+
frameXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
|
|
22717
|
+
frameXml += ` <a:graphicData uri="${graphicDataUri}">`;
|
|
22718
|
+
frameXml += ` ${chartRef}`;
|
|
22719
|
+
frameXml += ' </a:graphicData>';
|
|
22720
|
+
frameXml += ' </a:graphic>';
|
|
22721
|
+
frameXml += '</p:graphicFrame>';
|
|
22722
|
+
// A chartex frame replaces a standard graphic frame, so MS-PPTX 2.2 requires it be offered
|
|
22723
|
+
// through `mc:AlternateContent`. PowerPoint's own fallback is a rendered preview image, which
|
|
22724
|
+
// cannot be produced here - a locked text shape carrying the same message is the honest
|
|
22725
|
+
// equivalent for a consumer that does not understand the chartex namespace.
|
|
22726
|
+
strSlideXml += isChartex ? `<mc:AlternateContent xmlns:mc="${MC_NS}">` + `<mc:Choice xmlns:cx1="${chartExRequiresNs(chartType)}" Requires="cx1">` + frameXml + '</mc:Choice>' + `<mc:Fallback>${genXmlChartExFallback(shapeId, slideItemObj, {
|
|
22727
|
+
x,
|
|
22728
|
+
y,
|
|
22729
|
+
cx,
|
|
22730
|
+
cy
|
|
22731
|
+
})}</mc:Fallback>` + '</mc:AlternateContent>' : frameXml;
|
|
22732
|
+
break;
|
|
22733
|
+
}
|
|
22734
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"):
|
|
22735
|
+
{
|
|
22736
|
+
var _slideItemObj__objects;
|
|
22737
|
+
// PresentationML `p:grpSp` (ECMA-376 §19.3.1.22): nvGrpSpPr + grpSpPr + children.
|
|
22738
|
+
// Child coords are group-relative; chOff is 0,0 and chExt matches the group size.
|
|
22739
|
+
strSlideXml += '<p:grpSp>';
|
|
22740
|
+
strSlideXml += `<p:nvGrpSpPr>${genXmlCNvPr(shapeId, slideItemObj.options.objectName || `Group ${shapeId}`, slideItemObj.options)}`;
|
|
22741
|
+
const grpLocks = genXmlLocks('a:grpSpLocks', slideItemObj.options.lock);
|
|
22742
|
+
strSlideXml += (grpLocks ? `<p:cNvGrpSpPr>${grpLocks}</p:cNvGrpSpPr>` : '<p:cNvGrpSpPr/>') + `${genXmlNvPr(slideItemObj.options)}</p:nvGrpSpPr>`;
|
|
22743
|
+
strSlideXml += '<p:grpSpPr>';
|
|
22744
|
+
strSlideXml += `<a:xfrm${locationAttr}>`;
|
|
22745
|
+
strSlideXml += `<a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/>`;
|
|
22746
|
+
strSlideXml += `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/>`;
|
|
22747
|
+
strSlideXml += '</a:xfrm>';
|
|
22748
|
+
if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
|
|
22749
|
+
strSlideXml += genXmlEffectLst({
|
|
22750
|
+
shadow: slideItemObj.options.shadow,
|
|
22751
|
+
glow: slideItemObj.options.glow,
|
|
22752
|
+
softEdge: slideItemObj.options.softEdge,
|
|
22753
|
+
reflection: slideItemObj.options.reflection,
|
|
22754
|
+
blur: slideItemObj.options.blur,
|
|
22755
|
+
fillOverlay: slideItemObj.options.fillOverlay,
|
|
22756
|
+
effectDag: slideItemObj.options.effectDag
|
|
22757
|
+
});
|
|
22758
|
+
strSlideXml += '</p:grpSpPr>';
|
|
22759
|
+
strSlideXml += renderObjectList((_slideItemObj__objects = slideItemObj._objects) !== null && _slideItemObj__objects !== void 0 ? _slideItemObj__objects : []);
|
|
22760
|
+
strSlideXml += '</p:grpSp>';
|
|
22761
|
+
break;
|
|
22762
|
+
}
|
|
22763
|
+
default:
|
|
22764
|
+
strSlideXml += '';
|
|
22765
|
+
break;
|
|
22766
|
+
}
|
|
22767
|
+
return strSlideXml;
|
|
22652
22768
|
};
|
|
22769
|
+
const renderObjectList = (objects)=>objects.map((obj, idx)=>renderObject(obj, idx)).join('');
|
|
22653
22770
|
// Notes live on `_slideObjects` for the notes part, not the slide spTree — skip them so they do not consume cNvPr ids
|
|
22654
|
-
renderObjectList(((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).filter((obj)=>obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.notes */"notes")));
|
|
22771
|
+
strSlideXml += renderObjectList(((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).filter((obj)=>obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.notes */"notes")));
|
|
22655
22772
|
// STEP 4: Add slide numbers (if any) last
|
|
22656
22773
|
if (slide._slideNumberProps) {
|
|
22657
22774
|
// Set some defaults (done here b/c SlideNumber canbe added to masters or slides and has numerous entry points)
|
|
@@ -23210,13 +23327,17 @@ function collectSlideAnimations(slide) {
|
|
|
23210
23327
|
var _layout_colorMapOverride;
|
|
23211
23328
|
return ` ${slot}="${(_ref = (_layout_colorMapOverride = layout.colorMapOverride) === null || _layout_colorMapOverride === void 0 ? void 0 : _layout_colorMapOverride[slot]) !== null && _ref !== void 0 ? _ref : fallback}"`;
|
|
23212
23329
|
}).join('')}/></p:clrMapOvr>` : '<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>';
|
|
23330
|
+
const cSldXml = slideObjectToXml(layout);
|
|
23213
23331
|
const transitionXml = genXmlTransition(layout);
|
|
23214
23332
|
const hasP14 = transitionXml.includes('p14:') || transitionXml.includes('xmlns:p14');
|
|
23215
|
-
const
|
|
23333
|
+
const hasA14 = cSldXml.includes('a14:') || cSldXml.includes('Requires="a14"');
|
|
23334
|
+
const hasMc = cSldXml.includes('<mc:AlternateContent');
|
|
23335
|
+
const hasMath = cSldXml.includes('<m:oMath');
|
|
23336
|
+
const ns = (hasMath ? ` xmlns:m="${MATH_NS}"` : '') + (hasA14 ? ` xmlns:a14="${A14_NS}"` : '') + (hasP14 ? ` xmlns:p14="${P14_NS}"` : '') + (hasMc || hasA14 ? ` xmlns:mc="${MC_NS}"` : '') + (hasA14 ? ` mc:Ignorable="a14${hasP14 ? ' p14' : ''}"` : '');
|
|
23216
23337
|
// CT_SlideLayout sequence: cSld, clrMapOvr, transition, timing, hf, extLst
|
|
23217
23338
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
23218
23339
|
<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"${ns}${attrs}>
|
|
23219
|
-
${
|
|
23340
|
+
${cSldXml}
|
|
23220
23341
|
${clrMapOvr}${transitionXml}</p:sldLayout>`;
|
|
23221
23342
|
}
|
|
23222
23343
|
/**
|
|
@@ -23227,9 +23348,14 @@ function collectSlideAnimations(slide) {
|
|
|
23227
23348
|
*/ function makeXmlMaster(slide, layouts) {
|
|
23228
23349
|
// NOTE: Pass layouts as static rels because they are not referenced any time
|
|
23229
23350
|
const layoutDefs = layouts.map((_layoutDef, idx)=>`<p:sldLayoutId id="${LAYOUT_IDX_SERIES_BASE + idx}" r:id="rId${slide._rels.length + idx + 1}"/>`);
|
|
23351
|
+
const cSldXml = slideObjectToXml(slide);
|
|
23352
|
+
const hasA14 = cSldXml.includes('a14:') || cSldXml.includes('Requires="a14"');
|
|
23353
|
+
const hasMc = cSldXml.includes('<mc:AlternateContent');
|
|
23354
|
+
const hasMath = cSldXml.includes('<m:oMath');
|
|
23355
|
+
const masterNs = (hasMath ? ` xmlns:m="${MATH_NS}"` : '') + (hasA14 ? ` xmlns:a14="${A14_NS}"` : '') + (hasMc || hasA14 ? ` xmlns:mc="${MC_NS}"` : '') + (hasA14 ? ' mc:Ignorable="a14"' : '');
|
|
23230
23356
|
let strXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + (/* inlined export .CRLF */"\r\n");
|
|
23231
|
-
strXml +=
|
|
23232
|
-
strXml +=
|
|
23357
|
+
strXml += `<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"${masterNs}>`;
|
|
23358
|
+
strXml += cSldXml;
|
|
23233
23359
|
strXml += '<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>';
|
|
23234
23360
|
strXml += '<p:sldLayoutIdLst>' + layoutDefs.join('') + '</p:sldLayoutIdLst>';
|
|
23235
23361
|
// ECMA-376 §4.4.1.22 `p:hf@sldNum` (default true) enables the slide-number placeholder.
|
|
@@ -23293,7 +23419,11 @@ function makeXmlTheme(pres, variant = 'slide') {
|
|
|
23293
23419
|
const themeName = customName || (isCustomColors ? 'Custom Theme' : 'Office Theme');
|
|
23294
23420
|
const schemeName = customName || (isCustomColors ? 'Custom' : 'Office');
|
|
23295
23421
|
const fontSchemeName = ((_pres_theme7 = pres.theme) === null || _pres_theme7 === void 0 ? void 0 : _pres_theme7.fontSchemeName) ? encodeXmlEntities(pres.theme.fontSchemeName) : customName || 'Office';
|
|
23296
|
-
|
|
23422
|
+
// Custom dk1/lt1 must use srgbClr: both PowerPoint and LibreOffice ignore sysClr/@lastClr and
|
|
23423
|
+
// substitute OS windowText (#000000) / window (#FFFFFF), washing out custom dark/tinted themes.
|
|
23424
|
+
const dk1Xml = c[0].toUpperCase() === '000000' ? '<a:sysClr val="windowText" lastClr="000000"/>' : `<a:srgbClr val="${c[0]}"/>`;
|
|
23425
|
+
const lt1Xml = c[1].toUpperCase() === 'FFFFFF' ? '<a:sysClr val="window" lastClr="FFFFFF"/>' : `<a:srgbClr val="${c[1]}"/>`;
|
|
23426
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${themeName}"><a:themeElements><a:clrScheme name="${schemeName}"><a:dk1>${dk1Xml}</a:dk1><a:lt1>${lt1Xml}</a:lt1><a:dk2><a:srgbClr val="${c[2]}"/></a:dk2><a:lt2><a:srgbClr val="${c[3]}"/></a:lt2><a:accent1><a:srgbClr val="${c[4]}"/></a:accent1><a:accent2><a:srgbClr val="${c[5]}"/></a:accent2><a:accent3><a:srgbClr val="${c[6]}"/></a:accent3><a:accent4><a:srgbClr val="${c[7]}"/></a:accent4><a:accent5><a:srgbClr val="${c[8]}"/></a:accent5><a:accent6><a:srgbClr val="${c[9]}"/></a:accent6><a:hlink><a:srgbClr val="${c[10]}"/></a:hlink><a:folHlink><a:srgbClr val="${c[11]}"/></a:folHlink></a:clrScheme><a:fontScheme name="${fontSchemeName}"><a:majorFont>${majorFont}<a:font script="Jpan" typeface="游ゴシック Light"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线 Light"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Angsana New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:majorFont><a:minorFont>${minorFont}<a:font script="Jpan" typeface="游ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Cordia New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/><a:extLst><a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}"><thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="${themeFamilyId}" vid="${themeFamilyVid}"/></a:ext></a:extLst></a:theme>`;
|
|
23297
23427
|
}
|
|
23298
23428
|
const package_P15_NS = 'http://schemas.microsoft.com/office/powerpoint/2012/main';
|
|
23299
23429
|
const SLD_GUIDE_URI = '{EFAFB233-063F-42B5-8137-9DF3F51BA10A}';
|
|
@@ -24151,7 +24281,7 @@ class PptxGenJS {
|
|
|
24151
24281
|
*/ pptxgen_define_property(this, "_layout", void 0);
|
|
24152
24282
|
/**
|
|
24153
24283
|
* PptxGenJS Library Version
|
|
24154
|
-
*/ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.4.
|
|
24284
|
+
*/ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.4.1"));
|
|
24155
24285
|
/**
|
|
24156
24286
|
* @type {string}
|
|
24157
24287
|
*/ pptxgen_define_property(this, "_author", void 0);
|