Commit 85e1c068 authored by Alexey.Musinov's avatar Alexey.Musinov

[mobile] сборка скриптов для таблиц

parent a1013b41
......@@ -169,9 +169,35 @@
"../common/Local/common.js",
"../cell/Local/api.js"
],
"mobile_banners": [],
"exclude_mobile": [],
"dst": "../cell/sdk-all.js",
"mobile": [
"../../web-apps/vendor/xregexp/xregexp-all-min.js",
"../../web-apps/vendor/underscore/underscore-min.js",
"../common/Native/jquery_native.js",
"../common/Native/Wrappers/memory.js",
"../common/Native/Wrappers/TextMeasurerWrapper.js",
"../common/Native/Wrappers/DrawingStream.js",
"../cell/native/DrawingContext.js",
"../cell/native/Graphics.js",
"../cell/native/Overlay.js",
"../common/Native/Wrappers/ShapeDrawer.js",
"../cell/native/DrawingDocument.js"
],
"mobile_banners": [
"../cell/native/native.js"
],
"exclude_mobile": [
"../common/Overlay.js",
"../common/Controls.js",
"../cell/graphics/DrawingContext.js",
"../cell/model/DrawingObjects/ShapeDrawer.js",
"../cell/model/DrawingObjects/DrawingDocument.js",
"../common/FontsFreeType/font_engine.js",
"../common/FontsFreeType/FontFile.js",
"../common/FontsFreeType/FontManager.js",
"../common/FontsFreeType/TextMeasurer.js",
"../cell/model/DrawingObjects/Graphics.js"
],
"dst": "../cell/script.bin",
"externs": [
"../common/Build/Externs.js",
"../../web-apps/vendor/jquery/jquery.min.js",
......
......@@ -29,7 +29,7 @@
* Author: Dmitry.Sokolov@avsmedia.net
* Date: Nov 21, 2011
*/
(function (/** jQuery */$, /** Window */window, undefined) {
(function (/** Window */window, undefined) {
/*
* Import
......@@ -37,8 +37,6 @@
*/
var asc = window["Asc"];
var asc_round = asc.round;
var asc_floor = asc.floor;
function colorObjToAscColor(color) {
var oRes = null;
......@@ -592,10 +590,10 @@
DrawingContext.prototype.changeZoom = function (factor) {
if (factor <= 0) {throw "Scale factor must be >= 0";}
factor = asc_round(factor * 1000) / 1000;
factor = Asc.round(factor * 1000) / 1000;
this.ppiX = asc_round(this.ppiX / this.scaleFactor * factor * 1000) / 1000;
this.ppiY = asc_round(this.ppiY / this.scaleFactor * factor * 1000) / 1000;
this.ppiX = Asc.round(this.ppiX / this.scaleFactor * factor * 1000) / 1000;
this.ppiY = Asc.round(this.ppiY / this.scaleFactor * factor * 1000) / 1000;
this.scaleFactor = factor;
// reinitialize
......@@ -611,8 +609,8 @@
* @param {Number} height New height in current units
*/
DrawingContext.prototype.resetSize = function (width, height) {
var w = asc_round( width * getCvtRatio(this.units, 0/*px*/, this.ppiX) ),
h = asc_round( height * getCvtRatio(this.units, 0/*px*/, this.ppiY) );
var w = Asc.round( width * getCvtRatio(this.units, 0/*px*/, this.ppiX) ),
h = Asc.round( height * getCvtRatio(this.units, 0/*px*/, this.ppiY) );
if (w !== this.canvas.width) {
this.canvas.width = w;
}
......@@ -628,8 +626,8 @@
* @param {Number} height New height in current units
*/
DrawingContext.prototype.expand = function (width, height) {
var w = asc_round( width * getCvtRatio(this.units, 0/*px*/, this.ppiX) ),
h = asc_round( height * getCvtRatio(this.units, 0/*px*/, this.ppiY) );
var w = Asc.round( width * getCvtRatio(this.units, 0/*px*/, this.ppiX) ),
h = Asc.round( height * getCvtRatio(this.units, 0/*px*/, this.ppiY) );
if (w > this.canvas.width) {
this.canvas.width = w;
}
......@@ -849,7 +847,7 @@
res.descender = factor * d;
res.lineGap = factor * (fm.m_lLineHeight - fm.m_lAscender - d);
var face = AscCommon.g_oTextMeasurer.Measurer['GetFace']();
var face = g_oTextMeasurer.Measurer['GetFace']();
res.nat_scale = face[0];
res.nat_y1 = face[1];
res.nat_y2 = face[2];
......@@ -897,7 +895,7 @@
if (_info.SrcBold) flag |= 0x04;
if (_info.SrcItalic) flag |= 0x08;
napi_fontInfo = AscCommon.g_oTextMeasurer.Measurer["LoadFont"](_info.Path, _info.FaceIndex, this.font.FontSize, flag);
napi_fontInfo = g_oTextMeasurer.Measurer["LoadFont"](_info.Path, _info.FaceIndex, this.font.FontSize, flag);
this.napi_fmt[1].m_lUnits_Per_Em = napi_fontInfo[3];
this.napi_fmt[1].m_lAscender = napi_fontInfo[0];
......@@ -922,7 +920,7 @@
if (_info.SrcBold) flag |= 0x04;
if (_info.SrcItalic) flag |= 0x08;
napi_fontInfo = AscCommon.g_oTextMeasurer.Measurer["LoadFont"](_info.Path, _info.FaceIndex, this.font.FontSize, flag);
napi_fontInfo = g_oTextMeasurer.Measurer["LoadFont"](_info.Path, _info.FaceIndex, this.font.FontSize, flag);
this.nctx["PD_LoadFont"](_info.Path, _info.FaceIndex, this.font.FontSize, flag);
......@@ -982,7 +980,7 @@
r = getCvtRatio(0/*px*/, units >= 0 && units <=3 ? units : this.units, this.ppiX);
for (var tmp, w = 0, w2 = 0, i = 0; i < text.length; ++i) {
var bounds = AscCommon.g_oTextMeasurer.Measurer["GetDrawingBox"](text.charCodeAt(i));
var bounds = g_oTextMeasurer.Measurer["GetDrawingBox"](text.charCodeAt(i));
tmp = {
fAdvanceX: bounds[0],
oBBox: {
......@@ -993,7 +991,7 @@
}
};
w += asc_round(tmp.fAdvanceX); // asc_round - убрали что бы текст не скакал
w += Asc.round(tmp.fAdvanceX); // asc_round - убрали что бы текст не скакал
}
w2 = w - tmp.fAdvanceX + tmp.oBBox.fMaxX - tmp.oBBox.fMinX + 1;
return this._calcTextMetrics(w * r, w2 * r, fm, r);
......@@ -1005,8 +1003,8 @@
if ( !(nW > 0 && nH > 0) ) {return;}
var nX = asc_floor(fmgr.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX);
var nY = asc_floor(fmgr.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY);
var nX = Asc.floor(fmgr.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX);
var nY = Asc.floor(fmgr.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY);
var _r = this.fillColor.r;
var _g = this.fillColor.g;
......@@ -1059,7 +1057,7 @@
this.nctx["PD_FillText"](_x, _y, lUnicode);
_x += asc_round(AscCommon.g_oTextMeasurer.Measurer["MeasureChar"](lUnicode));
_x += Asc.round(g_oTextMeasurer.Measurer["MeasureChar"](lUnicode));
}
return this;
......@@ -1307,10 +1305,10 @@
_x = this._mft.transformPointX(x, y),
_y = this._mft.transformPointY(x, y);
return {
x: asc_round(_x),
y: asc_round(_y),
w: wh ? asc_round(this._mft.transformPointX(x2, y2) - _x) : undefined,
h: wh ? asc_round(this._mft.transformPointY(x2, y2) - _y) : undefined
x: Asc.round(_x),
y: Asc.round(_y),
w: wh ? Asc.round(this._mft.transformPointX(x2, y2) - _x) : undefined,
h: wh ? Asc.round(this._mft.transformPointY(x2, y2) - _y) : undefined
};
};
......@@ -1355,4 +1353,4 @@
window["Asc"].DrawingContext = DrawingContext;
window["Asc"].Matrix = Matrix;
})(jQuery, window);
})(window);
......@@ -30,7 +30,7 @@ var g_dDpiY = 96.0;
var g_dKoef_mm_to_pix = g_dDpiX / 25.4;
var g_dKoef_pix_to_mm = 25.4 / g_dDpiX;
var g_fontManager = new AscFonts.CFontManager();
var g_fontManager = new window['AscFonts'].CFontManager();
g_fontManager.Initialize(true);
function SetHintsProps(bIsHinting, bIsSubpixHinting)
......@@ -164,6 +164,243 @@ function CTableOutline(Table, PageNum, X, Y, W, H)
this.H = H;
}
function CTextMeasurer()
{
this.m_oManager = new window['AscFonts'].CFontManager();
this.m_oFont = null;
// RFonts
this.m_oTextPr = null;
this.m_oLastFont = new CFontSetup();
this.LastFontOriginInfo = { Name : "", Replace : null };
this.Init = function()
{
this.m_oManager.Initialize();
};
this.SetFont = function(font)
{
if (!font)
return;
this.m_oFont = font;
var bItalic = true === font.Italic;
var bBold = true === font.Bold;
var oFontStyle = FontStyle.FontStyleRegular;
if ( !bItalic && bBold )
oFontStyle = FontStyle.FontStyleBold;
else if ( bItalic && !bBold )
oFontStyle = FontStyle.FontStyleItalic;
else if ( bItalic && bBold )
oFontStyle = FontStyle.FontStyleBoldItalic;
var _lastSetUp = this.m_oLastFont;
if (_lastSetUp.SetUpName != font.FontFamily.Name || _lastSetUp.SetUpSize != font.FontSize || _lastSetUp.SetUpStyle != oFontStyle)
{
_lastSetUp.SetUpName = font.FontFamily.Name;
_lastSetUp.SetUpSize = font.FontSize;
_lastSetUp.SetUpStyle = oFontStyle;
g_fontApplication.LoadFont(_lastSetUp.SetUpName, window.g_font_loader, this.m_oManager, _lastSetUp.SetUpSize, _lastSetUp.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo);
}
};
this.SetFontInternal = function(_name, _size, _style)
{
var _lastSetUp = this.m_oLastFont;
if (_lastSetUp.SetUpName != _name || _lastSetUp.SetUpSize != _size || _lastSetUp.SetUpStyle != _style)
{
_lastSetUp.SetUpName = _name;
_lastSetUp.SetUpSize = _size;
_lastSetUp.SetUpStyle = _style;
g_fontApplication.LoadFont(_lastSetUp.SetUpName, window.g_font_loader, this.m_oManager, _lastSetUp.SetUpSize, _lastSetUp.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo);
}
};
this.SetTextPr = function(textPr, theme)
{
this.m_oTextPr = textPr.Copy();
this.theme = theme;
var FontScheme = theme.themeElements.fontScheme;
this.m_oTextPr.RFonts.Ascii = {Name: FontScheme.checkFont(this.m_oTextPr.RFonts.Ascii.Name), Index: -1};
this.m_oTextPr.RFonts.EastAsia = {Name: FontScheme.checkFont(this.m_oTextPr.RFonts.EastAsia.Name), Index: -1};
this.m_oTextPr.RFonts.HAnsi = {Name: FontScheme.checkFont(this.m_oTextPr.RFonts.HAnsi.Name), Index: -1};
this.m_oTextPr.RFonts.CS = {Name: FontScheme.checkFont(this.m_oTextPr.RFonts.CS.Name), Index: -1};
};
this.SetFontSlot = function(slot, fontSizeKoef)
{
var _rfonts = this.m_oTextPr.RFonts;
var _lastFont = this.m_oLastFont;
switch (slot)
{
case fontslot_ASCII:
{
_lastFont.Name = _rfonts.Ascii.Name;
_lastFont.Index = _rfonts.Ascii.Index;
_lastFont.Size = this.m_oTextPr.FontSize;
_lastFont.Bold = this.m_oTextPr.Bold;
_lastFont.Italic = this.m_oTextPr.Italic;
break;
}
case fontslot_CS:
{
_lastFont.Name = _rfonts.CS.Name;
_lastFont.Index = _rfonts.CS.Index;
_lastFont.Size = this.m_oTextPr.FontSizeCS;
_lastFont.Bold = this.m_oTextPr.BoldCS;
_lastFont.Italic = this.m_oTextPr.ItalicCS;
break;
}
case fontslot_EastAsia:
{
_lastFont.Name = _rfonts.EastAsia.Name;
_lastFont.Index = _rfonts.EastAsia.Index;
_lastFont.Size = this.m_oTextPr.FontSize;
_lastFont.Bold = this.m_oTextPr.Bold;
_lastFont.Italic = this.m_oTextPr.Italic;
break;
}
case fontslot_HAnsi:
default:
{
_lastFont.Name = _rfonts.HAnsi.Name;
_lastFont.Index = _rfonts.HAnsi.Index;
_lastFont.Size = this.m_oTextPr.FontSize;
_lastFont.Bold = this.m_oTextPr.Bold;
_lastFont.Italic = this.m_oTextPr.Italic;
break;
}
}
if (undefined !== fontSizeKoef)
_lastFont.Size *= fontSizeKoef;
var _style = 0;
if (_lastFont.Italic)
_style += 2;
if (_lastFont.Bold)
_style += 1;
if (_lastFont.Name != _lastFont.SetUpName || _lastFont.Size != _lastFont.SetUpSize || _style != _lastFont.SetUpStyle)
{
_lastFont.SetUpName = _lastFont.Name;
_lastFont.SetUpSize = _lastFont.Size;
_lastFont.SetUpStyle = _style;
g_fontApplication.LoadFont(_lastFont.SetUpName, window.g_font_loader, this.m_oManager, _lastFont.SetUpSize, _lastFont.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo);
}
};
this.GetTextPr = function()
{
return this.m_oTextPr;
};
this.GetFont = function()
{
return this.m_oFont;
};
this.Measure = function(text)
{
var Width = 0;
var Height = 0;
var _code = text.charCodeAt(0);
if (null != this.LastFontOriginInfo.Replace)
_code = g_fontApplication.GetReplaceGlyph(_code, this.LastFontOriginInfo.Replace);
var Temp = this.m_oManager.MeasureChar( _code);
Width = Temp.fAdvanceX * 25.4 / 72;
Height = 0;//Temp.fHeight;
return { Width : Width, Height : Height };
};
this.Measure2 = function(text)
{
var Width = 0;
var _code = text.charCodeAt(0);
if (null != this.LastFontOriginInfo.Replace)
_code = g_fontApplication.GetReplaceGlyph(_code, this.LastFontOriginInfo.Replace);
var Temp = this.m_oManager.MeasureChar( _code );
Width = Temp.fAdvanceX * 25.4 / 72;
return { Width : Width, Ascent : (Temp.oBBox.fMaxY * 25.4 / 72), Height : ((Temp.oBBox.fMaxY - Temp.oBBox.fMinY) * 25.4 / 72),
WidthG: ((Temp.oBBox.fMaxX - Temp.oBBox.fMinX) * 25.4 / 72)};
};
this.MeasureCode = function(lUnicode)
{
var Width = 0;
var Height = 0;
if (null != this.LastFontOriginInfo.Replace)
lUnicode = g_fontApplication.GetReplaceGlyph(lUnicode, this.LastFontOriginInfo.Replace);
var Temp = this.m_oManager.MeasureChar( lUnicode );
Width = Temp.fAdvanceX * 25.4 / 72;
Height = 0;//Temp.fHeight;
return { Width : Width, Height : Height };
};
this.Measure2Code = function(lUnicode)
{
var Width = 0;
if (null != this.LastFontOriginInfo.Replace)
lUnicode = g_fontApplication.GetReplaceGlyph(lUnicode, this.LastFontOriginInfo.Replace);
var Temp = this.m_oManager.MeasureChar( lUnicode );
Width = Temp.fAdvanceX * 25.4 / 72;
return { Width : Width, Ascent : (Temp.oBBox.fMaxY * 25.4 / 72), Height : ((Temp.oBBox.fMaxY - Temp.oBBox.fMinY) * 25.4 / 72),
WidthG: ((Temp.oBBox.fMaxX - Temp.oBBox.fMinX) * 25.4 / 72)};
};
this.GetAscender = function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Ascender = this.m_oManager.m_lAscender;
return Ascender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
this.GetDescender = function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Descender = this.m_oManager.m_lDescender;
return Descender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
this.GetHeight = function()
{
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Height = this.m_oManager.m_lLineHeight;
return Height * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
};
}
function CTableOutlineDr()
{
var image_64 = "u7u7/7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u//6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6/4+Pj/+7u7v/9vb2//b29v/39/f/9/f3//f39/83aMT/9/f3//f39//39/f/9/f3//f39/+Pj4//u7u7//Ly8v/y8vL/8vLy//Pz8/83aMT/N2jE/zdoxP/z8/P/8/Pz//Pz8//z8/P/j4+P/7u7u//u7u7/7u7u/+7u7v/u7u7/7u7u/zdoxP/u7u7/7u7u/+7u7v/u7u7/7u7u/4+Pj/+7u7v/6Ojo/+jo6P83aMT/6enp/+np6f83aMT/6enp/+np6f83aMT/6enp/+np6f+Pj4//u7u7/+Pj4/83aMT/N2jE/zdoxP83aMT/N2jE/zdoxP83aMT/N2jE/zdoxP/k5OT/j4+P/7u7u//o6Oj/6Ojo/zdoxP/o6Oj/6Ojo/zdoxP/o6Oj/6Ojo/zdoxP/o6Oj/6Ojo/4+Pj/+7u7v/7e3t/+3t7f/t7e3/7e3t/+3t7f83aMT/7e3t/+zs7P/s7Oz/7Ozs/+zs7P+Pj4//u7u7//Ly8v/y8vL/8vLy//Ly8v83aMT/N2jE/zdoxP/x8fH/8fHx//Hx8f/x8fH/j4+P/7u7u//19fX/9fX1//X19f/19fX/9fX1/zdoxP/19fX/9fX1//X19f/19fX/9fX1/4+Pj/+7u7v/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//j4+P+Pj4//u7u7/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/w==";
......@@ -1447,74 +1684,6 @@ function CDrawingDocument(drawingObjects)
this.drawingObjects = drawingObjects;
this.IsLockObjectsEnable = false;
this.cursorMarkerFormat = "";
if (bIsIE)
{
// Пути указаны относительно html в меню, не надо их исправлять
// и коммитить на пути относительно тестового меню
this.cursorMarkerFormat = "url(../../../sdk/Common/Images/marker_format.cur), pointer";
}
else if (window.opera)
{
this.cursorMarkerFormat = "pointer";
}
else
{
this.cursorMarkerFormat = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAACXBIWXMAAAsTAAALEwEAmpwYAAAK\
T2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AU\
kSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXX\
Pues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgAB\
eNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAt\
AGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3\
AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dX\
Lh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+\
5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk\
5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd\
0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA\
4vcAAPK7b8HUKAgDgGi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m_oWordControl = null;
this.m_oLogicDocument = null;
this.m_oDocumentRenderer = null;
......@@ -1630,23 +1799,6 @@ function CDrawingDocument(drawingObjects)
this.Native["DD_SetCursorType"](sType, Data);
else
this.Native["DD_SetCursorType"](this.m_sLockedCursorType, Data);
// if ("" == this.m_sLockedCursorType)
// {
// if (this.m_oWordControl.m_oApi.isPaintFormat && "default" == sType)
// this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor = kCurFormatPainterWord;
// else if (this.m_oWordControl.m_oApi.isMarkerFormat && "default" == sType)
// this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor = this.cursorMarkerFormat;
// else
// this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor = sType;
// }
// else
// this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor = this.m_sLockedCursorType;
//
// if ( "undefined" === typeof(Data) || null === Data )
// Data = new CMouseMoveData();
//
// editor.sync_MouseMoveCallback( Data );
}
this.LockCursorType = function(sType)
{
......
......@@ -123,10 +123,8 @@ function CBrush()
this.Type = 0;
}
var bIsChrome = AscCommon.AscBrowser.isChrome;
var bIsSafari = AscCommon.AscBrowser.isSafari;
var bIsIE = AscCommon.AscBrowser.isIE;
var bIsAndroid = AscCommon.AscBrowser.isAndroid;
var MATRIX_ORDER_PREPEND = 0;
var MATRIX_ORDER_APPEND = 1;
function deg2rad(deg){
return deg * Math.PI / 180.0;
......@@ -135,6 +133,207 @@ function rad2deg(rad){
return rad * 180.0 / Math.PI;
}
function CMatrix()
{
this.sx = 1.0;
this.shx = 0.0;
this.shy = 0.0;
this.sy = 1.0;
this.tx = 0.0;
this.ty = 0.0;
}
CMatrix.prototype =
{
Reset : function(){
this.sx = 1.0;
this.shx = 0.0;
this.shy = 0.0;
this.sy = 1.0;
this.tx = 0.0;
this.ty = 0.0;
},
// ���������
Multiply : function(matrix,order){
if (MATRIX_ORDER_PREPEND == order)
{
var m = new CMatrix();
m.sx = matrix.sx;
m.shx = matrix.shx;
m.shy = matrix.shy;
m.sy = matrix.sy;
m.tx = matrix.tx;
m.ty = matrix.ty;
m.Multiply(this, MATRIX_ORDER_APPEND);
this.sx = m.sx;
this.shx = m.shx;
this.shy = m.shy;
this.sy = m.sy;
this.tx = m.tx;
this.ty = m.ty;
}
else
{
var t0 = this.sx * matrix.sx + this.shy * matrix.shx;
var t2 = this.shx * matrix.sx + this.sy * matrix.shx;
var t4 = this.tx * matrix.sx + this.ty * matrix.shx + matrix.tx;
this.shy = this.sx * matrix.shy + this.shy * matrix.sy;
this.sy = this.shx * matrix.shy + this.sy * matrix.sy;
this.ty = this.tx * matrix.shy + this.ty * matrix.sy + matrix.ty;
this.sx = t0;
this.shx = t2;
this.tx = t4;
}
return this;
},
// � ������ ������� ������ ���������� (��� �������� �����������)
Translate : function(x,y,order){
var m = new CMatrix();
m.tx = x;
m.ty = y;
this.Multiply(m,order);
},
Scale : function(x,y,order){
var m = new CMatrix();
m.sx = x;
m.sy = y;
this.Multiply(m,order);
},
Rotate : function(a,order){
var m = new CMatrix();
var rad = deg2rad(a);
m.sx = Math.cos(rad);
m.shx = Math.sin(rad);
m.shy = -Math.sin(rad);
m.sy = Math.cos(rad);
this.Multiply(m,order);
},
RotateAt : function(a,x,y,order){
this.Translate(-x,-y,order);
this.Rotate(a,order);
this.Translate(x,y,order);
},
// determinant
Determinant : function(){
return this.sx * this.sy - this.shy * this.shx;
},
// invert
Invert : function(){
var det = this.Determinant();
if (0.0001 > Math.abs(det))
return;
var d = 1 / det;
var t0 = this.sy * d;
this.sy = this.sx * d;
this.shy = -this.shy * d;
this.shx = -this.shx * d;
var t4 = -this.tx * t0 - this.ty * this.shx;
this.ty = -this.tx * this.shy - this.ty * this.sy;
this.sx = t0;
this.tx = t4;
return this;
},
// transform point
TransformPointX : function(x,y){
return x * this.sx + y * this.shx + this.tx;
},
TransformPointY : function(x,y){
return x * this.shy + y * this.sy + this.ty;
},
// calculate rotate angle
GetRotation : function(){
var x1 = 0.0;
var y1 = 0.0;
var x2 = 1.0;
var y2 = 0.0;
this.TransformPoint(x1, y1);
this.TransformPoint(x2, y2);
var a = Math.atan2(y2-y1,x2-x1);
return rad2deg(a);
},
// ������� ���������
CreateDublicate : function(){
var m = new CMatrix();
m.sx = this.sx;
m.shx = this.shx;
m.shy = this.shy;
m.sy = this.sy;
m.tx = this.tx;
m.ty = this.ty;
return m;
},
IsIdentity : function()
{
if (this.sx == 1.0 &&
this.shx == 0.0 &&
this.shy == 0.0 &&
this.sy == 1.0 &&
this.tx == 0.0 &&
this.ty == 0.0)
{
return true;
}
return false;
},
IsIdentity2 : function()
{
if (this.sx == 1.0 &&
this.shx == 0.0 &&
this.shy == 0.0 &&
this.sy == 1.0)
{
return true;
}
return false;
}
};
function CMatrixL()
{
this.sx = 1.0;
this.shx = 0.0;
this.shy = 0.0;
this.sy = 1.0;
this.tx = 0.0;
this.ty = 0.0;
}
CMatrixL.prototype =
{
CreateDublicate : function()
{
var m = new CMatrixL();
m.sx = this.sx;
m.shx = this.shx;
m.shy = this.shy;
m.sy = this.sy;
m.tx = this.tx;
m.ty = this.ty;
return m;
},
Reset : function()
{
this.sx = 1.0;
this.shx = 0.0;
this.shy = 0.0;
this.sy = 1.0;
this.tx = 0.0;
this.ty = 0.0;
},
TransformPointX : function(x,y)
{
return x * this.sx + y * this.shx + this.tx;
},
TransformPointY : function(x,y)
{
return x * this.shy + y * this.sy + this.ty;
}
};
function CGlobalMatrixTransformer()
{
this.TranslateAppend = function(m, _tx, _ty)
......@@ -1035,7 +1234,7 @@ CGraphics.prototype =
if (_info.SrcBold) flag |= 0x04;
if (_info.SrcItalic) flag |= 0x08;
AscCommon.g_oTextMeasurer.Measurer["LoadFont"](_info.Path, _info.FaceIndex, font.FontSize, flag);
g_oTextMeasurer.Measurer["LoadFont"](_info.Path, _info.FaceIndex, font.FontSize, flag);
this.Native["PD_LoadFont"](_info.Path, _info.FaceIndex, font.FontSize, flag);
},
......@@ -1121,7 +1320,7 @@ CGraphics.prototype =
if (_info.SrcBold) flag |= 0x04;
if (_info.SrcItalic) flag |= 0x08;
AscCommon.g_oTextMeasurer.Measurer["LoadFont"](_info.Path, _info.FaceIndex, _lastFont.SetUpSize, flag);
g_oTextMeasurer.Measurer["LoadFont"](_info.Path, _info.FaceIndex, _lastFont.SetUpSize, flag);
this.Native["PD_LoadFont"](_info.Path, _info.FaceIndex, _lastFont.SetUpSize, flag);
}
......
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL 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 more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
var editor = undefined;
var window = {};
var navigator = {};
......@@ -540,114 +515,18 @@ window["NativeCorrectImageUrlOnCopy"] = function(url) {
return window["native"]["CorrectImageUrlOnCopy"](url);
};
// 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;
};
}
//--------------------------------------------------------------------------------
// font engine
//--------------------------------------------------------------------------------
var FONT_ITALIC_ANGLE = 0.3090169943749;
var FT_ENCODING_UNICODE = 1970170211;
var FT_ENCODING_NONE = 0;
var FT_ENCODING_MS_SYMBOL = 1937337698;
var FT_ENCODING_APPLE_ROMAN = 1634889070;
var LOAD_MODE = 40970;
var REND_MODE = 0;
var FontStyle = {
FontStyleRegular: 0,
FontStyleBold: 1,
......@@ -656,14 +535,19 @@ var FontStyle = {
FontStyleUnderline: 4,
FontStyleStrikeout: 8
};
function CFontManager() {
var EGlyphState = {
glyphstateNormal: 0,
glyphstateDeafault: 1,
glyphstateMiss: 2
};
window['AscFonts'].CFontManager = function CFontManager() {
this.m_oLibrary = {};
this.Initialize = function(){};
this.ClearFontsRasterCache = function(){};
}
};
window["use_native_fonts_only"] = true;
window["ftm"] = FT_Memory;
// FT_Common
function _FT_Common() {
......@@ -3243,7 +3127,7 @@ function OfflineEditor () {
worksheet._drawSelection();
}
AscFormat.DrawingArea.prototype.drawSelection = function(drawingDocument) {
window['AscFormat'].DrawingArea.prototype.drawSelection = function(drawingDocument) {
offlineEditor.flushTextMeasurer();
......@@ -3317,7 +3201,7 @@ function OfflineEditor () {
}
};
Path.prototype.drawSmart = function(shape_drawer) {
window['AscFormat'].Path.prototype.drawSmart = function(shape_drawer) {
var _graphics = shape_drawer.Graphics;
var _full_trans = _graphics.m_oFullTransform;
......@@ -3459,7 +3343,6 @@ function OfflineEditor () {
};
var asc_Range = window["Asc"].Range;
var asc_round = window["Asc"].round;
var asc_typeof = window["Asc"].typeOf;
/**
......@@ -7613,3 +7496,5 @@ function offline_apply_event(type,params) {
return _return;
}
window['AscFonts'].FT_Common = FT_Common;
......@@ -689,3 +689,7 @@ function FT_Stream(data, size)
}
window["fts"] = FT_Stream;
window['AscFonts'].FT_Memory = FT_Memory;
window['AscFonts'].FT_Stream = FT_Stream;
window['AscFonts'].g_memory = g_memory;
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