Commit 08def1c1 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

Нативная версия. работа с таймерами. статистика документа

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61062 954022d7-b5bf-4e40-9824-e11837661b57
parent 814bad90
......@@ -97,6 +97,16 @@ asc_docs_api.prototype["Call_Common"] = function(type, param)
this.WordControl.m_oLogicDocument.Cursor_MoveLeft();
break;
}
case 67:
{
this.startGetDocInfo();
break;
}
case 68:
{
this.stopGetDocInfo();
break;
}
default:
break;
}
......@@ -4625,6 +4635,64 @@ function Deserialize_Table_Markup(_params, _cols, _margins, _rows)
return _markup;
}
asc_docs_api.prototype.startGetDocInfo = function()
{
/*
Возвращаем объект следующего вида:
{
PageCount: 12,
WordsCount: 2321,
ParagraphCount: 45,
SymbolsCount: 232345,
SymbolsWSCount: 34356
}
*/
this.sync_GetDocInfoStartCallback();
if (null != this.WordControl.m_oLogicDocument)
this.WordControl.m_oLogicDocument.Statistics_Start();
};
asc_docs_api.prototype.stopGetDocInfo = function()
{
this.sync_GetDocInfoStopCallback();
if (null != this.WordControl.m_oLogicDocument)
this.WordControl.m_oLogicDocument.Statistics_Stop();
};
asc_docs_api.prototype.sync_DocInfoCallback = function(obj)
{
var _stream = global_memory_stream_menu;
_stream["ClearNoAttack"]();
_stream["WriteLong"](obj.PageCount);
_stream["WriteLong"](obj.WordsCount);
_stream["WriteLong"](obj.ParagraphCount);
_stream["WriteLong"](obj.SymbolsCount);
_stream["WriteLong"](obj.SymbolsWSCount);
window["native"]["OnCallMenuEvent"](70, _stream); // ASC_MENU_EVENT_TYPE_STATISTIC_INFO
};
asc_docs_api.prototype.sync_GetDocInfoStartCallback = function()
{
var _stream = global_memory_stream_menu;
_stream["ClearNoAttack"]();
window["native"]["OnCallMenuEvent"](67, _stream); // ASC_MENU_EVENT_TYPE_STATISTIC_START
};
asc_docs_api.prototype.sync_GetDocInfoStopCallback = function()
{
var _stream = global_memory_stream_menu;
_stream["ClearNoAttack"]();
window["native"]["OnCallMenuEvent"](68, _stream); // ASC_MENU_EVENT_TYPE_STATISTIC_STOP
};
asc_docs_api.prototype.sync_GetDocInfoEndCallback = function()
{
var _stream = global_memory_stream_menu;
_stream["ClearNoAttack"]();
window["native"]["OnCallMenuEvent"](69, _stream); // ASC_MENU_EVENT_TYPE_STATISTIC_END
};
asc_docs_api.prototype.sync_CanUndoCallback = function(bCanUndo)
{
var _stream = global_memory_stream_menu;
......@@ -5112,6 +5180,8 @@ window["ftm"] = FT_Memory;
asc_docs_api.prototype["Native_Editor_Initialize_Settings"] = function(_params)
{
window.NativeSupportTimeouts = true;
if (!_params)
return;
......
......@@ -414,15 +414,69 @@ function GetNativeId()
return window.native.GetFileId();
}
function clearTimeout() {}
function setTimeout() {}
function clearInterval() {}
function setInterval() {}
// для работы с таймерами
window.NativeSupportTimeouts = false;
window.NativeTimeoutObject = {};
window.clearTimeout = clearTimeout;
window.setTimeout = setTimeout;
window.clearInterval = clearInterval;
window.setInterval = setInterval;
function clearTimeout(_id)
{
if (!window.NativeSupportTimeouts)
return;
window.NativeTimeoutObject["" + _id] = undefined;
window.native["ClearTimeout"](_id);
}
function setTimeout(func, interval)
{
if (!window.NativeSupportTimeouts)
return;
var _id = window.native["GenerateTimeoutId"](interval);
window.NativeTimeoutObject["" + _id] = func;
return _id;
}
window.native.Call_TimeoutFire = function(_id)
{
if (!window.NativeSupportTimeouts)
return;
var _prop = "" + _id;
if (!window.NativeTimeoutObject[_prop])
return;
window.NativeTimeoutObject[_prop].apply(null);
window.NativeTimeoutObject[_prop] = undefined;
};
function clearInterval(_id)
{
if (!window.NativeSupportTimeouts)
return;
window.NativeTimeoutObject["" + _id] = undefined;
window.native["ClearTimeout"](_id);
}
function setInterval(func, interval)
{
if (!window.NativeSupportTimeouts)
return;
var _intervalFunc = function()
{
func.apply(null);
setTimeout(func, interval);
};
var _id = window.native["GenerateTimeoutId"](interval);
window.NativeTimeoutObject["" + _id] = _intervalFunc;
return _id;
}
window.clearTimeout = clearTimeout;
window.setTimeout = setTimeout;
window.clearInterval = clearInterval;
window.setInterval = setInterval;
var console = {
log : function(param) { window.native.ConsoleLog(param); }
......@@ -488,7 +542,7 @@ window.native.Call_CheckTargetUpdate = function()
};
window.native.Call_Common = function(type, param)
{
return _api.Call_Common();
return _api.Call_Common(type, param);
};
window.native.Call_HR_Tabs = function(arrT, arrP)
......
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