Skip to content
Browse files

Version 0.2.0 preview 1

The 'lib' folder now replacing the single 'officegen.js'

PLEASE REPORT ANY ISSUE THAT YOU WILL FIND!
  • Loading branch information...
1 parent 16f24df commit 26fbde5a422f2ecfdaa119ba279cd8e101ac0a26 @Ziv-Barber committed
View
22 LICENSE-MIT
@@ -0,0 +1,22 @@
+Copyright (c) 2013 Ziv Barber, contributors.
+
+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.
View
2 examples/make_docx.js
@@ -1,6 +1,6 @@
var fs = require('fs');
-var docx = require('../officegen.js').makegen ( { 'type': 'docx', 'onend': function ( written ) {
+var docx = require('../lib/index.js').makegen ( { 'type': 'docx', 'onend': function ( written ) {
console.log ( 'Finish to create Word file.\nTotal bytes created: ' + written + '\n' );
} } );
View
7 examples/make_ppsx.js
@@ -1,6 +1,6 @@
var fs = require('fs');
-var pptx = require('../officegen.js').makegen ( { 'type': 'ppsx', 'onend': function ( written ) {
+var pptx = require('../lib/index.js').makegen ( { 'type': 'ppsx', 'onend': function ( written ) {
console.log ( 'Finish to create a PowerPoint slideshow file.\nTotal bytes created: ' + written + '\n' );
} } );
@@ -9,8 +9,9 @@ pptx.setDocTitle ( 'Sample PPTX Document' );
slide = pptx.makeNewSlide ();
slide.name = 'The first slide!';
slide.back = 'ff0000';
-slide.addText ( 'Hello World!', { x: 600000, y: 10000, font_size: 56, cx: 10000000 } );
-slide.addText ( 'Office generator', { y: 850000, font_size: 48 } );
+slide.color = '000000';
+slide.addText ( 'Hello World!', { x: 60, y: 10, font_size: 56, cx: 1000 } );
+slide.addText ( 'Office generator', { y: 85, font_size: 48 } );
slide = pptx.makeNewSlide ();
slide.back = { type: 'solid', color: '00ff00' };
slide = pptx.makeNewSlide ();
View
2 examples/make_pptx.js
@@ -1,7 +1,7 @@
var fs = require('fs');
var path = require('path');
-var pptx = require('../officegen.js').makegen ( { 'type': 'pptx', 'onend': function ( written ) {
+var pptx = require('../lib/index.js').makegen ( { 'type': 'pptx', 'onend': function ( written ) {
console.log ( 'Finish to create a PowerPoint file.\nTotal bytes created: ' + written + '\n' );
} } );
View
2 examples/make_xlsx.js
@@ -1,6 +1,6 @@
var fs = require('fs');
-var officegen = require('../officegen.js');
+var officegen = require('../lib/index.js');
var xlsx = officegen.makegen ( { 'type': 'xlsx', 'onend': function ( written ) {
console.log ( 'Finish to create an Excel file.\nTotal bytes created: ' + written + '\n' );
} } );
View
4 examples/pptx_server.js
@@ -1,6 +1,8 @@
// Simple server that displaying form to ask the user name and then generate PowerPoint stream with the user's name
// without using real files on the server side.
+var officegen = require('../lib/index.js');
+
var fs = require('fs');
var http = require("http");
var querystring = require('querystring');
@@ -60,7 +62,7 @@ http.createServer ( function ( request, response ) {
// .xlam application/vnd.ms-excel.addin.macroEnabled.12
// .xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12
- var pptx = require('../officegen.js').makegen ( { 'type': 'pptx', 'onend': function ( written ) {
+ var pptx = officegen.makegen ( { 'type': 'pptx', 'onend': function ( written ) {
console.log ( 'Finish to create the surprise PowerPoint stream and send it to ' + response.post.name + '.\nTotal bytes created: ' + written + '\n' );
} } );
View
378 lib/basicgen.js
@@ -0,0 +1,378 @@
+//
+// officegen: basic common code
+//
+// 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.
+//
+
+require("setimmediate"); // To be compatible with all versions of node.js
+
+var archiver = require('archiver');
+var fs = require('fs');
+var Stream = require('stream'); // BMK_STREAM:
+
+// Globals:
+
+var int_officegen_globals = {}; // Our internal globals.
+
+int_officegen_globals.settings = {};
+int_officegen_globals.types = {};
+int_officegen_globals.common_obj = {};
+
+///
+/// @brief The constructor of the office generator object.
+///
+/// This constructor function is been called by makegen().
+///
+/// @b The @b Options:
+///
+/// The configuration options effecting the operation of the officegen object. Some of them can be only been
+/// declared on the 'options' object passed to the constructor object and the rest can be configured by either
+/// a property with the same name or by special function.
+///
+/// @b List @b Of @b Options:
+///
+/// - 'type' - the type of generator to create. Possible options: either 'pptx', 'docx' or 'xlsx'.
+/// - 'creator' - the name of the document's author. The default is 'officegen'.
+/// - 'onend' - callback that been fired after finishing to create the zip stream.
+///
+/// @param[in] options List of configuration options (see in the description of this function).
+///
+officegen = function ( options ) {
+ var genobj = this; // Can be accessed by all the functions been declared inside the officegen object.
+ var gen_private = {}; // For all the private data that we don't want the user of officegen to access it.
+
+ gen_private.plugs = {}; // API for plugins.
+
+ gen_private.perment = {}; // All stuff that is 100% unchangable after selecting the type to create.
+ gen_private.thisDoc = {}; // All stuff that is 100% depended on the current document to create (all the stuff that
+ // been erased by calling to startNewDoc().
+ gen_private.mixed = {}; // Mixed stuff (both perment and document depend).
+
+ gen_private.perment.features = {}; // Features been configured by the type selector and you can't change them.
+ // gen_private.perment.features.page_name
+ // gen_private.perment.features.call_before_gen
+ // gen_private.perment.features.call_after_gen
+ // gen_private.perment.features.call_on_clear
+
+ gen_private.thisDoc.pages = []; // Information about all the pages to create.
+ gen_private.mixed.res_list = []; // List of all the resources to create inside the zip.
+ gen_private.mixed.res_data = {}; // Information about all the resources to create.
+
+ ///
+ /// @brief Prepare all the internal options.
+ ///
+ /// This function configuring all the both public properties and internal options depending on the given options.
+ ///
+ /// @param[in] options The options to configure.
+ ///
+ function setOptions ( options )
+ {
+ // BMK_TODO: Temporary - a better way will be implemented later:
+ genobj.options = options ? options : {};
+ };
+
+ ///
+ /// @brief Configure this object to generate the given type of document.
+ ///
+ /// This function configuring the generator to create the given type of document.
+ ///
+ /// @param[in] new_type The type of document to create.
+ ///
+ function setGeneratorType ( new_type ) {
+ gen_private.length = 0;
+ var is_ok = false;
+
+ if ( new_type ) {
+ for ( var cur_type in int_officegen_globals.types ) {
+ if ( (cur_type == new_type) && int_officegen_globals.types[cur_type] && int_officegen_globals.types[cur_type].createFunc ) {
+ int_officegen_globals.types[cur_type].createFunc ( genobj, new_type, genobj.options, gen_private, int_officegen_globals.types[cur_type] );
+ is_ok = true;
+ break;
+ } // Endif.
+ } // End of for loop.
+
+ if ( !is_ok ) {
+ console.error ( '\nFATAL ERROR: Either unknown or unsupported file type - %s\n', options.type );
+ throw new Error ( 'FATAL ERROR: Invalid file type.' );
+ } // Endif.
+ } // Endif.
+ };
+
+ ///
+ /// @brief Add a resource to the list of resources to place inside the output zip file.
+ ///
+ /// This method adding a resource to the list of resources to place inside the output document ZIP.
+ ///
+ /// @param[in] resource_name The name of the resource (path).
+ /// @param[in] type_of_res The type of this resource: either 'file' or 'buffer'.
+ /// @param[in] res_data Optional data to use when creating this resource.
+ /// @param[in] res_cb Callback to generate this resource (for 'buffer' mode only).
+ /// @param[in] is_always Is true if this resource is perment for all the zip of this document type.
+ ///
+ gen_private.plugs.intAddAnyResourceToParse = function ( resource_name, type_of_res, res_data, res_cb, is_always ) {
+ var newRes = {};
+
+ newRes.name = resource_name;
+ newRes.type = type_of_res;
+ newRes.data = res_data;
+ newRes.callback = res_cb;
+ newRes.is_perment = is_always;
+
+ gen_private.mixed.res_list.push ( newRes );
+ };
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] element_name ???.
+ /// @param[in] def_data ???.
+ /// @param[in] prop_name ???.
+ /// @param[in] user_access_func_name ???.
+ ///
+ function addInfoType ( element_name, def_data, prop_name, user_access_func_name ) {
+ genobj.info[element_name] = {};
+ genobj.info[element_name].element = element_name;
+ genobj.info[element_name].data = def_data;
+ genobj.info[element_name].def_data = def_data;
+
+ // The user of officegen can configure this property using the options object:
+ if ( genobj.options.prop_name )
+ {
+ genobj.info[element_name].data = genobj.options.prop_name;
+ } // Endif.
+
+ genobj[user_access_func_name] = function ( new_data ) {
+ genobj.info[element_name].data = new_data;
+ };
+ };
+
+ // Public API:
+
+ ///
+ /// @brief Generating the output document stream.
+ ///
+ /// The user of officegen must call this method after filling all the information about what to put inside
+ /// the generated document. This method is creating the output document directly into the given stream object.
+ ///
+ this.generate = function ( stream ) {
+ if ( gen_private.perment.features.page_name ) {
+ if ( gen_private.thisDoc.pages.length == 0 ) {
+ throw new Error ( 'ERROR: No ' + gen_private.perment.features.page_name + ' been found inside your document.' );
+ } // Endif.
+ } // Endif.
+
+ // Optional callback to prepare everything for generating:
+ if ( gen_private.perment.features.call_before_gen )
+ {
+ gen_private.perment.features.call_before_gen ();
+ } // Endif.
+
+ var archive = archiver('zip');
+
+ archive.on('error', function(err) {
+ throw err;
+ });
+
+ archive.pipe ( stream );
+
+ ///
+ /// @brief Add the next resource into the zip stream.
+ ///
+ /// This function adding the next resource into the zip stream.
+ ///
+ function generateNextResource ( cur_index )
+ {
+ var resStream;
+
+ if ( cur_index < gen_private.mixed.res_list.length ) {
+ if ( typeof gen_private.mixed.res_list[cur_index] != 'undefined' ) {
+ switch ( gen_private.mixed.res_list[cur_index].type ) {
+ case 'buffer':
+ resStream = gen_private.mixed.res_list[cur_index].callback ( gen_private.mixed.res_list[cur_index].data );
+ break;
+
+ // BMK_STREAM: (***START***)
+ // Using some kind of simple 'template' engine:
+ case 'custom':
+ resStream = new Stream ();
+ resStream.readable = true;
+ process.nextTick ( function() {
+ // The callback should emit data events and then end event. The problem is that we can't
+ // call emit before the pipe starting to run. That's why we are not executing the callback
+ // immediately but using the process.nextTick trick to make it to run after the pipe is
+ // starting and someone is listening to our events.
+ gen_private.mixed.res_list[cur_index].callback ( resStream, gen_private.mixed.res_list[cur_index].data );
+ });
+ break;
+ // BMK_STREAM: (***END***)
+
+ // Just copy the file as is:
+ case 'file':
+ resStream = fs.createReadStream ( gen_private.mixed.res_list[cur_index].data || gen_private.mixed.res_list[cur_index].name );
+ break;
+
+ // Just use this stream:
+ case 'stream':
+ resStream = gen_private.mixed.res_list[cur_index].data;
+ break;
+ } // End of switch.
+
+ if ( typeof resStream != 'undefined' ) {
+ if ( int_officegen_globals.settings.verbose ) {
+ console.log ( 'Adding "' + gen_private.mixed.res_list[cur_index].name + '" (' + gen_private.mixed.res_list[cur_index].type + ')...' );
+ } // Endif.
+
+ archive.append ( resStream, { name: gen_private.mixed.res_list[cur_index].name }, function () {
+ setImmediate ( function() { generateNextResource ( cur_index + 1 ); });
+ });
+
+
+ } else {
+ setImmediate ( function() { generateNextResource ( cur_index + 1 ); });
+ } // Endif.
+
+ } else {
+ setImmediate ( function() { generateNextResource ( cur_index + 1 ); });
+ } // Endif.
+
+ } else {
+ archive.finalize ( function ( err, written ) {
+ // Optional callback to clean after us:
+ if ( gen_private.perment.features.call_after_gen )
+ {
+ gen_private.perment.features.call_after_gen ( err, written );
+ } // Endif.
+
+ if ( err ) {
+ throw err;
+ } // Endif.
+
+ if ( genobj.options && genobj.options.onend ) {
+ genobj.options.onend ( written );
+ } // Endif.
+ });
+ } // Endif.
+ };
+
+ // Start the process of generating the output zip stream:
+ generateNextResource ( 0 );
+ };
+
+ ///
+ /// @brief Reuse this object for a new document of the same type.
+ ///
+ /// Call this method if you want to start generating a new document of the same type using this object.
+ ///
+ this.startNewDoc = function () {
+ var kill = [];
+
+ for ( var i = 0; i < gen_private.mixed.res_list.length; i++ ) {
+ if ( !gen_private.mixed.res_list[i].is_perment ) kill.push ( i );
+ } // End of for loop.
+
+ for ( var i = 0; i < kill.length; i++ ) gen_private.mixed.res_list.splice ( kill[i] - i, 1 );
+
+ gen_private.thisDoc.pages.length = 0;
+
+ if ( gen_private.perment.features.call_on_clear ) {
+ gen_private.perment.features.call_on_clear ();
+ } // Endif.
+ };
+
+ // Public API - plugin API:
+
+ ///
+ /// @brief Register a new resource to add into the generated ZIP stream.
+ ///
+ /// Using this method the user can add extra custom resources into the generated ZIP stream.
+ ///
+ /// @param[in] resource_name The name of the resource (path).
+ /// @param[in] type_of_res The type of this resource: either 'file' or 'buffer'.
+ /// @param[in] res_data Optional data to use when creating this resource.
+ /// @param[in] res_cb Callback to generate this resource (for 'buffer' mode only).
+ ///
+ this.addResourceToParse = function ( resource_name, type_of_res, res_data, res_cb ) {
+ // We don't want the user to add perment resources to the list of resources:
+ intAddAnyResourceToParse ( resource_name, type_of_res, res_data, res_cb, false );
+ };
+
+ // See the officegen descriptions for the rules of the options:
+ setOptions ( options );
+
+ // Configure this object depending on the user's selected type:
+ if ( genobj.options.type ) {
+ setGeneratorType ( genobj.options.type );
+ } // Endif.
+};
+
+///
+/// @brief Create a new officegen object.
+///
+/// This method creating a new officegen based object.
+///
+/// @b Example:
+///
+/// @code
+/// @endcode
+///
+function makegen ( options ) {
+ return new officegen ( options );
+};
+
+///
+/// @brief Change the verbose state of officegen.
+///
+/// This is a global settings effecting all the officegen objects in your application. You should
+/// use it only for debugging.
+///
+/// @param[in] new_state Either true or false.
+///
+function setVerboseMode ( new_state ) {
+ int_officegen_globals.settings.verbose = new_state;
+};
+
+///
+/// @brief Register a new type of document that we can generate.
+///
+/// This method registering a new type of document that we can generate. You can extend officegen to support any
+/// type of document that based on resources files inside ZIP stream.
+///
+/// @param[in] typeName The type of the document file.
+/// @param[in] createFunc The function to use to create this type of file.
+///
+function registerDocType ( typeName, createFunc ) {
+ int_officegen_globals.types[typeName] = {};
+ int_officegen_globals.types[typeName].createFunc = createFunc;
+};
+
+exports.makegen = makegen;
+exports.setVerboseMode = setVerboseMode;
+exports.registerDocType = registerDocType;
+exports.schema = int_officegen_globals.types;
+
View
378 lib/gendocx.js
@@ -0,0 +1,378 @@
+//
+// officegen: All the code to generate DOCX 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.
+//
+
+var baseobj = require("./basicgen.js");
+var msdoc = require("./msofficegen.js");
+
+if ( !String.prototype.encodeHTML ) {
+ String.prototype.encodeHTML = function () {
+ return this.replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+ };
+}
+
+///
+/// @brief Extend officegen object with DOCX support.
+///
+/// This method extending the given officegen object to create DOCX document.
+///
+/// @param[in] genobj The object to extend.
+/// @param[in] new_type The type of object to create.
+/// @param[in] options The object's options.
+/// @param[in] gen_private Access to the internals of this object.
+/// @param[in] type_info Additional information about this type.
+///
+function makeDocx ( genobj, new_type, options, gen_private, type_info ) {
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeDocxFontsTable ( data ) {
+ return gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<w:fonts xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:font w:name="Calibri"><w:panose1 w:val="020F0502020204030204"/><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/><w:sig w:usb0="A00002EF" w:usb1="4000207B" w:usb2="00000000" w:usb3="00000000" w:csb0="0000009F" w:csb1="00000000"/></w:font><w:font w:name="Arial"><w:panose1 w:val="020B0604020202020204"/><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/><w:sig w:usb0="20002A87" w:usb1="80000000" w:usb2="00000008" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/></w:font><w:font w:name="Times New Roman"><w:panose1 w:val="02020603050405020304"/><w:charset w:val="00"/><w:family w:val="roman"/><w:pitch w:val="variable"/><w:sig w:usb0="20002A87" w:usb1="80000000" w:usb2="00000008" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/></w:font><w:font w:name="Cambria"><w:panose1 w:val="02040503050406030204"/><w:charset w:val="00"/><w:family w:val="roman"/><w:pitch w:val="variable"/><w:sig w:usb0="A00002EF" w:usb1="4000004B" w:usb2="00000000" w:usb3="00000000" w:csb0="0000009F" w:csb1="00000000"/></w:font></w:fonts>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeDocxSettings ( data ) {
+ return gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<w:settings xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main"><w:zoom w:percent="120"/><w:defaultTabStop w:val="720"/><w:characterSpacingControl w:val="doNotCompress"/><w:compat/><w:rsids><w:rsidRoot w:val="00A94AF2"/><w:rsid w:val="00A02F19"/><w:rsid w:val="00A94AF2"/></w:rsids><m:mathPr><m:mathFont m:val="Cambria Math"/><m:brkBin m:val="before"/><m:brkBinSub m:val="--"/><m:smallFrac m:val="off"/><m:dispDef/><m:lMargin m:val="0"/><m:rMargin m:val="0"/><m:defJc m:val="centerGroup"/><m:wrapIndent m:val="1440"/><m:intLim m:val="subSup"/><m:naryLim m:val="undOvr"/></m:mathPr><w:themeFontLang w:val="en-US" w:bidi="en-US"/><w:clrSchemeMapping w:bg1="light1" w:t1="dark1" w:bg2="light2" w:t2="dark2" w:accent1="accent1" w:accent2="accent2" w:accent3="accent3" w:accent4="accent4" w:accent5="accent5" w:accent6="accent6" w:hyperlink="hyperlink" w:followedHyperlink="followedHyperlink"/><w:shapeDefaults><o:shapedefaults v:ext="edit" spidmax="2050"/><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout></w:shapeDefaults><w:decimalSymbol w:val="."/><w:listSeparator w:val=","/></w:settings>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeDocxWeb ( data ) {
+ return gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<w:webSettings xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:optimizeForBrowser/></w:webSettings>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeDocxStyles ( data ) {
+ return gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<w:styles xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:asciiTheme="minorHAnsi" w:eastAsiaTheme="minorHAnsi" w:hAnsiTheme="minorHAnsi" w:cstheme="minorBidi"/><w:sz w:val="22"/><w:szCs w:val="22"/><w:lang w:val="en-US" w:eastAsia="en-US" w:bidi="en-US"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="200" w:line="276" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:latentStyles w:defLockedState="0" w:defUIPriority="99" w:defSemiHidden="1" w:defUnhideWhenUsed="1" w:defQFormat="0" w:count="267"><w:lsdException w:name="Normal" w:semiHidden="0" w:uiPriority="0" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="heading 1" w:semiHidden="0" w:uiPriority="9" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="heading 2" w:uiPriority="9" w:qFormat="1"/><w:lsdException w:name="heading 3" w:uiPriority="9" w:qFormat="1"/><w:lsdException w:name="heading 4" w:uiPriority="9" w:qFormat="1"/><w:lsdException w:name="heading 5" w:uiPriority="9" w:qFormat="1"/><w:lsdException w:name="heading 6" w:uiPriority="9" w:qFormat="1"/><w:lsdException w:name="heading 7" w:uiPriority="9" w:qFormat="1"/><w:lsdException w:name="heading 8" w:uiPriority="9" w:qFormat="1"/><w:lsdException w:name="heading 9" w:uiPriority="9" w:qFormat="1"/><w:lsdException w:name="toc 1" w:uiPriority="39"/><w:lsdException w:name="toc 2" w:uiPriority="39"/><w:lsdException w:name="toc 3" w:uiPriority="39"/><w:lsdException w:name="toc 4" w:uiPriority="39"/><w:lsdException w:name="toc 5" w:uiPriority="39"/><w:lsdException w:name="toc 6" w:uiPriority="39"/><w:lsdException w:name="toc 7" w:uiPriority="39"/><w:lsdException w:name="toc 8" w:uiPriority="39"/><w:lsdException w:name="toc 9" w:uiPriority="39"/><w:lsdException w:name="caption" w:uiPriority="35" w:qFormat="1"/><w:lsdException w:name="Title" w:semiHidden="0" w:uiPriority="10" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Default Paragraph Font" w:uiPriority="1"/><w:lsdException w:name="Subtitle" w:semiHidden="0" w:uiPriority="11" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Strong" w:semiHidden="0" w:uiPriority="22" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Emphasis" w:semiHidden="0" w:uiPriority="20" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Table Grid" w:semiHidden="0" w:uiPriority="59" w:unhideWhenUsed="0"/><w:lsdException w:name="Placeholder Text" w:unhideWhenUsed="0"/><w:lsdException w:name="No Spacing" w:semiHidden="0" w:uiPriority="1" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Light Shading" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/><w:lsdException w:name="Light List" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Grid" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 1" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 2" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 1" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 2" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 1" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 2" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 3" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/><w:lsdException w:name="Dark List" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Shading" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful List" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Grid" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Shading Accent 1" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/><w:lsdException w:name="Light List Accent 1" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Grid Accent 1" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 1 Accent 1" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 2 Accent 1" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 1 Accent 1" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/><w:lsdException w:name="Revision" w:unhideWhenUsed="0"/><w:lsdException w:name="List Paragraph" w:semiHidden="0" w:uiPriority="34" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Quote" w:semiHidden="0" w:uiPriority="29" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Intense Quote" w:semiHidden="0" w:uiPriority="30" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Medium List 2 Accent 1" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 1 Accent 1" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 2 Accent 1" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 3 Accent 1" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/><w:lsdException w:name="Dark List Accent 1" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Shading Accent 1" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful List Accent 1" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Grid Accent 1" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Shading Accent 2" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/><w:lsdException w:name="Light List Accent 2" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Grid Accent 2" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 1 Accent 2" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 2 Accent 2" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 1 Accent 2" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 2 Accent 2" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 1 Accent 2" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 2 Accent 2" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 3 Accent 2" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/><w:lsdException w:name="Dark List Accent 2" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Shading Accent 2" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful List Accent 2" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Grid Accent 2" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Shading Accent 3" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/><w:lsdException w:name="Light List Accent 3" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Grid Accent 3" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 1 Accent 3" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 2 Accent 3" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 1 Accent 3" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 2 Accent 3" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 1 Accent 3" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 2 Accent 3" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 3 Accent 3" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/><w:lsdException w:name="Dark List Accent 3" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Shading Accent 3" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful List Accent 3" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Grid Accent 3" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Shading Accent 4" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/><w:lsdException w:name="Light List Accent 4" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Grid Accent 4" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 1 Accent 4" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 2 Accent 4" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 1 Accent 4" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 2 Accent 4" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 1 Accent 4" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 2 Accent 4" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 3 Accent 4" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/><w:lsdException w:name="Dark List Accent 4" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Shading Accent 4" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful List Accent 4" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Grid Accent 4" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Shading Accent 5" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/><w:lsdException w:name="Light List Accent 5" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Grid Accent 5" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 1 Accent 5" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 2 Accent 5" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 1 Accent 5" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 2 Accent 5" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 1 Accent 5" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 2 Accent 5" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 3 Accent 5" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/><w:lsdException w:name="Dark List Accent 5" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Shading Accent 5" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful List Accent 5" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Grid Accent 5" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Shading Accent 6" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/><w:lsdException w:name="Light List Accent 6" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/><w:lsdException w:name="Light Grid Accent 6" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 1 Accent 6" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Shading 2 Accent 6" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 1 Accent 6" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium List 2 Accent 6" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 1 Accent 6" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 2 Accent 6" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/><w:lsdException w:name="Medium Grid 3 Accent 6" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/><w:lsdException w:name="Dark List Accent 6" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Shading Accent 6" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful List Accent 6" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/><w:lsdException w:name="Colorful Grid Accent 6" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/><w:lsdException w:name="Subtle Emphasis" w:semiHidden="0" w:uiPriority="19" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Intense Emphasis" w:semiHidden="0" w:uiPriority="21" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Subtle Reference" w:semiHidden="0" w:uiPriority="31" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Intense Reference" w:semiHidden="0" w:uiPriority="32" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Book Title" w:semiHidden="0" w:uiPriority="33" w:unhideWhenUsed="0" w:qFormat="1"/><w:lsdException w:name="Bibliography" w:uiPriority="37"/><w:lsdException w:name="TOC Heading" w:uiPriority="39" w:qFormat="1"/></w:latentStyles><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/><w:rsid w:val="00A02F19"/></w:style><w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont"><w:name w:val="Default Paragraph Font"/><w:uiPriority w:val="1"/><w:semiHidden/><w:unhideWhenUsed/></w:style><w:style w:type="table" w:default="1" w:styleId="TableNormal"><w:name w:val="Normal Table"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/><w:qFormat/><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style><w:style w:type="numbering" w:default="1" w:styleId="NoList"><w:name w:val="No List"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/></w:style></w:styles>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeDocxApp ( data ) {
+ var userName = genobj.options.creator || 'officegen';
+ var outString = gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Template>Normal.dotm</Template><TotalTime>1</TotalTime><Pages>1</Pages><Words>0</Words><Characters>0</Characters><Application>Microsoft Office Word</Application><DocSecurity>0</DocSecurity><Lines>1</Lines><Paragraphs>1</Paragraphs><ScaleCrop>false</ScaleCrop><Company>' + userName + '</Company><LinksUpToDate>false</LinksUpToDate><CharactersWithSpaces>0</CharactersWithSpaces><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>12.0000</AppVersion></Properties>';
+ return outString;
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeDocxDocument ( data ) {
+ var outString = gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"><w:body>';
+ var objs_list = data.data;
+
+ for ( var i = 0, total_size = objs_list.length; i < total_size; i++ ) {
+ outString += '<w:p w:rsidR="00A77427" w:rsidRDefault="00A77427">';
+ var pPrData = '';
+
+ if ( objs_list[i].options ) {
+ if ( objs_list[i].options.align ) {
+ switch ( objs_list[i].options.align ) {
+ case 'center':
+ pPrData += '<w:jc w:val="center"/>';
+ break;
+
+ case 'right':
+ pPrData += '<w:jc w:val="right"/>';
+ break;
+
+ case 'justify':
+ pPrData += '<w:jc w:val="both"/>';
+ break;
+ } // End of switch.
+ } // Endif.
+
+ if ( objs_list[i].options.list_type ) {
+ pPrData += '<w:pStyle w:val="ListParagraph"/><w:numPr><w:ilvl w:val="0"/><w:numId w:val="' + objs_list[i].options.list_type + '"/></w:numPr>';
+ } // Endif.
+ } // Endif.
+
+ if ( pPrData ) {
+ outString += '<w:pPr>' + pPrData + '</w:pPr>';
+ } // Endif.
+
+ for ( var j = 0, total_size_j = objs_list[i].data.length; j < total_size_j; j++ ) {
+ if ( objs_list[i].data[j] ) {
+ var rExtra = '';
+ var tExtra = '';
+ var rPrData = '';
+
+ if ( objs_list[i].data[j].options ) {
+ if ( objs_list[i].data[j].options.color ) {
+ rPrData += '<w:color w:val="' + objs_list[i].data[j].options.color + '"/>';
+ } // Endif.
+
+ if ( objs_list[i].data[j].options.back ) {
+ rPrData += '<w:shd w:val="clear" w:color="auto" w:fill="' + objs_list[i].data[j].options.back + '"/>';
+ } // Endif.
+
+ if ( objs_list[i].data[j].options.bold ) {
+ rPrData += '<w:b/><w:bCs/>';
+ } // Endif.
+
+ if ( objs_list[i].data[j].options.underline ) {
+ rPrData += '<w:u w:val="single"/>';
+ } // Endif.
+
+ if ( objs_list[i].data[j].options.font_face ) {
+ rPrData += '<w:rFonts w:ascii="' + objs_list[i].data[j].options.font_face + '" w:hAnsi="' + objs_list[i].data[j].options.font_face + '" w:cs="' + objs_list[i].data[j].options.font_face + '"/>';
+ } // Endif.
+
+ if ( objs_list[i].data[j].options.font_size ) {
+ rPrData += '<w:sz w:val="' + objs_list[i].data[j].options.font_size + '"/><w:szCs w:val="' + objs_list[i].data[j].options.font_size + '"/>';
+ } // Endif.
+
+ if ( objs_list[i].data[j].options.border ) {
+ switch ( objs_list[i].data[j].options.border )
+ {
+ case 'single':
+ case true:
+ rPrData += '<w:bdr w:val="single" w:sz="4" w:space="0" w:color="auto"/>';
+ break;
+ } // End of switch.
+ } // Endif.
+ } // Endif.
+
+ if ( objs_list[i].data[j].text ) {
+ if ( objs_list[i].data[j].text[0] == ' ' ) {
+ tExtra += ' xml:space="preserve"';
+ } // Endif.
+
+ outString += '<w:r' + rExtra + '>';
+
+ if ( rPrData ) {
+ outString += '<w:rPr>' + rPrData + '</w:rPr>';
+ } // Endif.
+
+ outString += '<w:t' + tExtra + '>' + objs_list[i].data[j].text.encodeHTML () + '</w:t></w:r>';
+
+ } else if ( objs_list[i].data[j].page_break ) {
+ outString += '<w:r><w:br w:type="page"/></w:r>';
+ } // Endif.
+ } // Endif.
+ } // Endif.
+
+ outString += '</w:p>';
+ } // End of for loop.
+
+ outString += '<w:p w:rsidR="00A02F19" w:rsidRDefault="00A02F19"/><w:sectPr w:rsidR="00A02F19" w:rsidSect="00A02F19"><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/><w:docGrid w:linePitch="360"/></w:sectPr></w:body></w:document>';
+ return outString;
+ }
+
+ // Prepare genobj for MS-Office:
+ msdoc.makemsdoc ( genobj, new_type, options, gen_private, type_info );
+ gen_private.plugs.makeOfficeGenerator ( 'word', 'document', {} );
+
+ gen_private.perment.features.clear_data_more = function () {
+ genobj.data.length = 0;
+ };
+
+ gen_private.plugs.addInfoType ( 'dc:title', '', 'title', 'setDocTitle' );
+ gen_private.plugs.addInfoType ( 'dc:subject', '', 'subject', 'setDocSubject' );
+ gen_private.plugs.addInfoType ( 'cp:keywords', '', 'keywords', 'setDocKeywords' );
+ gen_private.plugs.addInfoType ( 'dc:description', '', 'description', 'setDescription' );
+
+ gen_private.mixed.files_list.push (
+ {
+ name: '/word/settings.xml',
+ type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml',
+ clear: 'type'
+ },
+ {
+ name: '/word/fontTable.xml',
+ type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml',
+ clear: 'type'
+ },
+ {
+ name: '/word/webSettings.xml',
+ type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml',
+ clear: 'type'
+ },
+ {
+ name: '/word/styles.xml',
+ type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml',
+ clear: 'type'
+ },
+ {
+ name: '/word/document.xml',
+ type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml',
+ clear: 'type'
+ }
+ );
+
+ gen_private.mixed.rels_app.push (
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
+ target: 'styles.xml',
+ clear: 'type'
+ },
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings',
+ target: 'settings.xml',
+ clear: 'type'
+ },
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings',
+ target: 'webSettings.xml',
+ clear: 'type'
+ },
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable',
+ target: 'fontTable.xml',
+ clear: 'type'
+ },
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
+ target: 'theme/theme1.xml',
+ clear: 'type'
+ }
+ );
+
+ genobj.data = []; // All the data will be placed here.
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'docProps\\app.xml', 'buffer', null, cbMakeDocxApp, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'word\\fontTable.xml', 'buffer', null, cbMakeDocxFontsTable, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'word\\settings.xml', 'buffer', null, cbMakeDocxSettings, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'word\\webSettings.xml', 'buffer', null, cbMakeDocxWeb, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'word\\styles.xml', 'buffer', null, cbMakeDocxStyles, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'word\\document.xml', 'buffer', genobj, cbMakeDocxDocument, true );
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'word\\_rels\\document.xml.rels', 'buffer', gen_private.mixed.rels_app, gen_private.plugs.cbMakeRels, true );
+
+ // ----- API for Word documents: -----
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ genobj.createP = function ( options ) {
+ var newP = {};
+
+ newP.data = [];
+ newP.options = options || {};
+
+ newP.addText = function ( text_msg, opt, flag_data ) {
+ newP.data[newP.data.length] = { text: text_msg, options: opt, ext_data: flag_data };
+ };
+
+ genobj.data[genobj.data.length] = newP;
+ return newP;
+ };
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ genobj.createListOfDots = function ( options ) {
+ var newP = genobj.createP ( options );
+
+ newP.options.list_type = '1';
+
+ return newP;
+ };
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ genobj.createListOfNumbers = function ( options ) {
+ var newP = genobj.createP ( options );
+
+ newP.options.list_type = '2';
+
+ return newP;
+ };
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ genobj.putPageBreak = function () {
+ var newP = {};
+
+ newP.data = [ { 'page_break': true } ];
+
+ genobj.data[genobj.data.length] = newP;
+ return newP;
+ };
+}
+
+baseobj.registerDocType ( 'docx', makeDocx );
+
View
1,003 lib/genpptx.js
@@ -0,0 +1,1003 @@
+//
+// 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.
+//
+
+var baseobj = require("./basicgen.js");
+var msdoc = require("./msofficegen.js");
+
+var fast_image_size = require('fast-image-size');
+
+if ( !String.prototype.encodeHTML ) {
+ String.prototype.encodeHTML = function () {
+ return this.replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+ };
+}
+
+///
+/// @brief Extend officegen object with PPTX/PPSX support.
+///
+/// This method extending the given officegen object to create PPTX/PPSX document.
+///
+/// @param[in] genobj The object to extend.
+/// @param[in] new_type The type of object to create.
+/// @param[in] options The object's options.
+/// @param[in] gen_private Access to the internals of this object.
+/// @param[in] type_info Additional information about this type.
+///
+function makePptx ( genobj, new_type, options, gen_private, type_info ) {
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakePptxPresProps ( data ) {
+ return gen_private.plugs.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"/>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakePptxStyles ( data ) {
+ return gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"/>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakePptxViewProps ( data ) {
+ return gen_private.plugs.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>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakePptxLayout ( data ) {
+ return gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<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" 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/><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="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><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></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="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>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="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:sldLayout>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakePptxPresentation ( data ) {
+ var outString = gen_private.plugs.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.thisDoc.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="9144000" cy="6858000" type="screen4x3"/><p:notesSz cx="6858000" cy="9144000"/><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></p:presentation>';
+ return outString;
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakePptxSlideMasters ( data ) {
+ return gen_private.plugs.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><p:sldLayoutId id="2147483649" r:id="rId1"/></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>';
+ }
+
+ ///
+ /// @brief Generate the XML code to describe colors.
+ ///
+ /// ???.
+ ///
+ /// @param[in] color_info Foreground color information.
+ /// @param[in] 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;
+ } // End of switch.
+ } // Endif.
+
+ return outText;
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] text_info Information how to display the text.
+ /// @param[in] 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.underline = '';
+ out_obj.rpr_info = '';
+
+ if ( typeof text_info == 'object' )
+ {
+ if ( text_info.bold ) {
+ out_obj.bold = ' b="1"';
+ } // 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.
+
+ 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>';
+
+ return out_obj;
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] text_info Information how to display the text.
+ /// @param[in] text_string The text string.
+ /// @param[in] slide_obj The object of this slider.
+ /// @return The PPTX code.
+ ///
+ function cMakePptxOutTextCommand ( text_info, text_string, slide_obj ) {
+ var area_opt_data = cMakePptxOutTextData ( text_info, slide_obj );
+ return '<a:r><a:rPr lang="en-US"' + area_opt_data.font_size + area_opt_data.bold + area_opt_data.underline + ' dirty="0" smtClean="0"' + (area_opt_data.rpr_info != '' ? ('>' + area_opt_data.rpr_info) : '/>') + '<a:t>' + text_string.encodeHTML () + '</a:t></a:r>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] in_data_val ???.
+ /// @param[in] max_value ???.
+ /// @param[in] def_value ???.
+ /// @param[in] auto_val ???.
+ /// @return ???.
+ ///
+ function parseSmartNumber ( in_data_val, max_value, def_value, auto_val, mul_val ) {
+ var realNum = mul_val ? in_data_val * mul_val : in_data_val;
+
+ if ( typeof in_data_val == 'undefined' ) {
+ return (typeof def_value == 'number') ? def_value : 0;
+ } // Endif.
+
+ 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 (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 realAuto / 2;
+ } // Endif.
+
+ return (typeof def_value == 'number') ? def_value : 0;
+ } // Endif.
+
+ if ( typeof in_data_val == 'number' ) {
+ return realNum;
+ } // Endif.
+
+ return (typeof def_value == 'number') ? def_value : 0;
+ }
+
+ ///
+ /// @brief Generate a slider resource.
+ ///
+ /// This function generating a slider XML resource.
+ ///
+ /// @param[in] data The main slide object.
+ /// @return Text string.
+ ///
+ function cbMakePptxSlide ( data ) {
+ var outString = gen_private.plugs.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"';
+ var objs_list = data.data;
+
+ if ( !data.slide.show ) {
+ outString += ' show="0"';
+ } // Endif.
+
+ outString += '><p:cSld>';
+
+ 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>';
+
+ // 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 ( objs_list[i].options.cx ) {
+ cx = parseSmartNumber ( objs_list[i].options.cx, 9144000, 2819400, 9144000, 10000 );
+ } // Endif.
+
+ if ( objs_list[i].options.cy ) {
+ cy = parseSmartNumber ( objs_list[i].options.cy, 6858000, 369332, 6858000, 10000 );
+ } // Endif.
+
+ if ( objs_list[i].options.x ) {
+ x = parseSmartNumber ( objs_list[i].options.x, 9144000, 0, 9144000 - cx, 10000 );
+ } // Endif.
+
+ if ( objs_list[i].options.y ) {
+ y = parseSmartNumber ( objs_list[i].options.y, 6858000, 0, 6858000 - cy, 10000 );
+ } // Endif.
+
+ if ( objs_list[i].options.shape && (typeof objs_list[i].options.shape == 'string') ) {
+ shapeType = objs_list[i].options.shape;
+ } // Endif.
+
+ if ( objs_list[i].options.flip_vertical ) {
+ locationAttr += ' flipV="1"';
+ } // Endif.
+
+ if ( objs_list[i].options.rotate ) {
+ var rotateVal = objs_list[i].options.rotate > 360 ? (objs_list[i].options.rotate - 360) : objs_list[i].options.rotate;
+ rotateVal *= 60000;
+ locationAttr += ' rot="' + rotateVal + '"';
+ } // Endif.
+ } // Endif.
+
+ switch ( objs_list[i].type ) {
+ case 'text':
+ case 'cxn':
+ if ( shapeType == null ) shapeType = 'rect';
+
+ if ( objs_list[i].type == 'cxn' ) {
+ outString += '<p:cxnSp><p:nvCxnSpPr>';
+ outString += '<p:cNvPr id="' + (i + 2) + '" name="Object ' + (i + 1) + '"/><p:nvPr/></p:nvCxnSpPr>';
+
+ } else {
+ outString += '<p:sp><p:nvSpPr>';
+ outString += '<p:cNvPr id="' + (i + 2) + '" name="Object ' + (i + 1) + '"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr>';
+ } // Endif.
+
+ outString += '<p:spPr>';
+
+ outString += '<a:xfrm' + locationAttr + '>';
+
+ outString += '<a:off x="' + x + '" y="' + y + '"/><a:ext cx="' + cx + '" cy="' + cy + '"/></a:xfrm><a:prstGeom prst="' + shapeType + '"><a:avLst/></a:prstGeom>';
+
+ if ( objs_list[i].options ) {
+ if ( objs_list[i].options.fill ) {
+ outString += cMakePptxColorSelection ( objs_list[i].options.fill );
+
+ } else {
+ outString += '<a:noFill/>';
+ } // Endif.
+
+ if ( objs_list[i].options.line ) {
+ var lineAttr = '';
+
+ if ( objs_list[i].options.line_size ) {
+ lineAttr += ' w="' + (objs_list[i].options.line_size * 12700) + '"';
+ } // Endif.
+
+ // cmpd="dbl"
+
+ outString += '<a:ln' + lineAttr + '>';
+ outString += cMakePptxColorSelection ( objs_list[i].options.line );
+
+ if ( objs_list[i].options.line_head ) {
+ outString += '<a:headEnd type="' + objs_list[i].options.line_head + '"/>';
+ } // Endif.
+
+ if ( objs_list[i].options.line_tail ) {
+ outString += '<a:tailEnd type="' + objs_list[i].options.line_tail + '"/>';
+ } // Endif.
+
+ outString += '</a:ln>';
+ } // Endif.
+
+ } else {
+ outString += '<a:noFill/>';
+ } // Endif.
+
+ outString += '</p:spPr>';
+
+ if ( objs_list[i].options ) {
+ if ( objs_list[i].options.align ) {
+ switch ( objs_list[i].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 ( objs_list[i].options.indentLevel > 0 ) {
+ moreStylesAttr += ' lvl="' + objs_list[i].options.indentLevel + '"';
+ } // Endif.
+ } // Endif.
+
+ if ( moreStyles != '' ) {
+ outStyles = '<a:pPr' + moreStylesAttr + '>' + moreStyles + '</a:pPr>';
+
+ } else if ( moreStylesAttr != '' ) {
+ outStyles = '<a:pPr' + moreStylesAttr + '/>';
+ } // Endif.
+
+ if ( styleData != '' ) {
+ outString += '<p:style>' + styleData + '</p:style>';
+ } // Endif.
+
+ if ( typeof objs_list[i].text == 'string' ) {
+ outString += '<p:txBody><a:bodyPr wrap="square" rtlCol="0"><a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p>' + outStyles;
+ outString += cMakePptxOutTextCommand ( objs_list[i].options, objs_list[i].text, data.slide );
+
+ } else if ( objs_list[i].text ) {
+ outString += '<p:txBody><a:bodyPr wrap="square" rtlCol="0"><a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p>' + outStyles;
+
+ for ( var j = 0, total_size_j = objs_list[i].text.length; j < total_size_j; j++ ) {
+ if ( objs_list[i].text[j] ) {
+ outString += cMakePptxOutTextCommand ( objs_list[i].text[j].options, objs_list[i].text[j].text, data.slide );
+ } // Endif.
+ } // Endif.
+ } // Endif.
+
+ if ( typeof objs_list[i].text != 'undefined' ) {
+ var font_size = '';
+ if ( objs_list[i].options && objs_list[i].options.font_size ) {
+ font_size = ' sz="' + objs_list[i].options.font_size + '00"';
+ } // Endif.
+
+ outString += '<a:endParaRPr lang="en-US"' + font_size + ' dirty="0"/></a:p></p:txBody>';
+ } // Endif.
+
+ outString += objs_list[i].type == 'cxn' ? '</p:cxnSp>' : '</p:sp>';
+ break;
+
+ // Image:
+ case 'image':
+ outString += '<p:pic><p:nvPicPr><p:cNvPr id="' + (i + 2) + '" name="Object ' + (i + 1) + '"/><p:cNvPicPr><a:picLocks noChangeAspect="1"/></p:cNvPicPr><p:nvPr/></p:nvPicPr><p:blipFill><a:blip r:embed="rId' + objs_list[i].rel_id + '" cstate="print"/><a:stretch><a:fillRect/></a:stretch></p:blipFill><p:spPr><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></p:spPr></p:pic>';
+ break;
+
+ // Paragraph:
+ case 'p':
+ if ( shapeType == null ) shapeType = 'rect';
+
+ outString += '<p:sp><p:nvSpPr>';
+ outString += '<p:cNvPr id="' + (i + 2) + '" name="Object ' + (i + 1) + '"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr>';
+ outString += '<p:spPr>';
+
+ outString += '<a:xfrm' + locationAttr + '>';
+
+ outString += '<a:off x="' + x + '" y="' + y + '"/><a:ext cx="' + cx + '" cy="' + cy + '"/></a:xfrm><a:prstGeom prst="' + shapeType + '"><a:avLst/></a:prstGeom>';
+
+ if ( objs_list[i].options ) {
+ if ( objs_list[i].options.fill ) {
+ outString += cMakePptxColorSelection ( objs_list[i].options.fill );
+
+ } else {
+ outString += '<a:noFill/>';
+ } // Endif.
+
+ if ( objs_list[i].options.line ) {
+ outString += '<a:ln>';
+ outString += cMakePptxColorSelection ( objs_list[i].options.line );
+
+ if ( objs_list[i].options.line_head ) {
+ outString += '<a:headEnd type="' + objs_list[i].options.line_head + '"/>';
+ } // Endif.
+
+ if ( objs_list[i].options.line_tail ) {
+ outString += '<a:tailEnd type="' + objs_list[i].options.line_tail + '"/>';
+ } // Endif.
+
+ outString += '</a:ln>';
+ } // Endif.
+
+ } else {
+ outString += '<a:noFill/>';
+ } // Endif.
+
+ outString += '</p:spPr>';
+
+ if ( styleData != '' ) {
+ outString += '<p:style>' + styleData + '</p:style>';
+ } // Endif.
+
+ outString += '<p:txBody><a:bodyPr wrap="square" rtlCol="0"><a:spAutoFit/></a:bodyPr><a:lstStyle/>';
+
+ for ( var j = 0, total_size_j = objs_list[i].data.length; j < total_size_j; j++ ) {
+ if ( objs_list[i].data[j] ) {
+ moreStylesAttr = '';
+ moreStyles = '';
+
+ if ( objs_list[i].data[j].options ) {
+ if ( objs_list[i].data[j].options.align ) {
+ switch ( objs_list[i].data[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 ( objs_list[i].data[j].options.indentLevel > 0 ) {
+ moreStylesAttr += ' lvl="' + objs_list[i].data[j].options.indentLevel + '"';
+ } // Endif.
+
+ if ( objs_list[i].data[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.
+
+ outString += '<a:p>' + outStyles;
+
+ // if ( typeof objs_list[i].data[j].text == 'string' ) {
+ outString += cMakePptxOutTextCommand ( objs_list[i].data[j].options, objs_list[i].data[j].text, data.slide );
+ // BMK_TODO:
+ } // Endif.
+ } // Endif.
+
+ var font_size = '';
+ if ( objs_list[i].options && objs_list[i].options.font_size ) {
+ font_size = ' sz="' + objs_list[i].options.font_size + '00"';
+ } // Endif.
+
+ outString += '<a:endParaRPr lang="en-US"' + font_size + ' dirty="0"/></a:p>';
+ outString += '</p:txBody>';
+
+ outString += '</p:sp>';
+ break;
+ } // End of switch.
+ } // End of for loop.
+
+ outString += '</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>';
+ return outString;
+ }
+
+ ///
+ /// @brief Generate the extended attributes file (app) for PPTX/PPSX documents.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakePptxApp ( data ) {
+ var slidesCount = gen_private.thisDoc.pages.length;
+ var userName = genobj.options.creator || 'officegen';
+ var outString = gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><TotalTime>0</TotalTime><Words>0</Words><Application>Microsoft Office PowerPoint</Application><PresentationFormat>On-screen Show (4:3)</PresentationFormat><Paragraphs>0</Paragraphs><Slides>' + slidesCount + '</Slides><Notes>0</Notes><HiddenSlides>0</HiddenSlides><MMClips>0</MMClips><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size="4" baseType="variant"><vt:variant><vt:lpstr>Theme</vt:lpstr></vt:variant><vt:variant><vt:i4>1</vt:i4></vt:variant><vt:variant><vt:lpstr>Slide Titles</vt:lpstr></vt:variant><vt:variant><vt:i4>' + slidesCount + '</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size="' + (slidesCount + 1) + '" baseType="lpstr"><vt:lpstr>Office Theme</vt:lpstr>';
+
+ for ( var i = 0, total_size = gen_private.thisDoc.pages.length; i < total_size; i++ ) {
+ outString += '<vt:lpstr>' + gen_private.thisDoc.pages[i].slide.name.encodeHTML () + '</vt:lpstr>';
+ } // End of for loop.
+
+ outString += '</vt:vector></TitlesOfParts><Company>' + userName + '</Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>12.0000</AppVersion></Properties>';
+ return outString;
+ }
+
+ // Prepare genobj for MS-Office:
+ msdoc.makemsdoc ( genobj, new_type, options, gen_private, type_info );
+ gen_private.plugs.makeOfficeGenerator ( 'ppt', 'presentation', {} );
+
+ gen_private.thisDoc.images_count = 0;
+
+ gen_private.perment.features.page_name = 'slides'; // This document type must have pages.
+
+ gen_private.plugs.addInfoType ( 'dc:title', '', 'title', 'setDocTitle' );
+
+ var type_of_main_doc = 'slideshow';
+ if ( new_type != 'ppsx' )
+ {
+ type_of_main_doc = 'presentation';
+ } // Endif.
+
+ gen_private.mixed.files_list.push (
+ {
+ ext: 'jpeg',
+ type: 'image/jpeg',
+ clear: 'type'
+ },
+ {
+ ext: 'png',
+ type: 'image/png',
+ clear: 'type'
+ },
+ {
+ name: '/ppt/slideMasters/slideMaster1.xml',
+ type: 'application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml',
+ clear: 'type'
+ },
+ {
+ name: '/ppt/presProps.xml',
+ type: 'application/vnd.openxmlformats-officedocument.presentationml.presProps+xml',
+ clear: 'type'
+ },
+ {
+ name: '/ppt/presentation.xml',
+ type: 'application/vnd.openxmlformats-officedocument.presentationml.' + type_of_main_doc + '.main+xml',
+ clear: 'type'
+ },
+ {
+ name: '/ppt/slideLayouts/slideLayout1.xml',
+ type: 'application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml',
+ clear: 'type'
+ },
+ {
+ name: '/ppt/tableStyles.xml',
+ type: 'application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml',
+ clear: 'type'
+ },
+ {
+ name: '/ppt/viewProps.xml',
+ type: 'application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml',
+ clear: 'type'
+ }
+ );
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\presProps.xml', 'buffer', null, cbMakePptxPresProps, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\tableStyles.xml', 'buffer', null, cbMakePptxStyles, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\viewProps.xml', 'buffer', null, cbMakePptxViewProps, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\presentation.xml', 'buffer', null, cbMakePptxPresentation, true );
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\slideLayouts\\slideLayout1.xml', 'buffer', null, cbMakePptxLayout, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\slideLayouts\\_rels\\slideLayout1.xml.rels', 'buffer', [
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster',
+ target: '../slideMasters/slideMaster1.xml'
+ }
+ ], gen_private.plugs.cbMakeRels, true );
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\slideMasters\\slideMaster1.xml', 'buffer', null, cbMakePptxSlideMasters, true );
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\slideMasters\\_rels\\slideMaster1.xml.rels', 'buffer', [
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout',
+ target: '../slideLayouts/slideLayout1.xml'
+ },
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
+ target: '../theme/theme1.xml'
+ }
+ ], gen_private.plugs.cbMakeRels, true );
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'docProps\\app.xml', 'buffer', null, cbMakePptxApp, true );
+
+ gen_private.mixed.rels_app.push (
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster',
+ target: 'slideMasters/slideMaster1.xml',
+ clear: 'type'
+ }
+ );
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\_rels\\presentation.xml.rels', 'buffer', gen_private.mixed.rels_app, gen_private.plugs.cbMakeRels, true );
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ genobj.makeNewSlide = function () {
+ var pageNumber = gen_private.thisDoc.pages.length;
+ var slideObj = { show: true }; // The slide object that the user will use.
+
+ gen_private.thisDoc.pages[pageNumber] = {};
+ gen_private.thisDoc.pages[pageNumber].slide = slideObj;
+ gen_private.thisDoc.pages[pageNumber].data = [];
+ gen_private.thisDoc.pages[pageNumber].rels = [
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout',
+ target: '../slideLayouts/slideLayout1.xml',
+ clear: 'data'
+ }
+ ];
+
+ gen_private.mixed.files_list.push (
+ {
+ name: '/ppt/slides/slide' + (pageNumber + 1) + '.xml',
+ type: 'application/vnd.openxmlformats-officedocument.presentationml.slide+xml',
+ clear: 'data'
+ }
+ );
+
+ gen_private.mixed.rels_app.push (
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide',
+ target: 'slides/slide' + (pageNumber + 1) + '.xml',
+ clear: 'data'
+ }
+ );
+
+ slideObj.getPageNumber = function () { return pageNumber; };
+
+ slideObj.name = 'Slide ' + (pageNumber + 1);
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ slideObj.addText = function ( text, opt, y_pos, x_size, y_size, opt_b ) {
+ var objNumber = gen_private.thisDoc.pages[pageNumber].data.length;
+
+ gen_private.thisDoc.pages[pageNumber].data[objNumber] = {};
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].type = 'text';
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].text = text;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options = typeof opt == 'object' ? opt : {};
+
+ if ( typeof opt == 'string' ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.color = opt;
+
+ } else if ( (typeof opt != 'object') && (typeof y_pos != 'undefined') ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.x = opt;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.y = y_pos;
+
+ if ( (typeof x_size != 'undefined') && (typeof y_size != 'undefined') ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cx = x_size;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cy = y_size;
+ } // Endif.
+ } // Endif.
+
+ if ( typeof opt_b == 'object' ) {
+ for ( var attrname in opt_b ) { gen_private.thisDoc.pages[pageNumber].data[objNumber].options[attrname] = opt_b[attrname]; }
+
+ } else if ( (typeof x_size == 'object') && (typeof y_size == 'undefined') ) {
+ for ( var attrname in x_size ) { gen_private.thisDoc.pages[pageNumber].data[objNumber].options[attrname] = x_size[attrname]; }
+ } // Endif.
+ };
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ slideObj.addShape = function ( shape, opt, y_pos, x_size, y_size, opt_b ) {
+ var objNumber = gen_private.thisDoc.pages[pageNumber].data.length;
+
+ gen_private.thisDoc.pages[pageNumber].data[objNumber] = {};
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].type = 'text';
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options = typeof opt == 'object' ? opt : {};
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.shape = shape;
+
+ if ( typeof opt == 'string' ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.color = opt;
+
+ } else if ( (typeof opt != 'object') && (typeof y_pos != 'undefined') ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.x = opt;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.y = y_pos;
+
+ if ( (typeof x_size != 'undefined') && (typeof y_size != 'undefined') ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cx = x_size;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cy = y_size;
+ } // Endif.
+ } // Endif.
+
+ if ( typeof opt_b == 'object' ) {
+ for ( var attrname in opt_b ) { gen_private.thisDoc.pages[pageNumber].data[objNumber].options[attrname] = opt_b[attrname]; }
+
+ } else if ( (typeof x_size == 'object') && (typeof y_size == 'undefined') ) {
+ for ( var attrname in x_size ) { gen_private.thisDoc.pages[pageNumber].data[objNumber].options[attrname] = x_size[attrname]; }
+ } // Endif.
+ };
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ slideObj.addImage = function ( image_path, opt, y_pos, x_size, y_size, image_format_type ) {
+ var objNumber = gen_private.thisDoc.pages[pageNumber].data.length;
+ var image_type = (typeof image_format_type == 'string') ? image_format_type : 'png';
+ var defWidth, defHeight = 0;
+
+ if ( typeof image_path == 'string' ) {
+ var ret_data = fast_image_size ( image_path );
+ if ( ret_data.type == 'unknown' ) {
+ var image_ext = path.extname ( image_path );
+
+ switch ( image_ext ) {
+ case '.bmp':
+ image_type = 'bmp';
+ break;
+
+ case '.gif':
+ image_type = 'gif';
+ break;
+
+ case '.jpg':
+ case '.jpeg':
+ image_type = 'jpeg';
+ break;
+
+ case '.emf':
+ image_type = 'emf';
+ break;
+
+ case '.tiff':
+ image_type = 'tiff';
+ break;
+ } // End of switch.
+
+ } else {
+ if ( ret_data.width ) {
+ defWidth = ret_data.width;
+ } // Endif.
+
+ if ( ret_data.height ) {
+ defHeight = ret_data.height;
+ } // Endif.
+
+ image_type = ret_data.type;
+ if ( image_type == 'jpg' ) {
+ image_type = 'jpeg';
+ } // Endif.
+ } // Endif.
+ } // Endif.
+
+ gen_private.thisDoc.pages[pageNumber].data[objNumber] = {};
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].type = 'image';
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].image = image_path;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options = typeof opt == 'object' ? opt : {};
+
+ if ( !gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cx && defWidth ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cx = defWidth;
+ } // Endif.
+
+ if ( !gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cy && defHeight ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cy = defHeight;
+ } // Endif.
+
+ // console.log ( gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cy );
+ // console.log ( gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cx );
+
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].image_id = gen_private.thisDoc.images_count++;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].rel_id = gen_private.thisDoc.pages[pageNumber].rels.length + 1;
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\media\\image' + (gen_private.thisDoc.pages[pageNumber].data[objNumber].image_id + 1) + '.' + image_type, (typeof image_path == 'string') ? 'file' : 'stream', image_path, null, false );
+
+ gen_private.thisDoc.pages[pageNumber].rels.push (
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
+ target: '../media/image' + (gen_private.thisDoc.pages[pageNumber].data[objNumber].image_id + 1) + '.' + image_type,
+ clear: 'data'
+ }
+ );
+
+ if ( typeof opt == 'string' ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.color = opt;
+
+ } else if ( (typeof opt != 'object') && (typeof y_pos != 'undefined') ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.x = opt;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.y = y_pos;
+
+ if ( (typeof x_size != 'undefined') && (typeof y_size != 'undefined') ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cx = x_size;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cy = y_size;
+ } // Endif.
+ } // Endif.
+ };
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] ??? ???.
+ ///
+ slideObj.addP = function ( text, opt, y_pos, x_size, y_size, opt_b ) {
+ var objNumber = gen_private.thisDoc.pages[pageNumber].data.length;
+
+ gen_private.thisDoc.pages[pageNumber].data[objNumber] = {};
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].type = 'p';
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].data = [];
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options = typeof opt == 'object' ? opt : {};
+
+ if ( typeof opt == 'string' ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.color = opt;
+
+ } else if ( (typeof opt != 'object') && (typeof y_pos != 'undefined') ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.x = opt;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.y = y_pos;
+
+ if ( (typeof x_size != 'undefined') && (typeof y_size != 'undefined') ) {
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cx = x_size;
+ gen_private.thisDoc.pages[pageNumber].data[objNumber].options.cy = y_size;
+ } // Endif.
+ } // Endif.
+
+ if ( typeof opt_b == 'object' ) {
+ for ( var attrname in opt_b ) { gen_private.thisDoc.pages[pageNumber].data[objNumber].options[attrname] = opt_b[attrname]; }
+
+ } else if ( (typeof x_size == 'object') && (typeof y_size == 'undefined') ) {
+ for ( var attrname in x_size ) { gen_private.thisDoc.pages[pageNumber].data[objNumber].options[attrname] = x_size[attrname]; }
+ } // Endif.
+
+ // BMK_TODO:
+ return gen_private.thisDoc.pages[pageNumber].data[objNumber].data;
+ };
+
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\slides\\slide' + (pageNumber + 1) + '.xml', 'buffer', gen_private.thisDoc.pages[pageNumber], cbMakePptxSlide, false );
+ gen_private.plugs.intAddAnyResourceToParse ( 'ppt\\slides\\_rels\\slide' + (pageNumber + 1) + '.xml.rels', 'buffer', gen_private.thisDoc.pages[pageNumber].rels, gen_private.plugs.cbMakeRels, false );
+ return slideObj;
+ };
+}
+
+baseobj.registerDocType ( 'pptx', makePptx );
+baseobj.registerDocType ( 'ppsx', makePptx );
+
View
436 lib/genxlsx.js
@@ -0,0 +1,436 @@
+//
+// officegen: All the code to generate XLSX 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.
+//
+
+var baseobj = require("./basicgen.js");
+var msdoc = require("./msofficegen.js");
+
+if ( !String.prototype.encodeHTML ) {
+ String.prototype.encodeHTML = function () {
+ return this.replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+ };
+}
+
+///
+/// @brief Extend officegen object with XLSX support.
+///
+/// This method extending the given officegen object to create XLSX document.
+///
+/// @param[in] genobj The object to extend.
+/// @param[in] new_type The type of object to create.
+/// @param[in] options The object's options.
+/// @param[in] gen_private Access to the internals of this object.
+/// @param[in] type_info Additional information about this type.
+///
+function makeXlsx ( genobj, new_type, options, gen_private, type_info ) {
+ ///
+ /// @brief Create the shared string resource.
+ ///
+ /// This resource holding all the text strings of any Excel document.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeXlsSharedStrings ( data ) {
+ var outString = gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="' + genobj.generate_data.total_strings + '" uniqueCount="' + genobj.generate_data.shared_strings.length + '">';
+
+ for ( var i = 0, total_size = genobj.generate_data.shared_strings.length; i < total_size; i++ ) {
+ outString += '<si><t>' + genobj.generate_data.shared_strings[i].encodeHTML () + '</t></si>';
+ } // Endif.
+
+ return outString + '</sst>';
+ }
+
+ ///
+ /// @brief Prepare everything to generate XLSX files.
+ ///
+ /// This method working on all the Excel cells to find out information needed by the generator engine.
+ ///
+ function cbPrepareXlsxToGenerate () {
+ genobj.generate_data = {};
+ genobj.generate_data.shared_strings = [];
+ genobj.generate_data.total_strings = 0;
+ genobj.generate_data.cell_strings = [];
+
+ // Create the share strings data:
+ for ( var i = 0, total_size = gen_private.thisDoc.pages.length; i < total_size; i++ ) {
+ if ( gen_private.thisDoc.pages[i] ) {
+ for ( var rowId = 0, total_size_y = gen_private.thisDoc.pages[i].sheet.data.length; rowId < total_size_y; rowId++ ) {
+ if ( gen_private.thisDoc.pages[i].sheet.data[rowId] ) {
+ for ( var columnId = 0, total_size_x = gen_private.thisDoc.pages[i].sheet.data[rowId].length; columnId < total_size_x; columnId++ ) {
+ if ( typeof gen_private.thisDoc.pages[i].sheet.data[rowId][columnId] != 'undefined' ) {
+ switch ( typeof gen_private.thisDoc.pages[i].sheet.data[rowId][columnId] ) {
+ case 'string':
+ genobj.generate_data.total_strings++;
+
+ if ( !genobj.generate_data.cell_strings[i] ) {
+ genobj.generate_data.cell_strings[i] = [];
+ } // Endif.
+
+ if ( !genobj.generate_data.cell_strings[i][rowId] ) {
+ genobj.generate_data.cell_strings[i][rowId] = [];
+ } // Endif.
+
+ for ( var j = 0, total_size_j = genobj.generate_data.shared_strings.length; j < total_size_j; j++ ) {
+ if ( gen_private.thisDoc.pages[i].sheet.data[rowId][columnId] == genobj.generate_data.shared_strings[j] ) {
+ genobj.generate_data.cell_strings[i][rowId][columnId] = j;
+ } // Endif.
+ } // Endif.
+
+ if ( typeof genobj.generate_data.cell_strings[i][rowId][columnId] == 'undefined' ) {
+ genobj.generate_data.cell_strings[i][rowId][columnId] = genobj.generate_data.shared_strings.length;
+ genobj.generate_data.shared_strings[genobj.generate_data.shared_strings.length] = gen_private.thisDoc.pages[i].sheet.data[rowId][columnId];
+ } // Endif.
+ break;
+ } // End of switch.
+ } // Endif.
+ } // End of for loop.
+ } // Endif.
+ } // End of for loop.
+ } // Endif.
+ } // End of for loop.
+
+ if ( genobj.generate_data.total_strings ) {
+ gen_private.plugs.intAddAnyResourceToParse ( 'xl\\sharedStrings.xml', 'buffer', null, cbMakeXlsSharedStrings, false );
+ gen_private.mixed.files_list.push (
+ {
+ name: '/xl/sharedStrings.xml',
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml',
+ clear: 'generate'
+ }
+ );
+
+ gen_private.mixed.rels_app.push (
+ {
+ type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
+ target: 'sharedStrings.xml',
+ clear: 'generate'
+ }
+ );
+
+ // console.log ( genobj.generate_data.total_strings );
+ // console.log ( genobj.generate_data.shared_strings.length );
+ } // Endif.
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeXlsStyles ( data ) {
+ return gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="1"><font><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles><dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleLight16"/></styleSheet>';
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeXlsApp ( data ) {
+ var pagesCount = gen_private.thisDoc.pages.length;
+ var userName = genobj.options.creator || 'officegen';
+ var outString = gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>Microsoft Excel</Application><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size="2" baseType="variant"><vt:variant><vt:lpstr>Worksheets</vt:lpstr></vt:variant><vt:variant><vt:i4>' + pagesCount + '</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size="' + pagesCount + '" baseType="lpstr">';
+
+ for ( var i = 0, total_size = gen_private.thisDoc.pages.length; i < total_size; i++ ) {
+ outString += '<vt:lpstr>Sheet' + (i + 1) + '</vt:lpstr>';
+ } // End of for loop.
+
+ outString += '</vt:vector></TitlesOfParts><Company>' + userName + '</Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>12.0000</AppVersion></Properties>';
+ return outString;
+ }
+
+ ///
+ /// @brief ???.
+ ///
+ /// ???.
+ ///
+ /// @param[in] data Ignored by this callback function.
+ /// @return Text string.
+ ///
+ function cbMakeXlsWorkbook ( data ) {
+ var outString = gen_private.plugs.cbMakeMsOfficeBasicXml ( data ) + '<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4507"/><workbookPr defaultThemeVersion="124226"/><bookViews><workbookView xWindow="120" yWindow="75" windowWidth="19095" windowHeight="7485"/></bookViews><sheets>';
+
+ for ( var i = 0, total_size = gen_private.thisDoc.pages.length; i < total_size; i++ ) {
+ var sheetName = gen_private.thisDoc.pages[i].sheet.name || 'Sheet' + (i + 1);
+ var rId = gen_private.thisDoc.pages[i].relId;
+ outString += '<sheet name="' + sheetName + '" sheetId="' + (i + 1) + '" r:id="rId' + rId + '"/>';
+ } // End of for loop.
+
+ outString += '</sheets><calcPr calcId="125725"/></workbook>';
+ return outString;
+ }
+
+ ///
+ /// @brief Translate from the Excel displayed row name into index number.
+ ///
+ /// ???.
+ ///
+ /// @param[in] cell_string Either the cell displayed position or the row displayed position.
+ /// @return The cell's row Id.
+ ///
+ function cbCellToNumber ( cell_string, ret_also_column ) {
+ var cellNumber = 0;
+ var cellIndex = 0;
+ var cellMax = cell_string.length;
+ var rowId = 0;
+
+ // Converted from C++ (from DuckWriteC++):
+ while ( cellIndex < cellMax )
+ {
+ var curChar = cell_string.charCodeAt ( cellIndex );
+ if ( (curChar >= 0x30) && (curChar <= 0x39) )
+ {
+ rowId = parseInt ( cell_string.slice ( cellIndex ), 10 );
+ rowId = (rowId > 0) ? (rowId - 1) : 0;
+ break;
+
+ } else if ( (curChar >= 0x41) && (curChar <= 0x5A) )
+ {
+ if ( cellIndex > 0 )
+ {
+ cellNumber++;
+ cellNumber *= (0x5B-0x41);
+ } // Endif.
+
+ cellNumber += (curChar - 0x41);
+
+ } else if ( (curChar >= 0x61) && (curChar <= 0x7A) )
+ {
+ if ( cellIndex > 0 )
+ {
+ cellNumber++;
+ cellNumber *= (0x5B-0x41);
+ } // Endif.
+
+ cellNumber += (curChar - 0x61);
+ } // Endif.
+
+ cellIndex++;
+ } // End of while loop.
+