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.cjs.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
|
"use strict";
|
|
4
4
|
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
@@ -3176,10 +3176,15 @@ function imageDimensions(bytes) {
|
|
|
3176
3176
|
// Media bytes for path-based images are now loaded; deduplicate identical raster payloads deck-wide
|
|
3177
3177
|
// before slide/layout `.rels` and zip parts are emitted.
|
|
3178
3178
|
dedupeSlideMediaRels(layout);
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3179
|
+
const imageObjects = [];
|
|
3180
|
+
for (const obj of layout._slideObjects){
|
|
3181
|
+
var _obj_options, _obj__fallbackImage, _obj__fallbackImage_options;
|
|
3182
|
+
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);
|
|
3183
|
+
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)) {
|
|
3184
|
+
imageObjects.push(obj._fallbackImage);
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
imageObjects.forEach((obj)=>{
|
|
3183
3188
|
var _layout__relsMedia_find;
|
|
3184
3189
|
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;
|
|
3185
3190
|
if (!obj.options || typeof strData !== 'string' || !strData || strData === IMG_BROKEN) return;
|
|
@@ -4008,10 +4013,9 @@ const MC_NS = 'http://schemas.openxmlformats.org/markup-compatibility/2006';
|
|
|
4008
4013
|
const P14_NS = 'http://schemas.microsoft.com/office/powerpoint/2010/main';
|
|
4009
4014
|
const P1710_NS = 'http://schemas.microsoft.com/office/powerpoint/2017/10/main';
|
|
4010
4015
|
/**
|
|
4011
|
-
* Normalize caller-supplied OMML for PowerPoint.
|
|
4012
|
-
* - Ensures
|
|
4013
|
-
* -
|
|
4014
|
-
* @see MS-ODRAWXML Math / mc:AlternateContent; proven via PowerPoint 16 COM round-trip.
|
|
4016
|
+
* Normalize caller-supplied OMML for PowerPoint (`[MS-ODRAWXML]` `CT_TextMath`).
|
|
4017
|
+
* - Ensures `<m:oMathPara>` wrapping `<m:oMath>` inside `<a14:m>` (`CT_TextMath` allows only `m:oMathPara`).
|
|
4018
|
+
* - Declares `xmlns:m` (and `xmlns:w` when `w:` elements appear) on `<m:oMathPara>`.
|
|
4015
4019
|
*/ function normalizeOmml(omml) {
|
|
4016
4020
|
// Control characters in math text (`<m:t>`) are a data defect, not a markup
|
|
4017
4021
|
// one - drop them instead of failing the whole export over a single run.
|
|
@@ -4023,15 +4027,79 @@ const P1710_NS = 'http://schemas.microsoft.com/office/powerpoint/2017/10/main';
|
|
|
4023
4027
|
if (problem) {
|
|
4024
4028
|
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>).`);
|
|
4025
4029
|
}
|
|
4026
|
-
//
|
|
4027
|
-
if (/^<a14:m[
|
|
4028
|
-
|
|
4029
|
-
if (
|
|
4030
|
-
trimmed =
|
|
4031
|
-
|
|
4032
|
-
|
|
4030
|
+
// Unwrap pre-wrapped <a14:m> so we can still enforce <m:oMathPara> inside
|
|
4031
|
+
if (/^<a14:m(?:\s[^>]*)?\/>$/i.test(trimmed)) return '';
|
|
4032
|
+
const a14Match = /^<a14:m(?:\s[^>]*)?>([\s\S]*)<\/a14:m>$/i.exec(trimmed);
|
|
4033
|
+
if (a14Match) {
|
|
4034
|
+
trimmed = a14Match[1].trim();
|
|
4035
|
+
if (!trimmed) return '';
|
|
4036
|
+
}
|
|
4037
|
+
// Ensure <m:oMathPara> root (wrapping bare <m:oMath> or inner math fragments)
|
|
4038
|
+
if (/^<m:oMathPara[\s/>]/i.test(trimmed)) {
|
|
4039
|
+
const openTagEnd = trimmed.indexOf('>');
|
|
4040
|
+
const openTag = openTagEnd >= 0 ? trimmed.slice(0, openTagEnd) : trimmed;
|
|
4041
|
+
let extraNs = '';
|
|
4042
|
+
if (!/\bxmlns:m=/i.test(openTag)) extraNs += ` xmlns:m="${MATH_NS}"`;
|
|
4043
|
+
if (!/\bxmlns:w=/i.test(openTag) && /\bw:/i.test(trimmed)) extraNs += ` xmlns:w="${W_NS}"`;
|
|
4044
|
+
if (extraNs) {
|
|
4045
|
+
trimmed = trimmed.replace(/^<m:oMathPara/i, `<m:oMathPara${extraNs}`);
|
|
4046
|
+
}
|
|
4047
|
+
} else {
|
|
4048
|
+
const innerMath = /^<m:oMath[\s/>]/i.test(trimmed) ? trimmed : `<m:oMath>${trimmed}</m:oMath>`;
|
|
4049
|
+
const needsW = /\bw:/i.test(innerMath) && !/\bxmlns:w=/i.test(innerMath.slice(0, 180));
|
|
4050
|
+
trimmed = `<m:oMathPara xmlns:m="${MATH_NS}"${needsW ? ` xmlns:w="${W_NS}"` : ''}>${innerMath}</m:oMathPara>`;
|
|
4051
|
+
}
|
|
4052
|
+
return `<a14:m>${trimmed}</a14:m>`;
|
|
4053
|
+
}
|
|
4054
|
+
const OMML_FALLBACK_INHERITED_KEYS = [
|
|
4055
|
+
'lang',
|
|
4056
|
+
'color',
|
|
4057
|
+
'fontSize',
|
|
4058
|
+
'fontFace',
|
|
4059
|
+
'fontFaceEa',
|
|
4060
|
+
'fontFaceCs',
|
|
4061
|
+
'fontFaceSym',
|
|
4062
|
+
'bold',
|
|
4063
|
+
'italic',
|
|
4064
|
+
'transparency'
|
|
4065
|
+
];
|
|
4066
|
+
const EMPTY_OMML_FALLBACK = '<a:r><a:rPr dirty="0"/><a:t/></a:r>';
|
|
4067
|
+
/**
|
|
4068
|
+
* Build `<mc:Fallback>` run XML for an inline `omml` run so consumers that do not advertise `a14`
|
|
4069
|
+
* (e.g. LibreOffice Impress) render readable inline text instead of dropping the equation.
|
|
4070
|
+
*/ function genXmlOmmlFallback(textObj) {
|
|
4071
|
+
var _textObj_options;
|
|
4072
|
+
const opts = (_textObj_options = textObj.options) !== null && _textObj_options !== void 0 ? _textObj_options : {};
|
|
4073
|
+
const fallback = opts.ommlFallback;
|
|
4074
|
+
if (Array.isArray(fallback)) {
|
|
4075
|
+
const runsXml = fallback.map((fbRun)=>{
|
|
4076
|
+
var _fbRun_options;
|
|
4077
|
+
const merged = text_object_spread({}, (_fbRun_options = fbRun.options) !== null && _fbRun_options !== void 0 ? _fbRun_options : {});
|
|
4078
|
+
delete merged.omml;
|
|
4079
|
+
delete merged.ommlFallback;
|
|
4080
|
+
delete merged.fallbackImage;
|
|
4081
|
+
for (const key of OMML_FALLBACK_INHERITED_KEYS){
|
|
4082
|
+
if (merged[key] === undefined && opts[key] !== undefined) {
|
|
4083
|
+
;
|
|
4084
|
+
merged[key] = opts[key];
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
return genXmlTextRun({
|
|
4088
|
+
text: fbRun.text,
|
|
4089
|
+
options: merged
|
|
4090
|
+
});
|
|
4091
|
+
}).filter(Boolean).join('');
|
|
4092
|
+
return runsXml || EMPTY_OMML_FALLBACK;
|
|
4033
4093
|
}
|
|
4034
|
-
|
|
4094
|
+
const fallbackText = typeof fallback === 'string' && fallback.length > 0 ? fallback : typeof textObj.text === 'string' && textObj.text.length > 0 ? textObj.text : '';
|
|
4095
|
+
if (fallbackText) {
|
|
4096
|
+
const runOpts = text_object_spread({}, opts);
|
|
4097
|
+
delete runOpts.omml;
|
|
4098
|
+
delete runOpts.ommlFallback;
|
|
4099
|
+
delete runOpts.fallbackImage;
|
|
4100
|
+
return `<a:r>${genXmlTextRunProperties(runOpts, false)}<a:t>${encodeXmlEntities(fallbackText)}</a:t></a:r>`;
|
|
4101
|
+
}
|
|
4102
|
+
return EMPTY_OMML_FALLBACK;
|
|
4035
4103
|
}
|
|
4036
4104
|
/**
|
|
4037
4105
|
* A stable GUID for a field, derived from its type and cached value
|
|
@@ -4052,10 +4120,13 @@ function textRunsHaveOmml(text) {
|
|
|
4052
4120
|
function genXmlTextRun(textObj) {
|
|
4053
4121
|
var _textObj_options;
|
|
4054
4122
|
var _textObj_options1, _textObj_options2;
|
|
4055
|
-
// Native Office Math run —
|
|
4123
|
+
// Native Office Math run — wrapped in spec-valid MCE AlternateContent so PowerPoint renders
|
|
4124
|
+
// editable `<a14:m><m:oMathPara>…</m:oMathPara></a14:m>` and consumers without `a14` render `<mc:Fallback>`.
|
|
4056
4125
|
const omml = (_textObj_options1 = textObj.options) === null || _textObj_options1 === void 0 ? void 0 : _textObj_options1.omml;
|
|
4057
4126
|
if (typeof omml === 'string' && omml.trim()) {
|
|
4058
|
-
|
|
4127
|
+
const normalized = normalizeOmml(omml);
|
|
4128
|
+
if (!normalized) return '';
|
|
4129
|
+
return '<mc:AlternateContent>' + `<mc:Choice Requires="a14">${normalized}</mc:Choice>` + `<mc:Fallback>${genXmlOmmlFallback(textObj)}</mc:Fallback>` + '</mc:AlternateContent>';
|
|
4059
4130
|
}
|
|
4060
4131
|
// NOTE: Dont create full rPr runProps for empty [lineBreak] runs
|
|
4061
4132
|
// Why? The size of the lineBreak wont match (eg: below it will be 18px instead of the correct 36px)
|
|
@@ -4148,11 +4219,15 @@ function genXmlTextRun(textObj) {
|
|
|
4148
4219
|
var _slideObject_options_fit;
|
|
4149
4220
|
// NOTE: Use of '<a:noAutofit/>' instead of '' causes issues in PPT-2013!
|
|
4150
4221
|
if (slideObject.options.fit === 'none') bodyProperties += '';
|
|
4151
|
-
else if (slideObject.options.fit === 'shrink')
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
const
|
|
4155
|
-
|
|
4222
|
+
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') {
|
|
4223
|
+
// ECMA-376 §5.1.5.1.3 CT_TextNormalAutofit: fontScale (1..100% -> 1000..100000)
|
|
4224
|
+
// and lnSpcReduction (0..100% -> 0..100000) in 1000ths of a percent.
|
|
4225
|
+
const fitObj = typeof slideObject.options.fit === 'object' ? slideObject.options.fit : undefined;
|
|
4226
|
+
const fs = typeof (fitObj === null || fitObj === void 0 ? void 0 : fitObj.fontScale) === 'number' ? fitObj.fontScale : slideObject.options.fontScale;
|
|
4227
|
+
const ls = typeof (fitObj === null || fitObj === void 0 ? void 0 : fitObj.lnSpcReduction) === 'number' ? fitObj.lnSpcReduction : slideObject.options.lnSpcReduction;
|
|
4228
|
+
const fsAttr = typeof fs === 'number' && Number.isFinite(fs) ? ` fontScale="${clampInt(Math.round(fs * 1000), 1000, 100000)}"` : '';
|
|
4229
|
+
const lsAttr = typeof ls === 'number' && Number.isFinite(ls) ? ` lnSpcReduction="${clampInt(Math.round(ls * 1000), 0, 100000)}"` : '';
|
|
4230
|
+
bodyProperties += `<a:normAutofit${fsAttr}${lsAttr}/>`;
|
|
4156
4231
|
} else if (slideObject.options.fit === 'resize') bodyProperties += '<a:spAutoFit/>';
|
|
4157
4232
|
}
|
|
4158
4233
|
//
|
|
@@ -4257,6 +4332,7 @@ function genXmlTextRun(textObj) {
|
|
|
4257
4332
|
delete runOpts.shadow;
|
|
4258
4333
|
delete runOpts.fillOverlay;
|
|
4259
4334
|
delete runOpts.effectDag;
|
|
4335
|
+
delete runOpts.fallbackImage;
|
|
4260
4336
|
itext.options = runOpts;
|
|
4261
4337
|
}
|
|
4262
4338
|
if (idx === 0 && itext.options && !itext.options.bullet && opts.bullet) itext.options.bullet = opts.bullet;
|
|
@@ -4373,8 +4449,8 @@ function genXmlTextRun(textObj) {
|
|
|
4373
4449
|
// if (textOpts.hyperlink && key === 'color') null
|
|
4374
4450
|
// NOTE: This loop will pick up unecessary keys (`x`, etc.), but it doesnt hurt anything
|
|
4375
4451
|
// `glow` / softEdge / reflection belong on the shape effectLst (not per-run), unless set on the run itself
|
|
4376
|
-
// `omml`
|
|
4377
|
-
if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'fillOverlay' || key === 'effectDag' || key === 'omml') return;
|
|
4452
|
+
// `omml` / `ommlFallback` / `fallbackImage` must not inherit from shape options onto sibling plain-text runs
|
|
4453
|
+
if (key === 'glow' || key === 'softEdge' || key === 'reflection' || key === 'shadow' || key === 'blur' || key === 'fillOverlay' || key === 'effectDag' || key === 'omml' || key === 'ommlFallback' || key === 'fallbackImage') return;
|
|
4378
4454
|
if (key !== 'bullet' && textOpts[key] === undefined) textOpts[key] = val;
|
|
4379
4455
|
});
|
|
4380
4456
|
// D: Add formatted textrun
|
|
@@ -5343,7 +5419,7 @@ function resolveObjectImageFills(target, options) {
|
|
|
5343
5419
|
if (options.fill) resolveImageFill(target, options.fill);
|
|
5344
5420
|
if ((_options_fillOverlay = options.fillOverlay) === null || _options_fillOverlay === void 0 ? void 0 : _options_fillOverlay.fill) resolveImageFill(target, options.fillOverlay.fill);
|
|
5345
5421
|
}
|
|
5346
|
-
function
|
|
5422
|
+
function buildImageSlideObject(target, opt) {
|
|
5347
5423
|
var _opt_fillOverlay;
|
|
5348
5424
|
if ((_opt_fillOverlay = opt.fillOverlay) === null || _opt_fillOverlay === void 0 ? void 0 : _opt_fillOverlay.fill) resolveImageFill(target, opt.fillOverlay.fill);
|
|
5349
5425
|
const newObject = {
|
|
@@ -5368,16 +5444,16 @@ function addImageDefinition(target, opt) {
|
|
|
5368
5444
|
// REALITY-CHECK:
|
|
5369
5445
|
if (!strImagePath && !strImageData) {
|
|
5370
5446
|
console.error('ERROR: addImage() requires either \'data\' or \'path\' parameter!');
|
|
5371
|
-
return;
|
|
5447
|
+
return undefined;
|
|
5372
5448
|
} else if (strImagePath && typeof strImagePath !== 'string') {
|
|
5373
5449
|
console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(strImagePath)}`);
|
|
5374
|
-
return;
|
|
5450
|
+
return undefined;
|
|
5375
5451
|
} else if (strImageData && typeof strImageData !== 'string') {
|
|
5376
5452
|
console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(strImageData)}`);
|
|
5377
|
-
return;
|
|
5453
|
+
return undefined;
|
|
5378
5454
|
} else if (strImageData && typeof strImageData === 'string' && !strImageData.toLowerCase().includes('base64,')) {
|
|
5379
5455
|
console.error('ERROR: Image `data` value lacks a base64 header! Ex: \'image/png;base64,NMP[...]\')');
|
|
5380
|
-
return;
|
|
5456
|
+
return undefined;
|
|
5381
5457
|
}
|
|
5382
5458
|
// STEP 1: Set extension
|
|
5383
5459
|
// Honor explicit `opt.extn` (for extensionless signed CDN URLs); otherwise parse from path safely.
|
|
@@ -5407,6 +5483,7 @@ function addImageDefinition(target, opt) {
|
|
|
5407
5483
|
rounding: typeof opt.rounding === 'boolean' ? opt.rounding : false,
|
|
5408
5484
|
rectRadius: opt.rectRadius,
|
|
5409
5485
|
sizing: sizing !== null && sizing !== void 0 ? sizing : undefined,
|
|
5486
|
+
crop: opt.crop,
|
|
5410
5487
|
placeholder: opt.placeholder,
|
|
5411
5488
|
rotate: opt.rotate || 0,
|
|
5412
5489
|
flipV: opt.flipV || false,
|
|
@@ -5520,8 +5597,11 @@ function addImageDefinition(target, opt) {
|
|
|
5520
5597
|
resolveHyperlinkRels(target, opt.hyperlinkHover);
|
|
5521
5598
|
newObject.hyperlinkHover = opt.hyperlinkHover;
|
|
5522
5599
|
}
|
|
5523
|
-
|
|
5524
|
-
|
|
5600
|
+
return newObject;
|
|
5601
|
+
}
|
|
5602
|
+
function addImageDefinition(target, opt) {
|
|
5603
|
+
const newObject = buildImageSlideObject(target, opt);
|
|
5604
|
+
if (newObject) target._slideObjects.push(newObject);
|
|
5525
5605
|
}
|
|
5526
5606
|
/**
|
|
5527
5607
|
* Adds a media object to a slide definition.
|
|
@@ -6471,6 +6551,7 @@ function addShapeDefinition(target, shapeName, opts) {
|
|
|
6471
6551
|
var // STEP 2: Create/Clean text options
|
|
6472
6552
|
_newObject_text, _newObject_options1, _newObject_options2, _newObject_text1;
|
|
6473
6553
|
resolveObjectImageFills(target, opts);
|
|
6554
|
+
const rawObjectName = opts === null || opts === void 0 ? void 0 : opts.objectName;
|
|
6474
6555
|
const newObject = {
|
|
6475
6556
|
_type: isPlaceholder ? (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder") : (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"),
|
|
6476
6557
|
shape: (opts === null || opts === void 0 ? void 0 : opts.shape) || core_enums_SHAPE_TYPE.RECTANGLE,
|
|
@@ -6613,6 +6694,25 @@ function addShapeDefinition(target, shapeName, opts) {
|
|
|
6613
6694
|
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);
|
|
6614
6695
|
resolveBulletImage(target, item.options);
|
|
6615
6696
|
});
|
|
6697
|
+
// STEP 4: Optional slide-level `<mc:Fallback><p:pic>` image (e.g. display math SVG/PNG fallback).
|
|
6698
|
+
// Register media/relationships via the normal image pipeline without adding a second top-level slide object.
|
|
6699
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.fallbackImage) && !isPlaceholder) {
|
|
6700
|
+
var _opts_fallbackImage_x, _opts_fallbackImage_y, _opts_fallbackImage_w, _opts_fallbackImage_h, _opts_fallbackImage_rotate, _opts_fallbackImage_altText, _opts_fallbackImage_objectName;
|
|
6701
|
+
const rawBaseName = rawObjectName !== null && rawObjectName !== void 0 ? rawObjectName : `Text ${target._slideObjects.filter((obj)=>obj._type === (/* inlined export .SLIDE_OBJECT_TYPES.text */"text")).length}`;
|
|
6702
|
+
const fbOpt = gen_objects_object_spread_props(gen_objects_object_spread({}, opts.fallbackImage), {
|
|
6703
|
+
x: (_opts_fallbackImage_x = opts.fallbackImage.x) !== null && _opts_fallbackImage_x !== void 0 ? _opts_fallbackImage_x : newObject.options.x,
|
|
6704
|
+
y: (_opts_fallbackImage_y = opts.fallbackImage.y) !== null && _opts_fallbackImage_y !== void 0 ? _opts_fallbackImage_y : newObject.options.y,
|
|
6705
|
+
w: (_opts_fallbackImage_w = opts.fallbackImage.w) !== null && _opts_fallbackImage_w !== void 0 ? _opts_fallbackImage_w : newObject.options.w,
|
|
6706
|
+
h: (_opts_fallbackImage_h = opts.fallbackImage.h) !== null && _opts_fallbackImage_h !== void 0 ? _opts_fallbackImage_h : newObject.options.h,
|
|
6707
|
+
rotate: (_opts_fallbackImage_rotate = opts.fallbackImage.rotate) !== null && _opts_fallbackImage_rotate !== void 0 ? _opts_fallbackImage_rotate : newObject.options.rotate,
|
|
6708
|
+
altText: (_opts_fallbackImage_altText = opts.fallbackImage.altText) !== null && _opts_fallbackImage_altText !== void 0 ? _opts_fallbackImage_altText : newObject.options.altText,
|
|
6709
|
+
objectName: (_opts_fallbackImage_objectName = opts.fallbackImage.objectName) !== null && _opts_fallbackImage_objectName !== void 0 ? _opts_fallbackImage_objectName : `${rawBaseName} Fallback`
|
|
6710
|
+
});
|
|
6711
|
+
const fallbackObj = buildImageSlideObject(target, fbOpt);
|
|
6712
|
+
if (fallbackObj) {
|
|
6713
|
+
newObject._fallbackImage = fallbackObj;
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6616
6716
|
// LAST: Add object to Slide
|
|
6617
6717
|
target._slideObjects.push(newObject);
|
|
6618
6718
|
}
|
|
@@ -6934,6 +7034,7 @@ function slide_object_spread(target) {
|
|
|
6934
7034
|
delete runOpts.blur;
|
|
6935
7035
|
delete runOpts.fillOverlay;
|
|
6936
7036
|
delete runOpts.effectDag;
|
|
7037
|
+
delete runOpts.fallbackImage;
|
|
6937
7038
|
return runOpts;
|
|
6938
7039
|
}
|
|
6939
7040
|
class Slide {
|
|
@@ -21498,7 +21599,7 @@ const ImageSizingXml = {
|
|
|
21498
21599
|
const height = isBoxBased ? boxDim.h : boxDim.w * imgRatio;
|
|
21499
21600
|
const hzPerc = Math.round(1e5 * 0.5 * (1 - boxDim.w / width));
|
|
21500
21601
|
const vzPerc = Math.round(1e5 * 0.5 * (1 - boxDim.h / height));
|
|
21501
|
-
return `<a:srcRect l="${hzPerc}" r="${hzPerc}" t="${vzPerc}" b="${vzPerc}"/><a:stretch
|
|
21602
|
+
return `<a:srcRect l="${hzPerc}" r="${hzPerc}" t="${vzPerc}" b="${vzPerc}"/><a:stretch><a:fillRect/></a:stretch>`;
|
|
21502
21603
|
},
|
|
21503
21604
|
contain: function(imgSize, boxDim) {
|
|
21504
21605
|
const imgRatio = imgSize.h / imgSize.w;
|
|
@@ -21508,7 +21609,7 @@ const ImageSizingXml = {
|
|
|
21508
21609
|
const height = widthBased ? boxDim.w * imgRatio : boxDim.h;
|
|
21509
21610
|
const hzPerc = Math.round(1e5 * 0.5 * (1 - boxDim.w / width));
|
|
21510
21611
|
const vzPerc = Math.round(1e5 * 0.5 * (1 - boxDim.h / height));
|
|
21511
|
-
return `<a:srcRect l="${hzPerc}" r="${hzPerc}" t="${vzPerc}" b="${vzPerc}"/><a:stretch
|
|
21612
|
+
return `<a:srcRect l="${hzPerc}" r="${hzPerc}" t="${vzPerc}" b="${vzPerc}"/><a:stretch><a:fillRect/></a:stretch>`;
|
|
21512
21613
|
},
|
|
21513
21614
|
crop: function(imgSize, boxDim) {
|
|
21514
21615
|
const l = boxDim.x;
|
|
@@ -21519,7 +21620,7 @@ const ImageSizingXml = {
|
|
|
21519
21620
|
const rPerc = Math.round(1e5 * (r / imgSize.w));
|
|
21520
21621
|
const tPerc = Math.round(1e5 * (t / imgSize.h));
|
|
21521
21622
|
const bPerc = Math.round(1e5 * (b / imgSize.h));
|
|
21522
|
-
return `<a:srcRect l="${lPerc}" r="${rPerc}" t="${tPerc}" b="${bPerc}"/><a:stretch
|
|
21623
|
+
return `<a:srcRect l="${lPerc}" r="${rPerc}" t="${tPerc}" b="${bPerc}"/><a:stretch><a:fillRect/></a:stretch>`;
|
|
21523
21624
|
}
|
|
21524
21625
|
};
|
|
21525
21626
|
/**
|
|
@@ -21967,168 +22068,168 @@ function slideObjectToXml(slide) {
|
|
|
21967
22068
|
// STEP 3: Loop over all Slide.data objects and add them to this slide
|
|
21968
22069
|
const usedShapeIds = new Set();
|
|
21969
22070
|
const shapeCoordinates = [];
|
|
21970
|
-
const
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21986
|
-
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
|
|
21991
|
-
|
|
21992
|
-
|
|
21993
|
-
}
|
|
21994
|
-
});
|
|
21995
|
-
let intColCnt = 0;
|
|
21996
|
-
let cellOpts;
|
|
21997
|
-
let strXml = '';
|
|
21998
|
-
const sizing = (_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.sizing;
|
|
21999
|
-
const rounding = (_slideItemObj_options1 = slideItemObj.options) === null || _slideItemObj_options1 === void 0 ? void 0 : _slideItemObj_options1.rounding;
|
|
22000
|
-
if ('_slideLayout' in slide && ((_slide__slideLayout = slide._slideLayout) === null || _slide__slideLayout === void 0 ? void 0 : _slide__slideLayout._slideObjects) !== undefined && slideItemObj.options && slideItemObj.options.placeholder) {
|
|
22001
|
-
placeholderObj = slide._slideLayout._slideObjects.filter((object)=>{
|
|
22002
|
-
var _object_options, _slideItemObj_options;
|
|
22003
|
-
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);
|
|
22004
|
-
})[0];
|
|
22005
|
-
}
|
|
22006
|
-
// A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
|
|
22007
|
-
if ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) {
|
|
22008
|
-
resolveConnectorObjectNames(slideItemObj.options.line, shapeCoordinates);
|
|
22009
|
-
}
|
|
22010
|
-
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;
|
|
22011
|
-
if (connectorLayout) {
|
|
22012
|
-
x = connectorLayout.x;
|
|
22013
|
-
y = connectorLayout.y;
|
|
22014
|
-
cx = connectorLayout.cx;
|
|
22015
|
-
cy = connectorLayout.cy;
|
|
22016
|
-
slideItemObj.options.flipH = connectorLayout.flipH;
|
|
22017
|
-
slideItemObj.options.flipV = connectorLayout.flipV;
|
|
22018
|
-
} else {
|
|
22019
|
-
if (typeof slideItemObj.options.x !== 'undefined') x = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout);
|
|
22020
|
-
if (typeof slideItemObj.options.y !== 'undefined') y = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout);
|
|
22021
|
-
if (typeof slideItemObj.options.w !== 'undefined') cx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout);
|
|
22022
|
-
if (typeof slideItemObj.options.h !== 'undefined') cy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout);
|
|
22023
|
-
}
|
|
22024
|
-
// Set w/h now that smart parse is done.
|
|
22025
|
-
// `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes EMU
|
|
22026
|
-
// and inches. The sizing fns only use imgSize for a *ratio*, so normalize to a common unit before they
|
|
22027
|
-
// corrupt `srcRect` with a garbage aspect (issue #1286). Frame `cx`/`cy` below keep their own values.
|
|
22028
|
-
let imgWidth = cx;
|
|
22029
|
-
let imgHeight = cy;
|
|
22030
|
-
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) {
|
|
22031
|
-
// `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes
|
|
22032
|
-
// EMU and inches and corrupts the sizing aspect/`srcRect` (issue #1286). boxDim is always EMU, so
|
|
22033
|
-
// coerce both image dims to EMU: whichever raw value was taken as inches (<100) is re-read as EMU.
|
|
22034
|
-
const rawW = slideItemObj.options.w;
|
|
22035
|
-
const rawH = slideItemObj.options.h;
|
|
22036
|
-
if (typeof rawW === 'number' && rawW < 100 && typeof rawH === 'number' && rawH >= 100) imgWidth = rawW;
|
|
22037
|
-
else if (typeof rawH === 'number' && rawH < 100 && typeof rawW === 'number' && rawW >= 100) imgHeight = rawH;
|
|
22071
|
+
const renderObject = (slideItemObj, idx)=>{
|
|
22072
|
+
var _slideItemObj_options, _slideItemObj_options1, _slide__slideLayout, _slideItemObj_options_line, _slideItemObj_options_line1, _slideItemObj_options_sizing, _slideItemObj_options2;
|
|
22073
|
+
let strSlideXml = '';
|
|
22074
|
+
let x = 0;
|
|
22075
|
+
let y = 0;
|
|
22076
|
+
let cx = getSmartParseNumber('75%', 'X', slide._presLayout);
|
|
22077
|
+
let cy = 0;
|
|
22078
|
+
let placeholderObj;
|
|
22079
|
+
let locationAttr = '';
|
|
22080
|
+
let arrTabRows = [];
|
|
22081
|
+
let objTabOpts = {};
|
|
22082
|
+
slideItemObj.options = slideItemObj.options || {};
|
|
22083
|
+
const shapeId = resolveShapeId(slideItemObj.options, idx, usedShapeIds);
|
|
22084
|
+
// Keep resolved id on options so animations / later passes can target the same cNvPr id
|
|
22085
|
+
slideItemObj.options.sId = shapeId;
|
|
22086
|
+
shapeCoordinates.push({
|
|
22087
|
+
id: shapeId,
|
|
22088
|
+
objectName: slideItemObj.options.objectName,
|
|
22089
|
+
position: {
|
|
22090
|
+
x: slideItemObj.options.x,
|
|
22091
|
+
y: slideItemObj.options.y,
|
|
22092
|
+
w: slideItemObj.options.w,
|
|
22093
|
+
h: slideItemObj.options.h
|
|
22038
22094
|
}
|
|
22039
|
-
|
|
22040
|
-
|
|
22041
|
-
|
|
22042
|
-
|
|
22043
|
-
|
|
22044
|
-
|
|
22045
|
-
|
|
22046
|
-
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
|
|
22050
|
-
|
|
22051
|
-
|
|
22052
|
-
|
|
22053
|
-
|
|
22054
|
-
|
|
22055
|
-
|
|
22056
|
-
|
|
22057
|
-
|
|
22058
|
-
|
|
22059
|
-
|
|
22060
|
-
|
|
22061
|
-
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
if (
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
22075
|
-
|
|
22076
|
-
|
|
22077
|
-
|
|
22078
|
-
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
|
|
22083
|
-
|
|
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
|
-
|
|
22095
|
+
});
|
|
22096
|
+
let intColCnt = 0;
|
|
22097
|
+
let cellOpts;
|
|
22098
|
+
let strXml = '';
|
|
22099
|
+
const sizing = (_slideItemObj_options = slideItemObj.options) === null || _slideItemObj_options === void 0 ? void 0 : _slideItemObj_options.sizing;
|
|
22100
|
+
const rounding = (_slideItemObj_options1 = slideItemObj.options) === null || _slideItemObj_options1 === void 0 ? void 0 : _slideItemObj_options1.rounding;
|
|
22101
|
+
if ('_slideLayout' in slide && ((_slide__slideLayout = slide._slideLayout) === null || _slide__slideLayout === void 0 ? void 0 : _slide__slideLayout._slideObjects) !== undefined && slideItemObj.options && slideItemObj.options.placeholder) {
|
|
22102
|
+
placeholderObj = slide._slideLayout._slideObjects.filter((object)=>{
|
|
22103
|
+
var _object_options, _slideItemObj_options;
|
|
22104
|
+
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);
|
|
22105
|
+
})[0];
|
|
22106
|
+
}
|
|
22107
|
+
// A: Geometry — connectors may auto-size from source/target shape boxes (ZentoSoft)
|
|
22108
|
+
if ((_slideItemObj_options_line = slideItemObj.options.line) === null || _slideItemObj_options_line === void 0 ? void 0 : _slideItemObj_options_line.isConnector) {
|
|
22109
|
+
resolveConnectorObjectNames(slideItemObj.options.line, shapeCoordinates);
|
|
22110
|
+
}
|
|
22111
|
+
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;
|
|
22112
|
+
if (connectorLayout) {
|
|
22113
|
+
x = connectorLayout.x;
|
|
22114
|
+
y = connectorLayout.y;
|
|
22115
|
+
cx = connectorLayout.cx;
|
|
22116
|
+
cy = connectorLayout.cy;
|
|
22117
|
+
slideItemObj.options.flipH = connectorLayout.flipH;
|
|
22118
|
+
slideItemObj.options.flipV = connectorLayout.flipV;
|
|
22119
|
+
} else {
|
|
22120
|
+
if (typeof slideItemObj.options.x !== 'undefined') x = getSmartParseNumber(slideItemObj.options.x, 'X', slide._presLayout);
|
|
22121
|
+
if (typeof slideItemObj.options.y !== 'undefined') y = getSmartParseNumber(slideItemObj.options.y, 'Y', slide._presLayout);
|
|
22122
|
+
if (typeof slideItemObj.options.w !== 'undefined') cx = getSmartParseNumber(slideItemObj.options.w, 'X', slide._presLayout);
|
|
22123
|
+
if (typeof slideItemObj.options.h !== 'undefined') cy = getSmartParseNumber(slideItemObj.options.h, 'Y', slide._presLayout);
|
|
22124
|
+
}
|
|
22125
|
+
// Set w/h now that smart parse is done.
|
|
22126
|
+
// `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes EMU
|
|
22127
|
+
// and inches. The sizing fns only use imgSize for a *ratio*, so normalize to a common unit before they
|
|
22128
|
+
// corrupt `srcRect` with a garbage aspect (issue #1286). Frame `cx`/`cy` below keep their own values.
|
|
22129
|
+
let imgWidth = cx;
|
|
22130
|
+
let imgHeight = cy;
|
|
22131
|
+
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) {
|
|
22132
|
+
// `getSmartParseNumber` guesses units per-value (<100=inches, >=100=EMU), so `w:2899, h:97` mixes
|
|
22133
|
+
// EMU and inches and corrupts the sizing aspect/`srcRect` (issue #1286). boxDim is always EMU, so
|
|
22134
|
+
// coerce both image dims to EMU: whichever raw value was taken as inches (<100) is re-read as EMU.
|
|
22135
|
+
const rawW = slideItemObj.options.w;
|
|
22136
|
+
const rawH = slideItemObj.options.h;
|
|
22137
|
+
if (typeof rawW === 'number' && rawW < 100 && typeof rawH === 'number' && rawH >= 100) imgWidth = rawW;
|
|
22138
|
+
else if (typeof rawH === 'number' && rawH < 100 && typeof rawW === 'number' && rawW >= 100) imgHeight = rawH;
|
|
22139
|
+
}
|
|
22140
|
+
// Inherit placeholder geometry only for axes the caller did not set (fujita-h d7e3e93).
|
|
22141
|
+
// addImage always writes x/y/w/h defaults, so `_explicit*` distinguishes unset vs explicit.
|
|
22142
|
+
if (placeholderObj) {
|
|
22143
|
+
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;
|
|
22144
|
+
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);
|
|
22145
|
+
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);
|
|
22146
|
+
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);
|
|
22147
|
+
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);
|
|
22148
|
+
// Re-sync the image frame: imgWidth/imgHeight were snapshotted from cx/cy before this block, so a
|
|
22149
|
+
// placeholder's w/h would otherwise be lost and the frame stay at the 1x1 default (issue #996).
|
|
22150
|
+
imgWidth = cx;
|
|
22151
|
+
imgHeight = cy;
|
|
22152
|
+
}
|
|
22153
|
+
let flipH = !!slideItemObj.options.flipH;
|
|
22154
|
+
let flipV = !!slideItemObj.options.flipV;
|
|
22155
|
+
if (slideItemObj.shape === core_enums_SHAPE_TYPE.LINE) {
|
|
22156
|
+
const line = normalizeLineExtents(x, y, cx, cy, flipH, flipV);
|
|
22157
|
+
x = line.x;
|
|
22158
|
+
y = line.y;
|
|
22159
|
+
cx = line.cx;
|
|
22160
|
+
cy = line.cy;
|
|
22161
|
+
flipH = line.flipH;
|
|
22162
|
+
flipV = line.flipV;
|
|
22163
|
+
}
|
|
22164
|
+
// Clamp extents to ST_PositiveCoordinate (>= 0) after line flip so lines keep negative endpoint deltas
|
|
22165
|
+
if (cx < 0 || cy < 0) {
|
|
22166
|
+
console.warn(`[pptxgenjs] negative size on ${slideItemObj._type}${slideItemObj.options.objectName ? ` "${slideItemObj.options.objectName}"` : ''} - w/h cannot be negative, clamped to 0`);
|
|
22167
|
+
}
|
|
22168
|
+
cx = positiveExtent(cx);
|
|
22169
|
+
cy = positiveExtent(cy);
|
|
22170
|
+
imgWidth = positiveExtent(imgWidth);
|
|
22171
|
+
imgHeight = positiveExtent(imgHeight);
|
|
22172
|
+
if (flipH) locationAttr += ' flipH="1"';
|
|
22173
|
+
if (flipV) locationAttr += ' flipV="1"';
|
|
22174
|
+
if (slideItemObj.options.rotate) locationAttr += ` rot="${convertRotationDegrees(slideItemObj.options.rotate)}"`;
|
|
22175
|
+
// B: Add OBJECT to the current Slide
|
|
22176
|
+
switch(slideItemObj._type){
|
|
22177
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.table */"table"):
|
|
22178
|
+
{
|
|
22179
|
+
var _slideItemObj_arrTabRows, _slideItemObj_options_objectName;
|
|
22180
|
+
arrTabRows = (_slideItemObj_arrTabRows = slideItemObj.arrTabRows) !== null && _slideItemObj_arrTabRows !== void 0 ? _slideItemObj_arrTabRows : [];
|
|
22181
|
+
objTabOpts = slideItemObj.options;
|
|
22182
|
+
intColCnt = 0;
|
|
22183
|
+
// Calc number of columns
|
|
22184
|
+
// NOTE: Cells may have a colspan, so merely taking the length of the [0] (or any other) row is not
|
|
22185
|
+
// ....: sufficient to determine column count. Therefore, check each cell for a colspan and total cols as reqd
|
|
22186
|
+
arrTabRows[0].forEach((cell)=>{
|
|
22187
|
+
cellOpts = cell.options;
|
|
22188
|
+
intColCnt += (cellOpts === null || cellOpts === void 0 ? void 0 : cellOpts.colspan) ? Number(cellOpts.colspan) : 1;
|
|
22189
|
+
});
|
|
22190
|
+
// STEP 1: Start Table XML
|
|
22191
|
+
// NOTE: Non-numeric cNvPr id values will trigger "presentation needs repair" type warning in MS-PPT-2013
|
|
22192
|
+
// Use the shared slide allocator — `intTableNum * slideNum + 1` collided with `idx + 2` (gitbrent/PptxGenJS#1532)
|
|
22193
|
+
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);
|
|
22194
|
+
// When the table binds to a master/layout placeholder, emit `<p:ph type="tbl"/>` (ECMA-376 §4.4.1.33, issue #856)
|
|
22195
|
+
const tblPh = placeholderObj ? genXmlPlaceholder(placeholderObj, slideItemObj.options) : '';
|
|
22196
|
+
// MS-PPTX §2.3.1.19: each p14:modId must be unique on the slide (not a constant).
|
|
22197
|
+
const tableModId = typeof slideItemObj.options.modId === 'number' ? slideItemObj.options.modId : TABLE_MOD_ID_BASE + idx;
|
|
22198
|
+
strXml += `<p:cNvGraphicFramePr>${genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock, ' noGrp="1"')}</p:cNvGraphicFramePr>` + ` ${genXmlNvPr(slideItemObj.options, tblPh, [
|
|
22199
|
+
nvPrModIdExt(tableModId)
|
|
22200
|
+
])}` + '</p:nvGraphicFramePr>';
|
|
22201
|
+
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>`;
|
|
22202
|
+
strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">';
|
|
22203
|
+
// NOTE: banding/emphasis only renders when a table style is applied - either `tableStyleId` here or a theme default
|
|
22204
|
+
strXml += `<a:tbl>${genXmlTblPr(objTabOpts)}`;
|
|
22205
|
+
// STEP 2: Set column widths
|
|
22206
|
+
// Evenly distribute cols/rows across size provided when applicable (calc them if only overall dimensions were provided)
|
|
22207
|
+
// A: Col widths provided?
|
|
22208
|
+
// B: Table Width provided without colW? Then distribute cols
|
|
22209
|
+
if (Array.isArray(objTabOpts.colW)) {
|
|
22210
|
+
strXml += '<a:tblGrid>';
|
|
22211
|
+
for(let col = 0; col < intColCnt; col++){
|
|
22212
|
+
let w = inch2Emu(objTabOpts.colW[col]);
|
|
22213
|
+
if (w == null || isNaN(w)) {
|
|
22214
|
+
w = (typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt;
|
|
22124
22215
|
}
|
|
22125
|
-
strXml +=
|
|
22216
|
+
strXml += `<a:gridCol w="${positiveExtent(w)}"/>`;
|
|
22217
|
+
}
|
|
22218
|
+
strXml += '</a:tblGrid>';
|
|
22219
|
+
} else {
|
|
22220
|
+
let intColW = objTabOpts.colW ? objTabOpts.colW : (/* inlined export .EMU */914400);
|
|
22221
|
+
if (slideItemObj.options.w && !objTabOpts.colW) intColW = Math.round((typeof slideItemObj.options.w === 'number' ? slideItemObj.options.w : 1) / intColCnt);
|
|
22222
|
+
strXml += '<a:tblGrid>';
|
|
22223
|
+
for(let colw = 0; colw < intColCnt; colw++){
|
|
22224
|
+
strXml += `<a:gridCol w="${positiveExtent(intColW)}"/>`;
|
|
22126
22225
|
}
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22130
|
-
|
|
22131
|
-
|
|
22226
|
+
strXml += '</a:tblGrid>';
|
|
22227
|
+
}
|
|
22228
|
+
// STEP 3: Build our row arrays into an actual grid to match the XML we will be building next (ISSUE #36)
|
|
22229
|
+
// Note row arrays can arrive "lopsided" as in row1:[1,2,3] row2:[3] when first two cols rowspan!,
|
|
22230
|
+
// so a simple loop below in XML building wont suffice to build table correctly.
|
|
22231
|
+
// We have to build an actual grid now
|
|
22232
|
+
/*
|
|
22132
22233
|
EX: (A0:rowspan=3, B1:rowspan=2, C1:colspan=2)
|
|
22133
22234
|
|
|
22134
22235
|
/------|------|------|------\
|
|
@@ -22137,318 +22238,323 @@ function slideObjectToXml(slide) {
|
|
|
22137
22238
|
| | | C2 | D2 |
|
|
22138
22239
|
\------|------|------|------/
|
|
22139
22240
|
*/ // A: add _hmerge cell for colspan. should reserve rowspan
|
|
22140
|
-
|
|
22141
|
-
|
|
22142
|
-
|
|
22143
|
-
|
|
22144
|
-
|
|
22145
|
-
|
|
22146
|
-
|
|
22147
|
-
|
|
22148
|
-
|
|
22149
|
-
_type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
|
|
22150
|
-
options: {
|
|
22151
|
-
rowspan
|
|
22152
|
-
},
|
|
22153
|
-
_hmerge: true
|
|
22154
|
-
};
|
|
22155
|
-
});
|
|
22156
|
-
cells.splice(cIdx + 1, 0, ...vMergeCells);
|
|
22157
|
-
cIdx += colspan;
|
|
22158
|
-
} else {
|
|
22159
|
-
cIdx += 1;
|
|
22160
|
-
}
|
|
22161
|
-
}
|
|
22162
|
-
});
|
|
22163
|
-
// B: add _vmerge cell for rowspan. should reserve colspan/_hmerge
|
|
22164
|
-
arrTabRows.forEach((cells, rIdx)=>{
|
|
22165
|
-
const nextRow = arrTabRows[rIdx + 1];
|
|
22166
|
-
if (!nextRow) return;
|
|
22167
|
-
cells.forEach((cell, cIdx)=>{
|
|
22168
|
-
var _cell_options, _cell_options1;
|
|
22169
|
-
const rowspan = cell._rowContinue || ((_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan);
|
|
22170
|
-
const colspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.colspan;
|
|
22171
|
-
const _hmerge = cell._hmerge;
|
|
22172
|
-
if (rowspan && rowspan > 1) {
|
|
22173
|
-
const hMergeCell = {
|
|
22241
|
+
arrTabRows.forEach((cells)=>{
|
|
22242
|
+
for(let cIdx = 0; cIdx < cells.length;){
|
|
22243
|
+
var _cell_options, _cell_options1;
|
|
22244
|
+
const cell = cells[cIdx];
|
|
22245
|
+
const colspan = (_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.colspan;
|
|
22246
|
+
const rowspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.rowspan;
|
|
22247
|
+
if (colspan && colspan > 1) {
|
|
22248
|
+
const vMergeCells = new Array(colspan - 1).fill(undefined).map(()=>{
|
|
22249
|
+
return {
|
|
22174
22250
|
_type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
|
|
22175
22251
|
options: {
|
|
22176
|
-
|
|
22252
|
+
rowspan
|
|
22177
22253
|
},
|
|
22178
|
-
|
|
22179
|
-
_vmerge: true,
|
|
22180
|
-
_hmerge
|
|
22254
|
+
_hmerge: true
|
|
22181
22255
|
};
|
|
22182
|
-
|
|
22183
|
-
|
|
22184
|
-
|
|
22185
|
-
|
|
22186
|
-
|
|
22187
|
-
arrTabRows.forEach((cells, rIdx)=>{
|
|
22188
|
-
var _slideItemObj_options;
|
|
22189
|
-
const itemOpts = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
|
|
22190
|
-
// A: Table Height provided without rowH? Then distribute rows
|
|
22191
|
-
let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
|
|
22192
|
-
;
|
|
22193
|
-
// `rowH` is either one value for every row or a per-row array; `inch2Emu` resolves inches, EMU and unit-suffixed strings alike
|
|
22194
|
-
const rowHOpt = Array.isArray(objTabOpts.rowH) ? objTabOpts.rowH[rIdx] : objTabOpts.rowH;
|
|
22195
|
-
const rowHEmu = rowHOpt ? inch2Emu(rowHOpt) : NaN;
|
|
22196
|
-
if (!isNaN(rowHEmu)) intRowH = rowHEmu;
|
|
22197
|
-
else if (itemOpts.cy || itemOpts.h) {
|
|
22198
|
-
intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
|
|
22256
|
+
});
|
|
22257
|
+
cells.splice(cIdx + 1, 0, ...vMergeCells);
|
|
22258
|
+
cIdx += colspan;
|
|
22259
|
+
} else {
|
|
22260
|
+
cIdx += 1;
|
|
22199
22261
|
}
|
|
22200
|
-
|
|
22201
|
-
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
|
|
22207
|
-
|
|
22208
|
-
|
|
22209
|
-
|
|
22210
|
-
|
|
22211
|
-
|
|
22262
|
+
}
|
|
22263
|
+
});
|
|
22264
|
+
// B: add _vmerge cell for rowspan. should reserve colspan/_hmerge
|
|
22265
|
+
arrTabRows.forEach((cells, rIdx)=>{
|
|
22266
|
+
const nextRow = arrTabRows[rIdx + 1];
|
|
22267
|
+
if (!nextRow) return;
|
|
22268
|
+
cells.forEach((cell, cIdx)=>{
|
|
22269
|
+
var _cell_options, _cell_options1;
|
|
22270
|
+
const rowspan = cell._rowContinue || ((_cell_options = cell.options) === null || _cell_options === void 0 ? void 0 : _cell_options.rowspan);
|
|
22271
|
+
const colspan = (_cell_options1 = cell.options) === null || _cell_options1 === void 0 ? void 0 : _cell_options1.colspan;
|
|
22272
|
+
const _hmerge = cell._hmerge;
|
|
22273
|
+
if (rowspan && rowspan > 1) {
|
|
22274
|
+
const hMergeCell = {
|
|
22275
|
+
_type: (/* inlined export .SLIDE_OBJECT_TYPES.tablecell */"tablecell"),
|
|
22276
|
+
options: {
|
|
22277
|
+
colspan
|
|
22278
|
+
},
|
|
22279
|
+
_rowContinue: rowspan - 1,
|
|
22280
|
+
_vmerge: true,
|
|
22281
|
+
_hmerge
|
|
22212
22282
|
};
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
|
|
22219
|
-
|
|
22220
|
-
|
|
22221
|
-
|
|
22222
|
-
|
|
22223
|
-
|
|
22224
|
-
|
|
22225
|
-
|
|
22226
|
-
|
|
22227
|
-
|
|
22228
|
-
|
|
22229
|
-
|
|
22230
|
-
|
|
22231
|
-
|
|
22232
|
-
|
|
22233
|
-
|
|
22234
|
-
|
|
22235
|
-
|
|
22236
|
-
|
|
22237
|
-
|
|
22238
|
-
|
|
22239
|
-
|
|
22240
|
-
|
|
22241
|
-
|
|
22242
|
-
|
|
22243
|
-
|
|
22244
|
-
|
|
22245
|
-
|
|
22246
|
-
|
|
22247
|
-
|
|
22248
|
-
|
|
22249
|
-
|
|
22250
|
-
|
|
22251
|
-
|
|
22252
|
-
|
|
22253
|
-
|
|
22254
|
-
|
|
22255
|
-
|
|
22256
|
-
|
|
22257
|
-
|
|
22258
|
-
|
|
22283
|
+
nextRow.splice(cIdx, 0, hMergeCell);
|
|
22284
|
+
}
|
|
22285
|
+
});
|
|
22286
|
+
});
|
|
22287
|
+
// STEP 4: Build table rows/cells
|
|
22288
|
+
arrTabRows.forEach((cells, rIdx)=>{
|
|
22289
|
+
var _slideItemObj_options;
|
|
22290
|
+
const itemOpts = (_slideItemObj_options = slideItemObj.options) !== null && _slideItemObj_options !== void 0 ? _slideItemObj_options : {};
|
|
22291
|
+
// A: Table Height provided without rowH? Then distribute rows
|
|
22292
|
+
let intRowH = 0 // IMPORTANT: Default must be zero for auto-sizing to work
|
|
22293
|
+
;
|
|
22294
|
+
// `rowH` is either one value for every row or a per-row array; `inch2Emu` resolves inches, EMU and unit-suffixed strings alike
|
|
22295
|
+
const rowHOpt = Array.isArray(objTabOpts.rowH) ? objTabOpts.rowH[rIdx] : objTabOpts.rowH;
|
|
22296
|
+
const rowHEmu = rowHOpt ? inch2Emu(rowHOpt) : NaN;
|
|
22297
|
+
if (!isNaN(rowHEmu)) intRowH = rowHEmu;
|
|
22298
|
+
else if (itemOpts.cy || itemOpts.h) {
|
|
22299
|
+
intRowH = Math.round((itemOpts.h ? inch2Emu(itemOpts.h) : typeof itemOpts.cy === 'number' ? itemOpts.cy : 1) / arrTabRows.length);
|
|
22300
|
+
}
|
|
22301
|
+
// B: Start row
|
|
22302
|
+
strXml += `<a:tr h="${positiveExtent(intRowH)}">`;
|
|
22303
|
+
// C: Loop over each CELL
|
|
22304
|
+
cells.forEach((cellObj)=>{
|
|
22305
|
+
var _ref, _ref1;
|
|
22306
|
+
var _cell_options, _cell_options1, _cell_options2, _cell_options3, _cell__optImp_fill, _cell__optImp, _cell__optImp1;
|
|
22307
|
+
const cell = cellObj;
|
|
22308
|
+
const cellSpanAttrs = {
|
|
22309
|
+
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,
|
|
22310
|
+
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,
|
|
22311
|
+
vMerge: cell._vmerge ? 1 : undefined,
|
|
22312
|
+
hMerge: cell._hmerge ? 1 : undefined
|
|
22313
|
+
};
|
|
22314
|
+
let cellSpanAttrStr = Object.keys(cellSpanAttrs).map((k)=>[
|
|
22315
|
+
k,
|
|
22316
|
+
cellSpanAttrs[k]
|
|
22317
|
+
]).filter(([, v])=>!!v).map(([k, v])=>`${String(k)}="${String(v)}"`).join(' ');
|
|
22318
|
+
if (cellSpanAttrStr) cellSpanAttrStr = ' ' + cellSpanAttrStr;
|
|
22319
|
+
// 1: COLSPAN/ROWSPAN: Add dummy cells for any active colspan/rowspan
|
|
22320
|
+
if (cell._hmerge || cell._vmerge) {
|
|
22321
|
+
strXml += `<a:tc${cellSpanAttrStr}><a:tcPr/></a:tc>`;
|
|
22322
|
+
return;
|
|
22323
|
+
}
|
|
22324
|
+
// 2: OPTIONS: Build/set cell options
|
|
22325
|
+
const cellOpts = cell.options || {};
|
|
22326
|
+
cell.options = cellOpts;
|
|
22327
|
+
[
|
|
22328
|
+
'align',
|
|
22329
|
+
'bold',
|
|
22330
|
+
'border',
|
|
22331
|
+
'color',
|
|
22332
|
+
'fill',
|
|
22333
|
+
'fontFace',
|
|
22334
|
+
'fontSize',
|
|
22335
|
+
'lang',
|
|
22336
|
+
'margin',
|
|
22337
|
+
'textDirection',
|
|
22338
|
+
'vert',
|
|
22339
|
+
'underline',
|
|
22340
|
+
'valign'
|
|
22341
|
+
].forEach((name)=>{
|
|
22342
|
+
if (objTabOpts[name] && !cellOpts[name] && cellOpts[name] !== 0) cellOpts[name] = objTabOpts[name];
|
|
22343
|
+
});
|
|
22344
|
+
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')}"` : '';
|
|
22345
|
+
// `vert` = Martin-N alias of `textDirection`
|
|
22346
|
+
const cellDir = cellOpts.textDirection || cellOpts.vert;
|
|
22347
|
+
const cellTextDir = cellDir && cellDir !== 'horz' ? ` vert="${cellDir}"` : '';
|
|
22348
|
+
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 : '';
|
|
22349
|
+
fillColor = fillColor || cellOpts.fill ? cellOpts.fill : '';
|
|
22350
|
+
let cellFill;
|
|
22351
|
+
if (cellOpts._fillRid) {
|
|
22352
|
+
const fillRel = (slide._relsMedia || []).find((rel)=>rel.rId === cellOpts._fillRid);
|
|
22353
|
+
if ((fillRel === null || fillRel === void 0 ? void 0 : fillRel.extn) === 'svg') {
|
|
22354
|
+
var _cellOpts__fillRid;
|
|
22355
|
+
const pngRid = ((_cellOpts__fillRid = cellOpts._fillRid) !== null && _cellOpts__fillRid !== void 0 ? _cellOpts__fillRid : 0) - 1;
|
|
22356
|
+
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>`;
|
|
22259
22357
|
} else {
|
|
22260
|
-
cellFill =
|
|
22358
|
+
cellFill = `<a:blipFill dpi="0" rotWithShape="1"><a:blip r:embed="rId${cellOpts._fillRid}"/><a:stretch><a:fillRect/></a:stretch></a:blipFill>`;
|
|
22261
22359
|
}
|
|
22262
|
-
|
|
22263
|
-
|
|
22264
|
-
|
|
22265
|
-
|
|
22266
|
-
|
|
22267
|
-
|
|
22268
|
-
|
|
22269
|
-
|
|
22270
|
-
|
|
22271
|
-
|
|
22272
|
-
|
|
22360
|
+
} else {
|
|
22361
|
+
cellFill = fillColor ? genXmlColorSelection(fillColor) : '';
|
|
22362
|
+
}
|
|
22363
|
+
let cellMargin = cellOpts.margin === 0 || cellOpts.margin ? cellOpts.margin : DEF_CELL_MARGIN_IN;
|
|
22364
|
+
if (!Array.isArray(cellMargin) && typeof cellMargin === 'number') cellMargin = [
|
|
22365
|
+
cellMargin,
|
|
22366
|
+
cellMargin,
|
|
22367
|
+
cellMargin,
|
|
22368
|
+
cellMargin
|
|
22369
|
+
];
|
|
22370
|
+
// Guard against non-number/non-array margins (e.g. object/string) which otherwise yield marL="NaN" and trigger PowerPoint repair
|
|
22371
|
+
if (!Array.isArray(cellMargin)) cellMargin = DEF_CELL_MARGIN_IN;
|
|
22372
|
+
cellMargin = cellMargin.map((v)=>typeof v === 'number' && isFinite(v) ? v : 0);
|
|
22373
|
+
/** FUTURE: DEPRECATED:
|
|
22273
22374
|
* - Backwards-Compat: Oops! Discovered we were still using points for cell margin before v3.8.0 (UGH!)
|
|
22274
22375
|
* - We cant introduce a breaking change before v4.0, so...
|
|
22275
22376
|
*/ 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])}"`;
|
|
22276
|
-
|
|
22277
|
-
|
|
22278
|
-
|
|
22279
|
-
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
|
|
22287
|
-
|
|
22288
|
-
|
|
22289
|
-
|
|
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
|
-
|
|
22319
|
-
|
|
22320
|
-
|
|
22321
|
-
|
|
22322
|
-
|
|
22323
|
-
|
|
22324
|
-
|
|
22325
|
-
|
|
22326
|
-
|
|
22327
|
-
|
|
22328
|
-
|
|
22329
|
-
|
|
22330
|
-
|
|
22331
|
-
});
|
|
22332
|
-
// D: Complete row
|
|
22333
|
-
strXml += '</a:tr>';
|
|
22377
|
+
const cellOverflow = cellOpts.horzOverflow === 'overflow' || cellOpts.horzOverflow === 'clip' ? ` horzOverflow="${cellOpts.horzOverflow}"` : '';
|
|
22378
|
+
const cellAnchorCtr = cellOpts.anchorCtr === true ? ' anchorCtr="1"' : '';
|
|
22379
|
+
// 4: Set CELL content and properties ==================================
|
|
22380
|
+
strXml += `<a:tc${cellSpanAttrStr}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}${cellAnchorCtr}${cellOverflow}>`;
|
|
22381
|
+
// strXml += `<a:tc${cellColspan}${cellRowspan}>${genXmlTextBody(cell)}<a:tcPr${cellMarginXml}${cellValign}${cellTextDir}>`
|
|
22382
|
+
// FIXME: 20200525: ^^^
|
|
22383
|
+
// <a:tcPr marL="38100" marR="38100" marT="38100" marB="38100" vert="vert270">
|
|
22384
|
+
// 5: Borders: Add any borders
|
|
22385
|
+
if (cellOpts.border && Array.isArray(cellOpts.border)) {
|
|
22386
|
+
const border = cellOpts.border;
|
|
22387
|
+
[
|
|
22388
|
+
{
|
|
22389
|
+
idx: 3,
|
|
22390
|
+
name: 'lnL'
|
|
22391
|
+
},
|
|
22392
|
+
{
|
|
22393
|
+
idx: 1,
|
|
22394
|
+
name: 'lnR'
|
|
22395
|
+
},
|
|
22396
|
+
{
|
|
22397
|
+
idx: 0,
|
|
22398
|
+
name: 'lnT'
|
|
22399
|
+
},
|
|
22400
|
+
{
|
|
22401
|
+
idx: 2,
|
|
22402
|
+
name: 'lnB'
|
|
22403
|
+
}
|
|
22404
|
+
].forEach((obj)=>{
|
|
22405
|
+
strXml += genXmlCellBorder(obj.name, border[obj.idx]);
|
|
22406
|
+
});
|
|
22407
|
+
}
|
|
22408
|
+
// 5b: Diagonals follow the four edges in the CT_TableCellProperties sequence, and are
|
|
22409
|
+
// written only when asked for - unlike the edges, which are always emitted as a set
|
|
22410
|
+
if (cellOpts.borderDiagonalDown) strXml += genXmlCellBorder('lnTlToBr', cellOpts.borderDiagonalDown);
|
|
22411
|
+
if (cellOpts.borderDiagonalUp) strXml += genXmlCellBorder('lnBlToTr', cellOpts.borderDiagonalUp);
|
|
22412
|
+
// 5c: `a:cell3D` follows the diagonals and precedes the fill
|
|
22413
|
+
if (cellOpts.cell3D) {
|
|
22414
|
+
var _cell3D_bevel;
|
|
22415
|
+
var _cell3D_lightRig;
|
|
22416
|
+
const cell3D = cellOpts.cell3D;
|
|
22417
|
+
const bevel = (_cell3D_bevel = cell3D.bevel) !== null && _cell3D_bevel !== void 0 ? _cell3D_bevel : {};
|
|
22418
|
+
let bevelAttrs = '';
|
|
22419
|
+
if (typeof bevel.width === 'number' && isFinite(bevel.width) && bevel.width >= 0) bevelAttrs += ` w="${inch2Emu(bevel.width)}"`;
|
|
22420
|
+
if (typeof bevel.height === 'number' && isFinite(bevel.height) && bevel.height >= 0) bevelAttrs += ` h="${inch2Emu(bevel.height)}"`;
|
|
22421
|
+
if (bevel.preset) bevelAttrs += ` prst="${bevel.preset}"`;
|
|
22422
|
+
// `rig` and `dir` are both required on CT_LightRig, so a partial rig is dropped rather
|
|
22423
|
+
// than emitted as an element PowerPoint would refuse to open
|
|
22424
|
+
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}"/>` : '';
|
|
22425
|
+
// `a:bevel` is required by the schema, so it is always written
|
|
22426
|
+
strXml += `<a:cell3D${cell3D.material ? ` prstMaterial="${cell3D.material}"` : ''}><a:bevel${bevelAttrs}/>${lightRig}</a:cell3D>`;
|
|
22427
|
+
}
|
|
22428
|
+
// 6: Close cell Properties & Cell
|
|
22429
|
+
strXml += cellFill;
|
|
22430
|
+
strXml += ' </a:tcPr>';
|
|
22431
|
+
strXml += ' </a:tc>';
|
|
22334
22432
|
});
|
|
22335
|
-
//
|
|
22336
|
-
strXml += '
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
|
|
22342
|
-
|
|
22433
|
+
// D: Complete row
|
|
22434
|
+
strXml += '</a:tr>';
|
|
22435
|
+
});
|
|
22436
|
+
// STEP 5: Complete table
|
|
22437
|
+
strXml += ' </a:tbl>';
|
|
22438
|
+
strXml += ' </a:graphicData>';
|
|
22439
|
+
strXml += ' </a:graphic>';
|
|
22440
|
+
strXml += '</p:graphicFrame>';
|
|
22441
|
+
// STEP 6: Set table XML
|
|
22442
|
+
strSlideXml += strXml;
|
|
22443
|
+
break;
|
|
22444
|
+
}
|
|
22445
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.text */"text"):
|
|
22446
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.placeholder */"placeholder"):
|
|
22447
|
+
{
|
|
22448
|
+
var _slideItemObj_options_line2, _slideItemObj_options_styleRef;
|
|
22449
|
+
const isConnector = !!((_slideItemObj_options_line2 = slideItemObj.options.line) === null || _slideItemObj_options_line2 === void 0 ? void 0 : _slideItemObj_options_line2.isConnector);
|
|
22450
|
+
// Lines can have zero cy, but text should not
|
|
22451
|
+
if (!slideItemObj.options.line && cy === 0) cy = (/* inlined export .EMU */914400) * 0.3;
|
|
22452
|
+
// Text margins are applied in addTextDefinition → `_bodyProp` (TRBL)
|
|
22453
|
+
// A: Start SHAPE / CONNECTOR ============================================
|
|
22454
|
+
if (isConnector) {
|
|
22455
|
+
var _slideItemObj_options_objectName1, _ref, _ref1;
|
|
22456
|
+
var _slideItemObj_options_line3, _slideItemObj_options_line4, _slideItemObj_options_line5, _slideItemObj_options_line6;
|
|
22457
|
+
strSlideXml += '<p:cxnSp>';
|
|
22458
|
+
strSlideXml += `<p:nvCxnSpPr>${genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName1 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName1 !== void 0 ? _slideItemObj_options_objectName1 : ''), slideItemObj.options)}`;
|
|
22459
|
+
const cxnLocks = genXmlLocks('a:cxnSpLocks', slideItemObj.options.lock);
|
|
22460
|
+
const stId = (_slideItemObj_options_line3 = slideItemObj.options.line) === null || _slideItemObj_options_line3 === void 0 ? void 0 : _slideItemObj_options_line3.sourceId;
|
|
22461
|
+
const endId = (_slideItemObj_options_line4 = slideItemObj.options.line) === null || _slideItemObj_options_line4 === void 0 ? void 0 : _slideItemObj_options_line4.targetId;
|
|
22462
|
+
strSlideXml += `<p:cNvCxnSpPr>${cxnLocks}`;
|
|
22463
|
+
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}"/>`;
|
|
22464
|
+
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}"/>`;
|
|
22465
|
+
strSlideXml += '</p:cNvCxnSpPr>';
|
|
22466
|
+
strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
|
|
22467
|
+
nvPrModIdExt(slideItemObj.options.modId)
|
|
22468
|
+
])}</p:nvCxnSpPr><p:spPr>`;
|
|
22469
|
+
} else {
|
|
22470
|
+
var _slideItemObj_options_objectName2;
|
|
22471
|
+
var _slideItemObj_options3;
|
|
22472
|
+
strSlideXml += '<p:sp>';
|
|
22473
|
+
// B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
|
|
22474
|
+
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));
|
|
22475
|
+
// PowerPoint math zones are authored in text boxes; force txBox when OMML is present
|
|
22476
|
+
const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
|
|
22477
|
+
strSlideXml += genXmlCNvSpPr(slide_object_spread_props(xml_slide_object_spread({}, slideItemObj.options), {
|
|
22478
|
+
isTextBox: useTxBox
|
|
22479
|
+
}));
|
|
22480
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
|
|
22481
|
+
nvPrModIdExt(slideItemObj.options.modId)
|
|
22482
|
+
]);
|
|
22483
|
+
strSlideXml += '</p:nvSpPr><p:spPr>';
|
|
22343
22484
|
}
|
|
22344
|
-
|
|
22345
|
-
|
|
22346
|
-
{
|
|
22347
|
-
|
|
22348
|
-
|
|
22349
|
-
|
|
22350
|
-
|
|
22351
|
-
|
|
22352
|
-
//
|
|
22353
|
-
|
|
22354
|
-
|
|
22355
|
-
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
|
|
22362
|
-
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}"/>`;
|
|
22363
|
-
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}"/>`;
|
|
22364
|
-
strSlideXml += '</p:cNvCxnSpPr>';
|
|
22365
|
-
strSlideXml += `${genXmlNvPr(slideItemObj.options, '', [
|
|
22366
|
-
nvPrModIdExt(slideItemObj.options.modId)
|
|
22367
|
-
])}</p:nvCxnSpPr><p:spPr>`;
|
|
22368
|
-
} else {
|
|
22369
|
-
var _slideItemObj_options_objectName2;
|
|
22370
|
-
var _slideItemObj_options3;
|
|
22371
|
-
strSlideXml += '<p:sp>';
|
|
22372
|
-
// B: The addition of the "txBox" attribute is the sole determiner of if an object is a shape or textbox
|
|
22373
|
-
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));
|
|
22374
|
-
// PowerPoint math zones are authored in text boxes; force txBox when OMML is present
|
|
22375
|
-
const useTxBox = Boolean((_slideItemObj_options3 = slideItemObj.options) === null || _slideItemObj_options3 === void 0 ? void 0 : _slideItemObj_options3.isTextBox) || textRunsHaveOmml(slideItemObj.text);
|
|
22376
|
-
strSlideXml += genXmlCNvSpPr(slide_object_spread_props(xml_slide_object_spread({}, slideItemObj.options), {
|
|
22377
|
-
isTextBox: useTxBox
|
|
22378
|
-
}));
|
|
22379
|
-
strSlideXml += genXmlNvPr(slideItemObj.options, slideItemObj._type === 'placeholder' ? genXmlPlaceholder(slideItemObj, slideItemObj.options) : genXmlPlaceholder(placeholderObj, slideItemObj.options), [
|
|
22380
|
-
nvPrModIdExt(slideItemObj.options.modId)
|
|
22381
|
-
]);
|
|
22382
|
-
strSlideXml += '</p:nvSpPr><p:spPr>';
|
|
22383
|
-
}
|
|
22384
|
-
strSlideXml += `<a:xfrm${locationAttr}>`;
|
|
22385
|
-
strSlideXml += `<a:off x="${x}" y="${y}"/>`;
|
|
22386
|
-
strSlideXml += `<a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22387
|
-
if (!isConnector && slideItemObj.shape === 'custGeom') {
|
|
22388
|
-
strSlideXml += genCustGeomXml(slideItemObj, cx, cy, slide);
|
|
22389
|
-
} else {
|
|
22390
|
-
var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line7;
|
|
22391
|
-
strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
|
|
22392
|
-
// `rectRadius` adj is a 0..50000 fraction of the shorter side; clamp out-of-range / zero-extent results.
|
|
22393
|
-
// `round2SameRect` uses two handles (`adj1` top corners, `adj2` bottom corners) — single `adj` is ignored.
|
|
22394
|
-
if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius)) {
|
|
22395
|
-
const minDim = Math.min(cx, cy);
|
|
22396
|
-
const rawAdj = minDim > 0 ? slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / minDim : slideItemObj.options.rectRadius > 0 ? 50000 : 0;
|
|
22397
|
-
const adjVal = clampInt(rawAdj, 0, 50000);
|
|
22398
|
-
if (slideItemObj.shape === core_enums_SHAPE_TYPE.ROUND_2_SAME_RECTANGLE) {
|
|
22399
|
-
strSlideXml += `<a:gd name="adj1" fmla="val ${adjVal}"/><a:gd name="adj2" fmla="val 0"/>`;
|
|
22400
|
-
} else {
|
|
22401
|
-
strSlideXml += `<a:gd name="adj" fmla="val ${adjVal}"/>`;
|
|
22402
|
-
}
|
|
22403
|
-
} else if (slideItemObj.options.angleRange) {
|
|
22404
|
-
for(let i = 0; i < 2; i++){
|
|
22405
|
-
const angle = slideItemObj.options.angleRange[i];
|
|
22406
|
-
strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${convertRotationDegrees(angle)}" />`;
|
|
22407
|
-
}
|
|
22408
|
-
if (slideItemObj.options.arcThicknessRatio) {
|
|
22409
|
-
strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
|
|
22410
|
-
}
|
|
22485
|
+
strSlideXml += `<a:xfrm${locationAttr}>`;
|
|
22486
|
+
strSlideXml += `<a:off x="${x}" y="${y}"/>`;
|
|
22487
|
+
strSlideXml += `<a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22488
|
+
if (!isConnector && slideItemObj.shape === 'custGeom') {
|
|
22489
|
+
strSlideXml += genCustGeomXml(slideItemObj, cx, cy, slide);
|
|
22490
|
+
} else {
|
|
22491
|
+
var _slideItemObj_options_line_curveadjust, _slideItemObj_options_line7;
|
|
22492
|
+
strSlideXml += '<a:prstGeom prst="' + slideItemObj.shape + '"><a:avLst>';
|
|
22493
|
+
// `rectRadius` adj is a 0..50000 fraction of the shorter side; clamp out-of-range / zero-extent results.
|
|
22494
|
+
// `round2SameRect` uses two handles (`adj1` top corners, `adj2` bottom corners) — single `adj` is ignored.
|
|
22495
|
+
if (typeof slideItemObj.options.rectRadius === 'number' && Number.isFinite(slideItemObj.options.rectRadius)) {
|
|
22496
|
+
const minDim = Math.min(cx, cy);
|
|
22497
|
+
const rawAdj = minDim > 0 ? slideItemObj.options.rectRadius * (/* inlined export .EMU */914400) * 100000 / minDim : slideItemObj.options.rectRadius > 0 ? 50000 : 0;
|
|
22498
|
+
const adjVal = clampInt(rawAdj, 0, 50000);
|
|
22499
|
+
if (slideItemObj.shape === core_enums_SHAPE_TYPE.ROUND_2_SAME_RECTANGLE) {
|
|
22500
|
+
strSlideXml += `<a:gd name="adj1" fmla="val ${adjVal}"/><a:gd name="adj2" fmla="val 0"/>`;
|
|
22501
|
+
} else {
|
|
22502
|
+
strSlideXml += `<a:gd name="adj" fmla="val ${adjVal}"/>`;
|
|
22411
22503
|
}
|
|
22412
|
-
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
})
|
|
22504
|
+
} else if (slideItemObj.options.angleRange) {
|
|
22505
|
+
for(let i = 0; i < 2; i++){
|
|
22506
|
+
const angle = slideItemObj.options.angleRange[i];
|
|
22507
|
+
strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${convertRotationDegrees(angle)}" />`;
|
|
22508
|
+
}
|
|
22509
|
+
if (slideItemObj.options.arcThicknessRatio) {
|
|
22510
|
+
strSlideXml += `<a:gd name="adj3" fmla="val ${Math.round(slideItemObj.options.arcThicknessRatio * 50000)}" />`;
|
|
22416
22511
|
}
|
|
22417
|
-
strSlideXml += '</a:avLst></a:prstGeom>';
|
|
22418
22512
|
}
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
|
|
22444
|
-
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
|
|
22513
|
+
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)) {
|
|
22514
|
+
slideItemObj.options.line.curveadjust.forEach((adj, i)=>{
|
|
22515
|
+
strSlideXml += `<a:gd name="adj${i + 1}" fmla="val ${Math.round(Number(adj))}"/>`;
|
|
22516
|
+
});
|
|
22517
|
+
}
|
|
22518
|
+
strSlideXml += '</a:avLst></a:prstGeom>';
|
|
22519
|
+
}
|
|
22520
|
+
// Option: FILL
|
|
22521
|
+
// With a fillRef and no explicit fill, omit the fill element so the theme inherits
|
|
22522
|
+
if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
|
|
22523
|
+
else if (!((_slideItemObj_options_styleRef = slideItemObj.options.styleRef) === null || _slideItemObj_options_styleRef === void 0 ? void 0 : _slideItemObj_options_styleRef.fill)) strSlideXml += '<a:noFill/>';
|
|
22524
|
+
// shape Type: LINE: line color
|
|
22525
|
+
if (slideItemObj.options.line) strSlideXml += genXmlLine(slideItemObj.options.line);
|
|
22526
|
+
// EFFECTS: shadow / glow / softEdge / reflection / fillOverlay / blur
|
|
22527
|
+
// REF: @see http://officeopenxml.com/drwSp-effects.php
|
|
22528
|
+
strSlideXml += genXmlEffectLst({
|
|
22529
|
+
shadow: slideItemObj.options.shadow,
|
|
22530
|
+
glow: slideItemObj.options.glow,
|
|
22531
|
+
softEdge: slideItemObj.options.softEdge,
|
|
22532
|
+
reflection: slideItemObj.options.reflection,
|
|
22533
|
+
blur: slideItemObj.options.blur,
|
|
22534
|
+
fillOverlay: slideItemObj.options.fillOverlay,
|
|
22535
|
+
effectDag: slideItemObj.options.effectDag
|
|
22536
|
+
});
|
|
22537
|
+
// B: Close shape Properties
|
|
22538
|
+
strSlideXml += '</p:spPr>';
|
|
22539
|
+
// `p:style` follows `p:spPr` in CT_Shape / CT_Connector
|
|
22540
|
+
strSlideXml += genXmlShapeStyle(slideItemObj.options.styleRef);
|
|
22541
|
+
if (isConnector) {
|
|
22542
|
+
// Connectors have no text body
|
|
22543
|
+
strSlideXml += '</p:cxnSp>';
|
|
22544
|
+
} else {
|
|
22545
|
+
// C: Add formatted text (text body "bodyPr")
|
|
22546
|
+
strSlideXml += genXmlTextBody(slideItemObj);
|
|
22547
|
+
// LAST: Close SHAPE =======================================================
|
|
22548
|
+
strSlideXml += '</p:sp>';
|
|
22549
|
+
if (slideItemObj._fallbackImage) {
|
|
22550
|
+
const fallbackXml = renderObject(slideItemObj._fallbackImage, idx);
|
|
22551
|
+
strSlideXml = `<mc:AlternateContent><mc:Choice Requires="a14">${strSlideXml}</mc:Choice><mc:Fallback>${fallbackXml}</mc:Fallback></mc:AlternateContent>`;
|
|
22448
22552
|
}
|
|
22449
|
-
break;
|
|
22450
22553
|
}
|
|
22451
|
-
|
|
22554
|
+
break;
|
|
22555
|
+
}
|
|
22556
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.image */"image"):
|
|
22557
|
+
{
|
|
22452
22558
|
var _slideItemObj_options_objectName3;
|
|
22453
22559
|
var _slideItemObj_options_lock;
|
|
22454
22560
|
strSlideXml += '<p:pic>';
|
|
@@ -22477,7 +22583,16 @@ function slideObjectToXml(slide) {
|
|
|
22477
22583
|
strSlideXml += genXmlBlipEffects(slideItemObj.options.transparency, slideItemObj.options.alphaEffects, slideItemObj.options.recolor);
|
|
22478
22584
|
strSlideXml += '</a:blip>';
|
|
22479
22585
|
}
|
|
22480
|
-
|
|
22586
|
+
const crop = slideItemObj.options.crop;
|
|
22587
|
+
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));
|
|
22588
|
+
if (hasCrop) {
|
|
22589
|
+
// 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>.
|
|
22590
|
+
const lAttr = typeof crop.l === 'number' && Number.isFinite(crop.l) ? ` l="${clampInt(Math.round(crop.l * 1000), 0, 100000)}"` : '';
|
|
22591
|
+
const tAttr = typeof crop.t === 'number' && Number.isFinite(crop.t) ? ` t="${clampInt(Math.round(crop.t * 1000), 0, 100000)}"` : '';
|
|
22592
|
+
const rAttr = typeof crop.r === 'number' && Number.isFinite(crop.r) ? ` r="${clampInt(Math.round(crop.r * 1000), 0, 100000)}"` : '';
|
|
22593
|
+
const bAttr = typeof crop.b === 'number' && Number.isFinite(crop.b) ? ` b="${clampInt(Math.round(crop.b * 1000), 0, 100000)}"` : '';
|
|
22594
|
+
strSlideXml += `<a:srcRect${lAttr}${tAttr}${rAttr}${bAttr}/><a:stretch><a:fillRect/></a:stretch>`;
|
|
22595
|
+
} else if (sizing === null || sizing === void 0 ? void 0 : sizing.type) {
|
|
22481
22596
|
const boxW = sizing.w ? getSmartParseNumber(sizing.w, 'X', slide._presLayout) : cx;
|
|
22482
22597
|
const boxH = sizing.h ? getSmartParseNumber(sizing.h, 'Y', slide._presLayout) : cy;
|
|
22483
22598
|
const boxX = getSmartParseNumber(sizing.x || 0, 'X', slide._presLayout);
|
|
@@ -22550,237 +22665,239 @@ function slideObjectToXml(slide) {
|
|
|
22550
22665
|
strSlideXml += genXmlShapeStyle(slideItemObj.options.styleRef);
|
|
22551
22666
|
strSlideXml += '</p:pic>';
|
|
22552
22667
|
break;
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
}
|
|
22568
|
-
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:wavAudioFile r:embed="rId${slideItemObj.mediaRid}"${slideItemObj.options.objectName ? ` name="${slideItemObj.options.objectName}"` : ''}/>`);
|
|
22569
|
-
}
|
|
22570
|
-
strSlideXml += ' </p:nvPicPr>';
|
|
22571
|
-
strSlideXml += ` <p:blipFill><a:blip r:embed="rId${coverRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
|
|
22572
|
-
strSlideXml += ' <p:spPr>';
|
|
22573
|
-
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22574
|
-
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22575
|
-
strSlideXml += ' </p:spPr>';
|
|
22576
|
-
strSlideXml += '</p:pic>';
|
|
22577
|
-
} else if (slideItemObj.mtype === 'online') {
|
|
22578
|
-
var _slideItemObj_mediaRid;
|
|
22579
|
-
const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
|
|
22580
|
-
strSlideXml += '<p:pic>';
|
|
22581
|
-
strSlideXml += ' <p:nvPicPr>';
|
|
22582
|
-
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"/>`;
|
|
22583
|
-
strSlideXml += ' <p:cNvPicPr/>';
|
|
22584
|
-
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"${contentType}/>`);
|
|
22585
|
-
strSlideXml += ' </p:nvPicPr>';
|
|
22586
|
-
// NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
|
|
22587
|
-
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!
|
|
22588
|
-
strSlideXml += ' <p:spPr>';
|
|
22589
|
-
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22590
|
-
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22591
|
-
strSlideXml += ' </p:spPr>';
|
|
22592
|
-
strSlideXml += '</p:pic>';
|
|
22668
|
+
}
|
|
22669
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.media */"media"):
|
|
22670
|
+
if (slideItemObj.mtype === 'audioCd' || slideItemObj.mtype === 'wav') {
|
|
22671
|
+
var _slideItemObj__coverRid;
|
|
22672
|
+
// EG_Media is a choice, so these carry exactly one media element and no `p14:media`:
|
|
22673
|
+
// `a:audioCd` references the listener's drive and `a:wavAudioFile` is the legacy
|
|
22674
|
+
// embedded-WAV element, so neither has an embedded media part to point at
|
|
22675
|
+
const coverRid = (_slideItemObj__coverRid = slideItemObj._coverRid) !== null && _slideItemObj__coverRid !== void 0 ? _slideItemObj__coverRid : 2;
|
|
22676
|
+
strSlideXml += '<p:pic>';
|
|
22677
|
+
strSlideXml += ' <p:nvPicPr>';
|
|
22678
|
+
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
|
|
22679
|
+
strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
|
|
22680
|
+
if (slideItemObj.mtype === 'audioCd') {
|
|
22681
|
+
const cd = slideItemObj.options.audioCd;
|
|
22682
|
+
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>`);
|
|
22593
22683
|
} else {
|
|
22594
|
-
|
|
22595
|
-
// ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
|
|
22596
|
-
const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
|
|
22597
|
-
const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
|
|
22598
|
-
strSlideXml += '<p:pic>';
|
|
22599
|
-
strSlideXml += ' <p:nvPicPr>';
|
|
22600
|
-
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
|
|
22601
|
-
strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
|
|
22602
|
-
const mediaExtras = genXmlMediaExtras(slideItemObj.options);
|
|
22603
|
-
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>';
|
|
22604
|
-
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>' : '';
|
|
22605
|
-
strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"${contentType}/>`, narrationExt ? [
|
|
22606
|
-
mediaExt,
|
|
22607
|
-
narrationExt
|
|
22608
|
-
] : [
|
|
22609
|
-
mediaExt
|
|
22610
|
-
]);
|
|
22611
|
-
strSlideXml += ' </p:nvPicPr>';
|
|
22612
|
-
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!
|
|
22613
|
-
strSlideXml += ' <p:spPr>';
|
|
22614
|
-
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22615
|
-
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22616
|
-
strSlideXml += ' </p:spPr>';
|
|
22617
|
-
strSlideXml += '</p:pic>';
|
|
22684
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:wavAudioFile r:embed="rId${slideItemObj.mediaRid}"${slideItemObj.options.objectName ? ` name="${slideItemObj.options.objectName}"` : ''}/>`);
|
|
22618
22685
|
}
|
|
22619
|
-
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
|
|
22623
|
-
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
|
|
22644
|
-
|
|
22645
|
-
|
|
22646
|
-
|
|
22647
|
-
|
|
22648
|
-
|
|
22649
|
-
|
|
22650
|
-
|
|
22651
|
-
|
|
22652
|
-
|
|
22653
|
-
|
|
22654
|
-
|
|
22655
|
-
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
|
|
22659
|
-
|
|
22660
|
-
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
|
|
22664
|
-
|
|
22665
|
-
|
|
22666
|
-
|
|
22667
|
-
|
|
22668
|
-
|
|
22669
|
-
|
|
22670
|
-
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
locationAttr,
|
|
22707
|
-
coverRid: (_slideItemObj_coverRid = slideItemObj.coverRid) !== null && _slideItemObj_coverRid !== void 0 ? _slideItemObj_coverRid : 0
|
|
22708
|
-
});
|
|
22709
|
-
break;
|
|
22710
|
-
}
|
|
22711
|
-
case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
|
|
22712
|
-
{
|
|
22713
|
-
var _slideItemObj_options_objectName4;
|
|
22714
|
-
var _slideItemObj_options4;
|
|
22715
|
-
const chartType = (_slideItemObj_options4 = slideItemObj.options) === null || _slideItemObj_options4 === void 0 ? void 0 : _slideItemObj_options4._type;
|
|
22716
|
-
const isChartex = isChartexType(chartType);
|
|
22717
|
-
const graphicDataUri = isChartex ? OOXML_CHARTEX.ns : 'http://schemas.openxmlformats.org/drawingml/2006/chart';
|
|
22718
|
-
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"/>`;
|
|
22719
|
-
const chartLocks = genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock);
|
|
22720
|
-
let frameXml = '<p:graphicFrame>';
|
|
22721
|
-
frameXml += ' <p:nvGraphicFramePr>';
|
|
22722
|
-
frameXml += genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName4 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName4 !== void 0 ? _slideItemObj_options_objectName4 : ''), slideItemObj.options, slideItemObj.options.altText || '');
|
|
22723
|
-
frameXml += chartLocks ? ` <p:cNvGraphicFramePr>${chartLocks}</p:cNvGraphicFramePr>` : ' <p:cNvGraphicFramePr/>';
|
|
22724
|
-
frameXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
|
|
22725
|
-
nvPrModIdExt(slideItemObj.options.modId)
|
|
22726
|
-
]);
|
|
22727
|
-
frameXml += ' </p:nvGraphicFramePr>';
|
|
22728
|
-
frameXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
|
|
22729
|
-
frameXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
|
|
22730
|
-
frameXml += ` <a:graphicData uri="${graphicDataUri}">`;
|
|
22731
|
-
frameXml += ` ${chartRef}`;
|
|
22732
|
-
frameXml += ' </a:graphicData>';
|
|
22733
|
-
frameXml += ' </a:graphic>';
|
|
22734
|
-
frameXml += '</p:graphicFrame>';
|
|
22735
|
-
// A chartex frame replaces a standard graphic frame, so MS-PPTX 2.2 requires it be offered
|
|
22736
|
-
// through `mc:AlternateContent`. PowerPoint's own fallback is a rendered preview image, which
|
|
22737
|
-
// cannot be produced here - a locked text shape carrying the same message is the honest
|
|
22738
|
-
// equivalent for a consumer that does not understand the chartex namespace.
|
|
22739
|
-
strSlideXml += isChartex ? `<mc:AlternateContent xmlns:mc="${MC_NS}">` + `<mc:Choice xmlns:cx1="${chartExRequiresNs(chartType)}" Requires="cx1">` + frameXml + '</mc:Choice>' + `<mc:Fallback>${genXmlChartExFallback(shapeId, slideItemObj, {
|
|
22740
|
-
x,
|
|
22741
|
-
y,
|
|
22742
|
-
cx,
|
|
22743
|
-
cy
|
|
22744
|
-
})}</mc:Fallback>` + '</mc:AlternateContent>' : frameXml;
|
|
22745
|
-
break;
|
|
22686
|
+
strSlideXml += ' </p:nvPicPr>';
|
|
22687
|
+
strSlideXml += ` <p:blipFill><a:blip r:embed="rId${coverRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
|
|
22688
|
+
strSlideXml += ' <p:spPr>';
|
|
22689
|
+
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22690
|
+
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22691
|
+
strSlideXml += ' </p:spPr>';
|
|
22692
|
+
strSlideXml += '</p:pic>';
|
|
22693
|
+
} else if (slideItemObj.mtype === 'online') {
|
|
22694
|
+
var _slideItemObj_mediaRid;
|
|
22695
|
+
const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
|
|
22696
|
+
strSlideXml += '<p:pic>';
|
|
22697
|
+
strSlideXml += ' <p:nvPicPr>';
|
|
22698
|
+
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"/>`;
|
|
22699
|
+
strSlideXml += ' <p:cNvPicPr/>';
|
|
22700
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, `<a:videoFile r:link="rId${slideItemObj.mediaRid}"${contentType}/>`);
|
|
22701
|
+
strSlideXml += ' </p:nvPicPr>';
|
|
22702
|
+
// NOTE: `blip` is diferent than videos; also there's no preview "p:extLst" above but exists in videos
|
|
22703
|
+
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!
|
|
22704
|
+
strSlideXml += ' <p:spPr>';
|
|
22705
|
+
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22706
|
+
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22707
|
+
strSlideXml += ' </p:spPr>';
|
|
22708
|
+
strSlideXml += '</p:pic>';
|
|
22709
|
+
} else {
|
|
22710
|
+
var _slideItemObj_mediaRid1, _slideItemObj_mediaRid2, _slideItemObj_mediaRid3;
|
|
22711
|
+
// ECMA-376: audio uses `<a:audioFile>`, video uses `<a:videoFile>` under nvPr.
|
|
22712
|
+
const mediaFileTag = slideItemObj.mtype === 'audio' ? 'a:audioFile' : 'a:videoFile';
|
|
22713
|
+
const contentType = slideItemObj.options.contentType ? ` contentType="${encodeXmlEntities(slideItemObj.options.contentType)}"` : '';
|
|
22714
|
+
strSlideXml += '<p:pic>';
|
|
22715
|
+
strSlideXml += ' <p:nvPicPr>';
|
|
22716
|
+
strSlideXml += `<p:cNvPr id="${shapeId}" name="${slideItemObj.options.objectName}"><a:hlinkClick r:id="" action="ppaction://media"/></p:cNvPr>`;
|
|
22717
|
+
strSlideXml += ' <p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr>';
|
|
22718
|
+
const mediaExtras = genXmlMediaExtras(slideItemObj.options);
|
|
22719
|
+
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>';
|
|
22720
|
+
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>' : '';
|
|
22721
|
+
strSlideXml += genXmlNvPr(slideItemObj.options, `<${mediaFileTag} r:link="rId${slideItemObj.mediaRid}"${contentType}/>`, narrationExt ? [
|
|
22722
|
+
mediaExt,
|
|
22723
|
+
narrationExt
|
|
22724
|
+
] : [
|
|
22725
|
+
mediaExt
|
|
22726
|
+
]);
|
|
22727
|
+
strSlideXml += ' </p:nvPicPr>';
|
|
22728
|
+
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!
|
|
22729
|
+
strSlideXml += ' <p:spPr>';
|
|
22730
|
+
strSlideXml += ` <a:xfrm${locationAttr}><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
|
|
22731
|
+
strSlideXml += ' <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>';
|
|
22732
|
+
strSlideXml += ' </p:spPr>';
|
|
22733
|
+
strSlideXml += '</p:pic>';
|
|
22734
|
+
}
|
|
22735
|
+
break;
|
|
22736
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.zoom */"zoom"):
|
|
22737
|
+
{
|
|
22738
|
+
var _slideItemObj_zoomKind, _slideItemObj_zoomRid;
|
|
22739
|
+
// MS-PPTX §2.2.15: mc:AlternateContent { Choice p16:{sldZm|sectionZm|summaryZm} | Fallback }.
|
|
22740
|
+
const zOpts = slideItemObj.options;
|
|
22741
|
+
const zKind = (_slideItemObj_zoomKind = slideItemObj.zoomKind) !== null && _slideItemObj_zoomKind !== void 0 ? _slideItemObj_zoomKind : 'slide';
|
|
22742
|
+
const zRid = (_slideItemObj_zoomRid = slideItemObj.zoomRid) !== null && _slideItemObj_zoomRid !== void 0 ? _slideItemObj_zoomRid : 0;
|
|
22743
|
+
const zId = getUuid('{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}');
|
|
22744
|
+
const zRet = zOpts.returnToParent === false ? '0' : '1';
|
|
22745
|
+
const zShowBg = zOpts.showBg === false ? '0' : '1';
|
|
22746
|
+
const zDur = typeof zOpts.transitionDur === 'number' ? ` p14:transitionDur="${Math.round(zOpts.transitionDur)}"` : '';
|
|
22747
|
+
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>`;
|
|
22748
|
+
const zFill = `<p:blipFill><a:blip r:embed="rId${zRid}"/><a:stretch><a:fillRect/></a:stretch></p:blipFill>`;
|
|
22749
|
+
const zmPr = `<p166:zmPr id="${zId}" returnToParent="${zRet}" showBg="${zShowBg}" imageType="preview"${zDur}>${zFill}<p:spPr>${zGeom}</p:spPr></p166:zmPr>`;
|
|
22750
|
+
const nsMap = {
|
|
22751
|
+
slide: 'http://schemas.microsoft.com/office/powerpoint/2016/slidezoom',
|
|
22752
|
+
section: 'http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom',
|
|
22753
|
+
summary: 'http://schemas.microsoft.com/office/powerpoint/2016/summaryzoom'
|
|
22754
|
+
};
|
|
22755
|
+
const zNs = nsMap[zKind];
|
|
22756
|
+
strSlideXml += '<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">';
|
|
22757
|
+
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">`;
|
|
22758
|
+
if (zKind === 'slide') {
|
|
22759
|
+
var _slideItemObj_zoomSlideNum;
|
|
22760
|
+
const zSldId = 255 + ((_slideItemObj_zoomSlideNum = slideItemObj.zoomSlideNum) !== null && _slideItemObj_zoomSlideNum !== void 0 ? _slideItemObj_zoomSlideNum : 1);
|
|
22761
|
+
strSlideXml += `<p16:sldZm><p16:sldZmObj sldId="${zSldId}">${zmPr}</p16:sldZmObj></p16:sldZm>`;
|
|
22762
|
+
} else if (zKind === 'section') {
|
|
22763
|
+
strSlideXml += `<p16:sectionZm><p16:sectionZmObj sectionId="${slideItemObj.zoomSectionId}">${zmPr}</p16:sectionZmObj></p16:sectionZm>`;
|
|
22764
|
+
} else {
|
|
22765
|
+
var _slideItemObj_zoomSectionIds;
|
|
22766
|
+
// §2.11 CT_SummaryZoom: summaryZmObj(s) + required layout choice (gridLayout/fixedLayout).
|
|
22767
|
+
const szTitle = zOpts.zoomTitle ? ` title="${encodeXmlEntities(zOpts.zoomTitle)}"` : '';
|
|
22768
|
+
const szDescr = zOpts.zoomDescr ? ` descr="${encodeXmlEntities(zOpts.zoomDescr)}"` : '';
|
|
22769
|
+
const szOff = (typeof zOpts.offsetFactorX === 'number' ? ` offsetFactorX="${Math.round(zOpts.offsetFactorX)}"` : '') + (typeof zOpts.offsetFactorY === 'number' ? ` offsetFactorY="${Math.round(zOpts.offsetFactorY)}"` : '');
|
|
22770
|
+
const szScale = (typeof zOpts.scaleFactorX === 'number' ? ` scaleFactorX="${Math.round(zOpts.scaleFactorX)}"` : '') + (typeof zOpts.scaleFactorY === 'number' ? ` scaleFactorY="${Math.round(zOpts.scaleFactorY)}"` : '');
|
|
22771
|
+
const extraZm = ((_slideItemObj_zoomSectionIds = slideItemObj.zoomSectionIds) !== null && _slideItemObj_zoomSectionIds !== void 0 ? _slideItemObj_zoomSectionIds : []).map((id)=>`<p16:summaryZmObj sectionId="${id}">${zmPr}</p16:summaryZmObj>`).join('');
|
|
22772
|
+
strSlideXml += `<p16:summaryZm><p16:summaryZmObj sectionId="${slideItemObj.zoomSectionId}"${szTitle}${szDescr}${szOff}${szScale}>${zmPr}</p16:summaryZmObj>${extraZm}<p16:gridLayout/></p16:summaryZm>`;
|
|
22746
22773
|
}
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
strSlideXml += '<p:
|
|
22753
|
-
strSlideXml += `<p:
|
|
22754
|
-
|
|
22755
|
-
strSlideXml +=
|
|
22756
|
-
strSlideXml +=
|
|
22757
|
-
strSlideXml += `<a:xfrm${locationAttr}>`;
|
|
22758
|
-
strSlideXml += `<a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/>`;
|
|
22759
|
-
strSlideXml += `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/>`;
|
|
22760
|
-
strSlideXml += '</a:xfrm>';
|
|
22761
|
-
if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
|
|
22762
|
-
strSlideXml += genXmlEffectLst({
|
|
22763
|
-
shadow: slideItemObj.options.shadow,
|
|
22764
|
-
glow: slideItemObj.options.glow,
|
|
22765
|
-
softEdge: slideItemObj.options.softEdge,
|
|
22766
|
-
reflection: slideItemObj.options.reflection,
|
|
22767
|
-
blur: slideItemObj.options.blur,
|
|
22768
|
-
fillOverlay: slideItemObj.options.fillOverlay,
|
|
22769
|
-
effectDag: slideItemObj.options.effectDag
|
|
22770
|
-
});
|
|
22771
|
-
strSlideXml += '</p:grpSpPr>';
|
|
22772
|
-
renderObjectList((_slideItemObj__objects = slideItemObj._objects) !== null && _slideItemObj__objects !== void 0 ? _slideItemObj__objects : []);
|
|
22773
|
-
strSlideXml += '</p:grpSp>';
|
|
22774
|
-
break;
|
|
22774
|
+
strSlideXml += '</mc:Choice>';
|
|
22775
|
+
// Fallback for older readers: pic for slide/section zoom; grpSp for summary zoom (§2.2.15).
|
|
22776
|
+
if (zKind === 'summary') {
|
|
22777
|
+
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>`;
|
|
22778
|
+
} else {
|
|
22779
|
+
strSlideXml += '<mc:Fallback><p:pic><p:nvPicPr>';
|
|
22780
|
+
strSlideXml += `<p:cNvPr id="${shapeId}" name="${zOpts.objectName}" descr="${encodeXmlEntities(zOpts.altText || '')}"/>`;
|
|
22781
|
+
strSlideXml += '<p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr><p:nvPr/></p:nvPicPr>';
|
|
22782
|
+
strSlideXml += zFill;
|
|
22783
|
+
strSlideXml += `<p:spPr>${zGeom}</p:spPr></p:pic></mc:Fallback>`;
|
|
22775
22784
|
}
|
|
22776
|
-
|
|
22777
|
-
strSlideXml += '';
|
|
22785
|
+
strSlideXml += '</mc:AlternateContent>';
|
|
22778
22786
|
break;
|
|
22779
|
-
|
|
22780
|
-
|
|
22787
|
+
}
|
|
22788
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.contentPart */"contentPart"):
|
|
22789
|
+
{
|
|
22790
|
+
var _slideItemObj_contentPartRid;
|
|
22791
|
+
// MS-PPTX §2.2.3 / §2.2.3.1: mc:AlternateContent { Choice contentPart | Fallback sp|pic }.
|
|
22792
|
+
const cpKind = slideItemObj.contentPartKind === 'ink' ? 'ink' : 'content';
|
|
22793
|
+
strSlideXml += genXmlContentPartAlternate({
|
|
22794
|
+
kind: cpKind,
|
|
22795
|
+
rId: (_slideItemObj_contentPartRid = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid !== void 0 ? _slideItemObj_contentPartRid : 0,
|
|
22796
|
+
shapeId,
|
|
22797
|
+
name: slideItemObj.options.objectName || (cpKind === 'ink' ? 'Ink 1' : 'Content Part 1'),
|
|
22798
|
+
altText: slideItemObj.options.altText || '',
|
|
22799
|
+
x,
|
|
22800
|
+
y,
|
|
22801
|
+
cx,
|
|
22802
|
+
cy,
|
|
22803
|
+
locationAttr,
|
|
22804
|
+
bwMode: slideItemObj.contentPartBwMode,
|
|
22805
|
+
coverRid: slideItemObj.coverRid
|
|
22806
|
+
});
|
|
22807
|
+
break;
|
|
22808
|
+
}
|
|
22809
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.officeApp */"officeApp"):
|
|
22810
|
+
{
|
|
22811
|
+
var _slideItemObj_contentPartRid1, _slideItemObj_coverRid;
|
|
22812
|
+
// MS-PPTX §2.2.13: mc:AlternateContent { Choice we:webextensionref | Fallback pic }.
|
|
22813
|
+
strSlideXml += genXmlOfficeAppAlternate({
|
|
22814
|
+
rId: (_slideItemObj_contentPartRid1 = slideItemObj.contentPartRid) !== null && _slideItemObj_contentPartRid1 !== void 0 ? _slideItemObj_contentPartRid1 : 0,
|
|
22815
|
+
shapeId,
|
|
22816
|
+
name: slideItemObj.options.objectName || 'Office App 1',
|
|
22817
|
+
altText: slideItemObj.options.altText || '',
|
|
22818
|
+
x,
|
|
22819
|
+
y,
|
|
22820
|
+
cx,
|
|
22821
|
+
cy,
|
|
22822
|
+
locationAttr,
|
|
22823
|
+
coverRid: (_slideItemObj_coverRid = slideItemObj.coverRid) !== null && _slideItemObj_coverRid !== void 0 ? _slideItemObj_coverRid : 0
|
|
22824
|
+
});
|
|
22825
|
+
break;
|
|
22826
|
+
}
|
|
22827
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.chart */"chart"):
|
|
22828
|
+
{
|
|
22829
|
+
var _slideItemObj_options_objectName4;
|
|
22830
|
+
var _slideItemObj_options4;
|
|
22831
|
+
const chartType = (_slideItemObj_options4 = slideItemObj.options) === null || _slideItemObj_options4 === void 0 ? void 0 : _slideItemObj_options4._type;
|
|
22832
|
+
const isChartex = isChartexType(chartType);
|
|
22833
|
+
const graphicDataUri = isChartex ? OOXML_CHARTEX.ns : 'http://schemas.openxmlformats.org/drawingml/2006/chart';
|
|
22834
|
+
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"/>`;
|
|
22835
|
+
const chartLocks = genXmlLocks('a:graphicFrameLocks', slideItemObj.options.lock);
|
|
22836
|
+
let frameXml = '<p:graphicFrame>';
|
|
22837
|
+
frameXml += ' <p:nvGraphicFramePr>';
|
|
22838
|
+
frameXml += genXmlCNvPr(shapeId, String((_slideItemObj_options_objectName4 = slideItemObj.options.objectName) !== null && _slideItemObj_options_objectName4 !== void 0 ? _slideItemObj_options_objectName4 : ''), slideItemObj.options, slideItemObj.options.altText || '');
|
|
22839
|
+
frameXml += chartLocks ? ` <p:cNvGraphicFramePr>${chartLocks}</p:cNvGraphicFramePr>` : ' <p:cNvGraphicFramePr/>';
|
|
22840
|
+
frameXml += genXmlNvPr(slideItemObj.options, genXmlPlaceholder(placeholderObj, slideItemObj.options), [
|
|
22841
|
+
nvPrModIdExt(slideItemObj.options.modId)
|
|
22842
|
+
]);
|
|
22843
|
+
frameXml += ' </p:nvGraphicFramePr>';
|
|
22844
|
+
frameXml += ` <p:xfrm><a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/></p:xfrm>`;
|
|
22845
|
+
frameXml += ' <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">';
|
|
22846
|
+
frameXml += ` <a:graphicData uri="${graphicDataUri}">`;
|
|
22847
|
+
frameXml += ` ${chartRef}`;
|
|
22848
|
+
frameXml += ' </a:graphicData>';
|
|
22849
|
+
frameXml += ' </a:graphic>';
|
|
22850
|
+
frameXml += '</p:graphicFrame>';
|
|
22851
|
+
// A chartex frame replaces a standard graphic frame, so MS-PPTX 2.2 requires it be offered
|
|
22852
|
+
// through `mc:AlternateContent`. PowerPoint's own fallback is a rendered preview image, which
|
|
22853
|
+
// cannot be produced here - a locked text shape carrying the same message is the honest
|
|
22854
|
+
// equivalent for a consumer that does not understand the chartex namespace.
|
|
22855
|
+
strSlideXml += isChartex ? `<mc:AlternateContent xmlns:mc="${MC_NS}">` + `<mc:Choice xmlns:cx1="${chartExRequiresNs(chartType)}" Requires="cx1">` + frameXml + '</mc:Choice>' + `<mc:Fallback>${genXmlChartExFallback(shapeId, slideItemObj, {
|
|
22856
|
+
x,
|
|
22857
|
+
y,
|
|
22858
|
+
cx,
|
|
22859
|
+
cy
|
|
22860
|
+
})}</mc:Fallback>` + '</mc:AlternateContent>' : frameXml;
|
|
22861
|
+
break;
|
|
22862
|
+
}
|
|
22863
|
+
case (/* inlined export .SLIDE_OBJECT_TYPES.group */"group"):
|
|
22864
|
+
{
|
|
22865
|
+
var _slideItemObj__objects;
|
|
22866
|
+
// PresentationML `p:grpSp` (ECMA-376 §19.3.1.22): nvGrpSpPr + grpSpPr + children.
|
|
22867
|
+
// Child coords are group-relative; chOff is 0,0 and chExt matches the group size.
|
|
22868
|
+
strSlideXml += '<p:grpSp>';
|
|
22869
|
+
strSlideXml += `<p:nvGrpSpPr>${genXmlCNvPr(shapeId, slideItemObj.options.objectName || `Group ${shapeId}`, slideItemObj.options)}`;
|
|
22870
|
+
const grpLocks = genXmlLocks('a:grpSpLocks', slideItemObj.options.lock);
|
|
22871
|
+
strSlideXml += (grpLocks ? `<p:cNvGrpSpPr>${grpLocks}</p:cNvGrpSpPr>` : '<p:cNvGrpSpPr/>') + `${genXmlNvPr(slideItemObj.options)}</p:nvGrpSpPr>`;
|
|
22872
|
+
strSlideXml += '<p:grpSpPr>';
|
|
22873
|
+
strSlideXml += `<a:xfrm${locationAttr}>`;
|
|
22874
|
+
strSlideXml += `<a:off x="${x}" y="${y}"/><a:ext cx="${cx}" cy="${cy}"/>`;
|
|
22875
|
+
strSlideXml += `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/>`;
|
|
22876
|
+
strSlideXml += '</a:xfrm>';
|
|
22877
|
+
if (slideItemObj.options.fill) strSlideXml += genXmlColorSelection(slideItemObj.options.fill);
|
|
22878
|
+
strSlideXml += genXmlEffectLst({
|
|
22879
|
+
shadow: slideItemObj.options.shadow,
|
|
22880
|
+
glow: slideItemObj.options.glow,
|
|
22881
|
+
softEdge: slideItemObj.options.softEdge,
|
|
22882
|
+
reflection: slideItemObj.options.reflection,
|
|
22883
|
+
blur: slideItemObj.options.blur,
|
|
22884
|
+
fillOverlay: slideItemObj.options.fillOverlay,
|
|
22885
|
+
effectDag: slideItemObj.options.effectDag
|
|
22886
|
+
});
|
|
22887
|
+
strSlideXml += '</p:grpSpPr>';
|
|
22888
|
+
strSlideXml += renderObjectList((_slideItemObj__objects = slideItemObj._objects) !== null && _slideItemObj__objects !== void 0 ? _slideItemObj__objects : []);
|
|
22889
|
+
strSlideXml += '</p:grpSp>';
|
|
22890
|
+
break;
|
|
22891
|
+
}
|
|
22892
|
+
default:
|
|
22893
|
+
strSlideXml += '';
|
|
22894
|
+
break;
|
|
22895
|
+
}
|
|
22896
|
+
return strSlideXml;
|
|
22781
22897
|
};
|
|
22898
|
+
const renderObjectList = (objects)=>objects.map((obj, idx)=>renderObject(obj, idx)).join('');
|
|
22782
22899
|
// Notes live on `_slideObjects` for the notes part, not the slide spTree — skip them so they do not consume cNvPr ids
|
|
22783
|
-
renderObjectList(((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).filter((obj)=>obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.notes */"notes")));
|
|
22900
|
+
strSlideXml += renderObjectList(((_slide__slideObjects = slide._slideObjects) !== null && _slide__slideObjects !== void 0 ? _slide__slideObjects : []).filter((obj)=>obj._type !== (/* inlined export .SLIDE_OBJECT_TYPES.notes */"notes")));
|
|
22784
22901
|
// STEP 4: Add slide numbers (if any) last
|
|
22785
22902
|
if (slide._slideNumberProps) {
|
|
22786
22903
|
// Set some defaults (done here b/c SlideNumber canbe added to masters or slides and has numerous entry points)
|
|
@@ -23340,13 +23457,17 @@ function collectSlideAnimations(slide) {
|
|
|
23340
23457
|
var _layout_colorMapOverride;
|
|
23341
23458
|
return ` ${slot}="${(_ref = (_layout_colorMapOverride = layout.colorMapOverride) === null || _layout_colorMapOverride === void 0 ? void 0 : _layout_colorMapOverride[slot]) !== null && _ref !== void 0 ? _ref : fallback}"`;
|
|
23342
23459
|
}).join('')}/></p:clrMapOvr>` : '<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>';
|
|
23460
|
+
const cSldXml = slideObjectToXml(layout);
|
|
23343
23461
|
const transitionXml = genXmlTransition(layout);
|
|
23344
23462
|
const hasP14 = transitionXml.includes('p14:') || transitionXml.includes('xmlns:p14');
|
|
23345
|
-
const
|
|
23463
|
+
const hasA14 = cSldXml.includes('a14:') || cSldXml.includes('Requires="a14"');
|
|
23464
|
+
const hasMc = cSldXml.includes('<mc:AlternateContent');
|
|
23465
|
+
const hasMath = cSldXml.includes('<m:oMath');
|
|
23466
|
+
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' : ''}"` : '');
|
|
23346
23467
|
// CT_SlideLayout sequence: cSld, clrMapOvr, transition, timing, hf, extLst
|
|
23347
23468
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
23348
23469
|
<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}>
|
|
23349
|
-
${
|
|
23470
|
+
${cSldXml}
|
|
23350
23471
|
${clrMapOvr}${transitionXml}</p:sldLayout>`;
|
|
23351
23472
|
}
|
|
23352
23473
|
/**
|
|
@@ -23357,9 +23478,14 @@ function collectSlideAnimations(slide) {
|
|
|
23357
23478
|
*/ function makeXmlMaster(slide, layouts) {
|
|
23358
23479
|
// NOTE: Pass layouts as static rels because they are not referenced any time
|
|
23359
23480
|
const layoutDefs = layouts.map((_layoutDef, idx)=>`<p:sldLayoutId id="${LAYOUT_IDX_SERIES_BASE + idx}" r:id="rId${slide._rels.length + idx + 1}"/>`);
|
|
23481
|
+
const cSldXml = slideObjectToXml(slide);
|
|
23482
|
+
const hasA14 = cSldXml.includes('a14:') || cSldXml.includes('Requires="a14"');
|
|
23483
|
+
const hasMc = cSldXml.includes('<mc:AlternateContent');
|
|
23484
|
+
const hasMath = cSldXml.includes('<m:oMath');
|
|
23485
|
+
const masterNs = (hasMath ? ` xmlns:m="${MATH_NS}"` : '') + (hasA14 ? ` xmlns:a14="${A14_NS}"` : '') + (hasMc || hasA14 ? ` xmlns:mc="${MC_NS}"` : '') + (hasA14 ? ' mc:Ignorable="a14"' : '');
|
|
23360
23486
|
let strXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + (/* inlined export .CRLF */"\r\n");
|
|
23361
|
-
strXml +=
|
|
23362
|
-
strXml +=
|
|
23487
|
+
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}>`;
|
|
23488
|
+
strXml += cSldXml;
|
|
23363
23489
|
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"/>';
|
|
23364
23490
|
strXml += '<p:sldLayoutIdLst>' + layoutDefs.join('') + '</p:sldLayoutIdLst>';
|
|
23365
23491
|
// ECMA-376 §4.4.1.22 `p:hf@sldNum` (default true) enables the slide-number placeholder.
|
|
@@ -23423,7 +23549,11 @@ function makeXmlTheme(pres, variant = 'slide') {
|
|
|
23423
23549
|
const themeName = customName || (isCustomColors ? 'Custom Theme' : 'Office Theme');
|
|
23424
23550
|
const schemeName = customName || (isCustomColors ? 'Custom' : 'Office');
|
|
23425
23551
|
const fontSchemeName = ((_pres_theme7 = pres.theme) === null || _pres_theme7 === void 0 ? void 0 : _pres_theme7.fontSchemeName) ? encodeXmlEntities(pres.theme.fontSchemeName) : customName || 'Office';
|
|
23426
|
-
|
|
23552
|
+
// Custom dk1/lt1 must use srgbClr: both PowerPoint and LibreOffice ignore sysClr/@lastClr and
|
|
23553
|
+
// substitute OS windowText (#000000) / window (#FFFFFF), washing out custom dark/tinted themes.
|
|
23554
|
+
const dk1Xml = c[0].toUpperCase() === '000000' ? '<a:sysClr val="windowText" lastClr="000000"/>' : `<a:srgbClr val="${c[0]}"/>`;
|
|
23555
|
+
const lt1Xml = c[1].toUpperCase() === 'FFFFFF' ? '<a:sysClr val="window" lastClr="FFFFFF"/>' : `<a:srgbClr val="${c[1]}"/>`;
|
|
23556
|
+
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>`;
|
|
23427
23557
|
}
|
|
23428
23558
|
const package_P15_NS = 'http://schemas.microsoft.com/office/powerpoint/2012/main';
|
|
23429
23559
|
const SLD_GUIDE_URI = '{EFAFB233-063F-42B5-8137-9DF3F51BA10A}';
|
|
@@ -24283,7 +24413,7 @@ class PptxGenJS {
|
|
|
24283
24413
|
*/ pptxgen_define_property(this, "_layout", void 0);
|
|
24284
24414
|
/**
|
|
24285
24415
|
* PptxGenJS Library Version
|
|
24286
|
-
*/ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.4.
|
|
24416
|
+
*/ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.4.1"));
|
|
24287
24417
|
/**
|
|
24288
24418
|
* @type {string}
|
|
24289
24419
|
*/ pptxgen_define_property(this, "_author", void 0);
|