Commit 8bec310c authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53300 954022d7-b5bf-4e40-9824-e11837661b57
parent b9e44e9d
......@@ -125,18 +125,43 @@ native_canvas.prototype =
addEventListener : function()
{
}
},
attr : function()
{
}
};
window["Asc"] = new Object();
var _null_object = new 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 = new Object();
_null_object.documentElement = _null_object;
_null_object.body = _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.remove = function() {};
document.createElement = function(type)
{
......@@ -152,8 +177,15 @@ document.createElement = function(type)
function _return_empty_html_element() { return _null_object; };
document.createDocumentFragment = _return_empty_html_element;
document.getElementsByTagName = function() { return []; };
document.getElementsByTagName = function(tag) {
var ret = [];
if ("head" == tag)
ret.push(_null_object);
return ret;
};
document.insertBefore = function() {};
document.appendChild = function() {};
document.removeChild = function() {};
document.getElementById = function() { return undefined; };
document.createComment = function() { return undefined; };
......@@ -190,11 +222,16 @@ function NativeOpenFile()
_api = new spreadsheet_api("", "");
_api.DocumentUrl = "TeamlabNative";
window.asc_wb = new Workbook(_api.DocumentUrl, _api.handlers, _api);
Asc["editor"] = _api;
_api.User = new Asc["asc_CUser"];
_api.User.asc_setId("TM");
_api.User.asc_setUserName("native");
window.asc_wb = new Workbook(_api.DocumentUrl, _api.handlers, _api);
_api.initGlobalObjects(window.asc_wb);
_api.wbModel = window.asc_wb;
var oBinaryFileReader = new BinaryFileReader(_api.DocumentUrl);
var oBinaryFileReader = new BinaryFileReader(_api.DocumentUrl);
var doc_bin = window.native.GetFileString(g_file_path);
oBinaryFileReader.Read(doc_bin, window.asc_wb);
}
......@@ -209,8 +246,19 @@ function NativeCalculateFile()
}
else
{
window.adjustPrint = new asc_CAdjustPrint();
window.printPagesData = window.asc_wb.calcPagesPrint(window.adjustPrint);
_api.wb = new Asc["WorkbookView"](
_api.wbModel,
_api.controller,
_api.handlers,
_null_object,
_null_object,
_api,
_api.collaborativeEditing,
_api.fontRenderingMode,
_api.options);
window.adjustPrint = new asc_CAdjustPrint();
window.printPagesData = _api.wb.calcPagesPrint(window.adjustPrint);
}
}
......@@ -285,10 +333,21 @@ function GetNativePageBase64(pageIndex)
else
{
// TODO:
var pdf_writer = new CPdfPrinter(_api.wbModel.sUrlPath);
var isEndPrint = window.asc_wb.printSheet(pdf_writer, window.printPagesData);
return pdf_writer.DocumentRenderer.Memory.GetBase64Memory();
if (native_renderer == null)
{
native_renderer = new CPdfPrinter(_api.wbModel.sUrlPath);
native_renderer.DocumentRenderer.Memory = CreateNativeMemoryStream();
native_renderer.DocumentRenderer.VectorMemoryForPrint = CreateNativeMemoryStream();
}
else
{
native_renderer.DocumentRenderer.Memory.ClearNoAttack();
native_renderer.DocumentRenderer.VectorMemoryForPrint.ClearNoAttack();
}
var isEndPrint = _api.wb.printSheet(native_renderer, window.printPagesData);
return native_renderer.DocumentRenderer.Memory;
}
//return native_renderer.Memory.GetBase64Memory();
......@@ -300,9 +359,12 @@ function GetNativeId()
return window.native.GetFileId();
}
function clearTimeout()
{
}
function setTimeout()
{
}
\ No newline at end of file
function clearTimeout() {};
function setTimeout() {};
function clearInterval() {};
function setInterval() {};
window.clearTimeout = clearTimeout;
window.setTimeout = setTimeout;
window.clearInterval = clearInterval;
window.setInterval = setInterval;
\ No newline at end of file
......@@ -35,4 +35,89 @@ function CCacheManager()
{
}
var NATIVE_DOCUMENT_TYPE = "spreadsheet";
\ No newline at end of file
var NATIVE_DOCUMENT_TYPE = "spreadsheet";
var Asc = window["Asc"];
var spreadsheet_api = Asc["spreadsheet_api"];
var asc_CAdjustPrint = Asc["asc_CAdjustPrint"];
$.ready();
$.prototype.clone = function(_clone) { return _clone; };
$.prototype.clean = function() { return []; };
$.prototype.buildFragment = _return_empty_html_element;
$.prototype.init = function(selector, context, rootjQuery)
{
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
return _null_object;
};
Asc["DrawingContext"].prototype.setCanvas = function (_canvas) {
if (!_canvas)
return;
this.canvas = new Array();
this.canvas.push(_canvas);
this.ctx = this.canvas[0].getContext("2d");
if (this.ctx.mozImageSmoothingEnabled) {
this.ctx.mozImageSmoothingEnabled = false;
}
};
Asc["WorkbookView"].prototype.init = function (fontRenderingMode) {
var self = this;
var asc_DC = Asc["DrawingContext"];
var asc_CE = Asc["CellEditor"];
var asc_SR = Asc["StringRender"];
// Init font managers rendering
// c_oAscFontRenderingModeType.hintingAndSubpixeling
this.setFontRenderingMode(fontRenderingMode, /*isInit*/true);
this.canvas = new Array(); this.canvas.push(document.createElement("canvas"));
this.canvasOverlay = new Array(); this.canvasOverlay.push(document.createElement("canvas"));
this.buffers.main = asc_DC({canvas: this.canvas[0], units: 1/*pt*/,
fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.buffers.overlay = asc_DC({canvas: this.canvasOverlay[0], units: 1/*pt*/,
fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.buffers.overlay.ctx.isOverlay = true; // _activateOverlayCtx / _deactivateOverlayCtx
this.drawingCtx = this.buffers.main;
this.overlayCtx = this.buffers.overlay;
// Shapes
this.buffers.shapeCtx = new CGraphics();
this.buffers.shapeCtx.init(this.drawingCtx.ctx, this.drawingCtx.getWidth(0), this.drawingCtx.getHeight(0), this.drawingCtx.getWidth(3), this.drawingCtx.getHeight(3));
this.buffers.shapeCtx.m_oFontManager = this.fmgrGraphics[2];
this.buffers.shapeOverlayCtx = new CGraphics();
this.buffers.shapeOverlayCtx.init(this.overlayCtx.ctx, this.overlayCtx.getWidth(0), this.overlayCtx.getHeight(0), this.overlayCtx.getWidth(3), this.overlayCtx.getHeight(3));
this.buffers.shapeOverlayCtx.m_oFontManager = this.fmgrGraphics[2];
this.drawingCtxCharts = asc_DC({units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.stringRender = asc_SR(this.buffers.main);
this.stringRender.setDefaultFont(this.defaultFont);
// 100%
this._calcMaxDigitWidth();
this.cellEditor = null;
this.clipboard.Api = this.Api;
this.clipboard.init();
return this;
};
\ No newline at end of file
......@@ -200,7 +200,7 @@
<Tool
Name="VCPostBuildEventTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;&#x0D;&#x0A;copy $(TargetPath) ..\Redist\DoctRenderer.dll"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;&#x0D;&#x0A;copy $(TargetPath) ..\Redist\DoctRenderer.dll&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
......
This diff is collapsed.
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