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

native

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53341 954022d7-b5bf-4e40-9824-e11837661b57
parent 90040a58
...@@ -139,3 +139,5 @@ ...@@ -139,3 +139,5 @@
prot["get_hex"] = prot.get_hex; prot["get_hex"] = prot.get_hex;
} }
)(window); )(window);
var CColor = window["CColor"];
\ No newline at end of file
...@@ -1270,6 +1270,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1270,6 +1270,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}, },
_loadFonts: function (fonts, callback) { _loadFonts: function (fonts, callback) {
if (window.NATIVE_EDITOR_ENJINE)
return callback();
this.asyncMethodCallback = callback; this.asyncMethodCallback = callback;
this.FontLoader.LoadDocumentFonts2(fonts.map(function(f){return {name: f};})); this.FontLoader.LoadDocumentFonts2(fonts.map(function(f){return {name: f};}));
}, },
...@@ -3247,6 +3250,102 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3247,6 +3250,102 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
case c_oAscServerError.Unknown : nRes = c_oAscError.ID.Unknown;break; case c_oAscServerError.Unknown : nRes = c_oAscError.ID.Unknown;break;
} }
return nRes; return nRes;
},
asc_nativeOpenFile : function(base64File)
{
this.DocumentUrl = "TeamlabNative";
var Asc = asc;
asc["editor"] = this;
this.User = new asc_user();
this.User.asc_setId("TM");
this.User.asc_setUserName("native");
this.wbModel = new Workbook(this.DocumentUrl, this.handlers, this);
this.initGlobalObjects(this.wbModel);
var oBinaryFileReader = new BinaryFileReader(this.DocumentUrl);
oBinaryFileReader.Read(base64File, this.wbModel);
this._coAuthoringInit();
this.wb = new asc["WorkbookView"](
this.wbModel,
this.controller,
this.handlers,
window._null_object,
window._null_object,
this,
this.collaborativeEditing,
this.fontRenderingMode,
this.options);
},
asc_nativeCalculateFile : function()
{
},
asc_nativeApplyChanges : function(changes)
{
this.CoAuthoringApi.onSaveChanges(changes, false);
this.collaborativeEditing.applyChanges();
},
asc_nativeGetFile : function()
{
this.wb._initCommentsToSave();
var oBinaryFileWriter = new BinaryFileWriter(this.wbModel);
return oBinaryFileWriter.Write();
},
asc_nativeCheckPdfRenderer : function(_memory1, _memory2)
{
if (undefined == _memory1.pos)
{
_memory1.pos = _memory1["pos"];
_memory1.Copy = _memory1["Copy"];
_memory1.ClearNoAttack = _memory1["ClearNoAttack"];
_memory1.WriteByte = _memory1["WriteByte"];
_memory1.WriteBool = _memory1["WriteBool"];
_memory1.WriteLong = _memory1["WriteLong"];
_memory1.WriteDouble = _memory1["WriteDouble"];
_memory1.WriteString = _memory1["WriteString"];
_memory1.WriteString2 = _memory1["WriteString2"];
_memory2.pos = _memory1["pos"];
_memory2.Copy = _memory1["Copy"];
_memory2.ClearNoAttack = _memory1["ClearNoAttack"];
_memory2.WriteByte = _memory1["WriteByte"];
_memory2.WriteBool = _memory1["WriteBool"];
_memory2.WriteLong = _memory1["WriteLong"];
_memory2.WriteDouble = _memory1["WriteDouble"];
_memory2.WriteString = _memory1["WriteString"];
_memory2.WriteString2 = _memory1["WriteString2"];
}
var _printer = new CPdfPrinter(this.wbModel.sUrlPath);
_printer.DocumentRenderer.Memory = _memory1;
_printer.DocumentRenderer.VectorMemoryForPrint = _memory2;
return _printer;
},
asc_nativeCalculate : function()
{
},
asc_nativePrint : function(_printer, _page)
{
var _adjustPrint = new asc_CAdjustPrint();
var _printPagesData = this.wb.calcPagesPrint(_adjustPrint);
var isEndPrint = _api.wb.printSheet(_printer, _printPagesData);
return _printer.DocumentRenderer.Memory;
},
asc_nativePrintPagesCount : function()
{
return 1;
} }
}; };
...@@ -3556,5 +3655,15 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3556,5 +3655,15 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_openNewDocument"] = prot.asc_openNewDocument; prot["asc_openNewDocument"] = prot.asc_openNewDocument;
prot["asc_loadDocumentFromDisk"] = prot. asc_loadDocumentFromDisk; prot["asc_loadDocumentFromDisk"] = prot. asc_loadDocumentFromDisk;
// native
prot["asc_nativeOpenFile"] = prot.asc_nativeOpenFile;
prot["asc_nativeCalculateFile"] = prot.asc_nativeCalculateFile;
prot["asc_nativeApplyChanges"] = prot.asc_nativeApplyChanges;
prot["asc_nativeGetFile"] = prot.asc_nativeGetFile;
prot["asc_nativeCheckPdfRenderer"] = prot.asc_nativeCheckPdfRenderer;
prot["asc_nativeCalculate"] = prot.asc_nativeCalculate;
prot["asc_nativePrint"] = prot.asc_nativePrint;
prot["asc_nativePrintPagesCount"] = prot.asc_nativePrintPagesCount;
} }
)(jQuery, window); )(jQuery, window);
...@@ -221,6 +221,9 @@ ...@@ -221,6 +221,9 @@
/** @param whichSB {Number} Scroll bar to reinit (1=vertical, 2=horizontal) */ /** @param whichSB {Number} Scroll bar to reinit (1=vertical, 2=horizontal) */
reinitializeScroll: function (whichSB) { reinitializeScroll: function (whichSB) {
if (window.NATIVE_EDITOR_ENJINE)
return;
var self = this, var self = this,
opt = this.settings, opt = this.settings,
ws = self.view.getWorksheet(), ws = self.view.getWorksheet(),
......
...@@ -127,6 +127,8 @@ ...@@ -127,6 +127,8 @@
style0.innerHTML = ".block_elem { position:absolute;padding:0;margin:0; }"; style0.innerHTML = ".block_elem { position:absolute;padding:0;margin:0; }";
_head.appendChild(style0); _head.appendChild(style0);
if (!window.NATIVE_EDITOR_ENJINE)
{
// create canvas // create canvas
var outer = this.element.find("#ws-canvas-outer"); var outer = this.element.find("#ws-canvas-outer");
if (outer.length < 1) { if (outer.length < 1) {
...@@ -140,6 +142,12 @@ ...@@ -140,6 +142,12 @@
this.canvasOverlay = this.element.find("#ws-canvas-overlay") this.canvasOverlay = this.element.find("#ws-canvas-overlay")
.attr("width", outer.width()) .attr("width", outer.width())
.attr("height", outer.height()); .attr("height", outer.height());
}
else
{
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*/, this.buffers.main = asc_DC({canvas: this.canvas[0], units: 1/*pt*/,
fmgrGraphics: this.fmgrGraphics, font: this.m_oFont}); fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
...@@ -167,6 +175,8 @@ ...@@ -167,6 +175,8 @@
// Мерить нужно только со 100% и один раз для всего документа // Мерить нужно только со 100% и один раз для всего документа
this._calcMaxDigitWidth(); this._calcMaxDigitWidth();
if (!window.NATIVE_EDITOR_ENJINE)
{
// initialize events controller // initialize events controller
this.controller.init(this, this.element, this.canvasOverlay, /*handlers*/{ this.controller.init(this, this.element, this.canvasOverlay, /*handlers*/{
"resize": function () {self.resize.apply(self, arguments);}, "resize": function () {self.resize.apply(self, arguments);},
...@@ -388,6 +398,7 @@ ...@@ -388,6 +398,7 @@
/*settings*/{ /*settings*/{
font: this.defaultFont font: this.defaultFont
}); });
}
this.clipboard.Api = this.Api; this.clipboard.Api = this.Api;
this.clipboard.init(); this.clipboard.init();
......
...@@ -216,6 +216,15 @@ function CFontFileLoader(id) ...@@ -216,6 +216,15 @@ function CFontFileLoader(id)
xhr.send(null); xhr.send(null);
} }
this.LoadFontNative = function()
{
var __font_data_idx = g_fonts_streams.length;
var _data = window["native"].GetFontBinary(this.Id);
g_fonts_streams[__font_data_idx] = new FT_Stream(_data, _data.length);
this.SetStreamIndex(__font_data_idx);
this.Status = 0;
}
} }
CFontFileLoader.prototype.SetStreamIndex = function(index) CFontFileLoader.prototype.SetStreamIndex = function(index)
......
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