Commit 7ea49c85 authored by alexey.musinov's avatar alexey.musinov

color schemas event to global

parent f32cc085
File mode changed from 100644 to 100755
......@@ -2300,6 +2300,15 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
break;
}
case 2415: // ASC_MENU_EVENT_TYPE_CHANGE_COLOR_SCHEME
{
if (undefined !== _params) {
var indexScheme = parseInt(_params);
this.ChangeColorScheme(indexScheme);
}
break;
}
default:
break;
}
......@@ -4322,6 +4331,22 @@ function asc_menu_WriteHyperPr(_hyperPr, _stream)
_stream["WriteByte"](255);
};
function asc_WriteColorSchemes(schemas, s) {
s["WriteLong"](schemas.length);
for (var i = 0; i < schemas.length; ++i) {
s["WriteString2"](schemas[i].get_name());
var colors = schemas[i].get_colors();
s["WriteLong"](colors.length);
for (var j = 0; j < colors.length; ++j) {
asc_menu_WriteColor(0, colors[j], s);
}
}
}
///////////////////////////////////////////////////////////////////////
......@@ -5692,4 +5717,128 @@ AscCommon.ChartPreviewManager.prototype.getChartPreviews = function(chartType)
_api.WordControl.m_oDrawingDocument.Native["DD_EndNativeDraw"](_stream);
}
}
};
\ No newline at end of file
};
// additional
Asc['asc_docs_api'].prototype.__SendThemeColorScheme = function()
{
var infos = [];
var _index = 0;
var _c = null;
// user scheme
var oColorScheme = AscCommon.g_oUserColorScheme;
var _count_defaults = oColorScheme.length;
for (var i = 0; i < _count_defaults; ++i)
{
var _obj = oColorScheme[i];
infos[_index] = new AscCommon.CAscColorScheme();
infos[_index].Name = _obj.name;
_c = _obj.dk1;
infos[_index].Colors[0] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.lt1;
infos[_index].Colors[1] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.dk2;
infos[_index].Colors[2] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.lt2;
infos[_index].Colors[3] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.accent1;
infos[_index].Colors[4] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.accent2;
infos[_index].Colors[5] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.accent3;
infos[_index].Colors[6] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.accent4;
infos[_index].Colors[7] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.accent5;
infos[_index].Colors[8] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.accent6;
infos[_index].Colors[9] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.hlink;
infos[_index].Colors[10] = new CColor(_c.R, _c.G, _c.B);
_c = _obj.folHlink;
infos[_index].Colors[11] = new CColor(_c.R, _c.G, _c.B);
++_index;
}
// theme colors
var _theme = this.WordControl.m_oLogicDocument.theme;
var _extra = _theme.extraClrSchemeLst;
var _count = _extra.length;
var _rgba = {R:0, G: 0, B: 0, A: 255};
for (var i = 0; i < _count; ++i)
{
var _scheme = _extra[i].clrScheme;
infos[_index] = new AscCommon.CAscColorScheme();
infos[_index].Name = _scheme.name;
_scheme.colors[8].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[8].RGBA;
infos[_index].Colors[0] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[12].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[12].RGBA;
infos[_index].Colors[1] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[9].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[9].RGBA;
infos[_index].Colors[2] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[13].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[13].RGBA;
infos[_index].Colors[3] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[0].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[0].RGBA;
infos[_index].Colors[4] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[1].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[1].RGBA;
infos[_index].Colors[5] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[2].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[2].RGBA;
infos[_index].Colors[6] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[3].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[3].RGBA;
infos[_index].Colors[7] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[4].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[4].RGBA;
infos[_index].Colors[8] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[5].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[5].RGBA;
infos[_index].Colors[9] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[11].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[11].RGBA;
infos[_index].Colors[10] = new CColor(_c.R, _c.G, _c.B);
_scheme.colors[10].Calculate(_theme, null, null, null, _rgba);
_c = _scheme.colors[10].RGBA;
infos[_index].Colors[11] = new CColor(_c.R, _c.G, _c.B);
_index++;
}
this.WordControl.m_oApi.sync_SendThemeColorSchemes(infos);
};
......@@ -339,6 +339,7 @@ function NativeOpenFile()
if (window.NATIVE_DOCUMENT_TYPE == "presentation" || window.NATIVE_DOCUMENT_TYPE == "document")
{
_api = new window["Asc"]["asc_docs_api"]("");
_api.asc_nativeOpenFile(doc_bin);
}
else
......@@ -369,6 +370,16 @@ function NativeOpenFile2(_params)
if (_api.NativeAfterLoad)
_api.NativeAfterLoad();
_api.__SendThemeColorScheme();
var schemes = _api.get_PropertyThemeColorSchemes();
if (schemes) {
var st = global_memory_stream_menu;
st["ClearNoAttack"]();
asc_WriteColorSchemes(schemes, st);
window["native"]["OnCallMenuEvent"](2404, st); // ASC_MENU_EVENT_TYPE_COLOR_SCHEMES
}
}
else
{
......@@ -806,4 +817,5 @@ window.native.Call_VR_Table = function(_params, _cols, _margins, _rows)
window.native.Call_Menu_Event = function(type, _params)
{
return _api.Call_Menu_Event(type, _params);
};
\ No newline at end of file
};
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