This repository was archived by the owner on Jul 31, 2022. It is now read-only.
forked from uxal/officegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenpptx.js
More file actions
2066 lines (1701 loc) · 89 KB
/
genpptx.js
File metadata and controls
2066 lines (1701 loc) · 89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// officegen: All the code to generate PPTX/PPTS files.
//
// Please refer to README.md for this module's documentations.
//
// NOTE:
// - Before changing this code please refer to the hacking the code section on README.md.
//
// Copyright (c) 2013 Ziv Barber;
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// 'Software'), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
/**
* Basicgen plugin to create pptx files (Microsoft PowerPoint).
*/
var baseobj = require("./basicgen.js");
var OfficeChart = require("./officechart.js");
var msdoc = require("./msofficegen.js");
var pptxShapes = require("./pptxshapes.js");
var pptxFields = require("./pptxfields.js");
var fs = require('fs');
var officeTable = require('./genofficetable');
var path = require('path');
var fast_image_size = require('fast-image-size');
var excelbuilder = require('./msexcel-builder.js');
var xmlBuilder = require('xmlbuilder');
var docplugman = require('./docplug');
// Officegen pptx plugins:
var plugWidescreen = require('./pptxplg-widescreen');
var plugSpeakernotes = require('./pptxplg-speakernotes');
var plugLayouts = require('./pptxplg-layouts');
// BMK_PPTX_PLUG:
if ( !String.prototype.encodeHTML ) {
String.prototype.encodeHTML = function () {
return this.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
var GLOBAL_CHART_COUNT = 0;
/**
* Extend officegen object with PPTX/PPSX support.
*
* This method extending the given officegen object to create PPTX/PPSX document.
*
* @param {object} genobj The object to extend.
* @param {string} new_type The type of object to create.
* @param {object} options The object's options.
* @param {object} gen_private Access to the internals of this object.
* @param {object} type_info Additional information about this type.
* @constructor
* @name makePptx
*/
function makePptx ( genobj, new_type, options, gen_private, type_info ) {
/**
* Prepare the default data.
* @param {object} docpluginman Access to the document plugins manager.
*/
function setDefaultDocValues ( docpluginman ) {
var pptxData = docpluginman.getDataStorage ();
// Please put any setting that API can override here:
pptxData.EMUS_PER_PT = 12700;
pptxData.pptWidth = 720 * pptxData.EMUS_PER_PT;
pptxData.pptHeight = 540 * pptxData.EMUS_PER_PT;
pptxData.pptType = 'screen4x3';
// Rels im the main rels file that depended on the data and must be added after the slides:
pptxData.extraMainRelList = [];
}
/**
* Convert shape name to shape information.
*
* This method convert the shape information reseived from the user to the real shape information object.
*
* @param {object} shapeName Either the name of the shape or the shape information.
* @return Information about this shape.
*/
function getShapeInfo ( shapeName ) {
if ( !shapeName ) {
return pptxShapes.RECTANGLE;
} // Endif.
if ( (typeof shapeName == 'object') && shapeName.name && shapeName.displayName && shapeName.avLst ) {
return shapeName;
} // Endif.
if ( pptxShapes[shapeName] ) {
return pptxShapes[shapeName];
} // Endif.
for ( var shapeIntName in pptxShapes ) {
if ( pptxShapes[shapeIntName].name == shapeName ) {
return pptxShapes[shapeIntName];
} // Endif.
if ( pptxShapes[shapeIntName].displayName == shapeName ) {
return pptxShapes[shapeIntName];
} // Endif.
} // End of for loop.
return pptxShapes.RECTANGLE;
}
genobj.shapes = pptxShapes;
genobj.fields = pptxFields;
genobj.options = (options && typeof options == 'object') ? options : {};
// Temporary, I'll create a new code without the need to create a temp file (Ziv Barber, 2016-06-23):
if ( !genobj.options.tempDir ) {
genobj.options.tempDir = './';
} // Endif.
/**
* Prepare everything to generate PPTX files.
*
* This method checking for extra resources needed to add by the generator engine.
*/
function cbPreparePptxToGenerate () {
genobj.generate_data = {};
// Tell all the features (plugins) that we are about to generate a new document zip:
gen_private.features.type.pptx.emitEvent ( 'beforeGen', genobj );
// Allow some plugins to do more stuff after all the plugins added their data:
gen_private.features.type.pptx.emitEvent ( 'beforeGenFinal', genobj );
// Apple Keynote requires these added *after* all slides:
gen_private.type.msoffice.rels_app.push (
{
type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps',
target: 'presProps.xml',
clear: 'type'
},
{
type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps',
target: 'viewProps.xml',
clear: 'type'
},
{
type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
target: 'theme/theme1.xml',
clear: 'type'
}
);
// This event allow the plugins to add permanent rels that must be at the end:
var extraMainRelList = [];
gen_private.features.type.pptx.emitEvent ( 'addMainRels', { genobj: genobj, relsList: extraMainRelList } );
extraMainRelList.forEach ( function ( value ) {
gen_private.type.msoffice.rels_app.push ( value );
});
// Add any extra rels needed by the plugins and depended on the data:
if ( gen_private.type.pptx.extraMainRelList && typeof gen_private.type.pptx.extraMainRelList === 'object' && gen_private.type.pptx.extraMainRelList.forEach ) {
gen_private.type.pptx.extraMainRelList.forEach ( function ( value ) {
gen_private.type.msoffice.rels_app.push ( value );
});
};
gen_private.type.msoffice.rels_app.push (
{
type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles',
target: 'tableStyles.xml',
clear: 'type'
}
);
}
/**
* Create the 'presProps.xml' resource.
*
* @param {object} data Ignored by this callback function.
* @return Text string.
*/
function cbMakePptxPresProps ( data ) {
return gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) +
'<p:presentationPr 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">\
<p:extLst>\
<p:ext uri="{E76CE94A-603C-4142-B9EB-6D1370010A27}">\
<p14:discardImageEditData xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="0"/>\
</p:ext>\
<p:ext uri="{D31A062A-798A-4329-ABDD-BBA856620510}">\
<p14:defaultImageDpi xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="220"/>\
</p:ext>\
<p:ext uri="{FD5EFAAD-0ECE-453E-9831-46B23BE46B34}">\
<p15:chartTrackingRefBased xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main" val="1"/>\
</p:ext>\
</p:extLst>\
</p:presentationPr>';
}
/**
* Create the 'tableStyles.xml' resource.
*
* @param {object} data Ignored by this callback function.
* @return Text string.
*/
function cbMakePptxStyles ( data ) {
return gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + '<a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"/>';
}
/**
* Create the 'viewProps.xml' resource.
*
* @param {object} data Ignored by this callback function.
* @return Text string.
*/
function cbMakePptxViewProps ( data ) {
return gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + '<p:viewPr 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"><p:normalViewPr><p:restoredLeft sz="15620"/><p:restoredTop sz="94660"/></p:normalViewPr><p:slideViewPr><p:cSldViewPr><p:cViewPr varScale="1"><p:scale><a:sx n="64" d="100"/><a:sy n="64" d="100"/></p:scale><p:origin x="-1392" y="-96"/></p:cViewPr><p:guideLst><p:guide orient="horz" pos="2160"/><p:guide pos="2880"/></p:guideLst></p:cSldViewPr></p:slideViewPr><p:notesTextViewPr><p:cViewPr><p:scale><a:sx n="100" d="100"/><a:sy n="100" d="100"/></p:scale><p:origin x="0" y="0"/></p:cViewPr></p:notesTextViewPr><p:gridSpacing cx="78028800" cy="78028800"/></p:viewPr>';
}
/**
* Create the 'slideLayout1.xml' resource.
*
* @param {object} data Ignored by this callback function.
* @return Text string.
*/
function cbMakePptxLayout1 ( data ) {
if ( !data || typeof data !== 'object' ) {
data = {};
} // Endif.
// You can place here the title:
var ph1 = '<a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master title style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p>';
if ( data.ph1 && data.slide && data.ph1.length ) {
ph1 = cMakePptxOutTextP ( '', data.ph1, {}, data.slide );
} // Endif.
// The sub-title:
var ph2 = '<a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master subtitle style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p>';
if ( data.ph2 && data.slide && data.ph2.length ) {
ph2 = cMakePptxOutTextP ( '', data.ph2, {}, data.slide );
} // Endif.
var ph3 = CreateFieldText ( 'DATE_TIME', 1, data.useDate );
return gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + '<p:sld' + (data.isRealSlide ? '' : 'Layout') + ' 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"' + (data.isRealSlide ? '' : ' type="title" preserve="1"') + '><p:cSld name="Title Slide"><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Title 1"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="ctrTitle"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="685800" y="2130425"/><a:ext cx="7772400" cy="1470025"/></a:xfrm></p:spPr><p:txBody><a:bodyPr/><a:lstStyle/>' + ph1 + '</p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Subtitle 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="subTitle" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="1371600" y="3886200"/><a:ext cx="6400800" cy="1752600"/></a:xfrm></p:spPr><p:txBody><a:bodyPr/><a:lstStyle><a:lvl1pPr marL="0" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr><a:lvl2pPr marL="457200" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl2pPr><a:lvl3pPr marL="914400" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl3pPr><a:lvl4pPr marL="1371600" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl4pPr><a:lvl5pPr marL="1828800" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl5pPr><a:lvl6pPr marL="2286000" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl6pPr><a:lvl7pPr marL="2743200" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl7pPr><a:lvl8pPr marL="3200400" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl8pPr><a:lvl9pPr marL="3657600" indent="0" algn="ctr"><a:buNone/><a:defRPr><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl9pPr></a:lstStyle>' + ph2 + '</p:txBody></p:sp>' + (data.isRealSlide ? '' : '<p:sp><p:nvSpPr><p:cNvPr id="4" name="Date Placeholder 3"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="dt" sz="half" idx="10"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:fld id="{F8166F1F-CE9B-4651-A6AA-CD717754106B}" type="datetimeFigureOut"><a:rPr lang="en-US" smtClean="0"/><a:t>' + ph3 + '</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="5" name="Footer Placeholder 4"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="ftr" sz="quarter" idx="11"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="6" name="Slide Number Placeholder 5"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="12"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:fld id="{F7021451-1387-4CA6-816F-3879F97B5CBC}" type="slidenum"><a:rPr lang="en-US" smtClean="0"/><a:t>�#�</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp>') + '</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld' + (data.isRealSlide ? '' : 'Layout') + '>';
}
/**
* Create the main presentation resource.
*
* This resource is the main resource of any PowerPoint document.
*
* @param {object} data Ignored by this callback function.
* @return Text string.
*/
function cbMakePptxPresentation ( data ) {
var outString = gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + '<p:presentation 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" saveSubsetFonts="1"><p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst><p:sldIdLst>';
for ( var i = 0, total_size = gen_private.pages.length; i < total_size; i++ ) {
outString += '<p:sldId id="' + (i + 256) + '" r:id="rId' + (i + 2) + '"/>';
} // End of for loop.
outString += '</p:sldIdLst><p:sldSz cx="' + gen_private.type.pptx.pptWidth + '" cy="'+gen_private.type.pptx.pptHeight+'" type="' + gen_private.type.pptx.pptType + '"/><p:notesSz cx="'+gen_private.type.pptx.pptHeight+'" cy="'+gen_private.type.pptx.pptWidth+'"/><p:defaultTextStyle><a:defPPr><a:defRPr lang="en-US"/></a:defPPr>';
var curPos = 0;
for ( var i = 1; i < 10; i++ )
{
outString += '<a:lvl' + i + 'pPr marL="' + curPos + '" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl' + i + 'pPr>';
curPos += 457200;
} // End of for loop.
outString += '</p:defaultTextStyle>';
outString += '<p:extLst>\
<p:ext uri="{EFAFB233-063F-42B5-8137-9DF3F51BA10A}">\
<p15:sldGuideLst xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"/>\
</p:ext>\
</p:extLst></p:presentation>';
return outString;
}
/**
* Create the slides masters resource.
*
* @param {object} data Ignored by this callback function.
* @return Text string.
*/
function cbMakePptxSlideMasters ( data ) {
var outData = gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + '<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"><p:cSld><p:bg><p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef></p:bg><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Title Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="274638"/><a:ext cx="8229600" cy="1143000"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"><a:normAutofit/></a:bodyPr><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master title style</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Text Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="1600200"/><a:ext cx="8229600" cy="4525963"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0"><a:normAutofit/></a:bodyPr><a:lstStyle/><a:p><a:pPr lvl="0"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Click to edit Master text styles</a:t></a:r></a:p><a:p><a:pPr lvl="1"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Second level</a:t></a:r></a:p><a:p><a:pPr lvl="2"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Third level</a:t></a:r></a:p><a:p><a:pPr lvl="3"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Fourth level</a:t></a:r></a:p><a:p><a:pPr lvl="4"/><a:r><a:rPr lang="en-US" smtClean="0"/><a:t>Fifth level</a:t></a:r><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="4" name="Date Placeholder 3"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="dt" sz="half" idx="2"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="457200" y="6356350"/><a:ext cx="2133600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="l"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:fld id="{F8166F1F-CE9B-4651-A6AA-CD717754106B}" type="datetimeFigureOut"><a:rPr lang="en-US" smtClean="0"/><a:t>6/13/2013</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="5" name="Footer Placeholder 4"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="ftr" sz="quarter" idx="3"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="3124200" y="6356350"/><a:ext cx="2895600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="ctr"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="6" name="Slide Number Placeholder 5"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="4"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="6553200" y="6356350"/><a:ext cx="2133600" cy="365125"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/><a:lstStyle><a:lvl1pPr algn="r"><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"><a:tint val="75000"/></a:schemeClr></a:solidFill></a:defRPr></a:lvl1pPr></a:lstStyle><a:p><a:fld id="{F7021451-1387-4CA6-816F-3879F97B5CBC}" type="slidenum"><a:rPr lang="en-US" smtClean="0"/><a:t>�#�</a:t></a:fld><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree></p:cSld><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"/><p:sldLayoutIdLst>';
var curRelId = 1;
var curId = 2147483649;
var getDocData = plugsmanObj.getDataStorage ();
// Add all the slide layouts needed:
outData += '<p:sldLayoutId id="' + curId + '" r:id="rId' + curRelId + '"/>';
curRelId++;
curId++;
if ( getDocData.slideLayouts && typeof getDocData.slideLayouts === 'object' ) {
for ( var item in getDocData.slideLayouts ) {
if ( getDocData.slideLayouts[item] ) {
outData += '<p:sldLayoutId id="' + curId + '" r:id="rId' + getDocData.slideLayouts[item].relIdMaster + '"/>';
curRelId++;
curId++;
} // Endif.
} // End of for loop.
} // Endif.
outData += '</p:sldLayoutIdLst><p:txStyles><p:titleStyle><a:lvl1pPr algn="ctr" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="0"/></a:spcBef><a:buNone/><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/><a:ea typeface="+mj-ea"/><a:cs typeface="+mj-cs"/></a:defRPr></a:lvl1pPr></p:titleStyle><p:bodyStyle><a:lvl1pPr marL="342900" indent="-342900" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="3200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr><a:lvl2pPr marL="742950" indent="-285750" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="2800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr><a:lvl3pPr marL="1143000" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="2400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr><a:lvl4pPr marL="1600200" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr><a:lvl5pPr marL="2057400" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr><a:lvl6pPr marL="2514600" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr><a:lvl7pPr marL="2971800" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr><a:lvl8pPr marL="3429000" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr><a:lvl9pPr marL="3886200" indent="-228600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:spcBef><a:spcPct val="20000"/></a:spcBef><a:buFont typeface="Arial" pitchFamily="34" charset="0"/><a:buChar char="�"/><a:defRPr sz="2000" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr></p:bodyStyle><p:otherStyle><a:defPPr><a:defRPr lang="en-US"/></a:defPPr><a:lvl1pPr marL="0" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr><a:lvl2pPr marL="457200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl2pPr><a:lvl3pPr marL="914400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl3pPr><a:lvl4pPr marL="1371600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl4pPr><a:lvl5pPr marL="1828800" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl5pPr><a:lvl6pPr marL="2286000" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl6pPr><a:lvl7pPr marL="2743200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl7pPr><a:lvl8pPr marL="3200400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl8pPr><a:lvl9pPr marL="3657600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl9pPr></p:otherStyle></p:txStyles></p:sldMaster>';
return outData;
}
/**
* Generate the XML code to describe colors.
*
* @param {object} color_info Foreground color information.
* @param {object} back_info Background color information.
*/
function cMakePptxColorSelection ( color_info, back_info ) {
var outText = '';
var colorVal;
var fillType = 'solid';
var internalElements = '';
if ( back_info ) {
outText += '<p:bg><p:bgPr>';
outText += cMakePptxColorSelection ( back_info, false );
outText += '<a:effectLst/>';
// BMK_TODO: (add support for effects)
outText += '</p:bgPr></p:bg>';
} // Endif.
if ( color_info ) {
if ( typeof color_info == 'string' ) {
colorVal = color_info;
} else {
if ( color_info.type ) {
fillType = color_info.type;
} // Endif.
if ( color_info.color ) {
colorVal = color_info.color;
} // Endif.
if ( color_info.alpha ) {
internalElements += '<a:alpha val="' + (100 - color_info.alpha) + '000"/>';
} // Endif.
} // Endif.
switch ( fillType )
{
case 'solid':
outText += '<a:solidFill><a:srgbClr val="' + colorVal + '">' + internalElements + '</a:srgbClr></a:solidFill>';
break;
case 'gradient':
outText += '<a:gradFill flip="none" rotWithShape="1"><a:gsLst>';
for ( var item in colorVal ) {
if ( typeof colorVal[item] == 'string' ) {
// Positions are inverted because they start with 100000:
outText += '<a:gs pos="' + (100000 - Math.round(100000 / (colorVal.length - 1) * item)) + '"><a:srgbClr val="' + colorVal[item] + '">' + internalElements + '</a:srgbClr></a:gs>';
} else {
outText += '<a:gs pos="' + colorVal[item].position*1000 + '"><a:srgbClr val="' + colorVal[item].color + '">' + internalElements + '</a:srgbClr></a:gs>';
} // Endif.
} // End of for loop.
if ( typeof color_info.angle != 'undefined' ) {
outText += '</a:gsLst><a:lin ang="'+color_info.angle*100000+'" scaled="1"/><a:tileRect/></a:gradFill>';
} else {
outText += '</a:gsLst><a:path path="circle"><a:fillToRect l="100000" t="100000"/></a:path><a:tileRect r="-100000" b="-100000"/></a:gradFill>';
} // Endif.
break;
} // End of switch.
} // Endif.
return outText;
}
/**
* Translate field_name into the text real value.
*
* This method creating the text to display for the given field.
*
* @param {string} field_name the name of the field.
* @param {number} slide_num current slide number.
* @param {Date} useDate Optional date to use instead of the current date.
* @return The text string data.
*/
function CreateFieldText ( field_name, slide_num, useDate ) {
var curDateTime = useDate ? new Date ( useDate ) : new Date ();
var dayInWeek = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
var monthsList = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
var monthsShortList = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
var outValue = '';
// curDateTime.getDate () Returns the day of the month (from 1-31)
// curDateTime.getDay () Returns the day of the week (from 0-6)
// curDateTime.getFullYear () Returns the year (four digits)
// curDateTime.getHours () Returns the hour (from 0-23)
// curDateTime.getMinutes () Returns the minutes (from 0-59)
// curDateTime.getMonth () Returns the month (from 0-11)
// curDateTime.getSeconds () Returns the seconds (from 0-59)
switch ( field_name ) {
// presentation slide number:
case 'SLIDE_NUM':
case 'slidenum':
outValue += slide_num;
break;
// default date time format for the rendering application:
case 'DATE_TIME':
case 'datetime':
outValue += (curDateTime.getMonth () + 1) + '/' + curDateTime.getDate () + '/' + curDateTime.getFullYear ();
break;
// MM/DD/YYYY date time format (Example: 10/12/2007):
case 'DATE_MM_DD_YYYY':
case 'datetime1':
outValue += (curDateTime.getMonth () + 1) + '/' + curDateTime.getDate () + '/' + curDateTime.getFullYear ();
break;
// Day, Month DD, YYYY date time format (Example: Friday, October 12, 2007):
case 'DATE_WD_MN_DD_YYYY':
case 'datetime2':
outValue += dayInWeek[curDateTime.getDay ()] + ', ' + monthsList[curDateTime.getMonth ()] + ' ' + curDateTime.getDate () + ', ' + curDateTime.getFullYear ();
break;
// DD Month YYYY date time format (Example: 12 October 2007):
case 'DATE_DD_MN_YYYY':
case 'datetime3':
outValue += curDateTime.getDate () + ' ' + monthsList[curDateTime.getMonth ()] + ' ' + curDateTime.getFullYear ();
break;
// Month DD, YYYY date time format (Example: October 12, 2007):
case 'DATE_MN_DD_YYYY':
case 'datetime4':
outValue += monthsList[curDateTime.getMonth ()] + ' ' + curDateTime.getDate () + ', ' + curDateTime.getFullYear ();
break;
// DD-Mon-YY date time format (Example: 12-Oct-07):
case 'DATE_DD_SMN_YY':
case 'datetime5':
outValue += curDateTime.getDate () + '-' + monthsShortList[curDateTime.getMonth ()] + '-' + (curDateTime.getFullYear () % 100);
break;
// Month YY date time format (Example: October 07):
case 'DATE_MM_YY':
case 'datetime6':
outValue += monthsList[curDateTime.getMonth ()] + ' ' + (curDateTime.getFullYear () % 100);
break;
// Mon-YY date time format (Example: Oct-07):
case 'DATE_SMN_YY':
case 'datetime7':
outValue += monthsShortList[curDateTime.getMonth ()] + '-' + (curDateTime.getFullYear () % 100);
break;
// MM/DD/YYYY hh:mm AM/PM date time format (Example: 10/12/2007 4:28 PM):
case 'DATE_TIME_DD_MM_YYYY_HH_MM_PM':
case 'datetime8':
outValue += curDateTime.getMonth () + '/' + curDateTime.getDate () + '/' + curDateTime.getFullYear ();
outValue += (curDateTime.getHours () % 12) + ':' + curDateTime.getMinutes ();
outValue += (curDateTime.getHours () > 11) ? ' PM' : ' AM';
break;
// MM/DD/YYYY hh:mm:ss AM/PM date time format (Example: 10/12/2007 4:28:34 PM):
case 'DATE_TIME_DD_MM_YYYY_HH_MM_SC_PM':
case 'datetime9':
outValue += curDateTime.getMonth () + '/' + curDateTime.getDate () + '/' + curDateTime.getFullYear ();
outValue += (curDateTime.getHours () % 12) + ':' + curDateTime.getMinutes () + ':' + curDateTime.getSeconds ();
outValue += (curDateTime.getHours () > 11) ? ' PM' : ' AM';
break;
// hh:mm date time format (Example: 16:28):
case 'TIME_HH_MM':
case 'datetime10':
outValue += curDateTime.getHours () + ':' + curDateTime.getMinutes ();
break;
// hh:mm:ss date time format (Example: 16:28:34):
case 'TIME_HH_MM_SC':
case 'datetime11':
outValue += curDateTime.getHours () + ':' + curDateTime.getMinutes () + ':' + curDateTime.getSeconds ();
break;
// hh:mm AM/PM date time format (Example: 4:28 PM):
case 'TIME_HH_MM_PM':
case 'datetime12':
outValue += (curDateTime.getHours () % 12) + ':' + curDateTime.getMinutes ();
outValue += (curDateTime.getHours () > 11) ? ' PM' : ' AM';
break;
// hh:mm:ss: AM/PM date time format (Example: 4:28:34 PM):
case 'TIME_HH_MM_SC_PM':
case 'datetime13':
outValue += (curDateTime.getHours () % 12) + ':' + curDateTime.getMinutes () + ':' + curDateTime.getSeconds ();
outValue += (curDateTime.getHours () > 11) ? ' PM' : ' AM';
break;
default:
return null;
} // End of switch.
return outValue;
}
/**
* ???.
*
* @param {object} text_info Information how to display the text.
* @param {object} slide_obj The object of this slider.
* @return Text string.
*/
function cMakePptxOutTextData ( text_info, slide_obj ) {
var out_obj = {};
out_obj.font_size = '';
out_obj.bold = '';
out_obj.italic = '';
out_obj.strike = '';
out_obj.underline = '';
out_obj.rpr_info = '';
out_obj.char_spacing = '';
if ( typeof text_info == 'object' )
{
if ( text_info.bold ) {
out_obj.bold = ' b="1"';
} // Endif.
if ( text_info.italic ) {
out_obj.italic = ' i="1"';
} // Endif.
if ( text_info.strike ) {
out_obj.strike = ' strike="sngStrike"';
} // Endif.
if ( text_info.underline ) {
out_obj.underline = ' u="sng"';
} // Endif.
if ( text_info.font_size ) {
out_obj.font_size = ' sz="' + text_info.font_size + '00"';
} // Endif.
// psv 2015-01-21 Manually copied in from https://github.com/Ziv-Barber/officegen/pull/41/files
if ( text_info.char_spacing ) {
out_obj.char_spacing = ' spc="' + (text_info.char_spacing * 100) + '"';
// Must also disable kerning; otherwise text won't actually expand:
out_obj.char_spacing += ' kern="0"';
} // Endif.
if ( text_info.color ) {
out_obj.rpr_info += cMakePptxColorSelection ( text_info.color );
} else if ( slide_obj && slide_obj.color )
{
out_obj.rpr_info += cMakePptxColorSelection ( slide_obj.color );
} // Endif.
if ( text_info.font_face ) {
out_obj.rpr_info += '<a:latin typeface="' + text_info.font_face + '" pitchFamily="34" charset="0"/><a:cs typeface="' + text_info.font_face + '" pitchFamily="34" charset="0"/>';
} // Endif.
} else {
if ( slide_obj && slide_obj.color ) {
out_obj.rpr_info += cMakePptxColorSelection ( slide_obj.color );
} // Endif.
} // Endif.
if ( out_obj.rpr_info != '' ) {
out_obj.rpr_info += '</a:rPr>';
} // Endif.
return out_obj;
}
/**
* Create a text object for adding into a slide.
*
* @param {object} text_info Information how to display the text.
* @param {object} text_string The text string or requested field.
* @param {object} slide_obj The object of this slider.
* @param {object} slide_num Current slide number.
* @param {string} out_styles Paragraph style used to style paragraphs generated by newlines
* @return The PPTX code.
*/
function cMakePptxOutTextCommand ( text_info, text_string, slide_obj, slide_num, out_styles ) {
text_info = text_info || {};
var area_opt_data = cMakePptxOutTextData ( text_info, slide_obj );
var textStyles = ['font_size', 'strike', 'italic', 'bold', 'underline', 'char_spacing'].reduce(function(acc, attr) {
return acc + area_opt_data[attr]
}, '');
var parsedText;
var startInfo = '<a:rPr lang="en-US"' + textStyles + ' dirty="0" smtClean="0"' +
(area_opt_data.rpr_info != '' ? ('>' + area_opt_data.rpr_info) : '/>') + '<a:t>';
var endTag = '</a:r>';
var outData = '<a:r>' + startInfo;
if ( text_string.field ) {
endTag = '</a:fld>';
var outTextField = pptxFields[text_string.field];
if ( outTextField === null ) {
for ( var fieldIntName in pptxFields ) {
if ( pptxFields[fieldIntName] === text_string.field ) {
outTextField = text_string.field;
break;
} // Endif.
} // End of for loop.
if ( outTextField === null ) {
outTextField = 'datetime';
} // Endif.
} // Endif.
outData = '<a:fld id="{' + gen_private.plugs.type.msoffice.makeUniqueID ( '5C7A2A3D' ) + '}" type="' + outTextField + '">' + startInfo;
outData += CreateFieldText ( outTextField, slide_num );
} else {
// Automatic support for newline - split it into multi-p:
parsedText = text_string.split ( "\n" );
if ( parsedText.length > 1 ) {
var outTextData = '';
for ( var i = 0, total_size_i = parsedText.length; i < total_size_i; i++ ) {
outTextData += outData + parsedText[i].encodeHTML ();
if ( (i + 1) < total_size_i ) {
outTextData += '</a:t></a:r></a:p><a:p>';
if (out_styles) outTextData += out_styles;
} // Endif.
} // End of for loop.
outData = outTextData;
} else {
outData += text_string.encodeHTML ();
} // Endif.
} // Endif.
var outBreakP = '';
if ( text_info.breakLine ) {
outBreakP += '</a:p><a:p>';
} // Endif.
return outData + '</a:t>' + endTag + outBreakP;
}
/**
* Create all the objects inside a single paragraph.
* @param {string} outString The string to add the output xml to it.
* @param {Array} pData Array with all the parts of this paragraph.
* @param {object} pOptions Paragraph options.
* @param {object} slideObj The object of this slider.
*/
function cMakePptxOutTextP ( outString, pData, pOptions, slideObj ) {
var outStyles = '';
var moreStylesAttr;
var moreStyles;
// Work on all the parts of this paragraph:
for ( var j = 0, total_size_j = pData.length; j < total_size_j; j++ ) {
if ( pData[j] ) {
moreStylesAttr = '';
moreStyles = '';
if ( pData[j].options ) {
if ( pData[j].options.align ) {
switch ( pData[j].options.align )
{
case 'right':
moreStylesAttr += ' algn="r"';
break;
case 'center':
moreStylesAttr += ' algn="ctr"';
break;
case 'justify':
moreStylesAttr += ' algn="just"';
break;
} // End of switch.
} // Endif.
if ( pData[j].options.indentLevel > 0 ) {
moreStylesAttr += ' lvl="' + pData[j].options.indentLevel + '"';
} // Endif.
if ( pData[j].options.listType == 'number' ) {
moreStyles += '<a:buFont typeface="+mj-lt"/><a:buAutoNum type="arabicPeriod"/>';
} // Endif.
} // Endif.
if ( moreStyles != '' ) {
outStyles = '<a:pPr' + moreStylesAttr + '>' + moreStyles + '</a:pPr>';
} else if ( moreStylesAttr != '' ) {
outStyles = '<a:pPr' + moreStylesAttr + '/>';
} // Endif.
if ( outStyles || !j ) {
if ( j ) {
outString += '<a:p>';
} // Endif.
outString += '<a:p>' + outStyles;
} // Endif.
outString += cMakePptxOutTextCommand ( pData[j].options, pData[j].text, slideObj, slideObj.getPageNumber (), outStyles );
} // Endif.
} // End of for loop - adding all the objects inside the paragraph.
var font_size = '';
if ( pOptions && pOptions.font_size ) {
font_size = ' sz="' + pOptions.font_size + '00"';
} // Endif.
outString += '<a:endParaRPr lang="en-US"' + font_size + ' dirty="0"/></a:p>';
return outString;
}
/**
* ???.
*
* @param {object} in_data_val Input value as passed by the user.
* @param {number} max_value Maximum value allowed.
* @param {number} def_value Default value.
* @param {number} auto_val ???.
* @param {number} mul_val ???.
* @return ???.
*/
function parseSmartNumber ( in_data_val, max_value, def_value, auto_val, mul_val ) {
if ( typeof in_data_val == 'undefined' ) {
return (typeof def_value == 'number') ? def_value : 0;
} // Endif.
if ( in_data_val == '' ) {
in_data_val = 0;
} // Endif.
if ( typeof in_data_val == 'string' && !isNaN ( in_data_val ) ) {
in_data_val = parseInt ( in_data_val, 10 );
} // Endif.
var realNum = Math.round ( mul_val ? in_data_val * mul_val : in_data_val );
if ( typeof in_data_val == 'string' ) {
if ( in_data_val.indexOf ( '%' ) != -1 ) {
var realMax = (typeof max_value == 'number') ? max_value : 0;
if ( realMax <= 0 ) return 0;
var realVal = parseInt ( in_data_val, 10 );
return Math.round ( (realMax / 100) * realVal );
} // Endif.
if ( in_data_val.indexOf ( '#' ) != -1 ) {
var realVal = parseInt ( in_data_val, 10 );
return realMax;
} // Endif.
var realAuto = (typeof auto_val == 'number') ? auto_val : 0;
if ( in_data_val == '*' ) {
return realAuto;
} // Endif.
if ( in_data_val == 'c' ) {
return Math.round ( realAuto / 2 );
} // Endif.
} // Endif.
if ( typeof in_data_val == 'number' ) {
return realNum;
} // Endif.
return (typeof def_value == 'number') ? def_value : 0;
}
/**
* Create the XML code of a single effect.
*
* This method creating the effect XML code for a single object.
*
* @param {object} effectData Effect data.
* @param {string} effectName The name of the effect.
*/
function cbGenerateEffects ( effectData, effectName ) {
var outData = '<a:' + effectName + ' ';
var color = effectData.color || 'black';
var alphaPer = 60;
var algnData = '';
var blurRad = 50800;
var dist = 38100;
var dir = 13500000;
if ( typeof effectData.transparency == 'number' ) {
alphaPer = effectData.transparency;
} // Endif.
if ( (alphaPer > 100) || (alphaPer < 0) )
alphaPer = 60;
alphaPer = (100 - alphaPer) * 1000;
if ( effectData.align ) {
if ( effectData.align.top )
algnData += 't';
if ( effectData.align.bottom )
algnData += 'b';
if ( effectData.align.left )
algnData += 'l';
if ( effectData.align.right )
algnData += 'r';
} // Endif.
if ( algnData == '' )
algnData = 'br';
// Size
// Blur
// Angle
// Distance
// BMK_TODO:
outData += ' blurRad="' + blurRad + '" dist="' + dist + '" dir="' + dir + '" algn="' + algnData + '" rotWithShape="0"';
// sx="24000" sy="24000"
// BMK_TODO:
outData += '><a:prstClr val="' + color + '"><a:alpha val="' + alphaPer + '"/></a:prstClr>';
return outData + '</a:' + effectName + '>';
}
/**
* Create the body properties code for text.
*
* This method creating the XML code of the body properties of a text.
*
* @return The body properties XML code.
*/
function createBodyProperties ( objOptions ) {
var bodyProperties = '<a:bodyPr';
if ( objOptions && objOptions.bodyProp ) {
// Set anchorPoints bottom, center or top:
if ( objOptions.bodyProp.anchor ) {
bodyProperties += ' anchor="' + objOptions.bodyProp.anchor + '"';
} // Endif.
if ( objOptions.bodyProp.anchorCtr ) {
bodyProperties += ' anchorCtr="' + objOptions.bodyProp.anchorCtr + '"';
} // Endif.
// Enable or disable textwrapping none or square:
if ( objOptions.bodyProp.wrap ) {
bodyProperties += ' wrap="' + objOptions.bodyProp.wrap + '"';
} else {
bodyProperties += ' wrap="square"';
} // Endif.
// Box margins(padding):
// BMK_TODO: I should pass a better value as the auto_val parameter of parseSmartNumber().
if ( objOptions.bodyProp.bIns ) {
bodyProperties += ' bIns="' + parseSmartNumber ( objOptions.bodyProp.bIns, gen_private.type.pptx.pptHeight, 369332, gen_private.type.pptx.pptHeight, 10000 ) + '"';
} // Endif.
if ( objOptions.bodyProp.lIns ) {
bodyProperties += ' lIns="' + parseSmartNumber ( objOptions.bodyProp.lIns, gen_private.type.pptx.pptWidth, 2819400, gen_private.type.pptx.pptWidth, 10000 ) + '"';
} // Endif.
if ( objOptions.bodyProp.rIns ) {
bodyProperties += ' rIns="' + parseSmartNumber ( objOptions.bodyProp.rIns, gen_private.type.pptx.pptWidth, 2819400, gen_private.type.pptx.pptWidth, 10000 ) + '"';
} // Endif.
if ( objOptions.bodyProp.tIns ) {
bodyProperties += ' tIns="' + parseSmartNumber ( objOptions.bodyProp.tIns, gen_private.type.pptx.pptHeight, 369332, gen_private.type.pptx.pptHeight, 10000 ) + '"';
} // Endif.
bodyProperties += ' rtlCol="0">';
if ( objOptions.bodyProp.autoFit !== false ) {
bodyProperties += '<a:spAutoFit/>';
} // Endif.
bodyProperties += '</a:bodyPr>';
// Default:
} else {
bodyProperties += ' wrap="square" rtlCol="0"></a:bodyPr>';
} // Endif.
return bodyProperties;
}
/**
* Generate a slider resource.
*
* This function generating a slider XML resource.
*
* @param {object} data The main slide object.
* @param {boolean} makeOnlyObjects is true to turn this method to make only the objects in data.data.
* @return Text string.
*/
function cbMakePptxSlide ( data, makeOnlyObjects ) {
var outString = '';
var objs_list = data.data;
var timingData = '';
// Slide with layout support:
if ( data.slide.useLayout && typeof data.slide.useLayout == 'object' && data.slide.useLayout.mkResCb ) {
data.slide.useLayout.slide = data.slide;
return data.slide.useLayout.mkResCb ( data.slide.useLayout );
} // Endif.
// Create the header of the slide (only if we need that):
if ( !makeOnlyObjects ) {
outString = gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml ( data ) + '<p:sld 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"';
if ( !data.slide.show ) {
outString += ' show="0"';
} // Endif.
outString += '><p:cSld' + (data.slide.name ? ' name="' + data.slide.name + '"' : '') + '>';
if ( data.slide.back ) {
outString += cMakePptxColorSelection ( false, data.slide.back );
} // Endif.
outString += '<p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>';
} // Endif.
// Loop on all the objects inside the slide to add it into the slide:
for ( var i = 0, total_size = objs_list.length; i < total_size; i++ ) {
var x = 0;
var y = 0;
var cx = 2819400;
var cy = 369332;
var moreStyles = '';
var moreStylesAttr = '';
var outStyles = '';
var styleData = '';
var shapeType = null;
var locationAttr = '';
if ( objs_list[i].options ) {
if ( typeof objs_list[i].options.cx != 'undefined' ) {
if ( objs_list[i].options.cx ) {
cx = parseSmartNumber ( objs_list[i].options.cx, gen_private.type.pptx.pptWidth, cx, gen_private.type.pptx.pptWidth, 10000 );
} else {
cx = 1;
} // Endif.
} // Endif.
if ( typeof objs_list[i].options.cy != 'undefined' ) {
if ( objs_list[i].options.cy ) {
cy = parseSmartNumber ( objs_list[i].options.cy, gen_private.type.pptx.pptHeight, cy, gen_private.type.pptx.pptHeight, 10000 );
} else {
cy = 1;
} // Endif.
} // Endif.
if ( objs_list[i].options.x ) {