Commit 7ab34afd authored by Alexey.Golubev's avatar Alexey.Golubev Committed by Alexander.Trofimov

Изменения для корректной работы объединения документов.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47886 954022d7-b5bf-4e40-9824-e11837661b57
parent 1eec72a5
......@@ -2911,25 +2911,25 @@ function DrawingObjects() {
// Реальное смещение по высоте
_t.getRealTopOffset = function() {
var val = _t.worksheet.getCellTop(_t.from.row, 0) + mmToPx(_t.from.rowOff);
return Asc.round(val);
return window["Asc"].round(val);
}
// Реальное смещение по ширине
_t.getRealLeftOffset = function() {
var val = _t.worksheet.getCellLeft(_t.from.col, 0) + mmToPx(_t.from.colOff);
return Asc.round(val);
return window["Asc"].round(val);
}
// Ширина по координатам
_t.getWidthFromTo = function(withoutRound) {
var val = _t.worksheet.getCellLeft(_t.to.col, 0) + mmToPx(_t.to.colOff) - _t.worksheet.getCellLeft(_t.from.col, 0) - mmToPx(_t.from.colOff);
return withoutRound ? val : Asc.round(val);
return withoutRound ? val : window["Asc"].round(val);
}
// Высота по координатам
_t.getHeightFromTo = function(withoutRound) {
var val = _t.worksheet.getCellTop(_t.to.row, 0) + mmToPx(_t.to.rowOff) - _t.worksheet.getCellTop(_t.from.row, 0) - mmToPx(_t.from.rowOff);
return withoutRound ? val : Asc.round(val);
return withoutRound ? val : window["Asc"].round(val);
}
// Видимая ширина при скролах
......@@ -2970,14 +2970,14 @@ function DrawingObjects() {
_t.getInnerOffsetTop = function() {
var fvr = _t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0);
var off = _t.getRealTopOffset() - fvr;
return (off > 0) ? 0 : Asc.round(Math.abs(off) * _t.getHeightCoeff());
return (off > 0) ? 0 : window["Asc"].round(Math.abs(off) * _t.getHeightCoeff());
}
// смещение по ширине внутри объекта
_t.getInnerOffsetLeft = function() {
var fvc = _t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0);
var off = _t.getRealLeftOffset() - fvc;
return (off > 0) ? 0 : Asc.round(Math.abs(off) * _t.getWidthCoeff());
return (off > 0) ? 0 : window["Asc"].round(Math.abs(off) * _t.getWidthCoeff());
}
// коэффициент по ширине если несоответствие с реальным размером
......@@ -4222,18 +4222,18 @@ function DrawingObjects() {
var index = _this.getSelectedDrawingObjectIndex();
if (index >= 0) {
if (aObjects[index].isChart())
return new Asc.asc_CChart(aObjects[index].chart);
return new window["Asc"].asc_CChart(aObjects[index].chart);
else null;
}
else {
// Check iframe chart editor
for (var i = 0; i < _this.countDrawingObjects(); i++) {
if ( aObjects[i].isChart() && aObjects[i].chart.bChartEditor )
return new Asc.asc_CChart(aObjects[i].chart);
return new window["Asc"].asc_CChart(aObjects[i].chart);
}
// New chart object
var chart = new Asc.asc_CChart(_this.createDrawingObject().chart);
var chart = new window["Asc"].asc_CChart(_this.createDrawingObject().chart);
return chart;
}
}
......@@ -4533,7 +4533,7 @@ function DrawingObjects() {
return;
var BB = obj.chart.range.intervalObject.getBBox0(),
range = Asc.Range(BB.c1,BB.r1,BB.c2,BB.r2,true);
range = window["Asc"].Range(BB.c1,BB.r1,BB.c2,BB.r2,true);
worksheet.arrActiveChartsRanges.push(range);
worksheet.isChartAreaEditMode = true;
......@@ -5299,7 +5299,7 @@ function DrawingObjects() {
}
function ascCvtRatio(fromUnits, toUnits) {
return Asc.getCvtRatio( fromUnits, toUnits, drawingCtx.getPPIX() );
return window["Asc"].getCvtRatio( fromUnits, toUnits, drawingCtx.getPPIX() );
}
function setCanvasZIndex(canvas, value) {
......@@ -5318,7 +5318,7 @@ function DrawingObjects() {
}
function pxToPt(val) {
var tmp = Asc.round(val) * ascCvtRatio(0, 1);
var tmp = window["Asc"].round(val) * ascCvtRatio(0, 1);
return tmp > 0 ? tmp : 0;
}
......
......@@ -2072,7 +2072,7 @@ function getFontProperties(type)
var xAxisTitle = bar._xAxisTitle;
var yAxisTitle = bar._yAxisTitle;
var chartTitle = bar._chartTitle;
var fontProp = Asc.FontProperties;
var fontProp = window["Asc"].FontProperties;
if(!fontProp)
fontProp = FontProperties;
switch (type) {
......
......@@ -1504,7 +1504,7 @@
{
scale = drwContext.scaleFactor;
drwContext.setCanvas(bar.canvas);
var fontProp = Asc.FontProperties;
var fontProp = window["Asc"].FontProperties;
if(!fontProp)
fontProp = FontProperties;
......@@ -1754,7 +1754,7 @@
var textHeight = 0;
var font = textOptions.font;
var size = textOptions.size;
var asc = Asc;
var asc = window["Asc"];
if(!angle)
angle = 90;
......
/* docscoapicommon.js * * Author: Alexander.Trofimov * Date: 09.11.12 */( /** * @param {jQuery} $ * @param {Window} window * @param {undefined} undefined */ function ($, window, undefined) { /* * Import * ----------------------------------------------------------------------------- */ var asc = window["Asc"] ? window["Asc"] : (window["Asc"] = {}); var prot; /** * Класс user для совместного редактирования/просмотра документа * ----------------------------------------------------------------------------- * * @constructor * @memberOf Asc */ function asc_CUser () { if ( !(this instanceof asc_CUser) ) { return new asc_CUser(); } this.id = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.isViewerMode = false; // режим просмотра или нет this.state = undefined; // состояние (true - подключен, false - отключился) return this; } asc_CUser.prototype = { constructor: asc_CUser, asc_getId: function () { return this.id; }, asc_getUserName: function () { return this.userName; }, asc_getIsViewerMode: function () { return this.isViewerMode; }, asc_getState: function () { return this.state; }, asc_setId: function (val) { this.id = val; }, asc_setUserName: function (val) { this.userName = val; }, asc_setIsViewerMode: function (val) { this.isViewerMode = val; }, asc_setState: function (val) { this.state = val; } }; /* * Export * ----------------------------------------------------------------------------- */ window["Asc"]["asc_CUser"] = window["Asc"].asc_CUser = asc_CUser; prot = asc_CUser.prototype; prot["asc_getId"] = prot.asc_getId; prot["asc_getUserName"] = prot.asc_getUserName; prot["asc_getIsViewerMode"] = prot.asc_getIsViewerMode; prot["asc_getState"] = prot.asc_getState; prot["asc_setId"] = prot.asc_setId; prot["asc_setUserName"] = prot.asc_setUserName; prot["asc_setIsViewerMode"] = prot.asc_setIsViewerMode; prot["asc_setState"] = prot.asc_setState; } )(jQuery, window);
\ No newline at end of file
/* docscoapicommon.js * * Author: Alexander.Trofimov * Date: 09.11.12 */( /** * @param {Window} window * @param {undefined} undefined */ function (window, undefined) { /* * Import * ----------------------------------------------------------------------------- */ var asc = window["Asc"] ? window["Asc"] : (window["Asc"] = {}); var prot; /** * Класс user для совместного редактирования/просмотра документа * ----------------------------------------------------------------------------- * * @constructor * @memberOf Asc */ function asc_CUser () { if ( !(this instanceof asc_CUser) ) { return new asc_CUser(); } this.id = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.isViewerMode = false; // режим просмотра или нет this.state = undefined; // состояние (true - подключен, false - отключился) return this; } asc_CUser.prototype = { constructor: asc_CUser, asc_getId: function () { return this.id; }, asc_getUserName: function () { return this.userName; }, asc_getIsViewerMode: function () { return this.isViewerMode; }, asc_getState: function () { return this.state; }, asc_setId: function (val) { this.id = val; }, asc_setUserName: function (val) { this.userName = val; }, asc_setIsViewerMode: function (val) { this.isViewerMode = val; }, asc_setState: function (val) { this.state = val; } }; /* * Export * ----------------------------------------------------------------------------- */ window["Asc"]["asc_CUser"] = window["Asc"].asc_CUser = asc_CUser; prot = asc_CUser.prototype; prot["asc_getId"] = prot.asc_getId; prot["asc_getUserName"] = prot.asc_getUserName; prot["asc_getIsViewerMode"] = prot.asc_getIsViewerMode; prot["asc_getState"] = prot.asc_getState; prot["asc_setId"] = prot.asc_setId; prot["asc_setUserName"] = prot.asc_setUserName; prot["asc_setIsViewerMode"] = prot.asc_setIsViewerMode; prot["asc_setState"] = prot.asc_setState; } )(window);
\ No newline at end of file
......
......@@ -4,11 +4,10 @@
* Date: 24.06.13
*/
( /**
* @param {jQuery} $
* @param {Window} window
* @param {undefined} undefined
*/
function ($, window, undefined) {
function (window, undefined) {
/*
* Import
* -----------------------------------------------------------------------------
......@@ -55,4 +54,4 @@
prot["asc_setId"] = prot.asc_setId;
prot["asc_setName"] = prot.asc_setName;
}
)(jQuery, window);
\ No newline at end of file
)(window);
\ No newline at end of file
......@@ -1283,5 +1283,5 @@ var g_oLcidIdToNameMap = new Object();
window["CDetectFontUse"] = CDetectFontUse;
})(window.document);
var g_font_detector = new CDetectFontUse();
var g_font_detector = new window.CDetectFontUse();
g_font_detector.Init();
\ No newline at end of file
......@@ -5,6 +5,9 @@ function asc_docs_api()
{
editor = this;
}
if (editor)
window.editor = editor;
this.WordControl = new CEditorPage(this);
this.WordControl.m_oLogicDocument = new CDocument(this.WordControl.m_oDrawingDocument);
this.WordControl.m_oDrawingDocument.m_oLogicDocument = this.WordControl.m_oLogicDocument;
......
var Canvas = require('canvas');
var Image = Canvas.Image;
var jsdom = require("jsdom").jsdom;
var document = jsdom(null, null);
var window = document.createWindow();
var Image = window.Image;
var navigator = require('navigator');
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var $ = require('jQuery');
var jq = require('jQuery').create();
var jQuery = require('jQuery').create(window);
/*var window = {chrome:1};
window.postMessage = function(){};
window.addEventListener = function(){};
function XMLHttpRequest()
{
return undefined;
}
function Image()
{
this.onload = null;
}
function FT_Memory()
{
this.Alloc = function(size)
{
var p = { data: new Uint8Array(size), size : size };
p.obj = p.data;
return p;
}
}
var g_memory = new FT_Memory();
var charA = "A".charCodeAt(0);
var charZ = "Z".charCodeAt(0);
var chara = "a".charCodeAt(0);
var charz = "z".charCodeAt(0);
var char0 = "0".charCodeAt(0);
var char9 = "9".charCodeAt(0);
var charp = "+".charCodeAt(0);
var chars = "/".charCodeAt(0);
function DecodeBase64Char(ch)
{
if (ch >= charA && ch <= charZ)
return ch - charA + 0;
if (ch >= chara && ch <= charz)
return ch - chara + 26;
if (ch >= char0 && ch <= char9)
return ch - char0 + 52;
if (ch == charp)
return 62;
if (ch == chars)
return 63;
return -1;
}
var g_stringBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function Base64Encode(srcData, nSrcLen)
{
var nWritten = 0;
var nLen1 = (parseInt(nSrcLen / 3) * 4);
var nLen2 = parseInt(nLen1 / 76);
var nLen3 = 19;
var srcInd = 0;
var dstStr = "";
for (var i=0; i<=nLen2; i++)
{
if (i == nLen2)
nLen3 = parseInt((nLen1%76)/4);
for (var j=0;j<nLen3;j++)
{
var dwCurr = 0;
for (var n=0; n<3; n++)
{
dwCurr |= srcData[srcInd++];
dwCurr <<= 8;
}
for (var k=0; k<4; k++)
{
var b = (dwCurr>>>26)&0xFF;
dstStr += g_stringBase64[b];
dwCurr <<= 6;
dwCurr &= 0xFFFFFFFF;
}
}
}
nLen2 = (nSrcLen%3 != 0) ? (nSrcLen%3 + 1) : 0;
if (nLen2)
{
var dwCurr = 0;
for (var n=0; n<3; n++)
{
if (n<(nSrcLen%3))
dwCurr |= srcData[srcInd++];
dwCurr <<= 8;
}
for (var k=0; k<nLen2; k++)
{
var b = (dwCurr>>>26)&0xFF;
dstStr += g_stringBase64[b];
dwCurr <<= 6;
}
nLen3 = (nLen2 != 0) ? 4-nLen2 : 0;
for (var j=0; j<nLen3; j++)
{
dstStr += '=';
}
}
return dstStr;
}
function CMemory()
{
this.Init = function()
{
this.len = 1024*1024*5;
this.data = new Uint8Array(this.len);
this.pos = 0;
}
this.ImData = null;
this.data = null;
this.len = 0;
this.pos = 0;
this.Init();
this.CheckSize = function(count)
{
if (this.pos + count >= this.len)
{
var oldData = this.data;
var oldPos = this.pos;
this.len *= 2;
this.data = new Uint8Array(this.len);
var newData = this.data;
for (var i=0;i<this.pos;i++)
newData[i]=oldData[i];
}
}
this.GetBase64Memory = function()
{
return Base64Encode(this.data,this.pos);
}
this.GetCurPosition = function()
{
return this.pos;
}
this.Seek = function(nPos)
{
this.pos = nPos;
}
this.Skip = function(nDif)
{
this.pos += nDif;
}
this.WriteBool = function(val)
{
this.CheckSize(1);
if(false == val)
this.data[this.pos++] = 0;
else
this.data[this.pos++] = 1;
}
this.WriteByte = function(val)
{
this.CheckSize(1);
this.data[this.pos++] = val;
}
this.WriteLong = function(val)
{
this.CheckSize(4);
this.data[this.pos++] = (val)&0xFF;
this.data[this.pos++] = (val >>> 8)&0xFF;
this.data[this.pos++] = (val >>> 16)&0xFF;
this.data[this.pos++] = (val >>> 24)&0xFF;
}
this.WriteDouble = function(val)
{
this.CheckSize(4);
var lval = parseInt(val * 100000) & 0xFFFFFFFF; // .
this.data[this.pos++] = (lval)&0xFF;
this.data[this.pos++] = (lval >>> 8)&0xFF;
this.data[this.pos++] = (lval >>> 16)&0xFF;
this.data[this.pos++] = (lval >>> 24)&0xFF;
}
this.WriteString = function(text)
{
var count = text.length&0xFFFF;
this.CheckSize(count+2);
this.data[this.pos++] = count&0xFF;
this.data[this.pos++] = (count >>> 8)&0xFF;
for (var i=0;i<count;i++)
{
var c = text.charCodeAt(i) & 0xFFFF;
this.data[this.pos++] = c&0xFF;
this.data[this.pos++] = (c >>> 8)&0xFF;
}
}
this.WriteString2 = function(text)
{
var count = text.length & 0x7FFFFFFF
var countWrite = 2 * count;
this.WriteLong(countWrite);
this.CheckSize(countWrite);
for (var i=0;i<count;i++)
{
var c = text.charCodeAt(i) & 0xFFFF;
this.data[this.pos++] = c&0xFF;
this.data[this.pos++] = (c >>> 8)&0xFF;
}
}
}
var FontStyle =
{
FontStyleRegular: 0,
FontStyleBold: 1,
FontStyleItalic: 2,
FontStyleBoldItalic: 3,
FontStyleUnderline: 4,
FontStyleStrikeout: 8
};*/
\ No newline at end of file
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