Commit a893d380 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add recalculate workbook after the plugin

parent 02c70890
...@@ -3215,6 +3215,16 @@ var editor; ...@@ -3215,6 +3215,16 @@ var editor;
return _ret.data; return _ret.data;
}; };
spreadsheet_api.prototype.asc_canPaste = function () {
History.Create_NewPoint();
History.StartTransaction();
return true;
};
spreadsheet_api.prototype.asc_Recalculate = function () {
History.EndTransaction();
this._onUpdateAfterApplyChanges();
};
spreadsheet_api.prototype._onEndLoadSdk = function() { spreadsheet_api.prototype._onEndLoadSdk = function() {
History = AscCommon.History; History = AscCommon.History;
...@@ -3511,6 +3521,4 @@ var editor; ...@@ -3511,6 +3521,4 @@ var editor;
prot["asc_pluginButtonClick"] = prot.asc_pluginButtonClick; prot["asc_pluginButtonClick"] = prot.asc_pluginButtonClick;
prot["asc_addOleObject"] = prot.asc_addOleObject; prot["asc_addOleObject"] = prot.asc_addOleObject;
prot["asc_editOleObject"] = prot.asc_editOleObject; prot["asc_editOleObject"] = prot.asc_editOleObject;
prot["asc_Recalculate"] = prot.asc_Recalculate;
prot["asc_canPaste"] = prot.asc_canPaste;
})(window); })(window);
...@@ -348,48 +348,48 @@ ...@@ -348,48 +348,48 @@
window.g_asc_plugins.closeAttackTimer = -1; window.g_asc_plugins.closeAttackTimer = -1;
} }
if (value && value != "") if (value && value != "") {
{ try {
try if (window.g_asc_plugins.api.asc_canPaste()) {
{ var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + value + "})();";
if (window.g_asc_plugins.api.asc_canPaste()) eval(_script);
{
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + value + "})();"; if (pluginData.getAttribute("recalculate") == true) {
eval(_script); var editorId = window.g_asc_plugins.api.getEditorId();
if (AscCommon.c_oEditorId.Word === editorId) {
var oLogicDocument = window.g_asc_plugins.api.WordControl ? window.g_asc_plugins.api.WordControl.m_oLogicDocument : null; var oLogicDocument = window.g_asc_plugins.api.WordControl ?
if (pluginData.getAttribute("recalculate") == true) window.g_asc_plugins.api.WordControl.m_oLogicDocument : null;
{ var _fonts = oLogicDocument.Document_Get_AllFontNames();
var _fonts = oLogicDocument.Document_Get_AllFontNames(); var _imagesArray = oLogicDocument.Get_AllImageUrls();
var _imagesArray = oLogicDocument.Get_AllImageUrls(); var _images = {};
var _images = {}; for (var i = 0; i < _imagesArray.length; i++) {
for (var i = 0; i < _imagesArray.length; i++) _images[_imagesArray[i]] = _imagesArray[i];
{
_images[_imagesArray[i]] = _imagesArray[i];
}
window.g_asc_plugins.images_rename = _images;
AscCommon.Check_LoadingDataBeforePrepaste(window.g_asc_plugins.api, _fonts, _images, function()
{
if (window.g_asc_plugins.api.WordControl &&
window.g_asc_plugins.api.WordControl.m_oLogicDocument &&
window.g_asc_plugins.api.WordControl.m_oLogicDocument.Reassign_ImageUrls)
{
window.g_asc_plugins.api.WordControl.m_oLogicDocument.Reassign_ImageUrls(window.g_asc_plugins.images_rename);
} }
delete window.g_asc_plugins.images_rename;
window.g_asc_plugins.api.asc_Recalculate(); window.g_asc_plugins.images_rename = _images;
}); AscCommon.Check_LoadingDataBeforePrepaste(window.g_asc_plugins.api, _fonts, _images,
} function () {
} if (window.g_asc_plugins.api.WordControl &&
} window.g_asc_plugins.api.WordControl.m_oLogicDocument &&
catch (err) window.g_asc_plugins.api.WordControl.m_oLogicDocument.Reassign_ImageUrls) {
{ window.g_asc_plugins.api.WordControl.m_oLogicDocument.Reassign_ImageUrls(
window.g_asc_plugins.images_rename);
}
delete window.g_asc_plugins.images_rename;
window.g_asc_plugins.api.asc_Recalculate();
});
} else if (AscCommon.c_oEditorId.Spreadsheet === editorId) {
window.g_asc_plugins.api.asc_Recalculate();
}
}
}
} catch (err) {
} }
} }
if ("close" == name) if ("close" == name) {
window.g_asc_plugins.close(); window.g_asc_plugins.close();
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment