mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
Remove native scripts
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,169 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
window.IS_NATIVE_EDITOR = true;
|
||||
|
||||
window.NativeSupportTimeouts = true;
|
||||
window.NativeTimeoutObject = {};
|
||||
|
||||
var clearTimeout = function(id) {
|
||||
if (!window.NativeSupportTimeouts)
|
||||
return;
|
||||
|
||||
window.NativeTimeoutObject["" + id] = undefined;
|
||||
window["native"]["ClearTimeout"](id);
|
||||
}
|
||||
|
||||
var setTimeout = function(func, interval) {
|
||||
if (!window.NativeSupportTimeouts)
|
||||
return;
|
||||
|
||||
var id = window["native"]["GenerateTimeoutId"](interval);
|
||||
window.NativeTimeoutObject["" + id] = {"func": func, repeat: false};
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
var clearInterval = function(id) {
|
||||
if (!window.NativeSupportTimeouts)
|
||||
return;
|
||||
|
||||
|
||||
window.NativeTimeoutObject["" + id] = undefined;
|
||||
window["native"]["ClearTimeout"](id);
|
||||
}
|
||||
|
||||
var setInterval = function(func, interval) {
|
||||
if (!window.NativeSupportTimeouts)
|
||||
return;
|
||||
|
||||
var id = window["native"]["GenerateTimeoutId"](interval);
|
||||
window.NativeTimeoutObject["" + id] = {func: func, repeat: true, interval: interval};
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
window.native.Call_TimeoutFire = function(id) {
|
||||
if (!window.NativeSupportTimeouts)
|
||||
return;
|
||||
|
||||
var prop = "" + id;
|
||||
|
||||
if (undefined === window.NativeTimeoutObject[prop]) {
|
||||
return;
|
||||
}
|
||||
|
||||
var func = window.NativeTimeoutObject[prop].func;
|
||||
var repeat = window.NativeTimeoutObject[prop].repeat;
|
||||
var interval = window.NativeTimeoutObject[prop].interval;
|
||||
|
||||
window.NativeTimeoutObject[prop] = undefined;
|
||||
|
||||
if (!func)
|
||||
return;
|
||||
|
||||
func.call(null);
|
||||
|
||||
if (repeat) {
|
||||
setInterval(func, interval);
|
||||
}
|
||||
|
||||
func = null;
|
||||
};
|
||||
|
||||
function offline_timeoutFire(id) {
|
||||
return window.native.Call_TimeoutFire(id);
|
||||
}
|
||||
|
||||
var console = {
|
||||
log : function(param) { window["native"]["ConsoleLog"](param); },
|
||||
time : function (param) {},
|
||||
timeEnd : function (param) {}
|
||||
};
|
||||
|
||||
window["NativeCorrectImageUrlOnPaste"] = function (url)
|
||||
{
|
||||
return window["native"]["CorrectImageUrlOnPaste"](url);
|
||||
};
|
||||
window["NativeCorrectImageUrlOnCopy"] = function (url)
|
||||
{
|
||||
return window["native"]["CorrectImageUrlOnCopy"](url);
|
||||
};
|
||||
|
||||
window.NativeCalculateFile = function()
|
||||
{
|
||||
Asc.editor.asc_nativeCalculateFile();
|
||||
}
|
||||
|
||||
window.native.Call_OnUpdateOverlay = function(param)
|
||||
{
|
||||
return window["API"].Call_OnUpdateOverlay(param);
|
||||
};
|
||||
|
||||
window.native.Call_OnMouseDown = function(e)
|
||||
{
|
||||
return window["API"].Call_OnMouseDown(e);
|
||||
};
|
||||
window.native.Call_OnMouseUp = function(e)
|
||||
{
|
||||
return window["API"].Call_OnMouseUp(e);
|
||||
};
|
||||
window.native.Call_OnMouseMove = function(e)
|
||||
{
|
||||
return window["API"].Call_OnMouseMove(e);
|
||||
};
|
||||
window.native.Call_OnCheckMouseDown = function(e)
|
||||
{
|
||||
return window["API"].Call_OnCheckMouseDown(e);
|
||||
};
|
||||
|
||||
window.native.Call_OnKeyDown = function(e)
|
||||
{
|
||||
return window["API"].Call_OnKeyDown(e);
|
||||
};
|
||||
window.native.Call_OnKeyPress = function(e)
|
||||
{
|
||||
return window["API"].Call_OnKeyPress(e);
|
||||
};
|
||||
window.native.Call_OnKeyUp = function(e)
|
||||
{
|
||||
return window["API"].Call_OnKeyUp(e);
|
||||
};
|
||||
window.native.Call_OnKeyboardEvent = function(e)
|
||||
{
|
||||
return window["API"].Call_OnKeyboardEvent(e);
|
||||
};
|
||||
|
||||
window.native.Call_Menu_Event = function (type, _params)
|
||||
{
|
||||
return window["API"].Call_Menu_Event(type, _params);
|
||||
};
|
||||
@ -1,810 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
function CPointer()
|
||||
{
|
||||
this.obj = null;
|
||||
this.data = null;
|
||||
this.pos = 0;
|
||||
}
|
||||
function dublicate_pointer(p)
|
||||
{
|
||||
if (null == p)
|
||||
return null;
|
||||
|
||||
var d = new CPointer();
|
||||
d.data = p.data;
|
||||
d.pos = p.pos;
|
||||
return d;
|
||||
}
|
||||
function copy_pointer(p, size)
|
||||
{
|
||||
var _p = g_memory.Alloc(size);
|
||||
for (var i = 0; i < size; i++)
|
||||
_p.data[i] = p.data[p.pos + i];
|
||||
return _p;
|
||||
}
|
||||
|
||||
function FT_Memory()
|
||||
{
|
||||
this.canvas = document.createElement('canvas');
|
||||
this.canvas.width = 1;
|
||||
this.canvas.height = 1;
|
||||
this.ctx = this.canvas.getContext('2d');
|
||||
|
||||
this.Alloc = function(size)
|
||||
{
|
||||
var p = new CPointer();
|
||||
p.obj = this.ctx.createImageData(1,parseInt((size + 3) / 4));
|
||||
p.data = p.obj.data;
|
||||
p.pos = 0;
|
||||
return p;
|
||||
}
|
||||
this.AllocHeap = function()
|
||||
{
|
||||
// TODO:
|
||||
}
|
||||
this.CreateStream = function(size)
|
||||
{
|
||||
console.log("not impl");
|
||||
}
|
||||
}
|
||||
var g_memory = new FT_Memory();
|
||||
|
||||
function FT_Stream(data, size)
|
||||
{
|
||||
this.obj = null;
|
||||
this.data = data;
|
||||
this.size = size;
|
||||
this.pos = 0;
|
||||
this.cur = 0;
|
||||
|
||||
this.Seek = function(_pos)
|
||||
{
|
||||
if (_pos > this.size)
|
||||
return 85;
|
||||
this.pos = _pos;
|
||||
return 0;
|
||||
}
|
||||
this.Skip = function(_skip)
|
||||
{
|
||||
if (_skip < 0)
|
||||
return 85;
|
||||
return this.Seek(this.pos + _skip);
|
||||
}
|
||||
this.Read = function(pointer, count)
|
||||
{
|
||||
return this.ReadAt(this.pos, pointer, count);
|
||||
}
|
||||
this.ReadArray = function(count)
|
||||
{
|
||||
var read_bytes = this.size - this.pos;
|
||||
if (read_bytes > count)
|
||||
read_bytes = count;
|
||||
if (0 == read_bytes)
|
||||
return null;
|
||||
var a = new Array(read_bytes);
|
||||
for (var i = 0;i<count;i++)
|
||||
a[i] = this.data[this.pos+i];
|
||||
return a;
|
||||
}
|
||||
this.ReadAt = function(_pos, pointer, count)
|
||||
{
|
||||
if (_pos > this.size)
|
||||
return 85;
|
||||
var read_bytes = this.size - _pos;
|
||||
if (read_bytes > count)
|
||||
read_bytes = count;
|
||||
|
||||
FT_Common.memcpy_p2(pointer,this.data,_pos,count);
|
||||
|
||||
this.pos = _pos + read_bytes;
|
||||
|
||||
if (read_bytes < count)
|
||||
return 85;
|
||||
|
||||
return 0;
|
||||
}
|
||||
this.TryRead = function(pointer, count)
|
||||
{
|
||||
var read_bytes = 0;
|
||||
if (this.pos < this.size)
|
||||
return read_bytes;
|
||||
read_bytes = this.size - this.pos;
|
||||
if (read_bytes > count)
|
||||
read_bytes = count;
|
||||
|
||||
FT_Common.memcpy_p2(pointer,this.data,this.pos,count);
|
||||
|
||||
this.pos += read_bytes;
|
||||
return read_bytes;
|
||||
}
|
||||
|
||||
// 1 bytes
|
||||
this.GetUChar = function()
|
||||
{
|
||||
if (this.cur >= this.size)
|
||||
return 0;
|
||||
return this.data[this.cur++];
|
||||
}
|
||||
this.GetChar = function()
|
||||
{
|
||||
if (this.cur >= this.size)
|
||||
return 0;
|
||||
var m = this.data[this.cur++];
|
||||
if (m > 127)
|
||||
m -= 256;
|
||||
return m;
|
||||
}
|
||||
this.GetString1 = function(len)
|
||||
{
|
||||
if (this.cur + len > this.size)
|
||||
return "";
|
||||
var t = "";
|
||||
for (var i = 0; i < len; i++)
|
||||
t += String.fromCharCode(this.data[this.cur + i]);
|
||||
this.cur += len;
|
||||
return t;
|
||||
}
|
||||
this.ReadString1 = function(len)
|
||||
{
|
||||
if (this.pos + len > this.size)
|
||||
return "";
|
||||
var t = "";
|
||||
for (var i = 0; i < len; i++)
|
||||
t += String.fromCharCode(this.data[this.pos + i]);
|
||||
this.pos += len;
|
||||
return t;
|
||||
}
|
||||
|
||||
this.ReadUChar = function()
|
||||
{
|
||||
if (this.pos >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
return this.data[this.pos++];
|
||||
}
|
||||
this.ReadChar = function()
|
||||
{
|
||||
if (this.pos >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
var m = this.data[this.pos++];
|
||||
if (m > 127)
|
||||
m -= 256;
|
||||
return m;
|
||||
}
|
||||
|
||||
// 2 byte
|
||||
this.GetUShort = function()
|
||||
{
|
||||
if (this.cur + 1 >= this.size)
|
||||
return 0;
|
||||
return (this.data[this.cur++] << 8 | this.data[this.cur++]);
|
||||
}
|
||||
this.GetShort = function()
|
||||
{
|
||||
return FT_Common.UShort_To_Short(this.GetUShort());
|
||||
}
|
||||
this.ReadUShort = function()
|
||||
{
|
||||
if (this.pos + 1 >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
return (this.data[this.pos++] << 8 | this.data[this.pos++]);
|
||||
}
|
||||
this.ReadShort = function()
|
||||
{
|
||||
return FT_Common.UShort_To_Short(this.ReadUShort());
|
||||
}
|
||||
this.GetUShortLE = function()
|
||||
{
|
||||
if (this.cur + 1 >= this.size)
|
||||
return 0;
|
||||
return (this.data[this.cur++] | this.data[this.cur++] << 8);
|
||||
}
|
||||
this.GetShortLE = function()
|
||||
{
|
||||
return FT_Common.UShort_To_Short(this.GetUShortLE());
|
||||
}
|
||||
this.ReadUShortLE = function()
|
||||
{
|
||||
if (this.pos + 1 >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
return (this.data[this.pos++] | this.data[this.pos++] << 8);
|
||||
}
|
||||
this.ReadShortLE = function()
|
||||
{
|
||||
return FT_Common.UShort_To_Short(this.ReadUShortLE());
|
||||
}
|
||||
|
||||
// 4 byte
|
||||
this.GetULong = function()
|
||||
{
|
||||
if (this.cur + 3 >= this.size)
|
||||
return 0;
|
||||
//return (this.data[this.cur++] << 24 | this.data[this.cur++] << 16 | this.data[this.cur++] << 8 | this.data[this.cur++]);
|
||||
var s = (this.data[this.cur++] << 24 | this.data[this.cur++] << 16 | this.data[this.cur++] << 8 | this.data[this.cur++]);
|
||||
if (s < 0)
|
||||
s += 4294967296;
|
||||
return s;
|
||||
}
|
||||
this.GetLong = function()
|
||||
{
|
||||
// 32-битные числа - по умолчанию знаковые!!!
|
||||
//return FT_Common.UintToInt(this.GetULong());
|
||||
return (this.data[this.cur++] << 24 | this.data[this.cur++] << 16 | this.data[this.cur++] << 8 | this.data[this.cur++]);
|
||||
}
|
||||
this.ReadULong = function()
|
||||
{
|
||||
if (this.pos + 3 >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
var s = (this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++]);
|
||||
if (s < 0)
|
||||
s += 4294967296;
|
||||
return s;
|
||||
}
|
||||
this.ReadLong = function()
|
||||
{
|
||||
// 32-битные числа - по умолчанию знаковые!!!
|
||||
//return FT_Common.Uint_To_int(this.ReadULong());
|
||||
if (this.pos + 3 >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
return (this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++]);
|
||||
}
|
||||
|
||||
this.GetULongLE = function()
|
||||
{
|
||||
if (this.cur + 3 >= this.size)
|
||||
return 0;
|
||||
return (this.data[this.cur++] | this.data[this.cur++] << 8 | this.data[this.cur++] << 16 | this.data[this.cur++] << 24);
|
||||
}
|
||||
this.GetLongLE = function()
|
||||
{
|
||||
return FT_Common.Uint_To_int(this.GetULongLE());
|
||||
}
|
||||
this.ReadULongLE = function()
|
||||
{
|
||||
if (this.pos + 3 >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
return (this.data[this.pos++] | this.data[this.pos++] << 8 | this.data[this.pos++] << 16 | this.data[this.pos++] << 24);
|
||||
}
|
||||
this.ReadLongLE = function()
|
||||
{
|
||||
return FT_Common.Uint_To_int(this.ReadULongLE());
|
||||
}
|
||||
|
||||
// 3 byte
|
||||
this.GetUOffset = function()
|
||||
{
|
||||
if (this.cur + 2 >= this.size)
|
||||
return 0;
|
||||
return (this.data[this.cur++] << 16 | this.data[this.cur++] << 8 | this.data[this.cur++]);
|
||||
}
|
||||
this.GetUOffsetLE = function()
|
||||
{
|
||||
if (this.cur + 2 >= this.size)
|
||||
return 0;
|
||||
return (this.data[this.cur++] | this.data[this.cur++] << 8 | this.data[this.cur++] << 16);
|
||||
}
|
||||
this.ReadUOffset = function()
|
||||
{
|
||||
if (this.pos + 2 >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
return (this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++]);
|
||||
}
|
||||
this.ReadUOffsetLE = function()
|
||||
{
|
||||
if (this.pos + 2 >= this.size)
|
||||
{
|
||||
FT_Error = 85;
|
||||
return 0;
|
||||
}
|
||||
FT_Error = 0;
|
||||
return (this.data[this.pos++] | this.data[this.pos++] << 8 | this.data[this.pos++] << 16);
|
||||
}
|
||||
this.EnterFrame = function(count)
|
||||
{
|
||||
if (this.pos >= this.size || this.size - this.pos < count)
|
||||
return 85;
|
||||
|
||||
this.cur = this.pos;
|
||||
this.pos += count;
|
||||
return 0;
|
||||
}
|
||||
this.ExtractFrame = function(count, pointer)
|
||||
{
|
||||
if (null == pointer)
|
||||
pointer = new CPointer();
|
||||
|
||||
var err = this.EnterFrame(count);
|
||||
if (err != 0)
|
||||
return err;
|
||||
|
||||
pointer.data = this.data;
|
||||
pointer.pos = this.cur;
|
||||
|
||||
this.cur = 0;
|
||||
return err;
|
||||
}
|
||||
this.ReleaseFrame = function()
|
||||
{
|
||||
}
|
||||
this.ExitFrame = function()
|
||||
{
|
||||
this.cur = 0;
|
||||
}
|
||||
|
||||
this.ReadFields = function(arrayFields, structure)
|
||||
{
|
||||
// arrayFields : array {value, size, offset}
|
||||
// structures : data pointer
|
||||
var error = 0;
|
||||
var cursor = this.cur;
|
||||
var frame_accessed = false;
|
||||
|
||||
var data = null;
|
||||
var pos = 0;
|
||||
|
||||
var ind = 0;
|
||||
do
|
||||
{
|
||||
var value;
|
||||
var sign_shift;
|
||||
|
||||
switch (arrayFields[ind].value)
|
||||
{
|
||||
case 4: /* access a new frame */
|
||||
error = this.EnterFrame(arrayFields[ind].offset);
|
||||
if (error != 0)
|
||||
{
|
||||
if (frame_accessed === true)
|
||||
this.ExitFrame();
|
||||
return error;
|
||||
}
|
||||
|
||||
frame_accessed = true;
|
||||
cursor = this.cur;
|
||||
ind++;
|
||||
continue; /* loop! */
|
||||
|
||||
case 24: /* read a byte sequence */
|
||||
case 25: /* skip some bytes */
|
||||
{
|
||||
var len = arrayFields[ind].size;
|
||||
if ( cursor + len > this.size )
|
||||
{
|
||||
error = 85;
|
||||
if (frame_accessed === true)
|
||||
this.ExitFrame();
|
||||
return error;
|
||||
}
|
||||
|
||||
if ( arrayFields[ind] == 24 )
|
||||
{
|
||||
data = structure.data;
|
||||
pos = structure.pos + arrayFields[ind].offset;
|
||||
|
||||
for (var i=0;i<len;i++)
|
||||
data[i] = this.data[cursor+i];
|
||||
}
|
||||
cursor += len;
|
||||
ind++;
|
||||
continue;
|
||||
}
|
||||
|
||||
case 8:
|
||||
case 9: /* read a single byte */
|
||||
value = this.data[cursor++];
|
||||
sign_shift = 24;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
case 12: /* read a 2-byte big-endian short */
|
||||
value = this.data[cursor++] << 8 | this.data[cursor++];
|
||||
sign_shift = 16;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
case 14: /* read a 2-byte little-endian short */
|
||||
value = this.data[cursor++] | this.data[cursor++] << 8;
|
||||
sign_shift = 16;
|
||||
break;
|
||||
|
||||
case 17:
|
||||
case 16: /* read a 4-byte big-endian long */
|
||||
value = this.data[cursor++] << 24 | this.data[cursor++] << 16 | this.data[cursor++] << 8 | this.data[cursor++];
|
||||
sign_shift = 0;
|
||||
break;
|
||||
|
||||
case 19:
|
||||
case 18: /* read a 4-byte little-endian long */
|
||||
value = this.data[cursor++] | this.data[cursor++] << 8 | this.data[cursor++] << 16 | this.data[cursor++] << 24;
|
||||
sign_shift = 0;
|
||||
break;
|
||||
|
||||
case 21:
|
||||
case 20: /* read a 3-byte big-endian long */
|
||||
value = this.data[cursor++] << 16 | this.data[cursor++] << 8 | this.data[cursor++];
|
||||
sign_shift = 8;
|
||||
break;
|
||||
|
||||
case 23:
|
||||
case 22: /* read a 3-byte little-endian long */
|
||||
value = this.data[cursor++] | this.data[cursor++] << 8 | this.data[cursor++] << 16;
|
||||
sign_shift = 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* otherwise, exit the loop */
|
||||
this.cur = cursor;
|
||||
if (frame_accessed === true)
|
||||
this.ExitFrame();
|
||||
return error;
|
||||
}
|
||||
|
||||
/* now, compute the signed value is necessary */
|
||||
if ( arrayFields[ind].value & 1 )
|
||||
value = (( value << sign_shift ) >>> sign_shift) & 0xFFFFFFFF;
|
||||
|
||||
/* finally, store the value in the object */
|
||||
|
||||
data = structure.data;
|
||||
pos = structure.pos + arrayFields[ind].offset;
|
||||
switch (arrayFields[ind])
|
||||
{
|
||||
case 1:
|
||||
data[pos] = value & 0xFF;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data[pos] = (value >>> 8)&0xFF;
|
||||
data[pos+1] = value&0xFF;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data[pos] = (value >>> 24)&0xFF;
|
||||
data[pos+1] = (value >>> 16)&0xFF;
|
||||
data[pos+2] = (value >>> 8)&0xFF;
|
||||
data[pos+3] = value&0xFF;
|
||||
break;
|
||||
|
||||
default:
|
||||
data[pos] = (value >>> 24)&0xFF;
|
||||
data[pos+1] = (value >>> 16)&0xFF;
|
||||
data[pos+2] = (value >>> 8)&0xFF;
|
||||
data[pos+3] = value&0xFF;
|
||||
}
|
||||
|
||||
/* go to next field */
|
||||
ind++;
|
||||
}
|
||||
while ( 1 );
|
||||
|
||||
return error;
|
||||
}
|
||||
this.ReadFields2 = function(fields, structure)
|
||||
{
|
||||
// arrayFields : array {value, size, offset}
|
||||
// structures : data pointer
|
||||
var error = 0;
|
||||
var cursor = this.cur;
|
||||
var frame_accessed = false;
|
||||
|
||||
var data = null;
|
||||
var pos = 0;
|
||||
|
||||
var ind = 0;
|
||||
do
|
||||
{
|
||||
var value;
|
||||
var sign_shift;
|
||||
|
||||
var fval = fields[ind];
|
||||
var fsize = fields[ind+1];
|
||||
var foffset = fields[ind+2];
|
||||
|
||||
switch (fval)
|
||||
{
|
||||
case 4: /* access a new frame */
|
||||
error = this.EnterFrame(foffset);
|
||||
if (error != 0)
|
||||
{
|
||||
if (frame_accessed === true)
|
||||
this.ExitFrame();
|
||||
return error;
|
||||
}
|
||||
|
||||
frame_accessed = true;
|
||||
cursor = this.cur;
|
||||
ind+=3;
|
||||
continue; /* loop! */
|
||||
|
||||
case 24: /* read a byte sequence */
|
||||
case 25: /* skip some bytes */
|
||||
{
|
||||
var len = arrayFields[ind].size;
|
||||
if ( cursor + fsize > this.size )
|
||||
{
|
||||
error = 85;
|
||||
if (frame_accessed === true)
|
||||
this.ExitFrame();
|
||||
return error;
|
||||
}
|
||||
|
||||
if ( fval == 24 )
|
||||
{
|
||||
data = structure.data;
|
||||
pos = structure.pos + fields[ind].offset;
|
||||
|
||||
for (var i=0;i<len;i++)
|
||||
data[i] = this.data[cursor+i];
|
||||
}
|
||||
cursor += fsize;
|
||||
ind++;
|
||||
continue;
|
||||
}
|
||||
|
||||
case 8:
|
||||
case 9: /* read a single byte */
|
||||
value = this.data[cursor++];
|
||||
sign_shift = 24;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
case 12: /* read a 2-byte big-endian short */
|
||||
value = this.data[cursor++] << 8 | this.data[cursor++];
|
||||
sign_shift = 16;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
case 14: /* read a 2-byte little-endian short */
|
||||
value = this.data[cursor++] | this.data[cursor++] << 8;
|
||||
sign_shift = 16;
|
||||
break;
|
||||
|
||||
case 17:
|
||||
case 16: /* read a 4-byte big-endian long */
|
||||
value = this.data[cursor++] << 24 | this.data[cursor++] << 16 | this.data[cursor++] << 8 | this.data[cursor++];
|
||||
sign_shift = 0;
|
||||
break;
|
||||
|
||||
case 19:
|
||||
case 18: /* read a 4-byte little-endian long */
|
||||
value = this.data[cursor++] | this.data[cursor++] << 8 | this.data[cursor++] << 16 | this.data[cursor++] << 24;
|
||||
sign_shift = 0;
|
||||
break;
|
||||
|
||||
case 21:
|
||||
case 20: /* read a 3-byte big-endian long */
|
||||
value = this.data[cursor++] << 16 | this.data[cursor++] << 8 | this.data[cursor++];
|
||||
sign_shift = 8;
|
||||
break;
|
||||
|
||||
case 23:
|
||||
case 22: /* read a 3-byte little-endian long */
|
||||
value = this.data[cursor++] | this.data[cursor++] << 8 | this.data[cursor++] << 16;
|
||||
sign_shift = 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* otherwise, exit the loop */
|
||||
this.cur = cursor;
|
||||
if (frame_accessed === true)
|
||||
this.ExitFrame();
|
||||
return error;
|
||||
}
|
||||
|
||||
/* now, compute the signed value is necessary */
|
||||
if (0 != (fval & 1))
|
||||
value = (( value << sign_shift ) >>> sign_shift) & 0xFFFFFFFF;
|
||||
|
||||
/* finally, store the value in the object */
|
||||
|
||||
data = structure.data;
|
||||
pos = structure.pos + fields[ind].offset;
|
||||
switch (fields[ind])
|
||||
{
|
||||
case 1:
|
||||
data[pos] = value & 0xFF;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data[pos] = (value >>> 8)&0xFF;
|
||||
data[pos+1] = value&0xFF;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data[pos] = (value >>> 24)&0xFF;
|
||||
data[pos+1] = (value >>> 16)&0xFF;
|
||||
data[pos+2] = (value >>> 8)&0xFF;
|
||||
data[pos+3] = value&0xFF;
|
||||
break;
|
||||
|
||||
default:
|
||||
data[pos] = (value >>> 24)&0xFF;
|
||||
data[pos+1] = (value >>> 16)&0xFF;
|
||||
data[pos+2] = (value >>> 8)&0xFF;
|
||||
data[pos+3] = value&0xFF;
|
||||
}
|
||||
|
||||
/* go to next field */
|
||||
ind+=3;
|
||||
}
|
||||
while ( 1 );
|
||||
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
window["fts"] = FT_Stream;
|
||||
|
||||
window['AscFonts'].FT_Memory = FT_Memory;
|
||||
window['AscFonts'].FT_Stream = FT_Stream;
|
||||
window['AscFonts'].g_memory = g_memory;
|
||||
|
||||
// FT_Common
|
||||
function _FT_Common() {
|
||||
this.UintToInt = function(v)
|
||||
{
|
||||
return (v>2147483647)?v-4294967296:v;
|
||||
};
|
||||
this.UShort_To_Short = function(v)
|
||||
{
|
||||
return (v>32767)?v-65536:v;
|
||||
};
|
||||
this.IntToUInt = function(v)
|
||||
{
|
||||
return (v<0)?v+4294967296:v;
|
||||
};
|
||||
this.Short_To_UShort = function(v)
|
||||
{
|
||||
return (v<0)?v+65536:v;
|
||||
};
|
||||
this.memset = function(d,v,s)
|
||||
{
|
||||
for (var i=0;i<s;i++)
|
||||
d[i]=v;
|
||||
};
|
||||
this.memcpy = function(d,s,l)
|
||||
{
|
||||
for (var i=0;i<l;i++)
|
||||
d[i]=s[i];
|
||||
};
|
||||
this.memset_p = function(d,v,s)
|
||||
{
|
||||
var _d = d.data;
|
||||
var _e = d.pos+s;
|
||||
for (var i=d.pos;i<_e;i++)
|
||||
_d[i]=v;
|
||||
};
|
||||
this.memcpy_p = function(d,s,l)
|
||||
{
|
||||
var _d1=d.data;
|
||||
var _p1=d.pos;
|
||||
var _d2=s.data;
|
||||
var _p2=s.pos;
|
||||
for (var i=0;i<l;i++)
|
||||
_d1[_p1++]=_d2[_p2++];
|
||||
};
|
||||
this.memcpy_p2 = function(d,s,p,l)
|
||||
{
|
||||
var _d1=d.data;
|
||||
var _p1=d.pos;
|
||||
var _p2=p;
|
||||
for (var i=0;i<l;i++)
|
||||
_d1[_p1++]=s[_p2++];
|
||||
};
|
||||
this.realloc = function(memory, pointer, cur_count, new_count)
|
||||
{
|
||||
var ret = { block: null, err : 0, size : new_count};
|
||||
if (cur_count < 0 || new_count < 0)
|
||||
{
|
||||
/* may help catch/prevent nasty security issues */
|
||||
ret.err = 6;
|
||||
}
|
||||
else if (new_count == 0)
|
||||
{
|
||||
ret.block = null;
|
||||
}
|
||||
else if (cur_count == 0)
|
||||
{
|
||||
ret.block = memory.Alloc(new_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
var block2 = memory.Alloc(new_count);
|
||||
FT_Common.memcpy_p(block2, pointer, cur_count);
|
||||
ret.block = block2;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
this.realloc_long = function(memory, pointer, cur_count, new_count)
|
||||
{
|
||||
var ret = { block: null, err : 0, size : new_count};
|
||||
if (cur_count < 0 || new_count < 0)
|
||||
{
|
||||
/* may help catch/prevent nasty security issues */
|
||||
ret.err = 6;
|
||||
}
|
||||
else if (new_count == 0)
|
||||
{
|
||||
ret.block = null;
|
||||
}
|
||||
else if (cur_count == 0)
|
||||
{
|
||||
ret.block = CreateIntArray(new_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
var block2 = CreateIntArray(new_count);
|
||||
for (var i = 0; i < cur_count; i++)
|
||||
block2[i] = pointer[i];
|
||||
|
||||
ret.block = block2;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
var FT_Common = new _FT_Common();
|
||||
|
||||
window['AscFonts'].FT_Common = FT_Common;
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,305 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
var editor = undefined;
|
||||
var navigator = {};
|
||||
navigator.userAgent = "chrome";
|
||||
|
||||
window.location = {};
|
||||
|
||||
window.location.protocol = "";
|
||||
window.location.host = "";
|
||||
window.location.href = "";
|
||||
window.location.pathname = "";
|
||||
|
||||
window.XMLHttpRequest = function () {};
|
||||
|
||||
window.NATIVE_EDITOR_ENJINE = true;
|
||||
window.NATIVE_EDITOR_ENJINE_SYNC_RECALC = true;
|
||||
|
||||
var document = {};
|
||||
|
||||
var Asc = {};
|
||||
var AscFonts = {};
|
||||
var AscCommon = {};
|
||||
var AscFormat = {};
|
||||
var AscDFH = {};
|
||||
var AscCH = {};
|
||||
var AscCommonExcel = {};
|
||||
var AscCommonWord = {};
|
||||
var AscMath = {};
|
||||
var AscCommonSlide = {};
|
||||
var AscBuilder = {};
|
||||
var AscWord = {};
|
||||
var AscJsonConverter = {};
|
||||
|
||||
function Image()
|
||||
{
|
||||
this.src = "";
|
||||
this.onload = function () {};
|
||||
this.onerror = function () {};
|
||||
}
|
||||
|
||||
function _image_data()
|
||||
{
|
||||
this.data = null;
|
||||
this.length = 0;
|
||||
}
|
||||
|
||||
function native_pattern_fill()
|
||||
{
|
||||
}
|
||||
native_pattern_fill.prototype =
|
||||
{
|
||||
setTransform: function (transform) {}
|
||||
};
|
||||
|
||||
function native_gradient_fill() {}
|
||||
native_gradient_fill.prototype =
|
||||
{
|
||||
addColorStop: function (offset, color) {}
|
||||
};
|
||||
|
||||
function native_context2d(parent)
|
||||
{
|
||||
this.canvas = parent;
|
||||
|
||||
this.globalAlpha = 0;
|
||||
this.globalCompositeOperation = "";
|
||||
this.fillStyle = "#000000";
|
||||
this.strokeStyle = "#000000";
|
||||
|
||||
this.lineWidth = 0;
|
||||
this.lineCap = 0;
|
||||
this.lineJoin = 0;
|
||||
this.miterLimit = 0;
|
||||
this.shadowOffsetX = 0;
|
||||
this.shadowOffsetY = 0;
|
||||
this.shadowBlur = 0;
|
||||
this.shadowColor = 0;
|
||||
this.font = "";
|
||||
this.textAlign = 0;
|
||||
this.textBaseline = 0;
|
||||
}
|
||||
native_context2d.prototype =
|
||||
{
|
||||
save: function () {},
|
||||
restore: function () {},
|
||||
|
||||
scale: function (x, y) {},
|
||||
rotate: function (angle) {},
|
||||
translate: function (x, y) {},
|
||||
transform: function (m11, m12, m21, m22, dx, dy) {},
|
||||
setTransform: function (m11, m12, m21, m22, dx, dy) {},
|
||||
|
||||
createLinearGradient: function (x0, y0, x1, y1) {},
|
||||
createRadialGradient: function (x0, y0, r0, x1, y1, r1) {},
|
||||
createPattern: function (image, repetition) {},
|
||||
|
||||
clearRect: function (x, y, w, h) {},
|
||||
fillRect: function (x, y, w, h) {},
|
||||
strokeRect: function (x, y, w, h) {},
|
||||
|
||||
beginPath: function () {},
|
||||
closePath: function () {},
|
||||
moveTo: function (x, y) {},
|
||||
lineTo: function (x, y) {},
|
||||
quadraticCurveTo: function (cpx, cpy, x, y) {},
|
||||
bezierCurveTo: function (cp1x, cp1y, cp2x, cp2y, x, y) {},
|
||||
arcTo: function (x1, y1, x2, y2, radius) {},
|
||||
rect: function (x, y, w, h) {},
|
||||
arc: function (x, y, radius, startAngle, endAngle, anticlockwise) {},
|
||||
|
||||
fill: function () {},
|
||||
stroke: function () {},
|
||||
clip: function () {},
|
||||
isPointInPath: function (x, y) {},
|
||||
drawFocusRing: function (element, xCaret, yCaret, canDrawCustom) {},
|
||||
|
||||
fillText: function (text, x, y, maxWidth) {},
|
||||
strokeText: function (text, x, y, maxWidth) {},
|
||||
measureText: function (text) {},
|
||||
|
||||
drawImage: function (img_elem, dx_or_sx, dy_or_sy, dw_or_sw, dh_or_sh, dx, dy, dw, dh) {},
|
||||
|
||||
createImageData: function (imagedata_or_sw, sh)
|
||||
{
|
||||
var _data = new _image_data();
|
||||
_data.length = imagedata_or_sw * sh * 4;
|
||||
_data.data = (typeof(Uint8Array) != 'undefined') ? new Uint8Array(_data.length) : new Array(_data.length);
|
||||
return _data;
|
||||
},
|
||||
getImageData: function (sx, sy, sw, sh) {},
|
||||
putImageData: function (image_data, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight) {}
|
||||
};
|
||||
|
||||
function native_canvas()
|
||||
{
|
||||
this.id = "";
|
||||
this.width = 300;
|
||||
this.height = 150;
|
||||
|
||||
this.nodeType = 1;
|
||||
}
|
||||
native_canvas.prototype =
|
||||
{
|
||||
getContext: function (type) { return (type == "2d") ? new native_context2d(this) : null; },
|
||||
toDataUrl: function (type) { return ""; },
|
||||
addEventListener: function () {},
|
||||
attr: function () {}
|
||||
};
|
||||
|
||||
var _null_object = {};
|
||||
_null_object.length = 0;
|
||||
_null_object.nodeType = 1;
|
||||
_null_object.offsetWidth = 1;
|
||||
_null_object.offsetHeight = 1;
|
||||
_null_object.clientWidth = 1;
|
||||
_null_object.clientHeight = 1;
|
||||
_null_object.scrollWidth = 1;
|
||||
_null_object.scrollHeight = 1;
|
||||
_null_object.style = {};
|
||||
_null_object.documentElement = _null_object;
|
||||
_null_object.body = _null_object;
|
||||
_null_object.ownerDocument = _null_object;
|
||||
_null_object.defaultView = _null_object;
|
||||
|
||||
_null_object.addEventListener = function () {};
|
||||
_null_object.setAttribute = function () {};
|
||||
_null_object.getElementsByTagName = function () { return []; };
|
||||
_null_object.appendChild = function () {};
|
||||
_null_object.removeChild = function () {};
|
||||
_null_object.insertBefore = function () {};
|
||||
_null_object.childNodes = [];
|
||||
_null_object.parent = _null_object;
|
||||
_null_object.parentNode = _null_object;
|
||||
_null_object.find = function () { return this; };
|
||||
_null_object.appendTo = function () { return this; };
|
||||
_null_object.css = function () { return this; };
|
||||
_null_object.width = function () { return 0; };
|
||||
_null_object.height = function () { return 0; };
|
||||
_null_object.attr = function () { return this; };
|
||||
_null_object.prop = function () { return this; };
|
||||
_null_object.val = function () { return this; };
|
||||
_null_object.remove = function () {};
|
||||
_null_object.getComputedStyle = function () { return null; };
|
||||
_null_object.getContext = function (type) { return (type == "2d") ? new native_context2d(this) : null; };
|
||||
_null_object.getBoundingClientRect = function() { return { left : 0, top : 0, right : 0, bottom : 0 }; };
|
||||
|
||||
document.createElement = function (type)
|
||||
{
|
||||
if (type && type.toLowerCase)
|
||||
{
|
||||
if (type.toLowerCase() == "canvas")
|
||||
return new native_canvas();
|
||||
}
|
||||
|
||||
return _null_object;
|
||||
};
|
||||
|
||||
function _return_empty_html_element() { return _null_object; }
|
||||
|
||||
document.createDocumentFragment = _return_empty_html_element;
|
||||
document.getElementsByTagName = function (tag) { return ("head" == tag) ? [_null_object] : []; };
|
||||
document.insertBefore = function () {};
|
||||
document.appendChild = function () {};
|
||||
document.removeChild = function () {};
|
||||
document.getElementById = function () { return _null_object; };
|
||||
document.createComment = function () { return undefined; };
|
||||
|
||||
document.documentElement = _null_object;
|
||||
document.body = _null_object;
|
||||
|
||||
// NATIVE OBJECT
|
||||
window.native = native;
|
||||
function GetNativeEngine() { return window.native; }
|
||||
|
||||
var Api = null; // main builder object
|
||||
window.devicePixelRatio = 1;
|
||||
if (window.native && window.native.GetDevicePixelRatio)
|
||||
window.devicePixelRatio = window.native.GetDevicePixelRatio();
|
||||
|
||||
// OPEN
|
||||
function NativeOpenFileData(data, version, xlsx_file_path, options)
|
||||
{
|
||||
window.NATIVE_DOCUMENT_TYPE = window.native.GetEditorType();
|
||||
Api = null;
|
||||
|
||||
if (options && options["printOptions"] && options["printOptions"]["retina"])
|
||||
AscBrowser.isRetina = true;
|
||||
|
||||
var configApi = {};
|
||||
if (options && undefined !== options["translate"])
|
||||
configApi["translate"] = options["translate"];
|
||||
|
||||
if (window.NATIVE_DOCUMENT_TYPE === "presentation" || window.NATIVE_DOCUMENT_TYPE === "document")
|
||||
{
|
||||
Api = new window["Asc"]["asc_docs_api"](configApi);
|
||||
if (options && options["documentLayout"] && undefined !== options["documentLayout"]["openedAt"])
|
||||
Api.setOpenedAt(options["documentLayout"]["openedAt"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Api = new window["Asc"]["spreadsheet_api"](configApi);
|
||||
}
|
||||
|
||||
if (options && undefined !== options["locale"])
|
||||
Api.asc_setLocale(options["locale"]);
|
||||
|
||||
if (window.NATIVE_DOCUMENT_TYPE === "presentation" || window.NATIVE_DOCUMENT_TYPE === "document")
|
||||
{
|
||||
Api.asc_nativeOpenFile(data, version);
|
||||
}
|
||||
else
|
||||
{
|
||||
Api.asc_nativeOpenFile(data, version, undefined, xlsx_file_path);
|
||||
}
|
||||
}
|
||||
|
||||
var clearTimeout = window.clearTimeout = function() {};
|
||||
var setTimeout = window.setTimeout = function() {};
|
||||
var clearInterval = window.clearInterval = function() {};
|
||||
var setInterval = window.setInterval = function() {};
|
||||
|
||||
var console = {
|
||||
log: function (param) { window.native.ConsoleLog(param); },
|
||||
time: function (param) {},
|
||||
timeEnd: function (param) {},
|
||||
warn: function() {}
|
||||
};
|
||||
|
||||
var performance = window.performance = (function(){
|
||||
var basePerformanceOffset = Date.now();
|
||||
return {
|
||||
now : function() { return Date.now() - basePerformanceOffset; }
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user