Commit 5c73516b authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Вынес extendClass в common.

Убрал inherit, оставил только extendClass

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58003 954022d7-b5bf-4e40-9824-e11837661b57
parent 8cf7fb6e
......@@ -670,4 +670,27 @@ else
+BEx2UkMzPD4mJkIiiRemBQr6euCUG64rG1bAMB5nhRzqCgjWmsv5ziOGHSJrbV+PZsRmqYpleah\
FDqVBWmtq5oV65JdxpgqUKzTcf0ZEOOGl0Dsui4R+Ni+7wksOZAk+75nycQ6fl8S054+DEN1P25L\
M8Zg27Zb0DiOj6CPDE7TlB1rMgpAT2MJpEjSOff436zrGvjOuSCm+PL6z/MMAFiWJZirfz0j3wEA\
emp/gv47IxYAAAAASUVORK5CYII=') 14 8, pointer";
\ No newline at end of file
emp/gv47IxYAAAAASUVORK5CYII=') 14 8, pointer";
(
/**
* @param {Window} window
* @param {undefined} undefined
*/
function (window, undefined) {
/*
* Import
* -----------------------------------------------------------------------------
*/
var asc = window["Asc"] ? window["Asc"] : (window["Asc"] = {});
function extendClass (Child, Parent) {
var F = function() { };
F.prototype = Parent.prototype;
Child.prototype = new F();
Child.prototype.constructor = Child;
Child.superclass = Parent.prototype;
}
asc.extendClass = extendClass;
}
)(window);
\ No newline at end of file
......@@ -100,21 +100,18 @@
strictEqual(Asc.round(-.1-.2-.9+.2), -1, "Asc.round(.1+.2+.9-.2)"); // -1.0000...2
});
test("Asc.inherit", function test_inherit() {
test("Asc.extendClass", function test_extendClass() {
function Base(b1) {
this.b1 = b1;
}
Base.prototype = {
mb1: function (b1) {this.b1=b1;}
};
Base.prototype.mb1 = function (b1) {this.b1=b1;};
function Child(b1, c1) {
Child.superclass.constructor.call(this, b1);
this.c1 = c1;
}
Asc.inherit(Child, Base, {
mc1: function (c1) {this.c1=c1;}
});
Asc.extendClass(Child, Base);
Child.prototype.mc1 = function (c1) {this.c1=c1;};
var x = new Child(1, 2);
ok(x !== undefined, "x = new Child(1, 2)");
......@@ -130,15 +127,13 @@
equal(x.c1, 4, "x.c1");
});
test("Asc.inherit with fabric method", function test_inherit2() {
test("Asc.extendClass with fabric method", function test_extendClass2() {
function Base(b1) {
if ( !(this instanceof Base) ) {return new Base(b1);}
this.b1 = b1;
return this;
}
Base.prototype = {
mb1: function (b1) {this.b1=b1;}
};
Base.prototype.mb1 = function (b1) {this.b1=b1;};
function Child(b1, c1) {
if ( !(this instanceof Child) ) {return new Child(b1, c1);}
......@@ -146,9 +141,8 @@
this.c1 = c1;
return this;
}
Asc.inherit(Child, Base, {
mc1: function (c1) {this.c1=c1;}
});
Asc.extendClass(Child, Base);
Child.prototype.mc1 = function (c1) {this.c1=c1;};
var x = Child(1, 2);
ok(x !== undefined, "x = Child(1, 2)");
......
......@@ -5,7 +5,8 @@
* Author: Dmitry.Sokolov@avsmedia.net
* Date: Jan 25, 2012
*/
( /**
(
/**
* @param {jQuery} $
* @param {Window} window
* @param {undefined} undefined
......@@ -123,16 +124,6 @@
return aSizes[i];
}
function inherit(child, parent, childProto) {
parent.prototype.constructor = parent;
var F = function () {};
F.prototype = parent.prototype;
child.prototype = $.extend(true, new F(), childProto);
child.prototype.constructor = child;
child.superclass = parent.prototype;
}
// Определяет времени работы функции
function profileTime(fn/*[, arguments]*/) {
var start, end, arg = [], i;
......@@ -399,7 +390,7 @@
this.startRow = 0; // Активная ячейка в выделении
this._updateAdditionalData();
}
extendClass(ActiveRange, Range);
asc.extendClass(ActiveRange, Range);
ActiveRange.prototype.assign = function () {
ActiveRange.superclass.assign.apply(this, arguments);
......@@ -518,7 +509,7 @@
this.r2Abs = false;
this.c2Abs = false;
}
extendClass(FormulaRange, Range);
asc.extendClass(FormulaRange, Range);
FormulaRange.prototype.clone = function(){
var oRes = new FormulaRange(FormulaRange.superclass.clone.apply(this, arguments));
oRes.r1Abs = this.r1Abs;
......@@ -821,15 +812,6 @@
return val.replace(/^\s+|\s+$/g,'');
}
function extendClass(Child, Parent){
var F = function() { };
F.prototype = Parent.prototype;
Child.prototype = new F();
Child.prototype.constructor = Child;
Child.superclass = Parent.prototype;
}
function isNumber(val) {
var valTrim = trim(val);
return (valTrim - 0) == valTrim && valTrim.length > 0;
......@@ -1502,14 +1484,12 @@
window["Asc"].floor = floor;
window["Asc"].ceil = ceil;
window["Asc"].incDecFonSize = incDecFonSize;
window["Asc"].inherit = inherit;
window["Asc"].outputDebugStr = outputDebugStr;
window["Asc"].isEqual = isEqual;
window["Asc"].profileTime = profileTime;
window["Asc"].isNumber = isNumber;
window["Asc"].isNumberInfinity = isNumberInfinity;
window["Asc"].trim = trim;
window["Asc"].extendClass = extendClass;
window["Asc"].arrayToLowerCase = arrayToLowerCase;
window["Asc"].isFixedWidthCell = isFixedWidthCell;
window["Asc"].truncFracPart = truncFracPart;
......
......@@ -26,7 +26,6 @@
var asc_lastidx = asc.lastIndexOf;
var asc_HL = asc.HandlersList;
var asc_TR = asc.CellTextRender;
var asc_incDecFonSize = asc.incDecFonSize;
......@@ -184,7 +183,7 @@
// create text render
t.drawingCtx = new asc.DrawingContext({canvas: t.canvas, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
t.overlayCtx = new asc.DrawingContext({canvas: t.canvasOverlay, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
t.textRender = asc_TR(t.drawingCtx);
t.textRender = new asc.CellTextRender(t.drawingCtx);
t.textRender.setDefaultFont(settings.font.clone());
// bind event handlers
......
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