Commit 44bcfd94 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

delete newTextFormatAdditional

delete theme & tint in fragments

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52002 954022d7-b5bf-4e40-9824-e11837661b57
parent 00dbfaee
......@@ -2931,6 +2931,7 @@ CCellValue.prototype =
var aResult = new Array();
if(null == sText && null == aText)
sText = "";
var color;
var cellfont;
var xfs = this.cell.getStyle();
if(null != xfs && null != xfs.font)
......@@ -2941,13 +2942,11 @@ CCellValue.prototype =
var oNewItem = {text: null, format: null, sFormula: null, sId: null, theme: null, tint: null};
oNewItem.text = sText;
oNewItem.format = cellfont.clone();
//todo
if(oNewItem.format.c instanceof ThemeColor)
color = oNewItem.format.c;
if(color instanceof ThemeColor)
{
oNewItem.theme = oNewItem.format.c.theme;
oNewItem.tint = oNewItem.format.c.tint;
//для посещенных гиперссылок
if(g_nColorHyperlink == oNewItem.theme && null == oNewItem.tint)
if(g_nColorHyperlink == color.theme && null == color.tint)
{
var nRow = this.cell.oId.getRow0();
var nCol = this.cell.oId.getCol0();
......@@ -2955,15 +2954,13 @@ CCellValue.prototype =
if(null != hyperlink && hyperlink.data.getVisited())
{
oNewItem.format.c = g_oColorManager.getThemeColor(g_nColorHyperlinkVisited, null);
oNewItem.theme = g_nColorHyperlinkVisited;
}
}
}
oNewItem.format.skip = false;
oNewItem.format.repeat = false;
aResult.push(oNewItem);
}
else if(null != aText){
} else if(null != aText){
for(var i = 0; i < aText.length; i++){
var oNewItem = {text: null, format: null, sFormula: null, sId: null, theme: null, tint: null};
var oCurtext = aText[i];
......@@ -2976,13 +2973,11 @@ CCellValue.prototype =
if(null != oCurtext.format)
oCurFormat.set(oCurtext.format);
oNewItem.format = oCurFormat;
//todo
if(oNewItem.format.c instanceof ThemeColor)
color = oNewItem.format.c;
if(color instanceof ThemeColor)
{
oNewItem.theme = oNewItem.format.c.theme;
oNewItem.tint = oNewItem.format.c.tint;
//для посещенных гиперссылок
if(g_nColorHyperlink == oNewItem.theme && null == oNewItem.tint)
if(g_nColorHyperlink == color.theme && null == color.tint)
{
var nRow = this.cell.oId.getRow0();
var nCol = this.cell.oId.getCol0();
......@@ -2990,7 +2985,6 @@ CCellValue.prototype =
if(null != hyperlink && hyperlink.data.getVisited())
{
oNewItem.format.c = g_oColorManager.getThemeColor(g_nColorHyperlinkVisited, null);
oNewItem.theme = g_nColorHyperlinkVisited;
}
}
}
......@@ -3103,36 +3097,6 @@ CCellValue.prototype =
for(var i = 0, length = aVal.length; i < length; i++){
var item = aVal[i];
var format = item.format;
if(null != item.theme)
format.c = g_oColorManager.getThemeColor(item.theme, item.tint);
else if(null != format && null != format.c)
{
var color = format.c;
format.c = null;
if("string" == typeof(color))
{
//todo убрать это преобразование
//переводим обратно в число
if(0 == color.indexOf("#"))
{
var hex = color.substring(1);
if(hex.length == 3)
hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
if(hex.length == 6)
{
var r = parseInt("0x" + hex.substring(0,2));
var g = parseInt("0x" + hex.substring(2,4));
var b = parseInt("0x" + hex.substring(4,6));
format.c = new RgbColor(r << 16 | g << 8 | b);
}
}
}
else if("number" == typeof(color))
format.c = new RgbColor(color);
else if(color instanceof RgbColor || color instanceof ThemeColor)
format.c = color;
}
var oNewElem = new CCellValueMultiText();
oNewElem.text = item.text;
oNewElem.format = new Font();
......
......@@ -93,7 +93,6 @@
this.canvas = undefined;
this.canvasOverlay = undefined;
this.cursor = undefined;
this.graphicObjectCursor = undefined;
this.cursorTID = undefined;
this.cursorPos = 0;
this.topLineIndex = 0;
......@@ -115,7 +114,6 @@
this.hasCursor = false;
this.hasFocus = false;
this.newTextFormat = undefined;
this.newTextFormatAdditional = undefined;
this.selectionTimer = undefined;
this.enableKeyEvents = true;
this.isTopLineActive = false;
......@@ -320,8 +318,7 @@
if (first && last) {
for (i = first.index; i <= last.index; ++i) {
var elem = opt.fragments[i];
var valTmp = t._setFormatProperty(elem.format, prop, val, elem);
var valTmp = t._setFormatProperty(elem.format, prop, val);
// Только для горячих клавиш
if (null === val)
val = valTmp;
......@@ -344,11 +341,9 @@
first = t._findFragmentToInsertInto(t.cursorPos);
if (first) {
if (!t.newTextFormat) {
var elem = opt.fragments[first.index];
t.newTextFormat = t._cloneFormat(elem.format);
t.newTextFormatAdditional = {theme: elem.theme, tint: elem.tint};
t.newTextFormat = t._cloneFormat(opt.fragments[first.index].format);
}
t._setFormatProperty(t.newTextFormat, prop, val, t.newTextFormatAdditional);
t._setFormatProperty(t.newTextFormat, prop, val);
}
}
......@@ -636,7 +631,6 @@
t._cleanFragments(opt.fragments);
t.textRender.setString(opt.fragments, t.textFlags);
delete t.newTextFormat;
delete t.newTextFormatAdditional;
if (opt.zoom > 0) {
t.overlayCtx.setFont(t.drawingCtx.getFont());
......@@ -1262,14 +1256,8 @@
if (t.newTextFormat) {
var oNewObj = {format: t.newTextFormat, text: str, theme: null, tint: null};
if(null != t.newTextFormatAdditional)
{
oNewObj.theme = t.newTextFormatAdditional.theme;
oNewObj.tint = t.newTextFormatAdditional.tint;
}
t._addFragments([oNewObj], pos);
delete t.newTextFormat;
delete t.newTextFormatAdditional;
} else {
f = t._findFragmentToInsertInto(pos);
if (f) {
......@@ -1426,8 +1414,8 @@
Array.prototype.splice.apply(
opt.fragments,
[f.index, 1].concat([
{format: t._cloneFormat(fr.format), text: fr.text.slice(0, pos - f.begin), theme: fr.theme, tint: fr.tint},
{format: t._cloneFormat(fr.format), text: fr.text.slice(pos - f.begin), theme: fr.theme, tint: fr.tint}]));
{format: t._cloneFormat(fr.format), text: fr.text.slice(0, pos - f.begin)},
{format: t._cloneFormat(fr.format), text: fr.text.slice(pos - f.begin)}]));
}
},
......@@ -1503,9 +1491,8 @@
{
var fr = opt.fragments[i];
var nextFr = opt.fragments[i + 1];
if(t._isEqualFormats(fr.format, nextFr.format) && fr.theme == nextFr.theme && fr.tint == nextFr.tint) {
opt.fragments.splice(i, 2,
{format: fr.format, text: fr.text + nextFr.text, theme: fr.theme, tint: fr.tint});
if(t._isEqualFormats(fr.format, nextFr.format)) {
opt.fragments.splice(i, 2, {format: fr.format, text: fr.text + nextFr.text});
continue;
}
}
......@@ -1542,7 +1529,7 @@
f1.c === f2.c && f1.va === f2.va;
},
_setFormatProperty: function (format, prop, val, formatAdditional) {
_setFormatProperty: function (format, prop, val) {
switch (prop) {
case "fn": format.fn = val; break;
case "fs": format.fs = val; break;
......@@ -1565,13 +1552,6 @@
case "fa": format.va = val; break;
case "c":
format.c = val;
formatAdditional.theme = null;
formatAdditional.tint = null;
if(val instanceof ThemeColor)
{
formatAdditional.theme = val.theme;
formatAdditional.tint = val.tint;
}
break;
case "changeFontSize":
var newFontSize = asc_incDecFonSize(val, format.fs);
......
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