mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
924 lines
42 KiB
JavaScript
924 lines
42 KiB
JavaScript
/*
|
|
* (c) Copyright Ascensio System SIA 2010-2025
|
|
*
|
|
* This program is a free software product. You can redistribute it and/or
|
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
|
* version 3 as published by the Free Software Foundation. In accordance with
|
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
|
* of any third-party rights.
|
|
*
|
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
|
*
|
|
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
|
* street, Riga, Latvia, EU, LV-1050.
|
|
*
|
|
* The interactive user interfaces in modified source and object code versions
|
|
* of the Program must display Appropriate Legal Notices, as required under
|
|
* Section 5 of the GNU AGPL version 3.
|
|
*
|
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
|
* grant you any rights under trademark law for use of our trademarks.
|
|
*
|
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
|
* well as technical writing content are licensed under the terms of the
|
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
|
*
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
(function (window)
|
|
{
|
|
/**
|
|
* @param editor
|
|
* @constructor
|
|
*/
|
|
function MacroRecorder(editor)
|
|
{
|
|
this.editor = editor;
|
|
this.inProgress = false;
|
|
this.paused = false;
|
|
this.macroName = "";
|
|
this.result = "";
|
|
|
|
this.prevChangeType = null;
|
|
this.prevData = [];
|
|
this.actionCount = 0;
|
|
this.isFirstAction = null;
|
|
}
|
|
|
|
MacroRecorder.prototype.start = function(macroName)
|
|
{
|
|
if (this.inProgress)
|
|
return;
|
|
|
|
this.macroName = macroName;
|
|
this.result = "";
|
|
this.paused = false;
|
|
this.inProgress = true;
|
|
this.isFirstAction = true;
|
|
|
|
this.editor.sendEvent("asc_onMacroRecordingStart");
|
|
};
|
|
MacroRecorder.prototype.stop = function()
|
|
{
|
|
if (!this.inProgress)
|
|
return;
|
|
|
|
this.inProgress = false;
|
|
this.paused = false;
|
|
|
|
if (this.prevData && this.prevChangeType)
|
|
{
|
|
this.getResultByType(this.prevChangeType, this.prevData);
|
|
this.prevData = [];
|
|
this.prevChangeType = null;
|
|
CounterStore.reset();
|
|
}
|
|
|
|
let macroData = "";
|
|
try
|
|
{
|
|
let data = this.editor.macros.GetData();
|
|
if (data && "" !== data)
|
|
{
|
|
macroData = JSON.parse(this.editor.macros.GetData());
|
|
}
|
|
else
|
|
{
|
|
macroData = {
|
|
macrosArray : [],
|
|
current : -1
|
|
};
|
|
}
|
|
}
|
|
catch (e)
|
|
{
|
|
return;
|
|
}
|
|
|
|
let name = this.macroName ? this.macroName : this.getNewName(macroData.macrosArray);
|
|
let value = "(function()\n{\n" + this.result + "})();"
|
|
macroData.macrosArray.push({
|
|
guid : AscCommon.CreateUUID(true),
|
|
name : name,
|
|
autostart : false,
|
|
value : value
|
|
});
|
|
|
|
this.editor.asc_setMacros(JSON.stringify(macroData));
|
|
this.editor.sendEvent("asc_onMacroRecordingStop");
|
|
};
|
|
MacroRecorder.prototype.cancel = function()
|
|
{
|
|
if (!this.inProgress)
|
|
return;
|
|
|
|
this.inProgress = false;
|
|
this.paused = false;
|
|
this.editor.sendEvent("asc_onMacroRecordingStop");
|
|
};
|
|
MacroRecorder.prototype.pause = function()
|
|
{
|
|
if (!this.inProgress || this.paused)
|
|
return;
|
|
|
|
this.paused = true;
|
|
this.editor.sendEvent("asc_onMacroRecordingPause");
|
|
};
|
|
MacroRecorder.prototype.resume = function()
|
|
{
|
|
if (!this.inProgress || !this.paused)
|
|
return;
|
|
|
|
this.paused = false;
|
|
this.editor.sendEvent("asc_onMacroRecordingResume");
|
|
};
|
|
MacroRecorder.prototype.isInProgress = function()
|
|
{
|
|
return this.inProgress;
|
|
};
|
|
MacroRecorder.prototype.isPaused = function()
|
|
{
|
|
return this.paused;
|
|
};
|
|
MacroRecorder.prototype.addDefualtVaribalesForEditor = function()
|
|
{
|
|
if (this.editor.editorId === AscCommon.c_oEditorId.Word)
|
|
this.proceedDefualtVariablesForWord();
|
|
else if (this.editor.editorId === AscCommon.c_oEditorId.Spreadsheet)
|
|
this.proceedDefualtVariablesForSpreadsheet();
|
|
else if (this.editor.editorId === AscCommon.c_oEditorId.Presentation)
|
|
this.proceedDefualtVariablesForPresentation();
|
|
};
|
|
MacroRecorder.prototype.getMacrosListForEditor = function()
|
|
{
|
|
let actionsMacros = null;
|
|
|
|
if (this.editor.editorId === AscCommon.c_oEditorId.Word)
|
|
actionsMacros = WordActionsMacroList;
|
|
else if (this.editor.editorId === AscCommon.c_oEditorId.Spreadsheet)
|
|
actionsMacros = CellActionsMacroList;
|
|
else if (this.editor.editorId === AscCommon.c_oEditorId.Presentation)
|
|
actionsMacros = PresentationActionMacroList;
|
|
|
|
return actionsMacros;
|
|
}
|
|
MacroRecorder.prototype.onAction = function(type, additional)
|
|
{
|
|
if (!this.isInProgress() || this.isPaused())
|
|
return;
|
|
|
|
additional = this.proceedDataBefoeApply(additional);
|
|
|
|
if (this.prevChangeType === type)
|
|
{
|
|
this.prevData = this.joinDataForMacros(this.prevData, additional);
|
|
}
|
|
else if (type !== AscDFH.historydescription_Document_AutoCorrectMath)
|
|
{
|
|
this.getResultByType(this.prevChangeType, this.prevData);
|
|
this.prevChangeType = type;
|
|
this.prevData = additional;
|
|
}
|
|
|
|
if (this.isFirstAction)
|
|
{
|
|
this.addDefualtVaribalesForEditor();
|
|
this.isFirstAction = false;
|
|
}
|
|
};
|
|
MacroRecorder.prototype.getResultByType = function(type, additional)
|
|
{
|
|
let actionsMacros = this.getMacrosListForEditor();
|
|
let actionMacroFunction = actionsMacros[type];
|
|
if (actionMacroFunction)
|
|
this.result += actionMacroFunction(additional, type);
|
|
};
|
|
MacroRecorder.prototype.joinDataForMacros = function(prevData, currentData) {
|
|
function isPlainObject(v) {
|
|
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
}
|
|
function toArrayPreserveOrder(a, b) {
|
|
var arrA = Array.isArray(a) ? a : [a];
|
|
var arrB = Array.isArray(b) ? b : [b];
|
|
return arrA.concat(arrB);
|
|
}
|
|
function mergeByRules(a, b) {
|
|
if (typeof a === 'string' && typeof b === 'string') {
|
|
return a + b;
|
|
}
|
|
|
|
if (isPlainObject(a) && isPlainObject(b)) {
|
|
var out = {};
|
|
var k;
|
|
|
|
for (k in a) {
|
|
if (Object.prototype.hasOwnProperty.call(a, k)) {
|
|
out[k] = a[k];
|
|
}
|
|
}
|
|
|
|
for (k in b)
|
|
{
|
|
if (Object.prototype.hasOwnProperty.call(b, k))
|
|
{
|
|
if (Object.prototype.hasOwnProperty.call(a, k))
|
|
{
|
|
var av = a[k];
|
|
var bv = b[k];
|
|
if (typeof av === 'string' && typeof bv === 'string')
|
|
out[k] = av + bv;
|
|
else
|
|
out[k] = toArrayPreserveOrder(av, bv);
|
|
}
|
|
else
|
|
{
|
|
out[k] = b[k];
|
|
}
|
|
}
|
|
}
|
|
return out;
|
|
}
|
|
return toArrayPreserveOrder(a, b);
|
|
}
|
|
|
|
return mergeByRules(prevData, currentData);
|
|
};
|
|
MacroRecorder.prototype.proceedDataBefoeApply = function (data) {
|
|
if (!data || typeof data !== 'object')
|
|
return data;
|
|
|
|
if (this.editor.editorId === AscCommon.c_oEditorId.Presentation && Array.isArray(data) && data.length === 0)
|
|
return [[undefined]];
|
|
|
|
var out = {};
|
|
for (var key in data)
|
|
{
|
|
if (!Object.prototype.hasOwnProperty.call(data, key))
|
|
continue;
|
|
|
|
var val = data[key];
|
|
var isArr = Array.isArray
|
|
? Array.isArray(val)
|
|
: Object.prototype.toString.call(val) === '[object Array]';
|
|
|
|
if (isArr)
|
|
out[key] = val;
|
|
else
|
|
out[key] = [val];
|
|
}
|
|
return out;
|
|
};
|
|
MacroRecorder.prototype.getNewName = function(macros)
|
|
{
|
|
let maxId = 0;
|
|
for (let i = 0, count = macros.length; i < count; ++i)
|
|
{
|
|
if (0 !== macros[i].name.indexOf("Macro "))
|
|
continue;
|
|
|
|
let curId = parseInt(macros[i].name.substr(6));
|
|
if (isNaN(curId))
|
|
continue;
|
|
|
|
maxId = Math.max(curId, maxId);
|
|
}
|
|
|
|
return "Macro " + (maxId + 1);
|
|
};
|
|
MacroRecorder.prototype.proceedDefualtVariablesForWord = function()
|
|
{
|
|
this.result += "\tlet doc = Api.GetDocument();\n"
|
|
+ "";
|
|
};
|
|
MacroRecorder.prototype.proceedDefualtVariablesForSpreadsheet = function()
|
|
{
|
|
this.result += "\tlet worksheet = Api.GetActiveSheet();\n"
|
|
+ "";
|
|
};
|
|
MacroRecorder.prototype.proceedDefualtVariablesForPresentation = function()
|
|
{
|
|
this.result += "\tlet presentation = Api.GetPresentation();\n"
|
|
+ "";
|
|
};
|
|
|
|
function CounterStoreFn()
|
|
{
|
|
this.store = {};
|
|
this.get = function(name)
|
|
{
|
|
this.create(name);
|
|
return name + (this.store[name] === 0 ? "" : this.store[name]);
|
|
};
|
|
this.inc = function(name) {
|
|
if (this.create(name))
|
|
return this.get(name);
|
|
|
|
this.store[name] = this.store[name] + 1;
|
|
return this.get(name);
|
|
};
|
|
this.create = function(name)
|
|
{
|
|
if (!this.store.hasOwnProperty(name)) {
|
|
this.store[name] = 1;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
};
|
|
this.reset = function()
|
|
{
|
|
this.store = {};
|
|
};
|
|
}
|
|
let CounterStore = new CounterStoreFn();
|
|
|
|
function iterByDataFn(object, key, templateFn, type) {
|
|
if (!object && !Array.isArray(object[0]))
|
|
return "";
|
|
|
|
let out = "";
|
|
if (Array.isArray(object[0]))
|
|
{
|
|
for (let i = 0; i < object[0].length; i++) {
|
|
out += templateFn(object[0][i]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!object[key])
|
|
return "";
|
|
|
|
let arr = object[key];
|
|
for (let i = 0; i < arr.length; i++) {
|
|
out += templateFn(arr[i], type);
|
|
}
|
|
}
|
|
|
|
return out;
|
|
};
|
|
function makeAction(key, templateFn) {
|
|
return function(additional, type) {
|
|
return iterByDataFn(additional || {}, key, templateFn, type);
|
|
};
|
|
};
|
|
function connect(key, templateFn)
|
|
{
|
|
return function(additional){
|
|
if (!additional || !additional[key])
|
|
return "";
|
|
|
|
let text = "";
|
|
for (let i = 0; i < additional.codePoints.length; ++i)
|
|
{
|
|
text += String.fromCodePoint(additional.codePoints[i]);
|
|
}
|
|
|
|
return templateFn(text);
|
|
}
|
|
};
|
|
|
|
const wordActions = {
|
|
setTextBold : makeAction("isBold", function(bold){return "\tdoc.GetRangeBySelect().SetBold(" + bold + ");\n"}),
|
|
setTextItalic : makeAction("isItalic", function(italic){return "\tdoc.GetRangeBySelect().SetItalic(" + italic + ");\n"}),
|
|
setTextUnderline : makeAction("isUnderline", function(underline){return "\tdoc.GetRangeBySelect().SetUnderline(" + underline + ");\n"}),
|
|
setTextStrikeout : makeAction("isStrikeout", function(strikeout){return "\tdoc.GetRangeBySelect().SetStrikeout(" + strikeout + ");\n"}),
|
|
setTextFontName : makeAction("fontName", function(name){return "\tdoc.GetRangeBySelect().SetFontFamily(\"" + name + "\");\n"}),
|
|
setTextFontSize : makeAction("fontSize", function(size){return "\tdoc.GetRangeBySelect().SetFontSize(\"" + size + "\");\n"}),
|
|
setTextHighlightColor : makeAction('highlight', function(highlight){
|
|
let highlightColor = "";
|
|
if (highlight)
|
|
{
|
|
let color = new CDocumentColor(highlight.r, highlight.g, highlight.b);
|
|
highlightColor = color.ToHighlightColor();
|
|
}
|
|
|
|
if (highlightColor === "")
|
|
highlightColor = 'none';
|
|
|
|
return "\tdoc.GetRangeBySelect().SetHighlight(\"" + highlightColor + "\");\n";
|
|
}),
|
|
setTextHighlightNone : makeAction("", function(){return "\tdoc.GetRangeBySelect().SetHighlight(\"none\");\n"}),
|
|
setTextVertAlign : makeAction('baseline', function(baseline, type){
|
|
let align = "baseline";
|
|
if (baseline === true)
|
|
align = "baseline";
|
|
else if (AscDFH.historydescription_Document_SetTextVertAlignHotKey3 === type)
|
|
align = "subscript";
|
|
else if (AscDFH.historydescription_Document_SetTextVertAlignHotKey2 === type)
|
|
align = "superscript";
|
|
|
|
return "\tApi.GetDocument().GetRangeBySelect().SetVertAlign(\"" + align + "\");\n";
|
|
}),
|
|
setTextColor : makeAction('color', function(color){return "\tdoc.GetRangeBySelect().SetColor(" + color.r + "," + color.g + "," + color.b + ");\n"}),
|
|
setStyleHeading : makeAction('name', function(name){return "\tdoc.GetRangeBySelect().SetStyle(\"" + name + "\");\n"}),
|
|
clearFormat : makeAction("", function(){return "\tdoc.GetRangeBySelect().ClearFormating()\n"}),
|
|
cut : makeAction("", function(){return "\tdoc.GetRangeBySelect().Cut();\n"}),
|
|
changeTextCase : makeAction('changeType', function(changeType){return "\tdoc.GetRangeBySelect().SetTextCase(\"" + changeType + "\");\n"}),
|
|
incFontSize : makeAction("", function(){return "\tdoc.GetRangeBySelect().Grow();\n"}),
|
|
addLetter : connect('codePoints', function(text){return "\tdoc.GetCurrentParagraph().AddText(\"" + text + "\");\n"}),
|
|
setAlign : makeAction("align", function(align){
|
|
switch (align) {
|
|
case AscCommon.align_Left: align = 'left'; break;
|
|
case AscCommon.align_Right: align = 'right'; break;
|
|
case AscCommon.align_Justify: align = 'both'; break;
|
|
case AscCommon.align_Center: align = 'center'; break;
|
|
default: align = 'center';
|
|
}
|
|
return "\tdoc.GetCurrentParagraph().SetJc(\"" + align + "\");\n"
|
|
}),
|
|
setParagraphShd : makeAction("color", function(color){return "\tdoc.GetRangeBySelect().SetShd(\"clear\", "+ color.asc_getR() + " , " + color.asc_getG() +", "+ color.asc_getB() +", false);\n"}),
|
|
setLineSpacing : makeAction("lineSpacing", function(lineSpacing){
|
|
let type = lineSpacing.type;
|
|
let value = lineSpacing.value;
|
|
|
|
switch(type)
|
|
{
|
|
case Asc.linerule_Auto : type = "auto"; break;
|
|
case Asc.linerule_AtLeast : type = "atLeast"; break;
|
|
case Asc.linerule_Exact : type = "exact"; break;
|
|
default : type = "auto"; break;
|
|
}
|
|
|
|
return "\tdoc.GetRangeBySelect().GetAllParagraphs().forEach(para => para.SetSpacingLine(" + value + " * 240, \"" + type + "\"));\n"
|
|
}),
|
|
// incIndentetLineSpacing : makeAction("", function(){
|
|
// // for now we don't have relative increaee/decrease for api
|
|
// //"\tdoc.GetRangeBySelect().GetAllParagraphs().forEach(para => para.SetIndFirstLine());\n"
|
|
// //paragraph.SetIndFirstLine(1440);
|
|
// })
|
|
setParagraphNumbering : makeAction("numbering", function(num){
|
|
return "\tlet numbering = doc.CreateNumbering(\"" + num.Type + "\");\n"
|
|
+ "\tdoc.GetRangeBySelect().GetAllParagraphs().forEach(para => para.SetNumbering(numbering.GetLevel(0)));\n"
|
|
}),
|
|
addMath : makeAction("math", function(obj){
|
|
let type = 'unicode';
|
|
if (obj.type === 1)
|
|
type === "latex";
|
|
else if (obj.type === 2)
|
|
type === "mathml"
|
|
|
|
return "\tdoc.AddMathEquation(\"" + obj.math + "\", \"" + type + "\");\n";
|
|
})
|
|
};
|
|
|
|
const WordActionsMacroList = {};
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextBold] = wordActions.setTextBold;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextBoldHotKey] = wordActions.setTextBold;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextItalic] = wordActions.setTextItalic;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextItalicHotKey] = wordActions.setTextItalic;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextUnderline] = wordActions.setTextUnderline;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextUnderlineHotKey] = wordActions.setTextUnderline;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextStrikeout] = wordActions.setTextStrikeout;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextStrikeoutHotKey] = wordActions.setTextStrikeout;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextFontName] = wordActions.setTextFontName;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextFontSize] = wordActions.setTextFontSize;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextHighlightColor] = wordActions.setTextHighlightNone;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextHighlightNone] = wordActions.setTextHighlightColor;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextHighlight] = wordActions.setTextHighlightColor;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextVertAlignHotKey2] = wordActions.setTextVertAlign;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextVertAlignHotKey3] = wordActions.setTextVertAlign;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextVertAlignHotKey] = wordActions.setTextVertAlign;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetTextColor] = wordActions.setTextColor;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetStyleHeading] = wordActions.setStyleHeading;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetParagraphStyle] = wordActions.setStyleHeading;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_Shortcut_ClearFormatting] = wordActions.clearFormat;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_ClearFormatting] = wordActions.clearFormat;
|
|
WordActionsMacroList[AscDFH.historydescription_Cut] = wordActions.cut;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_ChangeTextCase] = wordActions.changeTextCase;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_AddLetter] = wordActions.addLetter;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetParagraphAlign] = wordActions.setAlign;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetParagraphAlignHotKey] = wordActions.setAlign;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetParagraphShd] = wordActions.setParagraphShd;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetParagraphLineSpacing] = wordActions.setLineSpacing;
|
|
//WordActionsMacroList[AscDFH.historydescription_Document_IncParagraphIndent] = wordActions.incIndentetLineSpacing;
|
|
//WordActionsMacroList[AscDFH.historydescription_Document_DecParagraphIndent] = wordActions.decIndentetLineSpacing;
|
|
//WordActionsMacroList[AscDFH.historydescription_Document_IncFontSize] = wordActions.incFontSize;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetParagraphNumbering] = wordActions.setParagraphNumbering;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_SetParagraphNumberingHotKey]= wordActions.setParagraphNumbering;
|
|
WordActionsMacroList[AscDFH.historydescription_Document_AddMathHotKey] = wordActions.addMath;
|
|
//WordActionsMacroList[AscDFH.historydescription_Document_AddPageNumHotKey] = wordActions.addPageNum;
|
|
|
|
// WordActionsMacroList[AscDFH.historydescription_Document_FormatPasteHotKey] = wordActions;
|
|
// WordActionsMacroList[AscDFH.historydescription_Document_PasteHotKey] = wordActions;
|
|
// WordActionsMacroList[AscDFH.historydescription_Document_PasteSafariHotKey] = wordActions;
|
|
// WordActionsMacroList[AscDFH.historydescription_Document_CutHotKey] = wordActions;
|
|
|
|
const cellActions = {
|
|
setCellIncreaseFontSize : makeAction("", function(){return "\tApi.GetSelection().FontIncrease();\n"}),
|
|
setCellDecreaseFontSize : makeAction("", function(){return "\tApi.GetSelection().FontDecrease();\n"}),
|
|
setCellFontSize : makeAction("val", function(fontSize){return "\tApi.GetSelection().SetFontSize(\"" + fontSize + "\");\n"}),
|
|
setCellFontName : makeAction("val", function(fontName){return "\tApi.GetSelection().SetFontName(\"" + fontName + "\");\n"}),
|
|
setCellBold : makeAction("val", function(bold){return "\tApi.GetSelection().SetBold(" + bold + ");\n"}),
|
|
setCellItalic : makeAction("val", function(italic){return "\tApi.GetSelection().SetItalic(" + italic + ");\n"}),
|
|
setCellUnderline : makeAction("val", function(underline){
|
|
let underlineType = null;
|
|
|
|
switch (underline) {
|
|
case Asc.EUnderline.underlineSingle: underlineType = 'single'; break;
|
|
case Asc.EUnderline.underlineSingleAccounting: underlineType = 'singleAccounting'; break;
|
|
case Asc.EUnderline.underlineDouble: underlineType = 'double'; break;
|
|
case Asc.EUnderline.underlineDoubleAccounting: underlineType = 'doubleAccounting'; break;
|
|
case Asc.EUnderline.underlineNone:
|
|
default: underlineType = 'none'; break;
|
|
}
|
|
|
|
return "\tApi.GetSelection().SetUnderline(\"" + underlineType + "\");\n"
|
|
}),
|
|
setCellStrikeout : makeAction("val", function(strikeout){return "\tApi.GetSelection().SetStrikeout(" + (!!strikeout) + ");\n"}),
|
|
setCellSubscript : makeAction("val", function(subscript){return "\tApi.GetSelection().GetCharacters().GetFont().SetSubscript(" + subscript + ");\n"}),
|
|
setCellSuperscript : makeAction("val", function(supscript){return "\tApi.GetSelection().GetCharacters().GetFont().SetSuperscript(" + supscript + ");\n"}),
|
|
setCellReadingOrder : makeAction("val", function(dir){
|
|
let direction = null;
|
|
switch (dir) {
|
|
case 0: direction = 'context'; break;
|
|
case 1: direction = 'ltr'; break;
|
|
case 2: direction = 'rtl'; break;
|
|
default: return "";
|
|
}
|
|
return "\tApi.GetSelection().SetReadingOrder(\"" + direction + "\");\n"
|
|
}),
|
|
setCellAlign : makeAction("val", function(al){
|
|
let align = null;
|
|
switch (al) {
|
|
case AscCommon.align_Left: align = 'left'; break;
|
|
case AscCommon.align_Right: align = 'right'; break;
|
|
case AscCommon.align_Justify: align = 'both'; break;
|
|
case AscCommon.align_Center: align = 'center'; break;
|
|
default: align = 'center';
|
|
}
|
|
return "\tApi.GetSelection().SetAlignHorizontal(\"" + align + "\");\n"
|
|
}),
|
|
setCellVerticalAlign : makeAction("val", function(al){
|
|
let align = null;
|
|
switch (al) {
|
|
case Asc.c_oAscVAlign.Center: align = 'center'; break;
|
|
case Asc.c_oAscVAlign.Bottom: align = 'bottom'; break;
|
|
case Asc.c_oAscVAlign.Top: align = 'top'; break;
|
|
case Asc.c_oAscVAlign.Dist: align = 'distributed'; break;
|
|
case Asc.c_oAscVAlign.Just: align = 'justify'; break;
|
|
default: align = 'center';
|
|
}
|
|
return "\tApi.GetSelection().SetAlignVertical(\"" + align + "\");\n"
|
|
}),
|
|
setCellTextColor : makeAction("val", function(clr){
|
|
let color = "Api.CreateColorFromRGB(" + clr.getR() + ", " + clr.getG() + ", " + clr.getB() + ")";
|
|
return "\tApi.GetSelection().SetFontColor(" + color + ");\n"
|
|
}),
|
|
setCellBackgroundColor : makeAction("val", function(clr){
|
|
let color = "Api.CreateColorFromRGB(" + clr.getR() + ", " + clr.getG() + ", " + clr.getB() + ")";
|
|
return "\tApi.GetSelection().SetBackgroundColor(" + color + ");\n"
|
|
}),
|
|
setCellWrap : makeAction("val", function(wrap){return "\tApi.GetSelection().SetWrap(" + wrap + ");\n"}),
|
|
//setCellShrinkToFit : function(additional){ return (additional && additional.val !== undefined) ? "Api.GetSelection().SetShrinkToFit(" + additional.val + ");\n" : "";},
|
|
setCellValue : makeAction("val", function(value){
|
|
if (typeof value === 'string')
|
|
value = '"' + value.replace(/"/g, '\\"') + '"';
|
|
else
|
|
value = value.toString();
|
|
|
|
return "\tApi.GetSelection().SetValue(" + value + ");\n"
|
|
}),
|
|
setCellAngle : makeAction("val", function(angle){
|
|
switch (angle) {
|
|
case -90: return "\tApi.GetSelection().SetOrientation('xlDownward');\n";
|
|
case 0: return "\tApi.GetSelection().SetOrientation('xlHorizontal');\n";
|
|
case 90: return "\tApi.GetSelection().SetOrientation('xlUpward');\n";
|
|
case 255: return "\tApi.GetSelection().SetOrientation('xlVertical');\n";
|
|
}
|
|
}),
|
|
setCellChangeTextCase : makeAction("val", function(textCase){return "\tApi.GetSelection().ChangeTextCase(" + textCase + ");\n"}),
|
|
setCellChangeFontSize : makeAction("val", function(isInc){
|
|
// todo create api
|
|
return isInc ? "\tApi.asc_increaseFontSize();\n" : "\tApi.asc_decreaseFontSize();\n";
|
|
}),
|
|
setCellBorder : makeAction("val", function(borderArray){
|
|
if (!Array.isArray(borderArray) || borderArray.length === 0) {
|
|
return "";
|
|
}
|
|
|
|
let result = "";
|
|
|
|
for (let i = 0; i < borderArray.length; i++) {
|
|
let border = borderArray[i];
|
|
if (border && border.style !== undefined) {
|
|
|
|
let positionStr = null;
|
|
switch (i) {
|
|
case 0: positionStr = 'Top'; break;
|
|
case 1: positionStr = 'Right'; break;
|
|
case 2: positionStr = 'Bottom'; break;
|
|
case 3: positionStr = 'Left'; break;
|
|
case 4: positionStr = 'DiagonalDown'; break;
|
|
case 5: positionStr = 'DiagonalUp'; break;
|
|
case 6: positionStr = 'InsideVertical'; break;
|
|
case 7: positionStr = 'InsideHorizontal'; break;
|
|
default: continue;
|
|
}
|
|
|
|
let styleStr = null;
|
|
switch (border.style) {
|
|
case window['Asc'].c_oAscBorderStyles.None: styleStr = 'None'; break;
|
|
case window['Asc'].c_oAscBorderStyles.Double: styleStr = 'Double'; break;
|
|
case window['Asc'].c_oAscBorderStyles.Hair: styleStr = 'Hair'; break;
|
|
case window['Asc'].c_oAscBorderStyles.DashDotDot: styleStr = 'DashDotDot'; break;
|
|
case window['Asc'].c_oAscBorderStyles.DashDot: styleStr = 'DashDot'; break;
|
|
case window['Asc'].c_oAscBorderStyles.Dotted: styleStr = 'Dotted'; break;
|
|
case window['Asc'].c_oAscBorderStyles.Dashed: styleStr = 'Dashed'; break;
|
|
case window['Asc'].c_oAscBorderStyles.Thin: styleStr = 'Thin'; break;
|
|
case window['Asc'].c_oAscBorderStyles.MediumDashDotDot: styleStr = 'MediumDashDotDot'; break;
|
|
case window['Asc'].c_oAscBorderStyles.SlantDashDot: styleStr = 'SlantDashDot'; break;
|
|
case window['Asc'].c_oAscBorderStyles.MediumDashDot: styleStr = 'MediumDashDot'; break;
|
|
case window['Asc'].c_oAscBorderStyles.MediumDashed: styleStr = 'MediumDashed'; break;
|
|
case window['Asc'].c_oAscBorderStyles.Medium: styleStr = 'Medium'; break;
|
|
case window['Asc'].c_oAscBorderStyles.Thick: styleStr = 'Thick'; break;
|
|
default: continue;
|
|
}
|
|
|
|
let colorStr = "Api.CreateColorFromRGB(0, 0, 0)";
|
|
if (border.color) {
|
|
if (typeof border.color === 'string') {
|
|
let hex = border.color.replace('#', '');
|
|
if (hex.length === 3) {
|
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
}
|
|
let r = parseInt(hex.substr(0, 2), 16) || 0;
|
|
let g = parseInt(hex.substr(2, 2), 16) || 0;
|
|
let b = parseInt(hex.substr(4, 2), 16) || 0;
|
|
colorStr = "Api.CreateColorFromRGB(" + r + ", " + g + ", " + b + ")";
|
|
} else if (typeof border.color === 'object') {
|
|
colorStr = "Api.CreateColorFromRGB(" + (border.color.r || 0) + ", " + (border.color.g || 0) + ", " + (border.color.b || 0) + ")";
|
|
}
|
|
}
|
|
|
|
result += "\tApi.GetSelection().SetBorders(\"" + positionStr + "\", \"" + styleStr + "\", " + colorStr + ");\n";
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}),
|
|
// setCellHyperlinkAdd : function(additional) {return (additional && additional.url) ? "" : ""},
|
|
// setCellHyperlinkModify : function(additional) {return (additional && additional.url) ? "" : ""},
|
|
// setCellHyperlinkRemove : function(additional) {return (additional && additional.url) ? "" : ""},
|
|
// cut : function(){return "ApiApi.GetSelection().Cut();\n"},
|
|
cellChangeValue : makeAction("val", function(value){return "\tApi.GetSelection().SetValue(\"" + value + "\");\n"})
|
|
};
|
|
const CellActionsMacroList = {};
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellIncreaseFontSize] = cellActions.setCellIncreaseFontSize,
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellDecreaseFontSize] = cellActions.setCellDecreaseFontSize,
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellFontSize] = cellActions.setCellFontSize;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellFontName] = cellActions.setCellFontName;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellBold] = cellActions.setCellBold;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellItalic] = cellActions.setCellItalic;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellUnderline] = cellActions.setCellUnderline;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellStrikeout] = cellActions.setCellStrikeout;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellSubscript] = cellActions.setCellSubscript;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellSuperscript] = cellActions.setCellSuperscript;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellReadingOrder] = cellActions.setCellReadingOrder;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellAlign] = cellActions.setCellAlign;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellVertAlign] = cellActions.setCellVerticalAlign;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellTextColor] = cellActions.setCellTextColor;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellBackgroundColor] = cellActions.setCellBackgroundColor;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellWrap] = cellActions.setCellWrap;
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellShrinkToFit] = cellActions.setCellShrinkToFit;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellBorder] = cellActions.setCellBorder;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellValue] = cellActions.setCellValue;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellAngle] = cellActions.setCellAngle;
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellMerge] = cellActions.setCellMerge;
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellStyle] = cellActions.setCellStyle;
|
|
CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellChangeTextCase] = cellActions.setCellChangeTextCase;
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellChangeFontSize] = cellActions.setCellChangeFontSize;
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellHyperlinkAdd] = cellActions.setCellHyperlinkAdd;
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellHyperlinkModify] = cellActions.setCellHyperlinkModify;
|
|
//CellActionsMacroList[AscDFH.historydescription_Spreadsheet_SetCellHyperlinkRemove] = cellActions.setCellHyperlinkRemove;
|
|
//CellActionsMacroList[AscDFH.historydescription_Cut] = cellActions.cut;
|
|
|
|
|
|
const presActions = {
|
|
setParagraphAlign : makeAction("", function(align){
|
|
switch (align) {
|
|
case AscCommon.align_Left: align = 'left'; break;
|
|
case AscCommon.align_Right: align = 'right'; break;
|
|
case AscCommon.align_Justify: align = 'justify'; break;
|
|
case AscCommon.align_Center: align = 'center'; break;
|
|
default: align = 'center';
|
|
}
|
|
return "\tApi.GetSelection().GetShapes()[0].GetDocContent().GetElement(0).SetJc(\"" + align + "\");\n";
|
|
}),
|
|
paragraphAdd : function(additional){
|
|
if (!additional || !additional[0].length)
|
|
return "";
|
|
|
|
let text = "";
|
|
for (let nChar = 0; nChar < additional[0].length; nChar++)
|
|
text += String.fromCodePoint(additional[0][nChar]);
|
|
|
|
let result = "\tApi.GetSelection().GetShapes()[0].GetDocContent().GetElement(0).AddText(\"" + text + "\");\n";
|
|
return result;
|
|
},
|
|
putTextPrBold : makeAction("", function(bold){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetBold(" + bold + "));\n\t})\n"}),
|
|
putTextPrItalic : makeAction("", function(italic){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetItalic(" + italic + "));\n\t})\n"}),
|
|
putTextPrUnderline : makeAction("", function(underline){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetUnderline(" + underline + "));\n\t})\n"}),
|
|
putTextPrStrikeout : makeAction("", function(strikeout){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetStrikeout(" + strikeout + "));\n\t})\n"}),
|
|
putTextPrFontName : makeAction("", function(fontName){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetFontName(" + fontName + "));\n\t})\n"}),
|
|
putTextPrFontSize : makeAction("", function(fontsize){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetFontSize(" + fontsize + "));\n\t})\n"}),
|
|
//putTextPrIncreaseFontSize : makeAction("", function(){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetFontSize(" + fontsize + "));\n\t})\n"}),
|
|
//incDecFontSize : makeAction("", function(){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetFontSize(" + fontsize + "));\n\t})\n"}),
|
|
setTextVertAlign : makeAction("", function(vertalign){
|
|
let textOfVertAlign = "baseline";
|
|
|
|
if (AscCommon.vertalign_Baseline === vertalign)
|
|
textOfVertAlign = "baseline";
|
|
else if (AscCommon.vertalign_SubScript === vertalign)
|
|
textOfVertAlign = "subscript";
|
|
else if (AscCommon.vertalign_SuperScript === vertalign)
|
|
textOfVertAlign = "superscript";
|
|
|
|
return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetVertAlign(\"" + textOfVertAlign + "\"));\n\t})\n"
|
|
}),
|
|
addNextSlide : makeAction("", function(data){
|
|
if (data === undefined)
|
|
{
|
|
return "\tpresentation.AddSlide(Api.CreateSlide());\n"
|
|
}
|
|
else
|
|
{
|
|
return "\tlet " + CounterStore.inc('slide') +" = Api.CreateSlide();\n"
|
|
+ "\tlet " + CounterStore.inc('master') +" = presentation.GetMaster(0);\n"
|
|
+ "\tlet " + CounterStore.inc('layout') +" = " + CounterStore.get('master') + ".GetLayout(" + data + ");\n"
|
|
+ "\t" + CounterStore.get('slide') + ".ApplyLayout(" + CounterStore.get('layout') + ");\n"
|
|
+ "\tpresentation.AddSlide(" + CounterStore.get('slide') + ");\n";
|
|
}
|
|
}),
|
|
deleteSlides : makeAction("", function(index){
|
|
return "\tlet " + CounterStore.inc('slide') +" = presentation.GetSlideByIndex(" + index + ");\n"
|
|
+ "\tif (" + CounterStore.get('slide') + ") " + CounterStore.get('slide') + ".Delete();\n";
|
|
}),
|
|
changeLayout : makeAction("", function(changeObj) {
|
|
return "\t[" + changeObj.slides.toString() + "].forEach(index => {\n"
|
|
+ "\t\tlet " + CounterStore.inc('slide') +" = presentation.GetSlideByIndex(index);\n"
|
|
+ "\t\tlet " + CounterStore.inc('master') +" = presentation.GetMaster(0);\n"
|
|
+ "\t\tlet " + CounterStore.inc('layout') +" = " + CounterStore.get('master') + ".GetLayout(" + changeObj.layout + ");\n"
|
|
+ "\t\tif (" + CounterStore.get('slide') + ") " + CounterStore.get('slide') + ".ApplyLayout(" + CounterStore.get('layout') + ");\n"
|
|
+ "\t});\n";
|
|
}),
|
|
//showfrom : makeAction("", function(){}),
|
|
setTextHighlight : makeAction("", function(highlight){
|
|
let highlightColor = "";
|
|
if (highlight)
|
|
{
|
|
let color = new CDocumentColor(highlight.r, highlight.g, highlight.b);
|
|
highlightColor = color.ToHighlightColor();
|
|
}
|
|
|
|
if (highlightColor === "") highlightColor = 'none';
|
|
return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetHighlight(\"" + highlightColor + "\"));\n\t})\n"
|
|
}),
|
|
putTextColor : makeAction("", function(color){
|
|
return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetColor(" + color.r + ", " + color.g + ", " + color.b + "));\n\t})\n"
|
|
}),
|
|
clearFormatting : makeAction("", function(isClear){return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.ClearFormating(" + isClear + "));\n\t})\n";}),
|
|
putTextPrLineSpacing : makeAction("", function(lineSpacing){
|
|
|
|
let type = lineSpacing.type;
|
|
let value = lineSpacing.value;
|
|
|
|
switch(type)
|
|
{
|
|
case Asc.linerule_Auto : type = "auto"; break;
|
|
case Asc.linerule_AtLeast : type = "atLeast"; break;
|
|
case Asc.linerule_Exact : type = "exact"; break;
|
|
default : type = "auto"; break;
|
|
}
|
|
return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.SetSpacingLine(" + value + " * 240, \"" + type + "\"));\n\t})\n"
|
|
}),
|
|
addNewShape : makeAction("", function(shapeProps){
|
|
// fix height for text box
|
|
let fill = shapeProps.fill.getRGBAColor();
|
|
let border = shapeProps.border;
|
|
let borderwidth = border.w / 36000;
|
|
let borderColor = border.Fill.getRGBAColor();
|
|
return "\t(function () {\n"
|
|
+ "\t\tlet slide = presentation.GetCurrentSlide();\n"
|
|
+ "\t\tif (slide) {\n"+
|
|
"\t\t\tlet fill = Api.CreateSolidFill(Api.CreateRGBColor("+ fill.R +", " + fill.G + ", " + fill.B + "));\n" +
|
|
"\t\t\tlet stroke = Api.CreateStroke(" + borderwidth +"* 36000, Api.CreateSolidFill(Api.CreateRGBColor("+ borderColor.R +", " + borderColor.G + ", " + borderColor.B + ")));\n" +
|
|
"\t\t\tlet shape = Api.CreateShape(\"" + shapeProps.type + "\", " + shapeProps.extX + " * 36000, " + shapeProps.extY + " * 36000, fill, stroke);\n" +
|
|
"\t\t\tshape.SetPosition(" + shapeProps.pos.x + " * 36000.0, " + shapeProps.pos.y + " * 36000.0)\n" +
|
|
"\t\t\tslide.AddObject(shape)\n" +
|
|
"\t\t}\n" +
|
|
"\t}());\n";
|
|
}),
|
|
paragraphRemove : makeAction("", function(args){
|
|
return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.GetDocContent().GetContent().forEach(para => para.RemoveAllElements());\n\t})\n"
|
|
}),
|
|
setVerticalAlign : makeAction("", function(align){
|
|
let typeOfVertAlign = "";
|
|
switch(align.verticalTextAlign)
|
|
{
|
|
case 4:
|
|
{
|
|
typeOfVertAlign = "top";
|
|
break;
|
|
}
|
|
case 1:
|
|
{
|
|
typeOfVertAlign = "center";
|
|
break;
|
|
}
|
|
case 0:
|
|
{
|
|
typeOfVertAlign = "bottom";
|
|
break;
|
|
}
|
|
}
|
|
|
|
return "\tApi.GetSelection().GetShapes().forEach(shape => {\n\t\tshape.SetVerticalTextAlign(\"" + typeOfVertAlign + "\");\n\t})\n";
|
|
}),
|
|
bringForward : makeAction("", function(){
|
|
// no api
|
|
}),
|
|
bringToFront : makeAction("", function(){
|
|
// no api
|
|
}),
|
|
bringBackward : makeAction("", function(){
|
|
// no api
|
|
}),
|
|
sendToBack : makeAction("", function(){
|
|
// no api
|
|
}),
|
|
createGroup : makeAction("", function(){
|
|
return "\tpresentation.GetCurrentSlide().GroupDrawings(Api.GetSelection().GetShapes());\n";
|
|
}),
|
|
unGroup : makeAction("", function(){
|
|
return "\tApi.GetSelection().GetShapes().forEach(shape => {shape.Ungroup()});\n"
|
|
})
|
|
|
|
};
|
|
const PresentationActionMacroList = {};
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_ParagraphAdd] = presActions.paragraphAdd;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextPrBold] = presActions.putTextPrBold;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetTextBoldHotKey] = presActions.putTextPrBold;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextPrItalic] = presActions.putTextPrItalic;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetTextItalicHotKey] = presActions.putTextPrItalic;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextPrUnderline] = presActions.putTextPrUnderline;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetTextUnderlineHotKey] = presActions.putTextPrUnderline;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextPrStrikeout] = presActions.putTextPrStrikeout;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetTextStrikeoutHotKey] = presActions.putTextPrStrikeout;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetTextVertAlign] = presActions.setTextVertAlign;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetTextVertAlignHotKey3] = presActions.setTextVertAlign;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetTextVertAlignHotKey2] = presActions.setTextVertAlign;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetTextHighlight] = presActions.setTextHighlight;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextColor] = presActions.putTextColor;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_ParagraphClearFormatting] = presActions.clearFormatting;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextPrFontName] = presActions.putTextPrFontName;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextPrFontSize] = presActions.putTextPrFontSize;
|
|
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_SetParagraphAlign] = presActions.setParagraphAlign;
|
|
PresentationActionMacroList[AscDFH.historydescription_Document_SetParagraphAlignHotKey] = presActions.setParagraphAlign;
|
|
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_AddNextSlide] = presActions.addNextSlide;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_DeleteSlides] = presActions.deleteSlides;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_ChangeLayout] = presActions.changeLayout;
|
|
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_SetVerticalAlign] = presActions.setVerticalAlign;
|
|
|
|
// PresentationActionMacroList[AscDFH.historydescription_Presentation_BringForward] = presActions.bringForward;
|
|
// PresentationActionMacroList[AscDFH.historydescription_Presentation_BringToFront] = presActions.bringToFront;
|
|
// PresentationActionMacroList[AscDFH.historydescription_Presentation_BringBackward] = presActions.bringBackward;
|
|
// PresentationActionMacroList[AscDFH.historydescription_Presentation_SendToBack] = presActions.sendToBack;
|
|
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_CreateGroup] = presActions.createGroup;
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_UnGroup] = presActions.unGroup;
|
|
|
|
//PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextPrIncreaseFontSize] = presActions.putTextPrIncreaseFontSize;
|
|
//PresentationActionMacroList[AscDFH.historydescription_Presentation_ParagraphIncDecFontSize] = presActions.incDecFontSize;
|
|
//PresentationActionMacroList[AscDFH.historydescription_Presentation_SetParagraphNumbering] = presActions.setNumbering;
|
|
|
|
// alignTo no api
|
|
// merge shapes no api
|
|
|
|
PresentationActionMacroList[AscDFH.historydescription_Presentation_PutTextPrLineSpacing] = presActions.putTextPrLineSpacing;
|
|
PresentationActionMacroList[AscDFH.historydescription_CommonStatesAddNewShape] = presActions.addNewShape;
|
|
PresentationActionMacroList[AscDFH.historydescription_Spreadsheet_Remove] = presActions.paragraphRemove;
|
|
// show from start/n-slide ... when add api
|
|
|
|
//--------------------------------------------------------export----------------------------------------------------
|
|
AscCommon.MacroRecorder = MacroRecorder;
|
|
|
|
MacroRecorder.prototype["start"] = MacroRecorder.prototype.start;
|
|
MacroRecorder.prototype["stop"] = MacroRecorder.prototype.stop;
|
|
MacroRecorder.prototype["cancel"] = MacroRecorder.prototype.cancel;
|
|
MacroRecorder.prototype["pause"] = MacroRecorder.prototype.pause;
|
|
MacroRecorder.prototype["resume"] = MacroRecorder.prototype.resume;
|
|
MacroRecorder.prototype["isInProgress"] = MacroRecorder.prototype.isInProgress;
|
|
MacroRecorder.prototype["isPaused"] = MacroRecorder.prototype.isPaused;
|
|
|
|
})(window);
|