Commit c26e1c3d authored by Alexander.Trofimov's avatar Alexander.Trofimov

move getColorThemeByIndex to editorscommon

parent c55304c4
...@@ -2888,7 +2888,7 @@ var editor; ...@@ -2888,7 +2888,7 @@ var editor;
var onChangeColorScheme = function (res) { var onChangeColorScheme = function (res) {
if (res) { if (res) {
var theme = t.wbModel.theme; var theme = t.wbModel.theme;
var scheme = t.getColorThemeByIndex(index); var scheme = AscCommon.getColorThemeByIndex(index);
if (!scheme) { if (!scheme) {
index -= AscCommon.g_oUserColorScheme.length; index -= AscCommon.g_oUserColorScheme.length;
if (index < 0 || index >= theme.extraClrSchemeLst.length) { if (index < 0 || index >= theme.extraClrSchemeLst.length) {
......
...@@ -1092,44 +1092,6 @@ ...@@ -1092,44 +1092,6 @@
this.sendEvent("asc_onSendThemeColorSchemes", result); this.sendEvent("asc_onSendThemeColorSchemes", result);
return result; return result;
}; };
baseEditorsApi.prototype.getColorThemeByIndex = function (index) {
var _c, scheme = null;
var oColorScheme = AscCommon.g_oUserColorScheme;
if (index >= oColorScheme.length) {
return scheme;
}
scheme = new AscFormat.ClrScheme();
var tmp = oColorScheme[index];
scheme.name = tmp.name;
_c = tmp.get_dk1();
scheme.colors[8] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_lt1();
scheme.colors[12] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_dk2();
scheme.colors[9] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_lt2();
scheme.colors[13] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent1();
scheme.colors[0] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent2();
scheme.colors[1] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent3();
scheme.colors[2] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent4();
scheme.colors[3] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent5();
scheme.colors[4] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent6();
scheme.colors[5] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_hlink();
scheme.colors[11] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_folHlink();
scheme.colors[10] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
return scheme;
};
// plugins // plugins
baseEditorsApi.prototype.asc_pluginsRegister = function(basePath, plugins) baseEditorsApi.prototype.asc_pluginsRegister = function(basePath, plugins)
......
...@@ -2285,7 +2285,46 @@ CUserCacheColor.prototype.init = function(nColor) { ...@@ -2285,7 +2285,46 @@ CUserCacheColor.prototype.init = function(nColor) {
} }
} }
var g_oIdCounter = new CIdCounter(); function getColorThemeByIndex(index) {
var _c, scheme = null;
var oColorScheme = AscCommon.g_oUserColorScheme;
if (index >= oColorScheme.length) {
return scheme;
}
scheme = new AscFormat.ClrScheme();
var tmp = oColorScheme[index];
scheme.name = tmp.name;
_c = tmp.get_dk1();
scheme.colors[8] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_lt1();
scheme.colors[12] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_dk2();
scheme.colors[9] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_lt2();
scheme.colors[13] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent1();
scheme.colors[0] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent2();
scheme.colors[1] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent3();
scheme.colors[2] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent4();
scheme.colors[3] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent5();
scheme.colors[4] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_accent6();
scheme.colors[5] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_hlink();
scheme.colors[11] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
_c = tmp.get_folHlink();
scheme.colors[10] = AscFormat.CreateUniColorRGB(_c.r, _c.g, _c.b);
return scheme;
}
var g_oIdCounter = new CIdCounter();
window["SetDoctRendererParams"] = function(_params) window["SetDoctRendererParams"] = function(_params)
{ {
...@@ -2332,6 +2371,7 @@ window["SetDoctRendererParams"] = function(_params) ...@@ -2332,6 +2371,7 @@ window["SetDoctRendererParams"] = function(_params)
window["AscCommon"].CContentChangesElement = CContentChangesElement; window["AscCommon"].CContentChangesElement = CContentChangesElement;
window["AscCommon"].loadSdk = loadSdk; window["AscCommon"].loadSdk = loadSdk;
window["AscCommon"].getColorThemeByIndex = getColorThemeByIndex;
window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls; window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls;
window["AscCommon"].FormulaTablePartInfo = FormulaTablePartInfo; window["AscCommon"].FormulaTablePartInfo = FormulaTablePartInfo;
......
...@@ -4204,7 +4204,7 @@ background-repeat: no-repeat;\ ...@@ -4204,7 +4204,7 @@ background-repeat: no-repeat;\
asc_docs_api.prototype.ChangeColorScheme = function(index_scheme) asc_docs_api.prototype.ChangeColorScheme = function(index_scheme)
{ {
var scheme = this.getColorThemeByIndex(index_scheme); var scheme = AscCommon.getColorThemeByIndex(index_scheme);
if (!scheme) if (!scheme)
{ {
index_scheme -= AscCommon.g_oUserColorScheme.length; index_scheme -= AscCommon.g_oUserColorScheme.length;
......
...@@ -6548,7 +6548,7 @@ background-repeat: no-repeat;\ ...@@ -6548,7 +6548,7 @@ background-repeat: no-repeat;\
if (this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_ColorScheme) === false) if (this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_ColorScheme) === false)
{ {
var scheme = this.getColorThemeByIndex(index_scheme); var scheme = AscCommon.getColorThemeByIndex(index_scheme);
if (!scheme) if (!scheme)
{ {
index_scheme -= AscCommon.g_oUserColorScheme.length; index_scheme -= AscCommon.g_oUserColorScheme.length;
......
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